-dnl $Id: aclocal.m4,v 1.119 2003/06/05 14:05:36 reid Exp $
+dnl $Id: aclocal.m4,v 1.125 2003/08/18 09:23:09 dons Exp $
dnl
dnl Extra autoconf macros for the Glasgow fptools
dnl
dnl to work around this by checking for *no* leading underscore first.
dnl Sigh. --SDM
dnl
+dnl Similarly on OpenBSD, but this test doesn't help. -- dons
+dnl
AC_DEFUN(FPTOOLS_UNDERSCORE,
[AC_CHECK_LIB(elf, nlist, LIBS="-lelf $LIBS")dnl
AC_CACHE_CHECK([leading underscore in symbol names], fptools_cv_lead_uscore,
changequote(<<, >>)dnl
<<
case $HostPlatform in
+*openbsd*) # x86 openbsd is ELF from 3.4 >, meaning no leading uscore
+ case $build in
+ i386-*2\.[[0-9]] | i386-*3\.[[0-3]] ) fptools_cv_lead_uscore='yes' ;;
+ *) fptools_cv_lead_uscore='no' ;;
+ esac ;;
alpha-dec-osf*) fptools_cv_lead_uscore='no';;
*cygwin32) fptools_cv_lead_uscore='yes';;
*mingw32) fptools_cv_lead_uscore='yes';;
])
dnl
+dnl Check for Alex and version. If we're building GHC, then we need
+dnl at least Alex version 2.0. If there's no installed Alex, we look
+dnl for a alex source tree and point the build system at that instead.
+dnl
+AC_DEFUN(FPTOOLS_ALEX,
+[
+if test -d $srcdir/alex; then
+ SrcTreeAlexCmd=$hardtop/alex/src/alex-inplace
+fi
+if test x"$UseSrcTreeAlex" = xYES; then
+ AlexCmd=$SrcTreeAlexCmd
+else
+ AC_PATH_PROG(AlexCmd,alex,$SrcTreeAlexCmd)
+fi
+AC_CACHE_CHECK([for version of alex], fptools_cv_alex_version,
+changequote(, )dnl
+[if test x"$AlexCmd" = x"$SrcTreeAlexCmd"; then
+ fptools_cv_alex_version=`grep '^ProjectVersion[ ]*=' $srcdir/alex/mk/version.mk | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`;
+elif test x"$AlexCmd" != x; then
+ fptools_cv_alex_version="`$AlexCmd -v |
+ grep 'Alex [Vv]ersion' | sed -e 's/Alex [Vv]ersion \([0-9\.]*\).*/\1/g'`" ;
+else
+ fptools_cv_alex_version="";
+fi;
+changequote([, ])dnl
+])
+dnl if test -d $srcdir/ghc -a ! -f $srcdir/ghc/compiler/parser/Lexer.hs; then
+dnl FPTOOLS_PROG_CHECK_VERSION([$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
+AlexVersion=$fptools_cv_alex_version;
+AC_SUBST(AlexVersion)
+])
+
+dnl
dnl What's the best way of doing context diffs?
dnl
dnl (NB: NeXTStep thinks diff'ing a file against itself is "trouble")
# include <GL/gl.h>
#endif
+#ifdef HAVE_OPENGL_GL_H
+# include <OpenGL/gl.h>
+#endif
+
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
dnl If we are running under X11 then add in the appropriate libraries.
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.
+dnl and GL_X_LIBS/GLUT_X_LIBS.
GL_CFLAGS="$CPPFLAGS $X_CFLAGS"
- GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS $LIBM"
+ GL_X_LIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBM"
+ GLUT_X_LIBS="$X_LIBS $X_PRE_LIBS -lXmu -lXt -lXi -lXext -lX11 $X_EXTRA_LIBS $LIBM"
fi
GL_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$GL_CFLAGS"
GL_save_LIBS="$LIBS"
LIBS="$GL_X_LIBS"
- dnl Including <GL/glut.h> instead of plain <GL/gl.h> avoids problems on
- dnl platforms like WinDoze where special headers like <windows.h> or
- dnl some macro trickery would be needed
- FPTOOLS_SEARCH_LIBS([#include <GL/glut.h>], glEnd, $GL_search_list, have_GL=yes, have_GL=no)
- FPTOOLS_SEARCH_LIBS([#include <GL/glut.h>], gluNewQuadric, $GLU_search_list, have_GLU=yes, have_GLU=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, glut32 glut, have_glut=yes, have_glut=no)
if test -n "$LIBS"; then
GL_LIBS="$LDFLAGS $LIBS"
GL_CFLAGS=
fi
+ LIBS="$GLUT_X_LIBS"
+
+ FPTOOLS_SEARCH_LIBS([#include <GL/glut.h>], glutMainLoop, glut32 glut, have_glut=yes, have_glut=no)
+
+ if test -n "$LIBS"; then
+ GLUT_LIBS="$LDFLAGS $LIBS"
+ fi
+
AC_CACHE_CHECK([OpenGL flags], mdl_cv_gl_cflags, [mdl_cv_gl_cflags="$GL_CFLAGS"])
GL_CFLAGS="$mdl_cv_gl_cflags"
AC_SUBST(GL_CFLAGS)
AC_CACHE_CHECK([OpenGL libs], mdl_cv_gl_libs, [mdl_cv_gl_libs="$GL_LIBS"])
GL_LIBS="$mdl_cv_gl_libs"
AC_SUBST(GL_LIBS)
+ AC_CACHE_CHECK([GLUT libs], mdl_cv_glut_libs, [mdl_cv_glut_libs="$GLUT_LIBS"])
+ GLUT_LIBS="$mdl_cv_glut_libs"
+ AC_SUBST(GLUT_LIBS)
-dnl Reset GL_X_LIBS regardless, since it was just a temporary variable
+dnl Reset GL_X_LIBS/GLUT_X_LIBS regardless, since they were just temporary variables
dnl and we don't want to be global namespace polluters.
GL_X_LIBS=
+ GLUT_X_LIBS=
LIBS="$GL_save_LIBS"
CPPFLAGS="$GL_save_CPPFLAGS"