X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=aclocal.m4;h=51da0dfff122d15268073a1df59fadabcd28d7e9;hb=25ee7c9eda18dbf3ccc37298dbba1f5fbbf64a30;hp=6eb2d1cda253880bf84b7d19e904499546abf661;hpb=d7fefe23ad15148686c0f2a1351d5e4dfc7e859c;p=ghc-hetmet.git diff --git a/aclocal.m4 b/aclocal.m4 index 6eb2d1c..51da0df 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,4 @@ -dnl $Id: aclocal.m4,v 1.48 2000/05/31 00:55:10 chak Exp $ +dnl $Id: aclocal.m4,v 1.50 2000/06/15 20:22:53 panne Exp $ dnl dnl Extra autoconf macros for the Glasgow fptools dnl @@ -374,6 +374,53 @@ undefine([AC_CV_NAME])dnl undefine([AC_CV_SIZEOF_NAME])dnl ]) +dnl ** Map an arithmetic C type to a Haskell type. +dnl Based on autconf's AC_CHECK_SIZEOF. + +dnl FPTOOLS_CHECK_HTYPE(TYPE [, DEFAULT_VALUE, [, VALUE-FOR-CROSS-COMPILATION]) +AC_DEFUN(FPTOOLS_CHECK_HTYPE, +[changequote(<<, >>)dnl +dnl The name to #define. +define(<>, translit(htype_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, translit(fptools_cv_htype_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(Haskell type for $1) +AC_CACHE_VAL(AC_CV_NAME, +[AC_TRY_RUN([#include +#include +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif + +typedef $1 testing; + +main() { + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + if (((testing)((int)((testing)1.4))) == ((testing)1.4)) { + fprintf(f, "%s%d\n", + ((testing)(-1) < (testing)0) ? "Int" : "Word", + sizeof(testing)*8); + } else { + fprintf(f,"%s\n", + (sizeof(testing) > sizeof(double)) ? "LDouble" : + (sizeof(testing) == sizeof(double)) ? "Double" : "Float"); + } + fclose(f); + exit(0); +}], AC_CV_NAME=`cat conftestval`, +ifelse([$2], , AC_CV_NAME=NotReallyAType, AC_CV_NAME=$2), +ifelse([$3], , AC_CV_NAME=NotReallyATypeCross, AC_CV_NAME=$3))]) dnl +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + dnl ** figure out whether C compiler supports 'long long's dnl (Closely based on Andreas Zeller's macro for testing dnl for this under C++)