-
Notifications
You must be signed in to change notification settings - Fork 32
/
configure.ac
1317 lines (1178 loc) · 31.2 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
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl Process this file with autoconf to produce a configure script.
AC_INIT([c_icap], m4_normalize(m4_include([VERSION.m4])))
dnl AC_INIT([c_icap], [030606rc1])
CICAPLIB_VERSION=0:1:0
AC_SUBST(CICAPLIB_VERSION)
dnl CICAPLIB_VERSION is the libtool current[:revision[:age]] version info
dnl libtool directions about version info
dnl - library source code has changed since the last update c:r:a => c:r+1:a
dnl - interfaces have been added, removed, or changed c:r:a => c+1:0:a
dnl - interfaces have been added c:r:a => c:r:a+1
dnl - interfaces have been removed c:r:a => c:r:0
AC_CONFIG_SRCDIR(aserver.c)
AM_MAINTAINER_MODE
AC_CONFIG_HEADERS(autoconf.h)
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_AWK
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AM_PROG_AR
WORDS_BIGENDIAN="0"
WORDS_LITTLEENDIAN="0"
AC_C_BIGENDIAN(
[AC_DEFINE(WORDS_BIGENDIAN, 1,
[Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel).])]
[WORDS_BIGENDIAN="1"]
[WORDS_LITTLEENDIAN="0"]
,
[AC_DEFINE(WORDS_LITTLEENDIAN, 1,
[Define WORDS_LITTLEENDIAN to 1 if your processor stores words with the least significant byte first (like Intel).])]
[WORDS_BIGENDIAN="0"]
[WORDS_LITTLEENDIAN="1"]
)
AC_SUBST(WORDS_BIGENDIAN)
AC_DISABLE_STATIC
LT_INIT(dlopen, win32-dll)
AC_SUBST(LIBTOOL_DEPS)
dnl Define c-icap version
C_ICAP_HEX_VERSION=`echo $PACKAGE_VERSION | $AWK -f $srcdir/build/c_icap_version.awk`
AC_SUBST(C_ICAP_HEX_VERSION)
dnl Checks for OS specific flags and posix threads libraries.....
case "$host_os" in
linux*)
CFLAGS="-D_REENTRANT $CFLAGS"
THREADS_LDADD="-lpthread"
THREADS_LDFLAGS=""
LIBS_LDFLAGS=""
;;
solaris2.*)
CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS $CFLAGS"
LIBS="-lsocket -lnsl -lrt $LIBS"
THREADS_LDADD="-lpthread"
THREADS_LDFLAGS=""
LIBS_LDFLAGS=""
;;
freebsd5*)
## If I understand how all those threading models works correctly
## in FreeBSD I will make an option in configure script
## --with-freebsd-threads={c_r,pthreads,linuxthreads,thr}
## If I am correct I must compile c-icap with the way
## external libraries are compiled. (The clamav uses -lc_r and I had problems
## using a different threading model)
## FreeBSD linuxthreads flags
# CFLAGS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads $CFLAGS"
# THREADS_LDADD="-llthread -lgcc_r"
# THREADS_LDFLAGS="-L/usr/local/lib"
## FreeBSD Standard threads
CFLAGS="-pthread -D_THREAD_SAFE $CFLAGS"
THREADS_LDADD="-XCClinker -lc_r"
THREADS_LDFLAGS=""
LIBS_LDFLAGS=""
## FreeBSD has pthreads rwlocks from version 3 (I think)
# AC_DEFINE(HAVE_PTHREADS_RWLOCK,1,[Define HAVE_PTHREADS_RWLOCK if pthreads library supports rwlocks])
## 1:1 threads
# CFLAGS="-D_THREAD_SAFE $CFLAGS"
# THREADS_LDADD="-XCClinker -lthr"
# THREADS_LDFLAGS=""
;;
freebsd6*)
CFLAGS="-D_THREAD_SAFE $CFLAGS"
THREADS_LDADD="-XCClinker -lthr"
THREADS_LDFLAGS=""
LIBS_LDFLAGS=""
;;
cygwin*)
CFLAGS="-D_REENTRANT $CFLAGS"
THREADS_LDADD="-lpthread"
THREADS_LDFLAGS="";
LIBS_LDFLAGS="-no-undefined"
iscygwin="yes"
;;
*)
CFLAGS="-D_REENTRANT $CFLAGS"
THREADS_LDADD="-lpthread"
THREADS_LDFLAGS=""
LIBS_LDFLAGS=""
;;
esac
TEST_LIBS="$TEST_LIBS $THREADS_LDADD"
AC_SUBST(THREADS_LDADD)
AC_SUBST(THREADS_LDFLAGS)
AC_SUBST(LIBS_LDFLAGS)
AC_DEFINE_UNQUOTED(C_ICAP_CONFIGURE_OPTIONS, "$ac_configure_args",
[configure command line used to configure c-icap])
AC_DEFINE_UNQUOTED(C_ICAP_CONFIG_HOST_TYPE, "$host",[Host type from configure])
CFLAGS="$CFLAGS -Wall"
AC_CACHE_CHECK([for __attribute__((visibility("default")))],
ac_cv_default_visibility_attribute, [
echo 'int __attribute__ ((visibility ("default"))) foo_visible (void) { return 1; } int foo_invisible(void) {return 1;}' > conftest.c
ac_cv_default_visibility_attribute=no
if AC_TRY_COMMAND(${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD);
then
if grep '\.hidden.*foo_invisible' conftest.s >/dev/null && ! grep '\.hidden.*foo_visible' conftest.s >/dev/null;
then
ac_cv_default_visibility_attribute=yes
fi
# Else try to detect visibility for Sun solaris:
# CC -xldscope={global|hidden}
# and use __global/__hidden inside C code
# elif
fi
rm -f conftest.*
])
INVISIBILITY_CFLAG=""
VISIBILITY_ATTR="0"
if test $ac_cv_default_visibility_attribute = yes;
then
AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE, 1,
[Define if __attribute__((visibility("default"))) is supported.])
INVISIBILITY_CFLAG="-fvisibility=hidden"
VISIBILITY_ATTR="1"
fi
AC_SUBST(INVISIBILITY_CFLAG)
AC_SUBST(VISIBILITY_ATTR)
AC_MSG_CHECKING([Whether large file support should enabled])
AC_ARG_ENABLE(large_files,
[ --enable-large-files Enable large files support],
[ if test $enableval = "yes"; then
large_file_support="yes"
AC_MSG_RESULT(yes)
else
large_file_support="no"
AC_MSG_RESULT(no)
fi
],
[ large_file_support="yes"
AC_MSG_RESULT(yes)
]
)
if test $large_file_support = "yes"; then
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
#here I must put a check if the -D_FILE_OFFSET_BITS makes the off_t an 64bit integer
# and if not supported warning the user
#Possibly checks for systems which supports large files using different defines....
#later .......
fi
AC_MSG_CHECKING([Whether to enable IPv6 support])
AC_ARG_ENABLE(ipv6,
[ --disable-ipv6 Disable ipv6 support],
[ if test $enableval = "yes"; then
ipv6_support="yes"
AC_MSG_RESULT(yes)
else
ipv6_support="no"
AC_MSG_RESULT(no)
fi
],
[ ipv6_support="yes"
AC_MSG_RESULT(yes)
]
)
USE_IPV6="0"
if test a"$ipv6_support" = "ayes"; then
AC_DEFINE(HAVE_IPV6,1,[Define HAVE_IPV6 if OS supports ipv6])
USE_IPV6="1"
fi
AC_SUBST(USE_IPV6)
AC_MSG_CHECKING([Whether to use SYSV/IPC])
AC_ARG_ENABLE(sysvipc,
[ --enable-sysvipc Enable SYSV/IPC for shared memory if supported],
[ if test $enableval = "yes"; then
sysvipc="yes"
AC_MSG_RESULT(yes)
else
sysvipc="no"
AC_MSG_RESULT(no)
fi
],
[ sysvipc="yes"
AC_MSG_RESULT(yes)
]
)
AC_MSG_CHECKING([Whether to use poll])
AC_ARG_ENABLE(poll,
[ --disable-poll Disable poll(2) support],
[ if test $enableval = "no"; then
enablepoll="no"
AC_MSG_RESULT(no)
else
enablepoll="yes"
AC_MSG_RESULT(yes)
fi
],
[ enablepoll="yes"
AC_MSG_RESULT(yes)
]
)
USE_COMPAT="0"
AC_MSG_CHECKING([Keep library compatibility])
AC_ARG_ENABLE(lib_compat,
[ --enable-lib-compat Enable library compatibility with older c-icap versions],
[ if test $enableval = "yes"; then
lib_compat="yes"
AC_MSG_RESULT(yes)
USE_COMPAT="1"
fi
],
[ lib_compat="no"
AC_MSG_RESULT(no)
]
)
AC_SUBST(USE_COMPAT)
# Checks for programs
AC_CHECK_PROG(has_doxygen, doxygen, "yes", "no")
if test a"$has_doxygen" = "ayes"; then
doxygen_bin=doxygen
else
doxygen_bin="echo Doxygen is not installed /"
fi
AC_SUBST(doxygen_bin)
# Check if we need to enable rpath when linking with libraries
AC_ARG_ENABLE(rpath,
[ --enable-rpath hardcode runtime library paths],
[
case "$enableval" in
yes)
enable_rpath="yes";
;;
no)
enable_rpath="no";
;;
*)
enable_rpath="yes";
# Build list with libraries to use rpath
ENABLE_RPATH_LIBS=`echo $enableval| tr ';:,' ' '`
echo "Enable rpath for libs:"$ENABLE_RPATH_LIBS
# search into $ENABLE_RPATH_LIBS using:
# if test "${ENABLE_RPATH_LIBS#*zlib}" != "$ENABLE_RPATH_LIBS"; then echo found; fi
;;
esac
],
[enable_rpath="no"]
)
#Routines used for checking libraries
AC_DEFUN([ICFG_STATE_SAVE],[
#save state
ICFG_OLD_CPPFLAGS=$CPPFLAGS
ICFG_OLD_CFLAGS=$CFLAGS
ICFG_OLD_LDFLAGS=$LDFLAGS
ICFG_OLD_LIBS=$LIBS
])
#Routines used for checking libraries
AC_DEFUN([ICFG_STATE_ROLLBACK],[
#rollback saved state
CPPFLAGS=$ICFG_OLD_CPPFLAGS
CFLAGS=$ICFG_OLD_CFLAGS
LDFLAGS=$ICFG_OLD_LDFLAGS
LIBS=$ICFG_OLD_LIBS
])
AC_DEFUN([ICFG_BUILD_FLAGS_2], [
# The *_LNDIR_LDADD used by external programs to link with cicapapi libibrary.
# They must link with libraries options if the cicapapi is not linked with
# -rpath option and not standard directories are used.
# TODO: support multiple directories
if test -n $2; then
$1_ADD_FLAG=-I$2
else
$1_ADD_FLAG=""
fi
$1_LNDIR_LDADD=""
if test -n $3; then
if test "a$enable_rpath" = "ayes"; then
$1_ADD_LDADD="-Wl,-rpath -Wl,$3 -L$3 "$4
else
$1_ADD_LDADD="-L$3 "$4
$1_LNDIR_LDADD="-L$3 "$4
fi
else
$1_ADD_LDADD=$4
fi
AC_SUBST($1_LNDIR_LDADD)
AC_SUBST($1_ADD_LDADD)
AC_SUBST($1_ADD_FLAG)
]
)
AC_DEFUN([ICFG_BUILD_FLAGS], [
if test "a$2" != "a"; then
ICFG_BUILD_FLAGS_2($1, $2/include, $2/lib, $3)
else
ICFG_BUILD_FLAGS_2($1, "", "", $3)
fi
]
)
# Checks for libraries
AC_ARG_WITH(perl,
[ --with-perl Path to perl binary],
[
case "$withval" in
yes)
perlbin="perl"
;;
no )
perlbin="";
perlcore="";
;;
* )
perlbin=$withval
;;
esac
],
[
perlbin="";
perlcore="";
]
)
if test a"$perlbin" != a; then
perlcore=`$perlbin -MConfig -e 'print $Config{archlib}'`/CORE;
perllib=`$perlbin -MConfig -e 'print $Config{libs}'`;
perlccflags=`$perlbin -MConfig -e 'print $Config{ccflags}'`;
perlldflags=`$perlbin -MConfig -e 'print $Config{ccdlflags}'`;
fi
AC_SUBST(perlcore)
AC_SUBST(perllib)
AC_SUBST(perlccflags)
AC_SUBST(perlldflags)
AC_ARG_WITH(openssl,
[ --with-openssl Path to openssl],
[
case "$withval" in
yes)
openssl=yes;
;;
no)
openssl=no;
;;
*)
openssl=yes;
opensslpath=$withval;
;;
esac
],
[ openssl=yes]
)
if test "a$openssl" != "ano"; then
ICFG_STATE_SAVE(OPENSSL)
if test "a$opensslpath" != "a"; then
CFLAGS="$CFLAGS -I$opensslpath/include"
LDFLAGS="$LDFLAGS -L$opensslpath/lib"
fi
LIBS="-lssl -lcrypto $LIBS"
(test -n "$opensslpath" && echo -n "checking for OpenSSL library under $opensslpath... ") || echo -n "checking for OpenSSL library... ";
AC_LINK_IFELSE(
[AC_LANG_SOURCE(
[[
#include <openssl/ssl.h>
int main(int argc, char *argv[])
{
int ret = SSL_library_init();
return ret;
}
]])
],
[openssl=yes; echo "yes";],
[openssl=no; echo "no"]
)
if test "a$openssl" = "ayes"; then
AC_DEFINE(HAVE_OPENSSL,1,[Define HAVE_OPENSSL if openssl is installed])
ICFG_BUILD_FLAGS(OPENSSL, $opensslpath, "-lssl -lcrypto")
fi
ICFG_STATE_ROLLBACK
fi
USE_OPENSSL="1"
if test a"$openssl" = "ano"; then
USE_OPENSSL="0"
fi
AC_SUBST(USE_OPENSSL)
AC_CHECK_LIB(dl,dlopen,DL_ADD_FLAG=" -ldl")
AC_SUBST(DL_ADD_FLAG)
AC_ARG_WITH(zlib,
[ --with-zlib Path to zlib library],
[
case "$withval" in
yes)
zlib=yes;
;;
no)
zlib=no;
;;
*)
zlib=yes;
zlibpath=$withval;
;;
esac
],
[ zlib=yes]
)
if test "a$zlib" != "ano"; then
ICFG_STATE_SAVE(ZLIB)
if test "a$zlibpath" != "a"; then
CFLAGS="$CFLAGS -I$zlib/include"
LDFLAGS="$LDFLAGS -L$zlib/lib"
fi
AC_CHECK_LIB(z,inflate,[zlib=yes],[zlib=no])
ICFG_STATE_ROLLBACK
fi
if test "a$zlib" = "ano"; then
AC_MSG_WARN("zlib required for the c-icap's internal filetype recognizer!")
else
AC_DEFINE(HAVE_ZLIB,1,[Define HAVE_ZLIB if zlib installed])
ICFG_BUILD_FLAGS(ZLIB, $zlibpath, "-lz")
fi
AC_ARG_WITH(bzlib,
[ --with-bzlib Path to bzlib library],
[
case "$withval" in
yes)
bzlib=yes;
;;
no)
bzlib=no;
;;
*)
bzlib=yes;
bzlibpath=$withval;
;;
esac
],
[ bzlib=yes]
)
if test "a$bzlib" != "ano"; then
ICFG_STATE_SAVE(BZLIB)
if test "a$bzlibpath" != "a"; then
CFLAGS="$CFLAGS -I$bzlibpath/include"
LDFLAGS="$LDFLAGS -L$bzlibpath/lib"
fi
AC_CHECK_LIB(bz2,BZ2_bzDecompressInit,[bzlib=yes],[bzlib=no])
ICFG_STATE_ROLLBACK
fi
if test "a$bzlib" = "ano"; then
AC_MSG_WARN("bzlib required for the c-icap's internal filetype recognizer!")
else
AC_DEFINE(HAVE_BZLIB,1,[Define HAVE_BZLIB if bzlib installed])
ICFG_BUILD_FLAGS(BZLIB, $bzlibpath, "-lbz2")
fi
AC_ARG_WITH(brotli,
[ --with-brotli Path to brotli library],
[
case "$withval" in
yes)
brotli=yes;
;;
no)
brotli=no;
;;
*)
brotli=yes;
brotlipath=$withval;
;;
esac
],
[ brotli=yes]
)
if test "a$brotli" != "ano"; then
ICFG_STATE_SAVE(BROTLI)
if test "a$brotlipath" != "a"; then
CFLAGS="$CFLAGS -I$brotlipath/include"
LDFLAGS="$LDFLAGS -L$brotlipath/lib -lbrotlicommon"
fi
AC_CHECK_LIB(brotlidec,BrotliDecoderDecompressStream,[brotli=yes],[brotli=no])
ICFG_STATE_ROLLBACK
fi
if test "a$brotli" = "ano"; then
AC_MSG_WARN("brotli required for the c-icap's internal filetype recognizer!")
else
AC_DEFINE(HAVE_BROTLI,1,[Define HAVE_BROTLI if brotli installed])
ICFG_BUILD_FLAGS(BROTLI, "$brotlipath", "-lbrotlicommon -lbrotlidec -lbrotlienc")
# fix BROTLI_LNDIR_LDADD the linker does not find brotlicommon even if
# it is linked to libicapapi using rpath
if test "a$brotlipath" != "a" -a "a$BROTLI_LNDIR_LDADD" = "a"; then
BROTLI_LNDIR_LDADD="-L$brotlipath/lib -lbrotlicommon"
AC_SUBST(BROTLI_LNDIR_LDADD)
fi
fi
AC_ARG_WITH(zstd,
[ --with-zstd Path to zstd library],
[
case "$withval" in
yes)
zstd=yes;
;;
no)
zstd=no;
;;
*)
zstd=yes;
zstdpath=$withval;
;;
esac
],
[ zstd=yes]
)
if test "a$zstd" != "ano"; then
ICFG_STATE_SAVE(ZSTD)
if test "a$zstdpath" != "a"; then
CFLAGS="$CFLAGS -I$zstdpath/include"
LDFLAGS="$LDFLAGS -L$zstdpath/lib -lzstd"
fi
AC_CHECK_LIB(zstd,ZSTD_compressStream2,[zstd=yes],[zstd=no])
ICFG_STATE_ROLLBACK
fi
if test "a$zstd" = "ano"; then
AC_MSG_WARN("libzstd required for the c-icap's internal filetype recognizer!")
else
AC_DEFINE(HAVE_ZSTD,1,[Define HAVE_ZSTD if libzstd installed])
ICFG_BUILD_FLAGS(ZSTD, "$zstdpath", "-lzstd")
fi
libdb="yes"
libdbpath=""
AC_ARG_WITH(bdb,
[ --with-bdb Where to find Berkeley DB library ],
[ case "$withval" in
yes)
libdb="yes"
;;
no )
libdb="no"
;;
* )
libdb="yes"
libdbpath=$withval
;;
esac
],
)
if test "a$libdb" != "ano"; then
if test "a$libdbpath" != "a"; then
CFLAGS="-I$libdbpath/include $CFLAGS"
LDFLAGS="-L$libdbpath/lib $LDFLAGS"
fi
# We are going to see if we can found a Berkeley DB located under a
# libdbpath/include/db4x directory and use lbdbpath/lib/libdb-4.x library.
ICFG_STATE_SAVE(BDB)
OLD_LIBS=$LIBS
for DBVER in "" 6 6.3 6.2 6.1 6.0 5 5.4 5.3 5.2 5.1 5.0 4 4.9 4.8 4.7 4.6 4.5 4.4 4.3 4.2; do
if test -z $DBVER; then
usedblib="-ldb"
incdbdir=""
else
usedblib="-ldb-$DBVER"
incdbdir=db`echo $DBVER|sed 's/\.//'`"/"
fi
if test -z "$libdbpath"; then
print_libdbpath="..."
else
print_libdbpath="under $libdbpath..."
fi
echo -n "checking for BerleleyDB v$DBVER $print_libdbpath"
LIBS="$usedblib $OLD_LIBS"
AC_LINK_IFELSE(
[AC_LANG_SOURCE(
[[
#include <${incdbdir}db.h>
int main(){
int major,minor,patch;
if (!db_version(&major,&minor,&patch))
return -1;
return 0;
}
]])
],
[echo yes;libdb="yes";],
[echo "no";libdb="no";]
)
if test a"$libdb" = "ayes"; then
ICFG_BUILD_FLAGS(BDB, "$libdbpath", $usedblib)
AC_DEFINE(HAVE_BDB, 1, [Define HAVE_BDB if berkeley DB is installed])
AC_DEFINE_UNQUOTED(BDB_HEADER_PATH(incfile), [<${incdbdir}incfile>], [Set DB_HEADER_PATH macro to compute berkeley DB header subpath])
break;
fi
done
ICFG_STATE_ROLLBACK
fi
# Detect LMDB library
liblmdb="yes"
liblmdbpath=""
AC_ARG_WITH(lmdb,
[ --with-lmdb Where to find LMDB library ],
[ case "$withval" in
yes)
liblmdb="yes"
;;
no )
liblmdb="no"
;;
* )
liblmdb="yes"
liblmdbpath=$withval
;;
esac
],
)
if test a"$liblmdb" != "ano"; then
ICFG_STATE_SAVE(LDAP)
if test "a$liblmdbpath" != "a"; then
CFLAGS="-I$liblmdbpath/include $CFLAGS"
LDFLAGS="-L$liblmdbpath/lib $LDFLAGS"
fi
AC_CHECK_LIB(lmdb, mdb_version, [liblmdb="yes"], [liblmdb="no"])
ICFG_STATE_ROLLBACK
if test a"$liblmdb" = "ayes"; then
AC_DEFINE(HAVE_LMDB, 1, [Define HAVE_LMDB if the LMDB library is installed])
ICFG_BUILD_FLAGS(LMDB, $liblmdbpath, "-llmdb")
fi
fi
libldap="yes"
AC_ARG_WITH(ldap,
[ --with-ldap Where to find LDAP libraries ],
[ case "$withval" in
yes)
libldap="yes"
;;
no )
libldap="no"
;;
* )
libldap="yes"
libldappath=$withval
;;
esac
],
)
if test "a$libldap" != "ano"; then
ICFG_STATE_SAVE(LDAP)
if test "a$libldappath" != "a"; then
CFLAGS="$CFLAGS -I$libldappath/include"
LDFLAGS="$LDFLAGS -L$libldappath/lib"
fi
useldaplib=""
AC_CHECK_LIB(ldap_r, ldap_search_ext_s,
[libldap="yes";useldaplib="ldap_r"],
[libldap="no"]
)
if test "a$libldap" = "ano"; then
AC_CHECK_LIB(ldap, ldap_search_ext_s,
[libldap="yes";useldaplib="ldap"],
[libldap="no"]
)
fi
if test "a$libldap" = "ayes"; then
AC_DEFINE(HAVE_LDAP, 1, [Define HAVE_LDAP if LDAP libraries are installed])
ICFG_BUILD_FLAGS(LDAP, "$libldappath", "-l$useldaplib -llber")
fi
ICFG_STATE_ROLLBACK
fi
# Detect memcached library
libmemcached="yes"
libmemcachedpath=""
AC_ARG_WITH(memcached,
[ --with-memcached Where to find Memcached library ],
[ case "$withval" in
yes)
libmemcached="yes"
;;
no )
libmemcached="no"
;;
* )
libmemcachedpath=$withval
libmemcached="yes"
;;
esac
],
)
if test a"$libmemcached" != "ano"; then
ICFG_STATE_SAVE(MEMCACHED)
if test a"$libmemcachedpath" != "a"; then
CFLAGS="-l$libmemcachedpath/include $CFLAGS"
fi
AC_CHECK_HEADERS(libmemcached/memcached.h, [libmemcached="yes"],[libmemcached="no"])
if test "a$libmemcached" = "ayes"; then
ICFG_BUILD_FLAGS(MEMCACHED, "$libmemcachedpath", "-lmemcached -lmemcachedutil")
fi
ICFG_STATE_ROLLBACK
fi
# Check for PCRE2 regex library
AC_ARG_WITH(pcre2,
[ --with-pcre2 Path to PCRE2 library],
[
case "$withval" in
yes)
pcre2=yes;
;;
no)
pcre2=no;
;;
*)
pcre2=yes;
pcre2path=$withval;
;;
esac
],
[ pcre2=yes]
)
if test a"$pcre2" != "ano"; then
ICFG_STATE_SAVE(PCRE2)
CPPFLAGS="$CPPFLAGS -DPCRE2_CODE_UNIT_WIDTH=8"
if test "a$pcre2path" != "a"; then
CFLAGS="$CFLAGS -I$pcre2path/include"
LDFLAGS="$LDFLAGS -L$pcre2path/lib"
fi
AC_CHECK_HEADERS(pcre2.h,
AC_CHECK_LIB(pcre2-8, pcre2_match_8,[pcre2=yes],[pcre2=no]),
[pcre2=no]
)
if test "a$pcre2" = "ayes"; then
AC_DEFINE(HAVE_PCRE2,1,[Define HAVE_PCRE2 if pcre2 installed])
ICFG_BUILD_FLAGS(PCRE2, "$pcre2path", "-lpcre2-8")
fi
ICFG_STATE_ROLLBACK
fi
# Check for PCRE regex library
AC_ARG_WITH(pcre,
[ --with-pcre Path to PCRE library],
[
case "$withval" in
yes)
pcre=yes;
;;
no)
pcre=no;
;;
*)
pcre=yes;
pcrepath=$withval;
;;
esac
],
[ pcre=yes]
)
if test a"$pcre" != "ano" -a a"$pcre2" != "ayes"; then
ICFG_STATE_SAVE(PCRE)
if test "a$pcrepath" != "a"; then
CFLAGS="$CFLAGS -I$pcrepath/include"
LDFLAGS="$LDFLAGS -L$pcrepath/lib"
fi
AC_CHECK_HEADERS(pcre.h,
AC_CHECK_LIB(pcre, pcre_exec,[pcre=yes],[pcre=no]),
[pcre=no]
)
if test "a$pcre" = "ayes"; then
AC_DEFINE(HAVE_PCRE,1,[Define HAVE_PCRE if pcre installed])
ICFG_BUILD_FLAGS(PCRE, "$pcrepath", "-lpcre")
fi
ICFG_STATE_ROLLBACK
fi
# Check for header files
AC_CHECK_HEADERS(stdio.h strings.h unistd.h sys/stat.h limits.h assert.h)
#Check for glibc versions
AC_CHECK_HEADERS(gnu/libc-version.h)
SYS_TYPES_H="0"
AC_CHECK_HEADERS(sys/types.h,
[AC_DEFINE(HAVE_SYS_TYPES_H,1,[Define HAVE_SYS_TYPES_H if you have the <sys/types.h> header file.])
SYS_TYPES_H="1"
]
)
AC_SUBST(SYS_TYPES_H)
INTTYPES_H="0"
AC_CHECK_HEADERS(inttypes.h,
[AC_DEFINE(HAVE_INTTYPES_H,1,[Define HAVE_INTTYPES_H if you have the <inttypes.h> header file.])
INTTYPES_H="1"
]
)
AC_SUBST(INTTYPES_H)
posix_regex=no
AC_CHECK_HEADERS(regex.h,
[posix_regex=yes;AC_DEFINE(HAVE_REGEX,1,[Define HAVE_REGEX if regex.h exists (posix regular expressions - maybe more tests needed)])],
[posix_regex=no]
)
USE_REGEX=0
if test "a$pcre2" = "ayes" -o "a$pcre" = "ayes" -o "a$posix_regex" = "ayes"; then
USE_REGEX=1
fi
AC_SUBST(USE_REGEX)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
DEFINE_SIZE_T="0"
AC_CHECK_TYPE(size_t,,[DEFINE_SIZE_T="1"])
AC_SUBST(DEFINE_SIZE_T)
DEFINE_OFF_T="0"
AC_CHECK_TYPE(off_t,,[DEFINE_OFF_T="1"])
AC_SUBST(DEFINE_OFF_T)
AC_CHECK_SIZEOF(off_t)
DEFINE_SIZE_OFF_T=$ac_cv_sizeof_off_t
AC_SUBST(DEFINE_SIZE_OFF_T)
AC_CHECK_SIZEOF(long)
DEFINE_SIZE_LONG=$ac_cv_sizeof_long
AC_SUBST(DEFINE_SIZE_LONG)
AC_CHECK_SIZEOF(void *)
DEFINE_SIZE_VOID_P=$ac_cv_sizeof_void_p
AC_SUBST(DEFINE_SIZE_VOID_P)
DEFINE_UINT8="0"
AC_CHECK_TYPE(uint8_t,,[DEFINE_UINT8="1"])
AC_SUBST(DEFINE_UINT8)
DEFINE_INT8="0"
AC_CHECK_TYPE(int8_t,,[DEFINE_INT8="1"])
AC_SUBST(DEFINE_INT8)
DEFINE_UINT64="0"
AC_CHECK_TYPE(uint64_t,,[DEFINE_UINT64="1"])
AC_SUBST(DEFINE_UINT64)
DEFINE_INT64="0"
AC_CHECK_TYPE(int64_t,,[DEFINE_INT64="1"])
AC_SUBST(DEFINE_INT64)
have_int128="no"
AC_CHECK_TYPE(__int128,
[have_int128="yes"]
[AC_DEFINE(HAVE_INT128,1,[Define HAVE_INT128 if compiler supports 128bit integers])]
)
#some type size (currently they are not used)
AC_CHECK_SIZEOF(short)
DEFINE_SIZE_SHORT=$ac_cv_sizeof_short
AC_CHECK_SIZEOF(int)
DEFINE_SIZE_INT=$ac_cv_sizeof_int
AC_CHECK_SIZEOF(long long)
DEFINE_SIZE_LONG_LONG=$ac_cv_sizeof_long_long
# Checks for library functions.
#Here we are changing the LIBS variable and save the current value to OLD_LIBS variable
EXTRALIBS=""
OLD_LIBS="$LIBS"
LIBS="$LIBS $TEST_LIBS"
#AC_FUNC_VPRINTF
AC_CHECK_FUNCS(nanosleep,
AC_DEFINE(HAVE_NANOSLEEP,1,[Define HAVE_NANOSLEEP if nanosleep exists])
)
AC_CHECK_FUNCS(inet_aton,
AC_DEFINE(HAVE_INET_ATON,1,[Define HAVE_INET_ATON if inet_aton exists])
)
AC_CHECK_FUNCS(strnstr,
AC_DEFINE(HAVE_STRNSTR,1,[Define HAVE_STRNSTR if strnstr exists])
)
AC_CHECK_FUNCS(strcasestr,
AC_DEFINE(HAVE_STRCASESTR,1,[Define HAVE_STRCASESTR if strcasestr exists])
)
AC_CHECK_FUNCS(strncasestr,
AC_DEFINE(HAVE_STRNCASESTR,1,[Define HAVE_STRNCASESTR if strncasestr exists])
)
AC_CHECK_FUNCS(setgroups)
AC_CHECK_FUNCS(inet_pton)
AC_CHECK_FUNCS(inet_ntop)
AC_CHECK_FUNCS(pread)
AC_FUNC_STRERROR_R
USE_POLL="0"
if test a"$enablepoll" != "ano"; then
AC_CHECK_HEADERS(poll.h,
AC_CHECK_FUNCS(poll,
USE_POLL="1"
)
)
fi
AC_SUBST(USE_POLL)
# if test a"$USE_POLL" = "1"; then
# AC_DEFINE(HAVE_POLL,1,[Define HAVE_POLL if poll(2) exists and we can use it])
# fi
#sysv ipc
SYSV_IPC="0"
AC_CHECK_HEADERS(sys/ipc.h,
[AC_DEFINE(HAVE_SYSV_IPC,1,[Define HAVE_SYSV_IPC if sys/ipc.h exists (maybe more tests needed)])
SYSV_IPC="1"
]
)
AC_SUBST(SYSV_IPC)
POSIX_MAPPED_FILES="0"
AC_CHECK_FUNCS(mmap munmap,
[AC_DEFINE(HAVE_POSIX_MAPPED_FILES,1,[Define HAVE_POSIX_MAPPED_FILES if mmap and munmap exists])
POSIX_MAPPED_FILES="1"
]
)
AC_SUBST(POSIX_MAPPED_FILES)