1 dnl Process this file with autoconf to produce a configure script.
4 dnl Checks for programs.
10 dnl Checks for libraries.
11 AC_CHECK_LIB(dl, dlopen)
12 AC_CHECK_HEADER(pcap.h,HAVE_PCAP_H=true)
14 dnl Checks for header files.
17 AC_CHECK_HEADERS(fcntl.h unistd.h)
19 dnl Checks for typedefs, structures, and compiler characteristics.
24 dnl Checks for library functions.
26 AC_CHECK_FUNCS(socket strerror)
28 dnl Checks for kernel source directory.
29 AC_MSG_CHECKING([kernel source directory])
30 KSRC="/lib/modules/`uname -r`/build"
32 --with-kernel=DIR kernel source directory,
35 # Check if kernel source directory has been configured
36 if test -f "$KSRC/include/linux/version.h" ; then
37 # Get kernel version number
38 eval KVER=$(echo "#include <linux/version.h>" | cpp -I "$KSRC/include" -dM - | awk '/UTS_RELEASE/ { print $3 }')
39 AC_MSG_RESULT([$KVER])
41 AC_MSG_RESULT([$KSRC/include/linux/version.h not found])
42 AC_MSG_ERROR(kernel source directory not specified or not configured)
47 dnl NetFlow prerequisites.
49 --with-proper=<directory> proper installed in <directory>,
50 [ CPPFLAGS="$CPPFLAGS -I$withval/include" ; LDFLAGS="$LDFLAGS -L$withval/.libs" ],
52 AC_CHECK_HEADER(prop.h, HAVE_PROP_H=true)
53 AC_CHECK_LIB(proper, prop_create_socket)
54 AC_CHECK_HEADER(pthread.h, HAVE_PTHREAD_H=true, AC_MSG_ERROR(NetFlow requires pthread))
55 AC_CHECK_LIB(pthread, pthread_create, [], AC_MSG_ERROR(NetFlow requires pthread))
67 --with-mysql=<directory> mysql installed in <directory>,[
68 if test $withval != yes
75 AC_MSG_CHECKING(for MySQL files)
76 for d in $dir/bin /usr/bin /usr/local/bin /usr/local/mysql/bin /opt/mysql/bin /opt/packages/mysql/bin
78 if test -f $d/mysql_config
80 AC_MSG_RESULT(found mysql_config in $d)
86 if test x$mysqldir = x
88 AC_MSG_WARN(MySQL backend not used)
91 MYSQLINCLUDES=`$d/mysql_config --include`
92 MYSQLLIBS=`$d/mysql_config --libs`
94 DATABASE_DIR="${DATABASE_DIR} mysql"
96 MYSQL_LIB="${DATABASE_LIB} ${MYSQLLIBS} "
97 # no change to DATABASE_LIB_DIR, since --libs already includes -L
99 DATABASE_DRIVERS="${DATABASE_DRIVERS} ../mysql/mysql_driver.o "
101 DB_DEF="${DB_DEF} -DHAVE_MYSQL "
104 AC_SUBST(MYSQLINCLUDES)
107 dnl Here we check whether we have an old MySQL client library
108 dnl installed, which does not support the mysql_real_escape_string(),
109 dnl but the real_escape_string() function.
110 dnl Having a look in the libary itself should be more reliable than
111 dnl parsing the output of mysql --version.
113 AC_MSG_CHECKING(for mysql_real_escape_string support)
115 MYSQL_FUNCTION_TEST=`strings ${MYSQLLIBS}/libmysqlclient.so | grep mysql_real_escape_string`
117 if test "x$MYSQL_FUNCTION_TEST" = x
119 EXTRA_MYSQL_DEF="-DOLD_MYSQL=1 "
120 AC_MSG_RESULT(found old MySQL)
122 AC_MSG_RESULT(found new MySQL)
130 dnl Check whether the user wants log IP-addresses as strings rather
131 dnl than as unsigned long-integers to his MySQL-database. Since this
132 dnl feature is only used in ulogd_MYSQL.c, there are no checks in any
136 AC_ARG_WITH(mysql-log-ip-as-string,
137 --with-mysql-log-ip-as-string log IPs as string rather than as
138 unsigned long-integer.
140 EXTRA_MYSQL_DEF="${EXTRA_MYSQL_DEF} -DIP_AS_STRING=1"
141 AC_MSG_WARN(the use of --with-mysql-log-ip-as-string is discouraged)
146 dnl test for PostgreSQL
149 --with-pgsql=<directory> pgsql installed in <directory>,[
150 if test $withval != yes
157 AC_MSG_CHECKING(for PGSQL files)
158 for d in $dir/bin /usr/bin /usr/local/bin /usr/local/pgsql/bin /opt/pgsql/bin /opt/packages/pgsql/bin
160 if test -x $d/pg_config
162 AC_MSG_RESULT(found pg_config in $d)
168 if test x$pgsqldir = x
170 AC_MSG_WARN(PGSQL backend not used)
172 AC_DEFINE(HAVE_PGSQL)
173 PGSQLINCLUDES=`$pgsqldir/pg_config --includedir`
174 PGSQLLIBS=`$pgsqldir/pg_config --libdir`
176 DATABASE_DIR="${DATABASE_DIR} pgsql"
177 PGSQL_LIB="${DATABASE_LIB} -lpq "
179 DATABASE_LIB_DIR="${DATABASE_LIB_DIR} -L${PGSQLLIBS} "
180 DB_DEF="${DB_DEF} -DHAVE_PGSQL "
182 AC_SUBST(PGSQLINCLUDES)
189 dnl Check whether the user wants to log IP-addresses as strings rather
190 dnl than integers to his pgsql-database.
193 AC_ARG_WITH(pgsql-log-ip-as-string,
194 --with-pgsql-log-ip-as-string log IPs as string rather than as interger
196 EXTRA_PGSQL_DEF="-DIP_AS_STRING=1"
204 --with-sqlite3=<directory> sqlite3 installed in <directory>,[
205 if test $withval != yes
212 AC_MSG_CHECKING(for sqlite3 files)
213 for d in $dir /usr /usr/local /usr/local/sqlite3
215 if test -f $d/lib/sqlite3/libsqlite3.so
217 AC_MSG_RESULT(found sqlite3 in $d)
219 sqlite3dir_suffix=/sqlite3
221 elif test -f $d/lib64/sqlite3/libsqlite3.so
223 AC_MSG_RESULT(found sqlite3 in $d)
225 sqlite3dir_suffix=/sqlite3
227 elif test -f $d/lib/libsqlite3.so
229 AC_MSG_RESULT(found sqlite in $d)
233 elif test -f $d/lib64/libsqlite3.so
235 AC_MSG_RESULT(found sqlite in $d)
242 if test x$sqlite3dir = x
244 AC_MSG_WARN(sqlite3 backend not used)
246 AC_DEFINE(HAVE_SQLITE3)
247 SQLITE3INCLUDES=${sqlite3dir}/include${sqlite3dir_suffix}
248 SQLITE3LIBS=${sqlite3dir}/lib${sqlite3dir_suffix}
250 DATABASE_DIR="${DATABASE_DIR} sqlite3"
252 SQLITE3_LIB="${DATABASE_LIB} -lsqlite3 "
253 DATABASE_LIB_DIR="${DATABASE_LIB_DIR} -L${SQLITE3LIBS} "
255 dnl DATABASE_DRIVERS="${DATABASE_DRIVERS} ../sqlite3/mysql_driver.o "
257 DB_DEF="${DB_DEF} -DHAVE_SQLITE3 "
260 AC_SUBST(SQLITE3INCLUDES)
261 AC_SUBST(SQLITE3_LIB)
268 dnl Check whether the user wants log IP-addresses as strings rather
269 dnl than as unsigned long-integers to his sqlite3-database. Since this
270 dnl feature is only used in ulogd_SQLITE3.c, there are no checks in any
274 AC_ARG_WITH(sqlite3-log-ip-as-string,
275 --with-sqlite3-log-ip-as-string log IPs as string rather than as
276 unsigned long-integer.
278 EXTRA_SQLITE3_DEF="${EXTRA_SQLITE3_DEF} -DIP_AS_STRING=1"
279 AC_MSG_WARN(the use of --with-sqlite3-log-ip-as-string is discouraged)
283 AC_SUBST(DATABASE_DIR)
284 AC_SUBST(DATABASE_LIB)
285 AC_SUBST(DATABASE_LIB_DIR)
287 AC_SUBST(EXTRA_MYSQL_DEF)
288 AC_SUBST(EXTRA_PGSQL_DEF)
289 AC_SUBST(EXTRA_SQLITE3_DEF)
291 AC_SUBST(DATABASE_DRIVERS)
292 AC_SUBST(HAVE_PCAP_H)
294 AM_CONDITIONAL(HAVE_MYSQL, test x$mysqldir != x)
295 AM_CONDITIONAL(HAVE_PGSQL, test x$pgsqldir != x)
296 AM_CONDITIONAL(HAVE_SQLITE3, test x$sqlite3dir != x)
298 AC_OUTPUT(extensions/Makefile doc/Makefile conffile/Makefile libipulog/Makefile mysql/Makefile pgsql/Makefile sqlite3/Makefile pcap/Makefile drl/Makefile Makefile Rules.make)