diff options
Diffstat (limited to 'config/antlr.m4')
-rw-r--r-- | config/antlr.m4 | 61 |
1 files changed, 16 insertions, 45 deletions
diff --git a/config/antlr.m4 b/config/antlr.m4 index 408df0d84..842b9b51d 100644 --- a/config/antlr.m4 +++ b/config/antlr.m4 @@ -3,28 +3,18 @@ # runantlr script ## AC_DEFUN([AC_PROG_ANTLR], [ - AC_ARG_VAR([ANTLR],[location of the runantlr script]) - - # Get the location of the runantlr script - # AC_ARG_WITH( - # [antlr], - # AS_HELP_STRING( - # [--with-antlr=RUNANTLR], - # [location of the ANTLR's `runantlr` script] - # ), - # ANTLR="$withval", - # ) + AC_ARG_VAR([ANTLR],[location of the antlr3 script]) # Check the existance of the runantlr script if test -z "$ANTLR"; then - AC_CHECK_PROGS(ANTLR, [runantlr antlr]) + AC_CHECK_PROGS(ANTLR, [antlr3]) else AC_CHECK_PROG(ANTLR, "$ANTLR", "$ANTLR", []) fi if test no$ANTLR = "no"; then AC_MSG_WARN( - [Couldn't find the runantlr script, make sure that the parser code has + [Couldn't find the antlr3 script, make sure that the parser code has been generated already. To obtain ANTLR see <http://www.antlr.org/>.] ) AC_MSG_RESULT(no) @@ -35,7 +25,7 @@ AC_DEFUN([AC_PROG_ANTLR], [ ]) ## -# Check the existnace of the ANTLR C++ runtime library and headers +# Check the existance of the ANTLR C++ runtime library and headers # Will set ANTLR_CPPFLAGS and ANTLR_LIBS to the location of the ANTLR headers # and library respectively ## @@ -46,16 +36,16 @@ AC_DEFUN([AC_LIB_ANTLR],[ [antlr-dir], AS_HELP_STRING( [--with-antlr-dir=PATH], - [path to ANTLR C++ headers and libraries] + [path to ANTLR C headers and libraries] ), ANTLR_PREFIXES="$withval", ANTLR_PREFIXES="/usr/local /usr /opt/local /opt" ) - AC_MSG_CHECKING(for antlr C++ runtime library) + AC_MSG_CHECKING(for ANTLR C runtime library) - # Use C++ and remember the variables we are changing - AC_LANG_PUSH(C++) + # Use C and remember the variables we are changing + AC_LANG_PUSH(C) OLD_CPPFLAGS="$CPPFLAGS" OLD_LIBS="$LIBS" @@ -63,46 +53,27 @@ AC_DEFUN([AC_LIB_ANTLR],[ for antlr_prefix in $ANTLR_PREFIXES do CPPFLAGS="$OLD_CPPFLAGS -I$antlr_prefix/include" - LIBS="$OLD_LIBS -L$antlr_prefix/lib -lantlr-pic" + LIBS="$OLD_LIBS -L$antlr_prefix/lib -lantlr3c" AC_LINK_IFELSE( [ - #include <antlr/CommonAST.hpp> - class MyAST : public ANTLR_USE_NAMESPACE(antlr)CommonAST { - }; + #include <antlr3.h> + int main() { - MyAST ast; + pANTLR3_UINT8 fName = (pANTLR3_UINT8)"foo"; + pANTLR3_INPUT_STREAM input = antlr3AsciiFileStreamNew(fName); + return 0; } ], [ AC_MSG_RESULT(found in $antlr_prefix) ANTLR_INCLUDES="-I$antlr_prefix/include" - ANTLR_LDFLAGS="-L$antlr_prefix/lib -lantlr-pic" + ANTLR_LDFLAGS="-L$antlr_prefix/lib -lantlr3c" break ], - [ - CPPFLAGS="$OLD_CPPFLAGS -I$antlr_prefix/include" - LIBS="$OLD_LIBS -L$antlr_prefix/lib -lantlr" - AC_LINK_IFELSE( - [ - #include <antlr/CommonAST.hpp> - class MyAST : public ANTLR_USE_NAMESPACE(antlr)CommonAST { - }; - int main() { - MyAST ast; - } - ], - [ - AC_MSG_RESULT(found in $antlr_prefix) - ANTLR_INCLUDES="-I$antlr_prefix/include" - ANTLR_LDFLAGS="-L$antlr_prefix/lib -lantlr" - break - ], [ AC_MSG_RESULT(no) - AC_MSG_ERROR([ANTLR C++ runtime not found, see <http://www.antlr.org/>]) + AC_MSG_ERROR([ANTLR C runtime not found, see <http://www.antlr.org/>]) ] - ) - ] ) done |