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