s3:wscript: fix flex and bison detection message when not installed
authorRalph Boehme <slow@samba.org>
Fri, 29 Mar 2019 17:20:52 +0000 (18:20 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 24 Apr 2019 18:32:14 +0000 (18:32 +0000)
If flex or bison are not installed, conf.env['BISON'] and
conf.env['FLEX'] respectively return an empty string, so
conf.CHECK_COMMAND() runs

 $ /bin/sh -c " --version  | head -n1"

and

 $ /bin/sh -c " --version"

which results in the following message

  /bin/sh: []: command not found

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/wscript

index dcd2a303063394d0afa41b8c159f3ec6f2aa98ba..6f50f5bc552c4d96574ee5536c4e4b04ffdb6d34 100644 (file)
@@ -1652,18 +1652,20 @@ main() {
 
     Logs.info("Checking for bison")
     bison.configure(conf)
-    conf.CHECK_COMMAND('%s --version  | head -n1' % conf.env['BISON'],
-                       msg='Using bison version',
-                       define=None,
-                       on_target=False)
+    if conf.env['BISON']:
+        conf.CHECK_COMMAND('%s --version  | head -n1' % conf.env.BISON,
+                           msg='Using bison version',
+                           define=None,
+                           on_target=False)
 
     Logs.info("Checking for flex")
     conf.find_program('flex', var='FLEX')
-    conf.env.FLEXFLAGS = ['-t']
-    conf.CHECK_COMMAND('%s --version' % conf.env['FLEX'],
-                       msg='Using flex version',
-                       define=None,
-                       on_target=False)
+    if conf.env['FLEX']:
+        conf.env.FLEXFLAGS = ['-t']
+        conf.CHECK_COMMAND('%s --version' % conf.env.FLEX,
+                           msg='Using flex version',
+                           define=None,
+                           on_target=False)
 
     conf.env.with_spotlight = False
     if Options.options.with_spotlight: