Must use (void) instead of () for function declarations.
[lwes-journaller.git] / configure.ac
blob4d234e7f22a81691f513446d0010e4876daccca5
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])
4 AM_INIT_AUTOMAKE
6 dnl Determine the host type for the host specific inclusion below
7 AC_CANONICAL_HOST
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)
26 AC_SUBST(SHORT_DESC)
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
34 AM_MAINTAINER_MODE
35 AC_SUBST(USE_MAINTAINER_MODE)
37 dnl -- we want a header to include in our source files with configure
38 dnl    info
39 AM_CONFIG_HEADER(src/config.h)
41 dnl -- make sure we have a C compiler and libtool
42 AC_PROG_CC
43 AM_PROG_LIBTOOL
45 dnl Checks for header files.
46 AC_HEADER_STDC
47 AC_HEADER_SYS_WAIT
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],
51                           [1],
52                           [Define to 1 if the <valgrind/valgrind.h> header is on the system]))
54 dnl Check for LWES installed
55 PKG_CHECK_MODULES([LWES], [lwes-0 >= 0.22.0])
56 AC_SUBST(LWES_CFLAGS)
57 AC_SUBST(LWES_LIBS)
59 dnl Check for messaging
60 AC_MSG_CHECKING(for sys/msg support)
61 AC_TRY_COMPILE([
62                 #include <sys/msg.h>
63                 ],[ ],g_have_sys_msg=yes,g_have_sys_msg=no)
64 AC_MSG_RESULT($g_have_sys_msg)
65 if test "x$g_have_sys_msg" = "xyes" ; then
66   AC_DEFINE(HAVE_SYS_MSG_H, 1, [System supports sys/msg.h])
69 dnl Check for mqueue
70 AC_MSG_CHECKING(for mqueue support)
71 AC_TRY_COMPILE([
72                 #include <mqueue.h>
73                 ],[ ],g_have_mqueue=yes,g_have_mqueue=no)
74 AC_MSG_RESULT($g_have_mqueue)
75 if test "x$g_have_mqueue" = "xyes" ; then
76   AC_DEFINE(HAVE_MQUEUE_H, 1, [System supports mqueue.h])
78 AC_CHECK_LIB(rt, main)
80 dnl Checks for typedefs, structures, and compiler characteristics.
81 AC_C_CONST
82 AC_TYPE_MODE_T
83 AC_TYPE_SIZE_T
84 AC_HEADER_TIME
85 AC_STRUCT_TM
87 dnl Checks for library functions.
88 AC_FUNC_ALLOCA
89 AC_FUNC_MEMCMP
90 AC_FUNC_MMAP
91 AC_FUNC_VPRINTF
92 AC_CHECK_FUNCS(gettimeofday socket strerror)
94 dnl These are mostly for solaris
95 AC_CHECK_LIB(socket,main)
96 AC_CHECK_LIB(nsl,main)
97 AC_CHECK_LIB(xnet,main)
98 AC_CHECK_LIB(resolv,main)
100 dnl syslog check
101 AC_CHECK_FUNCS(syslog)
102 AC_CHECK_LIB(syslog,main)
104 dnl allow for an external gettimeofday function, mostly useful for people have
105 dnl reimplemented gettimeofday because the system call is slow (FreeBSD 4.11)
106 AC_ARG_ENABLE(external-gettimeofday,
107               [  --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],
108               [AC_DEFINE([HAVE_EXTERNAL_GETTIMEOFDAY], [1], [Define to 1 if there is an external gettimeofday defined])
109                AC_DEFINE_UNQUOTED([EXTERNAL_GETTIMEOFDAY_HEADER], "$enable_external_gettimeofday", [Header for external gettime of day])
110                ],
111               AC_MSG_WARN(using system gettimeofday))
113 dnl  -- determine the type of varargs this platform supports --
114 # check for flavours of varargs macros
115 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
116 AC_TRY_COMPILE([],[
117 int a(int p1, int p2, int p3);
118 #define call_a(...) a(1,__VA_ARGS__)
119 call_a(2,3);
120 ],g_have_iso_c_varargs=yes,g_have_iso_c_varargs=no)
121 AC_MSG_RESULT($g_have_iso_c_varargs)
122 if test "x$g_have_iso_c_varargs" = "xyes" ; then
123   AC_DEFINE(HAVE_ISO_C_VARARGS, 1, [ISO C varargs])
126 AC_MSG_CHECKING(for GNUC varargs macros)
127 AC_TRY_COMPILE([],[
128 int a(int p1, int p2, int p3);
129 #define call_a(params...) a(1,params)
130 call_a(2,3);
131 ],g_have_gnuc_varargs=yes,g_have_gnuc_varargs=no)
132 AC_MSG_RESULT($g_have_gnuc_varargs)
133 if test "x$g_have_gnuc_varargs" = "xyes" ; then
134   AC_DEFINE(HAVE_GNUC_C_VARARGS, 1, [GNUC varargs])
138 # --- Coverage hooks ---
140 AC_ARG_ENABLE(coverage,
141               [  --enable-coverage      turn on -fprofile-arcs -ftest-coverage],              [case "${enableval}" in
142                 yes) ENABLE_COVERAGE=1 ;;
143                 no) ENABLE_COVERAGE=0 ;;
144                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;;
145               esac],
146               [ENABLE_COVERAGE=2])
148 if test "x[$]ENABLE_COVERAGE" = "x1"; then
149   AC_MSG_WARN(enable coverage)
150   CFLAGS="`echo \"[$]CFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
151   CXXFLAGS="`echo \"[$]CXXFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
154 AC_SUBST(ENABLE_COVERAGE)
156 # --- Compiler warnings ---
158 # for developer use, enable lots of compile warnings,
159 # but don't require this generally, because some system's
160 # header files (BSD) can't handle it
162 # NB: must add -Werror after AC_PROG_CC, etc., so do this last
164 AC_ARG_ENABLE(hardcore,
165               [  --disable-hardcore      turn off -W -Wall -Werror],
166               [case "${enableval}" in
167                 yes) ENABLE_HARDCORE=1 ;;
168                 no) ENABLE_HARDCORE=0 ;;
169                 *) AC_MSG_ERROR(bad value ${enableval} for --disable-hardcore) ;;              esac],
170               [ENABLE_HARDCORE=1])
172 if test "x[$]ENABLE_HARDCORE" = "x1"; then
173   AC_MSG_WARN(enable hardcore compile warnings)
174   if test "x$CXX" = "x"; then
175     dnl - only valid for C with newer gcc's
176     CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
177   fi
178   CPPFLAGS="[$]CPPFLAGS -Werror -W -Wall -Wpointer-arith -Wcast-align -Wwrite-strings"
182 AC_CONFIG_FILES([Makefile
183                  src/Makefile
184                  tests/Makefile
185                  doxygen.config])
186 AC_CONFIG_FILES([tests/test-wrapper.sh],
187                 [chmod +x tests/test-wrapper.sh])
189 AC_OUTPUT