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