--- embedaddon/libnet/acinclude.m4 2012/02/21 22:14:23 1.1.1.1 +++ embedaddon/libnet/acinclude.m4 2013/07/22 11:54:41 1.1.1.2 @@ -1,4 +1,4 @@ -dnl $Id: acinclude.m4,v 1.1.1.1 2012/02/21 22:14:23 misho Exp $ +dnl $Id: acinclude.m4,v 1.1.1.2 2013/07/22 11:54:41 misho Exp $ dnl dnl Libnet specific autoconf macros dnl Copyright (c) 1998 - 2004 Mike D. Schiffman @@ -11,7 +11,7 @@ dnl dnl usage: AC_LIBNET_LINUX_PROCFS dnl results: HAVE_LINUX_PROCFS dnl -AC_DEFUN(AC_LIBNET_LINUX_PROCFS, +AC_DEFUN([AC_LIBNET_LINUX_PROCFS], [AC_MSG_CHECKING(for Linux proc filesystem) AC_CACHE_VAL(ac_cv_libnet_linux_procfs, if test "x`cat /proc/sys/kernel/ostype 2>&-`" = "xLinux" ; then @@ -37,18 +37,12 @@ dnl dnl HAVE_PACKET_SOCKET (DEFINED) dnl -AC_DEFUN(AC_LIBNET_CHECK_PF_PACKET, +AC_DEFUN([AC_LIBNET_CHECK_PF_PACKET], [ - AC_MSG_CHECKING(for packet socket (PF_SOCKET)) - AC_CACHE_VAL(ac_libnet_have_packet_socket, + AC_MSG_CHECKING(for packet socket (PF_PACKET)) + 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 #include #include @@ -94,26 +88,27 @@ EOF # Oopz 4.3 BSD doesn't have this. Sorry. if test ! -x ./pf_packet-test ; then - ac_libnet_have_packet_socket=choked + libnet_cv_have_packet_socket=choked else - ac_libnet_have_packet_socket=`./pf_packet-test`; + libnet_cv_have_packet_socket=`./pf_packet-test`; 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) - elif test $ac_libnet_have_packet_socket = yes; then + elif test $libnet_cv_have_packet_socket = yes; then 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) - elif test $ac_libnet_have_packet_socket = no; then + elif test $libnet_cv_have_packet_socket = no; then AC_MSG_RESULT(no) fi 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 ]) @@ -131,7 +126,7 @@ 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) \ @@ -166,7 +161,7 @@ dnl dnl HAVE_STRUCT_IP_CSUM (DEFINED) dnl -AC_DEFUN(AC_LIBNET_CHECK_IP_CSUM, +AC_DEFUN([AC_LIBNET_CHECK_IP_CSUM], [ AC_MSG_CHECKING([struct ip contains ip_csum]) AC_TRY_COMPILE([ @@ -186,85 +181,7 @@ 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 < -# include -# include - 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 Checks endianess dnl @@ -278,69 +195,16 @@ dnl LIBNET_BIG_ENDIAN = 1 or dnl LIBNET_LIL_ENDIAN = 1 dnl -AC_DEFUN(AC_LIBNET_ENDIAN_CHECK, - [AC_MSG_CHECKING(machine endianess) - - cat > conftest.c << EOF -# include -# include - - 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) +AC_DEFUN([AC_LIBNET_ENDIAN_CHECK], + [AC_C_BIGENDIAN + if test $ac_cv_c_bigendian = yes ; then + AC_DEFINE(LIBNET_BIG_ENDIAN, 1, + [We are running on a big-endian machine.]) ENDIANESS="LIBNET_BIG_ENDIAN" LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_BIG_ENDIAN" - elif test $ac_cv_libnet_endianess = lil ; then - AC_DEFINE(LIBNET_LIL_ENDIAN) + else + AC_DEFINE(LIBNET_LIL_ENDIAN, 1, + [We are running on a little-endian machine.]) ENDIANESS="LIBNET_LIL_ENDIAN" LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_LIL_ENDIAN" fi @@ -361,7 +225,7 @@ dnl dnl LIBS dnl -define(AC_LBL_CHECK_LIB, +define([AC_LBL_CHECK_LIB], [AC_MSG_CHECKING([for $2 in -l$1]) 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 @@ -439,7 +303,8 @@ 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 libnsl.a). dnl -AC_DEFUN(AC_LBL_LIBRARY_NET, [ +AC_DEFUN([AC_LBL_LIBRARY_NET], +[ # Most operating systems have gethostbyname() in the default searched # libraries (i.e. libc): AC_CHECK_FUNC(gethostbyname, ,