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