corrected copyright notices
[gnutls.git] / m4 / gcc.m4
blobc01694285b13dd3382bead9e3a8df4ea3724986f
1 # gcc.m4 serial 2
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], [
16   save_CFLAGS="$CFLAGS"
17   CFLAGS="${CFLAGS} $1"
18   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
19                     [AS_VAR_SET([GCC_FLAG], [yes])],
20                     [AS_VAR_SET([GCC_FLAG], [no])])
21   CFLAGS="$save_CFLAGS"
23 AS_VAR_IF([GCC_FLAG], [yes], [
24 m4_ifval([$2], [AC_SUBST([$2],[yes])])
25 CFLAGS="${CFLAGS} $1"
26 ])dnl
27 AS_VAR_POPDEF([GCC_FLAG])