[project @ 2004-10-11 14:25:44 by simonmar]
[ghc-hetmet.git] / aclocal.m4
index d5a6cd8..d660017 100644 (file)
@@ -199,7 +199,7 @@ case $HostPlatform in
 alpha-dec-osf*) fptools_cv_leading_underscore=no;;
 *cygwin32) fptools_cv_leading_underscore=yes;;
 *mingw32) fptools_cv_leading_underscore=yes;;
-*) AC_TRY_RUN([#ifdef HAVE_NLIST_H
+*) AC_RUN_IFELSE([AC_LANG_SOURCE([[#ifdef HAVE_NLIST_H
 #include <nlist.h>
 struct nlist xYzzY1[] = {{"xYzzY1", 0},{0}};
 struct nlist xYzzY2[] = {{"_xYzzY2", 0},{0}};
@@ -216,7 +216,7 @@ char **argv;
         exit(0);
 #endif
     exit(1);
-}], [fptools_cv_leading_underscore=yes], [fptools_cv_leading_underscore=no], [fptools_cv_leading_underscore=no])
+}]])],[fptools_cv_leading_underscore=yes],[fptools_cv_leading_underscore=no],[fptools_cv_leading_underscore=no])
 ;;
 esac]);
 AC_SUBST([LeadingUnderscore], [`echo $fptools_cv_leading_underscore | sed 'y/yesno/YESNO/'`])
@@ -655,7 +655,7 @@ dnl
 AC_DEFUN(FPTOOLS_GHC_VERSION,
 [FPTOOLS_NOCACHE_CHECK([version of ghc], [fptools_version_of_ghc],
 ["${WithGhc-ghc}" --version > conftestghc 2>&1
-  cat conftestghc >&AC_FD_CC
+  cat conftestghc >&AS_MESSAGE_LOG_FD
 #Useless Use Of cat award...
   fptools_version_of_ghc=`cat conftestghc | sed -n -e 's/, patchlevel *\([[0-9]]\)/.\1/;s/.* version \([[0-9]][[0-9.]]*\).*/\1/p'`
   rm -fr conftest*
@@ -694,6 +694,19 @@ ifelse($#, [1], [dnl
 ])dnl
 
 
+AC_DEFUN(FPTOOLS_GHC_HAS_READLINE,
+[AC_CACHE_CHECK([whether ghc has readline package], [fptools_ghc_has_readline],
+[if "${GhcPkgCmd-ghc-pkg}" --show-package readline >/dev/null 2>&1; then
+    fptools_ghc_has_readline='yes';
+    GhcHasReadline='YES';
+ else
+    fptools_ghc_has_readline='no';
+    GhcHasReadline='NO';
+ fi
+ AC_SUBST(GhcHasReadline)
+])
+])
+
 dnl ** Map an arithmetic C type to a Haskell type.
 dnl    Based on autconf's AC_CHECK_SIZEOF.
 
@@ -711,7 +724,7 @@ AC_CACHE_VAL(AC_CV_NAME,
 [AC_CV_NAME_supported=yes
 fp_check_htype_save_cppflags="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-AC_TRY_RUN([#include <stdio.h>
+AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
 #include <stddef.h>
 
 #if HAVE_SYS_TYPES_H
@@ -782,9 +795,9 @@ main() {
   }
   fclose(f);
   exit(0);
-}],AC_CV_NAME=`cat conftestval`,
-ifelse([$2], , [AC_CV_NAME=NotReallyAType; AC_CV_NAME_supported=no], AC_CV_NAME=$2),
-ifelse([$3], , [AC_CV_NAME=NotReallyATypeCross; AC_CV_NAME_supported=no], AC_CV_NAME=$3))]) dnl
+}]])],[AC_CV_NAME=`cat conftestval`],
+[ifelse([$2], , [AC_CV_NAME=NotReallyAType; AC_CV_NAME_supported=no], [AC_CV_NAME=$2])],
+[ifelse([$3], , [AC_CV_NAME=NotReallyATypeCross; AC_CV_NAME_supported=no], [AC_CV_NAME=$3])])]) dnl
 CPPFLAGS="$fp_check_htype_save_cppflags"
 if test "$AC_CV_NAME_supported" = yes; then
   AC_MSG_RESULT($AC_CV_NAME)
@@ -1076,7 +1089,7 @@ AC_DEFUN([FP_CHECK_GL_HELPER],
       fp_try_lib=`echo $fp_try_lib | sed -e 's/^-l//' -e 's/$/.lib/'`
     fi
     LIBS="$fp_try_lib ${$1_LIBS} $fp_save_LIBS"
-    AC_TRY_LINK([$3], [$4], [fp_cv_check_$1_lib="$fp_try_lib ${$1_LIBS}"; break])
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([$3], [$4])], [fp_cv_check_$1_lib="$fp_try_lib ${$1_LIBS}"; break])
   done
   LIBS="$fp_save_LIBS"
   CPPFLAGS="$fp_save_CPPFLAGS"])
@@ -1098,7 +1111,7 @@ AC_DEFUN([FP_CHECK_GL_HELPER],
 # -----------
 AC_DEFUN([FP_CHECK_GL],
 [AC_REQUIRE([FP_PATH_X])
-AC_REQUIRE([AC_CANONICAL_SYSTEM])
+AC_REQUIRE([AC_CANONICAL_TARGET])
 
 AC_ARG_ENABLE([hopengl],
   [AC_HELP_STRING([--enable-hopengl],
@@ -1138,7 +1151,7 @@ else
         *-lopengl32*|*opengl32.lib*) ;;
         *) fp_save_LIBS="$LIBS"
            LIBS="$LIBS -lopengl32"
-           AC_TRY_LINK([@%:@include <GL/gl.h>], [glEnd()],
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <GL/gl.h>]], [[glEnd()]])],
              [GL_LIBS="$GL_LIBS -lopengl32"; GL_LIBS0="$GL_LIBS0 -lopengl32"])
            LIBS="$fp_save_LIBS"
            ;;
@@ -1209,20 +1222,19 @@ AC_SUBST([GLUT_LIBS])
 ])# FP_CHECK_GLUT
 
 
-dnl @synopsis FP_EMPTY_STRUCTS
-dnl 
-dnl Check whether empty structs is accepted by CC.
+# FP_EMPTY_STRUCTS
+# ---------------- 
+# Define output variable SUPPORTS_EMPTY_STRUCTS if empty structs are accepted by
+# CC.
 dnl
 AC_DEFUN(FP_EMPTY_STRUCTS,
-[AC_CACHE_CHECK(empty struct support, fptools_cv_empty_structs,
-[AC_TRY_COMPILE([
-typedef struct { /*empty*/ } StgFoo;
-],
-[int i;], 
-fptools_cv_empty_structs=yes,
-fptools_cv_empty_structs=no)])
-if test "$fptools_cv_empty_structs" = yes; then
-AC_DEFINE([SUPPORTS_EMPTY_STRUCTS], [1], [Define to 1 if C compiler supports declaration of empty structure types.])
+[AC_CACHE_CHECK(empty struct support, fp_cv_empty_structs,
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[typedef struct { /* empty */ } StgFoo;]],
+[[int i;]])],
+[fp_cv_empty_structs=yes],
+[fp_cv_empty_structs=no])])
+if test x"$fp_cv_empty_structs" = xyes; then
+  AC_DEFINE([SUPPORTS_EMPTY_STRUCTS], [1], [Define to 1 if C compiler supports declaration of empty structure types.])
 fi
 ])