forked from UndernetIRC/gnuworld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
396 lines (332 loc) · 11.9 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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
dnl $Id: configure.ac,v 1.42 2008/04/16 15:25:49 danielaustin Exp $
dnl ----------------------------------------------------------
echo Configuring GNUWorld...
echo
AC_REVISION($Revision: 1.42 $)
AC_INIT([gnuworld],[3.0])
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_SRCDIR([src/main.cc])
AC_CONFIG_HEADERS([include/defs.h])
AM_INIT_AUTOMAKE([subdir-objects])
AM_SILENT_RULES([yes])
AM_PROG_AR
AC_PROG_CXX
AC_LANG([C++])
AC_PROG_MAKE_SET(gmake)
AC_PROG_INSTALL
dnl Configure libtool and its convenience library
LT_CONFIG_LTDL_DIR([libltdl])
LT_INIT([dlopen disable-static shared])
LTDL_INIT
AM_MAINTAINER_MODE
AC_SEARCH_LIBS([strerror],[cposix])
CXXFLAGS="-W -Wall -pipe -I\$(top_srcdir)/libltdl"
CXXFLAGS="$CXXFLAGS -I\$(top_srcdir)/db"
CFLAGS="$CFLAGS"
AC_PREFIX_DEFAULT(`pwd`)
AC_MSG_CHECKING([whether to detect pthread libraries])
AC_ARG_ENABLE([threads],
AS_HELP_STRING([--disable-threads],[disable the linking of the pthread library (default = no)]),
[check_threadLib=$enable_threads],
[check_threadLib=yes])
AC_MSG_RESULT([$check_threadLib])
dnl Do we need an explicit lib for the pthreads?
gcc_support_pthread=no
if test "$check_threadLib" = yes; then
dnl usually, gcc needs -pthread
AC_MSG_CHECKING([whether gcc accepts the -pthread option])
pthreadtest=`$CXX -pthread 2>&1 | grep -c unrecognized`
if test "x$pthreadtest" = "x0" ; then
gcc_support_pthread=yes
AC_SUBST(threadLib)
threadLib=-pthread
else
gcc_support_pthread=no
fi
AC_MSG_RESULT([$gcc_support_pthread])
fi
if test x"$gcc_support_pthread" = xno ; then
pthread_found=no
AC_CHECK_LIB(pthread, pthread_create, pthread_found=yes)
if test x"$pthread_found" = xyes ; then
AC_SUBST(threadLib)
threadLib=-lpthread
else
AC_CHECK_LIB(c_r, pthread_create,threadLib=-lc_r)
AC_CHECK_LIB(gcc_r, main, threadLib=-gcc_r)
fi
fi
dnl The below algorithm is incorrect because gcc is given no
dnl input files
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
dnl
dnl System specific checks
dnl
dnl ----------------------------------------------------------
dnl ----------------------------------------------------------
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(nsl,gethostbyname)
dnl Check for pcre for building a test program.
dnl If it is not present, just don't build the program.
AC_CHECK_LIB(pcre,pcre_compile,
AM_CONDITIONAL(COND_PCRE,[/bin/true]),
AM_CONDITIONAL(COND_PCRE,[/bin/false]))
dnl AC_CHECK_LIB(z,inflate)
dnl AC_CHECK_LIB(pthread,pthread_create)
dnl AC_SEARCH_LIBS(pthread_create,lthread pthread c c_r)
dnl AC_SEARCH_LIBS(pthread_kill,lthread pthread c c_r)
dnl AC_CHECK_FUNCS(pthread_create)
dnl ----------------------------------------------------------
dnl
dnl Checking for headers, functions, and a type declarations
dnl
AC_CHECK_HEADERS(sys/file.h unistd.h sys/stat.h sys/ioctl.h sys/resource.h )
AC_CHECK_HEADERS(sys/time.h asm/ioctls.h xti_inet.h sys/filio.h getopt.h)
AC_CHECK_HEADERS(sys/types.h sys/socket.h netinet/in.h sys/un.h pthread.h)
AC_HEADER_STDC
AC_HEADER_TIME
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
found_socklen_t=no
AC_EGREP_HEADER(socklen_t,sys/socket.h, AC_DEFINE(HAVE_SOCKLEN_T) found_socklen_t=yes)
if test $found_socklen_t = yes; then
AC_EGREP_HEADER(socklen_t,bits/socket.h,
AC_DEFINE([HAVE_SOCKLEN_T],[],[Socket length type]))
fi
if test $found_socklen_t = yes; then
AC_MSG_CHECKING(for socklen_t)
AC_MSG_RESULT(yes)
else
AC_CHECK_TYPE(socklen_t,int)
fi
AC_ARG_WITH(debug,
AS_HELP_STRING([--without-debug],[Disable debugging in the executables]),
[dummy=true],
[CXXFLAGS="$CXXFLAGS -g"]
)
dnl By default, do NOT build test directory
build_testdir=false
AC_ARG_WITH(test,
AS_HELP_STRING([--with-test],[Enable building of test programs]),
[build_testdir=true]
)
AM_CONDITIONAL(COND_TESTDIR,[test $build_testdir = true])
AC_ARG_WITH(pedantic,
AS_HELP_STRING([--with-pedantic],[Add -pedantic to compile options]),
[CXXFLAGS="$CXXFLAGS -pedantic"]
)
AC_ARG_WITH(optimization,
AS_HELP_STRING([--with-optimization],[Optimize the executables]),
[CXXFLAGS="$CXXFLAGS -O2"],
[CXXFLAGS="$CXXFLAGS -O0"]
)
AC_ARG_WITH(prof,
AS_HELP_STRING([--with-prof],[Generate profiling information]),
[CXXFLAGS="$CXXFLAGS -pg"]
)
dnl The idea with this pgsql code is to check for a system installed
dnl postgresql and use it if found. However, if the user specifies
dnl an alternate install location, use that instead.
dnl Prepare to capture the user's input for the location of a pgsql
dnl installation.
AC_ARG_WITH(pgconfig,
AS_HELP_STRING([--with-pgconfig=FILE],[Specify an alternate pg_config location.]),
[pg_config_binary=$withval], [pg_config_binary=""]
)
if test "x$pg_config_binary" = "x"; then
dnl pg_config was not specified; search for it it in PATH.
AC_PATH_PROG([pg_config_binary], [pg_config])
if test "x$pg_config_binary" = "x"; then
AC_MSG_ERROR([Could not find pg_config. Ensure that PostgreSQL is installed, or specify pg_config location using --with-pgconfig.])
fi
elif test -f $pg_config_binary; then
AC_MSG_RESULT([Using pg_config: $pg_config_binary])
else
AC_MSG_ERROR([pg_config file $pg_config_binary does not exist])
fi
pgsql_includedir=$($pg_config_binary --includedir)
pgsql_libdir=$($pg_config_binary --libdir)
CXXFLAGS="$CXXFLAGS -I$pgsql_includedir"
CPPFLAGS="$CPPFLAGS -I$pgsql_includedir"
LIBS="$LIBS -L$pgsql_libdir"
dnl Check for the pgsql library and header file.
dnl Need to generalize when mysql support is added.
AC_CHECK_LIB(pq, PQconnectdb)
AC_CHECK_HEADER([libpq-fe.h])
AC_DEFINE([HAVE_PGSQL],[],[Using PostGreSQL])
dnl Enable log4cplus if required
AC_ARG_WITH(log4cplus,
AS_HELP_STRING([--with-log4cplus],[Check log4cplus, if not enabled some modules may not have logging support]),
[check_log4cplus=$withval]
)
LOG4CPLUS_LIB="${check_log4cplus}/lib"
AC_ARG_WITH(log4cplus-lib,
AS_HELP_STRING([--with-log4cplus-lib=LOG4CPLUSLIBDIR],[Specify location to find liblog4cplus.so]),
[LOG4CPLUS_LIB=$withval]
)
LOG4CPLUS_INCLUDE="${check_log4cplus}/include"
AC_ARG_WITH(log4cplus-include,
AS_HELP_STRING([--with-log4cplus-include=LOG4CPLUSINCLUDEDIR],[Specify location to find logger.h]),
[LOG4CPLUS_INCLUDE=$withval]
)
if test "x$check_log4cplus" != "x" ; then
AC_MSG_CHECKING([for liblog4cplus.so])
if ! test -f "$LOG4CPLUS_LIB/liblog4cplus.so" ; then
AC_MSG_ERROR( [Unable to find liblog4cplus.so, ]dnl
[please use the --with-log4cplus-lib argument to point to the right path])
fi
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([for log4cplus/logger.h])
if ! test -f "$LOG4CPLUS_INCLUDE/log4cplus/logger.h" ; then
AC_MSG_ERROR( [Unable to find log4cplus/logger.h, ]dnl
[please use the --with-log4cplus-include argument to point to the right path])
fi
AC_MSG_RESULT([yes])
AC_DEFINE([ENABLE_LOG4CPLUS], [], [Enable LOG4CPLUS])
LDFLAGS="${LDFLAGS} -L${LOG4CPLUS_LIB} -llog4cplus"
CXXFLAGS="${CXXFLAGS} -I${LOG4CPLUS_INCLUDE}"
fi
dnl Enable liboath if required
AC_ARG_WITH(liboath,
AS_HELP_STRING([--with-liboath],[Check liboath, if not enabled TOTP functionality will not be available]),
[check_liboath=$withval]
)
if test "$check_liboath" == "yes" ; then
check_liboath=/usr/local
fi
OATH_LIB="${check_liboath}/lib"
AC_ARG_WITH(liboath-lib,
AS_HELP_STRING([--with-liboath-lib=LIBOATHLIBDIR],[Specify location to find liboath.so]),
[OATH_LIB=$withval]
)
OATH_INCLUDE="${check_liboath}/include"
AC_ARG_WITH(liboath-include,
AS_HELP_STRING([--with-liboath-include=OATHINCLUDEDIR],[Specify location to find oath.h]),
[OATH_INCLUDE=$withval]
)
if test "x$check_liboath" != "x" ; then
LDFLAGS="${LDFLAGS} -L${OATH_LIB}"
CXXFLAGS="${CXXFLAGS} -I${OATH_INCLUDE} -L${OATH_LIB}"
dnl AC_CHECK_FILE("$OATH_LIB/liboath.so",, [AC_MSG_ERROR([Unable to find liboath.so, \
dnl please use the --with-liboath-lib argument to point to the right path],1)])
AC_CHECK_LIB(oath,oath_totp_validate,, [AC_MSG_ERROR([Unable to find liboath.so, please use the --with-liboath-lib argument to point to the right path],1)])
AC_CHECK_FILE("$OATH_INCLUDE/liboath/oath.h",, [AC_MSG_ERROR([Unable to find oath.h, please use the --with-liboath-include argument to point to the right path],1)])
dnl AC_DEFINE([ENABLE_LIBOATH], [], [Enable LIBOATH])
fi
dnl Allow selection of additional includes and libraries paths
dnl just in case!
AC_ARG_WITH(extra-includes,
AS_HELP_STRING([--with-extra-includes=INCLUDESDIR],[Specify location to find additional include files]),
[CXXFLAGS="$CXXFLAGS -I$withval"]
)
AC_ARG_WITH(extra-libraries,
AS_HELP_STRING([--with-extra-libraries=LIBRARYDIR],[Specify location to find additional libraries]),
[LDFLAGS="$LDFLAGS -L$withval"]
)
dnl AX_BOOST_THREAD requires AX_BOOST_BASE
AX_BOOST_BASE
AX_BOOST_THREAD
AX_CXX_COMPILE_STDCXX_11
echo
echo "Detecting modules..."
echo
build_modccontrol=false
build_modchanfix=false
build_modclientExample=false
build_modcloner=false
build_modcservice=false
build_moddronescan=false
build_modgnutest=false
build_modnickserv=false
build_modopenchanfix=false
build_modscanner=false
build_modstats=false
build_modsnoop=false
NEW_MODS=""
MOD_DIRS=""
searchForMods=yes
AC_ARG_ENABLE(modules,
AS_HELP_STRING([--enable-modules=mods],[Enable one or more modules; all modules found in the \
current directory are enabled by default. Specify "no" (without quotes) \
to build server only]),
[
dnl echo "enableval: $enableval"
if test $enableval = "yes" ; then
searchForMods=yes
elif test $enableval = "no" ; then
searchForMods=no
else
tmp="mod.$enableval"
dnl echo "tmp: $tmp"
tmp=`echo $tmp | sed 's/,/ mod./g'`
dnl echo "tmp: $tmp"
MOD_DIRS="$MOD_DIRS $tmp"
searchForMods=no
fi],[searchForMods=yes]) dnl AC_ARG_ENABLE
if test x$searchForMods = xyes ; then
for dir in ${srcdir}/mod.* ; do
if ! test -d $dir ; then
continue
fi
MOD_DIRS="$MOD_DIRS `basename $dir`"
done
fi
dnl Prepare for conditionals
for moduleName in $MOD_DIRS; do
case "$moduleName" in
mod.ccontrol) build_modccontrol=true;;
mod.chanfix) build_modchanfix=true;;
mod.clientExample) build_modclientExample=true;;
mod.cloner) build_modcloner=true;;
mod.cservice) build_modcservice=true;;
mod.dronescan) build_moddronescan=true;;
mod.gnutest) build_modgnutest=true;;
mod.nickserv) build_modnickserv=true;;
mod.openchanfix) build_modopenchanfix=true;;
mod.scanner) build_modscanner=true;;
mod.stats) build_modstats=true;;
mod.snoop) build_modsnoop=true;;
*) NEW_MODS="$NEW_MODS $moduleName";;
esac
done
AM_CONDITIONAL(COND_MODCCONTROL,[test $build_modccontrol = true])
AM_CONDITIONAL(COND_MODCHANFIX,[test $build_modchanfix = true])
AM_CONDITIONAL(COND_MODCLIENTEXAMPLE,[test $build_modclientExample = true])
AM_CONDITIONAL(COND_MODCLONER,[test $build_modcloner = true])
AM_CONDITIONAL(COND_MODCSERVICE,[test $build_modcservice = true])
AM_CONDITIONAL(COND_MODDRONESCAN,[test $build_moddronescan = true])
AM_CONDITIONAL(COND_MODGNUTEST,[test $build_modgnutest = true])
AM_CONDITIONAL(COND_MODNICKSERV,[test $build_modnickserv = true])
AM_CONDITIONAL(COND_MODOPENCHANFIX,[test $build_modopenchanfix = true])
AM_CONDITIONAL(COND_MODSCANNER,[test $build_modscanner = true])
AM_CONDITIONAL(COND_MODSTATS,[test $build_modstats = true])
AM_CONDITIONAL(COND_MODSNOOP,[test $build_modsnoop = true])
AC_SUBST(NEW_MODS)
AC_SUBST(CXXFLAGS)
AC_SUBST(INCLTDL)
AC_SUBST(LIBLTDL)
AC_SUBST(LIBTOOL_DEPS)
AC_SUBST(pgsql_includedir)
AC_SUBST(pgsql_libdir)
AC_CONFIG_FILES([Makefile \
tools/checkgnuworld.sh])
AC_OUTPUT
echo ""
echo "##########################"
echo "# GNUWorld Configuration #"
echo "##########################"
echo ""
echo "Configuration of GNUWorld is complete - you're almost ready to run 'make'..."
echo ""
echo "Check the following files for modification before building:"
echo " include/gnuworld_config.h"
if test $build_modcservice = true ; then
echo " mod.cservice/cservice_config.h"
fi
if test $build_modopenchanfix = true ; then
echo " mod.openchanfix/chanfix_config.h"
fi
echo ""