Import from my private repository. Snapshot after version 5.16, immediately
[external/ragel.git] / configure.in
1 dnl 
2 dnl   Copyright 2001-2006 Adrian Thurston <thurston@cs.queensu.ca>
3 dnl
4
5 dnl   This file is part of Ragel.
6 dnl  
7 dnl   Ragel is free software; you can redistribute it and/or modify
8 dnl   it under the terms of the GNU General Public License as published by
9 dnl   the Free Software Foundation; either version 2 of the License, or
10 dnl   (at your option) any later version.
11 dnl   
12 dnl   Ragel is distributed in the hope that it will be useful,
13 dnl   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 dnl   GNU General Public License for more details.
16 dnl   
17 dnl   You should have received a copy of the GNU General Public License
18 dnl   along with Ragel; if not, write to the Free Software
19 dnl   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
20   
21 AC_INIT(ragel/main.cpp)
22 AC_CONFIG_HEADER(common/config.h)
23
24 dnl Set true if build system should generate parsers from flex, bison, and
25 dnl gperf sources. Set false if generated files are included and not to be
26 dnl built (production).
27 AC_SUBST(BUILD_PARSERS,true)
28
29 dnl Checks for programs.
30 AC_PROG_CC
31 AC_DEFINE_UNQUOTED(CC,$CC)
32
33 dnl Checks for programs.
34 AC_PROG_CXX
35 AC_DEFINE_UNQUOTED(CXX,$CXX)
36
37 dnl Set test on c++ compiler.
38 AC_LANG_CPLUSPLUS
39
40 dnl Check for definition of MAKE.
41 AC_PROG_MAKE_SET
42
43 if test $BUILD_PARSERS = true; then
44
45 dnl Check for flex
46 AC_CHECK_PROG(FLEX, flex, flex)
47 if test -z "$FLEX"; then
48         echo
49         echo "error: flex is required to compile ragel"
50         echo
51         exit 1
52 fi
53
54 dnl Check for gperf
55 AC_CHECK_PROG(GPERF, gperf, gperf)
56 if test -z "$GPERF"; then
57         echo
58         echo "error: gperf is required to compile ragel"
59         echo
60         exit 1
61 fi
62
63 dnl Check for bison
64 AC_CHECK_PROG(BISON, bison, bison)
65 if test -z "$BISON"; then
66         echo
67         echo "error: bison is required to compile ragel"
68         echo
69         exit 1
70 fi
71
72 dnl Sorry, Ragel will not compile with bison++.
73 if "$BISON" --version | grep 'bison++'; then
74         echo
75         echo "error: sorry, ragel cannot be compiled with bison++"
76         echo
77         exit 1
78 fi
79
80 fi # BUILD_PARSERS
81
82 dnl Check for the D compiler
83 AC_CHECK_PROG(GDC, gdc, gdc)
84 if test -n "$GDC"; then
85         AC_DEFINE_UNQUOTED(GDC,$GDC)
86 fi
87
88 dnl Check for the Objective-C compiler
89 AC_MSG_CHECKING([for the Objective-C compiler])
90 cat > conftest.m <<EOF
91 int main() { return 0; }
92 EOF
93 GOBJC=""
94 if gcc -x objective-c conftest.m -o conftest.bin 2>/dev/null; then
95         GOBJC="gcc -x objective-c"
96         AC_MSG_RESULT([yes])
97         AC_DEFINE_UNQUOTED(GOBJC,$GOBJC)
98 else
99         AC_MSG_RESULT([no])
100 fi
101 AC_SUBST(GOBJC)
102
103 dnl Check for the Java compiler.
104 AC_CHECK_PROG(JAVAC, javac, javac)
105 if test -n "$JAVAC"; then
106         AC_DEFINE_UNQUOTED(JAVAC,$JAVAC)
107 fi
108
109 dnl Check for TXL.
110 AC_CHECK_PROG(TXL, txl, txl)
111 if test -n "$TXL"; then
112         AC_DEFINE_UNQUOTED(TXL,$TXL)
113 fi
114
115 dnl write output files
116 AC_OUTPUT(Makefile common/Makefile ragel/Makefile rlcodegen/Makefile doc/Makefile test/Makefile)
117
118 echo "configuration of ragel complete"