summaryrefslogtreecommitdiff
path: root/configure.ac
blob: b86da8c86321655870cd670aa2675900bfeb671f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
dnl 
dnl   Copyright 2001-2009 Adrian Thurston <thurston@complang.org>
dnl

dnl   This file is part of Ragel.
dnl  
dnl   Ragel is free software; you can redistribute it and/or modify
dnl   it under the terms of the GNU General Public License as published by
dnl   the Free Software Foundation; either version 2 of the License, or
dnl   (at your option) any later version.
dnl   
dnl   Ragel is distributed in the hope that it will be useful,
dnl   but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl   GNU General Public License for more details.
dnl   
dnl   You should have received a copy of the GNU General Public License
dnl   along with Ragel; if not, write to the Free Software
dnl   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
  
AC_INIT(ragel, 6.10)
PUBDATE="March 2017"

AM_INIT_AUTOMAKE([foreign])
AC_SUBST(PUBDATE)
AC_CONFIG_HEADER(ragel/config.h)

dnl Choose defaults for the build_parsers and build_manual vars. If the dist
dnl file is present in the root then default to no, otherwise go for it.

AS_IF([test -r $srcdir/DIST], [. $srcdir/DIST], [build_parsers=yes;
       build_manual=yes])

dnl
dnl Enable arg to explicitly control the building of the manual
dnl
AC_ARG_ENABLE(manual,
	[  --enable-manual         do we want to build the manual?],
	[
		if test "x$enableval" = "xyes"; then
			build_manual=yes;
		else
			build_manual=no;
		fi
	],
)


dnl Set to true if the build system should generate parsers from ragel and kelbt
dnl sources. Set to false if generated files are included and not to be built
dnl (production).
AM_CONDITIONAL(BUILD_PARSERS, [test "x$build_parsers" = "xyes"])

dnl Set to true if the manual should be built.
AM_CONDITIONAL(BUILD_MANUAL, [test "x$build_manual" = "xyes"])

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_TOOL(AR, ar)
AC_PROG_RANLIB

dnl Set test on c++ compiler.
AC_LANG_CPLUSPLUS

dnl Check for definition of MAKE.
AC_PROG_MAKE_SET

# Checks to carry out if we are building parsers.
if test "x$build_parsers" = "xyes"; then

AC_CHECK_PROG(RAGEL, ragel, ragel)
if test -z "$RAGEL"; then
	echo
	echo "error: ragel is required to build the parsers"
	echo
	exit 1
fi

AC_CHECK_PROG(KELBT, kelbt, kelbt)
if test -z "$KELBT"; then
	echo
	echo "error: kelbt is required to build the parsers"
	echo
	exit 1
fi

fi 

# Checks to carry out if we are building the manual.
if test "x$build_manual" = "xyes"; then

AC_CHECK_PROG(FIG2DEV, fig2dev, fig2dev)
if test -z "$FIG2DEV"; then
	echo
	echo "error: fig2dev is required to build the manual (maybe use --disable-manual)"
	echo
	exit 1
fi

AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex)
if test -z "$PDFLATEX"; then
	echo
	echo "error: pdflatex is required to build the manual (maybe use --disable-manual)"
	echo
	exit 1
fi

fi

dnl Check for the D compiler
AC_CHECK_PROG(GDC, gdc, gdc)

dnl Check for the Objective-C compiler
AC_MSG_CHECKING([for the Objective-C compiler])
cat > conftest.m <<EOF
int main() { return 0; }
EOF
GOBJC=""
if gcc -x objective-c conftest.m -o conftest.bin 2>/dev/null; then
	GOBJC="gcc -x objective-c"
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no])
fi
AC_SUBST(GOBJC)

dnl Check for the Java compiler.
AC_CHECK_PROG(JAVAC, javac, javac)

dnl Check for TXL.
AC_CHECK_PROG(TXL, txl, txl)

dnl Check for Ruby.
AC_CHECK_PROG(RUBY, ruby, ruby)

dnl Check for the C# compiler.
AC_CHECK_PROG(GMCS, gmcs, gmcs)

dnl Check for the Go compiler.
AC_CHECK_PROG(GOBIN, go, go build)

dnl write output files
AC_OUTPUT(
	[
		Makefile ragel/Makefile aapl/Makefile 
		doc/Makefile doc/ragel.1
		contrib/Makefile
		test/Makefile test/runtests
		examples/Makefile
	],
	[chmod +x test/runtests]
)

echo "configuration of ragel complete"