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