Merge branch 'prog-cc-c-o-work' into maint
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 26 May 2013 11:30:52 +0000 (13:30 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 26 May 2013 11:30:52 +0000 (13:30 +0200)
* prog-cc-c-o-work:
  tests: some tests make no sense if "$CC -c -o" doesn't work
  AM_PROG_CC_C_O: don't rely on AC_PROG_CC_C_O, re-implement similar logic
  compile: rewrite AC_PROG_CC with AM_PROG_CC_C_O contents

1  2 
NEWS
m4/prog-cc-c-o.m4
t/ax/am-test-lib.sh

diff --cc NEWS
Simple merge
index 06f74c906df21fcbca997b763ec2e44edd7e0126,0000000000000000000000000000000000000000..3b2a849b074a1283feae52af077f18fa63c31042
mode 100644,000000..100644
--- /dev/null
@@@ -1,32 -1,0 +1,47 @@@
- # AM_PROG_CC_C_O
- # --------------
- # 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_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 +##                                                          -*- Autoconf -*-
 +# Copyright (C) 1999-2013 Free Software Foundation, Inc.
 +#
 +# This file is free software; the Free Software Foundation
 +# gives unlimited permission to copy and/or distribute it,
 +# with or without modifications, as long as this notice is preserved.
 +
- # FIXME: we rely on the cache variable name because
- # there is no other way.
- set dummy $CC
- am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
- eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
- if test "$am_t" != yes; then
++# _AM_PROG_CC_C_O
++# ---------------
++# Like AC_PROG_CC_C_O, but changed for automake.  We rewrite AC_PROG_CC
++# to automatically call this.
++AC_DEFUN([_AM_PROG_CC_C_O],
++[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
 +AC_REQUIRE_AUX_FILE([compile])dnl
- dnl Make sure AC_PROG_CC is never called again, or it will override our
- dnl setting of CC.
- m4_define([AC_PROG_CC],
-           [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
- ])
++AC_LANG_PUSH([C])dnl
++AC_CACHE_CHECK(
++  [whether $CC understands -c and -o together],
++  [am_cv_prog_cc_c_o],
++  [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
++  # Make sure it works both with $CC and with simple cc.
++  # Following AC_PROG_CC_C_O, we do the test twice because some
++  # compilers refuse to overwrite an existing .o file with -o,
++  # though they will create one.
++  am_cv_prog_cc_c_o=yes
++  for am_i in 1 2; do
++    if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
++         && test -f conftest2.$ac_objext; then
++      : OK
++    else
++      am_cv_prog_cc_c_o=no
++      break
++    fi
++  done
++  rm -f core conftest*
++  unset am_i])
++if test "$am_cv_prog_cc_c_o" != yes; then
 +   # Losing compiler, so override with the script.
 +   # FIXME: It is wrong to rewrite CC.
 +   # But if we don't then we get into trouble of one sort or another.
 +   # A longer-term fix would be to have automake use am__CC in this case,
 +   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
 +   CC="$am_aux_dir/compile $CC"
 +fi
++AC_LANG_POP([C])])
++
++# For backward compatibility.
++AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
Simple merge