forked from TALP-UPC/FreeLing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
executable file
·308 lines (273 loc) · 15.3 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_INIT([FreeLing],[4.0])
AC_CONFIG_SRCDIR([src/libfreeling/version.cc])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE([foreign])
AC_PREREQ(2.59)
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
#CPPFLAGS=" $CPPFLAGS -Wall -fPIC"
#CXXFLAGS=" $CXXFLAGS -std=gnu++0x -Wall -fPIC"
##LDFLAGS=" $LDFLAGS -L/usr/local/lib"
## All macosx systems will put in host_os something like:
## darwin15.4.0 (this for El Capitan)
case "$host_os" in
*darwin*)
AC_DEFINE(MACOSX)
system="macosx"
;;
*)
system="linux"
;;
esac
using_xpressive="no"
### using_boost_locale="no"
######## Begin checkings ##########
AC_ARG_ENABLE([xpressive_regex],
[AS_HELP_STRING([--enable-xpressive-regex],[Use boost::xpressive instead of default boost::regex. Default is: Not enabled. Not compatible with --enable-boost-locale. If you are in MacOSX, do not enable it.])],
[if test "$enableval" = yes; then
# define symbol for CPP
AC_DEFINE(USE_XPRESSIVE_REGEX)
# inform other checks below
using_xpressive="yes"
fi
# pass info to automake
AM_CONDITIONAL([USE_XPRESSIVE_REGEX],[test "$enableval" = yes])
],
[AM_CONDITIONAL([USE_XPRESSIVE_REGEX],[test 0 = 1])])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],[Compile with debug information. Default is: Not enabled.])],
[if test "$enableval" = yes; then
# define symbol for CPP
AC_DEFINE(DEBUG)
fi
# pass info to automake
AM_CONDITIONAL([DEBUG],[test "$enableval" = yes])
],
[AM_CONDITIONAL([DEBUG],[test 0 = 1])])
AC_ARG_ENABLE([traces],
[AS_HELP_STRING([--enable-traces],[Compile with tracing information. Slows down the system, but you can know what's going on. Default is: Not enabled.])],
[if test "$enableval" = yes; then
# define symbol for CPP
AC_DEFINE(VERBOSE)
fi
# pass info to automake
AM_CONDITIONAL([VERBOSE],[test "$enableval" = yes])
],
[AM_CONDITIONAL([VERBOSE],[test 0 = 1])])
AC_ARG_ENABLE([warnings],
[AS_HELP_STRING([--disable-warnings],[Compile without warnings. Useful for large explotation systems with no logging desired. Default is: Enabled.])],
[if test "$enableval" = no; then
# define symbol for CPP
AC_DEFINE(NO_WARNINGS)
fi
# pass info to automake
AM_CONDITIONAL([NO_WARNINGS],[test "$enableval" = no])
],
[AM_CONDITIONAL([NO_WARNINGS],[test 1 = 0])])
AC_ARG_ENABLE([libfoma],
[AS_HELP_STRING([--disable-libfoma],[Compile without libfoma dependent modules. Useful for building libfreeling versions to be used under non-GPL dual license. Default is: Enabled.])],
[if test "$enableval" = no; then
# define symbol for CPP
AC_DEFINE(NO_LIBFOMA)
fi
# pass info to automake
AM_CONDITIONAL([NO_LIBFOMA],[test "$enableval" = no])
],
[AM_CONDITIONAL([NO_LIBFOMA],[test 1 = 0])])
AC_ARG_ENABLE([build-tests],
[AS_HELP_STRING([--enable-build-tests],[Compile unittest programs. Default: Not compiled.])],
[if test "$enableval" = yes; then
# define symbol for CPP
AC_DEFINE(BUILD_TESTS)
fi
# pass info to automake
AM_CONDITIONAL([BUILD_TESTS],[test "$enableval" = yes])
],
[AM_CONDITIONAL([BUILD_TESTS],[test 0 = 1])])
# Checks for programs.
AC_PROG_CXX
## change default automake c++ flags.
## We set them in src/libfreeling/Makefile.am
#if test "$CXXFLAGS" = "-g -O2"; then
#CXXFLAGS=""
#CPPFLAGS=""
#fi
CPPFLAGS=" -Wall -fPIC"
CXXFLAGS=" -std=gnu++0x -Wall -fPIC"
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_LANG([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <list>
using namespace std;]],
[[list<int> lst; int s;
for (auto &i : lst) s+=i;]]
)],
[echo "checking for required compiler C++11 support... yes"],
[echo "checking for required compiler C++11 support... no" &&
echo ""
echo " Your compiler does not suppport some C++11 features required to compile FreeLing." &&
echo " Version g++ >= 4.6 is needed." &&
echo "" && exit 1])
# init variables
AM_CONDITIONAL([BOOST_MT],[test 1 = 0])
AM_CONDITIONAL([BOOST_GCC],[test 1 = 0])
# check headers
if test $using_xpressive = "yes"
then
AC_CHECK_HEADERS([boost/xpressive/xpressive.hpp],[],
[echo "" && echo " boost/xpressive/xpressive.hpp not found." &&
echo " Make sure libboost headers (package libboost-dev or the like)" &&
echo " are installed and can be found in a standard path." &&
echo " You may need to set CPPFLAGS to specify search path." &&
echo "" && exit 1])
else
AC_CHECK_HEADERS([boost/regex.hpp],[],[echo "" && echo " boost/regex.hpp not found." &&
echo " Make sure libboost headers (package libboost-dev or the like)" &&
echo " are installed and can be found in a standard path." &&
echo " You may need to set CPPFLAGS to specify search path." &&
echo "" && exit 1])
AC_CHECK_HEADERS([boost/regex/icu.hpp],[],[echo "" && echo " boost/regex/icu.hpp not found." &&
echo " Make sure libicu headers (package libicu-dev or the like)" &&
echo " are installed and can be found in a standard path." &&
echo " You may need to set CPPFLAGS to specify search path." &&
echo "" && exit 1])
fi
AC_CHECK_HEADERS([boost/program_options.hpp],[],[echo "" && echo " boost/program_options not found." &&
echo " Make sure libboost headers (package libboost-dev or the like)" &&
echo " are installed and can be found in a standard path." &&
echo " You may need to set CPPFLAGS to specify search path." &&
echo "" && exit 1])
AC_CHECK_HEADERS([boost/thread.hpp],[],[echo "" && echo " boost/thread.hpp not found." &&
echo " Make sure libboost headers (package libboost-dev or the like)" &&
echo " are installed and can be found in a standard path." &&
echo " You may need to set CPPFLAGS to specify search path." &&
echo "" && exit 1])
AC_CHECK_HEADERS([boost/thread/mutex.hpp],[],[echo "" && echo " boost/thread/mutex.hpp not found." &&
echo " Make sure libboost headers (package libboost-dev or the like)" &&
echo " are installed and can be found in a standard path." &&
echo " You may need to set CPPFLAGS to specify search path." &&
echo "" && exit 1])
AC_CHECK_HEADERS([zlib.h],[],[echo "" && echo " zlib.h not found." &&
echo " Make sure zlib headers (package zlib-dev or the like)" &&
echo " are installed and can be found in a standard path." &&
echo " You may need to set CPPFLAGS to specify search path." &&
echo "" && exit 1])
# Checks for libraries.
## find out if boost version is older than 1.42
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <boost/version.hpp>
#if BOOST_VERSION < 104200
#error Version older than 1.42
#endif]],
[[]])],
[echo "checking for boost version... >= 1.42";AM_CONDITIONAL([BOOST_OLD],[test 0 = 1])],
[echo "checking for boost version... < 1.42";AM_CONDITIONAL([BOOST_OLD],[test 1 = 1])])
if test $using_xpressive != "yes"
then
AC_CHECK_LIB([icuuc],[main],
[echo "OK">/dev/null;],
[echo "" &&
echo " Unicode ICU library not found." &&
echo " Make sure libicu is" &&
echo " installed and can be found in a standard path." &&
echo " You may need to set LDFLAGS to specify search path." &&
echo "" && exit 1])
AC_CHECK_LIB([boost_regex],[main],
[MTLIB=""; echo "OK">/dev/null;],
AC_CHECK_LIB([boost_regex-mt],[main],
[MTLIB="-mt"; echo "OK">/dev/null;AM_CONDITIONAL([BOOST_MT],[test 1 = 1])],
AC_CHECK_LIB([boost_regex-gcc-mt],[main],
[MTLIB="-gcc-mt"; echo "OK">/dev/null;AM_CONDITIONAL([BOOST_GCC],[test 1 = 1])],
[echo "" &&
echo " boost_regex library not found." &&
echo " Make sure libboost_regex is" &&
echo " installed and can be found in a standard path." &&
echo " You may need to set LDFLAGS to specify search path." &&
echo "" && exit 1])))
LDF_BK=$LIBS
LIBS=" $LDF_BK -lboost_regex$MTLIB"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <boost/regex/icu.hpp>]],
[[boost::u32regex re=boost::make_u32regex(L"");]])],
[echo "OK">/dev/null;],
[LIBS=" $LDF_BK -lboost_regex-mt" &&
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <boost/regex/icu.hpp>]],
[[boost::u32regex re=boost::make_u32regex(L"");]])],
[echo "OK">/dev/null;],
[LIBS=" $LDF_BK -lboost_regex-gcc-mt" &&
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <boost/regex/icu.hpp>]],
[[boost::u32regex re=boost::make_u32regex(L"");]])],
[echo "OK">/dev/null;],
[echo "" &&
echo " libboost_regex does not include Unicode ICU support." &&
echo " Make sure that the installed libboost_regex was built" &&
echo " with libicu support." &&
echo "" && exit 1])])])
LIBS=$LDF_BK
fi
AC_CHECK_LIB([boost_program_options],[main],
[echo "OK">/dev/null;],
AC_CHECK_LIB([boost_program_options-mt],[main],
[echo "OK">/dev/null;AM_CONDITIONAL([BOOST_MT],[test 1 = 1])],
AC_CHECK_LIB([boost_program_options-gcc-mt],[main],
[echo "OK">/dev/null;AM_CONDITIONAL([BOOST_GCC],[test 1 = 1])],
[echo "" &&
echo " boost_program_options library not found." &&
echo " Make sure libboost_program_options is" &&
echo " installed and can be found in a standard path." &&
echo " You may need to set LDFLAGS to specify search path." &&
echo "" && exit 1])))
AC_CHECK_LIB([boost_system],[main],
[MTLIB=""; echo "OK">/dev/null;],
AC_CHECK_LIB([boost_system-mt],[main],
[MTLIB="-mt"; echo "OK">/dev/null;AM_CONDITIONAL([BOOST_MT],[test 1 = 1])],
AC_CHECK_LIB([boost_system-gcc-mt],[main],
[MTLIB="-gcc-mt"; echo "OK">/dev/null;AM_CONDITIONAL([BOOST_GCC],[test 1 = 1])],
[echo "" &&
echo " boost_system library not found." &&
echo " Make sure libboost_system is" &&
echo " installed and can be found in a standard path." &&
echo " You may need to set LDFLAGS to specify search path." &&
echo "" && exit 1])))
LIBS=" $LDF_BK -lboost_system$MTLIB"
AC_CHECK_LIB([boost_thread],[main],
[MTLIB=""; echo "OK">/dev/null;],
AC_CHECK_LIB([boost_thread-mt],[main],
[MTLIB="-mt"; echo "OK">/dev/null;AM_CONDITIONAL([BOOST_MT],[test 1 = 1])],
AC_CHECK_LIB([boost_thread-gcc-mt],[main],
[MTLIB="-gcc-mt"; echo "OK">/dev/null;AM_CONDITIONAL([BOOST_GCC],[test 1 = 1])],
[echo "" &&
echo " boost_thread library not found." &&
echo " Make sure libboost_thread is" &&
echo " installed and can be found in a standard path." &&
echo " You may need to set LDFLAGS to specify search path." &&
echo "" && exit 1])))
LIBS=$LDF_BK
AC_CHECK_LIB([z],[main],[echo "OK">/dev/null;], [echo "" &&
echo " zlib library not found." &&
echo " Make sure libz is installed and can" &&
echo " be found in a standard path." &&
echo " You may need to set LDFLAGS to specify search path." &&
echo "" && exit 1])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_STDC
AC_SUBST(CPPFLAGS)
AC_CONFIG_FILES([Makefile
data/Makefile
src/Makefile
src/include/Makefile
src/libfreeling/Makefile
src/libfoma/Makefile
src/libtreeler/Makefile
src/libtreeler/main/Makefile
src/main/Makefile
src/utilities/Makefile
src/tests/Makefile
freeling.pc])
AC_OUTPUT