author | leo_sobral |
Wed Sep 20 23:59:48 2006 +0100 (2006-09-20) | |
branch | trunk |
changeset 2 | bd3829c2e9c9 |
permissions | -rw-r--r-- |
leo_sobral@2 | 1 |
dnl as-compiler-flag.m4 0.1.0 |
leo_sobral@2 | 2 |
|
leo_sobral@2 | 3 |
dnl autostars m4 macro for detection of compiler flags |
leo_sobral@2 | 4 |
|
leo_sobral@2 | 5 |
dnl David Schleef <ds@schleef.org> |
leo_sobral@2 | 6 |
|
leo_sobral@2 | 7 |
dnl $Id: as-compiler-flag.m4,v 1.1.1.1 2005/08/26 00:42:44 andrunko Exp $ |
leo_sobral@2 | 8 |
|
leo_sobral@2 | 9 |
dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) |
leo_sobral@2 | 10 |
dnl Tries to compile with the given CFLAGS. |
leo_sobral@2 | 11 |
dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, |
leo_sobral@2 | 12 |
dnl and ACTION-IF-NOT-ACCEPTED otherwise. |
leo_sobral@2 | 13 |
|
leo_sobral@2 | 14 |
AC_DEFUN([AS_COMPILER_FLAG], |
leo_sobral@2 | 15 |
[ |
leo_sobral@2 | 16 |
AC_MSG_CHECKING([to see if compiler understands $1]) |
leo_sobral@2 | 17 |
|
leo_sobral@2 | 18 |
save_CFLAGS="$CFLAGS" |
leo_sobral@2 | 19 |
CFLAGS="$CFLAGS $1" |
leo_sobral@2 | 20 |
|
leo_sobral@2 | 21 |
AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) |
leo_sobral@2 | 22 |
CFLAGS="$save_CFLAGS" |
leo_sobral@2 | 23 |
|
leo_sobral@2 | 24 |
if test "X$flag_ok" = Xyes ; then |
leo_sobral@2 | 25 |
$2 |
leo_sobral@2 | 26 |
true |
leo_sobral@2 | 27 |
else |
leo_sobral@2 | 28 |
$3 |
leo_sobral@2 | 29 |
true |
leo_sobral@2 | 30 |
fi |
leo_sobral@2 | 31 |
AC_MSG_RESULT([$flag_ok]) |
leo_sobral@2 | 32 |
]) |
leo_sobral@2 | 33 |