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