gst-gpac/m4/as-compiler-flag.m4
branchtrunk
changeset 931 e8e3219edf5f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gst-gpac/m4/as-compiler-flag.m4	Wed Feb 27 11:00:07 2008 +0000
     1.3 @@ -0,0 +1,32 @@
     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 2005/06/18 18:02:46 burgerman 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 +])