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