113498266Sopenharmony_ci#---------------------------------------------------------------------------
213498266Sopenharmony_ci#
313498266Sopenharmony_ci# xc-cc-check.m4
413498266Sopenharmony_ci#
513498266Sopenharmony_ci# Copyright (C), Daniel Stenberg <daniel@haxx.se>
613498266Sopenharmony_ci#
713498266Sopenharmony_ci# Permission to use, copy, modify, and distribute this software for any
813498266Sopenharmony_ci# purpose with or without fee is hereby granted, provided that the above
913498266Sopenharmony_ci# copyright notice and this permission notice appear in all copies.
1013498266Sopenharmony_ci#
1113498266Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1213498266Sopenharmony_ci# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1313498266Sopenharmony_ci# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1413498266Sopenharmony_ci# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1513498266Sopenharmony_ci# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1613498266Sopenharmony_ci# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1713498266Sopenharmony_ci# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1813498266Sopenharmony_ci#
1913498266Sopenharmony_ci# SPDX-License-Identifier: ISC
2013498266Sopenharmony_ci#
2113498266Sopenharmony_ci#---------------------------------------------------------------------------
2213498266Sopenharmony_ci
2313498266Sopenharmony_ci# serial 1
2413498266Sopenharmony_ci
2513498266Sopenharmony_ci
2613498266Sopenharmony_cidnl _XC_PROG_CC_PREAMBLE
2713498266Sopenharmony_cidnl -------------------------------------------------
2813498266Sopenharmony_cidnl Private macro.
2913498266Sopenharmony_ci
3013498266Sopenharmony_ciAC_DEFUN([_XC_PROG_CC_PREAMBLE], [
3113498266Sopenharmony_ci  xc_prog_cc_prev_IFS=$IFS
3213498266Sopenharmony_ci  xc_prog_cc_prev_LIBS=$LIBS
3313498266Sopenharmony_ci  xc_prog_cc_prev_CFLAGS=$CFLAGS
3413498266Sopenharmony_ci  xc_prog_cc_prev_LDFLAGS=$LDFLAGS
3513498266Sopenharmony_ci  xc_prog_cc_prev_CPPFLAGS=$CPPFLAGS
3613498266Sopenharmony_ci])
3713498266Sopenharmony_ci
3813498266Sopenharmony_ci
3913498266Sopenharmony_cidnl _XC_PROG_CC_POSTLUDE
4013498266Sopenharmony_cidnl -------------------------------------------------
4113498266Sopenharmony_cidnl Private macro.
4213498266Sopenharmony_ci
4313498266Sopenharmony_ciAC_DEFUN([_XC_PROG_CC_POSTLUDE], [
4413498266Sopenharmony_ci  IFS=$xc_prog_cc_prev_IFS
4513498266Sopenharmony_ci  LIBS=$xc_prog_cc_prev_LIBS
4613498266Sopenharmony_ci  CFLAGS=$xc_prog_cc_prev_CFLAGS
4713498266Sopenharmony_ci  LDFLAGS=$xc_prog_cc_prev_LDFLAGS
4813498266Sopenharmony_ci  CPPFLAGS=$xc_prog_cc_prev_CPPFLAGS
4913498266Sopenharmony_ci  AC_SUBST([CC])dnl
5013498266Sopenharmony_ci  AC_SUBST([CPP])dnl
5113498266Sopenharmony_ci  AC_SUBST([LIBS])dnl
5213498266Sopenharmony_ci  AC_SUBST([CFLAGS])dnl
5313498266Sopenharmony_ci  AC_SUBST([LDFLAGS])dnl
5413498266Sopenharmony_ci  AC_SUBST([CPPFLAGS])dnl
5513498266Sopenharmony_ci])
5613498266Sopenharmony_ci
5713498266Sopenharmony_ci
5813498266Sopenharmony_cidnl _XC_PROG_CC
5913498266Sopenharmony_cidnl -------------------------------------------------
6013498266Sopenharmony_cidnl Private macro.
6113498266Sopenharmony_ci
6213498266Sopenharmony_ciAC_DEFUN([_XC_PROG_CC], [
6313498266Sopenharmony_ci  AC_REQUIRE([_XC_PROG_CC_PREAMBLE])dnl
6413498266Sopenharmony_ci  AC_REQUIRE([XC_CHECK_BUILD_FLAGS])dnl
6513498266Sopenharmony_ci  AC_REQUIRE([AC_PROG_INSTALL])dnl
6613498266Sopenharmony_ci  AC_REQUIRE([AC_PROG_CC])dnl
6713498266Sopenharmony_ci  AC_REQUIRE([AM_PROG_CC_C_O])dnl
6813498266Sopenharmony_ci  AC_REQUIRE([AC_PROG_CPP])dnl
6913498266Sopenharmony_ci  AC_REQUIRE([_XC_PROG_CC_POSTLUDE])dnl
7013498266Sopenharmony_ci])
7113498266Sopenharmony_ci
7213498266Sopenharmony_ci
7313498266Sopenharmony_cidnl XC_CHECK_PROG_CC
7413498266Sopenharmony_cidnl -------------------------------------------------
7513498266Sopenharmony_cidnl Public macro.
7613498266Sopenharmony_cidnl
7713498266Sopenharmony_cidnl Checks for C compiler and C preprocessor programs,
7813498266Sopenharmony_cidnl while doing some previous sanity validation on user
7913498266Sopenharmony_cidnl provided LIBS, LDFLAGS, CPPFLAGS and CFLAGS values
8013498266Sopenharmony_cidnl that must succeed in order to continue execution.
8113498266Sopenharmony_cidnl
8213498266Sopenharmony_cidnl This sets variables CC and CPP, while preventing
8313498266Sopenharmony_cidnl LIBS, LDFLAGS, CFLAGS, CPPFLAGS and IFS from being
8413498266Sopenharmony_cidnl unexpectedly changed by underlying macros.
8513498266Sopenharmony_ci
8613498266Sopenharmony_ciAC_DEFUN([XC_CHECK_PROG_CC], [
8713498266Sopenharmony_ci  AC_PREREQ([2.50])dnl
8813498266Sopenharmony_ci  AC_BEFORE([$0],[_XC_PROG_CC_PREAMBLE])dnl
8913498266Sopenharmony_ci  AC_BEFORE([$0],[AC_PROG_INSTALL])dnl
9013498266Sopenharmony_ci  AC_BEFORE([$0],[AC_PROG_CC])dnl
9113498266Sopenharmony_ci  AC_BEFORE([$0],[AM_PROG_CC_C_O])dnl
9213498266Sopenharmony_ci  AC_BEFORE([$0],[AC_PROG_CPP])dnl
9313498266Sopenharmony_ci  AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
9413498266Sopenharmony_ci  AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
9513498266Sopenharmony_ci  AC_BEFORE([$0],[_XC_PROG_CC_POSTLUDE])dnl
9613498266Sopenharmony_ci  AC_REQUIRE([_XC_PROG_CC])dnl
9713498266Sopenharmony_ci])
98