]> The Tcpdump Group git mirrors - tcpslice/blob - configure.ac
Update -h (help) option to print 32/64-bit build and time_t size
[tcpslice] / configure.ac
1 dnl Copyright (c) 1995, 1996, 1997, 1999
2 dnl The Regents of the University of California. All rights reserved.
3 dnl
4 dnl Process this file with autoconf to produce a configure script.
5 dnl
6
7 #
8 # See
9 #
10 # https://ftp.gnu.org/gnu/config/README
11 #
12 # for the URLs to use to fetch new versions of config.guess and
13 # config.sub.
14 #
15
16 AC_PREREQ([2.69])
17 AC_INIT([tcpslice],[m4_esyscmd_s(cat VERSION)],[https://github.com/the-tcpdump-group/tcpslice/issues])
18 AC_CONFIG_SRCDIR(tcpslice.c)
19
20 AC_CANONICAL_HOST
21
22 AC_LBL_C_INIT_BEFORE_CC(V_INCLS)
23 #
24 # Try to enable as many C99 features as we can.
25 # At minimum, we want C++/C99-style // comments.
26 #
27 AC_PROG_CC_C99
28 if test "$ac_cv_prog_cc_c99" = "no"; then
29 AC_MSG_WARN([The C compiler does not support C99; there may be compiler errors])
30 fi
31 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
32
33 AC_CHECK_HEADERS(fcntl.h)
34 #
35 # Get the size of a void *, to know whether this is a 32-bit or 64-bit build.
36 #
37 AC_CHECK_SIZEOF([void *])
38
39 #
40 # Get the size of a time_t, to know whether it's 32-bit or 64-bit.
41 #
42 AC_CHECK_SIZEOF([time_t],,[#include <time.h>])
43
44 #
45 # Try to arrange for large file support.
46 #
47 AC_SYS_LARGEFILE
48 AC_FUNC_FSEEKO
49
50 # OpenBSD, Solaris 9 and Solaris 10 don't have posix_fadvise().
51 AC_CHECK_FUNCS([posix_fadvise])
52
53 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
54
55 AC_MSG_CHECKING([whether to enable the instrument functions code])
56 AC_ARG_ENABLE([instrument-functions],
57 [AS_HELP_STRING([--enable-instrument-functions],
58 [enable instrument functions code [default=no]])],
59 [],
60 [enableval=no])
61 case "$enableval" in
62 yes) AC_MSG_RESULT(yes)
63 AC_CHECK_LIB([bfd], [bfd_init],
64 [true],
65 [AC_MSG_ERROR(
66 [--enable-instrument-functions was given, but test for library libbfd failed. Please install the 'binutils-dev' package.])],
67 [])
68 AC_DEFINE(ENABLE_INSTRUMENT_FUNCTIONS, 1,
69 [define if you want to build the instrument functions code])
70 LOCALSRC="$LOCALSRC instrument-functions.c"
71 # Add '-finstrument-functions' instrumentation option to generate
72 # instrumentation calls for entry and exit to functions.
73 # Try to avoid Address Space Layout Randomization (ALSR).
74 CFLAGS="$CFLAGS -O0 -ggdb -finstrument-functions -fno-stack-protector -fno-pic"
75 LDFLAGS="$LDFLAGS -O0 -ggdb -fno-stack-protector -no-pie"
76 LIBS="$LIBS -lbfd"
77 ;;
78 *) AC_MSG_RESULT(no)
79 ;;
80 esac
81
82 AC_ARG_WITH([libnids],
83 AS_HELP_STRING([--without-libnids], [Do not use libnids even if present]))
84
85 AS_IF([test "x$with_libnids" != "xno"],
86 [AC_CHECK_LIB(nids, nids_pcap_handler,,
87 AC_MSG_WARN(Libnids not present or too old; tcpslice won't be able to track sessions!)
88 AC_MSG_WARN(Get the latest version of Libnids at http://libnids.sourceforge.net/)
89 )])
90
91 AC_ARG_WITH([libosipparser2],
92 AS_HELP_STRING([--without-libosipparser2], [Do not use libosipparser2 even if present]))
93
94 AS_IF([test "x$with_libosipparser2" != "xno"],
95 [AC_CHECK_LIB(osipparser2, osip_message_parse,,
96 AC_MSG_WARN(Libosip2 not present or too old; tcpslice won't be able to track SIP calls!)
97 AC_MSG_WARN(Get the latest version of Libosip at https://www.gnu.org/software/osip/)
98 )])
99
100 AC_ARG_WITH([libooh323c],
101 AS_HELP_STRING([--without-libooh323c], [Do not use libooh323c even if present]))
102
103 AS_IF([test "x$with_libooh323c" != "xno"],
104 [AC_CHECK_LIB(ooh323c, asn1PD_H225RasMessage,,
105 AC_MSG_WARN(Libooh323c not present or too old; tcpslice won't be able to track H.323 calls!)
106 AC_MSG_WARN(Get the latest version of Libooh323c at https://sourceforge.net/projects/ooh323c/)
107 )])
108
109 #
110 # Check whether we have pcap/pcap-inttypes.h.
111 # If we do, we use that to get the C99 types defined.
112 #
113 savedcppflags="$CPPFLAGS"
114 CPPFLAGS="$CPPFLAGS $V_INCLS"
115 AC_CHECK_HEADERS(pcap/pcap-inttypes.h)
116 AC_CHECK_FUNCS(pcap_lib_version)
117 CPPFLAGS="$savedcppflags"
118
119 #
120 # Define the old BSD specified-width types in terms of the C99 types;
121 # we may need them with libpcap include files.
122 #
123 AC_CHECK_TYPE([u_int8_t], ,
124 [AC_DEFINE([u_int8_t], [uint8_t],
125 [Define to `uint8_t' if u_int8_t not defined.])],
126 [AC_INCLUDES_DEFAULT
127 #include <sys/types.h>
128 ])
129 AC_CHECK_TYPE([u_int16_t], ,
130 [AC_DEFINE([u_int16_t], [uint16_t],
131 [Define to `uint16_t' if u_int16_t not defined.])],
132 [AC_INCLUDES_DEFAULT
133 #include <sys/types.h>
134 ])
135 AC_CHECK_TYPE([u_int32_t], ,
136 [AC_DEFINE([u_int32_t], [uint32_t],
137 [Define to `uint32_t' if u_int32_t not defined.])],
138 [AC_INCLUDES_DEFAULT
139 #include <sys/types.h>
140 ])
141 AC_CHECK_TYPE([u_int64_t], ,
142 [AC_DEFINE([u_int64_t], [uint64_t],
143 [Define to `uint64_t' if u_int64_t not defined.])],
144 [AC_INCLUDES_DEFAULT
145 #include <sys/types.h>
146 ])
147
148 AC_LBL_DEVEL(V_CCOPT)
149
150 if test "${srcdir}" = "." ; then
151 srcdirprefix=""
152 else
153 srcdirprefix="./"
154 fi
155
156 AC_SUBST(V_CCOPT)
157 AC_SUBST(V_DEFS)
158 AC_SUBST(V_INCLS)
159 AC_SUBST(V_PCAPDEP)
160 AC_SUBST(LOCALSRC)
161
162 AC_PROG_INSTALL
163
164 AC_CONFIG_HEADERS([config.h])
165
166 AC_CONFIG_COMMANDS([.devel],[[if test -f .devel; then
167 echo timestamp > stamp-h
168 cat $srcdir/Makefile-devel-adds >> Makefile
169 make depend || exit 1
170 fi]],[[]])
171 AC_CONFIG_FILES([Makefile])
172 AC_OUTPUT
173 exit 0