3
#########################################################################
7
# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
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. #
14
#########################################################################
16
# $Id: configure 10636 2010-07-28 13:18:22Z doligez $
18
configure_options="$*"
46
# Try to turn internationalization off, can cause config.guess to malfunction!
48
unset LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
50
# Turn off some MacOS X debugging stuff, same reason
51
unset RC_TRACE_ARCHIVES RC_TRACE_DYLIBS RC_TRACE_PREBINDING_DISABLED
53
# Parse command-line arguments
67
mandir=`echo $2 | sed -e 's|^\(.*\)/man.$|\1|'`
68
manext=`echo $2 | sed -e 's/^.*\(.\)$/\1/'`;;
77
ccoption="$2"; shift;;
79
asoption="$2"; shift;;
81
asppoption="$2"; shift;;
83
cclibs="$2 $cclibs"; shift;;
88
-x11include*|--x11include*)
89
x11_include_dir=$2; shift;;
91
x11_lib_dir=$2; shift;;
92
-with-pthread*|--with-pthread*)
93
;; # Ignored for backward compatibility
94
-no-pthread*|--no-pthread*)
98
-partialld|--partialld)
99
partialld="$2"; shift;;
104
-tk-no-x11|--tk-no-x11)
107
dl_defs="$2"; shift;;
112
*) echo "Unknown option \"$1\"." 1>&2; exit 2;;
121
*) echo "The -prefix directory must be absolute." 1>&2; exit 2;;
126
*) echo "The -bindir directory must be absolute." 1>&2; exit 2;;
131
*) echo "The -libdir directory must be absolute." 1>&2; exit 2;;
136
*) echo "The -mandir directory must be absolute." 1>&2; exit 2;;
142
rm -f s.h m.h Makefile
143
touch s.h m.h Makefile
145
# Write options to Makefile
147
echo "# generated by ./configure $configure_options" >> Makefile
151
echo "PREFIX=$prefix" >> Makefile
153
"") echo 'BINDIR=$(PREFIX)/bin' >> Makefile
154
bindir="$prefix/bin";;
155
*) echo "BINDIR=$bindir" >> Makefile;;
158
"") echo 'LIBDIR=$(PREFIX)/lib/ocaml' >> Makefile
159
libdir="$prefix/lib/ocaml";;
160
*) echo "LIBDIR=$libdir" >> Makefile;;
162
echo 'STUBLIBDIR=$(LIBDIR)/stublibs' >> Makefile
164
"") echo 'MANDIR=$(PREFIX)/man' >> Makefile
165
mandir="$prefix/man";;
166
*) echo "MANDIR=$mandir" >> Makefile;;
168
echo "MANEXT=$manext" >> Makefile
170
# Determine the system type
172
if test "$host_type" = "unknown"; then
173
if host_type=`../gnu/config.guess`; then :; else
174
echo "Cannot guess host type"
175
echo "You must specify one with the -host option"
179
if host=`../gnu/config.sub $host_type`; then :; else
180
echo "Please specify the correct host type with the -host option"
183
echo "Configuring for a $host ..."
187
if test -z "$ccoption"; then
188
if sh ./searchpath gcc; then
198
# Check for buggy versions of GCC
204
case `$cc --version` in
207
WARNING: you are using gcc version 2.7.2.1 on an Intel x86 processor.
208
This version of gcc is known to generate incorrect code for the
209
Objective Caml runtime system on some Intel x86 machines. (The symptom
210
is a crash of boot/ocamlc when compiling stdlib/pervasives.mli.)
211
In particular, the version of gcc 2.7.2.1 that comes with
212
Linux RedHat 4.x / Intel is affected by this problem.
213
Other Linux distributions might also be affected.
214
If you are using one of these configurations, you are strongly advised
215
to use another version of gcc, such as 2.95, which are
216
known to work well with Objective Caml.
218
Press <enter> to proceed or <interrupt> to stop.
223
WARNING: you are using gcc version 2.96 on an Intel x86 processor.
224
Certain patched versions of gcc 2.96 are known to generate incorrect
225
code for the Objective Caml runtime system. (The symptom is a segmentation
226
violation on boot/ocamlc.) Those incorrectly patched versions can be found
227
in RedHat 7.2 and Mandrake 8.0 and 8.1; other Linux distributions
228
might also be affected. (See bug #57760 on bugzilla.redhat.com)
230
Auto-configuration will now select gcc compiler flags that work around
231
the problem. Still, if you observe segmentation faults while running
232
ocamlc or ocamlopt, you are advised to try another version of gcc,
233
such as 2.95.3 or 3.2.
241
# Configure the bytecode compiler
252
case "$bytecc,$host" in
254
# GNU C extensions disabled, but __GNUC__ still defined!
255
bytecccompopts="-fno-defer-pop $gcc_warnings -U__GNUC__ -posix"
256
bytecclinkopts="-posix";;
258
# Almost the same as NeXTStep
259
bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
262
bytecccompopts="-fno-defer-pop -no-cpp-precomp $gcc_warnings"
264
# Tell gcc that we can use 32-bit code addresses for threaded code
265
# unless we are compiled for a shared library (-fPIC option)
266
echo "#ifndef __PIC__" >> m.h
267
echo "# define ARCH_CODE32" >> m.h
268
echo "#endif" >> m.h;;
270
bytecccompopts="-fno-defer-pop $gcc_warnings"
274
bytecccompopts="-fno-defer-pop $gcc_warnings"
275
if cc="$bytecc" sh ./hasgot -mieee; then
276
bytecccompopts="-mieee $bytecccompopts";
278
# Put code and static data in lower 4GB
279
bytecclinkopts="-Wl,-T,12000000 -Wl,-D,14000000"
280
# Tell gcc that we can use 32-bit code addresses for threaded code
281
echo "#define ARCH_CODE32" >> m.h;;
283
bytecccompopts="-std1 -ieee";;
285
if cc="$bytecc" sh ./hasgot -mieee; then
286
bytecccompopts="-mieee $bytecccompopts";
288
bytecclinkopts="-Wl,--no-relax";;
290
# Add -n32 flag to ensure compatibility with native-code compiler
291
bytecccompopts="-n32"
292
# Turn off warning "unused library"
293
bytecclinkopts="-n32 -Wl,-woff,84";;
295
# (For those who want to force "cc -64")
296
# Turn off warning "unused library"
297
bytecclinkopts="-Wl,-woff,84";;
300
bytecccompopts="-DUMK";;
302
# Avoid name-space pollution by requiring Unix98-conformant includes
303
bytecccompopts="-fno-defer-pop $gcc_warnings -D_XOPEN_SOURCE=500";;
305
bytecccompopts="-D_XOPEN_SOURCE=500";;
307
bytecccompopts="-fno-defer-pop $gcc_warnings -U_WIN32"
308
dllccompopts="-D_WIN32 -DCAML_DLL"
309
if test $withsharedlibs = yes; then
310
flexlink="flexlink -chain cygwin -merge-manifest"
311
flexdir=`$flexlink -where | dos2unix`
312
if test -z "$flexdir"; then
313
echo "flexlink not found: native shared libraries won't be available"
316
iflexdir="-I\"$flexdir\""
317
mkexe="$flexlink -exe"
322
gcc*,x86_64-*-linux*)
323
bytecccompopts="-fno-defer-pop $gcc_warnings"
324
# Tell gcc that we can use 32-bit code addresses for threaded code
325
# unless we are compiled for a shared library (-fPIC option)
326
echo "#ifndef __PIC__" >> m.h
327
echo "# define ARCH_CODE32" >> m.h
328
echo "#endif" >> m.h;;
330
bytecccompopts="-fno-defer-pop $gcc_warnings";;
333
# Configure compiler to use in further tests
335
cc="$bytecc -O $bytecclinkopts"
336
export cc cclibs verbose
342
0) echo "The C compiler is ANSI-compliant.";;
343
1) echo "The C compiler $cc is not ANSI-compliant."
344
echo "You need an ANSI C compiler to build Objective Caml."
346
*) echo "Unable to compile the test program."
347
echo "Make sure the C compiler $cc is properly installed."
351
# Check the sizes of data types
353
echo "Checking the sizes of integers and pointers..."
354
set `sh ./runtest sizes.c`
356
4,4) echo "OK, this is a regular 32 bit architecture."
357
echo "#undef ARCH_SIXTYFOUR" >> m.h
359
*,8) echo "Wow! A 64 bit architecture!"
360
echo "#define ARCH_SIXTYFOUR" >> m.h
362
*,*) echo "This architecture seems to be neither 32 bits nor 64 bits."
363
echo "Objective Caml won't run on this architecture."
365
*) echo "Unable to compile the test program."
366
echo "Make sure the C compiler $cc is properly installed."
369
if test $1 != 4 && test $2 != 4 && test $4 != 4; then
370
echo "Sorry, we can't find a 32-bit integer type"
371
echo "(sizeof(short) = $4, sizeof(int) = $1, sizeof(long) = $2)"
372
echo "Objective Caml won't run on this architecture."
376
echo "#define SIZEOF_INT $1" >> m.h
377
echo "#define SIZEOF_LONG $2" >> m.h
378
echo "#define SIZEOF_PTR $3" >> m.h
379
echo "#define SIZEOF_SHORT $4" >> m.h
382
echo "#define ARCH_INT64_TYPE long" >> m.h
383
echo "#define ARCH_UINT64_TYPE unsigned long" >> m.h
384
echo '#define ARCH_INT64_PRINTF_FORMAT "l"' >> m.h
387
sh ./runtest longlong.c
389
0) echo "64-bit \"long long\" integer type found (printf with \"%ll\")."
390
echo "#define ARCH_INT64_TYPE long long" >> m.h
391
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
392
echo '#define ARCH_INT64_PRINTF_FORMAT "ll"' >> m.h
394
1) echo "64-bit \"long long\" integer type found (printf with \"%q\")."
395
echo "#define ARCH_INT64_TYPE long long" >> m.h
396
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
397
echo '#define ARCH_INT64_PRINTF_FORMAT "q"' >> m.h
399
2) echo "64-bit \"long long\" integer type found (but no printf)."
400
echo "#define ARCH_INT64_TYPE long long" >> m.h
401
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
402
echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
404
*) echo "No suitable 64-bit integer type found, will use software emulation."
405
echo "#undef ARCH_INT64_TYPE" >> m.h
406
echo "#undef ARCH_UINT64_TYPE" >> m.h
407
echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
412
if test $3 = 8 && test $int64_native = false; then
413
echo "This architecture has 64-bit pointers but no 64-bit integer type."
414
echo "Objective Caml won't run on this architecture."
418
# Determine endianness
420
sh ./runtest endian.c
422
0) echo "This is a big-endian architecture."
423
echo "#define ARCH_BIG_ENDIAN" >> m.h;;
424
1) echo "This is a little-endian architecture."
425
echo "#undef ARCH_BIG_ENDIAN" >> m.h;;
426
2) echo "This architecture seems to be neither big endian nor little endian."
427
echo "Objective Caml won't run on this architecture."
429
*) echo "Something went wrong during endianness determination."
430
echo "You'll have to figure out endianness yourself"
431
echo "(option ARCH_BIG_ENDIAN in m.h).";;
434
# Determine alignment constraints
437
sparc*-*-*|hppa*-*-*|arm*-*-*)
438
# On Sparc V9 with certain versions of gcc, determination of double
439
# alignment is not reliable (PR#1521), hence force it.
440
# Same goes for hppa.
441
# PR#5088 suggests same problem on ARM.
442
# But there's a knack (PR#2572):
443
# if we're in 64-bit mode (sizeof(long) == 8),
444
# we must not doubleword-align floats...
446
echo "Doubles can be word-aligned."
447
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h
449
echo "Doubles must be doubleword-aligned."
450
echo "#define ARCH_ALIGN_DOUBLE" >> m.h
453
sh ./runtest dblalign.c
455
0) echo "Doubles can be word-aligned."
456
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
457
1) echo "Doubles must be doubleword-aligned."
458
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
459
*) echo "Something went wrong during alignment determination for doubles."
460
echo "I'm going to assume this architecture has alignment constraints over doubles."
461
echo "That's a safe bet: Objective Caml will work even if"
462
echo "this architecture has actually no alignment constraints."
463
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
467
if $int64_native; then
469
# PR#5088: autodetection is unreliable on ARM
470
sparc*-*-*|hppa*-*-*|arm*-*-*)
472
echo "64-bit integers can be word-aligned."
473
echo "#undef ARCH_ALIGN_INT64" >> m.h
475
echo "64-bit integers must be doubleword-aligned."
476
echo "#define ARCH_ALIGN_INT64" >> m.h
479
sh ./runtest int64align.c
481
0) echo "64-bit integers can be word-aligned."
482
echo "#undef ARCH_ALIGN_INT64" >> m.h;;
483
1) echo "64-bit integers must be doubleword-aligned."
484
echo "#define ARCH_ALIGN_INT64" >> m.h;;
485
*) echo "Something went wrong during alignment determination for 64-bit integers."
486
echo "I'm going to assume this architecture has alignment constraints."
487
echo "That's a safe bet: Objective Caml will work even if"
488
echo "this architecture has actually no alignment constraints."
489
echo "#define ARCH_ALIGN_INT64" >> m.h;;
493
echo "#undef ARCH_ALIGN_INT64" >> m.h
496
# Check semantics of division and modulus
498
sh ./runtest divmod.c
500
0) echo "Native division and modulus have round-towards-zero semantics, will use them."
501
echo "#undef NONSTANDARD_DIV_MOD" >> m.h;;
502
1) echo "Native division and modulus do not have round-towards-zero semantics, will use software emulation."
503
echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
504
*) echo "Something went wrong while checking native division and modulus, please report it."
505
echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
508
# Shared library support
510
shared_libraries_supported=false
511
dl_needs_underscore=false
518
if test $withsharedlibs = "yes"; then
521
mksharedlib="$flexlink"
522
mkmaindll="$flexlink -maindll"
523
shared_libraries_supported=true;;
524
*-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-openbsd*|*-*-netbsd*|*-*-gnu*)
525
sharedcccompopts="-fPIC"
526
mksharedlib="$bytecc -shared"
527
bytecclinkopts="$bytecclinkopts -Wl,-E"
528
byteccrpath="-Wl,-rpath,"
529
mksharedlibrpath="-Wl,-rpath,"
530
natdynlinkopts="-Wl,-E"
531
shared_libraries_supported=true;;
535
sharedcccompopts="-fPIC"
536
mksharedlib="$bytecc -shared"
537
byteccrpath="-Wl,-rpath,"
538
mksharedlibrpath="-Wl,-rpath,"
539
shared_libraries_supported=true;;
542
mksharedlib="ld -shared -expect_unresolved '*'"
543
byteccrpath="-Wl,-rpath,"
544
mksharedlibrpath="-rpath "
545
shared_libraries_supported=true;;
550
sharedcccompopts="-fPIC"
551
if sh ./solaris-ld; then
552
mksharedlib="$bytecc -shared"
554
mksharedlibrpath="-R"
556
mksharedlib="$bytecc -shared"
557
bytecclinkopts="$bytecclinkopts -Wl,-E"
558
natdynlinkopts="-Wl,-E"
559
byteccrpath="-Wl,-rpath,"
560
mksharedlibrpath="-Wl,-rpath,"
562
shared_libraries_supported=true;;
564
sharedcccompopts="-KPIC"
566
mksharedlibrpath="-R"
567
mksharedlib="/usr/ccs/bin/ld -G"
568
shared_libraries_supported=true;;
572
cc*) sharedcccompopts="";;
573
gcc*) sharedcccompopts="-fPIC";;
575
mksharedlib="ld -shared -rdata_shared"
576
byteccrpath="-Wl,-rpath,"
577
mksharedlibrpath="-rpath "
578
shared_libraries_supported=true;;
579
i[3456]86-*-darwin10.*)
580
mksharedlib="$bytecc -bundle -flat_namespace -undefined suppress"
581
bytecccompopts="$dl_defs $bytecccompopts"
582
dl_needs_underscore=false
583
shared_libraries_supported=true
586
mksharedlib="$bytecc -bundle -flat_namespace -undefined suppress -read_only_relocs suppress"
587
bytecccompopts="$dl_defs $bytecccompopts"
588
dl_needs_underscore=false
589
shared_libraries_supported=true;;
591
mksharedlib="$bytecc -bundle -flat_namespace -undefined suppress"
592
bytecccompopts="$dl_defs $bytecccompopts"
593
dl_needs_underscore=false
594
shared_libraries_supported=true;;
596
shared_libraries_supported=false;;
598
shared_libraries_supported=false;;
600
sharedcccompopts="-fPIC"
601
mksharedlib="$bytecc -shared"
602
bytecclinkopts="$bytecclinkopts -Wl,-E"
603
natdynlinkopts="-Wl,-E"
604
byteccrpath="-Wl,-rpath,"
605
mksharedlibrpath="-Wl,-rpath,"
606
shared_libraries_supported=true;;
610
if test -z "$mkmaindll"; then
611
mkmaindll=$mksharedlib
614
# Configure native dynlink
618
if test $withsharedlibs = "yes"; then
620
*-*-cygwin*) natdynlink=true;;
621
i[3456]86-*-linux*) natdynlink=true;;
622
x86_64-*-linux*) natdynlink=true;;
623
i[3456]86-*-darwin10.*)
624
if test $arch64 == true; then
627
i[3456]86-*-darwin[89]*) natdynlink=true;;
628
powerpc64-*-linux*) natdynlink=true;;
629
sparc-*-linux*) natdynlink=true;;
630
i686-*-kfreebsd*) natdynlink=true;;
631
x86_64-*-kfreebsd*) natdynlink=true;;
632
i386-*-gnu0.3) natdynlink=true;;
636
if test $natdynlink = "true"; then
643
# Configure the native-code compiler
650
alpha*-*-osf*) arch=alpha; system=digital;;
651
alpha*-*-linux*) arch=alpha; system=linux;;
652
alpha*-*-gnu*) arch=alpha; system=gnu;;
653
alpha*-*-freebsd*) arch=alpha; system=freebsd;;
654
alpha*-*-netbsd*) arch=alpha; system=netbsd;;
655
alpha*-*-openbsd*) arch=alpha; system=openbsd;;
656
sparc*-*-sunos4.*) arch=sparc; system=sunos;;
657
sparc*-*-solaris2.*) arch=sparc; system=solaris;;
658
sparc*-*-*bsd*) arch=sparc; system=bsd;;
659
sparc*-*-linux*) arch=sparc; system=linux;;
660
sparc*-*-gnu*) arch=sparc; system=gnu;;
661
i[3456]86-*-linux*) arch=i386; system=linux_`sh ./runtest elf.c`;;
662
i[3456]86-*-*bsd*) arch=i386; system=bsd_`sh ./runtest elf.c`;;
663
i[3456]86-*-nextstep*) arch=i386; system=nextstep;;
664
i[3456]86-*-solaris*) if $arch64; then
665
arch=amd64; system=solaris
667
arch=i386; system=solaris
669
i[3456]86-*-beos*) arch=i386; system=beos;;
670
i[3456]86-*-cygwin*) arch=i386; system=cygwin;;
671
i[3456]86-*-darwin*) if $arch64; then
672
arch=amd64; system=macosx
674
arch=i386; system=macosx
676
i[3456]86-*-gnu*) arch=i386; system=gnu;;
677
mips-*-irix6*) arch=mips; system=irix;;
678
hppa1.1-*-hpux*) arch=hppa; system=hpux;;
679
hppa2.0*-*-hpux*) arch=hppa; system=hpux;;
680
hppa*-*-linux*) arch=hppa; system=linux;;
681
hppa*-*-gnu*) arch=hppa; system=gnu;;
682
powerpc*-*-linux*) arch=power; model=ppc; system=elf;;
683
powerpc-*-netbsd*) arch=power; model=ppc; system=elf;;
684
powerpc-*-rhapsody*) arch=power; model=ppc; system=rhapsody;;
685
powerpc-*-darwin*) arch=power; system=rhapsody
686
if $arch64; then model=ppc64; else model=ppc; fi;;
687
arm*-*-linux*) arch=arm; system=linux;;
688
arm*-*-gnu*) arch=arm; system=gnu;;
689
ia64-*-linux*) arch=ia64; system=linux;;
690
ia64-*-gnu*) arch=ia64; system=gnu;;
691
ia64-*-freebsd*) arch=ia64; system=freebsd;;
692
x86_64-*-linux*) arch=amd64; system=linux;;
693
x86_64-*-gnu*) arch=amd64; system=gnu;;
694
x86_64-*-freebsd*) arch=amd64; system=freebsd;;
695
x86_64-*-netbsd*) arch=amd64; system=netbsd;;
696
x86_64-*-openbsd*) arch=amd64; system=openbsd;;
697
x86_64-*-darwin9.5) arch=amd64; system=macosx;;
700
# Some platforms exist both in 32-bit and 64-bit variants, not distinguished
701
# by $host. Turn off native code compilation on platforms where 64-bit mode
702
# is not supported. (PR#4441)
705
case "$arch,$model" in
706
sparc,default|mips,default|hppa,default|power,ppc)
707
arch=none; model=default; system=unknown;;
711
if test -z "$ccoption"; then
712
case "$arch,$system,$cc" in
713
alpha,digital,gcc*) nativecc=cc;;
714
mips,*,gcc*) nativecc=cc;;
715
*) nativecc="$bytecc";;
723
nativeccrpath="$byteccrpath"
725
case "$arch,$nativecc,$system,$host_type" in
726
alpha,cc*,digital,*) nativecccompopts=-std1;;
727
mips,cc*,irix,*) nativecccompopts=-n32
728
nativecclinkopts="-n32 -Wl,-woff,84";;
729
*,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix"
730
nativecclinkopts="-posix";;
731
*,*,rhapsody,*darwin[1-5].*)
732
nativecccompopts="$gcc_warnings -DSHRINKED_GNUC";;
733
*,*,rhapsody,*) nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6 $dl_defs"
734
if $arch64; then partialld="ld -r -arch ppc64"; fi;;
735
alpha,gcc*,linux*,*) nativecclinkopts="-Wl,--no-relax";;
736
*,gcc*,cygwin,*) nativecccompopts="$gcc_warnings -U_WIN32";;
737
amd64,gcc*,macosx,*) partialld="ld -r -arch x86_64";;
738
amd64,gcc*,solaris,*) partialld="ld -r -m elf_x86_64";;
739
*,gcc*,*,*) nativecccompopts="$gcc_warnings";;
742
asppprofflags='-DPROFILING'
744
case "$arch,$model,$system" in
745
alpha,*,digital) as='as -O2 -nocpp'
747
asppprofflags='-pg -DPROFILING';;
750
amd64,*,macosx) as='as -arch x86_64'
751
aspp='gcc -arch x86_64 -c';;
752
amd64,*,solaris) as='as --64'
759
aspp='gcc -traditional -c';;
760
i386,*,solaris) as='as'
761
aspp='/usr/ccs/bin/as -P';;
764
ia64,*,*) as='as -xexplicit'
765
aspp='gcc -c -Wa,-xexplicit';;
766
mips,*,irix) as='as -n32 -O2 -nocpp -g0'
768
power,*,elf) as='as -u -m ppc'
772
power,*,rhapsody) as="as -arch $model"
774
sparc,*,solaris) as='as'
776
gcc*) aspp='gcc -c';;
783
if test -n "$asoption"; then as="$asoption"; fi
784
if test -n "$asppoption"; then aspp="$asppoption"; fi
787
case "$arch,$model,$system" in
788
alpha,*,digital) profiling='prof';;
789
i386,*,linux_elf) profiling='prof';;
790
i386,*,gnu) profiling='prof';;
791
i386,*,bsd_elf) profiling='prof';;
792
amd64,*,macosx) profiling='prof';;
793
i386,*,macosx) profiling='prof';;
796
case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
797
amd64,*,linux) profiling='prof';;
798
amd64,*,gnu) profiling='prof';;
799
*) profiling='noprof';;
804
if sh ./searchpath ranlib; then
806
echo "RANLIB=ranlib" >> Makefile
807
echo "RANLIBCMD=ranlib" >> Makefile
809
echo "ranlib not used"
810
echo "RANLIB=ar rs" >> Makefile
811
echo "RANLIBCMD=" >> Makefile
814
# Do #! scripts work?
816
if (SHELL=/bin/sh; export SHELL; (./sharpbang || ./sharpbang2) >/dev/null); then
817
echo "#! appears to work in shell scripts"
819
*-*-sunos*|*-*-unicos*)
820
echo "We won't use it, though, because under SunOS and Unicos it breaks"
821
echo "on pathnames longer than 30 characters"
822
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
824
echo "We won't use it, though, because of conflicts with .exe extension"
826
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
828
echo "SHARPBANGSCRIPTS=true" >> Makefile;;
831
echo "No support for #! in shell scripts"
832
echo "SHARPBANGSCRIPTS=false" >> Makefile
835
# Write the OS type (Unix or Cygwin)
837
echo "#define OCAML_OS_TYPE \"$ostype\"" >> s.h
838
echo "#define OCAML_STDLIB_DIR \"$libdir\"" >> s.h
840
# Use 64-bit file offset if possible
842
bytecccompopts="$bytecccompopts -D_FILE_OFFSET_BITS=64"
843
nativecccompopts="$nativecccompopts -D_FILE_OFFSET_BITS=64"
845
# Check the semantics of signal handlers
847
if sh ./hasgot sigaction sigprocmask; then
848
echo "POSIX signal handling found."
849
echo "#define POSIX_SIGNALS" >> s.h
851
if sh ./runtest signals.c; then
852
echo "Signals have the BSD semantics."
853
echo "#define BSD_SIGNALS" >> s.h
855
echo "Signals have the System V semantics."
857
if sh ./hasgot sigsetmask; then
858
echo "sigsetmask() found"
859
echo "#define HAS_SIGSETMASK" >> s.h
863
# For the Pervasives module
865
if sh ./trycompile expm1.c $mathlib; then
866
echo "expm1() and log1p() found."
867
echo "#define HAS_EXPM1_LOG1P" >> s.h
872
if sh ./hasgot getrusage; then
873
echo "getrusage() found."
874
echo "#define HAS_GETRUSAGE" >> s.h
877
if sh ./hasgot times; then
878
echo "times() found."
879
echo "#define HAS_TIMES" >> s.h
882
# For the terminfo module
884
if test "$withcurses" = "yes"; then
885
for libs in "" "-lcurses" "-ltermcap" "-lcurses -ltermcap" "-lncurses"; do
886
if sh ./hasgot $libs tgetent tgetstr tgetnum tputs; then
887
echo "termcap functions found (with libraries '$libs')"
888
echo "#define HAS_TERMCAP" >> s.h
895
# Configuration for the libraries
897
otherlibraries="unix str num dynlink bigarray"
899
# For the Unix library
902
if sh ./hasgot socket socketpair bind listen accept connect; then
903
echo "You have BSD sockets."
904
echo "#define HAS_SOCKETS" >> s.h
906
elif sh ./hasgot -lnsl -lsocket socket socketpair bind listen accept connect; then
907
echo "You have BSD sockets (with libraries '-lnsl -lsocket')"
908
cclibs="$cclibs -lnsl -lsocket"
909
echo "#define HAS_SOCKETS" >> s.h
913
if sh ./hasgot -i sys/socket.h -t socklen_t; then
914
echo "socklen_t is defined in <sys/socket.h>"
915
echo "#define HAS_SOCKLEN_T" >> s.h
918
if sh ./hasgot inet_aton; then
919
echo "inet_aton() found."
920
echo "#define HAS_INET_ATON" >> s.h
923
if sh ./hasgot -i sys/types.h -i sys/socket.h -i netinet/in.h \
924
-t 'struct sockaddr_in6' \
925
&& sh ./hasgot getaddrinfo getnameinfo inet_pton inet_ntop; then
926
echo "IPv6 is supported."
927
echo "#define HAS_IPV6" >> s.h
930
if sh ./hasgot -i unistd.h; then
931
echo "unistd.h found."
932
echo "#define HAS_UNISTD" >> s.h
935
if sh ./hasgot -i sys/types.h -t off_t; then
936
echo "off_t is defined in <sys/types.h>"
937
echo "#define HAS_OFF_T" >> s.h
940
if sh ./hasgot -i sys/types.h -i dirent.h; then
941
echo "dirent.h found."
942
echo "#define HAS_DIRENT" >> s.h
945
if sh ./hasgot rewinddir; then
946
echo "rewinddir() found."
947
echo "#define HAS_REWINDDIR" >> s.h
950
if sh ./hasgot lockf; then
951
echo "lockf() found."
952
echo "#define HAS_LOCKF" >> s.h
955
if sh ./hasgot mkfifo; then
956
echo "mkfifo() found."
957
echo "#define HAS_MKFIFO" >> s.h
960
if sh ./hasgot getcwd; then
961
echo "getcwd() found."
962
echo "#define HAS_GETCWD" >> s.h
965
if sh ./hasgot getwd; then
966
echo "getwd() found."
967
echo "#define HAS_GETWD" >> s.h
970
if sh ./hasgot getpriority setpriority; then
971
echo "getpriority() found."
972
echo "#define HAS_GETPRIORITY" >> s.h
975
if sh ./hasgot -i sys/types.h -i utime.h && sh ./hasgot utime; then
976
echo "utime() found."
977
echo "#define HAS_UTIME" >> s.h
980
if sh ./hasgot utimes; then
981
echo "utimes() found."
982
echo "#define HAS_UTIMES" >> s.h
985
if sh ./hasgot dup2; then
987
echo "#define HAS_DUP2" >> s.h
990
if sh ./hasgot fchmod fchown; then
991
echo "fchmod() found."
992
echo "#define HAS_FCHMOD" >> s.h
995
if sh ./hasgot truncate ftruncate; then
996
echo "truncate() found."
997
echo "#define HAS_TRUNCATE" >> s.h
1001
if sh ./hasgot -i sys/types.h -i sys/select.h; then
1002
echo "sys/select.h found."
1003
echo "#define HAS_SYS_SELECT_H" >> s.h
1004
select_include='-i sys/select.h'
1008
if sh ./hasgot select && \
1009
sh ./hasgot -i sys/types.h $select_include -t fd_set ; then
1010
echo "select() found."
1011
echo "#define HAS_SELECT" >> s.h
1015
if sh ./hasgot symlink readlink lstat; then
1016
echo "symlink() found."
1017
echo "#define HAS_SYMLINK" >> s.h
1021
if sh ./hasgot waitpid; then
1022
echo "waitpid() found."
1023
echo "#define HAS_WAITPID" >> s.h
1027
if sh ./hasgot wait4; then
1028
echo "wait4() found."
1029
echo "#define HAS_WAIT4" >> s.h
1033
if sh ./hasgot -i limits.h && sh ./runtest getgroups.c; then
1034
echo "getgroups() found."
1035
echo "#define HAS_GETGROUPS" >> s.h
1038
if sh ./hasgot -i limits.h -i grp.h && sh ./runtest setgroups.c; then
1039
echo "setgroups() found."
1040
echo "#define HAS_SETGROUPS" >> s.h
1043
if sh ./hasgot -i limits.h -i grp.h && sh ./runtest initgroups.c; then
1044
echo "initgroups() found."
1045
echo "#define HAS_INITGROUPS" >> s.h
1048
if sh ./hasgot -i termios.h &&
1049
sh ./hasgot tcgetattr tcsetattr tcsendbreak tcflush tcflow; then
1050
echo "POSIX termios found."
1051
echo "#define HAS_TERMIOS" >> s.h
1054
# Async I/O under OSF1 3.x are so buggy that the test program hangs...
1056
if test -f /usr/bin/uname; then
1057
case "`/usr/bin/uname -s -r`" in
1058
"OSF1 V3."*) testasyncio=false;;
1061
if $testasyncio && sh ./runtest async_io.c; then
1062
echo "Asynchronous I/O are supported."
1063
echo "#define HAS_ASYNC_IO" >> s.h
1067
if sh ./hasgot setitimer; then
1068
echo "setitimer() found."
1069
echo "#define HAS_SETITIMER" >> s.h
1073
if sh ./hasgot gethostname; then
1074
echo "gethostname() found."
1075
echo "#define HAS_GETHOSTNAME" >> s.h
1078
if sh ./hasgot -i sys/utsname.h && sh ./hasgot uname; then
1079
echo "uname() found."
1080
echo "#define HAS_UNAME" >> s.h
1084
if sh ./hasgot gettimeofday; then
1085
echo "gettimeofday() found."
1086
echo "#define HAS_GETTIMEOFDAY" >> s.h
1087
has_gettimeofday="yes"
1090
if sh ./hasgot mktime; then
1091
echo "mktime() found."
1092
echo "#define HAS_MKTIME" >> s.h
1096
*-*-cygwin*) ;; # setsid emulation under Cygwin breaks the debugger
1097
*) if sh ./hasgot setsid; then
1098
echo "setsid() found."
1099
echo "#define HAS_SETSID" >> s.h
1103
if sh ./hasgot putenv; then
1104
echo "putenv() found."
1105
echo "#define HAS_PUTENV" >> s.h
1108
if sh ./hasgot -i locale.h && sh ./hasgot setlocale; then
1109
echo "setlocale() and <locale.h> found."
1110
echo "#define HAS_LOCALE" >> s.h
1114
if sh ./hasgot $dllib dlopen; then
1115
echo "dlopen() found."
1116
elif sh ./hasgot $dllib -ldl dlopen; then
1117
echo "dlopen() found in -ldl."
1120
shared_libraries_supported=false
1123
if $shared_libraries_supported; then
1124
echo "Dynamic loading of shared libraries is supported."
1125
echo "#define SUPPORT_DYNAMIC_LINKING" >> s.h
1126
if $dl_needs_underscore; then
1127
echo '#define DL_NEEDS_UNDERSCORE' >>s.h
1131
if sh ./hasgot -i sys/types.h -i sys/mman.h && sh ./hasgot mmap munmap; then
1132
echo "mmap() found."
1133
echo "#define HAS_MMAP" >> s.h
1138
if sh ./trycompile -DNUM_ARGS=${i} gethostbyname.c; then nargs=$i; break; fi
1140
if test $nargs != "none"; then
1141
echo "gethostbyname_r() found (with ${nargs} arguments)."
1142
echo "#define HAS_GETHOSTBYNAME_R $nargs" >> s.h
1147
if sh ./trycompile -DNUM_ARGS=${i} gethostbyaddr.c; then nargs=$i; break; fi
1149
if test $nargs != "none"; then
1150
echo "gethostbyaddr_r() found (with ${nargs} arguments)."
1151
echo "#define HAS_GETHOSTBYADDR_R $nargs" >> s.h
1154
# Determine if the debugger is supported
1156
if test "$has_sockets" = "yes"; then
1157
echo "Replay debugger supported."
1158
debugger="ocamldebugger"
1160
echo "No replay debugger (missing system calls)"
1165
# Determine if system stack overflows can be detected
1167
case "$arch,$system" in
1168
i386,linux_elf|amd64,linux|power,rhapsody|amd64,macosx|i386,macosx|amd64,macosx)
1169
echo "System stack overflow can be detected."
1170
echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;;
1172
echo "Cannot detect system stack overflow.";;
1175
# Determine the target architecture for the "num" library
1178
alpha) bng_arch=alpha; bng_asm_level=1;;
1180
if sh ./trycompile ia32sse2.c
1181
then bng_asm_level=2
1182
else bng_asm_level=1
1184
mips) bng_arch=mips; bng_asm_level=1;;
1185
power) bng_arch=ppc; bng_asm_level=1;;
1186
amd64) bng_arch=amd64; bng_asm_level=1;;
1187
*) bng_arch=generic; bng_asm_level=0;;
1190
echo "BNG_ARCH=$bng_arch" >> Makefile
1191
echo "BNG_ASM_LEVEL=$bng_asm_level" >> Makefile
1193
# Determine if the POSIX threads library is supported
1195
systhread_support=false
1197
if test "$pthread_wanted" = "yes"; then
1199
*-*-solaris*) pthread_link="-lpthread -lposix4"
1200
pthread_caml_link="-cclib -lpthread -cclib -lposix4";;
1201
*-*-freebsd*) pthread_link="-pthread"
1202
pthread_caml_link="-cclib -pthread";;
1203
*-*-openbsd*) pthread_link="-pthread"
1204
pthread_caml_link="-cclib -pthread";;
1205
*) pthread_link="-lpthread"
1206
pthread_caml_link="-cclib -lpthread";;
1208
if ./hasgot -i pthread.h $pthread_link pthread_self; then
1209
echo "POSIX threads library supported."
1210
systhread_support=true
1211
otherlibraries="$otherlibraries systhreads"
1212
bytecccompopts="$bytecccompopts -D_REENTRANT"
1213
nativecccompopts="$nativecccompopts -D_REENTRANT"
1216
bytecccompopts="$bytecccompopts -D_THREAD_SAFE"
1217
nativecccompopts="$nativecccompopts -D_THREAD_SAFE";;
1219
bytecccompopts="$bytecccompopts -pthread"
1220
asppflags="$asppflags -pthread"
1221
nativecccompopts="$nativecccompopts -pthread";;
1223
echo "Options for linking with POSIX threads: $pthread_link"
1224
if sh ./hasgot $pthread_link sigwait; then
1225
echo "sigwait() found"
1226
echo "#define HAS_SIGWAIT" >> s.h
1229
echo "POSIX threads not found."
1235
echo "PTHREAD_LINK=$pthread_caml_link" >> Makefile
1237
# Determine if the bytecode thread library is supported
1239
if test "$has_select" = "yes" \
1240
&& test "$has_setitimer" = "yes" \
1241
&& test "$has_gettimeofday" = "yes" \
1242
&& test "$has_wait" = "yes"; then
1243
echo "Bytecode threads library supported."
1244
otherlibraries="$otherlibraries threads"
1246
echo "Bytecode threads library not supported (missing system calls)"
1249
# Determine the location of X include files and libraries
1251
x11_include="not found"
1252
x11_link="not found"
1257
/usr/X11R7/include \
1258
/usr/include/X11R7 \
1259
/usr/local/X11R7/include \
1260
/usr/local/include/X11R7 \
1261
/opt/X11R7/include \
1263
/usr/X11R6/include \
1264
/usr/include/X11R6 \
1265
/usr/local/X11R6/include \
1266
/usr/local/include/X11R6 \
1267
/opt/X11R6/include \
1271
/usr/local/X11/include \
1272
/usr/local/include/X11 \
1275
/usr/X11R5/include \
1276
/usr/include/X11R5 \
1277
/usr/local/X11R5/include \
1278
/usr/local/include/X11R5 \
1279
/usr/local/x11r5/include \
1280
/opt/X11R5/include \
1282
/usr/X11R4/include \
1283
/usr/include/X11R4 \
1284
/usr/local/X11R4/include \
1285
/usr/local/include/X11R4 \
1289
/usr/XFree86/include/X11 \
1292
/usr/local/include \
1293
/usr/unsupported/include \
1294
/usr/athena/include \
1295
/usr/lpp/Xamples/include \
1297
/usr/openwin/include \
1298
/usr/openwin/share/include \
1301
if test -f $dir/X11/X.h; then
1307
if test "$x11_include" = "not found"; then
1310
x11_try_lib_dir=`echo $x11_include | sed -e 's|include|lib|'`
1320
/usr/local/X11R6/lib \
1321
/usr/local/lib/X11R6 \
1326
/usr/local/X11/lib \
1327
/usr/local/lib/X11 \
1332
/usr/local/X11R5/lib \
1333
/usr/local/lib/X11R5 \
1334
/usr/local/x11r5/lib \
1339
/usr/local/X11R4/lib \
1340
/usr/local/lib/X11R4 \
1344
/usr/XFree86/lib/X11 \
1349
/usr/unsupported/lib \
1351
/usr/lpp/Xamples/lib \
1355
/usr/openwin/share/lib \
1358
if test -f $dir/libX11.a || \
1359
test -f $dir/libX11.so || \
1360
test -f $dir/libX11.dll.a || \
1361
test -f $dir/libX11.dylib || \
1362
test -f $dir/libX11.sa; then
1363
if test $dir = /usr/lib; then
1368
*-*-*bsd*) x11_link="-R$dir -L$dir -lX11";;
1369
*) x11_link="-L$dir -lX11";;
1377
if test "$x11_include" = "not found" || test "$x11_link" = "not found"
1379
echo "X11 not found, the \"graph\" library will not be supported."
1382
echo "Location of X11 include files: $x11_include/X11"
1383
echo "Options for linking with X11: $x11_link"
1384
otherlibraries="$otherlibraries graph"
1385
if test "$x11_include" = "/usr/include"; then
1388
x11_include="-I$x11_include"
1391
echo "X11_INCLUDES=$x11_include" >> Makefile
1392
echo "X11_LINK=$x11_link" >> Makefile
1394
# See if we can compile the dbm library
1396
dbm_include="not found"
1397
dbm_link="not found"
1400
for dir in /usr/include /usr/include/db1 /usr/include/gdbm; do
1401
if test -f $dir/ndbm.h; then
1403
if sh ./hasgot dbm_open; then
1405
elif sh ./hasgot -lndbm dbm_open; then
1407
elif sh ./hasgot -ldb1 dbm_open; then
1409
elif sh ./hasgot -lgdbm dbm_open; then
1411
elif sh ./hasgot -lgdbm_compat -lgdbm dbm_open; then
1412
dbm_link="-lgdbm_compat -lgdbm"
1416
if test -f $dir/gdbm-ndbm.h; then
1419
if sh ./hasgot -lgdbm_compat -lgdbm dbm_open; then
1420
dbm_link="-lgdbm_compat -lgdbm"
1425
if test "$dbm_include" = "not found" || test "$dbm_link" = "not found"; then
1426
echo "NDBM not found, the \"dbm\" library will not be supported."
1428
echo "NDBM found (in $dbm_include)"
1429
if test "$dbm_include" = "/usr/include"; then
1432
dbm_include="-I$dbm_include"
1434
if test "$use_gdbm_ndbm" = "yes"; then
1435
echo "#define DBM_USES_GDBM_NDBM" >> s.h
1437
otherlibraries="$otherlibraries dbm"
1439
echo "DBM_INCLUDES=$dbm_include" >> Makefile
1440
echo "DBM_LINK=$dbm_link" >> Makefile
1444
echo "Configuring LablTk..."
1446
if test $tk_wanted = no; then
1448
elif test $tk_x11 = no; then
1450
elif test "$x11_include" = "not found" || test "$x11_link" = "not found"; then
1451
echo "X11 not found."
1454
tk_x11_include="$x11_include"
1455
tk_x11_libs="$x11_libs -lX11"
1459
if test $has_tk = true; then
1461
tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1463
"-I/usr/local/include" \
1465
"-I/usr/local/include/tcl8.5 -I/usr/local/include/tk8.5" \
1466
"-I/usr/include/tcl8.5 -I/usr/include/tk8.5" \
1467
"-I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4" \
1468
"-I/usr/include/tcl8.4 -I/usr/include/tk8.4" \
1469
"-I/usr/local/include/tcl8.3 -I/usr/local/include/tk8.3" \
1470
"-I/usr/include/tcl8.3 -I/usr/include/tk8.3" \
1471
"-I/usr/local/include/tcl8.2 -I/usr/local/include/tk8.2" \
1472
"-I/usr/include/tcl8.2 -I/usr/include/tk8.2" \
1474
"-I/usr/pkg/include"
1475
do if test -z "$tcl_version"; then
1477
tcl_version=`sh ./runtest $tk_defs $tk_x11_include tclversion.c`
1479
if test -n "$tcl_version" && test "x$tcl_version" != "xnone"; then
1480
echo "tcl.h and tk.h version $tcl_version found with \"$tk_defs\"."
1481
case $tcl_version in
1482
7.5) tclmaj=7 tclmin=5 tkmaj=4 tkmin=1 ;;
1483
7.6) tclmaj=7 tclmin=6 tkmaj=4 tkmin=2 ;;
1484
8.0) tclmaj=8 tclmin=0 tkmaj=8 tkmin=0 ;;
1485
8.1) tclmaj=8 tclmin=1 tkmaj=8 tkmin=1 ;;
1486
8.2) tclmaj=8 tclmin=2 tkmaj=8 tkmin=2 ;;
1487
8.3) tclmaj=8 tclmin=3 tkmaj=8 tkmin=3 ;;
1488
8.4) tclmaj=8 tclmin=4 tkmaj=8 tkmin=4 ;;
1489
8.5) tclmaj=8 tclmin=5 tkmaj=8 tkmin=5 ;;
1490
*) echo "This version is not known."; has_tk=false ;;
1493
echo "tcl.h and/or tk.h not found."
1498
tkauxlibs="$mathlib $dllib"
1501
if test $has_tk = true; then
1502
if test -n "$tk_libs" && \
1503
sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs Tcl_DoOneEvent
1504
then tk_libs="$tk_libs $dllib"
1505
elif sh ./hasgot $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs Tcl_DoOneEvent
1507
tk_libs="$tk_libs -ltk$tkmaj.$tkmin -ltcl$tclmaj.$tclmin $dllib"
1508
elif sh ./hasgot $tk_libs -ltcl$tclmaj$tclmin $tkauxlibs Tcl_DoOneEvent
1510
tk_libs="$tk_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin $dllib"
1511
elif test -z "$tk_libs" && tk_libs=-L/usr/local/lib && \
1512
sh ./hasgot $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs Tcl_DoOneEvent
1514
tk_libs="$tk_libs -ltk$tkmaj.$tkmin -ltcl$tclmaj.$tclmin $dllib"
1515
elif sh ./hasgot $tk_libs -ltcl$tclmaj$tclmin $tkauxlibs Tcl_DoOneEvent
1517
tk_libs="$tk_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin $dllib"
1518
elif sh ./hasgot -L/sw/lib $tk_libs -ltcl$tclmaj.$tclmin $tkauxlibs \
1520
then tk_libs="-L/sw/lib -ltk$tkmaj.$tkmin -ltcl$tclmaj.$tclmin $dllib"
1521
elif sh ./hasgot -L/usr/pkg/lib $tk_libs $tk_x11_libs \
1522
-ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin -lpthread $tkauxlibs \
1526
*-*-*bsd*) tk_libs="-R/usr/pkg/lib -L/usr/pkg/lib $tk_libs $tk_x11_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin -lpthread $tkauxlibs";;
1527
*) tk_libs="-L/usr/pkg/lib $tk_libs $tk_x11_libs -ltk$tkmaj$tkmin -ltcl$tclmaj$tclmin -lpthread $tkauxlibs";;
1530
echo "Tcl library not found."
1535
if test $has_tk = true; then
1536
if sh ./hasgot $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid; then
1537
echo "Tcl/Tk libraries found."
1538
elif sh ./hasgot -L/sw/lib $tk_libs $tk_x11_libs $tkauxlibs Tk_SetGrid; then
1540
*-*-*bsd*) tk_libs="-R/sw/lib -L/sw/lib $tk_libs";;
1541
*) tk_libs="-L/sw/lib $tk_libs";;
1543
echo "Tcl/Tk libraries found."
1544
elif sh ./hasgot -L/usr/pkg/lib $tk_libs $tk_x11_libs $tkauxlibs \
1547
*-*-*bsd*) tk_libs="-R/usr/pkg/lib -L/usr/pkg/lib $tk_libs";;
1548
*) tk_libs="-L/usr/pkg/lib $tk_libs";;
1550
echo "Tcl/Tk libraries found."
1552
echo "Tcl library found."
1553
echo "Tk library not found."
1558
if test $has_tk = true; then
1559
if test $tk_x11 = yes; then
1560
echo "TK_DEFS=$tk_defs "'$(X11_INCLUDES)' >> Makefile
1561
echo "TK_LINK=$tk_libs "'$(X11_LINK)' >> Makefile
1563
echo "TK_DEFS=$tk_defs" >> Makefile
1564
echo "TK_LINK=$tk_libs" >> Makefile
1566
otherlibraries="$otherlibraries labltk"
1568
echo "Configuration failed, LablTk will not be built."
1569
echo "TK_DEFS=" >> Makefile
1570
echo "TK_LINK=" >> Makefile
1573
# Look for BFD library
1575
if ./hasgot -i bfd.h && \
1576
./hasgot -lbfd -ldl -liberty -lz bfd_openr; then
1577
echo "BFD library found."
1578
echo "#define HAS_LIBBFD" >> s.h
1579
echo "LIBBFD_LINK=-lbfd -ldl -liberty -lz" >> Makefile
1581
echo "BFD library not found, 'objinfo' will be unable to display info on .cmxs files"
1582
echo "LIBBFD_LINK=" >> Makefile
1585
# Final twiddling of compiler options to work around known bugs
1587
nativeccprofopts="$nativecccompopts"
1590
bytecccompopts="$bytecccompopts -fomit-frame-pointer"
1591
nativecccompopts="$nativecccompopts -fomit-frame-pointer";;
1594
# Finish generated files
1596
cclibs="$cclibs $mathlib"
1598
echo "BYTECC=$bytecc" >> Makefile
1599
echo "BYTECCCOMPOPTS=$bytecccompopts" >> Makefile
1600
echo "BYTECCLINKOPTS=$bytecclinkopts" >> Makefile
1601
echo "BYTECCLIBS=$cclibs $dllib $curseslibs $pthread_link" >> Makefile
1602
echo "BYTECCRPATH=$byteccrpath" >> Makefile
1603
echo "EXE=$exe" >> Makefile
1604
echo "SUPPORTS_SHARED_LIBRARIES=$shared_libraries_supported" >> Makefile
1605
echo "SHAREDCCCOMPOPTS=$sharedcccompopts" >> Makefile
1606
echo "MKSHAREDLIBRPATH=$mksharedlibrpath" >> Makefile
1607
echo "NATDYNLINKOPTS=$natdynlinkopts" >> Makefile
1608
cat >> Makefile <<EOF
1610
#ml let syslib x = "-l"^x;;
1612
### How to build a static library
1613
MKLIB=ar rc \$(1) \$(2); ranlib \$(1)
1614
#ml let mklib out files opts = Printf.sprintf "ar rc %s %s %s; ranlib %s" out opts files out;;
1616
echo "ARCH=$arch" >> Makefile
1617
echo "MODEL=$model" >> Makefile
1618
echo "SYSTEM=$system" >> Makefile
1619
echo "NATIVECC=$nativecc" >> Makefile
1620
echo "NATIVECCCOMPOPTS=$nativecccompopts" >> Makefile
1621
echo "NATIVECCPROFOPTS=$nativeccprofopts" >> Makefile
1622
echo "NATIVECCLINKOPTS=$nativecclinkopts" >> Makefile
1623
echo "NATIVECCRPATH=$nativeccrpath" >> Makefile
1624
echo "NATIVECCLIBS=$cclibs $dllib" >> Makefile
1625
echo "ASM=$as" >> Makefile
1626
echo "ASPP=$aspp" >> Makefile
1627
echo "ASPPPROFFLAGS=$asppprofflags" >> Makefile
1628
echo "PROFILING=$profiling" >> Makefile
1629
echo "DYNLINKOPTS=$dllib" >> Makefile
1630
echo "OTHERLIBRARIES=$otherlibraries" >> Makefile
1631
echo "DEBUGGER=$debugger" >> Makefile
1632
echo "CC_PROFILE=$cc_profile" >> Makefile
1633
echo "SYSTHREAD_SUPPORT=$systhread_support" >> Makefile
1634
echo "PARTIALLD=$partialld" >> Makefile
1635
echo "PACKLD=\$(PARTIALLD) $(echo $nativecclinkopts|sed s/-Wl,//g) -o " \
1636
| sed -e 's/ $/\\ /' >> Makefile
1637
echo "DLLCCCOMPOPTS=$dllccompopts" >> Makefile
1638
echo "IFLEXDIR=$iflexdir" >> Makefile
1639
echo "O=o" >> Makefile
1640
echo "A=a" >> Makefile
1641
echo "SO=so" >> Makefile
1642
echo "EXT_OBJ=.o" >> Makefile
1643
echo "EXT_ASM=.s" >> Makefile
1644
echo "EXT_LIB=.a" >> Makefile
1645
echo "EXT_DLL=.so" >> Makefile
1646
echo "EXTRALIBS=" >> Makefile
1647
echo "CCOMPTYPE=cc" >> Makefile
1648
echo "TOOLCHAIN=cc" >> Makefile
1649
echo "NATDYNLINK=$natdynlink" >> Makefile
1650
echo "CMXS=$cmxs" >> Makefile
1651
echo "MKEXE=$mkexe" >> Makefile
1652
echo "MKDLL=$mksharedlib" >> Makefile
1653
echo "MKMAINDLL=$mkmaindll" >> Makefile
1656
rm -f ../m.h ../s.h ../Makefile
1657
mv m.h s.h Makefile ..
1662
echo "** Configuration summary **"
1664
echo "Directories where Objective Caml will be installed:"
1665
echo " binaries.................. $bindir"
1666
echo " standard library.......... $libdir"
1667
echo " manual pages.............. $mandir (with extension .$manext)"
1669
echo "Configuration for the bytecode compiler:"
1670
echo " C compiler used........... $bytecc"
1671
echo " options for compiling..... $bytecccompopts"
1672
echo " options for linking....... $bytecclinkopts $cclibs $dllib $curseslibs $pthread_link"
1673
if $shared_libraries_supported; then
1674
echo " shared libraries are supported"
1675
echo " options for compiling..... $sharedcccompopts $bytecccompopts"
1676
echo " command for building...... $mksharedlib -o lib.so $mksharedlibrpath/a/path objs"
1678
echo " shared libraries not supported"
1681
echo "Configuration for the native-code compiler:"
1682
if test "$arch" = "none"; then
1683
echo " (not supported on this platform)"
1685
if test "$model" = "default"; then
1686
echo " hardware architecture..... $arch"
1688
echo " hardware architecture..... $arch ($model)"
1690
if test "$system" = "unknown"; then : ; else
1691
echo " OS variant................ $system"
1693
echo " C compiler used........... $nativecc"
1694
echo " options for compiling..... $nativecccompopts"
1695
echo " options for linking....... $nativecclinkopts $cclibs"
1696
echo " assembler ................ $as"
1697
echo " preprocessed assembler ... $aspp"
1698
echo " native dynlink ........... $natdynlink"
1699
if test "$profiling" = "prof"; then
1700
echo " profiling with gprof ..... supported"
1702
echo " profiling with gprof ..... not supported"
1706
if test "$debugger" = "ocamldebugger"; then
1707
echo "Source-level replay debugger: supported"
1709
echo "Source-level replay debugger: not supported"
1712
echo "Additional libraries supported:"
1713
echo " $otherlibraries"
1715
echo "Configuration for the \"num\" library:"
1716
echo " target architecture ...... $bng_arch (asm level $bng_asm_level)"
1718
if test "$x11_include" != "not found" && test "$x11_lib" != "not found"; then
1719
echo "Configuration for the \"graph\" library:"
1720
echo " options for compiling .... $x11_include"
1721
echo " options for linking ...... $x11_link"
1724
if test $has_tk = true; then
1725
echo "Configuration for the \"labltk\" library:"
1726
echo " use tcl/tk version ....... $tcl_version"
1727
echo " options for compiling .... $tk_defs"
1728
echo " options for linking ...... $tk_libs"
1730
echo "The \"labltk\" library: not supported"
1734
echo "** Objective Caml configuration completed successfully **"