-dnl $Id: aclocal.m4,v 1.47 2000/05/09 10:43:45 rrt Exp $
+dnl $Id: aclocal.m4,v 1.51 2000/06/29 13:40:17 simonmar Exp $
dnl
dnl Extra autoconf macros for the Glasgow fptools
dnl
])
+dnl *** Does libc contain GNU regex? ***
+dnl
+AC_DEFUN(FPTOOLS_REGEX_IN_LIBC,
+[AC_CACHE_CHECK([for GNU regex in libc], fptools_cv_have_regex,
+[AC_TRY_LINK([#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <regex.h>
+],[ struct re_pattern_buffer patbuf; re_compile_pattern("",0,&patbuf); ],
+fptools_cv_have_regex=yes, fptools_cv_have_regex=no)])
+if test "$fptools_cv_have_regex" = yes; then
+ HaveRegex=YES
+else
+ HaveRegex=NO
+fi
+AC_SUBST(HaveRegex)
+])
+
+
dnl ** check for leading underscores in symbol names
dnl
dnl Test for determining whether symbol names have a leading
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(<<AC_TYPE_NAME>>, translit(htype_$1, [a-z *], [A-Z_P]))dnl
+dnl The cache variable name.
+define(<<AC_CV_NAME>>, 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 <stdio.h>
+#include <stddef.h>
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#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++)
fi
])
+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
+<!DOCTYPE Article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
+<Article>
+<ArtHeader>
+<Title>Test</Title>
+<Author><OtherName>Test</OtherName></Author>
+<Address>Test</Address>
+<PubDate>Test</PubDate>
+</ArtHeader>
+<Sect1><Title>Test</Title>
+<Para>
+Test.
+</Para>
+</Sect1>
+</Article>
+EOF
+fptools_cv_sgml_catalog=no
+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
+])
+rm -rf conftest*
+if test $fptools_cv_sgml_catalog != "no"; then
+ $1=$fptools_cv_sgml_catalog
+fi
+])
+
# LocalWords: fi