This repository has been archived by the owner on Feb 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathconfigure.ac
442 lines (370 loc) · 15 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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
AC_PREREQ([2.68])
AC_COPYRIGHT([2014 elemental-ircd Team])
AC_INIT([elemental-ircd],[7.0-experimental],[https://github.com/Elemental-IRCd/elemental-ircd/issues])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([libratbox/aux])
AC_CONFIG_SRCDIR([src/ircd.c])
AC_CONFIG_HEADERS([include/setup.h])
AC_PREFIX_DEFAULT($HOME/ircd)
AC_LANG(C)
AM_INIT_AUTOMAKE([])
AM_SILENT_RULES([yes])
AM_PROG_AR
AC_PROG_CC_C99([], [AC_MSG_ERROR(elemental-ircd requires a C99 capable compiler)])
LT_INIT([dlopen disable-static])
LT_CONFIG_LTDL_DIR([extra/libltdl])
LTDL_INIT
build_ltdl=$with_included_ltdl
AM_CONDITIONAL([BUILD_LTDL], [test x"$build_ltdl" = x"yes"])
GCC_STACK_PROTECT_CC
AC_CONFIG_SUBDIRS(libratbox)
AC_SEARCH_LIBS([strerror],[cposix])
AC_C_INLINE
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_GCC_TRADITIONAL
AC_PROG_MAKE_SET
AC_PROG_SED
AC_PROG_YACC
AC_PROG_LEX
AC_CHECK_PROGS(TCLSH, [tclsh tclsh8.6 tclsh8.5])
dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
fi
if test "$LEX" = ":"; then
AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
fi
AC_ARG_ENABLE([fhs-paths],
[AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])],
[],
[dnl detect if the user appears to want --enable-fhs-paths
AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \
test "$localstatedir" = '${prefix}/var' && \
test "$libdir" = '${exec_prefix}/lib'],
[enable_fhs_paths=no],
[enable_fhs_paths=yes])
])
dnl use directory structure of cached as default (hack)
AS_IF([test "x$enable_fhs_paths" = "xyes"],
[dnl Avoid name collisions.
pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}'
rundir=${rundir-'${prefix}/run'}
pkgrundir='${rundir}/${PACKAGE_TARNAME}'
pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'],
[libexecdir='${bindir}'
pkglibexecdir='${libexecdir}'
rundir='${sysconfdir}'
pkgrundir='${rundir}'
localstatedir='${prefix}'
pkglocalstatedir='${sysconfdir}'])
pkglibdir='${libdir}/${PACKAGE_TARNAME}'
AC_SUBST([pkglibdir])
AC_SUBST([rundir])
AC_SUBST([pkgrundir])
AC_SUBST([pkglocalstatedir])
AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as ban database]])
AC_SUBST([pkglibexecdir])
AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live])
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/resource.h sys/param.h errno.h stddef.h sys/wait.h wait.h sys/uio.h])
dnl Stuff that the memory manager (imalloc) depends on
dnl ==================================================
AC_C_CONST
AC_C_BIGENDIAN
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
dnl Needed for bandb
PKG_CHECK_MODULES([SQLITE], [sqlite3 > 3.0.0])
dnl Networking Functions
dnl ====================
AC_ARG_ENABLE(ipv6,
AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
if test x"$ac_cv_header_sys_wait_h" = yes -o x"$ac_cv_header_wait_h" = yes; then
VICONF=yes
dnl We need one of the above to build viconf. Just a sanity check,
dnl we don't want to stop people from building the rest of ircd
dnl just because they can't build viconf.
fi
AM_CONDITIONAL([BUILD_VICONF],[test x"$VICONF" = x"yes"])
dnl See whether we can include both string.h and strings.h.
AC_CACHE_CHECK([whether string.h and strings.h may both be included],
gcc_cv_header_string,
[
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <string.h>
#include <strings.h>
])],
[gcc_cv_header_string=yes],
[gcc_cv_header_string=no])
])
if test "$gcc_cv_header_string" = "yes"; then
AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h])
fi
AC_C_BIGENDIAN
dnl Check for stdarg.h - if we cant find it, halt configure
AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])])
AC_CHECK_TYPE([u_int32_t], [],
[
AC_CHECK_TYPE([uint32_t],
[
AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
],
[
AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int])
AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.])
])
])
AC_CHECK_TYPE([u_int16_t], [],
[
AC_CHECK_TYPE([uint16_t],
[
AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
],
[
AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int])
AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.])
])
])
AC_CHECK_TYPES([uintptr_t])
dnl check for various functions...
AC_CHECK_FUNCS([strlcat strlcpy])
AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup sigaction geteuid])
dnl Specialized functions checks
dnl ============================
dnl check for nanosleep
AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
LIBS="${LIBS} -lrt",
[AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
)])])
if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
then
AC_MSG_RESULT("nanosleep not found..using select for delay")
else
AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
fi
dnl **********************************************************************
dnl --with-confdir Deprecated, use --sysconfdir
dnl **********************************************************************
AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.])
dnl **********************************************************************
dnl Check for --with-logdir
dnl **********************************************************************
AC_MSG_CHECKING([whether to modify logdir])
AC_ARG_WITH(logdir,
AS_HELP_STRING([--with-logdir=DIR],[Directory where to write logfiles.]),
[ logdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes)],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[logdir='${localstatedir}/log/${PACKAGE_TARNAME}'],
[logdir='${prefix}/logs'])
AC_MSG_RESULT(no)])
AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.])
AC_SUBST_DIR([logdir])
dnl **********************************************************************
dnl Check for --with-helpdir
dnl **********************************************************************
AC_MSG_CHECKING([whether to modify helpdir])
AC_ARG_WITH(helpdir,
AS_HELP_STRING([--with-helpdir=DIR],[Directory to install help files.]),
[ helpdir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes) ],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[helpdir='${datadir}/${PACKAGE_TARNAME}/help'],
[helpdir='${prefix}/help'])
AC_MSG_RESULT(no) ])
AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.])
AC_SUBST_DIR([helpdir])
dnl **********************************************************************
dnl Check for --with-moduledir
dnl **********************************************************************
AC_MSG_CHECKING([whether to modify moduledir])
AC_ARG_WITH(moduledir,
[AS_HELP_STRING([--with-moduledir=DIR],[Directory to install modules.])],
[ moduledir=`echo $withval | sed 's/\/$//'`
AC_MSG_RESULT(yes)],
[ AS_IF([test "x$enable_fhs_paths" = "xyes"],
[moduledir='${pkglibdir}/modules'],
[moduledir='${prefix}/modules'])
AC_MSG_RESULT(no)
])
AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
AC_SUBST_DIR([moduledir])
dnl Check for --with-rundir
AC_MSG_CHECKING([whether or modify rundir])
AC_ARG_WITH([rundir],
[AS_HELP_STRING([--with-rundir=DIR],[Directory in which to store pidfile.])],
[AC_MSG_RESULT([yes])
rundir=`echo $withval | sed 's/\/$//'`],
[AC_MSG_RESULT([no])
AS_IF([test "x$enable_fhs_paths" = "xyes"],
[rundir='${prefix}/run'],
[rundir='${sysconfdir}'])])
AC_SUBST([rundir])
AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.])
dnl Installed utility program prefixes (does not affect binaries
dnl installed into pkglibexecdir)
AC_MSG_CHECKING([for program prefix])
AC_ARG_WITH([program-prefix],
[AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])],
[test "x$with_program_prefix" = "xno" && with_program_prefix=],
[with_program_prefix=])
AC_MSG_RESULT(["$with_program_prefix"])
PROGRAM_PREFIX="$with_program_prefix"
AC_SUBST([PROGRAM_PREFIX])
AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.])
dnl Debug-related options
dnl =====================
AC_ARG_ENABLE(assert, AS_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),[],[enable_assert=no])
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],[Enable debug build, enables asserts]),[],[enable_debug=no])
AC_ARG_ENABLE(sanitize, AS_HELP_STRING([--enable-sanitize],[Enables address and undefined behaviour sanitizers if available, enables debug]),[],[enable_sanitize=no])
AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage],[Enable gcov based code coverage]), [], [enable_coverage=no])
if test x"$enable_coverage" = x"yes"; then
AX_APPEND_LINK_FLAGS([-lgcov])
AX_APPEND_COMPILE_FLAGS([-fprofile-arcs])
AX_APPEND_COMPILE_FLAGS([-ftest-coverage])
enable_debug=yes
fi
if test x"$enable_sanitize" != x"no"; then
AX_APPEND_LINK_FLAGS([-fsanitize=address])
AX_APPEND_LINK_FLAGS([-fsanitize=undefined])
enable_debug="yes";
fi
if test x"$enable_debug" != x"no"; then
AX_APPEND_COMPILE_FLAGS([-g])
AX_APPEND_COMPILE_FLAGS([-Og])
enable_assert="hard";
fi;
if test x"$enable_assert" = x"no"; then
AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
elif test x"$enable_assert" = x"soft"; then
AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
elif test x"$enable_assert" = x"yes"; then
enable_assert="hard";
fi
AC_MSG_CHECKING(if you want IO Debugging hooks)
AC_ARG_ENABLE(iodebug,
AS_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
[iodebug=$enableval], [iodebug=no])
if test "$iodebug" = yes; then
AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_ARG_ENABLE(balloc,
AS_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
[balloc=$enableval], [balloc=yes])
if test "$balloc" = no; then
AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
fi
AC_ARG_ENABLE(small-net,
AS_HELP_STRING([--disable-small-net],[Disable small network support.]),
[small_net=$enableval], [small_net=yes])
if test "$small_net" = yes; then
AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.])
AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.])
AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
AC_DEFINE([FD_HEAP_SIZE], 128, [Size of fd heap.])
AC_DEFINE([AWAY_HEAP_SIZE], 128, [Size of away heap.])
else
dnl These settings are for a large network like efnet..they will use lots of memory
dnl so enable small net unless you really need this much support
AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.])
AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.])
fi
AC_ARG_WITH(nicklen,
AS_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 31, max 50)]),
[
if ! expr "$withval" + 0 >/dev/null 2>&1; then
AC_MSG_ERROR(NICKLEN must be a numeric value)
fi
if test $withval -ge 50; then
NICKLEN=50
AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
else
NICKLEN="$withval"
fi
], [NICKLEN=31])
AC_ARG_WITH(topiclen,
AS_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
[
if test $withval -ge 390; then
TOPICLEN=390
AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
else
TOPICLEN=$withval
fi
], [TOPICLEN=390])
AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
RB_CFLAGS
RB_FORTIFY_SOURCE(1)
AC_DEFINE_UNQUOTED(EXEEXT, "${EXEEXT}", [Executable extension])
AC_SUBST(MODULES_LIBS)
AC_SUBST(MOD_TARGET)
AC_SUBST(LDFLAGS)
AC_SUBST(PICFLAGS)
AC_SUBST(SEDOBJ)
if test "$prefix" = "NONE"; then
AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
else
dnl Don't get bitten by Cygwin's stupidity if the user specified
dnl a custom prefix with a trailing slash
prefix=`echo $prefix | sed 's/\/$//'`
AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
fi
AC_CONFIG_FILES( \
Makefile \
bandb/Makefile \
ssld/Makefile \
extensions/Makefile \
src/Makefile \
modules/Makefile \
tests/Makefile \
tools/Makefile \
tools/genssl.sh \
doc/Makefile \
help/Makefile \
)
AC_OUTPUT
echo "
Configuration:
Install directory : $prefix
Small network : $small_net
Block allocator : $balloc
Nickname length : $NICKLEN
Topic length : $TOPICLEN
Use (g)make to compile elemental-ircd, then (g)make install to install it.
"