2 # Copyright (C) 1999-2017 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
10 # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
11 # to automatically call this.
12 AC_DEFUN([_AM_PROG_CC_C_O],
13 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
14 AC_REQUIRE_AUX_FILE([compile])dnl
17 [whether $CC understands -c and -o together],
19 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
20 # Make sure it works both with $CC and with simple cc.
21 # Following AC_PROG_CC_C_O, we do the test twice because some
22 # compilers refuse to overwrite an existing .o file with -o,
23 # though they will create one.
26 if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
27 && test -f conftest2.$ac_objext; then
36 if test "$am_cv_prog_cc_c_o" != yes; then
37 # Losing compiler, so override with the script.
38 # FIXME: It is wrong to rewrite CC.
39 # But if we don't then we get into trouble of one sort or another.
40 # A longer-term fix would be to have automake use am__CC in this case,
41 # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
42 CC="$am_aux_dir/compile $CC"
46 # For backward compatibility.
47 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])