-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure.in
226 lines (197 loc) · 6.27 KB
/
configure.in
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# $Id: configure.in,v 1.15 2005/07/18 10:53:40 mederchik Exp $
#
# Copyright (C) 2001 Fyodor Yarochkin <[email protected]>,
# Ofir Arkin <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
AC_INIT(src/xprobe.cc)
AC_LANG_CPLUSPLUS
AC_ARG_PROGRAM
PACKAGE=xprobe2
VERSION='0.3'
if test "x$sysconfdir" != xNONE; then
if test "x$prefix" = xNONE; then
prefix="$ac_default_prefix"
fi
CFGDIR="`eval echo $sysconfdir`/xprobe2"
else
CFGDIR="$ac_default_prefix/etc/xprobe2"
fi
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(CFGDIR)
AC_CONFIG_HEADER(src/config.h)
AC_CONFIG_AUX_DIR(cfg-scripts)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
SOURCES=`cd src; ls *.cc | awk ' { printf "%s ", $1 } '`
AC_SUBST(SOURCES)
HEADERS=`cd src; ls *.h | awk '!/defines.h|config.h/{ printf "%s ", $1 }'`
AC_SUBST(HEADERS)
# XXX: add -Werror for the final version
# remove -Wmissing-prototypes, as they cause warnings
if test -n "$GCC"; then
CPPFLAGS="$CPPFLAGS -Wall -W -Wcast-align \
-Wcast-qual -Wshadow" #-Wwrite-strings
fi
AC_ARG_ENABLE(debug,
[ --enable-debug enable debugging )],
[ if test -n "$GCC"; then
CPPFLAGS="$CPPFLAGS -DDEBUG -ggdb"
else
CPPFLAGS="$CPPFLAGS -DDEBUG"
fi
], )
AC_CANONICAL_HOST
case "$host" in
*-solaris*)
AC_DEFINE(SOLARIS,,Solaris OS)
LDFLAGS="${LDFLAGS} -lsocket -lnsl -lresolv -ldl"
HAVE_LIBDL=1
;;
*-linux*)
AC_DEFINE(LINUX,,Linux OS)
LDFLAGS="${LDFLAGS} -ldl -rdynamic"
HAVE_LIBDL=1
;;
esac
AC_HEADER_STDC
AC_CHECK_HEADERS(strings.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(glib.h)
AC_CHECK_HEADERS(dlfcn.h)
#AC_C_CONST
#AC_CHECK_TYPE(uint8_t, unsigned char)
#AC_CHECK_TYPE(uint16_t, unsigned short)
#AC_CHECK_TYPE(uint32_t, unsigned long)
AC_CACHE_CHECK([if sa_len is in struct sockaddr], ac_cv_sockaddr_sa_len,
AC_TRY_COMPILE([
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>]
,[ printf("%i\n", ((struct sockaddr *)NULL)->sa_len); ],
[
ac_cv_sockaddr_sa_len=yes
]
,[
ac_cv_sockaddr_sa_len=no
]))
if test "$ac_cv_sockaddr_sa_len" = "yes"; then
AC_DEFINE(HAVE_SOCKADDR_SA_LEN,,Struct sockaddr has sa_len member)
fi
AC_ARG_WITH(libpcap_includes,
[ --with-libpcap-includes=DIR libpcap include directory],
[with_libpcap_includes="$withval"],[with_libpcap_includes=no])
AC_ARG_WITH(libpcap_libraries,
[ --with-libpcap-libraries=DIR libpcap library directory],
[with_libpcap_libraries="$withval"],[with_libpcap_libraries=no])
if test "$with_libpcap_includes" != "no"; then
CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}"
fi
if test "$with_libpcap_libraries" != "no"; then
LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}"
fi
LPCAP=""
AC_CHECK_LIB(pcap, pcap_datalink,, LPCAP="no")
if test "$LPCAP" = "no"; then
echo
echo " ERROR! Libpcap library/headers not found."
echo " http://www.tcpdump.org/ is a good place to fetch one"
echo " if libpcap library is installed, use the --with-libpcap-* options"
echo " to specify pathes to include and library files locations."
exit
fi
AC_ARG_WITH(libusipp_includes,
[ --with-libusipp-includes=DIR libusipp include directory],
[with_libusipp_includes="$withval"],[with_libusipp_includes=no])
AC_ARG_WITH(libusipp_libraries,
[ --with-libusipp-libraries=DIR libusipp library directory],
[with_libusipp_libraries="$withval"],[with_libusipp_libraries=no])
if test "$with_libusipp_includes" != "no"; then
CPPFLAGS="${CPPFLAGS} -I${with_libusipp_includes}"
fi
if test "$with_libusipp_libraries" != "no"; then
LDFLAGS="${LDFLAGS} -L${with_libusipp_libraries}"
fi
#AC_CACHE_CHECK(if libusi++ works, ac_cv_have_libusipp,
#AC_TRY_COMPILE([
#
##include <stdio.h>
##include <usi++/usi++.h>
##include <usi++/tcp.h>
##include <unistd.h>
#
#],[
# TCP *tmp = new TCP("foo");
#
# TCP tcp(*tmp);
#
#], ac_cv_have_libusipp=yes,
# ac_cv_have_libusipp=no
# ))
#
#
#if test "$ac_cv_have_libusipp" = "no"; then
# echo
# echo " ERROR! Libusi++ library/headers not found."
# echo " http://www.cs.uni-potsdam.de/homepages/students/linuxer/"
# echo " is a good place to fetch one. (a copy avail. at our page too)."
# echo " if libusipp library is installed, use the --with-libusipp-* options"
# echo " to specify pathes to include and library files locations."
# exit
#fi
#LIBS="-lusi++ $LIBS"
AC_CHECK_HEADERS(dlfcn.h,HAVE_DLFCN_H=1, DL_FAIL=1)
if test "$HAVE_DLCFCN_H" = 1; then
if test "$HAVE_LIBDL" = 1; then
AC_CHECK_LIB(dl,dlopen,,DL_FAIL=1)
else
AC_CHECK_LIB(c,dlopen,,DL_FAIL=1)
fi
fi
if test "$DL_FAIL" = 1; then
AC_MSG_WARN("Dynamically loadable tests will not be supported");
AC_DEFINE(STATIC_TESTS,, Static Tests)
else
DYNFLAGS="-fPIC -shared"
AC_SUBST(DYNFLAGS)
fi
AC_PROG_INSTALL
AC_PROG_MAKE_SET
#subdirs="libs-external/USI++/src"
AC_CONFIG_SUBDIRS("libs-external/USI++/src")
AC_OUTPUT([
Makefile
src/defines.h
src/Makefile
src/xplib/Makefile
src/xpmodules/Makefile
src/xpmodules/alive_probe/Makefile
src/xpmodules/alive_probe/ttl_calc/Makefile
src/xpmodules/alive_probe/portscanner/Makefile
src/xpmodules/os_probe/Makefile
src/xpmodules/os_probe/icmp_echo_id/Makefile
src/xpmodules/os_probe/icmp_timestamp/Makefile
src/xpmodules/os_probe/icmp_addrmask/Makefile
src/xpmodules/os_probe/icmp_inforeq/Makefile
src/xpmodules/os_probe/icmp_port_unreach/Makefile
src/xpmodules/os_probe/tcp_handshake/Makefile
src/xpmodules/os_probe/tcp_rst/Makefile
src/xpmodules/os_probe/smb/Makefile
src/xpmodules/os_probe/snmp/Makefile
])