1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([lwes-journaller], [0.3.0], [lwes-devel@lists.sourceforge.net])
6 dnl Determine the host type for the host specific inclusion below
9 dnl --- Variables I use later on --
11 SHORT_DESC="The LWES (Light Weight Event System) is a system for sending structured self describing events over multicast. This is a journaller implementation that receives events and saves them to disk."
12 MAJOR_VERSION=`echo "[$]PACKAGE_VERSION" |
13 perl -ne 'm%^(\d+)\.% && print "[$]1"'`
14 MINOR_VERSION=`echo "[$]PACKAGE_VERSION" |
15 perl -ne 'm%^\d+\.(\d+)% && print "[$]1"'`
16 RELEASE_NUMBER=`echo "[$]PACKAGE_VERSION" |
17 perl -ne 'm%^\d+\.\d+\.(\d+)% && print "[$]1"'`
18 MAJOR_VERSION_UNDERLINE=`echo "[$]MAJOR_VERSION" | perl -pe 'chomp; s/\W/_/g;'`
19 PACKAGE_UNDERLINE=`echo "[$]PACKAGE_NAME" | perl -pe 'chomp; s/\W/_/g;'`
20 PACKAGEPACKED=`echo "[$]PACKAGE_NAME" | perl -pe 'chomp; s/\W//g;'`
21 VERSION_UNDERLINE=`echo "[$]PACKAGE_VERSION" | perl -pe 'chomp; s/\W/_/g;'`
23 AC_SUBST(MAJOR_VERSION)
24 AC_SUBST(MINOR_VERSION)
25 AC_SUBST(RELEASE_NUMBER)
28 AC_SUBST(MAJOR_VERSION_UNDERLINE)
29 AC_SUBST(PACKAGE_UNDERLINE)
30 AC_SUBST(PACKAGEPACKED)
31 AC_SUBST(VERSION_UNDERLINE)
33 dnl -- set maintainer mode
35 AC_SUBST(USE_MAINTAINER_MODE)
37 dnl -- we want a header to include in our source files with configure
39 AM_CONFIG_HEADER(src/config.h)
41 dnl -- make sure we have a C compiler and libtool
45 dnl Checks for header files.
48 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h getopt.h)
49 AC_CHECK_HEADER(valgrind/valgrind.h,
50 AC_DEFINE([HAVE_VALGRIND_HEADER],
52 [Define to 1 if the <valgrind/valgrind.h> header is on the system]))
53 AC_CHECK_HEADER(pthread.h,
54 AC_CHECK_LIB(pthread, pthread_join,[
55 THREAD_LIBS="-lpthread"
56 AC_DEFINE([HAVE_LIBPTHREAD], [1], [Define if pthread library is there (-lpthread)])
57 AC_DEFINE([HAVE_PTHREAD_H], [1], [Define if <pthread.h> is there])
60 AC_CHECK_HEADER(zlib.h,
61 AC_CHECK_LIB(z, gzopen,[
63 AC_DEFINE([HAVE_LIBZ], [1], [Define if zlib library is there (-lz)])
64 AC_DEFINE([HAVE_LIBZ_H], [1], [Define if <zlib.h> is there])
68 dnl Check for LWES installed
69 PKG_CHECK_MODULES([LWES], [lwes-0 >= 0.23.1])
73 dnl Check for mondemand installed, if requested
74 AC_ARG_WITH([mondemand], AS_HELP_STRING([--with-mondemand],
75 [Build with support for mondemand logging and statistics (default: disabled)]))
76 if test "x$with_mondemand" == "xyes"; then
77 PKG_CHECK_MODULES([MONDEMAND], [mondemand-4.0 >= 4.0.2])
78 AC_SUBST(MONDEMAND_CFLAGS)
79 AC_SUBST(MONDEMAND_LIBS)
80 AC_DEFINE(HAVE_MONDEMAND, 1, [System supports mondemand])
83 dnl Check for messaging
84 AC_MSG_CHECKING(for sys/msg support)
87 ],[ ],g_have_sys_msg=yes,g_have_sys_msg=no)
88 AC_MSG_RESULT($g_have_sys_msg)
89 if test "x$g_have_sys_msg" = "xyes" ; then
90 AC_DEFINE(HAVE_SYS_MSG_H, 1, [System supports sys/msg.h])
94 AC_MSG_CHECKING(for mqueue support)
97 ],[ ],g_have_mqueue=yes,g_have_mqueue=no)
98 AC_MSG_RESULT($g_have_mqueue)
99 if test "x$g_have_mqueue" = "xyes" ; then
100 AC_DEFINE(HAVE_MQUEUE_H, 1, [System supports mqueue.h])
102 AC_CHECK_LIB(rt, main)
104 dnl Checks for typedefs, structures, and compiler characteristics.
111 dnl Check for SO_REUSEPORT
112 AC_CHECK_DECL([SO_REUSEPORT],
113 AC_DEFINE(HAVE_SO_REUSEPORT,1,[Define if kernel supports SO_REUSEPORT]),
116 #include <sys/types.h>
117 #include <sys/socket.h>
120 dnl Checks for library functions.
125 AC_CHECK_FUNCS(gettimeofday socket strerror)
127 dnl These are mostly for solaris
128 AC_CHECK_LIB(socket,main)
129 AC_CHECK_LIB(nsl,main)
130 AC_CHECK_LIB(xnet,main)
131 AC_CHECK_LIB(resolv,main)
134 AC_CHECK_FUNCS(syslog)
135 AC_CHECK_LIB(syslog,main)
137 dnl allow for an external gettimeofday function, mostly useful for people have
138 dnl reimplemented gettimeofday because the system call is slow (FreeBSD 4.11)
139 AC_ARG_ENABLE(external-gettimeofday,
140 [ --enable-external-gettimeofday=<header> Provide an external definition of the gettimeofday function. The header pointed to should contain a macro which defines GETTIMEOFDAY(t,tz). The header will be included in the appropriate place, so that your macro is substituted],
141 [AC_DEFINE([HAVE_EXTERNAL_GETTIMEOFDAY], [1], [Define to 1 if there is an external gettimeofday defined])
142 AC_DEFINE_UNQUOTED([EXTERNAL_GETTIMEOFDAY_HEADER], "$enable_external_gettimeofday", [Header for external gettime of day])
144 AC_MSG_WARN(using system gettimeofday))
146 dnl -- determine the type of varargs this platform supports --
147 # check for flavours of varargs macros
148 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
150 int a(int p1, int p2, int p3);
151 #define call_a(...) a(1,__VA_ARGS__)
153 ],g_have_iso_c_varargs=yes,g_have_iso_c_varargs=no)
154 AC_MSG_RESULT($g_have_iso_c_varargs)
155 if test "x$g_have_iso_c_varargs" = "xyes" ; then
156 AC_DEFINE(HAVE_ISO_C_VARARGS, 1, [ISO C varargs])
159 AC_MSG_CHECKING(for GNUC varargs macros)
161 int a(int p1, int p2, int p3);
162 #define call_a(params...) a(1,params)
164 ],g_have_gnuc_varargs=yes,g_have_gnuc_varargs=no)
165 AC_MSG_RESULT($g_have_gnuc_varargs)
166 if test "x$g_have_gnuc_varargs" = "xyes" ; then
167 AC_DEFINE(HAVE_GNUC_C_VARARGS, 1, [GNUC varargs])
171 # --- Coverage hooks ---
173 AC_ARG_ENABLE(coverage,
174 [ --enable-coverage turn on -fprofile-arcs -ftest-coverage], [case "${enableval}" in
175 yes) ENABLE_COVERAGE=1 ;;
176 no) ENABLE_COVERAGE=0 ;;
177 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;;
181 if test "x[$]ENABLE_COVERAGE" = "x1"; then
182 AC_MSG_WARN(enable coverage)
183 CFLAGS="`echo \"[$]CFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
184 CXXFLAGS="`echo \"[$]CXXFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
187 AC_SUBST(ENABLE_COVERAGE)
189 # --- Compiler warnings ---
191 # for developer use, enable lots of compile warnings,
192 # but don't require this generally, because some system's
193 # header files (BSD) can't handle it
195 # NB: must add -Werror after AC_PROG_CC, etc., so do this last
197 AC_ARG_ENABLE(hardcore,
198 [ --disable-hardcore turn off -W -Wall -Werror],
199 [case "${enableval}" in
200 yes) ENABLE_HARDCORE=1 ;;
201 no) ENABLE_HARDCORE=0 ;;
202 *) AC_MSG_ERROR(bad value ${enableval} for --disable-hardcore) ;; esac],
205 if test "x[$]ENABLE_HARDCORE" = "x1"; then
206 AC_MSG_WARN(enable hardcore compile warnings)
207 if test "x$CXX" = "x"; then
208 dnl - only valid for C with newer gcc's
209 CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
211 CPPFLAGS="[$]CPPFLAGS -Werror -W -Wall -Wpointer-arith -Wcast-align -Wwrite-strings"
215 AC_CONFIG_FILES([Makefile
219 AC_CONFIG_FILES([tests/test-wrapper.sh],
220 [chmod +x tests/test-wrapper.sh])