2 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 dnl Based on code by Simon Josefsson
9 # GCC_FLAG_ADD(PARAMETER, [ACTION])
10 # ------------------------------------------------
11 # Adds parameter to CFLAGS if the compiler supports it. For example,
12 # GCC_FLAG_ADD([-maes], [VAR]).
13 AC_DEFUN([GCC_FLAG_ADD],
14 [AS_VAR_PUSHDEF([GCC_FLAG], [gl_cv_GCC_FLAG_$1])dnl
15 AC_CACHE_CHECK([whether compiler handles $1], [GCC_FLAG], [
18 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
19 [AS_VAR_SET([GCC_FLAG], [yes])],
20 [AS_VAR_SET([GCC_FLAG], [no])])
23 AS_VAR_IF([GCC_FLAG], [yes], [
24 m4_ifval([$2], [AC_SUBST([$2],[yes])])
27 AS_VAR_POPDEF([GCC_FLAG])