Use autoconf's endian check instead of the locally defined check so that we can determine the endianess without having to compile a program. Idea from http://www.security-lists.org/lists/libnet/2003/03/00001.html Also remove the old test from aclocal.m4. --- libnet/configure.in 2005/11/15 03:49:30 1.1 +++ libnet/configure.in 2005/11/15 03:50:29 @@ -7,6 +7,7 @@ dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.52) AC_INIT(src/libnet_build_ip.c) LIBNET_VERSION=`cat VERSION` AC_MSG_RESULT(beginning autoconfiguration process for libnet-$LIBNET_VERSION...) @@ -29,7 +30,16 @@ dnl And some custom things dnl -AC_LIBNET_ENDIAN_CHECK +AC_C_BIGENDIAN([ + AC_DEFINE(LIBNET_BIG_ENDIAN) + ENDIANESS="LIBNET_BIG_ENDIAN" + LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_BIG_ENDIAN" +],[ + AC_DEFINE(LIBNET_LIL_ENDIAN) + ENDIANESS="LIBNET_LIL_ENDIAN" + LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_LIL_ENDIAN" +], AC_MSG_WARN(cannot detect endianess. try setting ac_cv_c_bigendian to yes or no)) + AC_LBL_UNALIGNED_ACCESS dnl AC_LBL_LIBRARY_NET --- libnet/aclocal.m4 2005/11/15 04:02:01 1.1 +++ libnet/aclocal.m4 2005/11/15 04:03:43 @@ -279,87 +279,6 @@ dnl -dnl Checks endianess -dnl -dnl usage: -dnl -dnl AC_LIBNET_ENDIAN_CHECK -dnl -dnl results: -dnl -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) - 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) - ENDIANESS="LIBNET_LIL_ENDIAN" - LIBNET_CONFIG_DEFINES="$LIBNET_CONFIG_DEFINES -DLIBNET_LIL_ENDIAN" - fi - ]) - -dnl dnl Improved version of AC_CHECK_LIB dnl dnl Thanks to John Hawkinson (jhawk@mit.edu)