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