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