update(add) packaging directory and spec file from OBSTF:Private, OBS
[external/ragel.git] / configure.in
1 dnl 
2 dnl   Copyright 2001-2009 Adrian Thurston <thurston@complang.org>
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, 6.6)
22 PUBDATE="Dec 2009"
23
24 AM_INIT_AUTOMAKE([foreign])
25 AC_SUBST(PUBDATE)
26 AC_CONFIG_HEADER(ragel/config.h)
27
28 dnl Choose defaults for the build_parsers and build_manual vars. If the dist
29 dnl file is present in the root then default to no, otherwise go for it.
30 AC_CHECK_FILES( $srcdir/DIST, 
31         [ . $srcdir/DIST; ], 
32         [ build_parsers=yes; build_manual=yes; ] )
33
34 dnl Set to true if the build system should generate parsers from ragel and kelbt
35 dnl sources. Set to false if generated files are included and not to be built
36 dnl (production).
37 AM_CONDITIONAL(BUILD_PARSERS, [test "x$build_parsers" = "xyes"])
38
39 dnl Set to true if the manual should be built.
40 AM_CONDITIONAL(BUILD_MANUAL, [test "x$build_manual" = "xyes"])
41
42 dnl Checks for programs.
43 AC_PROG_CC
44 AC_PROG_CXX
45 AC_CHECK_TOOL(AR, ar)
46 AC_PROG_RANLIB
47
48 # Default flags.
49 CXXFLAGS="-g"
50
51 dnl Set test on c++ compiler.
52 AC_LANG_CPLUSPLUS
53
54 dnl Check for definition of MAKE.
55 AC_PROG_MAKE_SET
56
57 # Checks to carry out if we are building parsers.
58 if test "x$build_parsers" = "xyes"; then
59
60 AC_CHECK_PROG(RAGEL, ragel, ragel)
61 if test -z "$RAGEL"; then
62         echo
63         echo "error: ragel is required to build the parsers"
64         echo
65         exit 1
66 fi
67
68 AC_CHECK_PROG(KELBT, kelbt, kelbt)
69 if test -z "$KELBT"; then
70         echo
71         echo "error: kelbt is required to build the parsers"
72         echo
73         exit 1
74 fi
75
76 fi 
77
78 # Checks to carry out if we are building the manual.
79 if test "x$build_manual" = "xyes"; then
80
81 AC_CHECK_PROG(FIG2DEV, fig2dev, fig2dev)
82 if test -z "$FIG2DEV"; then
83         echo
84         echo "error: fig2dev is required to build the manual"
85         echo
86         exit 1
87 fi
88
89 AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex)
90 if test -z "$PDFLATEX"; then
91         echo
92         echo "error: pdflatex is required to build the manual"
93         echo
94         exit 1
95 fi
96
97 fi
98
99 dnl Check for the D compiler
100 AC_CHECK_PROG(GDC, gdc, gdc)
101
102 dnl Check for the Objective-C compiler
103 AC_MSG_CHECKING([for the Objective-C compiler])
104 cat > conftest.m <<EOF
105 int main() { return 0; }
106 EOF
107 GOBJC=""
108 if gcc -x objective-c conftest.m -o conftest.bin 2>/dev/null; then
109         GOBJC="gcc -x objective-c"
110         AC_MSG_RESULT([yes])
111 else
112         AC_MSG_RESULT([no])
113 fi
114 AC_SUBST(GOBJC)
115
116 dnl Check for the Java compiler.
117 AC_CHECK_PROG(JAVAC, javac, javac)
118
119 dnl Check for TXL.
120 AC_CHECK_PROG(TXL, txl, txl)
121
122 dnl Check for Ruby.
123 AC_CHECK_PROG(RUBY, ruby, ruby)
124
125 dnl Check for the C# compiler.
126 AC_CHECK_PROG(GMCS, gmcs, gmcs)
127
128 dnl write output files
129 AC_OUTPUT(
130         [
131                 Makefile ragel/Makefile aapl/Makefile 
132                 doc/Makefile doc/ragel.1
133                 contrib/Makefile
134                 test/Makefile test/runtests
135                 examples/Makefile
136         ],
137         [chmod +x test/runtests]
138 )
139
140 echo "configuration of ragel complete"