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).
343 case $HostPlatform in
344 i386-unknown-mingw32)
345 hardtop_plat=`cygpath -w ${hardtop}`
347 i386-unknown-cygwin32)
348 hardtop_plat=`cygpath -w ${hardtop}`
351 hardtop_plat=${hardtop}
354 AC_SUBST(hardtop_plat)
356 dnl --------------------------------------------------------------
357 dnl * Project specific configuration options
358 dnl --------------------------------------------------------------
359 dnl What follows is a bunch of options that can either be configured
360 dnl through command line options to the configure script or by
361 dnl supplying defns in the build tree's mk/build.mk. Having the option to
362 dnl use either is considered a Feature.
364 dnl ** What command to use to compile compiler sources ?
365 dnl --------------------------------------------------------------
368 [ --with-ghc=<haskell compiler>
369 Use a command different from 'ghc' to compile GHC-specific Haskell code
370 (including GHC itself).
372 [ WithGhc="$withval" ],
374 if test "$GHC" = ""; then
375 AC_PATH_PROG(GHC,ghc)
383 [ --with-hc=<haskell compiler>
384 Use a command different from 'ghc' to compile generic Haskell code.
391 if test "$WithGhc" != ""; then
392 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
393 AC_SUBST(GhcVersion)dnl
394 AC_SUBST(GhcMajVersion)dnl
395 AC_SUBST(GhcMinVersion)dnl
396 AC_SUBST(GhcPatchLevel)dnl
399 AC_PATH_PROGS(NHC,nhc nhc98)
400 AC_PATH_PROG(HBC,hbc)
402 dnl ** Which gcc to use?
403 dnl --------------------------------------------------------------
405 [ --with-gcc=<gcc command>
406 Use a different command instead of 'gcc' for the GNU C compiler.
408 [WhatGccIsCalled="$withval"
410 [WhatGccIsCalled="gcc"]
412 AC_SUBST(WhatGccIsCalled)
414 dnl ** Booting from .hc files?
415 dnl --------------------------------------------------------------
416 AC_ARG_ENABLE(hc-boot,
418 Boot the Glasgow Haskell Compiler from intermediate .hc files.
419 (This option is mostly of interest to porters.)
424 AC_SUBST(BootingFromHc)
426 dnl ** Booting from unregisterised .hc files?
427 dnl --------------------------------------------------------------
428 AC_ARG_ENABLE(hc-boot-unregisterised,
429 [ --enable-hc-boot-unregisterised
430 With --enable-hc-boot, treat the intermediate .hc files as
431 unregisterised rather than registerised code.
432 (This option is mostly of interest to porters.)
434 [BootingFromUnregisterisedHc=YES],
435 [BootingFromUnregisterisedHc=NO]
437 AC_SUBST(BootingFromUnregisterisedHc)
439 if test "$BootingFromHc" = "NO"; then
440 if test "$BootingFromUnregisterisedHc" = "YES"; then
441 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
446 dnl ** Enable the construction of Win32 DLLs?
447 dnl --------------------------------------------------------------
448 AC_ARG_ENABLE(win32-dlls,
449 [ --enable-win32-dlls
450 If on a Win32 platform running mingw32/cygwin, enable the
451 construction of DLLs containing ghc-compiled code.
457 *) echo "Unrecognised win32 platform: $HostPlatform"
465 AC_SUBST(EnableWin32DLLs)
466 if test x"$EnableWin32DLLs" = "xYES" ; then
467 AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
470 dnl ** Enable the building of the OpenGL/GLUT binding in hslibs?
471 dnl --------------------------------------------------------------
472 AC_ARG_ENABLE(hopengl,
474 Build HOpenGL, a Haskell binding for OpenGL/GLUT, too.
475 (This option is only relevant when hslibs are built.)
477 [GhcLibsWithHOpenGL=YES],
478 [GhcLibsWithHOpenGL=NO]
480 AC_SUBST(GhcLibsWithHOpenGL)
482 dnl ** Use a specific version of the GLUT API
483 dnl --------------------------------------------------------------
484 AC_ARG_WITH(glut-api,
485 [ --with-glut-api=<version>
486 Use a specific version of the GLUT API when building HOpenGL.
488 test -n "$with_glut_api" && CPPFLAGS="$CPPFLAGS -DGLUT_API_VERSION=$with_glut_api"
491 dnl ** Use a specific version of the GLUT API
492 dnl --------------------------------------------------------------
493 AC_ARG_WITH(glut-xlib,
494 [ --with-glut-xlib=<version>
495 Use a specific version of the GLUT Xlib implementation when building HOpenGL.
497 test -n "$with_glut_xlib" && CPPFLAGS="$CPPFLAGS -DGLUT_XLIB_IMPLEMENTATION=$with_glut_xlib"
502 dnl --------------------------------------------------------------
503 dnl End of configure script option section
504 dnl --------------------------------------------------------------
507 dnl --------------------------------------------------------------
508 dnl * General configuration checks
509 dnl --------------------------------------------------------------
514 dnl ** look for `perl', but only in /bin on Windows
517 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
518 if test -z "$PerlCmd"; then
519 echo "You must install the version of Perl shipped with GHC"
520 echo "(or a compatible one) in /bin."
525 AC_PATH_PROG(PerlCmd,perl)
526 if test -z "$PerlCmd"; then
527 echo "You must install perl before you can continue"
528 echo "Perhaps it is already installed, but not in your PATH?"
531 FPTOOLS_CHECK_PERL_VERSION
536 dnl ** does #! path/to/perl work? (sometimes it's too long...)
539 dnl ** look for GCC and find out which version
540 dnl Figure out which C compiler to use. Gcc is preferred.
541 dnl If gcc, make sure it's at least 2.1
546 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
549 dnl ** does the C compiler support the following options?
550 FPTOOLS_CC_FLAG(-mwin32,CC_SUPPORTS_MWIN32)
551 FPTOOLS_CC_FLAG(-mno-cygwin,CC_SUPPORTS_MNO_CYGWIN)
553 EXTRA_CC_OPTS="$CC_SUPPORTS_MNO_CYGWIN $CC_SUPPORTS_MWIN32"
554 SRC_CC_OPTS="-O $EXTRA_CC_OPTS"
555 CPPFLAGS="$EXTRA_CC_OPTS $CPPFLAGS"
556 AC_SUBST(SRC_CC_OPTS)
558 dnl ** figure out how to do context diffs
561 dnl ** Find find command (for Win32's benefit)
564 dnl ** look for a decent parser generator (bison preferred)
565 dnl (FPTOOLS_PROG_YACCY is AC_PROG_YACC, but with some extra testing
566 dnl on the suitability of the 'yacc' returned.)
569 dnl ** Find lex command (lex or flex) - *doesn't* use autoconf's
570 dnl AC_PROG_LEX, since it doesn't actually check whether 'lex'
571 dnl exists if 'flex' doesn't.
574 dnl ** figure out how to do a BSD-ish install
577 dnl If you can run configure, you certainly have /bin/sh
578 AC_DEFINE(HAVE_BIN_SH)
580 dnl ** how to invoke `ar' and `ranlib'
581 FPTOOLS_PROG_AR_AND_RANLIB
584 dnl ** Check to see whether ln -s works
588 dnl ** Find the path to sed
589 AC_PATH_PROG(SedCmd,sed)
592 dnl ** check for time command
593 AC_PATH_PROG(TimeCmd,time)
597 dnl if GNU tar is named gtar, look for it first.
598 AC_PATH_PROGS(TarCmd,gtar tar,tar)
600 dnl ** check for gzip/compress
601 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
603 dnl ** check for jade/openjade & determine a working catalog
604 AC_PATH_PROGS(JadeCmd,openjade jade,jade)
605 FPTOOLS_DOCBOOK_CATALOG(Catalog, $JadeCmd, docs/fptools-both.dsl,
606 /etc/sgml/catalog /etc/sgml.catalog /usr/share/sgml/CATALOG.docbkdsl glafp-utils/docbook/CATALOG*)
607 if test -z "$Catalog"; then
608 AC_MSG_RESULT([Warning: You will not be able to build the documentation.])
614 Catalog=`cygpath -w $hardtop/$Catalog`
616 *) Catalog=$hardtop/$Catalog
623 compress_nm=`basename $CompressCmd`
624 if test x"$compress_nm" = xgzip; then
625 CompressCmd="$CompressCmd -d"
630 AC_SUBST(CompressCmd)
631 AC_SUBST(CompressSuffix)
633 dnl ** check for installed happy binary + version
634 dnl (don't do it if we're booting from .hc files though.)
635 if test "$BootingFromHc" = "NO"; then
639 dnl --------------------------------------------------
640 dnl ### program checking section ends here ###
641 dnl --------------------------------------------------
643 dnl --------------------------------------------------
644 dnl * Platform header file and syscall feature tests
645 dnl ### checking the state of the local header files and syscalls ###
647 dnl ** check for full ANSI header (.h) files
650 dnl ** check for specific header (.h) files that we are interested in
651 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)
653 AC_CHECK_HEADER(readline/readline.h, HaveReadlineReadlineH=YES, HaveReadlineReadlineH=NO)
654 AC_CHECK_HEADER(readline/history.h, HaveReadlineHistoryH=YES, HaveReadlineHistoryH=NO)
656 if test $HaveReadlineReadlineH = YES && test $HaveReadlineHistoryH = YES ; then
657 HaveReadlineHeaders=YES
658 AC_DEFINE(HAVE_READLINE_HEADERS,1)
660 HaveReadlineHeaders=NO
661 AC_DEFINE(HAVE_READLINE_HEADERS,0)
663 AC_SUBST(HaveReadlineHeaders)
665 dnl ** check for DOS include files
666 AC_CHECK_HEADERS(dos.h conio.h io.h std.h)
668 dnl ** check for Windows include files
669 AC_CHECK_HEADERS(windows.h)
671 dnl ** check for OpenGL include files
672 AC_CHECK_HEADERS(GL/gl.h)
674 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
677 dnl dynamic loading include files
678 AC_CHECK_HEADERS(dlfcn.h dl.h)
680 dnl ** check for farcalloc (in bcc)
681 AC_CHECK_HEADER(alloc.h,AC_CHECK_FUNCS(farcalloc))
683 dnl ** check for valloc (in sunos, solaris, mips, amiga, next, minix, ultrix)
684 AC_CHECK_HEADER(malloc.h,AC_CHECK_FUNCS(valloc))
686 dnl ** how do we get a timezone name, and UTC offset ?
689 dnl ** what's the type of timezone?
690 FPTOOLS_HAVE_TIMEZONE
691 FPTOOLS_TYPE_TIMEZONE
693 dnl ** do we have altzone?
696 dnl ** does struct stat contain st_blksize?
699 dnl ** do we have long longs?
702 dnl ** what are the sizes of various types
703 dnl (these must come before GHC_CHECK_ALIGNMENT)
704 AC_CHECK_SIZEOF(char, 1)
705 AC_CHECK_SIZEOF(double, 8)
706 AC_CHECK_SIZEOF(float, 4)
707 AC_CHECK_SIZEOF(int, 4)
708 AC_CHECK_SIZEOF(long, 4)
709 if test "$fptools_cv_have_long_long" = yes; then
710 AC_CHECK_SIZEOF(long long, 8)
712 AC_CHECK_SIZEOF(short, 2)
713 AC_CHECK_SIZEOF(unsigned char, 1)
714 AC_CHECK_SIZEOF(unsigned int, 4)
715 AC_CHECK_SIZEOF(unsigned long, 4)
716 if test "$fptools_cv_have_long_long" = yes; then
717 AC_CHECK_SIZEOF(unsigned long long, 8)
719 AC_CHECK_SIZEOF(unsigned short, 2)
720 AC_CHECK_SIZEOF(void *, 4)
722 dnl ** what are alignment constraints on various types
723 FPTOOLS_CHECK_ALIGNMENT(char)
724 FPTOOLS_CHECK_ALIGNMENT(double)
725 FPTOOLS_CHECK_ALIGNMENT(float)
726 FPTOOLS_CHECK_ALIGNMENT(int)
727 FPTOOLS_CHECK_ALIGNMENT(long)
728 if test "$fptools_cv_have_long_long" = yes; then
729 FPTOOLS_CHECK_ALIGNMENT(long long)
731 FPTOOLS_CHECK_ALIGNMENT(short)
732 FPTOOLS_CHECK_ALIGNMENT(unsigned char)
733 FPTOOLS_CHECK_ALIGNMENT(unsigned int)
734 FPTOOLS_CHECK_ALIGNMENT(unsigned long)
735 if test "$fptools_cv_have_long_long" = yes; then
736 FPTOOLS_CHECK_ALIGNMENT(unsigned long long)
738 FPTOOLS_CHECK_ALIGNMENT(unsigned short)
739 FPTOOLS_CHECK_ALIGNMENT(void *)
741 dnl ** map standard C types and ISO types to Haskell types
742 FPTOOLS_CHECK_HTYPE(char)
743 FPTOOLS_CHECK_HTYPE(signed char)
744 FPTOOLS_CHECK_HTYPE(unsigned char)
745 FPTOOLS_CHECK_HTYPE(short)
746 FPTOOLS_CHECK_HTYPE(unsigned short)
747 FPTOOLS_CHECK_HTYPE(int)
748 FPTOOLS_CHECK_HTYPE(unsigned int)
749 FPTOOLS_CHECK_HTYPE(long)
750 FPTOOLS_CHECK_HTYPE(unsigned long)
751 if test "$fptools_cv_have_long_long" = yes; then
752 FPTOOLS_CHECK_HTYPE(long long)
753 FPTOOLS_CHECK_HTYPE(unsigned long long)
755 FPTOOLS_CHECK_HTYPE(float)
756 FPTOOLS_CHECK_HTYPE(double)
757 FPTOOLS_CHECK_HTYPE(ptrdiff_t)
758 FPTOOLS_CHECK_HTYPE(size_t)
759 FPTOOLS_CHECK_HTYPE(wchar_t)
760 dnl Int32 is a HACK for non-ISO C compilers
761 FPTOOLS_CHECK_HTYPE(sig_atomic_t, Int32)
762 FPTOOLS_CHECK_HTYPE(clock_t)
763 FPTOOLS_CHECK_HTYPE(time_t)
765 dnl ** Map OpenGL data types to Haskell types
766 if test $GhcLibsWithHOpenGL = YES ; then
767 FPTOOLS_CHECK_HTYPE(GLboolean)
768 FPTOOLS_CHECK_HTYPE(GLbyte)
769 FPTOOLS_CHECK_HTYPE(GLubyte)
770 FPTOOLS_CHECK_HTYPE(GLshort)
771 FPTOOLS_CHECK_HTYPE(GLushort)
772 FPTOOLS_CHECK_HTYPE(GLint)
773 FPTOOLS_CHECK_HTYPE(GLuint)
774 FPTOOLS_CHECK_HTYPE(GLsizei)
775 FPTOOLS_CHECK_HTYPE(GLenum)
776 FPTOOLS_CHECK_HTYPE(GLbitfield)
777 FPTOOLS_CHECK_HTYPE(GLfloat)
778 FPTOOLS_CHECK_HTYPE(GLclampf)
779 FPTOOLS_CHECK_HTYPE(GLdouble)
780 FPTOOLS_CHECK_HTYPE(GLclampd)
783 dnl ** can we open files in binary mode?
786 dnl ** check for GetModuleFileName and WinExec (windows only)
787 dnl Old: AC_CHECK_FUNCS(WinExec GetModuleFileName) dnl Windows
788 dnl Doesn't work because the linker can't see the functions if
789 dnl you omit the #include <windows.h>. (I've no idea why not...)
791 FPTOOLS_TRY_LINK_NOWARN(,[
802 if test "$have_winexec" = "1"; then
803 AC_DEFINE(HAVE_WINEXEC)
806 FPTOOLS_TRY_LINK_NOWARN(,[
812 GetModuleFileName((HMODULE)0,dir,0);
816 [have_getmodulefilename=1],
817 [have_getmodulefilename=0])
818 if test "$have_getmodulefilename" = "1"; then
819 AC_DEFINE(HAVE_GETMODULEFILENAME)
822 dnl ** check return type of signal handlers
823 dnl Foo: assumes we can use prototypes.
824 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
825 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
826 dnl [AC_TRY_COMPILE([#include <sys/types.h>
827 dnl #include <signal.h>
831 dnl void (*signal (int, void (*)(int)))(int);
834 dnl ac_cv_type_signal_handler=void_int,
835 dnl ac_cv_type_signal_handler=int_void)])
836 dnl if test "$ac_cv_type_signal_handler" = void_int; then
837 dnl AC_DEFINE(VOID_INT_SIGNALS)
840 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
842 if test "$ac_cv_type_signal" = void; then
843 AC_DEFINE(VOID_INT_SIGNALS)
846 dnl ** check for more functions
847 AC_CHECK_FUNCS(strcasecmp _stricmp stricmp strcmpi)
848 AC_CHECK_FUNCS(strcmp)
849 AC_CHECK_FUNCS(realpath _fullpath)
850 AC_CHECK_FUNCS(PBHSetVolSync macsystem)
851 AC_CHECK_FUNCS(fgetpos fsetpos fseek ftell)
852 AC_CHECK_FUNCS(vsnprintf _vsnprintf)
853 AC_CHECK_FUNCS(snprintf _snprintf )
854 AC_CHECK_FUNCS(popen _popen )
855 AC_CHECK_FUNCS(pclose _pclose )
858 dnl ** check for specific library functions that we are interested in
859 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)
861 dnl ** check whether this machine has gmp3 installed
862 AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
863 AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp3,
864 HaveLibGmp=No; LibGmp=not-installed))
868 dnl ** check whether this machine has GNU regex in libc.
869 FPTOOLS_REGEX_IN_LIBC
871 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
872 dnl the order of these tests matters: bfd needs liberty
873 AC_CHECK_LIB(iberty, xmalloc)
874 AC_CHECK_LIB(bfd, bfd_init)
876 dnl ** check for readline, for Hugs and hslibs' Readline
877 dnl ncurses supersedes termcap and curses, but for compatibility,
878 dnl we have to check for all...
879 AC_CHECK_LIB(ncurses, tputs, HaveLibTermcap=YES; LibTermcap=ncurses,
880 AC_CHECK_LIB(termcap, tputs, HaveLibTermcap=YES; LibTermcap=termcap,
881 AC_CHECK_LIB(curses, tputs, HaveLibTermcap=YES; LibTermcap=curses,
882 HaveLibTermcap=NO; LibTermcap=not-installed)))
884 if test $HaveLibTermcap = YES ; then
885 LIBS="-l$LibTermcap $LIBS"
886 AC_CHECK_LIB(readline, readline, HaveLibReadline=YES, HaveLibReadline=NO)
889 if test $HaveLibTermcap = YES && test x"$HaveLibReadline" = xYES ; then
890 AC_DEFINE(HAVE_READLINE_LIBS,1)
891 LibsReadline="readline $LibTermcap"
893 AC_DEFINE(HAVE_READLINE_LIBS,0)
896 AC_SUBST(LibsReadline)
898 if test "$HaveLibReadline"; then
899 AC_CHECK_LIB(readline, rl_erase_empty_line,
900 [AC_DEFINE(HAVE_READLINE_4, 1)],
901 [AC_DEFINE(HAVE_READLINE_4, 0)])
902 AC_CHECK_LIB(readline, rl_free_undo_list,
903 [AC_DEFINE(HAVE_READLINE_4_2, 1)],
904 [AC_DEFINE(HAVE_READLINE_4_2, 0)])
906 AC_DEFINE(HAVE_READLINE_4, 0)
907 AC_DEFINE(HAVE_READLINE_4_2, 0)
910 dnl ** check for math library
920 dnl ################################################################
921 dnl Check for libraries
922 dnl ################################################################
924 AC_CHECK_LIB(dl, dlopen,
926 AC_DEFINE(HAVE_LIBDL)
929 AC_CHECK_FUNCS(dlopen)
932 FPTOOLS_CHECK_LIB_NOWARN(m, atan)
934 dnl --------------------------------------------------
936 dnl --------------------------------------------------
938 AC_PATH_PROGS(GTK_CONFIG, gtk-config gtk12-config)
939 if test "$GTK_CONFIG" != ""; then
940 AC_CACHE_CHECK([for version of GTK+], fptools_cv_gtk_version, [
941 fptools_cv_gtk_version=`$GTK_CONFIG --version`
943 GTK_VERSION=$fptools_cv_gtk_version
948 case $fptools_cv_gtk_version in
950 *) AC_MSG_WARN([GTK+ not usable; need at least version 1.2])
956 AC_SUBST(GTK_VERSION)
958 dnl --------------------------------------------------
959 dnl * Miscellaneous feature tests
960 dnl --------------------------------------------------
962 dnl ** can we get alloca?
965 dnl ** determine whether or not const works
968 dnl ** determine whether ANSI-function prototypes work?
971 dnl ** are we big endian?
973 # Allay users' general fear of warnings of any kind.
974 errprint(fptools configure script wizard sez: autoconf-2.50 or later should produce no warnings
976 errprint(if you are using 2.13 or earlier, you may get a (harmless) warning message.
979 dnl ** check for leading underscores in symbol names
982 dnl ** how is the end of text section signalled?
983 FPTOOLS_END_TEXT_SECTION
985 dnl ** how is the end of data section signalled?
986 FPTOOLS_END_DATA_SECTION
988 dnl ** code before data?
989 FPTOOLS_CODE_BEFORE_DATA
991 dnl ** check for ld, and whether ld has -x option
992 AC_PATH_PROG(LdCmd, ld)
995 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )