1#############################################################################
2# Copyright (c) 2016 Balabit
3#
4# This library is free software; you can redistribute it and/or
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
8#
9# This library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12# Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public
15# License along with this library; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17#
18# As an additional exemption you are allowed to compile & link against the
19# OpenSSL libraries as published by the OpenSSL project. See the file
20# COPYING for details.
21#
22#############################################################################
23
24dnl Process this file with autoconf to produce a configure script.
25dnl
26dnl There are a couple of environment defined variables which this script
27dnl makes use of in addition to the standard CFLAGS/LDFLAGS/etc. These are:
28dnl
29dnl RELEASE_TAG        - Debian release tag which is put to debian/changelog
30dnl SNAPSHOT_VERSION   - snapshot version to add to version number
31dnl BINARY_BRANCH      - the value is added to all source/binary packages
32dnl SOURCE_REVISION    - Revision of the source-tree, will added to the version string
33dnl
34
35AC_INIT([syslog-ng], m4_esyscmd_s([scripts/version.sh]))
36AC_CONFIG_SRCDIR([syslog-ng/main.c])
37AC_CONFIG_MACRO_DIR([m4])
38m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
39
40dnl ***************************************************************************
41dnl dependencies
42
43GLIB_MIN_VERSION="2.32"
44OPENSSL_MIN_VERSION="0.9.8"
45LIBDBI_MIN_VERSION="0.9.0"
46LIBRABBITMQ_MIN_VERSION="0.5.3"
47LIBRDKAFKA_MIN_VERSION="1.1.0"
48IVYKIS_MIN_VERSION="0.36.1"
49IVYKIS_UPDATED_VERSION="0.39"
50JSON_C_MIN_VERSION="0.9"
51PCRE_MIN_VERSION="6.1"
52LMC_MIN_VERSION="1.0.0"
53LRMQ_MIN_VERSION="0.0.1"
54LRC_MIN_VERSION="1.6.0"
55JOURNALD_MIN_VERSION="195"
56LIBSYSTEMD_MIN_VERSION="209"
57LIBSYSTEMD_WITH_JOURNAL_NAMESPACES_MIN_VERSION="245"
58JAVA_MIN_VERSION="1.7"
59GRADLE_MIN_VERSION="3.4"
60HIREDIS_MIN_VERSION="0.11.0"
61CRITERION_MIN_VERSION="2.2.1"
62
63dnl ***************************************************************************
64dnl Initial setup
65
66ostype=`uname -s`
67
68if test -r $srcdir/dist.conf; then
69        # read defaults, dist.conf does not change
70        # values for parameters that are already set
71        . $srcdir/dist.conf
72fi
73
74if test -z "$RELEASE_TAG"; then
75        RELEASE_TAG=unstable
76fi
77
78
79if test "`uname -s`" = "Linux";then
80        CURRDATE=`date -R`
81else
82        CURRDATE=`date +"%a, %d %b %Y %H:%M:%S %Z"`
83fi
84
85AM_INIT_AUTOMAKE([foreign no-define subdir-objects])
86_AM_PROG_TAR([ustar])
87if test -n "$SNAPSHOT_VERSION"; then
88	PACKAGE_VERSION=$PACKAGE_VERSION+$SNAPSHOT_VERSION
89fi
90
91dnl ***************************************************************************
92dnl script snippet to generate user friendly version strings according to the
93dnl new versioning policy. All needed code are here to allow easy moving
94dnl between projects.
95if test -z "$RELEASE_TYPE"; then
96    RELEASE_TYPE=stable
97fi
98
99if test -z "$BROCHURE_VERSION"; then
100    _MAJOR=`echo $VERSION | cut -f1 -d'.'`
101    _MINOR=`echo $VERSION | cut -f2 -d'.'`
102    case "$RELEASE_TYPE" in
103        stable) BROCHURE_VERSION="$_MAJOR";;
104        feature) BROCHURE_VERSION="$_MAJOR F$_MINOR";;
105        *) BROCHURE_VERSION="$VERSION dogfood edition. Please contact your syslog-ng release manager to fix the configure scritpt";;
106    esac
107fi
108
109if test -z "$COMBINED_VERSION"; then
110    COMBINED_VERSION="$BROCHURE_VERSION ($VERSION)"
111fi
112
113TECHNICAL_VERSION=$VERSION
114
115AC_DEFINE_UNQUOTED(RELEASE_TYPE, "$RELEASE_TYPE", [type of syslog-ng release. stable or feature])
116AC_DEFINE_UNQUOTED(BROCHURE_VERSION, "$BROCHURE_VERSION", [pretty version for users depends on the release type])
117AC_DEFINE_UNQUOTED(COMBINED_VERSION, "$COMBINED_VERSION", [normal and brochure version combined])
118AC_DEFINE_UNQUOTED(SOURCE_REVISION, "$SOURCE_REVISION", [source revision])
119AC_SUBST(RELEASE_TYPE)
120AC_SUBST(BROCHURE_VERSION)
121AC_SUBST(COMBINED_VERSION)
122AC_SUBST(TECHNICAL_VERSION)
123dnl ***************************************************************************
124
125
126if test "x$prefix" = "xNONE"; then
127        prefix=$ac_default_prefix
128fi
129if test "x$exec_prefix" = "xNONE"; then
130        exec_prefix='${prefix}'
131fi
132pidfiledir='${localstatedir}'
133moduledir='${exec_prefix}/lib/syslog-ng'
134loggenplugindir='${moduledir}/loggen'
135toolsdir='${datadir}/syslog-ng/tools'
136xsddir='${datadir}/syslog-ng/xsd'
137
138config_includedir='${datadir}/syslog-ng/include'
139scldir="${config_includedir}/scl"
140abs_topsrcdir=`(cd $srcdir && pwd)`
141
142AC_CONFIG_HEADERS(config.h)
143
144dnl ***************************************************************************
145dnl Arguments
146
147AC_ARG_WITH(libnet,
148   [  --with-libnet=path      use path to libnet-config script],
149   ,
150   [with_libnet=""])
151
152AC_ARG_WITH(net-snmp,
153   [  --with-net-snmp=path      use path to net-snmp-config script],
154   ,
155   [with_net_snmp=""])
156
157AC_ARG_WITH(pidfile-dir,
158   [  --with-pidfile-dir=path   Use path as the directory for storing pidfiles],
159   pidfiledir=$with_pidfile_dir)
160
161AC_ARG_WITH(module-dir,
162   [  --with-module-dir=path   Use path as the directory to install modules into],
163   moduledir=$with_module_dir)
164
165AC_ARG_WITH(loggen-plugin-dir,
166   [  --with-loggen-plugin-dir=path   Use path as the directory to install loggen plugins into],
167   loggenplugindir=$with_loggen_plugin_dir)
168
169AC_ARG_WITH(module-path,
170   [  --with-module-path=path   Use path as the list of ':' separated directories looked up when searching for modules],
171   module_path=$with_module_path)
172
173AC_ARG_WITH(timezone-dir,
174   [  --with-timezone-dir=path   Use path as the directory to get the timezone files],
175   timezonedir=$with_timezone_dir)
176
177AC_ARG_WITH(ld-library-path,
178   [  --with-ld-library-path=path  Set LD_LIBRARY_PATH during runtime to the value given],
179   env_ld_library_path=$with_ld_library_path)
180
181AC_ARG_WITH([systemdsystemunitdir],
182   AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]))
183
184AC_ARG_WITH(package_name,
185   [  --with-package-name=package name Package name is printed out when syslog-ng started with --version],
186   PACKAGE_NAME=$with_package_name)
187
188AC_ARG_ENABLE(forced_server_mode,
189              [  --enable-forced-server-mode   Enable forced server mode.],, enable_forced_server_mode="yes")
190
191AC_ARG_ENABLE(debug,
192              [  --enable-debug      Enable debugging code.],, enable_debug="no")
193
194AC_ARG_ENABLE(force_gnu99,
195              [  --enable-force-gnu99      Enforce C99 with gnu extensions.],, force_gnu99="no")
196
197AC_ARG_ENABLE(extra-warnings,
198              [  --enable-extra-warnings      Enable extra compiler warnings (recommended).],, enable_extra_warnings="no")
199
200AC_ARG_ENABLE(env-wrapper,
201              [  --enable-env-wrapper    Enable wrapper program to set up various environment variables],, enable_env_wrapper=auto)
202
203AC_ARG_ENABLE(gprof,
204              [  --enable-gprof      Enable gcc profiling.],, enable_gprof="no")
205
206AC_ARG_ENABLE(memtrace,
207              [  --enable-memtrace   Enable alternative leak debugging code.])
208
209AC_ARG_WITH(sanitizer,
210              [  --with-sanitizer=[address/undefined/etc...]
211                                         Enables compiler sanitizer supports (default: no)]
212              ,,with_sanitizer="no")
213
214AC_ARG_ENABLE(dynamic-linking,
215              [  --enable-dynamic-linking        Link everything dynamically.],,enable_dynamic_linking="auto")
216
217AC_ARG_ENABLE(mixed-linking,
218              [  --enable-mixed-linking          Link 3rd party libraries statically, system libraries dynamically],,enable_mixed_linking="auto")
219
220AC_ARG_ENABLE(ipv6,
221              [  --enable-ipv6           Enable support for IPv6.],,enable_ipv6="auto")
222
223AC_ARG_ENABLE(tcp-wrapper,
224              [  --enable-tcp-wrapper    Enable support for TCP wrappers.],,enable_tcp_wrapper="auto")
225
226AC_ARG_ENABLE(spoof-source,
227              [  --enable-spoof-source   Enable support for spoofed source addresses.]
228              ,,enable_spoof_source="auto")
229
230AC_ARG_ENABLE(sun-streams,
231              [  --enable-sun-streams    Enable support for Solaris /dev/log STREAMS device.]
232              ,,enable_sun_streams="auto")
233
234AC_ARG_ENABLE(openbsd-system-source,
235              [  --enable-openbsd-system-source    Enable support for OpenBSD /dev/klog device.]
236              ,,enable_openbsd_system_source="auto")
237
238AC_ARG_ENABLE(sql,
239	      [  --enable-sql            Enable support for SQL destinations. (default: auto)]
240	      ,,enable_sql="auto")
241
242AC_ARG_ENABLE(pacct,
243              [  --enable-pacct          Enable support for reading Process Accounting files (EXPERIMENTAL, Linux only).]
244              ,,enable_pacct="no")
245
246AC_ARG_ENABLE(linux-caps,
247              [  --enable-linux-caps     Enable support for managing Linux capabilities (default: auto)]
248              ,,enable_linux_caps="auto")
249
250AC_ARG_ENABLE(gcov,
251              [  --enable-gcov           Enable coverage profiling (default: no)]
252              ,,enable_gcov="no")
253
254AC_ARG_ENABLE(mongodb,
255	      [  --enable-mongodb        Enable mongodb destination (default: auto)]
256              ,,enable_mongodb="auto")
257
258AC_ARG_WITH(jsonc,
259              [  --with-jsonc=[system/internal/auto/no]
260                                         Link against the system supplied or the built-in jsonc library or explicitly disable it. (default:auto)]
261              ,,with_jsonc="internal")
262
263AC_ARG_ENABLE(json,
264             [ --enable-json=[yes/no]            Enable JSON support (default: yes)]
265              ,[if test "x$enableval" != "xno"; then with_jsonc="system"; else with_jsonc="no"; fi],)
266
267AC_ARG_ENABLE(amqp,
268          [  --enable-amqp        Enable amqp destination (default: auto)]
269              ,,enable_amqp="auto")
270
271AC_ARG_ENABLE(stomp,
272          [  --enable-stomp        Enable stomp destination (default: yes)]
273              ,,enable_stomp="yes")
274
275AC_ARG_WITH(ivykis,
276              [  --with-ivykis=[system/internal]
277                                         Link against the system supplied or the built-in ivykis library.]
278              ,,with_ivykis="internal")
279
280AC_ARG_ENABLE(smtp,
281              [  --disable-smtp          Disable SMTP support (default: auto)]
282              ,,enable_smtp="auto")
283
284AC_ARG_WITH(libesmtp,
285             AC_HELP_STRING([--with-libesmtp=DIR],
286                            [use libesmtp library from (prefix) directory DIR]),,)
287
288AC_ARG_ENABLE(mqtt,
289              [  --disable-mqtt          Disable MQTT support (default: auto)]
290              ,,enable_mqtt="auto")
291
292AC_ARG_WITH(libpaho-mqtt,
293             AC_HELP_STRING([--with-libpaho-mqtt=DIR],
294                            [use libpaho-mqtt library from (prefix) directory DIR]),,)
295
296
297AC_ARG_ENABLE(http,
298              [  --disable-http          Disable http support (default: auto)]
299              ,,enable_http="auto")
300
301AC_ARG_WITH(libcurl,
302             AC_HELP_STRING([--with-libcurl=DIR],
303                            [use libcurl library from (prefix) directory DIR]),,)
304
305AC_ARG_ENABLE(redis,
306              [  --disable-redis          Disable REDIS support (default: auto)]
307              ,,enable_redis="auto")
308
309AC_ARG_WITH(libhiredis,
310             AC_HELP_STRING([--with-libhiredis=DIR],
311                            [use libhiredis library from (prefix) directory DIR]),,)
312
313AC_ARG_ENABLE(systemd,
314              [  --enable-systemd        Enable systemd support (default: auto)]
315              ,,enable_systemd="auto")
316
317AC_ARG_ENABLE(geoip2,
318              [  --enable-geoip2          Enable GeoIP2 support (default: auto)]
319              ,,enable_geoip2="auto")
320
321AC_ARG_ENABLE(riemann,
322              [  --disable-riemann       Disable riemann destination]
323              ,,enable_riemann="auto")
324
325AC_ARG_WITH(compile-date,
326	      [  --without-compile-date  Do not include the compile date in the binary]
327	      ,wcmp_date="${withval}", wcmp_date="yes")
328
329AC_ARG_WITH(systemd-journal,
330              [  --with-systemd-journal=[system/optional/auto]
331                                         Link against the system supplied or the wrapper library. (default: auto)]
332              ,,with_systemd_journal="auto")
333
334AC_ARG_ENABLE(python,
335              [  --disable-python       Disable Python module]
336              ,,enable_python="auto")
337
338AC_ARG_ENABLE(kafka,
339              [  --enable-kafka         Enable rdkafka support]
340              ,,enable_kafka="auto")
341
342AC_ARG_WITH(python,
343              [  --with-python=VERSION    Build with a specific version of python]
344              ,,with_python="auto")
345
346AC_ARG_WITH(python3-home,
347              [  --with-python3-home=path Use path as a hard-coded Python home directory that can not be overwritten by the PYTHONHOME environment variable],
348              python3_home_dir=$with_python3_home)
349
350AC_ARG_WITH(python2-home,
351              [  --with-python2-home=path Use path as a hard-coded Python home directory that can not be overwritten by the PYTHONHOME environment variable],
352              python2_home_dir=$with_python2_home)
353
354AC_ARG_WITH(pylint,
355              [  --with-pylint=ABSOLUTE_PATH    Specify pylint location])
356
357AC_ARG_WITH(docbook,
358            [  --with-docbook=FILE    Compiling manpages using docbook in the specified path, if not set, it will be searched on the system, or online version will be used from http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl]
359            ,,with_docbook="auto")
360
361AC_ARG_ENABLE(manpages, AC_HELP_STRING([ --enable-manpages], [ Enable generation of manpages (default: no)]), , [enable_manpages="no"; XSL_STYLESHEET=""])
362AC_ARG_ENABLE(manpages-install, AC_HELP_STRING([ --enable-manpages-install], [ Enable installation of manpages (default: auto)]), , [enable_manpages_install="auto"])
363
364AC_ARG_ENABLE(java, [ --enable-java  Enable java destination (default: auto)],, enable_java="auto")
365
366AC_ARG_ENABLE(java-modules, [ --enable-java-modules  Compile all Java modules (default: auto)],, enable_java_modules="auto")
367
368AC_ARG_ENABLE(native,
369              [  --enable-native        Enable native bindings (default: auto)]
370              ,,enable_native="auto")
371
372AC_ARG_ENABLE(afsnmp, [ --enable-afsnmp Enable afsnmp module (default: auto)],, enable_afsnmp="auto")
373
374AC_ARG_ENABLE(all-modules,
375              [  --enable-all-modules    Forcibly enable all modules. (default: auto)]
376              ,,enable_all_modules="auto")
377
378if test "x$enable_all_modules" != "xauto"; then
379   state="$enable_all_modules"
380
381   MODULES="spoof_source sun_streams sql pacct mongodb json amqp stomp \
382            redis systemd geoip2 riemann ipv6 smtp native python java java_modules \
383            http afsnmp kafka mqtt"
384   for mod in ${MODULES}; do
385       modstate=$(eval echo \$enable_${mod})
386       if test "x$modstate" = "xauto"; then
387          eval enable_${mod}=${state}
388       fi
389   done
390fi
391
392if test "x$wcmp_date" != "xno"; then
393  wcmp_date="1"
394else
395  wcmp_date="0"
396fi
397
398patheval()
399{
400        OLD=$1
401        NEW=`eval echo $1`
402        while test "x$OLD" != "x$NEW"
403        do
404                OLD=$NEW
405                NEW=`eval echo $OLD`
406        done
407        echo $OLD
408}
409
410dnl ***************************************************************************
411dnl Checks for programs.
412AC_PROG_CC
413AC_PROG_CC_C99
414AM_PROG_CC_C_O
415if test "x$ac_cv_prog_cc_c99" = "xno"; then
416	AC_MSG_ERROR("C99 standard compliant C compiler required. Try GCC 3.x or later.")
417fi
418AC_PROG_YACC
419AM_PROG_LEX
420AC_PROG_MAKE_SET
421PKG_PROG_PKG_CONFIG
422LT_INIT([dlopen disable-static])
423if test "x$with_python" = "xauto"; then
424  AM_PATH_PYTHON(,,[:])
425else
426  AM_PATH_PYTHON([$with_python],,[:])
427fi
428
429if test "${PYTHON}" = ":"; then
430       AC_MSG_WARN([Python interpreter is missing.])
431fi
432
433AM_CONDITIONAL([HAVE_PYTHON_INTERPRETER], [test "$PYTHON" != :])
434
435dnl ***************************************************************************
436dnl Validate yacc
437
438yacc_ok=0
439if echo "$YACC" | grep -q bison; then
440	# NOTE: m4 removes [], that's why it needs to be escaped
441	bison_version=`$YACC --version | head -n 1 | sed 's/@<:@^0-9.@:>@*//'`
442	bison_version_major=`echo $bison_version | cut -d. -f1`
443	bison_version_minor=`echo $bison_version | cut -d. -f2`
444	bison_version_patch=`echo $bison_version | cut -d. -f3`
445	if ([[ "$bison_version_major" -gt 3 ]]) ||
446	   ([[ "$bison_version_major" -eq 3 ]] && [[ "$bison_version_minor" -gt 7 ]]) ||
447	   ([[ "$bison_version_major" -eq 3 ]] && [[ "$bison_version_minor" -eq 7 ]] && [[ "$bison_version_patch" -ge 6 ]]); then
448		yacc_ok=1
449	else
450		AC_MSG_WARN([bison is found, but your bison version $bison_version is not recent enough, at least 3.7.6 is required])
451	fi
452fi
453
454if test $yacc_ok = 0; then
455	if test -f $srcdir/lib/cfg-grammar.c || test -f lib/cfg-grammar.c; then
456		AC_MSG_WARN([No proper bison found, you'll not be able to change lib/cfg-grammar.y])
457		YACC="echo Required bison not found && false"
458	else
459		AC_MSG_ERROR([syslog-ng requires bison 3.7.6 or later. Your source tree seems to be from git, which doesn't have the bison generated files (like cfg-grammar.c). Please install/upgrade bison or use a distribution tarball.])
460	fi
461fi
462
463dnl ***************************************************************************
464dnl Validate flex
465
466if $LEX --version | grep "flex" >/dev/null; then
467	lex_ok=1
468else
469	lex_ok=0
470fi
471
472if test $lex_ok = 0 ; then
473	if test -f $srcdir/lib/cfg-lex.c || test -f lib/cfg-lex.c; then
474		AC_MSG_WARN([No flex found, you'll not be able to change lib/cfg-lex.l])
475		LEX="echo Required flex version not found && false"
476	else
477		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.])
478	fi
479fi
480
481dnl ***************************************************************************
482dnl Set up NO_PIE_LDFLAG: -no-pie is compatible with $CC.
483
484AX_COMPILER_VENDOR
485AX_COMPILER_VERSION
486
487if test $ostype = "Darwin"; then
488  no_pie_ldflags="-Wl,-no_pie"
489else
490  if test x$ax_cv_c_compiler_vendor = "xgnu"; then
491    AX_COMPARE_VERSION($ax_cv_c_compiler_version, gt, [4.5], [no_pie_ldflags="-no-pie"], [no_pie_ldflags=""])
492  else
493    no_pie_ldflags="-no-pie"
494  fi;
495fi
496
497old_LDFLAGS="$LDFLAGS"
498LDFLAGS="$LDFLAGS $no_pie_ldflags"
499
500AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])],
501	[no_pie_option_available=yes],
502	[no_pie_option_available=no])
503
504LDFLAGS="$old_LDFLAGS"
505
506if test "$no_pie_option_available" = "yes"; then
507  NO_PIE_LDFLAG="$no_pie_ldflags"
508fi
509AC_SUBST([NO_PIE_LDFLAG])
510
511dnl ***************************************************************************
512dnl Set up CFLAGS
513
514
515dnl The rest of CFLAGS. We produce
516dnl -g/-O2/-pg/-fprofile-arcs/-ftest-coverage combinations, the rest is
517dnl supplied by Makefile.am
518
519if test "x$ac_compiler_gnu" = "xyes"; then
520	# by ignoring the existing $CFLAGS setting we can override the
521	# default supplied by autoconf (which defaults to -O2), which
522	# we don't want to use with our debugging builds.
523
524	CFLAGS_ADD=""
525        if test "x$enable_debug" = "xyes"; then
526                CFLAGS_ADD="${CFLAGS_ADD} -g"
527        else
528                CFLAGS_ADD="${CFLAGS_ADD} -O2 -g"
529        fi
530        if test "x$enable_gprof" = "xyes"; then
531                CFLAGS_ADD="${CFLAGS_ADD} -pg"
532        fi
533        if test "x$enable_gcov" = "xyes"; then
534                CFLAGS_ADD="${CFLAGS_ADD} -fprofile-arcs -ftest-coverage"
535        fi
536else
537        enable_extra_warnings="no"
538fi
539CFLAGS_ADD="${CFLAGS_ADD} -pthread"
540
541dnl The current supported standard is C99 with gnu extensions
542
543if test "x$force_gnu99" = "xyes"; then
544	CFLAGS_ADD="${CFLAGS_ADD} -std=gnu99"
545fi
546
547dnl We are checking for the postive warning flag, as gcc handles the
548dnl -Wno-XXX version oddly, so if no other warnings are present, it is not
549dnl reported at all, causing it to be unusable for detection purposes.
550
551AX_CFLAGS_GCC_OPTION(-Winitializer-overrides,
552		     CFLAGS_INITIALIZER_OVERRIDES,
553		     CFLAGS_ADD="${CFLAGS_ADD} -Wno-initializer-overrides")
554
555dnl User supplied CFLAGS come last
556CFLAGS="${CFLAGS_ADD} ${ac_cv_env_CFLAGS_value}"
557
558AC_SYS_LARGEFILE
559
560# FIXME: skip tests on unsupported platforms/architectures...
561case "$ostype" in
562	HP-UX)
563		if $CC -v 2>&1 | grep gcc > /dev/null; then
564			CFLAGS="${CFLAGS} -U_XOPEN_SOURCE -U_XOPEN_SOURCE_EXTENDED -D_HPUX_SOURCE"
565			LDFLAGS="${LDFLAGS} -lcl"
566			AC_DEFINE(HAVE_BROKEN_PREAD, 1, [define if your platform has a broken pread/pwrite (e.g. HP-UX)])
567			AC_MSG_WARN([NOTE: on HP-UX with gcc, you might need to edit sys/socket.h manually or you'll get compilation errors])
568		fi
569		;;
570	AIX)
571		if test "$ac_cv_sys_large_files" -ne 0; then
572			CFLAGS="${CFLAGS} -D_LARGE_FILES=1"
573		fi
574
575                # NOTE: The -brtl option to the linker must be set before calling the
576                # configure script, as otherwise the generated libtool will behave
577                # differently. We need the runtime linker during execution (hence the
578                # -brtl) to load external modules. Also, please note that with -brtl the
579                # linker behaves similarly to what is expected on other UNIX systems,
580                # without it, it refuses to link an .so in if there's no reference from
581                # the main program, even if there is a proper -llibname option.
582		LDFLAGS="$LDFLAGS -Wl,-brtl"
583		MODULE_LDFLAGS="-avoid-version -module"
584		;;
585	Darwin)
586		MODULE_LDFLAGS="-avoid-version -dylib"
587		LDFLAGS="$LDFLAGS -Wl,-flat_namespace"
588		CFLAGS="$CFLAGS -D__APPLE_USE_RFC_3542"
589    ;;
590	OSF1)
591		CFLAGS="${CFLAGS} -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE -D_POSIX_C_SOURCE"
592		;;
593esac
594
595if test "$enable_dynamic_linking" = "auto" -a "$enable_mixed_linking" = "auto"; then
596	enable_dynamic_linking="yes"
597	enable_mixed_linking="no"
598fi
599
600linkopts=0
601if test "x$enable_dynamic_linking" = "xyes"; then
602       linkopts=`expr $linkopts + 1`
603fi
604if test "x$enable_mixed_linking" = "xyes"; then
605       linkopts=`expr $linkopts + 1`
606fi
607
608if test "$linkopts" -gt 1; then
609       AC_MSG_ERROR([You cannot specify multiple linking options at the same time (--enable-dynamic-linking, --enable-mixed-linking).])
610fi
611
612if test "x$enable_dynamic_linking" = "xyes"; then
613	enable_dynamic_linking="yes"
614	enable_mixed_linking="no"
615	linking_mode="dynamic"
616elif test "x$enable_mixed_linking" = "xyes"; then
617	enable_dynamic_linking="no"
618	enable_mixed_linking="yes"
619	linking_mode="mixed"
620fi
621
622dnl ***************************************************************************
623dnl Check for --whole-archive flag
624dnl ***************************************************************************
625
626if test $ostype = "Darwin"; then
627  WHOLE_ARCHIVE_OPT="-all_load"
628  NO_WHOLE_ARCHIVE_OPT="-noall_load"
629else
630  WHOLE_ARCHIVE_OPT="--whole-archive"
631  NO_WHOLE_ARCHIVE_OPT="--no-whole-archive"
632fi
633
634dnl ***************************************************************************
635dnl Is the __thread keyword available?
636dnl ***************************************************************************
637
638AC_LINK_IFELSE([AC_LANG_PROGRAM(
639[[#include <pthread.h>
640__thread int a;
641]],
642[a=0;])],
643[ac_cv_have_tls=yes; AC_DEFINE_UNQUOTED(HAVE_THREAD_KEYWORD, 1, "Whether Thread Local Storage is supported by the system")])
644
645dnl ***************************************************************************
646dnl How to do static linking?
647dnl ***************************************************************************
648
649AC_MSG_CHECKING(how to enable static linking for certain libraries)
650ldversion=`ld -V 2>&1 | head -n 1`
651if echo $ldversion | egrep "GNU|Solaris" > /dev/null; then
652        LD_START_STATIC="-Wl,-Bstatic"
653        LD_END_STATIC="-Wl,-Bdynamic"
654        AC_MSG_RESULT(GNU or Solaris)
655elif test $ostype = "HP-UX" > /dev/null; then
656        LD_START_STATIC="-Wl,-a,archive"
657        LD_END_STATIC="-Wl,-a,shared_archive"
658        AC_MSG_RESULT(HP-UX)
659elif test "$ostype" = "AIX"; then
660        LD_START_STATIC="-Wl,-bstatic"
661        LD_END_STATIC="-Wl,-bdynamic"
662        AC_MSG_RESULT(AIX)
663else
664        LD_START_STATIC=""
665        LD_END_STATIC=""
666        AC_MSG_RESULT([no clues, linking everything dynamically, please send appropriate ld arguments to syslog-ng@lists.balabit.hu])
667fi
668
669dnl ***************************************************************************
670dnl Miscellanneous headers
671dnl ***************************************************************************
672
673AC_HEADER_STDC
674AC_CHECK_HEADER(dmalloc.h)
675AC_CHECK_HEADER(dlfcn.h)
676AC_CHECK_HEADERS(strings.h	\
677	getopt.h		\
678	stropts.h		\
679	sys/strlog.h		\
680	door.h			\
681	sys/capability.h	\
682	sys/prctl.h		\
683	utmp.h			\
684	utmpx.h)
685AC_CHECK_HEADERS(tcpd.h)
686
687AC_CHECK_TYPES([struct ucred, struct cmsgcred], [], [], [#define _GNU_SOURCE 1
688#define _DEFAULT_SOURCE 1
689#include <sys/types.h>
690#include <sys/socket.h>])
691
692dnl ***************************************************************************
693dnl Header checks
694dnl ***************************************************************************
695
696dnl Checks for typedefs, structures, and compiler characteristics.
697AC_STRUCT_TM
698
699AC_CHECK_MEMBER(struct tm.tm_gmtoff,AC_DEFINE(HAVE_STRUCT_TM_TM_GMTOFF,1,[Whether you have tm_gmtoff field in struct tm]),,[
700#if TM_IN_SYS_TIME
701#include <sys/time.h>
702#else
703#include <time.h>
704#endif])
705
706AC_CHECK_MEMBER(struct msghdr.msg_control,AC_DEFINE(HAVE_CTRLBUF_IN_MSGHDR,1,[Whether you have msg_control field in msghdr in socket.h]),,[
707#include <sys/socket.h>
708])
709
710AC_CACHE_CHECK(for I_CONSLOG, blb_cv_c_i_conslog,
711  [AC_EGREP_CPP(I_CONSLOG,
712[
713#include <sys/strlog.h>
714I_CONSLOG
715],
716  blb_cv_c_i_conslog=no, blb_cv_c_i_conslog=yes)])
717
718old_CPPFLAGS=$CPPFLAGS
719CPPFLAGS="-D_GNU_SOURCE -D_DEFAULT_SOURCE"
720AC_CACHE_CHECK(for O_LARGEFILE, blb_cv_c_o_largefile,
721  [AC_EGREP_CPP(O_LARGEFILE,
722[
723#include <fcntl.h>
724O_LARGEFILE
725],
726  blb_cv_c_o_largefile=no, blb_cv_c_o_largefile=yes)])
727CPPFLAGS=$old_CPPFLAGS
728
729if test "x$blb_cv_c_o_largefile" = "xyes"; then
730        AC_DEFINE(HAVE_O_LARGEFILE, 1, [O_LARGEFILE is present])
731fi
732
733AC_CACHE_CHECK(for struct sockaddr_storage, blb_cv_c_struct_sockaddr_storage,
734  [AC_EGREP_HEADER([sockaddr_storage], sys/socket.h, blb_cv_c_struct_sockaddr_storage=yes,blb_cv_c_struct_sockaddr_storage=no)])
735
736if test "$blb_cv_c_struct_sockaddr_storage" = "yes"; then
737	AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE,[1],[struct sockaddr_storage is present on your system])
738fi
739
740AC_CACHE_CHECK(for struct sockaddr_in6, blb_cv_c_struct_sockaddr_in6,
741  [AC_EGREP_HEADER([sockaddr_in6], netinet/in.h, blb_cv_c_struct_sockaddr_in6=yes,blb_cv_c_struct_sockaddr_in6=no)])
742
743AC_CACHE_CHECK(for PR_SET_KEEPCAPS, blb_cv_keepcaps,
744  [AC_EGREP_CPP(PR_SET_KEEPCAPS,
745[
746#include <sys/prctl.h>
747
748PR_SET_KEEPCAPS
749],
750  blb_cv_keepcaps=no,
751  blb_cv_keepcaps=yes)])
752
753if test "x$blb_cv_keepcaps" = "xyes"; then
754	AC_DEFINE(HAVE_PR_SET_KEEPCAPS, 1, [have PR_SET_KEEPCAPS])
755fi
756
757if test "$ostype" != "Darwin" ; then
758	AC_DEFINE(HAVE_ENVIRON, [1], [Specifies whether the environ global variable exists])
759fi
760
761AC_CACHE_CHECK(for modern utmp,
762               blb_cv_c_modern_utmp,
763[AC_TRY_COMPILE([
764#ifdef HAVE_UTMPX_H
765#include <utmpx.h>
766#else
767#include <utmp.h>
768#endif
769],
770[
771#ifdef HAVE_UTMPX_H
772        struct utmpx ut;
773#else
774        struct utmp ut;
775#endif
776  return sizeof(ut.ut_type) & sizeof(ut.ut_user);
777],
778blb_cv_c_modern_utmp=yes,
779blb_cv_c_modern_utmp=no)])
780
781if test "x$blb_cv_c_modern_utmp" = "xyes"; then
782	AC_DEFINE(HAVE_MODERN_UTMP, 1, [have modern utmp/utmpx format])
783fi
784
785dnl ***************************************************************************
786dnl Checks for libraries
787AC_CHECK_LIB(door, door_create, BASE_LIBS="$BASE_LIBS -ldoor")
788AC_CHECK_LIB(socket, socket, BASE_LIBS="$BASE_LIBS -lsocket")
789AC_CHECK_LIB(rt, nanosleep, BASE_LIBS="$BASE_LIBS -lrt")
790AC_CHECK_FUNC(gethostbyname, [], AC_CHECK_LIB(nsl, gethostbyname, BASE_LIBS="$BASE_LIBS -lnsl"))
791AC_CHECK_LIB(regex, regexec, REGEX_LIBS="-lregex")
792AC_CHECK_LIB(resolv, res_init, RESOLV_LIBS="-lresolv")
793
794AC_CHECK_FUNCS(strdup		\
795	strtol			\
796	strtoll			\
797	strtoimax		\
798	inet_aton		\
799	inet_ntoa		\
800	getaddrinfo		\
801	getnameinfo		\
802	getutent		\
803	getutxent		\
804	pread			\
805	pwrite			\
806	strcasestr		\
807	memrchr			\
808	localtime_r		\
809	getprotobynumber_r	\
810	gmtime_r		\
811	strnlen			\
812	strtok_r)
813old_LIBS=$LIBS
814LIBS=$BASE_LIBS
815AC_CHECK_FUNCS(clock_gettime)
816LIBS=$old_LIBS
817
818dnl ***************************************************************************
819dnl check inotify
820dnl ***************************************************************************
821AC_CHECK_FUNCS([inotify_init])
822
823dnl ***************************************************************************
824dnl check getrandom
825dnl ***************************************************************************
826AC_CHECK_FUNCS([getrandom])
827
828dnl ***************************************************************************
829dnl libevtlog headers/libraries (remove after relicensing libevtlog)
830dnl ***************************************************************************
831
832EVTLOG_LIBS="\$(top_builddir)/lib/eventlog/src/libevtlog.la"
833EVTLOG_NO_LIBTOOL_LIBS="\$(top_builddir)/lib/eventlog/src/.libs/libevtlog.so"
834EVTLOG_CFLAGS="-I\$(top_srcdir)/lib/eventlog/src -I\$(top_builddir)/lib/eventlog/src"
835
836dnl ***************************************************************************
837dnl secret storage libraries
838dnl ***************************************************************************
839
840SECRETSTORAGE_LIBS="\$(top_builddir)/lib/secret-storage/libsecret-storage.la"
841SECRETSTORAGE_NO_LIBTOOL_LIBS="\$(top_builddir)/lib/secret-storage/.libs/libsecret-storage.so"
842
843dnl ***************************************************************************
844dnl libwrap headers/libraries
845dnl ***************************************************************************
846
847old_LIBS=$LIBS
848AC_CACHE_CHECK(for TCP wrapper library,
849                blb_cv_c_lwrap,
850
851for libwrap in "-lwrap" "/usr/local/lib/libwrap.a"; do
852        LIBS="$old_LIBS $libwrap"
853
854        [AC_TRY_LINK(,
855        [
856}
857
858int allow_severity;
859int deny_severity;
860extern int hosts_access(void);
861
862int foo(void)
863{
864        hosts_access();
865],
866        [blb_cv_c_lwrap=$libwrap
867        break],
868        blb_cv_c_lwrap="")
869done
870
871])
872LIBS=$old_LIBS
873LIBWRAP_LIBS=$blb_cv_c_lwrap
874
875if test "x$enable_tcp_wrapper" = "xauto"; then
876	AC_MSG_CHECKING(whether to enable TCP wrapper support)
877        if test "x$ac_cv_header_tcpd_h" = "xyes" -a "x$blb_cv_c_lwrap" != "x"; then
878                enable_tcp_wrapper=yes
879                AC_MSG_RESULT(yes)
880        else
881                LIBWRAP_LIBS=""
882                AC_MSG_RESULT(no)
883                enable_tcp_wrapper=no
884        fi
885elif test "x$enable_tcp_wrapper" != "xyes"; then
886        LIBWRAP_LIBS=""
887fi
888
889dnl ***************************************************************************
890dnl -ldl
891dnl ***************************************************************************
892
893AC_CHECK_LIB(dl, dlsym, DL_LIBS="-ldl")
894
895dnl ***************************************************************************
896dnl libdbi headers/libraries
897dnl ***************************************************************************
898if test "x$enable_sql" = "xyes" || test "x$enable_sql" = "xauto"; then
899	PKG_CHECK_MODULES(LIBDBI, dbi >= $LIBDBI_MIN_VERSION, with_libdbi="1", with_libdbi="0")
900	if test "$with_libdbi" -eq 0; then
901		dnl if libdbi has no .pc file (e.g., Ubuntu Precise), try it without one
902		AC_CHECK_LIB(dbi, dbi_initialize_r, LIBDBI_LIBS="-ldbi"; LIBDBI_CFLAGS="-I/usr/include/dbi"; with_libdbi="1")
903	fi
904
905	AC_MSG_CHECKING(whether to enable SQL support)
906	if test "$with_libdbi" -eq 1; then
907		enable_sql="yes"
908		AC_MSG_RESULT(yes)
909	elif test "x$enable_sql" = "xyes"; then
910		AC_MSG_RESULT(no)
911		enable_sql="no"
912                AC_MSG_ERROR([Could not find libdbi, and SQL support was explicitly enabled.])
913        else
914		AC_MSG_RESULT(no)
915	fi
916fi
917
918dnl ***************************************************************************
919dnl GLib headers/libraries
920dnl ***************************************************************************
921
922GLIB_ADDONS="gmodule-2.0 gthread-2.0"
923PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_MIN_VERSION $GLIB_ADDONS,,)
924
925if test "$linking_mode" != "dynamic"; then
926	# strip out -ldl & -lrt as it cannot be linked statically
927	GLIB_LIBS=`echo $GLIB_LIBS | tr ' ' '\n' | egrep -v "^(-ldld?)|(-lrt)$" | tr '\n' ' '`
928
929	old_LIBS=$LIBS
930	LIBS="$LD_START_STATIC $GLIB_LIBS $LD_END_STATIC $BASE_LIBS"
931	AC_CHECK_FUNC(g_hash_table_new, blb_cv_static_glib=yes, blb_cv_static_glib=no)
932	LIBS=$old_LIBS
933fi
934
935GLIB_CFLAGS="${GLIB_CFLAGS} -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"
936
937old_CPPFLAGS=$CPPFLAGS
938CPPFLAGS="$GLIB_CFLAGS"
939old_LDFLAGS=$LDFLAGS
940LDFLAGS="$LDFLAGS $GLIB_LIBS"
941
942old_LIBS=$LIBS
943LIBS="$LIBS $GLIB_LIBS"
944AC_CHECK_FUNCS(g_list_copy_deep \
945  g_ptr_array_find_with_equal_func \
946  g_canonicalize_filename)
947LIBS=$old_LIBS
948
949AC_CACHE_CHECK(sanity checking Glib headers,
950               blb_cv_glib_sane,
951[AC_TRY_RUN([
952#include <glib.h>
953
954int main()
955{
956  if (sizeof(long) != GLIB_SIZEOF_LONG)
957    return 1;
958  return 0;
959}
960],
961blb_cv_glib_sane=yes,
962blb_cv_glib_sane=no,
963blb_cv_glib_sane=yes)])
964CPPFLAGS=$old_CPPFLAGS
965LDFLAGS=$old_LDFLAGS
966
967if test "x$blb_cv_glib_sane" = "xno"; then
968	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])
969fi
970
971if test "x$linking_mode" != "xdynamic" -a "x$blb_cv_static_glib" = "xno"; then
972	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])
973fi
974
975dnl ***************************************************************************
976dnl geoip2 headers/libraries
977dnl ***************************************************************************
978if test "x$enable_geoip2" = "xyes" || test "x$enable_geoip2" = "xauto"; then
979        if test "x$MAXMINDDB_LIBS" != "x"; then
980                AC_MSG_CHECKING([for MAXMINDDB])
981                AC_MSG_RESULT([yes (MAXMINDDB_LIBS set, will use that.)])
982                with_maxminddb="yes"
983        else
984                AC_MSG_CHECKING([for MAXMINDDB])
985                AC_CHECK_LIB(maxminddb, MMDB_open, MAXMINDDB_LIBS="-lmaxminddb"; with_maxminddb="yes", with_maxminddb="no")
986                AC_SUBST(MAXMINDDB_LIBS)
987        fi
988
989        if test "x$with_maxminddb" = "xno" && test "x$enable_geoip2" = "xyes"; then
990                AC_MSG_ERROR([Could not find libmaxminddb, and geoip2 support was explicitly enabled.])
991        fi
992
993        if test "x$with_maxminddb" = "xyes"; then
994                AC_CONFIG_LINKS([modules/geoip2/tests/test.mmdb:modules/geoip2/tests/test.mmdb])
995        fi
996
997        enable_geoip2="$with_maxminddb"
998fi
999
1000dnl ***************************************************************************
1001dnl pcre headers/libraries
1002dnl ***************************************************************************
1003
1004if test "x$linking_mode" = "xmixed"; then
1005
1006	# check if we have a pcre bundled in glib. In case glib is
1007        # dynamic it doesn't matter as glib doesn't export those
1008        # symbols.  But in case glib is static, linking it through
1009        # glib and through libpcre would clash.
1010        old_LIBS="$LIBS"
1011        LIBS="$LD_START_STATIC $GLIB_LIBS $LD_END_STATIC $LIBS"
1012        AC_CHECK_FUNC(pcre_compile2, AC_MSG_ERROR([You cannot use a GLib embedded PCRE in mixed linking mode]))
1013        LIBS="$old_LIBS"
1014fi
1015
1016PKG_CHECK_MODULES(PCRE, libpcre >= $PCRE_MIN_VERSION,, PCRE_LIBS="")
1017if test -z "$PCRE_LIBS"; then
1018	AC_MSG_ERROR(Cannot find pcre version >= $PCRE_MIN_VERSION it is a hard dependency from syslog-ng 3.6 onwards)
1019fi
1020
1021dnl ***************************************************************************
1022dnl OpenSSL headers/libraries
1023dnl ***************************************************************************
1024
1025# openssl is needed for:
1026#  * TLS support
1027
1028dnl check OpenSSL static linking
1029PKG_CHECK_MODULES(OPENSSL,
1030                  openssl >= $OPENSSL_MIN_VERSION,,
1031                  AC_MSG_ERROR(Cannot find OpenSSL libraries with version >= $OPENSSL_MIN_VERSION it is a hard dependency from syslog-ng 3.7 onwards))
1032
1033if test -n "$OPENSSL_LIBS" -a "$linking_mode" != "dynamic"; then
1034        dnl required for openssl, but only when linking statically
1035        AC_CHECK_LIB(z, inflate, ZLIB_LIBS="-lz")
1036
1037	dnl Remove -ldl as it cannot be linked statically on some platforms, it'll be present in DL_LIBS
1038	OPENSSL_LIBS=`echo $OPENSSL_LIBS | tr ' ' '\n' | egrep -v "^-ldld?$" | tr '\n' ' '`
1039
1040	old_LIBS=$LIBS
1041	LIBS="$LD_START_STATIC $OPENSSL_LIBS $ZLIB_LIBS $LD_END_STATIC $DL_LIBS"
1042	AC_CHECK_FUNC(SSL_library_init, blb_cv_static_openssl=yes, blb_cv_static_openssl=no)
1043	LIBS=$old_LIBS
1044fi
1045
1046CPPFLAGS_SAVE="$CPPFLAGS"
1047CPPFLAGS="$CPPFLAGS $OPENSSL_CFLAGS"
1048
1049AC_CHECK_DECLS([SSL_CTX_get0_param],[], [], [[#include <openssl/ssl.h>]])
1050AC_CHECK_DECLS([X509_STORE_CTX_get0_cert],[], [], [[#include <openssl/ssl.h>]])
1051AC_CHECK_DECLS([X509_get_extension_flags], [], [], [[#include <openssl/x509v3.h>]])
1052AC_CHECK_DECLS([EVP_MD_CTX_reset], [], [], [[#include <openssl/evp.h>]])
1053AC_CHECK_DECLS([ASN1_STRING_get0_data], [], [], [[#include <openssl/asn1.h>]])
1054AC_CHECK_DECLS([DH_set0_pqg], [], [], [[#include <openssl/dh.h>]])
1055AC_CHECK_DECLS([BN_get_rfc3526_prime_2048], [], [], [[#include <openssl/bn.h>]])
1056AC_CHECK_DECLS([SSL_CTX_set_num_tickets],[], [], [[#include <openssl/ssl.h>]])
1057
1058CPPFLAGS="$CPPFLAGS_SAVE"
1059
1060dnl
1061dnl Right now, openssl is never linked statically as it is only used by the
1062dnl TLS build of the afsocket plugin which is loaded dynamically anyway.
1063dnl
1064dnl The static check remains though, because the core may need openssl in the
1065dnl future, in which case it becomes relevant again.
1066dnl
1067
1068dnl if test "x$linking_mode" != "xdynamic" -a "x$blb_cv_static_openssl" = "xno"; then
1069dnl	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])
1070dnl fi
1071
1072dnl ***************************************************************************
1073dnl libnet headers/libraries
1074dnl ***************************************************************************
1075AC_MSG_CHECKING(for LIBNET)
1076if test "x$with_libnet" = "x"; then
1077        LIBNET_CONFIG="`which libnet-config`"
1078else
1079        LIBNET_CONFIG="$with_libnet/libnet-config"
1080fi
1081
1082if test -n "$LIBNET_CONFIG" -a -x "$LIBNET_CONFIG"; then
1083        LIBNET_CFLAGS="`$LIBNET_CONFIG --defines`"
1084        LIBNET_LIBS="`$LIBNET_CONFIG --libs`"
1085        AC_MSG_RESULT(yes)
1086dnl libnet-config does not provide the _DEFAULT_SOURCE define, that can cause warning during build
1087dnl as upstream libnet-config does uses _DEFAULT_SOURCE this is just a fix till
1088        LIBNET_CFLAGS="$LIBNET_CFLAGS -D_DEFAULT_SOURCE"
1089
1090else
1091        LIBNET_LIBS=
1092        AC_MSG_RESULT(no)
1093fi
1094
1095
1096if test "x$enable_spoof_source" = "xauto"; then
1097	AC_MSG_CHECKING(whether to enable spoof source support)
1098        if test "x$LIBNET_LIBS" != "x"; then
1099                enable_spoof_source=yes
1100                AC_MSG_RESULT(yes)
1101	else
1102		enable_spoof_source=no
1103                LIBNET_LIBS=
1104		LIBNET_CFLAGS=
1105		AC_MSG_RESULT(no)
1106        fi
1107elif test "x$enable_spoof_source" = "xyes"; then
1108  if test "x$LIBNET_LIBS" = "x"; then
1109    AC_MSG_ERROR([Could not find libnet, and spoof source support was explicitly enabled.])
1110  fi
1111elif test "x$enable_spoof_source" = "xno"; then
1112	LIBNET_CFLAGS=""
1113	LIBNET_LIBS=""
1114	enable_spoof_source=no
1115else
1116  AC_MSG_ERROR([Invalid value ($enable_spoof_source) for enable-spoof-source])
1117fi
1118
1119dnl ***************************************************************************
1120dnl afsnmp module & net-snmp headers/libraries
1121dnl ***************************************************************************
1122AC_MSG_CHECKING(whether to enable snmp destination driver)
1123
1124if test "x$with_net_snmp" = "x"; then
1125   NETSNMP_CONFIG="`which net-snmp-config`"
1126else
1127   NETSNMP_CONFIG="$with_net_snmp/net-snmp-config"
1128fi
1129
1130if test "x$enable_afsnmp" = "xyes"; then
1131   if test -n "$NETSNMP_CONFIG" -a -x "$NETSNMP_CONFIG"; then
1132     enable_afsnmp="yes"
1133     AC_MSG_RESULT(yes)
1134   else
1135     enable_afsnmp_dest="no"
1136     AC_MSG_RESULT(no)
1137     AC_MSG_ERROR("AFSNMP module is explicit enabled but no net-snmp lib found")
1138   fi
1139elif test "x$enable_afsnmp" = "xauto"; then
1140  if test -n "$NETSNMP_CONFIG" -a -x "$NETSNMP_CONFIG"; then
1141     enable_afsnmp="yes"
1142     AC_MSG_RESULT(yes)
1143  else
1144     enable_afsnmp="no"
1145     AC_MSG_RESULT(no)
1146  fi
1147else
1148  enable_afsnmp="no"
1149  AC_MSG_RESULT(no)
1150fi
1151
1152if test "$enable_afsnmp" = "yes"; then
1153  NETSNMP_CFLAGS="`$NETSNMP_CONFIG --cflags`"
1154  NETSNMP_LIBS="`$NETSNMP_CONFIG --libs`"
1155else
1156  NETSNMP_CFLAGS=
1157  NETSNMP_LIBS=
1158fi
1159
1160dnl ***************************************************************************
1161dnl Criterion headers/libraries
1162dnl ***************************************************************************
1163
1164PKG_CHECK_MODULES(CRITERION, criterion >= $CRITERION_MIN_VERSION,
1165  [with_criterion="system"],
1166  [AC_MSG_WARN([pkg-config was not able to find Criterion >= $CRITERION_MIN_VERSION]); with_criterion="no"])
1167
1168if test "$with_criterion" != "no"; then
1169   enable_tests=yes
1170else
1171  enable_tests=no
1172fi
1173
1174dnl ***************************************************************************
1175dnl ivykis headers/libraries
1176dnl ***************************************************************************
1177
1178IVYKIS_INTERNAL_SOURCE_EXISTS="test -f $srcdir/lib/ivykis/src/iv_main_posix.c"
1179
1180if $IVYKIS_INTERNAL_SOURCE_EXISTS; then
1181	AC_CONFIG_SUBDIRS([lib/ivykis])
1182	IVYKIS_SUBDIRS=lib/ivykis
1183fi
1184
1185
1186INTERNAL_IVYKIS_CFLAGS=""
1187if test "x$with_ivykis" = "xinternal"; then
1188	if $IVYKIS_INTERNAL_SOURCE_EXISTS; then
1189		# these can only be used in lib as it assumes
1190		# the current directory just one below ivykis
1191
1192		IVYKIS_LIBS="-Wl,${WHOLE_ARCHIVE_OPT} -L\$(top_builddir)/lib/ivykis/src -livykis -Wl,${NO_WHOLE_ARCHIVE_OPT}"
1193		IVYKIS_CFLAGS="-isystem \$(top_srcdir)/lib/ivykis/src/include -isystem \$(top_builddir)/lib/ivykis/src/include"
1194                INTERNAL_IVYKIS_CFLAGS="-isystem \${includedir}/syslog-ng/ivykis"
1195
1196		IVYKIS_VERSION_UPDATED="yes"
1197
1198		# LIBS to use when libtool is not applicable (when linking the main syslog-ng executable in mixed linking mode)
1199		IVYKIS_NO_LIBTOOL_LIBS="-Wl,${WHOLE_ARCHIVE_OPT} -L\$(top_builddir)/lib/ivykis/src/.libs -livykis -Wl,${NO_WHOLE_ARCHIVE_OPT}"
1200	else
1201		AC_MSG_ERROR([Internal ivykis sources not found in lib/ivykis. This is a hard dependency, unable to build syslog-ng without them.])
1202	fi
1203else
1204	with_ivykis="system"
1205	PKG_CHECK_MODULES(IVYKIS, ivykis >= $IVYKIS_MIN_VERSION,,)
1206	PKG_CHECK_MODULES(IVYKIS_VERSION_CHECK, ivykis >= $IVYKIS_UPDATED_VERSION, [IVYKIS_VERSION_UPDATED="yes"], [IVYKIS_VERSION_UPDATED="no"])
1207
1208	# in case we're using a system installed ivykis, we can link against
1209	# it even without libtool and without extra linker arguments (as
1210	# we're linking dynamically)
1211
1212	IVYKIS_NO_LIBTOOL_LIBS="$IVYKIS_LIBS"
1213fi
1214
1215dnl ***************************************************************************
1216dnl json headers/libraries
1217dnl ***************************************************************************
1218
1219enable_json="no"
1220
1221JSON_INTERNAL_SOURCE_EXISTS="test -f $srcdir/lib/jsonc/json.h"
1222
1223if $JSON_INTERNAL_SOURCE_EXISTS; then
1224  AC_CONFIG_SUBDIRS([lib/jsonc])
1225  JSON_SUBDIRS="lib/jsonc"
1226fi
1227
1228if test "x$with_jsonc" = "xsystem" -o "x$with_jsonc" = "xauto"; then
1229   enable_json="yes"
1230   PKG_CHECK_EXISTS(json-c, json_module_name="json-c",
1231   PKG_CHECK_EXISTS(json, json_module_name="json"))
1232   PKG_CHECK_MODULES(JSON, $json_module_name >= $JSON_C_MIN_VERSION,[with_jsonc="system"], [JSON_LIBS=""; enable_json="no"])
1233   if test "x$with_jsonc" = "xsystem" -a "x$enable_json" = "xno"; then
1234     AC_MSG_ERROR([json-c library development files cannot be not found on system!])
1235   fi
1236fi
1237if test "x$with_jsonc" = "xinternal" -o "x$with_jsonc" = "xauto"; then
1238  AC_MSG_CHECKING(for JSON)
1239  if $JSON_INTERNAL_SOURCE_EXISTS; then
1240      JSON_LIBS="\$(top_builddir)/lib/jsonc/libjson-c.la"
1241      JSON_DEPENDENCY="$JSON_LIBS"
1242      JSON_CFLAGS="-I\$(top_srcdir)/lib/jsonc -I\$(top_builddir)/lib/jsonc"
1243      enable_json="yes"
1244      with_jsonc="internal"
1245  else
1246      AC_MSG_WARN([Internal jsonc sources not found in lib/jsonc])
1247      enable_json="no"
1248      with_jsonc="no"
1249  fi
1250  AC_MSG_RESULT($enable_json)
1251fi
1252
1253dnl ***************************************************************************
1254dnl mongo-c-driver headers/libraries
1255dnl ***************************************************************************
1256
1257PKG_CHECK_MODULES(LIBMONGO, libmongoc-1.0 >= $LMC_MIN_VERSION, with_mongoc="yes", with_mongoc="no")
1258
1259if test "x$with_mongoc" = "xno" && test "x$enable_mongodb" = "xyes"; then
1260   AC_MSG_ERROR([Could not find mongo-c-driver, and MongoDB support was explicitly enabled.])
1261fi
1262
1263if test "x$with_mongoc" = "xyes"; then
1264CPPFLAGS_SAVE="$CPPFLAGS"
1265CPPFLAGS="$CPPFLAGS $LIBMONGO_CFLAGS"
1266
1267AC_CHECK_DECLS([mongoc_uri_set_option_as_int32], [], [], [[#include <mongoc.h>]])
1268AC_CHECK_DECLS([MONGOC_URI_SERVERSELECTIONTIMEOUTMS], [], [], [[#include <mongoc.h>]])
1269
1270CPPFLAGS="$CPPFLAGS_SAVE"
1271fi
1272
1273dnl ***************************************************************************
1274dnl libesmtp headers/libraries
1275dnl ***************************************************************************
1276if test "x$enable_smtp" != "xno" && test "x$with_libesmtp" != "xno"; then
1277	libesmtp="yes"
1278	if test "x$with_libesmtp" != "xyes" && test "x$with_libesmtp" != "x"; then
1279		CPPFLAGS_SAVE="$CPPFLAGS"
1280		LDFLAGS_SAVE="$LDFLAGS"
1281		CPPFLAGS="$CPPFLAGS -I$with_libesmtp/include"
1282		LDFLAGS="$LDFLAGS -L$with_libesmtp/lib"
1283		AC_CHECK_HEADER(libesmtp.h, [LIBESMTP_CFLAGS="-I$with_libesmtp/include"
1284					     LIBESMTP_LIBS="-L$with_libesmtp/lib -lesmtp"], [libesmtp=no])
1285		CPPFLAGS="$CPPFLAGS_SAVE"
1286		LDFLAGS="$LDFLAGS_SAVE"
1287	else
1288		PKG_CHECK_MODULES(LIBESMTP, libesmtp-1.0, libesmtp="yes", libesmtp="no")
1289		if test "x$libesmtp" = "xno"; then
1290			AC_MSG_CHECKING(for libESMTP with libesmtp-config)
1291			if libesmtp-config --version >/dev/null 2>&1; then
1292				AC_MSG_RESULT(yes)
1293				LIBESMTP_CFLAGS="`libesmtp-config --cflags`"
1294				LIBESMTP_LIBS="`libesmtp-config --libs`"
1295				libesmtp="yes"
1296			else
1297				AC_MSG_RESULT(no)
1298				libesmtp=no
1299			fi
1300                fi
1301	fi
1302	if test "x$enable_smtp" = "xyes" && test "x$libesmtp" = "xno"; then
1303		AC_MSG_ERROR(libESMTP not found)
1304	fi
1305	enable_smtp=$libesmtp
1306fi
1307
1308
1309dnl ***************************************************************************
1310dnl libmqtt headers/libraries
1311dnl ***************************************************************************
1312
1313if test "x$enable_mqtt" = "xyes" || test "x$enable_mqtt" = "xauto"; then
1314	if test "x$with_libpaho_mqtt" != "x"; then
1315		CPPFLAGS_SAVE="$CPPFLAGS"
1316		LDFLAGS_SAVE="$LDFLAGS"
1317		CPPFLAGS="$CPPFLAGS -I$with_libpaho_mqtt/include"
1318		LDFLAGS="$LDFLAGS -L$with_libpaho_mqtt -lpaho-mqtt3cs"
1319		AC_CHECK_HEADER(MQTTClient.h, [LIBPAHO_MQTT_CFLAGS="-I$with_libpaho_mqtt/include"
1320						LIBPAHO_MQTT_LIBS="-L$with_libpaho_mqtt/lib -lpaho-mqtt3cs"
1321						libpaho_mqtt="yes"], [libpaho_mqtt=no])
1322
1323		CPPFLAGS="$CPPFLAGS_SAVE"
1324		LDFLAGS="$LDFLAGS_SAVE"
1325	else
1326		AC_CHECK_LIB(paho-mqtt3cs, MQTTClient_create, LIBPAHO_MQTT_LIBS="-lpaho-mqtt3cs"; libpaho_mqtt="yes", libpaho_mqtt="no")
1327	fi
1328	if test "x$enable_mqtt" = "xyes" && test "x$libpaho_mqtt" = "xno"; then
1329		AC_MSG_ERROR(libPAHO_MQTT not found)
1330	fi
1331
1332	if test "x$libpaho_mqtt" = "xyes"; then
1333		CPPFLAGS_SAVE="$CPPFLAGS"
1334		LDFLAGS_SAVE="$LDFLAGS"
1335		CPPFLAGS="$CPPFLAGS $LIBPAHO_MQTT_CFLAGS"
1336		LDFLAGS="$LDFLAGS $LIBPAHO_MQTT_LIBS"
1337
1338		AC_CHECK_MEMBER([MQTTClient_connectOptions.httpProxy],
1339				[have_paho_http_proxy=1],
1340				[have_paho_http_proxy=0],
1341				[[#include "MQTTClient.h"]])
1342
1343		CPPFLAGS="$CPPFLAGS_SAVE"
1344		LDFLAGS="$LDFLAGS_SAVE"
1345
1346		AC_DEFINE_UNQUOTED(HAVE_PAHO_HTTP_PROXY, $have_paho_http_proxy, [libpaho-mqtt supports MQTTClient_connectOptions::httpProxy])
1347	fi
1348
1349	enable_mqtt=$libpaho_mqtt
1350fi
1351
1352dnl ***************************************************************************
1353dnl libcurl headers/libraries
1354dnl ***************************************************************************
1355if test "x$enable_http" != "xno" && test "x$with_libcurl" != "xno"; then
1356	libcurl="yes"
1357	if test "x$with_libcurl" != "xyes" && test "x$with_libcurl" != "x"; then
1358		CPPFLAGS_SAVE="$CPPFLAGS"
1359		LDFLAGS_SAVE="$LDFLAGS"
1360		CPPFLAGS="$CPPFLAGS -I$with_libcurl/include"
1361		LDFLAGS="$LDFLAGS -L$with_libcurl/lib"
1362		AC_CHECK_HEADER(curl/curl.h, [LIBCURL_CFLAGS="-I$with_libcurl/include"
1363					     LIBCURL_LIBS="-L$with_libcurl/lib -lcurl"], [libcurl=no])
1364		CPPFLAGS="$CPPFLAGS_SAVE"
1365		LDFLAGS="$LDFLAGS_SAVE"
1366	else
1367		AC_MSG_CHECKING(for libcurl)
1368		if curl-config --version >/dev/null 2>&1; then
1369			AC_MSG_RESULT(yes)
1370			LIBCURL_CFLAGS="`curl-config --cflags`"
1371			LIBCURL_LIBS="`curl-config --libs`"
1372		else
1373			AC_MSG_RESULT(no)
1374			libcurl=no
1375		fi
1376	fi
1377	if test "x$enable_http" = "xyes" && test "x$libcurl" = "xno"; then
1378		AC_MSG_ERROR(libcurl not found)
1379	fi
1380	enable_http=$libcurl
1381
1382        if test "$enable_http" = "yes"; then
1383           old_CFLAGS=$CFLAGS
1384           CFLAGS=$LIBCURL_CFLAGS
1385           AC_CHECK_DECLS([CURL_SSLVERSION_TLSv1_0, CURL_SSLVERSION_TLSv1_1, CURL_SSLVERSION_TLSv1_2, CURL_SSLVERSION_TLSv1_3],
1386                          [], [],
1387                          [[#include <curl/curl.h>]])
1388           CFLAGS=$old_CFLAGS
1389        fi
1390fi
1391
1392dnl ***************************************************************************
1393dnl libhiredis headers/libraries
1394dnl ***************************************************************************
1395if test "x$enable_redis" != "xno" && test "x$with_redis" != "xno"; then
1396       hiredis="yes"
1397       if test "x$with_libhiredis" != "xyes" && test "x$with_libhiredis" != "x"; then
1398               CFLAGS_SAVE="$CFLAGS"
1399               LDFLAGS_SAVE="$LDFLAGS"
1400               CFLAGS="$CFLAGS -I$with_libhiredis/include"
1401               LDFLAGS="$LDFLAGS -L$with_libhiredis/lib"
1402               AC_CHECK_HEADER(hiredis/hiredis.h, [HIREDIS_CFLAGS="-I$with_libhiredis/include"
1403                                                   HIREDIS_LIBS="-L$with_libhiredis/lib -lhiredis"], [hiredis=no])
1404               CFLAGS="$CFLAGS_SAVE"
1405               LDFLAGS="$LDFLAGS_SAVE"
1406       else
1407               hiredis="yes"
1408               PKG_CHECK_MODULES(HIREDIS, hiredis >= $HIREDIS_MIN_VERSION, ,
1409                                 [AC_MSG_WARN([pkg-config was not able to find hiredis >= $HIREDIS_MIN_VERSION])
1410				  PKG_CHECK_MODULES(HIREDIS, libhiredis >= $HIREDIS_MIN_VERSION,,
1411				  [AC_MSG_WARN([pkg-config was not able to find libhiredis >= $HIREDIS_MIN_VERSION])
1412				   hiredis=no])])
1413       fi
1414
1415       if test "x$enable_redis" = "xyes" && test "x$hiredis" = "xno"; then
1416               AC_MSG_ERROR(libHIREDIS not found)
1417       fi
1418
1419       enable_redis=$hiredis
1420fi
1421
1422dnl ***************************************************************************
1423dnl rabbitmq-c headers/libraries
1424dnl ***************************************************************************
1425
1426PKG_CHECK_MODULES(LIBRABBITMQ, librabbitmq >= $LIBRABBITMQ_MIN_VERSION, with_librabbitmq_client="yes", with_librabbitmq_client="no")
1427
1428if test "$enable_amqp" = "yes" && test "$with_librabbitmq_client" = "no"; then
1429       AC_MSG_ERROR([Could not find librabbitmq-c, and AMQP support was explicitly enabled.])
1430fi
1431
1432old_LIBS=$LIBS
1433LIBS=$LIBRABBITMQ_LIBS
1434AC_CHECK_FUNCS(amqp_ssl_socket_set_verify_peer)
1435LIBS=$old_LIBS
1436
1437dnl ***************************************************************************
1438dnl rdkafka headers/libraries
1439dnl ***************************************************************************
1440
1441PKG_CHECK_MODULES(LIBRDKAFKA, rdkafka >= $LIBRDKAFKA_MIN_VERSION, with_librdkafka="yes", with_librdkafka="no")
1442
1443if test "$enable_kafka" = "yes" && test "$with_librdkafka" = "no"; then
1444       AC_MSG_ERROR([Could not find librdkafka, and Kafka support was explicitly enabled.])
1445fi
1446
1447dnl
1448dnl Check if librdkafka has transactional api
1449dnl
1450
1451old_LIBS=$LIBS
1452old_CFLAGS=$CFLAGS
1453LIBS=$LIBRDKAFKA_LIBS
1454CFLAGS=$LIBRDKAFKA_CFLAGS
1455AC_CHECK_FUNCS(rd_kafka_init_transactions)
1456LIBS=$old_LIBS
1457CFLAGS=$old_CFLAGS
1458
1459
1460if test "x$enable_native" = "xyes" -o "x$enable_native" = "xauto"; then
1461    AC_CONFIG_FILES([syslog-ng-native-connector.pc])
1462fi
1463
1464dnl ***************************************************************************
1465dnl riemann-client headers/libraries
1466dnl ***************************************************************************
1467if test "$enable_riemann" != "no"; then
1468 PKG_CHECK_MODULES(RIEMANN_CLIENT, riemann-client >= $LRC_MIN_VERSION,,riemann_found="no")
1469 if test "$riemann_found" = "no" && test "$enable_riemann" = "yes"; then
1470   AC_MSG_ERROR([Dependency for Riemann not found!])
1471 fi
1472 if test "$riemann_found" = "no"; then
1473   enable_riemann="no";
1474 else
1475   enable_riemann="yes";
1476 fi
1477
1478 if test "$enable_riemann" = "yes"; then
1479
1480    old_CFLAGS=$CFLAGS
1481    CFLAGS=`pkg-config --cflags riemann-client`
1482    AC_CHECK_DECLS(RIEMANN_EVENT_FIELD_TIME_MICROS,
1483                  AC_DEFINE(HAVE_RIEMANN_MICROSECONDS, 1, [Riemann microseconds support]),,
1484                  [[#include <riemann/event.h>]])
1485    CFLAGS=$old_CFLAGS
1486 fi
1487fi
1488
1489dnl ***************************************************************************
1490dnl libsystemd headers/libraries
1491dnl ***************************************************************************
1492
1493PKG_CHECK_MODULES(libsystemd, libsystemd >= ${LIBSYSTEMD_MIN_VERSION},
1494                  have_libsystemd="yes", have_libsystemd="no")
1495
1496PKG_CHECK_MODULES(libsystemd_namespaces, libsystemd >= ${LIBSYSTEMD_WITH_JOURNAL_NAMESPACES_MIN_VERSION},
1497                  journal_namespaces="yes", journal_namespaces="no")
1498
1499dnl ***************************************************************************
1500dnl python checks
1501dnl ***************************************************************************
1502if test "x$enable_python" != "xno"; then
1503  if test "x$with_python" = "xauto"; then
1504    PKG_CHECK_MODULES(PYTHON, python3-embed, python_found="yes", [
1505      PKG_CHECK_MODULES(PYTHON, python3, python_found="yes", python_found="no")
1506    ])
1507    if test "$python_found" = "no"; then
1508      PKG_CHECK_MODULES(PYTHON, python2, python_found="yes", python_found="no")
1509      if test "$python_found" = "no"; then
1510        PKG_CHECK_MODULES(PYTHON, python, python_found="yes", python_found="no")
1511      fi
1512    fi
1513  else
1514    case "$with_python" in
1515      [[0-9]])
1516          with_python="python${with_python}"
1517          ;;
1518      [[0-9]].[[0-9]])
1519          with_python="python-${with_python}"
1520          ;;
1521      [[0-9]].[[0-9][0-9]])
1522          with_python="python-${with_python}"
1523          ;;
1524    esac
1525
1526    PKG_CHECK_MODULES(PYTHON, $with_python-embed, python_found="yes", [
1527      PKG_CHECK_MODULES(PYTHON, $with_python, python_found="yes", python_found="no")
1528    ])
1529  fi
1530
1531  if test "x$python_found" = "xyes"; then
1532    old_LIBS=$LIBS
1533    LIBS="$LIBS $PYTHON_LIBS"
1534    AC_CHECK_FUNCS(PyUnicode_AsUTF8, with_python=python3, with_python=python2)
1535    LIBS=$old_LIBS
1536  fi
1537
1538  if test "x$enable_python" = "xyes" -a "x$python_found" = "xno"; then
1539    AC_MSG_ERROR([Could not find the requested Python development libraries])
1540  fi
1541  enable_python="$python_found"
1542
1543  if (echo "$with_python" | grep -Eq "python-?3.*"); then
1544    python_version=3
1545  else
1546    python_version=2
1547  fi
1548else
1549  with_python=""
1550fi
1551
1552dnl ***************************************************************************
1553dnl pylint
1554dnl ***************************************************************************
1555
1556if test "x$with_pylint" != "x"; then
1557    PYLINT=$with_pylint
1558else
1559    if test "$python_found" = "yes"; then
1560      if test "$python_version" = "3"; then
1561          AC_CHECK_PROG(PYLINT, pylint3, pylint3)
1562          if test "x$PYLINT" = "x"; then
1563            AC_CHECK_PROG(PYLINT, pylint, pylint)
1564          fi
1565      else
1566          AC_CHECK_PROG(PYLINT, pylint, pylint)
1567      fi
1568    fi
1569fi
1570
1571dnl ***************************************************************************
1572dnl docbook
1573dnl ***************************************************************************
1574
1575if test "x$enable_manpages" != "xno"; then
1576    if test "x$with_docbook" = "xauto"; then
1577        XSL_STYLESHEET=`find /usr/share/{xml,sgml} -path '*/manpages/docbook.xsl' 2>/dev/null | head -n 1`
1578        if test -z "$XSL_STYLESHEET"; then
1579            XSL_STYLESHEET="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
1580        fi
1581    else
1582        XSL_STYLESHEET=$with_docbook
1583    fi
1584fi
1585
1586if test "x$enable_manpages_install" = "xauto"; then
1587    dnl do we have the generated manpages (part of the tarball but not in git)
1588    if test -f doc/man/syslog-ng.8 -o "x$enable_manpages" = "xyes"; then
1589        enable_manpages_install=yes
1590    else
1591        enable_manpages_install=no
1592    fi
1593fi
1594
1595dnl ***************************************************************************
1596dnl java headers/libraries
1597dnl ***************************************************************************
1598
1599if test "x$enable_java" = "xauto" || test "x$enable_java" = "xyes"; then
1600    if test "x$enable_java" = "xauto"; then
1601      AC_CHECK_JAVA_VERSION([$JAVA_MIN_VERSION], [enable_java=yes], [enable_java=no])
1602    else
1603      AC_CHECK_JAVA_VERSION([$JAVA_MIN_VERSION], [enable_java=yes], [AC_MSG_ERROR([Java not found])])
1604    fi
1605fi
1606
1607if test "x$enable_java" = "xyes"; then
1608    if test "x$enable_java_modules" = "xauto" || test "x$enable_java_modules" = "xyes"; then
1609        if test "x$enable_java_modules" = "xauto"; then
1610          AC_CHECK_GRADLE_VERSION([$GRADLE_MIN_VERSION], [enable_java_modules=yes], [enable_java_modules=no])
1611        else
1612          AC_CHECK_GRADLE_VERSION([$GRADLE_MIN_VERSION], [enable_java_modules=yes], [AC_MSG_ERROR([Gradle not found])])
1613        fi
1614    fi
1615else
1616    if test "x$enable_java_modules" = "xyes"; then
1617        AC_MSG_ERROR([Could not build Java modules without Java])
1618    elif test "x$enable_java_modules" = "xauto"; then
1619        AC_MSG_WARN([Could not build Java modules without Java])
1620	enable_java_modules=no
1621    fi
1622fi
1623
1624dnl ***************************************************************************
1625dnl misc features to be enabled
1626dnl ***************************************************************************
1627
1628if test "x$ac_cv_lib_door_door_create" = "xyes"; then
1629        AC_CHECK_HEADERS(pthread.h)
1630        AC_CHECK_LIB(pthread, pthread_create)
1631fi
1632
1633AC_MSG_CHECKING(whether to enable Sun STREAMS support)
1634if test "x$ac_cv_header_stropts_h" = "xyes" -a \
1635        "x$ac_cv_header_sys_strlog_h" = "xyes" -a \
1636        "x$enable_sun_streams" != "xno" -a \
1637        "x$blb_cv_c_i_conslog" != "xno"; then
1638        enable_sun_streams=yes
1639        AC_MSG_RESULT(yes)
1640else
1641        enable_sun_streams=no
1642        AC_MSG_RESULT(no)
1643fi
1644
1645AC_MSG_CHECKING(whether to enable OpenBSD system source support)
1646if test "x$enable_openbsd_system_source" = "xyes"; then
1647        enable_openbsd_system_source="yes"
1648        AC_MSG_RESULT(yes)
1649elif test "x$enable_openbsd_system_source" = "xauto" -a \
1650        "$ostype" = "OpenBSD" ; then
1651        enable_openbsd_system_source="yes"
1652        AC_MSG_RESULT(yes)
1653else
1654        enable_openbsd_system_source="no"
1655        AC_MSG_RESULT(no)
1656fi
1657
1658if test "x$enable_env_wrapper" = "xauto"; then
1659	if test "x$env_ld_library_path" != "x"; then
1660		enable_env_wrapper="yes"
1661	else
1662		enable_env_wrapper="no"
1663	fi
1664fi
1665
1666if test "x$enable_ipv6" = "xauto"; then
1667	AC_MSG_CHECKING(whether to enable IPv6 support)
1668        if test "x$blb_cv_c_struct_sockaddr_in6" = "xyes"; then
1669                enable_ipv6=yes
1670                AC_MSG_RESULT(yes)
1671        else
1672                enable_ipv6=no
1673                AC_MSG_RESULT(no)
1674        fi
1675fi
1676
1677AC_CHECK_DECLS([TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT], [], [],
1678                [[#include <sys/socket.h>
1679                  #include <netinet/in.h>
1680                  #include <netinet/tcp.h>]])
1681
1682if test "x$ac_cv_have_decl_TCP_KEEPIDLE" = "xyes" -a "x$ac_cv_have_decl_TCP_KEEPINTVL" = "xyes" -a "x$ac_cv_have_decl_TCP_KEEPCNT" = "xyes"; then
1683        AC_DEFINE(HAVE_TCP_KEEPALIVE_TIMERS, 1, [TCP keepalive timers])
1684fi
1685
1686if test "x$enable_linux_caps" = "xyes" -o "x$enable_linux_caps" = "xauto"; then
1687        PKG_CHECK_MODULES(LIBCAP, libcap, has_linux_caps="yes", has_linux_caps="no")
1688
1689        if test "x$has_linux_caps" = "xno"; then
1690                if test "x$ac_cv_header_sys_capability_h" = "xyes"; then
1691                        AC_CHECK_LIB(cap, cap_set_proc, LIBCAP_LIBS="-lcap"; has_linux_caps="yes", has_linux_caps="no")
1692                else
1693                        has_linux_caps="no"
1694                fi
1695                AC_MSG_CHECKING(whether to enable Linux capability support)
1696                AC_MSG_RESULT([$has_linux_caps])
1697        fi
1698
1699        if test "x$enable_linux_caps" = "xyes" -a "x$has_linux_caps" = "xno"; then
1700           AC_MSG_ERROR([Cannot enable Linux capability support.])
1701        fi
1702
1703        enable_linux_caps="$has_linux_caps"
1704fi
1705
1706if test "x$enable_mongodb" = "xauto"; then
1707	AC_MSG_CHECKING(whether to enable mongodb destination support)
1708	if test "x$with_mongoc" != "xno"; then
1709		enable_mongodb="yes"
1710	else
1711		enable_mongodb="no"
1712	fi
1713	AC_MSG_RESULT([$enable_mongodb])
1714fi
1715
1716if test "x$enable_amqp" = "xauto"; then
1717    AC_MSG_CHECKING(whether to enable amqp destination support)
1718    if test "x$with_librabbitmq_client" != "xno"; then
1719        enable_amqp="yes"
1720    else
1721        enable_amqp="no"
1722    fi
1723    AC_MSG_RESULT([$enable_amqp])
1724fi
1725
1726if test "x$enable_kafka" = "xauto"; then
1727    AC_MSG_CHECKING(whether to enable kafka support)
1728    if test "x$with_librdkafka" != "xno"; then
1729        enable_kafka="yes"
1730    else
1731        enable_kafka="no"
1732    fi
1733    AC_MSG_RESULT([$enable_kafka])
1734fi
1735
1736if test "x$enable_systemd" = "xauto"; then
1737	if test "$ostype" = "Linux" -a "$have_libsystemd" = "yes"; then
1738		enable_systemd=yes
1739	else
1740		enable_systemd=no
1741	fi
1742
1743fi
1744
1745if test "x$enable_systemd" != "xyes"; then
1746  if test "x$with_systemd_journal" = "xauto"; then
1747    with_systemd_journal=no
1748  fi
1749fi
1750
1751if test "x$enable_systemd" = "xyes"; then
1752
1753        if test "x$with_systemdsystemunitdir" = "xyes"; then
1754		# no arguments, just --with-systemdsystemunitdir
1755		systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
1756		if test "$systemdsystemunitdir" = ""; then
1757			AC_MSG_ERROR([Error autodetecting systemdsystemunitdir, systemd pkg-config file not found?])
1758		fi
1759	elif test "$systemdsystemunitdir" = "no"; then
1760		# --without-systemdsystemunitdir was specified
1761		systemdsystemunitdir=""
1762	else
1763		systemdsystemunitdir="$with_systemdsystemunitdir"
1764	fi
1765
1766        if test "x$have_libsystemd" = "xno"; then
1767	    PKG_CHECK_MODULES(libsystemd_daemon, libsystemd-daemon >= 31,enable_systemd="yes",enable_systemd="no")
1768            if test "x$with_systemd_journal" = "xauto"; then
1769                PKG_CHECK_MODULES(LIBSYSTEMD_JOURNAL, libsystemd-journal >= $JOURNALD_MIN_VERSION,
1770                                  with_systemd_journal=system, with_systemd_journal=optional)
1771            elif test "x$with_systemd_journal" = "xsystem"; then
1772                PKG_CHECK_MODULES(LIBSYSTEMD_JOURNAL, libsystemd-journal >= $JOURNALD_MIN_VERSION,,
1773                                  AC_MSG_ERROR([Detecting system related systemd-journal library failed]))
1774            fi
1775            libsystemd_CFLAGS="${LIBSYSTEMD_JOURNAL_CFLAGS} ${libsystemd_daemon_CFLAGS}"
1776            libsystemd_LIBS="${LIBSYSTEMD_JOURNAL_LIBS} ${libsystemd_daemon_LIBS}"
1777            AC_SUBST(libsystemd_CFLAGS)
1778            AC_SUBST(libsystemd_LIBS)
1779        else
1780            if test "x$with_systemd_journal" = "xauto"; then
1781                with_systemd_journal="system"
1782            fi
1783        fi
1784fi
1785
1786dnl ***************************************************************************
1787dnl check if we have timezone variable in <time.h>
1788dnl ***************************************************************************
1789AC_VAR_TIMEZONE_EXTERNALS
1790
1791dnl ***************************************************************************
1792dnl check fmemopen
1793dnl ***************************************************************************
1794AC_CHECK_FUNCS([fmemopen])
1795
1796dnl ***************************************************************************
1797dnl sanitizer
1798dnl ***************************************************************************
1799
1800if  test "x$with_sanitizer" != "xno"; then
1801   CFLAGS="$CFLAGS -O1 -fsanitize=$with_sanitizer -fno-omit-frame-pointer"
1802fi
1803
1804dnl ***************************************************************************
1805dnl default modules to be loaded
1806dnl ***************************************************************************
1807
1808### The default set of modules are those that provide functionality that
1809### were provided in syslog-ng 3.2 and prior, unless explicitly overridden
1810### by the user.
1811###
1812### New plugins can be loaded by explicit "@module foo" lines in the
1813### configuration file, or by the autoloading mechanism.
1814
1815if test "x$module_path" = "x"; then
1816	module_path="$moduledir"
1817	java_module_path="$moduledir"/java-modules
1818fi
1819
1820python_moduledir="$moduledir"/python
1821
1822CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS $EVTLOG_CFLAGS $PCRE_CFLAGS $OPENSSL_CFLAGS $LIBNET_CFLAGS $LIBDBI_CFLAGS $IVYKIS_CFLAGS $LIBCAP_CFLAGS -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
1823
1824########################################################
1825## NOTES: on how syslog-ng is linked
1826#
1827# There are two major linking modes currently:
1828#   1) dynamic: all libraries are linked dynamically, and assumed to be available as dynamic libraries
1829#
1830#   2) mixed: typical system provided libraries are linked dynamicaly, the
1831#      rest is linked statically (Glib etc).  Please note that _only_ the
1832#      main syslog-ng executable is linked this way so that it can be
1833#      started early during startup, tools and unit tests are linked
1834#      dynamically the same way.
1835#
1836# The following variables are introduced and AC_SUBSTed to be used in Makefiles:
1837#
1838# SYSLOGNG_DEPS_LIBS:
1839#       includes all dependendent libraries used by binary that can be linked in mixed mode (e.g. only the syslog-ng binary).
1840#
1841# TOOL_DEPS_LIBS:
1842#       executables (e.g. tools & unit test programs) that link against
1843#       libsyslog-ng.so should be linked with this set of libraries.  other
1844#       tools that do not use libsyslog-ng.so can use the _LIBS variables
1845#       directly.
1846#
1847# CORE_DEPS_LIBS:
1848#	libsyslog-ng.so is linked with this set of libraries.
1849#
1850# MODULE_DEPS_LIBS:
1851#       The set of libraries that modules should be linked against. Only to
1852#       satisfy their "core" dependency, any other libs that the core doesn't
1853#       depend on must be linked explicitly.
1854#
1855# MODULE_LDFLAGS:
1856#       The LDFLAGS to be passed when linking modules (may not contain
1857#       library references -l and such, only linker flags)
1858#
1859# Modules should be linked against libsyslog-ng.la and libraries that are
1860# _NOT_ linked into libsyslog-ng.la no need to define a LIBS variable for
1861# that.
1862
1863
1864if test -z "$MODULE_LDFLAGS"; then
1865	MODULE_LDFLAGS="-avoid-version -module -no-undefined"
1866fi
1867MODULE_DEPS_LIBS="\$(top_builddir)/lib/libsyslog-ng.la"
1868
1869if test "x$linking_mode" = "xdynamic"; then
1870	SYSLOGNG_DEPS_LIBS="$LIBS $BASE_LIBS $GLIB_LIBS $EVTLOG_LIBS $SECRETSTORAGE_LIBS $RESOLV_LIBS $LIBCAP_LIBS $PCRE_LIBS $REGEX_LIBS $DL_LIBS"
1871
1872	if test "x$with_ivykis" = "xinternal"; then
1873		# when using the internal ivykis, we're linking it statically into libsyslog-ng.so
1874
1875		TOOL_DEPS_LIBS="$SYSLOGNG_DEPS_LIBS"
1876		CORE_DEPS_LIBS="$SYSLOGNG_DEPS_LIBS $IVYKIS_LIBS"
1877	else
1878		# otherwise everything needs to link against libivykis.so
1879
1880		SYSLOGNG_DEPS_LIBS="$SYSLOGNG_DEPS_LIBS $IVYKIS_LIBS"
1881
1882		TOOL_DEPS_LIBS="$SYSLOGNG_DEPS_LIBS"
1883		CORE_DEPS_LIBS="$SYSLOGNG_DEPS_LIBS"
1884	fi
1885
1886	# syslog-ng binary is linked with the default link command (e.g. libtool)
1887	SYSLOGNG_LINK='$(LINK)'
1888else
1889	SYSLOGNG_DEPS_LIBS="$LIBS $BASE_LIBS $RESOLV_LIBS $EVTLOG_NO_LIBTOOL_LIBS $SECRETSTORAGE_NO_LIBTOOL_LIBS $LD_START_STATIC -Wl,${WHOLE_ARCHIVE_OPT} $GLIB_LIBS $PCRE_LIBS $REGEX_LIBS  -Wl,${NO_WHOLE_ARCHIVE_OPT} $IVYKIS_NO_LIBTOOL_LIBS $LD_END_STATIC $LIBCAP_LIBS $DL_LIBS"
1890	TOOL_DEPS_LIBS="$LIBS $BASE_LIBS $GLIB_LIBS $EVTLOG_LIBS $SECRETSTORAGE_LIBS $RESOLV_LIBS $LIBCAP_LIBS $PCRE_LIBS $REGEX_LIBS $IVYKIS_LIBS $DL_LIBS"
1891	CORE_DEPS_LIBS=""
1892
1893	# bypass libtool in case we want to do mixed linking because it
1894	# doesn't support -Wl,-Bstatic -Wl,-Bdynamic on a per-library basis.
1895	SYSLOGNG_LINK='$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@'
1896fi
1897YFLAGS="-d"
1898
1899enable_value()
1900{
1901        if test "x$1" = "xyes" ; then
1902                echo 1
1903        else
1904                echo 0
1905        fi
1906}
1907
1908journald_mode()
1909{
1910  if test "x$with_systemd_journal" = "xno"; then
1911    echo SYSLOG_NG_JOURNALD_OFF
1912  elif test "x$with_systemd_journal" = "xsystem"; then
1913    echo SYSLOG_NG_JOURNALD_SYSTEM
1914  else
1915    echo SYSLOG_NG_JOURNALD_OPTIONAL
1916  fi
1917}
1918
1919AC_DEFINE_UNQUOTED(JOURNALD_OFF, 0, ["Disable systemd-journal source"])
1920AC_DEFINE_UNQUOTED(JOURNALD_OPTIONAL, 1, ["Enable systemd-journal source if journald is available"])
1921AC_DEFINE_UNQUOTED(JOURNALD_SYSTEM, 2, ["Force systemd-journal source to use system's journald"])
1922AC_DEFINE_UNQUOTED(HAVE_JOURNAL_NAMESPACES, `(test "$journal_namespaces" = "yes" ) && echo 1 || echo 0`, [have journal namespaces])
1923
1924AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [version number])
1925AC_DEFINE_UNQUOTED(SOURCE_REVISION, "$SOURCE_REVISION", [source revision])
1926AC_DEFINE_UNQUOTED(LICENSE_VERSION, "$LICENSE_VERSION", [Required license version])
1927
1928AC_DEFINE_UNQUOTED(PATH_PREFIX, "$prefix", [prefix directory])
1929AC_DEFINE_UNQUOTED(PATH_EXECPREFIX, "$exec_prefix", [execprefix directory])
1930
1931AC_DEFINE_UNQUOTED(PATH_SYSCONFDIR, "$sysconfdir", [sysconfdir])
1932AC_DEFINE_UNQUOTED(PATH_LOCALSTATEDIR, "$localstatedir", [local state directory])
1933AC_DEFINE_UNQUOTED(PATH_PIDFILEDIR, "$pidfiledir", [local state directory])
1934AC_DEFINE_UNQUOTED(PATH_DATAROOTDIR, "$datarootdir", [data root directory])
1935AC_DEFINE_UNQUOTED(PATH_DATADIR, "$datadir", [data directory])
1936AC_DEFINE_UNQUOTED(PATH_CONFIG_INCLUDEDIR, "$config_includedir", [include directory])
1937AC_DEFINE_UNQUOTED(PATH_SCLDIR, "$scldir", [SCL directory])
1938AC_DEFINE_UNQUOTED(PATH_XSDDIR, "$xsddir", [XSD directory])
1939AC_DEFINE_UNQUOTED(PATH_LIBEXECDIR, "$libexecdir", [libexec directory])
1940if test -n "$timezonedir"; then
1941        AC_DEFINE_UNQUOTED(PATH_TIMEZONEDIR, "$timezonedir", [timezone base directory])
1942fi
1943if test -n "$env_ld_library_path"; then
1944        AC_DEFINE_UNQUOTED(ENV_LD_LIBRARY_PATH, "$env_ld_library_path", [set LD_LIBRARY_PATH to this value])
1945fi
1946AC_DEFINE_UNQUOTED(PATH_MODULEDIR, "$moduledir", [module installation directory])
1947AC_DEFINE_UNQUOTED(PYTHON_MODULE_DIR, "$python_moduledir", [Python module installation directory])
1948AC_DEFINE_UNQUOTED(PYTHON3_HOME_DIR, "$python3_home_dir", [Hard-coded Python 3 home directory])
1949AC_DEFINE_UNQUOTED(PYTHON2_HOME_DIR, "$python2_home_dir", [Hard-coded Python 2 home directory])
1950AC_DEFINE_UNQUOTED(PATH_LOGGENPLUGINDIR, "$loggenplugindir", [loggenplugin installation directory])
1951AC_DEFINE_UNQUOTED(MODULE_PATH, "$module_path", [module search path])
1952AC_DEFINE_UNQUOTED(JAVA_MODULE_PATH, "$java_module_path", [java module search path])
1953AC_DEFINE_UNQUOTED(PATH_TOPSRC_DIR, "$abs_topsrcdir", [self-defined top_srcdir path])
1954AC_DEFINE_UNQUOTED(PACKAGE_NAME, "$PACKAGE_NAME", [package name])
1955
1956
1957AC_DEFINE_UNQUOTED(WITH_COMPILE_DATE, $wcmp_date, [Include the compile date in the binary])
1958AC_DEFINE_UNQUOTED(ENABLE_FORCED_SERVER_MODE, `enable_value $enable_forced_server_mode`, [Enable forced server mode])
1959AC_DEFINE_UNQUOTED(ENABLE_DEBUG, `enable_value $enable_debug`, [Enable debugging])
1960AC_DEFINE_UNQUOTED(ENABLE_GPROF, `enable_value $enable_gprof`, [Enable gcc profiling])
1961AC_DEFINE_UNQUOTED(ENABLE_MEMTRACE, `enable_value $enable_memtrace`, [Enable memtrace])
1962AC_DEFINE_UNQUOTED(ENABLE_SPOOF_SOURCE, `enable_value $enable_spoof_source`, [Enable spoof source support])
1963AC_DEFINE_UNQUOTED(ENABLE_IPV6, `enable_value $enable_ipv6`, [Enable IPv6 support])
1964AC_DEFINE_UNQUOTED(ENABLE_TCP_WRAPPER, `enable_value $enable_tcp_wrapper`, [Enable TCP wrapper support])
1965AC_DEFINE_UNQUOTED(ENABLE_LINUX_CAPS, `enable_value $enable_linux_caps`, [Enable Linux capability management support])
1966AC_DEFINE_UNQUOTED(ENABLE_ENV_WRAPPER, `enable_value $enable_env_wrapper`, [Enable environment wrapper support])
1967AC_DEFINE_UNQUOTED(ENABLE_SYSTEMD, `enable_value $enable_systemd`, [Enable systemd support])
1968AC_DEFINE_UNQUOTED(ENABLE_KAFKA, `enable_value $enable_kafka`, [Enable kafka support])
1969AC_DEFINE_UNQUOTED(SYSTEMD_JOURNAL_MODE, `journald_mode`, [Systemd-journal support mode])
1970AC_DEFINE_UNQUOTED(HAVE_INOTIFY, `enable_value $ac_cv_func_inotify_init`, [Have inotify])
1971AC_DEFINE_UNQUOTED(ENABLE_PYTHONv2, `(test "$python_version" = "2" ) && echo 1 || echo 0`, [Python2 c api])
1972AC_DEFINE_UNQUOTED(ENABLE_PYTHONv3, `(test "$python_version" = "3" ) && echo 1 || echo 0`, [Python3 c api])
1973AC_DEFINE_UNQUOTED(USE_CONST_IVYKIS_MOCK, `enable_value $IVYKIS_VERSION_UPDATED`, [ivykis version is greater than $IVYKIS_UPDATED_VERSION])
1974
1975AM_CONDITIONAL(ENABLE_ENV_WRAPPER, [test "$enable_env_wrapper" = "yes"])
1976AM_CONDITIONAL(ENABLE_SYSTEMD, [test "$enable_systemd" = "yes"])
1977AM_CONDITIONAL(ENABLE_SYSTEMD_UNIT_INSTALL, [test "$systemdsystemunitdir" != ""])
1978AM_CONDITIONAL(ENABLE_SQL, [test "$enable_sql" = "yes"])
1979AM_CONDITIONAL(ENABLE_SUN_STREAMS, [test "$enable_sun_streams" = "yes"])
1980AM_CONDITIONAL(ENABLE_OPENBSD_SYSTEM_SOURCE, [test "$enable_openbsd_system_source" = "yes"])
1981AM_CONDITIONAL(ENABLE_PACCT, [test "$enable_pacct" = "yes"])
1982AM_CONDITIONAL(ENABLE_MONGODB, [test "$enable_mongodb" = "yes"])
1983AM_CONDITIONAL(ENABLE_SMTP, [test "$enable_smtp" = "yes"])
1984AM_CONDITIONAL(ENABLE_MQTT, [test "$enable_mqtt" = "yes"])
1985AM_CONDITIONAL(ENABLE_HTTP, [test "$enable_http" = "yes"])
1986AM_CONDITIONAL(ENABLE_AMQP, [test "$enable_amqp" = "yes"])
1987AM_CONDITIONAL(ENABLE_STOMP, [test "$enable_stomp" = "yes"])
1988AM_CONDITIONAL(ENABLE_JSON, [test "$enable_json" = "yes"])
1989AM_CONDITIONAL(ENABLE_GEOIP2, [test "$enable_geoip2" = "yes"])
1990AM_CONDITIONAL(ENABLE_REDIS, [test "$enable_redis" = "yes"])
1991AM_CONDITIONAL(ENABLE_KAFKA, [test "$enable_kafka" = "yes"])
1992AM_CONDITIONAL(IVYKIS_INTERNAL, [test "x$with_ivykis" = "xinternal"])
1993AM_CONDITIONAL(JSON_INTERNAL, [test "x$with_jsonc" = "xinternal"])
1994AM_CONDITIONAL(LIBMONGO_INTERNAL, [test "x$LIBMONGO_SUBDIRS" != "x"])
1995AM_CONDITIONAL(LIBRABBITMQ_INTERNAL, [test "x$with_librabbitmq_client" = "xinternal"])
1996AM_CONDITIONAL(ENABLE_RIEMANN, [test "$enable_riemann" != "no"])
1997AM_CONDITIONAL(ENABLE_JOURNALD, [test "$with_systemd_journal" != "no"])
1998AM_CONDITIONAL(ENABLE_PYTHON, [test "$enable_python" != "no"])
1999AM_CONDITIONAL(ENABLE_JAVA, [test "$enable_java" = "yes"])
2000AM_CONDITIONAL(ENABLE_JAVA_MODULES, [test "$enable_java_modules" = "yes"])
2001AM_CONDITIONAL(ENABLE_AFSNMP, [test "$enable_afsnmp" = "yes"])
2002AM_CONDITIONAL(ENABLE_MANPAGES, [test "$enable_manpages" != "no"])
2003AM_CONDITIONAL(ENABLE_MANPAGES_INSTALL, [test "$enable_manpages_install" != "no"])
2004AM_CONDITIONAL(ENABLE_NATIVE, [test "$enable_native" != "no"])
2005AM_CONDITIONAL(ENABLE_EXTRA_WARNINGS, [test "$enable_extra_warnings" = "yes"])
2006AM_CONDITIONAL(ENABLE_TESTING, [test "$enable_tests" != "no"])
2007AM_CONDITIONAL(ENABLE_SANITIZER, [test "$with_sanitizer" != "no"])
2008AM_CONDITIONAL(ENABLE_DEBUG, [test "$enable_debug" != "no"])
2009AM_CONDITIONAL([HAVE_INOTIFY], [test x$ac_cv_func_inotify_init = xyes])
2010AM_CONDITIONAL([HAVE_GETRANDOM], [test x$ac_cv_func_getrandom = xyes])
2011AM_CONDITIONAL([HAVE_FMEMOPEN], [test x$ac_cv_func_fmemopen = xyes])
2012AM_CONDITIONAL(ENABLE_IPV6, [test $enable_ipv6 = yes])
2013AM_CONDITIONAL(PYLINT, [test "x$PYLINT" != "x"])
2014
2015
2016AC_SUBST(PYLINT)
2017AC_SUBST(timezonedir)
2018AC_SUBST(pidfiledir)
2019AC_SUBST(moduledir)
2020AC_SUBST(python_moduledir)
2021AC_SUBST(loggenplugindir)
2022AC_SUBST(toolsdir)
2023AC_SUBST(config_includedir)
2024AC_SUBST(scldir)
2025AC_SUBST(abs_topsrcdir)
2026AC_SUBST(xsddir)
2027AC_SUBST(systemdsystemunitdir)
2028AC_SUBST(SYSLOGNG_LINK)
2029AC_SUBST(SYSLOGNG_DEPS_LIBS)
2030AC_SUBST(TOOL_DEPS_LIBS)
2031AC_SUBST(CORE_DEPS_LIBS)
2032AC_SUBST(MODULE_DEPS_LIBS)
2033AC_SUBST(MODULE_LDFLAGS)
2034AC_SUBST(BASE_LIBS)
2035AC_SUBST(YFLAGS)
2036AC_SUBST(LIBNET_LIBS)
2037AC_SUBST(LIBNET_CFLAGS)
2038AC_SUBST(NETSNMP_CFLAGS)
2039AC_SUBST(NETSNMP_LIBS)
2040AC_SUBST(LIBWRAP_LIBS)
2041AC_SUBST(LIBWRAP_CFLAGS)
2042AC_SUBST(ZLIB_LIBS)
2043AC_SUBST(ZLIB_CFLAGS)
2044AC_SUBST(LIBDBI_LIBS)
2045AC_SUBST(LIBDBI_CFLAGS)
2046AC_SUBST(LIBMONGO_LIBS)
2047AC_SUBST(LIBMONGO_CFLAGS)
2048AC_SUBST(LIBMONGO_SUBDIRS)
2049AC_SUBST(LIBPAHO_MQTT_CFLAGS)
2050AC_SUBST(LIBPAHO_MQTT_LIBS)
2051AC_SUBST(LIBESMTP_CFLAGS)
2052AC_SUBST(LIBESMTP_LIBS)
2053AC_SUBST(LIBCURL_CFLAGS)
2054AC_SUBST(LIBCURL_LIBS)
2055AC_SUBST(LIBRABBITMQ_LIBS)
2056AC_SUBST(LIBRABBITMQ_CFLAGS)
2057AC_SUBST(LIBRABBITMQ_SUBDIRS)
2058AC_SUBST(JSON_LIBS)
2059AC_SUBST(JSON_CFLAGS)
2060AC_SUBST(JSON_SUBDIRS)
2061AC_SUBST(JSON_DEPENDENCY)
2062AC_SUBST(IVYKIS_SUBDIRS)
2063AC_SUBST(RESOLV_LIBS)
2064
2065AC_SUBST(CURRDATE)
2066AC_SUBST(RELEASE_TAG)
2067AC_SUBST(SNAPSHOT_VERSION)
2068AC_SUBST(SOURCE_REVISION)
2069AC_SUBST(with_ivykis)
2070AC_SUBST(INTERNAL_IVYKIS_CFLAGS)
2071AC_SUBST(LIBSYSTEMD_JOURNAL_CFLAGS)
2072AC_SUBST(LIBSYSTEMD_JOURNAL_LIBS)
2073AC_SUBST(XSL_STYLESHEET)
2074
2075AX_PREFIX_CONFIG_H(syslog-ng-config.h, "SYSLOG_NG")
2076AX_VALGRIND_CHECK
2077
2078AC_OUTPUT(dist.conf
2079          Makefile
2080	  syslog-ng.pc
2081          libtest/syslog-ng-test.pc
2082	  scripts/update-patterndb
2083          )
2084
2085echo
2086echo "syslog-ng Open Source Edition $PACKAGE_VERSION configured"
2087echo " Edition settings:"
2088echo "  Release type                : $RELEASE_TYPE"
2089echo "  Pretty version              : $BROCHURE_VERSION"
2090echo "  Combined vers.              : $COMBINED_VERSION"
2091echo "  Package name                : $PACKAGE_NAME"
2092echo " Compiler options:"
2093echo "  compiler                    : $CC"
2094echo "  compiler options            : $CFLAGS $CPPFLAGS"
2095echo "  linker flags                : $LDFLAGS $LIBS"
2096echo "  prefix                      : $prefix"
2097echo "  linking mode                : $linking_mode"
2098echo "  embedded crypto             : ${with_embedded_crypto:=no}"
2099echo "  __thread keyword            : ${ac_cv_have_tls:=no}"
2100echo " Test dependencies:"
2101echo "  Criterion                   : ${with_criterion:=no}"
2102echo "  Unit tests                  : ${enable_tests:=no}"
2103echo " Submodules:"
2104echo "  ivykis                      : $with_ivykis"
2105echo "  jsonc                       : $with_jsonc"
2106echo " Features:"
2107echo "  Forced server mode          : ${enable_forced_server_mode:=yes}"
2108echo "  Debug symbols               : ${enable_debug:=no}"
2109echo "  GCC profiling               : ${enable_gprof:=no}"
2110echo "  Memtrace                    : ${enable_memtrace:=no}"
2111echo "  IPV6 support                : ${enable_ipv6:=no}"
2112echo "  spoof-source support        : ${enable_spoof_source:=no}"
2113echo "  tcp-wrapper support         : ${enable_tcp_wrapper:=no}"
2114echo "  Linux capability support    : ${has_linux_caps:=no}"
2115echo "  Env wrapper support         : ${enable_env_wrapper:=no}"
2116echo "  systemd support             : ${enable_systemd:=no} (unit dir: ${systemdsystemunitdir:=none})"
2117echo "  systemd-journal support     : ${with_systemd_journal:=no}"
2118echo " Build options:"
2119echo "  Generate manual pages       : ${enable_manpages:=no}"
2120echo "  Install manual pages        : ${enable_manpages_install:=no}"
2121echo " Modules:"
2122echo "  Module search path          : ${module_path}"
2123echo "  Sun STREAMS support (module): ${enable_sun_streams:=no}"
2124echo "  OpenBSD syslog (module)     : ${enable_openbsd_system_source:=no}"
2125echo "  SQL support (module)        : ${enable_sql:=no}"
2126echo "  PACCT module (EXPERIMENTAL) : ${enable_pacct:=no}"
2127echo "  MongoDB destination (module): ${enable_mongodb:=no}"
2128echo "  JSON support (module)       : ${enable_json:=no}"
2129echo "  SMTP support (module)       : ${enable_smtp:=no}"
2130echo "  HTTP support (module)       : ${enable_http:=no}"
2131echo "  AMQP destination (module)   : ${enable_amqp:=no}"
2132echo "  STOMP destination (module)  : ${enable_stomp:=no}"
2133echo "  MQTT (module)               : ${enable_mqtt:=no}"
2134echo "  GEOIP2 support (module)     : ${enable_geoip2:=no}"
2135echo "  Redis support (module)      : ${enable_redis:=no}"
2136echo "  Kafka support (module)      : ${enable_kafka:=no}"
2137echo "  Riemann destination (module): ${enable_riemann:=no}, microseconds: ${riemann_micros:=no}"
2138echo "  python                      : ${enable_python:=no} (pkg-config package: ${with_python:=none})"
2139echo "  java                        : ${enable_java:=no}"
2140echo "  java modules                : ${enable_java_modules:=no}"
2141echo "  afsnmp module               : ${enable_afsnmp:=no}"
2142echo "  native bindings             : ${enable_native:=no}"
2143