[project @ 1997-09-04 19:54:32 by sof]
[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/|/|' | 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 # The following will be more difficult when we *are* cross-compiling.
71 # Suitable names to slam in *_CPP are in platform.h.in.
72 # We also record the architecture, vendor, and operating system (OS)
73 # separately.
74 case $HostPlatform in
75 alpha-dec-osf[[1234]]*)
76         HostPlatform=alpha-dec-osf1   # canonicalise for our purposes
77         TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
78         BuildPlatform=alpha-dec-osf1  # hack
79         HostPlatform_CPP='alpha_dec_osf1'
80         HostArch_CPP='alpha'
81         HostVendor_CPP='dec'
82         HostOS_CPP='osf1'
83         ;;
84 hppa1.1-hp-hpux*)
85         HostPlatform=hppa1.1-hp-hpux  # canonicalise for our purposes (hack)
86         TargetPlatform=hppa1.1-hp-hpux
87         BuildPlatform=hppa1.1-hp-hpux
88         HostPlatform_CPP='hppa1_1_hp_hpux'
89         HostArch_CPP='hppa1_1'
90         HostVendor_CPP='hp'
91         HostOS_CPP='hpux'
92         ;;
93 i[[3456]]86-*-linuxaout*)
94         HostPlatform=i386-unknown-linuxaout   # hack again
95         TargetPlatform=i386-unknown-linuxaout
96         BuildPlatform=i386-unknown-linuxaout
97         HostPlatform_CPP='i386_unknown_linuxaout'
98         HostArch_CPP='i386'
99         HostVendor_CPP='unknown'
100         HostOS_CPP='linuxaout'
101         ;;
102 i[[3456]]86-*-linux*)
103         HostPlatform=i386-unknown-linux # hack again
104         TargetPlatform=i386-unknown-linux
105         BuildPlatform=i386-unknown-linux
106         HostPlatform_CPP='i386_unknown_linux'
107         HostArch_CPP='i386'
108         HostVendor_CPP='unknown'
109         HostOS_CPP='linux'
110         ;;
111 i[[3456]]86-*-freebsd*)
112         HostPlatform=i386-unknown-freebsd # hack again
113         TargetPlatform=i386-unknown-freebsd
114         BuildPlatform=i386-unknown-freebsd
115         HostPlatform_CPP='i386_unknown_freebsd'
116         HostArch_CPP='i386'
117         HostVendor_CPP='unknown'
118         HostOS_CPP='freebsd'
119         ;;
120 i[[3456]]86-*-netbsd*)
121         HostPlatform=i386-unknown-netbsd # hack again
122         TargetPlatform=i386-unknown-netbsd
123         BuildPlatform=i386-unknown-netbsd
124         HostPlatform_CPP='i386_unknown_netbsd'
125         HostArch_CPP='i386'
126         HostVendor_CPP='unknown'
127         HostOS_CPP='netbsd'
128         ;;
129 i[[3456]]86-*-solaris2*)
130         HostPlatform=i386-unknown-solaris2 # hack again
131         TargetPlatform=i386-unknown-solaris2
132         BuildPlatform=i386-unknown-solaris2
133         HostPlatform_CPP='i386_unknown_solaris2'
134         HostArch_CPP='i386'
135         HostVendor_CPP='unknown'
136         HostOS_CPP='solaris2'
137         ;;
138 i[[3456]]86-*-cygwin32*)
139         HostPlatform=i386-unknown-cygwin32 # hack again
140         TargetPlatform=i386-unknown-cygwin32
141         BuildPlatform=i386-unknown-cygwin32
142         HostPlatform_CPP='i386_unknown_cygwin32'
143         HostArch_CPP='i386'
144         HostVendor_CPP='unknown'
145         HostOS_CPP='cygwin32'
146         ;;
147 m68k-next-nextstep2)
148         HostPlatform_CPP='m68k_next_nextstep2'
149         HostArch_CPP='m68k'
150         HostVendor_CPP='next'
151         HostOS_CPP='nextstep2'
152         ;;
153 m68k-next-nextstep3)
154         HostPlatform_CPP='m68k_next_nextstep3'
155         HostArch_CPP='m68k'
156         HostVendor_CPP='next'
157         HostOS_CPP='nextstep3'
158         ;;
159 i[[3456]]86-next-nextstep3)
160         HostPlatform=i386-next-nextstep3 # hack again
161         TargetPlatform=i386-next-nextstep3
162         BuildPlatform=i386-next-nextstep3
163         HostPlatform_CPP='i386_next_nextstep3'
164         HostArch_CPP='i386'
165         HostVendor_CPP='next'
166         HostOS_CPP='nextstep3'
167         ;;
168 m68k-sun-sunos4*)
169         HostPlatform=m68k-sun-sunos4
170         TargetPlatform=m68k-sun-sunos4 #hack
171         BuildPlatform=m68k-sun-sunos4 #hack
172         HostPlatform_CPP='m68k_sun_sunos4'
173         HostArch_CPP='m68k'
174         HostVendor_CPP='sun'
175         HostOS_CPP='sunos4'
176         ;;
177 mips-dec-ultrix*)
178         HostPlatform_CPP='mips_dec_ultrix'
179         HostArch_CPP='mipsel'   # NB a little different
180         HostVendor_CPP='dec'
181         HostOS_CPP='ultrix'
182         ;;
183 mips-sgi-irix*)
184         HostPlatform=mips-sgi-irix
185         TargetPlatform=mips-sgi-irix #hack
186         BuildPlatform=mips-sgi-irix #hack
187         HostPlatform_CPP='mips_sgi_irix'
188         HostArch_CPP='mipseb'   # NB a little different
189         HostVendor_CPP='sgi'
190         HostOS_CPP='irix'
191         ;;
192 rs6000-ibm-aix*)
193         HostPlatform=rs6000-ibm-aix
194         TargetPlatform=rs6000-ibm-aix #hack
195         BuildPlatform=rs6000-ibm-aix #hack
196         HostPlatform_CPP='rs6000_ibm_aix'
197         HostArch_CPP='rs6000'
198         HostVendor_CPP='ibm'
199         HostOS_CPP='aix'
200         ;;
201 powerpc-ibm-aix*)
202         HostPlatform=powerpc-ibm-aix
203         TargetPlatform=powerpc-ibm-aix #hack
204         BuildPlatform=powerpc-ibm-aix #hack
205         HostPlatform_CPP='powerpc_ibm_aix'
206         HostArch_CPP='powerpc'
207         HostVendor_CPP='ibm'
208         HostOS_CPP='aix'
209         ;;
210 sparc-sun-sunos4*)
211         HostPlatform=sparc-sun-sunos4
212         TargetPlatform=sparc-sun-sunos4 #hack
213         BuildPlatform=sparc-sun-sunos4 #hack
214         HostPlatform_CPP='sparc_sun_sunos4'
215         HostArch_CPP='sparc'
216         HostVendor_CPP='sun'
217         HostOS_CPP='sunos4'
218         ;;
219 sparc-sun-solaris2*)
220         HostPlatform=sparc-sun-solaris2
221         TargetPlatform=sparc-sun-solaris2 #hack
222         BuildPlatform=sparc-sun-solaris2 #hack
223         HostPlatform_CPP='sparc_sun_solaris2'
224         HostArch_CPP='sparc'
225         HostVendor_CPP='sun'
226         HostOS_CPP='solaris2'
227         ;;
228 *)
229         echo "Unrecognised platform: $HostPlatform"
230         exit 1
231         ;;
232 esac
233 echo "Canonicalised to: $HostPlatform"
234 test  x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
235 test  x"$BuildPlatform" != x"$HostPlatform"  && echo "Build platform set to $BuildPlatform"
236
237 BuildPlatform_CPP=$HostPlatform_CPP
238 TargetPlatform_CPP=$HostPlatform_CPP
239 BuildArch_CPP=$HostArch_CPP
240 TargetArch_CPP=$HostArch_CPP
241 BuildOS_CPP=$HostOS_CPP
242 HostOS_Full=$host_os
243 TargetOS_CPP=$HostOS_CPP
244 BuildVendor_CPP=$HostVendor_CPP
245 TargetVendor_CPP=$HostVendor_CPP
246
247 dnl Cannot afford all these SUBSTs (because of braindead seds w/ 99 cmd limits)
248 dnl AC_SUBST(BuildPlatform)
249
250 AC_SUBST(HostPlatform)
251 AC_SUBST(TargetPlatform)
252 AC_SUBST(HostPlatform_CPP)
253 dnl AC_SUBST(BuildPlatform_CPP)
254 dnl AC_SUBST(TargetPlatform_CPP)
255
256 AC_SUBST(HostArch_CPP)
257 dnl AC_SUBST(BuildArch_CPP)
258 dnl AC_SUBST(TargetArch_CPP)
259
260 AC_SUBST(HostOS_CPP)
261 AC_SUBST(HostOS_Full)
262 dnl AC_SUBST(BuildOS_CPP)
263 dnl AC_SUBST(TargetOS_CPP)
264
265 AC_SUBST(HostVendor_CPP)
266 dnl AC_SUBST(BuildVendor_CPP)
267 dnl AC_SUBST(TargetVendor_CPP)
268
269 ####--------------------------------------------------------------------
270 dnl
271 dnl * _GENERAL_ CONFIGURATION CHECKS
272 #
273
274 #
275 dnl ** does #! work?
276 #
277 AC_SYS_INTERPRETER()
278 #
279 dnl ** look for `perl', but watch out for version 4.035
280 #
281 AC_PATH_PROG(PerlCmd,perl)
282 if test -z "$PerlCmd"; then
283    echo "You must install perl before you can continue"
284    echo "Perhaps it is already installed, but not in your PATH?"
285    exit 1
286 else
287 AC_CHECK_PERL_VERSION
288 fi
289
290 #
291 dnl ** does #!.../perl work? (sometimes it's too long...)
292 #
293 AC_SHEBANG_PERL
294
295 # Remove: we work around the problem in the single place
296 # where we rely on something (getopts) from the libraries.
297 #
298 #dnl ** check if perl library is properly installed
299
300 # (by seeing if a "do 'getopts.pl'" works...
301 #if $PerlCmd -e 'do "getopts.pl" || exit(1); exit(0);' > /dev/null 2>&1 ; then
302 #    :
303 #else
304 #    echo "I think your perl library is misinstalled:"
305 #    echo "The following script did not work:"
306 #    echo '      do "getopts.pl" || exit(1); exit(0);'
307 #    echo 'But, anyway, we will continue in our quest..'
308 #fi
309 #
310
311 #
312 dnl ** look for GCC and find out which version
313 # Figure out which C compiler to use.  Gcc is preferred.
314 # If gcc, make sure it's at least 2.1
315 #
316 AC_PROG_CC
317 AC_HAVE_GCC
318
319 #
320 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
321 #
322 AC_PROG_CPP
323 AC_PROG_GNUCPP
324
325 #
326 dnl ** figure out how to do context diffs
327 #
328 AC_PROG_DIFF
329
330 #
331 dnl ** look for a decent parser generator (bison preferred)
332 #
333 # (AC_PROG_YACCY is AC_PROG_YACC, but with some extra testing 
334 # on the suitability of the 'yacc' returned.)
335 AC_PROG_YACCY
336
337 #
338 dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
339 #
340 AC_PROG_LEX
341
342 #
343 dnl ** figure out how to do a BSD-ish install
344 #
345 AC_PROG_INSTALL
346 #
347 dnl ** how to invoke `ar' and `ranlib'
348 #
349 AC_PROG_AR_AND_RANLIB
350
351 #
352 #
353 dnl ** Check to see whether ln -s works
354 #
355 AC_PROG_LN_S
356
357 #
358 dnl ** Find the path to sed **
359 #
360 AC_PATH_PROG(SedCmd,sed)
361
362 #
363 dnl ** check for time command **
364 AC_PATH_PROG(TimeCmd,time)
365
366 #
367 dnl ** check for tar **
368 #
369 # if GNU tar is named gtar, look for it first.
370 #
371 AC_PATH_PROGS(TarCmd,gtar tar,tar)
372
373 #
374 dnl ** check for gzip/compress **
375 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
376
377 compress_nm=`basename $CompressCmd`
378 if test x"$compress_nm" = xgzip; then
379   CompressCmd="$CompressCmd -d"
380   CompressSuffix="gz"
381 else
382   CompressSuffix="Z"
383 fi
384 AC_SUBST(CompressCmd)
385 AC_SUBST(CompressSuffix)
386
387 #
388 dnl ** check for installed happy binary + version
389 #
390 AC_HAPPY
391
392 #
393 #
394 dnl ** check for installed lx binary
395 #
396 AC_PATH_PROG(LxCmd,lx)
397
398 #
399 dnl ** check for installed green-card binary
400 #
401 AC_PATH_PROG(GreencardCmd,green-card)
402
403 #### program checking section ends here ####
404
405 ####--------------------------------------------------
406 #### checking the state of the local header files and syscalls ####
407
408 #
409 dnl ** check for full ANSI header (.h) files
410 #
411 AC_HEADER_STDC
412
413 #
414 dnl ** check for specific header (.h) files that we are interested in
415 #
416 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 )
417
418 #
419 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
420 #
421 AC_HEADER_TIME
422 #
423 dnl ** how do we get a timezone name, and UTC offset ?
424 #
425 AC_STRUCT_TIMEZONE
426
427
428 dnl what's the type of timezone?
429 AC_TYPE_TIMEZONE
430
431 #
432 dnl do we have altzone?
433 AC_ALTZONE
434
435 #
436 dnl ** check for specific library functions that we are interested in
437 #
438 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect setitimer stat sysconf timelocal times vadvise vfork)
439
440 #
441 # Misc
442 #
443 dnl ** can we get alloca?
444 AC_FUNC_ALLOCA
445 dnl ** determine whether or not const works
446 AC_C_CONST
447 dnl ** determine the type of signal()
448 AC_TYPE_SIGNAL
449
450 #
451 dnl ** check for leading underscores in symbol names
452 #
453 AC_UNDERSCORE
454
455 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
456
457 echo ''
458 echo '************************************************'
459 echo '*** NOW DO: gmake boot followed by gmake all'
460 echo '***         (where gmake == GNU make)'
461 echo '************************************************'
462 exit 0