forked from jabberd2/jabberd2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
829 lines (761 loc) · 31.7 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
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
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
# jabberd2 configure script
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT(jabberd, 2.1, jabberd2@xiaoka.com)
AC_CONFIG_SRCDIR([sx/sx.h])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
# libtool for internal linking
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
# extra paths
AC_ARG_WITH([extra_include_path], AC_HELP_STRING([--with-extra-include-path],
[use additional include paths]),
extra_include_path=$withval)
split_includes="`echo $extra_include_path | sed -e 's/:/ /g'`"
for incpath in $split_includes ; do
CPPFLAGS="-I$incpath $CPPFLAGS"
done
AC_ARG_WITH([extra_library_path], AC_HELP_STRING([--with-extra-library-path],
[use additional library paths]),
extra_library_path=$withval)
split_libs="`echo $extra_library_path | sed -e 's/:/ /g'`"
for libpath in $split_libs ; do
LDFLAGS="-L$libpath $LDFLAGS"
done
# developer flags
AC_ARG_ENABLE([developer], AC_HELP_STRING([--enable-developer], [Compile with warnings and debugging symbols]),
CFLAGS="-Wall -g $CFLAGS")
# debugging
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable debug messages]),
want_debug=$enableval, want_debug=no)
if test "x-$want_debug" = "x-yes" ; then
AC_DEFINE(DEBUG,1,[Define to 1 if you want to get debug output with -D.])
AC_DEFINE(SX_DEBUG,1,[Define to 1 if you want to get SX debug output with -D.])
fi
AC_ARG_ENABLE(nad_debug, AC_HELP_STRING([--enable-nad-debug], [enable NAD pointer tracking]),
want_nad_debug=$enableval, want_nad_debug=no)
if test "x-$want_nad_debug" = "x-yes" ; then
AC_DEFINE(NAD_DEBUG,1,[Define to 1 if you want to enable NAD pointer tracking.])
fi
AC_ARG_ENABLE(pool_debug, AC_HELP_STRING([--enable-pool-debug], [enable memory pool statistics]),
want_pool_debug=$enableval, want_pool_debug=no)
if test "x-$want_pool_debug" = "x-yes" ; then
AC_DEFINE(POOL_DEBUG,1,[Define to 1 if you want to enable memory pool statistics.])
fi
AC_ARG_ENABLE(mio_debug, AC_HELP_STRING([--enable-mio-debug], [enable managed IO debug output]),
want_mio_debug=$enableval, want_mio_debug=no)
if test "x-$want_mio_debug" = "x-yes" ; then
AC_DEFINE(MIO_DEBUG,1,[Define to 1 if you want to enable managed IO debug output.])
fi
# Two-step header checking. First check for headers which don't
# require any other headers.
AC_HEADER_DIRENT
AC_HEADER_RESOLV
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS([arpa/inet.h \
arpa/nameser.h \
fcntl.h \
netinet/in.h \
signal.h \
stdint.h \
stdlib.h \
string.h \
sys/filio.h \
sys/ioctl.h \
sys/socket.h \
sys/time.h \
sys/timeb.h \
sys/types.h \
sys/stat.h \
sys/utsname.h \
syslog.h \
unistd.h \
windows.h \
winsock2.h \
])
# Now check for those headers that do, including all the required
# headers.
AC_CHECK_HEADERS([resolv.h windns.h],,,
[#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
# generic system types
AC_CREATE_STDINT_H(ac-stdint.h)
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_REPLACE_FNMATCH
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([close \
dup2 \
fcntl \
_findfirst \
gethostname \
getopt \
getpagesize \
getpid \
gettimeofday \
inet_aton \
inet_ntoa \
ioctl \
isascii \
memchr \
memmove \
memset \
mkdir \
_mkdir \
modf \
select \
setenv \
sleep \
Sleep \
socket \
strcasecmp \
strchr \
strdup \
strerror \
stricmp \
strncasecmp \
strndup \
strnicmp \
strstr \
tzset \
uname \
])
AC_CHECK_FUNC([connect], ,[AC_CHECK_LIB([socket], [connect])])
AC_CHECK_LIB([ws2_32], [_head_libws2_32_a])
AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB([resolv], [gethostbyname])])
AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB([nsl], [gethostbyname])])
if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
AC_CHECK_FUNC([gethostbyname], , [AC_CHECK_LIB([socket], [gethostbyname])])
fi
if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
AC_MSG_CHECKING([if we can include libnsl + libsocket])
LIBS="-lnsl -lsocket $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
if test "$my_ac_link_result" = "no" ; then
AC_MSG_RESULT([failure])
AC_MSG_ERROR([unable to use gethostbyname()])
else
AC_MSG_RESULT([success])
fi
fi
# windows has different names for a few basic things
if test "x-$ac_cv_func_getpid" != "x-yes" -a "x-$ac_cv_func__getpid" = "x-yes" ; then
AC_DEFINE(getpid,_getpid,[Define to a function than can provide getpid(2) functionality.])
fi
if test "x-$ac_cv_func_sleep" != "x-yes" -a "x-$ac_cv_func_Sleep" = "x-yes" ; then
AC_DEFINE(sleep,Sleep,[Define to a function than can provide sleep(2) functionality.])
fi
if test "x-$ac_cv_func_strcasecmp" != "x-yes" -a "x-$ac_cv_func_stricmp" = "x-yes" ; then
AC_DEFINE(strcasecmp,stricmp,[Define to a function than can provide strcasecmp(3) functionality.])
fi
if test "x-$ac_cv_func_strncasecmp" != "x-yes" -a "x-$ac_cv_func_strnicmp" = "x-yes" ; then
AC_DEFINE(strncasecmp,strnicmp,[Define to a function than can provide strncasecmp(3) functionality.])
fi
# winsock substitutions
if test "x-$ac_cv_func_close" != "x-yes" ; then
AC_MSG_CHECKING(for closesocket)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
[[closesocket(0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(close,closesocket,[Define to a function than can provide close(2) functionality.])],
AC_DEFINE(HAVE_CLOSE,1,[Define to 1 if you have the 'close' function.])
AC_MSG_RESULT(no))
fi
if test "x-$ac_cv_func_ioctl" != "x-yes" ; then
AC_MSG_CHECKING(for ioctlsocket)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
[[ioctlsocket(0,0,0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(ioctl,ioctlsocket,[Define to a function than can provide ioctl(2) functionality.])],
AC_DEFINE(HAVE_IOCTL,1,[Define to 1 if you have the 'ioctl' function.])
AC_MSG_RESULT(no))
fi
# res_query has been seen in libc, libbind and libresolv
if test "x-$ac_cv_header_resolv_h" = "x-yes" ; then
AC_CHECK_FUNCS(res_query)
if test "x-$ac_cv_func_res_query" = "x-yes" ; then
have_res_query=yes
else
AC_CHECK_LIB(resolv, res_query)
if test "x-$ac_cv_lib_resolv_res_query" = "x-yes" ; then
have_res_query=yes
else
AC_CHECK_LIB(bind, res_query)
if test "x-$ac_cv_lib_bind_res_query" = "x-yes" ; then
have_res_query=yes
else
dnl some glibcs have res_query as a macro, so work around it
AC_MSG_CHECKING([for res_query in -lresolv (alternate version)])
save_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <resolv.h>]],
[[res_query(0,0,0,0,0)]])],
[AC_MSG_RESULT(yes)
have_res_query=yes],
[AC_MSG_RESULT(no)
LIBS="$save_libs"])
fi
fi
fi
fi
# windows calls it DnsQuery
if test "x-$ac_cv_header_windns_h" = "x-yes" ; then
AC_MSG_CHECKING([for DnsQuery in -ldnsapi])
save_libs="$LIBS"
LIBS="-ldnsapi $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>
#include <windns.h>]],
[[DnsQuery(0,0,0,0,0,0)]])],
[AC_MSG_RESULT(yes)
have_dnsquery=yes],
[AC_MSG_RESULT(no)
LIBS="$save_libs"])
fi
if test "x-$have_res_query" = "x-yes" ; then
AC_DEFINE(HAVE_RES_QUERY,1,[Define to 1 if you have the 'res_query' function.])
elif test "x-$have_dnsquery" = "x-yes" ; then
AC_DEFINE(HAVE_DNSQUERY,1,[Define to 1 if you have the 'DnsQuery' function.])
else
AC_MSG_ERROR([no DNS resolver interface (res_query or DnsQuery) found])
fi
# inet_ntop/inet_pton have been seen in -lnsl, and sometimes not at all
AC_CHECK_FUNC(inet_ntop, ,[AC_CHECK_LIB(nsl, inet_ntop)])
unset ac_cv_func_inet_ntop
AC_CHECK_FUNCS(inet_ntop inet_pton)
# some glibcs have broken sockaddr_storage members
if test "x-$ac_cv_type_struct_sockaddr_storage" = "x-yes" ; then
AC_MSG_CHECKING(for broken __ss_family member in struct sockaddr_storage)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_IP6_INCLUDES,
[[do {
struct sockaddr_storage s;
s.__ss_family = 0;
} while(0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(ss_family, __ss_family,
[Define to '__ss_family' if 'struct sockaddr_storage' defines '__ss_family' instead of 'ss_family'.])],
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for broken __ss_len member in struct sockaddr_storage)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_IP6_INCLUDES,
[[do {
struct sockaddr_storage s;
s.__ss_len = 0;
} while(0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(ss_len, __ss_len,
[Define to '__ss_len' if 'struct sockaddr_storage' defines '__ss_len' instead of 'ss_len'.])],
AC_MSG_RESULT(no))
fi
# syslog
if test "x-$ac_cv_header_syslog_h" = "x-yes" ; then
AC_CHECK_FUNCS(syslog vsyslog)
fi
if test "x-$ac_cv_header_windows_h" = "x-yes" ; then
AC_MSG_CHECKING(for ReportEvent)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]],
[[ReportEvent(0,0,0,0,0,0,0,0,0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REPORTEVENT,1,[Define to 1 if you have the 'ReportEvent' function.])],
AC_MSG_RESULT(no))
fi
# snprintf/vsnprintf don't exist everywhere. additionally, we require
# them to gracefully accept NULLs, which is non-standard
AC_CHECK_FUNCS(snprintf vsnprintf)
if test "x-$ac_cv_func_snprintf" = "x-yes" ; then
AC_MSG_CHECKING([if snprintf can handle NULL arguments])
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
#include <signal.h>
segv() { exit(1); }
main() { char b[10]; signal(SIGSEGV,segv); snprintf(b,10,"%s",NULL); exit(0); }]])],
AC_MSG_RESULT(yes),
[AC_MSG_RESULT(no)
AC_DEFINE(HAVE_BROKEN_SNPRINTF,1,[Define to 1 if 'snprintf' cannot handle NULL arguments.])])
fi
if test "x-$ac_cv_func_vsnprintf" = "x-yes" ; then
AC_MSG_CHECKING([if vsnprintf can handle NULL arguments])
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
#include <signal.h>
#include <stdarg.h>
segv() { exit(1); }
expand(char *f,...) { va_list ap; char b[10]; va_start(ap,f); vsnprintf(b,10,f,ap); va_end(ap); }
main() { char b[10]; signal(SIGSEGV,segv); expand("%s", NULL); exit(0); }]])],
AC_MSG_RESULT(yes),
[AC_MSG_RESULT(no)
AC_DEFINE(HAVE_BROKEN_VSNPRINTF,1,[Define to 1 if 'vsnprintf' cannot handle NULL arguments.])])
fi
#
# Checks for libraries.
# Expat
AC_CHECK_LIB([expat], [XML_ParserCreate])
if test "x-$ac_cv_lib_expat_XML_ParserCreate" != "x-yes" ; then
AC_MSG_ERROR([Expat not found])
fi
# libidn >= 0.3.0
AC_CHECK_LIB(idn, stringprep_check_version)
if test "x-$ac_cv_lib_idn_stringprep_check_version" = "x-yes" ; then
AC_MSG_CHECKING(for Libidn version >= 0.3.0)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stringprep.h>]],
[[return !(stringprep_check_version("0.3.0"))]])],
[AC_MSG_RESULT(yes)
have_idn=yes],
AC_MSG_RESULT(no))
fi
if test "x-$have_idn" != "x-yes" ; then
AC_MSG_ERROR([Libidn >= 0.3.0 not found])
fi
#
# SASL backend selection
AC_ARG_ENABLE(sasl, AC_HELP_STRING([--enable-sasl=BACKEND], [use BACKEND as SASL backend]),
sasl_check=$enableval, sasl_check='gsasl')
sasl_backend=''
for backend in $sasl_check ; do
case x-$backend in
x-gsasl)
AC_CHECK_HEADERS(gsasl.h)
if test "x-$ac_cv_header_gsasl_h" = "x-yes" ; then
AC_CHECK_LIB(gsasl, gsasl_check_version)
fi
if test "x-$ac_cv_lib_gsasl_gsasl_check_version" = "x-yes" ; then
AC_MSG_CHECKING(for GnuSASL version >= 0.2.14)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <gsasl.h>]],
[[return !(gsasl_check_version("0.2.14"))]])],
[AC_MSG_RESULT(yes)
sasl_backend='gsasl'],
AC_MSG_RESULT(no))
fi
;;
x-cyrus)
AC_CHECK_LIB(sasl2, sasl_client_init)
if test "x-$ac_cv_lib_sasl2_sasl_client_init" = "x-yes" ; then
AC_CHECK_HEADERS(sasl/sasl.h)
if test "x-$ac_cv_header_sasl_sasl_h" = "x-yes" ; then
sasl_backend='cyrus'
fi
fi
;;
x-scod)
sasl_backend='scod'
;;
esac
done
if test "x-$sasl_backend" = "x-" ; then
AC_MSG_ERROR([no SASL backend available out of: $sasl_check])
fi
AM_CONDITIONAL(SASL_GSASL, [test "x-$sasl_backend" = "x-gsasl"])
AM_CONDITIONAL(SASL_CYRUS, [test "x-$sasl_backend" = "x-cyrus"])
AM_CONDITIONAL(SASL_SCOD, [test "x-$sasl_backend" = "x-scod"])
#
# optional libs
# OpenSSL >= 0.9.6b
AC_ARG_ENABLE(ssl, AC_HELP_STRING([--enable-ssl], [enable SSL/TLS support (yes)]), want_ssl=$enableval, want_ssl=yes)
if test "x-$want_ssl" = "x-yes" ; then
AC_CHECK_HEADERS(openssl/crypto.h)
if test "x-$ac_cv_header_openssl_crypto_h" = "x-yes" ; then
AC_CHECK_LIB(crypto, CRYPTO_lock)
fi
if test "x-$ac_cv_lib_crypto_CRYPTO_lock" = "x-yes" ; then
AC_CHECK_HEADERS(openssl/ssl.h)
fi
if test "x-$ac_cv_header_openssl_ssl_h" = "x-yes" ; then
AC_CHECK_LIB(ssl, SSL_connect)
fi
if test "x-$ac_cv_lib_ssl_SSL_connect" = "x-yes" ; then
AC_MSG_CHECKING(for OpenSSL version >= 0.9.6b)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <openssl/opensslv.h>]],
[[return !(SSLeay() >= 0x000906020L)]])],
[AC_MSG_RESULT(yes)
have_openssl=yes],
AC_MSG_RESULT(no))
fi
if test "x-$have_openssl" != "x-yes" ; then
AC_MSG_ERROR([OpenSSL >= 0.9.6b not found])
fi
AC_DEFINE(HAVE_SSL,1,[Define to 1 if OpenSSL is available.])
fi
# MySQL
AC_ARG_ENABLE([mysql],
AC_HELP_STRING([--enable-mysql], [enable MySQL auth/reg/storage support (no)]),
[enable_mysql=$enableval have_mysql=no],
[enable_mysql=no have_mysql=no])
if test "x-$enable_mysql" = "x-yes" ; then
for i in /usr /usr/local /usr/local/mysql ; do
for j in include include/mysql "" ; do
if test -r "$i/$j/mysql.h" ; then
MYSQL_INCLUDE=$i/$j
fi
done
for j in lib lib/mysql lib64 lib64/mysql "" ; do
if test -f "$i/$j/libmysqlclient.so" || test -f "$i/$j/libmysqlclient.a" ; then
MYSQL_LIBDIR=$i/$j
fi
done
done
AC_CHECK_LIB([mysqlclient], [mysql_init], [
have_mysql=yes
if test "x-$MYSQL_INCLUDE" != "x-" ; then
MYSQL_CFLAGS="-I $MYSQL_INCLUDE"
fi
if test "x-$MYSQL_LIBDIR" != "x-" ; then
MYSQL_LIBS="-L$MYSQL_LIBDIR -lmysqlclient"
fi
AC_DEFINE(STORAGE_MYSQL, 1, [Define to 1 if you want to use MySQL for storage.])
])
if test "x-$have_mysql" != "x-yes" ; then
AC_MSG_ERROR([MySQL support requested, but headers/libraries not found.])
fi
fi
AC_SUBST(MYSQL_CFLAGS)
AC_SUBST(MYSQL_LIBS)
AM_CONDITIONAL(STORAGE_MYSQL, [test "x-$have_mysql" = "x-yes"])
# PostgreSQL
AC_ARG_ENABLE([pgsql],
AC_HELP_STRING([--enable-pgsql], [enable PostgreSQL auth/reg/storage support (no)]),
[enable_pgsql=$enableval have_pgsql=no],
[enable_pgsql=no have_pgsql=no])
if test "x-$enable_pgsql" = "x-yes" ; then
for i in /usr /usr/local /usr/local/pgsql ; do
for j in include include/pgsql include/postgres include/postgresql "" ; do
if test -r "$i/$j/libpq-fe.h" ; then
PGSQL_INCLUDE=$i/$j
fi
done
for lib in lib lib64 ; do
for j in $lib $lib/pgsql $lib/postgres $lib/postgresql "" ; do
if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a" ; then
PGSQL_LIBDIR=$i/$j
fi
done
done
done
AC_CHECK_LIB([pq], [PQsetdbLogin], [
have_pgsql=yes
if test "x-$PGSQL_INCLUDE" != "x-"; then
PGSQL_CFLAGS="-I $PGSQL_INCLUDE"
fi
if test "x-$PGSQL_LIBDIR" != "x-"; then
PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq"
fi
AC_DEFINE(STORAGE_POSTGRES, 1, [Define to 1 if you want to use PostgreSQL for storage.])
])
if test "x-$have_pgsql" != "x-yes" ; then
AC_MSG_ERROR([PostgreSQL support requested, but headers/libraries not found.])
fi
fi
AC_SUBST(PGSQL_CFLAGS)
AC_SUBST(PGSQL_LIBS)
AM_CONDITIONAL(STORAGE_PGSQL, [test "x-$have_pgsql" = "x-yes"])
# SQLite 3
AC_ARG_ENABLE([sqlite],
AS_HELP_STRING([--enable-sqlite], [enable SQLite3 auth/reg/storage support (no)]),
[enable_sqlite=$enableval have_sqlite=no],
[enable_sqlite=no have_sqlite=no])
if test "x-$enable_sqlite" = "x-yes" ; then
AC_CHECK_HEADERS([sqlite3.h], [
AC_CHECK_LIB([sqlite3], [sqlite3_open], [
have_sqlite=yes
SQLITE_LIBS="-lsqlite3"
AC_DEFINE(STORAGE_SQLITE, 1, [Define to 1 if you want to use SQLite 3 for storage.])
])
])
if test "x-$have_sqlite" != "x-yes" ; then
AC_MSG_ERROR([SQLite3 support requested, but headers/libraries not found.])
fi
fi
AC_SUBST(SQLITE_LIBS)
AM_CONDITIONAL(STORAGE_SQLITE, [test "x-$have_sqlite" = "x-yes"])
# Berkeley DB
AC_ARG_ENABLE(db, AC_HELP_STRING([--enable-db], [enable Berkeley DB auth/reg/storage support (no)]),
want_db=$enableval, want_db=no)
if test "x-$want_db" = "x-yes" ; then
AC_CHECK_HEADERS(db.h)
if test "x-$ac_cv_header_db_h" = "x-yes" ; then
for lib in db-4.3 db-4.2 db-4.1 db-4 db4 db41 db ; do
if test "x-$have_db_version" != "x-yes" ; then
AC_MSG_CHECKING([for db_create in -l$lib])
save_libs="$LIBS"
LIBS="-l$lib $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <db.h>]],
[[db_create(0,0,0)]])],
[AC_MSG_RESULT(yes)
AC_MSG_CHECKING(for Berkeley DB version >= 4.1.25)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <db.h>]],
[[do {
int major, minor, patch;
db_version(&major, &minor, &patch);
if(major < 4 ||
(major == 4 && minor < 1) ||
(major == 4 && minor == 1 && patch < 24))
return 1;
} while(0)]])],
[AC_MSG_RESULT(yes)
have_db_version=yes],
AC_MSG_RESULT(no))],
AC_MSG_RESULT(no))
LIBS="$save_libs"
fi
done
fi
if test "x-$have_db_version" != "x-yes" ; then
AC_MSG_ERROR([Berkeley DB >= 4.1.24 not found])
else
DB_LIBS="-l$lib"
AC_DEFINE(STORAGE_DB,1,[Define to 1 if you want to use Berkeley DB for auth/reg/storage.])
fi
fi
AC_SUBST(DB_LIBS)
AM_CONDITIONAL(STORAGE_DB, [test "x-$have_db_version" = "x-yes"])
# Oracle
AC_ARG_WITH(oracle-home,
[ --with-oracle-home=DIR the Oracle home directory, for includes and libs. ],
[ ac_oracle_home="$withval" ])
AC_ARG_ENABLE(oracle, AC_HELP_STRING([--enable-oracle], [enable Oracle auth/reg/storage support (no)]),
want_oracle=$enableval, want_oracle=no)
if test "x-$want_oracle" = "x-yes" ; then
AC_CHECK_HEADERS(oci.h)
if test "x-$ac_cv_header_oci_h" != "x-yes" ; then
if test -n $ac_oracle_home ; then
AC_MSG_CHECKING([for oci.h in $ac_oracle_home])
save_cppflags="$CPPFLAGS"
CPPFLAGS="-I$ac_oracle_home/rdbms/demo -I$ac_oracle_home/rdbms/public $CPPFLAGS"
save_libs="$LIBS"
LIBS="-L$ac_oracle_home/lib $LIBS"
save_ldflags="$LDFLAGS"
LDFLAGS="-Wl,-rpath,$ac_oracle_home/lib $LDFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <oci.h>]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_OCI_H,,[Define if you have oci.h])
ac_cv_header_oci_h=yes],
AC_MSG_RESULT(no))
if test "x-$ac_cv_header_oci_h" != "x-yes" ; then
CPPFLAGS="$save_cppflags"
LIBS="$save_libs"
LDFLAGS="$save_ldflags"
fi
fi
fi
if test "x-$ac_cv_header_oci_h" = "x-yes" ; then
AC_CHECK_LIB(clntsh, OCIInitialize)
fi
if test "x-$ac_cv_lib_clntsh_OCIInitialize" != "x-yes" ; then
AC_MSG_ERROR([Oracle client libraries not found])
else
have_oracle="yes"
ORACLE_CPPFLAGS="-I$ac_oracle_home/rdbms/demo -I$ac_oracle_home/rdbms/public"
ORACLE_LIBS="-L$ac_oracle_home/lib"
ORACLE_LDFLAGS="-Wl,-rpath,$ac_oracle_home/lib"
AC_DEFINE(STORAGE_ORACLE,1,[Define to 1 if you want to use Oracle for auth/reg/storage.])
fi
fi
AC_SUBST(ORACLE_CPPFLAGS)
AC_SUBST(ORACLE_LIBS)
AC_SUBST(ORACLE_LDFLAGS)
AM_CONDITIONAL(STORAGE_ORACLE, [test "x-$have_oracle" = "x-yes"])
# OpenLDAP
AC_ARG_ENABLE(ldap, AC_HELP_STRING([--enable-ldap], [enable OpenLDAP auth/reg support (no)]),
want_ldap=$enableval, want_ldap=no)
if test "x-$want_ldap" = "x-yes" ; then
AC_CHECK_HEADERS(lber.h ldap.h)
save_libs="$LIBS"
if test "x-$ac_cv_header_ldap_h" = "x-yes" -a "x-$ac_cv_header_lber_h" = "x-yes" ; then
AC_CHECK_LIB(lber, ber_alloc)
AC_CHECK_LIB(ldap, ldap_init)
fi
if test "x-$ac_cv_lib_lber_ber_alloc" = "x-yes" -a "x-$ac_cv_lib_ldap_ldap_init" = "x-yes" ; then
AC_MSG_CHECKING(for OpenLDAP version >= 2.1.0)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <lber.h>
#include <ldap.h>]],
[[do {
LDAPAPIInfo info;
info.ldapai_info_version = LDAP_API_INFO_VERSION;
ldap_get_option(0, LDAP_OPT_API_INFO, &info);
if(info.ldapai_vendor_version != LDAP_VENDOR_VERSION || LDAP_VENDOR_VERSION < 2004)
return 1;
} while(0)]])],
[AC_MSG_RESULT(yes)
have_ldap_version=yes],
AC_MSG_RESULT(no))
fi
LIBS="$save_libs"
if test "x-$have_ldap_version" != "x-yes" ; then
AC_MSG_ERROR([OpenLDAP client libraries >= 2.1.0 not found])
else
LDAP_LIBS="-llber -lldap"
AC_DEFINE(STORAGE_LDAP,1,[Define to 1 if you want to use OpenLDAP for auth/reg.])
fi
fi
AC_SUBST(LDAP_LIBS)
AM_CONDITIONAL(STORAGE_LDAP, [test "x-$have_ldap_version" = "x-yes"])
# Plugabble Authentication Modules (PAM)
AC_ARG_ENABLE(pam, AC_HELP_STRING([--enable-pam], [enable PAM auth/reg support (no)]),
want_pam=$enableval, want_pam=no)
if test "x-$want_pam" = "x-yes" ; then
AC_CHECK_HEADERS(security/pam_appl.h)
if test "x-$ac_cv_header_security_pam_appl_h" = "x-yes" ; then
AC_CHECK_LIB(pam, pam_start)
fi
if test "x-$ac_cv_lib_pam_pam_start" != "x-yes" ; then
AC_MSG_ERROR([PAM application libraries not found])
else
have_pam="yes"
PAM_LIBS="-lpam"
AC_DEFINE(STORAGE_PAM,1,[Define to 1 if you want to use PAM for auth/reg.])
fi
fi
AC_SUBST(PAM_LIBS)
AM_CONDITIONAL(STORAGE_PAM, [test "x-$have_pam" = "x-yes"])
# pipe (not really an external package, but does need some checks)
AC_ARG_ENABLE(pipe, AC_HELP_STRING([--enable-pipe], [enable pipe auth/reg support (no)]),
want_pipe=$enableval, want_pipe=no)
if test "x-$want_pipe" = "x-yes" ; then
AC_CHECK_HEADERS(sys/wait.h)
AC_FUNC_FORK
AC_CHECK_FUNCS(pipe wait)
if test "x-$ac_cv_header_sys_wait_h" != "x-yes" -o \
"x-$ac_cv_func_fork" != "x-yes" -o \
"x-$ac_cv_func_pipe" != "x-yes" -o \
"x-$ac_cv_func_wait" != "x-yes" ; then
AC_MSG_ERROR([Pipe auth/reg requirements (sys/wait.h, fork(), pipe(), wait()) not found])
else
have_pipe="yes"
AC_DEFINE(STORAGE_PIPE,1,[Define to 1 if you want to use pipes for auth/reg.])
fi
fi
AM_CONDITIONAL(STORAGE_PIPE, [test "x-$have_pipe" = "x-yes"])
# Anonymous
AC_ARG_ENABLE(anon, AC_HELP_STRING([--enable-anon], [enable anonymous auth/reg support (no)]),
want_anon=$enableval, want_anon=no)
if test "x-$want_anon" = "x-yes" ; then
AC_DEFINE(STORAGE_ANON,1,[Define to 1 if you want anonymous auth.])
fi
AM_CONDITIONAL(STORAGE_ANON, [test "x-$want_anon" = "x-yes"])
# Filesystem storage
AC_ARG_ENABLE(fs, AC_HELP_STRING([--enable-fs], [enable filesystem storage support (no)]),
want_fs=$enableval, want_fs=no)
if test "x-$want_fs" = "x-yes" ; then
AC_DEFINE(STORAGE_FS,1,[Define to 1 if you want to use the filesystem for storage.])
fi
AM_CONDITIONAL(STORAGE_FS, [test "x-$want_fs" = "x-yes"])
#
# IPv6 checks
AC_DEFUN([_IP6_INCLUDES],[[
#include "ac-stdint.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
]])
# these types are sometimes missing
AC_CHECK_TYPES([in_port_t, sa_family_t, struct sockaddr_storage, struct sockaddr_in6, struct in6_addr],,, _IP6_INCLUDES)
#
# mio backend selection
AC_ARG_ENABLE(mio, AC_HELP_STRING([--enable-mio=BACKEND], [use BACKEND to drive MIO (select poll epoll)]),
mio_check=$enableval, mio_check='epoll poll select')
mio_backend=''
for backend in $mio_check ; do
case x-$backend in
x-epoll)
AC_CHECK_HEADERS(sys/epoll.h)
if test "x-$ac_cv_header_sys_epoll_h" = "x-yes" ; then
AC_CHECK_FUNCS(epoll_create,[
mio_backend='epoll'
AC_DEFINE(MIO_EPOLL,1,[Define to 1 if you want to use 'epoll' for non-blocking I/O.])])
fi
;;
x-poll)
AC_CHECK_HEADERS(poll.h)
if test "x-$ac_cv_header_poll_h" = "x-yes" ; then
AC_CHECK_FUNCS(poll,[
mio_backend='poll'
AC_DEFINE(MIO_POLL,1,[Define to 1 if you want to use 'poll' for non-blocking I/O.])])
fi
;;
x-select)
AC_CHECK_HEADERS(sys/select.h)
if test "x-$ac_cv_header_sys_select_h" = "x-yes" ; then
AC_CHECK_FUNCS(select, have_select=yes)
fi
if test "x-$have_select" != "x-yes" -a "x-$ac_cv_header_winsock2_h" = "x-yes" ; then
AC_MSG_CHECKING([for select in ws2_32])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
[[select(0,0,0,0,0)]])],
[AC_MSG_RESULT(yes)
have_select=yes],
AC_MSG_RESULT(no))
fi
if test "x-$have_select" = "x-yes" ; then
mio_backend='select'
AC_DEFINE(MIO_SELECT,1,[Define to 1 if you want to use 'select' for non-blocking I/O.])
fi
;;
esac
done
if test "x-$mio_backend" = "x-" ; then
AC_MSG_ERROR([no MIO backend available out of: $mio_check])
fi
# Generate Makefiles
AC_CONFIG_FILES([Doxyfile
Makefile
etc/Makefile
etc/templates/Makefile
man/Makefile
subst/Makefile
util/Makefile
mio/Makefile
sx/Makefile
sx/scod/Makefile
storage/Makefile
c2s/Makefile
resolver/Makefile
router/Makefile
s2s/Makefile
sm/Makefile
tools/Makefile])
AC_OUTPUT