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