[project @ 2001-06-30 00:12:52 by sof]
[ghc-hetmet.git] / aclocal.m4
index 9ae1145..bdef3bd 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: aclocal.m4,v 1.74 2001/06/25 05:25:31 sof Exp $
+dnl $Id: aclocal.m4,v 1.78 2001/06/30 00:12:52 sof Exp $
 dnl 
 dnl Extra autoconf macros for the Glasgow fptools
 dnl
@@ -1064,3 +1064,24 @@ then
   test -z "$LEX" && AC_MSG_ERROR(['lex' or 'flex' is required to compile GHC.])
 fi
 ])
+
+dnl
+dnl Check to see whether CC (gcc) supports a particular option.
+dnl 
+AC_DEFUN(FPTOOLS_CC_FLAG,
+[
+AC_CACHE_CHECK([whether $CC accepts $1], [ac_cv_cc_$2],
+[save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ AC_LANG_C
+ AC_TRY_COMPILE(,[int main(){return(0);}],
+                 [ac_cv_cc_$2=yes],
+                [ac_cv_cc_$2=no])
+ CFLAGS="$save_CFLAGS"
+])
+if test "$ac_cv_cc_$2"x = "yesx"; then
+  $2=$extra_flag;
+else
+  $2=$extra_flag;
+fi;
+])