]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
Add conditional workaround for flex < 2.5.20, such as in RedHat.
authorkhooyp <khooyp@e59a4935-1847-0410-ae03-e826735625c1>
Thu, 10 Feb 2011 01:59:06 +0000 (01:59 +0000)
committerkhooyp <khooyp@e59a4935-1847-0410-ae03-e826735625c1>
Thu, 10 Feb 2011 01:59:06 +0000 (01:59 +0000)
- Old versions of flex did not support the -f flag, and did not provide a destroy function.

git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1139 e59a4935-1847-0410-ae03-e826735625c1

src/parser/Makefile

index 5e331393b3a31b9501476405a7bc3cf9f4bf4fe9..25998d26a331913d24794aad7bea5e8da3500b56 100644 (file)
@@ -1,8 +1,16 @@
 TOP = ../..
 include $(TOP)/scripts/Makefile.common
 
+# Workaround for flex < 2.5.20 which do not support the -f flag nor provide *_destroy functions
+OLD_FLEX=$(shell flex --version | awk -F '[ .]' '{ print ($$(NF-2) < 2 || $$(NF-2) == 2 && ($$(NF-1) < 5 || $$(NF-1) == 5 && $$NF < 20)) }')
+
+ifeq (1,$(OLD_FLEX))
+LEX=flex -Ce
+else
 #`From the flex manual>: -Cfe' is often a good compromise between speed and size for production scanners.
 LEX=flex -Cfe
+endif
+
 YACC=bison --debug -v
 
 SRCS = $(foreach foo,cvc smt smt2,lex$(foo).cpp parse$(foo).cpp) LetMgr.cpp
@@ -15,6 +23,9 @@ libparser.a: $(OBJS)
 
 lex%.cpp: %.lex parse%.hpp ../AST/AST.h
        $(LEX) -o$@ -P$* $<
+ifeq (1,$(OLD_FLEX))
+       echo "int $*lex_destroy(void) { return 0; }" >> $@
+endif
 
 parse%.cpp parse%.hpp: %.y
        $(YACC) -o parse$*.cpp -d -p $* $<