version 1.1.1.1, 2012/02/21 22:14:23
|
version 1.1.1.2, 2013/07/22 11:54:41
|
Line 11 dnl
|
Line 11 dnl
|
dnl usage: AC_LIBNET_LINUX_PROCFS |
dnl usage: AC_LIBNET_LINUX_PROCFS |
dnl results: HAVE_LINUX_PROCFS |
dnl results: HAVE_LINUX_PROCFS |
dnl |
dnl |
AC_DEFUN(AC_LIBNET_LINUX_PROCFS, | AC_DEFUN([AC_LIBNET_LINUX_PROCFS], |
[AC_MSG_CHECKING(for Linux proc filesystem) |
[AC_MSG_CHECKING(for Linux proc filesystem) |
AC_CACHE_VAL(ac_cv_libnet_linux_procfs, |
AC_CACHE_VAL(ac_cv_libnet_linux_procfs, |
if test "x`cat /proc/sys/kernel/ostype 2>&-`" = "xLinux" ; then |
if test "x`cat /proc/sys/kernel/ostype 2>&-`" = "xLinux" ; then |
Line 37 dnl
|
Line 37 dnl
|
dnl HAVE_PACKET_SOCKET (DEFINED) |
dnl HAVE_PACKET_SOCKET (DEFINED) |
dnl |
dnl |
|
|
AC_DEFUN(AC_LIBNET_CHECK_PF_PACKET, | AC_DEFUN([AC_LIBNET_CHECK_PF_PACKET], |
[ |
[ |
AC_MSG_CHECKING(for packet socket (PF_SOCKET)) | AC_MSG_CHECKING(for packet socket (PF_PACKET)) |
AC_CACHE_VAL(ac_libnet_have_packet_socket, | AC_CACHE_VAL(libnet_cv_have_packet_socket, |
|
|
[case "$target_os" in | [ |
| |
linux) | |
ac_libnet_have_packet_socket = no | |
;; | |
*) | |
| |
cat > pf_packet-test.c << EOF |
cat > pf_packet-test.c << EOF |
#include <stdio.h> |
#include <stdio.h> |
#include <errno.h> |
#include <errno.h> |
Line 94 EOF
|
Line 88 EOF
|
|
|
# Oopz 4.3 BSD doesn't have this. Sorry. |
# Oopz 4.3 BSD doesn't have this. Sorry. |
if test ! -x ./pf_packet-test ; then |
if test ! -x ./pf_packet-test ; then |
ac_libnet_have_packet_socket=choked | libnet_cv_have_packet_socket=choked |
else |
else |
ac_libnet_have_packet_socket=`./pf_packet-test`; | libnet_cv_have_packet_socket=`./pf_packet-test`; |
fi |
fi |
if test $ac_libnet_have_packet_socket = choked; then | if test $libnet_cv_have_packet_socket = choked; then |
AC_MSG_RESULT(test program compile choked... assuming no) |
AC_MSG_RESULT(test program compile choked... assuming no) |
elif test $ac_libnet_have_packet_socket = yes; then | elif test $libnet_cv_have_packet_socket = yes; then |
AC_MSG_RESULT(yes) |
AC_MSG_RESULT(yes) |
elif test $ac_libnet_have_packet_socket = probably; then | elif test $libnet_cv_have_packet_socket = probably; then |
AC_MSG_RESULT(test program got EPERM... assuming yes) |
AC_MSG_RESULT(test program got EPERM... assuming yes) |
elif test $ac_libnet_have_packet_socket = no; then | elif test $libnet_cv_have_packet_socket = no; then |
AC_MSG_RESULT(no) |
AC_MSG_RESULT(no) |
fi |
fi |
|
|
rm -f pf_packet-test* core core.pf_packet-test |
rm -f pf_packet-test* core core.pf_packet-test |
;; |
|
esac]) |
|
|
|
if test $ac_libnet_have_packet_socket = yes -o $ac_libnet_have_packet_socket = probably; then | ]) |
AC_DEFINE(HAVE_PACKET_SOCKET) | |
| if test $libnet_cv_have_packet_socket = yes -o $libnet_cv_have_packet_socket = probably; then |
| AC_DEFINE(HAVE_PACKET_SOCKET, 1, |
| [Define if we're running on a Linux system with PF_PACKET sockets.]) |
fi |
fi |
]) |
]) |
|
|
Line 131 dnl
|
Line 126 dnl
|
dnl |
dnl |
dnl |
dnl |
|
|
AC_DEFUN(AC_LIBNET_CHECK_LIBNET_VER, | AC_DEFUN([AC_LIBNET_CHECK_LIBNET_VER], |
[ |
[ |
AC_CHECK_LIB(net, libnet_build_ip, AC_MSG_CHECKING(version) \ |
AC_CHECK_LIB(net, libnet_build_ip, AC_MSG_CHECKING(version) \ |
|
|
Line 166 dnl
|
Line 161 dnl
|
dnl HAVE_STRUCT_IP_CSUM (DEFINED) |
dnl HAVE_STRUCT_IP_CSUM (DEFINED) |
dnl |
dnl |
|
|
AC_DEFUN(AC_LIBNET_CHECK_IP_CSUM, | AC_DEFUN([AC_LIBNET_CHECK_IP_CSUM], |
[ |
[ |
AC_MSG_CHECKING([struct ip contains ip_csum]) |
AC_MSG_CHECKING([struct ip contains ip_csum]) |
AC_TRY_COMPILE([ |
AC_TRY_COMPILE([ |
Line 186 AC_DEFUN(AC_LIBNET_CHECK_IP_CSUM,
|
Line 181 AC_DEFUN(AC_LIBNET_CHECK_IP_CSUM,
|
]) |
]) |
]) |
]) |
|
|
dnl |
|
dnl Checks to see if unaligned memory accesses fail |
|
dnl (Pulled from libpcap) |
|
dnl |
|
dnl usage: |
|
dnl |
|
dnl AC_LBL_UNALIGNED_ACCESS |
|
dnl |
|
dnl results: |
|
dnl |
|
dnl LBL_ALIGN (DEFINED) |
|
dnl |
|
|
|
AC_DEFUN(AC_LBL_UNALIGNED_ACCESS, |
|
[AC_MSG_CHECKING(if unaligned accesses fail) |
|
AC_CACHE_VAL(ac_cv_lbl_unaligned_fail, |
|
[case "$target_cpu" in |
|
|
|
alpha|hp*|mips|sparc) |
|
ac_cv_lbl_unaligned_fail=yes |
|
;; |
|
|
|
*) |
|
cat >conftest.c <<EOF |
|
# include <sys/types.h> |
|
# include <sys/wait.h> |
|
# include <stdio.h> |
|
unsigned char a[[5]] = { 1, 2, 3, 4, 5 }; |
|
main() |
|
{ |
|
unsigned int i; |
|
pid_t pid; |
|
int status; |
|
/* avoid "core dumped" message */ |
|
pid = fork(); |
|
if (pid < 0) |
|
{ |
|
exit(2); |
|
} |
|
if (pid > 0) |
|
{ |
|
/* parent */ |
|
pid = waitpid(pid, &status, 0); |
|
if (pid < 0) |
|
{ |
|
exit(3); |
|
} |
|
exit(!WIFEXITED(status)); |
|
} |
|
/* child */ |
|
i = *(unsigned int *)&a[[1]]; |
|
printf("%d\n", i); |
|
exit(0); |
|
} |
|
EOF |
|
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \ |
|
conftest.c $LIBS > /dev/null 2>&1 |
|
# Oopz 4.3 BSD doesn't have this. Sorry. |
|
if test ! -x conftest ; then |
|
dnl failed to compile for some reason |
|
ac_cv_lbl_unaligned_fail=yes |
|
else |
|
./conftest > conftest.out |
|
if test ! -s conftest.out ; then |
|
ac_cv_lbl_unaligned_fail=yes |
|
else |
|
ac_cv_lbl_unaligned_fail=no |
|
fi |
|
fi |
|
rm -f conftest* core core.conftest |
|
;; |
|
esac]) |
|
AC_MSG_RESULT($ac_cv_lbl_unaligned_fail) |
|
if test $ac_cv_lbl_unaligned_fail = yes ; then |
|
AC_DEFINE(LBL_ALIGN) |
|
fi |
|
]) |
|
|
|
|
|
dnl |
dnl |
dnl Checks endianess |
dnl Checks endianess |
dnl |
dnl |
Line 278 dnl LIBNET_BIG_ENDIAN = 1 or
|
Line 195 dnl LIBNET_BIG_ENDIAN = 1 or
|
dnl LIBNET_LIL_ENDIAN = 1 |
dnl LIBNET_LIL_ENDIAN = 1 |
dnl |
dnl |
|
|
AC_DEFUN(AC_LIBNET_ENDIAN_CHECK, | AC_DEFUN([AC_LIBNET_ENDIAN_CHECK], |
[AC_MSG_CHECKING(machine endianess) | [AC_C_BIGENDIAN |
| if test $ac_cv_c_bigendian = yes ; then |
cat > conftest.c << EOF | AC_DEFINE(LIBNET_BIG_ENDIAN, 1, |
# include <stdio.h> | [We are running on a big-endian machine.]) |
# include <stdlib.h> | |
| |
int main() | |
{ | |
union | |
{ | |
short s; | |
char c[[sizeof(short)]]; | |
} un; | |
| |
un.s = 0x0102; | |
if (sizeof (short) == 2) | |
{ | |
if (un.c [[0]] == 1 && un.c [[1]] == 2) | |
{ | |
printf("B\n"); | |
} | |
else | |
{ | |
if (un.c [[0]] == 2 && un.c [[1]] == 1) | |
{ | |
printf("L\n"); | |
} | |
} | |
} | |
else | |
{ | |
printf("?\n"); | |
} | |
return (EXIT_SUCCESS); | |
} | |
EOF | |
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS > /dev/null 2>&1 | |
# Oopz 4.3 BSD doesn't have this. Sorry. | |
if test ! -x conftest ; then | |
dnl failed to compile for some reason | |
ac_cv_libnet_endianess=unknown | |
else | |
./conftest > conftest.out | |
result=`cat conftest.out` | |
if test $result = "B"; then | |
ac_cv_libnet_endianess=big | |
elif test $result = "L"; then | |
ac_cv_libnet_endianess=lil | |
else | |
ac_cv_libnet_endianess=unknown | |
fi | |
fi | |
rm -f conftest* core core.conftest | |
| |
AC_MSG_RESULT($ac_cv_libnet_endianess) | |
| |
if test $ac_cv_libnet_endianess = big ; then | |
AC_DEFINE(LIBNET_BIG_ENDIAN) | |
ENDIANESS="LIBNET_BIG_ENDIAN" |
ENDIANESS="LIBNET_BIG_ENDIAN" |
LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_BIG_ENDIAN" |
LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_BIG_ENDIAN" |
elif test $ac_cv_libnet_endianess = lil ; then | else |
AC_DEFINE(LIBNET_LIL_ENDIAN) | AC_DEFINE(LIBNET_LIL_ENDIAN, 1, |
| [We are running on a little-endian machine.]) |
ENDIANESS="LIBNET_LIL_ENDIAN" |
ENDIANESS="LIBNET_LIL_ENDIAN" |
LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_LIL_ENDIAN" |
LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_LIL_ENDIAN" |
fi |
fi |
Line 361 dnl
|
Line 225 dnl
|
dnl LIBS |
dnl LIBS |
dnl |
dnl |
|
|
define(AC_LBL_CHECK_LIB, | define([AC_LBL_CHECK_LIB], |
[AC_MSG_CHECKING([for $2 in -l$1]) |
[AC_MSG_CHECKING([for $2 in -l$1]) |
dnl Use a cache variable name containing both the library and function name, |
dnl Use a cache variable name containing both the library and function name, |
dnl because the test really is for library $1 defining function $2, not |
dnl because the test really is for library $1 defining function $2, not |
Line 439 dnl The check for libresolv is in case you are attempt
|
Line 303 dnl The check for libresolv is in case you are attempt
|
dnl statically and happen to have a libresolv.a lying around (and no |
dnl statically and happen to have a libresolv.a lying around (and no |
dnl libnsl.a). |
dnl libnsl.a). |
dnl |
dnl |
AC_DEFUN(AC_LBL_LIBRARY_NET, [ | AC_DEFUN([AC_LBL_LIBRARY_NET], |
| [ |
# Most operating systems have gethostbyname() in the default searched |
# Most operating systems have gethostbyname() in the default searched |
# libraries (i.e. libc): |
# libraries (i.e. libc): |
AC_CHECK_FUNC(gethostbyname, , |
AC_CHECK_FUNC(gethostbyname, , |