Cleaned the code up, replacing references to xid --> slice_id
[fprobe-ulog.git] / configure.in
1 dnl Disable config.cache
2 define([AC_CACHE_LOAD], )
3 define([AC_CACHE_SAVE], )
4
5 AC_INIT
6 AC_CANONICAL_SYSTEM
7 AM_INIT_AUTOMAKE(fprobe-ulog,1.1)
8 AM_CONFIG_HEADER(config.h)
9
10 AC_PROG_CC
11 AC_PROG_INSTALL
12 AC_PROG_RANLIB
13 dnl AC_CHECK_TOOL(RANLIB, ranlib, :)
14
15 AC_CHECK_LIB(pthread, pthread_create, , [AC_ERROR(POSIX threads not found)])
16
17 dnl ************************************************
18 dnl inttypes
19
20 AC_CHECK_HEADER(inttypes.h, AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, , Have inttypes.h),
21         [AC_CHECK_SIZEOF(int, 8)
22         AC_CHECK_SIZEOF(long, 8)
23         AC_CHECK_SIZEOF(long long, 8)]
24 )
25
26 dnl ************************************************
27 dnl OS type
28
29 AC_DEFINE_UNQUOTED(OS_LINUX, , OS type)
30 CFLAGS="$CFLAGS -D_BSD_SOURCE"
31
32 dnl ************************************************
33 dnl Memory bulk indexing mode
34
35 AC_MSG_CHECKING(which memory bulk indexing mode to use)
36 AC_ARG_WITH(membulk,
37         [  --with-membulk=MODE     indexing mode: index8|index16|ptr [default=ptr]],
38         mem="$withval", mem="ptr")
39
40 case "$mem" in
41         ptr)
42                 mem_bits="0"
43                 ;;
44         index8)
45                 mem_bits="8"
46                 ;;
47         index16)
48                 mem_bits="16"
49                 ;;
50         *)
51                 AC_ERROR(Invalid argument: "$mem")
52                 ;;
53 esac
54
55 AC_MSG_RESULT("$mem")
56 AC_DEFINE_UNQUOTED(MEM_BITS, $mem_bits, Memory bulk indexing mode)
57
58 dnl ************************************************
59 dnl Hash type
60
61 AC_MSG_CHECKING(which hash type and size to use)
62 AC_ARG_WITH(hash, 
63         [  --with-hash=TYPE        hash type: crc16|xor16|xor8 [default=crc16]],
64         hash="$withval", hash="crc16")
65
66 hash_type=`echo "$hash"|cut -b -3`
67 hash_bits=`echo "$hash"|cut -b 4-`
68
69 if test "$hash_type" = "xor"; then
70         AC_DEFINE_UNQUOTED(HASH_TYPE_XOR, , Hash type)
71         if test "$hash_bits" != "8" -a "$hash_bits" != "16"; then
72                 AC_ERROR(Invalid argument: "$withval")
73         fi
74 else
75         if test "$hash" != "crc16"; then
76                 AC_ERROR(Invalid argument: "$hash")
77         fi
78         AC_DEFINE_UNQUOTED(HASH_TYPE_CRC, , Hash type)
79 fi
80
81 AC_DEFINE_UNQUOTED(HASH_BITS, $hash_bits , Hash size)
82 AC_MSG_RESULT("$hash")
83
84 dnl ************************************************
85 dnl Uptime trick
86
87 AC_MSG_CHECKING(whether to enable uptime trick)
88 AC_ARG_ENABLE(uptime_trick,
89         [  --enable-uptime_trick   enable uptime trick [default=yes]],
90         uptime_trick="$enableval", uptime_trick="yes")
91 case "$uptime_trick" in
92         yes)
93                 AC_MSG_RESULT(yes)
94                 AC_DEFINE_UNQUOTED(UPTIME_TRICK, , Uptime trick)
95                 ;;
96         *)
97                 AC_MSG_RESULT(no)
98                 ;;
99 esac
100
101 dnl ************************************************
102 dnl ICMP trick
103
104 AC_MSG_CHECKING(whether to enable icmp trick)
105 AC_ARG_ENABLE(icmp_trick, 
106         [  --enable-icmp_trick     enable icmp trick: yes|cisco|no [default=yes]],
107         icmp_trick="$enableval", icmp_trick="yes")
108 case "$icmp_trick" in
109         yes)
110                 AC_MSG_RESULT(yes)
111                 AC_DEFINE_UNQUOTED(ICMP_TRICK, , ICMP trick)
112                 ;;
113         cisco)
114                 AC_MSG_RESULT(yes: cisco)
115                 AC_DEFINE_UNQUOTED(UPTIME_TRICK_CISCO, , Uptime trick)
116                 ;;
117         *)
118                 AC_MSG_RESULT(no)
119                 ;;
120 esac
121
122 dnl ************************************************
123 dnl Debugging output
124
125 AC_MSG_CHECKING(whether to enable debugging)
126 AC_ARG_ENABLE(debug,
127         [  --enable-debug          enable debugging [default=no]],
128         debug="$enableval", debug="no")
129 case "$debug" in
130         no)
131                 AC_MSG_RESULT(no)
132                 debug_val="0"
133                 ;;
134         yes)
135                 AC_MSG_RESULT(all)
136                 debug_val="-1"
137                 ;;
138         *)
139                 AC_MSG_RESULT(custom: $debug)
140                 debug_val="0"
141                 debug=`echo $debug|tr , " "`
142                 for i in $debug; do
143                         debug_val="$debug_val | DEBUG_$i"
144                 done
145                 ;;
146 esac
147 AC_DEFINE_UNQUOTED(DEBUG, ($debug_val) , Debugging output)
148
149 dnl ************************************************
150 dnl Runtime messages
151
152 AC_MSG_CHECKING(whether to enable runtime messages)
153 AC_ARG_ENABLE(messages,
154         [  --enable-messages       enable runtime messages [default=no]],
155         messages="$enableval", messages="no")
156 case "$messages" in
157         yes)
158                 AC_MSG_RESULT(yes)
159                 AC_DEFINE_UNQUOTED(MESSAGES, , Runtime messages)
160                 ;;
161         *)
162                 AC_MSG_RESULT(no)
163                 ;;
164 esac
165
166 dnl ************************************************
167 dnl Pidfiles location
168
169 AC_MSG_CHECKING(directory to store pidfiles)
170 AC_ARG_WITH(piddir,
171         [  --with-piddir=DIR       pidfiles location [default=/var/run]],
172         piddir="$withval", piddir="/var/run")
173         AC_DEFINE_UNQUOTED(PID_DIR, "$piddir", Pidfiles location)
174         AC_MSG_RESULT("$piddir")
175
176 dnl ************************************************
177
178 CFLAGS="$CFLAGS -D_REENTRANT"
179 CFLAGS="$CFLAGS -DWALL -W -Wall"
180
181 AC_SUBST(PACKAGE)
182 AC_SUBST(VERSION)
183 DATE=`date +%Y-%m-%d`
184 AC_SUBST(DATE)
185
186 AC_OUTPUT(Makefile src/Makefile src/libipulog/Makefile)