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