1 # Copyright © 2006 Rémi Denis-Courmont
2 # This file (flags.m4) is free software; unlimited permission to
3 # copy and/or distribute it , with or without modifications, as long
4 # as this notice is preserved.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
8 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 AC_DEFUN([RDC_PROG_CC_FLAGS_IFELSE],
13 CFLAGS_save="${CFLAGS}"
14 as_ac_var=`echo "ac_cv_prog_cc_flags_$1" | $as_tr_sh`
15 AC_CACHE_CHECK([if $CC accepts $1], [$as_ac_var], [
17 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
24 ac_res=`eval echo '${'$as_ac_var'}'`
25 CFLAGS="${CFLAGS_save}"
26 AS_IF([test "${ac_res}" != "no"], [$2], [$3])
29 AC_DEFUN([RDC_PROG_CC_FLAGS],
31 RDC_PROG_CC_FLAGS_IFELSE([$1], [CFLAGS="${CFLAGS} $1"])
34 AC_DEFUN([RDC_PROG_CC_WFLAGS],
36 RDC_PROG_CC_FLAGS([-W$a])
40 AC_DEFUN([RDC_PROG_LINK_FLAGS_IFELSE],
42 LDFLAGS_save="${LDFLAGS}"
43 as_ac_var=`echo "ac_cv_prog_link_flags_$1" | $as_tr_sh`
44 AC_CACHE_CHECK([if $LINK accepts $1], [$as_ac_var], [
45 LDFLAGS="${LDFLAGS} $1"
46 AC_LINK_IFELSE([AC_LANG_PROGRAM()], [
53 ac_res=`eval echo '${'$as_ac_var'}'`
54 AS_IF([test "${ac_res}" != "no"], [
55 LDFLAGS="${LDFLAGS} $1"
58 LDFLAGS="${LDFLAGS_save}"