maemo-ui-old/m4/as-compiler-flag.m4
branchtrunk
changeset 790 7a914b3fafc1
parent 23 915ef81992c0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/maemo-ui-old/m4/as-compiler-flag.m4	Wed Aug 01 14:50:29 2007 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +dnl as-compiler-flag.m4 0.1.0
     1.5 +
     1.6 +dnl autostars m4 macro for detection of compiler flags
     1.7 +
     1.8 +dnl David Schleef <ds@schleef.org>
     1.9 +
    1.10 +dnl $Id: as-compiler-flag.m4,v 1.1.1.1 2005/08/26 00:42:44 andrunko Exp $
    1.11 +
    1.12 +dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
    1.13 +dnl Tries to compile with the given CFLAGS.
    1.14 +dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
    1.15 +dnl and ACTION-IF-NOT-ACCEPTED otherwise.
    1.16 +
    1.17 +AC_DEFUN([AS_COMPILER_FLAG],
    1.18 +[
    1.19 +  AC_MSG_CHECKING([to see if compiler understands $1])
    1.20 +
    1.21 +  save_CFLAGS="$CFLAGS"
    1.22 +  CFLAGS="$CFLAGS $1"
    1.23 +
    1.24 +  AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
    1.25 +  CFLAGS="$save_CFLAGS"
    1.26 +
    1.27 +  if test "X$flag_ok" = Xyes ; then
    1.28 +    $2
    1.29 +    true
    1.30 +  else
    1.31 +    $3
    1.32 +    true
    1.33 +  fi
    1.34 +  AC_MSG_RESULT([$flag_ok])
    1.35 +])
    1.36 +