configure: check if lex requires/fails with -o for output
authorJens Axboe <axboe@fb.com>
Tue, 29 Dec 2015 19:23:17 +0000 (12:23 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 29 Dec 2015 19:23:17 +0000 (12:23 -0700)
Signed-off-by: Jens Axboe <axboe@fb.com>
Makefile
configure

index 510e2570bd84dad22368be085d69df30ee16a440..1b5c9a6f35892d3e15b259a0dafde6df2a2cfc6c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -297,7 +297,11 @@ override CFLAGS += -DFIO_VERSION='"$(FIO_VERSION)"'
 
 ifdef CONFIG_ARITHMETIC
 lex.yy.c: exp/expression-parser.l
 
 ifdef CONFIG_ARITHMETIC
 lex.yy.c: exp/expression-parser.l
+ifdef CONFIG_LEX_USE_O
        $(QUIET_LEX)$(LEX) -o $@ $<
        $(QUIET_LEX)$(LEX) -o $@ $<
+else
+       $(QUIET_LEX)$(LEX) $<
+endif
 
 lex.yy.o: lex.yy.c y.tab.h
        $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
 
 lex.yy.o: lex.yy.c y.tab.h
        $(QUIET_CC)$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -c $<
index af26165e7bc3a7821d2730a8d3efcd858bcf1b79..a0d5a15fa5667295b5375281ffde2b6206fc7c04 100755 (executable)
--- a/configure
+++ b/configure
@@ -1494,6 +1494,16 @@ fi
 fi
 fi
 
 fi
 fi
 
+# Check if lex fails using -o
+if test "$arith" = "yes" ; then
+$LEX -o lex.yy.c exp/expression-parser.l 2> /dev/null
+if test "$?" = "0" ; then
+  lex_use_o="yes"
+else
+  lex_use_o="no"
+fi
+fi
+
 echo "lex/yacc for arithmetic       $arith"
 
 ##########################################
 echo "lex/yacc for arithmetic       $arith"
 
 ##########################################
@@ -1756,6 +1766,9 @@ if test "$arith" = "yes" ; then
   else
     echo "YACC=$YACC" >> $config_host_mak
   fi
   else
     echo "YACC=$YACC" >> $config_host_mak
   fi
+  if test "$lex_use_o" = "yes" ; then
+    echo "CONFIG_LEX_USE_O=y" >> $config_host_mak
+  fi
 fi
 if test "$getmntent" = "yes" ; then
   output_sym "CONFIG_GETMNTENT"
 fi
 if test "$getmntent" = "yes" ; then
   output_sym "CONFIG_GETMNTENT"