summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-05-14 16:08:32 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-05-24 14:17:26 +0200
commit9877109c1f00e20f76a69ac656fc02a439ae318a (patch)
tree97fe748cf815830dcfdf3b9af4ca60f4cf8dff24 /m4
parentac13ca500648395417e5d9bcf110475b42841bee (diff)
downloadautomake-9877109c1f00e20f76a69ac656fc02a439ae318a.tar.gz
compile: rewrite AC_PROG_CC with AM_PROG_CC_C_O contents
This is a much simpler rewrite than the one we attempted in the past, and that was later removed by commit 'v1.13.1d-137-g32eb770' of 2013-05-11 (compile: avoid AC_PROG_CC messy rewrite). Not only this change simplifies the code a little, but has the welcome collateral effect of making automatic dependency tracking work better with compilers that doesn't grasp the '-c' and '-o' options together. Issues in that setup have been caught by several failures in the target 'check-no-cc-c-o'. Unfortunately, this change has less welcome collateral effects: 1. AM_PROG_AR must now be called *after* AC_PROG_CC; 2. Autoconf emits extra warnings when used with Automake-generated aclocal.m4. These are unacceptable regressions for a release, but since we are going to fix them soon enough in a follow-up patch (surely to be applied before Automake 1.14 is released) we don't worry too much. * m4/init.m4: Redefine AC_PROG_CC early, to automatically invoke AM_PROG_CC_C_O as well. Accordingly, drop now-unneeded "automagical" AM_PROG_CC_C_O expansion at later time (which took place thanks to a AC_CONFIG_COMMANDS_PRE call). * m4/minuso.m4 (AM_PROG_CC_C_O): Ensure the expansion of the body of this macro takes place with C as "current Autoconf language" (use AC_LANG_PUSH/AC_LANG_POP). * m4/ar-lib.m4 (AM_PROG_AR): Likewise. Also, require this macro to be expanded *after* AC_PROG_CC (so that any rewrite of $CC, if required, has already taken place). * t/add-missing.tap: Adjust to avoid spurious failures. * t/aclocal-deps.sh: Likewise, by having AM_PROG_AR called *after* AC_PROG_CC. * t/subobj-clean-lt-pr10697.sh: Likewise. * t/alloca.sh: Likewise. * t/condlib.sh: Likewise. * t/discover.sh: Likewise. * t/objc-megademo.sh: Likewise. * t/ccnoco.sh: Extend a little. * t/ccnoco-deps.sh: New test. * t/ccnoco-lib.sh: Likewise. * t/ccnoco-lt.sh: Likewise. * t/list-of-tests.mk: Add them. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/ar-lib.m46
-rw-r--r--m4/init.m410
-rw-r--r--m4/minuso.m44
3 files changed, 11 insertions, 9 deletions
diff --git a/m4/ar-lib.m4 b/m4/ar-lib.m4
index f895f6bd2..53c8c2a7e 100644
--- a/m4/ar-lib.m4
+++ b/m4/ar-lib.m4
@@ -13,13 +13,15 @@
AC_DEFUN([AM_PROG_AR],
[AC_BEFORE([$0], [LT_INIT])dnl
AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
+AC_BEFORE([AC_PROG_CC])
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([ar-lib])dnl
AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
: ${AR=ar}
AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
- [am_cv_ar_interface=ar
+ [AC_LANG_PUSH([C])
+ am_cv_ar_interface=ar
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
[am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
AC_TRY_EVAL([am_ar_try])
@@ -36,7 +38,7 @@ AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
fi
rm -f conftest.lib libconftest.a
])
- ])
+ AC_LANG_POP([C])])
case $am_cv_ar_interface in
ar)
diff --git a/m4/init.m4 b/m4/init.m4
index a6f27339d..fb6ed5851 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -9,6 +9,10 @@
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
+dnl Redefine AC_PROG_CC to automatically invoke AM_PROG_CC_C_O.
+m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[AM_PROG_CC_C_O
+])
+
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
@@ -110,12 +114,6 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
-dnl Automatically invoke AM_PROG_CC_C_O as necessary. Since AC_PROG_CC is
-dnl usually called after AM_INIT_AUTOMAKE, we arrange for the test to be
-dnl done later by AC_CONFIG_COMMANDS_PRE.
-AC_CONFIG_COMMANDS_PRE([AC_PROVIDE_IFELSE(
- [AC_PROG_CC],
- [AC_LANG_PUSH([C]) AM_PROG_CC_C_O AC_LANG_POP([C])])])dnl
AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
diff --git a/m4/minuso.m4 b/m4/minuso.m4
index 06f74c906..3e68f2b72 100644
--- a/m4/minuso.m4
+++ b/m4/minuso.m4
@@ -9,7 +9,8 @@
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN_ONCE([AM_PROG_CC_C_O],
-[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+[AC_LANG_PUSH([C])
+AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
# FIXME: we rely on the cache variable name because
@@ -25,6 +26,7 @@ if test "$am_t" != yes; then
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
+AC_LANG_POP([C])
dnl Make sure AC_PROG_CC is never called again, or it will override our
dnl setting of CC.
m4_define([AC_PROG_CC],