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 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
|
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 2007-2014 Eloy Paris <peloy@netexpect.org>
AC_PREREQ([2.59])
AC_INIT([Network Expect],[0.22],[peloy@netexpect.org],[netexpect])
AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR([src/nexp.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([1.9 gnu])
AM_MAINTAINER_MODE
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AM_PROG_LEX
AC_PROG_YACC
# Needed to link correctly against libwireshark and libwiretap
AC_PROG_LIBTOOL
#
# If we're running gcc add '-D_U_="__attribute__((unused))"' to CFLAGS as well,
# so we can use _U_ to flag unused function arguments and not get warnings
# about them. Otherwise, add '-D_U_=""', so that _U_ used to flag an unused
# function argument will compile with non-GCC compilers. This was taken
# from wireshark's configure.in.
#
if test "x$GCC" = "xyes" ; then
CFLAGS="-D_U_=\"__attribute__((unused))\" $CFLAGS"
else
CFLAGS="-D_U_=\"\" $CFLAGS"
fi
# wireshark uses GLib
CFLAGS="$CFLAGS `pkg-config --cflags glib-2.0`"
LIBS="$LIBS `pkg-config --libs glib-2.0`"
# Checks for libraries.
######################################################################
dnl This libtcl detection code was stolen from tclreadline's
dnl configure.in (http://tclreadline.sourceforge.net/)
# -- WHICH TCL TO USE
AC_ARG_WITH(
tcl,
[ --with-tcl=DIR where to look for tclConfig.sh],
tcl_search=$withval,
tcl_search=""
)
AC_MSG_CHECKING([which tclConfig.sh to use])
TCL_LIB_DIR=""
for dir in $tcl_search /usr/lib /usr/local/lib $exec_prefix/lib /usr/local/lib/unix /opt/tcl/lib; do
if test -r $dir/tclConfig.sh; then
TCL_LIB_DIR=$dir
break
fi
done
if test -z "$TCL_LIB_DIR"; then
AC_MSG_ERROR(Can't find Tcl libraries. Use --with-tcl to specify the directory containing tclConfig.sh on your system.)
fi
. $TCL_LIB_DIR/tclConfig.sh
AC_MSG_RESULT($TCL_LIB_DIR/tclConfig.sh)
AC_MSG_CHECKING([for your tcl version])
AC_MSG_RESULT([$TCL_VERSION, patchlevel $TCL_PATCH_LEVEL])
# Check, if tcl_version is > 8.0
if test $TCL_MAJOR_VERSION -lt 8; then
AC_MSG_ERROR(need tcl 8.0 or higher.)
fi
AC_SUBST(TCL_LIB_SPEC)
######################################################################
dnl At least in OpenBSD, mathematic library functions are not in the
dnl standard C library but in libm, so we check of libm before checking
dnl for the Tcl library since Tcl uses mathematic functions.
AC_CHECK_LIB(m, log)
######################################################################
dnl This PCAP detection code was stolen from yersinia
dnl
dnl libpcap must be at least 0.8.x
dnl
AC_MSG_CHECKING(for a complete set of pcap headers)
possible_dirs="`eval echo -n ${includedir}` \
/usr/include /usr/include/pcap \
/usr/local/include /usr/local/include/pcap \
/usr/share/include /usr/share/include/pcap"
AC_ARG_WITH(pcap,
[ --with-pcap=DIR use libpcap in DIR],
[PCAP_DIR=$withval],
[PCAP_DIR=$possible_dirs])
pcap_dir=""
for dir in $PCAP_DIR ; do
if test -d $dir -a -r "$dir/pcap.h" ; then
if test -n "$pcap_dir" -a "$pcap_dir" != "$dir"; then
echo
echo; echo more than one set found in:
echo $pcap_dir
echo $dir
echo; echo please wipe out all unused pcap installations
exit
else
pcap_dir="$dir"
fi
fi
done
if test -z "$pcap_dir" ; then
echo no; echo !!! couldn\'t find a complete set of pcap headers
exit
else
echo found $pcap_dir
PCAP_INCLUDE="-I$pcap_dir"
PCAP_LINK="-L`dirname $pcap_dir`/lib"
fi
if test "$PCAP_LINK" != "-L/usr/lib" ; then
LIBS="$LIBS $PCAP_LINK"
fi
if test "$PCAP_INCLUDE" != "-I/usr/include" ; then
CFLAGS="$CFLAGS $PCAP_INCLUDE"
fi
AC_CHECK_LIB(pcap, pcap_get_selectable_fd,, have_libpcap=no)
if test "$have_libpcap" == "no"; then
AC_MSG_ERROR(libpcap (>= 0.8.x) is needed in order to build netexpect.)
fi
######################################################################
dnl This wireshark detection code is based on code from from the
dnl yersinia project
AC_MSG_CHECKING(for wireshark headers)
possible_dirs="`eval echo -n ${includedir}` \
/usr/include /usr/include/wireshark \
/usr/local/include /usr/local/include/wireshark \
/usr/share/include /usr/share/include/wireshark"
AC_ARG_WITH(wsharkinc,
[ --with-wsharkinc=DIR use wireshark headers in DIR],
[WSHARK_DIR=$withval],
[WSHARK_DIR=$possible_dirs])
wireshark_dir=""
for dir in $WSHARK_DIR ; do
if test -d $dir -a -r "$dir/epan/epan.h" ; then
if test -n "$wshark_dir" -a "$wshark_dir" != "$dir"; then
echo
echo; echo more than one set found in:
echo $wshark_dir
echo $dir
echo; echo please wipe out all unused wireshark installations
exit
else
wshark_dir="$dir"
fi
fi
done
if test -z "$wshark_dir" ; then
echo no; echo !!! couldn\'t find a complete set of wireshark headers
exit 1
fi
echo found $wshark_dir
WSHARK_INCLUDE="-I$wshark_dir"
if test "$WSHARK_INCLUDE" != "-I/usr/include" ; then
CFLAGS="$CFLAGS $WSHARK_INCLUDE"
fi
DIR=`dirname $wshark_dir`
if test -d "$DIR/lib/wireshark"; then
WSHARK_LINK="-L$DIR/lib/wireshark"
else
DIR=`dirname $DIR`
if test -d "$DIR/lib/wireshark"; then
WSHARK_LINK="-L$DIR/lib/wireshark"
fi
fi
WIRESHARKLIB="-lwireshark"
WIRETAPLIB="-lwiretap"
WSUTILLIB="-lwsutil"
if test "$WSHARK_LINK" != "-L/usr/lib" ; then
WIRESHARKLIB="$WSHARK_LINK $WIRESHARKLIB"
fi
AC_SUBST(WIRESHARKLIB)
AC_SUBST(WIRETAPLIB)
AC_SUBST(WSUTILLIB)
dnl This comes from Wireshark 1.6.x and is needed to be able to build
dnl with libwireshark from Wireshark 1.6.x.
# Define WS_MSVC_NORETURN appropriately for declarations of routines that
# never return (just like Charlie on the MTA).
#
# Note that MSVC++ expects __declspec(noreturn) to precede the function
# name and GCC, as far as I know, expects __attribute__((noreturn)) to
# follow the function name, so we need two different flavors of
# noreturn tag.
#
AC_DEFINE(WS_MSVC_NORETURN,, [Define as the string to precede declarations of routines that never return])
######################################################################
dnl This libdnet detection code was stolen from honeyd
dnl Checks for (installed) libdnet
AC_ARG_WITH(libdnet,
[ --with-libdnet=DIR use libdnet in DIR],
[ case "$withval" in
yes|no)
AC_ERROR([Please specify directory containing dnet-config when using --with-libdnet])
;;
*)
AC_MSG_CHECKING(for libdnet)
AC_MSG_RESULT($withval)
if test -f $withval/src/libdnet.a; then
DNETINC="-I$withval/include"
DNETLIB="-L$withval/src -ldnet `$withval/dnet-config --libs`"
elif test -x $withval/bin/dnet-config; then
DNETINC="`$withval/bin/dnet-config --cflags`"
DNETLIB="`$withval/bin/dnet-config --libs`"
else
AC_MSG_RESULT(no)
AC_ERROR(dnet-config not found in $withval/bin)
fi
;;
esac
AC_MSG_RESULT(yes) ],
[ dnl This is the default case so let's just use AC_PATH_PROG! --CPK.
AC_PATH_PROG(dnetconfig, dnet-config, "no")
if test "$dnetconfig" = "no"; then
AC_ERROR(dnet-config not found)
else
DNETINC="`$dnetconfig --cflags`"
DNETLIB="`$dnetconfig --libs`"
fi]
)
dnl We still need to check whether it's dnet or dumbnet as
dnl for example on Debian. We test by looking at the content
dnl of DNETLIB and derive from the library name what version
dnl we're dealing with. If we find a libdumbnet, we prefix
dnl compat/libdnet to our inclusion path. It provides a dnet.h
dnl that transparently includes dumbnet.h for those systems. --CPK.
AC_MSG_CHECKING([whether libdnet is a libdumbnet])
if test `echo $DNETLIB | sed -e '/dumb/=;d'`; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DUMBNET, 1,
[Define if our libdnet is a libdumbnet])
DNETCOMPAT="src/compat/libdnet"
else
AC_MSG_RESULT(no)
fi
AC_SUBST(DNETCOMPAT)
AC_SUBST(DNETINC)
AC_SUBST(DNETLIB)
######################################################################
dnl Check whether we want to use libtclx
dnl This is very ugly. Someone please let me know if there's a better way...
AC_MSG_CHECKING([whether to use TclX])
AC_ARG_WITH(tclx, AS_HELP_STRING([--with-tclx],
[include TclX support (default=no)]),
[ case "$withval" in
yes|no)
with_tclx=$withval
;;
*)
with_tclx=no
esac ])
AC_MSG_RESULT($with_tclx)
if test x"$with_tclx" = x"yes"; then
AC_CHECK_LIB(tclx8.4, Tclx_Init)
if test x"$ac_cv_lib_tclx8_4_Tclx_Init" != x"yes"; then
AC_MSG_ERROR(--with-tclx specified but libtclx library not found)
fi
fi
######################################################################
dnl Use the included md5 or use the system libssl?
AC_ARG_WITH(included-md5, AS_HELP_STRING([--with-included-md5],
[use bundled md5 code, not libssl]),
[ case "$withval" in
yes|no)
with_included_md5=$withval
;;
esac ])
if test x"$with_included_md5" != x"yes"
then
AC_CHECK_LIB(ssl, MD5_Init, , [with_included_md5=yes])
fi
AC_MSG_CHECKING([whether to use included md5])
AM_CONDITIONAL(BUILD_MD5, test "$with_included_md5" = yes)
if test x"$with_included_md5" = x"yes"; then
AC_MSG_RESULT($srcdir/src/md5c.c)
else
AC_MSG_RESULT(no)
fi
######################################################################
dnl Build with debugging support? (stolen from the automake manual)
AC_ARG_ENABLE(debug,
[ --enable-debug Turn on debugging],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
######################################################################
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(stdlib.h string.h unistd.h inttypes.h float.h openssl/md5.h)
AC_CHECK_HEADERS(sys/bufmod.h)
#--------------------------------------------------------------------
# Check for tcl.h (stolen from tclreadline)
#--------------------------------------------------------------------
AC_ARG_WITH(tcl-includes,
[ --with-tcl-includes=DIR where to look for tcl.h],
tcl_includes=$withval, tcl_includes=$prefix/include)
AC_MSG_CHECKING([where to look for tcl.h])
TCL_INCLUDE_DIR=""
for dir in $tcl_includes $prefix/include/ /usr/include; do
if test -r $dir/tcl.h; then
TCL_INCLUDE_DIR=$dir
break
fi
done
if test -z "$TCL_INCLUDE_DIR"; then
AC_MSG_ERROR([
Can't find tcl.h. Use --with-tcl-includes to specify the directory
containing tcl.h on your system.])
else
AC_MSG_RESULT($TCL_INCLUDE_DIR/tcl.h)
fi
AC_SUBST(TCL_INCLUDE_DIR)
#--------------------------------------------------------------------
# wireshark requires stdarg.h
AC_CHECK_HEADERS(stdarg.h)
# Check for expect_tcl.h
AC_CHECK_HEADERS(tcl8.4/tcl.h tclx8.4/tclExtend.h,,,
[[#if HAVE_TCL8_4_TCL_H
#include <tcl8.4/tcl.h>
#endif
]])
# Check for expect_tcl.h
AC_CHECK_HEADERS(tcl8.4/tcl.h tcl8.4/expect_tcl.h,,,
[[#if HAVE_TCL8_4_TCL_H
#include <tcl8.4/tcl.h>
#endif
]])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
# We need this to handle endianess issues in some of our structure
# definitions
AC_C_BIGENDIAN
# Checks for library functions.
dnl AC_FUNC_ERROR_AT_LINE
dnl AC_FUNC_MALLOC
dnl AC_FUNC_REALLOC
dnl AC_FUNC_STAT
dnl AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memset socket strchr strrchr strstr])
AC_CHECK_FUNCS([strtoul strerror strdup])
AC_REPLACE_FUNCS(strlcpy strlcat)
dnl
dnl Check and set OS specific parameters
dnl
case "$target_os" in
*linux* | *freebsd* | *openbsd* | *solaris* | *darwin*)
;;
*)
AC_MSG_WARN(apparently your OS is not officially supported yet)
AC_MSG_WARN(this may not work)
AC_MSG_RESULT(please send diffs to peloy@netexpect.org)
;;
esac
#
# Define WS_VAR_IMPORT appropriately for declarations of external
# variables exported from dynamically-linked libraries.
#
AC_DEFINE(WS_VAR_IMPORT, extern, [Define as the string to precede external variable declarations in dynamically-linked libraries])
AC_CONFIG_FILES([Makefile src/Makefile src/missing/Makefile doc/Makefile src/numbers/Makefile src/packets/Makefile src/usr/Makefile src/pbuild/Makefile src/pbuild/builders/Makefile src/dumbhex/Makefile src/p0f/Makefile])
AC_OUTPUT
|