diff options
author | Guy Harris <guy@alum.mit.edu> | 2010-01-02 14:15:46 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2010-01-02 14:15:46 -0800 |
commit | d1a3a92fab103210ab5f61780a731bce9a8909b5 (patch) | |
tree | a1c5b06b800525588f0cb18d9c52e1aeca78e598 | |
parent | 1daef0632194346a39bcfb2b465fafe7aeb26454 (diff) |
Fix some problems that show up in autoconf 2.64 and later.
-rw-r--r-- | aclocal.m4 | 60 | ||||
-rwxr-xr-x | configure | 9 | ||||
-rw-r--r-- | configure.in | 2 |
3 files changed, 45 insertions, 26 deletions
@@ -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 Do whatever AC_LBL_C_INIT work is necessary before using AC_PROG_CC. dnl -dnl usage: +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 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 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 @@ -1909,9 +1909,6 @@ test -n "$target_alias" && - - - # Check whether --with-gcc was given. if test "${with_gcc+set}" = set; then withval=$with_gcc; @@ -1978,7 +1975,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' @@ -2897,6 +2895,9 @@ 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' ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + if test "$GCC" = yes ; then if test "$SHLICC2" = yes ; then ac_cv_lbl_gcc_vers=2 diff --git a/configure.in b/configure.in index f4e51bd..c0a1df9 100644 --- a/configure.in +++ b/configure.in @@ -21,6 +21,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) AC_LBL_C_INLINE AC_C___ATTRIBUTE__ |