[project @ 2002-12-12 03:15:41 by mthomas]
[ghc-hetmet.git] / aclocal.m4
index a75df17..6fb47cb 100644 (file)
@@ -1,4 +1,4 @@
-dnl $Id: aclocal.m4,v 1.103 2002/05/31 21:12:28 sof Exp $
+dnl $Id: aclocal.m4,v 1.109 2002/12/11 16:37:16 simonmar Exp $
 dnl 
 dnl Extra autoconf macros for the Glasgow fptools
 dnl
@@ -189,7 +189,7 @@ fi
 
 dnl
 dnl Check for Happy and version.  If we're building GHC, then we need
-dnl at least Happy version 1.9.  If there's no installed Happy, we look
+dnl at least Happy version 1.13.  If there's no installed Happy, we look
 dnl for a happy source tree and point the build system at that instead.
 dnl
 AC_DEFUN(FPTOOLS_HAPPY,
@@ -215,14 +215,34 @@ fi;
 changequote([, ])dnl
 ])
 if test -d $srcdir/ghc -a ! -f $srcdir/ghc/compiler/parser/Parser.hs; then
-  FPTOOLS_PROG_CHECK_VERSION([$fptools_cv_happy_version],-lt,[1.9],
-  [AC_MSG_ERROR([Happy version 1.9 or later is required to compile GHC.])])dnl
+  FPTOOLS_PROG_CHECK_VERSION([$fptools_cv_happy_version],-lt,[1.13],
+  [AC_MSG_ERROR([Happy version 1.13 or later is required to compile GHC.])])dnl
 fi
 HappyVersion=$fptools_cv_happy_version;
 AC_SUBST(HappyVersion)
 ])
 
 dnl
+dnl Check for Haddock and version.  If there's no installed Haddock, we look
+dnl for a haddock source tree and point the build system at that instead.
+dnl
+AC_DEFUN(FPTOOLS_HADDOCK,
+[
+if test -d $srcdir/haddock; then
+   SrcTreeHaddockCmd=$hardtop/haddock/src/haddock-inplace
+fi
+if test x"$UseSrcTreeHaddock" = xYES; then
+  HaddockCmd=$SrcTreeHaddockCmd
+else
+  AC_PATH_PROG(HaddockCmd,haddock,$SrcTreeHaddockCmd)
+fi
+dnl Darn, I forgot to make Haddock print out its version number when
+dnl invoked with -v.  We could try generating some HTML and grepping
+dnl through that to find the version number, but I think we'll make
+dnl do without it for now.
+])
+
+dnl
 dnl What's the best way of doing context diffs?
 dnl
 dnl (NB: NeXTStep thinks diff'ing a file against itself is "trouble")
@@ -423,15 +443,19 @@ AC_DEFUN(FPTOOLS_CHECK_PERL_VERSION,
 if grep "version 5" conftest.out >/dev/null 2>&1; then
    :
 else
-  if grep "v5.6" conftest.out >/dev/null 2>&1; then
-     :
-  else
-     if grep "version 6" conftest.out >/dev/null 2>&1; then
-       :
-     else
-       echo "Your version of perl probably won't work."
-     fi
-  fi
+   if grep "v5.6" conftest.out >/dev/null 2>&1; then
+      :
+   else
+      if grep "v5.8" conftest.out >/dev/null 2>&1; then
+         :
+      else
+         if grep "version 6" conftest.out >/dev/null 2>&1; then
+            :
+         else
+            echo "Your version of perl probably won't work."
+         fi  
+      fi
+   fi
 fi
 rm -fr conftest*
 ])
@@ -737,130 +761,12 @@ AC_DEFINE(HAVE_O_BINARY)
 fi
 ])
 
-dnl *** Which one comes first, .text or .data? ***
-dnl 
-AC_DEFUN(FPTOOLS_CODE_BEFORE_DATA,
-[AC_CACHE_CHECK([if code section appears before data], fptools_cv_code_bef_data,
-[AC_TRY_RUN([
-int f() { return 1; }
-int i;
-int main() { return ((char*)&f > (char*)&i); }
-
-],
-fptools_cv_code_bef_data=yes, fptools_cv_code_bef_data=no,false)])
-if test "$fptools_cv_code_bef_data" = yes; then
-  AC_DEFINE(CODE_BEFORE_DATA)
-fi
-])
-
 dnl *** Helper function **
 dnl 
 AC_DEFUN(FPTOOLS_IN_SCOPE,
 [AC_TRY_LINK([extern char* $1;],[return (int)&$2], $3=yes, $3=no)
 ])
 
