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