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