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