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.."
38 dnl--------------------------------------------------------------------
39 dnl * Choose host(/target/build) platform
40 dnl--------------------------------------------------------------------
42 dnl Guess host/target/build platform(s) if necessary.
45 # "$host" defaults to "$target"
46 if test "x$host" = xNONE ; then
50 dnl ** canonicalize platform names
51 BuildPlatform=`/bin/sh $srcdir/config.sub $build` || exit 1
52 HostPlatform=`/bin/sh $srcdir/config.sub $host` || exit 1
53 TargetPlatform=`/bin/sh $srcdir/config.sub $target` || exit 1
55 if test x"$TargetPlatform" != x"$HostPlatform" ; then
56 echo "GHC configuration does not support differing host/target (i.e., cross-compiling)"
62 # The following will be more difficult when we *are* cross-compiling.
63 # Suitable names to slam in *_CPP are in platform.h.in.
64 # We also record the architecture, vendor, and operating system (OS)
67 alpha*-dec-osf[[12]]*)
68 HostPlatform=alpha-dec-osf1 # canonicalise for our purposes
69 TargetPlatform=alpha-dec-osf1 # this will work for now... (hack)
70 BuildPlatform=alpha-dec-osf1 # hack
71 HostPlatform_CPP='alpha_dec_osf1'
76 alpha*-dec-osf[[345]]*)
77 HostPlatform=alpha-dec-osf3 # canonicalise for our purposes
78 TargetPlatform=alpha-dec-osf3 # this will work for now... (hack)
79 BuildPlatform=alpha-dec-osf3 # hack
80 HostPlatform_CPP='alpha_dec_osf3'
86 HostPlatform=alpha-unknown-linux
87 TargetPlatform=alpha-unknown-linux
88 BuildPlatform=alpha-unknown-linux
89 HostPlatform_CPP='alpha_unknown_linux'
91 HostVendor_CPP='unknown'
94 alpha*-unknown-freebsd*)
95 HostPlatform=alpha-unknown-freebsd
96 TargetPlatform=alpha-unknown-freebsd
97 BuildPlatform=alpha-unknown-freebsd
98 HostPlatform_CPP='alpha_unknown_freebsd'
100 HostVendor_CPP='unknown'
104 HostPlatform=hppa1.1-hp-hpux # canonicalise for our purposes (hack)
105 TargetPlatform=hppa1.1-hp-hpux
106 BuildPlatform=hppa1.1-hp-hpux
107 HostPlatform_CPP='hppa1_1_hp_hpux'
108 HostArch_CPP='hppa1_1'
112 i[[3456]]86-*-linuxaout*)
113 HostPlatform=i386-unknown-linuxaout # hack again
114 TargetPlatform=i386-unknown-linuxaout
115 BuildPlatform=i386-unknown-linuxaout
116 HostPlatform_CPP='i386_unknown_linuxaout'
118 HostVendor_CPP='unknown'
119 HostOS_CPP='linuxaout'
121 i[[3456]]86-*-linux*)
122 HostPlatform=i386-unknown-linux # hack again
123 TargetPlatform=i386-unknown-linux
124 BuildPlatform=i386-unknown-linux
125 HostPlatform_CPP='i386_unknown_linux'
127 HostVendor_CPP='unknown'
130 i[[3456]]86-*-freebsd[[3-9]]*) # FreeBSD 3.0+ uses ELF
131 HostPlatform=i386-unknown-freebsd # hack again
132 TargetPlatform=i386-unknown-freebsd
133 BuildPlatform=i386-unknown-freebsd
134 HostPlatform_CPP='i386_unknown_freebsd'
136 HostVendor_CPP='unknown'
139 i[[3456]]86-*-freebsd2*) # Older FreeBSDs are a.out
140 HostPlatform=i386-unknown-freebsd2 # hack again
141 TargetPlatform=i386-unknown-freebsd2
142 BuildPlatform=i386-unknown-freebsd2
143 HostPlatform_CPP='i386_unknown_freebsd2'
145 HostVendor_CPP='unknown'
146 HostOS_CPP='freebsd2'
148 i[[3456]]86-*-netbsd*)
149 HostPlatform=i386-unknown-netbsd # hack again
150 TargetPlatform=i386-unknown-netbsd
151 BuildPlatform=i386-unknown-netbsd
152 HostPlatform_CPP='i386_unknown_netbsd'
154 HostVendor_CPP='unknown'
157 i[[3456]]86-*-openbsd*)
158 HostPlatform=i386-unknown-openbsd # hack again
159 TargetPlatform=i386-unknown-openbsd
160 BuildPlatform=i386-unknown-openbsd
161 HostPlatform_CPP='i386_unknown_openbsd'
163 HostVendor_CPP='unknown'
166 i[[3456]]86-*-solaris2*)
167 HostPlatform=i386-unknown-solaris2 # hack again
168 TargetPlatform=i386-unknown-solaris2
169 BuildPlatform=i386-unknown-solaris2
170 HostPlatform_CPP='i386_unknown_solaris2'
172 HostVendor_CPP='unknown'
173 HostOS_CPP='solaris2'
175 i[[3456]]86-*-cygwin*)
176 HostPlatform=i386-unknown-cygwin32 # hack again
177 TargetPlatform=i386-unknown-cygwin32
178 BuildPlatform=i386-unknown-cygwin32
179 HostPlatform_CPP='i386_unknown_cygwin32'
181 HostVendor_CPP='unknown'
182 HostOS_CPP='cygwin32'
185 i[[3456]]86-*-mingw32*)
186 HostPlatform=i386-unknown-mingw32 # hack again
187 TargetPlatform=i386-unknown-mingw32
188 BuildPlatform=i386-unknown-mingw32
189 HostPlatform_CPP='i386_unknown_mingw32'
191 HostVendor_CPP='unknown'
196 HostPlatform_CPP='m68k_next_nextstep2'
198 HostVendor_CPP='next'
199 HostOS_CPP='nextstep2'
202 HostPlatform_CPP='m68k_next_nextstep3'
204 HostVendor_CPP='next'
205 HostOS_CPP='nextstep3'
207 i[[3456]]86-next-nextstep3)
208 HostPlatform=i386-next-nextstep3 # hack again
209 TargetPlatform=i386-next-nextstep3
210 BuildPlatform=i386-next-nextstep3
211 HostPlatform_CPP='i386_next_nextstep3'
213 HostVendor_CPP='next'
214 HostOS_CPP='nextstep3'
217 HostPlatform=m68k-sun-sunos4
218 TargetPlatform=m68k-sun-sunos4 #hack
219 BuildPlatform=m68k-sun-sunos4 #hack
220 HostPlatform_CPP='m68k_sun_sunos4'
226 HostPlatform_CPP='mips_dec_ultrix'
227 HostArch_CPP='mipsel' # NB a little different
232 HostPlatform=mips-sgi-irix
233 TargetPlatform=mips-sgi-irix #hack
234 BuildPlatform=mips-sgi-irix #hack
235 HostPlatform_CPP='mips_sgi_irix'
236 HostArch_CPP='mipseb' # NB a little different
241 HostPlatform=rs6000-ibm-aix
242 TargetPlatform=rs6000-ibm-aix #hack
243 BuildPlatform=rs6000-ibm-aix #hack
244 HostPlatform_CPP='rs6000_ibm_aix'
245 HostArch_CPP='rs6000'
250 HostPlatform=powerpc-ibm-aix
251 TargetPlatform=powerpc-ibm-aix #hack
252 BuildPlatform=powerpc-ibm-aix #hack
253 HostPlatform_CPP='powerpc_ibm_aix'
254 HostArch_CPP='powerpc'
258 powerpc-apple-macosx*)
259 HostPlatform=powerpc-apple-macosx
260 TargetPlatform=powerpc-apple-macosx #hack
261 BuildPlatform=powerpc-apple-macosx #hack
262 HostPlatform_CPP='powerpc_apple_macosx'
263 HostArch_CPP='powerpc'
264 HostVendor_CPP='apple'
268 HostPlatform=sparc-sun-sunos4
269 TargetPlatform=sparc-sun-sunos4 #hack
270 BuildPlatform=sparc-sun-sunos4 #hack
271 HostPlatform_CPP='sparc_sun_sunos4'
277 HostPlatform=sparc-sun-solaris2
278 TargetPlatform=sparc-sun-solaris2 #hack
279 BuildPlatform=sparc-sun-solaris2 #hack
280 HostPlatform_CPP='sparc_sun_solaris2'
283 HostOS_CPP='solaris2'
286 echo "Unrecognised platform: $HostPlatform"
290 echo "Canonicalised to: $HostPlatform"
291 test x"$HostPlatform" != x"$TargetPlatform" && echo "Target platform set to $TargetPlatform"
292 test x"$BuildPlatform" != x"$HostPlatform" && echo "Build platform set to $BuildPlatform"
294 BuildPlatform_CPP=$HostPlatform_CPP
295 TargetPlatform_CPP=$HostPlatform_CPP
296 BuildArch_CPP=$HostArch_CPP
297 TargetArch_CPP=$HostArch_CPP
298 BuildOS_CPP=$HostOS_CPP
300 TargetOS_CPP=$HostOS_CPP
301 BuildVendor_CPP=$HostVendor_CPP
302 TargetVendor_CPP=$HostVendor_CPP
304 dnl Cannot afford all these SUBSTs (because of braindead seds w/ 99 cmd limits)
305 dnl AC_SUBST(BuildPlatform)
307 AC_SUBST(HostPlatform)
308 AC_SUBST(TargetPlatform)
309 AC_SUBST(HostPlatform_CPP)
310 dnl AC_SUBST(BuildPlatform_CPP)
311 dnl AC_SUBST(TargetPlatform_CPP)
313 AC_SUBST(HostArch_CPP)
314 dnl AC_SUBST(BuildArch_CPP)
315 dnl AC_SUBST(TargetArch_CPP)
318 AC_SUBST(HostOS_Full)
319 dnl AC_SUBST(BuildOS_CPP)
320 dnl AC_SUBST(TargetOS_CPP)
322 AC_SUBST(HostVendor_CPP)
323 dnl AC_SUBST(BuildVendor_CPP)
324 dnl AC_SUBST(TargetVendor_CPP)
329 # Remove common automounter nonsense + convert from UNC to DOS style paths
330 # (UNC awareness isn't quite there yet for cygwin32-beta18 and consituent tools.)
333 hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|' | sed 's|^/grasp_tmp|/local/grasp_tmp|' | sed 's|^//\(.\)/|\1:/|' `
336 echo "*** The top of your build tree is: $hardtop"
337 case $HostPlatform in
338 i386-unknown-mingw32)
339 hardtop_plat=`cygpath -w ${hardtop}`
341 i386-unknown-cygwin32)
342 hardtop_plat=`cygpath -w ${hardtop}`
345 hardtop_plat=${hardtop}
349 # The native format (i.e., right kind of slashes on a Win32 box).
350 AC_SUBST(hardtop_plat)
352 dnl --------------------------------------------------------------
353 dnl * Project specific configuration options
354 dnl --------------------------------------------------------------
355 dnl What follows is a bunch of options that can either be configured
356 dnl through command line options to the configure script or by
357 dnl supplying defns in the build tree's mk/build.mk. Having the option to
358 dnl use either is considered a Feature.
360 dnl ** What command to use to compile compiler sources ?
361 dnl --------------------------------------------------------------
364 [ --with-ghc=<haskell compiler>
365 Use a command different from 'ghc' to compile GHC-specific Haskell code
366 (including GHC itself).
368 [ WithGhc="$withval" ],
370 if test "$GHC" = ""; then
371 AC_PATH_PROG(GHC,ghc)
379 [ --with-hc=<haskell compiler>
380 Use a command different from 'ghc' to compile generic Haskell code.
387 if test "$WithGhc" != ""; then
388 FPTOOLS_GHC_VERSION([GhcVersion], [GhcMajVersion], [GhcMinVersion], [GhcPatchLevel])dnl
389 AC_SUBST(GhcVersion)dnl
390 AC_SUBST(GhcMajVersion)dnl
391 AC_SUBST(GhcMinVersion)dnl
392 AC_SUBST(GhcPatchLevel)dnl
395 AC_PATH_PROGS(NHC,nhc nhc98)
396 AC_PATH_PROG(HBC,hbc)
398 dnl ** Which gcc to use?
399 dnl --------------------------------------------------------------
401 [ --with-gcc=<gcc command>
402 Use a different command instead of 'gcc' for the GNU C compiler.
404 [WhatGccIsCalled="$withval"
406 [WhatGccIsCalled="gcc"]
408 AC_SUBST(WhatGccIsCalled)
410 dnl ** Booting from .hc files?
411 dnl --------------------------------------------------------------
412 AC_ARG_ENABLE(hc-boot,
414 Boot the Glasgow Haskell Compiler from intermediate .hc files.
415 (This option is mostly of interest to porters.)
420 AC_SUBST(BootingFromHc)
422 dnl ** Booting from unregisterised .hc files?
423 dnl --------------------------------------------------------------
424 AC_ARG_ENABLE(hc-boot-unregisterised,
425 [ --enable-hc-boot-unregisterised
426 With --enable-hc-boot, treat the intermediate .hc files as
427 unregisterised rather than registerised code.
428 (This option is mostly of interest to porters.)
430 [BootingFromUnregisterisedHc=YES],
431 [BootingFromUnregisterisedHc=NO]
433 AC_SUBST(BootingFromUnregisterisedHc)
435 if test "$BootingFromHc" = "NO"; then
436 if test "$BootingFromUnregisterisedHc" = "YES"; then
437 AC_MSG_ERROR([--enable-hc-boot-unregisterised requires --enable-hc-boot.])
442 dnl ** Enable the construction of Win32 DLLs?
443 dnl --------------------------------------------------------------
444 AC_ARG_ENABLE(win32-dlls,
445 [ --enable-win32-dlls
446 If on a Win32 platform running mingw32/cygwin, enable the
447 construction of DLLs containing ghc-compiled code.
453 *) echo "Unrecognised win32 platform: $HostPlatform"
461 AC_SUBST(EnableWin32DLLs)
462 if test x"$EnableWin32DLLs" = "xYES" ; then
463 AC_DEFINE(HAVE_WIN32_DLL_SUPPORT)
466 dnl ** Enable the building of the OpenGL/GLUT binding in hslibs?
467 dnl --------------------------------------------------------------
468 AC_ARG_ENABLE(hopengl,
470 Build HOpenGL, a Haskell binding for OpenGL/GLUT, too.
471 (This option is only relevant when hslibs are built.)
473 [GhcLibsWithHOpenGL=YES],
474 [GhcLibsWithHOpenGL=NO]
476 AC_SUBST(GhcLibsWithHOpenGL)
478 dnl ** Use a specific version of the GLUT API
479 dnl --------------------------------------------------------------
480 AC_ARG_WITH(glut-api,
481 [ --with-glut-api=<version>
482 Use a specific version of the GLUT API when building HOpenGL.
484 test -n "$with_glut_api" && CPPFLAGS="$CPPFLAGS -DGLUT_API_VERSION=$with_glut_api"
487 dnl ** Use a specific version of the GLUT API
488 dnl --------------------------------------------------------------
489 AC_ARG_WITH(glut-xlib,
490 [ --with-glut-xlib=<version>
491 Use a specific version of the GLUT Xlib implementation when building HOpenGL.
493 test -n "$with_glut_xlib" && CPPFLAGS="$CPPFLAGS -DGLUT_XLIB_IMPLEMENTATION=$with_glut_xlib"
498 dnl --------------------------------------------------------------
499 dnl End of configure script option section
500 dnl --------------------------------------------------------------
503 dnl --------------------------------------------------------------
504 dnl * General configuration checks
505 dnl --------------------------------------------------------------
510 dnl ** look for `perl', but only in /bin on Windows
513 AC_CHECK_PROG(PerlCmd,perl,/bin/perl,,/bin)
514 if test -z "$PerlCmd"; then
515 echo "You must install the version of Perl shipped with GHC"
516 echo "(or a compatible one) in /bin."
521 AC_PATH_PROG(PerlCmd,perl)
522 if test -z "$PerlCmd"; then
523 echo "You must install perl before you can continue"
524 echo "Perhaps it is already installed, but not in your PATH?"
527 FPTOOLS_CHECK_PERL_VERSION
532 dnl ** does #! path/to/perl work? (sometimes it's too long...)
535 dnl ** look for GCC and find out which version
536 dnl Figure out which C compiler to use. Gcc is preferred.
537 dnl If gcc, make sure it's at least 2.1
542 dnl ** figure out how to invoke cpp directly (gcc -E is no good)
545 dnl ** does the C compiler support the following options?
546 FPTOOLS_CC_FLAG(-mwin32,CC_SUPPORTS_MWIN32)
547 FPTOOLS_CC_FLAG(-mno-cygwin,CC_SUPPORTS_MNO_CYGWIN)
549 EXTRA_CC_OPTS="$CC_SUPPORTS_MNO_CYGWIN $CC_SUPPORTS_MWIN32"
550 SRC_CC_OPTS="-O $EXTRA_CC_OPTS"
551 CPPFLAGS="$EXTRA_CC_OPTS $CPPFLAGS"
552 AC_SUBST(SRC_CC_OPTS)
554 dnl ** figure out how to do context diffs
557 dnl ** Find find command (for Win32's benefit)
560 dnl ** look for a decent parser generator (bison preferred)
561 dnl (FPTOOLS_PROG_YACCY is AC_PROG_YACC, but with some extra testing
562 dnl on the suitability of the 'yacc' returned.)
565 dnl ** Find lex command (lex or flex) - *doesn't* use autoconf's
566 dnl AC_PROG_LEX, since it doesn't actually check whether 'lex'
567 dnl exists if 'flex' doesn't.
570 dnl ** figure out how to do a BSD-ish install
573 dnl If you can run configure, you certainly have /bin/sh
574 AC_DEFINE(HAVE_BIN_SH)
576 dnl ** how to invoke `ar' and `ranlib'
577 FPTOOLS_PROG_AR_AND_RANLIB
580 dnl ** Check to see whether ln -s works
584 dnl ** Find the path to sed
585 AC_PATH_PROG(SedCmd,sed)
588 dnl ** check for time command
589 AC_PATH_PROG(TimeCmd,time)
593 dnl if GNU tar is named gtar, look for it first.
594 AC_PATH_PROGS(TarCmd,gtar tar,tar)
596 dnl ** check for gzip/compress
597 AC_PATH_PROGS(CompressCmd,gzip compress,gzip)
599 dnl ** check for jade/openjade & determine a working catalog
600 AC_PATH_PROGS(JadeCmd,openjade jade,jade)
601 FPTOOLS_DOCBOOK_CATALOG(Catalog, $JadeCmd, docs/fptools-both.dsl,
602 /etc/sgml/catalog /etc/sgml.catalog /usr/share/sgml/CATALOG.docbkdsl glafp-utils/docbook/CATALOG*)
603 if test -z "$Catalog"; then
604 AC_MSG_RESULT([Warning: You will not be able to build the documentation.])
610 Catalog=`cygpath -w $hardtop/$Catalog`
612 *) Catalog=$hardtop/$Catalog
619 compress_nm=`basename $CompressCmd`
620 if test x"$compress_nm" = xgzip; then
621 CompressCmd="$CompressCmd -d"
626 AC_SUBST(CompressCmd)
627 AC_SUBST(CompressSuffix)
629 dnl ** check for installed happy binary + version
630 dnl (don't do it if we're booting from .hc files though.)
631 if test "$BootingFromHc" = "NO"; then
635 dnl --------------------------------------------------
636 dnl ### program checking section ends here ###
637 dnl --------------------------------------------------
639 dnl --------------------------------------------------
640 dnl * Platform header file and syscall feature tests
641 dnl ### checking the state of the local header files and syscalls ###
643 dnl ** check for full ANSI header (.h) files
646 dnl ** check for specific header (.h) files that we are interested in
647 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)
649 AC_CHECK_HEADER(readline/readline.h, HaveReadlineReadlineH=YES, HaveReadlineReadlineH=NO)
650 AC_CHECK_HEADER(readline/history.h, HaveReadlineHistoryH=YES, HaveReadlineHistoryH=NO)
652 if test $HaveReadlineReadlineH = YES && test $HaveReadlineHistoryH = YES ; then
653 HaveReadlineHeaders=YES
654 AC_DEFINE(HAVE_READLINE_HEADERS,1)
656 HaveReadlineHeaders=NO
657 AC_DEFINE(HAVE_READLINE_HEADERS,0)
659 AC_SUBST(HaveReadlineHeaders)
661 dnl ** check for DOS include files
662 AC_CHECK_HEADERS(dos.h conio.h io.h std.h)
664 dnl ** check for Windows include files
665 AC_CHECK_HEADERS(windows.h)
667 dnl ** check for OpenGL include files
668 AC_CHECK_HEADERS(GL/gl.h)
670 dnl ** check if it is safe to include both <time.h> and <sys/time.h>
673 dnl dynamic loading include files
674 AC_CHECK_HEADERS(dlfcn.h dl.h)
676 dnl ** check for farcalloc (in bcc)
677 AC_CHECK_HEADER(alloc.h,AC_CHECK_FUNCS(farcalloc))
679 dnl ** check for valloc (in sunos, solaris, mips, amiga, next, minix, ultrix)
680 AC_CHECK_HEADER(malloc.h,AC_CHECK_FUNCS(valloc))
682 dnl ** how do we get a timezone name, and UTC offset ?
685 dnl ** what's the type of timezone?
686 FPTOOLS_HAVE_TIMEZONE
687 FPTOOLS_TYPE_TIMEZONE
689 dnl ** do we have altzone?
692 dnl ** does struct stat contain st_blksize?
695 dnl ** do we have long longs?
698 dnl ** what are the sizes of various types
699 dnl (these must come before GHC_CHECK_ALIGNMENT)
700 AC_CHECK_SIZEOF(char, 1)
701 AC_CHECK_SIZEOF(double, 8)
702 AC_CHECK_SIZEOF(float, 4)
703 AC_CHECK_SIZEOF(int, 4)
704 AC_CHECK_SIZEOF(long, 4)
705 if test "$fptools_cv_have_long_long" = yes; then
706 AC_CHECK_SIZEOF(long long, 8)
708 AC_CHECK_SIZEOF(short, 2)
709 AC_CHECK_SIZEOF(unsigned char, 1)
710 AC_CHECK_SIZEOF(unsigned int, 4)
711 AC_CHECK_SIZEOF(unsigned long, 4)
712 if test "$fptools_cv_have_long_long" = yes; then
713 AC_CHECK_SIZEOF(unsigned long long, 8)
715 AC_CHECK_SIZEOF(unsigned short, 2)
716 AC_CHECK_SIZEOF(void *, 4)
718 dnl ** what are alignment constraints on various types
719 FPTOOLS_CHECK_ALIGNMENT(char)
720 FPTOOLS_CHECK_ALIGNMENT(double)
721 FPTOOLS_CHECK_ALIGNMENT(float)
722 FPTOOLS_CHECK_ALIGNMENT(int)
723 FPTOOLS_CHECK_ALIGNMENT(long)
724 if test "$fptools_cv_have_long_long" = yes; then
725 FPTOOLS_CHECK_ALIGNMENT(long long)
727 FPTOOLS_CHECK_ALIGNMENT(short)
728 FPTOOLS_CHECK_ALIGNMENT(unsigned char)
729 FPTOOLS_CHECK_ALIGNMENT(unsigned int)
730 FPTOOLS_CHECK_ALIGNMENT(unsigned long)
731 if test "$fptools_cv_have_long_long" = yes; then
732 FPTOOLS_CHECK_ALIGNMENT(unsigned long long)
734 FPTOOLS_CHECK_ALIGNMENT(unsigned short)
735 FPTOOLS_CHECK_ALIGNMENT(void *)
737 dnl ** map standard C types and ISO types to Haskell types
738 FPTOOLS_CHECK_HTYPE(char)
739 FPTOOLS_CHECK_HTYPE(signed char)
740 FPTOOLS_CHECK_HTYPE(unsigned char)
741 FPTOOLS_CHECK_HTYPE(short)
742 FPTOOLS_CHECK_HTYPE(unsigned short)
743 FPTOOLS_CHECK_HTYPE(int)
744 FPTOOLS_CHECK_HTYPE(unsigned int)
745 FPTOOLS_CHECK_HTYPE(long)
746 FPTOOLS_CHECK_HTYPE(unsigned long)
747 if test "$fptools_cv_have_long_long" = yes; then
748 FPTOOLS_CHECK_HTYPE(long long)
749 FPTOOLS_CHECK_HTYPE(unsigned long long)
751 FPTOOLS_CHECK_HTYPE(float)
752 FPTOOLS_CHECK_HTYPE(double)
753 FPTOOLS_CHECK_HTYPE(ptrdiff_t)
754 FPTOOLS_CHECK_HTYPE(size_t)
755 FPTOOLS_CHECK_HTYPE(wchar_t)
756 dnl Int32 is a HACK for non-ISO C compilers
757 FPTOOLS_CHECK_HTYPE(sig_atomic_t, Int32)
758 FPTOOLS_CHECK_HTYPE(clock_t)
759 FPTOOLS_CHECK_HTYPE(time_t)
761 dnl ** Map OpenGL data types to Haskell types
762 if test $GhcLibsWithHOpenGL = YES ; then
763 FPTOOLS_CHECK_HTYPE(GLboolean)
764 FPTOOLS_CHECK_HTYPE(GLbyte)
765 FPTOOLS_CHECK_HTYPE(GLubyte)
766 FPTOOLS_CHECK_HTYPE(GLshort)
767 FPTOOLS_CHECK_HTYPE(GLushort)
768 FPTOOLS_CHECK_HTYPE(GLint)
769 FPTOOLS_CHECK_HTYPE(GLuint)
770 FPTOOLS_CHECK_HTYPE(GLsizei)
771 FPTOOLS_CHECK_HTYPE(GLenum)
772 FPTOOLS_CHECK_HTYPE(GLbitfield)
773 FPTOOLS_CHECK_HTYPE(GLfloat)
774 FPTOOLS_CHECK_HTYPE(GLclampf)
775 FPTOOLS_CHECK_HTYPE(GLdouble)
776 FPTOOLS_CHECK_HTYPE(GLclampd)
779 dnl ** can we open files in binary mode?
782 dnl ** check for GetModuleFileName and WinExec (windows only)
783 dnl Old: AC_CHECK_FUNCS(WinExec GetModuleFileName) dnl Windows
784 dnl Doesn't work because the linker can't see the functions if
785 dnl you omit the #include <windows.h>. (I've no idea why not...)
787 FPTOOLS_TRY_LINK_NOWARN(,[
798 if test "$have_winexec" = "1"; then
799 AC_DEFINE(HAVE_WINEXEC)
802 FPTOOLS_TRY_LINK_NOWARN(,[
808 GetModuleFileName((HMODULE)0,dir,0);
812 [have_getmodulefilename=1],
813 [have_getmodulefilename=0])
814 if test "$have_getmodulefilename" = "1"; then
815 AC_DEFINE(HAVE_GETMODULEFILENAME)
818 dnl ** check return type of signal handlers
819 dnl Foo: assumes we can use prototypes.
820 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
821 dnl AC_CACHE_CHECK([type of signal handlers], ac_cv_type_signal_handler,
822 dnl [AC_TRY_COMPILE([#include <sys/types.h>
823 dnl #include <signal.h>
827 dnl void (*signal (int, void (*)(int)))(int);
830 dnl ac_cv_type_signal_handler=void_int,
831 dnl ac_cv_type_signal_handler=int_void)])
832 dnl if test "$ac_cv_type_signal_handler" = void_int; then
833 dnl AC_DEFINE(VOID_INT_SIGNALS)
836 dnl On BCC, signal handlers have type "int(void)", elsewhere its "void(int)".
838 if test "$ac_cv_type_signal" = void; then
839 AC_DEFINE(VOID_INT_SIGNALS)
842 dnl ** check for more functions
843 AC_CHECK_FUNCS(strcasecmp _stricmp stricmp strcmpi)
844 AC_CHECK_FUNCS(strcmp)
845 AC_CHECK_FUNCS(realpath _fullpath)
846 AC_CHECK_FUNCS(PBHSetVolSync macsystem)
847 AC_CHECK_FUNCS(fgetpos fsetpos fseek ftell)
848 AC_CHECK_FUNCS(vsnprintf _vsnprintf)
849 AC_CHECK_FUNCS(snprintf _snprintf )
850 AC_CHECK_FUNCS(popen _popen )
851 AC_CHECK_FUNCS(pclose _pclose )
854 dnl ** check for specific library functions that we are interested in
855 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)
857 dnl ** check whether this machine has gmp3 installed
858 AC_CHECK_LIB(gmp, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp,
859 AC_CHECK_LIB(gmp3, __gmpz_fdiv_qr, HaveLibGmp=YES; LibGmp=gmp3,
860 HaveLibGmp=No; LibGmp=not-installed))
864 dnl ** check whether this machine has GNU regex in libc.
865 FPTOOLS_REGEX_IN_LIBC
867 dnl ** check whether this machine has BFD and liberty installed (used for debugging)
868 dnl the order of these tests matters: bfd needs liberty
869 AC_CHECK_LIB(iberty, xmalloc)
870 AC_CHECK_LIB(bfd, bfd_init)
872 dnl ** check for readline, for Hugs and hslibs' Readline
873 dnl ncurses supersedes termcap and curses, but for compatibility,
874 dnl we have to check for all...
875 AC_CHECK_LIB(ncurses, tputs, HaveLibTermcap=YES; LibTermcap=ncurses,
876 AC_CHECK_LIB(termcap, tputs, HaveLibTermcap=YES; LibTermcap=termcap,
877 AC_CHECK_LIB(curses, tputs, HaveLibTermcap=YES; LibTermcap=curses,
878 HaveLibTermcap=NO; LibTermcap=not-installed)))
880 if test $HaveLibTermcap = YES ; then
881 LIBS="-l$LibTermcap $LIBS"
882 AC_CHECK_LIB(readline, readline, HaveLibReadline=YES, HaveLibReadline=NO)
885 if test $HaveLibTermcap = YES && test x"$HaveLibReadline" = xYES ; then
886 AC_DEFINE(HAVE_READLINE_LIBS,1)
887 LibsReadline="readline $LibTermcap"
889 AC_DEFINE(HAVE_READLINE_LIBS,0)
892 AC_SUBST(LibsReadline)
894 if test "$HaveLibReadline"; then
895 AC_CHECK_LIB(readline, rl_erase_empty_line,
896 [AC_DEFINE(HAVE_READLINE_4, 1)],
897 [AC_DEFINE(HAVE_READLINE_4, 0)])
898 AC_CHECK_LIB(readline, rl_free_undo_list,
899 [AC_DEFINE(HAVE_READLINE_4_2, 1)],
900 [AC_DEFINE(HAVE_READLINE_4_2, 0)])
902 AC_DEFINE(HAVE_READLINE_4, 0)
903 AC_DEFINE(HAVE_READLINE_4_2, 0)
906 dnl ** check for math library
916 dnl ################################################################
917 dnl Check for libraries
918 dnl ################################################################
920 AC_CHECK_LIB(dl, dlopen,
922 AC_DEFINE(HAVE_LIBDL)
925 AC_CHECK_FUNCS(dlopen)
928 FPTOOLS_CHECK_LIB_NOWARN(m, atan)
930 dnl --------------------------------------------------
932 dnl --------------------------------------------------
934 AC_PATH_PROGS(GTK_CONFIG, gtk-config gtk12-config)
935 if test "$GTK_CONFIG" != ""; then
936 AC_CACHE_CHECK([for version of GTK+], fptools_cv_gtk_version, [
937 fptools_cv_gtk_version=`$GTK_CONFIG --version`
939 GTK_VERSION=$fptools_cv_gtk_version
944 case $fptools_cv_gtk_version in
946 *) AC_MSG_WARN([GTK+ not usable; need at least version 1.2])
952 AC_SUBST(GTK_VERSION)
954 dnl --------------------------------------------------
955 dnl * Miscellaneous feature tests
956 dnl --------------------------------------------------
958 dnl ** can we get alloca?
961 dnl ** determine whether or not const works
964 dnl ** determine whether ANSI-function prototypes work?
967 dnl ** are we big endian?
969 # Allay users' general fear of warnings of any kind.
970 errprint(fptools configure script wizard sez: autoconf-2.50 or later should produce no warnings
972 errprint(if you are using 2.13 or earlier, you may get a (harmless) warning message.
975 dnl ** check for leading underscores in symbol names
978 dnl ** how is the end of text section signalled?
979 FPTOOLS_END_TEXT_SECTION
981 dnl ** how is the end of data section signalled?
982 FPTOOLS_END_DATA_SECTION
984 dnl ** code before data?
985 FPTOOLS_CODE_BEFORE_DATA
987 dnl ** check for ld, and whether ld has -x option
988 AC_PATH_PROG(LdCmd, ld)
991 AC_OUTPUT(mk/config.mk, echo timestamp > mk/stamp-h )