Merge pull request #119126 from fabaff/pycomfoconnect
[NixPkgs.git] / pkgs / development / compilers / ocaml / configure-3.08.0
blob9c8705855120b1c314f32fbde34b96bbaed0bfd0
1 #! /bin/sh
3 #########################################################################
4 # #
5 # Objective Caml #
6 # #
7 # Xavier Leroy, projet Cristal, INRIA Rocquencourt #
8 # #
9 # Copyright 1999 Institut National de Recherche en Informatique et #
10 # en Automatique. All rights reserved. This file is distributed #
11 # under the terms of the GNU Library General Public License, with #
12 # the special exception on linking described in file LICENSE. #
13 # #
14 #########################################################################
16 # $Id: configure,v 1.215.2.3 2004/07/09 15:08:51 doligez Exp $
18 configure_options="$*"
19 prefix=/usr/local
20 bindir=''
21 libdir=''
22 mandir=''
23 manext=1
24 host_type=unknown
25 ccoption=''
26 cclibs=''
27 curseslibs=''
28 mathlib='-lm'
29 dllib=''
30 x11_include_dir=''
31 x11_lib_dir=''
32 tk_wanted=yes
33 pthread_wanted=yes
34 tk_defs=''
35 tk_libs=''
36 tk_x11=yes
37 dl_defs=''
38 verbose=no
39 withcurses=yes
40 withsharedlibs=yes
41 binutils_dir=''
42 gcc_warnings="-Wall"
44 # Try to turn internationalization off, can cause config.guess to malfunction!
45 unset LANG
46 unset LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
48 # Turn off some macOS debugging stuff, same reason
49 unset RC_TRACE_ARCHIVES RC_TRACE_DYLIBS RC_TRACE_PREBINDING_DISABLED
51 # Parse command-line arguments
53 while : ; do
54 case "$1" in
55 "") break;;
56 -prefix|--prefix)
57 prefix=$2; shift;;
58 -bindir|--bindir)
59 bindir=$2; shift;;
60 -libdir|--libdir)
61 libdir=$2; shift;;
62 -mandir|--mandir)
63 case "$2" in
64 */man[1-9ln])
65 mandir=`echo $2 | sed -e 's|^\(.*\)/man.$|\1|'`
66 manext=`echo $2 | sed -e 's/^.*\(.\)$/\1/'`;;
68 mandir=$2
69 manext=1;;
70 esac
71 shift;;
72 -host*|--host*)
73 host_type=$2; shift;;
74 -cc*)
75 ccoption="$2"; shift;;
76 -lib*)
77 cclibs="$2 $cclibs"; shift;;
78 -no-curses)
79 withcurses=no;;
80 -no-shared-libs)
81 withsharedlibs=no;;
82 -x11include*|--x11include*)
83 x11_include_dir=$2; shift;;
84 -x11lib*|--x11lib*)
85 x11_lib_dir=$2; shift;;
86 -with-pthread*|--with-pthread*)
87 ;; # Ignored for backward compatibility
88 -no-pthread*|--no-pthread*)
89 pthread_wanted=no;;
90 -no-tk|--no-tk)
91 tk_wanted=no;;
92 -tkdefs*|--tkdefs*)
93 tk_defs=$2; shift;;
94 -tklibs*|--tklibs*)
95 tk_libs=$2; shift;;
96 -tk-no-x11|--tk-no-x11)
97 tk_x11=no;;
98 -dldefs*|--dldefs*)
99 dl_defs="$2"; shift;;
100 -dllibs*|--dllibs*)
101 dllib="$2"; shift;;
102 -binutils*|--binutils*)
103 binutils_dir=$2; shift;;
104 -verbose|--verbose)
105 verbose=yes;;
106 *) echo "Unknown option \"$1\"." 1>&2; exit 2;;
107 esac
108 shift
109 done
111 # Sanity checks
113 case "$prefix" in
114 /*) ;;
115 *) echo "The -prefix directory must be absolute." 1>&2; exit 2;;
116 esac
117 case "$bindir" in
118 /*) ;;
119 "") ;;
120 *) echo "The -bindir directory must be absolute." 1>&2; exit 2;;
121 esac
122 case "$libdir" in
123 /*) ;;
124 "") ;;
125 *) echo "The -libdir directory must be absolute." 1>&2; exit 2;;
126 esac
127 case "$mandir" in
128 /*) ;;
129 "") ;;
130 *) echo "The -mandir directory must be absolute." 1>&2; exit 2;;
131 esac
133 # Generate the files
135 cd config/auto-aux
136 rm -f s.h m.h Makefile
137 touch s.h m.h Makefile
139 # Write options to Makefile
141 echo "# generated by ./configure $configure_options" >> Makefile
143 # Where to install
145 echo "PREFIX=$prefix" >> Makefile
146 case "$bindir" in
147 "") echo 'BINDIR=$(PREFIX)/bin' >> Makefile
148 bindir="$prefix/bin";;
149 *) echo "BINDIR=$bindir" >> Makefile;;
150 esac
151 case "$libdir" in
152 "") echo 'LIBDIR=$(PREFIX)/lib/ocaml' >> Makefile
153 libdir="$prefix/lib/ocaml";;
154 *) echo "LIBDIR=$libdir" >> Makefile;;
155 esac
156 echo 'STUBLIBDIR=$(LIBDIR)/stublibs' >> Makefile
157 case "$mandir" in
158 "") echo 'MANDIR=$(PREFIX)/man' >> Makefile
159 mandir="$prefix/man";;
160 *) echo "MANDIR=$mandir" >> Makefile;;
161 esac
162 echo "MANEXT=$manext" >> Makefile
164 # Determine the system type
166 if test "$host_type" = "unknown"; then
167 if host_type=`../gnu/config.guess`; then :; else
168 echo "Cannot guess host type"
169 echo "You must specify one with the -host option"
170 exit 2
173 if host=`../gnu/config.sub $host_type`; then :; else
174 echo "Please specify the correct host type with the -host option"
175 exit 2
177 echo "Configuring for a $host ..."
179 # Do we have gcc?
181 if test -z "$ccoption"; then
182 if sh ./searchpath gcc; then
183 echo "gcc found"
184 cc=gcc
185 else
186 cc=cc
188 else
189 cc="$ccoption"
192 # Check for buggy versions of GCC
194 buggycc="no"
196 case "$host,$cc" in
197 i[3456]86-*-*,gcc*)
198 case `$cc --version` in
199 2.7.2.1) cat <<'EOF'
201 WARNING: you are using gcc version 2.7.2.1 on an Intel x86 processor.
202 This version of gcc is known to generate incorrect code for the
203 Objective Caml runtime system on some Intel x86 machines. (The symptom
204 is a crash of boot/ocamlc when compiling stdlib/pervasives.mli.)
205 In particular, the version of gcc 2.7.2.1 that comes with
206 Linux RedHat 4.x / Intel is affected by this problem.
207 Other Linux distributions might also be affected.
208 If you are using one of these configurations, you are strongly advised
209 to use another version of gcc, such as 2.95, which are
210 known to work well with Objective Caml.
212 Press <enter> to proceed or <interrupt> to stop.
214 read reply;;
215 2.96*) cat <<'EOF'
217 WARNING: you are using gcc version 2.96 on an Intel x86 processor.
218 Certain patched versions of gcc 2.96 are known to generate incorrect
219 code for the Objective Caml runtime system. (The symptom is a segmentation
220 violation on boot/ocamlc.) Those incorrectly patched versions can be found
221 in RedHat 7.2 and Mandrake 8.0 and 8.1; other Linux distributions
222 might also be affected. (See bug #57760 on bugzilla.redhat.com)
224 Auto-configuration will now select gcc compiler flags that work around
225 the problem. Still, if you observe segmentation faults while running
226 ocamlc or ocamlopt, you are advised to try another version of gcc,
227 such as 2.95.3 or 3.2.
230 buggycc="gcc.2.96";;
232 esac;;
233 esac
235 # Configure the bytecode compiler
237 bytecc="$cc"
238 bytecccompopts=""
239 bytecclinkopts=""
240 ostype="Unix"
241 exe=""
243 case "$bytecc,$host" in
244 cc,*-*-nextstep*)
245 # GNU C extensions disabled, but __GNUC__ still defined!
246 bytecccompopts="-fno-defer-pop $gcc_warnings -U__GNUC__ -posix"
247 bytecclinkopts="-posix";;
248 *,*-*-rhapsody*)
249 # Almost the same as NeXTStep
250 bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
251 mathlib="";;
252 *,*-*-darwin*)
253 # Almost the same as rhapsody
254 bytecccompopts="-fno-defer-pop -no-cpp-precomp $gcc_warnings"
255 mathlib="";;
256 *,*-*-beos*)
257 bytecccompopts="-fno-defer-pop $gcc_warnings"
258 # No -lm library
259 mathlib="";;
260 gcc,alpha*-*-osf*)
261 bytecccompopts="-fno-defer-pop $gcc_warnings"
262 if cc="$bytecc" sh ./hasgot -mieee; then
263 bytecccompopts="-mieee $bytecccompopts";
265 # Put code and static data in lower 4GB
266 bytecclinkopts="-Wl,-T,12000000 -Wl,-D,14000000"
267 # Tell gcc that we can use 32-bit code addresses for threaded code
268 echo "#define ARCH_CODE32" >> m.h;;
269 cc,alpha*-*-osf*)
270 bytecccompopts="-std1 -ieee";;
271 gcc,alpha*-*-linux*)
272 if cc="$bytecc" sh ./hasgot -mieee; then
273 bytecccompopts="-mieee $bytecccompopts";
274 fi;;
275 cc,mips-*-irix6*)
276 # Add -n32 flag to ensure compatibility with native-code compiler
277 bytecccompopts="-n32"
278 # Turn off warning "unused library"
279 bytecclinkopts="-n32 -Wl,-woff,84";;
280 cc*,mips-*-irix6*)
281 # (For those who want to force "cc -64")
282 # Turn off warning "unused library"
283 bytecclinkopts="-Wl,-woff,84";;
284 *,alpha*-*-unicos*)
285 # For the Cray T3E
286 bytecccompopts="-DUMK";;
287 gcc*,powerpc-*-aix4.3*)
288 # Avoid name-space pollution by requiring Unix98-conformant includes
289 bytecccompopts="-fno-defer-pop $gcc_warnings -D_XOPEN_SOURCE=500";;
290 *,powerpc-*-aix4.3*)
291 bytecccompopts="-D_XOPEN_SOURCE=500";;
292 gcc*,*-*-cygwin*)
293 bytecccompopts="-fno-defer-pop $gcc_warnings -U_WIN32"
294 exe=".exe"
295 ostype="Cygwin";;
296 gcc*,x86_64-*-linux*)
297 bytecccompopts="-fno-defer-pop $gcc_warnings"
298 # Tell gcc that we can use 32-bit code addresses for threaded code
299 echo "#define ARCH_CODE32" >> m.h;;
300 gcc*)
301 bytecccompopts="-fno-defer-pop $gcc_warnings";;
302 esac
304 # Configure compiler to use in further tests
306 cc="$bytecc -O $bytecclinkopts"
307 export cc cclibs verbose
309 # Check C compiler
311 sh ./runtest ansi.c
312 case $? in
313 0) echo "The C compiler is ANSI-compliant.";;
314 1) echo "The C compiler $cc is not ANSI-compliant."
315 echo "You need an ANSI C compiler to build Objective Caml."
316 exit 2;;
317 *) echo "Unable to compile the test program."
318 echo "Make sure the C compiler $cc is properly installed."
319 exit 2;;
320 esac
322 # Check the sizes of data types
324 echo "Checking the sizes of integers and pointers..."
325 set `sh ./runtest sizes.c`
326 case "$2,$3" in
327 4,4) echo "OK, this is a regular 32 bit architecture."
328 echo "#undef ARCH_SIXTYFOUR" >> m.h;;
329 8,8) echo "Wow! A 64 bit architecture!"
330 echo "#define ARCH_SIXTYFOUR" >> m.h;;
331 *,8) echo "Wow! A 64 bit architecture!"
332 echo "Unfortunately, Objective Caml cannot work in the case"
333 echo "sizeof(long) != sizeof(long *)."
334 echo "Objective Caml won't run on this architecture."
335 exit 2;;
336 *,*) echo "This architecture seems to be neither 32 bits nor 64 bits."
337 echo "Objective Caml won't run on this architecture."
338 exit 2;;
339 *) echo "Unable to compile the test program."
340 echo "Make sure the C compiler $cc is properly installed."
341 exit 2;;
342 esac
343 if test $1 != 4 && test $2 != 4 && test $4 != 4; then
344 echo "Sorry, we can't find a 32-bit integer type"
345 echo "(sizeof(short) = $4, sizeof(int) = $1, sizeof(long) = $2)"
346 echo "Objective Caml won't run on this architecture."
347 exit 2
350 echo "#define SIZEOF_INT $1" >> m.h
351 echo "#define SIZEOF_LONG $2" >> m.h
352 echo "#define SIZEOF_SHORT $4" >> m.h
354 if test $2 = 8; then
355 echo "#define ARCH_INT64_TYPE long" >> m.h
356 echo "#define ARCH_UINT64_TYPE unsigned long" >> m.h
357 echo '#define ARCH_INT64_PRINTF_FORMAT "l"' >> m.h
358 int64_native=true
359 else
360 sh ./runtest longlong.c
361 case $? in
362 0) echo "64-bit \"long long\" integer type found (printf with \"%ll\")."
363 echo "#define ARCH_INT64_TYPE long long" >> m.h
364 echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
365 echo '#define ARCH_INT64_PRINTF_FORMAT "ll"' >> m.h
366 int64_native=true;;
367 1) echo "64-bit \"long long\" integer type found (printf with \"%q\")."
368 echo "#define ARCH_INT64_TYPE long long" >> m.h
369 echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
370 echo '#define ARCH_INT64_PRINTF_FORMAT "q"' >> m.h
371 int64_native=true;;
372 2) echo "64-bit \"long long\" integer type found (but no printf)."
373 echo "#define ARCH_INT64_TYPE long long" >> m.h
374 echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
375 echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
376 int64_native=true;;
377 *) echo "No suitable 64-bit integer type found, will use software emulation."
378 echo "#undef ARCH_INT64_TYPE" >> m.h
379 echo "#undef ARCH_UINT64_TYPE" >> m.h
380 echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
381 int64_native=false;;
382 esac
385 # Determine endianness
387 sh ./runtest endian.c
388 case $? in
389 0) echo "This is a big-endian architecture."
390 echo "#define ARCH_BIG_ENDIAN" >> m.h;;
391 1) echo "This is a little-endian architecture."
392 echo "#undef ARCH_BIG_ENDIAN" >> m.h;;
393 2) echo "This architecture seems to be neither big endian nor little endian."
394 echo "Objective Caml won't run on this architecture."
395 exit 2;;
396 *) echo "Something went wrong during endianness determination."
397 echo "You'll have to figure out endianness yourself"
398 echo "(option ARCH_BIG_ENDIAN in m.h).";;
399 esac
401 # Determine alignment constraints
403 case "$host" in
404 sparc-*-*|hppa*-*-*)
405 # On Sparc V9 with certain versions of gcc, determination of double
406 # alignment is not reliable (PR#1521), hence force it.
407 # Same goes for hppa.
408 # But there's a knack (PR#2572):
409 # if we're in 64-bit mode (sizeof(long) == 8),
410 # we must not doubleword-align floats...
411 if test $2 = 8; then
412 echo "Doubles can be word-aligned."
413 echo "#undef ARCH_ALIGN_DOUBLE" >> m.h
414 else
415 echo "Doubles must be doubleword-aligned."
416 echo "#define ARCH_ALIGN_DOUBLE" >> m.h
417 fi;;
419 sh ./runtest dblalign.c
420 case $? in
421 0) echo "Doubles can be word-aligned."
422 echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
423 1) echo "Doubles must be doubleword-aligned."
424 echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
425 *) echo "Something went wrong during alignment determination for doubles."
426 echo "I'm going to assume this architecture has alignment constraints over doubles."
427 echo "That's a safe bet: Objective Caml will work even if"
428 echo "this architecture has actually no alignment constraints."
429 echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
430 esac;;
431 esac
433 if $int64_native; then
434 case "$host" in
435 hppa*-*-*)
436 if test $2 = 8; then
437 echo "64-bit integers can be word-aligned."
438 echo "#undef ARCH_ALIGN_INT64" >> m.h
439 else
440 echo "64-bit integers must be doubleword-aligned."
441 echo "#define ARCH_ALIGN_INT64" >> m.h
442 fi;;
444 sh ./runtest int64align.c
445 case $? in
446 0) echo "64-bit integers can be word-aligned."
447 echo "#undef ARCH_ALIGN_INT64" >> m.h;;
448 1) echo "64-bit integers must be doubleword-aligned."
449 echo "#define ARCH_ALIGN_INT64" >> m.h;;
450 *) echo "Something went wrong during alignment determination for 64-bit integers."
451 echo "I'm going to assume this architecture has alignment constraints."
452 echo "That's a safe bet: Objective Caml will work even if"
453 echo "this architecture has actually no alignment constraints."
454 echo "#define ARCH_ALIGN_INT64" >> m.h;;
455 esac
456 esac
457 else
458 echo "#undef ARCH_ALIGN_INT64" >> m.h
461 # Check semantics of division and modulus
463 sh ./runtest divmod.c
464 case $? in
465 0) echo "Native division and modulus have round-towards-zero semantics, will use them."
466 echo "#undef NONSTANDARD_DIV_MOD" >> m.h;;
467 1) echo "Native division and modulus do not have round-towards-zero semantics, will use software emulation."
468 echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
469 *) echo "Something went wrong while checking native division and modulus, please report it."
470 echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
471 esac
473 # Shared library support
475 shared_libraries_supported=false
476 dl_needs_underscore=false
477 sharedcccompopts=''
478 mksharedlib=''
479 byteccrpath=''
480 mksharedlibrpath=''
482 if test $withsharedlibs = "yes"; then
483 case "$host" in
484 *-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*)
485 sharedcccompopts="-fPIC"
486 mksharedlib="$bytecc -shared -o"
487 bytecclinkopts="$bytecclinkopts -Wl,-E"
488 byteccrpath="-Wl,-rpath,"
489 mksharedlibrpath="-Wl,-rpath,"
490 shared_libraries_supported=true;;
491 alpha*-*-osf*)
492 case "$bytecc" in
493 gcc*)
494 sharedcccompopts="-fPIC"
495 mksharedlib="$bytecc -shared -o"
496 byteccrpath="-Wl,-rpath,"
497 mksharedlibrpath="-Wl,-rpath,"
498 shared_libraries_supported=true;;
499 cc*)
500 sharedcccompopts=""
501 mksharedlib="ld -shared -expect_unresolved '*' -o"
502 byteccrpath="-Wl,-rpath,"
503 mksharedlibrpath="-rpath "
504 shared_libraries_supported=true;;
505 esac;;
506 *-*-solaris2*)
507 case "$bytecc" in
508 gcc*)
509 sharedcccompopts="-fPIC"
510 if sh ./solaris-ld; then
511 mksharedlib="$bytecc -shared -o"
512 byteccrpath="-R"
513 mksharedlibrpath="-R"
514 else
515 mksharedlib="$bytecc -shared -o"
516 bytecclinkopts="$bytecclinkopts -Wl,-E"
517 byteccrpath="-Wl,-rpath,"
518 mksharedlibrpath="-Wl,-rpath,"
520 shared_libraries_supported=true;;
522 sharedcccompopts="-KPIC"
523 byteccrpath="-R"
524 mksharedlibrpath="-R"
525 mksharedlib="/usr/ccs/bin/ld -G -o"
526 shared_libraries_supported=true;;
527 esac;;
528 mips*-*-irix[56]*)
529 case "$bytecc" in
530 cc*) sharedcccompopts="";;
531 gcc*) sharedcccompopts="-fPIC";;
532 esac
533 mksharedlib="ld -shared -rdata_shared -o"
534 byteccrpath="-Wl,-rpath,"
535 mksharedlibrpath="-rpath "
536 shared_libraries_supported=true;;
537 powerpc-apple-darwin*)
538 mksharedlib="cc -bundle -flat_namespace -undefined suppress -o"
539 bytecccompopts="$dl_defs $bytecccompopts"
540 #sharedcccompopts="-fnocommon"
541 dl_needs_underscore=true
542 shared_libraries_supported=true;;
543 esac
546 # Further machine-specific hacks
548 case "$host" in
549 ia64-*-linux*|alpha*-*-linux*|x86_64-*-linux*)
550 echo "Will use mmap() instead of malloc() for allocation of major heap chunks."
551 echo "#define USE_MMAP_INSTEAD_OF_MALLOC" >> s.h;;
552 esac
554 # Configure the native-code compiler
556 arch=none
557 model=default
558 system=unknown
560 case "$host" in
561 alpha*-*-osf*) arch=alpha; system=digital;;
562 alpha*-*-linux*) arch=alpha; system=linux;;
563 alpha*-*-freebsd*) arch=alpha; system=freebsd;;
564 alpha*-*-netbsd*) arch=alpha; system=netbsd;;
565 alpha*-*-openbsd*) arch=alpha; system=openbsd;;
566 sparc*-*-sunos4.*) arch=sparc; system=sunos;;
567 sparc*-*-solaris2.*) arch=sparc; system=solaris;;
568 sparc*-*-*bsd*) arch=sparc; system=bsd;;
569 sparc*-*-linux*) arch=sparc; system=linux;;
570 i[3456]86-*-linux*) arch=i386; system=linux_`sh ./runtest elf.c`;;
571 i[3456]86-*-*bsd*) arch=i386; system=bsd_`sh ./runtest elf.c`;;
572 i[3456]86-*-nextstep*) arch=i386; system=nextstep;;
573 i[3456]86-*-solaris*) arch=i386; system=solaris;;
574 i[3456]86-*-beos*) arch=i386; system=beos;;
575 i[3456]86-*-cygwin*) arch=i386; system=cygwin;;
576 mips-*-irix6*) arch=mips; system=irix;;
577 hppa1.1-*-hpux*) arch=hppa; system=hpux;;
578 hppa2.0*-*-hpux*) arch=hppa; system=hpux;;
579 hppa*-*-linux*) arch=hppa; system=linux;;
580 powerpc-*-linux*) arch=power; model=ppc; system=elf;;
581 powerpc-*-netbsd*) arch=power; model=ppc; system=bsd;;
582 powerpc-*-rhapsody*) arch=power; model=ppc; system=rhapsody;;
583 powerpc-*-darwin*) arch=power; model=ppc; system=rhapsody;;
584 arm*-*-linux*) arch=arm; system=linux;;
585 ia64-*-linux*) arch=ia64; system=linux;;
586 ia64-*-freebsd*) arch=ia64; system=freebsd;;
587 x86_64-*-linux*) arch=amd64; system=linux;;
588 x86_64-*-freebsd*) arch=amd64; system=freebsd;;
589 x86_64-*-openbsd*) arch=amd64; system=openbsd;;
590 esac
592 if test -z "$ccoption"; then
593 case "$arch,$system,$cc" in
594 alpha,digital,gcc*) nativecc=cc;;
595 mips,*,gcc*) nativecc=cc;;
596 *) nativecc="$bytecc";;
597 esac
598 else
599 nativecc="$ccoption"
602 nativecccompopts=''
603 nativecclinkopts=''
604 nativeccrpath="$byteccrpath"
606 case "$arch,$nativecc,$system,$host_type" in
607 alpha,cc*,digital,*) nativecccompopts=-std1;;
608 mips,cc*,irix,*) nativecccompopts=-n32
609 nativecclinkopts="-n32 -Wl,-woff,84";;
610 *,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix"
611 nativecclinkopts="-posix";;
612 *,*,rhapsody,*darwin[1-5].*)
613 nativecccompopts="$gcc_warnings -DSHRINKED_GNUC";;
614 *,*,rhapsody,*)
615 nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6 $dl_defs";;
616 *,gcc*,cygwin,*) nativecccompopts="$gcc_warnings -U_WIN32";;
617 *,gcc*,*,*) nativecccompopts="$gcc_warnings";;
618 esac
620 asflags=''
621 aspp='$(AS)'
622 asppflags=''
623 asppprofflags='-DPROFILING'
625 case "$arch,$model,$system" in
626 alpha,*,digital) asflags='-O2'; asppflags='-O2 -DSYS_$(SYSTEM)';
627 asppprofflags='-pg -DPROFILING';;
628 alpha,*,linux) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
629 alpha,*,freebsd) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
630 alpha,*,netbsd) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
631 alpha,*,openbsd) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
632 mips,*,irix) asflags='-n32 -O2'; asppflags="$asflags";;
633 sparc,*,bsd) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
634 sparc,*,linux) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
635 sparc,*,*) case "$cc" in
636 gcc*) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
637 *) asppflags='-P -DSYS_$(SYSTEM)';;
638 esac;;
639 i386,*,solaris) aspp='/usr/ccs/bin/as'; asppflags='-P -DSYS_$(SYSTEM)';;
640 i386,*,*) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
641 hppa,*,*) aspp="$cc"; asppflags='-traditional -c -DSYS_$(SYSTEM)';;
642 power,*,elf) aspp='gcc'; asppflags='-c';;
643 power,*,bsd) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
644 power,*,rhapsody) ;;
645 arm,*,linux) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
646 ia64,*,*) asflags=-xexplicit
647 aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM) -Wa,-xexplicit';;
648 amd64,*,*) aspp='gcc'; asppflags='-c -DSYS_$(SYSTEM)';;
649 esac
651 cc_profile='-pg'
652 case "$arch,$model,$system" in
653 alpha,*,digital) profiling='prof';;
654 i386,*,linux_elf) profiling='prof';;
655 i386,*,bsd_elf) profiling='prof';;
656 sparc,*,solaris)
657 profiling='prof'
658 case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
659 amd64,*,linux) profiling='prof';;
660 *) profiling='noprof';;
661 esac
663 # Where are GNU binutils?
665 binutils_objcopy=''
666 binutils_nm=''
668 if test "$arch" != "none"; then
669 binutils_path="${binutils_dir}:${PATH}:/usr/libexec/binutils"
670 old_IFS="$IFS"
671 IFS=':'
672 for d in ${binutils_path}; do
673 if test -z "$d"; then continue; fi
674 if test -f "$d/objcopy" && test -f "$d/nm"; then
675 echo "objcopy and nm found in $d"
676 if test `$d/objcopy --help | grep -s -c 'redefine-sym'` -eq 0; then
677 echo "$d/objcopy does not support option --redefine-sym, discarded"
678 continue;
680 if test `$d/nm --version | grep -s -c 'GNU nm'` -eq 0; then
681 echo "$d/nm is not from GNU binutils, discarded"
682 continue;
684 binutils_objcopy="$d/objcopy"
685 binutils_nm="$d/nm"
686 break
688 done
689 IFS="$old_IFS"
692 # Where is ranlib?
694 if sh ./searchpath ranlib; then
695 echo "ranlib found"
696 echo "RANLIB=ranlib" >> Makefile
697 echo "RANLIBCMD=ranlib" >> Makefile
698 else
699 echo "ranlib not used"
700 echo "RANLIB=ar rs" >> Makefile
701 echo "RANLIBCMD=" >> Makefile
704 # Do #! scripts work?
706 if (SHELL=/bin/sh; export SHELL; (./sharpbang || ./sharpbang2) >/dev/null); then
707 echo "#! appears to work in shell scripts"
708 case "$host" in
709 *-*-sunos*|*-*-unicos*)
710 echo "We won't use it, though, because under SunOS and Unicos it breaks"
711 echo "on pathnames longer than 30 characters"
712 echo "SHARPBANGSCRIPTS=false" >> Makefile;;
713 *-*-cygwin*)
714 echo "We won't use it, though, because of conflicts with .exe extension"
715 echo "under Cygwin"
716 echo "SHARPBANGSCRIPTS=false" >> Makefile;;
718 echo "SHARPBANGSCRIPTS=true" >> Makefile;;
719 esac
720 else
721 echo "No support for #! in shell scripts"
722 echo "SHARPBANGSCRIPTS=false" >> Makefile
725 # Write the OS type (Unix or Cygwin)
727 echo "#define OCAML_OS_TYPE \"$ostype\"" >> s.h
728 echo "#define OCAML_STDLIB_DIR \"$libdir\"" >> s.h
730 # Use 64-bit file offset if possible
732 bytecccompopts="$bytecccompopts -D_FILE_OFFSET_BITS=64"
733 nativecccompopts="$nativecccompopts -D_FILE_OFFSET_BITS=64"
735 # Check the semantics of signal handlers
737 if sh ./hasgot sigaction sigprocmask; then
738 echo "POSIX signal handling found."
739 echo "#define POSIX_SIGNALS" >> s.h
740 else
741 if sh ./runtest signals.c; then
742 echo "Signals have the BSD semantics."
743 echo "#define BSD_SIGNALS" >> s.h
744 else
745 echo "Signals have the System V semantics."
747 if sh ./hasgot sigsetmask; then
748 echo "sigsetmask() found"
749 echo "#define HAS_SIGSETMASK" >> s.h
753 # For the sys module
755 if sh ./hasgot times; then
756 echo "times() found."
757 echo "#define HAS_TIMES" >> s.h
760 # For the terminfo module
762 if test "$withcurses" = "yes"; then
763 for libs in "" "-lcurses" "-ltermcap" "-lcurses -ltermcap" "-lncurses"; do
764 if sh ./hasgot $libs tgetent tgetstr tgetnum tputs; then
765 echo "termcap functions found (with libraries '$libs')"
766 echo "#define HAS_TERMCAP" >> s.h
767 curseslibs="${libs}"
768 break
770 done
773 # Configuration for the libraries
775 otherlibraries="unix str num dynlink bigarray"
777 # For the Unix library
779 has_sockets=no
780 if sh ./hasgot socket socketpair bind listen accept connect; then
781 echo "You have BSD sockets."
782 echo "#define HAS_SOCKETS" >> s.h
783 has_sockets=yes
784 elif sh ./hasgot -lnsl -lsocket socket socketpair bind listen accept connect; then
785 echo "You have BSD sockets (with libraries '-lnsl -lsocket')"
786 cclibs="$cclibs -lnsl -lsocket"
787 echo "#define HAS_SOCKETS" >> s.h
788 has_sockets=yes
791 if sh ./hasgot -i sys/socket.h -t socklen_t; then
792 echo "socklen_t is defined in <sys/socket.h>"
793 echo "#define HAS_SOCKLEN_T" >> s.h
796 if sh ./hasgot inet_aton; then
797 echo "inet_aton() found."
798 echo "#define HAS_INET_ATON" >> s.h
801 if sh ./hasgot -i sys/types.h -i sys/socket.h -i netinet/in.h \
802 -t 'struct sockaddr_in6' \
803 && sh ./hasgot getaddrinfo getnameinfo inet_pton inet_ntop; then
804 echo "IPv6 is supported."
805 echo "#define HAS_IPV6" >> s.h
808 if sh ./hasgot -i unistd.h; then
809 echo "unistd.h found."
810 echo "#define HAS_UNISTD" >> s.h
813 if sh ./hasgot -i sys/types.h -t off_t; then
814 echo "off_t is defined in <sys/types.h>"
815 echo "#define HAS_OFF_T" >> s.h
818 if sh ./hasgot -i sys/types.h -i dirent.h; then
819 echo "dirent.h found."
820 echo "#define HAS_DIRENT" >> s.h
823 if sh ./hasgot rewinddir; then
824 echo "rewinddir() found."
825 echo "#define HAS_REWINDDIR" >> s.h
828 if sh ./hasgot lockf; then
829 echo "lockf() found."
830 echo "#define HAS_LOCKF" >> s.h
833 if sh ./hasgot mkfifo; then
834 echo "mkfifo() found."
835 echo "#define HAS_MKFIFO" >> s.h
838 if sh ./hasgot getcwd; then
839 echo "getcwd() found."
840 echo "#define HAS_GETCWD" >> s.h
843 if sh ./hasgot getwd; then
844 echo "getwd() found."
845 echo "#define HAS_GETWD" >> s.h
848 if sh ./hasgot getpriority setpriority; then
849 echo "getpriority() found."
850 echo "#define HAS_GETPRIORITY" >> s.h
853 if sh ./hasgot -i sys/types.h -i utime.h && sh ./hasgot utime; then
854 echo "utime() found."
855 echo "#define HAS_UTIME" >> s.h
858 if sh ./hasgot utimes; then
859 echo "utimes() found."
860 echo "#define HAS_UTIMES" >> s.h
863 if sh ./hasgot dup2; then
864 echo "dup2() found."
865 echo "#define HAS_DUP2" >> s.h
868 if sh ./hasgot fchmod fchown; then
869 echo "fchmod() found."
870 echo "#define HAS_FCHMOD" >> s.h
873 if sh ./hasgot truncate ftruncate; then
874 echo "truncate() found."
875 echo "#define HAS_TRUNCATE" >> s.h
878 select_include=''
879 if sh ./hasgot -i sys/types.h -i sys/select.h; then
880 echo "sys/select.h found."
881 echo "#define HAS_SYS_SELECT_H" >> s.h
882 select_include='-i sys/select.h'
885 has_select=no
886 if sh ./hasgot select && \
887 sh ./hasgot -i sys/types.h $select_include -t fd_set ; then
888 echo "select() found."
889 echo "#define HAS_SELECT" >> s.h
890 has_select=yes
893 if sh ./hasgot symlink readlink lstat; then
894 echo "symlink() found."
895 echo "#define HAS_SYMLINK" >> s.h
898 has_wait=no
899 if sh ./hasgot waitpid; then
900 echo "waitpid() found."
901 echo "#define HAS_WAITPID" >> s.h
902 has_wait=yes
905 if sh ./hasgot wait4; then
906 echo "wait4() found."
907 echo "#define HAS_WAIT4" >> s.h
908 has_wait=yes
911 if sh ./hasgot -i limits.h && sh ./runtest getgroups.c; then
912 echo "getgroups() found."
913 echo "#define HAS_GETGROUPS" >> s.h
916 if sh ./hasgot -i termios.h &&
917 sh ./hasgot tcgetattr tcsetattr tcsendbreak tcflush tcflow; then
918 echo "POSIX termios found."
919 echo "#define HAS_TERMIOS" >> s.h
922 # Async I/O under OSF1 3.x are so buggy that the test program hangs...
923 testasyncio=true
924 if test -f /usr/bin/uname; then
925 case "`/usr/bin/uname -s -r`" in
926 "OSF1 V3."*) testasyncio=false;;
927 esac
929 if $testasyncio && sh ./runtest async_io.c; then
930 echo "Asynchronous I/O are supported."
931 echo "#define HAS_ASYNC_IO" >> s.h
934 has_setitimer=no
935 if sh ./hasgot setitimer; then
936 echo "setitimer() found."
937 echo "#define HAS_SETITIMER" >> s.h
938 has_setitimer="yes"
941 if sh ./hasgot gethostname; then
942 echo "gethostname() found."
943 echo "#define HAS_GETHOSTNAME" >> s.h
946 if sh ./hasgot -i sys/utsname.h && sh ./hasgot uname; then
947 echo "uname() found."
948 echo "#define HAS_UNAME" >> s.h
951 has_gettimeofday=no
952 if sh ./hasgot gettimeofday; then
953 echo "gettimeofday() found."
954 echo "#define HAS_GETTIMEOFDAY" >> s.h
955 has_gettimeofday="yes"
958 if sh ./hasgot mktime; then
959 echo "mktime() found."
960 echo "#define HAS_MKTIME" >> s.h
963 case "$host" in
964 *-*-cygwin*) ;; # setsid emulation under Cygwin breaks the debugger
965 *) if sh ./hasgot setsid; then
966 echo "setsid() found."
967 echo "#define HAS_SETSID" >> s.h
968 fi;;
969 esac
971 if sh ./hasgot putenv; then
972 echo "putenv() found."
973 echo "#define HAS_PUTENV" >> s.h
976 if sh ./hasgot -i locale.h && sh ./hasgot setlocale; then
977 echo "setlocale() and <locale.h> found."
978 echo "#define HAS_LOCALE" >> s.h
981 if sh ./hasgot -i mach-o/dyld.h && sh ./hasgot NSLinkModule; then
982 echo "NSLinkModule() found. Using darwin dynamic loading."
983 echo "#define HAS_NSLINKMODULE" >> s.h
984 elif sh ./hasgot $dllib dlopen; then
985 echo "dlopen() found."
986 elif sh ./hasgot $dllib -ldl dlopen; then
987 echo "dlopen() found in -ldl."
988 dllib="$dllib -ldl"
989 else
990 shared_libraries_supported=no
993 if $shared_libraries_supported; then
994 echo "Dynamic loading of shared libraries is supported."
995 echo "#define SUPPORT_DYNAMIC_LINKING" >> s.h
996 if $dl_needs_underscore; then
997 echo '#define DL_NEEDS_UNDERSCORE' >>s.h
1001 if sh ./hasgot -i sys/types.h -i sys/mman.h && sh ./hasgot mmap munmap; then
1002 echo "mmap() found."
1003 echo "#define HAS_MMAP" >> s.h
1006 nargs=none
1007 for i in 5 6; do
1008 if sh ./trycompile -DNUM_ARGS=${i} gethostbyname.c; then nargs=$i; break; fi
1009 done
1010 if test $nargs != "none"; then
1011 echo "gethostbyname_r() found (with ${nargs} arguments)."
1012 echo "#define HAS_GETHOSTBYNAME_R $nargs" >> s.h
1015 nargs=none
1016 for i in 7 8; do
1017 if sh ./trycompile -DNUM_ARGS=${i} gethostbyaddr.c; then nargs=$i; break; fi
1018 done
1019 if test $nargs != "none"; then
1020 echo "gethostbyaddr_r() found (with ${nargs} arguments)."
1021 echo "#define HAS_GETHOSTBYADDR_R $nargs" >> s.h
1024 # Determine if the debugger is supported
1026 if test "$has_sockets" = "yes"; then
1027 echo "Replay debugger supported."
1028 debugger="ocamldebugger"
1029 else
1030 echo "No replay debugger (missing system calls)"
1031 debugger=""
1035 # Determine if system stack overflows can be detected
1037 case "$arch,$system" in
1038 i386,linux_elf)
1039 echo "System stack overflow can be detected."
1040 echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;;
1042 echo "Cannot detect system stack overflow.";;
1043 esac
1045 # Determine the target architecture for the "num" library
1047 case "$host" in
1048 alpha*-*-*) bng_arch=alpha; bng_asm_level=1;;
1049 i[3456]86-*-*) bng_arch=ia32
1050 if sh ./trycompile ia32sse2.c
1051 then bng_asm_level=2
1052 else bng_asm_level=1
1053 fi;;
1054 mips-*-*) bng_arch=mips; bng_asm_level=1;;
1055 powerpc-*-*) bng_arch=ppc; bng_asm_level=1;;
1056 sparc*-*-*) bng_arch=sparc; bng_asm_level=1;;
1057 x86_64-*-*) bng_arch=amd64; bng_asm_level=1;;
1058 *) bng_arch=generic; bng_asm_level=0;;
1059 esac
1061 echo "BNG_ARCH=$bng_arch" >> Makefile
1062 echo "BNG_ASM_LEVEL=$bng_asm_level" >> Makefile
1064 # Determine if the POSIX threads library is supported
1066 if test "$pthread_wanted" = "yes"; then
1067 case "$host" in
1068 *-*-solaris*) pthread_link="-lpthread -lposix4";;
1069 *-*-freebsd*) pthread_link="-pthread";;
1070 *-*-openbsd*) pthread_link="-pthread";;
1071 *) pthread_link="-lpthread";;
1072 esac
1073 if ./hasgot -i pthread.h $pthread_link pthread_self; then
1074 echo "POSIX threads library supported."
1075 otherlibraries="$otherlibraries systhreads"
1076 bytecccompopts="$bytecccompopts -D_REENTRANT"
1077 nativecccompopts="$nativecccompopts -D_REENTRANT"
1078 case "$host" in
1079 *-*-freebsd*)
1080 bytecccompopts="$bytecccompopts -D_THREAD_SAFE"
1081 nativecccompopts="$nativecccompopts -D_THREAD_SAFE";;
1082 *-*-openbsd*)
1083 bytecccompopts="$bytecccompopts -pthread"
1084 asppflags="$asppflags -pthread"
1085 nativecccompopts="$nativecccompopts -pthread";;
1086 esac
1087 echo "Options for linking with POSIX threads: $pthread_link"
1088 echo "PTHREAD_LINK=$pthread_link" >> Makefile
1089 if sh ./hasgot $pthread_link sigwait; then
1090 echo "sigwait() found"
1091 echo "#define HAS_SIGWAIT" >> s.h
1093 else
1094 echo "POSIX threads not found."
1095 pthread_link=""
1099 # Determine if the bytecode thread library is supported
1101 if test "$has_select" = "yes" \
1102 && test "$has_setitimer" = "yes" \
1103 && test "$has_gettimeofday" = "yes" \
1104 && test "$has_wait" = "yes"; then
1105 echo "Bytecode threads library supported."
1106 otherlibraries="$otherlibraries threads"
1107 else
1108 echo "Bytecode threads library not supported (missing system calls)"
1111 # Determine the location of X include files and libraries
1113 x11_include="not found"
1114 x11_link="not found"
1116 for dir in \
1117 $x11_include_dir \
1120 if test -f $dir/X11/X.h; then
1121 x11_include=$dir
1122 break
1124 done
1126 if test "$x11_include" = "not found"; then
1127 x11_try_lib_dir=''
1128 else
1129 x11_try_lib_dir=`echo $x11_include | sed -e 's|include|lib|'`
1132 for dir in \
1133 $x11_lib_dir \
1134 $x11_try_lib_dir \
1137 if test -f $dir/libX11.a || \
1138 test -f $dir/libX11.so || \
1139 test -f $dir/libX11.dll.a || \
1140 test -f $dir/libX11.sa; then
1141 if test $dir = /usr/lib; then
1142 x11_link="-lX11"
1143 else
1144 x11_link="-L$dir -lX11"
1145 x11_libs="-L$dir"
1147 break
1149 done
1152 if test "$x11_include" = "not found" || test "$x11_link" = "not found"
1153 then
1154 echo "X11 not found, the \"graph\" library will not be supported."
1155 x11_include=""
1156 else
1157 echo "Location of X11 include files: $x11_include/X11"
1158 echo "Options for linking with X11: $x11_link"
1159 otherlibraries="$otherlibraries graph"
1160 if test "$x11_include" = "/usr/include"; then
1161 x11_include=""
1162 else
1163 x11_include="-I$x11_include"
1165 echo "X11_INCLUDES=$x11_include" >> Makefile
1166 echo "X11_LINK=$x11_link" >> Makefile
1169 # See if we can compile the dbm library
1171 dbm_include="not found"
1172 dbm_link="not found"
1173 use_gdbm_ndbm=no
1175 for dir in ; do
1176 if test -f $dir/ndbm.h; then
1177 dbm_include=$dir
1178 if sh ./hasgot dbm_open; then
1179 dbm_link=""
1180 elif sh ./hasgot -lndbm dbm_open; then
1181 dbm_link="-lndbm"
1182 elif sh ./hasgot -ldb1 dbm_open; then
1183 dbm_link="-ldb1"
1184 elif sh ./hasgot -lgdbm dbm_open; then
1185 dbm_link="-lgdbm"
1186 elif sh ./hasgot -lgdbm_compat -lgdbm dbm_open; then
1187 dbm_link="-lgdbm_compat -lgdbm"
1189 break
1191 if test -f $dir/gdbm-ndbm.h; then
1192 dbm_include=$dir
1193 use_gdbm_ndbm=yes
1194 if sh ./hasgot -lgdbm_compat -lgdbm dbm_open; then
1195 dbm_link="-lgdbm_compat -lgdbm"
1197 break
1199 done
1200 if test "$dbm_include" = "not found" || test "$dbm_link" = "not found"; then
1201 echo "NDBM not found, the \"dbm\" library will not be supported."
1202 else
1203 echo "NDBM found (in $dbm_include)"
1204 if test "$dbm_include" = "/usr/include"; then
1205 dbm_include=""
1206 else
1207 dbm_include="-I$dbm_include"
1209 echo "DBM_INCLUDES=$dbm_include" >> Makefile
1210 echo "DBM_LINK=$dbm_link" >> Makefile
1211 if test "$use_gdbm_ndbm" = "yes"; then
1212 echo "#define DBM_USES_GDBM_NDBM" >> s.h
1214 otherlibraries="$otherlibraries dbm"
1217 # Look for tcl/tk
1219 echo "Configuring LablTk..."
1221 if test $tk_wanted = no; then
1222 has_tk=false
1223 elif test $tk_x11 = no; then
1224 has_tk=true
1225 elif test "$x11_include" = "not found" || test "$x11_link" = "not found"; then
1226 echo "X11 not found."
1227 has_tk=false
1228 else
1229 tk_x11_include="$x11_include"
1230 tk_x11_libs="$x11_libs -lX11"
1231 has_tk=true
1234 if test $has_tk = true; then
1235 tcl_version=''
1236 tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1237 if test -z "$tcl_version" && test -z "$tk_defs"; then
1238 tk_defs=-I/usr/local/include
1239 tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1241 if test -z "$tcl_version"; then
1242 tk_defs="-I/usr/local/include/tcl8.2 -I/usr/local/include/tk8.2"
1243 tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1245 if test -z "$tcl_version"; then
1246 tk_defs="-I/usr/local/include/tcl8.3 -I/usr/local/include/tk8.3"
1247 tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1249 if test -z "$tcl_version"; then
1250 tk_defs="-I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4"
1251 tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1253 if test -z "$tcl_version"; then
1254 tk_defs="-I/usr/include/tcl8.2 -I/usr/include/tk8.2"
1255 tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1257 if test -z "$tcl_version"; then
1258 tk_defs="-I/usr/include/tcl8.3 -I/usr/include/tk8.3"
1259 tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1261 if test -z "$tcl_version"; then
1262 tk_defs="-I/usr/include/tcl8.4 -I/usr/include/tk8.4"
1263 tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1265 if test -z "$tcl_version"; then
1266 tk_defs="-I/sw/include"
1267 tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1269 if test -n "$tcl_version"; then
1270 echo "tcl.h version $tcl_version found with \"$tk_defs\"."
1271 case $tcl_version in
1272 7.5) tclmaj=7 tclmin=5 tkmaj=4 tkmin=1 ;;
1273 7.6) tclmaj=7 tclmin=6 tkmaj=4 tkmin=2 ;;
1274 8.0) tclmaj=8 tclmin=0 tkmaj=8 tkmin=0 ;;
1275 8.1) tclmaj=8 tclmin=1 tkmaj=8 tkmin=1 ;;
1276 8.2) tclmaj=8 tclmin=2 tkmaj=8 tkmin=2 ;;
1277 8.3) tclmaj=8 tclmin=3 tkmaj=8 tkmin=3 ;;
1278 8.4) tclmaj=8 tclmin=4 tkmaj=8 tkmin=4 ;;
1279 *) echo "This version is not known."; has_tk=false ;;
1280 esac
1281 else
1282 echo "tcl.h not found."
1283 has_tk=false
1287 if test $has_tk = true; then
1288 if sh ./hasgot $tk_x11_include $tk_defs -i tk.h; then
1289 echo "tk.h found."
1290 else
1291 echo "tk.h not found."
1292 has_tk=false
1296 tkauxlibs="$mathlib $dllib"
1297 tcllib=''
1298 tklib=''
1299 if test $has_tk = true; then
1300 if sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs Tcl_DoOneEvent
1301 then tk_libs="$tk_libs $dllib"
1302 elif sh ./hasgot $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs Tcl_DoOneEvent
1303 then
1304 tk_libs="$tk_libs -ltk$tkmaj.$tkmin -ltcl$tclmaj.$tclmin $dllib"
1305 elif sh ./hasgot $tk_libs -ltcl$tclmaj$tclmin $tkauxlibs Tcl_DoOneEvent
1306 then
1307 tk_libs="$tk_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin $dllib"
1308 elif test -z "$tk_libs" && tk_libs=-L/usr/local/lib && \
1309 sh ./hasgot $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs Tcl_DoOneEvent
1310 then
1311 tk_libs="$tk_libs -ltk$tkmaj.$tkmin -ltcl$tclmaj.$tclmin $dllib"
1312 elif sh ./hasgot $tk_libs -ltcl$tclmaj$tclmin $tkauxlibs Tcl_DoOneEvent
1313 then
1314 tk_libs="$tk_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin $dllib"
1315 # elif sh ./hasgot $tk_libs -ltcl $tkauxlibs Tcl_DoOneEvent; then
1316 # tk_libs="$tk_libs -ltk -ltcl"
1317 elif sh ./hasgot -L/sw/lib $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs \
1318 Tcl_DoOneEvent
1319 then tk_libs="-L/sw/lib -ltk$tkmaj.$tkmin -ltcl$tclmaj.$tclmin $dllib"
1320 else
1321 echo "Tcl library not found."
1322 has_tk=false
1325 if test $has_tk = true; then
1326 if sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid; then
1327 echo "Tcl/Tk libraries found."
1328 elif sh ./hasgot -L/sw/lib $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid; then
1329 tk_libs="-L/sw/lib $tk_libs"
1330 echo "Tcl/Tk libraries found."
1331 else
1332 echo "Tcl library found."
1333 echo "Tk library not found."
1334 has_tk=false
1338 if test $has_tk = true; then
1339 if test $tk_x11 = yes; then
1340 echo "TK_DEFS=$tk_defs "'$(X11_INCLUDES)' >> Makefile
1341 echo "TK_LINK=$tk_libs "'$(X11_LINK)' >> Makefile
1342 else
1343 echo "TK_DEFS=$tk_defs" >> Makefile
1344 echo "TK_LINK=$tk_libs" >> Makefile
1346 otherlibraries="$otherlibraries labltk"
1347 else
1348 echo "Configuration failed, LablTk will not be built."
1351 # Camlp4
1354 cd ../../camlp4/config
1355 EXE=$exe ./configure_batch -bindir "$bindir" -libdir "$libdir" -mandir "$mandir" -ocaml-top ../.. > /dev/null
1358 # Final twiddling of compiler options to work around known bugs
1360 nativeccprofopts="$nativecccompopts"
1361 case "$buggycc" in
1362 gcc.2.96)
1363 bytecccompopts="$bytecccompopts -fomit-frame-pointer"
1364 nativecccompopts="$nativecccompopts -fomit-frame-pointer";;
1365 esac
1367 # Finish generated files
1369 cclibs="$cclibs $mathlib"
1371 echo "BYTECC=$bytecc" >> Makefile
1372 echo "BYTECCCOMPOPTS=$bytecccompopts" >> Makefile
1373 echo "BYTECCLINKOPTS=$bytecclinkopts" >> Makefile
1374 echo "BYTECCLIBS=$cclibs $dllib $curseslibs $pthread_link" >> Makefile
1375 echo "BYTECCRPATH=$byteccrpath" >> Makefile
1376 echo "EXE=$exe" >> Makefile
1377 echo "SUPPORTS_SHARED_LIBRARIES=$shared_libraries_supported" >> Makefile
1378 echo "SHAREDCCCOMPOPTS=$sharedcccompopts" >> Makefile
1379 echo "MKSHAREDLIB=$mksharedlib" >> Makefile
1380 echo "MKSHAREDLIBRPATH=$mksharedlibrpath" >> Makefile
1381 echo "ARCH=$arch" >> Makefile
1382 echo "MODEL=$model" >> Makefile
1383 echo "SYSTEM=$system" >> Makefile
1384 echo "NATIVECC=$nativecc" >> Makefile
1385 echo "NATIVECCCOMPOPTS=$nativecccompopts" >> Makefile
1386 echo "NATIVECCPROFOPTS=$nativeccprofopts" >> Makefile
1387 echo "NATIVECCLINKOPTS=$nativecclinkopts" >> Makefile
1388 echo "NATIVECCRPATH=$nativeccrpath" >> Makefile
1389 echo "NATIVECCLIBS=$cclibs $dllib" >> Makefile
1390 echo "ASFLAGS=$asflags" >> Makefile
1391 echo "ASPP=$aspp" >> Makefile
1392 echo "ASPPFLAGS=$asppflags" >> Makefile
1393 echo "ASPPPROFFLAGS=$asppprofflags" >> Makefile
1394 echo "PROFILING=$profiling" >> Makefile
1395 echo "BINUTILS_OBJCOPY=$binutils_objcopy" >> Makefile
1396 echo "BINUTILS_NM=$binutils_nm" >> Makefile
1397 echo "DYNLINKOPTS=$dllib" >> Makefile
1398 echo "OTHERLIBRARIES=$otherlibraries" >> Makefile
1399 echo "DEBUGGER=$debugger" >> Makefile
1400 echo "CC_PROFILE=$cc_profile" >> Makefile
1402 rm -f tst hasgot.c
1403 rm -f ../m.h ../s.h ../Makefile
1404 mv m.h s.h Makefile ..
1406 # Print a summary
1408 echo
1409 echo "** Configuration summary **"
1410 echo
1411 echo "Directories where Objective Caml will be installed:"
1412 echo " binaries.................. $bindir"
1413 echo " standard library.......... $libdir"
1414 echo " manual pages.............. $mandir (with extension .$manext)"
1416 echo "Configuration for the bytecode compiler:"
1417 echo " C compiler used........... $bytecc"
1418 echo " options for compiling..... $bytecccompopts"
1419 echo " options for linking....... $bytecclinkopts $cclibs $dllib $curseslibs $pthread_link"
1420 if $shared_libraries_supported; then
1421 echo " shared libraries are supported"
1422 echo " options for compiling..... $sharedcccompopts $bytecccompopts"
1423 echo " command for building...... $mksharedlib lib.so $mksharedlibrpath/a/path objs"
1424 else
1425 echo " shared libraries not supported"
1428 echo "Configuration for the native-code compiler:"
1429 if test "$arch" = "none"; then
1430 echo " (not supported on this platform)"
1431 else
1432 if test "$model" = "default"; then
1433 echo " hardware architecture..... $arch"
1434 else
1435 echo " hardware architecture..... $arch ($model)"
1437 if test "$system" = "unknown"; then : ; else
1438 echo " OS variant................ $system"
1440 echo " C compiler used........... $nativecc"
1441 echo " options for compiling..... $nativecccompopts"
1442 echo " options for linking....... $nativecclinkopts $cclibs"
1443 echo " assembler ................ \$(AS) $asflags"
1444 echo " preprocessed assembler ... $aspp $asppflags"
1445 if test "$profiling" = "prof"; then
1446 echo " profiling with gprof ..... supported"
1447 else
1448 echo " profiling with gprof ..... not supported"
1450 if test -n "$binutils_objcopy" && test -n "$binutils_nm"; then
1451 echo " ocamlopt -pack ........... supported"
1452 else
1453 echo " ocamlopt -pack ........... not supported (no binutils)"
1457 if test "$debugger" = "ocamldebugger"; then
1458 echo "Source-level replay debugger: supported"
1459 else
1460 echo "Source-level replay debugger: not supported"
1463 echo "Additional libraries supported:"
1464 echo " $otherlibraries"
1466 echo "Configuration for the \"num\" library:"
1467 echo " target architecture ...... $bng_arch (asm level $bng_asm_level)"
1469 if test "$x11_include" != "not found" && test "$x11_lib" != "not found"; then
1470 echo "Configuration for the \"graph\" library:"
1471 echo " options for compiling .... $x11_include"
1472 echo " options for linking ...... $x11_link"
1475 if test $has_tk = true; then
1476 echo "Configuration for the \"labltk\" library:"
1477 echo " use tcl/tk version ....... $tcl_version"
1478 echo " options for compiling .... $tk_defs"
1479 echo " options for linking ...... $tk_libs"
1480 else
1481 echo "The \"labltk\" library: not found"