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)
6 # (c) The AQUA Project, Glasgow University, 1994-1998
8 # Configure script template for the Glasgow functional programming tools
10 # Process with 'autoconf' to get a working configure script.
12 # For the generated configure script, do "./configure --help" to
13 # see what flags are available. (Better yet, read the documentation!)
16 # First off, a distrib sanity check..
17 AC_INIT(mk/config.mk.in)
19 dnl * Declare subdirectories that have a private configure script
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 dnl (We probably have to add hslibs/{OpenGL,GLUT} here later...)
24 AC_CONFIG_SUBDIRS(ghc)
26 # -------------------------------------------------------------------------
27 # Prepare to generate the following header files
30 AC_CONFIG_HEADER(mk/config.h)
32 # No, semi-sadly, we don't do `--srcdir'...
33 if test x"$srcdir" != 'x.' ; then
34 echo "This configuration does not support the \`--srcdir' option.."
39 # Remove common automounter nonsense + convert from UNC to DOS style paths
40 # (UNC awareness isn't quite there yet for cygwin32-beta18 and consituent tools.)
43 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^/grasp_tmp|/local/grasp_tmp|' | sed 's|^//\(.\)/|\1:/|' `
46 echo "*** The top of your build tree is: $hardtop"
50 dnl--------------------------------------------------------------------
51 dnl * Choose host(/target/build) platform
52 dnl--------------------------------------------------------------------
54 dnl Guess host/target/build platform(s) if necessary.
57 # "$host" defaults to "$target"
58 if test "x$host" = xNONE ; then
62 dnl ** canonicalize platform names
63 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
64 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
65 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
67 if test x"$TargetPlatform" != x"$HostPlatform" ; then
68 echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
74 # The following will be more difficult when we *are* cross-compiling.
75 # Suitable names to slam in *_CPP are in platform.h.in.
76 # We also record the architecture, vendor, and operating system (OS)
79 alpha*-dec-osf[[12]]*)
80 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
81 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
82 BuildPlatform=alpha-dec-osf1 # hack
83 HostPlatform_CPP='alpha_dec_osf1'
88 alpha*-dec-osf[[345]]*)
89 HostPlatform=alpha-dec-osf3 # canonicalise for our purposes
90 TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
91 BuildPlatform=alpha-dec-osf3 # hack
92 HostPlatform_CPP='alpha_dec_osf3'
98 HostPlatform=alpha-unknown-linux
99 TargetPlatform=alpha-unknown-linux
100 BuildPlatform=alpha-unknown-linux
101 HostPlatform_CPP='alpha_unknown_linux'
103 HostVendor_CPP='unknown'
106 alpha*-unknown-freebsd*)
107 HostPlatform=alpha-unknown-freebsd
108 TargetPlatform=alpha-unknown-freebsd
109 BuildPlatform=alpha-unknown-freebsd
110 HostPlatform_CPP='alpha_unknown_freebsd'
112 HostVendor_CPP='unknown'
116 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
117 TargetPlatform=hppa1.1-hp-hpux
118 BuildPlatform=hppa1.1-hp-hpux
119 HostPlatform_CPP='hppa1_1_hp_hpux'
120 HostArch_CPP='hppa1_1'
124 i[[3456]]86-*-linuxaout*)
125 HostPlatform=i386-unknown-linuxaout # hack again
126 TargetPlatform=i386-unknown-linuxaout
127 BuildPlatform=i386-unknown-linuxaout
128 HostPlatform_CPP='i386_unknown_linuxaout'
130 HostVendor_CPP='unknown'
131 HostOS_CPP='linuxaout'
133 i[[3456]]86-*-linux*)
134 HostPlatform=i386-unknown-linux # hack again
135 TargetPlatform=i386-unknown-linux
136 BuildPlatform=i386-unknown-linux
137 HostPlatform_CPP='i386_unknown_linux'
139 HostVendor_CPP='unknown'
142 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
143 HostPlatform=i386-unknown-freebsd # hack again
144 TargetPlatform=i386-unknown-freebsd
145 BuildPlatform=i386-unknown-freebsd
146 HostPlatform_CPP='i386_unknown_freebsd'
148 HostVendor_CPP='unknown'
151 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
152 HostPlatform=i386-unknown-freebsd2 # hack again
153 TargetPlatform=i386-unknown-freebsd2
154 BuildPlatform=i386-unknown-freebsd2
155 HostPlatform_CPP='i386_unknown_freebsd2'
157 HostVendor_CPP='unknown'
158 HostOS_CPP='freebsd2'
160 i[[3456]]86-*-netbsd*)
161 HostPlatform=i386-unknown-netbsd # hack again
162 TargetPlatform=i386-unknown-netbsd
163 BuildPlatform=i386-unknown-netbsd
164 HostPlatform_CPP='i386_unknown_netbsd'
166 HostVendor_CPP='unknown'
169 i[[3456]]86-*-openbsd*)
170 HostPlatform=i386-unknown-openbsd # hack again
171 TargetPlatform=i386-unknown-openbsd
172 BuildPlatform=i386-unknown-openbsd
173 HostPlatform_CPP='i386_unknown_openbsd'
175 HostVendor_CPP='unknown'
178 i[[3456]]86-*-solaris2*)
179 HostPlatform=i386-unknown-solaris2 # hack again
180 TargetPlatform=i386-unknown-solaris2
181 BuildPlatform=i386-unknown-solaris2
182 HostPlatform_CPP='i386_unknown_solaris2'
184 HostVendor_CPP='unknown'
185 HostOS_CPP='solaris2'
187 i[[3456]]86-*-cygwin*)
188 HostPlatform=i386-unknown-cygwin32 # hack again
189 TargetPlatform=i386-unknown-cygwin32
190 BuildPlatform=i386-unknown-cygwin32
191 HostPlatform_CPP='i386_unknown_cygwin32'
193 HostVendor_CPP='unknown'
194 HostOS_CPP='cygwin32'
197 i[[3456]]86-*-mingw32*)
198 HostPlatform=i386-unknown-mingw32 # hack again
199 TargetPlatform=i386-unknown-mingw32
200 BuildPlatform=i386-unknown-mingw32
201 HostPlatform_CPP='i386_unknown_mingw32'
203 HostVendor_CPP='unknown'
208 HostPlatform_CPP='m68k_next_nextstep2'
210 HostVendor_CPP='next'
211 HostOS_CPP='nextstep2'
214 HostPlatform_CPP='m68k_next_nextstep3'
216 HostVendor_CPP='next'
217 HostOS_CPP='nextstep3'
219 i[[3456]]86-next-nextstep3)
220 HostPlatform=i386-next-nextstep3 # hack again
221 TargetPlatform=i386-next-nextstep3
222 BuildPlatform=i386-next-nextstep3
223 HostPlatform_CPP='i386_next_nextstep3'
225 HostVendor_CPP='next'
226 HostOS_CPP='nextstep3'
229 HostPlatform=m68k-sun-sunos4
230 TargetPlatform=m68k-sun-sunos4 #hack
231 BuildPlatform=m68k-sun-sunos4 #hack
232 HostPlatform_CPP='m68k_sun_sunos4'
238 HostPlatform_CPP='mips_dec_ultrix'
239 HostArch_CPP='mipsel' # NB a little different
244 HostPlatform=mips-sgi-irix
245 TargetPlatform=mips-sgi-irix #hack
246 BuildPlatform=mips-sgi-irix #hack
247 HostPlatform_CPP='mips_sgi_irix'
248 HostArch_CPP='mipseb' # NB a little different
253 HostPlatform=rs6000-ibm-aix
254 TargetPlatform=rs6000-ibm-aix #hack
255 BuildPlatform=rs6000-ibm-aix #hack
256 HostPlatform_CPP='rs6000_ibm_aix'
257 HostArch_CPP='rs6000'
262 HostPlatform=powerpc-ibm-aix
263 TargetPlatform=powerpc-ibm-aix #hack
264 BuildPlatform=powerpc-ibm-aix #hack
265 HostPlatform_CPP='powerpc_ibm_aix'
266 HostArch_CPP='powerpc'
270 powerpc-apple-macosx*)
271 HostPlatform=powerpc-apple-macosx
272 TargetPlatform=powerpc-apple-macosx #hack
273 BuildPlatform=powerpc-apple-macosx #hack
274 HostPlatform_CPP='powerpc_apple_macosx'
275 HostArch_CPP='powerpc'
276 HostVendor_CPP='apple'
280 HostPlatform=sparc-sun-sunos4
281 TargetPlatform=sparc-sun-sunos4 #hack
282 BuildPlatform=sparc-sun-sunos4 #hack
283 HostPlatform_CPP='sparc_sun_sunos4'
289 HostPlatform=sparc-sun-solaris2
290 TargetPlatform=sparc-sun-solaris2 #hack
291 BuildPlatform=sparc-sun-solaris2 #hack
292 HostPlatform_CPP='sparc_sun_solaris2'
295 HostOS_CPP='solaris2'
298 echo "Unrecognised platform: $HostPlatform"
302 echo "Canonicalised to: $HostPlatform"
303 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
304 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
306 BuildPlatform_CPP=$HostPlatform_CPP
307 TargetPlatform_CPP=$HostPlatform_CPP
308 BuildArch_CPP=$HostArch_CPP
309 TargetArch_CPP=$HostArch_CPP
310 BuildOS_CPP=$HostOS_CPP
312 TargetOS_CPP=$HostOS_CPP
313 BuildVendor_CPP=$HostVendor_CPP
314 TargetVendor_CPP=$HostVendor_CPP
316 dnl Cannot afford all these SUBSTs (because of braindead seds w/ 99 cmd limits)
317 dnl AC_SUBST(BuildPlatform)
319 AC_SUBST(HostPlatform)
320 AC_SUBST(TargetPlatform)
321 AC_SUBST(HostPlatform_CPP)
322 dnl AC_SUBST(BuildPlatform_CPP)
323 dnl AC_SUBST(TargetPlatform_CPP)
325 AC_SUBST(HostArch_CPP)
326 dnl AC_SUBST(BuildArch_CPP)
327 dnl AC_SUBST(TargetArch_CPP)
330 AC_SUBST(HostOS_Full)
331 dnl AC_SUBST(BuildOS_CPP)
332 dnl AC_SUBST(TargetOS_CPP)
334 AC_SUBST(HostVendor_CPP)
335 dnl AC_SUBST(BuildVendor_CPP)
336 dnl AC_SUBST(TargetVendor_CPP)
341 # The native format for 'hardtop' (i.e., right kind of slashes on a Win32 box).
342 # (but with b-slashes being escaped).
343 case $HostPlatform in
344 i386-unknown-mingw32 | i386-unknown-cygwin32)
345 hardtop_plat=`cygpath -w ${hardtop} | sed -e 's@\\\\@\\\\\\\\@g' `
348 hardtop_plat=${hardtop}
351 AC_SUBST(hardtop_plat)
353 dnl --------------------------------------------------------------
354 dnl * Project specific configuration options
355 dnl --------------------------------------------------------------
356 dnl What follows is a bunch of options that can either be configured
357 dnl through command line options to the configure script or by
358 dnl supplying defns in the build tree's mk/build.mk. Having the option to
359 dnl use either is considered a Feature.
361 dnl ** What command to use to compile compiler sources ?
362 dnl --------------------------------------------------------------
365 [ --with-ghc=<haskell compiler>
366 Use a command different from 'ghc' to compile GHC-specific Haskell code
367 (including GHC itself).
369 [ WithGhc="$withval" ],
371 if test "$GHC" = ""; then
372 AC_PATH_PROG(GHC,ghc)
380 [ --with-hc=<haskell compiler>
381 Use a command different from 'ghc' to compile generic Haskell code.
388 if test "$WithGhc" != ""; then
389 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
390 AC_SUBST(GhcVersion)dnl
391 AC_SUBST(GhcMajVersion)dnl
392 AC_SUBST(GhcMinVersion)dnl
393 AC_SUBST(GhcPatchLevel)dnl
396 AC_PATH_PROGS(NHC,nhc nhc98)
397 AC_PATH_PROG(HBC,hbc)
399 dnl ** Which gcc to use?
400 dnl --------------------------------------------------------------
402 [ --with-gcc=<gcc command>
403 Use a different command instead of 'gcc' for the GNU C compiler.
405 [WhatGccIsCalled="$withval"
407 [WhatGccIsCalled="gcc"]
409 AC_SUBST(WhatGccIsCalled)
411 dnl ** Booting from .hc files?
412 dnl --------------------------------------------------------------
413 AC_ARG_ENABLE(hc-boot,
415 Boot the Glasgow Haskell Compiler from intermediate .hc files.
416 (This option is mostly of interest to porters.)
421 AC_SUBST(BootingFromHc)
423 dnl ** Booting from unregisterised .hc files?
424 dnl --------------------------------------------------------------
425 AC_ARG_ENABLE(hc-boot-unregisterised,
426 [ --enable-hc-boot-unregisterised
427 With --enable-hc-boot, treat the intermediate .hc files as
428 unregisterised rather than registerised code.
429 (This option is mostly of interest to porters.)
431 [BootingFromUnregisterisedHc=YES],
432 [BootingFromUnregisterisedHc=NO]
434 AC_SUBST(BootingFromUnregisterisedHc)
436 if test "$BootingFromHc" = "NO"; then
437 if test "$BootingFromUnregisterisedHc" = "YES"; then
438 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
443 dnl ** Enable the construction of Win32 DLLs?
444 dnl --------------------------------------------------------------
445 AC_ARG_ENABLE(win32-dlls,
446 [ --enable-win32-dlls
447 If on a Win32 platform running mingw32/cygwin, enable the
448 construction of DLLs containing ghc-compiled code.
454 *) echo "Unrecognised win32 platform: $HostPlatform"
462 AC_SUBST(EnableWin32DLLs)
463 if test x"$EnableWin32DLLs" = "xYES" ; then
464 AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
467 dnl ** Enable the building of the OpenGL/GLUT binding in hslibs?
468 dnl --------------------------------------------------------------
469 AC_ARG_ENABLE(hopengl,
471 Build HOpenGL, a Haskell binding for OpenGL/GLUT, too.
472 (This option is only relevant when hslibs are built.)
474 [GhcLibsWithHOpenGL=YES],
475 [GhcLibsWithHOpenGL=NO]
477 AC_SUBST(GhcLibsWithHOpenGL)
479 dnl ** Use a specific version of the GLUT API
480 dnl --------------------------------------------------------------
481 AC_ARG_WITH(glut-api,
482 [ --with-glut-api=<version>
483 Use a specific version of the GLUT API when building HOpenGL.
485 test -n "$with_glut_api" && CPPFLAGS="$CPPFLAGS -DGLUT_API_VERSION=$with_glut_api"
488 dnl ** Use a specific version of the GLUT API
489 dnl --------------------------------------------------------------
490 AC_ARG_WITH(glut-xlib,
491 [ --with-glut-xlib=<version>
492 Use a specific version of the GLUT Xlib implementation when building HOpenGL.
494 test -n "$with_glut_xlib" && CPPFLAGS="$CPPFLAGS -DGLUT_XLIB_IMPLEMENTATION=$with_glut_xlib"
499 dnl --------------------------------------------------------------
500 dnl End of configure script option section
501 dnl --------------------------------------------------------------
504 dnl --------------------------------------------------------------
505 dnl * General configuration checks
506 dnl --------------------------------------------------------------
511 dnl ** look for `perl', but only in /bin on Windows
514 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
515 if test -z "$PerlCmd"; then
516 echo "You must install the version of Perl shipped with GHC"
517 echo "(or a compatible one) in /bin."
522 AC_PATH_PROG(PerlCmd,perl)
523 if test -z "$PerlCmd"; then
524 echo "You must install perl before you can continue"
525 echo "Perhaps it is already installed, but not in your PATH?"
528 FPTOOLS_CHECK_PERL_VERSION
533 dnl ** does #! path/to/perl work? (sometimes it's too long...)
536 dnl ** look for GCC and find out which version
537 dnl Figure out which C compiler to use. Gcc is preferred.
538 dnl If gcc, make sure it's at least 2.1
543 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
546 dnl ** does the C compiler support the following options?
547 FPTOOLS_CC_FLAG(-mwin32,CC_SUPPORTS_MWIN32)
548 FPTOOLS_CC_FLAG(-mno-cygwin,CC_SUPPORTS_MNO_CYGWIN)
550 EXTRA_CC_OPTS="$CC_SUPPORTS_MNO_CYGWIN $CC_SUPPORTS_MWIN32"
551 SRC_CC_OPTS="-O $EXTRA_CC_OPTS"
552 CPPFLAGS="$EXTRA_CC_OPTS $CPPFLAGS"
553 AC_SUBST(SRC_CC_OPTS)
555 dnl ** figure out how to do context diffs
558 dnl ** Find find command (for Win32's benefit)
561 dnl ** look for a decent parser generator (bison preferred)
562 dnl (FPTOOLS_PROG_YACCY is AC_PROG_YACC, but with some extra testing
563 dnl on the suitability of the 'yacc' returned.)
566 dnl ** Find lex command (lex or flex) - *doesn't* use autoconf's
567 dnl AC_PROG_LEX, since it doesn't actually check whether 'lex'
568 dnl exists if 'flex' doesn't.
571 dnl ** figure out how to do a BSD-ish install
574 dnl If you can run configure, you certainly have /bin/sh
575 AC_DEFINE(HAVE_BIN_SH)
577 dnl ** how to invoke `ar' and `ranlib'
578 FPTOOLS_PROG_AR_AND_RANLIB
581 dnl ** Check to see whether ln -s works
585 dnl ** Find the path to sed
586 AC_PATH_PROG(SedCmd,sed)
589 dnl ** check for time command
590 AC_PATH_PROG(TimeCmd,time)
594 dnl if GNU tar is named gtar, look for it first.
595 AC_PATH_PROGS(TarCmd,gtar tar,tar)
597 dnl ** check for gzip/compress
598 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
600 dnl ** check for jade/openjade & determine a working catalog
601 AC_PATH_PROGS(JadeCmd,openjade jade,jade)
602 FPTOOLS_DOCBOOK_CATALOG(Catalog, $JadeCmd, docs/fptools-both.dsl,
603 /etc/sgml/catalog /etc/sgml.catalog /usr/share/sgml/CATALOG.docbkdsl glafp-utils/docbook/CATALOG*)
604 if test -z "$Catalog"; then
605 AC_MSG_RESULT([Warning: You will not be able to build the documentation.])
611 Catalog=`cygpath -w $hardtop/$Catalog`
613 *) Catalog=$hardtop/$Catalog
620 compress_nm=`basename $CompressCmd`
621 if test x"$compress_nm" = xgzip; then
622 CompressCmd="$CompressCmd -d"
627 AC_SUBST(CompressCmd)
628 AC_SUBST(CompressSuffix)
630 dnl ** check for installed happy binary + version
631 dnl (don't do it if we're booting from .hc files though.)
632 if test "$BootingFromHc" = "NO"; then
636 dnl --------------------------------------------------
637 dnl ### program checking section ends here ###
638 dnl --------------------------------------------------
640 dnl --------------------------------------------------
641 dnl * Platform header file and syscall feature tests
642 dnl ### checking the state of the local header files and syscalls ###
644 dnl ** check for full ANSI header (.h) files
647 dnl ** check for specific header (.h) files that we are interested in
648 AC_CHECK_HEADERS(Files.h arpa/inet.h assert.h console.h ctype.h dirent.h errno.h fcntl.h float.h ftw.h grp.h ieee754.h inttypes.h limits.h malloc.h memory.h nlist.h pascal.h pwd.h sgtty.h siginfo.h signal.h stat.h stdint.h stdlib.h stddef.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 netdb.h netinet/in.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/un.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 bfd.h winsock.h)
650 AC_CHECK_HEADER(readline/readline.h, HaveReadlineReadlineH=YES, HaveReadlineReadlineH=NO)
651 AC_CHECK_HEADER(readline/history.h, HaveReadlineHistoryH=YES, HaveReadlineHistoryH=NO)
653 if test $HaveReadlineReadlineH = YES && test $HaveReadlineHistoryH = YES ; then
654 HaveReadlineHeaders=YES
655 AC_DEFINE(HAVE_READLINE_HEADERS,1)
657 HaveReadlineHeaders=NO
658 AC_DEFINE(HAVE_READLINE_HEADERS,0)
660 AC_SUBST(HaveReadlineHeaders)
662 dnl ** check for DOS include files
663 AC_CHECK_HEADERS(dos.h conio.h io.h std.h)
665 dnl ** check for Windows include files
666 AC_CHECK_HEADERS(windows.h)
668 dnl ** check for OpenGL include files
669 AC_CHECK_HEADERS(GL/gl.h)
671 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
674 dnl dynamic loading include files
675 AC_CHECK_HEADERS(dlfcn.h dl.h)
677 dnl ** check for farcalloc (in bcc)
678 AC_CHECK_HEADER(alloc.h,AC_CHECK_FUNCS(farcalloc))
680 dnl ** check for valloc (in sunos, solaris, mips, amiga, next, minix, ultrix)
681 AC_CHECK_HEADER(malloc.h,AC_CHECK_FUNCS(valloc))
683 dnl ** how do we get a timezone name, and UTC offset ?
686 dnl ** what's the type of timezone?
687 FPTOOLS_HAVE_TIMEZONE
688 FPTOOLS_TYPE_TIMEZONE
690 dnl ** do we have altzone?
693 dnl ** does struct stat contain st_blksize?
696 dnl ** do we have long longs?
699 dnl ** what are the sizes of various types
700 dnl (these must come before GHC_CHECK_ALIGNMENT)
701 AC_CHECK_SIZEOF(char, 1)
702 AC_CHECK_SIZEOF(double, 8)
703 AC_CHECK_SIZEOF(float, 4)
704 AC_CHECK_SIZEOF(int, 4)
705 AC_CHECK_SIZEOF(long, 4)
706 if test "$fptools_cv_have_long_long" = yes; then
707 AC_CHECK_SIZEOF(long long, 8)
709 AC_CHECK_SIZEOF(short, 2)
710 AC_CHECK_SIZEOF(unsigned char, 1)
711 AC_CHECK_SIZEOF(unsigned int, 4)
712 AC_CHECK_SIZEOF(unsigned long, 4)
713 if test "$fptools_cv_have_long_long" = yes; then
714 AC_CHECK_SIZEOF(unsigned long long, 8)
716 AC_CHECK_SIZEOF(unsigned short, 2)
717 AC_CHECK_SIZEOF(void *, 4)
719 dnl ** what are alignment constraints on various types
720 FPTOOLS_CHECK_ALIGNMENT(char)
721 FPTOOLS_CHECK_ALIGNMENT(double)
722 FPTOOLS_CHECK_ALIGNMENT(float)
723 FPTOOLS_CHECK_ALIGNMENT(int)
724 FPTOOLS_CHECK_ALIGNMENT(long)
725 if test "$fptools_cv_have_long_long" = yes; then
726 FPTOOLS_CHECK_ALIGNMENT(long long)
728 FPTOOLS_CHECK_ALIGNMENT(short)
729 FPTOOLS_CHECK_ALIGNMENT(unsigned char)
730 FPTOOLS_CHECK_ALIGNMENT(unsigned int)
731 FPTOOLS_CHECK_ALIGNMENT(unsigned long)
732 if test "$fptools_cv_have_long_long" = yes; then
733 FPTOOLS_CHECK_ALIGNMENT(unsigned long long)
735 FPTOOLS_CHECK_ALIGNMENT(unsigned short)
736 FPTOOLS_CHECK_ALIGNMENT(void *)
738 dnl ** map standard C types and ISO types to Haskell types
739 FPTOOLS_CHECK_HTYPE(char)
740 FPTOOLS_CHECK_HTYPE(signed char)
741 FPTOOLS_CHECK_HTYPE(unsigned char)
742 FPTOOLS_CHECK_HTYPE(short)
743 FPTOOLS_CHECK_HTYPE(unsigned short)
744 FPTOOLS_CHECK_HTYPE(int)
745 FPTOOLS_CHECK_HTYPE(unsigned int)
746 FPTOOLS_CHECK_HTYPE(long)
747 FPTOOLS_CHECK_HTYPE(unsigned long)
748 if test "$fptools_cv_have_long_long" = yes; then
749 FPTOOLS_CHECK_HTYPE(long long)
750 FPTOOLS_CHECK_HTYPE(unsigned long long)
752 FPTOOLS_CHECK_HTYPE(float)
753 FPTOOLS_CHECK_HTYPE(double)
754 FPTOOLS_CHECK_HTYPE(ptrdiff_t)
755 FPTOOLS_CHECK_HTYPE(size_t)
756 FPTOOLS_CHECK_HTYPE(wchar_t)
757 dnl Int32 is a HACK for non-ISO C compilers
758 FPTOOLS_CHECK_HTYPE(sig_atomic_t, Int32)
759 FPTOOLS_CHECK_HTYPE(clock_t)
760 FPTOOLS_CHECK_HTYPE(time_t)
762 dnl ** Map OpenGL data types to Haskell types
763 if test $GhcLibsWithHOpenGL = YES ; then
764 FPTOOLS_CHECK_HTYPE(GLboolean)
765 FPTOOLS_CHECK_HTYPE(GLbyte)
766 FPTOOLS_CHECK_HTYPE(GLubyte)
767 FPTOOLS_CHECK_HTYPE(GLshort)
768 FPTOOLS_CHECK_HTYPE(GLushort)
769 FPTOOLS_CHECK_HTYPE(GLint)
770 FPTOOLS_CHECK_HTYPE(GLuint)
771 FPTOOLS_CHECK_HTYPE(GLsizei)
772 FPTOOLS_CHECK_HTYPE(GLenum)
773 FPTOOLS_CHECK_HTYPE(GLbitfield)
774 FPTOOLS_CHECK_HTYPE(GLfloat)
775 FPTOOLS_CHECK_HTYPE(GLclampf)
776 FPTOOLS_CHECK_HTYPE(GLdouble)
777 FPTOOLS_CHECK_HTYPE(GLclampd)
780 dnl ** can we open files in binary mode?
783 dnl ** check for GetModuleFileName and WinExec (windows only)
784 dnl Old: AC_CHECK_FUNCS(WinExec GetModuleFileName) dnl Windows
785 dnl Doesn't work because the linker can't see the functions if
786 dnl you omit the #include <windows.h>. (I've no idea why not...)
788 FPTOOLS_TRY_LINK_NOWARN(,[
799 if test "$have_winexec" = "1"; then
800 AC_DEFINE(HAVE_WINEXEC)
803 FPTOOLS_TRY_LINK_NOWARN(,[
809 GetModuleFileName((HMODULE)0,dir,0);
813 [have_getmodulefilename=1],
814 [have_getmodulefilename=0])
815 if test "$have_getmodulefilename" = "1"; then
816 AC_DEFINE(HAVE_GETMODULEFILENAME)
819 dnl ** check return type of signal handlers
820 dnl Foo: assumes we can use prototypes.
821 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
822 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
823 dnl [AC_TRY_COMPILE([#include <sys/types.h>
824 dnl #include <signal.h>
828 dnl void (*signal (int, void (*)(int)))(int);
831 dnl ac_cv_type_signal_handler=void_int,
832 dnl ac_cv_type_signal_handler=int_void)])
833 dnl if test "$ac_cv_type_signal_handler" = void_int; then
834 dnl AC_DEFINE(VOID_INT_SIGNALS)
837 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
839 if test "$ac_cv_type_signal" = void; then
840 AC_DEFINE(VOID_INT_SIGNALS)
843 dnl ** check for more functions
844 AC_CHECK_FUNCS(strcasecmp _stricmp stricmp strcmpi)
845 AC_CHECK_FUNCS(strcmp)
846 AC_CHECK_FUNCS(realpath _fullpath)
847 AC_CHECK_FUNCS(PBHSetVolSync macsystem)
848 AC_CHECK_FUNCS(fgetpos fsetpos fseek ftell)
849 AC_CHECK_FUNCS(vsnprintf _vsnprintf)
850 AC_CHECK_FUNCS(snprintf _snprintf )
851 AC_CHECK_FUNCS(popen _popen )
852 AC_CHECK_FUNCS(pclose _pclose )
855 dnl ** check for specific library functions that we are interested in
856 AC_CHECK_FUNCS(access ftime getclock getpagesize getrusage gettimeofday mktime mprotect readlink setitimer stat lstat symlink sysconf timelocal times vadvise vfork localtime_r gmtime_r)
858 dnl ** check whether this machine has gmp3 installed
859 AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
860 AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp3,
861 HaveLibGmp=No; LibGmp=not-installed))
865 dnl ** check whether this machine has GNU regex in libc.
866 FPTOOLS_REGEX_IN_LIBC
868 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
869 dnl the order of these tests matters: bfd needs liberty
870 AC_CHECK_LIB(iberty, xmalloc)
871 AC_CHECK_LIB(bfd, bfd_init)
873 dnl ** check for readline, for Hugs and hslibs' Readline
874 dnl ncurses supersedes termcap and curses, but for compatibility,
875 dnl we have to check for all...
876 AC_CHECK_LIB(ncurses, tputs, HaveLibTermcap=YES; LibTermcap=ncurses,
877 AC_CHECK_LIB(termcap, tputs, HaveLibTermcap=YES; LibTermcap=termcap,
878 AC_CHECK_LIB(curses, tputs, HaveLibTermcap=YES; LibTermcap=curses,
879 HaveLibTermcap=NO; LibTermcap=not-installed)))
881 if test $HaveLibTermcap = YES ; then
882 LIBS="-l$LibTermcap $LIBS"
883 AC_CHECK_LIB(readline, readline, HaveLibReadline=YES, HaveLibReadline=NO)
886 if test $HaveLibTermcap = YES && test x"$HaveLibReadline" = xYES ; then
887 AC_DEFINE(HAVE_READLINE_LIBS,1)
888 LibsReadline="readline $LibTermcap"
890 AC_DEFINE(HAVE_READLINE_LIBS,0)
893 AC_SUBST(LibsReadline)
895 if test "$HaveLibReadline"; then
896 AC_CHECK_LIB(readline, rl_erase_empty_line,
897 [AC_DEFINE(HAVE_READLINE_4, 1)],
898 [AC_DEFINE(HAVE_READLINE_4, 0)])
899 AC_CHECK_LIB(readline, rl_free_undo_list,
900 [AC_DEFINE(HAVE_READLINE_4_2, 1)],
901 [AC_DEFINE(HAVE_READLINE_4_2, 0)])
903 AC_DEFINE(HAVE_READLINE_4, 0)
904 AC_DEFINE(HAVE_READLINE_4_2, 0)
907 dnl ** check for math library
917 dnl ################################################################
918 dnl Check for libraries
919 dnl ################################################################
921 AC_CHECK_LIB(dl, dlopen,
923 AC_DEFINE(HAVE_LIBDL)
926 AC_CHECK_FUNCS(dlopen)
929 FPTOOLS_CHECK_LIB_NOWARN(m, atan)
931 dnl --------------------------------------------------
933 dnl --------------------------------------------------
935 AC_PATH_PROGS(GTK_CONFIG, gtk-config gtk12-config)
936 if test "$GTK_CONFIG" != ""; then
937 AC_CACHE_CHECK([for version of GTK+], fptools_cv_gtk_version, [
938 fptools_cv_gtk_version=`$GTK_CONFIG --version`
940 GTK_VERSION=$fptools_cv_gtk_version
945 case $fptools_cv_gtk_version in
947 *) AC_MSG_WARN([GTK+ not usable; need at least version 1.2])
953 AC_SUBST(GTK_VERSION)
955 dnl --------------------------------------------------
956 dnl * Miscellaneous feature tests
957 dnl --------------------------------------------------
959 dnl ** can we get alloca?
962 dnl ** determine whether or not const works
965 dnl ** determine whether ANSI-function prototypes work?
968 dnl ** are we big endian?
970 # Allay users' general fear of warnings of any kind.
971 errprint(fptools configure script wizard sez: autoconf-2.50 or later should produce no warnings
973 errprint(if you are using 2.13 or earlier, you may get a (harmless) warning message.
976 dnl ** check for leading underscores in symbol names
979 dnl ** how is the end of text section signalled?
980 FPTOOLS_END_TEXT_SECTION
982 dnl ** how is the end of data section signalled?
983 FPTOOLS_END_DATA_SECTION
985 dnl ** code before data?
986 FPTOOLS_CODE_BEFORE_DATA
988 dnl ** check for ld, and whether ld has -x option
989 AC_PATH_PROG(LdCmd, ld)
992 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )