2
0

prog-cc-c-o.m4 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ## -*- Autoconf -*-
  2. # Copyright (C) 1999-2017 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. # _AM_PROG_CC_C_O
  8. # ---------------
  9. # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
  10. # to automatically call this.
  11. AC_DEFUN([_AM_PROG_CC_C_O],
  12. [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
  13. AC_REQUIRE_AUX_FILE([compile])dnl
  14. AC_LANG_PUSH([C])dnl
  15. AC_CACHE_CHECK(
  16. [whether $CC understands -c and -o together],
  17. [am_cv_prog_cc_c_o],
  18. [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
  19. # Make sure it works both with $CC and with simple cc.
  20. # Following AC_PROG_CC_C_O, we do the test twice because some
  21. # compilers refuse to overwrite an existing .o file with -o,
  22. # though they will create one.
  23. am_cv_prog_cc_c_o=yes
  24. for am_i in 1 2; do
  25. if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
  26. && test -f conftest2.$ac_objext; then
  27. : OK
  28. else
  29. am_cv_prog_cc_c_o=no
  30. break
  31. fi
  32. done
  33. rm -f core conftest*
  34. unset am_i])
  35. if test "$am_cv_prog_cc_c_o" != yes; then
  36. # Losing compiler, so override with the script.
  37. # FIXME: It is wrong to rewrite CC.
  38. # But if we don't then we get into trouble of one sort or another.
  39. # A longer-term fix would be to have automake use am__CC in this case,
  40. # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
  41. CC="$am_aux_dir/compile $CC"
  42. fi
  43. AC_LANG_POP([C])])
  44. # For backward compatibility.
  45. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])