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