3 ev.sigev_notify = SIGEV_SIGNAL;
4 ev.sigev_signo = SIGVTALRM;
5 if (timer_create(CLOCK_PROCESS_CPUTIME_ID, &ev, &timer) != 0) {
13 # Extra autoconf macros for the Glasgow fptools
15 # To be a good autoconf citizen, names of local macros have prefixed with FP_ to
16 # ensure we don't clash with any pre-supplied autoconf ones.
19 # FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
20 # ----------------------------------
21 # Little endian Arm on Linux with some ABIs has big endian word order
22 # in doubles. Define FLOAT_WORDS_BIGENDIAN if this is the case.
23 AC_DEFUN([FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN],
24 [AC_CACHE_CHECK([whether float word order is big endian], [fptools_cv_float_word_order_bigendian],
27 [#include <endian.h>],
28 [#if defined(__FLOAT_WORD_ORDER) && __FLOAT_WORD_ORDER == BIG_ENDIAN
31 not float word order big endian
34 [fptools_cv_float_word_order_bigendian=yes],
35 [fptools_cv_float_word_order_bigendian=no])
37 case $fptools_cv_float_word_order_bigendian in
39 AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
40 [Define to 1 if your processor stores words of floats with
41 the most significant byte first]) ;;
46 # FP_EVAL_STDERR(COMMAND)
47 # -----------------------
48 # Eval COMMAND, save its stderr (without lines resulting from shell tracing)
49 # into the file conftest.err and the exit status in the variable fp_status.
50 AC_DEFUN([FP_EVAL_STDERR],
51 [{ (eval $1) 2>conftest.er1
53 grep -v '^ *+' conftest.er1 >conftest.err
55 (exit $fp_status); }[]dnl
59 # FP_CHECK_FLAG(FLAG, [ACTION-IF-SUPPORTED], [ACTION-IF-NOT-SUPPORTED])
60 # ---------------------------------------------------------------------
61 # Check to see whether the compiler for the current language supports a
64 # Implementation note: When given an unkown option, GCC issues an warning on
65 # stderr only, but returns an exit value of 0 nevertheless. Consequently we have
66 # to check stderr *and* the exit value.
69 AC_DEFUN([FP_CHECK_FLAG],
70 [AC_LANG_COMPILER_REQUIRE()dnl
71 AC_LANG_CASE([C], [fp_compiler="$CC" m4_pushdef([fp_Flags], [CFLAGS])],
72 [C++], [fp_compiler="$CXX" m4_pushdef([fp_Flags], [CXXFLAGS])],
73 [Fortran 77], [fp_compiler="$F77" m4_pushdef([fp_Flags], [FFLAGS])])
74 m4_pushdef([fp_Cache], [fp_cv_[]fp_Flags[]AS_TR_SH([$1])])[]dnl
75 AC_CACHE_CHECK([whether $fp_compiler accepts $1], [fp_Cache],
76 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
77 fp_save_flags="$fp_Flags"
78 fp_Flags="$fp_Flags $1"
80 if FP_EVAL_STDERR([$ac_compile conftest.$ac_ext]) >/dev/null; then
81 test -s conftest.err || fp_Cache=yes
83 fp_Flags="$fp_save_flags"
84 rm -f conftest.err conftest.$ac_ext])
85 AS_IF([test $fp_Cache = yes], [$2], [$3])[]dnl
86 m4_popdef([fp_Cache])[]dnl
87 m4_popdef([fp_Flags])[]dnl
91 # FP_PROG_CONTEXT_DIFF
92 # --------------------
93 # Figure out how to do context diffs. Sets the output variable ContextDiffCmd.
95 # Note: NeXTStep thinks diff'ing a file against itself is "trouble".
97 # Used by ghc, glafp-utils/ltx, and glafp-utils/runstdtest.
98 AC_DEFUN([FP_PROG_CONTEXT_DIFF],
99 [AC_CACHE_CHECK([for a working context diff], [fp_cv_context_diff],
100 [echo foo > conftest1
102 fp_cv_context_diff=no
103 for fp_var in '-C 1' '-c1'
105 if diff $fp_var conftest1 conftest2 > /dev/null 2>&1; then
106 fp_cv_context_diff="diff $fp_var"
110 if test x"$fp_cv_context_diff" = xno; then
111 AC_MSG_ERROR([cannot figure out how to do context diffs])
113 AC_SUBST(ContextDiffCmd, [$fp_cv_context_diff])
114 ])# FP_PROG_CONTEXT_DIFF
117 # FP_COMPUTE_INT(EXPRESSION, VARIABLE, INCLUDES, IF-FAILS)
118 # --------------------------------------------------------
119 # Assign VARIABLE the value of the compile-time EXPRESSION using INCLUDES for
120 # compilation. Execute IF-FAILS when unable to determine the value. Works for
121 # cross-compilation, too.
123 # Implementation note: We are lazy and use an internal autoconf macro, but it
124 # is supported in autoconf versions 2.50 up to the actual 2.57, so there is
126 AC_DEFUN([FP_COMPUTE_INT],
127 [_AC_COMPUTE_INT([$1], [$2], [$3], [$4])[]dnl
131 # FP_CHECK_ALIGNMENT(TYPE, [IGNORED], [INCLUDES = DEFAULT-INCLUDES])
132 # ------------------------------------------------------------------
133 # A variation of AC_CHECK_SIZEOF for computing the alignment restrictions of a
134 # given type. Defines ALIGNMENT_TYPE.
135 AC_DEFUN([FP_CHECK_ALIGNMENT],
136 [AS_LITERAL_IF([$1], [],
137 [AC_FATAL([$0: requires literal arguments])])[]dnl
138 AC_CHECK_TYPE([$1], [], [], [$3])[]dnl
139 m4_pushdef([fp_Cache], [AS_TR_SH([fp_cv_alignment_$1])])[]dnl
140 AC_CACHE_CHECK([alignment of $1], [fp_Cache],
141 [if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
142 FP_COMPUTE_INT([(long) (&((struct { char c; $1 ty; } *)0)->ty)],
144 [AC_INCLUDES_DEFAULT([$3])],
145 [AC_MSG_ERROR([cannot compute alignment ($1)
146 See `config.log' for more details.], [77])])
150 AC_DEFINE_UNQUOTED(AS_TR_CPP(alignment_$1), $fp_Cache, [The alignment of a `$1'.])[]dnl
151 m4_popdef([fp_Cache])[]dnl
152 ])# FP_CHECK_ALIGNMENT
155 # FP_LEADING_UNDERSCORE
156 # ---------------------
157 # Test for determining whether symbol names have a leading underscore. We assume
158 # that they _haven't_ if anything goes wrong. Sets the output variable
159 # LeadingUnderscore to YES or NO and defines LEADING_UNDERSCORE correspondingly.
161 # Some nlist implementations seem to try to be compatible by ignoring a leading
162 # underscore sometimes (eg. FreeBSD). We therefore have to work around this by
163 # checking for *no* leading underscore first. Sigh. --SDM
165 # Similarly on OpenBSD, but this test doesn't help. -- dons
166 AC_DEFUN([FP_LEADING_UNDERSCORE],
167 [AC_CHECK_LIB([elf], [nlist], [LIBS="-lelf $LIBS"])
168 AC_CACHE_CHECK([leading underscore in symbol names], [fptools_cv_leading_underscore], [
169 # Hack!: nlist() under Digital UNIX insist on there being an _,
170 # but symbol table listings shows none. What is going on here?!?
172 # Another hack: cygwin doesn't come with nlist.h , so we hardwire
173 # the underscoredness of that "platform"
174 case $HostPlatform in
175 *openbsd*) # x86 openbsd is ELF from 3.4 >, meaning no leading uscore
177 i386-*2\.@<:@0-9@:>@ | i386-*3\.@<:@0-3@:>@ ) fptools_cv_leading_underscore=yes ;;
178 *) fptools_cv_leading_underscore=no ;;
180 alpha-dec-osf*) fptools_cv_leading_underscore=no;;
181 *cygwin32) fptools_cv_leading_underscore=yes;;
182 *mingw32) fptools_cv_leading_underscore=yes;;
184 # HACK: Apple doesn't seem to provide nlist in the 64-bit-libraries
185 x86_64-apple-darwin*) fptools_cv_leading_underscore=yes;;
187 *) AC_RUN_IFELSE([AC_LANG_SOURCE([[#ifdef HAVE_NLIST_H
189 struct nlist xYzzY1[] = {{"xYzzY1", 0},{0}};
190 struct nlist xYzzY2[] = {{"_xYzzY2", 0},{0}};
198 if(nlist(argv[0], xYzzY1) == 0 && xYzzY1[0].n_value != 0)
200 if(nlist(argv[0], xYzzY2) == 0 && xYzzY2[0].n_value != 0)
204 }]])],[fptools_cv_leading_underscore=yes],[fptools_cv_leading_underscore=no],[fptools_cv_leading_underscore=no])
207 AC_SUBST([LeadingUnderscore], [`echo $fptools_cv_leading_underscore | sed 'y/yesno/YESNO/'`])
208 if test x"$fptools_cv_leading_underscore" = xyes; then
209 AC_DEFINE([LEADING_UNDERSCORE], [1], [Define to 1 if C symbols have a leading underscore added by the compiler.])
210 fi])# FP_LEADING_UNDERSCORE
213 # FP_COMPARE_VERSIONS(VERSION1, TEST, VERSION2, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
214 # ----------------------------------------------------------------------------------
215 # Compare dotted version numbers VERSION1 and VERSION2 lexicographically according
216 # to TEST (one of -eq, -ne, -lt, -le, -gt, or -ge).
217 AC_DEFUN([FP_COMPARE_VERSIONS],
218 [fp_version1=$1; fp_version2=$3
219 fp_save_IFS=$IFS; IFS='.'
220 while test x"$fp_version1" != x || test x"$fp_version2" != x
223 set dummy $fp_version1; shift
225 test $[@%:@] = 0 || { fp_num1="[$]1"; shift; }
226 test x"$fp_num1" = x && fp_num1="0"
229 set dummy $fp_version2; shift
231 test $[@%:@] = 0 || { fp_num2="[$]1"; shift; }
232 test x"$fp_num2" = x && fp_num2="0"
235 test "$fp_num1" = "$fp_num2" || break;
238 AS_IF([test "$fp_num1" $2 "$fp_num2"], [$4], [$5])[]dnl
239 ])# FP_COMPARE_VERSIONS
243 dnl Check for GreenCard and version.
245 AC_DEFUN([FPTOOLS_GREENCARD],
247 AC_PATH_PROG(GreenCardCmd,greencard)
248 AC_CACHE_CHECK([for version of greencard], fptools_cv_greencard_version,
250 [if test x"$GreenCardCmd" != x; then
251 fptools_cv_greencard_version="`$GreenCardCmd --version |
252 grep 'version' | sed -e 's/greencard. version \([^ ]*\).*/\1/g'`"
254 fptools_cv_greencard_version=""
258 FP_COMPARE_VERSIONS([$fptools_cv_greencard_version],[-lt],[$1],
259 [AC_MSG_ERROR([greencard version $1 or later is required (found '$fptools_cv_greencard_version')])])[]dnl
260 GreenCardVersion=$fptools_cv_greencard_version
261 AC_SUBST(GreenCardVersion)
265 dnl Check for Happy and version. If we're building GHC, then we need
266 dnl at least Happy version 1.14. If there's no installed Happy, we look
267 dnl for a happy source tree and point the build system at that instead.
269 AC_DEFUN([FPTOOLS_HAPPY],
270 [AC_PATH_PROG(HappyCmd,happy,)
271 AC_CACHE_CHECK([for version of happy], fptools_cv_happy_version,
273 [if test x"$HappyCmd" != x; then
274 fptools_cv_happy_version="`$HappyCmd -v |
275 grep 'Happy Version' | sed -e 's/Happy Version \([^ ]*\).*/\1/g'`" ;
277 fptools_cv_happy_version="";
281 if test ! -f compiler/parser/Parser.hs || test ! -f compiler/main/ParsePkgConf.hs || test ! -f compiler/cmm/CmmParse.hs || test ! -f compiler/parser/ParserCore.hs
283 FP_COMPARE_VERSIONS([$fptools_cv_happy_version],[-lt],[1.15],
284 [AC_MSG_ERROR([Happy version 1.15 or later is required to compile GHC.])])[]dnl
286 HappyVersion=$fptools_cv_happy_version;
287 AC_SUBST(HappyVersion)
291 dnl Check for Haddock and version. If there's no installed Haddock, we look
292 dnl for a haddock source tree and point the build system at that instead.
294 AC_DEFUN([FPTOOLS_HADDOCK],
295 [AC_PATH_PROG(HaddockCmd,haddock,)
296 dnl Darn, I forgot to make Haddock print out its version number when
297 dnl invoked with -v. We could try generating some HTML and grepping
298 dnl through that to find the version number, but I think we'll make
299 dnl do without it for now.
303 dnl Check for Alex and version. If we're building GHC, then we need
304 dnl at least Alex version 2.0.1.
306 AC_DEFUN([FPTOOLS_ALEX],
308 AC_PATH_PROG(AlexCmd,alex,)
309 AC_CACHE_CHECK([for version of alex], fptools_cv_alex_version,
311 [if test x"$AlexCmd" != x; then
312 fptools_cv_alex_version="`$AlexCmd -v |
313 grep 'Alex [Vv]ersion' | sed -e 's/Alex [Vv]ersion \([0-9\.]*\).*/\1/g'`" ;
315 fptools_cv_alex_version="";
319 if test ! -f compiler/cmm/CmmLex.hs || test ! -f compiler/parser/Lexer.hs
321 FP_COMPARE_VERSIONS([$fptools_cv_alex_version],[-lt],[2.0.1],
322 [AC_MSG_ERROR([Alex version 2.0.1 or later is required to compile GHC.])])[]dnl
324 AlexVersion=$fptools_cv_alex_version;
325 AC_SUBST(AlexVersion)
331 # Sets the output variable LdCmd to the (non-Cygwin version of the) full path
332 # of ld. Exits if no ld can be found
333 AC_DEFUN([FP_PROG_LD],
337 AC_PATH_PROG([fp_prog_ld_raw], [ld])
338 if test -z "$fp_prog_ld_raw"; then
339 AC_MSG_ERROR([cannot find ld in your PATH, no idea how to link])
341 LdCmd=$fp_prog_ld_raw
342 case $HostPlatform in
343 *mingw32) if test x${OSTYPE} != xmsys; then
344 LdCmd="`cygpath -w ${fp_prog_ld_raw} | sed -e 's@\\\\@/@g'`"
345 AC_MSG_NOTICE([normalized ld command to $LdCmd])
347 # Insist on >= ld-2.15.x, since earlier versions doesn't handle
348 # the generation of relocatable object files with large amounts
349 # of relocations correctly. (cf. HSbase.o splittage-hack)
350 fp_prog_ld_version=`${LdCmd} --version | sed -n '/GNU ld/p' | tr -cd 0-9 | cut -b1-3`
351 FP_COMPARE_VERSIONS([$fp_prog_ld_version],[-lt],[214],
352 [AC_MSG_ERROR([GNU ld version later than 2.14 required to compile GHC on Windows.])])[]dnl
364 # Sets the output variable LdXFlag to -x if ld supports this flag, otherwise the
365 # variable's value is empty.
366 AC_DEFUN([FP_PROG_LD_X],
367 [AC_REQUIRE([FP_PROG_LD])
368 AC_CACHE_CHECK([whether ld understands -x], [fp_cv_ld_x],
369 [echo 'foo() {}' > conftest.c
370 ${CC-cc} -c conftest.c
371 if ${LdCmd} -r -x -o conftest2.o conftest.o > /dev/null 2>&1; then
377 if test "$fp_cv_ld_x" = yes; then
388 # Sets the output variable LdIsGNULd to YES or NO, depending on whether it is
390 AC_DEFUN([FP_PROG_LD_IS_GNU],
391 [AC_REQUIRE([FP_PROG_LD])
392 AC_CACHE_CHECK([whether ld is GNU ld], [fp_cv_gnu_ld],
393 [if ${LdCmd} --version 2> /dev/null | grep "GNU" > /dev/null 2>&1; then
398 AC_SUBST([LdIsGNULd], [`echo $fp_cv_gnu_ld | sed 'y/yesno/YESNO/'`])
399 ])# FP_PROG_LD_IS_GNU
404 # Sets fp_prog_ar_raw to the full path of ar and fp_prog_ar to a non-Cygwin
405 # version of it. Exits if no ar can be found
406 AC_DEFUN([FP_PROG_AR],
407 [AC_PATH_PROG([fp_prog_ar_raw], [ar])
408 if test -z "$fp_prog_ar_raw"; then
409 AC_MSG_ERROR([cannot find ar in your PATH, no idea how to make a library])
411 fp_prog_ar=$fp_prog_ar_raw
412 case $HostPlatform in
413 *mingw32) if test x${OSTYPE} != xmsys; then
414 fp_prog_ar="`cygpath -w ${fp_prog_ar_raw} | sed -e 's@\\\\@/@g'`"
415 AC_MSG_NOTICE([normalized ar command to $fp_prog_ar])
424 # Sets fp_prog_ar_is_gnu to yes or no, depending on whether it is GNU ar or not.
425 AC_DEFUN([FP_PROG_AR_IS_GNU],
426 [AC_REQUIRE([FP_PROG_AR])
427 AC_CACHE_CHECK([whether $fp_prog_ar_raw is GNU ar], [fp_cv_prog_ar_is_gnu],
428 [if $fp_prog_ar_raw --version 2> /dev/null | grep "GNU" > /dev/null 2>&1; then
429 fp_cv_prog_ar_is_gnu=yes
431 fp_cv_prog_ar_is_gnu=no
433 fp_prog_ar_is_gnu=$fp_cv_prog_ar_is_gnu
434 ])# FP_PROG_AR_IS_GNU
439 # Sets fp_prog_ar_args to the arguments for ar and the output variable ArCmd
440 # to a non-Cygwin invocation of ar including these arguments.
441 AC_DEFUN([FP_PROG_AR_ARGS],
442 [AC_REQUIRE([FP_PROG_AR_IS_GNU])
443 AC_CACHE_CHECK([for ar arguments], [fp_cv_prog_ar_args],
445 # GNU ar needs special treatment: it appears to have problems with
446 # object files with the same name if you use the 's' modifier, but
447 # simple 'ar q' works fine, and doesn't need a separate ranlib.
448 if test $fp_prog_ar_is_gnu = yes; then
449 fp_cv_prog_ar_args="q"
452 for fp_var in clqsZ clqs cqs clq cq ; do
454 if $fp_prog_ar_raw $fp_var conftest.a conftest.dummy > /dev/null 2> /dev/null; then
455 fp_cv_prog_ar_args=$fp_var
460 if test -z "$fp_cv_prog_ar_args"; then
461 AC_MSG_ERROR([cannot figure out how to use your $fp_prog_ar_raw])
464 fp_prog_ar_args=$fp_cv_prog_ar_args
465 AC_SUBST([ArCmd], ["$fp_prog_ar $fp_prog_ar_args"])
470 # FP_PROG_AR_NEEDS_RANLIB
471 # -----------------------
472 # Sets the output variable RANLIB to "ranlib" if it is needed and found,
474 AC_DEFUN([FP_PROG_AR_NEEDS_RANLIB],
475 [AC_REQUIRE([FP_PROG_AR_IS_GNU])
476 AC_REQUIRE([FP_PROG_AR_ARGS])
477 AC_REQUIRE([AC_PROG_CC])
478 AC_CACHE_CHECK([whether ranlib is needed], [fp_cv_prog_ar_needs_ranlib],
479 [if test $fp_prog_ar_is_gnu = yes; then
480 fp_cv_prog_ar_needs_ranlib=no
481 elif echo $TargetPlatform | grep "^.*-apple-darwin$" > /dev/null 2> /dev/null; then
482 # It's quite tedious to check for Apple's crazy timestamps in .a files,
484 fp_cv_prog_ar_needs_ranlib=yes
485 elif echo $fp_prog_ar_args | grep "s" > /dev/null 2> /dev/null; then
486 fp_cv_prog_ar_needs_ranlib=no
488 fp_cv_prog_ar_needs_ranlib=yes
490 if test $fp_cv_prog_ar_needs_ranlib = yes; then
496 ])# FP_PROG_AR_NEEDS_RANLIB
499 # FP_PROG_AR_SUPPORTS_INPUT
500 # -------------------------
501 # Sets the output variable ArSupportsInput to "-input" or "", depending on
502 # whether ar supports -input flag is supported or not.
503 AC_DEFUN([FP_PROG_AR_SUPPORTS_INPUT],
504 [AC_REQUIRE([FP_PROG_AR_IS_GNU])
505 AC_REQUIRE([FP_PROG_AR_ARGS])
506 AC_CACHE_CHECK([whether $fp_prog_ar_raw supports -input], [fp_cv_prog_ar_supports_input],
507 [fp_cv_prog_ar_supports_input=no
508 if test $fp_prog_ar_is_gnu = no; then
511 if FP_EVAL_STDERR([$fp_prog_ar_raw $fp_prog_ar_args conftest.a -input conftest.lst]) >/dev/null; then
512 test -s conftest.err || fp_cv_prog_ar_supports_input=yes
516 if test $fp_cv_prog_ar_supports_input = yes; then
517 ArSupportsInput="-input"
521 AC_SUBST([ArSupportsInput])
522 ])# FP_PROG_AR_SUPPORTS_INPUT
526 dnl AC_SHEBANG_PERL - can we she-bang perl?
528 AC_DEFUN([FPTOOLS_SHEBANG_PERL],
529 [AC_CACHE_CHECK([if your perl works in shell scripts], fptools_cv_shebang_perl,
534 (SHELL=/bin/sh; export SHELL; ./conftest 69 > /dev/null)
535 if test $? -ne 69; then
536 fptools_cv_shebang_perl=yes
538 fptools_cv_shebang_perl=no
546 # Extra testing of the result AC_PROG_CC, testing the gcc version no. Sets the
547 # output variables HaveGcc and GccVersion.
548 AC_DEFUN([FP_HAVE_GCC],
549 [AC_REQUIRE([AC_PROG_CC])
550 if test -z "$GCC"; then
555 if test "$fp_have_gcc" = "NO" -a -d $srcdir/ghc; then
556 AC_MSG_ERROR([gcc is required])
558 AC_CACHE_CHECK([version of gcc], [fp_gcc_version],
559 [if test "$fp_have_gcc" = "YES"; then
560 fp_gcc_version="`$CC -v 2>&1 | grep 'version ' | sed -e 's/.*version [[^0-9]]*\([[0-9.]]*\).*/\1/g'`"
561 FP_COMPARE_VERSIONS([$fp_gcc_version], [-lt], [2.0],
562 [AC_MSG_ERROR([Need at least gcc version 2.0 (3.4+ recommended)])])
564 fp_gcc_version="not-installed"
567 AC_SUBST([HaveGcc], [$fp_have_gcc])
568 AC_SUBST([GccVersion], [$fp_gcc_version])
571 AC_DEFUN([FP_MINGW_GCC],
574 mingw*) AC_MSG_CHECKING([whether $CC is a mingw gcc])
575 if $CC -v 2>&1 | grep mingw >/dev/null; then
579 AC_MSG_ERROR([Please use --with-gcc to specify a mingw gcc])
585 dnl Small feature test for perl version. Assumes PerlCmd
586 dnl contains path to perl binary.
588 dnl (Perl versions prior to v5.6 does not contain the string "v5";
589 dnl instead they display version strings such as "version 5.005".)
591 AC_DEFUN([FPTOOLS_CHECK_PERL_VERSION],
592 [$PerlCmd -v >conftest.out 2>&1
593 if grep "v5" conftest.out >/dev/null 2>&1; then
596 AC_MSG_ERROR([your version of perl probably won't work, try upgrading it.])
602 # FP_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
603 # [VALUE-IF-NOT-FOUND], [PATH], [REJECT])
604 # -----------------------------------------------------
605 # HACK: A small wrapper around AC_CHECK_PROG, setting VARIABLE to the full path
606 # of PROG-TO-CHECK-FOR when found.
607 AC_DEFUN([FP_CHECK_PROG],
608 [AC_CHECK_PROG([$1], [$2], [$as_dir/$ac_word$ac_exec_ext], [$3], [$4], [$5])][]dnl
614 # Find a non-WinDoze version of the "find" utility.
615 AC_DEFUN([FP_PROG_FIND],
616 [AC_PATH_PROG([fp_prog_find], [find])
617 echo foo > conftest.txt
618 $fp_prog_find conftest.txt -print > conftest.out 2>&1
619 if grep '^conftest.txt$' conftest.out > /dev/null 2>&1 ; then
620 # OK, looks like a real "find".
621 case $HostPlatform in
623 if test x${OSTYPE} != xmsys
625 fp_prog_find="`cygpath --mixed ${fp_prog_find}`"
626 AC_MSG_NOTICE([normalized find command to $fp_prog_find])
630 FindCmd="$fp_prog_find"
632 # Found a poor WinDoze version of "find", ignore it.
633 AC_MSG_WARN([$fp_prog_find looks like a non-*nix find, ignoring it])
634 FP_CHECK_PROG([FindCmd], [find], [], [], [$fp_prog_find])
636 rm -f conftest.txt conftest.out
637 AC_SUBST([FindCmd])[]dnl
643 # Find a Unix-like sort
644 AC_DEFUN([FP_PROG_SORT],
645 [AC_PATH_PROG([fp_prog_sort], [sort])
646 echo conwip > conftest.txt
647 $fp_prog_sort -f conftest.txt > conftest.out 2>&1
648 if grep 'conwip' conftest.out > /dev/null 2>&1 ; then
650 SortCmd="$fp_prog_sort"
652 # Summink else..pick next one.
653 AC_MSG_WARN([$fp_prog_sort looks like a non-*nix sort, ignoring it])
654 FP_CHECK_PROG([SortCmd], [sort], [], [], [$fp_prog_sort])
656 rm -f conftest.txt conftest.out
657 AC_SUBST([SortCmd])[]dnl
661 dnl FPTOOLS_NOCACHE_CHECK prints a message, then sets the
662 dnl values of the second argument to the result of running
663 dnl the commands given by the third. It does not cache its
664 dnl result, so it is suitable for checks which should be
667 AC_DEFUN([FPTOOLS_NOCACHE_CHECK],
668 [AC_MSG_CHECKING([$1])
670 AC_MSG_RESULT([$][$2])
674 dnl FPTOOLS_GHC_VERSION(version)
675 dnl FPTOOLS_GHC_VERSION(major, minor [, patchlevel])
676 dnl FPTOOLS_GHC_VERSION(version, major, minor, patchlevel)
678 dnl Test for version of installed ghc. Uses $GHC.
679 dnl [original version pinched from c2hs]
681 AC_DEFUN([FPTOOLS_GHC_VERSION],
682 [FPTOOLS_NOCACHE_CHECK([version of ghc], [fptools_version_of_ghc],
683 ["${WithGhc-ghc}" --version > conftestghc 2>&1
684 cat conftestghc >&AS_MESSAGE_LOG_FD
685 #Useless Use Of cat award...
686 fptools_version_of_ghc=`cat conftestghc | sed -n -e 's/, patchlevel *\([[0-9]]\)/.\1/;s/.* version \([[0-9]][[0-9.]]*\).*/\1/p'`
688 if test "[$]fptools_version_of_ghc" = ""
690 fptools_version_of_ghc='unknown'
692 fptools_version_of_ghc[_major]=`echo [$]fptools_version_of_ghc | sed -e 's/^\([[0-9]]\).*/\1/'`
693 fptools_version_of_ghc[_minor]=`echo [$]fptools_version_of_ghc | sed -e 's/^[[0-9]]\.\([[0-9]]*\).*/\1/'`
694 fptools_version_of_ghc[_pl]=`echo [$]fptools_version_of_ghc | sed -n -e 's/^[[0-9]]\.[[0-9]]*\.\([[0-9]]*\)/\1/p'`
696 if test "[$]fptools_version_of_ghc[_pl]" = ""
698 fptools_version_of_ghc[_all]="[$]fptools_version_of_ghc[_major].[$]fptools_version_of_ghc[_minor]"
699 fptools_version_of_ghc[_pl]="0"
701 fptools_version_of_ghc[_all]="[$]fptools_version_of_ghc[_major].[$]fptools_version_of_ghc[_minor].[$]fptools_version_of_ghc[_pl]"
705 [$1]="[$]fptools_version_of_ghc[_all]"
707 [$1]="[$]fptools_version_of_ghc[_major]"
708 [$2]="[$]fptools_version_of_ghc[_minor]"
710 [$1]="[$]fptools_version_of_ghc[_major]"
711 [$2]="[$]fptools_version_of_ghc[_minor]"
712 [$3]="[$]fptools_version_of_ghc[_pl]"
714 [$1]="[$]fptools_version_of_ghc[_all]"
715 [$2]="[$]fptools_version_of_ghc[_major]"
716 [$3]="[$]fptools_version_of_ghc[_minor]"
717 [$4]="[$]fptools_version_of_ghc[_pl]"
723 # FP_CHECK_FUNC(FUNCTION, PROLOGUE, BODY, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
724 # ---------------------------------------------------------------------------------
725 # A variant of AC_CHECK_FUNCS, limited to a single FUNCTION, but with the
726 # additional flexibility of specifying the PROLOGUE and BODY.
727 AC_DEFUN([FP_CHECK_FUNC],
728 [AS_VAR_PUSHDEF([fp_func], [fp_cv_func_$1])dnl
729 AC_CACHE_CHECK([for $1], fp_func,
730 [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
731 [AS_VAR_SET(fp_func, yes)],
732 [AS_VAR_SET(fp_func, no)])])
733 AS_IF([test AS_VAR_GET(fp_func) = yes],
734 [AC_DEFINE(AS_TR_CPP(HAVE_$1), [1],
735 [Define to 1 if you have the `]$1[' function.]) $4],
737 AS_VAR_POPDEF([fp_func])dnl
743 # Generates a DocBook XML V4.2 document in conftest.xml.
744 AC_DEFUN([FP_GEN_DOCBOOK_XML],
746 cat > conftest.xml << EOF
747 <?xml version="1.0" encoding="iso-8859-1"?>
748 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
749 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
751 <title>A DocBook Test Document</title>
752 <chapter id="id-one">
753 <title>A Chapter Title</title>
754 <para>This is a paragraph, referencing <xref linkend="id-two"/>.</para>
756 <chapter id="id-two">
757 <title>Another Chapter Title</title>
758 <para>This is another paragraph, referencing <xref linkend="id-one"/>.</para>
762 ]) # FP_GEN_DOCBOOK_XML
767 # Sets the output variable XsltprocCmd to the full path of the XSLT processor
768 # xsltproc. XsltprocCmd is empty if xsltproc could not be found.
769 AC_DEFUN([FP_PROG_XSLTPROC],
770 [AC_PATH_PROG([XsltprocCmd], [xsltproc])
771 if test -z "$XsltprocCmd"; then
772 AC_MSG_WARN([cannot find xsltproc in your PATH, you will not be able to build the documentation])
777 # FP_DIR_DOCBOOK_XSL(XSL-DIRS)
778 # ----------------------------
779 # Check which of the directories XSL-DIRS contains DocBook XSL stylesheets. The
780 # output variable DIR_DOCBOOK_XSL will contain the first usable directory or
781 # will be empty if none could be found.
782 AC_DEFUN([FP_DIR_DOCBOOK_XSL],
783 [AC_REQUIRE([FP_PROG_XSLTPROC])dnl
784 if test -n "$XsltprocCmd"; then
785 AC_CACHE_CHECK([for DocBook XSL stylesheet directory], fp_cv_dir_docbook_xsl,
787 fp_cv_dir_docbook_xsl=no
789 if $XsltprocCmd ${fp_var}/html/docbook.xsl conftest.xml > /dev/null 2>&1; then
790 fp_cv_dir_docbook_xsl=$fp_var
796 if test x"$fp_cv_dir_docbook_xsl" = xno; then
797 AC_MSG_WARN([cannot find DocBook XSL stylesheets, you will not be able to build the documentation])
800 DIR_DOCBOOK_XSL=$fp_cv_dir_docbook_xsl
802 AC_SUBST([DIR_DOCBOOK_XSL])
803 ])# FP_DIR_DOCBOOK_XSL
808 # Sets the output variable XmllintCmd to the full path of the XSLT processor
809 # xmllint. XmllintCmd is empty if xmllint could not be found.
810 AC_DEFUN([FP_PROG_XMLLINT],
811 [AC_PATH_PROG([XmllintCmd], [xmllint])
812 if test -z "$XmllintCmd"; then
813 AC_MSG_WARN([cannot find xmllint in your PATH, you will not be able to validate your documentation])
818 # FP_CHECK_DOCBOOK_DTD
819 # --------------------
820 AC_DEFUN([FP_CHECK_DOCBOOK_DTD],
821 [AC_REQUIRE([FP_PROG_XMLLINT])dnl
822 if test -n "$XmllintCmd"; then
823 AC_MSG_CHECKING([for DocBook DTD])
825 if $XmllintCmd --valid --noout conftest.xml > /dev/null 2>&1; then
828 AC_MSG_RESULT([failed])
829 AC_MSG_WARN([cannot find a DTD for DocBook XML V4.2, you will not be able to validate your documentation])
830 AC_MSG_WARN([check your XML_CATALOG_FILES environment variable and/or /etc/xml/catalog])
834 ])# FP_CHECK_DOCBOOK_DTD
839 # Generates a formatting objects document in conftest.fo.
840 AC_DEFUN([FP_GEN_FO],
842 cat > conftest.fo << EOF
843 <?xml version="1.0"?>
844 <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
845 <fo:layout-master-set>
846 <fo:simple-page-master master-name="blank">
848 </fo:simple-page-master>
849 </fo:layout-master-set>
850 <fo:page-sequence master-reference="blank">
851 <fo:flow flow-name="xsl-region-body">
864 # Set the output variable 'FopCmd' to the first working 'fop' in the current
865 # 'PATH'. Note that /usr/bin/fop is broken in SuSE 9.1 (unpatched), so try
866 # /usr/share/fop/fop.sh in that case (or no 'fop'), too.
867 AC_DEFUN([FP_PROG_FOP],
868 [AC_PATH_PROGS([FopCmd1], [fop fop.sh])
869 if test -n "$FopCmd1"; then
870 AC_CACHE_CHECK([for $FopCmd1 usability], [fp_cv_fop_usability],
872 if "$FopCmd1" -fo conftest.fo -ps conftest.ps > /dev/null 2>&1; then
873 fp_cv_fop_usability=yes
875 fp_cv_fop_usability=no
878 if test x"$fp_cv_fop_usability" = xyes; then
882 if test -z "$FopCmd"; then
883 AC_PATH_PROGS([FopCmd2], [fop.sh], , [/usr/share/fop])
890 # FP_PROG_FO_PROCESSOR
891 # --------------------
892 # Try to find an FO processor. PassiveTeX output is sometimes a bit strange, so
893 # try FOP first. Sets the output variables FopCmd, XmltexCmd, DvipsCmd, and
895 AC_DEFUN([FP_PROG_FO_PROCESSOR],
896 [AC_REQUIRE([FP_PROG_FOP])
897 AC_PATH_PROG([XmltexCmd], [xmltex])
898 AC_PATH_PROG([DvipsCmd], [dvips])
899 if test -z "$FopCmd"; then
900 if test -z "$XmltexCmd"; then
901 AC_MSG_WARN([cannot find an FO => DVI converter, you will not be able to build DVI or PostScript documentation])
903 if test -z "$DvipsCmd"; then
904 AC_MSG_WARN([cannot find a DVI => PS converter, you will not be able to build PostScript documentation])
907 AC_PATH_PROG([PdfxmltexCmd], [pdfxmltex])
908 if test -z "$PdfxmltexCmd"; then
909 AC_MSG_WARN([cannot find an FO => PDF converter, you will not be able to build PDF documentation])
911 elif test -z "$XmltexCmd"; then
912 AC_MSG_WARN([cannot find an FO => DVI converter, you will not be able to build DVI documentation])
914 ])# FP_PROG_FO_PROCESSOR
919 # Try to find a ghc-pkg matching the ghc mentioned in the environment variable
920 # WithGhc. If the latter is unset or no matching ghc-pkg can be found, try to
921 # find a plain ghc-pkg. Sets the output variable GhcPkgCmd.
922 AC_DEFUN([FP_PROG_GHC_PKG],
923 [AC_CACHE_CHECK([for ghc-pkg matching $WithGhc], fp_cv_matching_ghc_pkg,
924 [fp_ghc_pkg_guess=`echo $WithGhc | sed 's,ghc\(@<:@^/\\@:>@*\)$,ghc-pkg\1,'`
925 if "$fp_ghc_pkg_guess" -l > /dev/null 2>&1; then
926 fp_cv_matching_ghc_pkg=$fp_ghc_pkg_guess
928 fp_cv_matching_ghc_pkg=no
930 if test x"$fp_cv_matching_ghc_pkg" = xno; then
931 AC_PATH_PROG([GhcPkgCmd], [ghc-pkg])
933 GhcPkgCmd=$fp_cv_matching_ghc_pkg
934 fi])# FP_PROG_GHC_PKG
937 # FP_GHC_HAS_EDITLINE
938 # -------------------
939 AC_DEFUN([FP_GHC_HAS_EDITLINE],
940 [AC_REQUIRE([FP_PROG_GHC_PKG])
941 AC_CACHE_CHECK([whether ghc has editline package], [fp_cv_ghc_has_editline],
942 [if "${GhcPkgCmd-ghc-pkg}" --show-package editline >/dev/null 2>&1; then
943 fp_cv_ghc_has_editline=yes
945 fp_cv_ghc_has_editline=no
947 AC_SUBST([GhcHasEditline], [`echo $fp_cv_ghc_has_editline | sed 'y/yesno/YESNO/'`])
948 ])# FP_GHC_HAS_EDITLINE
953 # Determine which extra flags we need to pass gcc when we invoke it
954 # to compile .hc code.
956 # Some OSs (Mandrake Linux, in particular) configure GCC with
957 # -momit-leaf-frame-pointer on by default. If this is the case, we
958 # need to turn it off for mangling to work. The test is currently a
959 # bit crude, using only the version number of gcc.
961 # -fwrapv is needed for gcc to emit well-behaved code in the presence of
962 # integer wrap around. (Trac #952)
964 # -fno-unit-at-a-time or -fno-toplevel-reoder is necessary to avoid gcc
965 # reordering things in the module and confusing the manger and/or splitter.
968 AC_DEFUN([FP_GCC_EXTRA_FLAGS],
969 [AC_REQUIRE([FP_HAVE_GCC])
970 AC_CACHE_CHECK([for extra options to pass gcc when compiling via C], [fp_cv_gcc_extra_opts],
971 [fp_cv_gcc_extra_opts=
972 FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [3.4],
973 [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fwrapv"],
975 case $TargetPlatform in
977 FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [3.2],
978 [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -mno-omit-leaf-frame-pointer"],
980 FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [3.4],
981 [FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [4.2],
982 [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fno-toplevel-reorder"],
983 [fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fno-unit-at-a-time"]
989 AC_SUBST([GccExtraViaCOpts],$fp_cv_gcc_extra_opts)
993 # FP_SETUP_PROJECT_VERSION
994 # ---------------------
995 AC_DEFUN([FP_SETUP_PROJECT_VERSION],
997 if test "$RELEASE" = "NO"; then
998 AC_MSG_CHECKING([for GHC version date])
999 if test -f VERSION_DATE; then
1000 PACKAGE_VERSION=${PACKAGE_VERSION}.`cat VERSION_DATE`
1001 AC_MSG_RESULT(given $PACKAGE_VERSION)
1002 elif test -d _darcs; then
1004 ver_date=`darcs changes --quiet --no-summary --xml | head -500 | grep 'date=' | sed "s/^.*date='\([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\).*$/\1/g" | sort -n | tail -1`
1005 if echo $ver_date | grep '^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$' 2>&1 >/dev/null; then true; else
1006 changequote([, ])dnl
1007 AC_MSG_ERROR([failed to detect version date: check that darcs is in your path])
1009 PACKAGE_VERSION=${PACKAGE_VERSION}.$ver_date
1010 AC_MSG_RESULT(inferred $PACKAGE_VERSION)
1011 elif test -f VERSION; then
1012 PACKAGE_VERSION=`cat VERSION`
1013 AC_MSG_RESULT(given $PACKAGE_VERSION)
1015 AC_MSG_WARN([cannot determine snapshot version: no _darcs directory and no VERSION file])
1020 AC_SUBST([ProjectName], [$PACKAGE_NAME])
1021 AC_SUBST([ProjectVersion], [$PACKAGE_VERSION])
1023 # Split PACKAGE_VERSION into (possibly empty) parts
1024 VERSION_MAJOR=`echo $PACKAGE_VERSION | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\1'/`
1025 VERSION_TMP=`echo $PACKAGE_VERSION | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\3'/`
1026 VERSION_MINOR=`echo $VERSION_TMP | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\1'/`
1027 ProjectPatchLevel=`echo $VERSION_TMP | sed 's/^\(@<:@^.@:>@*\)\(\.\{0,1\}\(.*\)\)$/\3'/`
1029 # Calculate project version as an integer, using 2 digits for minor version
1030 case $VERSION_MINOR in
1031 ?) ProjectVersionInt=${VERSION_MAJOR}0${VERSION_MINOR} ;;
1032 ??) ProjectVersionInt=${VERSION_MAJOR}${VERSION_MINOR} ;;
1033 *) AC_MSG_ERROR([bad minor version in $PACKAGE_VERSION]) ;;
1035 AC_SUBST([ProjectVersionInt])
1037 # The project patchlevel is zero unless stated otherwise
1038 test -z "$ProjectPatchLevel" && ProjectPatchLevel=0
1040 # Remove dots from the patch level; this allows us to have versions like 6.4.1.20050508
1041 ProjectPatchLevel=`echo $ProjectPatchLevel | sed 's/\.//'`
1043 AC_SUBST([ProjectPatchLevel])
1044 ])# FP_SETUP_PROJECT_VERSION
1047 # Check for a working timer_create(). We need a pretty detailed check
1048 # here, because there exist partially-working implementations of
1049 # timer_create() in certain versions of Linux (see bug #1933).
1051 AC_DEFUN([FP_CHECK_TIMER_CREATE],
1052 [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)],
1053 [fptools_cv_timer_create_works],
1056 #ifdef HAVE_STDLIB_H
1062 #ifdef HAVE_SIGNAL_H
1065 #ifdef HAVE_UNISTD_H
1069 static volatile int tock = 0;
1070 static void handler(int i)
1075 static void timeout(int i)
1077 // timer_settime() has been known to hang, so just in case
1078 // we install a 1-second timeout (see #2257)
1082 int main(int argc, char *argv[])
1087 struct itimerspec it;
1088 struct sigaction action;
1091 ev.sigev_notify = SIGEV_SIGNAL;
1092 ev.sigev_signo = SIGVTALRM;
1094 action.sa_handler = handler;
1095 action.sa_flags = 0;
1096 sigemptyset(&action.sa_mask);
1097 if (sigaction(SIGVTALRM, &action, NULL) == -1) {
1098 fprintf(stderr,"SIGVTALRM problem\n");
1102 action.sa_handler = timeout;
1103 action.sa_flags = 0;
1104 sigemptyset(&action.sa_mask);
1105 if (sigaction(SIGALRM, &action, NULL) == -1) {
1106 fprintf(stderr,"SIGALRM problem\n");
1111 if (timer_create(CLOCK_PROCESS_CPUTIME_ID, &ev, &timer) != 0) {
1112 fprintf(stderr,"No CLOCK_PROCESS_CPUTIME_ID timer\n");
1116 it.it_value.tv_sec = 0;
1117 it.it_value.tv_nsec = 1;
1118 it.it_interval = it.it_value;
1119 if (timer_settime(timer, 0, &it, NULL) != 0) {
1120 fprintf(stderr,"settime problem\n");
1126 for(n = 3; n < 20000; n++){
1127 for(m = 2; m <= n/2; m++){
1128 if (!(n%m)) count++;
1135 fprintf(stderr,"no CLOCK_PROCESS_CPUTIME_ID signal\n");
1139 timer_delete(timer);
1141 if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) {
1142 fprintf(stderr,"No CLOCK_REALTIME timer\n");
1146 it.it_value.tv_sec = 0;
1147 it.it_value.tv_nsec = 1000000;
1148 it.it_interval = it.it_value;
1149 if (timer_settime(timer, 0, &it, NULL) != 0) {
1150 fprintf(stderr,"settime problem\n");
1159 fprintf(stderr,"no CLOCK_REALTIME signal\n");
1163 timer_delete(timer);
1168 [fptools_cv_timer_create_works=yes],
1169 [fptools_cv_timer_create_works=no])
1171 case $fptools_cv_timer_create_works in
1172 yes) AC_DEFINE([USE_TIMER_CREATE], 1,
1173 [Define to 1 if we can use timer_create(CLOCK_PROCESS_CPUTIME_ID,...)]);;
1179 AC_DEFUN([FP_ARG_GMP],
1181 AC_ARG_WITH([gmp-includes],
1182 [AC_HELP_STRING([--with-gmp-includes],
1183 [directory containing gmp.h])],
1184 [gmp_includes=$withval],
1185 [gmp_includes=NONE])
1187 AC_ARG_WITH([gmp-libraries],
1188 [AC_HELP_STRING([--with-gmp-libraries],
1189 [directory containing gmp library])],
1190 [gmp_libraries=$withval],
1191 [gmp_libraries=NONE])
1194 AC_DEFUN([CHECK_GMP],
1195 [AC_REQUIRE([AC_PROG_CPP])
1196 AC_REQUIRE([AC_PROG_CC])
1199 # FP_CHECK_MACOSX_DEPLOYMENT_TARGET
1200 # ---------------------------------
1201 AC_DEFUN([FP_CHECK_MACOSX_DEPLOYMENT_TARGET],
1203 if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple"; then
1204 AC_MSG_CHECKING([Mac OS X deployment target])
1205 case $FP_MACOSX_DEPLOYMENT_TARGET in
1207 10.4) MACOSX_DEPLOYMENT_VERSION=10.4
1208 MACOSX_DEPLOYMENT_SDK=/Developer/SDKs/MacOSX10.4u.sdk
1210 10.4u) MACOSX_DEPLOYMENT_VERSION=10.4
1211 MACOSX_DEPLOYMENT_SDK=/Developer/SDKs/MacOSX10.4u.sdk
1213 *) MACOSX_DEPLOYMENT_VERSION=$FP_MACOSX_DEPLOYMENT_TARGET
1214 MACOSX_DEPLOYMENT_SDK=/Developer/SDKs/MacOSX${FP_MACOSX_DEPLOYMENT_TARGET}.sdk
1217 if test "x$FP_MACOSX_DEPLOYMENT_TARGET" = "xnone"; then
1220 if test ! -d $MACOSX_DEPLOYMENT_SDK; then
1221 AC_MSG_ERROR([Unknown deployment target $FP_MACOSX_DEPLOYMENT_TARGET])
1223 AC_MSG_RESULT([${MACOSX_DEPLOYMENT_VERSION} (${MACOSX_DEPLOYMENT_SDK})])
1228 # --------------------------------------------------------------
1229 # Calculate absolute path to build tree
1230 # --------------------------------------------------------------
1232 AC_DEFUN([FP_FIND_ROOT],[
1233 AC_MSG_CHECKING(for path to top of build tree)
1236 dnl make -C utils/pwd clean && make -C utils/pwd
1237 dnl except we don't want to have to know what make is called. Sigh.
1238 if test ! -f utils/pwd/pwd && test ! -f utils/pwd/pwd.exe; then
1244 $WithGhc -v0 --make pwd -o pwd
1248 hardtop=`utils/pwd/pwd forwardslash`
1250 if ! test -d "$hardtop"; then
1251 AC_MSG_ERROR([cannot determine current directory])
1254 dnl Remove common automounter nonsense
1256 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|'`
1260 AC_MSG_RESULT(${hardtop})
1262 # We don't support building in directories with spaces.
1264 *' '*) AC_MSG_ERROR([
1265 The build system does not support building in a directory containing
1266 space characters. Suggestion: move the build tree somewhere else.])