gmyth-stream/client/m4/as-compiler-flag.m4
author melunko
Thu Apr 19 21:22:26 2007 +0100 (2007-04-19)
branchtrunk
changeset 576 6ee1dc7357e8
permissions -rwxr-xr-x
[svn r581] added GMYTH_USE_DEBUG test at gmyth_program_info_print() and gmyth_channel_info_print()
renatofilho@522
     1
dnl as-compiler-flag.m4 0.1.0
renatofilho@522
     2
renatofilho@522
     3
dnl autostars m4 macro for detection of compiler flags
renatofilho@522
     4
renatofilho@522
     5
dnl David Schleef <ds@schleef.org>
renatofilho@522
     6
renatofilho@522
     7
dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
renatofilho@522
     8
renatofilho@522
     9
dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
renatofilho@522
    10
dnl Tries to compile with the given CFLAGS.
renatofilho@522
    11
dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
renatofilho@522
    12
dnl and ACTION-IF-NOT-ACCEPTED otherwise.
renatofilho@522
    13
renatofilho@522
    14
AC_DEFUN([AS_COMPILER_FLAG],
renatofilho@522
    15
[
renatofilho@522
    16
  AC_MSG_CHECKING([to see if compiler understands $1])
renatofilho@522
    17
renatofilho@522
    18
  save_CFLAGS="$CFLAGS"
renatofilho@522
    19
  CFLAGS="$CFLAGS $1"
renatofilho@522
    20
renatofilho@522
    21
  AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
renatofilho@522
    22
  CFLAGS="$save_CFLAGS"
renatofilho@522
    23
renatofilho@522
    24
  if test "X$flag_ok" = Xyes ; then
renatofilho@522
    25
    $2
renatofilho@522
    26
    true
renatofilho@522
    27
  else
renatofilho@522
    28
    $3
renatofilho@522
    29
    true
renatofilho@522
    30
  fi
renatofilho@522
    31
  AC_MSG_RESULT([$flag_ok])
renatofilho@522
    32
])