1 # <rdenis (at) simphalempin (dot) com>.
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_WERRORFLAGS],
36 RDC_PROG_CC_FLAGS_IFELSE([-Werror=$a], [CFLAGS_WERROR="${CFLAGS_WERROR} -Werror=${a}"])
40 AC_DEFUN([RDC_PROG_CC_WFLAGS],
42 RDC_PROG_CC_FLAGS([-W$a])
46 AC_DEFUN([RDC_PROG_LINK_FLAGS_IFELSE],
48 LDFLAGS_save="${LDFLAGS}"
49 as_ac_var=`echo "ac_cv_prog_link_flags_$1" | $as_tr_sh`
50 AC_CACHE_CHECK([if $LINK accepts $1], [$as_ac_var], [
51 LDFLAGS="${LDFLAGS} $1"
52 AC_LINK_IFELSE([AC_LANG_PROGRAM()], [
59 ac_res=`eval echo '${'$as_ac_var'}'`
60 AS_IF([test "${ac_res}" != "no"], [
61 LDFLAGS="${LDFLAGS} $1"
64 LDFLAGS="${LDFLAGS_save}"