1## -*- Autoconf -*- 2# Copyright (C) 1999-2021 Free Software Foundation, Inc. 3# 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. 7 8# _AM_PROG_CC_C_O 9# --------------- 10# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC 11# to automatically call this. 12AC_DEFUN([_AM_PROG_CC_C_O], 13[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 14AC_REQUIRE_AUX_FILE([compile])dnl 15AC_LANG_PUSH([C])dnl 16AC_CACHE_CHECK( 17 [whether $CC understands -c and -o together], 18 [am_cv_prog_cc_c_o], 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. 24 am_cv_prog_cc_c_o=yes 25 for am_i in 1 2; do 26 if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ 27 && test -f conftest2.$ac_objext; then 28 : OK 29 else 30 am_cv_prog_cc_c_o=no 31 break 32 fi 33 done 34 rm -f core conftest* 35 unset am_i]) 36if 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" 43fi 44AC_LANG_POP([C])]) 45 46# For backward compatibility. 47AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) 48