-dnl *** What's the end-of-text-section marker called? ***
-dnl
-AC_DEFUN([FPTOOLS_END_TEXT_SECTION],
-[AC_CACHE_CHECK([for end of text section marker],
-                [fptools_cv_end_of_text],
-               [fptools_cv_end_of_text=""
-                not_done=1
-                for i in data_start _data_start etext _etext __etext; do
-                  FPTOOLS_IN_SCOPE($i,$i,fptools_end_of_text)
-                  if test "$fptools_end_of_text" = yes; then
-                    fptools_cv_end_of_text=$i
-                    not_done=0
-                    break
-                  fi
-                done
-                if test "$not_done" = 1; then
-                  FPTOOLS_IN_SCOPE(etext asm("etext"),etext,fptools_end_of_text)
-                  if test "$fptools_end_of_text" = yes; then
-                    fptools_cv_end_of_text="etext"
-                  fi
-                fi])
-                if test -n "$fptools_cv_end_of_text"; then
-                  AC_DEFINE_UNQUOTED([TEXT_SECTION_END_MARKER], $fptools_cv_end_of_text)
-                else
-                  AC_DEFINE_UNQUOTED([TEXT_SECTION_END_MARKER], dunno_end_of_text)
-                fi
- AC_CACHE_CHECK([for end of text section marker declaration],
-               [fptools_cv_end_of_text_decl],
-               [fptools_cv_end_of_text_decl=""
-                not_done=1
-                for i in data_start _data_start etext _etext __etext; do
-                  FPTOOLS_IN_SCOPE($i,$i,fptools_end_of_text_decl)
-                  if test "$fptools_end_of_text_decl" = yes; then
-                    fptools_cv_end_of_text_decl=$i
-                    not_done=0
-                    break
-                  fi
-                done
-                if test "$not_done" = 1; then
-                  FPTOOLS_IN_SCOPE(etext asm("etext"),etext,fptools_end_of_text_decl)
-                  if test "$fptools_end_of_text_decl" = yes; then
-                    fptools_cv_end_of_text_decl="etext asm(\"etext\")"
-                  fi
-                fi])
-                if test -n "$fptools_cv_end_of_text_decl"; then
-                  AC_DEFINE_UNQUOTED([TEXT_SECTION_END_MARKER_DECL], $fptools_cv_end_of_text_decl)
-                else
-                  AC_DEFINE_UNQUOTED([TEXT_SECTION_END_MARKER_DECL], dunno_end_of_text_decl)
-                fi
-])                
-dnl *** What's the end-of-data-section marker called? ***
-dnl
-AC_DEFUN([FPTOOLS_END_DATA_SECTION],
-[AC_CACHE_CHECK([for end of data section marker],
-                [fptools_cv_end_of_data],
-               [fptools_cv_end_of_data=""
-                not_done=1
-                for i in end _end __end; do
-                  FPTOOLS_IN_SCOPE($i,$i,fptools_end_of_data)
-                  if test "$fptools_end_of_data" = yes; then
-                    fptools_cv_end_of_data=$i
-                    not_done=0
-                    break
-                  fi
-                done
-                if test "$not_done" = 1; then
-                  FPTOOLS_IN_SCOPE(end asm("end"),end,fptools_end_of_data)
-                  if test "$fptools_end_of_data" = yes; then
-                    fptools_cv_end_of_data="end"
-                  fi
-                fi])
-                if test -n "$fptools_cv_end_of_data"; then
-                  AC_DEFINE_UNQUOTED([DATA_SECTION_END_MARKER], $fptools_cv_end_of_data)
-                else
-                  AC_DEFINE_UNQUOTED([DATA_SECTION_END_MARKER], dunno_end_of_data)
-                fi
- AC_CACHE_CHECK([for end of data section marker declaration],
-               [fptools_cv_end_of_data_decl],
-               [fptools_cv_end_of_data_decl=""
-                not_done=1
-                for i in end _end __end; do
-                  FPTOOLS_IN_SCOPE($i,$i,fptools_end_of_data_decl)
-                  if test "$fptools_end_of_data_decl" = yes; then
-                    fptools_cv_end_of_data_decl=$i
-                    not_done=0
-                    break
-                  fi
-                done
-                if test "$not_done" = 1; then
-                  FPTOOLS_IN_SCOPE(end asm("end"),end,fptools_end_of_data_decl)
-                  if test "$fptools_end_of_data_decl" = yes; then
-                    fptools_cv_end_of_data_decl="end asm(\"end\")"
-                  fi
-                fi])
-                if test -n "$fptools_cv_end_of_data_decl"; then
-                  AC_DEFINE_UNQUOTED([DATA_SECTION_END_MARKER_DECL], $fptools_cv_end_of_data_decl)
-                else
-                  AC_DEFINE_UNQUOTED([DATA_SECTION_END_MARKER_DECL], dunno_end_of_data_decl)
-                fi
-])                
 
 dnl Based on AC_TRY_LINK - run iftrue if links cleanly with no warning
 
