11cb0ef41Sopenharmony_ci# =========================================================================== 21cb0ef41Sopenharmony_ci# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html 31cb0ef41Sopenharmony_ci# =========================================================================== 41cb0ef41Sopenharmony_ci# 51cb0ef41Sopenharmony_ci# SYNOPSIS 61cb0ef41Sopenharmony_ci# 71cb0ef41Sopenharmony_ci# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) 81cb0ef41Sopenharmony_ci# 91cb0ef41Sopenharmony_ci# DESCRIPTION 101cb0ef41Sopenharmony_ci# 111cb0ef41Sopenharmony_ci# Check whether the given FLAG works with the current language's compiler 121cb0ef41Sopenharmony_ci# or gives an error. (Warnings, however, are ignored) 131cb0ef41Sopenharmony_ci# 141cb0ef41Sopenharmony_ci# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 151cb0ef41Sopenharmony_ci# success/failure. 161cb0ef41Sopenharmony_ci# 171cb0ef41Sopenharmony_ci# If EXTRA-FLAGS is defined, it is added to the current language's default 181cb0ef41Sopenharmony_ci# flags (e.g. CFLAGS) when the check is done. The check is thus made with 191cb0ef41Sopenharmony_ci# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to 201cb0ef41Sopenharmony_ci# force the compiler to issue an error when a bad flag is given. 211cb0ef41Sopenharmony_ci# 221cb0ef41Sopenharmony_ci# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this 231cb0ef41Sopenharmony_ci# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. 241cb0ef41Sopenharmony_ci# 251cb0ef41Sopenharmony_ci# LICENSE 261cb0ef41Sopenharmony_ci# 271cb0ef41Sopenharmony_ci# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> 281cb0ef41Sopenharmony_ci# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> 291cb0ef41Sopenharmony_ci# 301cb0ef41Sopenharmony_ci# This program is free software: you can redistribute it and/or modify it 311cb0ef41Sopenharmony_ci# under the terms of the GNU General Public License as published by the 321cb0ef41Sopenharmony_ci# Free Software Foundation, either version 3 of the License, or (at your 331cb0ef41Sopenharmony_ci# option) any later version. 341cb0ef41Sopenharmony_ci# 351cb0ef41Sopenharmony_ci# This program is distributed in the hope that it will be useful, but 361cb0ef41Sopenharmony_ci# WITHOUT ANY WARRANTY; without even the implied warranty of 371cb0ef41Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 381cb0ef41Sopenharmony_ci# Public License for more details. 391cb0ef41Sopenharmony_ci# 401cb0ef41Sopenharmony_ci# You should have received a copy of the GNU General Public License along 411cb0ef41Sopenharmony_ci# with this program. If not, see <http://www.gnu.org/licenses/>. 421cb0ef41Sopenharmony_ci# 431cb0ef41Sopenharmony_ci# As a special exception, the respective Autoconf Macro's copyright owner 441cb0ef41Sopenharmony_ci# gives unlimited permission to copy, distribute and modify the configure 451cb0ef41Sopenharmony_ci# scripts that are the output of Autoconf when processing the Macro. You 461cb0ef41Sopenharmony_ci# need not follow the terms of the GNU General Public License when using 471cb0ef41Sopenharmony_ci# or distributing such scripts, even though portions of the text of the 481cb0ef41Sopenharmony_ci# Macro appear in them. The GNU General Public License (GPL) does govern 491cb0ef41Sopenharmony_ci# all other use of the material that constitutes the Autoconf Macro. 501cb0ef41Sopenharmony_ci# 511cb0ef41Sopenharmony_ci# This special exception to the GPL applies to versions of the Autoconf 521cb0ef41Sopenharmony_ci# Macro released by the Autoconf Archive. When you make and distribute a 531cb0ef41Sopenharmony_ci# modified version of the Autoconf Macro, you may extend this special 541cb0ef41Sopenharmony_ci# exception to the GPL to apply to your modified version as well. 551cb0ef41Sopenharmony_ci 561cb0ef41Sopenharmony_ci#serial 2 571cb0ef41Sopenharmony_ci 581cb0ef41Sopenharmony_ciAC_DEFUN([AX_CHECK_COMPILE_FLAG], 591cb0ef41Sopenharmony_ci[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX 601cb0ef41Sopenharmony_ciAS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl 611cb0ef41Sopenharmony_ciAC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ 621cb0ef41Sopenharmony_ci ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS 631cb0ef41Sopenharmony_ci _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" 641cb0ef41Sopenharmony_ci AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], 651cb0ef41Sopenharmony_ci [AS_VAR_SET(CACHEVAR,[yes])], 661cb0ef41Sopenharmony_ci [AS_VAR_SET(CACHEVAR,[no])]) 671cb0ef41Sopenharmony_ci _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) 681cb0ef41Sopenharmony_ciAS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], 691cb0ef41Sopenharmony_ci [m4_default([$2], :)], 701cb0ef41Sopenharmony_ci [m4_default([$3], :)]) 711cb0ef41Sopenharmony_ciAS_VAR_POPDEF([CACHEVAR])dnl 721cb0ef41Sopenharmony_ci])dnl AX_CHECK_COMPILE_FLAGS 73