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 NetFlow prerequisites.
30 --with-proper=<directory> proper installed in <directory>,
31 [ CPPFLAGS="$CPPFLAGS -I$withval/include" ; LDFLAGS="$LDFLAGS -L$withval/.libs" ],
33 AC_CHECK_HEADER(prop.h, HAVE_PROP_H=true)
34 AC_CHECK_LIB(proper, prop_create_socket)
35 AC_CHECK_HEADER(pthread.h, HAVE_PTHREAD_H=true, AC_MSG_ERROR(NetFlow requires pthread))
36 AC_CHECK_LIB(pthread, pthread_create, [], AC_MSG_ERROR(NetFlow requires pthread))
48 --with-mysql=<directory> mysql installed in <directory>,[
49 if test $withval != yes
56 AC_MSG_CHECKING(for MySQL files)
57 for d in $dir/bin /usr/bin /usr/local/bin /usr/local/mysql/bin /opt/mysql/bin /opt/packages/mysql/bin
59 if test -f $d/mysql_config
61 AC_MSG_RESULT(found mysql_config in $d)
67 if test x$mysqldir = x
69 AC_MSG_WARN(MySQL backend not used)
72 MYSQLINCLUDES=`$d/mysql_config --include`
73 MYSQLLIBS=`$d/mysql_config --libs`
75 DATABASE_DIR="${DATABASE_DIR} mysql"
77 MYSQL_LIB="${DATABASE_LIB} ${MYSQLLIBS} "
78 # no change to DATABASE_LIB_DIR, since --libs already includes -L
80 DATABASE_DRIVERS="${DATABASE_DRIVERS} ../mysql/mysql_driver.o "
82 DB_DEF="${DB_DEF} -DHAVE_MYSQL "
85 AC_SUBST(MYSQLINCLUDES)
88 dnl Here we check whether we have an old MySQL client library
89 dnl installed, which does not support the mysql_real_escape_string(),
90 dnl but the real_escape_string() function.
91 dnl Having a look in the libary itself should be more reliable than
92 dnl parsing the output of mysql --version.
94 AC_MSG_CHECKING(for mysql_real_escape_string support)
96 MYSQL_FUNCTION_TEST=`strings ${MYSQLLIBS}/libmysqlclient.so | grep mysql_real_escape_string`
98 if test "x$MYSQL_FUNCTION_TEST" = x
100 EXTRA_MYSQL_DEF="-DOLD_MYSQL=1 "
101 AC_MSG_RESULT(found old MySQL)
103 AC_MSG_RESULT(found new MySQL)
111 dnl Check whether the user wants log IP-addresses as strings rather
112 dnl than as unsigned long-integers to his MySQL-database. Since this
113 dnl feature is only used in ulogd_MYSQL.c, there are no checks in any
117 AC_ARG_WITH(mysql-log-ip-as-string,
118 --with-mysql-log-ip-as-string log IPs as string rather than as
119 unsigned long-integer.
121 EXTRA_MYSQL_DEF="${EXTRA_MYSQL_DEF} -DIP_AS_STRING=1"
122 AC_MSG_WARN(the use of --with-mysql-log-ip-as-string is discouraged)
128 AC_ARG_WITH(libxml2, --with-libxml=<directory> libxml2 installed in <directory>,[
129 if test $withval != yes
137 AC_MSG_CHECKING(for LIBXML2 files)
138 for d in $dir/bin /usr/bin /usr/local/bin /usr/local/libxml2/bin /opt/libxml2/bin /opt/packages/libxml2/bin
140 if test -x $d/xml2-config
142 AC_MSG_RESULT(found xml2-config in $d)
148 if test x$libxmldir = x
150 AC_MSG_ERROR(xml2-config not found)
152 XMLINCLUDES=`$libxmldir/xml2-config --cflags`
153 AC_SUBST(XMLINCLUDES)
155 XMLLIBS=`$libxmldir/xml2-config --libs`
160 dnl check for zookeeper library
162 zkdir="/usr/local/lib"
164 AC_ARG_WITH(zookeeper, --with-zookeeperlib=<directory> zookeeper shared object located in <directory>,[
165 if test $withval = no
168 AC_MSG_WARN(Building without zookeeper support.)
176 AC_MSG_CHECKING(for zookeeper libraries)
177 for d in $zkdir /usr/local/lib /lib /usr/lib
179 if test -f $d/libzookeeper_mt.so
181 AC_MSG_RESULT(found libzookeeper_mt.so in $d)
182 zklib=$d/libzookeeper_mt.so
190 AC_MSG_WARN(Zookeeper libraries not found.)
201 ZKFLAGS="-DTHREADED -DBUILD_ZOOKEEPER"
207 dnl test for PostgreSQL
210 --with-pgsql=<directory> pgsql installed in <directory>,[
211 if test $withval != yes
218 AC_MSG_CHECKING(for PGSQL files)
219 for d in $dir/bin /usr/bin /usr/local/bin /usr/local/pgsql/bin /opt/pgsql/bin /opt/packages/pgsql/bin
221 if test -x $d/pg_config
223 AC_MSG_RESULT(found pg_config in $d)
229 if test x$pgsqldir = x
231 AC_MSG_WARN(PGSQL backend not used)
233 AC_DEFINE(HAVE_PGSQL)
234 PGSQLINCLUDES=`$pgsqldir/pg_config --includedir`
235 PGSQLLIBS=`$pgsqldir/pg_config --libdir`
237 DATABASE_DIR="${DATABASE_DIR} pgsql"
238 PGSQL_LIB="${DATABASE_LIB} -lpq "
240 DATABASE_LIB_DIR="${DATABASE_LIB_DIR} -L${PGSQLLIBS} "
241 DB_DEF="${DB_DEF} -DHAVE_PGSQL "
243 AC_SUBST(PGSQLINCLUDES)
250 dnl Check whether the user wants to log IP-addresses as strings rather
251 dnl than integers to his pgsql-database.
254 AC_ARG_WITH(pgsql-log-ip-as-string,
255 --with-pgsql-log-ip-as-string log IPs as string rather than as interger
257 EXTRA_PGSQL_DEF="-DIP_AS_STRING=1"
265 --with-sqlite3=<directory> sqlite3 installed in <directory>,[
266 if test $withval != yes
273 AC_MSG_CHECKING(for sqlite3 files)
274 for d in $dir /usr /usr/local /usr/local/sqlite3
276 if test -f $d/lib/sqlite3/libsqlite3.so
278 AC_MSG_RESULT(found sqlite3 in $d)
280 sqlite3dir_suffix=/sqlite3
282 elif test -f $d/lib64/sqlite3/libsqlite3.so
284 AC_MSG_RESULT(found sqlite3 in $d)
286 sqlite3dir_suffix=/sqlite3
288 elif test -f $d/lib/libsqlite3.so
290 AC_MSG_RESULT(found sqlite in $d)
294 elif test -f $d/lib64/libsqlite3.so
296 AC_MSG_RESULT(found sqlite in $d)
303 if test x$sqlite3dir = x
305 AC_MSG_WARN(sqlite3 backend not used)
307 AC_DEFINE(HAVE_SQLITE3)
308 SQLITE3INCLUDES=${sqlite3dir}/include${sqlite3dir_suffix}
309 SQLITE3LIBS=${sqlite3dir}/lib${sqlite3dir_suffix}
311 DATABASE_DIR="${DATABASE_DIR} sqlite3"
313 SQLITE3_LIB="${DATABASE_LIB} -lsqlite3 "
314 DATABASE_LIB_DIR="${DATABASE_LIB_DIR} -L${SQLITE3LIBS} "
316 dnl DATABASE_DRIVERS="${DATABASE_DRIVERS} ../sqlite3/mysql_driver.o "
318 DB_DEF="${DB_DEF} -DHAVE_SQLITE3 "
321 AC_SUBST(SQLITE3INCLUDES)
322 AC_SUBST(SQLITE3_LIB)
329 dnl Check whether the user wants log IP-addresses as strings rather
330 dnl than as unsigned long-integers to his sqlite3-database. Since this
331 dnl feature is only used in ulogd_SQLITE3.c, there are no checks in any
335 AC_ARG_WITH(sqlite3-log-ip-as-string,
336 --with-sqlite3-log-ip-as-string log IPs as string rather than as
337 unsigned long-integer.
339 EXTRA_SQLITE3_DEF="${EXTRA_SQLITE3_DEF} -DIP_AS_STRING=1"
340 AC_MSG_WARN(the use of --with-sqlite3-log-ip-as-string is discouraged)
344 AC_SUBST(DATABASE_DIR)
345 AC_SUBST(DATABASE_LIB)
346 AC_SUBST(DATABASE_LIB_DIR)
348 AC_SUBST(EXTRA_MYSQL_DEF)
349 AC_SUBST(EXTRA_PGSQL_DEF)
350 AC_SUBST(EXTRA_SQLITE3_DEF)
352 AC_SUBST(DATABASE_DRIVERS)
353 AC_SUBST(HAVE_PCAP_H)
355 AM_CONDITIONAL(HAVE_MYSQL, test x$mysqldir != x)
356 AM_CONDITIONAL(HAVE_PGSQL, test x$pgsqldir != x)
357 AM_CONDITIONAL(HAVE_SQLITE3, test x$sqlite3dir != x)
359 AC_OUTPUT(extensions/Makefile doc/Makefile conffile/Makefile libipulog/Makefile mysql/Makefile pgsql/Makefile sqlite3/Makefile pcap/Makefile drl/Makefile Makefile Rules.make)