X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=aclocal.m4;h=10cd4a7c654dd06d2cf2172b1b2e3b0a49b4cef2;hb=7bd8a0491055e7ca5709109400459556e870250a;hp=b5b5a2b20c50935910398c660b9bc9c5dfc2e7ec;hpb=45859a43c20254e40fa241d4ad4f507c0256faa2;p=ghc-hetmet.git diff --git a/aclocal.m4 b/aclocal.m4 index b5b5a2b..10cd4a7 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,56 +1,9 @@ -dnl $Id: aclocal.m4,v 1.110 2002/12/19 11:28:58 simonmar Exp $ -dnl dnl Extra autoconf macros for the Glasgow fptools dnl dnl To be a good autoconf citizen, names of local macros have dnl prefixed with FPTOOLS_ to ensure we don't clash dnl with any pre-supplied autoconf ones. -dnl -dnl Is timezone around? (in a header file) -dnl -AC_DEFUN(FPTOOLS_HAVE_TIMEZONE, -[AC_CACHE_CHECK([timezone], fptools_cv_have_timezone, -[AC_TRY_COMPILE([#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif -], [return timezone;], -fptools_cv_have_timezone=yes, fptools_cv_have_timezone=no)]) -if test "$fptools_cv_have_timezone" = yes; then - AC_DEFINE(HAVE_TIMEZONE) -fi -]) - -dnl -dnl Has timezone the type time_t or long (HP-UX 10.20 apparently -dnl has `long'..) -dnl -AC_DEFUN(FPTOOLS_TYPE_TIMEZONE, -[AC_CACHE_CHECK([type of timezone], fptools_cv_type_timezone, -[AC_TRY_COMPILE([#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -extern time_t timezone; -], -[int i;], fptools_cv_type_timezone=time_t, fptools_cv_type_timezone=long)]) -AC_DEFINE_UNQUOTED(TYPE_TIMEZONE, $fptools_cv_type_timezone) -]) - dnl *** Is altzone available? *** dnl AC_DEFUN(FPTOOLS_ALTZONE, @@ -106,6 +59,8 @@ dnl a leading underscore sometimes (eg. FreeBSD). We therefore have 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, @@ -119,6 +74,11 @@ dnl the underscoredness of that "platform" 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';; @@ -188,6 +148,28 @@ fi dnl +dnl Check for Greencard and version. +dnl +AC_DEFUN(FPTOOLS_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 | + grep 'version' | sed -e 's/greencard. version \([^ ]*\).*/\1/g'`" +else + fptools_cv_greencard_version="" +fi +changequote([, ])dnl +]) +FPTOOLS_PROG_CHECK_VERSION([$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) +]) + +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. @@ -243,6 +225,41 @@ dnl do without it for now. ]) 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") @@ -337,7 +354,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 @@ -417,10 +440,10 @@ AC_DEFUN(FPTOOLS_HAVE_GCC, fptools_cv_have_gcc='no' else changequote(, )dnl - is_gcc_v1="`$CC -v 2>&1 | grep 'version ' | sed -e 's/.*version [^0-9]*\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/expr 2000 \\\>= \1 \\\* 1000 + \2/g' `" + gcc_version_str="`$CC -v 2>&1 | grep 'version ' | sed -e 's/.*version [^0-9]*\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1\.\2/g' `" changequote([, ])dnl fptools_cv_have_gcc='yes' - if test `eval $is_gcc_v1 2>/dev/null` = "1"; then + FPTOOLS_PROG_CHECK_VERSION($gcc_version_str, -lt, "2.0", fptools_cv_have_gcc='no' echo "" echo "your gcc version appears to be ..." @@ -428,13 +451,31 @@ changequote([, ])dnl echo "gcc prior to 2.0 and have never worked with ghc." echo "we recommend 2.95.3, although versions back to 2.7.2 should be ok." AC_MSG_ERROR([gcc 1.X has never been supported]) - fi + ) fi ]) HaveGcc=`echo $fptools_cv_have_gcc | sed 'y/yesno/YESNO/'` AC_SUBST(HaveGcc) ]) +dnl +dnl Some OSs (Mandrake Linux, in particular) configure GCC with +dnl -momit-leaf-frame-pointer on by default. If this is the case, we +dnl need to turn it off for mangling to work. The test is currently a bit +dnl crude, using only the version number of gcc. +dnl +AC_DEFUN(FPTOOLS_GCC_NEEDS_NO_OMIT_LFPTR, +[AC_CACHE_CHECK([whether gcc needs -mno-omit-leaf-frame-pointer], fptools_cv_gcc_needs_no_omit_lfptr, +[ + fptools_cv_gcc_needs_no_omit_lfptr='no' + FPTOOLS_PROG_CHECK_VERSION($gcc_version_str, -ge, "3.2", + fptools_cv_gcc_needs_no_omit_lfptr='yes') +]) +if test "$fptools_cv_gcc_needs_no_omit_lfptr" = "yes"; then + AC_DEFINE(HAVE_GCC_MNO_OMIT_LFPTR) +fi +]) + dnl Small feature test for perl version. Assumes PerlCmd dnl contains path to perl binary dnl @@ -645,6 +686,14 @@ AC_CACHE_VAL(AC_CV_NAME, # include #endif +#ifdef HAVE_OPENGL_GL_H +# include +#endif + +#ifdef HAVE_SYS_RESOURCE_H +# include +#endif + typedef $1 testing; main() { @@ -745,11 +794,11 @@ AC_CACHE_VAL(fptools_cv_have_o_binary, [ AC_LANG_SAVE AC_LANG_C -AC_TRY_COMPILE(, +AC_TRY_COMPILE( [#ifdef HAVE_FCNTL_H #include -#endif -int x = O_BINARY;], +#endif], +[int x = O_BINARY;], fptools_cv_have_o_binary=yes, fptools_cv_have_o_binary=no) AC_LANG_RESTORE @@ -986,9 +1035,7 @@ 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 Note: Caching has been completely rewritten, but is still no perfect yet. dnl ###################################################################### dnl ########################### -*- Mode: M4 -*- ####################### @@ -1016,8 +1063,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 @@ -1061,12 +1108,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" @@ -1084,9 +1132,10 @@ dnl AC_ARG_ENABLE(Mesa, $with_Mesa_help_string, use_Mesa=$enableval, use_Mesa 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_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS $LIBM" +dnl and GL_X_LIBS/GLUT_X_LIBS. + GL_CFLAGS="$CPPFLAGS $X_CFLAGS" + 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" @@ -1097,25 +1146,36 @@ dnl and 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) 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) if test -n "$LIBS"; then - GL_LIBS="$LIBS" + GL_LIBS="$LDFLAGS $LIBS" else - GL_LIBS= + GL_LIBS="$LDFLAGS" GL_CFLAGS= fi + LIBS="$GLUT_X_LIBS" + + FPTOOLS_SEARCH_LIBS([#include ], 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" @@ -1141,7 +1201,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],