@@ -1177,7 +1083,7 @@ dnl    AC_ARG_ENABLE(Mesa, $with_Mesa_help_string, use_Mesa=$enableval, use_Mesa
   AC_LANG_C
 
 dnl If we are running under X11 then add in the appropriate libraries.
-  if ! test x"$no_x" = xyes; then
+  if test x"$no_x" != xyes; then
 dnl Add everything we need to compile and link X programs to GL_CFLAGS
 dnl and GL_X_LIBS.
     GL_CFLAGS="$X_CFLAGS"
@@ -1189,10 +1095,10 @@ dnl and GL_X_LIBS.
   GL_save_LIBS="$LIBS"
   LIBS="$GL_X_LIBS"
 
-  FPTOOLS_SEARCH_LIBS([#include <GL/gl.h>],   glEnd,           $GL_search_list,  have_GL=yes,   have_GL=no)
-  FPTOOLS_SEARCH_LIBS([#include <GL/glu.h>],  gluNewQuadric,   $GLU_search_list, have_GLU=yes,  have_GLU=no)
-  FPTOOLS_SEARCH_LIBS([#include <GL/glx.h>],  glXChooseVisual, $GLX_search_list, have_GLX=yes,  have_GLX=no)
-  FPTOOLS_SEARCH_LIBS([#include <GL/glut.h>], glutMainLoop,    glut glut32,      have_glut=yes, have_glut=no)
+  FPTOOLS_SEARCH_LIBS([#include <GL/gl.h>],   glEnd,         $GL_search_list,  have_GL=yes,   have_GL=no)
+  FPTOOLS_SEARCH_LIBS([#include <GL/glu.h>],  gluNewQuadric, $GLU_search_list, have_GLU=yes,  have_GLU=no)
+  FPTOOLS_SEARCH_LIBS([#include <GL/glx.h>],  glXWaitX,      $GLX_search_list, have_GLX=yes,  have_GLX=no)
+  FPTOOLS_SEARCH_LIBS([#include <GL/glut.h>], glutMainLoop,  glut glut32,      have_glut=yes, have_glut=no)
 
   if test -n "$LIBS"; then
     GL_LIBS="$LIBS"
@@ -1260,7 +1166,8 @@ dnl Check to see whether 'struct msghdr' contains msg_control
 dnl 
 AC_DEFUN(FPTOOLS_MSGHDR_MSG_CONTROL,
 [AC_CACHE_CHECK([for msg_control in struct msghdr], fptools_cv_struct_msghdr_msg_control,
-[AC_TRY_COMPILE([#include <sys/uio.h>
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/uio.h>
 #include <sys/socket.h>], [struct msghdr m; m.msg_control;],
 fptools_cv_struct_msghdr_msg_control=yes, fptools_cv_struct_msghdr_msg_control=no)])
 if test $fptools_cv_struct_msghdr_msg_control = yes; then
@@ -1274,7 +1181,8 @@ dnl Check to see whether 'struct msghdr' contains msg_accrights
 dnl 
 AC_DEFUN(FPTOOLS_MSGHDR_MSG_ACCRIGHTS,
 [AC_CACHE_CHECK([for msg_accrights in struct msghdr], fptools_cv_struct_msghdr_msg_accrights,
-[AC_TRY_COMPILE([#include <sys/uio.h>
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/uio.h>
 #include <sys/socket.h>], [struct msghdr m; m.msg_accrights;],
 fptools_cv_struct_msghdr_msg_accrights=yes, fptools_cv_struct_msghdr_msg_accrights=no)])
 if test $fptools_cv_struct_msghdr_msg_accrights = yes; then