1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([lwes-journaller], [1.1.2], [lwes-devel@lists.sourceforge.net])
4 AM_INIT_AUTOMAKE([foreign])
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 sched.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])
63 AC_CHECK_HEADER(zlib.h,
64 AC_CHECK_LIB(z, gzopen,[
66 AC_DEFINE([HAVE_LIBZ], [1], [Define if zlib library is there (-lz)])
67 AC_DEFINE([HAVE_LIBZ_H], [1], [Define if <zlib.h> is there])
71 dnl Check for LWES installed
72 PKG_CHECK_MODULES([LWES], [lwes-1 >= 1.1.2])
76 dnl Check for mondemand installed, if requested
77 AC_ARG_WITH([mondemand], AS_HELP_STRING([--with-mondemand],
78 [Build with support for mondemand logging and statistics (default: disabled)]))
79 if test "x$with_mondemand" == "xyes"; then
80 PKG_CHECK_MODULES([MONDEMAND], [mondemand-4 >= 4.4.2])
81 AC_SUBST(MONDEMAND_CFLAGS)
82 AC_SUBST(MONDEMAND_LIBS)
83 AC_DEFINE(HAVE_MONDEMAND, 1, [System supports mondemand])
86 dnl Check for messaging
87 AC_MSG_CHECKING(for sys/msg support)
90 ],[ ],g_have_sys_msg=yes,g_have_sys_msg=no)
91 AC_MSG_RESULT($g_have_sys_msg)
92 if test "x$g_have_sys_msg" = "xyes" ; then
93 AC_DEFINE(HAVE_SYS_MSG_H, 1, [System supports sys/msg.h])
97 AC_MSG_CHECKING(for mqueue support)
100 ],[ ],g_have_mqueue=yes,g_have_mqueue=no)
101 AC_MSG_RESULT($g_have_mqueue)
102 if test "x$g_have_mqueue" = "xyes" ; then
103 AC_DEFINE(HAVE_MQUEUE_H, 1, [System supports mqueue.h])
105 AC_CHECK_LIB(rt, main)
107 dnl Checks for typedefs, structures, and compiler characteristics.
114 dnl Found this check here https://github.com/varnish/hitch with license
115 dnl ------------- BEGIN included chunk
116 dnl Copyright 2015-2016 Varnish Software
117 dnl Copyright 2012 Bump Technologies, Inc. All rights reserved.
119 dnl Redistribution and use in source and binary forms, with or without modification, are
120 dnl permitted provided that the following conditions are met:
122 dnl 1. Redistributions of source code must retain the above copyright notice, this list of
123 dnl conditions and the following disclaimer.
125 dnl 2. Redistributions in binary form must reproduce the above copyright notice, this list
126 dnl of conditions and the following disclaimer in the documentation and/or other materials
127 dnl provided with the distribution.
129 dnl THIS SOFTWARE IS PROVIDED BY BUMP TECHNOLOGIES, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED
130 dnl WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
131 dnl FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BUMP TECHNOLOGIES, INC. OR
132 dnl CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
133 dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
134 dnl SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
135 dnl ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
136 dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
137 dnl ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
139 dnl The views and conclusions contained in the software and documentation are those of the
140 dnl authors and should not be interpreted as representing official policies, either expressed
141 dnl or implied, of Bump Technologies, Inc.
142 AC_CACHE_CHECK([whether SO_REUSEPORT works],
143 [ac_cv_so_reuseport_works],
146 #include <sys/types.h>
147 #include <sys/socket.h>
149 int s = socket(AF_INET, SOCK_STREAM, 0);
151 if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &i, sizeof i) < 0)
155 [ac_cv_so_reuseport_works=yes],
156 [ac_cv_so_reuseport_works=no])
159 if test "$ac_cv_so_reuseport_works" = yes; then
160 AC_DEFINE([HAVE_SO_REUSEPORT], [1], [Define if SO_REUSEPORT works])
162 dnl ------------- END included chunk
164 dnl Checks for library functions.
169 AC_CHECK_FUNCS(gettimeofday socket strerror)
171 dnl These are mostly for solaris
172 AC_CHECK_LIB(socket,main)
173 AC_CHECK_LIB(nsl,main)
174 AC_CHECK_LIB(xnet,main)
175 AC_CHECK_LIB(resolv,main)
178 AC_CHECK_FUNCS(syslog)
179 AC_CHECK_LIB(syslog,main)
181 dnl allow for an external gettimeofday function, mostly useful for people have
182 dnl reimplemented gettimeofday because the system call is slow (FreeBSD 4.11)
183 AC_ARG_ENABLE(external-gettimeofday,
184 [ --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],
185 [AC_DEFINE([HAVE_EXTERNAL_GETTIMEOFDAY], [1], [Define to 1 if there is an external gettimeofday defined])
186 AC_DEFINE_UNQUOTED([EXTERNAL_GETTIMEOFDAY_HEADER], "$enable_external_gettimeofday", [Header for external gettime of day])
188 AC_MSG_WARN(using system gettimeofday))
190 dnl -- determine the type of varargs this platform supports --
191 # check for flavours of varargs macros
192 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
194 int a(int p1, int p2, int p3);
195 #define call_a(...) a(1,__VA_ARGS__)
197 ],g_have_iso_c_varargs=yes,g_have_iso_c_varargs=no)
198 AC_MSG_RESULT($g_have_iso_c_varargs)
199 if test "x$g_have_iso_c_varargs" = "xyes" ; then
200 AC_DEFINE(HAVE_ISO_C_VARARGS, 1, [ISO C varargs])
203 AC_MSG_CHECKING(for GNUC varargs macros)
205 int a(int p1, int p2, int p3);
206 #define call_a(params...) a(1,params)
208 ],g_have_gnuc_varargs=yes,g_have_gnuc_varargs=no)
209 AC_MSG_RESULT($g_have_gnuc_varargs)
210 if test "x$g_have_gnuc_varargs" = "xyes" ; then
211 AC_DEFINE(HAVE_GNUC_C_VARARGS, 1, [GNUC varargs])
215 # --- Coverage hooks ---
217 AC_ARG_ENABLE(coverage,
218 [ --enable-coverage turn on -fprofile-arcs -ftest-coverage], [case "${enableval}" in
219 yes) ENABLE_COVERAGE=1 ;;
220 no) ENABLE_COVERAGE=0 ;;
221 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;;
225 if test "x[$]ENABLE_COVERAGE" = "x1"; then
226 AC_MSG_WARN(enable coverage)
227 CFLAGS="`echo \"[$]CFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
228 CXXFLAGS="`echo \"[$]CXXFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
231 AC_SUBST(ENABLE_COVERAGE)
233 # --- Compiler warnings ---
235 # for developer use, enable lots of compile warnings,
236 # but don't require this generally, because some system's
237 # header files (BSD) can't handle it
239 # NB: must add -Werror after AC_PROG_CC, etc., so do this last
241 AC_ARG_ENABLE(hardcore,
242 [ --disable-hardcore turn off -W -Wall -Werror],
243 [case "${enableval}" in
244 yes) ENABLE_HARDCORE=1 ;;
245 no) ENABLE_HARDCORE=0 ;;
246 *) AC_MSG_ERROR(bad value ${enableval} for --disable-hardcore) ;; esac],
249 if test "x[$]ENABLE_HARDCORE" = "x1"; then
250 AC_MSG_WARN(enable hardcore compile warnings)
251 if test "x$CXX" = "x"; then
252 dnl - only valid for C with newer gcc's
253 CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
255 CPPFLAGS="[$]CPPFLAGS -Werror -W -Wall -Wpointer-arith -Wcast-align -Wwrite-strings"
259 AC_CONFIG_FILES([Makefile
263 AC_CONFIG_FILES([tests/test-wrapper.sh],
264 [chmod +x tests/test-wrapper.sh])