Remove redundant fromIntegral calls
[ghc-hetmet.git] / configure.ac
1 dnl == autoconf source for the Glasgow FP tools ==
2 dnl (run "grep '^dnl \*' configure.ac | sed -e 's/dnl / /g; s/\*\*/   +/g;'"
3 dnl  (or some such) to see the outline of this file)
4 dnl
5 #
6 # (c) The University of Glasgow 1994-2004
7 #
8 # Configure script template for GHC
9 #
10 # Process with 'autoreconf' to get a working configure script.
11 #
12 # For the generated configure script, do "./configure --help" to
13 # see what flags are available. (Better yet, read the documentation!)
14 #
15
16 AC_INIT([The Glorious Glasgow Haskell Compilation System], [6.9], [glasgow-haskell-bugs@haskell.org], [ghc])
17
18 # Set this to YES for a released version, otherwise NO
19 : ${RELEASE=NO}
20
21 # The primary version (e.g. 6.7, 6.6.1) is set in the AC_INIT line
22 # above.  If this is not a released version, then we will append the
23 # date to the version number (e.g. 6.7.20070204).  The date is
24 # constructed by finding the date of the most recent patch in the
25 # darcs repository.  If this is a source distribution (not a darcs
26 # checkout), then we ship a file 'VERSION' containing the full version
27 # when the source distribution was created.
28
29 if test ! -f mk/config.h.in; then
30    echo "mk/config.h.in doesn't exist: perhaps you haven't run 'sh boot'?"
31    exit 1
32 fi
33
34 AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args])
35
36 FP_SETUP_PROJECT_VERSION
37
38 # Hmmm, we fix the RPM release number to 1 here... Is this convenient?
39 AC_SUBST([release], [1])
40
41 # First off, a distrib sanity check..
42 AC_CONFIG_SRCDIR([mk/config.mk.in])
43
44 dnl * We require autoconf version 2.52
45 dnl We need 2.50 due to the use of AC_SYS_LARGEFILE and AC_MSG_NOTICE.
46 dnl We need 2.52 due to the use of AS_TR_CPP and AS_TR_SH.
47 AC_PREREQ([2.52])
48
49 # -------------------------------------------------------------------------
50 # Prepare to generate the following header files
51 #
52 #
53 AC_CONFIG_HEADER(mk/config.h)
54
55 # No, semi-sadly, we don't do `--srcdir'...
56 if test x"$srcdir" != 'x.' ; then
57     echo "This configuration does not support the \`--srcdir' option.."
58     exit 1
59 fi
60
61 dnl--------------------------------------------------------------------
62 dnl * Deal with arguments telling us gmp is somewhere odd
63 dnl--------------------------------------------------------------------
64
65 FP_ARG_GMP
66
67 GMP_INCLUDE_DIRS=
68 GMP_LIB_DIRS=
69 if test "x$gmp_libraries" != "xNONE"; then
70   LDFLAGS="-L$gmp_libraries $LDFLAGS"
71   GMP_LIB_DIRS=$gmp_libraries
72 fi
73 if test "x$gmp_includes" != "xNONE"; then
74   CPPFLAGS="-I$gmp_includes $CPPFLAGS"
75   GMP_INCLUDE_DIRS=$gmp_includes
76 fi
77 AC_SUBST(GMP_INCLUDE_DIRS)
78 AC_SUBST(GMP_LIB_DIRS)
79
80 dnl--------------------------------------------------------------------
81 dnl * Choose host(/target/build) platform
82 dnl--------------------------------------------------------------------
83
84 dnl Guess host/target/build platform(s) if necessary.
85 AC_CANONICAL_TARGET
86
87 # "$host" defaults to "$target"
88 if test "x$host" = xNONE ; then
89     host=$target
90 fi
91
92 dnl ** canonicalize platform names
93 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
94 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
95 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
96
97 if test x"$TargetPlatform" != x"$HostPlatform" ; then
98     echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
99     exit 1
100 fi
101
102 exeext=''
103 soext='.so'
104 #
105 # The following will be more difficult when we *are* cross-compiling.
106 # Suitable names to slam in *_CPP are in platform.h.in.
107 # We also record the architecture, vendor, and operating system (OS)
108 # separately.
109 case $HostPlatform in
110 alpha*-dec-osf[[12]]*)
111         HostPlatform=alpha-dec-osf1   # canonicalise for our purposes
112         TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
113         BuildPlatform=alpha-dec-osf1  # hack
114         HostPlatform_CPP='alpha_dec_osf1'
115         HostArch_CPP='alpha'
116         HostVendor_CPP='dec'
117         HostOS_CPP='osf1'
118         ;;
119 alpha*-dec-osf[[345]]*)
120         HostPlatform=alpha-dec-osf3   # canonicalise for our purposes
121         TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
122         BuildPlatform=alpha-dec-osf3  # hack
123         HostPlatform_CPP='alpha_dec_osf3'
124         HostArch_CPP='alpha'
125         HostVendor_CPP='dec'
126         HostOS_CPP='osf3'
127         ;;
128 alpha*-unknown-linux*)
129         HostPlatform=alpha-unknown-linux
130         TargetPlatform=alpha-unknown-linux
131         BuildPlatform=alpha-unknown-linux
132         HostPlatform_CPP='alpha_unknown_linux'
133         HostArch_CPP='alpha'
134         HostVendor_CPP='unknown'
135         HostOS_CPP='linux'
136         ;;
137 alpha*-unknown-freebsd*)
138         HostPlatform=alpha-unknown-freebsd
139         TargetPlatform=alpha-unknown-freebsd
140         BuildPlatform=alpha-unknown-freebsd
141         HostPlatform_CPP='alpha_unknown_freebsd'
142         HostArch_CPP='alpha'
143         HostVendor_CPP='unknown'
144         HostOS_CPP='freebsd'
145         ;;
146 alpha*-unknown-openbsd*)
147         HostPlatform=alpha-unknown-openbsd
148         TargetPlatform=alpha-unknown-openbsd
149         BuildPlatform=alpha-unknown-openbsd
150         HostPlatform_CPP='alpha_unknown_openbsd'
151         HostArch_CPP='alpha'
152         HostVendor_CPP='unknown'
153         HostOS_CPP='openbsd'
154         ;;
155 amd64-*-openbsd*|x86_64-*-openbsd*)
156         HostPlatform=x86_64-unknown-openbsd
157         TargetPlatform=x86_64-unknown-openbsd
158         BuildPlatform=x86_64-unknown-openbsd
159         HostPlatform_CPP='x86_64_unknown_openbsd'
160         HostArch_CPP='x86_64'
161         HostVendor_CPP='unknown'
162         HostOS_CPP='openbsd'
163         ;;
164 amd64-*-freebsd*|x86_64-*-freebsd*)
165         HostPlatform=x86_64-unknown-freebsd
166         TargetPlatform=x86_64-unknown-freebsd
167         BuildPlatform=x86_64-unknown-freebsd
168         HostPlatform_CPP='x86_64_unknown_freebsd'
169         HostArch_CPP='x86_64'
170         HostVendor_CPP='unknown'
171         HostOS_CPP='freebsd'
172         ;;
173 amd64-*-netbsd*|x86_64-*-netbsd*)
174         HostPlatform=x86_64-unknown-netbsd
175         TargetPlatform=x86_64-unknown-netbsd
176         BuildPlatform=x86_64-unknown-netbsd
177         HostPlatform_CPP='x86_64_unknown_netbsd'
178         HostArch_CPP='x86_64'
179         HostVendor_CPP='unknown'
180         HostOS_CPP='netbsd'
181         ;;
182 arm*-linux*)
183         HostPlatform=arm-unknown-linux # hack again
184         TargetPlatform=arm-unknown-linux
185         BuildPlatform=arm-unknown-linux
186         HostPlatform_CPP='arm_unknown_linux'
187         HostArch_CPP='arm'
188         HostVendor_CPP='unknown'
189         HostOS_CPP='linux'
190         ;;
191 arm*-openbsd*)
192         HostPlatform=arm-unknown-openbsd
193         TargetPlatform=arm-unknown-openbsd
194         BuildPlatform=arm-unknown-openbsd
195         HostPlatform_CPP='arm_unknown_openbsd'
196         HostArch_CPP='arm'
197         HostVendor_CPP='unknown'
198         HostOS_CPP='openbsd'
199         ;;
200 hppa*-*-linux*)
201         HostPlatform=hppa-unknown-linux # hack again
202         TargetPlatform=hppa-unknown-linux
203         BuildPlatform=hppa-unknown-linux
204         HostPlatform_CPP='hppa_unknown_linux'
205         HostArch_CPP='hppa'
206         HostVendor_CPP='unknown'
207         HostOS_CPP='linux'
208         ;;
209 hppa*-*-openbsd*)
210         HostPlatform=hppa-unknown-openbsd # hack again
211         TargetPlatform=hppa-unknown-openbsd
212         BuildPlatform=hppa-unknown-openbsd
213         HostPlatform_CPP='hppa_unknown_openbsd'
214         HostArch_CPP='hppa'
215         HostVendor_CPP='unknown'
216         HostOS_CPP='openbsd'
217         ;;
218 hppa1.1-hp-hpux*)
219         HostPlatform=hppa1.1-hp-hpux  # canonicalise for our purposes (hack)
220         TargetPlatform=hppa1.1-hp-hpux
221         BuildPlatform=hppa1.1-hp-hpux
222         HostPlatform_CPP='hppa1_1_hp_hpux'
223         HostArch_CPP='hppa1_1'
224         HostVendor_CPP='hp'
225         HostOS_CPP='hpux'
226         ;;
227 i[[3456]]86-*-linuxaout*)
228         HostPlatform=i386-unknown-linuxaout   # hack again
229         TargetPlatform=i386-unknown-linuxaout
230         BuildPlatform=i386-unknown-linuxaout
231         HostPlatform_CPP='i386_unknown_linuxaout'
232         HostArch_CPP='i386'
233         HostVendor_CPP='unknown'
234         HostOS_CPP='linuxaout'
235         ;;
236 i[[3456]]86-*-linux*)
237         HostPlatform=i386-unknown-linux # hack again
238         TargetPlatform=i386-unknown-linux
239         BuildPlatform=i386-unknown-linux
240         HostPlatform_CPP='i386_unknown_linux'
241         HostArch_CPP='i386'
242         HostVendor_CPP='unknown'
243         HostOS_CPP='linux'
244         ;;
245 i[[3456]]86-*-kfreebsd*-gnu)
246         HostPlatform=i386-unknown-kfreebsdgnu # hack again
247         TargetPlatform=i386-unknown-kfreebsdgnu
248         BuildPlatform=i386-unknown-kfreebsdgnu
249         HostPlatform_CPP='i386_unknown_kfreebsdgnu'
250         HostArch_CPP='i386'
251         HostVendor_CPP='unknown'
252         HostOS_CPP='kfreebsdgnu'
253         ;;
254 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
255         HostPlatform=i386-unknown-freebsd # hack again
256         TargetPlatform=i386-unknown-freebsd
257         BuildPlatform=i386-unknown-freebsd
258         HostPlatform_CPP='i386_unknown_freebsd'
259         HostArch_CPP='i386'
260         HostVendor_CPP='unknown'
261         HostOS_CPP='freebsd'
262         ;;
263 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
264         HostPlatform=i386-unknown-freebsd2 # hack again
265         TargetPlatform=i386-unknown-freebsd2
266         BuildPlatform=i386-unknown-freebsd2
267         HostPlatform_CPP='i386_unknown_freebsd2'
268         HostArch_CPP='i386'
269         HostVendor_CPP='unknown'
270         HostOS_CPP='freebsd2'
271         ;;
272 i[[3456]]86-*-netbsd*)
273         HostPlatform=i386-unknown-netbsd # hack again
274         TargetPlatform=i386-unknown-netbsd
275         BuildPlatform=i386-unknown-netbsd
276         HostPlatform_CPP='i386_unknown_netbsd'
277         HostArch_CPP='i386'
278         HostVendor_CPP='unknown'
279         HostOS_CPP='netbsd'
280         ;;
281 i[[3456]]86-*-openbsd*)
282         HostPlatform=i386-unknown-openbsd # hack again
283         TargetPlatform=i386-unknown-openbsd
284         BuildPlatform=i386-unknown-openbsd
285         HostPlatform_CPP='i386_unknown_openbsd'
286         HostArch_CPP='i386'
287         HostVendor_CPP='unknown'
288         HostOS_CPP='openbsd'
289         ;;
290 i[[3456]]86-*-solaris2*)
291         HostPlatform=i386-unknown-solaris2 # hack again
292         TargetPlatform=i386-unknown-solaris2
293         BuildPlatform=i386-unknown-solaris2
294         HostPlatform_CPP='i386_unknown_solaris2'
295         HostArch_CPP='i386'
296         HostVendor_CPP='unknown'
297         HostOS_CPP='solaris2'
298         ;;
299 i[[3456]]86-*-cygwin*)
300         HostPlatform=i386-unknown-cygwin32 # hack again
301         TargetPlatform=i386-unknown-cygwin32
302         BuildPlatform=i386-unknown-cygwin32
303         HostPlatform_CPP='i386_unknown_cygwin32'
304         HostArch_CPP='i386'
305         HostVendor_CPP='unknown'
306         HostOS_CPP='cygwin32'
307         exeext='.exe'
308         soext='.dll'
309         ;;
310 i[[3456]]86-*-mingw32*)
311         HostPlatform=i386-unknown-mingw32 # hack again
312         TargetPlatform=i386-unknown-mingw32
313         BuildPlatform=i386-unknown-mingw32
314         HostPlatform_CPP='i386_unknown_mingw32'
315         HostArch_CPP='i386'
316         HostVendor_CPP='unknown'
317         HostOS_CPP='mingw32'
318         exeext='.exe'
319         soext='.dll'
320         ;;
321 i[[3456]]86-apple-darwin*)
322         HostPlatform=i386-apple-darwin
323         TargetPlatform=i386-apple-darwin #hack
324         BuildPlatform=i386-apple-darwin #hack
325         HostPlatform_CPP='i386_apple_darwin'
326         HostArch_CPP='i386'
327         HostVendor_CPP='apple'
328         HostOS_CPP='darwin'
329         soext='.dylib'
330         ;;
331 i[[3456]]86-*-gnu*)
332         HostPlatform=i386-unknown-gnu
333         TargetPlatform=i386-unknown-gnu
334         BuildPlatform=i386-unknown-gnu
335         HostPlatform_CPP=i386_unknown_gnu
336         HostArch_CPP=i386
337         HostVendor_CPP=unknown
338         HostOS_CPP=gnu
339         ;;
340 ia64-*-linux*)
341         HostPlatform=ia64-unknown-linux # hack again
342         TargetPlatform=ia64-unknown-linux
343         BuildPlatform=ia64-unknown-linux
344         HostPlatform_CPP='ia64_unknown_linux'
345         HostArch_CPP='ia64'
346         HostVendor_CPP='unknown'
347         HostOS_CPP='linux'
348         ;;
349 x86_64-*-linux*)
350         HostPlatform=x86_64-unknown-linux
351         TargetPlatform=x86_64-unknown-linux
352         BuildPlatform=x86_64-unknown-linux
353         HostPlatform_CPP='x86_64_unknown_linux'
354         HostArch_CPP='x86_64'
355         HostVendor_CPP='unknown'
356         HostOS_CPP='linux'
357         ;;
358 x86_64-apple-darwin*)
359         HostPlatform=x86_64-apple-darwin
360         TargetPlatform=x86_64-apple-darwin
361         BuildPlatform=x86_64-apple-darwin
362         HostPlatform_CPP='x86_64_apple_darwin'
363         HostArch_CPP='x86_64'
364         HostVendor_CPP='apple'
365         HostOS_CPP='darwin'
366         soext='.dylib'
367         ;;
368 m68k-*-linux*)
369         HostPlatform=m68k-unknown-linux # hack again
370         TargetPlatform=m68k-unknown-linux
371         BuildPlatform=m68k-unknown-linux
372         HostPlatform_CPP='m68k_unknown_linux'
373         HostArch_CPP='m68k'
374         HostVendor_CPP='unknown'
375         HostOS_CPP='linux'
376         ;;
377 m68k-next-nextstep2)
378         HostPlatform_CPP='m68k_next_nextstep2'
379         HostArch_CPP='m68k'
380         HostVendor_CPP='next'
381         HostOS_CPP='nextstep2'
382         ;;
383 m68k-next-nextstep3)
384         HostPlatform_CPP='m68k_next_nextstep3'
385         HostArch_CPP='m68k'
386         HostVendor_CPP='next'
387         HostOS_CPP='nextstep3'
388         ;;
389 i[[3456]]86-next-nextstep3)
390         HostPlatform=i386-next-nextstep3 # hack again
391         TargetPlatform=i386-next-nextstep3
392         BuildPlatform=i386-next-nextstep3
393         HostPlatform_CPP='i386_next_nextstep3'
394         HostArch_CPP='i386'
395         HostVendor_CPP='next'
396         HostOS_CPP='nextstep3'
397         ;;
398 m68k-*-openbsd*)
399         HostPlatform=m68k-unknown-openbsd
400         TargetPlatform=m68k-unknown-openbsd
401         BuildPlatform=m68k-unknown-openbsd
402         HostPlatform_CPP='m68k_unknown_openbsd'
403         HostArch_CPP='m68k'
404         HostVendor_CPP='unknown'
405         HostOS_CPP='openbsd'
406         ;;
407 m68k-*-netbsd*)
408         HostPlatform=m68k-unknown-netbsd
409         TargetPlatform=m68k-unknown-netbsd
410         BuildPlatform=m68k-unknown-netbsd
411         HostPlatform_CPP='m68k_unknown_netbsd'
412         HostArch_CPP='m68k'
413         HostVendor_CPP='unknown'
414         HostOS_CPP='netbsd'
415         ;;
416 m68k-sun-sunos4*)
417         HostPlatform=m68k-sun-sunos4
418         TargetPlatform=m68k-sun-sunos4 #hack
419         BuildPlatform=m68k-sun-sunos4 #hack
420         HostPlatform_CPP='m68k_sun_sunos4'
421         HostArch_CPP='m68k'
422         HostVendor_CPP='sun'
423         HostOS_CPP='sunos4'
424         ;;
425 m88k-*-openbsd*)
426         HostPlatform=m88k-unknown-openbsd
427         TargetPlatform=m88k-unknown-openbsd
428         BuildPlatform=m88k-unknown-openbsd
429         HostPlatform_CPP='m88k_unknown_openbsd'
430         HostArch_CPP='m88k'
431         HostVendor_CPP='unknown'
432         HostOS_CPP='openbsd'
433         ;;
434 mips-*-linux*)
435         HostPlatform=mips-unknown-linux # hack again
436         TargetPlatform=mips-unknown-linux
437         BuildPlatform=mips-unknown-linux
438         HostPlatform_CPP='mips_unknown_linux'
439         HostArch_CPP='mips'
440         HostVendor_CPP='unknown'
441         HostOS_CPP='linux'
442         ;;
443 mipsel-*-linux*)
444         HostPlatform=mipsel-unknown-linux # hack again
445         TargetPlatform=mipsel-unknown-linux
446         BuildPlatform=mipsel-unknown-linux
447         HostPlatform_CPP='mipsel_unknown_linux'
448         HostArch_CPP='mipsel'
449         HostVendor_CPP='unknown'
450         HostOS_CPP='linux'
451         ;;
452 mips-dec-ultrix*)
453         HostPlatform_CPP='mips_dec_ultrix'
454         HostArch_CPP='mipsel'   # NB a little different
455         HostVendor_CPP='dec'
456         HostOS_CPP='ultrix'
457         ;;
458 mips-sgi-irix*)
459         HostPlatform=mips-sgi-irix
460         TargetPlatform=mips-sgi-irix #hack
461         BuildPlatform=mips-sgi-irix #hack
462         HostPlatform_CPP='mips_sgi_irix'
463         HostArch_CPP='mipseb'   # NB a little different
464         HostVendor_CPP='sgi'
465         HostOS_CPP='irix'
466         ;;
467 rs6000-ibm-aix*)
468         HostPlatform=rs6000-ibm-aix
469         TargetPlatform=rs6000-ibm-aix #hack
470         BuildPlatform=rs6000-ibm-aix #hack
471         HostPlatform_CPP='rs6000_ibm_aix'
472         HostArch_CPP='rs6000'
473         HostVendor_CPP='ibm'
474         HostOS_CPP='aix'
475         ;;
476 powerpc-ibm-aix*)
477         HostPlatform=powerpc-ibm-aix
478         TargetPlatform=powerpc-ibm-aix #hack
479         BuildPlatform=powerpc-ibm-aix #hack
480         HostPlatform_CPP='powerpc_ibm_aix'
481         HostArch_CPP='powerpc'
482         HostVendor_CPP='ibm'
483         HostOS_CPP='aix'
484         ;;
485 powerpc-apple-darwin*)
486         HostPlatform=powerpc-apple-darwin
487         TargetPlatform=powerpc-apple-darwin #hack
488         BuildPlatform=powerpc-apple-darwin #hack
489         HostPlatform_CPP='powerpc_apple_darwin'
490         HostArch_CPP='powerpc'
491         HostVendor_CPP='apple'
492         HostOS_CPP='darwin'
493         soext='.dylib'
494         ;;
495 powerpc-unknown-linux*)
496         HostPlatform=powerpc-unknown-linux
497         TargetPlatform=powerpc-unknown-linux
498         BuildPlatform=powerpc-unknown-linux
499         HostPlatform_CPP='powerpc_unknown_linux'
500         HostArch_CPP='powerpc'
501         HostVendor_CPP='unknown'
502         HostOS_CPP='linux'
503         ;;
504 powerpc-unknown-openbsd*)
505         HostPlatform=powerpc-unknown-openbsd
506         TargetPlatform=powerpc-unknown-openbsd
507         BuildPlatform=powerpc-unknown-openbsd
508         HostPlatform_CPP='powerpc_unknown_openbsd'
509         HostArch_CPP='powerpc'
510         HostVendor_CPP='unknown'
511         HostOS_CPP='openbsd'
512         ;;
513 powerpc64-unknown-linux*)
514         HostPlatform=powerpc64-unknown-linux
515         TargetPlatform=powerpc64-unknown-linux
516         BuildPlatform=powerpc64-unknown-linux
517         HostPlatform_CPP='powerpc64_unknown_linux'
518         HostArch_CPP='powerpc64'
519         HostVendor_CPP='unknown'
520         HostOS_CPP='linux'
521         ;;
522
523 s390-ibm-linux*)
524        HostPlatform=s390-ibm-linux
525        TargetPlatform=s390-ibm-linux #hack
526        BuildPlatform=s390-ibm-linux #hack
527         HostPlatform_CPP='s390_ibm_linux'
528         HostArch_CPP='s390'
529         HostVendor_CPP='ibm'
530         HostOS_CPP='linux'
531         ;;
532 sparc-sun-sunos4*)
533         HostPlatform=sparc-sun-sunos4
534         TargetPlatform=sparc-sun-sunos4 #hack
535         BuildPlatform=sparc-sun-sunos4 #hack
536         HostPlatform_CPP='sparc_sun_sunos4'
537         HostArch_CPP='sparc'
538         HostVendor_CPP='sun'
539         HostOS_CPP='sunos4'
540         ;;
541 sparc-sun-solaris2*)
542         HostPlatform=sparc-sun-solaris2
543         TargetPlatform=sparc-sun-solaris2 #hack
544         BuildPlatform=sparc-sun-solaris2 #hack
545         HostPlatform_CPP='sparc_sun_solaris2'
546         HostArch_CPP='sparc'
547         HostVendor_CPP='sun'
548         HostOS_CPP='solaris2'
549         ;;
550 sparc*-linux*)
551         HostPlatform=sparc-unknown-linux
552         TargetPlatform=sparc-unknown-linux
553         BuildPlatform=sparc-unknown-linux
554         HostPlatform_CPP='sparc_unknown_linux'
555         HostArch_CPP='sparc'
556         HostVendor_CPP='unknown'
557         HostOS_CPP='linux'
558         ;;
559 sparc-*-openbsd*)
560         HostPlatform=sparc-unknown-openbsd
561         TargetPlatform=sparc-unknown-openbsd
562         BuildPlatform=sparc-unknown-openbsd
563         HostPlatform_CPP='sparc_unknown_openbsd'
564         HostArch_CPP='sparc'
565         HostVendor_CPP='unknown'
566         HostOS_CPP='openbsd'
567         ;;
568 sparc64-*-openbsd*)
569         HostPlatform=sparc64-unknown-openbsd
570         TargetPlatform=sparc64-unknown-openbsd
571         BuildPlatform=sparc64-unknown-openbsd
572         HostPlatform_CPP='sparc64_unknown_openbsd'
573         HostArch_CPP='sparc64'
574         HostVendor_CPP='unknown'
575         HostOS_CPP='openbsd'
576         ;;
577 vax-*-openbsd*)
578         HostPlatform=vax-unknown-openbsd
579         TargetPlatform=vax-unknown-openbsd
580         BuildPlatform=vax-unknown-openbsd
581         HostPlatform_CPP='vax_unknown_openbsd'
582         HostArch_CPP='vax'
583         HostVendor_CPP='unknown'
584         HostOS_CPP='openbsd'
585         ;;
586 *)
587         echo "Unrecognised platform: $HostPlatform"
588         exit 1
589         ;;
590 esac
591 echo "Canonicalised to: $HostPlatform"
592 test  x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
593 test  x"$BuildPlatform" != x"$HostPlatform"  && echo "Build platform set to $BuildPlatform"
594
595 BuildPlatform_CPP=$HostPlatform_CPP
596 TargetPlatform_CPP=$HostPlatform_CPP
597 BuildArch_CPP=$HostArch_CPP
598 TargetArch_CPP=$HostArch_CPP
599 BuildOS_CPP=$HostOS_CPP
600 HostOS_Full=$host_os
601 TargetOS_CPP=$HostOS_CPP
602 BuildVendor_CPP=$HostVendor_CPP
603 TargetVendor_CPP=$HostVendor_CPP
604
605 AC_SUBST(BuildPlatform)
606 AC_SUBST(HostPlatform)
607 AC_SUBST(TargetPlatform)
608 AC_SUBST(HostPlatform_CPP)
609 AC_SUBST(BuildPlatform_CPP)
610 AC_SUBST(TargetPlatform_CPP)
611
612 AC_SUBST(HostArch_CPP)
613 AC_SUBST(BuildArch_CPP)
614 AC_SUBST(TargetArch_CPP)
615
616 AC_SUBST(HostOS_CPP)
617 AC_SUBST(HostOS_Full)
618 AC_SUBST(BuildOS_CPP)
619 AC_SUBST(TargetOS_CPP)
620
621 AC_SUBST(HostVendor_CPP)
622 AC_SUBST(BuildVendor_CPP)
623 AC_SUBST(TargetVendor_CPP)
624
625 AC_SUBST(exeext)
626 AC_SUBST(soext)
627
628 dnl --------------------------------------------------------------
629 dnl * Project specific configuration options
630 dnl --------------------------------------------------------------
631 dnl What follows is a bunch of options that can either be configured
632 dnl through command line options to the configure script or by
633 dnl supplying defns in the build tree's mk/build.mk. Having the option to
634 dnl use either is considered a Feature.
635
636 dnl ** What command to use to compile compiler sources ?
637 dnl --------------------------------------------------------------
638
639 AC_ARG_WITH([ghc],
640 [AC_HELP_STRING([--with-ghc=ARG],
641   [Use ARG as the path to GHC  [default=autodetect]])],
642   [WithGhc="$withval"],
643   [if test "$GHC" = ""; then
644     AC_PATH_PROG([GHC], [ghc])
645   fi
646   WithGhc="$GHC"])
647 # GHC is passed to Cabal, so we need a native path
648 if test "x$HostPlatform"  = "xi386-unknown-mingw32" && \
649    test "${OSTYPE}"      != "msys"                  && \
650    test "${WithGhc}"     != ""
651 then
652     # Canonicalise to <drive>:/path/to/ghc
653     WithGhc=`cygpath -m ${WithGhc}`
654 fi
655 AC_SUBST([WithGhc])
656
657 AC_ARG_WITH(hc,
658 [AC_HELP_STRING([--with-hc=ARG],
659         [Use ARG as the path to the compiler for compiling ordinary
660          Haskell code  (default= value of --with-ghc)])],
661 [WithHc="$withval"],
662 [WithHc=$WithGhc]
663 )
664 AC_SUBST(WithHc)
665
666 if test "$WithGhc" != ""; then
667   FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
668   AC_SUBST(GhcVersion)dnl
669   AC_SUBST(GhcMajVersion)dnl
670   AC_SUBST(GhcMinVersion)dnl
671   AC_SUBST(GhcPatchLevel)dnl
672   GhcMinVersion2=`echo "$GhcMinVersion" | sed 's/^\\(.\\)$/0\\1/'`
673   GhcCanonVersion="$GhcMajVersion$GhcMinVersion2"
674   if test $GhcCanonVersion -ge 605; then ghc_ge_605=YES; else ghc_ge_605=NO; fi
675   if test $GhcCanonVersion -ge 607; then ghc_ge_607=YES; else ghc_ge_607=NO; fi
676   if test $GhcCanonVersion -ge 609; then ghc_ge_609=YES; else ghc_ge_609=NO; fi
677   AC_SUBST(ghc_ge_605)dnl
678   AC_SUBST(ghc_ge_607)dnl
679   AC_SUBST(ghc_ge_609)dnl
680 fi
681
682 # Check whether this GHC has editline installed
683 FP_GHC_HAS_EDITLINE
684
685 AC_PATH_PROGS(NHC,nhc nhc98)
686 AC_PATH_PROG(HBC,hbc)
687
688 dnl ** Which gcc to use?
689 dnl --------------------------------------------------------------
690 AC_ARG_WITH(gcc,
691 [AC_HELP_STRING([--with-gcc=ARG],
692         [Use ARG as the path to GCC  [default=autodetect]])],
693 [WhatGccIsCalled="$withval"
694  if test "x$HostPlatform"  = "xi386-unknown-mingw32" && \
695     test "${OSTYPE}"      != "msys"                  && \
696     test "${withval}"     != ""
697  then
698      # Canonicalise to <drive>:/path/to/gcc
699      withval=`cygpath -m ${withval}`
700  fi;
701  CC="$withval"
702  export CC
703  ],
704 [WhatGccIsCalled="gcc"]
705 )
706 AC_SUBST(WhatGccIsCalled)
707
708 dnl ** Which ld to use?
709 dnl --------------------------------------------------------------
710 AC_ARG_WITH(ld,
711 [AC_HELP_STRING([--with-ld=ARG],
712         [Use ARG as the path to LD  [default=autodetect]])],
713 [if test "x$HostPlatform"  = "xi386-unknown-mingw32" && \
714     test "${OSTYPE}"      != "msys"                  && \
715     test "${withval}"     != ""
716  then
717      # Canonicalise to <drive>:/path/to/ld
718      withval=`cygpath -m ${withval}`
719  fi;
720  LD=$withval
721  FP_PROG_LD([$LD])
722  ],
723  [FP_PROG_LD()]
724 )
725
726 dnl ** Build shared and/or static libs?
727 dnl --------------------------------------------------------------
728 AC_ARG_ENABLE(shared,
729 [AC_HELP_STRING([--enable-shared],
730 [Build shared libraries, if available. [default=no]])],
731 [ if test x"$enableval" = x"yes"; then
732         BuildSharedLibs=YES
733   else
734         BuildSharedLibs=NO
735   fi
736 ],
737 [BuildSharedLibs=NO]
738 )
739 AC_SUBST(BuildSharedLibs)
740
741 # ToDo later:
742 # AC_ARG_ENABLE(static,
743 # [AC_HELP_STRING([--enable-static],
744 # [Build static libraries. [default=yes]])],
745 # [ if test x"$enableval" = x"yes"; then
746 #         BuildStaticLibs=YES
747 #   else
748 #         BuildStaticLibs=NO
749 #   fi
750 # ],
751 # [BuildStaticLibs=YES]
752 # )
753 # AC_SUBST(BuildStaticLibs)
754
755 dnl ** Booting from .hc files?
756 dnl --------------------------------------------------------------
757 AC_ARG_ENABLE(hc-boot,
758 [AC_HELP_STRING([--enable-hc-boot],
759 [Boot the Glasgow Haskell Compiler from intermediate .hc files.
760  (This option is mostly of interest to porters.) [default=no]])],
761 [ if test x"$enableval" = x"yes"; then
762         BootingFromHc=YES
763   else
764         BootingFromHc=NO
765   fi
766 ],
767 [BootingFromHc=NO]
768 )
769 AC_SUBST(BootingFromHc)
770
771 dnl ** Booting from unregisterised .hc files?
772 dnl --------------------------------------------------------------
773 AC_ARG_ENABLE(hc-boot-unregisterised,
774 [AC_HELP_STRING([--enable-hc-boot-unregisterised],
775 [ With --enable-hc-boot, treat the intermediate .hc files as
776  unregisterised rather than registerised code.
777  (This option is mostly of interest to porters.) [default=no]])],
778 [ if test x"$enableval" = x"yes"; then
779         BootingFromUnregisterisedHc=YES
780   else
781         BootingFromUnregisterisedHc=NO
782   fi
783 ],
784 [BootingFromUnregisterisedHc=NO]
785 )
786 AC_SUBST(BootingFromUnregisterisedHc)
787
788 if test "$BootingFromHc" = "NO"; then
789 if test "$BootingFromUnregisterisedHc" = "YES"; then
790 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
791 fi;
792 fi;
793
794 dnl ** Must have GHC to build GHC, unless --enable-hc-boot is on
795 if test "$BootingFromHc" = "NO" -a -d "$srcdir/compiler"; then
796   if test "$WithGhc" = ""; then
797      AC_MSG_ERROR([GHC is required unless bootstrapping from .hc files.])
798   fi
799   FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[6.4],
800     [AC_MSG_ERROR([GHC version 6.4 or later is required to compile GHC.])])dnl
801 fi;
802
803 # This uses GHC, so put it after the "GHC is required" check above:
804 FP_FIND_ROOT
805
806 dnl ** Enable the construction of Win32 DLLs?
807 dnl --------------------------------------------------------------
808 dnl
809 dnl [ The ability to build the RTS and libraries as separate DLLs used
810 dnl   to be supported, but isn't currently (updates to the RTS, compiler
811 dnl   and build system would be required to bring it back again.)
812 dnl   Hence, exposing it as an option is false advertisement, so better
813 dnl   disable it to avoid confusion (but leave it commented-out rather
814 dnl   than removed in order to remind ourselves to bring back the
815 dnl   feature at some stage.) ]
816 dnl
817 dnl AC_ARG_ENABLE(win32-dlls,
818 dnl [  --enable-win32-dlls
819 dnl         If on a Win32 platform running mingw32/cygwin, enable the
820 dnl         construction of DLLs containing ghc-compiled code.
821 dnl ],
822 dnl [
823 dnl case $HostOS_CPP in
824 dnl cygwin32) ;;
825 dnl mingw32)  ;;
826 dnl *)    echo "Unrecognised win32 platform: $HostPlatform"
827 dnl       exit 1
828 dnl       ;;
829 dnl esac
830 dnl EnableWin32DLLs=YES
831 dnl ],
832 dnl [EnableWin32DLLs=NO]
833 dnl )
834 dnl AC_SUBST(EnableWin32DLLs)
835 dnl if test x"$EnableWin32DLLs" = "xYES" ; then
836 dnl  AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
837 dnl fi
838
839 dnl ** .NET interop support?
840 dnl --------------------------------------------------------------
841 AC_ARG_ENABLE(dotnet,
842 [AC_HELP_STRING([--enable-dotnet],
843 [Build .NET interop layer. [default=no]])],
844 [ if test x"$enableval" = x"yes"; then
845         DotnetSupport=YES; AC_DEFINE([WANT_DOTNET_SUPPORT], [1], [Define to 1 if you want to include .NET interop support.])
846   else
847         DotnetSupport=NO
848   fi],
849 [DotnetSupport=NO]
850 )
851 AC_SUBST(DotnetSupport)
852
853 dnl ** Mac OS X: explicit deployment target
854 dnl --------------------------------------------------------------
855 AC_ARG_WITH([macosx-deployment-target],
856 [AC_HELP_STRING([--with-macosx-deployment-target=VERSION],
857         [Build for Mac OS VERSION and higher  (default= version of build host)])],
858 [FP_MACOSX_DEPLOYMENT_TARGET="$withval"
859  if test "x$TargetOS_CPP-$TargetVendor_CPP" != "xdarwin-apple"; then
860    # ignore everywhere, but on Mac OS
861    AC_MSG_WARN([--macosx-deployment-target is only available on Mac OS X])
862    FP_MACOSX_DEPLOYMENT_TARGET=none
863  fi],
864 [FP_MACOSX_DEPLOYMENT_TARGET=none]
865 )
866 FP_CHECK_MACOSX_DEPLOYMENT_TARGET
867 AC_SUBST(MACOSX_DEPLOYMENT_VERSION)
868 AC_SUBST(MACOSX_DEPLOYMENT_SDK)
869
870 dnl --------------------------------------------------------------
871 dnl End of configure script option section
872 dnl --------------------------------------------------------------
873
874
875 dnl --------------------------------------------------------------
876 dnl * General configuration checks
877 dnl --------------------------------------------------------------
878
879 dnl ** Can the unix package be built?
880 dnl --------------------------------------------------------------
881
882 if test x"$TargetPlatform" = x"i386-unknown-mingw32"; then
883    GhcLibsWithUnix=NO
884 else
885    GhcLibsWithUnix=YES
886 fi
887 AC_SUBST([GhcLibsWithUnix])
888
889 dnl ** does #! work?
890 AC_SYS_INTERPRETER()
891
892 dnl ** look for `perl', but only in /bin on Windows
893 case $HostOS_CPP in
894 cygwin32|mingw32)
895       AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
896       if test -z "$PerlCmd"; then
897          echo "You must install the version of Perl shipped with GHC"
898          echo "(or a compatible one) in /bin."
899          exit 1
900       fi
901    ;;
902 *)
903    AC_PATH_PROG(PerlCmd,perl)
904    if test -z "$PerlCmd"; then
905       echo "You must install perl before you can continue"
906       echo "Perhaps it is already installed, but not in your PATH?"
907       exit 1
908    else
909    FPTOOLS_CHECK_PERL_VERSION
910    fi
911    ;;
912 esac
913
914 dnl ** does #! path/to/perl work? (sometimes it's too long...)
915 FPTOOLS_SHEBANG_PERL
916
917 dnl ** check for Python
918 AC_PATH_PROG(PythonCmd,python)
919
920 dnl ** look for GCC and find out which version
921 dnl     Figure out which C compiler to use.  Gcc is preferred.
922 dnl     If gcc, make sure it's at least 2.1
923 dnl
924 FP_HAVE_GCC
925 FP_MINGW_GCC
926 FP_GCC_EXTRA_FLAGS
927
928 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
929 AC_PROG_CPP
930
931 dnl ** Without optimization some INLINE trickery fails for GHCi
932 SRC_CC_OPTS="-O"
933
934 AC_SUBST(SRC_CC_OPTS)
935
936 dnl ** figure out how to do context diffs
937 FP_PROG_CONTEXT_DIFF
938
939 dnl ** Find find command (for Win32's benefit)
940 FP_PROG_FIND
941
942 dnl ** Find sort command (for the benefit of Win32 environs)
943 FP_PROG_SORT
944
945 dnl Let's make sure install-sh is executable here.  If we got it from
946 dnl a darcs repo, it might not be (see bug #978).
947 chmod +x install-sh
948 dnl ** figure out how to do a BSD-ish install
949 AC_PROG_INSTALL
950
951 dnl If you can run configure, you certainly have /bin/sh
952 AC_DEFINE([HAVE_BIN_SH], [1], [Define to 1 if you have /bin/sh.])
953
954 dnl ** how to invoke `ar' and `ranlib'
955 FP_PROG_AR_NEEDS_RANLIB
956 FP_PROG_AR_SUPPORTS_INPUT
957
958 dnl ** Check to see whether ln -s works
959 AC_PROG_LN_S
960
961
962 dnl ** Find the path to sed
963 AC_PATH_PROG(SedCmd,sed)
964
965
966 dnl ** check for time command
967 AC_PATH_PROG(TimeCmd,time)
968
969 dnl ** check for tar
970 dnl   if GNU tar is named gtar, look for it first.
971 AC_PATH_PROGS(TarCmd,gtar tar,tar)
972
973 AC_PATH_PROG(HSCOLOUR,HsColour)
974 # HsColour is passed to Cabal, so we need a native path
975 if test "x$HostPlatform"  = "xi386-unknown-mingw32" && \
976    test "${OSTYPE}"      != "msys"                  && \
977    test "${HSCOLOUR}"    != ""
978 then
979     # Canonicalise to <drive>:/path/to/gcc
980     HSCOLOUR=`cygpath -m ${HSCOLOUR}`
981 fi
982
983 dnl ** check for DocBook toolchain
984 FP_CHECK_DOCBOOK_DTD
985 FP_DIR_DOCBOOK_XSL([/usr/share/xml/docbook/stylesheet/nwalsh/current /usr/share/xml/docbook/stylesheet/nwalsh /usr/share/xml/docbook/xsl-stylesheets* /usr/share/sgml/docbook/docbook-xsl-stylesheets* /usr/share/sgml/docbook/xsl-stylesheets* /opt/kde?/share/apps/ksgmltools2/docbook/xsl /usr/share/docbook-xsl /usr/share/sgml/docbkxsl /usr/local/share/xsl/docbook /sw/share/xml/xsl/docbook-xsl /opt/local/share/xsl/docbook-xsl])
986 FP_PROG_FO_PROCESSOR
987
988 dnl ** check for ghc-pkg command
989 FP_PROG_GHC_PKG
990
991 AC_ARG_WITH(greencard,
992 [AC_HELP_STRING([--with-greencard=ARG],
993         [Use ARG as the path to greencard  [default=autodetct]])],
994 [
995 GreenCardCmd=$withval;
996 FPTOOLS_GREENCARD(3.00)
997 ]
998 )
999
1000 dnl ** check for installed happy binary + version
1001 dnl    (don't do it if we're booting from .hc files though.)
1002 if test "$BootingFromHc" = "NO"; then
1003 FPTOOLS_HAPPY
1004 fi;
1005
1006 dnl ** check for installed haddock
1007 FPTOOLS_HADDOCK
1008
1009 dnl ** check for installed alex binary + version
1010 dnl    (don't do it if we're booting from .hc files though.)
1011 if test "$BootingFromHc" = "NO"; then
1012 FPTOOLS_ALEX
1013 fi;
1014
1015 dnl --------------------------------------------------
1016 dnl ### program checking section ends here ###
1017 dnl --------------------------------------------------
1018
1019 dnl --------------------------------------------------
1020 dnl * Platform header file and syscall feature tests
1021 dnl ### checking the state of the local header files and syscalls ###
1022
1023 dnl ** check for full ANSI header (.h) files
1024 AC_HEADER_STDC
1025
1026 dnl ** Enable large file support.  NB. do this before testing the type of
1027 dnl    off_t, because it will affect the result of that test.
1028 AC_SYS_LARGEFILE
1029
1030 dnl ** check for specific header (.h) files that we are interested in
1031 AC_CHECK_HEADERS([bfd.h ctype.h dirent.h dlfcn.h errno.h fcntl.h grp.h limits.h locale.h nlist.h pthread.h pwd.h signal.h sys/mman.h sys/resource.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h time.h utime.h windows.h winsock.h])
1032
1033 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
1034 AC_HEADER_TIME
1035
1036 dnl ** do we have long longs?
1037 AC_CHECK_TYPES([long long])
1038
1039 dnl ** what are the sizes of various types
1040 AC_CHECK_SIZEOF(char,               1)
1041 AC_CHECK_SIZEOF(double,             8)
1042 AC_CHECK_SIZEOF(float,              4)
1043 AC_CHECK_SIZEOF(int,                4)
1044 AC_CHECK_SIZEOF(long,               4)
1045 if test "$ac_cv_type_long_long" = yes; then
1046 AC_CHECK_SIZEOF(long long,          8)
1047 fi
1048 AC_CHECK_SIZEOF(short,              2)
1049 AC_CHECK_SIZEOF(unsigned char,      1)
1050 AC_CHECK_SIZEOF(unsigned int,       4)
1051 AC_CHECK_SIZEOF(unsigned long,      4)
1052 if test "$ac_cv_type_long_long" = yes; then
1053 AC_CHECK_SIZEOF(unsigned long long, 8)
1054 fi
1055 AC_CHECK_SIZEOF(unsigned short,     2)
1056 AC_CHECK_SIZEOF(void *,             4)
1057
1058 dnl ** what are alignment constraints on various types
1059 FP_CHECK_ALIGNMENT(char)
1060 FP_CHECK_ALIGNMENT(double)
1061 FP_CHECK_ALIGNMENT(float)
1062 FP_CHECK_ALIGNMENT(int)
1063 FP_CHECK_ALIGNMENT(long)
1064 if test "$ac_cv_type_long_long" = yes; then
1065 FP_CHECK_ALIGNMENT(long long)
1066 fi
1067 FP_CHECK_ALIGNMENT(short)
1068 FP_CHECK_ALIGNMENT(unsigned char)
1069 FP_CHECK_ALIGNMENT(unsigned int)
1070 FP_CHECK_ALIGNMENT(unsigned long)
1071 if test "$ac_cv_type_long_long" = yes; then
1072 FP_CHECK_ALIGNMENT(unsigned long long)
1073 fi
1074 FP_CHECK_ALIGNMENT(unsigned short)
1075 FP_CHECK_ALIGNMENT(void *)
1076
1077 FP_CHECK_FUNC([WinExec],
1078   [@%:@include <windows.h>], [WinExec("",0)])
1079
1080 FP_CHECK_FUNC([GetModuleFileName],
1081   [@%:@include <windows.h>], [GetModuleFileName((HMODULE)0,(LPTSTR)0,0)])
1082
1083 dnl ** check return type of signal handlers
1084 dnl Foo: assumes we can use prototypes.
1085 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1086 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
1087 dnl [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1088 dnl #include <signal.h>
1089 dnl #ifdef signal
1090 dnl #undef signal
1091 dnl #endif
1092 dnl void (*signal (int, void (*)(int)))(int);
1093 dnl ]],
1094 dnl [[int i;]])],
1095 dnl [ac_cv_type_signal_handler=void_int],
1096 dnl [ac_cv_type_signal_handler=int_void])])
1097 dnl if test "$ac_cv_type_signal_handler" = void_int; then
1098 dnl AC_DEFINE(VOID_INT_SIGNALS)
1099 dnl fi
1100
1101 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
1102 AC_TYPE_SIGNAL
1103 if test "$ac_cv_type_signal" = void; then
1104   AC_DEFINE([VOID_INT_SIGNALS], [1], [Define to 1 if signal handlers have type void (*)(int). Otherwise, they're assumed to have type int (*)(void).])
1105 fi
1106
1107 dnl ** check for more functions
1108 dnl ** The following have been verified to be used in ghc/, but might be used somewhere else, too.
1109 AC_CHECK_FUNCS([getclock getrusage gettimeofday setitimer siginterrupt sysconf times ctime_r])
1110 dnl ** On OS X 10.4 (at least), time.h doesn't declare ctime_r if
1111 dnl ** _POSIX_C_SOURCE is defined
1112 AC_CHECK_DECLS([ctime_r], , ,
1113 [#define _POSIX_SOURCE 1
1114 #define _POSIX_C_SOURCE 199506L
1115 #include <time.h>])
1116
1117 dnl ** For ghc/rts/gmp:
1118 AC_CHECK_FUNCS([getpagesize])
1119
1120 dnl ** check whether this machine has gmp3 installed
1121 AC_CHECK_LIB(gmp,  __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
1122   AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr,  HaveLibGmp=YES; LibGmp=gmp3,
1123     HaveLibGmp=NO; LibGmp=not-installed))
1124   if test $HaveLibGmp = YES; then
1125     AC_DEFINE([HAVE_LIB_GMP], [1], [Define to 1 if GMP library is installed.])
1126   fi;
1127 AC_SUBST(HaveLibGmp)
1128 AC_SUBST(LibGmp)
1129
1130 dnl ** (Mac OS X only: check for GMP.framework)
1131 HaveFrameworkGMP=NO
1132 case $HostPlatform in
1133 *-apple-darwin)
1134     AC_MSG_CHECKING([for GMP.framework])
1135     save_libs="$LIBS"
1136     LIBS="-framework GMP"
1137     AC_TRY_LINK_FUNC(__gmpz_fdiv_qr, HaveFrameworkGMP=YES,)
1138     if test $HaveFrameworkGMP = YES; then
1139       AC_DEFINE([HAVE_FRAMEWORK_GMP], [1], [Define to 1 if GMP.framework is installed (Mac OS X only).])
1140     fi;
1141     LIBS="$save_libs"
1142     AC_MSG_RESULT([$HaveFrameworkGMP])
1143     ;;
1144 esac
1145 AC_SUBST(HaveFrameworkGMP)
1146
1147 dnl ** check for mingwex library
1148 AC_CHECK_LIB(mingwex, closedir, HaveLibMingwEx=YES, HaveLibMingwEx=NO)
1149 AC_SUBST(HaveLibMingwEx)
1150
1151 if test $HaveLibMingwEx = YES ; then
1152   AC_DEFINE([HAVE_MINGWEX], [1], [Define to 1 if you have the mingwex library.])
1153 fi
1154
1155 if test "$HaveLibGmp" = "NO"; then
1156 if test "$HostArch_CPP" = "ia64" -o "$HostArch_CPP" = "mipseb" ; then
1157 AC_MSG_ERROR([You need to install libgmp (the in-tree version does not work on IA64 or mips64).])
1158 fi;
1159 fi;
1160
1161 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
1162 dnl    the order of these tests matters: bfd needs liberty
1163 AC_CHECK_LIB(iberty, xmalloc)
1164 AC_CHECK_LIB(bfd,    bfd_init)
1165
1166 dnl ** check for math library
1167 AC_CHECK_FUNC(atan,[fp_libm_not_needed=yes;LIBM=],[fp_libm_not_needed=dunno])
1168 if test x"$fp_libm_not_needed" = xdunno; then
1169    AC_CHECK_LIB([m], [atan], [LIBS="-lm $LIBS"; LIBM="-lm"],[LIBM=])
1170 fi
1171 AC_SUBST([LIBM])
1172
1173 dnl ################################################################
1174 dnl Check for libraries
1175 dnl ################################################################
1176
1177 dnl ** check whether we need -ldl to get dlopen()
1178
1179 AC_CHECK_LIB(dl, dlopen,
1180     [HaveLibDL=YES
1181      AC_DEFINE([HAVE_LIBDL], [1], [Define to 1 if you need -ldl to get dlopen().])
1182      LIBS="$LIBS -ldl"],
1183     [HaveLibDL=NO])
1184 AC_SUBST(HaveLibDL)
1185
1186 dnl --------------------------------------------------
1187 dnl * Miscellaneous feature tests
1188 dnl --------------------------------------------------
1189
1190 dnl ** can we get alloca?
1191 AC_FUNC_ALLOCA
1192
1193 dnl ** Working vfork?
1194 AC_FUNC_FORK
1195
1196 dnl ** determine whether or not const works
1197 AC_C_CONST
1198
1199 dnl ** are we big endian?
1200 AC_C_BIGENDIAN
1201 FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
1202
1203 dnl ** check for leading underscores in symbol names
1204 FP_LEADING_UNDERSCORE
1205
1206 dnl ** check for ld, whether it has an -x option, and if it is GNU ld
1207 FP_PROG_LD_X
1208 FP_PROG_LD_IS_GNU
1209
1210 dnl ** check for Apple-style dead-stripping support
1211 dnl    (.subsections-via-symbols assembler directive)
1212
1213
1214 AC_MSG_CHECKING(for .subsections_via_symbols)
1215 AC_COMPILE_IFELSE(
1216     [AC_LANG_PROGRAM([], [__asm__ (".subsections_via_symbols");])],
1217     [AC_MSG_RESULT(yes)
1218      AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
1219                [Define to 1 if Apple-style dead-stripping is supported.])
1220     ],
1221     [AC_MSG_RESULT(no)])
1222
1223 dnl *** check for GNU non-executable stack note support (ELF only)
1224 dnl     (.section .note.GNU-stack,"",@progbits)
1225
1226 AC_MSG_CHECKING(for GNU non-executable stack support)
1227 AC_COMPILE_IFELSE(
1228     [AC_LANG_PROGRAM([__asm__ (".section .note.GNU-stack,\"\",@progbits");], [0])],
1229     [AC_MSG_RESULT(yes)
1230      AC_DEFINE([HAVE_GNU_NONEXEC_STACK],[1],
1231                [Define to 1 if GNU non-executable stack notes are supported.])
1232     ],
1233     [AC_MSG_RESULT(no)])
1234
1235 dnl ** check for librt
1236 AC_CHECK_LIB(rt, clock_gettime)
1237 AC_CHECK_FUNCS(clock_gettime timer_create timer_settime)
1238 FP_CHECK_TIMER_CREATE
1239
1240 dnl ** check for Apple's "interesting" long double compatibility scheme
1241 AC_MSG_CHECKING(for printf\$LDBLStub)
1242 AC_TRY_LINK_FUNC(printf\$LDBLStub,
1243     [
1244         AC_MSG_RESULT(yes)
1245         AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[1],
1246             [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1247     ],
1248     [
1249         AC_MSG_RESULT(no)
1250         AC_DEFINE([HAVE_PRINTF_LDBLSTUB],[0],
1251             [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).])
1252     ])
1253
1254 # test for GTK+
1255 AC_PATH_PROGS([GTK_CONFIG], [pkg-config])
1256 if test -n "$GTK_CONFIG"; then
1257   if $GTK_CONFIG gtk+-2.0 --atleast-version=2.0; then
1258     GTK_CONFIG="$GTK_CONFIG gtk+-2.0"
1259   else
1260     AC_MSG_WARN([GTK+ not usable, need at least version 2.0])
1261     GTK_CONFIG=
1262   fi
1263 fi
1264 AC_SUBST([GTK_CONFIG])
1265
1266 #Checking for PAPI
1267 AC_CHECK_LIB(papi, PAPI_library_init, HavePapiLib=YES, HavePapiLib=NO)
1268 AC_CHECK_HEADER([papi.h], [HavePapiHeader=YES], [HavePapiHeader=NO])
1269 AC_SUBST(HavePapiLib)
1270 AC_SUBST(HavePapiHeader)
1271
1272 if test "$HavePapiLib" = "YES" -a "$HavePapiHeader" = "YES"; then
1273    HavePapi=YES
1274 else
1275    HavePapi=NO
1276 fi
1277 AC_SUBST(HavePapi)
1278
1279 AC_CONFIG_FILES([mk/config.mk ghc.spec extra-gcc-opts docs/users_guide/ug-book.xml])
1280 AC_CONFIG_COMMANDS([mk/stamp-h],[echo timestamp > mk/stamp-h])
1281 AC_OUTPUT