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