* Node::isAtomic() now looks at an "atomic" attribute of arguments
[cvc5.git] / config / antlr.m4
1 ##
2 # Check for ANTLR's antlr3 script.
3 # Will set ANTLR to the location of the script.
4 ##
5 AC_DEFUN([AC_PROG_ANTLR], [
6 AC_ARG_VAR([ANTLR],[location of the antlr3 script])
7
8 # Check the existence of the runantlr script
9 if test -z "$ANTLR"; then
10 AC_CHECK_PROGS(ANTLR, [antlr3])
11 else
12 AC_CHECK_PROG(ANTLR, "$ANTLR", "$ANTLR", [])
13 fi
14 if test no$ANTLR = "no";
15 then
16 AC_MSG_WARN(
17 [Couldn't find the antlr3 script, make sure that the parser code has
18 been generated already. To obtain ANTLR see <http://www.antlr.org/>.]
19 )
20 AC_MSG_RESULT(no)
21 fi
22
23 # Define the ANTL related variables
24 # AC_SUBST(ANTLR)
25 ])
26
27 ##
28 # Check the existence of the ANTLR3 C runtime library and headers
29 # Will set ANTLR_INCLUDES and ANTLR_LIBS to the location of the ANTLR
30 # headers and library respectively
31 ##
32 AC_DEFUN([AC_LIB_ANTLR],[
33 AC_ARG_VAR(ANTLR_HOME, [path to libantlr3c installation])
34
35 # Get the location of the ANTLR3 C includes and libraries
36 AC_ARG_WITH(
37 [antlr-dir],
38 AS_HELP_STRING(
39 [--with-antlr-dir=PATH],
40 [path to ANTLR C headers and libraries]
41 ),
42 ANTLR_PREFIXES="$withval",
43 ANTLR_PREFIXES="$ANTLR_HOME /usr/local /usr /opt/local /opt"
44 )
45
46 AC_MSG_CHECKING(for ANTLR3 C runtime library)
47
48 # Use C and remember the variables we are changing
49 AC_LANG_PUSH(C)
50 OLD_CPPFLAGS="$CPPFLAGS"
51 OLD_LIBS="$LIBS"
52
53 # Try all the includes/libs set in ANTLR_PREFIXES
54 for antlr_prefix in $ANTLR_PREFIXES
55 do
56 CPPFLAGS="$OLD_CPPFLAGS -I$antlr_prefix/include"
57 LIBS="$OLD_LIBS -L$antlr_prefix/lib -lantlr3c"
58 AC_LINK_IFELSE(
59 [
60 #include <antlr3.h>
61
62 int main() {
63 pANTLR3_UINT8 fName = (pANTLR3_UINT8)"foo";
64 pANTLR3_INPUT_STREAM input = antlr3AsciiFileStreamNew(fName);
65 return 0;
66 }
67 ],
68 [
69 AC_MSG_RESULT(found in $antlr_prefix)
70 ANTLR_INCLUDES="-I$antlr_prefix/include"
71 ANTLR_LDFLAGS="-L$antlr_prefix/lib -lantlr3c"
72 break
73 ],
74 [
75 AC_MSG_RESULT(no)
76 AC_MSG_ERROR([ANTLR3 C runtime not found, see <http://www.antlr.org/>])
77 ]
78 )
79 done
80
81 # Return the old compile variables and pop the language.
82 LIBS="$OLD_LIBS"
83 CPPFLAGS="$OLD_CPPFLAGS"
84 AC_LANG_POP()
85
86 # Define the ANTLR include/libs variables
87 AC_SUBST(ANTLR_INCLUDES)
88 AC_SUBST(ANTLR_LDFLAGS)
89 ])