libgnomevfs2-mythtv/m4/as-compiler-flag.m4
author rosfran
Thu Jan 11 17:36:33 2007 +0000 (2007-01-11)
branchtrunk
changeset 262 91a24122e3ae
child 621 1bf45de64bd5
permissions -rwxr-xr-x
[svn r263] Fixed bug inserted on gmyth_socket_try_connect, which throws a NULL pointer error.
melunko@38
     1
dnl as-compiler-flag.m4 0.1.0
melunko@38
     2
melunko@38
     3
dnl autostars m4 macro for detection of compiler flags
melunko@38
     4
melunko@38
     5
dnl David Schleef <ds@schleef.org>
melunko@38
     6
melunko@38
     7
dnl $Id: as-compiler-flag.m4,v 1.1.1.1 2005/08/26 00:42:44 andrunko Exp $
melunko@38
     8
melunko@38
     9
dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
melunko@38
    10
dnl Tries to compile with the given CFLAGS.
melunko@38
    11
dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
melunko@38
    12
dnl and ACTION-IF-NOT-ACCEPTED otherwise.
melunko@38
    13
melunko@38
    14
AC_DEFUN([AS_COMPILER_FLAG],
melunko@38
    15
[
melunko@38
    16
  AC_MSG_CHECKING([to see if compiler understands $1])
melunko@38
    17
melunko@38
    18
  save_CFLAGS="$CFLAGS"
melunko@38
    19
  CFLAGS="$CFLAGS $1"
melunko@38
    20
melunko@38
    21
  AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
melunko@38
    22
  CFLAGS="$save_CFLAGS"
melunko@38
    23
melunko@38
    24
  if test "X$flag_ok" = Xyes ; then
melunko@38
    25
    $2
melunko@38
    26
    true
melunko@38
    27
  else
melunko@38
    28
    $3
melunko@38
    29
    true
melunko@38
    30
  fi
melunko@38
    31
  AC_MSG_RESULT([$flag_ok])
melunko@38
    32
])
melunko@38
    33