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