[project @ 2000-04-17 11:39:56 by simonmar]
[ghc-hetmet.git] / configure.in
1 dnl == autoconf source for the Glasgow FP tools ==
2 dnl (run "grep '^dnl \*' configure.in | 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-1998
7 #
8 # Configure script template for the Glasgow functional programming tools
9 #
10 # Process with 'autoconf' 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 # First off, a distrib sanity check..
17 AC_INIT(mk/config.mk.in)
18
19 dnl * Declare subdirectories that have a private configure script
20 dnl
21 dnl After the toplevel configuration is complete, the script will recurse into
22 dnl these subdirectories (the use of cache values makes repeated checks cheap)
23 AC_CONFIG_SUBDIRS(ghc)
24
25 # -------------------------------------------------------------------------
26 # Prepare to generate the following header files
27 #
28 #
29 AC_CONFIG_HEADER(mk/config.h)
30
31 # No, semi-sadly, we don't do `--srcdir'...
32 if test x"$srcdir" != 'x.' ; then
33     echo "This configuration does not support the \`--srcdir' option.."
34     exit 1
35 fi
36
37 #
38 # Remove common automounter nonsense + convert from UNC to DOS style paths
39 # (UNC awareness isn't quite there yet for cygwin32-beta18 and consituent tools.)
40 #
41 hardtop=`pwd`
42 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^/grasp_tmp|/local/grasp_tmp|' | sed 's|^//\(.\)/|\1:/|' `
43
44 echo ''
45 echo "*** The top of your build tree is: $hardtop"
46 AC_SUBST(hardtop)
47
48 dnl--------------------------------------------------------------------
49 dnl * Choose host(/target/build) platform
50 dnl--------------------------------------------------------------------
51
52 dnl Guess host/target/build platform(s) if necessary.
53 AC_CANONICAL_SYSTEM
54
55 # "$host" defaults to "$target"
56 if test "x$host" = xNONE ; then
57     host=$target
58 fi
59
60 dnl ** canonicalize platform names
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[[12]]*)
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 alpha-dec-osf[[34]]*)
87         HostPlatform=alpha-dec-osf3   # canonicalise for our purposes
88         TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
89         BuildPlatform=alpha-dec-osf3  # hack
90         HostPlatform_CPP='alpha_dec_osf3'
91         HostArch_CPP='alpha'
92         HostVendor_CPP='dec'
93         HostOS_CPP='osf3'
94         ;;
95 alpha-unknown-linux)
96         HostPlatform=alpha-unknown-linux
97         TargetPlatform=alpha-unknown-linux
98         BuildPlatform=alpha-unknown-linux
99         HostPlatform_CPP='alpha_unknown_linux'
100         HostArch_CPP='alpha'
101         HostVendor_CPP='unknown'
102         HostOS_CPP='linux'
103         ;;
104 alpha-unknown-freebsd*)
105         HostPlatform=alpha-unknown-freebsd
106         TargetPlatform=alpha-unknown-freebsd
107         BuildPlatform=alpha-unknown-freebsd
108         HostPlatform_CPP='alpha_unknown_freebsd'
109         HostArch_CPP='alpha'
110         HostVendor_CPP='unknown'
111         HostOS_CPP='freebsd'
112         ;;
113 hppa1.1-hp-hpux*)
114         HostPlatform=hppa1.1-hp-hpux  # canonicalise for our purposes (hack)
115         TargetPlatform=hppa1.1-hp-hpux
116         BuildPlatform=hppa1.1-hp-hpux
117         HostPlatform_CPP='hppa1_1_hp_hpux'
118         HostArch_CPP='hppa1_1'
119         HostVendor_CPP='hp'
120         HostOS_CPP='hpux'
121         ;;
122 i[[3456]]86-*-linuxaout*)
123         HostPlatform=i386-unknown-linuxaout   # hack again
124         TargetPlatform=i386-unknown-linuxaout
125         BuildPlatform=i386-unknown-linuxaout
126         HostPlatform_CPP='i386_unknown_linuxaout'
127         HostArch_CPP='i386'
128         HostVendor_CPP='unknown'
129         HostOS_CPP='linuxaout'
130         ;;
131 i[[3456]]86-*-linux*)
132         HostPlatform=i386-unknown-linux # hack again
133         TargetPlatform=i386-unknown-linux
134         BuildPlatform=i386-unknown-linux
135         HostPlatform_CPP='i386_unknown_linux'
136         HostArch_CPP='i386'
137         HostVendor_CPP='unknown'
138         HostOS_CPP='linux'
139         ;;
140 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
141         HostPlatform=i386-unknown-freebsd # hack again
142         TargetPlatform=i386-unknown-freebsd
143         BuildPlatform=i386-unknown-freebsd
144         HostPlatform_CPP='i386_unknown_freebsd'
145         HostArch_CPP='i386'
146         HostVendor_CPP='unknown'
147         HostOS_CPP='freebsd'
148         ;;
149 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
150         HostPlatform=i386-unknown-freebsd2 # hack again
151         TargetPlatform=i386-unknown-freebsd2
152         BuildPlatform=i386-unknown-freebsd2
153         HostPlatform_CPP='i386_unknown_freebsd2'
154         HostArch_CPP='i386'
155         HostVendor_CPP='unknown'
156         HostOS_CPP='freebsd2'
157         ;;
158 i[[3456]]86-*-netbsd*)
159         HostPlatform=i386-unknown-netbsd # hack again
160         TargetPlatform=i386-unknown-netbsd
161         BuildPlatform=i386-unknown-netbsd
162         HostPlatform_CPP='i386_unknown_netbsd'
163         HostArch_CPP='i386'
164         HostVendor_CPP='unknown'
165         HostOS_CPP='netbsd'
166         ;;
167 i[[3456]]86-*-solaris2*)
168         HostPlatform=i386-unknown-solaris2 # hack again
169         TargetPlatform=i386-unknown-solaris2
170         BuildPlatform=i386-unknown-solaris2
171         HostPlatform_CPP='i386_unknown_solaris2'
172         HostArch_CPP='i386'
173         HostVendor_CPP='unknown'
174         HostOS_CPP='solaris2'
175         ;;
176 i[[3456]]86-*-cygwin32*)
177         HostPlatform=i386-unknown-cygwin32 # hack again
178         TargetPlatform=i386-unknown-cygwin32
179         BuildPlatform=i386-unknown-cygwin32
180         HostPlatform_CPP='i386_unknown_cygwin32'
181         HostArch_CPP='i386'
182         HostVendor_CPP='unknown'
183         HostOS_CPP='cygwin32'
184         exeext='.exe'
185         ;;
186 i[[3456]]86-*-mingw32*)
187         HostPlatform=i386-unknown-mingw32 # hack again
188         TargetPlatform=i386-unknown-mingw32
189         BuildPlatform=i386-unknown-mingw32
190         HostPlatform_CPP='i386_unknown_mingw32'
191         HostArch_CPP='i386'
192         HostVendor_CPP='unknown'
193         HostOS_CPP='mingw32'
194         exeext='.exe'
195         # We assume you're using mingw32 via the gcc that comes
196         # with cygwin, and not the native port, so let's augment
197         # the gcc command-line used here with -mno-cygwin to
198         # arrange for good things to happen.
199         CFLAGS="-mno-cygwin $CFLAGS"
200         ;;
201 m68k-next-nextstep2)
202         HostPlatform_CPP='m68k_next_nextstep2'
203         HostArch_CPP='m68k'
204         HostVendor_CPP='next'
205         HostOS_CPP='nextstep2'
206         ;;
207 m68k-next-nextstep3)
208         HostPlatform_CPP='m68k_next_nextstep3'
209         HostArch_CPP='m68k'
210         HostVendor_CPP='next'
211         HostOS_CPP='nextstep3'
212         ;;
213 i[[3456]]86-next-nextstep3)
214         HostPlatform=i386-next-nextstep3 # hack again
215         TargetPlatform=i386-next-nextstep3
216         BuildPlatform=i386-next-nextstep3
217         HostPlatform_CPP='i386_next_nextstep3'
218         HostArch_CPP='i386'
219         HostVendor_CPP='next'
220         HostOS_CPP='nextstep3'
221         ;;
222 m68k-sun-sunos4*)
223         HostPlatform=m68k-sun-sunos4
224         TargetPlatform=m68k-sun-sunos4 #hack
225         BuildPlatform=m68k-sun-sunos4 #hack
226         HostPlatform_CPP='m68k_sun_sunos4'
227         HostArch_CPP='m68k'
228         HostVendor_CPP='sun'
229         HostOS_CPP='sunos4'
230         ;;
231 mips-dec-ultrix*)
232         HostPlatform_CPP='mips_dec_ultrix'
233         HostArch_CPP='mipsel'   # NB a little different
234         HostVendor_CPP='dec'
235         HostOS_CPP='ultrix'
236         ;;
237 mips-sgi-irix*)
238         HostPlatform=mips-sgi-irix
239         TargetPlatform=mips-sgi-irix #hack
240         BuildPlatform=mips-sgi-irix #hack
241         HostPlatform_CPP='mips_sgi_irix'
242         HostArch_CPP='mipseb'   # NB a little different
243         HostVendor_CPP='sgi'
244         HostOS_CPP='irix'
245         ;;
246 rs6000-ibm-aix*)
247         HostPlatform=rs6000-ibm-aix
248         TargetPlatform=rs6000-ibm-aix #hack
249         BuildPlatform=rs6000-ibm-aix #hack
250         HostPlatform_CPP='rs6000_ibm_aix'
251         HostArch_CPP='rs6000'
252         HostVendor_CPP='ibm'
253         HostOS_CPP='aix'
254         ;;
255 powerpc-ibm-aix*)
256         HostPlatform=powerpc-ibm-aix
257         TargetPlatform=powerpc-ibm-aix #hack
258         BuildPlatform=powerpc-ibm-aix #hack
259         HostPlatform_CPP='powerpc_ibm_aix'
260         HostArch_CPP='powerpc'
261         HostVendor_CPP='ibm'
262         HostOS_CPP='aix'
263         ;;
264 sparc-sun-sunos4*)
265         HostPlatform=sparc-sun-sunos4
266         TargetPlatform=sparc-sun-sunos4 #hack
267         BuildPlatform=sparc-sun-sunos4 #hack
268         HostPlatform_CPP='sparc_sun_sunos4'
269         HostArch_CPP='sparc'
270         HostVendor_CPP='sun'
271         HostOS_CPP='sunos4'
272         ;;
273 sparc-sun-solaris2*)
274         HostPlatform=sparc-sun-solaris2
275         TargetPlatform=sparc-sun-solaris2 #hack
276         BuildPlatform=sparc-sun-solaris2 #hack
277         HostPlatform_CPP='sparc_sun_solaris2'
278         HostArch_CPP='sparc'
279         HostVendor_CPP='sun'
280         HostOS_CPP='solaris2'
281         ;;
282 *)
283         echo "Unrecognised platform: $HostPlatform"
284         exit 1
285         ;;
286 esac
287 echo "Canonicalised to: $HostPlatform"
288 test  x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
289 test  x"$BuildPlatform" != x"$HostPlatform"  && echo "Build platform set to $BuildPlatform"
290
291 BuildPlatform_CPP=$HostPlatform_CPP
292 TargetPlatform_CPP=$HostPlatform_CPP
293 BuildArch_CPP=$HostArch_CPP
294 TargetArch_CPP=$HostArch_CPP
295 BuildOS_CPP=$HostOS_CPP
296 HostOS_Full=$host_os
297 TargetOS_CPP=$HostOS_CPP
298 BuildVendor_CPP=$HostVendor_CPP
299 TargetVendor_CPP=$HostVendor_CPP
300
301 dnl Cannot afford all these SUBSTs (because of braindead seds w/ 99 cmd limits)
302 dnl AC_SUBST(BuildPlatform)
303
304 AC_SUBST(HostPlatform)
305 AC_SUBST(TargetPlatform)
306 AC_SUBST(HostPlatform_CPP)
307 dnl AC_SUBST(BuildPlatform_CPP)
308 dnl AC_SUBST(TargetPlatform_CPP)
309
310 AC_SUBST(HostArch_CPP)
311 dnl AC_SUBST(BuildArch_CPP)
312 dnl AC_SUBST(TargetArch_CPP)
313
314 AC_SUBST(HostOS_CPP)
315 AC_SUBST(HostOS_Full)
316 dnl AC_SUBST(BuildOS_CPP)
317 dnl AC_SUBST(TargetOS_CPP)
318
319 AC_SUBST(HostVendor_CPP)
320 dnl AC_SUBST(BuildVendor_CPP)
321 dnl AC_SUBST(TargetVendor_CPP)
322
323 AC_SUBST(exeext)
324
325 AC_PATH_PROG(GHC,ghc)
326 AC_PATH_PROGS(NHC,nhc nhc98)
327 AC_PATH_PROG(HBC,hbc)
328
329 dnl --------------------------------------------------------------
330 dnl * Project specific configuration options
331 dnl --------------------------------------------------------------
332 dnl What follows is a bunch of options that can either be configured
333 dnl through command line options to the configure script or by
334 dnl supplying defns in the build tree's mk/build.mk. Having the option to
335 dnl use either is considered a Feature.
336
337 dnl ** What command to use to compile compiler sources ?
338 dnl --------------------------------------------------------------
339 AC_ARG_WITH(hc,
340 [  --with-hc=<haskell compiler>
341         Use a command different from 'ghc' to compile up Haskell code.
342         (no claims currently made that this will work with a compiler other than a
343          recent version of GHC, but you could always try...)
344 ],
345 [WithHc="$withval"],
346 [WithHc=$GHC]
347 )
348 AC_SUBST(WithHc)
349
350 dnl ** Which gcc to use?
351 dnl --------------------------------------------------------------
352 AC_ARG_WITH(gcc,
353 [  --with-gcc=<gcc command>
354         Use a different command instead of 'gcc' for the GNU C compiler.
355 ],
356 [WhatGccIsCalled="$withval"],
357 [WhatGccIsCalled="gcc"]
358 )
359 AC_SUBST(WhatGccIsCalled)
360
361 dnl ** Booting from .hc files?
362 dnl --------------------------------------------------------------
363 AC_ARG_ENABLE(hc-boot,
364 [  --enable-hc-boot
365         Boot the Glasgow Haskell Compiler from intermediate .hc files.
366         (This option is mostly of interest to porters.)
367 ],
368 [BootingFromHc=YES],
369 [BootingFromHc=NO]
370 )
371 AC_SUBST(BootingFromHc)
372
373
374 dnl ** Enable the construction of Win32 DLLs?
375 dnl --------------------------------------------------------------
376 AC_ARG_ENABLE(win32-dlls,
377 [  --enable-win32-dlls
378         If on a Win32 platform running mingw32/cygwin, enable the
379         construction of DLLs containing ghc-compiled code.
380 ],
381 [
382 case $HostOS_CPP in
383 cygwin32) ;;
384 mingw32)  ;;
385 *)    echo "Unrecognised win32 platform: $HostPlatform"
386       exit 1
387       ;;
388 esac
389 EnableWin32DLLs=YES
390 ],
391 [EnableWin32DLLs=NO]
392 )
393 AC_SUBST(EnableWin32DLLs)
394 if test x"$EnableWin32DLLs" = "xYES" ; then
395  AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
396 fi
397
398 dnl --------------------------------------------------------------
399 dnl End of configure script option section
400 dnl --------------------------------------------------------------
401
402
403 dnl --------------------------------------------------------------
404 dnl * General configuration checks
405 dnl --------------------------------------------------------------
406
407 dnl ** does #! work?
408 AC_SYS_INTERPRETER()
409
410 dnl ** look for `perl', but watch out for version 4.035
411 AC_PATH_PROG(PerlCmd,perl)
412 if test -z "$PerlCmd"; then
413    echo "You must install perl before you can continue"
414    echo "Perhaps it is already installed, but not in your PATH?"
415    exit 1
416 else
417 FPTOOLS_CHECK_PERL_VERSION
418 fi
419
420 dnl ** does #! path/to/perl work? (sometimes it's too long...)
421 FPTOOLS_SHEBANG_PERL
422
423
424 dnl ** look for GCC and find out which version
425 dnl     Figure out which C compiler to use.  Gcc is preferred.
426 dnl     If gcc, make sure it's at least 2.1
427 dnl
428 AC_PROG_CC
429 FPTOOLS_HAVE_GCC
430
431 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
432 AC_PROG_CPP
433
434 dnl ** figure out how to do context diffs
435 FPTOOLS_PROG_DIFF
436
437 dnl ** Find find command (for Win32's benefit)
438 AC_PATH_PROG(FindCmd, find)
439
440 dnl ** look for a decent parser generator (bison preferred)
441 dnl (FPTOOLS_PROG_YACCY is AC_PROG_YACC, but with some extra testing 
442 dnl  on the suitability of the 'yacc' returned.)
443 FPTOOLS_PROG_YACCY
444
445 dnl ** Find lex command (lex or flex) and library (-ll or -lfl)
446 dnl     ( not that we care about the latter, see mk/config.mk.in )
447 AC_PROG_LEX
448
449
450 dnl ** figure out how to do a BSD-ish install
451 AC_PROG_INSTALL
452
453 dnl If you can run configure, you certainly have /bin/sh
454 AC_DEFINE(HAVE_BIN_SH)
455
456 dnl ** how to invoke `ar' and `ranlib'
457 FPTOOLS_PROG_AR_AND_RANLIB
458
459
460 dnl ** Check to see whether ln -s works
461 AC_PROG_LN_S
462
463
464 dnl ** Find the path to sed
465 AC_PATH_PROG(SedCmd,sed)
466
467
468 dnl ** check for time command
469 AC_PATH_PROG(TimeCmd,time)
470
471
472 dnl ** check for tar
473 dnl   if GNU tar is named gtar, look for it first.
474 AC_PATH_PROGS(TarCmd,gtar tar,tar)
475
476 dnl ** check for gzip/compress
477 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
478
479 compress_nm=`basename $CompressCmd`
480 if test x"$compress_nm" = xgzip; then
481   CompressCmd="$CompressCmd -d"
482   CompressSuffix="gz"
483 else
484   CompressSuffix="Z"
485 fi
486 AC_SUBST(CompressCmd)
487 AC_SUBST(CompressSuffix)
488
489 dnl ** check for installed happy binary + version
490 dnl    (don't do it if we're booting from .hc files though.)
491 if (test "$BootingFromHc" = "NO"); then
492 FPTOOLS_HAPPY
493 fi;
494
495 dnl --------------------------------------------------
496 dnl ### program checking section ends here ###
497 dnl --------------------------------------------------
498
499 dnl --------------------------------------------------
500 dnl * Platform header file and syscall feature tests
501 dnl ### checking the state of the local header files and syscalls ###
502
503 dnl ** check for full ANSI header (.h) files
504 AC_HEADER_STDC
505
506 dnl ** check for specific header (.h) files that we are interested in
507 AC_CHECK_HEADERS(Files.h assert.h console.h ctype.h dirent.h errno.h fcntl.h float.h ftw.h grp.h ieee754.h malloc.h memory.h nlist.h pascal.h pwd.h sgtty.h siginfo.h signal.h stat.h stdint.h stdlib.h stdarg.h string.h sys/fault.h sys/file.h sys/ioctl.h sys/limits.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h netinet/tcp.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 termio.h termios.h time.h types.h unistd.h utime.h values.h vfork.h readline/readline.h readline/history.h bfd.h winsock.h)
508
509 dnl ** check for DOS include files
510 AC_CHECK_HEADERS(dos.h conio.h io.h std.h) 
511
512 dnl ** check for Windows include files
513 AC_CHECK_HEADERS(windows.h)
514
515 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
516 AC_HEADER_TIME
517
518 dnl dynamic loading include files
519 AC_CHECK_HEADERS(dlfcn.h dl.h) 
520
521 dnl ** check for farcalloc (in bcc)
522 AC_CHECK_HEADER(alloc.h,AC_CHECK_FUNCS(farcalloc))
523
524 dnl ** check for valloc (in sunos, solaris, mips, amiga, next, minix, ultrix)
525 AC_CHECK_HEADER(malloc.h,AC_CHECK_FUNCS(valloc))
526
527 dnl ** how do we get a timezone name, and UTC offset ?
528 AC_STRUCT_TIMEZONE
529
530 dnl ** what's the type of timezone?
531 FPTOOLS_HAVE_TIMEZONE
532 FPTOOLS_TYPE_TIMEZONE
533
534 dnl ** do we have altzone?
535 FPTOOLS_ALTZONE
536
537 dnl ** does struct stat contain st_blksize?
538 AC_STRUCT_ST_BLKSIZE
539
540 dnl ** do we have long longs?
541 FPTOOLS_C_LONG_LONG
542
543 dnl ** what are the sizes of various types
544 dnl    (these must come before GHC_CHECK_ALIGNMENT)
545 AC_CHECK_SIZEOF(char,               1)
546 AC_CHECK_SIZEOF(double,             8)
547 AC_CHECK_SIZEOF(float,              4)
548 AC_CHECK_SIZEOF(int,                4)
549 AC_CHECK_SIZEOF(long,               4)
550 if test "$fptools_cv_have_long_long" = yes; then
551 AC_CHECK_SIZEOF(long long,          8)
552 fi
553 AC_CHECK_SIZEOF(short,              2)
554 AC_CHECK_SIZEOF(unsigned char,      1)
555 AC_CHECK_SIZEOF(unsigned int,       4)
556 AC_CHECK_SIZEOF(unsigned long,      4)
557 if test "$fptools_cv_have_long_long" = yes; then
558 AC_CHECK_SIZEOF(unsigned long long, 8)
559 fi
560 AC_CHECK_SIZEOF(unsigned short,     2)
561 AC_CHECK_SIZEOF(void *,             4)
562
563 dnl ** what are alignment constraints on various types
564 FPTOOLS_CHECK_ALIGNMENT(char)
565 FPTOOLS_CHECK_ALIGNMENT(double)
566 FPTOOLS_CHECK_ALIGNMENT(float)
567 FPTOOLS_CHECK_ALIGNMENT(int)
568 FPTOOLS_CHECK_ALIGNMENT(long)
569 if test "$fptools_cv_have_long_long" = yes; then
570 FPTOOLS_CHECK_ALIGNMENT(long long)
571 fi
572 FPTOOLS_CHECK_ALIGNMENT(short)
573 FPTOOLS_CHECK_ALIGNMENT(unsigned char)
574 FPTOOLS_CHECK_ALIGNMENT(unsigned int)
575 FPTOOLS_CHECK_ALIGNMENT(unsigned long)
576 if test "$fptools_cv_have_long_long" = yes; then
577 FPTOOLS_CHECK_ALIGNMENT(unsigned long long)
578 fi
579 FPTOOLS_CHECK_ALIGNMENT(unsigned short)
580 FPTOOLS_CHECK_ALIGNMENT(void *)
581
582 dnl ** can we open files in binary mode?
583 FPTOOLS_O_BINARY
584
585 dnl ** check for GetModuleFileName and WinExec (windows only)
586 dnl Old: AC_CHECK_FUNCS(WinExec GetModuleFileName)       dnl Windows
587 dnl Doesn't work because the linker can't see the functions if
588 dnl you omit the #include <windows.h>.  (I've no idea why not...)
589
590 FPTOOLS_TRY_LINK_NOWARN(,[
591 #if HAVE_WINDOWS_H
592 #include <windows.h>
593 #endif
594 main() { 
595   WinExec("",0);
596   exit(0);
597 }
598 ],
599 [have_winexec=1],
600 [have_winexec=0])
601 if test "$have_winexec" = "1"; then
602 AC_DEFINE(HAVE_WINEXEC)
603 fi
604
605 FPTOOLS_TRY_LINK_NOWARN(,[
606 #if HAVE_WINDOWS_H
607 #include <windows.h>
608 #endif
609 main() { 
610   char* dir;
611   GetModuleFileName((HMODULE)0,dir,0);
612   exit(0);
613 }
614 ],
615 [have_getmodulefilename=1],
616 [have_getmodulefilename=0])
617 if test "$have_getmodulefilename" = "1"; then
618 AC_DEFINE(HAVE_GETMODULEFILENAME)
619 fi
620
621 dnl ** check return type of signal handlers
622 dnl Foo: assumes we can use prototypes.
623 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
624 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
625 dnl [AC_TRY_COMPILE([#include <sys/types.h>
626 dnl #include <signal.h>
627 dnl #ifdef signal
628 dnl #undef signal
629 dnl #endif
630 dnl void (*signal (int, void (*)(int)))(int);
631 dnl ],
632 dnl [int i;], 
633 dnl ac_cv_type_signal_handler=void_int,
634 dnl ac_cv_type_signal_handler=int_void)])
635 dnl if test "$ac_cv_type_signal_handler" = void_int; then
636 dnl AC_DEFINE(VOID_INT_SIGNALS)
637 dnl fi
638
639 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
640 AC_TYPE_SIGNAL
641 if test "$ac_cv_type_signal" = void; then
642 AC_DEFINE(VOID_INT_SIGNALS)
643 fi
644
645 dnl ** check for more functions
646 AC_CHECK_FUNCS(strcasecmp _stricmp stricmp strcmpi)
647 AC_CHECK_FUNCS(strcmp)
648 AC_CHECK_FUNCS(realpath _fullpath)  
649 AC_CHECK_FUNCS(PBHSetVolSync macsystem)  
650 AC_CHECK_FUNCS(fgetpos fsetpos fseek ftell)
651 AC_CHECK_FUNCS(vsnprintf _vsnprintf)
652 AC_CHECK_FUNCS(snprintf  _snprintf )  
653 AC_CHECK_FUNCS(popen     _popen )  
654 AC_CHECK_FUNCS(pclose    _pclose )  
655
656
657 dnl ** check for specific library functions that we are interested in
658 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect readlink setitimer stat symlink sysconf timelocal times vadvise vfork)
659
660 dnl ** check whether this machine has gmp2 installed
661 AC_CHECK_LIB(gmp,  mpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
662   AC_CHECK_LIB(gmp2, mpz_fdiv_qr,  HaveLibGmp=YES; LibGmp=gmp2,
663     HaveLibGmp=No; LibGmp=not-installed))
664 AC_SUBST(HaveLibGmp)
665 AC_SUBST(LibGmp)
666
667 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
668 dnl    the order of these tests matters: bfd needs liberty
669 AC_CHECK_LIB(iberty, xmalloc)
670 AC_CHECK_LIB(bfd,    bfd_init)
671
672 dnl ** check for readline, for Hugs
673 dnl termcap is obsoleted by ncurses, but for compatibility, we have to
674 dnl check for both...
675 AC_SEARCH_LIBS(tputs, [ncurses termcap])
676
677 AC_CHECK_LIB(readline, readline,
678 [
679 AC_DEFINE(HAVE_LIBREADLINE,1)
680 HaveLibReadline=YES
681 ],
682 [
683 AC_DEFINE(HAVE_LIBREADLINE,0)
684 HaveLibReadline=NO
685 ])
686 AC_SUBST(HaveLibReadline)
687
688
689 dnl ################################################################
690 dnl Check for libraries
691 dnl ################################################################
692
693 FPTOOLS_CHECK_LIB_NOWARN(dl, dlopen)
694 FPTOOLS_CHECK_LIB_NOWARN(dld, shl_load)
695 FPTOOLS_CHECK_LIB_NOWARN(m, atan)
696
697 dnl --------------------------------------------------
698 dnl * Miscellaneous feature tests
699 dnl --------------------------------------------------
700
701 dnl ** can we get alloca?
702 AC_FUNC_ALLOCA
703
704 dnl ** determine whether or not const works
705 AC_C_CONST
706
707 dnl ** determine whether ANSI-function prototypes work?
708 AC_C_PROTOTYPES          
709
710 dnl ** are we big endian?
711 AC_C_BIGENDIAN
712 # Allay users' general fear of warnings of any kind.
713 errprint((fptools configure script wizard sez: "don't worry, the above warning is harmless (to us.)")
714 )
715
716 dnl ** check for leading underscores in symbol names
717 FPTOOLS_UNDERSCORE
718
719 dnl ** how is the end of text section signalled?
720 FPTOOLS_END_TEXT_SECTION
721
722 dnl ** how is the end of data section signalled?
723 FPTOOLS_END_DATA_SECTION
724
725 dnl ** code before data?
726 FPTOOLS_CODE_BEFORE_DATA
727
728 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )
729
730 echo ''
731 echo '************************************************'
732 echo '*** NOW DO: gmake boot followed by gmake all'
733 echo '***         (where gmake == GNU make)'
734 echo '************************************************'
735 exit 0