[project @ 2003-10-22 16:25:42 by simonpj]
[ghc-hetmet.git] / aclocal.m4
index ea73a21..3b8c7f2 100644 (file)
@@ -269,15 +269,15 @@ AS_IF([test "$fp_num1" $2 "$fp_num2"], [$4], [$5])[]dnl
 
 
 dnl
-dnl Check for Greencard and version.
+dnl Check for GreenCard and version.
 dnl
 AC_DEFUN(FPTOOLS_GREENCARD,
 [
-AC_PATH_PROG(GreencardCmd,greencard)
+AC_PATH_PROG(GreenCardCmd,greencard)
 AC_CACHE_CHECK([for version of greencard], fptools_cv_greencard_version,
 changequote(, )dnl
-[if test x"$GreencardCmd" != x; then
-   fptools_cv_greencard_version="`$GreencardCmd --version |
+[if test x"$GreenCardCmd" != x; then
+   fptools_cv_greencard_version="`$GreenCardCmd --version |
                          grep 'version' | sed -e 's/greencard. version \([^ ]*\).*/\1/g'`"
 else
    fptools_cv_greencard_version=""
@@ -286,8 +286,8 @@ changequote([, ])dnl
 ])
 FP_COMPARE_VERSIONS([$fptools_cv_greencard_version],[-lt],[$1],
   [AC_MSG_ERROR([greencard version $1 or later is required (found '$fptools_cv_greencard_version')])])[]dnl
-GreencardVersion=$fptools_cv_greencard_version
-AC_SUBST(GreencardVersion)
+GreenCardVersion=$fptools_cv_greencard_version
+AC_SUBST(GreenCardVersion)
 ])
 
 dnl
@@ -372,10 +372,10 @@ else
 fi;
 changequote([, ])dnl
 ])
-dnl if test -d $srcdir/ghc -a ! -f $srcdir/ghc/compiler/parser/Lexer.hs; then
-dnl   FP_COMPARE_VERSIONS([$fptools_cv_alex_version],[-lt],[2.0],
-dnl   [AC_MSG_ERROR([Alex version 2.0 or later is required to compile GHC.])])[]dnl
-dnl fi
+if test -d $srcdir/ghc -a ! -f $srcdir/ghc/compiler/parser/Lexer.hs; then
+  FP_COMPARE_VERSIONS([$fptools_cv_alex_version],[-lt],[2.0],
+  [AC_MSG_ERROR([Alex version 2.0 or later is required to compile GHC.])])[]dnl
+fi
 AlexVersion=$fptools_cv_alex_version;
 AC_SUBST(AlexVersion)
 ])
@@ -657,10 +657,12 @@ dnl The name to #define.
 define(<<AC_TYPE_NAME>>, translit(htype_$1, [a-z *], [A-Z_P]))dnl
 dnl The cache variable name.
 define(<<AC_CV_NAME>>, translit(fptools_cv_htype_$1, [ *], [_p]))dnl
+define(<<AC_CV_NAME_supported>>, translit(fptools_cv_htype_sup_$1, [ *], [_p]))dnl
 changequote([, ])dnl
 AC_MSG_CHECKING(Haskell type for $1)
 AC_CACHE_VAL(AC_CV_NAME,
-[AC_TRY_RUN([#include <stdio.h>
+[AC_CV_NAME_supported=yes;
+AC_TRY_RUN([#include <stdio.h>
 #include <stddef.h>
 
 #ifdef HAVE_SYS_TYPES_H
@@ -727,16 +729,20 @@ main() {
   }
   fclose(f);
   exit(0);
-}], AC_CV_NAME=`cat conftestval`,
-ifelse([$2], , AC_CV_NAME=NotReallyAType,      AC_CV_NAME=$2),
-ifelse([$3], , AC_CV_NAME=NotReallyATypeCross, AC_CV_NAME=$3))]) dnl
-AC_MSG_RESULT($AC_CV_NAME)
-AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [Define to Haskell type for $1])
+}],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
+if test "$AC_CV_NAME_supported" = yes; then
+  AC_MSG_RESULT($AC_CV_NAME)
+  AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [Define to Haskell type for $1])
+else
+  AC_MSG_RESULT([not supported])
+fi
 undefine([AC_TYPE_NAME])dnl
 undefine([AC_CV_NAME])dnl
+undefine([AC_CV_NAME_supported])dnl
 ])
 
-
 dnl Based on AC_TRY_LINK - run iftrue if links cleanly with no warning
 
 dnl FPTOOLS_TRY_LINK_NOWARN(flags,main?,iftrue,iffalse)
@@ -1057,7 +1063,9 @@ dnl and GL_X_LIBS/GLUT_X_LIBS.
     GL_CFLAGS=
   fi
 
-  LIBS="$GLUT_X_LIBS"
+  dnl Keep the GL/GLU/GLX libs, but expand the rest to what GLUT needs.
+  dnl (Some systems, like OpenBSD, need the GL/GLU libs.)
+  LIBS=`echo "$LIBS" | sed "s@$GL_X_LIBS@$GLUT_X_LIBS@"`
 
   FPTOOLS_SEARCH_LIBS([#include <GL/glut.h>], glutMainLoop,  glut32 glut,      have_glut=yes, have_glut=no)