1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([lwes], [0.23.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 the C library for sending and receiving events."
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
44 dnl -- if we are building a library we need libtool
47 dnl Checks for programs.
51 dnl Checks for header files.
54 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h getopt.h)
55 AC_CHECK_HEADER(valgrind/valgrind.h,
56 AC_DEFINE([HAVE_VALGRIND_HEADER],
58 [Define to 1 if the <valgrind/valgrind.h> header is on the system]))
60 dnl Checks for typedefs, structures, and compiler characteristics.
67 dnl Checks for library functions.
72 AC_CHECK_FUNCS(gettimeofday socket strerror)
74 dnl Checks for libraries.
75 dnl Don't know if I need this, but it won't compile if flex is used without it
78 dnl These are mostly for solaris
79 AC_CHECK_LIB(socket,main)
80 AC_CHECK_LIB(nsl,main)
81 AC_CHECK_LIB(xnet,main)
82 AC_CHECK_LIB(resolv,main)
84 dnl allow for an external gettimeofday function, mostly useful for people have
85 dnl reimplemented gettimeofday because the system call is slow (FreeBSD 4.11)
86 AC_ARG_ENABLE(external-gettimeofday,
87 [ --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],
88 [AC_DEFINE([HAVE_EXTERNAL_GETTIMEOFDAY], [1], [Define to 1 if there is an external gettimeofday defined])
89 AC_DEFINE_UNQUOTED([EXTERNAL_GETTIMEOFDAY_HEADER], "$enable_external_gettimeofday", [Header for external gettime of day])
91 AC_MSG_WARN(using system gettimeofday))
93 # --- Coverage hooks ---
95 AC_ARG_ENABLE(coverage,
96 [ --enable-coverage turn on -fprofile-arcs -ftest-coverage], [case "${enableval}" in
97 yes) ENABLE_COVERAGE=1 ;;
98 no) ENABLE_COVERAGE=0 ;;
99 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cov) ;;
103 if test "x[$]ENABLE_COVERAGE" = "x1"; then
104 AC_MSG_WARN(enable coverage)
105 CFLAGS="`echo \"[$]CFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
106 CXXFLAGS="`echo \"[$]CXXFLAGS\" | perl -pe 's/-O\d+//g;'` -fprofile-arcs -ftest-coverage"
107 GCOV_LTFLAGS="-XCClinker -fprofile-arcs -XCClinker -ftest-coverage"
110 AC_SUBST(ENABLE_COVERAGE)
111 AC_SUBST(GCOV_LTFLAGS)
113 # --- Compiler warnings ---
115 # for developer use, enable lots of compile warnings,
116 # but don't require this generally, because some system's
117 # header files (BSD) can't handle it
119 # NB: must add -Werror after AC_PROG_CC, etc., so do this last
121 AC_ARG_ENABLE(hardcore,
122 [ --disable-hardcore turn off -W -Wall -Werror],
123 [case "${enableval}" in
124 yes) ENABLE_HARDCORE=1 ;;
125 no) ENABLE_HARDCORE=0 ;;
126 *) AC_MSG_ERROR(bad value ${enableval} for --disable-hardcore) ;; esac],
129 if test "x[$]ENABLE_HARDCORE" = "x1"; then
130 AC_MSG_WARN(enable hardcore compile warnings)
131 if test "x$CXX" = "x"; then
132 dnl - only valid for C with newer gcc's
133 CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
135 CPPFLAGS="[$]CPPFLAGS -Werror -W -Wall -Wpointer-arith -Wcast-align -Wwrite-strings"
139 AC_CONFIG_FILES([Makefile
143 pkgconfig-template.pc])
144 AC_CONFIG_FILES([tests/test-wrapper.sh],
145 [chmod +x tests/test-wrapper.sh])