From: panne Date: Thu, 8 Jun 2000 20:57:02 +0000 (+0000) Subject: [project @ 2000-06-08 20:57:02 by panne] X-Git-Tag: Approximately_9120_patches~4300 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=e653c5bf94d66d85092c7a6dd741367365ef3a4c;p=ghc-hetmet.git [project @ 2000-06-08 20:57:02 by panne] autoconf hackery for CTypes{,ISO} (continued) --- diff --git a/aclocal.m4 b/aclocal.m4 index 6eb2d1c..8f12e0d 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.49 2000/06/08 20:57:02 panne Exp $ dnl dnl Extra autoconf macros for the Glasgow fptools dnl @@ -374,6 +374,51 @@ 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) +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`, AC_CV_NAME=NotReallyAType, AC_CV_NAME=NotReallyAType)])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++)