xc-cc-check.m4 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #---------------------------------------------------------------------------
  2. #
  3. # xc-cc-check.m4
  4. #
  5. # Copyright (c) 2013 - 2020, Daniel Stenberg <daniel@haxx.se>
  6. #
  7. # Permission to use, copy, modify, and distribute this software for any
  8. # purpose with or without fee is hereby granted, provided that the above
  9. # copyright notice and this permission notice appear in all copies.
  10. #
  11. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  13. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  14. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  15. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  16. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  17. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  18. #
  19. #---------------------------------------------------------------------------
  20. # serial 1
  21. dnl _XC_PROG_CC_PREAMBLE
  22. dnl -------------------------------------------------
  23. dnl Private macro.
  24. AC_DEFUN([_XC_PROG_CC_PREAMBLE], [
  25. xc_prog_cc_prev_IFS=$IFS
  26. xc_prog_cc_prev_LIBS=$LIBS
  27. xc_prog_cc_prev_CFLAGS=$CFLAGS
  28. xc_prog_cc_prev_LDFLAGS=$LDFLAGS
  29. xc_prog_cc_prev_CPPFLAGS=$CPPFLAGS
  30. ])
  31. dnl _XC_PROG_CC_POSTLUDE
  32. dnl -------------------------------------------------
  33. dnl Private macro.
  34. AC_DEFUN([_XC_PROG_CC_POSTLUDE], [
  35. IFS=$xc_prog_cc_prev_IFS
  36. LIBS=$xc_prog_cc_prev_LIBS
  37. CFLAGS=$xc_prog_cc_prev_CFLAGS
  38. LDFLAGS=$xc_prog_cc_prev_LDFLAGS
  39. CPPFLAGS=$xc_prog_cc_prev_CPPFLAGS
  40. AC_SUBST([CC])dnl
  41. AC_SUBST([CPP])dnl
  42. AC_SUBST([LIBS])dnl
  43. AC_SUBST([CFLAGS])dnl
  44. AC_SUBST([LDFLAGS])dnl
  45. AC_SUBST([CPPFLAGS])dnl
  46. ])
  47. dnl _XC_PROG_CC
  48. dnl -------------------------------------------------
  49. dnl Private macro.
  50. AC_DEFUN([_XC_PROG_CC], [
  51. AC_REQUIRE([_XC_PROG_CC_PREAMBLE])dnl
  52. AC_REQUIRE([XC_CHECK_BUILD_FLAGS])dnl
  53. AC_REQUIRE([AC_PROG_INSTALL])dnl
  54. AC_REQUIRE([AC_PROG_CC])dnl
  55. AC_REQUIRE([AM_PROG_CC_C_O])dnl
  56. AC_REQUIRE([AC_PROG_CPP])dnl
  57. AC_REQUIRE([_XC_PROG_CC_POSTLUDE])dnl
  58. ])
  59. dnl XC_CHECK_PROG_CC
  60. dnl -------------------------------------------------
  61. dnl Public macro.
  62. dnl
  63. dnl Checks for C compiler and C preprocessor programs,
  64. dnl while doing some previous sanity validation on user
  65. dnl provided LIBS, LDFLAGS, CPPFLAGS and CFLAGS values
  66. dnl that must succeed in order to continue execution.
  67. dnl
  68. dnl This sets variables CC and CPP, while preventing
  69. dnl LIBS, LDFLAGS, CFLAGS, CPPFLAGS and IFS from being
  70. dnl unexpectedly changed by underlying macros.
  71. AC_DEFUN([XC_CHECK_PROG_CC], [
  72. AC_PREREQ([2.50])dnl
  73. AC_BEFORE([$0],[_XC_PROG_CC_PREAMBLE])dnl
  74. AC_BEFORE([$0],[AC_PROG_INSTALL])dnl
  75. AC_BEFORE([$0],[AC_PROG_CC])dnl
  76. AC_BEFORE([$0],[AM_PROG_CC_C_O])dnl
  77. AC_BEFORE([$0],[AC_PROG_CPP])dnl
  78. AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
  79. AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
  80. AC_BEFORE([$0],[_XC_PROG_CC_POSTLUDE])dnl
  81. AC_REQUIRE([_XC_PROG_CC])dnl
  82. ])