lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 17.09-beta 1482 lines 45 kB view raw
1#! /bin/sh 2 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######################################################################### 15 16# $Id: configure,v 1.215.2.3 2004/07/09 15:08:51 doligez Exp $ 17 18configure_options="$*" 19prefix=/usr/local 20bindir='' 21libdir='' 22mandir='' 23manext=1 24host_type=unknown 25ccoption='' 26cclibs='' 27curseslibs='' 28mathlib='-lm' 29dllib='' 30x11_include_dir='' 31x11_lib_dir='' 32tk_wanted=yes 33pthread_wanted=yes 34tk_defs='' 35tk_libs='' 36tk_x11=yes 37dl_defs='' 38verbose=no 39withcurses=yes 40withsharedlibs=yes 41binutils_dir='' 42gcc_warnings="-Wall" 43 44# Try to turn internationalization off, can cause config.guess to malfunction! 45unset LANG 46unset LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME 47 48# Turn off some macOS debugging stuff, same reason 49unset RC_TRACE_ARCHIVES RC_TRACE_DYLIBS RC_TRACE_PREBINDING_DISABLED 50 51# Parse command-line arguments 52 53while : ; 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/'`;; 67 *) 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 109done 110 111# Sanity checks 112 113case "$prefix" in 114 /*) ;; 115 *) echo "The -prefix directory must be absolute." 1>&2; exit 2;; 116esac 117case "$bindir" in 118 /*) ;; 119 "") ;; 120 *) echo "The -bindir directory must be absolute." 1>&2; exit 2;; 121esac 122case "$libdir" in 123 /*) ;; 124 "") ;; 125 *) echo "The -libdir directory must be absolute." 1>&2; exit 2;; 126esac 127case "$mandir" in 128 /*) ;; 129 "") ;; 130 *) echo "The -mandir directory must be absolute." 1>&2; exit 2;; 131esac 132 133# Generate the files 134 135cd config/auto-aux 136rm -f s.h m.h Makefile 137touch s.h m.h Makefile 138 139# Write options to Makefile 140 141echo "# generated by ./configure $configure_options" >> Makefile 142 143# Where to install 144 145echo "PREFIX=$prefix" >> Makefile 146case "$bindir" in 147 "") echo 'BINDIR=$(PREFIX)/bin' >> Makefile 148 bindir="$prefix/bin";; 149 *) echo "BINDIR=$bindir" >> Makefile;; 150esac 151case "$libdir" in 152 "") echo 'LIBDIR=$(PREFIX)/lib/ocaml' >> Makefile 153 libdir="$prefix/lib/ocaml";; 154 *) echo "LIBDIR=$libdir" >> Makefile;; 155esac 156echo 'STUBLIBDIR=$(LIBDIR)/stublibs' >> Makefile 157case "$mandir" in 158 "") echo 'MANDIR=$(PREFIX)/man' >> Makefile 159 mandir="$prefix/man";; 160 *) echo "MANDIR=$mandir" >> Makefile;; 161esac 162echo "MANEXT=$manext" >> Makefile 163 164# Determine the system type 165 166if 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 171 fi 172fi 173if host=`../gnu/config.sub $host_type`; then :; else 174 echo "Please specify the correct host type with the -host option" 175 exit 2 176fi 177echo "Configuring for a $host ..." 178 179# Do we have gcc? 180 181if test -z "$ccoption"; then 182 if sh ./searchpath gcc; then 183 echo "gcc found" 184 cc=gcc 185 else 186 cc=cc 187 fi 188else 189 cc="$ccoption" 190fi 191 192# Check for buggy versions of GCC 193 194buggycc="no" 195 196case "$host,$cc" in 197 i[3456]86-*-*,gcc*) 198 case `$cc --version` in 199 2.7.2.1) cat <<'EOF' 200 201WARNING: you are using gcc version 2.7.2.1 on an Intel x86 processor. 202This version of gcc is known to generate incorrect code for the 203Objective Caml runtime system on some Intel x86 machines. (The symptom 204is a crash of boot/ocamlc when compiling stdlib/pervasives.mli.) 205In particular, the version of gcc 2.7.2.1 that comes with 206Linux RedHat 4.x / Intel is affected by this problem. 207Other Linux distributions might also be affected. 208If you are using one of these configurations, you are strongly advised 209to use another version of gcc, such as 2.95, which are 210known to work well with Objective Caml. 211 212Press <enter> to proceed or <interrupt> to stop. 213EOF 214 read reply;; 215 2.96*) cat <<'EOF' 216 217WARNING: you are using gcc version 2.96 on an Intel x86 processor. 218Certain patched versions of gcc 2.96 are known to generate incorrect 219code for the Objective Caml runtime system. (The symptom is a segmentation 220violation on boot/ocamlc.) Those incorrectly patched versions can be found 221in RedHat 7.2 and Mandrake 8.0 and 8.1; other Linux distributions 222might also be affected. (See bug #57760 on bugzilla.redhat.com) 223 224Auto-configuration will now select gcc compiler flags that work around 225the problem. Still, if you observe segmentation faults while running 226ocamlc or ocamlopt, you are advised to try another version of gcc, 227such as 2.95.3 or 3.2. 228 229EOF 230 buggycc="gcc.2.96";; 231 232 esac;; 233esac 234 235# Configure the bytecode compiler 236 237bytecc="$cc" 238bytecccompopts="" 239bytecclinkopts="" 240ostype="Unix" 241exe="" 242 243case "$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"; 264 fi 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";; 302esac 303 304# Configure compiler to use in further tests 305 306cc="$bytecc -O $bytecclinkopts" 307export cc cclibs verbose 308 309# Check C compiler 310 311sh ./runtest ansi.c 312case $? 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;; 320esac 321 322# Check the sizes of data types 323 324echo "Checking the sizes of integers and pointers..." 325set `sh ./runtest sizes.c` 326case "$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;; 342esac 343if 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 348fi 349 350echo "#define SIZEOF_INT $1" >> m.h 351echo "#define SIZEOF_LONG $2" >> m.h 352echo "#define SIZEOF_SHORT $4" >> m.h 353 354if 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 359else 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 383fi 384 385# Determine endianness 386 387sh ./runtest endian.c 388case $? 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).";; 399esac 400 401# Determine alignment constraints 402 403case "$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;; 418 *) 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;; 431esac 432 433if $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;; 443 *) 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 457else 458 echo "#undef ARCH_ALIGN_INT64" >> m.h 459fi 460 461# Check semantics of division and modulus 462 463sh ./runtest divmod.c 464case $? 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;; 471esac 472 473# Shared library support 474 475shared_libraries_supported=false 476dl_needs_underscore=false 477sharedcccompopts='' 478mksharedlib='' 479byteccrpath='' 480mksharedlibrpath='' 481 482if 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," 519 fi 520 shared_libraries_supported=true;; 521 *) 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 544fi 545 546# Further machine-specific hacks 547 548case "$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;; 552esac 553 554# Configure the native-code compiler 555 556arch=none 557model=default 558system=unknown 559 560case "$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;; 590esac 591 592if 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 598else 599 nativecc="$ccoption" 600fi 601 602nativecccompopts='' 603nativecclinkopts='' 604nativeccrpath="$byteccrpath" 605 606case "$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";; 618esac 619 620asflags='' 621aspp='$(AS)' 622asppflags='' 623asppprofflags='-DPROFILING' 624 625case "$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)';; 649esac 650 651cc_profile='-pg' 652case "$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';; 661esac 662 663# Where are GNU binutils? 664 665binutils_objcopy='' 666binutils_nm='' 667 668if 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; 679 fi 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; 683 fi 684 binutils_objcopy="$d/objcopy" 685 binutils_nm="$d/nm" 686 break 687 fi 688 done 689 IFS="$old_IFS" 690fi 691 692# Where is ranlib? 693 694if sh ./searchpath ranlib; then 695 echo "ranlib found" 696 echo "RANLIB=ranlib" >> Makefile 697 echo "RANLIBCMD=ranlib" >> Makefile 698else 699 echo "ranlib not used" 700 echo "RANLIB=ar rs" >> Makefile 701 echo "RANLIBCMD=" >> Makefile 702fi 703 704# Do #! scripts work? 705 706if (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;; 717 *) 718 echo "SHARPBANGSCRIPTS=true" >> Makefile;; 719 esac 720else 721 echo "No support for #! in shell scripts" 722 echo "SHARPBANGSCRIPTS=false" >> Makefile 723fi 724 725# Write the OS type (Unix or Cygwin) 726 727echo "#define OCAML_OS_TYPE \"$ostype\"" >> s.h 728echo "#define OCAML_STDLIB_DIR \"$libdir\"" >> s.h 729 730# Use 64-bit file offset if possible 731 732bytecccompopts="$bytecccompopts -D_FILE_OFFSET_BITS=64" 733nativecccompopts="$nativecccompopts -D_FILE_OFFSET_BITS=64" 734 735# Check the semantics of signal handlers 736 737if sh ./hasgot sigaction sigprocmask; then 738 echo "POSIX signal handling found." 739 echo "#define POSIX_SIGNALS" >> s.h 740else 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." 746 fi 747 if sh ./hasgot sigsetmask; then 748 echo "sigsetmask() found" 749 echo "#define HAS_SIGSETMASK" >> s.h 750 fi 751fi 752 753# For the sys module 754 755if sh ./hasgot times; then 756 echo "times() found." 757 echo "#define HAS_TIMES" >> s.h 758fi 759 760# For the terminfo module 761 762if 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 769 fi 770 done 771fi 772 773# Configuration for the libraries 774 775otherlibraries="unix str num dynlink bigarray" 776 777# For the Unix library 778 779has_sockets=no 780if 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 784elif 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 789fi 790 791if 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 794fi 795 796if sh ./hasgot inet_aton; then 797 echo "inet_aton() found." 798 echo "#define HAS_INET_ATON" >> s.h 799fi 800 801if 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 806fi 807 808if sh ./hasgot -i unistd.h; then 809 echo "unistd.h found." 810 echo "#define HAS_UNISTD" >> s.h 811fi 812 813if 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 816fi 817 818if sh ./hasgot -i sys/types.h -i dirent.h; then 819 echo "dirent.h found." 820 echo "#define HAS_DIRENT" >> s.h 821fi 822 823if sh ./hasgot rewinddir; then 824 echo "rewinddir() found." 825 echo "#define HAS_REWINDDIR" >> s.h 826fi 827 828if sh ./hasgot lockf; then 829 echo "lockf() found." 830 echo "#define HAS_LOCKF" >> s.h 831fi 832 833if sh ./hasgot mkfifo; then 834 echo "mkfifo() found." 835 echo "#define HAS_MKFIFO" >> s.h 836fi 837 838if sh ./hasgot getcwd; then 839 echo "getcwd() found." 840 echo "#define HAS_GETCWD" >> s.h 841fi 842 843if sh ./hasgot getwd; then 844 echo "getwd() found." 845 echo "#define HAS_GETWD" >> s.h 846fi 847 848if sh ./hasgot getpriority setpriority; then 849 echo "getpriority() found." 850 echo "#define HAS_GETPRIORITY" >> s.h 851fi 852 853if sh ./hasgot -i sys/types.h -i utime.h && sh ./hasgot utime; then 854 echo "utime() found." 855 echo "#define HAS_UTIME" >> s.h 856fi 857 858if sh ./hasgot utimes; then 859 echo "utimes() found." 860 echo "#define HAS_UTIMES" >> s.h 861fi 862 863if sh ./hasgot dup2; then 864 echo "dup2() found." 865 echo "#define HAS_DUP2" >> s.h 866fi 867 868if sh ./hasgot fchmod fchown; then 869 echo "fchmod() found." 870 echo "#define HAS_FCHMOD" >> s.h 871fi 872 873if sh ./hasgot truncate ftruncate; then 874 echo "truncate() found." 875 echo "#define HAS_TRUNCATE" >> s.h 876fi 877 878select_include='' 879if 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' 883fi 884 885has_select=no 886if 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 891fi 892 893if sh ./hasgot symlink readlink lstat; then 894 echo "symlink() found." 895 echo "#define HAS_SYMLINK" >> s.h 896fi 897 898has_wait=no 899if sh ./hasgot waitpid; then 900 echo "waitpid() found." 901 echo "#define HAS_WAITPID" >> s.h 902 has_wait=yes 903fi 904 905if sh ./hasgot wait4; then 906 echo "wait4() found." 907 echo "#define HAS_WAIT4" >> s.h 908 has_wait=yes 909fi 910 911if sh ./hasgot -i limits.h && sh ./runtest getgroups.c; then 912 echo "getgroups() found." 913 echo "#define HAS_GETGROUPS" >> s.h 914fi 915 916if 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 920fi 921 922# Async I/O under OSF1 3.x are so buggy that the test program hangs... 923testasyncio=true 924if test -f /usr/bin/uname; then 925 case "`/usr/bin/uname -s -r`" in 926 "OSF1 V3."*) testasyncio=false;; 927 esac 928fi 929if $testasyncio && sh ./runtest async_io.c; then 930 echo "Asynchronous I/O are supported." 931 echo "#define HAS_ASYNC_IO" >> s.h 932fi 933 934has_setitimer=no 935if sh ./hasgot setitimer; then 936 echo "setitimer() found." 937 echo "#define HAS_SETITIMER" >> s.h 938 has_setitimer="yes" 939fi 940 941if sh ./hasgot gethostname; then 942 echo "gethostname() found." 943 echo "#define HAS_GETHOSTNAME" >> s.h 944fi 945 946if sh ./hasgot -i sys/utsname.h && sh ./hasgot uname; then 947 echo "uname() found." 948 echo "#define HAS_UNAME" >> s.h 949fi 950 951has_gettimeofday=no 952if sh ./hasgot gettimeofday; then 953 echo "gettimeofday() found." 954 echo "#define HAS_GETTIMEOFDAY" >> s.h 955 has_gettimeofday="yes" 956fi 957 958if sh ./hasgot mktime; then 959 echo "mktime() found." 960 echo "#define HAS_MKTIME" >> s.h 961fi 962 963case "$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;; 969esac 970 971if sh ./hasgot putenv; then 972 echo "putenv() found." 973 echo "#define HAS_PUTENV" >> s.h 974fi 975 976if sh ./hasgot -i locale.h && sh ./hasgot setlocale; then 977 echo "setlocale() and <locale.h> found." 978 echo "#define HAS_LOCALE" >> s.h 979fi 980 981if 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 984elif sh ./hasgot $dllib dlopen; then 985 echo "dlopen() found." 986elif sh ./hasgot $dllib -ldl dlopen; then 987 echo "dlopen() found in -ldl." 988 dllib="$dllib -ldl" 989else 990 shared_libraries_supported=no 991fi 992 993if $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 998 fi 999fi 1000 1001if 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 1004fi 1005 1006nargs=none 1007for i in 5 6; do 1008 if sh ./trycompile -DNUM_ARGS=${i} gethostbyname.c; then nargs=$i; break; fi 1009done 1010if test $nargs != "none"; then 1011 echo "gethostbyname_r() found (with ${nargs} arguments)." 1012 echo "#define HAS_GETHOSTBYNAME_R $nargs" >> s.h 1013fi 1014 1015nargs=none 1016for i in 7 8; do 1017 if sh ./trycompile -DNUM_ARGS=${i} gethostbyaddr.c; then nargs=$i; break; fi 1018done 1019if test $nargs != "none"; then 1020 echo "gethostbyaddr_r() found (with ${nargs} arguments)." 1021 echo "#define HAS_GETHOSTBYADDR_R $nargs" >> s.h 1022fi 1023 1024# Determine if the debugger is supported 1025 1026if test "$has_sockets" = "yes"; then 1027 echo "Replay debugger supported." 1028 debugger="ocamldebugger" 1029else 1030 echo "No replay debugger (missing system calls)" 1031 debugger="" 1032fi 1033 1034 1035# Determine if system stack overflows can be detected 1036 1037case "$arch,$system" in 1038 i386,linux_elf) 1039 echo "System stack overflow can be detected." 1040 echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;; 1041 *) 1042 echo "Cannot detect system stack overflow.";; 1043esac 1044 1045# Determine the target architecture for the "num" library 1046 1047case "$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;; 1059esac 1060 1061echo "BNG_ARCH=$bng_arch" >> Makefile 1062echo "BNG_ASM_LEVEL=$bng_asm_level" >> Makefile 1063 1064# Determine if the POSIX threads library is supported 1065 1066if 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 1092 fi 1093 else 1094 echo "POSIX threads not found." 1095 pthread_link="" 1096 fi 1097fi 1098 1099# Determine if the bytecode thread library is supported 1100 1101if 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" 1107else 1108 echo "Bytecode threads library not supported (missing system calls)" 1109fi 1110 1111# Determine the location of X include files and libraries 1112 1113x11_include="not found" 1114x11_link="not found" 1115 1116for dir in \ 1117 $x11_include_dir \ 1118 ; \ 1119do 1120 if test -f $dir/X11/X.h; then 1121 x11_include=$dir 1122 break 1123 fi 1124done 1125 1126if test "$x11_include" = "not found"; then 1127 x11_try_lib_dir='' 1128else 1129 x11_try_lib_dir=`echo $x11_include | sed -e 's|include|lib|'` 1130fi 1131 1132for dir in \ 1133 $x11_lib_dir \ 1134 $x11_try_lib_dir \ 1135 ; \ 1136do 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" 1146 fi 1147 break 1148 fi 1149done 1150 1151 1152if test "$x11_include" = "not found" || test "$x11_link" = "not found" 1153then 1154 echo "X11 not found, the \"graph\" library will not be supported." 1155 x11_include="" 1156else 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" 1164 fi 1165 echo "X11_INCLUDES=$x11_include" >> Makefile 1166 echo "X11_LINK=$x11_link" >> Makefile 1167fi 1168 1169# See if we can compile the dbm library 1170 1171dbm_include="not found" 1172dbm_link="not found" 1173use_gdbm_ndbm=no 1174 1175for 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" 1188 fi 1189 break 1190 fi 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" 1196 fi 1197 break 1198 fi 1199done 1200if test "$dbm_include" = "not found" || test "$dbm_link" = "not found"; then 1201 echo "NDBM not found, the \"dbm\" library will not be supported." 1202else 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" 1208 fi 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 1213 fi 1214 otherlibraries="$otherlibraries dbm" 1215fi 1216 1217# Look for tcl/tk 1218 1219echo "Configuring LablTk..." 1220 1221if test $tk_wanted = no; then 1222 has_tk=false 1223elif test $tk_x11 = no; then 1224 has_tk=true 1225elif test "$x11_include" = "not found" || test "$x11_link" = "not found"; then 1226 echo "X11 not found." 1227 has_tk=false 1228else 1229 tk_x11_include="$x11_include" 1230 tk_x11_libs="$x11_libs -lX11" 1231 has_tk=true 1232fi 1233 1234if 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` 1240 fi 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` 1244 fi 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` 1248 fi 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` 1252 fi 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` 1256 fi 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` 1260 fi 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` 1264 fi 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` 1268 fi 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 1284 fi 1285fi 1286 1287if 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 1293 fi 1294fi 1295 1296tkauxlibs="$mathlib $dllib" 1297tcllib='' 1298tklib='' 1299if 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 1323 fi 1324fi 1325if 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 1335 fi 1336fi 1337 1338if 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 1345 fi 1346 otherlibraries="$otherlibraries labltk" 1347else 1348 echo "Configuration failed, LablTk will not be built." 1349fi 1350 1351# Camlp4 1352 1353( 1354cd ../../camlp4/config 1355EXE=$exe ./configure_batch -bindir "$bindir" -libdir "$libdir" -mandir "$mandir" -ocaml-top ../.. > /dev/null 1356) 1357 1358# Final twiddling of compiler options to work around known bugs 1359 1360nativeccprofopts="$nativecccompopts" 1361case "$buggycc" in 1362 gcc.2.96) 1363 bytecccompopts="$bytecccompopts -fomit-frame-pointer" 1364 nativecccompopts="$nativecccompopts -fomit-frame-pointer";; 1365esac 1366 1367# Finish generated files 1368 1369cclibs="$cclibs $mathlib" 1370 1371echo "BYTECC=$bytecc" >> Makefile 1372echo "BYTECCCOMPOPTS=$bytecccompopts" >> Makefile 1373echo "BYTECCLINKOPTS=$bytecclinkopts" >> Makefile 1374echo "BYTECCLIBS=$cclibs $dllib $curseslibs $pthread_link" >> Makefile 1375echo "BYTECCRPATH=$byteccrpath" >> Makefile 1376echo "EXE=$exe" >> Makefile 1377echo "SUPPORTS_SHARED_LIBRARIES=$shared_libraries_supported" >> Makefile 1378echo "SHAREDCCCOMPOPTS=$sharedcccompopts" >> Makefile 1379echo "MKSHAREDLIB=$mksharedlib" >> Makefile 1380echo "MKSHAREDLIBRPATH=$mksharedlibrpath" >> Makefile 1381echo "ARCH=$arch" >> Makefile 1382echo "MODEL=$model" >> Makefile 1383echo "SYSTEM=$system" >> Makefile 1384echo "NATIVECC=$nativecc" >> Makefile 1385echo "NATIVECCCOMPOPTS=$nativecccompopts" >> Makefile 1386echo "NATIVECCPROFOPTS=$nativeccprofopts" >> Makefile 1387echo "NATIVECCLINKOPTS=$nativecclinkopts" >> Makefile 1388echo "NATIVECCRPATH=$nativeccrpath" >> Makefile 1389echo "NATIVECCLIBS=$cclibs $dllib" >> Makefile 1390echo "ASFLAGS=$asflags" >> Makefile 1391echo "ASPP=$aspp" >> Makefile 1392echo "ASPPFLAGS=$asppflags" >> Makefile 1393echo "ASPPPROFFLAGS=$asppprofflags" >> Makefile 1394echo "PROFILING=$profiling" >> Makefile 1395echo "BINUTILS_OBJCOPY=$binutils_objcopy" >> Makefile 1396echo "BINUTILS_NM=$binutils_nm" >> Makefile 1397echo "DYNLINKOPTS=$dllib" >> Makefile 1398echo "OTHERLIBRARIES=$otherlibraries" >> Makefile 1399echo "DEBUGGER=$debugger" >> Makefile 1400echo "CC_PROFILE=$cc_profile" >> Makefile 1401 1402rm -f tst hasgot.c 1403rm -f ../m.h ../s.h ../Makefile 1404mv m.h s.h Makefile .. 1405 1406# Print a summary 1407 1408echo 1409echo "** Configuration summary **" 1410echo 1411echo "Directories where Objective Caml will be installed:" 1412echo " binaries.................. $bindir" 1413echo " standard library.......... $libdir" 1414echo " manual pages.............. $mandir (with extension .$manext)" 1415 1416echo "Configuration for the bytecode compiler:" 1417echo " C compiler used........... $bytecc" 1418echo " options for compiling..... $bytecccompopts" 1419echo " options for linking....... $bytecclinkopts $cclibs $dllib $curseslibs $pthread_link" 1420if $shared_libraries_supported; then 1421echo " shared libraries are supported" 1422echo " options for compiling..... $sharedcccompopts $bytecccompopts" 1423echo " command for building...... $mksharedlib lib.so $mksharedlibrpath/a/path objs" 1424else 1425echo " shared libraries not supported" 1426fi 1427 1428echo "Configuration for the native-code compiler:" 1429if test "$arch" = "none"; then 1430 echo " (not supported on this platform)" 1431else 1432 if test "$model" = "default"; then 1433 echo " hardware architecture..... $arch" 1434 else 1435 echo " hardware architecture..... $arch ($model)" 1436 fi 1437 if test "$system" = "unknown"; then : ; else 1438 echo " OS variant................ $system" 1439 fi 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" 1449 fi 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)" 1454 fi 1455fi 1456 1457if test "$debugger" = "ocamldebugger"; then 1458 echo "Source-level replay debugger: supported" 1459else 1460 echo "Source-level replay debugger: not supported" 1461fi 1462 1463echo "Additional libraries supported:" 1464echo " $otherlibraries" 1465 1466echo "Configuration for the \"num\" library:" 1467echo " target architecture ...... $bng_arch (asm level $bng_asm_level)" 1468 1469if test "$x11_include" != "not found" && test "$x11_lib" != "not found"; then 1470echo "Configuration for the \"graph\" library:" 1471echo " options for compiling .... $x11_include" 1472echo " options for linking ...... $x11_link" 1473fi 1474 1475if test $has_tk = true; then 1476echo "Configuration for the \"labltk\" library:" 1477echo " use tcl/tk version ....... $tcl_version" 1478echo " options for compiling .... $tk_defs" 1479echo " options for linking ...... $tk_libs" 1480else 1481echo "The \"labltk\" library: not found" 1482fi