1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([lwes-journaller], [0.0.1], [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.22.0])
73 dnl Check for messaging
74 AC_MSG_CHECKING(for sys/msg support)
77 ],[ ],g_have_sys_msg=yes,g_have_sys_msg=no)
78 AC_MSG_RESULT($g_have_sys_msg)
79 if test "x$g_have_sys_msg" = "xyes" ; then
80 AC_DEFINE(HAVE_SYS_MSG_H, 1, [System supports sys/msg.h])
84 AC_MSG_CHECKING(for mqueue support)
87 ],[ ],g_have_mqueue=yes,g_have_mqueue=no)
88 AC_MSG_RESULT($g_have_mqueue)
89 if test "x$g_have_mqueue" = "xyes" ; then
90 AC_DEFINE(HAVE_MQUEUE_H, 1, [System supports mqueue.h])
92 AC_CHECK_LIB(rt, main)
94 dnl Checks for typedefs, structures, and compiler characteristics.
101 dnl Checks for library functions.
106 AC_CHECK_FUNCS(gettimeofday socket strerror)
108 dnl These are mostly for solaris
109 AC_CHECK_LIB(socket,main)
110 AC_CHECK_LIB(nsl,main)
111 AC_CHECK_LIB(xnet,main)
112 AC_CHECK_LIB(resolv,main)
115 AC_CHECK_FUNCS(syslog)
116 AC_CHECK_LIB(syslog,main)
118 dnl allow for an external gettimeofday function, mostly useful for people have
119 dnl reimplemented gettimeofday because the system call is slow (FreeBSD 4.11)
120 AC_ARG_ENABLE(external-gettimeofday,
121 [ --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],
122 [AC_DEFINE([HAVE_EXTERNAL_GETTIMEOFDAY], [1], [Define to 1 if there is an external gettimeofday defined])
123 AC_DEFINE_UNQUOTED([EXTERNAL_GETTIMEOFDAY_HEADER], "$enable_external_gettimeofday", [Header for external gettime of day])
125 AC_MSG_WARN(using system gettimeofday))
127 dnl -- determine the type of varargs this platform supports --
128 # check for flavours of varargs macros
129 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
131 int a(int p1, int p2, int p3);
132 #define call_a(...) a(1,__VA_ARGS__)
134 ],g_have_iso_c_varargs=yes,g_have_iso_c_varargs=no)
135 AC_MSG_RESULT($g_have_iso_c_varargs)
136 if test "x$g_have_iso_c_varargs" = "xyes" ; then
137 AC_DEFINE(HAVE_ISO_C_VARARGS, 1, [ISO C varargs])
140 AC_MSG_CHECKING(for GNUC varargs macros)
142 int a(int p1, int p2, int p3);
143 #define call_a(params...) a(1,params)
145 ],g_have_gnuc_varargs=yes,g_have_gnuc_varargs=no)
146 AC_MSG_RESULT($g_have_gnuc_varargs)
147 if test "x$g_have_gnuc_varargs" = "xyes" ; then
148 AC_DEFINE(HAVE_GNUC_C_VARARGS, 1, [GNUC varargs])
152 # --- Coverage hooks ---
154 AC_ARG_ENABLE(coverage,
155 [ --enable-coverage turn on -fprofile-arcs -ftest-coverage], [case "${enableval}" in
156 yes) ENABLE_COVERAGE=1 ;;
157 no) ENABLE_COVERAGE=0 ;;
158 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;;
162 if test "x[$]ENABLE_COVERAGE" = "x1"; then
163 AC_MSG_WARN(enable coverage)
164 CFLAGS="`echo \"[$]CFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
165 CXXFLAGS="`echo \"[$]CXXFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
168 AC_SUBST(ENABLE_COVERAGE)
170 # --- Compiler warnings ---
172 # for developer use, enable lots of compile warnings,
173 # but don't require this generally, because some system's
174 # header files (BSD) can't handle it
176 # NB: must add -Werror after AC_PROG_CC, etc., so do this last
178 AC_ARG_ENABLE(hardcore,
179 [ --disable-hardcore turn off -W -Wall -Werror],
180 [case "${enableval}" in
181 yes) ENABLE_HARDCORE=1 ;;
182 no) ENABLE_HARDCORE=0 ;;
183 *) AC_MSG_ERROR(bad value ${enableval} for --disable-hardcore) ;; esac],
186 if test "x[$]ENABLE_HARDCORE" = "x1"; then
187 AC_MSG_WARN(enable hardcore compile warnings)
188 if test "x$CXX" = "x"; then
189 dnl - only valid for C with newer gcc's
190 CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
192 CPPFLAGS="[$]CPPFLAGS -Werror -W -Wall -Wpointer-arith -Wcast-align -Wwrite-strings"
196 AC_CONFIG_FILES([Makefile
200 AC_CONFIG_FILES([tests/test-wrapper.sh],
201 [chmod +x tests/test-wrapper.sh])