summaryrefslogtreecommitdiff
path: root/config/antlr.m4
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2009-12-09 23:14:40 +0000
committerMorgan Deters <mdeters@gmail.com>2009-12-09 23:14:40 +0000
commit2f121daa042c6f25a3f9ed8ece60ac5dccb11976 (patch)
tree58ee28d73e8638b100abe09e961bc3dbdf9d79d9 /config/antlr.m4
parentd697d1e91be226339a28bd7e8dce3862901cba8a (diff)
some fixes and organizational adjustments to assert code, parsers/lexers, and build process
Diffstat (limited to 'config/antlr.m4')
-rw-r--r--config/antlr.m465
1 files changed, 44 insertions, 21 deletions
diff --git a/config/antlr.m4 b/config/antlr.m4
index fbc4dbe56..ad0ddcd91 100644
--- a/config/antlr.m4
+++ b/config/antlr.m4
@@ -1,33 +1,36 @@
##
# Check for ANTLR's runantlr script. Will set ANTLR to the location of the
-# runantlr script
+# runantlr script
##
AC_DEFUN([AC_PROG_ANTLR], [
-
+
# Get the location of the runantlr script
AC_ARG_WITH(
[antlr],
AC_HELP_STRING(
[--with-antlr=RUNANTLR],
- [location of the ANTLR's `runantlr` script]
+ [location of the ANTLR's `runantlr` script]
),
ANTLR="$withval",
- ANTLR="runantlr"
- )
+ )
# Check the existance of the runantlr script
- AC_CHECK_PROG(ANTLR, "$ANTLR", "$ANTLR", [])
- if test no$ANTLR = "no";
+ if test -z "$ANTLR"; then
+ AC_CHECK_PROGS(ANTLR, [runantlr antlr])
+ 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 runantlr script, make sure that the parser code has
been generated already. To obtain ANTLR see <http://www.antlr.org/>.]
)
AC_MSG_RESULT(no)
- fi
+ fi
- # Define the ANTL related variables
- AC_SUBST(ANTLR)
+ # Define the ANTL related variables
+ AC_SUBST(ANTLR)
])
##
@@ -43,7 +46,7 @@ AC_DEFUN([AC_LIB_ANTLR],[
AC_HELP_STRING(
[--with-antlr-prefix=PATH],
[set the search path for ANTLR headers and libraries to `PATH/include`
- and `PATH/lib`. By default we look in /usr, /usr/local, /opt and
+ and `PATH/lib`. By default we look in /usr, /usr/local, /opt and
/opt/local.
]
),
@@ -53,16 +56,16 @@ AC_DEFUN([AC_LIB_ANTLR],[
AC_MSG_CHECKING(for antlr C++ runtime library)
- # Use C++ and remember the variables we are changing
+ # Use C++ and remember the variables we are changing
AC_LANG_PUSH(C++)
OLD_CPPFLAGS="$CPPFLAGS"
OLD_LIBS="$LIBS"
-
+
# Try all the includes/libs set in ANTLR_PREFIXES
for antlr_prefix in $ANTLR_PREFIXES
- do
+ do
CPPFLAGS="$OLD_CPPFLAGS -I$antlr_prefix/include"
- LIBS="$OLD_LIBS -L$antlr_prefix/lib -lantlr"
+ LIBS="$OLD_LIBS -L$antlr_prefix/lib -lantlr-pic"
AC_LINK_IFELSE(
[
#include <antlr/CommonAST.hpp>
@@ -71,20 +74,40 @@ AC_DEFUN([AC_LIB_ANTLR],[
int main() {
MyAST ast;
}
- ],
+ ],
[
AC_MSG_RESULT(found in $antlr_prefix)
ANTLR_INCLUDES="-I$antlr_prefix/include"
ANTLR_LDFLAGS="-L$antlr_prefix/lib -lantlr-pic"
break
- ],
+ ],
[
- AC_MSG_RESULT(no)
- AC_MSG_ERROR([ANTLR C++ runtime not found, see <http://www.antlr.org/>])
+ 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/>])
+ ]
+ )
]
)
done
-
+
# Return the old compile variables and pop the language.
LIBS="$OLD_LIBS"
CPPFLAGS="$OLD_CPPFLAGS"
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback