1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.61)
5AC_INIT([rsyslog],[8.2112.0],[rsyslog@lists.adiscon.com])   # UPDATE on release
6AC_DEFINE(VERSION_YEAR,  21, [year part of real rsyslog version])  # UPDATE on release
7AC_DEFINE(VERSION_MONTH, 12, [month part of real rsyslog version]) # UPDATE on release
8
9AM_INIT_AUTOMAKE([subdir-objects])
10
11m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
12
13unamestr=$(uname)
14if test "$unamestr" = "AIX"; then
15	AC_ARG_ENABLE(aix64bits,
16		[AS_HELP_STRING([--enable-aix64bits],[Enable compilation of rsyslog using 64 bits @<:@default=no@:>@])],
17	        [case "${enableval}" in
18	         yes) enable_aix64bits="yes" ;;
19	          no) enable_aix64bits="no" ;;
20	           *) AC_MSG_ERROR(bad value ${enableval} for --enable-aix64bits) ;;
21	         esac],
22		[enable_aix64bits=no]
23	)
24
25	CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT"
26	LDFLAGS="-brtl"
27	if test "x$enable_aix64bits" == "xyes"; then
28		CFLAGS="$CFLAGS -q64"
29		LDFLAGS="$LDFLAGS -b64"
30		AR_CFLAGS="-X64 $AR_CFLAGS"
31		NM="$(which nm) -X64 rcu"
32	fi
33fi
34
35AC_CONFIG_SRCDIR([ChangeLog])
36AC_CONFIG_MACRO_DIR([m4])
37AC_CONFIG_HEADERS([config.h])
38
39AC_USE_SYSTEM_EXTENSIONS
40
41# Checks for programs.
42AC_PROG_LEX
43AC_PROG_YACC
44AC_PROG_CC
45AC_PROG_CC_C99
46AC_DISABLE_STATIC
47# AIXPORT START: enable dlopen
48if test "$unamestr" = "AIX"; then
49	AC_LIBTOOL_DLOPEN
50fi
51# AIXPORT end
52AC_PROG_LIBTOOL
53AC_CANONICAL_HOST
54
55if test "$GCC" = "yes"
56then
57	m4_ifdef([AX_IS_RELEASE], [
58		AX_IS_RELEASE([git-directory])
59		m4_ifdef([AX_COMPILER_FLAGS], [
60			AX_COMPILER_FLAGS(,,,,[-Wunused-parameter -Wmissing-field-initializers])
61			# unfortunately, AX_COMPILER_FLAGS does not provide a way to override
62			# the default -Wno-error=warning" flags. So we do this via sed below.
63			# Note: we *really* want to have this error out during CI testing!
64			# rgerhards, 2018-05-09
65			WARN_CFLAGS="$(echo "$WARN_CFLAGS" | sed s/-Wno-error=/-W/g)"
66		], [
67			CFLAGS="$CFLAGS -W -Wall -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute -g"
68			AC_MSG_WARN([missing AX_COMPILER_FLAGS macro, not using it])
69		])
70	], [
71		CFLAGS="$CFLAGS -W -Wall -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute -g"
72		AC_MSG_WARN([missing AX_IS_RELEASE macro, not using AX_COMPILER_FLAGS macro because of this])
73	])
74else
75	AC_MSG_WARN([compiler is not GCC or close compatible, not using ax_compiler_flags because of this (CC=$CC)])
76fi
77
78PKG_PROG_PKG_CONFIG
79
80AC_ARG_VAR(CONF_FILE_PATH, Configuration file path (default : /usr/local/etc/rsyslog.conf))
81if test "$ac_cv_env_CONF_FILE_PATH_set" = "set"; then
82	AC_DEFINE_UNQUOTED(PATH_CONFFILE,  "${ac_cv_env_CONF_FILE_PATH_value}", "Configuration file path (default : /usr/local/etc/rsyslog.conf)")
83fi
84
85AC_ARG_VAR(PID_FILE_PATH, Pid file path (default : /var/run/rsyslogd.pid))
86if test "$ac_cv_env_PID_FILE_PATH_set" = "set"; then
87	AC_DEFINE_UNQUOTED(PATH_PIDFILE,  "${ac_cv_env_PID_FILE_PATH_value}", "Pid file path (default : /var/run/rsyslogd.pid)")
88fi
89
90
91# modules we require
92PKG_CHECK_MODULES(LIBESTR, libestr >= 0.1.9)
93
94PKG_CHECK_MODULES([LIBFASTJSON], [libfastjson >= 0.99.8],,)
95
96AC_DEFINE_UNQUOTED([PLATFORM_ID], ["${host}"], [platform id for display purposes])
97# we don't mind if we don't have the lsb_release utility. But if we have, it's
98# nice to have the extra information.
99AC_DEFINE_UNQUOTED([PLATFORM_ID_LSB], ["`lsb_release -d`"], [platform id for display purposes])
100
101echo HOST: ${host}
102case "${host}" in
103  *-*-linux*)
104    AC_DEFINE([OS_LINUX], [1], [Indicator for a Linux OS])
105    os_type="linux"
106  ;;
107  *-*-*darwin*|*-*-dragonfly*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
108    AC_DEFINE([OS_BSD], [1], [Indicator for a BSD OS])
109    os_type="bsd"
110  ;;
111  *-apple-*)
112    AC_DEFINE([OS_APPLE], [1], [Indicator for APPLE OS])
113    os_type="apple"
114  ;;
115  *-*-kfreebsd*)
116    # kernel is FreeBSD, but userspace is glibc - i.e. like linux
117    # do not DEFINE OS_BSD
118    os_type="bsd"
119  ;;
120  *-*-solaris*)
121    os_type="solaris"
122    AC_DEFINE([OS_SOLARIS], [1], [Indicator for a Solaris OS])
123    AC_DEFINE([_POSIX_PTHREAD_SEMANTICS], [1], [Use POSIX pthread semantics])
124    AC_DEFINE([_XOPEN_SOURCE], [600], [Use X/Open CAE Specification])
125    CPPFLAGS="-std=c99 $CPPFLAGS"
126    CFLAGS="-std=c99 $CFLAGS"
127    SOL_LIBS="-lsocket -lnsl"
128    # Solaris libuuid does not ship with a pkgconfig file so override the appropriate
129    # variables (but only if they have not been set by the user).
130    LIBUUID_CFLAGS=${LIBUUID_CFLAGS:= }
131    LIBUUID_LIBS=${LIBUUID_LIBS:=-luuid}
132    AC_SUBST(SOL_LIBS)
133  ;;
134  *-*-aix*)
135    os_type="aix"
136    AC_DEFINE([OS_AIX], [1], [Indicator for a AIX OS])
137  ;;
138esac
139AM_CONDITIONAL(OS_APPLE, test x$os_type == xapple)
140AM_CONDITIONAL(OS_LINUX, test x$os_type == xlinux)
141AM_CONDITIONAL(OS_AIX, test x$os_type == xaix)
142
143AM_PATH_PYTHON(,, [:])
144
145# Running from git source?
146in_git_src=no
147AS_IF([test -d "$srcdir"/.git && ! test -f  "$srcdir"/.tarball-version], [in_git_src=yes])
148
149
150AC_DEFINE_UNQUOTED([HOSTENV], "$host", [the host environment, can be queried via a system variable])
151
152# Some Unix systems, like Gnu Hurd, don't define PATH_MAX
153AC_MSG_CHECKING([for PATH_MAX])
154AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include <limits.h>]],
155                                    [[char checker[PATH_MAX];]])],
156                   [
157                      AC_MSG_RESULT([yes])
158                    ],
159                    [
160                      AC_MSG_RESULT([no, mocking PATH_MAX = 4096])
161                      AC_DEFINE([PATH_MAX], 4096, [replacement for missing PATH_MAX])
162                      AC_DEFINE([MAXPATHLEN], 4096, [replacement for missing PATH_MAX]) # we assume this does not exit
163                    ]
164                 )
165
166# Checks for libraries.
167save_LIBS=$LIBS
168LIBS=
169AC_SEARCH_LIBS(clock_gettime, rt)
170RT_LIBS=$LIBS
171AC_SEARCH_LIBS(mq_getattr, rt)
172RT_LIBS="$RT_LIBS $LIBS"
173LIBS=
174AC_SEARCH_LIBS(dlopen, dl)
175DL_LIBS=$LIBS
176LIBS=$save_LIBS
177
178AC_SUBST(RT_LIBS)
179AC_SUBST(DL_LIBS)
180
181# Checks for header files.
182AC_HEADER_RESOLV
183AC_HEADER_STDC
184AC_HEADER_SYS_WAIT
185AC_CHECK_HEADER([arpa/inet.h],[],[],[
186  [#ifdef HAVE_ARPA_INET_H
187     # include <arpa/inet.h>
188     #endif
189  ]
190])
191AC_CHECK_HEADERS([libgen.h],[],[],[
192  [#ifdef HAVE_LIBGEN_H
193     # include <libgen.h>
194     #endif
195  ]
196])
197AC_CHECK_HEADERS([malloc.h],[],[],[
198  [#ifdef HAVE_MALLOC_H
199     # include <malloc.h>
200     #endif
201  ]
202])
203AC_CHECK_HEADERS([fcntl.h locale.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h sys/stat.h unistd.h utmp.h utmpx.h sys/epoll.h sys/prctl.h sys/select.h getopt.h])
204
205# Checks for typedefs, structures, and compiler characteristics.
206AC_C_CONST
207AC_C_INLINE
208AC_TYPE_OFF_T
209AC_TYPE_PID_T
210AC_TYPE_SIZE_T
211AC_TYPE_SSIZE_T
212AC_TYPE_MODE_T
213AC_TYPE_UID_T
214AC_TYPE_UINT8_T
215AC_HEADER_TIME
216AC_STRUCT_TM
217AC_C_VOLATILE
218
219sa_includes="\
220$ac_includes_default
221#if HAVE_SYS_SOCKET_H
222# include <sys/socket.h>
223#endif
224"
225AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[$sa_includes])
226
227# Checks for library functions.
228AC_FUNC_CHOWN
229AC_FUNC_FORK
230AC_PROG_GCC_TRADITIONAL
231AC_FUNC_SELECT_ARGTYPES
232AC_TYPE_SIGNAL
233AC_FUNC_STAT
234AC_FUNC_STRERROR_R
235AC_FUNC_VPRINTF
236AC_CHECK_FUNCS([flock recvmmsg basename alarm clock_gettime gethostbyname gethostname gettimeofday localtime_r memset mkdir regcomp select setsid socket strcasecmp strchr strdup strerror strndup strnlen strrchr strstr strtol strtoul uname ttyname_r getline malloc_trim prctl epoll_create epoll_create1 fdatasync syscall lseek64 asprintf])
237AC_CHECK_FUNC([setns], [AC_DEFINE([HAVE_SETNS], [1], [Define if setns exists.])])
238AC_CHECK_TYPES([off64_t])
239
240AC_CHECK_HEADERS([sys/inotify.h], [rsyslog_sysinotify=yes])
241AC_CHECK_FUNCS([inotify_init], [rsyslog_inotify_init=yes])
242AM_CONDITIONAL(ENABLE_INOTIFY, test x$rsyslog_sysinotify = xyes -a x$rsyslog_inotify_init = xyes)
243
244# getifaddrs is in libc (mostly) or in libsocket (eg Solaris 11) or not defined (eg Solaris 10)
245AC_SEARCH_LIBS([getifaddrs], [socket], [AC_DEFINE(HAVE_GETIFADDRS, [1], [set define])])
246
247# the check below is probably ugly. If someone knows how to do it in a better way, please
248# let me know! -- rgerhards, 2010-10-06
249AC_CHECK_DECL([SCM_CREDENTIALS], [AC_DEFINE(HAVE_SCM_CREDENTIALS, [1], [set define])], [], [#include <sys/types.h>
250#include <sys/socket.h>])
251AC_CHECK_DECL([SO_TIMESTAMP], [AC_DEFINE(HAVE_SO_TIMESTAMP, [1], [set define])], [], [#include <sys/types.h>
252#include <sys/socket.h>])
253AC_CHECK_DECL([SYS_gettid], [AC_DEFINE(HAVE_SYS_gettid, [1], [set define])], [], [#include <sys/syscall.h>])
254AC_CHECK_MEMBER([struct sysinfo.uptime], [AC_DEFINE(HAVE_SYSINFO_UPTIME, [1], [set define])], [], [#include <sys/sysinfo.h>])
255AC_CHECK_DECL([GLOB_NOMAGIC], [AC_DEFINE(HAVE_GLOB_NOMAGIC, [1], [set define])], [], [#include <glob.h>])
256
257# Check for MAXHOSTNAMELEN
258AC_MSG_CHECKING(for MAXHOSTNAMELEN)
259AC_TRY_COMPILE([
260	#include <sys/param.h>
261	#include <netdb.h>
262	], [
263	return MAXHOSTNAMELEN;
264	]
265	,
266	AC_MSG_RESULT(yes)
267	,
268	# note: we use 1024 here, which should be far more than needed by any system. If that's too low, we simply
269	# life with the need to change it. Most of the code doesn't need it anyways, but there are a few places
270	# where it actually is needed and it makes no sense to change them.
271	AC_DEFINE(MAXHOSTNAMELEN, 1024, [Define with a value if your <sys/param.h> does not define MAXHOSTNAMELEN])
272	AC_MSG_RESULT(no; defined as 64)
273)
274
275# check if GNU's ld is used
276
277# Check for __builtin_expect()
278AC_MSG_CHECKING([for __builtin_expect()])
279AC_LINK_IFELSE([AC_LANG_PROGRAM(, return __builtin_expect(main != 0, 1))],
280               [AC_DEFINE(HAVE_BUILTIN_EXPECT, 1,
281                          Define to 1 if compiler supports __builtin_expect)
282                AC_MSG_RESULT([yes])],
283               [AC_MSG_RESULT([no])])
284
285# check for availability of atomic operations
286# Note: this switch is primarily for the testbench, so that we can try
287# to build w/o automic operations on systems that actually support them.
288# Usually, atomic operations should be used when available as this
289# speeds up processig.
290# note that when automic operations are enabled but not available, they
291# will silently NOT be used!
292AC_ARG_ENABLE(atomic-operations,
293        [AS_HELP_STRING([--enable-atomic-operations],[Enable atomic operation support @<:@default=yes@:>@])],
294        [case "${enableval}" in
295         yes) enable_atomic_operations="yes" ;;
296          no) enable_atomic_operations="no" ;;
297           *) AC_MSG_ERROR(bad value ${enableval} for --enable-atomic-operations) ;;
298         esac],
299        [enable_atomic_operations=yes]
300)
301if test "$enable_atomic_operations" = "yes"; then
302	RS_ATOMIC_OPERATIONS
303	RS_ATOMIC_OPERATIONS_64BIT
304fi
305
306# fall back to POSIX sems for atomic operations (cpu expensive)
307AC_CHECK_HEADERS([semaphore.h sys/syscall.h])
308
309
310# Additional module directories
311AC_ARG_WITH(moddirs,
312        [AS_HELP_STRING([--with-moddirs=DIRS],[Additional module search paths appended to @<:@$libdir/rsyslog@:>@])],
313        [_save_IFS=$IFS ; IFS=$PATH_SEPARATOR ; moddirs=""
314         for w in ${with_moddirs} ;
315         do
316                 case $w in
317                 "") continue ;; */) ;; *)  w="${w}/" ;;
318                 esac
319                 for m in ${moddirs} ;
320                 do
321                         test "x$w" = "x${libdir}/${PACKAGE}/"   || \
322                         test "x$w" = "x$m" || test "x$w" = "x/" && \
323                         continue 2
324                 done
325                 case $moddirs in
326                 "") moddirs="$w" ;; *) moddirs="${moddirs}:${w}" ;;
327                 esac
328         done ; IFS=$_save_IFS],[moddirs=""]
329)
330AM_CONDITIONAL(WITH_MODDIRS, test x$moddirs != x)
331AC_SUBST(moddirs)
332
333
334# Large file support
335# http://www.gnu.org/software/autoconf/manual/html_node/System-Services.html#index-AC_005fSYS_005fLARGEFILE-1028
336AC_SYS_LARGEFILE
337case "${enable_largefile}" in
338  no) ;;
339  *) enable_largefile="yes" ;;
340esac
341
342# Regular expressions
343AC_ARG_ENABLE(regexp,
344        [AS_HELP_STRING([--enable-regexp],[Enable regular expressions support @<:@default=yes@:>@])],
345        [case "${enableval}" in
346         yes) enable_regexp="yes" ;;
347          no) enable_regexp="no" ;;
348           *) AC_MSG_ERROR(bad value ${enableval} for --enable-regexp) ;;
349         esac],
350        [enable_regexp=yes]
351)
352AM_CONDITIONAL(ENABLE_REGEXP, test x$enable_regexp = xyes)
353if test "$enable_regexp" = "yes"; then
354        AC_DEFINE(FEATURE_REGEXP, 1, [Regular expressions support enabled.])
355fi
356
357# zlib support
358PKG_CHECK_MODULES([ZLIB], [zlib], [found_zlib=yes], [found_zlib=no])
359AS_IF([test "x$found_zlib" = "xno"], [
360        AC_SEARCH_LIBS([inflate], [z], [AC_CHECK_HEADER([zlib.h], [found_zlib=yes])])
361        if test "x$found_zlib" = "xno" ; then
362                AC_MSG_ERROR([zlib library and headers not found])
363        fi
364        ZLIB_LIBS="-lz"
365        AC_SUBST(ZLIB_LIBS)
366])
367
368
369#hash implementations header checks
370AC_ARG_ENABLE(fmhash,
371	[AS_HELP_STRING([--enable-fmhash],[Enable fmhash support @<:@default=yes@:>@])],
372        [case "${enableval}" in
373         yes) enable_fmhash="yes" ;;
374          no) enable_fmhash="no" ;;
375           *) AC_MSG_ERROR(bad value ${enableval} for --enable-fmhash) ;;
376         esac],
377	[enable_fmhash=yes]
378)
379
380AC_ARG_ENABLE(fmhash-xxhash,
381	[AS_HELP_STRING([--enable-fmhash-xxhash],[Enable xxhash in fmhash support @<:@default=no@:>@])],
382        [case "${enableval}" in
383         yes) enable_fmhash_xxhash="yes" ;;
384          no) enable_fmhash_xxhash="no" ;;
385           *) AC_MSG_ERROR(bad value ${enableval} for --enable-fmhash-xxhash) ;;
386         esac],
387	[enable_fmhash_xxhash=no]
388)
389
390AM_CONDITIONAL(ENABLE_FMHASH, [test "x$enable_fmhash" = "xyes" || test "x$enable_fmhash_xxhash" = "xyes"])
391
392AM_CONDITIONAL(ENABLE_FMHASH_XXHASH, test x$enable_fmhash_xxhash = xyes)
393if test "$enable_fmhash_xxhash" = "yes"; then
394	AC_CHECK_LIB([xxhash], [XXH64], [
395		AC_CHECK_HEADER([xxhash.h], [
396			AC_DEFINE(USE_HASH_XXHASH, 1,
397				  [Using XXHASH for hash64.])
398			HASH_XXHASH_LIBS="-lxxhash"
399			AC_SUBST(HASH_XXHASH_LIBS)],
400			[AC_MSG_ERROR([Unable to add XXHASH support for hash64.])])
401	])
402fi
403
404
405#faup header checks
406AC_ARG_ENABLE(ffaup,
407	[AS_HELP_STRING([--enable-ffaup],[Enable ffaup support @<:@default=no@:>@])],
408        [case "${enableval}" in
409         yes) enable_ffaup="yes" ;;
410          no) enable_ffaup="no" ;;
411           *) AC_MSG_ERROR(bad value ${enableval} for --enable-ffaup) ;;
412         esac],
413	[enable_ffaup=no]
414)
415
416AM_CONDITIONAL(ENABLE_FFAUP, test x$enable_ffaup = xyes)
417if test "$enable_ffaup" = "yes"; then
418	AC_CHECK_LIB([faupl], [faup_init], [
419		AC_CHECK_HEADER([faup/faup.h], [
420			FAUP_LIBS="-lfaupl"
421			AC_SUBST(FAUP_LIBS)],
422			[AC_MSG_ERROR([Unable to add faup support for URL parsing.])])
423	])
424fi
425
426
427# rscript function unflatten
428AC_ARG_ENABLE(fmunflatten,
429	[AS_HELP_STRING([--enable-fmunflatten],[Enable fmunflatten support @<:@default=no@:>@])],
430        [case "${enableval}" in
431         yes) enable_fmunflatten="yes" ;;
432          no) enable_fmunflatten="no" ;;
433           *) AC_MSG_ERROR(bad value ${enableval} for --enable-fmunflatten) ;;
434         esac],
435	[enable_fmunflatten=no]
436)
437AM_CONDITIONAL(ENABLE_FMUNFLATTEN, test x$enable_fmunflatten = xyes)
438
439
440#gssapi
441AC_ARG_ENABLE(gssapi_krb5,
442	[AS_HELP_STRING([--enable-gssapi-krb5],[Enable GSSAPI Kerberos 5 support @<:@default=no@:>@])],
443        [case "${enableval}" in
444         yes) enable_gssapi_krb5="yes" ;;
445          no) enable_gssapi_krb5="no" ;;
446           *) AC_MSG_ERROR(bad value ${enableval} for --enable-gssapi-krb5) ;;
447         esac],
448	[enable_gssapi_krb5=no]
449)
450
451case "${os_type}" in
452solaris) GSSLIB=gss ;;
453*)       GSSLIB=gssapi_krb5 ;;
454esac
455
456if test $enable_gssapi_krb5 = yes; then
457	AC_CHECK_LIB($GSSLIB, gss_acquire_cred, [
458		AC_CHECK_HEADER(gssapi/gssapi.h, [
459			AC_DEFINE(USE_GSSAPI,,
460				  Define if you want to use GSSAPI)
461			GSS_LIBS="-l$GSSLIB"
462			AC_SUBST(GSS_LIBS)
463		])
464	])
465fi
466AM_CONDITIONAL(ENABLE_GSSAPI, test x$enable_gssapi_krb5 = xyes)
467
468
469# shall the testbench try to run test that require root permissions?
470# This is uncommon. Test skip if run under non-root, but that pollutes the
471# testbench result. So the default is not to do that.
472AC_ARG_ENABLE(root_tests,
473        [AS_HELP_STRING([--enable-root-tests],[enable root tests in testbench @<:@default=no@:>@])],
474        [case "${enableval}" in
475         yes) enable_root_tests="yes" ;;
476          no) enable_root_tests="no" ;;
477           *) AC_MSG_ERROR(bad value ${enableval} for --enable-root-tests) ;;
478         esac],
479        [enable_root_tests=no]
480)
481AM_CONDITIONAL(ENABLE_ROOT_TESTS, test x$enable_root_tests = xyes)
482
483# multithreading via pthreads
484if test "$os_type" != "solaris"
485then
486	AC_CHECK_HEADERS(
487		[pthread.h],
488		[
489			AC_CHECK_LIB(
490				[pthread],
491				[pthread_create],
492				[
493					PTHREADS_LIBS="-lpthread"
494					if test "$unamestr" = "AIX"; then
495					case "${CC}" in
496						*xlc*|*xlC*) PTHREADS_CFLAGS="-qthreaded" ;;
497						*) PTHREADS_CFLAGS="-lpthreads" ;;
498					esac
499					else
500						PTHREADS_CFLAGS="-pthread"
501					fi
502					AC_SUBST(PTHREADS_LIBS)
503					AC_SUBST(PTHREADS_CFLAGS)
504				],
505				[AC_MSG_FAILURE([pthread is missing])],
506				[-lpthread]
507			)
508		],
509		[AC_MSG_FAILURE([pthread is missing])]
510	)
511fi
512
513AC_CHECK_LIB(
514  [pthread],
515	[pthread_rwlockattr_setkind_np],
516	[AC_DEFINE(
517	   [HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP],
518		 [1],
519		 [Set-kind available for rwlock attr.])])
520
521AC_CHECK_LIB(
522  [pthread],
523	[pthread_setname_np],
524	[AC_DEFINE(
525	   [HAVE_PTHREAD_SETNAME_NP],
526		 [1],
527		 [Can set thread-name.])])
528
529AC_SEARCH_LIBS(
530    [pthread_setschedparam],
531    [pthread],
532    [
533      rsyslog_have_pthread_setschedparam=yes
534      AC_DEFINE([HAVE_PTHREAD_SETSCHEDPARAM],
535	[1],
536	[Can set thread scheduling parameters])
537    ],
538    [
539      rsyslog_have_pthread_setschedparam=no
540    ]
541)
542AC_CHECK_HEADERS(
543    [sched.h],
544    [
545      rsyslog_have_sched_h=yes
546    ],
547    [
548      rsyslog_have_sched_h=no
549    ]
550)
551if test "$rsyslog_have_pthread_setschedparam" = "yes" -a "$rsyslog_have_sched_h" = "yes"; then
552	save_LIBS=$LIBS
553	LIBS=
554	AC_SEARCH_LIBS(sched_get_priority_max, rt)
555	if test "x$ac_cv_search" != "xno"; then
556		AC_CHECK_FUNCS(sched_get_priority_max)
557	fi
558	IMUDP_LIBS=$LIBS
559	AC_SUBST(IMUDP_LIBS)
560	LIBS=$save_LIBS
561fi
562
563if test "$unamestr" = "AIX"; then
564enable_klog="no"
565else
566# klog
567AC_ARG_ENABLE(klog,
568        [AS_HELP_STRING([--enable-klog],[Integrated klog functionality @<:@default=yes@:>@])],
569        [case "${enableval}" in
570         yes) enable_klog="yes" ;;
571          no) enable_klog="no" ;;
572           *) AC_MSG_ERROR(bad value ${enableval} for --enable-klog) ;;
573         esac],
574        [enable_klog="yes"]
575)
576fi
577AM_CONDITIONAL(ENABLE_IMKLOG, test x$enable_klog = xyes)
578AM_CONDITIONAL(ENABLE_IMKLOG_BSD, test x$os_type = xbsd)
579AM_CONDITIONAL(ENABLE_IMKLOG_LINUX, test x$os_type = xlinux)
580AM_CONDITIONAL(ENABLE_IMKLOG_SOLARIS, test x$os_type = xsolaris)
581
582# kmsg
583AC_ARG_ENABLE(kmsg,
584        [AS_HELP_STRING([--enable-kmsg],[Kmsg structured kernel logs functionality @<:@default=no@:>@])],
585        [case "${enableval}" in
586         yes) enable_kmsg="yes" ;;
587          no) enable_kmsg="no" ;;
588           *) AC_MSG_ERROR(bad value ${enableval} for --enable-kmsg) ;;
589         esac],
590        [enable_kmsg="no"]
591)
592AM_CONDITIONAL(ENABLE_IMKMSG, test x$enable_kmsg = xyes)
593
594# imjournal
595AC_ARG_ENABLE(imjournal,
596        [AS_HELP_STRING([--enable-imjournal],[Systemd journal message import @<:@default=no@:>@])],
597        [case "${enableval}" in
598         yes) enable_imjournal="yes" ;;
599          no) enable_imjournal="no" ;;
600         optional) enable_imjournal="optional" ;;
601           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imjournal) ;;
602         esac],
603        [enable_imjournal="no"]
604)
605imjournal_use_dummy="no"
606if test "x$enable_imjournal" = "xyes" -o "x$enable_imjournal" = "xoptional"; then
607	PKG_CHECK_MODULES([LIBSYSTEMD_JOURNAL], [libsystemd >= 234] , [AC_DEFINE(NEW_JOURNAL, 1, [new systemd present])] , [
608	    PKG_CHECK_MODULES([LIBSYSTEMD_JOURNAL], [libsystemd >= 209] , , [
609	        PKG_CHECK_MODULES([LIBSYSTEMD_JOURNAL], [libsystemd-journal >= 197], , [
610                    AS_IF([test x$enable_imjournal = xyes],
611                        AC_MSG_FAILURE([imjournal support libraries are missing])
612	            )
613                    imjournal_use_dummy="yes"
614                 ])
615	    ])
616	])
617fi
618AM_CONDITIONAL(IMJOURNAL_USE_DUMMY, test x$imjournal_use_dummy = xyes)
619AM_CONDITIONAL(ENABLE_IMJOURNAL, test x$enable_imjournal = xyes -o x$enable_imjournal = xoptional)
620
621# use libsystemd
622AC_ARG_ENABLE(libsystemd,
623        [AS_HELP_STRING([--enable-libsystemd],[Enable libsystemd mode @<:@default=auto@:>@])],
624        [case "${enableval}" in
625          yes) enable_libsystemd="yes" ;;
626           no) enable_libsystemd="no" ;;
627         auto) enable_libsystemd="auto" ;;
628           *) AC_MSG_ERROR(bad value ${enableval} for --enable-libsystemd) ;;
629         esac],
630        [enable_libsystemd="auto"]
631)
632if test "$enable_libsystemd" = "yes"; then
633	PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd],
634		[ AC_DEFINE(HAVE_LIBSYSTEMD, 1, [libsystemd present]) ]
635	)
636fi
637if test "$enable_libsystemd" = "auto"; then
638	PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd],
639		[ AC_DEFINE(HAVE_LIBSYSTEMD, 1, [libsystemd present])
640		  AC_MSG_NOTICE([--enable-libsystemd in auto mode])
641		  enable_libsystemd="yes"
642		],
643		[ AC_MSG_WARN([libsystemd not present - disabling systemd support])
644		  enable_libsystemd="no"
645		]
646	)
647	AC_MSG_NOTICE([--enable-libsystemd in auto mode, enable-libsystemd is set to ${enable_libsystemd}])
648fi
649
650# inet
651AC_ARG_ENABLE(inet,
652        [AS_HELP_STRING([--enable-inet],[Enable networking support @<:@default=yes@:>@])],
653        [case "${enableval}" in
654         yes) enable_inet="yes" ;;
655          no) enable_inet="no" ;;
656           *) AC_MSG_ERROR(bad value ${enableval} for --enable-inet) ;;
657         esac],
658        [enable_inet="yes"]
659)
660AM_CONDITIONAL(ENABLE_INET, test x$enable_inet = xyes)
661if test "$enable_inet" = "yes"; then
662        AC_DEFINE(SYSLOG_INET, 1, [network support is integrated.])
663fi
664
665# jemalloc
666AC_ARG_ENABLE(jemalloc,
667        [AS_HELP_STRING([--enable-jemalloc],[Enable jemalloc support @<:@default=no@:>@])],
668        [case "${enableval}" in
669         yes) enable_jemalloc="yes" ;;
670          no) enable_jemalloc="no" ;;
671           *) AC_MSG_ERROR(bad value ${enableval} for --enable-jemalloc) ;;
672         esac],
673        [enable_jemalloc="no"]
674)
675AM_CONDITIONAL(ENABLE_JEMALLOC, test x$enable_jemalloc = xyes)
676if test "$enable_jemalloc" = "yes"; then
677  AC_CHECK_LIB(
678    [jemalloc],
679    [malloc_stats_print],
680    [RT_LIBS="$RT_LIBS -ljemalloc"
681     AC_DEFINE(HAVE_JEMALLOC, 1, [jemalloc support is integrated.])
682    ],
683    [AC_MSG_FAILURE([jemalloc library is missing])],
684    []
685    )
686fi
687
688
689# support for unlimited select() syscall
690AC_ARG_ENABLE(unlimited_select,
691        [AS_HELP_STRING([--enable-unlimited-select],[Enable unlimited select() syscall @<:@default=no@:>@])],
692        [case "${enableval}" in
693         yes) enable_unlimited_select="yes" ;;
694          no) enable_unlimited_select="no" ;;
695           *) AC_MSG_ERROR(bad value ${enableval} for --enable-unlimited-select) ;;
696         esac],
697        [enable_unlimited_select="no"]
698)
699if test "$enable_unlimited_select" = "yes"; then
700        AC_DEFINE(USE_UNLIMITED_SELECT, 1, [If defined, the select() syscall won't be limited to a particular number of file descriptors.])
701fi
702
703
704# support for systemd unit files
705AC_ARG_WITH([systemdsystemunitdir],
706        AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
707        [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
708if test "x$with_systemdsystemunitdir" != xno; then
709        AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
710fi
711AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
712
713
714# debug
715AC_ARG_ENABLE(debug,
716        [AS_HELP_STRING([--enable-debug],[Enable debug mode @<:@default=auto@:>@])],
717        [case "${enableval}" in
718          yes) enable_debug="yes" ;;
719           no) enable_debug="no" ;;
720         auto) enable_debug="auto" ;;
721           *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
722         esac],
723        [enable_debug="auto"]
724)
725if test "$enable_debug" = "auto"; then
726	if test "x$in_git_src" = "xyes"; then
727		enable_debug="yes"
728	else
729		enable_debug="no"
730	fi
731	AC_MSG_NOTICE([enable-debug in auto mode, enable-debug is set to ${enable_debug}])
732fi
733if test "$enable_debug" = "yes"; then
734        AC_DEFINE(DEBUG, 1, [Defined if debug mode is enabled (its easier to check).])
735fi
736if test "$enable_debug" = "no"; then
737        AC_DEFINE(NDEBUG, 1, [Defined if debug mode is disabled.])
738fi
739
740
741# debug-symbols
742AC_ARG_ENABLE(debug_symbols,
743        [AS_HELP_STRING([--disable-debug-symbols],[Disable debugging symbols @<:@default=no@:>@])],
744        [case "${enableval}" in
745         yes) enable_debug_symbols="yes" ;;
746          no) enable_debug_symbols="no" ;;
747           *) AC_MSG_ERROR(bad value ${enableval} for --disable-debug-symbols) ;;
748         esac],
749        [enable_debug_symbols="yes"]
750)
751
752
753# total debugless: highest performance, but no way at all to enable debug
754# logging
755AC_ARG_ENABLE(debugless,
756        [AS_HELP_STRING([--enable-debugless],[Enable runtime instrumentation mode @<:@default=no@:>@])],
757        [case "${enableval}" in
758         yes) enable_debugless="yes" ;;
759          no) enable_debugless="no" ;;
760           *) AC_MSG_ERROR(bad value ${enableval} for --enable-debugless) ;;
761         esac],
762        [enable_debugless="no"]
763)
764if test "$enable_debugless" = "yes"; then
765        AC_DEFINE(DEBUGLESS, 1, [Defined if debugless mode is enabled.])
766fi
767
768
769# valgrind
770AC_ARG_ENABLE(valgrind,
771        [AS_HELP_STRING([--enable-valgrind],[Enable somes special code that rsyslog core developers consider useful for testing. Do NOT use if you don't exactly know what you are doing, except if told so by rsyslog developers. NOT to be used by distro maintainers for building regular packages. @<:@default=no@:>@])],
772        [case "${enableval}" in
773         yes) enable_valgrind="yes" ;;
774          no) enable_valgrind="no" ;;
775           *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;;
776         esac],
777        [enable_valgrind="no"]
778)
779if test "$enable_valgrind" = "yes"; then
780        AC_DEFINE(VALGRIND, 1, [Defined if valgrind support settings are to be enabled (e.g. prevents dlclose()).])
781fi
782
783
784# compile diagnostic tools (small helpers usually not needed)
785AC_ARG_ENABLE(diagtools,
786        [AS_HELP_STRING([--enable-diagtools],[Enable diagnostic tools @<:@default=no@:>@])],
787        [case "${enableval}" in
788         yes) enable_diagtools="yes" ;;
789          no) enable_diagtools="no" ;;
790           *) AC_MSG_ERROR(bad value ${enableval} for --enable-diagtools) ;;
791         esac],
792        [enable_diagtools=no]
793)
794AM_CONDITIONAL(ENABLE_DIAGTOOLS, test x$enable_diagtools = xyes)
795
796
797# compile end-user tools
798AC_ARG_ENABLE(usertools,
799        [AS_HELP_STRING([--enable-usertools],[Enable end user tools @<:@default=no@:>@])],
800        [case "${enableval}" in
801         yes) enable_usertools="yes" ;;
802          no) enable_usertools="no" ;;
803           *) AC_MSG_ERROR(bad value ${enableval} for --enable-usertools) ;;
804         esac],
805        [enable_usertools=no]
806)
807AM_CONDITIONAL(ENABLE_USERTOOLS, test x$enable_usertools = xyes)
808
809
810# MySQL support
811AC_ARG_ENABLE(mysql,
812        [AS_HELP_STRING([--enable-mysql],[Enable MySql database support @<:@default=no@:>@])],
813        [case "${enableval}" in
814         yes) enable_mysql="yes" ;;
815          no) enable_mysql="no" ;;
816           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mysql) ;;
817         esac],
818        [enable_mysql=no]
819)
820AS_IF([test "x$enable_mysql" = "xyes"],[
821  PKG_CHECK_MODULES([MYSQL],[mysqlclient],,[
822    AC_CHECK_PROG(
823      [MYSQL_CONFIG],
824      [mysql_config],
825      [mysql_config],
826      [no],,
827    )
828    AS_IF([test "x${MYSQL_CONFIG}" = "xno"],[
829      AC_MSG_FAILURE([mysql_config not found - usually a package named mysql-dev, libmysql-dev or similar, is missing - install it to fix this issue])
830    ])
831    MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
832    MYSQL_LIBS=`$MYSQL_CONFIG --libs`
833  ])
834  AC_MSG_CHECKING(if we have mysql_library_init)
835  save_CFLAGS="$CFLAGS"
836  CFLAGS="$CFLAGS $MYSQL_CFLAGS"
837  save_LIBS="$LIBS"
838  AC_CHECK_LIB(
839    [mysqlclient],
840    [mysql_init],
841    ,
842    [AC_MSG_FAILURE([MySQL library is missing])],
843    [$MYSQL_LIBS]
844  )
845  LIBS="$LIBS $MYSQL_LIBS"
846  AC_TRY_LINK(
847    [#include <mysql.h>
848     #include <stdio.h>],
849    [mysql_library_init(0, NULL, NULL)],
850    [have_mysql_library_init=yes],
851    [have_mysql_library_init=no])
852  CFLAGS="$save_CFLAGS"
853  LIBS="$save_LIBS"
854])
855AM_CONDITIONAL(ENABLE_MYSQL, test x$enable_mysql = xyes)
856if test "$have_mysql_library_init" = "yes"; then
857  AC_DEFINE([HAVE_MYSQL_LIBRARY_INIT], [1], [mysql_library_init available])
858fi
859AC_SUBST(MYSQL_CFLAGS)
860AC_SUBST(MYSQL_LIBS)
861
862
863# PostgreSQL support
864AC_ARG_ENABLE(pgsql,
865        [AS_HELP_STRING([--enable-pgsql],[Enable PostgreSQL database support @<:@default=no@:>@])],
866        [case "${enableval}" in
867         yes) enable_pgsql="yes" ;;
868          no) enable_pgsql="no" ;;
869           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pgsql) ;;
870         esac],
871        [enable_pgsql=no]
872)
873if test "x$enable_pgsql" = "xyes"; then
874	PKG_CHECK_MODULES([PGSQL], [libpq],, [
875	  AC_CHECK_PROG(
876	    [PG_CONFIG],
877	    [pg_config],
878	    [pg_config],
879	    [no],,,
880	  )
881	  if test "x${PG_CONFIG}" = "xno"; then
882	    AC_MSG_FAILURE([pg_config not found])
883	  fi
884	  AC_CHECK_LIB(
885	    [pq],
886	    [PQconnectdb],
887	    [PGSQL_CFLAGS="-I`$PG_CONFIG --includedir`"
888	     PGSQL_LIBS="-L`$PG_CONFIG --libdir` -lpq"
889	    ],
890	    [AC_MSG_FAILURE([PgSQL library is missing])],
891	    [-L`$PG_CONFIG --libdir`]
892	  )
893	])
894fi
895AM_CONDITIONAL(ENABLE_PGSQL, test x$enable_pgsql = xyes)
896AC_SUBST(PGSQL_CFLAGS)
897AC_SUBST(PGSQL_LIBS)
898
899# libdbi support
900AC_ARG_ENABLE(libdbi,
901        [AS_HELP_STRING([--enable-libdbi],[Enable libdbi database support @<:@default=no@:>@])],
902        [case "${enableval}" in
903         yes) enable_libdbi="yes" ;;
904          no) enable_libdbi="no" ;;
905          optional) enable_libdbi="optional" ;;
906           *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdbi) ;;
907         esac],
908        [enable_libdbi=no]
909)
910libdbi_use_dummy="no"
911if test "x$enable_libdbi" = "xyes" -o x$enable_libdbi = xoptional; then
912  AC_CHECK_HEADERS(
913    [dbi/dbi.h],,[
914        AS_IF([test x$enable_libdbi = xyes],
915            AC_MSG_FAILURE([libdbi is missing])
916	)
917        libdbi_use_dummy="yes"
918     ]
919  )
920  AC_CHECK_LIB(
921    [dbi],
922    [dbi_initialize],
923    [LIBDBI_CFLAGS=""
924     LIBDBI_LIBS="-ldbi"
925    ], [
926        AS_IF([test x$enable_libdbi = xyes],
927            AC_MSG_FAILURE([libdbi is missing])
928	)
929        libdbi_use_dummy="yes"
930     ]
931  )
932  AC_CHECK_LIB(
933    [dbi],
934    [dbi_initialize_r],
935    [AC_DEFINE([HAVE_DBI_R], [1], [Define to 1 if libdbi supports the new plugin-safe interface])]
936  )
937  AC_CHECK_LIB(
938    [dbi],
939    [dbi_conn_transaction_begin],
940    [AC_DEFINE([HAVE_DBI_TXSUPP], [1], [Define to 1 if libdbi supports transactions])]
941  )
942fi
943AM_CONDITIONAL(LIBDBI_USE_DUMMY, test x$libdbi_use_dummy = xyes)
944AM_CONDITIONAL(ENABLE_OMLIBDBI, test x$enable_libdbi = xyes -o x$enable_libdbi = xoptional)
945AC_SUBST(LIBDBI_CFLAGS)
946AC_SUBST(LIBDBI_LIBS)
947
948
949# SNMP support
950AC_ARG_ENABLE(snmp,
951        [AS_HELP_STRING([--enable-snmp],[Enable SNMP support @<:@default=no@:>@])],
952        [case "${enableval}" in
953         yes) enable_snmp="yes" ;;
954          no) enable_snmp="no" ;;
955           *) AC_MSG_ERROR(bad value ${enableval} for --enable-snmp) ;;
956         esac],
957        [enable_snmp=no]
958)
959if test "x$enable_snmp" = "xyes"; then
960  AC_CHECK_HEADERS(
961    [net-snmp/net-snmp-config.h],,
962    [AC_MSG_FAILURE([Net-SNMP is missing])]
963  )
964  AC_CHECK_LIB(
965    [netsnmp],
966    [snmp_timeout],
967    [SNMP_CFLAGS=""
968     SNMP_LIBS="-lnetsnmp"
969    ],
970    [AC_MSG_FAILURE([Net-SNMP library is missing])]
971  )
972fi
973AM_CONDITIONAL(ENABLE_SNMP, test x$enable_snmp = xyes)
974AC_SUBST(SNMP_CFLAGS)
975AC_SUBST(SNMP_LIBS)
976
977# SNMP Test Support
978AC_ARG_ENABLE(snmp-tests,
979        [AS_HELP_STRING([--enable-snmp-tests],[Enable omsnmp tests @<:@default=no@:>@])],
980        [case "${enableval}" in
981         yes) enable_snmp_tests="yes" ;;
982          no) enable_snmp_tests="no" ;;
983           *) AC_MSG_ERROR(bad value ${enableval} for --enable-snmp-tests) ;;
984         esac],
985        [enable_snmp_tests=no]
986)
987AM_CONDITIONAL(ENABLE_SNMP_TESTS, test x$enable_snmp_tests = xyes)
988
989# uuid support
990AC_ARG_ENABLE(uuid,
991        [AS_HELP_STRING([--enable-uuid],[Enable support for uuid generation @<:@default=yes@:>@])],
992        [case "${enableval}" in
993         yes) enable_uuid="yes" ;;
994          no) enable_uuid="no" ;;
995           *) AC_MSG_ERROR(bad value ${enableval} for --enable-uuid) ;;
996         esac],
997        [enable_uuid=yes]
998)
999if test "x$enable_uuid" = "xyes"; then
1000	PKG_CHECK_MODULES([LIBUUID], [uuid])
1001	AC_DEFINE(USE_LIBUUID, 1, [Define if you want to enable libuuid support])
1002fi
1003AM_CONDITIONAL(ENABLE_UUID, test x$enable_uuid = xyes)
1004
1005
1006# elasticsearch support
1007AC_ARG_ENABLE(elasticsearch,
1008        [AS_HELP_STRING([--enable-elasticsearch],[Enable elasticsearch output module @<:@default=no@:>@])],
1009        [case "${enableval}" in
1010         yes) enable_elasticsearch="yes" ;;
1011          no) enable_elasticsearch="no" ;;
1012           *) AC_MSG_ERROR(bad value ${enableval} for --enable-elasticsearch) ;;
1013         esac],
1014        [enable_elasticsearch=no]
1015)
1016if test "x$enable_elasticsearch" = "xyes"; then
1017	PKG_CHECK_MODULES([CURL], [libcurl])
1018	LT_LIB_M
1019fi
1020AM_CONDITIONAL(ENABLE_ELASTICSEARCH, test x$enable_elasticsearch = xyes)
1021
1022
1023# clickhouse support
1024AC_ARG_ENABLE(clickhouse,
1025        [AS_HELP_STRING([--enable-clickhouse],[Enable clickhouse output module @<:@default=no@:>@])],
1026        [case "${enableval}" in
1027         yes) enable_clickhouse="yes" ;;
1028          no) enable_clickhouse="no" ;;
1029           *) AC_MSG_ERROR(bad value ${enableval} for --enable-clickhouse) ;;
1030         esac],
1031        [enable_clickhouse=no]
1032)
1033if test "x$enable_clickhouse" = "xyes"; then
1034	PKG_CHECK_MODULES([CURL], [libcurl])
1035	LT_LIB_M
1036fi
1037AM_CONDITIONAL(ENABLE_CLICKHOUSE, test x$enable_clickhouse = xyes)
1038
1039
1040# omhttp support
1041AC_ARG_ENABLE(omhttp,
1042        [AS_HELP_STRING([--enable-omhttp],[Enable http output module @<:@default=no@:>@])],
1043        [case "${enableval}" in
1044         yes) enable_omhttp="yes" ;;
1045          no) enable_omhttp="no" ;;
1046           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omhttp) ;;
1047         esac],
1048        [enable_omhttp=no]
1049)
1050if test "x$enable_omhttp" = "xyes"; then
1051        PKG_CHECK_MODULES([CURL], [libcurl])
1052        LT_LIB_M
1053fi
1054AM_CONDITIONAL(ENABLE_OMHTTP, test x$enable_omhttp = xyes)
1055
1056
1057# capability to enable elasticsearch testbench tests. This requries that an ES test
1058# environment is present on the local (127.0.0.1) machine.
1059# we support a "minimal" mode to take care of travis where we cannot run all tests
1060# due to runtime constraints
1061AC_ARG_ENABLE(elasticsearch_tests,
1062        [AS_HELP_STRING([--enable-elasticsearch-tests],[enable Elasticsearch specific tests in testbench @<:@default=no@:>@])],
1063        [case "${enableval}" in
1064         yes) enable_elasticsearch_tests="yes" ;;
1065          no) enable_elasticsearch_tests="no" ;;
1066         minimal) enable_elasticsearch_tests="minimal" ;;
1067           *) AC_MSG_ERROR(bad value ${enableval} for --enable-elasticsearch-tests) ;;
1068         esac],
1069        [enable_elasticsearch_tests=no]
1070)
1071AM_CONDITIONAL(ENABLE_ELASTICSEARCH_TESTS, test x$enable_elasticsearch_tests = xyes)
1072AM_CONDITIONAL(ENABLE_ELASTICSEARCH_TESTS_MINIMAL, test x$enable_elasticsearch_tests = xminimal -o x$enable_elasticsearch_tests = xyes)
1073
1074
1075# capability to enable clickhouse testbench tests. This requries that a test
1076# environment is present on the local (127.0.0.1) machine.
1077AC_ARG_ENABLE(clickhouse_tests,
1078        [AS_HELP_STRING([--enable-clickhouse-tests],[enable Elasticsearch specific tests in testbench @<:@default=no@:>@])],
1079        [case "${enableval}" in
1080         yes) enable_clickhouse_tests="yes" ;;
1081          no) enable_clickhouse_tests="no" ;;
1082           *) AC_MSG_ERROR(bad value ${enableval} for --enable-clickhouse-tests) ;;
1083         esac],
1084        [enable_clickhouse_tests=no]
1085)
1086AM_CONDITIONAL(ENABLE_CLICKHOUSE_TESTS, test x$enable_clickhouse_tests = xyes)
1087
1088
1089# openssl support
1090AC_ARG_ENABLE(openssl,
1091        [AS_HELP_STRING([--enable-openssl],[Enable openssl support @<:@default=no@:>@])],
1092        [case "${enableval}" in
1093         yes) enable_openssl="yes" ;;
1094          no) enable_openssl="no" ;;
1095           *) AC_MSG_ERROR(bad value ${enableval} for --enable-openssl) ;;
1096         esac],
1097        [enable_openssl=no]
1098)
1099if test "x$enable_openssl" = "xyes"; then
1100	PKG_CHECK_MODULES(OPENSSL, openssl)
1101	AC_DEFINE([ENABLE_OPENSSL], [1], [Indicator that openssl is present])
1102	save_libs=$LIBS
1103fi
1104AM_CONDITIONAL(ENABLE_OPENSSL, test x$enable_openssl = xyes)
1105
1106
1107# GnuTLS support
1108AC_ARG_ENABLE(gnutls,
1109        [AS_HELP_STRING([--enable-gnutls],[Enable GNU TLS support @<:@default=no@:>@])],
1110        [case "${enableval}" in
1111         yes) enable_gnutls="yes" ;;
1112          no) enable_gnutls="no" ;;
1113           *) AC_MSG_ERROR(bad value ${enableval} for --enable-gnutls) ;;
1114         esac],
1115        [enable_gnutls=no]
1116)
1117if test "x$enable_gnutls" = "xyes"; then
1118	PKG_CHECK_MODULES(GNUTLS, gnutls >= 1.4.0)
1119	AC_DEFINE([ENABLE_GNUTLS], [1], [Indicator that GnuTLS is present])
1120	save_libs=$LIBS
1121	LIBS="$LIBS $GNUTLS_LIBS"
1122	AC_CHECK_FUNCS(gnutls_certificate_set_retrieve_function,,)
1123	AC_CHECK_FUNCS(gnutls_certificate_type_set_priority,,)
1124	LIBS=$save_libs
1125fi
1126
1127AM_CONDITIONAL(ENABLE_GNUTLS, test x$enable_gnutls = xyes)
1128
1129AC_ARG_ENABLE(gnutls-tests,
1130        [AS_HELP_STRING([--enable-gnutls-tests],[Enable gnutls tests @<:@default=yes@:>@])],
1131        [case "${enableval}" in
1132         yes) enable_gnutls_tests="yes" ;;
1133          no) enable_gnutls_tests="no" ;;
1134           *) AC_MSG_ERROR(bad value ${enableval} for --enable-gnutls-tests) ;;
1135         esac],
1136        [if [[ "$enable_gnutls" == "yes" ]]; then
1137		enable_gnutls_tests=yes
1138	else
1139		enable_gnutls_tests=no
1140	fi]
1141)
1142if  [[ "$enable_gnutls_tests" == "yes" ]] && [[ "$enable_gnutls" != "yes" ]]; then
1143		AC_MSG_WARN([gnutls-tests can not be enabled without gnutls support. Disabling gnutls tests...])
1144		enable_gnutls_tests="no"
1145fi
1146
1147AM_CONDITIONAL(ENABLE_GNUTLS_TESTS, test x$enable_gnutls_tests = xyes)
1148
1149
1150# libgcrypt support
1151AC_ARG_ENABLE(libgcrypt,
1152        [AS_HELP_STRING([--enable-libgcrypt],[Enable log file encryption support (libgcrypt) @<:@default=yes@:>@])],
1153        [case "${enableval}" in
1154         yes) enable_libgcrypt="yes" ;;
1155          no) enable_libgcrypt="no" ;;
1156           *) AC_MSG_ERROR(bad value ${enableval} for --enable-libgcrypt) ;;
1157         esac],
1158        [enable_libgcrypt=yes]
1159)
1160if test "x$enable_libgcrypt" = "xyes"; then
1161	AC_PATH_PROG([LIBGCRYPT_CONFIG],[libgcrypt-config],[no])
1162        if test "x${LIBGCRYPT_CONFIG}" = "xno"; then
1163           AC_MSG_FAILURE([libgcrypt-config not found in PATH])
1164        fi
1165        AC_CHECK_LIB(
1166		[gcrypt],
1167        	[gcry_cipher_open],
1168        	[LIBGCRYPT_CFLAGS="`${LIBGCRYPT_CONFIG} --cflags`"
1169        	LIBGCRYPT_LIBS="`${LIBGCRYPT_CONFIG} --libs`"
1170        	],
1171        	[AC_MSG_FAILURE([libgcrypt is missing])],
1172        	[`${LIBGCRYPT_CONFIG} --libs --cflags`]
1173        	)
1174	AC_DEFINE([ENABLE_LIBGCRYPT], [1], [Indicator that LIBGCRYPT is present])
1175fi
1176AM_CONDITIONAL(ENABLE_LIBGCRYPT, test x$enable_libgcrypt = xyes)
1177AC_SUBST(LIBGCRYPT_CFLAGS)
1178AC_SUBST(LIBGCRYPT_LIBS)
1179
1180
1181# support for building the rsyslogd runtime
1182AC_ARG_ENABLE(rsyslogrt,
1183        [AS_HELP_STRING([--enable-rsyslogrt],[Build rsyslogrt @<:@default=yes@:>@])],
1184        [case "${enableval}" in
1185         yes) enable_rsyslogrt="yes" ;;
1186          no) enable_rsyslogrt="no" ;;
1187           *) AC_MSG_ERROR(bad value ${enableval} for --enable-rsyslogrt) ;;
1188         esac],
1189        [enable_rsyslogrt=yes]
1190)
1191if test "x$enable_rsyslogrt" = "xyes"; then
1192  RSRT_CFLAGS1="-I\$(top_srcdir)/runtime -I\$(top_srcdir) -I\$(top_srcdir)/grammar"
1193  RSRT_LIBS1="\$(top_builddir)/runtime/librsyslog.la"
1194fi
1195AM_CONDITIONAL(ENABLE_RSYSLOGRT, test x$enable_rsyslogrt = xyes)
1196RSRT_CFLAGS="\$(RSRT_CFLAGS1) \$(LIBESTR_CFLAGS) \$(LIBFASTJSON_CFLAGS) \$(LIBSYSTEMD_CFLAGS)"
1197if test "$GCC" = "yes"; then
1198  RSRT_CFLAGS="$RSRT_CFLAGS -W -Wall -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute"
1199  if $CC -Werror=implicit-function-declaration -x c -c /dev/null -o /dev/null 2>/dev/null; then
1200    RSRT_CFLAGS="$RSRT_CFLAGS -Werror=implicit-function-declaration"
1201  elif $CC -Werror-implicit-function-declaration -x c -c /dev/null -o /dev/null 2>/dev/null; then
1202    RSRT_CFLAGS="$RSRT_CFLAGS -Werror-implicit-function-declaration"
1203  fi
1204
1205  if test "x$enable_debug_symbols" = "xyes"; then
1206    RSRT_CFLAGS="$RSRT_CFLAGS -g"
1207  fi
1208fi
1209RSRT_CFLAGS="$RSRT_CFLAGS $WARN_CFLAGS"
1210RSRT_LIBS="\$(RSRT_LIBS1) \$(LIBESTR_LIBS) \$(LIBFASTJSON_LIBS) \$(LIBSYSTEMD_LIBS)"
1211AC_SUBST(RSRT_CFLAGS1)
1212AC_SUBST(RSRT_LIBS1)
1213AC_SUBST(RSRT_CFLAGS)
1214AC_SUBST(RSRT_LIBS)
1215
1216
1217# support for NOT building rsyslogd (useful for source-based packaging systems)
1218AC_ARG_ENABLE(rsyslogd,
1219        [AS_HELP_STRING([--enable-rsyslogd],[Build rsyslogd @<:@default=yes@:>@])],
1220        [case "${enableval}" in
1221         yes) enable_rsyslogd="yes" ;;
1222          no) enable_rsyslogd="no" ;;
1223           *) AC_MSG_ERROR(bad value ${enableval} for --enable-rsyslogd) ;;
1224         esac],
1225        [enable_rsyslogd=yes]
1226)
1227AM_CONDITIONAL(ENABLE_RSYSLOGD, test x$enable_rsyslogd = xyes)
1228
1229
1230# capability to enable an extended testbench. By default, this is off. The reason
1231# for this switch is that some test simply take too long to execute them on a regular
1232# basis. So we enable to skip them, while the majority of tests can still be used. The
1233# idea is that at least "make distcheck" executes the extended testbench, and also
1234# developers should explicitely enable it after important changes. -- rgerhards, 2010-04-12
1235AC_ARG_ENABLE(extended_tests,
1236        [AS_HELP_STRING([--enable-extended-tests],[extended testbench @<:@default=no@:>@])],
1237        [case "${enableval}" in
1238         yes) enable_extended_tests="yes" ;;
1239          no) enable_extended_tests="no" ;;
1240           *) AC_MSG_ERROR(bad value ${enableval} for --enable-extended-tests) ;;
1241         esac],
1242        [enable_extended_tests=no]
1243)
1244AM_CONDITIONAL(ENABLE_EXTENDED_TESTS, test x$enable_extended_tests = xyes)
1245
1246
1247# capability to enable MySQL testbench tests. This requries that a Syslog database
1248# with the default schema has been created on the local (127.0.0.1) MySQL server and
1249# a user "rsyslog" with password "testbench" exists, is able to login with default
1250# parameters and has sufficient (read: all) privileges on that database.
1251# rgerhards, 2011-03-09
1252AC_ARG_ENABLE(mysql_tests,
1253        [AS_HELP_STRING([--enable-mysql-tests],[enable MySQL specific tests in testbench @<:@default=no@:>@])],
1254        [case "${enableval}" in
1255         yes) enable_mysql_tests="yes" ;;
1256          no) enable_mysql_tests="no" ;;
1257           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mysql-tests) ;;
1258         esac],
1259        [enable_mysql_tests=no]
1260)
1261AM_CONDITIONAL(ENABLE_MYSQL_TESTS, test x$enable_mysql_tests = xyes)
1262
1263
1264# capability to enable PostgreSQL testbench tests. This requries that a Syslog database
1265# with the default schema (see plugins/ompgsql/createDB.sql) has been created on the
1266# local (127.0.0.1) PostgreSQL server and a user "rsyslog" with password "testbench"
1267# exists, is able to login with default parameters and has sufficient (read: all)
1268# privileges on that database
1269AC_ARG_ENABLE(pgsql_tests,
1270        [AS_HELP_STRING([--enable-pgsql-tests],[enable PostgreSQL specific tests in testbench @<:@default=no@:>@])],
1271        [case "${enableval}" in
1272         yes) enable_pgsql_tests="yes" ;;
1273          no) enable_pgsql_tests="no" ;;
1274           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pgsql-tests) ;;
1275         esac],
1276        [enable_pgsql_tests=no]
1277)
1278AM_CONDITIONAL(ENABLE_PGSQL_TESTS, test x$enable_pgsql_tests = xyes)
1279
1280
1281# Mail support (so far we do not need a library, but we need to turn this on and off)
1282AC_ARG_ENABLE(mail,
1283        [AS_HELP_STRING([--enable-mail],[Enable mail support @<:@default=no@:>@])],
1284        [case "${enableval}" in
1285         yes) enable_mail="yes" ;;
1286          no) enable_mail="no" ;;
1287           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mail) ;;
1288         esac],
1289        [enable_mail=no]
1290)
1291AM_CONDITIONAL(ENABLE_MAIL, test x$enable_mail = xyes)
1292
1293
1294AC_ARG_ENABLE(fmhttp,
1295        [AS_HELP_STRING([--enable-fmhttp],[Enable fmhttp @<:@default=yes@:>@])],
1296        [case "${enableval}" in
1297         yes) enable_fmhttp="yes" ;;
1298          no) enable_fmhttp="no" ;;
1299           *) AC_MSG_ERROR(bad value ${enableval} for --enable-fmhttp) ;;
1300         esac],
1301        [enable_fmhttp=yes]
1302)
1303if test "$enable_fmhttp" = "yes"; then
1304        PKG_CHECK_MODULES([CURL], [libcurl])
1305fi
1306AM_CONDITIONAL(ENABLE_FMHTTP, test x$enable_fmhttp = xyes)
1307
1308
1309# imdiag support
1310# This is a core testbench tool. You need to enable it if you want to
1311# use not only a small subset of the testbench.
1312AC_ARG_ENABLE(imdiag,
1313        [AS_HELP_STRING([--enable-imdiag],[Enable imdiag @<:@default=no@:>@])],
1314        [case "${enableval}" in
1315         yes) enable_imdiag="yes" ;;
1316          no) enable_imdiag="no" ;;
1317           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imdiag) ;;
1318         esac],
1319        [enable_imdiag=no]
1320)
1321if test "x$enable_imdiag" = "xyes"; then
1322	AC_DEFINE([ENABLE_IMDIAG], [1], [Indicator that IMDIAG is present])
1323fi
1324AM_CONDITIONAL(ENABLE_IMDIAG, test x$enable_imdiag = xyes)
1325
1326
1327# mmnormalize
1328AC_ARG_ENABLE(mmnormalize,
1329        [AS_HELP_STRING([--enable-mmnormalize],[Enable building mmnormalize support @<:@default=no@:>@])],
1330        [case "${enableval}" in
1331         yes) enable_mmnormalize="yes" ;;
1332          no) enable_mmnormalize="no" ;;
1333           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmnormalize) ;;
1334         esac],
1335        [enable_mmnormalize=no]
1336)
1337if test "x$enable_mmnormalize" = "xyes"; then
1338	PKG_CHECK_MODULES(LIBLOGNORM, lognorm >= 2.0.3)
1339
1340	save_CFLAGS="$CFLAGS"
1341	save_LIBS="$LIBS"
1342
1343	CFLAGS="$CFLAGS $LIBLOGNORM_CFLAGS"
1344	LIBS="$LIBS $LIBLOGNORM_LIBS"
1345
1346	AX_CHECK_DEFINED([[#include <lognorm-features.h>]],LOGNORM_REGEX_SUPPORTED,[lognorm_regex_supported="yes"],)
1347
1348	CFLAGS="$save_CFLAGS"
1349	LIBS="$save_LIBS"
1350fi
1351AM_CONDITIONAL(LOGNORM_REGEX_SUPPORTED, test x$lognorm_regex_supported = xyes)
1352AM_CONDITIONAL(ENABLE_MMNORMALIZE, test x$enable_mmnormalize = xyes)
1353
1354# mmnjsonparse
1355AC_ARG_ENABLE(mmjsonparse,
1356        [AS_HELP_STRING([--enable-mmjsonparse],[Enable building mmjsonparse support @<:@default=no@:>@])],
1357        [case "${enableval}" in
1358         yes) enable_mmjsonparse="yes" ;;
1359          no) enable_mmjsonparse="no" ;;
1360           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmjsonparse) ;;
1361         esac],
1362        [enable_mmjsonparse=no]
1363)
1364AM_CONDITIONAL(ENABLE_MMJSONPARSE, test x$enable_mmjsonparse = xyes)
1365
1366# mmgrok
1367AC_ARG_ENABLE(mmgrok,
1368        [AS_HELP_STRING([--enable-mmgrok],[Enable building mmgrok support @<:@default=no@:>@])],
1369        [case "${enableval}" in
1370         yes) enable_mmgrok="yes" ;;
1371          no) enable_mmgrok="no" ;;
1372           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmgrok) ;;
1373        esac],
1374        [enable_mmgrok=no]
1375)
1376if test "x$enable_mmgrok" = "xyes"; then
1377        AC_CHECK_HEADERS([grok.h])
1378	GLIB_CFLAGS="$(pkg-config --cflags glib-2.0)"
1379	GLIB_LIBS="$(pkg-config --libs glib-2.0)"
1380fi
1381AM_CONDITIONAL(ENABLE_MMGROK, test x$enable_mmgrok = xyes)
1382AC_SUBST(GLIB_CFLAGS)
1383AC_SUBST(GLIB_LIBS)
1384
1385# mmaudit
1386AC_ARG_ENABLE(mmaudit,
1387        [AS_HELP_STRING([--enable-mmaudit],[Enable building mmaudit support @<:@default=no@:>@])],
1388        [case "${enableval}" in
1389         yes) enable_mmaudit="yes" ;;
1390          no) enable_mmaudit="no" ;;
1391           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmaudit) ;;
1392         esac],
1393        [enable_mmaudit=no]
1394)
1395AM_CONDITIONAL(ENABLE_MMAUDIT, test x$enable_mmaudit = xyes)
1396
1397
1398# mmanon
1399AC_ARG_ENABLE(mmanon,
1400        [AS_HELP_STRING([--enable-mmanon],[Enable building mmanon support @<:@default=no@:>@])],
1401        [case "${enableval}" in
1402         yes) enable_mmanon="yes" ;;
1403          no) enable_mmanon="no" ;;
1404           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmanon) ;;
1405         esac],
1406        [enable_mmanon=no]
1407)
1408AM_CONDITIONAL(ENABLE_MMANON, test x$enable_mmanon = xyes)
1409
1410
1411# mmrm1stspace
1412AC_ARG_ENABLE(mmrm1stspace,
1413        [AS_HELP_STRING([--enable-mmrm1stspace],[Enable building mmrm1stspace support @<:@default=no@:>@])],
1414        [case "${enableval}" in
1415         yes) enable_mmrm1stspace="yes" ;;
1416          no) enable_mmrm1stspace="no" ;;
1417           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmrm1stspace) ;;
1418         esac],
1419        [enable_mmrm1stspace=no]
1420)
1421AM_CONDITIONAL(ENABLE_MMRM1STSPACE, test x$enable_mmrm1stspace = xyes)
1422
1423
1424# mmutf8fix
1425AC_ARG_ENABLE(mmutf8fix,
1426        [AS_HELP_STRING([--enable-mmutf8fix],[Enable building mmutf8fix support @<:@default=no@:>@])],
1427        [case "${enableval}" in
1428         yes) enable_mmutf8fix="yes" ;;
1429          no) enable_mmutf8fix="no" ;;
1430           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmutf8fix) ;;
1431         esac],
1432        [enable_mmutf8fix=no]
1433)
1434AM_CONDITIONAL(ENABLE_MMUTF8FIX, test x$enable_mmutf8fix = xyes)
1435
1436
1437# mmcount
1438AC_ARG_ENABLE(mmcount,
1439        [AS_HELP_STRING([--enable-mmcount],[Enable message counting @<:@default=no@:>@])],
1440        [case "${enableval}" in
1441         yes) enable_mmcount="yes" ;;
1442          no) enable_mmcount="no" ;;
1443           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmcount) ;;
1444         esac],
1445        [enable_mmcount=no]
1446)
1447AM_CONDITIONAL(ENABLE_MMCOUNT, test x$enable_mmcount = xyes)
1448
1449
1450# mmsequence
1451AC_ARG_ENABLE(mmsequence,
1452        [AS_HELP_STRING([--enable-mmsequence],[Enable sequence generator @<:@default=no@:>@])],
1453        [case "${enableval}" in
1454         yes) enable_mmsequence="yes" ;;
1455          no) enable_mmsequence="no" ;;
1456           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmsequence) ;;
1457         esac],
1458        [enable_mmsequence=no]
1459)
1460AM_CONDITIONAL(ENABLE_MMSEQUENCE, test x$enable_mmsequence = xyes)
1461
1462
1463
1464# mmdblookup
1465AC_ARG_ENABLE(mmdblookup,
1466        [AS_HELP_STRING([--enable-mmdblookup],[Enable mmdb lookup helper @<:@default=no@:>@])],
1467        [case "${enableval}" in
1468         yes) enable_mmdblookup="yes" ;;
1469          no) enable_mmdblookup="no" ;;
1470         optional) enable_mmdblookup="optional" ;;
1471           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmdblookup) ;;
1472         esac],
1473        [enable_mmdblookup=no]
1474)
1475AM_CONDITIONAL(ENABLE_MMDBLOOKUP, test x$enable_mmdblookup = xyes -o x$enable_mmdblookup = xoptional)
1476mmdblookup_use_dummy="no"
1477if test x$enable_mmdblookup = xoptional -o x$enable_mmdblookup = xyes; then
1478        #PKG_CHECK_MODULES(LIBMAXMINDDB, libmaxminddb) -- does not work - later?
1479        AC_CHECK_HEADERS([maxminddb.h], [
1480	], [
1481		AS_IF([test x$enable_mmdblookup = xyes],
1482			AC_MSG_ERROR(libmaxminddb library for mmdblookup could not be found)
1483		)
1484		mmdblookup_use_dummy="yes"
1485		AC_DEFINE([ENABLE_MMBDLOOKUP_DUMMY], [1], [Indicator that we need to build a dummy module])
1486	])
1487fi
1488AM_CONDITIONAL(MMDBLOOKUP_USE_DUMMY, test x$mmdblookup_use_dummy = xyes)
1489
1490
1491# mmdarwin
1492AC_ARG_ENABLE(mmdarwin,
1493        [AS_HELP_STRING([--enable-mmdarwin],[Enable mmdb lookup helper @<:@default=no@:>@])],
1494        [case "${enableval}" in
1495         yes) enable_mmdarwin="yes" ;;
1496          no) enable_mmdarwin="no" ;;
1497           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmdarwin) ;;
1498         esac],
1499        [enable_mmdarwin=no]
1500)
1501if test "x$enable_mmdarwin"; then
1502        AC_CHECK_HEADERS([protocol.h])
1503fi
1504AM_CONDITIONAL(ENABLE_MMDARWIN, test x$enable_mmdarwin = xyes)
1505
1506
1507
1508
1509# mmfields
1510AC_ARG_ENABLE(mmfields,
1511        [AS_HELP_STRING([--enable-mmfields],[Enable building mmfields support @<:@default=no@:>@])],
1512        [case "${enableval}" in
1513         yes) enable_mmfields="yes" ;;
1514          no) enable_mmfields="no" ;;
1515           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmfields) ;;
1516         esac],
1517        [enable_mmfields=no]
1518)
1519AM_CONDITIONAL(ENABLE_MMFIELDS, test x$enable_mmfields = xyes)
1520
1521# mmpstrucdata
1522AC_ARG_ENABLE(mmpstrucdata,
1523        [AS_HELP_STRING([--enable-mmpstrucdata],[Enable building mmpstrucdata support @<:@default=no@:>@])],
1524        [case "${enableval}" in
1525         yes) enable_mmpstrucdata="yes" ;;
1526          no) enable_mmpstrucdata="no" ;;
1527           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmpstrucdata) ;;
1528         esac],
1529        [enable_mmpstrucdata=no]
1530)
1531AM_CONDITIONAL(ENABLE_MMPSTRUCDATA, test x$enable_mmpstrucdata = xyes)
1532
1533
1534# mmrfc5424addhmac
1535AC_ARG_ENABLE(mmrfc5424addhmac,
1536        [AS_HELP_STRING([--enable-mmrfc5424addhmac],[Enable building mmrfc5424addhmac support @<:@default=no@:>@])],
1537        [case "${enableval}" in
1538         yes) enable_mmrfc5424addhmac="yes" ;;
1539          no) enable_mmrfc5424addhmac="no" ;;
1540           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmrfc5424addhmac) ;;
1541         esac],
1542        [enable_mmrfc5424addhmac=no]
1543)
1544if test "x$enable_mmrfc5424addhmac" = "xyes"; then
1545	PKG_CHECK_MODULES(OPENSSL, openssl >= 0.9.7)
1546#AC_CHECK_LIB([crypto],[CRYPTO_new_ex_data], [], [AC_MSG_ERROR([OpenSSL libraries required])])
1547#AC_CHECK_LIB([ssl],[SSL_library_init], [], [AC_MSG_ERROR([OpenSSL libraries required])])
1548#AC_CHECK_HEADERS([openssl/crypto.h openssl/x509.h openssl/pem.h openssl/ssl.h openssl/err.h],[],[AC_MSG_ERROR([OpenSSL headers required])])
1549fi
1550AM_CONDITIONAL(ENABLE_MMRFC5424ADDHMAC, test x$enable_mmrfc5424addhmac = xyes)
1551
1552
1553# experimental omfile-hardened module
1554AC_ARG_ENABLE(omfile-hardened,
1555        [AS_HELP_STRING([--enable-omfile-hardened],[Enable omfile-hardened support @<:@default=no@:>@])],
1556        [case "${enableval}" in
1557         yes) enable_omfile_hardened="yes" ;;
1558          no) enable_omfile_hardened="no" ;;
1559           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omfile-hardened) ;;
1560         esac],
1561        [enable_omfile_hardened=no]
1562)
1563AM_CONDITIONAL(ENABLE_OMFILE_HARDENED, test x$enable_omfile_hardened = xyes)
1564
1565
1566# RELP support
1567AC_ARG_ENABLE(relp,
1568        [AS_HELP_STRING([--enable-relp],[Enable RELP support @<:@default=no@:>@])],
1569        [case "${enableval}" in
1570         yes) enable_relp="yes" ;;
1571          no) enable_relp="no" ;;
1572           *) AC_MSG_ERROR(bad value ${enableval} for --enable-relp) ;;
1573         esac],
1574        [enable_relp=no]
1575)
1576if test "x$enable_relp" = "xyes"; then
1577	PKG_CHECK_MODULES(RELP, relp >= 1.2.14)
1578	AC_DEFINE([ENABLE_RELP], [1], [Indicator that RELP is present])
1579        save_CFLAGS="$CFLAGS"
1580        save_LIBS="$LIBS"
1581
1582        CFLAGS="$CFLAGS $RELP_CFLAGS"
1583        LIBS="$LIBS $RELP_LIBS"
1584	# Export RELP Version for testbench tools
1585	RELP_VERSION="$(pkg-config --modversion relp)"
1586	AC_DEFINE_UNQUOTED([RELP_VERSION], "${RELP_VERSION}", [Define version of librelp used.])
1587
1588        AC_CHECK_FUNC([relpSrvSetOversizeMode],
1589                      [AC_DEFINE([HAVE_RELPSRVSETOVERSIZEMODE], [1], [Define if relpSrvSetOversizeMode exists.])])
1590        AC_CHECK_FUNC([relpSrvSetLstnAddr],
1591                      [AC_DEFINE([HAVE_RELPSRVSETLSTNADDR], [1], [Define if relpSrvSetLstnAddr exists.])])
1592        AC_CHECK_FUNC([relpEngineSetTLSLibByName],
1593                      [AC_DEFINE([HAVE_RELPENGINESETTLSLIBBYNAME], [1], [Define if relpEngineSetTLSLibByName exists.])])
1594        AC_CHECK_FUNC([relpSrvSetTlsConfigCmd],
1595                      [AC_DEFINE([HAVE_RELPENGINESETTLSCFGCMD], [1], [Define if relpSrvSetTlsConfigCmd exists.])])
1596        AC_CHECK_FUNC([relpSrvSetTlsConfigCmd],
1597                      [HAVE_RELPENGINESETTLSCFGCMD=1])
1598
1599        CFLAGS="$save_CFLAGS"
1600        LIBS="$save_LIBS"
1601fi
1602AM_CONDITIONAL(ENABLE_RELP, test x$enable_relp = xyes)
1603AM_CONDITIONAL([USE_RELPENGINESETTLSCFGCMD], [test "x$HAVE_RELPENGINESETTLSCFGCMD" = x1])
1604
1605# RELP default port
1606AC_ARG_ENABLE(omrelp-default-port,
1607        [AS_HELP_STRING([--enable-omrelp-default-port],[set omrelp default port @<:@default=514@:>@])],
1608	[ AC_DEFINE_UNQUOTED(RELP_DFLT_PT, "${enableval}", [default port for omrelp]) ],
1609	[ AC_DEFINE(RELP_DFLT_PT, "514", [default port for omrelp]) ]
1610)
1611
1612
1613
1614# GuardTime KSI LOGSIG 12 support
1615AC_ARG_ENABLE(ksi-ls12,
1616        [AS_HELP_STRING([--enable-ksi-ls12],[Enable log file signing support via GuardTime KSI LS12 @<:@default=no@:>@])],
1617        [case "${enableval}" in
1618         yes) enable_ksi_ls12="yes" ;;
1619          no) enable_ksi_ls12="no" ;;
1620           *) AC_MSG_ERROR(bad value ${enableval} for --enable-ksi-ls12) ;;
1621         esac],
1622        [enable_ksi_ls12=no]
1623)
1624if test "x$enable_ksi_ls12" = "xyes"; then
1625	PKG_CHECK_MODULES(GT_KSI_LS12, libksi >= 3.19.0)
1626fi
1627AM_CONDITIONAL(ENABLE_KSI_LS12, test x$enable_ksi_ls12 = xyes)
1628
1629# liblogging-stdlog support
1630# we use liblogging-stdlog inside the testbench, which is why we need to check for it in any case
1631PKG_CHECK_MODULES(LIBLOGGING_STDLOG, liblogging-stdlog >= 1.0.3,
1632        [AC_DEFINE(HAVE_LIBLOGGING_STDLOG, 1, [Define to 1 if liblogging-stdlog is available.])
1633        found_liblogging_stdlog="yes"],
1634        [AC_MSG_NOTICE([liblogging-stdlog not found, parts of the testbench will not run])]
1635)
1636
1637AC_ARG_ENABLE(liblogging-stdlog,
1638        [AS_HELP_STRING([--enable-liblogging-stdlog],[Enable liblogging-stdlog support @<:@default=no@:>@])],
1639        [case "${enableval}" in
1640         yes) enable_liblogging_stdlog="yes" ;;
1641          no) enable_liblogging_stdlog="no" ;;
1642           *) AC_MSG_ERROR(bad value ${enableval} for --enable-liblogging-stdlog) ;;
1643         esac],
1644        [enable_liblogging_stdlog=no]
1645)
1646if test "x$enable_liblogging_stdlog" = "xyes" -a "x$found_liblogging_stdlog" != "xyes"; then
1647	AC_MSG_ERROR(--enable-liblogging-stdlog set but liblogging-stdlog was not found)
1648fi
1649AM_CONDITIONAL(ENABLE_LIBLOGGING_STDLOG, [test "x$enable_liblogging_stdlog" = "xyes"])
1650
1651# RFC 3195 support
1652AC_ARG_ENABLE(rfc3195,
1653        [AS_HELP_STRING([--enable-rfc3195],[Enable RFC3195 support @<:@default=no@:>@])],
1654        [case "${enableval}" in
1655         yes) enable_rfc3195="yes" ;;
1656          no) enable_rfc3195="no" ;;
1657           *) AC_MSG_ERROR(bad value ${enableval} for --enable-rfc3195) ;;
1658         esac],
1659        [enable_rfc3195=no]
1660)
1661if test "x$enable_rfc3195" = "xyes"; then
1662	PKG_CHECK_MODULES(LIBLOGGING, liblogging-rfc3195 >= 1.0.1)
1663fi
1664AM_CONDITIONAL(ENABLE_RFC3195, test x$enable_rfc3195 = xyes)
1665
1666
1667# enable/disable the testbench (e.g. because some important parts
1668# are missing)
1669AC_ARG_ENABLE(testbench,
1670        [AS_HELP_STRING([--enable-testbench],[testbench enabled @<:@default=no@:>@])],
1671        [case "${enableval}" in
1672         yes) enable_testbench="yes" ;;
1673          no) enable_testbench="no" ;;
1674           *) AC_MSG_ERROR(bad value ${enableval} for --enable-testbench) ;;
1675         esac],
1676        [enable_testbench=no]
1677)
1678
1679# Add a capability to turn off libfaketime tests. Unfortunately, libfaketime
1680# becomes more and more problematic in newer versions and causes aborts
1681# on some platforms. This provides the ability to turn it off. In the
1682# longer term, we should consider writing our own replacement.
1683AC_ARG_ENABLE(libfaketime,
1684        [AS_HELP_STRING([--enable-libfaketime],[libfaketime enabled @<:@default=no@:>@])],
1685        [case "${enableval}" in
1686         yes) enable_libfaketime="yes" ;;
1687          no) enable_libfaketime="no" ;;
1688           *) AC_MSG_ERROR(bad value ${enableval} for --enable-libfaketime) ;;
1689         esac],
1690        [enable_libfaketime=no]
1691)
1692AM_CONDITIONAL(ENABLE_LIBFAKETIME, test "x${enable_libfaketime}" = "xyes")
1693
1694# this permits to control the "default tests" in testbench runs. These
1695# are those tests that do not need a special configure option. There are
1696# some situations where we really want to turn them of so that we can
1697# run tests only for a specific component (e.g. ElasticSearch).
1698# This also enables us to do some parallel testing even while the
1699# testbench is not yet able to support make -j check
1700AC_ARG_ENABLE(default-tests,
1701        [AS_HELP_STRING([--enable-default-tests],[default-tests enabled @<:@default=yes@:>@])],
1702        [case "${enableval}" in
1703         yes) enable_default_tests="yes" ;;
1704          no) enable_default_tests="no" ;;
1705           *) AC_MSG_ERROR(bad value ${enableval} for --enable-default-tests) ;;
1706         esac],
1707        [enable_default_tests=yes]
1708)
1709AM_CONDITIONAL(ENABLE_DEFAULT_TESTS, test "x${enable_default_tests}" = "xyes")
1710
1711AC_CHECK_PROG(IP, [ip], [yes], [no])
1712if test "x${IP}" = "xno"; then
1713	AC_MSG_NOTICE([Will not check network namespace functionality as 'ip' (part of iproute2) is not available.])
1714fi
1715AM_CONDITIONAL(ENABLE_IP, test "x${IP}" = "xyes")
1716
1717
1718# valgrind-testbench
1719AC_ARG_WITH([valgrind_testbench],
1720        [AS_HELP_STRING([--without-valgrind-testbench], [Don't use valgrind in testbench])]
1721)
1722
1723if test "x$with_valgrind_testbench" != "xno"; then
1724        AC_CHECK_PROG(VALGRIND, [valgrind], [valgrind], [no])
1725
1726        if test "x$enable_testbench" = "xyes" && test "x$VALGRIND" = "xno"; then
1727                if test "x$with_valgrind_testbench" = "xyes"; then
1728                        AC_MSG_ERROR([valgrind is missing but forced with --with-valgrind-testbench. Either install valgrind or remove the option!])
1729                else
1730                        AC_MSG_WARN([valgrind is missing -- testbench won't use valgrind!])
1731                fi
1732        else
1733                AC_MSG_NOTICE([testbench will use valgrind])
1734        fi
1735else
1736	AC_MSG_NOTICE([testbench won't use valgrind due to set --without-valgrind-testbench option])
1737fi
1738AM_CONDITIONAL([HAVE_VALGRIND], [test "x$with_valgrind_testbench" != "xno" && test "x$VALGRIND" != "xno"])
1739
1740# ability to disable helgrind tests - we at least need this for
1741# clang coverage reports, where we cannot suppress the races
1742AC_ARG_ENABLE(helgrind,
1743        [AS_HELP_STRING([--enable-helgrind],[valgrind helgrind enabled @<:@default=yes@:>@])],
1744        [case "${enableval}" in
1745         yes) enable_helgrind="yes" ;;
1746          no) enable_helgrind="no" ;;
1747           *) AC_MSG_ERROR(bad value ${enableval} for --enable-helgrind) ;;
1748         esac],
1749        [enable_helgrind=yes]
1750)
1751AM_CONDITIONAL(ENABLE_HELGRIND, test x$enable_helgrind = xyes)
1752
1753# settings for the batch report input module
1754AC_ARG_ENABLE(imbatchreport,
1755        [AS_HELP_STRING([--enable-imbatchreport],[batch report input module enabled @<:@default=no@:>@])],
1756        [case "${enableval}" in
1757         yes) enable_imbatchreport="yes" ;;
1758          no) enable_imbatchreport="no" ;;
1759           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imbatchreport) ;;
1760         esac],
1761        [enable_imbatchreport=no]
1762)
1763AM_CONDITIONAL(ENABLE_IMBATCHREPORT, test x$enable_imbatchreport = xyes)
1764
1765# settings for the db2diag parser module
1766AC_ARG_ENABLE(pmdb2diag,
1767        [AS_HELP_STRING([--enable-pmdb2diag],[db2diag parser module enabled @<:@default=no@:>@])],
1768        [case "${enableval}" in
1769         yes) enable_pmdb2diag="yes" ;;
1770          no) enable_pmdb2diag="no" ;;
1771           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmdb2diag) ;;
1772         esac],
1773        [enable_pmdb2diag=no]
1774)
1775AM_CONDITIONAL(ENABLE_PMDB2DIAG, test x$enable_pmdb2diag = xyes)
1776
1777# settings for the file input module
1778AC_ARG_ENABLE(imfile,
1779        [AS_HELP_STRING([--enable-imfile],[file input module enabled @<:@default=no@:>@])],
1780        [case "${enableval}" in
1781         yes) enable_imfile="yes" ;;
1782          no) enable_imfile="no" ;;
1783           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imfile) ;;
1784         esac],
1785        [enable_imfile=no]
1786)
1787if test "x$enable_imfile" = "xyes"; then
1788	AC_CHECK_FUNCS(port_create,,)
1789	AC_MSG_CHECKING(for Solaris File Events Notification API support)
1790	AC_TRY_COMPILE([
1791		#include <port.h>
1792		#include <sys/port.h>
1793		], [
1794		return PORT_SOURCE_FILE;
1795		]
1796		,
1797		AC_DEFINE(HAVE_PORT_SOURCE_FILE, 1, [Enable FEN support for imfile])
1798		AC_MSG_RESULT(yes)
1799		,
1800		AC_MSG_RESULT(no)
1801	)
1802fi
1803AM_CONDITIONAL(ENABLE_IMFILE, test x$enable_imfile = xyes)
1804
1805AC_ARG_ENABLE(imfile-tests,
1806        [AS_HELP_STRING([--enable-imfile-tests],[Enable imfile tests @<:@default=yes@:>@])],
1807        [case "${enableval}" in
1808         yes) enable_imfile_tests="yes" ;;
1809          no) enable_imfile_tests="no" ;;
1810           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imfile-tests) ;;
1811         esac],
1812        [enable_imfile_tests=yes]
1813)
1814if  [[ "$enable_imfile_tests" == "yes" ]] && [[ "$enable_imfile" != "yes" ]]; then
1815		AC_MSG_WARN([imfile-tests can not be enabled without imfile support. Disabling imfile tests...])
1816		enable_imfile_tests="no"
1817fi
1818AM_CONDITIONAL(ENABLE_IMFILE_TESTS, test x$enable_imfile_tests = xyes)
1819
1820
1821# settings for the docker log input module
1822AC_ARG_ENABLE(imdocker,
1823        [AS_HELP_STRING([--enable-imdocker],[input docker module enabled @<:@default=no@:>@])],
1824        [case "${enableval}" in
1825         yes) enable_imdocker="yes" ;;
1826          no) enable_imdocker="no" ;;
1827           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imdocker) ;;
1828         esac],
1829        [enable_imdocker=no]
1830)
1831if test "x$enable_imdocker" = "xyes"; then
1832	AC_CHECK_HEADERS([curl/curl.h])
1833	PKG_CHECK_MODULES([CURL], [libcurl >= 7.40.0])
1834fi
1835AM_CONDITIONAL(ENABLE_IMDOCKER, test x$enable_imdocker = xyes)
1836
1837AC_ARG_ENABLE(imdocker-tests,
1838        [AS_HELP_STRING([--enable-imdocker-tests],[Enable imdocker tests @<:@default=no@:>@])],
1839        [case "${enableval}" in
1840         yes) enable_imdocker_tests="yes" ;;
1841          no) enable_imdocker_tests="no" ;;
1842           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imdocker-tests) ;;
1843         esac],
1844        [enable_imdocker_tests=no]
1845)
1846
1847AM_CONDITIONAL(ENABLE_IMDOCKER_TESTS, test x$enable_imdocker_tests = xyes)
1848
1849
1850# settings for the tuxedo ULOG input module
1851AC_ARG_ENABLE(imtuxedoulog,
1852        [AS_HELP_STRING([--enable-imtuxedoulog],[tuxedo ULOG input module enabled @<:@default=no@:>@])],
1853        [case "${enableval}" in
1854         yes) enable_imtuxedoulog="yes" ;;
1855          no) enable_imtuxedoulog="no" ;;
1856           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imtuxedoulog) ;;
1857         esac],
1858        [enable_imtuxedoulog=no]
1859)
1860AM_CONDITIONAL(ENABLE_IMTUXEDOULOG, test x$enable_imtuxedoulog = xyes)
1861
1862# settings for the external program input module
1863AC_ARG_ENABLE(improg,
1864        [AS_HELP_STRING([--enable-improg],[external program input module enabled @<:@default=no@:>@])],
1865        [case "${enableval}" in
1866         yes) enable_improg="yes" ;;
1867          no) enable_improg="no" ;;
1868           *) AC_MSG_ERROR(bad value ${enableval} for --enable-improg) ;;
1869         esac],
1870        [enable_improg=no]
1871)
1872AM_CONDITIONAL(ENABLE_IMPROG, test x$enable_improg = xyes)
1873
1874# settings for the external http input module
1875AC_ARG_ENABLE(imhttp,
1876        [AS_HELP_STRING([--enable-imhttp],[external http input module enabled @<:@default=no@:>@])],
1877        [case "${enableval}" in
1878         yes) enable_imhttp="yes" ;;
1879          no) enable_imhttp="no" ;;
1880           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imhttp) ;;
1881         esac],
1882        [enable_imhttp=no]
1883)
1884if test "x$enable_imhttp" = "xyes"; then
1885  AC_CHECK_HEADERS(
1886    [civetweb.h],,
1887    [AC_MSG_FAILURE([civetweb is missing])]
1888  )
1889  AC_SEARCH_LIBS(mg_version, civetweb)
1890
1891  PKG_CHECK_MODULES(APU, apr-util-1 >= 1.0)
1892  save_CFLAGS="$CFLAGS"
1893  save_LIBS="$LIBS"
1894
1895  CFLAGS="$CFLAGS $APU_CFLAGS"
1896  LIBS="$LIBS $APU_LIBS"
1897
1898  AC_CHECK_HEADERS([apr_md5.h])
1899  AC_CHECK_HEADERS([apr_base64.h])
1900  AC_SEARCH_LIBS(apr_base64_decode, aprutil-1)
1901  AC_SEARCH_LIBS(apr_password_validate, aprutil-1)
1902
1903  CIVETWEB_LIBS=-lcivetweb
1904  AC_SUBST(CIVETWEB_LIBS)
1905
1906  CFLAGS="$save_CFLAGS"
1907  LIBS="$save_LIBS"
1908fi
1909AM_CONDITIONAL(ENABLE_IMHTTP, test x$enable_imhttp = xyes)
1910
1911# settings for the door input module (under solaris, thus default off)
1912AC_ARG_ENABLE(imsolaris,
1913        [AS_HELP_STRING([--enable-imsolaris],[solaris input module enabled @<:@default=no@:>@])],
1914        [case "${enableval}" in
1915         yes) enable_imsolaris="yes" ;;
1916          no) enable_imsolaris="no" ;;
1917           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imsolaris) ;;
1918         esac],
1919        [enable_imsolaris=no]
1920)
1921AM_CONDITIONAL(ENABLE_IMSOLARIS, test x$enable_imsolaris = xyes)
1922
1923# settings for the ptcp input module
1924AC_ARG_ENABLE(imptcp,
1925        [AS_HELP_STRING([--enable-imptcp],[plain tcp input module enabled @<:@default=no@:>@])],
1926        [case "${enableval}" in
1927         yes) enable_imptcp="yes" ;;
1928          no) enable_imptcp="no" ;;
1929           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imptcp) ;;
1930         esac],
1931        [enable_imptcp=no]
1932)
1933AM_CONDITIONAL(ENABLE_IMPTCP, test x$enable_imptcp = xyes)
1934
1935
1936# settings for the pstats input module
1937AC_ARG_ENABLE(impstats,
1938        [AS_HELP_STRING([--enable-impstats],[periodic statistics module enabled @<:@default=no@:>@])],
1939        [case "${enableval}" in
1940         yes) enable_impstats="yes" ;;
1941          no) enable_impstats="no" ;;
1942           *) AC_MSG_ERROR(bad value ${enableval} for --enable-impstats) ;;
1943         esac],
1944        [enable_impstats=no]
1945)
1946AM_CONDITIONAL(ENABLE_IMPSTATS, test x$enable_impstats = xyes)
1947
1948# settings for the pcap input module
1949AC_ARG_ENABLE(impcap,
1950        [AS_HELP_STRING([--enable-impcap],[libpcap input module enabled @<:@default=no@:>@])],
1951        [case "${enableval}" in
1952         yes) enable_impcap="yes" ;;
1953          no) enable_impcap="no" ;;
1954           *) AC_MSG_ERROR(bad value ${enableval} for --enable-impcap) ;;
1955         esac],
1956        [enable_impcap=no]
1957)
1958
1959if test "x$enable_impcap" = "xyes"; then
1960				AC_CHECK_HEADERS([pcap.h],
1961				[AC_MSG_NOTICE([pcap found])],
1962				AC_MSG_ERROR([libpcap library and headers not found])
1963				)
1964fi
1965AM_CONDITIONAL(ENABLE_IMPCAP, test x$enable_impcap = xyes)
1966
1967# settings for the omprog output module
1968AC_ARG_ENABLE(omprog,
1969        [AS_HELP_STRING([--enable-omprog],[Compiles omprog module @<:@default=no@:>@])],
1970        [case "${enableval}" in
1971         yes) enable_omprog="yes" ;;
1972          no) enable_omprog="no" ;;
1973           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omprog) ;;
1974         esac],
1975        [enable_omprog=no]
1976)
1977AM_CONDITIONAL(ENABLE_OMPROG, test x$enable_omprog = xyes)
1978
1979
1980# settings for omudpspoof
1981AC_ARG_ENABLE(omudpspoof,
1982        [AS_HELP_STRING([--enable-omudpspoof],[Compiles omudpspoof module @<:@default=no@:>@])],
1983        [case "${enableval}" in
1984         yes) enable_omudpspoof="yes" ;;
1985          no) enable_omudpspoof="no" ;;
1986           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omudpspoof) ;;
1987         esac],
1988        [enable_omudpspoof=no]
1989)
1990
1991if test "x$enable_omudpspoof" = "xyes"; then
1992  AC_CHECK_HEADERS(
1993    [libnet.h],,
1994    [AC_MSG_FAILURE([libnet is missing])]
1995  )
1996  AC_CHECK_LIB(
1997    [net],
1998    [libnet_init],
1999    [UDPSPOOF_CFLAGS=""
2000     UDPSPOOF_LIBS="-lnet"
2001    ],
2002    [AC_MSG_FAILURE([libnet is missing])]
2003  )
2004fi
2005AM_CONDITIONAL(ENABLE_OMUDPSPOOF, test x$enable_omudpspoof = xyes)
2006AC_SUBST(UDPSPOOF_CFLAGS)
2007AC_SUBST(UDPSPOOF_LIBS)
2008
2009
2010# settings for omstdout
2011AC_ARG_ENABLE(omstdout,
2012        [AS_HELP_STRING([--enable-omstdout],[Compiles stdout module @<:@default=no@:>@])],
2013        [case "${enableval}" in
2014         yes) enable_omstdout="yes" ;;
2015          no) enable_omstdout="no" ;;
2016           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omstdout) ;;
2017         esac],
2018        [enable_omstdout=no]
2019)
2020AM_CONDITIONAL(ENABLE_OMSTDOUT, test x$enable_omstdout = xyes)
2021
2022AM_CONDITIONAL(ENABLE_TESTBENCH, test x$enable_testbench = xyes)
2023if test "x$enable_testbench" = "xyes"; then
2024	if test "x$enable_imdiag" != "xyes"; then
2025		AC_MSG_ERROR("--enable-testbench requires --enable-imdiag")
2026	fi
2027	if test "x$enable_omstdout" != "xyes"; then
2028		AC_MSG_ERROR("--enable-testbench requires --enable-omstdout")
2029	fi
2030fi
2031
2032
2033# settings for omjournal
2034AC_ARG_ENABLE(omjournal,
2035        [AS_HELP_STRING([--enable-omjournal],[Compiles omjournal @<:@default=no@:>@])],
2036        [case "${enableval}" in
2037         yes) enable_omjournal="yes" ;;
2038          no) enable_omjournal="no" ;;
2039           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omjournal) ;;
2040         esac],
2041        [enable_omjournal=no]
2042)
2043if test "x$enable_omjournal" = "xyes"; then
2044	PKG_CHECK_MODULES([LIBSYSTEMD_JOURNAL], [libsystemd >= 209] ,, [
2045	    PKG_CHECK_MODULES([LIBSYSTEMD_JOURNAL], [libsystemd-journal >= 197])
2046	])
2047fi
2048AM_CONDITIONAL(ENABLE_OMJOURNAL, test x$enable_omjournal = xyes)
2049
2050# capability to enable journal testbench tests. They have very special requirements,
2051# so it does not make sense to have them run by default.
2052# Also note that as of now, they have a pretty high rate of false positives due
2053# to bugs in the journal.
2054# see also https://github.com/rsyslog/rsyslog/issues/2931#issuecomment-416914707
2055AC_ARG_ENABLE(journal_tests,
2056        [AS_HELP_STRING([--enable-journal-tests],[enable systemd journal specific tests in testbench @<:@default=no@:>@])],
2057        [case "${enableval}" in
2058         yes) enable_journal_tests="yes" ;;
2059          no) enable_journal_tests="no" ;;
2060           *) AC_MSG_ERROR(bad value ${enableval} for --enable-journal-tests) ;;
2061         esac],
2062        [enable_journal_tests=no]
2063)
2064AM_CONDITIONAL(ENABLE_JOURNAL_TESTS, test x$enable_journal_tests = xyes)
2065
2066
2067# settings for pmlastmsg
2068AC_ARG_ENABLE(pmlastmsg,
2069        [AS_HELP_STRING([--enable-pmlastmsg],[Compiles lastmsg parser module @<:@default=no@:>@])],
2070        [case "${enableval}" in
2071         yes) enable_pmlastmsg="yes" ;;
2072          no) enable_pmlastmsg="no" ;;
2073           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmlastmsg) ;;
2074         esac],
2075        [enable_pmlastmsg=no]
2076)
2077AM_CONDITIONAL(ENABLE_PMLASTMSG, test x$enable_pmlastmsg = xyes)
2078
2079
2080# settings for pmcisconames
2081AC_ARG_ENABLE(pmcisconames,
2082        [AS_HELP_STRING([--enable-pmcisconames],[Compiles cisconames parser module @<:@default=no@:>@])],
2083        [case "${enableval}" in
2084         yes) enable_pmcisconames="yes" ;;
2085          no) enable_pmcisconames="no" ;;
2086           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmcisconames) ;;
2087         esac],
2088        [enable_pmcisconames=no]
2089)
2090AM_CONDITIONAL(ENABLE_PMCISCONAMES, test x$enable_pmcisconames = xyes)
2091
2092
2093# settings for pmciscoios
2094AC_ARG_ENABLE(pmciscoios,
2095        [AS_HELP_STRING([--enable-pmciscoios],[Compiles ciscoios parser module @<:@default=no@:>@])],
2096        [case "${enableval}" in
2097         yes) enable_pmciscoios="yes" ;;
2098          no) enable_pmciscoios="no" ;;
2099           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmciscoios) ;;
2100         esac],
2101        [enable_pmciscoios=no]
2102)
2103AM_CONDITIONAL(ENABLE_PMCISCOIOS, test x$enable_pmciscoios = xyes)
2104
2105
2106# settings for pmnull
2107AC_ARG_ENABLE(pmnull,
2108        [AS_HELP_STRING([--enable-pmnull],[Compiles null parser module @<:@default=no@:>@])],
2109        [case "${enableval}" in
2110         yes) enable_pmnull="yes" ;;
2111          no) enable_pmnull="no" ;;
2112           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmnull) ;;
2113         esac],
2114        [enable_pmnull=no]
2115)
2116AM_CONDITIONAL(ENABLE_PMNULL, test x$enable_pmnull = xyes)
2117
2118
2119# settings for pmnormalize
2120AC_ARG_ENABLE(pmnormalize,
2121        [AS_HELP_STRING([--enable-pmnormalize],[Compiles normalizer parser module @<:@default=no@:>@])],
2122        [case "${enableval}" in
2123         yes) enable_pmnormalize="yes" ;;
2124          no) enable_pmnormalize="no" ;;
2125           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmnormalize) ;;
2126         esac],
2127        [enable_pmnormalize=no]
2128)
2129AM_CONDITIONAL(ENABLE_PMNORMALIZE, test x$enable_pmnormalize = xyes)
2130
2131
2132# settings for pmaixforwardedfrom
2133AC_ARG_ENABLE(pmaixforwardedfrom,
2134        [AS_HELP_STRING([--enable-pmaixforwardedfrom],[Compiles aixforwardedfrom parser module @<:@default=no@:>@])],
2135        [case "${enableval}" in
2136         yes) enable_pmaixforwardedfrom="yes" ;;
2137          no) enable_pmaixforwardedfrom="no" ;;
2138           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmaixforwardedfrom) ;;
2139         esac],
2140        [enable_pmaixforwardedfrom=no]
2141)
2142AM_CONDITIONAL(ENABLE_PMAIXFORWARDEDFROM, test x$enable_pmaixforwardedfrom = xyes)
2143
2144
2145# settings for pmsnare
2146AC_ARG_ENABLE(pmsnare,
2147        [AS_HELP_STRING([--enable-pmsnare],[Compiles snare parser module @<:@default=no@:>@])],
2148        [case "${enableval}" in
2149         yes) enable_pmsnare="yes" ;;
2150          no) enable_pmsnare="no" ;;
2151           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmsnare) ;;
2152         esac],
2153        [enable_pmsnare=no]
2154)
2155AM_CONDITIONAL(ENABLE_PMSNARE, test x$enable_pmsnare = xyes)
2156
2157
2158# settings for pmpanngfw
2159AC_ARG_ENABLE(pmpanngfw,
2160        [AS_HELP_STRING([--enable-pmpanngfw],[Compiles Palo Alto Networks parser module @<:@default=no@:>@])],
2161        [case "${enableval}" in
2162         yes) enable_pmpanngfw="yes" ;;
2163          no) enable_pmpanngfw="no" ;;
2164           *) AC_MSG_ERROR(bad value ${enableval} for --enable-pmpanngfw) ;;
2165         esac],
2166        [enable_pmpanngfw=no]
2167)
2168AM_CONDITIONAL(ENABLE_PMPANNGFW, test x$enable_pmpanngfw = xyes)
2169
2170
2171# settings for omruleset
2172AC_ARG_ENABLE(omruleset,
2173        [AS_HELP_STRING([--enable-omruleset],[Compiles ruleset forwarding module @<:@default=no@:>@])],
2174        [case "${enableval}" in
2175         yes) enable_omruleset="yes" ;;
2176          no) enable_omruleset="no" ;;
2177           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omruleset) ;;
2178         esac],
2179        [enable_omruleset=no]
2180)
2181AM_CONDITIONAL(ENABLE_OMRULESET, test x$enable_omruleset = xyes)
2182
2183
2184# settings for omuxsock
2185AC_ARG_ENABLE(omuxsock,
2186        [AS_HELP_STRING([--enable-omuxsock],[Compiles omuxsock module @<:@default=no@:>@])],
2187        [case "${enableval}" in
2188         yes) enable_omuxsock="yes" ;;
2189          no) enable_omuxsock="no" ;;
2190           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omuxsock) ;;
2191         esac],
2192        [enable_omuxsock=no]
2193)
2194AM_CONDITIONAL(ENABLE_OMUXSOCK, test x$enable_omuxsock = xyes)
2195
2196
2197# settings for mmsnmptrapd message modification module
2198AC_ARG_ENABLE(mmsnmptrapd,
2199        [AS_HELP_STRING([--enable-mmsnmptrapd],[Compiles mmsnmptrapd module @<:@default=no@:>@])],
2200        [case "${enableval}" in
2201         yes) enable_mmsnmptrapd="yes" ;;
2202          no) enable_mmsnmptrapd="no" ;;
2203           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmsnmptrapd) ;;
2204         esac],
2205        [enable_mmsnmptrapd=no]
2206)
2207AM_CONDITIONAL(ENABLE_MMSNMPTRAPD, test x$enable_mmsnmptrapd = xyes)
2208
2209
2210# settings for the omhdfs;
2211AC_ARG_ENABLE(omhdfs,
2212        [AS_HELP_STRING([--enable-omhdfs],[Compiles omhdfs module @<:@default=no@:>@])],
2213        [case "${enableval}" in
2214         yes) enable_omhdfs="yes" ;;
2215          no) enable_omhdfs="no" ;;
2216           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omhdfs) ;;
2217         esac],
2218        [enable_omhdfs=no]
2219)
2220if test "x$enable_omhdfs"; then
2221	AC_CHECK_HEADERS([hdfs.h hadoop/hdfs.h])
2222fi
2223AM_CONDITIONAL(ENABLE_OMHDFS, test x$enable_omhdfs = xyes)
2224
2225# support for kafka input output
2226AC_ARG_ENABLE(omkafka,
2227        [AS_HELP_STRING([--enable-omkafka],[Compiles kafka output module @<:@default=no@:>@])],
2228        [case "${enableval}" in
2229         yes) enable_omkafka="yes" ;;
2230          no) enable_omkafka="no" ;;
2231         optional) enable_omkafka="optional" ;;
2232           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omkafka) ;;
2233         esac],
2234        [enable_omkafka=no]
2235)
2236AC_ARG_ENABLE(imkafka,
2237        [AS_HELP_STRING([--enable-imkafka],[Compiles kafka input and output module @<:@default=no@:>@])],
2238        [case "${enableval}" in
2239         yes) enable_imkafka="yes" ;;
2240          no) enable_imkafka="no" ;;
2241         optional) enable_imkafka="optional" ;;
2242           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imkafka) ;;
2243         esac],
2244        [enable_imkafka=no]
2245)
2246
2247AC_ARG_ENABLE(kafka_tests,
2248        [AS_HELP_STRING([--enable-kafka-tests],[Enable Kafka tests, needs Java @<:@default=no@:>@])],
2249        [case "${enableval}" in
2250         yes) enable_kafka_tests="yes" ;;
2251          no) enable_kafka_tests="no" ;;
2252           *) AC_MSG_ERROR(bad value ${enableval} for --enable-kafka-tests) ;;
2253         esac],
2254        [enable_kafka_tests=no]
2255)
2256AM_CONDITIONAL(ENABLE_KAFKA_TESTS, test x$enable_kafka_tests = xyes)
2257
2258AC_ARG_ENABLE(kafka_static,
2259        [AS_HELP_STRING([--enable-kafka-static],[Enable static library linking for Kafka modules. Removes dependency for rdkafka.so. @<:@default=no@:>@])],
2260        [case "${enableval}" in
2261         yes) enable_kafka_static="yes" ;;
2262          no) enable_kafka_static="no" ;;
2263           *) AC_MSG_ERROR(bad value ${enableval} for --enable-kafka-static) ;;
2264         esac],
2265        [enable_kafka_static=no]
2266)
2267AM_CONDITIONAL(ENABLE_KAFKA_STATIC, test x$enable_kafka_static = xyes)
2268
2269# omkafka works with older library
2270omkafka_use_dummy="no"
2271if test "$enable_omkafka" = "yes" -o "$enable_omkafka" = "optional"; then
2272	PKG_CHECK_MODULES([LIBRDKAFKA], [rdkafka >= 0.9.1],, [
2273		PKG_CHECK_MODULES([LIBRDKAFKA], [librdkafka],, [
2274			AC_CHECK_LIB([rdkafka], [rd_kafka_last_error], [
2275				AC_MSG_WARN([librdkafka is missing but library present, using -lrdkafka])
2276				LIBRDKAFKA_LIBS=-lrdkafka
2277			], [
2278				AS_IF([test "$enable_omkafka" = "yes"],
2279					AC_MSG_ERROR([could not find rdkafka library])
2280				)
2281				AC_MSG_NOTICE([omkafka: no suiteable build environment, use omkafka dummy])
2282				omkafka_use_dummy=yes
2283				AC_DEFINE([ENABLE_OMKAFKA_DUMMY], [1], [Indicator that we need to build a dummy omkafka module])
2284			])
2285		])
2286	])
2287fi
2288AM_CONDITIONAL(OMKAFKA_USE_DUMMY, test x$omkafka_use_dummy = xyes)
2289if test "$enable_omkafka" = "yes" -o "$enable_omkafka" = "optional" && test "$omkafka_use_dummy" = "no"; then
2290	AC_CHECK_HEADERS([librdkafka/rdkafka.h])
2291
2292	# Add additional dependencies if statically linking rdkafka
2293	if test "x$enable_kafka_static" = "xyes"; then
2294		PKG_CHECK_MODULES([LIBLZ4], [liblz4],, [
2295			AC_CHECK_LIB([lz4], [LZ4_compress], [
2296				AC_MSG_WARN([liblz4 is missing but library present, using -llz4])
2297				LIBRDKAFKA_LIBS=-llz4
2298			], [
2299				AC_MSG_ERROR([could not find liblz4 library])
2300			])
2301		])
2302	fi
2303fi
2304
2305imkafka_use_dummy="no"
2306# imkafka needs newer library
2307if test "x$enable_imkafka" = "xyes" -o "$enable_imkafka" = "optional"; then
2308	PKG_CHECK_MODULES([LIBRDKAFKA], [rdkafka >= 0.9.1],, [
2309		AC_CHECK_LIB([rdkafka], [rd_kafka_consumer_poll], [
2310			AC_MSG_WARN([librdkafka is missing but library present, using -lrdkafka])
2311			LIBRDKAFKA_LIBS=-lrdkafka
2312		], [
2313			AS_IF([test "$enable_imkafka" = "yes"],
2314				AC_MSG_ERROR([could not find sufficiently current rdkafka library])
2315			)
2316			AC_MSG_NOTICE([imkafka: no suiteable build environment, use imkafka dummy])
2317			imkafka_use_dummy=yes
2318			AC_DEFINE([ENABLE_IMKAFKA_DUMMY], [1], [Indicator that we need to build a dummy imkafka module])
2319		])
2320	])
2321fi
2322AM_CONDITIONAL(IMKAFKA_USE_DUMMY, test x$imkafka_use_dummy = xyes)
2323if test "$enable_imkafka" = "yes" -o "$enable_imkafka" = "optional" && test "$imkafka_use_dummy" = "no"; then
2324	AC_CHECK_HEADERS([librdkafka/rdkafka.h])
2325
2326	# Add additional dependencies if statically linking rdkafka
2327	if test "x$enable_kafka_static" = "xyes"; then
2328		PKG_CHECK_MODULES([LIBLZ4], [liblz4],, [
2329			AC_CHECK_LIB([lz4], [LZ4_compress], [
2330				AC_MSG_WARN([liblz4 is missing but library present, using -llz4])
2331				LIBRDKAFKA_LIBS=-llz4
2332			], [
2333				AC_MSG_ERROR([could not find liblz4 library])
2334			])
2335		])
2336	fi
2337fi
2338
2339if test "x$enable_omkafka" = "xyes" && test "x$enable_imkafka" = "xyes"; then
2340	if test "x$enable_kafka_tests" = "xyes"; then
2341		AX_PROG_JAVAC #we don't need javac, but macro documentation says JAVAC *must* be checked before JAVA
2342		AX_PROG_JAVA
2343		AC_CHECK_PROG(WGET, [wget], [yes], [no])
2344		if test "x${WGET}" = "xno"; then
2345			AC_MSG_FAILURE([wget, which is a kafka-tests dependency, not found])
2346		fi
2347		AC_CHECK_PROG(READLINK, [readlink], [yes], [no])
2348		if test "x${READLINK}" = "xno"; then
2349			AC_MSG_FAILURE([readlink, which is a kafka-tests dependency, not found])
2350		fi
2351	fi
2352else
2353	if test "x$enable_kafka_tests" = "xyes"; then
2354		AC_MSG_WARN([kafka-tests can not be enabled without omkafka and imkafka support. Disabling enable_kafka_tests...])
2355		enable_kafka_tests="no"
2356	fi
2357fi
2358AM_CONDITIONAL(ENABLE_OMKAFKA, test x$enable_omkafka = xyes -o x$enable_omkafka = xoptional)
2359AM_CONDITIONAL(ENABLE_IMKAFKA, test x$enable_imkafka = xyes -o x$enable_imkafka = xoptional)
2360
2361#MONGODB SUPPORT
2362
2363AC_ARG_ENABLE(ommongodb,
2364        [AS_HELP_STRING([--enable-ommongodb],[Compiles ommongodb module @<:@default=no@:>@])],
2365        [case "${enableval}" in
2366         yes) enable_ommongodb="yes" ;;
2367          no) enable_ommongodb="no" ;;
2368           *) AC_MSG_ERROR(bad value ${enableval} for --enable-ommongodb) ;;
2369         esac],
2370        [enable_ommongodb=no]
2371)
2372if test "x$enable_ommongodb" = "xyes"; then
2373	PKG_CHECK_MODULES(LIBMONGOC, libmongoc-1.0)
2374    AC_CHECK_FUNCS(mongoc_client_set_ssl_opts,,)
2375
2376fi
2377AM_CONDITIONAL(ENABLE_OMMONGODB, test x$enable_ommongodb = xyes)
2378# end of mongodb code
2379
2380
2381# BEGIN CZMQ INPUT SUPPORT
2382AC_ARG_ENABLE(imczmq,
2383        [AS_HELP_STRING([--enable-imczmq],[Compiles imczmq output module @<:@default=no@:>@])],
2384        [case "${enableval}" in
2385         yes) enable_imczmq="yes" ;;
2386          no) enable_imczmq="no" ;;
2387           *) AC_MSG_ERROR(bad value ${enableval} for --enable-imczmq) ;;
2388         esac],
2389        [enable_imczmq=no]
2390)
2391if test "x$enable_imczmq" = "xyes"; then
2392	PKG_CHECK_MODULES(CZMQ, libczmq >= 4.0.0)
2393fi
2394AM_CONDITIONAL(ENABLE_IMCZMQ, test x$enable_imczmq = xyes)
2395
2396# END CZMQ INPUT
2397
2398
2399# BEGIN CZMQ OUTPUT SUPPORT
2400AC_ARG_ENABLE(omczmq,
2401        [AS_HELP_STRING([--enable-omczmq],[Compiles omczmq output module @<:@default=no@:>@])],
2402        [case "${enableval}" in
2403         yes) enable_omczmq="yes" ;;
2404          no) enable_omczmq="no" ;;
2405           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omczmq) ;;
2406         esac],
2407        [enable_omczmq=no]
2408)
2409if test "x$enable_omczmq" = "xyes"; then
2410   PKG_CHECK_MODULES(CZMQ, libczmq >= 4.0.0)
2411fi
2412AM_CONDITIONAL(ENABLE_OMCZMQ, test x$enable_omczmq = xyes)
2413
2414# END CZMQ SUPPORT
2415
2416
2417# BEGIN RABBITMQ OUTPUT SUPPORT
2418
2419AC_ARG_ENABLE(omrabbitmq,
2420        [AS_HELP_STRING([--enable-omrabbitmq],[Compiles omrabbitmq output module @<:@default=no@:>@])],
2421        [case "${enableval}" in
2422         yes) enable_omrabbitmq="yes" ;;
2423          no) enable_omrabbitmq="no" ;;
2424           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omrabbitmq) ;;
2425         esac],
2426        [enable_omrabbitmq=no]
2427)
2428if test "x$enable_omrabbitmq" = "xyes"; then
2429        PKG_CHECK_MODULES(RABBITMQ, librabbitmq >= 0.2.0)
2430        AC_SUBST(RABBITMQ_CFLAGS)
2431        AC_SUBST(RABBITMQ_LIBS)
2432fi
2433AM_CONDITIONAL(ENABLE_OMRABBITMQ, test x$enable_omrabbitmq = xyes)
2434
2435# END RABBITMQ SUPPORT
2436
2437# HIREDIS SUPPORT
2438
2439AC_ARG_ENABLE(imhiredis,
2440         [AS_HELP_STRING([--enable-imhiredis],[Compiles imhiredis input module @<:@default=no@:>@])],
2441         [case "${enableval}" in
2442          yes) enable_imhiredis="yes" ;;
2443           no) enable_imhiredis="no" ;;
2444          optional) enable_imhiredis="optional" ;;
2445            *) AC_MSG_ERROR(bad value ${enableval} for --enable-imhiredis) ;;
2446          esac],
2447         [enable_imhiredis=no]
2448)
2449AC_ARG_ENABLE(omhiredis,
2450        [AS_HELP_STRING([--enable-omhiredis],[Compiles omhiredis template module @<:@default=no@:>@])],
2451        [case "${enableval}" in
2452         yes) enable_omhiredis="yes" ;;
2453          no) enable_omhiredis="no" ;;
2454           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omhiredis) ;;
2455         esac],
2456        [enable_omhiredis=no]
2457)
2458
2459if test "x$enable_omhiredis" = "xyes" -o "x$enable_imhiredis" = "xyes" ; then
2460    PKG_CHECK_MODULES(HIREDIS, hiredis >= 0.10.1, [],
2461        [AC_SEARCH_LIBS(redisConnectWithTimeout, hiredis,
2462            [AC_COMPILE_IFELSE(
2463                [AC_LANG_PROGRAM(
2464                    [[ #include <hiredis/hiredis.h> ]],
2465                    [[ #define major 0
2466                       #define minor 10
2467                       #define patch 1
2468                       #if (( HIREDIS_MAJOR > major ) || \
2469                         (( HIREDIS_MAJOR == major ) && ( HIREDIS_MINOR > minor )) || \
2470                         (( HIREDIS_MAJOR == major ) && ( HIREDIS_MINOR == minor ) && ( HIREDIS_PATCH >= patch ))) \
2471                       /* OK */
2472                       #else
2473                       # error Hiredis version must be >= major.minor.path
2474                       #endif
2475                    ]]
2476                )],
2477                [],
2478                [AC_MSG_ERROR([hiredis version must be >= 0.10.1])]
2479            )],
2480            [AC_MSG_ERROR([hiredis not found])]
2481        )]
2482    )
2483fi
2484
2485if test "x$enable_imhiredis" = "xyes" ; then
2486    PKG_CHECK_MODULES(LIBEVENT, [libevent >= 2.0, libevent_pthreads],
2487        # libevent found
2488        [
2489            HIREDIS_LIBS="$HIREDIS_LIBS -levent -levent_pthreads"
2490        ],
2491        # libevent not found
2492        [AC_MSG_ERROR([no libevent >= 2.0 found with pthreads support, imhiredis cannot use pub/sub])])
2493fi
2494
2495AM_CONDITIONAL(ENABLE_OMHIREDIS, test x$enable_omhiredis = xyes)
2496AM_CONDITIONAL(ENABLE_IMHIREDIS, test x$enable_imhiredis = xyes)
2497
2498# END HIREDIS SUPPORT
2499
2500
2501# HTTPFS SUPPORT
2502
2503AC_ARG_ENABLE(omhttpfs,
2504        [AS_HELP_STRING([--enable-omhttpfs],[Compiles omhttpfs template module @<:@default=no@:>@])],
2505        [case "${enableval}" in
2506         yes) enable_omhttpfs="yes" ;;
2507          no) enable_omhttpfs="no" ;;
2508           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omhttpfs) ;;
2509         esac],
2510        [enable_omhttpfs=no]
2511)
2512
2513if test "x$enable_omhttpfs" = "xyes"; then
2514	AC_CHECK_HEADERS([curl/curl.h])
2515	PKG_CHECK_MODULES([CURL], [libcurl])
2516	LT_LIB_M
2517	#PKG_CHECK_MODULES(HTTPFS, curl >= 7.0.0)
2518fi
2519AM_CONDITIONAL(ENABLE_OMHTTPFS, test x$enable_omhttpfs = xyes)
2520
2521# END HTTPFS SUPPORT
2522
2523# AMQP 1.0 PROTOCOL SUPPORT
2524# uses the Proton protocol library
2525
2526AC_ARG_ENABLE(omamqp1,
2527        [AS_HELP_STRING([--enable-omamqp1],[Compiles omamqp1 output module @<:@default=no@:>@])],
2528        [case "${enableval}" in
2529         yes) enable_omamqp1="yes" ;;
2530          no) enable_omamqp1="no" ;;
2531           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omamqp1) ;;
2532         esac],
2533        [enable_omamqp1=no]
2534)
2535if test "x$enable_omamqp1" = "xyes"; then
2536        PKG_CHECK_MODULES(PROTON, libqpid-proton >= 0.9)
2537        AC_SUBST(PROTON_CFLAGS)
2538        AC_SUBST(PROTON_LIBS)
2539fi
2540AM_CONDITIONAL(ENABLE_OMAMQP1, test x$enable_omamqp1 = xyes)
2541
2542# END AMQP 1.0 PROTOCOL SUPPORT
2543
2544# TCL SUPPORT
2545
2546AC_ARG_ENABLE(omtcl,
2547        [AS_HELP_STRING([--enable-omtcl],[Compiles omtcl output module @<:@default=no@:>@])],
2548        [case "${enableval}" in
2549         yes) enable_omtcl="yes" ;;
2550          no) enable_omtcl="no" ;;
2551           *) AC_MSG_ERROR(bad value ${enableval} for --enable-omtcl) ;;
2552         esac],
2553        [enable_omtcl=no]
2554)
2555
2556if test "x$enable_omtcl" = "xyes"; then
2557	SC_PATH_TCLCONFIG
2558	SC_LOAD_TCLCONFIG
2559	AC_SUBST(TCL_INCLUDE_SPEC)
2560fi
2561AM_CONDITIONAL(ENABLE_OMTCL, test x$enable_omtcl = xyes)
2562
2563# END TCL SUPPORT
2564
2565# mmkubernetes - Kubernetes metadata support
2566
2567AC_ARG_ENABLE(mmkubernetes,
2568        [AS_HELP_STRING([--enable-mmkubernetes],
2569            [Enable compilation of the mmkubernetes module @<:@default=no@:>@])],
2570        [case "${enableval}" in
2571         yes) enable_mmkubernetes="yes" ;;
2572          no) enable_mmkubernetes="no" ;;
2573           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmkubernetes) ;;
2574         esac],
2575        [enable_mmkubernetes=no]
2576)
2577if test "x$enable_mmkubernetes" = "xyes"; then
2578        PKG_CHECK_MODULES([CURL], [libcurl])
2579        PKG_CHECK_MODULES(LIBLOGNORM, lognorm >= 2.0.3)
2580
2581        save_CFLAGS="$CFLAGS"
2582        save_LIBS="$LIBS"
2583
2584        CFLAGS="$CFLAGS $LIBLOGNORM_CFLAGS"
2585        LIBS="$LIBS $LIBLOGNORM_LIBS"
2586
2587        AC_CHECK_FUNC([ln_loadSamplesFromString],
2588                      [AC_DEFINE([HAVE_LOADSAMPLESFROMSTRING], [1], [Define if ln_loadSamplesFromString exists.])],
2589                      [AC_DEFINE([NO_LOADSAMPLESFROMSTRING], [1], [Define if ln_loadSamplesFromString does not exist.])])
2590
2591        CFLAGS="$save_CFLAGS"
2592        LIBS="$save_LIBS"
2593fi
2594AM_CONDITIONAL(ENABLE_MMKUBERNETES, test x$enable_mmkubernetes = xyes)
2595
2596# END Kubernetes metadata support
2597
2598
2599# mmtaghostname
2600AC_ARG_ENABLE(mmtaghostname,
2601        [AS_HELP_STRING([--enable-mmtaghostname],[Enable Tag and Hostname messages' modifier @<:@default=no@:>@])],
2602        [case "${enableval}" in
2603         yes) enable_mmtaghostname="yes" ;;
2604          no) enable_mmtaghostname="no" ;;
2605           *) AC_MSG_ERROR(bad value ${enableval} for --enable-mmtaghostname) ;;
2606         esac],
2607        [enable_mmtaghostname=no]
2608)
2609AM_CONDITIONAL(ENABLE_MMTAGHOSTNAME, test x$enable_mmtaghostname = xyes)
2610#END mmtaghostname
2611
2612# man pages
2613have_to_generate_man_pages="no"
2614git_src_have_to_generate_man_pages="yes" # default to use when building from git source
2615AC_ARG_ENABLE(generate-man-pages,
2616        [AS_HELP_STRING([--enable-generate-man-pages],[Generate man pages from source @<:@default=no@:>@])],
2617        [case "${enableval}" in
2618         yes) have_to_generate_man_pages="yes" ;;
2619          no) have_to_generate_man_pages="no" ;
2620              git_src_have_to_generate_man_pages="no"
2621	      ;;
2622           *) AC_MSG_ERROR(bad value ${enableval} for --enable-generate-man-pages) ;;
2623         esac],
2624        [have_to_generate_man_pages=no]
2625)
2626
2627
2628# This provides a work-around to use "make distcheck" without
2629# running tests (mode used pre 2018-07-02)
2630AC_ARG_ENABLE(distcheck-workaround,
2631        [AS_HELP_STRING([--enable-distcheck-workaround],[enable to use make distcheck without runing testbench inside it @<:@default=no@:>@])],
2632        [case "${enableval}" in
2633         yes) enable_distcheck_workaround="yes" ;;
2634          no) enable_distcheck_workaround="no" ;;
2635           *) AC_MSG_ERROR(bad value ${enableval} for --enable-distcheck_workaround) ;;
2636         esac],
2637        [enable_distcheck_workaround="no"]
2638)
2639AM_CONDITIONAL(ENABLE_DISTCHECK_WORKAROUND, test x$enable_distcheck_workaround = xyes)
2640
2641
2642if test "x$in_git_src" = "xyes"; then
2643        AC_MSG_NOTICE([Running from git source])
2644
2645        have_to_generate_man_pages=$git_src_have_to_generate_man_pages
2646
2647        if test "x$LEX" != "xflex"; then
2648                AC_MSG_ERROR([flex program is needed to build rsyslog, please install flex.])
2649        fi
2650
2651        if test "x$YACC" = "xyacc"; then
2652                # AC_PROG_YACC only checks for yacc replacements, not for yacc itself
2653                AC_CHECK_PROG([YACC_FOUND], [yacc], [yes], [no])
2654                if test "x$YACC_FOUND" = "xno"; then
2655                        AC_MSG_ERROR([A yacc program is needed to build rsyslog, please install bison.])
2656                fi
2657        fi
2658else
2659        AC_MSG_NOTICE([Not running from git source])
2660fi
2661
2662AM_CONDITIONAL(ENABLE_GENERATE_MAN_PAGES, test x$have_to_generate_man_pages = xyes)
2663
2664# rst2man
2665AC_CHECK_PROGS([RST2MAN], [rst2man rst2man.py], [false])
2666if test "x$have_to_generate_man_pages" = "xyes" && test "x$RST2MAN" = "xfalse"; then
2667        AC_MSG_ERROR([rst2man is required when building from git source or --enable-generate-man-pages option was set, please install python-docutils.])
2668fi
2669
2670
2671AC_CONFIG_FILES([Makefile \
2672		runtime/Makefile \
2673		compat/Makefile \
2674		grammar/Makefile \
2675		tools/Makefile \
2676		plugins/imudp/Makefile \
2677		plugins/imtcp/Makefile \
2678		plugins/im3195/Makefile \
2679		plugins/imgssapi/Makefile \
2680		plugins/imuxsock/Makefile \
2681		plugins/imjournal/Makefile \
2682		plugins/immark/Makefile \
2683		plugins/imklog/Makefile \
2684		plugins/omhdfs/Makefile \
2685		plugins/omkafka/Makefile \
2686		plugins/omprog/Makefile \
2687		plugins/mmexternal/Makefile \
2688		plugins/omstdout/Makefile \
2689		plugins/omjournal/Makefile \
2690		plugins/pmciscoios/Makefile \
2691		plugins/pmnull/Makefile \
2692		plugins/pmnormalize/Makefile \
2693		plugins/omruleset/Makefile \
2694		plugins/omuxsock/Makefile \
2695		plugins/imfile/Makefile \
2696		plugins/imsolaris/Makefile \
2697		plugins/imptcp/Makefile \
2698		plugins/impstats/Makefile \
2699		plugins/imrelp/Makefile \
2700		plugins/imdiag/Makefile \
2701		plugins/imkafka/Makefile \
2702		plugins/omtesting/Makefile \
2703		plugins/omgssapi/Makefile \
2704		plugins/ommysql/Makefile \
2705		plugins/ompgsql/Makefile \
2706		plugins/omrelp/Makefile \
2707		plugins/omlibdbi/Makefile \
2708		plugins/ommail/Makefile \
2709		plugins/fmhttp/Makefile \
2710		plugins/omsnmp/Makefile \
2711		plugins/omudpspoof/Makefile \
2712		plugins/ommongodb/Makefile \
2713		plugins/mmnormalize/Makefile \
2714		plugins/mmjsonparse/Makefile \
2715		plugins/mmaudit/Makefile \
2716		plugins/mmanon/Makefile \
2717		plugins/mmrm1stspace/Makefile \
2718		plugins/mmutf8fix/Makefile \
2719		plugins/mmfields/Makefile \
2720		plugins/mmpstrucdata/Makefile \
2721		plugins/omelasticsearch/Makefile \
2722		plugins/omclickhouse/Makefile \
2723		plugins/mmsnmptrapd/Makefile \
2724		plugins/pmlastmsg/Makefile \
2725		plugins/mmdblookup/Makefile \
2726    		contrib/mmdarwin/Makefile \
2727		contrib/omhttp/Makefile \
2728		contrib/fmhash/Makefile \
2729		contrib/fmunflatten/Makefile \
2730		contrib/ffaup/Makefile \
2731		contrib/pmsnare/Makefile \
2732		contrib/pmpanngfw/Makefile \
2733		contrib/pmaixforwardedfrom/Makefile \
2734		contrib/omhiredis/Makefile \
2735		contrib/omrabbitmq/Makefile \
2736		contrib/imkmsg/Makefile \
2737		contrib/mmgrok/Makefile \
2738		contrib/mmcount/Makefile \
2739		contrib/omczmq/Makefile \
2740		contrib/imczmq/Makefile \
2741		contrib/mmsequence/Makefile \
2742		contrib/mmrfc5424addhmac/Makefile \
2743		contrib/pmcisconames/Makefile \
2744		contrib/omhttpfs/Makefile \
2745		contrib/omamqp1/Makefile \
2746		contrib/omtcl/Makefile \
2747		contrib/imbatchreport/Makefile \
2748		contrib/omfile-hardened/Makefile \
2749		contrib/mmkubernetes/Makefile \
2750		contrib/impcap/Makefile \
2751		contrib/imtuxedoulog/Makefile \
2752		contrib/improg/Makefile \
2753		contrib/imhttp/Makefile \
2754		contrib/mmtaghostname/Makefile \
2755		contrib/imdocker/Makefile \
2756		contrib/pmdb2diag/Makefile \
2757		contrib/imhiredis/Makefile \
2758		tests/set-envvars \
2759		tests/Makefile])
2760AC_OUTPUT
2761
2762echo "****************************************************"
2763echo "rsyslog will be compiled with the following settings:"
2764echo
2765echo "    Large file support enabled:               $enable_largefile"
2766echo "    Networking support enabled:               $enable_inet"
2767echo "    Regular expressions support enabled:      $enable_regexp"
2768echo "    rsyslog runtime will be built:            $enable_rsyslogrt"
2769echo "    rsyslogd will be built:                   $enable_rsyslogd"
2770echo "    have to generate man pages:               $have_to_generate_man_pages"
2771echo "    Unlimited select() support enabled:       $enable_unlimited_select"
2772echo "    uuid support enabled:                     $enable_uuid"
2773echo "    Log file signing support via KSI LS12:    $enable_ksi_ls12"
2774echo "    Log file encryption support:              $enable_libgcrypt"
2775echo "    anonymization support enabled:            $enable_mmanon"
2776echo "    message counting support enabled:         $enable_mmcount"
2777echo "    liblogging-stdlog support enabled:        $enable_liblogging_stdlog"
2778echo "    libsystemd enabled:                       $enable_libsystemd"
2779echo "    kafka static linking enabled:             $enable_kafka_static"
2780echo "    atomic operations enabled:                $enable_atomic_operations"
2781echo
2782echo "---{ input plugins }---"
2783if test "$unamestr" != "AIX"; then
2784echo "    Klog functionality enabled:               $enable_klog ($os_type)"
2785fi
2786echo "    /dev/kmsg functionality enabled:          $enable_kmsg"
2787echo "    plain tcp input module enabled:           $enable_imptcp"
2788echo "    imdiag enabled:                           $enable_imdiag"
2789echo "    file input module enabled:                $enable_imfile"
2790echo "    docker log input module enabled:          $enable_imdocker"
2791echo "    Solaris input module enabled:             $enable_imsolaris"
2792echo "    periodic statistics module enabled:       $enable_impstats"
2793echo "    imczmq input module enabled:              $enable_imczmq"
2794echo "    imjournal input module enabled:           $enable_imjournal"
2795if test "$enable_imjournal" = "optional"; then
2796echo "        imjournal use dummy:                  $imjournal_use_dummy"
2797fi
2798echo "    imbatchreport input module enabled:       $enable_imbatchreport"
2799echo "    imkafka module will be compiled:          $enable_imkafka"
2800if test "$enable_imkafka" = "optional"; then
2801echo "        imkafka use dummy:                    $imkafka_use_dummy"
2802fi
2803echo "    impcap input module enabled:              $enable_impcap"
2804echo "    imtuxedoulog module will be compiled:     $enable_imtuxedoulog"
2805echo "    improg input module enabled:              $enable_improg"
2806echo "    imhttp input module enabled:              $enable_imhttp"
2807echo "    imhiredis input module enabled:           $enable_imhiredis"
2808echo
2809echo "---{ output plugins }---"
2810echo "    Mail support enabled:                     $enable_mail"
2811echo "    omfile-hardened module will be compiled:  $enable_omfile_hardened"
2812echo "    omprog module will be compiled:           $enable_omprog"
2813echo "    omstdout module will be compiled:         $enable_omstdout"
2814echo "    omjournal module will be compiled:        $enable_omjournal"
2815echo "    omhdfs module will be compiled:           $enable_omhdfs"
2816echo "    omelasticsearch module will be compiled:  $enable_elasticsearch"
2817echo "    omclickhouse module will be compiled:     $enable_clickhouse"
2818echo "    omhttp module will be compiled:           $enable_omhttp"
2819echo "    omruleset module will be compiled:        $enable_omruleset"
2820echo "    omudpspoof module will be compiled:       $enable_omudpspoof"
2821echo "    omuxsock module will be compiled:         $enable_omuxsock"
2822echo "    omczmq module will be compiled:           $enable_omczmq"
2823echo "    omrabbitmq module will be compiled:       $enable_omrabbitmq"
2824echo "    omhttpfs module will be compiled:         $enable_omhttpfs"
2825echo "    omamqp1 module will be compiled:          $enable_omamqp1"
2826echo "    omtcl module will be compiled:            $enable_omtcl"
2827echo "    omkafka module will be compiled:          $enable_omkafka"
2828echo
2829echo "---{ parser modules }---"
2830echo "    pmlastmsg module will be compiled:        $enable_pmlastmsg"
2831echo "    pmcisconames module will be compiled:     $enable_pmcisconames"
2832echo "    pmciscoios module will be compiled:       $enable_pmciscoios"
2833echo "    pmnull module will be compiled:           $enable_pmnull"
2834echo "    pmnormalize module will be compiled:      $enable_pmnormalize"
2835echo "    pmaixforwardedfrom module w.be compiled:  $enable_pmaixforwardedfrom"
2836echo "    pmsnare module will be compiled:          $enable_pmsnare"
2837echo "    pmdb2diag module will be compiled:        $enable_pmdb2diag"
2838echo "    pmpanngfw module will be compiled:        $enable_pmpanngfw"
2839echo
2840echo "---{ message modification modules }---"
2841echo "    mmnormalize module will be compiled:      $enable_mmnormalize"
2842echo "    mmjsonparse module will be compiled:      $enable_mmjsonparse"
2843echo "    mmgrok module will be compiled:           $enable_mmgrok"
2844echo "    mmjaduit module will be compiled:         $enable_mmaudit"
2845echo "    mmsnmptrapd module will be compiled:      $enable_mmsnmptrapd"
2846echo "    mmutf8fix enabled:                        $enable_mmutf8fix"
2847echo "    mmrfc5424addhmac enabled:                 $enable_mmrfc5424addhmac"
2848echo "    mmpstrucdata enabled:                     $enable_mmpstrucdata"
2849echo "    mmsequence enabled:                       $enable_mmsequence"
2850echo "    mmdblookup enabled:                       $enable_mmdblookup"
2851echo "    mmdarwin enabled:                         $enable_mmdarwin"
2852echo "    mmfields enabled:                         $enable_mmfields"
2853echo "    mmrm1stspace module enabled:              $enable_mmrm1stspace"
2854echo "    mmkubernetes enabled:                     $enable_mmkubernetes"
2855echo "    mmtaghostname enabled:                    $enable_mmtaghostname"
2856echo
2857echo "---{ database support }---"
2858echo "    MySql support enabled:                    $enable_mysql"
2859echo "    libdbi support enabled:                   $enable_libdbi"
2860if test "$enable_libdbi" = "optional"; then
2861echo "        libdbi use dummy:                     $libdbi_use_dummy"
2862fi
2863echo "    PostgreSQL support enabled:               $enable_pgsql"
2864echo "    mongodb support enabled:                  $enable_ommongodb"
2865echo "    hiredis support enabled:                  $enable_omhiredis"
2866echo
2867echo "---{ protocol support }---"
2868echo "    openssl network stream driver enabled:    $enable_openssl"
2869echo "    GnuTLS network stream driver enabled:     $enable_gnutls"
2870echo "    GSSAPI Kerberos 5 support enabled:        $enable_gssapi_krb5"
2871echo "    RELP support enabled:                     $enable_relp"
2872echo "    SNMP support enabled:                     $enable_snmp"
2873echo
2874echo "---{ function modules }---"
2875echo "    fmhttp enabled:                           $enable_fmhttp"
2876echo "    fmhash enabled:                           $enable_fmhash"
2877echo "    fmhash with xxhash enabled:               $enable_fmhash_xxhash"
2878echo "    fmunflatten enabled:                      $enable_fmunflatten"
2879echo "    ffaup enabled:                            $enable_ffaup"
2880echo
2881echo "---{ debugging support }---"
2882echo "    distcheck workaround enabled:             $enable_distcheck_workaround"
2883echo "    Testbench enabled:                        $enable_testbench"
2884echo "    valgrind tests enabled:                   $with_valgrind_testbench"
2885echo "    valgrind helgrind tests enabled:          $enable_helgrind"
2886echo "    Default tests enabled:                    $enable_default_tests"
2887echo "    Testbench libfaketime tests enabled:      $enable_libfaketime"
2888echo "    Extended Testbench enabled:               $enable_extended_tests"
2889echo "    MySQL Tests enabled:                      $enable_mysql_tests"
2890echo "    Elasticsearch Tests:                      $enable_elasticsearch_tests"
2891echo "    ClickHouse Tests:                         $enable_clickhouse_tests"
2892echo "    PostgreSQL Tests enabled:                 $enable_pgsql_tests"
2893echo "    Kafka Tests enabled:                      $enable_kafka_tests"
2894echo "    Imdocker Tests enabled:                   $enable_imdocker_tests"
2895echo "    gnutls tests enabled:                     $enable_gnutls_tests"
2896echo "    imfile tests enabled:                     $enable_imfile_tests"
2897echo "    systemd journal tests enabled:            $enable_journal_tests"
2898echo "    SNMP Tests enabled:                       $enable_snmp_tests"
2899echo "    Debug mode enabled:                       $enable_debug"
2900echo "    (total) debugless mode enabled:           $enable_debugless"
2901echo "    Diagnostic tools enabled:                 $enable_diagtools"
2902echo "    End-User tools enabled:                   $enable_usertools"
2903echo "    Valgrind support settings enabled:        $enable_valgrind"
2904echo
2905