Blame m4/ax_check_compiler_flags.m4

Packit Service e6cf14
##### http://autoconf-archive.cryp.to/ax_check_compiler_flags.html
Packit Service e6cf14
#
Packit Service e6cf14
# SYNOPSIS
Packit Service e6cf14
#
Packit Service e6cf14
#   AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
Packit Service e6cf14
#
Packit Service e6cf14
# DESCRIPTION
Packit Service e6cf14
#
Packit Service e6cf14
#   Check whether the given compiler FLAGS work with the current
Packit Service e6cf14
#   language's compiler, or whether they give an error. (Warnings,
Packit Service e6cf14
#   however, are ignored.)
Packit Service e6cf14
#
Packit Service e6cf14
#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
Packit Service e6cf14
#   success/failure.
Packit Service e6cf14
#
Packit Service e6cf14
# LAST MODIFICATION
Packit Service e6cf14
#
Packit Service e6cf14
#   2005-05-30
Packit Service e6cf14
#
Packit Service e6cf14
# COPYLEFT
Packit Service e6cf14
#
Packit Service e6cf14
#   Copyright (c) 2005 Steven G. Johnson <stevenj@alum.mit.edu>
Packit Service e6cf14
#   Copyright (c) 2005 Matteo Frigo
Packit Service e6cf14
#
Packit Service e6cf14
#   This program is free software; you can redistribute it and/or
Packit Service e6cf14
#   modify it under the terms of the GNU General Public License as
Packit Service e6cf14
#   published by the Free Software Foundation; either version 2 of the
Packit Service e6cf14
#   License, or (at your option) any later version.
Packit Service e6cf14
#
Packit Service e6cf14
#   This program is distributed in the hope that it will be useful, but
Packit Service e6cf14
#   WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service e6cf14
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Packit Service e6cf14
#   General Public License for more details.
Packit Service e6cf14
#
Packit Service e6cf14
#   You should have received a copy of the GNU General Public License
Packit Service e6cf14
#   along with this program; if not, write to the Free Software
Packit Service e6cf14
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
Packit Service e6cf14
#   02111-1307, USA.
Packit Service e6cf14
#
Packit Service e6cf14
#   As a special exception, the respective Autoconf Macro's copyright
Packit Service e6cf14
#   owner gives unlimited permission to copy, distribute and modify the
Packit Service e6cf14
#   configure scripts that are the output of Autoconf when processing
Packit Service e6cf14
#   the Macro. You need not follow the terms of the GNU General Public
Packit Service e6cf14
#   License when using or distributing such scripts, even though
Packit Service e6cf14
#   portions of the text of the Macro appear in them. The GNU General
Packit Service e6cf14
#   Public License (GPL) does govern all other use of the material that
Packit Service e6cf14
#   constitutes the Autoconf Macro.
Packit Service e6cf14
#
Packit Service e6cf14
#   This special exception to the GPL applies to versions of the
Packit Service e6cf14
#   Autoconf Macro released by the Autoconf Macro Archive. When you
Packit Service e6cf14
#   make and distribute a modified version of the Autoconf Macro, you
Packit Service e6cf14
#   may extend this special exception to the GPL to apply to your
Packit Service e6cf14
#   modified version as well.
Packit Service e6cf14
Packit Service e6cf14
AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
Packit Service e6cf14
[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
Packit Service e6cf14
AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
Packit Service e6cf14
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
Packit Service e6cf14
AS_LITERAL_IF([$1],
Packit Service e6cf14
  [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1), [
Packit Service e6cf14
      ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
Packit Service e6cf14
      _AC_LANG_PREFIX[]FLAGS="$1"
Packit Service e6cf14
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
Packit Service e6cf14
        AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes,
Packit Service e6cf14
        AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no)
Packit Service e6cf14
      _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
Packit Service e6cf14
  [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
Packit Service e6cf14
   _AC_LANG_PREFIX[]FLAGS="$1"
Packit Service e6cf14
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
Packit Service e6cf14
     eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes,
Packit Service e6cf14
     eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no)
Packit Service e6cf14
   _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
Packit Service e6cf14
eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)
Packit Service e6cf14
AC_MSG_RESULT($ax_check_compiler_flags)
Packit Service e6cf14
if test "x$ax_check_compiler_flags" = xyes; then
Packit Service e6cf14
	m4_default([$2], :)
Packit Service e6cf14
else
Packit Service e6cf14
	m4_default([$3], :)
Packit Service e6cf14
fi
Packit Service e6cf14
])dnl AX_CHECK_COMPILER_FLAGS