forked from eric/syslog-ng-3.3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1199 lines (1005 loc) · 41.8 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
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.
dnl
dnl There are a couple of environment defined variables which this script
dnl makes use of in addition to the standard CFLAGS/LDFLAGS/etc. These are:
dnl
dnl RELEASE_TAG - Debian release tag which is put to debian/changelog
dnl SNAPSHOT_VERSION - snapshot version to add to version number
dnl BINARY_BRANCH - the value is added to all source/binary packages
dnl SOURCE_REVISION - Revision of the source-tree, will added to the version string
dnl
AC_INIT(syslog-ng/main.c)
AC_CONFIG_MACRO_DIR([m4])
dnl ***************************************************************************
dnl definitions
PACKAGE="syslog-ng"
VERSION="`cat $srcdir/VERSION`"
dnl ***************************************************************************
dnl dependencies
GLIB_MIN_VERSION="2.10.1"
EVTLOG_MIN_VERSION="0.2.12"
OPENSSL_MIN_VERSION="0.9.8"
LIBDBI_MIN_VERSION="0.8.0"
IVYKIS_MIN_VERSION="0.30.1"
JSON_C_MIN_VERSION="0.7"
JSON_GLIB_MIN_VERSION="0.12"
PCRE_MIN_VERSION="6.1"
LMC_MIN_VERSION="0.1.0"
dnl ***************************************************************************
dnl Initial setup
ostype=`uname -s`
if test -r $srcdir/dist.conf; then
# read defaults, dist.conf does not change
# values for parameters that are already set
. $srcdir/dist.conf
fi
if test -z "$RELEASE_TAG"; then
RELEASE_TAG=unstable
fi
if test "`uname -s`" = "Linux";then
CURRDATE=`date -R`
else
CURRDATE=`date +"%a, %d %b %Y %H:%M:%S %Z"`
fi
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
_AM_PROG_TAR([ustar])
if test -n "$SNAPSHOT_VERSION"; then
VERSION=$VERSION+$SNAPSHOT_VERSION
fi
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
fi
if test "x$exec_prefix" = "xNONE"; then
exec_prefix='${prefix}'
fi
pidfiledir='${localstatedir}'
moduledir='${exec_prefix}/lib/syslog-ng'
AM_CONFIG_HEADER(config.h)
dnl ***************************************************************************
dnl Arguments
AC_ARG_WITH(libnet,
[ --with-libnet=path use path to libnet-config script],
,
[with_libnet=""])
AC_ARG_WITH(pidfile-dir,
[ --with-pidfile-dir=path Use path as the directory for storing pidfiles],
pidfiledir=$with_pidfile_dir)
AC_ARG_WITH(module-dir,
[ --with-module-dir=path Use path as the directory to install modules into],
moduledir=$with_module_dir)
AC_ARG_WITH(module-path,
[ --with-module-path=path Use path as the list of ':' separated directories looked up when searching for modules],
module_path=$with_module_path)
AC_ARG_WITH(timezone-dir,
[ --with-timezone-dir=path Use path as the directory to get the timezone files],
timezonedir=$with_timezone_dir)
AC_ARG_WITH(default-modules,
[ --with-default-modules="mod1,mod2,mod3" Use these as the list of automatically loaded modules],
default_modules=$with_default_modules, default_modules="auto")
AC_ARG_WITH(ld-library-path,
[ --with-ld-library-path=path Set LD_LIBRARY_PATH during runtime to the value given],
env_ld_library_path=$with_ld_library_path)
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]))
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debugging code.],, enable_debug="no")
AC_ARG_ENABLE(env-wrapper,
[ --enable-env-wrapper Enable wrapper program to set up various environment variables],, enable_env_wrapper=auto)
AC_ARG_ENABLE(gprof,
[ --enable-gprof Enable gcc profiling.],, enable_gprof="no")
AC_ARG_ENABLE(memtrace,
[ --enable-memtrace Enable alternative leak debugging code.])
AC_ARG_ENABLE(ssl,
[ --enable-ssl Enable SSL support.],,enable_ssl="auto")
AC_ARG_ENABLE(dynamic-linking,
[ --enable-dynamic-linking Link everything dynamically.],,enable_dynamic_linking="auto")
AC_ARG_ENABLE(mixed-linking,
[ --enable-mixed-linking Link 3rd party libraries statically, system libraries dynamically],,enable_mixed_linking="auto")
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 Enable support for IPv6.],,enable_ipv6="auto")
AC_ARG_ENABLE(tcp-wrapper,
[ --enable-tcp-wrapper Enable support for TCP wrappers.],,enable_tcp_wrapper="auto")
AC_ARG_ENABLE(spoof-source,
[ --enable-spoof-source Enable support for spoofed source addresses.]
,,enable_spoof_source="auto")
AC_ARG_ENABLE(sun-streams,
[ --enable-sun-streams Enable support for Solaris /dev/log STREAMS device.]
,,enable_sun_streams="auto")
AC_ARG_ENABLE(sql,
[ --enable-sql Enable support for SQL destinations. (default: auto)]
,,enable_sql="auto")
AC_ARG_ENABLE(pacct,
[ --enable-pacct Enable support for reading Process Accounting files (EXPERIMENTAL, Linux only).]
,,enable_pacct="no")
AC_ARG_ENABLE(linux-caps,
[ --enable-linux-caps Enable support for managing Linux capabilities (default: auto)]
,,enable_linux_caps="auto")
AC_ARG_ENABLE(pcre,
[ --enable-pcre Enable support for Perl Compatible Regular Expressions (default: auto)]
,,enable_pcre="auto")
AC_ARG_ENABLE(gcov,
[ --enable-gcov Enable coverage profiling (default: no)]
,,enable_gcov="no")
AC_ARG_ENABLE(mongodb,
[ --enable-mongodb Enable mongodb destination (default: auto)]
,,enable_mongodb="auto")
AC_ARG_WITH(libmongo-client,
[ --with-libmongo-client=[system/internal]
Link against the system supplied or the built-in libmongo-client library.]
,,with_libmongo_client="internal")
AC_ARG_WITH(ivykis,
[ --with-ivykis=[system/internal]
Link against the system supplied or the built-in ivykis library.]
,,with_ivykis="internal")
AC_ARG_WITH(json,
[ --with-json=[json-c/json-glib/auto]
Use the JSON implementation specified]
,,with_json="auto")
AC_ARG_ENABLE(json,
[ --enable-json Enable support for JSON template formatting (default: auto)]
,,enable_json="auto")
AC_ARG_ENABLE(systemd,
[ --enable-systemd Enable systemd support (default: auto)]
,,enable_systemd="auto")
AC_ARG_WITH(compile-date,
[ --without-compile-date Do not include the compile date in the binary]
,wcmp_date="${withval}", wcmp_date="yes")
if test "x$wcmp_date" != "xno"; then
wcmp_date="1"
else
wcmp_date="0"
fi
patheval()
{
OLD=$1
NEW=`eval echo $1`
while test "x$OLD" != "x$NEW"
do
OLD=$NEW
NEW=`eval echo $OLD`
done
echo $OLD
}
dnl ***************************************************************************
dnl Checks for programs.
AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_CC_C99
if test "x$ac_cv_prog_cc_c99" = "xno"; then
AC_MSG_ERROR("C99 standard compliant C compiler required. Try GCC 3.x or later.")
fi
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
LT_INIT([dlopen disable-static])
dnl ***************************************************************************
dnl Validate yacc
yacc_ok=1
if echo "$YACC" | grep bison > /dev/null; then
# NOTE: m4 removes [], that's why it needs to be escaped
bison_version=[`$YACC --version | head -n 1 | sed -e 's/[^0-9.]*\([0-9.]\+\)$/\1/'`]
bison_version_major=`echo $bison_version | cut -d. -f1`
bison_version_minor=`echo $bison_version | cut -d. -f2`
if test "$bison_version_major" -lt 2 -o "$bison_version_minor" -lt 4; then
yacc_ok=0
fi
else
yacc_ok=0
fi
if test $yacc_ok = 0; then
if test -f $srcdir/lib/cfg-grammar.c || test -f lib/cfg-grammar.c; then
AC_MSG_WARN([No proper bison found, you'll not be able to change lib/cfg-grammar.y])
else
AC_MSG_ERROR([syslog-ng requires bison 2.4 or later (traditional yacc is not enough). Your source tree seems to be from git, which doesn't have lib/cfg-grammar.c. Please install bison or use a distribution tarball.])
fi
fi
dnl ***************************************************************************
dnl Validate flex
if $LEX --version | grep "flex" >/dev/null; then
lex_ok=1
else
lex_ok=0
fi
if test $lex_ok = 0 ; then
if test -f $srcdir/lib/cfg-lex.c || test -f lib/cfg-lex.c; then
AC_MSG_WARN([No flex found, you'll not be able to change lib/cfg-lex.l])
else
AC_MSG_ERROR([syslog-ng requires flex in order to generate its config lexer. Your source tree seems to be from git, which doesn't have lib/cfg-lex.c. Please install flex or use a distribution tarball.])
fi
fi
dnl ***************************************************************************
dnl Set up CFLAGS
if test "x$ac_compiler_gnu" = "xyes"; then
CFLAGS="${CFLAGS} -Wall"
if test "x$enable_debug" = "xyes"; then
CFLAGS="${ac_cv_env_CFLAGS_value} -Wall -g"
fi
if test "x$enable_gprof" = "xyes"; then
CFLAGS="${CFLAGS} -pg"
fi
if test "x$enable_gcov" = "xyes"; then
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
fi
fi
CFLAGS="${CFLAGS} -pthread"
AX_CFLAGS_GCC_OPTION(-Wno-pointer-sign, CFLAGS_NOWARN_POINTER_SIGN)
AC_SYS_LARGEFILE
# FIXME: skip tests on unsupported platforms/architectures...
case "$ostype" in
HP-UX)
if $CC -v 2>&1 | grep gcc > /dev/null; then
CFLAGS="${CFLAGS} -U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED -D_HPUX_SOURCE"
LDFLAGS="${LDFLAGS} -lcl"
AC_DEFINE(HAVE_BROKEN_PREAD, 1, [define if your platform has a broken pread/pwrite (e.g. HP-UX)])
AC_MSG_WARN([NOTE: on HP-UX with gcc, you might need to edit sys/socket.h manually or you'll get compilation errors])
fi
;;
AIX)
if test "$ac_cv_sys_large_files" -ne 0; then
CFLAGS="${CFLAGS} -D_LARGE_FILES=1"
fi
# NOTE: The -brtl option to the linker must be set before calling the
# configure script, as otherwise the generated libtool will behave
# differently. We need the runtime linker during execution (hence the
# -brtl) to load external modules. Also, please note that with -brtl the
# linker behaves similarly to what is expected on other UNIX systems,
# without it, it refuses to link an .so in if there's no reference from
# the main program, even if there is a proper -llibname option.
LDFLAGS="$LDFLAGS -Wl,-brtl"
MODULE_LDFLAGS="-avoid-version -module"
;;
OSF1)
CFLAGS="${CFLAGS} -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE -D_POSIX_C_SOURCE"
;;
esac
if test "$enable_dynamic_linking" = "auto" -a "$enable_mixed_linking" = "auto"; then
enable_dynamic_linking="yes"
enable_mixed_linking="no"
fi
linkopts=0
if test "x$enable_dynamic_linking" = "xyes"; then
linkopts=`expr $linkopts + 1`
fi
if test "x$enable_mixed_linking" = "xyes"; then
linkopts=`expr $linkopts + 1`
fi
if test "$linkopts" -gt 1; then
AC_MSG_ERROR([You cannot specify multiple linking options at the same time (--enable-dynamic-linking, --enable-mixed-linking).])
fi
if test "x$enable_dynamic_linking" = "xyes"; then
enable_dynamic_linking="yes"
enable_mixed_linking="no"
linking_mode="dynamic"
elif test "x$enable_mixed_linking" = "xyes"; then
enable_dynamic_linking="no"
enable_mixed_linking="yes"
linking_mode="mixed"
fi
dnl ***************************************************************************
dnl Is the __thread keyword available?
dnl ***************************************************************************
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <pthread.h>
__thread int a;
]],
[a=0;])],
[ac_cv_have_tls=yes; AC_DEFINE_UNQUOTED(HAVE_THREAD_KEYWORD, 1, "Whether thread-local storage is supported by the system")])
dnl ***************************************************************************
dnl How to do static linking?
dnl ***************************************************************************
AC_MSG_CHECKING(how to enable static linking for certain libraries)
ldversion=`ld -V 2>&1 | head -n 1`
if echo $ldversion | egrep "GNU|Solaris" > /dev/null; then
LD_START_STATIC="-Wl,-Bstatic"
LD_END_STATIC="-Wl,-Bdynamic"
AC_MSG_RESULT(GNU or Solaris)
elif test $ostype = "HP-UX" > /dev/null; then
LD_START_STATIC="-Wl,-a,archive"
LD_END_STATIC="-Wl,-a,shared_archive"
AC_MSG_RESULT(HP-UX)
elif test "$ostype" = "AIX"; then
LD_START_STATIC="-Wl,-bstatic"
LD_END_STATIC="-Wl,-bdynamic"
AC_MSG_RESULT(AIX)
else
LD_START_STATIC=""
LD_END_STATIC=""
AC_MSG_RESULT([no clues, linking everything dynamically, please send appropriate ld arguments to [email protected]])
fi
dnl ***************************************************************************
dnl Miscellanneous headers
dnl ***************************************************************************
AC_HEADER_STDC
AC_CHECK_HEADER(dmalloc.h)
AC_CHECK_HEADERS(strings.h getopt.h stropts.h sys/strlog.h door.h sys/capability.h sys/prctl.h utmp.h utmpx.h)
AC_CHECK_HEADERS(tcpd.h)
dnl ***************************************************************************
dnl Header checks
dnl ***************************************************************************
dnl Checks for typedefs, structures, and compiler characteristics.
AC_STRUCT_TM
AC_CACHE_CHECK(for SO_ACCEPTCONN, blb_cv_c_so_acceptconn,
[AC_EGREP_CPP(SO_ACCEPTCONN,
[
#include <sys/types.h>
#include <socket.h>
SO_ACCEPTCONN
],
blb_cv_c_so_acceptconn=no, blb_cv_c_so_acceptconn=yes)])
if test "x$blb_cv_c_so_acceptconn" = "xyes"; then
AC_DEFINE(HAVE_SO_ACCEPTCONN, 1, [SO_ACCEPTCONN is present])
fi
AC_CHECK_MEMBER(struct tm.tm_gmtoff,AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF,1,[Whether you have tm_gmtoff field in struct tm]),,[
#if TM_IN_SYS_TIME
#include <sys/time.h>
#else
#include <time.h>
#endif])
AC_CACHE_CHECK(for I_CONSLOG, blb_cv_c_i_conslog,
[AC_EGREP_CPP(I_CONSLOG,
[
#include <sys/strlog.h>
I_CONSLOG
],
blb_cv_c_i_conslog=no, blb_cv_c_i_conslog=yes)])
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS=-D_GNU_SOURCE
AC_CACHE_CHECK(for O_LARGEFILE, blb_cv_c_o_largefile,
[AC_EGREP_CPP(O_LARGEFILE,
[
#include <fcntl.h>
O_LARGEFILE
],
blb_cv_c_o_largefile=no, blb_cv_c_o_largefile=yes)])
CPPFLAGS=$old_CPPFLAGS
if test "x$blb_cv_c_o_largefile" = "xyes"; then
AC_DEFINE(HAVE_O_LARGEFILE, 1, [O_LARGEFILE is present])
fi
AC_CACHE_CHECK(for struct sockaddr_storage, blb_cv_c_struct_sockaddr_storage,
[AC_EGREP_HEADER([sockaddr_storage], sys/socket.h, blb_cv_c_struct_sockaddr_storage=yes,blb_cv_c_struct_sockaddr_storage=no)])
if test "$blb_cv_c_struct_sockaddr_storage" = "yes"; then
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[1],[struct sockaddr_storage is present on your system])
fi
AC_CACHE_CHECK(for struct sockaddr_in6, blb_cv_c_struct_sockaddr_in6,
[AC_EGREP_HEADER([sockaddr_in6], netinet/in.h, blb_cv_c_struct_sockaddr_in6=yes,blb_cv_c_struct_sockaddr_in6=no)])
AC_CACHE_CHECK(for PR_SET_KEEPCAPS, blb_cv_keepcaps,
[AC_EGREP_CPP(PR_SET_KEEPCAPS,
[
#include <sys/prctl.h>
PR_SET_KEEPCAPS
],
blb_cv_keepcaps=no,
blb_cv_keepcaps=yes)])
if test "x$blb_cv_keepcaps" = "xyes"; then
AC_DEFINE(HAVE_PR_SET_KEEPCAPS, 1, [have PR_SET_KEEPCAPS])
fi
if test "$ostype" != "Darwin" ; then
AC_DEFINE(HAVE_ENVIRON, [1], [Specifies whether the environ global variable exists])
fi
dnl ***************************************************************************
dnl Checks for libraries
AC_CHECK_LIB(door, door_create, BASE_LIBS="$BASE_LIBS -ldoor")
AC_CHECK_LIB(socket, socket, BASE_LIBS="$BASE_LIBS -lsocket")
AC_CHECK_LIB(rt, nanosleep, BASE_LIBS="$BASE_LIBS -lrt")
AC_CHECK_LIB(nsl, gethostbyname, BASE_LIBS="$BASE_LIBS -lnsl")
AC_CHECK_LIB(regex, regexec, REGEX_LIBS="-lregex")
AC_CHECK_LIB(resolv, res_init, RESOLV_LIBS="-lresolv")
if test "x$enable_linux_caps" = "xyes" -o "x$enable_linux_caps" = "xauto"; then
AC_CHECK_LIB(cap, cap_set_proc, LIBCAP_LIBS="-lcap")
fi
AC_CHECK_FUNCS(strdup strtol strtoll strtoimax inet_aton inet_ntoa getopt_long getaddrinfo getutent getutxent pread pwrite strcasestr memrchr localtime_r gmtime_r)
old_LIBS=$LIBS
LIBS=$BASE_LIBS
AC_CHECK_FUNCS(clock_gettime)
LIBS=$old_LIBS
dnl ***************************************************************************
dnl libevtlog headers/libraries
dnl ***************************************************************************
PKG_CHECK_MODULES(EVTLOG, eventlog >= $EVTLOG_MIN_VERSION,,)
dnl ***************************************************************************
dnl libwrap headers/libraries
dnl ***************************************************************************
old_LIBS=$LIBS
AC_CACHE_CHECK(for TCP wrapper library,
blb_cv_c_lwrap,
for libwrap in "-lwrap" "/usr/local/lib/libwrap.a"; do
LIBS="$old_LIBS $libwrap"
[AC_TRY_LINK(,
[
}
int allow_severity;
int deny_severity;
extern int hosts_access(void);
int foo(void)
{
hosts_access();
],
[blb_cv_c_lwrap=$libwrap
break],
blb_cv_c_lwrap="")
done
])
LIBS=$old_LIBS
LIBWRAP_LIBS=$blb_cv_c_lwrap
if test "x$enable_tcp_wrapper" = "xauto"; then
AC_MSG_CHECKING(whether to enable TCP wrapper support)
if test "x$ac_cv_header_tcpd_h" = "xyes" -a "x$blb_cv_c_lwrap" != "x"; then
enable_tcp_wrapper=yes
AC_MSG_RESULT(yes)
else
LIBWRAP_LIBS=""
AC_MSG_RESULT(no)
enable_tcp_wrapper=no
fi
elif test "x$enable_tcp_wrapper" != "xyes"; then
LIBWRAP_LIBS=""
fi
dnl ***************************************************************************
dnl libdbi headers/libraries
dnl ***************************************************************************
AC_CHECK_LIB(dl, dlsym, DL_LIBS="-ldl")
PKG_CHECK_MODULES(LIBDBI, dbi >= $LIBDBI_MIN_VERSION, libdbi_pkgconfig_not_found="0", libdbi_pkgconfig_not_found="1")
if test "$libdbi_pkgconfig_not_found" -eq 1; then
dnl if libdbi has no .pc file, try it without one
AC_CHECK_LIB(dbi, dbi_initialize, LIBDBI_LIBS="-ldbi"; LIBDBI_CFLAGS="-I/usr/include")
fi
if test "x$enable_sql" = "xauto"; then
AC_MSG_CHECKING(whether to enable SQL support)
if test "x$LIBDBI_LIBS" != "x"; then
enable_sql="yes"
AC_MSG_RESULT(yes)
else
enable_sql="no"
AC_MSG_RESULT(no)
fi
fi
dnl ***************************************************************************
dnl GLib headers/libraries
dnl ***************************************************************************
GLIB_ADDONS="gmodule-2.0 gthread-2.0"
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_MIN_VERSION $GLIB_ADDONS,,)
if test "$linking_mode" != "dynamic"; then
# strip out -ldl & -lrt as it cannot be linked statically
GLIB_LIBS=`echo $GLIB_LIBS | tr ' ' '\n' | egrep -v "^(-ldld?)|(-lrt)$" | tr '\n' ' '`
old_LIBS=$LIBS
LIBS="$LD_START_STATIC $GLIB_LIBS $LD_END_STATIC $BASE_LIBS"
AC_CHECK_FUNC(g_hash_table_new, blb_cv_static_glib=yes, blb_cv_static_glib=no)
LIBS=$old_LIBS
fi
old_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$GLIB_CFLAGS"
old_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $GLIB_LIBS"
AC_CHECK_FUNCS(g_mapped_file_unref)
AC_CACHE_CHECK(sanity checking Glib headers,
blb_cv_glib_sane,
[AC_TRY_RUN([
#include <glib.h>
int main()
{
if (sizeof(long) != GLIB_SIZEOF_LONG)
return 1;
return 0;
}
],
blb_cv_glib_sane=yes,
blb_cv_glib_sane=no,
blb_cv_glib_sane=yes)])
CPPFLAGS=$old_CPPFLAGS
LDFLAGS=$old_LDFLAGS
if test "x$blb_cv_glib_sane" = "xno"; then
AC_MSG_ERROR([Glib headers inconsistent with current compiler setting. You might be using 32 bit Glib with a 64 bit compiler, check PKG_CONFIG_PATH])
fi
if test "x$linking_mode" != "xdynamic" -a "x$blb_cv_static_glib" = "xno"; then
AC_MSG_ERROR([static GLib libraries not found (a file named libglib-2.0.a), either link GLib dynamically using the --enable-dynamic-linking or install a static GLib])
fi
dnl ***************************************************************************
dnl json headers/libraries
dnl ***************************************************************************
PKG_CHECK_MODULES(JSON_C, json >= $JSON_C_MIN_VERSION,, JSON_C_LIBS="")
PKG_CHECK_MODULES(JSON_GLIB, json-glib-1.0 >= $JSON_GLIB_MIN_VERSION,, JSON_GLIB_LIBS="")
dnl ***************************************************************************
dnl pcre headers/libraries
dnl ***************************************************************************
if test "x$enable_pcre" = "xyes" -o "x$enable_pcre" = "xauto"; then
if test "x$linking_mode" = "xmixed"; then
# check if we have a pcre bundled in glib. In case glib is
# dynamic it doesn't matter as glib doesn't export those
# symbols. But in case glib is static, linking it through
# glib and through libpcre would clash.
old_LIBS="$LIBS"
LIBS="$LD_START_STATIC $GLIB_LIBS $LD_END_STATIC $LIBS"
AC_CHECK_FUNC(pcre_compile2, AC_MSG_ERROR([You cannot use a GLib embedded PCRE in mixed linking mode]))
LIBS="$old_LIBS"
fi
PKG_CHECK_MODULES(PCRE, libpcre >= $PCRE_MIN_VERSION,, PCRE_LIBS="")
if test -z "$PCRE_LIBS"; then
if test "x$enable_pcre" = "xyes"; then
AC_MSG_ERROR(Cannot find pcre version >= $PCRE_MIN_VERSION.)
else
AC_MSG_WARN(Cannot find pcre version >= $PCRE_MIN_VERSION. pcre support disabled.)
fi
fi
fi
if test -z "$PCRE_LIBS"; then
PCRE_LIBS=""
PCRE_CFLAGS=""
fi
if test "x$enable_pcre" = "xauto"; then
AC_MSG_CHECKING(whether to enable PCRE support)
if test "x$PCRE_LIBS" != "x"; then
enable_pcre="yes"
else
enable_pcre="no"
fi
AC_MSG_RESULT([$enable_pcre])
fi
dnl ***************************************************************************
dnl OpenSSL headers/libraries
dnl ***************************************************************************
# openssl is needed for:
# * TLS support
dnl check OpenSSL static linking
PKG_CHECK_MODULES(OPENSSL, openssl >= $OPENSSL_MIN_VERSION,, OPENSSL_LIBS="")
if test -n "$OPENSSL_LIBS" -a "$linking_mode" != "dynamic"; then
dnl required for openssl, but only when linking statically
AC_CHECK_LIB(z, inflate, ZLIB_LIBS="-lz")
dnl Remove -ldl as it cannot be linked statically on some platforms, it'll be present in DL_LIBS
OPENSSL_LIBS=`echo $OPENSSL_LIBS | tr ' ' '\n' | egrep -v "^-ldld?$" | tr '\n' ' '`
old_LIBS=$LIBS
LIBS="$LD_START_STATIC $OPENSSL_LIBS $ZLIB_LIBS $LD_END_STATIC $DL_LIBS"
AC_CHECK_FUNC(SSL_library_init, blb_cv_static_openssl=yes, blb_cv_static_openssl=no)
LIBS=$old_LIBS
fi
if test "x$OPENSSL_LIBS" != "x"; then
if test "x$enable_ssl" = "xauto"; then
enable_ssl="yes"
fi
else
enable_ssl="no"
fi
if test "x$enable_ssl" = "xno"; then
OPENSSL_LIBS=""
fi
dnl
dnl Right now, openssl is never linked statically as it is only used by the
dnl TLS build of the afsocket plugin which is loaded dynamically anyway.
dnl
dnl The static check remains though, because the core may need openssl in the
dnl future, in which case it becomes relevant again.
dnl
dnl if test "x$linking_mode" != "xdynamic" -a "x$blb_cv_static_openssl" = "xno"; then
dnl AC_MSG_ERROR([static OpenSSL libraries not found (libssl.a, libcrypto.a and their external dependencies like libz.a), either link OpenSSL statically using the --enable-dynamic-linking, or install a static OpenSSL])
dnl fi
dnl ***************************************************************************
dnl libnet headers/libraries
dnl ***************************************************************************
AC_MSG_CHECKING(for LIBNET)
if test "x$with_libnet" = "x"; then
LIBNET_CONFIG="`which libnet-config`"
else
LIBNET_CONFIG="$with_libnet/libnet-config"
fi
if test -n "$LIBNET_CONFIG" -a -x "$LIBNET_CONFIG"; then
LIBNET_CFLAGS="`$LIBNET_CONFIG --defines`"
LIBNET_LIBS="`$LIBNET_CONFIG --libs`"
AC_MSG_RESULT(yes)
else
LIBNET_LIBS=
AC_MSG_RESULT(no)
fi
if test "x$enable_spoof_source" = "xauto"; then
AC_MSG_CHECKING(whether to enable spoof source support)
if test "x$LIBNET_LIBS" != "x"; then
enable_spoof_source=yes
AC_MSG_RESULT(yes)
else
enable_spoof_source=no
LIBNET_LIBS=
LIBNET_CFLAGS=
AC_MSG_RESULT(no)
fi
elif test "x$enable_spoof_source" != "xyes"; then
LIBNET_CFLAGS=""
LIBNET_LIBS=""
enable_spoof_source=no
fi
dnl ***************************************************************************
dnl ivykis headers/libraries
dnl ***************************************************************************
if test "x$with_ivykis" = "xinternal"; then
if test -f "$srcdir/lib/ivykis/lib/iv_main.c"; then
AC_CONFIG_SUBDIRS([lib/ivykis])
# these can only be used in lib as it assumes
# the current directory just one below ivykis
IVYKIS_LIBS="-Wl,--whole-archive -L\$(top_builddir)/lib/ivykis -livykis -Wl,--no-whole-archive"
IVYKIS_CFLAGS="-I\$(top_srcdir)/lib/ivykis/lib/include -I\$(top_builddir)/lib/ivykis/lib/include -I\$(top_srcdir)/lib/ivykis/modules/include"
IVYKIS_SUBDIRS=ivykis
# LIBS to use when libtool is not applicable (when linking the main syslog-ng executable in mixed linking mode)
IVYKIS_NO_LIBTOOL_LIBS="-Wl,--whole-archive -L\$(top_builddir)/lib/ivykis/.libs -livykis -Wl,--no-whole-archive"
else
AC_MSG_ERROR([Internal ivykis sources not found in lib/ivykis. This is a hard dependency, unable to build syslog-ng without them.])
fi
else
with_ivykis="system"
PKG_CHECK_MODULES(IVYKIS, ivykis >= $IVYKIS_MIN_VERSION,,)
# in case we're using a system installed ivykis, we can link against
# it even without libtool and without extra linker arguments (as
# we're linking dynamically)
IVYKIS_NO_LIBTOOL_LIBS="$IVYKIS_LIBS"
fi
dnl ***************************************************************************
dnl libmongo headers/libraries
dnl ***************************************************************************
if test "x$with_libmongo_client" = "xinternal"; then
if test -f "$srcdir/modules/afmongodb/libmongo-client/src/mongo.h"; then
AC_CONFIG_SUBDIRS([modules/afmongodb/libmongo-client])
# these can only be used in modules/mongodb as it assumes
# the current directory just one below libmongo-client
LIBMONGO_LIBS="-L\$(builddir)/libmongo-client/src -lmongo-client"
LIBMONGO_CFLAGS="-I\$(srcdir)/libmongo-client/src"
LIBMONGO_SUBDIRS="libmongo-client"
else
AC_MSG_WARN([Internal libmongo-client sources not found in modules/afmongodb/libmongo-client])
with_libmongo_client="no"
fi
elif test "x$with_libmongo_client" = "xsystem"; then
PKG_CHECK_MODULES(LIBMONGO, libmongo-client >= $LMC_MIN_VERSION,,with_libmongo_client="no")
fi
if test "x$with_libmongo_client" = "xno"; then
enable_mongodb="no"
fi
dnl ***************************************************************************
dnl misc features to be enabled
dnl ***************************************************************************
if test "x$ac_cv_lib_door_door_create" = "xyes"; then
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_LIB(pthread, pthread_create)
fi
AC_MSG_CHECKING(whether to enable Sun STREAMS support)
if test "x$ac_cv_header_stropts_h" = "xyes" -a \
"x$ac_cv_header_sys_strlog_h" = "xyes" -a \
"x$enable_sun_streams" != "xno" -a \
"x$blb_cv_c_i_conslog" != "xno" -o \
"x$enable_sun_streams" = "xyes"; then
enable_sun_streams=yes
AC_MSG_RESULT(yes)
else
enable_sun_streams=no
AC_MSG_RESULT(no)
fi
if test "x$enable_env_wrapper" = "xauto"; then
if test "x$env_ld_library_path" != "x"; then
enable_env_wrapper="yes"
else
enable_env_wrapper="no"
fi
fi
if test "x$enable_ipv6" = "xauto"; then
AC_MSG_CHECKING(whether to enable IPv6 support)
if test "x$blb_cv_c_struct_sockaddr_in6" = "xyes"; then
enable_ipv6=yes
AC_MSG_RESULT(yes)
else
enable_ipv6=no
AC_MSG_RESULT(no)
fi
fi
if test "x$enable_linux_caps" = "xauto"; then
AC_MSG_CHECKING(whether to enable Linux capability support)
if test "x$ac_cv_header_sys_capability_h" = "xyes"; then
enable_linux_caps="yes"
else
enable_linux_caps="no"
fi
AC_MSG_RESULT([$enable_linux_caps])
fi
if test "x$enable_mongodb" = "xauto"; then
AC_MSG_CHECKING(whether to enable mongodb destination support)
if test "x$with_mongo_client" != "no"; then
enable_mongodb="yes"
else
enable_mongodb="no"
fi
AC_MSG_RESULT([$enable_mongodb])
fi
if test "x$with_json" != "xjson-glib" -a "x$with_json" != "xjson-c" -a "x$with_json" != "xauto"; then
# unknown --with-json argument
AC_MSG_ERROR([Unknown JSON implementation ($with_json) specified, only json-glib, json-c and auto is known])
elif test \( "x$with_json" = "xauto" -o "x$with_json" = "xjson-c" \) -a -n "$JSON_C_LIBS" ; then
# json-c found and user requested json-c or auto
JSON_LIBS=$JSON_C_LIBS
JSON_CFLAGS=$JSON_C_CFLAGS
AC_DEFINE_UNQUOTED(HAVE_JSON_C, 1, [Have json-c])
with_json="json-c"
elif test \( "x$with_json" = "xauto" -o "x$with_json" = "xjson-glib" \) -a -n "$JSON_GLIB_LIBS"; then
# json-glib found and user requested json-glib or auto
JSON_LIBS=$JSON_GLIB_LIBS
JSON_CFLAGS=$JSON_GLIB_CFLAGS
AC_DEFINE_UNQUOTED(HAVE_JSON_GLIB, 1, [Have json-glib])
with_json="json-glib"
elif test "x$with_json" = "xauto"; then
# nothing found, but autodetect was selected
JSON_LIBS=""
JSON_CFLAGS=""
with_json="no"
elif test "x$with_json" = "xjson-glib"; then
AC_MSG_ERROR([Cannot find json-glib-1.0 >= $JSON_GLIB_MIN_VERSION: is pkg-config in path?])
elif test "x$with_json" = "xjson-c"; then
AC_MSG_ERROR([Cannot find json-c version >= $JSON_C_MIN_VERSION: is pkg-config in path?])
fi
if test "x$enable_json" = "xauto"; then
if test "x$with_json" = "xno"; then
enable_json="no"
else
enable_json="yes"
fi
elif test "x$enable_json" = "xyes" -a "x$with_json" = "xno"; then
AC_MSG_ERROR([Cannot find json-c version >= $JSON_C_MIN_VERSION or json-glib-1.0 >= $JSON_GLIB_MIN_VERSION: is pkg-config in path?])
fi
if test "x$enable_systemd" = "xauto"; then
if test "$ostype" = "Linux" -a "$blb_cv_c_so_acceptconn" = "yes"; then
enable_systemd=yes
else
enable_systemd=no
fi
fi
if test "x$enable_systemd" = "xyes"; then
PKG_CHECK_MODULES(libsystemd_daemon, libsystemd-daemon >= 31,with_libsystemd="yes",with_libsystemd="no")
if test "x$with_systemdsystemunitdir" = "xyes"; then
# no arguments, just --with-systemdsystemunitdir
systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd);
if test "$systemdsystemunitdir" = ""; then
AC_MSG_ERROR([Error autodetecting systemdsystemunitdir, systemd pkg-config file not found?])
fi
elif test "$systemdsystemunitdir" = "no"; then
# --without-systemdsystemunitdir was specified
systemdsystemunitdir=""
else
systemdsystemunitdir="$with_systemdsystemunitdir"
fi
fi
dnl ***************************************************************************
dnl default modules to be loaded
dnl ***************************************************************************
### The default set of modules are those that provide functionality that
### were provided in syslog-ng 3.2 and prior, unless explicitly overridden
### by the user.
###
### New plugins can be loaded by explicit "@module foo" lines in the
### configuration file, that's the preferred form.
if test "x$default_modules" = "xauto"; then
default_modules="affile,afprog,afsocket,afuser,basicfuncs,csvparser,dbparser,syslogformat"
if test "x$enable_sql" = "xyes"; then
default_modules="$default_modules,afsql"
fi
if test "x$enable_sun_streams" = "xyes"; then
default_modules="$default_modules,afstreams"
fi
fi
if test "x$module_path" = "x"; then
module_path="`patheval $moduledir`"
fi
CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS $EVTLOG_CFLAGS $PCRE_CFLAGS $OPENSSL_CFLAGS $LIBNET_CFLAGS $LIBDBI_CFLAGS $IVYKIS_CFLAGS -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
########################################################
## NOTES: on how syslog-ng is linked
#
# There are two major linking modes currently:
# 1) dynamic: all libraries are linked dynamically, and assumed to be available as dynamic libraries
#
# 2) mixed: typical system provided libraries are linked dynamicaly, the
# rest is linked statically (Glib etc). Please note that _only_ the
# main syslog-ng executable is linked this way so that it can be
# started early during startup, tools and unit tests are linked
# dynamically the same way.
#
# The following variables are introduced and AC_SUBSTed to be used in Makefiles:
#
# SYSLOGNG_DEPS_LIBS:
# includes all dependendent libraries used by binary that can be linked in mixed mode (e.g. only the syslog-ng binary).
#
# TOOL_DEPS_LIBS:
# executables (e.g. tools & unit test programs) that link against
# libsyslog-ng.so should be linked with this set of libraries. other
# tools that do not use libsyslog-ng.so can use the _LIBS variables
# directly.
#
# CORE_DEPS_LIBS:
# libsyslog-ng.so is linked with this set of libraries.
#
# MODULE_DEPS_LIBS:
# The set of libraries that modules should be linked against. Only to
# satisfy their "core" dependency, any other libs that the core doesn't
# depend on must be linked explicitly.
#
# MODULE_LDFLAGS:
# The LDFLAGS to be passed when linking modules (may not contain
# library references -l and such, only linker flags)
#
# Modules should be linked against libsyslog-ng.la and libraries that are
# _NOT_ linked into libsyslog-ng.la no need to define a LIBS variable for
# that.
if test -z "$MODULE_LDFLAGS"; then
MODULE_LDFLAGS="-avoid-version -module -no-undefined"
fi
MODULE_DEPS_LIBS="\$(top_builddir)/lib/libsyslog-ng.la"