X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=aclocal.m4;h=86ec141f397ca46b52702daa68d029b48ed096d9;hb=a08aa16ae39b5fc2f4541e9fd33009a5288ba0ae;hp=647c077932579a4401302733a78c83ac8e6156b5;hpb=7a156bdfc2b3ba1b406f96a3a68abb0d076410b0;p=ghc-hetmet.git diff --git a/aclocal.m4 b/aclocal.m4 index 647c077..86ec141 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl $Id: aclocal.m4,v 1.111 2003/01/08 12:03:28 simonmar Exp $ +dnl $Id: aclocal.m4,v 1.116 2003/05/17 14:49:45 reid Exp $ dnl dnl Extra autoconf macros for the Glasgow fptools dnl @@ -188,6 +188,28 @@ fi dnl +dnl Check for Greencard and version. +dnl +AC_DEFUN(FPTOOLS_GREENCARD, +[ +AC_PATH_PROG(GreencardCmd,green-card) +AC_CACHE_CHECK([for version of green-card], fptools_cv_greencard_version, +changequote(, )dnl +[if test x"$GreencardCmd" != x; then + fptools_cv_greencard_version="`$GreencardCmd --version | + grep 'version' | sed -e 's/green-card. version \([^ ]*\).*/\1/g'`" +else + fptools_cv_greencard_version="" +fi +changequote([, ])dnl +]) +FPTOOLS_PROG_CHECK_VERSION([$fptools_cv_greencard_version],-lt,$1, + [AC_MSG_ERROR([green-card version $1 or later is required (found '$fptools_cv_greencard_version')])])dnl +GreencardVersion=$fptools_cv_greencard_version +AC_SUBST(GreencardVersion) +]) + +dnl dnl Check for Happy and version. If we're building GHC, then we need 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. @@ -337,7 +359,13 @@ if test -z "$ArCmdRaw"; then echo "You don't seem to have ar in your PATH...I have no idea how to make a library" exit 1; fi -if $ArCmdRaw clqsZ conftest.a >/dev/null 2>/dev/null; then +dnl GNU ar needs special treatment: it appears to have problems with +dnl object files with the same name if you use the 's' modifier, but +dnl simple 'ar q' works fine, and doesn't need a separate ranlib. +if $ArCmdRaw --version | grep 'GNU' >/dev/null 2>/dev/null; then + ArCmdArgs='q' + NeedRanLib='' +elif $ArCmdRaw clqsZ conftest.a >/dev/null 2>/dev/null; then ArCmdArgs="clqsZ" NeedRanLib='' elif $ArCmdRaw clqs conftest.a >/dev/null 2>/dev/null; then @@ -663,6 +691,10 @@ AC_CACHE_VAL(AC_CV_NAME, # include #endif +#ifdef HAVE_SYS_RESOURCE_H +# include +#endif + typedef $1 testing; main() { @@ -1004,9 +1036,9 @@ esac ]) dnl ###################################################################### -dnl NOTE: Because of portability issues between different autoconf -dnl versions the AC_HELP_STRING macro has been removed from FPTOOLS_HAVE_OPENGL. -dnl Furthermore, caching has been completely rewritten. +dnl Some notes about the heavily changed OpenGL test below: +dnl * Caching has been completely rewritten, but is still no perfect yet. +dnl * Version detection for GL and GLU has been added. dnl ###################################################################### dnl ########################### -*- Mode: M4 -*- ####################### @@ -1034,8 +1066,8 @@ dnl #################################################################### dnl @synopsis FPTOOLS_HAVE_OPENGL dnl dnl Search for OpenGL. We search first for Mesa (a GPL'ed version of -dnl OpenGL) before a vendor's version of OpenGL, unless we were -dnl specifically asked not to with `--with-Mesa=no' or `--without-Mesa'. +dnl OpenGL) before a vendor's version of OpenGL if we were specifically +dnl asked to with `--with-Mesa=yes' or `--with-Mesa'. dnl dnl The four "standard" OpenGL libraries are searched for: "-lGL", dnl "-lGLU", "-lGLX" (or "-lMesaGL", "-lMesaGLU" as the case may be) and @@ -1079,12 +1111,13 @@ AC_DEFUN(FPTOOLS_HAVE_OPENGL, AC_REQUIRE([AC_PATH_XTRA]) AC_REQUIRE([FPTOOLS_CHECK_LIBM]) -dnl Check for Mesa first, unless we were asked not to. -dnl AC_HELP_STRING([--with-Mesa], -dnl [Prefer the Mesa library over a vendors native OpenGL library (default=yes)], -dnl with_Mesa_help_string) -dnl AC_ARG_ENABLE(Mesa, $with_Mesa_help_string, use_Mesa=$enableval, use_Mesa=yes) - AC_ARG_ENABLE(Mesa, [ --with-Mesa Prefer the Mesa library over a vendors native OpenGL library (default=no)], use_Mesa=$enableval, use_Mesa=no) +dnl Check for Mesa first if we were asked to. + AC_ARG_ENABLE(Mesa, +[ --enable-mesa + Prefer Mesa over a vendor's native OpenGL library (default=no) +], + use_Mesa=$enableval, + use_Mesa=no) if test x"$use_Mesa" = xyes; then GL_search_list="MesaGL GL opengl32" @@ -1103,7 +1136,7 @@ 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. - GL_CFLAGS="$X_CFLAGS" + GL_CFLAGS="$CPPFLAGS $X_CFLAGS" GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS $LIBM" fi GL_save_CPPFLAGS="$CPPFLAGS" @@ -1112,15 +1145,131 @@ dnl and GL_X_LIBS. GL_save_LIBS="$LIBS" LIBS="$GL_X_LIBS" - FPTOOLS_SEARCH_LIBS([#include ], glEnd, $GL_search_list, have_GL=yes, have_GL=no) - FPTOOLS_SEARCH_LIBS([#include ], gluNewQuadric, $GLU_search_list, have_GLU=yes, have_GLU=no) + dnl Including instead of plain avoids problems on + dnl platforms like WinDoze where special headers like or + dnl some macro trickery would be needed + FPTOOLS_SEARCH_LIBS([#include ], glEnd, $GL_search_list, have_GL=yes, have_GL=no) + + dnl TODO: The tests for GL features should better be cascaded and the + dnl results should be cached. A new macro would be helpful here. + + AC_MSG_CHECKING(glTexSubImage1D) + AC_TRY_LINK([#include ], + [glTexSubImage1D(GL_TEXTURE_1D,0,0,2,GL_INTENSITY,GL_BYTE,(void*)0)], + fptools_gl_texsubimage1d=yes, + fptools_gl_texsubimage1d=no); + AC_MSG_RESULT($fptools_gl_texsubimage1d) + + AC_MSG_CHECKING(glDrawRangeElements) + AC_TRY_LINK([#include ], + [glDrawRangeElements(GL_QUADS,0,0,0,GL_UNSIGNED_BYTE,(void*)0)], + fptools_gl_drawrangeelements=yes, + fptools_gl_drawrangeelements=no); + AC_MSG_RESULT($fptools_gl_drawrangeelements) + + AC_MSG_CHECKING(glActiveTexture) + AC_TRY_LINK([#include ], + [glActiveTexture(GL_TEXTURE1)], + fptools_gl_activetexture=yes, + fptools_gl_activetexture=no); + AC_MSG_RESULT($fptools_gl_activetexture) + + AC_MSG_CHECKING(glMultiDrawArrays) + AC_TRY_LINK([#include ], + [glMultiDrawArrays(GL_TRIANGLES, (GLint*)0, (GLsizei*)0, 0)], + fptools_gl_multidrawarrays=yes, + fptools_gl_multidrawarrays=no); + AC_MSG_RESULT($fptools_gl_multidrawarrays) + + if test x"$fptools_gl_texsubimage1d" != xyes; then + fptools_gl_version=1.0 + else + if test x"$fptools_gl_drawrangeelements" != xyes; then + fptools_gl_version=1.1 + else + if test x"$fptools_gl_activetexture" != xyes; then + fptools_gl_version=1.2 + else + if test x"$fptools_gl_multidrawarrays" != xyes; then + fptools_gl_version=1.3 + else + fptools_gl_version=1.4 + fi + fi + fi + fi + echo "It looks like GL version ${fptools_gl_version}" + + dnl TODO: Cache the results of the tests for the imaging subset. + + AC_MSG_CHECKING(EXT_blend_color) + AC_TRY_LINK([#include ], + [glBlendColorEXT((GLclampf)0.0,(GLclampf)0.0,(GLclampf)0.0,(GLclampf)0.0)], + hopengl_EXT_blend_color=yes, + hopengl_EXT_blend_color=no); + AC_MSG_RESULT($hopengl_EXT_blend_color) + + AC_MSG_CHECKING(EXT_blend_minmax) + AC_TRY_LINK([#include ], + [glBlendEquationEXT(GL_FUNC_ADD_EXT)], + hopengl_EXT_blend_minmax=yes, + hopengl_EXT_blend_minmax=no); + AC_MSG_RESULT($hopengl_EXT_blend_minmax) + + AC_MSG_CHECKING(EXT_blend_subtract) + AC_TRY_LINK([#include ], + [glBlendEquationEXT(GL_FUNC_SUBTRACT_EXT)], + hopengl_EXT_blend_subtract=yes, + hopengl_EXT_blend_subtract=no); + AC_MSG_RESULT($hopengl_EXT_blend_subtract) + + FPTOOLS_SEARCH_LIBS([#include ], gluNewQuadric, $GLU_search_list, have_GLU=yes, have_GLU=no) + + dnl TODO: Cascade and cache... + + AC_MSG_CHECKING(gluGetString) + AC_TRY_LINK([#include ], + [gluGetString(GLU_EXTENSIONS)], + fptools_glu_getstring=yes, + fptools_glu_getstring=no); + AC_MSG_RESULT($fptools_glu_getstring) + + AC_MSG_CHECKING(gluTessEndPolygon) + AC_TRY_LINK([#include ], + [gluTessEndPolygon((GLUtesselator*)0)], + fptools_glu_tessendpolygon=yes, + fptools_glu_tessendpolygon=no); + AC_MSG_RESULT($fptools_glu_tessendpolygon) + + AC_MSG_CHECKING(gluUnProject4) + AC_TRY_LINK([#include ], + [gluUnProject4(0.0,0.0,0.0,0.0,(GLdouble*)0,(GLdouble*)0,(GLint*)0,0.0,0.0,(GLdouble*)0,(GLdouble*)0,(GLdouble*)0,(GLdouble*)0)], + fptools_glu_unproject4=yes, + fptools_glu_unproject4=no); + AC_MSG_RESULT($fptools_glu_unproject4) + + if test x"$fptools_glu_getstring" != xyes; then + fptools_glu_version=1.0 + else + if test x"$fptools_glu_tessendpolygon" != xyes; then + fptools_glu_version=1.1 + else + if test x"$fptools_glu_unproject4" != xyes; then + fptools_glu_version=1.2 + else + fptools_glu_version=1.3 + fi + fi + fi + echo "It looks like GLU version ${fptools_glu_version}" + FPTOOLS_SEARCH_LIBS([#include ], glXWaitX, $GLX_search_list, have_GLX=yes, have_GLX=no) - FPTOOLS_SEARCH_LIBS([#include ], glutMainLoop, glut glut32, have_glut=yes, have_glut=no) + FPTOOLS_SEARCH_LIBS([#include ], glutMainLoop, glut32 glut, have_glut=yes, have_glut=no) if test -n "$LIBS"; then - GL_LIBS="$LIBS" + GL_LIBS="$LDFLAGS $LIBS" else - GL_LIBS= + GL_LIBS="$LDFLAGS" GL_CFLAGS= fi @@ -1159,7 +1308,7 @@ fi dnl dnl Check to see whether CC (gcc) supports a particular option. -dnl +dnl AC_DEFUN(FPTOOLS_CC_FLAG, [ AC_CACHE_CHECK([whether $CC accepts $1], [ac_cv_cc_$2],