-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.in
539 lines (458 loc) · 13.9 KB
/
configure.in
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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
dnl Process this file with autoconf to produce a configure script.
dnl -------------------------------------------------------------
AC_INIT(IServerd, 2.5.5-20080609, BUGS on http://sourceforge.net/projects/iserverd)
AC_PREREQ(2.52)
AC_CANONICAL_HOST
AC_UNAME_SYS
AM_INIT_AUTOMAKE(IServerd, 2.5.5-20080609)
AC_CONFIG_HEADER(include/config.h)
MAJOR_VERSION=2
MINOR_VERSION=5
PATCH_LEVEL=5-20080609
VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_LEVEL}"
AC_DEFINE_UNQUOTED(Iversion, "$VERSION", [Version number of package.])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_YACC
AC_PROG_LEX
AC_COMPILE_CHECK_SIZEOF(char)
AC_COMPILE_CHECK_SIZEOF(long)
AC_COMPILE_CHECK_SIZEOF(unsigned long)
AC_COMPILE_CHECK_SIZEOF(int)
AC_COMPILE_CHECK_SIZEOF(unsigned int)
AC_COMPILE_CHECK_SIZEOF(short)
AC_COMPILE_CHECK_SIZEOF(unsigned short)
PETI_PATH_SENDMAIL
MKPATH=$PATH:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
AC_PATH_PROG(MKTEMP,mktemp,,$MKPATH)
CFLAGS="$CFLAGS -Iinclude -I/usr/include -I/usr/local/include"
CPPFLAGS="$CPPFLAGS -Iinclude -I/usr/include -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/lib -L/usr/local/lib"
dnl Checks for libraries.
AC_CHECK_LIB(m, main)
AC_CHECK_LIB(cygipc, semop, [LIBS="$LIBS -lcygipc"])
AC_CHECK_LIB(epoll, epoll_create, [LIBS="$LIBS -lepoll"])
dnl Check for prefix directory
if test "$prefix" = "NONE"; then
prefix=$ac_default_prefix
VAR_DIR="/var/run/iserverd"
ETC_DIR="/etc/iserverd"
BIN_DIR="/usr/bin"
SBIN_DIR="/usr/sbin"
LOG_DIR="/var/log/iserverd"
MAN_DIR="/usr/share/man"
SBIN_RULE='$(SBIN_DIR): $(BIN_DIR)'
SBIN_ACT=' $(mkinstalldirs) $(SBIN_DIR);'
else
AC_DEFINE([ENABLE_SWITCH], 1, [Check if iserverd can switch into prefix directory])
VAR_DIR="$prefix/var"
ETC_DIR="$prefix/etc"
BIN_DIR="$prefix/bin"
SBIN_DIR="$prefix/bin"
LOG_DIR="$prefix/log"
MAN_DIR="$prefix/man"
SBIN_RULE=""
SBIN_ACT=""
fi
dnl ##### Now we should check if user set fixed directories #####
dnl check if user specified ETC directory path
AC_ARG_WITH(etcdir,
[ --with-etcdir=DIR Where to put config files (/etc/$pr_name/)],
[ case "$withval" in
yes|no)
AC_MSG_WARN([--with-etcdir called without argument - will use default])
;;
* )
ETC_DIR="$withval"
;;
esac
]
)
dnl check if user specified VAR directory path
AC_ARG_WITH(vardir,
[ --with-vardir=DIR Where to put runtime and pid files (/var/run/$pr_name/)],
[ case "$withval" in
yes|no)
AC_MSG_WARN([--with-vardir called without argument - will use default])
;;
* )
VAR_DIR="$withval"
;;
esac
]
)
dnl check if user specified LOG directory path
AC_ARG_WITH(logdir,
[ --with-logdir=DIR Where to put log files (/var/log/$pr_name/)],
[ case "$withval" in
yes|no)
AC_MSG_WARN([--with-logdir called without argument - will use default])
;;
* )
LOG_DIR="$withval"
;;
esac
]
)
dnl check if user specified BIN directory path
AC_ARG_WITH(bindir,
[ --with-bindir=DIR Where to put executable files (/usr/bin/)],
[ case "$withval" in
yes|no)
AC_MSG_WARN([--with-bindir called without argument - will use default])
;;
* )
BIN_DIR="$withval"
;;
esac
]
)
dnl check if user specified SBIN directory path
AC_ARG_WITH(sbindir,
[ --with-sbindir=DIR Where to put daemons files (/usr/bin/)],
[ case "$withval" in
yes|no)
AC_MSG_WARN([--with-sbindir called without argument - will use default])
;;
* )
SBIN_DIR="$withval"
;;
esac
]
)
dnl check if user specified MAN directory path
AC_ARG_WITH(mandir,
[ --with-mandir=DIR Where to put manuals (/usr/share/man)],
[ case "$withval" in
yes|no)
AC_MSG_WARN([--with-mandir called without argument - will use default])
;;
* )
MAN_DIR="$withval"
;;
esac
]
)
if test "$exec_prefix" = "NONE"; then
exec_prefix=$prefix
fi
SERVROOT="$prefix"
AC_SUBST(SERVROOT)
AC_DEFINE_UNQUOTED(SERVER_ROOT, "$prefix", [Server root])
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(sys/types.h stdio.h stddef.h sys/wait.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(strings.h)
AC_CHECK_HEADERS(sys/sockio.h)
AC_CHECK_HEADERS(term.h)
AC_CHECK_HEADERS(sys/int_types.h)
AC_CHECK_HEADERS(sys/file.h)
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(sys/epoll.h)
AC_CHECK_HEADERS(sys/event.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(sys/pstat.h endian.h)
AC_CHECK_HEADERS(sys/poll.h poll.h)
AC_CHECK_HEADERS(sys/fcntl.h sys/stat.h sys/file.h stdarg.h errno.h)
AC_CHECK_HEADERS(unistd.h sys/ipc.h sys/sem.h sys/msg.h sys/shm.h)
AC_CHECK_HEADERS(stdlib.h string.h ctype.h sys/resource.h)
AC_CHECK_HEADERS(sys/param.h sys/ioctl.h sys/socket.h arpa/inet.h)
AC_CHECK_HEADERS(netinet/in.h netdb.h sys/un.h syslog.h)
AC_CHECK_HEADERS(machine/endian.h signal.h)
AC_CHECK_HEADERS([net/if.h], [], [],
[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
AC_CHECK_LIB(gd, gdImageCreate,
[
AC_CHECK_HEADERS([gd.h],
[
AC_CHECK_HEADERS([gdfontg.h],
[
GD_LIBS=" -lgd "
AC_SUBST(GD_LIBS)
AC_DEFINE([HAVE_GD], 1, [If we have gd.])
])
])
])
AC_CHECK_LIB(iconv, iconv,
[
AC_CHECK_HEADERS([iconv.h],
[
LIBS="$LIBS -liconv"
AC_DEFINE([HAVE_ICONV], 1, [If we have iconv.])
])
])
AC_CHECK_FUNCS(atexit)
if test "$ac_cv_func_atexit" != yes; then
AC_CHECK_FUNCS(on_exit)
if test "$ac_cv_func_on_exit" != yes; then
echo "no capability to register termination functions found."
fi
fi
AC_CHECK_FUNCS(srandomdev)
if test "$ac_cv_func_srandomdev" = yes; then
AC_DEFINE(HAVE_SRANDOMDEV)
fi
AC_CHECK_FUNCS([vsyslog])
AC_CHECK_FUNCS([strerror pstat setproctitle mktemp mkstemp])
AC_CHECK_FUNCS([ualarm sigaction sigprocmask sigaddset])
AC_CHECK_FUNCS([setsid seteuid setegid setpgid])
CHECK_BACKTRACE
if test "$ac_cv_check_backtrace" = "yes"; then
LIBS="$LIBS -lexecinfo";
fi
AC_CHECK_FUNCS(fcntl)
if test "$ac_cv_func_fcntl" != yes; then
AC_CHECK_FUNCS(flock)
if test "$ac_cv_func_flock" != yes; then
AC_CHECK_FUNCS(lockf)
if test "$ac_cv_func_lockf" != "yes"; then
AC_CHECK_FUNCS(flockfile)
if test "$ac_cv_func_flockfile" != "yes"; then
echo "No native file locking capabilities found."
fi
fi
fi
fi
AC_CHECK_FUNCS(memcpy, AC_DEFINE(HAVE_MEMCPY))
AC_FUNC_FORK
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_SOCKLEN_T
if test "$ac_cv_type_socklen_t" = no; then
AC_RECVFROM_WITH_INT
fi
ETR_SYSV_IPC
ETR_STRUCT_SEMUN
AC_FUNC_SETPGRP
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_SIGNAL
dnl Check for u_int64_t
AC_CHECK_TYPE(u_int64_t, unsigned long long)
if test "$ac_cv_type_u_int64_t" = "yes"; then
AC_DEFINE([HAVE_TYPE_U_INT64_T], 1, [Have u_int64_t])
fi
AC_PATH_PG_INC
if test "$have_pg_inc" = "no"; then
AC_MSG_ERROR([
I can't find the Postgress DB header files.
Install the Postgress C frontend library, or if you have them installed,
override this check with the --with-postgresdb argument.
])
fi
AC_PATH_PG_LIB
if test "$have_pg_lib" = "yes"; then
AC_DEFINE([HAVE_POSTGRESDB], 1, [If we have postgresql libs.])
else
AC_MSG_ERROR([
I found PostgresDB header files but can't find proper libraries.
Check path for library files - they should be placed in ${postgresdb}/lib
directory or in public library directory.
])
fi
AC_PATH_PG_BIN
if test "$have_pg_bin" = yes; then
AC_DEFINE([HAVE_POSTGRESBIN], 1, [If we have postgresql bins.])
else
AC_MSG_ERROR([
I found PostgresDB headers and libraries but can't find binaries (psql,
createdb, dropdb, dropuser, createuser, pg_dump, pg_passwd, vacuumdb).
Check path for binaries - they should be placed in ${postgresdb}/bin
directory or in public binaries directory.
])
fi
AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
[AC_TRY_LINK(
[#include <machine/vmparam.h>
#include <sys/exec.h>
],
[PS_STRINGS->ps_nargvstr = 1;
PS_STRINGS->ps_argvstr = "foo";],
[pgac_cv_var_PS_STRINGS=yes],
[pgac_cv_var_PS_STRINGS=no])])
if test "$pgac_cv_var_PS_STRINGS" = yes ; then
AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS thing exists.])
fi
AC_CHECK_FUNCS(socket)
if test $ac_cv_func_socket = no; then
# socket is not in the default libraries. See if it's in some other.
for lib in socket inet bsd; do
AC_CHECK_LIB($lib, socket, [AC_DEFINE(HAVE_SOCKET)
LIBS="$LIBS -l$lib"; break])
done
fi
AC_CHECK_FUNCS(gethostname)
if test $ac_cv_func_gethostname = no; then
# gethostname is not in the default libraries. See if it's in some other.
for lib in socket nsl inet; do
AC_CHECK_LIB($lib, gethostname, [AC_DEFINE(HAVE_GETHOSTNAME)
LIBS="$LIBS -l$lib"; break])
done
fi
AC_CHECK_FUNCS(gethostbyname)
if test $ac_cv_func_gethostbyname = no; then
# gethostbyname is not in the default libraries. See if it's in some other.
for lib in socket nsl inet; do
AC_CHECK_LIB($lib, gethostbyname, [AC_DEFINE(HAVE_GETHOSTBYNAME)
LIBS="$LIBS -l$lib"; break])
done
fi
AC_CHECK_FUNCS(gethostbyaddr)
if test $ac_cv_func_gethostbyaddr = no; then
# gethostbyaddr is not in the default libraries. See if it's in some other.
for lib in socket nsl inet; do
AC_CHECK_LIB($lib, gethostbyaddr, [AC_DEFINE(HAVE_GETHOSTBYADDR)
LIBS="$LIBS -l$lib"; break])
done
fi
AC_CHECK_FUNCS(getprotobyname)
if test $ac_cv_func_getprotobyname = no; then
# getprotobyname is not in the default libraries. See if it's in some other.
for lib in socket nsl inet; do
AC_CHECK_LIB($lib, getprotobyname, [AC_DEFINE(HAVE_GETPROTOBYNAME)
LIBS="$LIBS -l$lib"; break])
done
fi
AC_CHECK_FUNCS(inet_aton)
if test $ac_cv_func_inet_aton = no; then
# inet_aton is not in the default libraries. See if it's in some other.
for lib in socket nsl inet; do
AC_CHECK_LIB($lib, inet_aton, [AC_DEFINE(HAVE_INET_ATON)
LIBS="$LIBS -l$lib"; break])
done
fi
dnl Not ready yet....
dnl AC_NEED_STDINT_H(include/mystdint.h)
dnl Various enable/disable checks.
AC_MSG_CHECKING(if server should be compiled with debug symbols)
AC_ARG_WITH(debug,
[ --with-debug enable debug symbols], [
if test x$withval = xyes;
then
AC_MSG_RESULT(yes)
DBG="-g -ggdb3 -Wall"
STRIPKEY=""
AC_SUBST(DBG)
fi ], [
AC_MSG_RESULT(no)
STRIPKEY="-s"
])
dnl Priority - kqueue, epoll, poll
AC_MSG_CHECKING(if user wants poll() support)
AC_ARG_WITH(poll,
[ --with-poll enable default poll support], [
if test x$withval = xyes;
then
AC_MSG_RESULT(yes)
AC_DEFINE([USE_POLL], 1, [Define to use poll interface])
fi ], [
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if user wants kqueue support)
AC_ARG_WITH(kqueue,
[ --with-kqueue enable kqueue support], [
if test x$withval = xyes;
then
AC_MSG_RESULT(yes)
AC_CHECK_FUNCS(kqueue)
if test "$ac_cv_func_kqueue" = "yes" ; then
AC_CHECK_FUNCS(kevent, [ kqueue_func="yes" ], )
if test "X$kqueue_func" = "X" ; then
AC_MSG_WARN(**** kevent() not found - kqueue support disabled ****)
AC_DEFINE(USE_POLL)
else
AC_DEFINE([USE_KQUEUE], 1, [Define to use kqueue interface])
fi
else
AC_MSG_WARN(**** kqueue() not found - kqueue support disabled ****)
AC_DEFINE(USE_POLL)
fi
fi ], [
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if user wants epoll support)
AC_ARG_WITH(epoll,
[ --with-epoll enable epoll support], [
if test x$withval = xyes;
then
AC_MSG_RESULT(yes)
dnl Check for the Linux epoll interface; epoll* may be available in libc
dnl but return ENOSYS on a pre-2.6 kernel, so do a run-time check.
AC_CACHE_CHECK([for working epoll_create() function], [apr_cv_epoll],
[AC_TRY_RUN([
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_STDDEF_H
#include <stddef.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_EPOLL_H
#include <sys/epoll.h>
#endif
int main() { return epoll_create(5) == -1; }
], [apr_cv_epoll=yes], [apr_cv_epoll=no], [apr_cv_epoll=no])])
if test "$apr_cv_epoll" = "yes"; then
AC_DEFINE([HAVE_EPOLL], 1, [Define if the epoll interface is supported])
AC_DEFINE([USE_EPOLL], 1, [Define to use epoll interface])
else
AC_MSG_WARN(**** epoll_create() not found - epoll support disabled ****)
AC_DEFINE(USE_POLL)
fi
fi ], [
AC_MSG_RESULT(no)
dnl This currently enabled by default
AC_DEFINE(USE_POLL)
])
])
])
AC_NEED_STDINT_H(include/mystdint.h)
PETI_ENABLED_DYNAMIC_LINKING
AC_SUBST(VAR_DIR)
AC_SUBST(ETC_DIR)
AC_SUBST(BIN_DIR)
AC_SUBST(LOG_DIR)
AC_SUBST(MAN_DIR)
AC_SUBST(SBIN_DIR)
AC_SUBST(STRIPKEY)
AC_SUBST(SBIN_RULE)
AC_SUBST(SBIN_ACT)
SYS_MKTMP="yes"
if test x$MKTEMP = x ; then
MKTEMP="$BIN_DIR/mktemp"
SYS_MKTMP="no"
AC_MSG_WARN([I can't find mktemp utility, i'll use my own mktemp...])
fi
AC_SUBST(SYS_MKTMP)
dnl Now we can setup Makefiles and scripts with includes
AC_OUTPUT(Makefile data/Makefile script/Makefile
IServerd.spec
script/iserver_icquser script/db_manage.sh include/defaults.h
script/iserverd.sh script/iserverd.sh.asp
script/iserver_post_mess.cgi man/Makefile
script/iserver_convert_db.sh
data/etc/iserv.conf.default
data/etc/v3_proto.conf.default
data/etc/v5_proto.conf.default
data/etc/v7_proto.conf.default
data/etc/actions.conf.default)