X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=aclocal.m4;h=c0338fbd93011bbbb31c653856d20edae227609d;hb=aca2e347e7904c3e2ef1dac083420ff2f0aeea38;hp=e2c46f782b41e102b93658446f536bf045e357c4;hpb=53386c359c55bd6eaa13c35fe174c9274ff5888e;p=ghc-hetmet.git diff --git a/aclocal.m4 b/aclocal.m4 index e2c46f7..c0338fb 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -171,72 +171,56 @@ done ])# FP_CHECK_CONSTS -dnl ** check for leading underscores in symbol names -dnl -dnl Test for determining whether symbol names have a leading -dnl underscore. -dnl -dnl We assume that they _haven't_ if anything goes wrong. -dnl -dnl Some nlist implementations seem to try to be compatible by ignoring -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, - -dnl -dnl Hack!: nlist() under Digital UNIX insist on there being an _, -dnl but symbol table listings shows none. What is going on here?!? -dnl -dnl Another hack: cygwin doesn't come with nlist.h , so we hardwire -dnl the underscoredness of that "platform" -changequote(<<, >>)dnl -<< +# FP_LEADING_UNDERSCORE +# --------------------- +# Test for determining whether symbol names have a leading underscore. We assume +# that they _haven't_ if anything goes wrong. Sets the output variable +# LeadingUnderscore to YES or NO and defines LEADING_UNDERSCORE correspondingly. +# +# Some nlist implementations seem to try to be compatible by ignoring a leading +# underscore sometimes (eg. FreeBSD). We therefore have to work around this by +# checking for *no* leading underscore first. Sigh. --SDM +# +# Similarly on OpenBSD, but this test doesn't help. -- dons +AC_DEFUN([FP_LEADING_UNDERSCORE], +[AC_CHECK_LIB([elf], [nlist], [LIBS="-lelf $LIBS"]) +AC_CACHE_CHECK([leading underscore in symbol names], [fptools_cv_leading_underscore], [ +# Hack!: nlist() under Digital UNIX insist on there being an _, +# but symbol table listings shows none. What is going on here?!? +# +# Another hack: cygwin doesn't come with nlist.h , so we hardwire +# the underscoredness of that "platform" 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';; -*) >> -changequote([, ])dnl -AC_TRY_RUN([#ifdef HAVE_NLIST_H + case $build in + i386-*2\.@<:@0-9@:>@ | i386-*3\.@<:@0-3@:>@ ) fptools_cv_leading_underscore=yes ;; + *) fptools_cv_leading_underscore=no ;; + esac ;; +alpha-dec-osf*) fptools_cv_leading_underscore=no;; +*cygwin32) fptools_cv_leading_underscore=yes;; +*mingw32) fptools_cv_leading_underscore=yes;; +*) AC_TRY_RUN([#ifdef HAVE_NLIST_H #include -changequote(<<, >>)dnl -<< struct nlist xYzzY1[] = {{"xYzzY1", 0},{0}}; struct nlist xYzzY2[] = {{"_xYzzY2", 0},{0}}; #endif -main(argc, argv) -int argc; -char **argv; +int main() { #ifdef HAVE_NLIST_H if(nlist(argv[0], xYzzY1) == 0 && xYzzY1[0].n_value != 0) exit(1); if(nlist(argv[0], xYzzY2) == 0 && xYzzY2[0].n_value != 0) - exit(0);>> -changequote([, ])dnl + exit(0); #endif exit(1); -}], fptools_cv_lead_uscore=yes, fptools_cv_lead_uscore=no, fptools_cv_lead_uscore=NO) +}], [fptools_cv_leading_underscore=yes], [fptools_cv_leading_underscore=no], [fptools_cv_leading_underscore=no]) ;; -esac); -LeadingUnderscore=`echo $fptools_cv_lead_uscore | sed 'y/yesno/YESNO/'` -AC_SUBST(LeadingUnderscore) -case $LeadingUnderscore in -YES) AC_DEFINE([LEADING_UNDERSCORE], [1], [Define to 1 if C symbols have a leading underscore added by the compiler.]);; -esac -]) +esac]); +AC_SUBST([LeadingUnderscore], [`echo $fptools_cv_leading_underscore | sed 'y/yesno/YESNO/'`]) +if test x"$fptools_cv_leading_underscore" = xyes; then + AC_DEFINE([LEADING_UNDERSCORE], [1], [Define to 1 if C symbols have a leading underscore added by the compiler.]) +fi])# FP_LEADING_UNDERSCORE # FP_COMPARE_VERSIONS(VERSION1, TEST, VERSION2, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) @@ -431,7 +415,7 @@ esac AC_DEFUN([FP_PROG_AR_IS_GNU], [AC_REQUIRE([FP_PROG_AR]) AC_CACHE_CHECK([whether $fp_prog_ar_raw is GNU ar], [fp_cv_prog_ar_is_gnu], -[if $fp_prog_ar_raw --version | grep "GNU" > /dev/null 2> /dev/null; then +[if $fp_prog_ar_raw --version 2> /dev/null | grep "GNU" > /dev/null 2>&1; then fp_cv_prog_ar_is_gnu=yes else fp_cv_prog_ar_is_gnu=no @@ -954,53 +938,24 @@ fi ])# FP_PROG_FO_PROCESSOR -dnl ** Check which CATALOG file we have to use with DocBook SGML. -dnl -dnl FPTOOLS_DOCBOOK_CATALOG(VARIABLE, JADE, STYLESHEET, CATALOGS-TO-CHECK-FOR) -dnl -dnl If any of the catalogs given in CATALOGS-TO-CHECK-FOR works on this -dnl platform, let VARIABLE refer to this catalog; otherwise, VARIABLE -dnl is set to "no". JADE is the jade executable and STYLESHEET -dnl a DocBook style sheet. -dnl -AC_DEFUN(FPTOOLS_DOCBOOK_CATALOG, -[AC_CACHE_CHECK([for DocBook CATALOG], fptools_cv_sgml_catalog, -[ -cat > conftest.sgml << EOF - -
- -Test -Test -
Test
-Test -
-Test - -Test. - - -
-EOF -fptools_cv_sgml_catalog=no -if test -z "$SGML_CATALOG_FILES" ; then - for fptools_catalog in $4; do - ac_try="$2 -t rtf -d $3#print -c $fptools_catalog conftest.sgml" - if AC_TRY_EVAL(ac_try); then - fptools_cv_sgml_catalog=[$]fptools_catalog - break - fi - done +# FP_PROG_GHC_PKG +# ---------------- +# Try to find a ghc-pkg matching the ghc mentioned in the environment variable +# WithGhc. If the latter is unset or no matching ghc-pkg can be found, try to +# find a plain ghc-pkg. Sets the output variable GhcPkgCmd. +AC_DEFUN([FP_PROG_GHC_PKG], +[AC_CACHE_CHECK([for ghc-pkg matching $WithGhc], fp_cv_matching_ghc_pkg, +[fp_ghc_pkg_guess=`echo $WithGhc | sed 's,ghc\(@<:@^/\\@:>@*\)$,ghc-pkg\1,'` +if "$fp_ghc_pkg_guess" -l > /dev/null 2>&1; then + fp_cv_matching_ghc_pkg=$fp_ghc_pkg_guess else -# If the env var SGML_CATALOG_FILES is defined, assume things are cool. - fptools_cv_sgml_catalog="yes" -fi -]) -rm -rf conftest* -if test $fptools_cv_sgml_catalog != "no"; then - $1=$fptools_cv_sgml_catalog -fi -]) + fp_cv_matching_ghc_pkg=no +fi]) +if test x"$fp_cv_matching_ghc_pkg" = xno; then + AC_PATH_PROG([GhcPkgCmd], [ghc-pkg]) +else + GhcPkgCmd=$fp_cv_matching_ghc_pkg +fi])# FP_PROG_GHC_PKG # FP_CHECK_WIN32 @@ -1217,4 +1172,101 @@ AC_DEFINE([SUPPORTS_EMPTY_STRUCTS], [1], [Define to 1 if C compiler supports dec fi ]) + +dnl @synopsis FP_READDIR_EOF_ERRNO +dnl +dnl Check what readdir() sets 'errno' to upon reaching +dnl end of directory; not setting it is the correct thing to do, +dnl but mingw based versions have set it to ENOENT until recently +dnl (summer 2004). +dnl +dnl +AC_DEFUN(FP_READDIR_EOF_ERRNO, +[AC_CACHE_CHECK([what readdir sets errno to upon EOF], fptools_cv_readdir_eof_errno, +[AC_TRY_RUN([#include +#include +#include +int +main(argc, argv) +int argc; +char **argv; +{ + FILE *f=fopen("conftestval", "w"); +#if defined(__MINGW32__) + int fd = mkdir("testdir"); +#else + int fd = mkdir("testdir", 0666); +#endif + DIR* dp; + struct dirent* de; + int err = 0; + + if (!f) return 1; + if (fd == -1) { + fprintf(stderr,"unable to create directory; quitting.\n"); + return 1; + } + close(fd); + dp = opendir("testdir"); + if (!dp) { + fprintf(stderr,"unable to browse directory; quitting.\n"); + rmdir("testdir"); + return 1; + } + + /* the assumption here is that readdir() will only return NULL + * due to reaching the end of the directory. + */ + while (de = readdir(dp)) { + ; + } + err = errno; + fprintf(f,"%d", err); + fclose(f); + closedir(de); + rmdir("testdir"); + return 0; +}],fptools_cv_readdir_eof_errno=`cat conftestval`, fptools_cv_readdir_eof_errno=bogus, fptools_cv_readdir_eof_errno=0)]) +dnl the cross value is somewhat bogus. +AC_DEFINE_UNQUOTED([READDIR_ERRNO_EOF], [$fptools_cv_readdir_eof_errno], [readdir() sets errno to this upon EOF]) +]) + +dnl @synopsis FP_DIRENT_FLAT_LAYOUT +dnl +dnl Check whether 'struct dirent' (in dirent.h) has d_name defined +dnl as being the final field in a struct, or a pointer to somewhere +dnl else. The former is the standardly thing to do, but mingw defns +dnl have for the longest time gone for the latter. They no longer do, +dnl hence the need to configure test for this. +dnl +dnl +AC_DEFUN(FP_DIRENT_FLAT_LAYOUT, +[AC_CACHE_CHECK([if struct dirent layout is flat], fptools_cv_dirent_flat_layout, +[AC_TRY_RUN([#include +#include +#include +int +main(argc, argv) +int argc; +char **argv; +{ + struct dirent de; + /* + * Check whether d_name is defined as + * struct dirent { .... ; char d_name[..]; } + * or + * struct dirent { .... ; char* d_name; } + * + * Returns 0 if the former. + */ + memset(&de,0,sizeof(struct dirent)); + return ((int)de.d_name == 0); +}],fptools_cv_dirent_flat_layout=yes, fptools_cv_dirent_flat_layout=no, fptools_cv_dirent_flat_layout=yes)]) +dnl the cross value is somewhat bogus. +if test "$fptools_cv_dirent_flat_layout" = yes; then +AC_DEFINE([STRUCT_DIRENT_FLAT_LAYOUT], [1], [Define to 1 if struct dirent is a flat structure]) +fi +]) + + # LocalWords: fi