a9b8941ffce33c777acf35a2f0812a7f0249e6b1
[ghc-hetmet.git] / configure.in
1 dnl == autoconf source for the Glasgow FP tools ==
2 dnl (grep for '^dnl' to see the outline of this file)
3 dnl
4 dnl * INITIAL SETUP, CHOICE OF PLATFORM(S)
5 #!/bin/sh
6 #
7 # (c) The AQUA Project, Glasgow University, 1994-1997
8 #
9 # Configure script for the Glasgow functional programming tools
10 # (created automagically by autoconf...do not edit by hand)
11 #
12 # Do "./configure --help" to see what flags are available.
13 # (Better yet, read the documentation!)
14 #
15 # First off, a distrib sanity check..
16 AC_INIT(mk/config.mk.in)
17
18 # -------------------------------------------------------------------------
19 # Prepare to generate the following header files
20 #
21 #
22 AC_CONFIG_HEADER(mk/config.h)
23
24 # No, we don't do `--srcdir'...
25 if test x"$srcdir" != 'x.' ; then
26     echo "This configuration does not support the \`--srcdir' option.."
27     exit 1
28 fi
29
30 #
31 # Remove some automounter nonsense (Glasgow specific gruff)
32 #
33 hardtop=`pwd`
34 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^/grasp_tmp|/local/grasp_tmp|'`
35
36 echo ''
37 echo "*** The top of your build tree is: $hardtop"
38 AC_SUBST(hardtop)
39
40 ####--------------------------------------------------------------------
41 dnl ** choose host(/target/build) platform
42 #
43 # Guess host/target/build platform(s) if necessary.
44 #
45 AC_CANONICAL_SYSTEM
46
47 # "$host" defaults to "$target"
48 if test "x$host" = xNONE ; then
49     host=$target
50 fi
51 # "$build" defaults to "$host"
52 #if test "x$build" = xNONE ; then
53 #    build=$host
54 #else
55 #    echo "This configuration does not support the \`--build' option."
56 #    exit 1
57 #fi
58
59 dnl ** canonicalize platform names
60 # Canonicali[sz]e those babies
61 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
62 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
63 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
64
65 if test x"$TargetPlatform" != x"$HostPlatform" ; then
66     echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
67     exit 1
68 fi
69
70 exeext=''
71 #
72 # The following will be more difficult when we *are* cross-compiling.
73 # Suitable names to slam in *_CPP are in platform.h.in.
74 # We also record the architecture, vendor, and operating system (OS)
75 # separately.
76 case $HostPlatform in
77 alpha-dec-osf[[1234]]*)
78         HostPlatform=alpha-dec-osf1   # canonicalise for our purposes
79         TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
80         BuildPlatform=alpha-dec-osf1  # hack
81         HostPlatform_CPP='alpha_dec_osf1'
82         HostArch_CPP='alpha'
83         HostVendor_CPP='dec'
84         HostOS_CPP='osf1'
85         ;;
86 hppa1.1-hp-hpux*)
87         HostPlatform=hppa1.1-hp-hpux  # canonicalise for our purposes (hack)
88         TargetPlatform=hppa1.1-hp-hpux
89         BuildPlatform=hppa1.1-hp-hpux
90         HostPlatform_CPP='hppa1_1_hp_hpux'
91         HostArch_CPP='hppa1_1'
92         HostVendor_CPP='hp'
93         HostOS_CPP='hpux'
94         ;;
95 i[[3456]]86-*-linuxaout*)
96         HostPlatform=i386-unknown-linuxaout   # hack again
97         TargetPlatform=i386-unknown-linuxaout
98         BuildPlatform=i386-unknown-linuxaout
99         HostPlatform_CPP='i386_unknown_linuxaout'
100         HostArch_CPP='i386'
101         HostVendor_CPP='unknown'
102         HostOS_CPP='linuxaout'
103         ;;
104 i[[3456]]86-*-linux*)
105         HostPlatform=i386-unknown-linux # hack again
106         TargetPlatform=i386-unknown-linux
107         BuildPlatform=i386-unknown-linux
108         HostPlatform_CPP='i386_unknown_linux'
109         HostArch_CPP='i386'
110         HostVendor_CPP='unknown'
111         HostOS_CPP='linux'
112         ;;
113 i[[3456]]86-*-freebsd*)
114         HostPlatform=i386-unknown-freebsd # hack again
115         TargetPlatform=i386-unknown-freebsd
116         BuildPlatform=i386-unknown-freebsd
117         HostPlatform_CPP='i386_unknown_freebsd'
118         HostArch_CPP='i386'
119         HostVendor_CPP='unknown'
120         HostOS_CPP='freebsd'
121         ;;
122 i[[3456]]86-*-netbsd*)
123         HostPlatform=i386-unknown-netbsd # hack again
124         TargetPlatform=i386-unknown-netbsd
125         BuildPlatform=i386-unknown-netbsd
126         HostPlatform_CPP='i386_unknown_netbsd'
127         HostArch_CPP='i386'
128         HostVendor_CPP='unknown'
129         HostOS_CPP='netbsd'
130         ;;
131 i[[3456]]86-*-solaris2*)
132         HostPlatform=i386-unknown-solaris2 # hack again
133         TargetPlatform=i386-unknown-solaris2
134         BuildPlatform=i386-unknown-solaris2
135         HostPlatform_CPP='i386_unknown_solaris2'
136         HostArch_CPP='i386'
137         HostVendor_CPP='unknown'
138         HostOS_CPP='solaris2'
139         ;;
140 i[[3456]]86-*-cygwin32*)
141         HostPlatform=i386-unknown-cygwin32 # hack again
142         TargetPlatform=i386-unknown-cygwin32
143         BuildPlatform=i386-unknown-cygwin32
144         HostPlatform_CPP='i386_unknown_cygwin32'
145         HostArch_CPP='i386'
146         HostVendor_CPP='unknown'
147         HostOS_CPP='cygwin32'
148         exeext='.exe'
149         ;;
150 m68k-next-nextstep2)
151         HostPlatform_CPP='m68k_next_nextstep2'
152         HostArch_CPP='m68k'
153         HostVendor_CPP='next'
154         HostOS_CPP='nextstep2'
155         ;;
156 m68k-next-nextstep3)
157         HostPlatform_CPP='m68k_next_nextstep3'
158         HostArch_CPP='m68k'
159         HostVendor_CPP='next'
160         HostOS_CPP='nextstep3'
161         ;;
162 i[[3456]]86-next-nextstep3)
163         HostPlatform=i386-next-nextstep3 # hack again
164         TargetPlatform=i386-next-nextstep3
165         BuildPlatform=i386-next-nextstep3
166         HostPlatform_CPP='i386_next_nextstep3'
167         HostArch_CPP='i386'
168         HostVendor_CPP='next'
169         HostOS_CPP='nextstep3'
170         ;;
171 m68k-sun-sunos4*)
172         HostPlatform=m68k-sun-sunos4
173         TargetPlatform=m68k-sun-sunos4 #hack
174         BuildPlatform=m68k-sun-sunos4 #hack
175         HostPlatform_CPP='m68k_sun_sunos4'
176         HostArch_CPP='m68k'
177         HostVendor_CPP='sun'
178         HostOS_CPP='sunos4'
179         ;;
180 mips-dec-ultrix*)
181         HostPlatform_CPP='mips_dec_ultrix'
182         HostArch_CPP='mipsel'   # NB a little different
183         HostVendor_CPP='dec'
184         HostOS_CPP='ultrix'
185         ;;
186 mips-sgi-irix*)
187         HostPlatform=mips-sgi-irix
188         TargetPlatform=mips-sgi-irix #hack
189         BuildPlatform=mips-sgi-irix #hack
190         HostPlatform_CPP='mips_sgi_irix'
191         HostArch_CPP='mipseb'   # NB a little different
192         HostVendor_CPP='sgi'
193         HostOS_CPP='irix'
194         ;;
195 rs6000-ibm-aix*)
196         HostPlatform=rs6000-ibm-aix
197         TargetPlatform=rs6000-ibm-aix #hack
198         BuildPlatform=rs6000-ibm-aix #hack
199         HostPlatform_CPP='rs6000_ibm_aix'
200         HostArch_CPP='rs6000'
201         HostVendor_CPP='ibm'
202         HostOS_CPP='aix'
203         ;;
204 powerpc-ibm-aix*)
205         HostPlatform=powerpc-ibm-aix
206         TargetPlatform=powerpc-ibm-aix #hack
207         BuildPlatform=powerpc-ibm-aix #hack
208         HostPlatform_CPP='powerpc_ibm_aix'
209         HostArch_CPP='powerpc'
210         HostVendor_CPP='ibm'
211         HostOS_CPP='aix'
212         ;;
213 sparc-sun-sunos4*)
214         HostPlatform=sparc-sun-sunos4
215         TargetPlatform=sparc-sun-sunos4 #hack
216         BuildPlatform=sparc-sun-sunos4 #hack
217         HostPlatform_CPP='sparc_sun_sunos4'
218         HostArch_CPP='sparc'
219         HostVendor_CPP='sun'
220         HostOS_CPP='sunos4'
221         ;;
222 sparc-sun-solaris2*)
223         HostPlatform=sparc-sun-solaris2
224         TargetPlatform=sparc-sun-solaris2 #hack
225         BuildPlatform=sparc-sun-solaris2 #hack
226         HostPlatform_CPP='sparc_sun_solaris2'
227         HostArch_CPP='sparc'
228         HostVendor_CPP='sun'
229         HostOS_CPP='solaris2'
230         ;;
231 *)
232         echo "Unrecognised platform: $HostPlatform"
233         exit 1
234         ;;
235 esac
236 echo "Canonicalised to: $HostPlatform"
237 test  x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
238 test  x"$BuildPlatform" != x"$HostPlatform"  && echo "Build platform set to $BuildPlatform"
239
240 BuildPlatform_CPP=$HostPlatform_CPP
241 TargetPlatform_CPP=$HostPlatform_CPP
242 BuildArch_CPP=$HostArch_CPP
243 TargetArch_CPP=$HostArch_CPP
244 BuildOS_CPP=$HostOS_CPP
245 HostOS_Full=$host_os
246 TargetOS_CPP=$HostOS_CPP
247 BuildVendor_CPP=$HostVendor_CPP
248 TargetVendor_CPP=$HostVendor_CPP
249
250 dnl Cannot afford all these SUBSTs (because of braindead seds w/ 99 cmd limits)
251 dnl AC_SUBST(BuildPlatform)
252
253 AC_SUBST(HostPlatform)
254 AC_SUBST(TargetPlatform)
255 AC_SUBST(HostPlatform_CPP)
256 dnl AC_SUBST(BuildPlatform_CPP)
257 dnl AC_SUBST(TargetPlatform_CPP)
258
259 AC_SUBST(HostArch_CPP)
260 dnl AC_SUBST(BuildArch_CPP)
261 dnl AC_SUBST(TargetArch_CPP)
262
263 AC_SUBST(HostOS_CPP)
264 AC_SUBST(HostOS_Full)
265 dnl AC_SUBST(BuildOS_CPP)
266 dnl AC_SUBST(TargetOS_CPP)
267
268 AC_SUBST(HostVendor_CPP)
269 dnl AC_SUBST(BuildVendor_CPP)
270 dnl AC_SUBST(TargetVendor_CPP)
271
272 AC_SUBST(exeext)
273
274 # -------------------------------------------------------------------------
275 dnl
276 dnl * _GENERAL_ CONFIGURATION CHECKS
277 #
278
279 #
280 dnl ** does #! work?
281 #
282 AC_SYS_INTERPRETER()
283 #
284 dnl ** look for `perl', but watch out for version 4.035
285 #
286 AC_PATH_PROG(PerlCmd,perl)
287 if test -z "$PerlCmd"; then
288    echo "You must install perl before you can continue"
289    echo "Perhaps it is already installed, but not in your PATH?"
290    exit 1
291 else
292 AC_CHECK_PERL_VERSION
293 fi
294
295 #
296 dnl ** does #!.../perl work? (sometimes it's too long...)
297 #
298 AC_SHEBANG_PERL
299
300 # Remove: we work around the problem in the single place
301 # where we rely on something (getopts) from the libraries.
302 #
303 #dnl ** check if perl library is properly installed
304
305 # (by seeing if a "do 'getopts.pl'" works...
306 #if $PerlCmd -e 'do "getopts.pl" || exit(1); exit(0);' > /dev/null 2>&1 ; then
307 #    :
308 #else
309 #    echo "I think your perl library is misinstalled:"
310 #    echo "The following script did not work:"
311 #    echo '      do "getopts.pl" || exit(1); exit(0);'
312 #    echo 'But, anyway, we will continue in our quest..'
313 #fi
314 #
315
316 #
317 dnl ** look for GCC and find out which version
318 # Figure out which C compiler to use.  Gcc is preferred.
319 # If gcc, make sure it's at least 2.1
320 #
321 AC_PROG_CC
322 AC_HAVE_GCC
323
324 #
325 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
326 #
327 AC_PROG_CPP
328 AC_PROG_GNUCPP
329
330 #
331 dnl ** figure out how to do context diffs
332 #
333 AC_PROG_DIFF
334
335 #
336 dnl ** look for a decent parser generator (bison preferred)
337 #
338 # (AC_PROG_YACCY is AC_PROG_YACC, but with some extra testing 
339 # on the suitability of the 'yacc' returned.)
340 AC_PROG_YACCY
341
342 #
343 dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
344 #
345 AC_PROG_LEX
346
347 #
348 dnl ** figure out how to do a BSD-ish install
349 #
350 AC_PROG_INSTALL
351 #
352 dnl ** how to invoke `ar' and `ranlib'
353 #
354 AC_PROG_AR_AND_RANLIB
355
356 #
357 #
358 dnl ** Check to see whether ln -s works
359 #
360 AC_PROG_LN_S
361
362 #
363 dnl ** Find the path to sed **
364 #
365 AC_PATH_PROG(SedCmd,sed)
366
367 #
368 dnl ** check for time command **
369 AC_PATH_PROG(TimeCmd,time)
370
371 #
372 dnl ** check for tar **
373 #
374 # if GNU tar is named gtar, look for it first.
375 #
376 AC_PATH_PROGS(TarCmd,gtar tar,tar)
377
378 #
379 dnl ** check for gzip/compress **
380 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
381
382 compress_nm=`basename $CompressCmd`
383 if test x"$compress_nm" = xgzip; then
384   CompressCmd="$CompressCmd -d"
385   CompressSuffix="gz"
386 else
387   CompressSuffix="Z"
388 fi
389 AC_SUBST(CompressCmd)
390 AC_SUBST(CompressSuffix)
391
392 #
393 dnl ** check for installed happy binary + version
394 #
395 AC_HAPPY
396
397 if test x"$HappyCmd" != x; then
398    if expr $HappyVersion \< "1.3" >/dev/null; then
399         echo "   Happy Version 1.3 or later is required to compile GHC."
400         echo "   Using the Happy sources in the tree.";
401         HappyCmd=""
402    fi
403 fi
404
405 #
406 #
407 dnl ** check for installed lx binary
408 #
409 AC_PATH_PROG(LxCmd,lx)
410
411 #
412 dnl ** check for installed green-card binary
413 #
414 AC_PATH_PROG(GreencardCmd,green-card)
415
416 #### program checking section ends here ####
417
418 ####--------------------------------------------------
419 #### checking the state of the local header files and syscalls ####
420
421 #
422 dnl ** check for full ANSI header (.h) files
423 #
424 AC_HEADER_STDC
425
426 #
427 dnl ** check for specific header (.h) files that we are interested in
428 #
429 AC_CHECK_HEADERS(dirent.h fcntl.h grp.h malloc.h memory.h nlist.h pwd.h siginfo.h signal.h stdlib.h string.h sys/fault.h sys/file.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/utsname.h sys/vadvise.h sys/wait.h termios.h time.h types.h unistd.h utime.h vfork.h readline/readline.h )
430
431 #
432 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
433 #
434 AC_HEADER_TIME
435 #
436 dnl ** how do we get a timezone name, and UTC offset ?
437 #
438 AC_STRUCT_TIMEZONE
439
440
441 dnl what's the type of timezone?
442 AC_TYPE_TIMEZONE
443
444 #
445 dnl do we have altzone?
446 AC_ALTZONE
447
448 #
449 dnl ** check for specific library functions that we are interested in
450 #
451 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect setitimer stat sysconf timelocal times vadvise vfork)
452
453 #
454 # Misc
455 #
456 dnl ** can we get alloca?
457 AC_FUNC_ALLOCA
458 dnl ** determine whether or not const works
459 AC_C_CONST
460 dnl ** determine the type of signal()
461 AC_TYPE_SIGNAL
462
463 #
464 dnl ** check for leading underscores in symbol names
465 #
466 AC_UNDERSCORE
467
468 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
469
470 echo ''
471 echo '************************************************'
472 echo '*** NOW DO: gmake boot followed by gmake all'
473 echo '***         (where gmake == GNU make)'
474 echo '************************************************'
475 exit 0