Re-import of fprobe-ulog
[iptables.git] / configure.in
diff --git a/configure.in b/configure.in
new file mode 100644 (file)
index 0000000..7116712
--- /dev/null
@@ -0,0 +1,186 @@
+dnl Disable config.cache
+define([AC_CACHE_LOAD], )
+define([AC_CACHE_SAVE], )
+
+AC_INIT
+AC_CANONICAL_SYSTEM
+AM_INIT_AUTOMAKE(fprobe-ulog,1.1)
+AM_CONFIG_HEADER(config.h)
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+dnl AC_CHECK_TOOL(RANLIB, ranlib, :)
+
+AC_CHECK_LIB(pthread, pthread_create, ,        [AC_ERROR(POSIX threads not found)])
+
+dnl ************************************************
+dnl inttypes
+
+AC_CHECK_HEADER(inttypes.h, AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, , Have inttypes.h),
+       [AC_CHECK_SIZEOF(int, 8)
+       AC_CHECK_SIZEOF(long, 8)
+       AC_CHECK_SIZEOF(long long, 8)]
+)
+
+dnl ************************************************
+dnl OS type
+
+AC_DEFINE_UNQUOTED(OS_LINUX, , OS type)
+CFLAGS="$CFLAGS -D_BSD_SOURCE"
+
+dnl ************************************************
+dnl Memory bulk indexing mode
+
+AC_MSG_CHECKING(which memory bulk indexing mode to use)
+AC_ARG_WITH(membulk,
+       [  --with-membulk=MODE     indexing mode: index8|index16|ptr [default=ptr]],
+       mem="$withval", mem="ptr")
+
+case "$mem" in
+       ptr)
+               mem_bits="0"
+               ;;
+       index8)
+               mem_bits="8"
+               ;;
+       index16)
+               mem_bits="16"
+               ;;
+       *)
+               AC_ERROR(Invalid argument: "$mem")
+               ;;
+esac
+
+AC_MSG_RESULT("$mem")
+AC_DEFINE_UNQUOTED(MEM_BITS, $mem_bits, Memory bulk indexing mode)
+
+dnl ************************************************
+dnl Hash type
+
+AC_MSG_CHECKING(which hash type and size to use)
+AC_ARG_WITH(hash, 
+       [  --with-hash=TYPE        hash type: crc16|xor16|xor8 [default=crc16]],
+       hash="$withval", hash="crc16")
+
+hash_type=`echo "$hash"|cut -b -3`
+hash_bits=`echo "$hash"|cut -b 4-`
+
+if test "$hash_type" = "xor"; then
+       AC_DEFINE_UNQUOTED(HASH_TYPE_XOR, , Hash type)
+       if test "$hash_bits" != "8" -a "$hash_bits" != "16"; then
+               AC_ERROR(Invalid argument: "$withval")
+       fi
+else
+       if test "$hash" != "crc16"; then
+               AC_ERROR(Invalid argument: "$hash")
+       fi
+       AC_DEFINE_UNQUOTED(HASH_TYPE_CRC, , Hash type)
+fi
+
+AC_DEFINE_UNQUOTED(HASH_BITS, $hash_bits , Hash size)
+AC_MSG_RESULT("$hash")
+
+dnl ************************************************
+dnl Uptime trick
+
+AC_MSG_CHECKING(whether to enable uptime trick)
+AC_ARG_ENABLE(uptime_trick,
+       [  --enable-uptime_trick   enable uptime trick [default=yes]],
+       uptime_trick="$enableval", uptime_trick="yes")
+case "$uptime_trick" in
+       yes)
+               AC_MSG_RESULT(yes)
+               AC_DEFINE_UNQUOTED(UPTIME_TRICK, , Uptime trick)
+               ;;
+       *)
+               AC_MSG_RESULT(no)
+               ;;
+esac
+
+dnl ************************************************
+dnl ICMP trick
+
+AC_MSG_CHECKING(whether to enable icmp trick)
+AC_ARG_ENABLE(icmp_trick, 
+       [  --enable-icmp_trick     enable icmp trick: yes|cisco|no [default=yes]],
+       icmp_trick="$enableval", icmp_trick="yes")
+case "$icmp_trick" in
+       yes)
+               AC_MSG_RESULT(yes)
+               AC_DEFINE_UNQUOTED(ICMP_TRICK, , ICMP trick)
+               ;;
+       cisco)
+               AC_MSG_RESULT(yes: cisco)
+               AC_DEFINE_UNQUOTED(UPTIME_TRICK_CISCO, , Uptime trick)
+               ;;
+       *)
+               AC_MSG_RESULT(no)
+               ;;
+esac
+
+dnl ************************************************
+dnl Debugging output
+
+AC_MSG_CHECKING(whether to enable debugging)
+AC_ARG_ENABLE(debug,
+       [  --enable-debug          enable debugging [default=no]],
+       debug="$enableval", debug="no")
+case "$debug" in
+       no)
+               AC_MSG_RESULT(no)
+               debug_val="0"
+               ;;
+       yes)
+               AC_MSG_RESULT(all)
+               debug_val="-1"
+               ;;
+       *)
+               AC_MSG_RESULT(custom: $debug)
+               debug_val="0"
+               debug=`echo $debug|tr , " "`
+               for i in $debug; do
+                       debug_val="$debug_val | DEBUG_$i"
+               done
+               ;;
+esac
+AC_DEFINE_UNQUOTED(DEBUG, ($debug_val) , Debugging output)
+
+dnl ************************************************
+dnl Runtime messages
+
+AC_MSG_CHECKING(whether to enable runtime messages)
+AC_ARG_ENABLE(messages,
+       [  --enable-messages       enable runtime messages [default=no]],
+       messages="$enableval", messages="no")
+case "$messages" in
+       yes)
+               AC_MSG_RESULT(yes)
+               AC_DEFINE_UNQUOTED(MESSAGES, , Runtime messages)
+               ;;
+       *)
+               AC_MSG_RESULT(no)
+               ;;
+esac
+
+dnl ************************************************
+dnl Pidfiles location
+
+AC_MSG_CHECKING(directory to store pidfiles)
+AC_ARG_WITH(piddir,
+       [  --with-piddir=DIR       pidfiles location [default=/var/run]],
+       piddir="$withval", piddir="/var/run")
+       AC_DEFINE_UNQUOTED(PID_DIR, "$piddir", Pidfiles location)
+       AC_MSG_RESULT("$piddir")
+
+dnl ************************************************
+
+CFLAGS="$CFLAGS -D_REENTRANT"
+CFLAGS="$CFLAGS -DWALL -W -Wall"
+
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
+DATE=`date +%Y-%m-%d`
+AC_SUBST(DATE)
+
+AC_OUTPUT(Makefile src/Makefile src/libipulog/Makefile)