-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
223 lines (197 loc) · 5.25 KB
/
configure.ac
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
dnl
dnl Copyright 2001-2018 Adrian Thurston <[email protected]>
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a copy
dnl of this software and associated documentation files (the "Software"), to
dnl deal in the Software without restriction, including without limitation the
dnl rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
dnl sell copies of the Software, and to permit persons to whom the Software is
dnl furnished to do so, subject to the following conditions:
dnl
dnl The above copyright notice and this permission notice shall be included in all
dnl copies or substantial portions of the Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
dnl AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
dnl OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
dnl SOFTWARE.
dnl
AC_INIT(ragel, 7.0.0.12)
PUBDATE="May 2019"
EXPECTED_COLM=0.13.0.7
AM_INIT_AUTOMAKE([foreign])
AC_SUBST(PUBDATE)
AC_CONFIG_HEADER(src/config.h)
: ${CFLAGS="-Wall -g"}
: ${CXXFLAGS="-Wall -g"}
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
dnl Build the program? ( no means just build libfsm )
dnl
AC_ARG_ENABLE(program,
[AC_HELP_STRING([--enable-program], [build the program? no means libfsm only] )],
[
if test "x$enableval" = "xyes"; then
build_program=yes;
else
build_program=no;
fi
],
[
build_program=yes;
]
)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_TOOL(AR, ar)
AC_PROG_RANLIB
AC_PROG_LIBTOOL
dnl Set test on c++ compiler.
AC_LANG_CPLUSPLUS
dnl Check for definition of MAKE.
AC_PROG_MAKE_SET
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
if [test "x$build_program" = "xyes"]; then
dnl
dnl Check for ragel.
dnl
AC_ARG_WITH(ragel,
[AC_HELP_STRING([--with-ragel], [location of ragel install])],
[
RAGEL="$withval/bin/ragel"
AC_CHECK_FILES( [$RAGEL], [], [RAGEL=""] )
],
[
AC_PATH_PROG( [RAGEL], [ragel] )
]
)
dnl
dnl Check for kelbt.
dnl
AC_ARG_WITH(kelbt,
[AC_HELP_STRING([--with-kelbt], [location of kelbt install])],
[
KELBT="$withval/bin/kelbt"
AC_CHECK_FILES( [$KELBT], [], [KELBT=""] )
],
[
AC_PATH_PROG( [KELBT], [kelbt] )
]
)
AC_SUBST(RAGEL)
AC_SUBST(KELBT)
if test x$RAGEL != x -a x$KELBT != x; then
RAGEL_KELBT=yes
AC_DEFINE([WITH_RAGEL_KELBT], [1], [ragel AND kelbt are available])
fi
dnl
dnl Check for colm.
dnl
AC_ARG_WITH(colm,
[AC_HELP_STRING([--with-colm], [location of colm install (or built source)])],
[
if test -f "$withval/src/fsmgraph.h"; then
CPPFLAGS="${CPPFLAGS} -I$withval/src/include"
LDFLAGS="${LDFLAGS} -L$withval/src"
COLM="$withval/src/colm"
COLM_LD="$withval/src/libcolm.la"
COLM_LIBDEP="$COLM_LD"
COLM_BINDEP="$COLM"
else
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
COLM="$withval/bin/colm"
COLM_LD="-lcolm"
COLM_LIBDEP=""
COLM_BINDEP="$COLM"
fi
AC_CHECK_FILES(
[$COLM],
[],
[AC_ERROR([--with-colm was specified, but binary was not found])]
)
],
[
AC_PATH_PROG( [COLM], [colm] )
COLM_LD="-lcolm"
COLM_LIBDEP=""
COLM_BINDEP=""
]
)
if test -z "$COLM"; then
AC_ERROR([colm is required to build ragel])
fi
AC_CHECK_FILES(
[$COLM],
[],
[AC_ERROR([could not find $COLM])]
)
INSTALLED_VER=`$COLM -v | sed -n -e '1 { s/^.*version //; s/ .*$//; p; }'`
if test "x$INSTALLED_VER" != "x$EXPECTED_COLM"; then
AC_ERROR( [check colm: expected version $EXPECTED_COLM, but $INSTALLED_VER is installed] )
fi
AC_SUBST(COLM)
AC_SUBST(COLM_LD)
AC_SUBST(COLM_LIBDEP)
AC_SUBST(COLM_BINDEP)
fi
dnl 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
AM_CONDITIONAL([BUILD_PROGRAM], [test "x$build_program" = "xyes"])
AM_CONDITIONAL([BUILD_MANUAL], [test "x$build_manual" = "xyes"])
AM_CONDITIONAL([WITH_RAGEL_KELBT], [test "x$RAGEL_KELBT" = "xyes"])
AC_CANONICAL_HOST()
AM_CONDITIONAL([LINKER_NO_UNDEFINED], [test "x$host_os" = "xlinux-gnu"])
dnl write output files
AC_OUTPUT([
Makefile
src/Makefile
src/host-ruby/Makefile
src/host-asm/Makefile
src/host-julia/Makefile
src/host-ocaml/Makefile
src/host-c/Makefile
src/host-d/Makefile
src/host-csharp/Makefile
src/host-go/Makefile
src/host-java/Makefile
src/host-rust/Makefile
src/host-crack/Makefile
src/host-js/Makefile
aapl/Makefile
doc/Makefile
doc/ragel.1
])
echo "configuration of ragel complete"