melunko@47: dnl as-compiler-flag.m4 0.1.0 melunko@47: melunko@47: dnl autostars m4 macro for detection of compiler flags melunko@47: melunko@47: dnl David Schleef melunko@47: melunko@47: dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $ melunko@47: melunko@47: dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) melunko@47: dnl Tries to compile with the given CFLAGS. melunko@47: dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, melunko@47: dnl and ACTION-IF-NOT-ACCEPTED otherwise. melunko@47: melunko@47: AC_DEFUN([AS_COMPILER_FLAG], melunko@47: [ melunko@47: AC_MSG_CHECKING([to see if compiler understands $1]) melunko@47: melunko@47: save_CFLAGS="$CFLAGS" melunko@47: CFLAGS="$CFLAGS $1" melunko@47: melunko@47: AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) melunko@47: CFLAGS="$save_CFLAGS" melunko@47: melunko@47: if test "X$flag_ok" = Xyes ; then melunko@47: $2 melunko@47: true melunko@47: else melunko@47: $3 melunko@47: true melunko@47: fi melunko@47: AC_MSG_RESULT([$flag_ok]) melunko@47: ])