2
0

xc-cc-check.m4 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #---------------------------------------------------------------------------
  2. #
  3. # xc-cc-check.m4
  4. #
  5. # Copyright (C) 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. # SPDX-License-Identifier: ISC
  20. #
  21. #---------------------------------------------------------------------------
  22. # serial 1
  23. dnl _XC_PROG_CC_PREAMBLE
  24. dnl -------------------------------------------------
  25. dnl Private macro.
  26. AC_DEFUN([_XC_PROG_CC_PREAMBLE], [
  27. xc_prog_cc_prev_IFS=$IFS
  28. xc_prog_cc_prev_LIBS=$LIBS
  29. xc_prog_cc_prev_CFLAGS=$CFLAGS
  30. xc_prog_cc_prev_LDFLAGS=$LDFLAGS
  31. xc_prog_cc_prev_CPPFLAGS=$CPPFLAGS
  32. ])
  33. dnl _XC_PROG_CC_POSTLUDE
  34. dnl -------------------------------------------------
  35. dnl Private macro.
  36. AC_DEFUN([_XC_PROG_CC_POSTLUDE], [
  37. IFS=$xc_prog_cc_prev_IFS
  38. LIBS=$xc_prog_cc_prev_LIBS
  39. CFLAGS=$xc_prog_cc_prev_CFLAGS
  40. LDFLAGS=$xc_prog_cc_prev_LDFLAGS
  41. CPPFLAGS=$xc_prog_cc_prev_CPPFLAGS
  42. AC_SUBST([CC])dnl
  43. AC_SUBST([CPP])dnl
  44. AC_SUBST([LIBS])dnl
  45. AC_SUBST([CFLAGS])dnl
  46. AC_SUBST([LDFLAGS])dnl
  47. AC_SUBST([CPPFLAGS])dnl
  48. ])
  49. dnl _XC_PROG_CC
  50. dnl -------------------------------------------------
  51. dnl Private macro.
  52. AC_DEFUN([_XC_PROG_CC], [
  53. AC_REQUIRE([_XC_PROG_CC_PREAMBLE])dnl
  54. AC_REQUIRE([XC_CHECK_BUILD_FLAGS])dnl
  55. AC_REQUIRE([AC_PROG_INSTALL])dnl
  56. AC_REQUIRE([AC_PROG_CC])dnl
  57. AC_REQUIRE([AM_PROG_CC_C_O])dnl
  58. AC_REQUIRE([AC_PROG_CPP])dnl
  59. AC_REQUIRE([_XC_PROG_CC_POSTLUDE])dnl
  60. ])
  61. dnl XC_CHECK_PROG_CC
  62. dnl -------------------------------------------------
  63. dnl Public macro.
  64. dnl
  65. dnl Checks for C compiler and C preprocessor programs,
  66. dnl while doing some previous sanity validation on user
  67. dnl provided LIBS, LDFLAGS, CPPFLAGS and CFLAGS values
  68. dnl that must succeed in order to continue execution.
  69. dnl
  70. dnl This sets variables CC and CPP, while preventing
  71. dnl LIBS, LDFLAGS, CFLAGS, CPPFLAGS and IFS from being
  72. dnl unexpectedly changed by underlying macros.
  73. AC_DEFUN([XC_CHECK_PROG_CC], [
  74. AC_PREREQ([2.50])dnl
  75. AC_BEFORE([$0],[_XC_PROG_CC_PREAMBLE])dnl
  76. AC_BEFORE([$0],[AC_PROG_INSTALL])dnl
  77. AC_BEFORE([$0],[AC_PROG_CC])dnl
  78. AC_BEFORE([$0],[AM_PROG_CC_C_O])dnl
  79. AC_BEFORE([$0],[AC_PROG_CPP])dnl
  80. AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
  81. AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
  82. AC_BEFORE([$0],[_XC_PROG_CC_POSTLUDE])dnl
  83. AC_REQUIRE([_XC_PROG_CC])dnl
  84. ])