From d1a3a92fab103210ab5f61780a731bce9a8909b5 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 2 Jan 2010 14:15:46 -0800 Subject: [PATCH] Fix some problems that show up in autoconf 2.64 and later. --- aclocal.m4 | 60 ++++++++++++++++++++++++++++++++++++--------------------- configure | 9 ++++--- configure.in | 2 + 3 files changed, 45 insertions(+), 26 deletions(-) Index: libpcap-1.0.0/aclocal.m4 =================================================================== --- libpcap-1.0.0.orig/aclocal.m4 +++ libpcap-1.0.0/aclocal.m4 @@ -23,30 +23,21 @@ dnl LBL autoconf macros dnl dnl -dnl Determine which compiler we're using (cc or gcc) -dnl If using gcc, determine the version number -dnl If using cc, require that it support ansi prototypes -dnl If using gcc, use -O2 (otherwise use -O) -dnl If using cc, explicitly specify /usr/local/include -dnl -dnl usage: -dnl -dnl AC_LBL_C_INIT(copt, incls) -dnl -dnl results: +dnl Do whatever AC_LBL_C_INIT work is necessary before using AC_PROG_CC. dnl -dnl $1 (copt set) -dnl $2 (incls set) -dnl CC -dnl LDFLAGS -dnl ac_cv_lbl_gcc_vers -dnl LBL_CFLAGS +dnl It appears that newer versions of autoconf (2.64 and later) will, +dnl if you use AC_TRY_COMPILE in a macro, stick AC_PROG_CC at the +dnl beginning of the macro, even if the macro itself calls AC_PROG_CC. +dnl See section 20.8 "Expanded Before Required" in the Autoconf +dnl documentation. +dnl +dnl This causes a steaming heap of fail in our case, as we were, in +dnl AC_LBL_C_INIT, doing the tests we now do in AC_LBL_C_PREPARE, +dnl calling AC_PROG_CC, and then doing the tests we now do in +dnl AC_LBL_C_INIT. dnl -AC_DEFUN([AC_LBL_C_INIT], - [AC_PREREQ(2.12) - AC_BEFORE([$0], [AC_PROG_CC]) - AC_BEFORE([$0], [AC_LBL_FIXINCLUDES]) - AC_BEFORE([$0], [AC_LBL_DEVEL]) +AC_DEFUN(AC_LBL_C_INIT_BEFORE_CC, +[ AC_ARG_WITH(gcc, [ --without-gcc don't use gcc]) $1="-O" $2="" @@ -72,7 +63,32 @@ AC_DEFUN([AC_LBL_C_INIT], CC=cc export CC fi - AC_PROG_CC +]) + +dnl +dnl Determine which compiler we're using (cc or gcc) +dnl If using gcc, determine the version number +dnl If using cc, require that it support ansi prototypes +dnl If using gcc, use -O2 (otherwise use -O) +dnl If using cc, explicitly specify /usr/local/include +dnl +dnl usage: +dnl +dnl AC_LBL_C_INIT(copt, incls) +dnl +dnl results: +dnl +dnl $1 (copt set) +dnl $2 (incls set) +dnl CC +dnl LDFLAGS +dnl ac_cv_lbl_gcc_vers +dnl LBL_CFLAGS +dnl +AC_DEFUN(AC_LBL_C_INIT, + [AC_PREREQ(2.50) + AC_BEFORE([$0], [AC_LBL_FIXINCLUDES]) + AC_BEFORE([$0], [AC_LBL_DEVEL]) if test "$GCC" = yes ; then if test "$SHLICC2" = yes ; then ac_cv_lbl_gcc_vers=2 Index: libpcap-1.0.0/configure =================================================================== --- libpcap-1.0.0.orig/configure +++ libpcap-1.0.0/configure @@ -1893,9 +1893,6 @@ test -n "$target_alias" && - - - # Check whether --with-gcc was given. if test "${with_gcc+set}" = set; then withval=$with_gcc; @@ -1962,7 +1959,8 @@ fi CC=cc export CC fi - ac_ext=c + +ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' @@ -2881,6 +2879,9 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS con ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + if test "$GCC" = yes ; then if test "$SHLICC2" = yes ; then ac_cv_lbl_gcc_vers=2 Index: libpcap-1.0.0/configure.in =================================================================== --- libpcap-1.0.0.orig/configure.in +++ libpcap-1.0.0/configure.in @@ -12,6 +12,8 @@ AC_INIT(pcap.c) AC_CANONICAL_SYSTEM +AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS) +AC_PROG_CC AC_LBL_C_INIT(V_CCOPT, V_INCLS, V_LIBS) AC_LBL_C_INLINE AC_C___ATTRIBUTE__