Chris@82: dnl @synopsis AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE]) Chris@82: dnl @summary check whether FLAGS are accepted by the compiler Chris@82: dnl @category Misc Chris@82: dnl Chris@82: dnl Check whether the given compiler FLAGS work with the current language's Chris@82: dnl compiler, or whether they give an error. (Warnings, however, are Chris@82: dnl ignored.) Chris@82: dnl Chris@82: dnl ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on Chris@82: dnl success/failure. Chris@82: dnl Chris@82: dnl @version 2005-05-30 Chris@82: dnl @license GPLWithACException Chris@82: dnl @author Steven G. Johnson and Matteo Frigo. Chris@82: AC_DEFUN([AX_CHECK_COMPILER_FLAGS], Chris@82: [AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX Chris@82: AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1]) Chris@82: dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: Chris@82: AS_LITERAL_IF([$1], Chris@82: [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1), [ Chris@82: ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS Chris@82: _AC_LANG_PREFIX[]FLAGS="$1" Chris@82: AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], Chris@82: AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, Chris@82: AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) Chris@82: _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])], Chris@82: [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS Chris@82: _AC_LANG_PREFIX[]FLAGS="$1" Chris@82: AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], Chris@82: eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, Chris@82: eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) Chris@82: _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS]) Chris@82: eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1) Chris@82: AC_MSG_RESULT($ax_check_compiler_flags) Chris@82: if test "x$ax_check_compiler_flags" = xyes; then Chris@82: m4_default([$2], :) Chris@82: else Chris@82: m4_default([$3], :) Chris@82: fi Chris@82: ])dnl AX_CHECK_COMPILER_FLAGS