AC_SUBST(exeext)
+dnl * Booting from .hc files?
+#--------------------------------------------------------------
+AC_ARG_ENABLE(hc-boot,
+ [
+Boot the Glasgow Haskell Compiler from intermediate .hc files.
+(This option is mostly of interest for porters.)
+ ],
+
+ BootingFromHc=YES,
+ BootingFromHc=NO
+)
+AC_SUBST(BootingFromHc)
+
# -------------------------------------------------------------------------
dnl
dnl * _GENERAL_ CONFIGURATION CHECKS
echo "Perhaps it is already installed, but not in your PATH?"
exit 1
else
-AC_CHECK_PERL_VERSION
+FPTOOLS_CHECK_PERL_VERSION
fi
#
dnl ** does #!.../perl work? (sometimes it's too long...)
#
-AC_SHEBANG_PERL
-
-# Remove: we work around the problem in the single place
-# where we rely on something (getopts) from the libraries.
-#
-#dnl ** check if perl library is properly installed
-#
-# (by seeing if a "do 'getopts.pl'" works...
-#if $PerlCmd -e 'do "getopts.pl" || exit(1); exit(0);' > /dev/null 2>&1 ; then
-# :
-#else
-# echo "I think your perl library is misinstalled:"
-# echo "The following script did not work:"
-# echo ' do "getopts.pl" || exit(1); exit(0);'
-# echo 'But, anyway, we will continue in our quest..'
-#fi
-#
+FPTOOLS_SHEBANG_PERL
#
dnl ** look for GCC and find out which version
# If gcc, make sure it's at least 2.1
#
AC_PROG_CC
-AC_HAVE_GCC
+FPTOOLS_HAVE_GCC
#
dnl ** figure out how to invoke cpp directly (gcc -E is no good)
#
AC_PROG_CPP
-AC_PROG_GNUCPP
+FPTOOLS_PROG_GNUCPP
#
dnl ** figure out how to do context diffs
#
-AC_PROG_DIFF
+FPTOOLS_PROG_DIFF
#
dnl ** look for a decent parser generator (bison preferred)
#
-# (AC_PROG_YACCY is AC_PROG_YACC, but with some extra testing
+# (FPTOOLS_PROG_YACCY is AC_PROG_YACC, but with some extra testing
# on the suitability of the 'yacc' returned.)
-AC_PROG_YACCY
+FPTOOLS_PROG_YACCY
#
dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
#
dnl ** how to invoke `ar' and `ranlib'
#
-AC_PROG_AR_AND_RANLIB
+FPTOOLS_PROG_AR_AND_RANLIB
#
#
AC_SUBST(CompressCmd)
AC_SUBST(CompressSuffix)
-#
+dnl
dnl ** check for installed happy binary + version
-#
-AC_HAPPY
-
-if test x"$HappyCmd" != x; then
- if expr $HappyVersion \< "1.3" >/dev/null; then
- echo " Happy Version 1.3 or later is required to compile GHC."
- echo " Using the Happy sources in the tree.";
- HappyCmd=""
- fi
-fi
-
-#
-#
-dnl ** check for installed lx binary
-#
-AC_PATH_PROG(LxCmd,lx)
+dnl (don't do it if we're booting from .hc files though.)
+if (test "$BootingFromHc" = "NO"); then
+FPTOOLS_HAPPY
+fi;
#### program checking section ends here ####
#
dnl ** check for specific header (.h) files that we are interested in
#
-AC_CHECK_HEADERS(dirent.h fcntl.h grp.h malloc.h memory.h nlist.h pwd.h siginfo.h signal.h stdlib.h string.h sys/fault.h sys/file.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/vadvise.h sys/wait.h termios.h time.h types.h unistd.h utime.h vfork.h readline/readline.h )
+AC_CHECK_HEADERS(dirent.h fcntl.h grp.h malloc.h memory.h nlist.h pwd.h siginfo.h signal.h stdlib.h string.h sys/fault.h sys/file.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/vadvise.h sys/wait.h termios.h time.h types.h unistd.h utime.h vfork.h readline/readline.h bfd.h)
#
dnl ** check if it is safe to include both <time.h> and <sys/time.h>
AC_STRUCT_TIMEZONE
#
-dnl what's the type of timezone?
-AC_TYPE_TIMEZONE
+dnl ** what's the type of timezone?
+FPTOOLS_TYPE_TIMEZONE
+
+#
+dnl ** do we have altzone?
+FPTOOLS_ALTZONE
+dnl ** does struct stat contain st_blksize?
#
-dnl do we have altzone?
-AC_ALTZONE
+AC_STRUCT_ST_BLKSIZE
+
+dnl ** what are the sizes of various types
+dnl (these must come before GHC_CHECK_ALIGNMENT)
+AC_CHECK_SIZEOF(unsigned int,4)
+AC_CHECK_SIZEOF(float, 4)
+AC_CHECK_SIZEOF(double, 8)
+AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(void *, 4)
+
+dnl ** what are alignment constraints on various types
+FPTOOLS_CHECK_ALIGNMENT(unsigned int) dnl redundant but harmless
+FPTOOLS_CHECK_ALIGNMENT(long)
+FPTOOLS_CHECK_ALIGNMENT(float)
+FPTOOLS_CHECK_ALIGNMENT(double)
+
+dnl ** do we have long longs?
+FPTOOLS_C_LONG_LONG
#
dnl ** check for specific library functions that we are interested in
AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect setitimer stat sysconf timelocal times vadvise vfork)
#
+dnl ** check whether this machine has GMP 2.0 installed
+#
+AC_CHECK_LIB(gmp, mpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
+ AC_CHECK_LIB(gmp2, mpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp2,
+ HaveLibGmp=No; LibGmp=not-installed))
+AC_SUBST(HaveLibGmp)
+AC_SUBST(LibGmp)
+
+#
+dnl ** check whether this machine has BFD and liberty installed (used for debugging)
+dnl ** the order of these tests matters: bfd needs liberty
+#
+AC_CHECK_LIB(iberty, xmalloc)
+AC_CHECK_LIB(bfd, bfd_init)
+
+#
# Misc
#
dnl ** can we get alloca?
AC_FUNC_ALLOCA
dnl ** determine whether or not const works
AC_C_CONST
+dnl ** are we big endian?
+AC_C_BIGENDIAN
dnl ** determine the type of signal()
AC_TYPE_SIGNAL
#
dnl ** check for leading underscores in symbol names
#
-AC_UNDERSCORE
+FPTOOLS_UNDERSCORE
AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )