You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xc-cc-check.m4 2.9KB

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