1*a3cefe7fSPierre Pronchery# =========================================================================== 2*a3cefe7fSPierre Pronchery# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html 3*a3cefe7fSPierre Pronchery# =========================================================================== 4*a3cefe7fSPierre Pronchery# 5*a3cefe7fSPierre Pronchery# SYNOPSIS 6*a3cefe7fSPierre Pronchery# 7*a3cefe7fSPierre Pronchery# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) 8*a3cefe7fSPierre Pronchery# 9*a3cefe7fSPierre Pronchery# DESCRIPTION 10*a3cefe7fSPierre Pronchery# 11*a3cefe7fSPierre Pronchery# Check whether the given FLAG works with the current language's compiler 12*a3cefe7fSPierre Pronchery# or gives an error. (Warnings, however, are ignored) 13*a3cefe7fSPierre Pronchery# 14*a3cefe7fSPierre Pronchery# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 15*a3cefe7fSPierre Pronchery# success/failure. 16*a3cefe7fSPierre Pronchery# 17*a3cefe7fSPierre Pronchery# If EXTRA-FLAGS is defined, it is added to the current language's default 18*a3cefe7fSPierre Pronchery# flags (e.g. CFLAGS) when the check is done. The check is thus made with 19*a3cefe7fSPierre Pronchery# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to 20*a3cefe7fSPierre Pronchery# force the compiler to issue an error when a bad flag is given. 21*a3cefe7fSPierre Pronchery# 22*a3cefe7fSPierre Pronchery# INPUT gives an alternative input source to AC_COMPILE_IFELSE. 23*a3cefe7fSPierre Pronchery# 24*a3cefe7fSPierre Pronchery# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this 25*a3cefe7fSPierre Pronchery# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. 26*a3cefe7fSPierre Pronchery# 27*a3cefe7fSPierre Pronchery# LICENSE 28*a3cefe7fSPierre Pronchery# 29*a3cefe7fSPierre Pronchery# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> 30*a3cefe7fSPierre Pronchery# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> 31*a3cefe7fSPierre Pronchery# 32*a3cefe7fSPierre Pronchery# Copying and distribution of this file, with or without modification, are 33*a3cefe7fSPierre Pronchery# permitted in any medium without royalty provided the copyright notice 34*a3cefe7fSPierre Pronchery# and this notice are preserved. This file is offered as-is, without any 35*a3cefe7fSPierre Pronchery# warranty. 36*a3cefe7fSPierre Pronchery 37*a3cefe7fSPierre Pronchery#serial 6 38*a3cefe7fSPierre Pronchery 39*a3cefe7fSPierre ProncheryAC_DEFUN([AX_CHECK_COMPILE_FLAG], 40*a3cefe7fSPierre Pronchery[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF 41*a3cefe7fSPierre ProncheryAS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl 42*a3cefe7fSPierre ProncheryAC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ 43*a3cefe7fSPierre Pronchery ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS 44*a3cefe7fSPierre Pronchery _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" 45*a3cefe7fSPierre Pronchery AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], 46*a3cefe7fSPierre Pronchery [AS_VAR_SET(CACHEVAR,[yes])], 47*a3cefe7fSPierre Pronchery [AS_VAR_SET(CACHEVAR,[no])]) 48*a3cefe7fSPierre Pronchery _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) 49*a3cefe7fSPierre ProncheryAS_VAR_IF(CACHEVAR,yes, 50*a3cefe7fSPierre Pronchery [m4_default([$2], :)], 51*a3cefe7fSPierre Pronchery [m4_default([$3], :)]) 52*a3cefe7fSPierre ProncheryAS_VAR_POPDEF([CACHEVAR])dnl 53*a3cefe7fSPierre Pronchery])dnl AX_CHECK_COMPILE_FLAGS 54