ocaml/configure

1836 lines
56 KiB
Plaintext
Raw Normal View History

#! /bin/sh
#########################################################################
# #
# OCaml #
# #
# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
# #
# Copyright 1999 Institut National de Recherche en Informatique et #
# en Automatique. All rights reserved. This file is distributed #
# under the terms of the GNU Library General Public License, with #
# the special exception on linking described in file LICENSE. #
# #
#########################################################################
configure_options="$*"
prefix=/usr/local
bindir=''
libdir=''
mandir=''
manext=1
host_type=unknown
target_type=""
ccoption=''
asoption=''
asppoption=''
cclibs=''
curseslibs=''
mathlib='-lm'
dllib=''
x11_include_dir=''
x11_lib_dir=''
graph_wanted=yes
pthread_wanted=yes
dl_defs=''
verbose=no
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
with_curses=yes
debugruntime=noruntimed
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
with_sharedlibs=yes
gcc_warnings="-Wall"
partialld="ld -r"
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
with_camlp4=camlp4
with_debugger=ocamldebugger
with_ocamldoc=ocamldoc
with_ocamlbuild=ocamlbuild
with_frame_pointers=false
TOOLPREF=""
with_cfi=true
# Try to turn internationalization off, can cause config.guess to malfunction!
unset LANG
unset LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
# Turn off some MacOS X debugging stuff, same reason
unset RC_TRACE_ARCHIVES RC_TRACE_DYLIBS RC_TRACE_PREBINDING_DISABLED
# The inf(), wrn(), err() functions below can be used to provide a consistent
# way to notify the user. The notification is always given to the stdout
# descriptor.
#
# Their output is redirected to a file-descriptor "3" which is then redirected
# to fd 1 at the level of the whole configure script. This is done to not
# conflict with how values are returned from functions in shell script.
# Consider the following where "It works!" would be mixed with "42".
# do_foo() {
# if some_command; then
# inf "It works!"
# echo "42"
# fi
# }
inf() {
printf "%b\n" "$*" 1>&3
}
wrn() {
printf "[WARNING] %b\n" "$*" 1>&3
}
err() {
printf "[ERROR!]%b\n" "$*" 1>&3
exit 2
}
exec 3>&1
# Parse command-line arguments
if echo "$configure_options" | grep -q -e '--\?[a-zA-Z0-9-]\+='; then
err "Arguments to this script look like '-prefix /foo/bar', not '-prefix=/foo/bar' (note the '=')."
fi
while : ; do
case "$1" in
"") break;;
-prefix|--prefix)
prefix=$2; shift;;
-bindir|--bindir)
bindir=$2; shift;;
-libdir|--libdir)
libdir=$2; shift;;
-mandir|--mandir)
case "$2" in
*/man[1-9ln])
mandir=`echo $2 | sed -e 's|^\(.*\)/man.$|\1|'`
manext=`echo $2 | sed -e 's/^.*\(.\)$/\1/'`;;
*)
mandir=$2
manext=1;;
esac
shift;;
-host*|--host*)
host_type=$2; shift;;
-target*|--target*)
target_type=$2; shift;;
-cc*)
ccoption="$2"; shift;;
-as)
asoption="$2"; shift;;
-aspp)
asppoption="$2"; shift;;
-lib*)
cclibs="$2 $cclibs"; shift;;
-no-curses|--no-curses)
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
with_curses=no;;
-no-shared-libs|--no-shared-libs)
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
with_sharedlibs=no;;
-x11include*|--x11include*)
x11_include_dir=$2; shift;;
-x11lib*|--x11lib*)
x11_lib_dir=$2; shift;;
-no-graph|--no-graph) graph_wanted=no;;
-with-pthread*|--with-pthread*)
;; # Ignored for backward compatibility
-no-pthread*|--no-pthread*)
pthread_wanted=no;;
-partialld|--partialld)
partialld="$2"; shift;;
-dldefs*|--dldefs*)
dl_defs="$2"; shift;;
-dllibs*|--dllibs*)
dllib="$2"; shift;;
-verbose|--verbose)
verbose=yes;;
-with-debug-runtime|--with-debug-runtime)
debugruntime=runtimed;;
-no-camlp4|--no-camlp4)
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
with_camlp4="";;
-no-debugger|--no-debugger)
with_debugger="";;
-no-ocamldoc|--no-ocamldoc)
with_ocamldoc="";;
-no-ocamlbuild|--no-ocamlbuild)
with_ocamlbuild="";;
-with-frame-pointers|--with-frame-pointers)
with_frame_pointers=true;;
-no-cfi|--no-cfi)
with_cfi=false;;
*) err "Unknown option \"$1\".";;
esac
shift
done
# Sanity checks
case "$prefix" in
/*) ;;
*) err "The -prefix directory must be absolute.";;
esac
case "$bindir" in
/*) ;;
"") ;;
'$(PREFIX)/'*) ;;
*) err 'The -bindir directory must be absolute or relative to $(PREFIX).';;
esac
case "$libdir" in
/*) ;;
"") ;;
'$(PREFIX)/'*) ;;
*) err 'The -libdir directory must be absolute or relative to $(PREFIX).';;
esac
case "$mandir" in
/*) ;;
"") ;;
'$(PREFIX)/'*) ;;
*) err 'The -mandir directory must be absolute or relative to $(PREFIX).';;
esac
if test -n "$with_camlp4" -a -z "$with_ocamlbuild"; then
err "Camlp4 is enabled but not ocamlbuild; building camlp4 is not possible without building ocamlbuild."
fi
# Generate the files
cd config/auto-aux
rm -f s.h m.h Makefile
touch s.h m.h Makefile
# Write options to Makefile
echo "# generated by ./configure $configure_options" >> Makefile
# Where to install
echo "PREFIX=$prefix" >> Makefile
case "$bindir" in
"") echo 'BINDIR=$(PREFIX)/bin' >> Makefile
bindir="$prefix/bin";;
*) echo "BINDIR=$bindir" >> Makefile;;
esac
case "$libdir" in
"") echo 'LIBDIR=$(PREFIX)/lib/ocaml' >> Makefile
libdir="$prefix/lib/ocaml";;
*) echo "LIBDIR=$libdir" >> Makefile;;
esac
echo 'STUBLIBDIR=$(LIBDIR)/stublibs' >> Makefile
case "$mandir" in
"") echo 'MANDIR=$(PREFIX)/man' >> Makefile
mandir="$prefix/man";;
*) echo "MANDIR=$mandir" >> Makefile;;
esac
echo "MANEXT=$manext" >> Makefile
# Determine the system type
if test "$host_type" = "unknown"; then
if host_type=`../gnu/config.guess`; then :; else
err "Cannot guess host type. You must specify one with the -host option."
fi
fi
if host=`../gnu/config.sub $host_type`; then :; else
err "Please specify the correct host type with the -host option"
fi
inf "Configuring for host $host ..."
if test -n "$target_type"; then
target="$target_type"
TOOLPREF="${target}-"
else
target="$host"
fi
inf "Configuring for target $target ..."
# Do we have gcc?
if test -z "$ccoption"; then
if sh ./searchpath "${TOOLPREF}gcc"; then
cc="${TOOLPREF}gcc"
else
if test x"$host" = x"$target"; then
cc="cc"
else
err "No cross-compiler found for ${target}.\n" \
"It should be named ${TOOLPREF}gcc and be in the PATH."
fi
fi
else
cc="$ccoption"
fi
inf "Using compiler $cc."
# Check for buggy versions of GCC
# These checks are not done for cross-compilation (yet at least) because after
# 15 years, I doubt someone will try to use an experimental (2.96) or
# known-unstable (2.7.2.1) version for cross-compilation.
buggycc="no"
case "$target,$cc" in
i[3456]86-*-*,gcc*)
case `$cc --version` in
2.7.2.1) cat <<'EOF'
WARNING: you are using gcc version 2.7.2.1 on an Intel x86 processor.
This version of gcc is known to generate incorrect code for the
OCaml runtime system on some Intel x86 machines. (The symptom
is a crash of boot/ocamlc when compiling stdlib/pervasives.mli.)
In particular, the version of gcc 2.7.2.1 that comes with
Linux RedHat 4.x / Intel is affected by this problem.
Other Linux distributions might also be affected.
If you are using one of these configurations, you are strongly advised
to use another version of gcc, such as 2.95, which are
known to work well with OCaml.
Press <enter> to proceed or <interrupt> to stop.
EOF
read reply;;
2.96*) cat <<'EOF'
WARNING: you are using gcc version 2.96 on an Intel x86 processor.
Certain patched versions of gcc 2.96 are known to generate incorrect
code for the OCaml runtime system. (The symptom is a segmentation
violation on boot/ocamlc.) Those incorrectly patched versions can be found
in RedHat 7.2 and Mandrake 8.0 and 8.1; other Linux distributions
might also be affected. (See bug #57760 on bugzilla.redhat.com)
Auto-configuration will now select gcc compiler flags that work around
the problem. Still, if you observe segmentation faults while running
ocamlc or ocamlopt, you are advised to try another version of gcc,
such as 2.95.3 or 3.2.
EOF
buggycc="gcc.2.96";;
esac;;
esac
# Configure the bytecode compiler
bytecc="$cc"
mkexe="\$(BYTECC)"
mkexedebugflag="-g"
bytecccompopts=""
bytecclinkopts=""
dllccompopts=""
ostype="Unix"
exe=""
iflexdir=""
SO=".so"
TOOLCHAIN="cc"
case "$bytecc,$target" in
cc,*-*-nextstep*)
# GNU C extensions disabled, but __GNUC__ still defined!
bytecccompopts="-fno-defer-pop $gcc_warnings -U__GNUC__ -posix"
bytecclinkopts="-posix";;
*,*-*-rhapsody*)
# Almost the same as NeXTStep
bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
mathlib="";;
*,*-*-darwin*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
mathlib=""
mkexe="$mkexe -Wl,-no_compact_unwind"
# Tell gcc that we can use 32-bit code addresses for threaded code
# unless we are compiled for a shared library (-fPIC option)
echo "#ifndef __PIC__" >> m.h
echo "# define ARCH_CODE32" >> m.h
echo "#endif" >> m.h;;
*,*-*-beos*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
# No -lm library
mathlib="";;
*gcc,alpha*-*-osf*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
if cc="$bytecc" sh ./hasgot -mieee; then
bytecccompopts="-mieee $bytecccompopts";
fi
# Put code and static data in lower 4GB
bytecclinkopts="-Wl,-T,12000000 -Wl,-D,14000000"
# Tell gcc that we can use 32-bit code addresses for threaded code
echo "#define ARCH_CODE32" >> m.h;;
cc,alpha*-*-osf*)
bytecccompopts="-std1 -ieee";;
*gcc*,alpha*-*-linux*)
if cc="$bytecc" sh ./hasgot -mieee; then
bytecccompopts="-mieee $bytecccompopts";
fi;;
cc,mips-*-irix6*)
# Add -n32 flag to ensure compatibility with native-code compiler
bytecccompopts="-n32"
# Turn off warning "unused library"
bytecclinkopts="-n32 -Wl,-woff,84";;
cc*,mips-*-irix6*)
# (For those who want to force "cc -64")
# Turn off warning "unused library"
bytecclinkopts="-Wl,-woff,84";;
*,alpha*-*-unicos*)
# For the Cray T3E
bytecccompopts="-DUMK";;
*gcc*,powerpc-*-aix*)
# Avoid name-space pollution by requiring Unix98-conformant includes
bytecccompopts="-fno-defer-pop $gcc_warnings -D_XOPEN_SOURCE=500";;
*,powerpc-*-aix*)
bytecccompopts="-D_XOPEN_SOURCE=500";;
*gcc*,*-*-cygwin*)
bytecccompopts="-fno-defer-pop $gcc_warnings -U_WIN32"
dllccompopts="-U_WIN32 -DCAML_DLL"
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
if test $with_sharedlibs = yes; then
flexlink="flexlink -chain cygwin -merge-manifest -stack 16777216"
flexdir=`$flexlink -where | dos2unix`
if test -z "$flexdir"; then
wrn "flexlink not found: native shared libraries won't be available."
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
with_sharedlibs=no
else
iflexdir="-I\"$flexdir\""
mkexe="$flexlink -exe"
mkexedebugflag="-link -g"
fi
fi
exe=".exe"
ostype="Cygwin";;
*gcc*,*-*-mingw*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
dllccompopt="-DCAML_DLL"
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
if test $with_sharedlibs = yes; then
case "$target" in
i686-*-*) flexlink_chain="mingw";;
x86_64-*-*) flexlink_chain="mingw64";;
esac
flexlink="flexlink -chain $flexlink_chain -merge-manifest -stack 16777216"
flexdir=`$flexlink -where`
if test -z "$flexdir"; then
wrn "flexlink not found: native shared libraries won't be available."
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
with_sharedlibs=no
else
iflexdir="-I\"$flexdir\""
mkexe="$flexlink -exe"
mkexedebugflag="-link -g"
fi
fi
exe=".exe"
ostype="Win32"
TOOLCHAIN="mingw"
SO=".dll"
;;
*gcc*,x86_64-*-linux*)
bytecccompopts="-fno-defer-pop $gcc_warnings"
# Tell gcc that we can use 32-bit code addresses for threaded code
# unless we are compiled for a shared library (-fPIC option)
echo "#ifndef __PIC__" >> m.h
echo "# define ARCH_CODE32" >> m.h
echo "#endif" >> m.h;;
*gcc*)
bytecccompopts="-fno-defer-pop $gcc_warnings";;
esac
# Configure compiler to use in further tests
cc="$bytecc -O $bytecclinkopts"
export cc cclibs verbose
# Check C compiler
sh ./runtest ansi.c
case $? in
0) inf "The C compiler is ANSI-compliant." ;;
1) err "The C compiler $cc is not ANSI-compliant.\n" \
"You need an ANSI C compiler to build OCaml.";;
*)
if test x"$host" != x"$target"; then
wrn "Unable to compile the test program.\n" \
"This failure is expected for cross-compilation:\n" \
"we will assume the C compiler is ANSI-compliant."
else
err "Unable to compile the test program.\n" \
"Make sure the C compiler $cc is properly installed."
fi;;
esac
# Determine which ocamlrun executable to use; for cross-compilation, a native
# "ocamlrun" executable must be available on the system.
if test x"$target" != x"$host"; then
if ! sh ./searchpath ocamlrun; then
err "Cross-compilation requires an ocaml runtime environment (the ocamlrun binary). Moreover, its version must be the same as the one you're trying to build (`cut -f1 -d+ < ../../VERSION`)."
else
# Make sure the version of the system ocaml and the version of these
# sources match. Don't compare "+devXX" on purpose as it would be too
# annoying during development and people using SVN are expected to know
# what they're doing and how to handle basic issues.
ocaml_system_version=`ocamlc -version | cut -f1 -d+`
ocaml_source_version=`sed -n '1 s/\([0-9\.]\+\).*/\1/ p' < ../../VERSION`
if test x"$ocaml_system_version" != x"$ocaml_source_version"; then
err "The system OCaml toolchain is $ocaml_system_version but these sources are $ocaml_source_version.\nBuilding a cross-compiler requires versions to match."
else
camlrun="ocamlrun"
fi
fi
else
rootdir=`cd ../.. && pwd`
camlrun=$rootdir/boot/ocamlrun
fi
# Check the sizes of data types
# OCaml needs a 32 or 64bit architectue and a 32-bit integer type.
inf "Checking the sizes of integers and pointers..."
ret=`sh ./runtest sizes.c`
if test "$?" -eq 0; then
set $ret
case "$2,$3" in
4,4) inf "OK, this is a regular 32 bit architecture."
echo "#undef ARCH_SIXTYFOUR" >> m.h
arch64=false;;
*,8) inf "Wow! A 64 bit architecture!"
echo "#define ARCH_SIXTYFOUR" >> m.h
arch64=true
if test $1 != 4 && test $2 != 4 && test $4 != 4; then
err "Sorry, we can't find a 32-bit integer type\n" \
"(sizeof(short) = $4, sizeof(int) = $1, sizeof(long) = $2)\n" \
"OCaml won't run on this architecture."
fi;;
*,*) err "This architecture seems to be neither 32 bits nor 64 bits.\n" \
"OCaml won't run on this architecture.";;
esac
else
# For cross-compilation, runtest always fails: add special handling.
case "$target" in
i686-*-mingw*) inf "OK, this is a regular 32 bit architecture."
echo "#undef ARCH_SIXTYFOUR" >> m.h
set 4 4 4 2
arch64=false;;
x86_64-*-mingw*) inf "Wow! A 64 bit architecture!"
echo "#define ARCH_SIXTYFOUR" >> m.h
set 4 4 8 2
arch64=true;;
*) err "Since datatype sizes cannot be guessed when cross-compiling,\n" \
"a hardcoded list is used but your architecture isn't known yet.\n" \
"You need to determine the sizes yourself.\n" \
"Please submit a bug report in order to expand the list." ;;
esac
fi
echo "#define SIZEOF_INT $1" >> m.h
echo "#define SIZEOF_LONG $2" >> m.h
echo "#define SIZEOF_PTR $3" >> m.h
echo "#define SIZEOF_SHORT $4" >> m.h
if test $2 = 8; then
echo "#define ARCH_INT64_TYPE long" >> m.h
echo "#define ARCH_UINT64_TYPE unsigned long" >> m.h
echo '#define ARCH_INT64_PRINTF_FORMAT "l"' >> m.h
int64_native=true
else
sh ./runtest longlong.c
case $? in
0) inf "64-bit \"long long\" integer type found (printf with \"%ll\")."
echo "#define ARCH_INT64_TYPE long long" >> m.h
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
echo '#define ARCH_INT64_PRINTF_FORMAT "ll"' >> m.h
int64_native=true;;
1) inf "64-bit \"long long\" integer type found (printf with \"%q\")."
echo "#define ARCH_INT64_TYPE long long" >> m.h
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
echo '#define ARCH_INT64_PRINTF_FORMAT "q"' >> m.h
int64_native=true;;
2) inf "64-bit \"long long\" integer type found (but no printf)."
echo "#define ARCH_INT64_TYPE long long" >> m.h
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
int64_native=true;;
*)
case "$target" in
*-*-mingw*)
inf "No suitable 64-bit integer type found, will use software emulation."
echo "#define ARCH_INT64_TYPE long long" >> m.h
echo "#define ARCH_UINT64_TYPE unsigned long long" >> m.h
echo '#define ARCH_INT64_PRINTF_FORMAT "I64"' >> m.h
int64_native=true;;
*)
wrn "No suitable 64-bit integer type found, will use software emulation."
echo "#undef ARCH_INT64_TYPE" >> m.h
echo "#undef ARCH_UINT64_TYPE" >> m.h
echo '#undef ARCH_INT64_PRINTF_FORMAT' >> m.h
int64_native=false;;
esac;;
esac
fi
if test $3 = 8 && test $int64_native = false; then
err "This architecture has 64-bit pointers but no 64-bit integer type.\n" \
"OCaml won't run on this architecture."
fi
# Determine endianness
sh ./runtest endian.c
case $? in
0) inf "This is a big-endian architecture."
echo "#define ARCH_BIG_ENDIAN" >> m.h;;
1) inf "This is a little-endian architecture."
echo "#undef ARCH_BIG_ENDIAN" >> m.h;;
2) err "This architecture seems to be neither big endian nor little endian.\n" \
"OCaml won't run on this architecture.";;
*) case $target in
*-*-mingw*) inf "This is a little-endian architecture."
echo "#undef ARCH_BIG_ENDIAN" >> m.h;;
*) wrn "Something went wrong during endianness determination.\n" \
"You will have to figure out endianness yourself (option ARCH_BIG_ENDIAN in m.h).";;
esac;;
esac
# Determine alignment constraints
case "$target" in
sparc*-*-*|hppa*-*-*|arm*-*-*|mips*-*-*)
# On Sparc V9 with certain versions of gcc, determination of double
# alignment is not reliable (PR#1521), hence force it.
# Same goes for hppa.
# PR#5088 suggests same problem on ARM.
# PR#5280 reports same problem on MIPS.
# But there's a knack (PR#2572):
# if we're in 64-bit mode (sizeof(long) == 8),
# we must not doubleword-align floats...
if test $2 = 8; then
inf "Doubles can be word-aligned."
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h
else
inf "Doubles must be doubleword-aligned."
echo "#define ARCH_ALIGN_DOUBLE" >> m.h
fi;;
*)
sh ./runtest dblalign.c
case $? in
0) inf "Doubles can be word-aligned."
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
1) inf "Doubles must be doubleword-aligned."
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
*) case "$target" in
*-*-mingw*) inf "Doubles can be word-aligned."
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
*) wrn "Something went wrong during alignment determination for doubles.\n" \
"We will assume alignment constraints over doubles.\n" \
"That's a safe bet: OCaml will work even if\n" \
"this architecture actually has no alignment constraints."
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
esac;;
esac;;
esac
if $int64_native; then
case "$target" in
# PR#5088: autodetection is unreliable on ARM. PR#5280: also on MIPS.
sparc*-*-*|hppa*-*-*|arm*-*-*|mips*-*-*)
if test $2 = 8; then
inf "64-bit integers can be word-aligned."
echo "#undef ARCH_ALIGN_INT64" >> m.h
else
inf "64-bit integers must be doubleword-aligned."
echo "#define ARCH_ALIGN_INT64" >> m.h
fi;;
*-*-mingw*) true;; # Nothing is in config/m-nt.h so don't add anything.
*)
sh ./runtest int64align.c
case $? in
0) inf "64-bit integers can be word-aligned."
echo "#undef ARCH_ALIGN_INT64" >> m.h;;
1) inf "64-bit integers must be doubleword-aligned."
echo "#define ARCH_ALIGN_INT64" >> m.h;;
*) wrn "Something went wrong during alignment determination for\n" \
"64-bit integers. I'm going to assume this architecture has\n" \
"alignment constraints. That's a safe bet: OCaml will work\n" \
"even if this architecture has actually no alignment\n" \
"constraints." \
echo "#define ARCH_ALIGN_INT64" >> m.h;;
esac
esac
else
echo "#undef ARCH_ALIGN_INT64" >> m.h
fi
# Check semantics of division and modulus
sh ./runtest divmod.c
case $? in
0) inf "Native division and modulus have round-towards-zero semantics," \
"will use them."
echo "#undef NONSTANDARD_DIV_MOD" >> m.h;;
1) inf "Native division and modulus do not have round-towards-zero"
"semantics, will use software emulation."
echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
*) case $target in
*-*-mingw*) inf "Native division and modulus have round-towards-zero" \
"semantics, will use them."
echo "#undef NONSTANDARD_DIV_MOD" >> m.h;;
*) wrn "Something went wrong while checking native division and modulus"\
"please report it at http://http://caml.inria.fr/mantis/"
echo "#define NONSTANDARD_DIV_MOD" >> m.h;;
esac;;
esac
# Shared library support
shared_libraries_supported=false
dl_needs_underscore=false
sharedcccompopts=''
mksharedlib=''
byteccrpath=''
mksharedlibrpath=''
natdynlinkopts=""
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
if test $with_sharedlibs = "yes"; then
case "$target" in
*-*-cygwin*)
mksharedlib="$flexlink"
mkmaindll="$flexlink -maindll"
shared_libraries_supported=true;;
*-*-mingw*)
mksharedlib="$flexlink"
mkmaindll="$flexlink -maindll"
shared_libraries_supported=true;;
*-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-freebsd[1-9][0-9]*|*-*-openbsd*|*-*-netbsd*|*-*-gnu*)
sharedcccompopts="-fPIC"
mksharedlib="$bytecc -shared"
bytecclinkopts="$bytecclinkopts -Wl,-E"
byteccrpath="-Wl,-rpath,"
mksharedlibrpath="-Wl,-rpath,"
natdynlinkopts="-Wl,-E"
shared_libraries_supported=true;;
alpha*-*-osf*)
case "$bytecc" in
*gcc*)
sharedcccompopts="-fPIC"
mksharedlib="$bytecc -shared"
byteccrpath="-Wl,-rpath,"
mksharedlibrpath="-Wl,-rpath,"
shared_libraries_supported=true;;
cc*)
sharedcccompopts=""
mksharedlib="ld -shared -expect_unresolved '*'"
byteccrpath="-Wl,-rpath,"
mksharedlibrpath="-rpath "
shared_libraries_supported=true;;
esac;;
*-*-solaris2*)
case "$bytecc" in
*gcc*)
sharedcccompopts="-fPIC"
if sh ./solaris-ld; then
mksharedlib="$bytecc -shared"
byteccrpath="-R"
mksharedlibrpath="-R"
else
mksharedlib="$bytecc -shared"
bytecclinkopts="$bytecclinkopts -Wl,-E"
natdynlinkopts="-Wl,-E"
byteccrpath="-Wl,-rpath,"
mksharedlibrpath="-Wl,-rpath,"
fi
shared_libraries_supported=true;;
*)
sharedcccompopts="-KPIC"
byteccrpath="-R"
mksharedlibrpath="-R"
mksharedlib="/usr/ccs/bin/ld -G"
shared_libraries_supported=true;;
esac;;
mips*-*-irix[56]*)
case "$bytecc" in
cc*) sharedcccompopts="";;
*gcc*) sharedcccompopts="-fPIC";;
esac
mksharedlib="ld -shared -rdata_shared"
byteccrpath="-Wl,-rpath,"
mksharedlibrpath="-rpath "
shared_libraries_supported=true;;
i[3456]86-*-darwin[89].*)
mksharedlib="$bytecc -bundle -flat_namespace -undefined suppress -read_only_relocs suppress"
bytecccompopts="$dl_defs $bytecccompopts"
dl_needs_underscore=false
shared_libraries_supported=true;;
*-apple-darwin*)
mksharedlib="$bytecc -bundle -flat_namespace -undefined suppress -Wl,-no_compact_unwind"
bytecccompopts="$dl_defs $bytecccompopts"
dl_needs_underscore=false
shared_libraries_supported=true;;
m88k-*-openbsd*)
shared_libraries_supported=false;;
vax-*-openbsd*)
shared_libraries_supported=false;;
*-*-openbsd*)
sharedcccompopts="-fPIC"
mksharedlib="$bytecc -shared"
bytecclinkopts="$bytecclinkopts -Wl,-E"
natdynlinkopts="-Wl,-E"
byteccrpath="-Wl,-rpath,"
mksharedlibrpath="-Wl,-rpath,"
shared_libraries_supported=true;;
esac
fi
if test -z "$mkmaindll"; then
mkmaindll=$mksharedlib
fi
# Configure native dynlink
natdynlink=false
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
if test $with_sharedlibs = "yes"; then
case "$target" in
*-*-cygwin*) natdynlink=true;;
*-*-mingw*) natdynlink=true;;
i[3456]86-*-linux*) natdynlink=true;;
i[3456]86-*-gnu*) natdynlink=true;;
x86_64-*-linux*) natdynlink=true;;
i[3456]86-*-darwin[89].*) natdynlink=true;;
i[3456]86-*-darwin*)
if test $arch64 == true; then
natdynlink=true
fi;;
x86_64-*-darwin*) natdynlink=true;;
powerpc*-*-linux*) natdynlink=true;;
sparc*-*-linux*) natdynlink=true;;
i686-*-kfreebsd*) natdynlink=true;;
x86_64-*-kfreebsd*) natdynlink=true;;
i[345]86-*-freebsd*) natdynlink=true;;
x86_64-*-freebsd*) natdynlink=true;;
i[345]86-*-openbsd*) natdynlink=true;;
x86_64-*-openbsd*) natdynlink=true;;
i[345]86-*-netbsd*) natdynlink=true;;
x86_64-*-netbsd*) natdynlink=true;;
i386-*-gnu0.3) natdynlink=true;;
arm*-*-linux*) natdynlink=true;;
aarch64-*-linux*) natdynlink=true;;
esac
fi
if test $natdynlink = "true"; then
cmxs="cmxs"
else
cmxs="cmxa"
fi
# Configure the native-code compiler
arch=none
model=default
system=unknown
case "$target" in
sparc*-*-solaris2.*) arch=sparc; system=solaris;;
sparc*-*-*bsd*) arch=sparc; system=bsd;;
sparc*-*-linux*) arch=sparc; system=linux;;
sparc*-*-gnu*) arch=sparc; system=gnu;;
i[3456]86-*-linux*) arch=i386; system=linux_`sh ./runtest elf.c`;;
i[3456]86-*-*bsd*) arch=i386; system=bsd_`sh ./runtest elf.c`;;
i[3456]86-*-nextstep*) arch=i386; system=nextstep;;
i[3456]86-*-solaris*) if $arch64; then
arch=amd64; system=solaris
else
arch=i386; system=solaris
fi;;
i[3456]86-*-beos*) arch=i386; system=beos;;
i[3456]86-*-cygwin*) arch=i386; system=cygwin;;
i[3456]86-*-darwin*) if $arch64; then
arch=amd64; system=macosx
else
arch=i386; system=macosx
fi;;
i[3456]86-*-gnu*) arch=i386; system=gnu;;
i[3456]86-*-mingw*) arch=i386; system=mingw;;
powerpc*-*-linux*) arch=power; model=ppc; system=elf;;
powerpc-*-netbsd*) arch=power; model=ppc; system=elf;;
powerpc-*-openbsd*) arch=power; model=ppc; system=bsd_elf;;
powerpc-*-rhapsody*) arch=power; model=ppc; system=rhapsody;;
powerpc-*-darwin*) arch=power; system=rhapsody
if $arch64;then model=ppc64;else model=ppc;fi;;
armv6*-*-linux-gnueabihf) arch=arm; model=armv6; system=linux_eabihf;;
arm*-*-linux-gnueabihf) arch=arm; system=linux_eabihf;;
armv7*-*-linux-gnueabi) arch=arm; model=armv7; system=linux_eabi;;
armv6t2*-*-linux-gnueabi) arch=arm; model=armv6t2; system=linux_eabi;;
armv6*-*-linux-gnueabi) arch=arm; model=armv6; system=linux_eabi;;
armv5te*-*-linux-gnueabi) arch=arm; model=armv5te; system=linux_eabi;;
armv5*-*-linux-gnueabi) arch=arm; model=armv5; system=linux_eabi;;
arm*-*-linux-gnueabi) arch=arm; system=linux_eabi;;
x86_64-*-linux*) arch=amd64; system=linux;;
x86_64-*-gnu*) arch=amd64; system=gnu;;
x86_64-*-freebsd*) arch=amd64; system=freebsd;;
x86_64-*-netbsd*) arch=amd64; system=netbsd;;
x86_64-*-openbsd*) arch=amd64; system=openbsd;;
x86_64-*-darwin*) arch=amd64; system=macosx;;
x86_64-*-mingw*) arch=amd64; system=mingw;;
aarch64-*-linux*) arch=arm64; system=linux;;
esac
# Some platforms exist both in 32-bit and 64-bit variants, not distinguished
# by $target. Turn off native code compilation on platforms where 64-bit mode
# is not supported. (PR#4441)
if $arch64; then
case "$arch,$model" in
sparc,default|power,ppc)
arch=none; model=default; system=unknown;;
esac
fi
if test -z "$ccoption"; then
nativecc="$bytecc"
else
nativecc="$ccoption"
fi
nativecccompopts=''
nativecclinkopts=''
# FIXME the naming of nativecclinkopts is broken: these are options for
# ld (for shared libs), not for cc
nativeccrpath="$byteccrpath"
case "$arch,$nativecc,$system,$target" in
*,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix"
nativecclinkopts="-posix";;
*,*,rhapsody,*darwin[1-5].*)
nativecccompopts="$gcc_warnings -DSHRINKED_GNUC";;
*,*,rhapsody,*) nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6 $dl_defs"
if $arch64; then partialld="ld -r -arch ppc64"; fi;;
*,gcc*,cygwin,*) nativecccompopts="$gcc_warnings -U_WIN32";;
amd64,gcc*,macosx,*) partialld="ld -r -arch x86_64";;
amd64,gcc*,solaris,*) partialld="ld -r -m elf_x86_64";;
*,gcc*,*,*) nativecccompopts="$gcc_warnings";;
esac
asppprofflags='-DPROFILING'
case "$arch,$system" in
amd64,macosx) if ./searchpath clang; then
as='clang -arch x86_64 -c'
aspp='clang -arch x86_64 -c'
else
as="${TOOLPREF}as -arch x86_64"
aspp="${TOOLPREF}gcc -arch x86_64 -c"
fi;;
amd64,solaris) as="${TOOLPREF}as --64"
aspp="${TOOLPREF}gcc -m64 -c";;
i386,solaris) as="${TOOLPREF}as"
aspp="/usr/ccs/bin/${TOOLPREF}as -P";;
power,elf) as="${TOOLPREF}as -u -m ppc"
aspp="${TOOLPREF}gcc -c";;
power,rhapsody) as="${TOOLPREF}as -arch $model"
aspp="$bytecc -c";;
sparc,solaris) as="${TOOLPREF}as"
case "$cc" in
*gcc*) aspp="${TOOLPREF}gcc -c";;
*) aspp="${TOOLPREF}as -P";;
esac;;
amd64,*|arm,*|arm64,*|i386,*|power,bsd*|sparc,*)
as="${TOOLPREF}as"
aspp="${TOOLPREF}gcc -c";;
esac
if test -n "$asoption"; then as="$asoption"; fi
if test -n "$asppoption"; then aspp="$asppoption"; fi
cc_profile='-pg'
case "$arch,$system" in
i386,linux_elf) profiling='prof';;
i386,gnu) profiling='prof';;
i386,bsd_elf) profiling='prof';;
amd64,macosx) profiling='prof';;
i386,macosx) profiling='prof';;
sparc,solaris)
profiling='prof'
case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
amd64,linux) profiling='prof';;
amd64,gnu) profiling='prof';;
arm,linux*) profiling='prof';;
*) profiling='noprof';;
esac
# Where is ranlib?
if sh ./searchpath ${TOOLPREF}ranlib; then
inf "ranlib found"
echo "RANLIB=${TOOLPREF}ranlib" >> Makefile
echo "RANLIBCMD=${TOOLPREF}ranlib" >> Makefile
else
inf "ranlib not used"
echo "RANLIB=${TOOLPREF}ar rs" >> Makefile
echo "RANLIBCMD=" >> Makefile
fi
echo "ARCMD=${TOOLPREF}ar" >> Makefile
# Write the OS type (Unix or Cygwin)
echo "#define OCAML_OS_TYPE \"$ostype\"" >> s.h
echo "#define OCAML_STDLIB_DIR \"$libdir\"" >> s.h
# Do #! scripts work?
if (SHELL=/bin/sh; export SHELL; (./sharpbang || ./sharpbang2) >/dev/null); then
inf "#! appears to work in shell scripts."
case "$target" in
*-*-sunos*|*-*-unicos*)
wrn "We won't use it, though, because under SunOS and Unicos it breaks " \
"on pathnames longer than 30 characters"
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
*-*-cygwin*)
wrn "We won't use it, though, because of conflicts with .exe extension " \
"under Cygwin"
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
*-*-mingw*)
inf "We won't use it, though, because it's on the target platform it would be used and windows doesn't support it."
echo "SHARPBANGSCRIPTS=false" >> Makefile;;
*)
echo "SHARPBANGSCRIPTS=true" >> Makefile;;
esac
else
inf "No support for #! in shell scripts"
echo "SHARPBANGSCRIPTS=false" >> Makefile
fi
# Use 64-bit file offset if possible
bytecccompopts="$bytecccompopts -D_FILE_OFFSET_BITS=64"
nativecccompopts="$nativecccompopts -D_FILE_OFFSET_BITS=64"
# Check the semantics of signal handlers
if sh ./hasgot sigaction sigprocmask; then
inf "POSIX signal handling found."
echo "#define POSIX_SIGNALS" >> s.h
else
if sh ./runtest signals.c; then
inf "Signals have the BSD semantics."
echo "#define BSD_SIGNALS" >> s.h
else
inf "Signals have the System V semantics."
fi
if sh ./hasgot sigsetmask; then
inf "sigsetmask() found"
echo "#define HAS_SIGSETMASK" >> s.h
fi
fi
# For the Pervasives module
if sh ./hasgot2 -i math.h $mathlib expm1 log1p hypot copysign; then
inf "expm1(), log1p(), hypot(), copysign() found."
echo "#define HAS_C99_FLOAT_OPS" >> s.h
fi
# For the Sys module
if sh ./hasgot getrusage; then
inf "getrusage() found."
echo "#define HAS_GETRUSAGE" >> s.h
fi
if sh ./hasgot times; then
inf "times() found."
echo "#define HAS_TIMES" >> s.h
fi
# For the terminfo module
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
if test "$with_curses" = "yes"; then
for libs in "" "-lcurses" "-ltermcap" "-lcurses -ltermcap" "-lncurses"; do
if sh ./hasgot $libs tgetent tgetstr tgetnum tputs; then
inf "termcap functions found (with libraries '$libs')"
echo "#define HAS_TERMCAP" >> s.h
curseslibs="${libs}"
break
fi
done
fi
# Configuration for the libraries
case "$system" in
mingw) unix_or_win32="win32"; unixlib="win32unix"; graphlib="win32graph";;
*) unix_or_win32="unix"; unixlib="unix"; graphlib="graph";;
esac
echo "UNIX_OR_WIN32=$unix_or_win32" >> Makefile
echo "UNIXLIB=$unixlib" >> Makefile
echo "GRAPHLIB=$graphlib" >> Makefile
otherlibraries="$unixlib str num dynlink bigarray"
# For the Unix library
has_sockets=no
if sh ./hasgot socket socketpair bind listen accept connect; then
inf "You have BSD sockets."
echo "#define HAS_SOCKETS" >> s.h
has_sockets=yes
elif sh ./hasgot -lnsl -lsocket socket socketpair bind listen accept connect; then
inf "You have BSD sockets (with libraries '-lnsl -lsocket')"
cclibs="$cclibs -lnsl -lsocket"
echo "#define HAS_SOCKETS" >> s.h
has_sockets=yes
else
case "$target" in
*-*-mingw*)
inf "You have BSD sockets (with libraries '-lws2_32')"
cclibs="$cclibs -lws2_32"
echo "#define HAS_SOCKETS" >> s.h
has_sockets=yes ;;
*) ;;
esac
fi
if sh ./hasgot -i sys/socket.h -t socklen_t; then
inf "socklen_t is defined in <sys/socket.h>"
echo "#define HAS_SOCKLEN_T" >> s.h
fi
if sh ./hasgot inet_aton; then
inf "inet_aton() found."
echo "#define HAS_INET_ATON" >> s.h
fi
if sh ./hasgot -i sys/types.h -i sys/socket.h -i netinet/in.h \
-t 'struct sockaddr_in6' \
&& sh ./hasgot getaddrinfo getnameinfo inet_pton inet_ntop; then
inf "IPv6 is supported."
echo "#define HAS_IPV6" >> s.h
fi
if sh ./hasgot -i unistd.h; then
inf "unistd.h found."
echo "#define HAS_UNISTD" >> s.h
fi
if sh ./hasgot -i sys/types.h -t off_t; then
inf "off_t is defined in <sys/types.h>"
echo "#define HAS_OFF_T" >> s.h
fi
if sh ./hasgot -i sys/types.h -i dirent.h; then
inf "dirent.h found."
echo "#define HAS_DIRENT" >> s.h
fi
if sh ./hasgot rewinddir; then
inf "rewinddir() found."
echo "#define HAS_REWINDDIR" >> s.h
fi
if sh ./hasgot lockf; then
inf "lockf() found."
echo "#define HAS_LOCKF" >> s.h
fi
if sh ./hasgot mkfifo; then
inf "mkfifo() found."
echo "#define HAS_MKFIFO" >> s.h
fi
if sh ./hasgot getcwd; then
inf "getcwd() found."
echo "#define HAS_GETCWD" >> s.h
fi
if sh ./hasgot getwd; then
inf "getwd() found."
echo "#define HAS_GETWD" >> s.h
fi
if sh ./hasgot getpriority setpriority; then
inf "getpriority() found."
echo "#define HAS_GETPRIORITY" >> s.h
fi
if sh ./hasgot -i sys/types.h -i utime.h && sh ./hasgot utime; then
inf "utime() found."
echo "#define HAS_UTIME" >> s.h
fi
if sh ./hasgot utimes; then
inf "utimes() found."
echo "#define HAS_UTIMES" >> s.h
fi
if sh ./hasgot dup2; then
inf "dup2() found."
echo "#define HAS_DUP2" >> s.h
fi
if sh ./hasgot fchmod fchown; then
inf "fchmod() found."
echo "#define HAS_FCHMOD" >> s.h
fi
if sh ./hasgot truncate ftruncate; then
inf "truncate() found."
echo "#define HAS_TRUNCATE" >> s.h
fi
select_include=''
if sh ./hasgot -i sys/types.h -i sys/select.h; then
inf "sys/select.h found."
echo "#define HAS_SYS_SELECT_H" >> s.h
select_include='-i sys/select.h'
fi
has_select=no
if sh ./hasgot select && \
sh ./hasgot -i sys/types.h $select_include -t fd_set ; then
inf "select() found."
echo "#define HAS_SELECT" >> s.h
has_select=yes
fi
if sh ./hasgot symlink readlink lstat; then
inf "symlink() found."
echo "#define HAS_SYMLINK" >> s.h
fi
has_wait=no
if sh ./hasgot waitpid; then
inf "waitpid() found."
echo "#define HAS_WAITPID" >> s.h
has_wait=yes
fi
if sh ./hasgot wait4; then
inf "wait4() found."
echo "#define HAS_WAIT4" >> s.h
has_wait=yes
fi
if sh ./hasgot -i limits.h && sh ./runtest getgroups.c; then
inf "getgroups() found."
echo "#define HAS_GETGROUPS" >> s.h
fi
if sh ./hasgot -i limits.h -i grp.h && sh ./runtest setgroups.c; then
inf "setgroups() found."
echo "#define HAS_SETGROUPS" >> s.h
fi
if sh ./hasgot -i limits.h -i grp.h && sh ./runtest initgroups.c; then
inf "initgroups() found."
echo "#define HAS_INITGROUPS" >> s.h
fi
if sh ./hasgot -i termios.h &&
sh ./hasgot tcgetattr tcsetattr tcsendbreak tcflush tcflow; then
inf "POSIX termios found."
echo "#define HAS_TERMIOS" >> s.h
fi
if sh ./runtest async_io.c; then
inf "Asynchronous I/O are supported."
echo "#define HAS_ASYNC_IO" >> s.h
fi
has_setitimer=no
if sh ./hasgot setitimer; then
inf "setitimer() found."
echo "#define HAS_SETITIMER" >> s.h
has_setitimer="yes"
fi
if sh ./hasgot gethostname; then
inf "gethostname() found."
echo "#define HAS_GETHOSTNAME" >> s.h
fi
if sh ./hasgot -i sys/utsname.h && sh ./hasgot uname; then
inf "uname() found."
echo "#define HAS_UNAME" >> s.h
fi
has_gettimeofday=no
if sh ./hasgot gettimeofday; then
inf "gettimeofday() found."
echo "#define HAS_GETTIMEOFDAY" >> s.h
has_gettimeofday="yes"
fi
if sh ./hasgot mktime; then
inf "mktime() found."
echo "#define HAS_MKTIME" >> s.h
fi
case "$target" in
*-*-cygwin*) ;; # setsid emulation under Cygwin breaks the debugger
*) if sh ./hasgot setsid; then
inf "setsid() found."
echo "#define HAS_SETSID" >> s.h
fi;;
esac
if sh ./hasgot putenv; then
inf "putenv() found."
echo "#define HAS_PUTENV" >> s.h
fi
if sh ./hasgot -i locale.h && sh ./hasgot setlocale; then
inf "setlocale() and <locale.h> found."
echo "#define HAS_LOCALE" >> s.h
fi
if sh ./hasgot $dllib dlopen; then
inf "dlopen() found."
elif sh ./hasgot $dllib -ldl dlopen; then
inf "dlopen() found in -ldl."
dllib="$dllib -ldl"
else
case "$target" in
*-*-mingw*) ;;
*) shared_libraries_supported=false
esac
fi
if $shared_libraries_supported; then
inf "Dynamic loading of shared libraries is supported."
echo "#define SUPPORT_DYNAMIC_LINKING" >> s.h
if $dl_needs_underscore; then
echo '#define DL_NEEDS_UNDERSCORE' >>s.h
fi
fi
if sh ./hasgot -i sys/types.h -i sys/mman.h && sh ./hasgot mmap munmap; then
inf "mmap() found."
echo "#define HAS_MMAP" >> s.h
fi
if sh ./hasgot pwrite; then
inf "pwrite() found"
echo "#define HAS_PWRITE" >> s.h
fi
nargs=none
for i in 5 6; do
if sh ./trycompile -DNUM_ARGS=${i} gethostbyname.c; then nargs=$i; break; fi
done
if test $nargs != "none"; then
inf "gethostbyname_r() found (with ${nargs} arguments)."
echo "#define HAS_GETHOSTBYNAME_R $nargs" >> s.h
fi
nargs=none
for i in 7 8; do
if sh ./trycompile -DNUM_ARGS=${i} gethostbyaddr.c; then nargs=$i; break; fi
done
if test $nargs != "none"; then
inf "gethostbyaddr_r() found (with ${nargs} arguments)."
echo "#define HAS_GETHOSTBYADDR_R $nargs" >> s.h
fi
# Determine if the debugger is supported
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
if test -n "$with_debugger"; then
if test "$has_sockets" = "yes"; then
inf "Replay debugger supported."
with_debugger="ocamldebugger"
else
inf "No replay debugger (missing system calls)"
with_debugger=""
fi
fi
# Determine if system stack overflows can be detected
case "$arch,$system" in
i386,linux_elf|amd64,linux|power,rhapsody|amd64,macosx|i386,macosx)
inf "System stack overflow can be detected."
echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;;
*)
inf "Cannot detect system stack overflow.";;
esac
# Determine the target architecture for the "num" library
case "$arch" in
i386) bng_arch=ia32
if sh ./trycompile ia32sse2.c
then bng_asm_level=2
else bng_asm_level=1
fi;;
power) bng_arch=ppc; bng_asm_level=1;;
amd64) bng_arch=amd64; bng_asm_level=1;;
arm64) bng_arch=arm64; bng_asm_level=1;;
*) bng_arch=generic; bng_asm_level=0;;
esac
echo "BNG_ARCH=$bng_arch" >> Makefile
echo "BNG_ASM_LEVEL=$bng_asm_level" >> Makefile
# Determine if the POSIX threads library is supported
systhread_support=false
if test "$pthread_wanted" = "yes"; then
case "$target" in
*-*-solaris*) pthread_link="-lpthread -lposix4"
pthread_caml_link="-cclib -lpthread -cclib -lposix4";;
*-*-freebsd*) pthread_link="-pthread"
pthread_caml_link="-cclib -pthread";;
*-*-openbsd*) pthread_link="-pthread"
pthread_caml_link="-cclib -pthread";;
*) pthread_link="-lpthread"
pthread_caml_link="-cclib -lpthread";;
esac
if ./hasgot -i pthread.h $pthread_link pthread_self; then
inf "POSIX threads library supported."
systhread_support=true
otherlibraries="$otherlibraries systhreads"
bytecccompopts="$bytecccompopts -D_REENTRANT"
nativecccompopts="$nativecccompopts -D_REENTRANT"
case "$target" in
*-*-freebsd*)
bytecccompopts="$bytecccompopts -D_THREAD_SAFE"
nativecccompopts="$nativecccompopts -D_THREAD_SAFE";;
*-*-openbsd*)
bytecccompopts="$bytecccompopts -pthread"
asppflags="$asppflags -pthread"
nativecccompopts="$nativecccompopts -pthread";;
esac
inf "Options for linking with POSIX threads: $pthread_link"
if sh ./hasgot $pthread_link sigwait; then
inf "sigwait() found"
echo "#define HAS_SIGWAIT" >> s.h
fi
else
inf "POSIX threads not found."
pthread_link=""
fi
else
pthread_link=""
fi
echo "PTHREAD_LINK=$pthread_caml_link" >> Makefile
# Determine if the bytecode thread library is supported
if test "$has_select" = "yes" \
&& test "$has_setitimer" = "yes" \
&& test "$has_gettimeofday" = "yes" \
&& test "$has_wait" = "yes"; then
inf "Bytecode threads library supported."
otherlibraries="$otherlibraries threads"
else
inf "Bytecode threads library not supported (missing system calls)"
fi
# Determine the location of X include files and libraries
# If the user specified -x11include and/or -x11lib, these settings
# are used. Otherwise, we check whether there is pkg-config, and take
# the flags from there. Otherwise, we search the location.
x11_include="not found"
x11_link="not found"
if test -z "$x11_include_dir" -a -z "$x11_lib_dir"; then
if pkg-config --exists x11 2>/dev/null; then
x11_include=`pkg-config --cflags x11`
x11_link=`pkg-config --libs x11`
fi
fi
if test "$x11_include" = "not found"; then
for dir in \
$x11_include_dir \
\
/usr/X11R7/include \
/usr/include/X11R7 \
/usr/local/X11R7/include \
/usr/local/include/X11R7 \
/opt/X11R7/include \
\
/usr/X11R6/include \
/usr/include/X11R6 \
/usr/local/X11R6/include \
/usr/local/include/X11R6 \
/opt/X11R6/include \
\
/usr/X11/include \
/usr/include/X11 \
/usr/local/X11/include \
/usr/local/include/X11 \
/opt/X11/include \
\
/usr/X11R5/include \
/usr/include/X11R5 \
/usr/local/X11R5/include \
/usr/local/include/X11R5 \
/usr/local/x11r5/include \
/opt/X11R5/include \
\
/usr/X11R4/include \
/usr/include/X11R4 \
/usr/local/X11R4/include \
/usr/local/include/X11R4 \
\
/usr/X386/include \
/usr/x386/include \
/usr/XFree86/include/X11 \
\
/usr/include \
/usr/local/include \
/usr/unsupported/include \
/usr/athena/include \
/usr/lpp/Xamples/include \
\
/usr/openwin/include \
/usr/openwin/share/include \
; \
do
if test -f $dir/X11/X.h; then
x11_include_dir=$dir
x11_include="-I$dir"
break
fi
done
if test "$x11_include" = "not found"; then
x11_try_lib_dir=''
else
x11_try_lib_dir=`echo $x11_include_dir | sed -e 's|include|lib|'`
fi
for dir in \
$x11_lib_dir \
$x11_try_lib_dir \
\
/usr/X11R6/lib64 \
/usr/X11R6/lib \
/usr/lib/X11R6 \
/usr/local/X11R6/lib \
/usr/local/lib/X11R6 \
/opt/X11R6/lib \
\
/usr/X11/lib \
/usr/lib/X11 \
/usr/local/X11/lib \
/usr/local/lib/X11 \
/opt/X11/lib \
\
/usr/X11R5/lib \
/usr/lib/X11R5 \
/usr/local/X11R5/lib \
/usr/local/lib/X11R5 \
/usr/local/x11r5/lib \
/opt/X11R5/lib \
\
/usr/X11R4/lib \
/usr/lib/X11R4 \
/usr/local/X11R4/lib \
/usr/local/lib/X11R4 \
\
/usr/X386/lib \
/usr/x386/lib \
/usr/XFree86/lib/X11 \
\
/usr/lib64 \
/usr/lib \
/usr/local/lib \
/usr/unsupported/lib \
/usr/athena/lib \
/usr/lpp/Xamples/lib \
/lib/usr/lib/X11 \
\
/usr/openwin/lib \
/usr/openwin/share/lib \
\
/usr/lib/i386-linux-gnu \
/usr/lib/x86_64-linux-gnu \
; \
do
if test -f $dir/libX11.a || \
test -f $dir/libX11.so || \
test -f $dir/libX11.dll.a || \
test -f $dir/libX11.dylib || \
test -f $dir/libX11.sa; then
if test $dir = /usr/lib; then
x11_link="-lX11"
else
x11_libs="-L$dir"
case "$target" in
*-kfreebsd*-gnu) x11_link="-L$dir -lX11";;
*-*-*bsd*) x11_link="-R$dir -L$dir -lX11";;
*) x11_link="-L$dir -lX11";;
esac
fi
break
fi
done
fi
if test "x11_include" != "not found"; then
if test "$x11_include" = "-I/usr/include"; then
x11_include=""
fi
if ./hasgot $x11_include $x11_link -i X11/Xlib.h XrmInitialize; then
inf "X11 works"
else
wrn "Cannot compile X11 program."
x11_include="not found"
fi
fi
has_graph=false
if test "$x11_include" = "not found" || test "$x11_link" = "not found"
then
wrn 'X11 not found, the "graph" library will not be supported.'
x11_include="not found"
x11_link="not found"
else
inf "Options for compiling for X11: $x11_include"
inf "Options for linking with X11: $x11_link"
if test "$graph_wanted" = yes
then
has_graph=true
otherlibraries="$otherlibraries graph"
fi
fi
echo "X11_INCLUDES=$x11_include" >> Makefile
echo "X11_LINK=$x11_link" >> Makefile
# Look for BFD library
if ./hasgot -i bfd.h && \
./hasgot -lbfd -ldl -liberty -lz bfd_openr; then
inf "BFD library found."
echo "#define HAS_LIBBFD" >> s.h
echo "LIBBFD_LINK=-lbfd -ldl -liberty -lz" >> Makefile
else
wrn "BFD library not found, 'objinfo' will be unable to display info on .cmxs files."
echo "LIBBFD_LINK=" >> Makefile
fi
# Check whether assembler supports CFI directives
asm_cfi_supported=false
export as aspp
if ! $with_cfi; then
echo "CFI support: disabled by command-line option -no-cfi"
elif sh ./tryassemble cfi.S; then
echo "#define ASM_CFI_SUPPORTED" >> m.h
asm_cfi_supported=true
inf "Assembler supports CFI"
else
inf "Assembler does not support CFI"
fi
if test "$with_frame_pointers" = "true"; then
case "$target,$cc" in
x86_64-*-linux*,gcc*)
nativecccompopts="$nativecccompopts -g -fno-omit-frame-pointer"
bytecccompopts="$bytecccompopts -g -fno-omit-frame-pointer"
nativecclinkopts="$nativecclinkopts -g"
echo "#define WITH_FRAME_POINTERS" >> m.h
;;
*) err "Unsupported architecture with frame pointers";;
esac
fi
# Final twiddling of compiler options to work around known bugs
nativeccprofopts="$nativecccompopts"
case "$buggycc" in
gcc.2.96)
bytecccompopts="$bytecccompopts -fomit-frame-pointer"
nativecccompopts="$nativecccompopts -fomit-frame-pointer";;
esac
# Finish generated files
cclibs="$cclibs $mathlib"
echo "BYTECC=$bytecc" >> Makefile
echo "BYTECCCOMPOPTS=$bytecccompopts" >> Makefile
echo "BYTECCLINKOPTS=$bytecclinkopts" >> Makefile
echo "BYTECCLIBS=$cclibs $dllib $curseslibs $pthread_link" >> Makefile
echo "BYTECCRPATH=$byteccrpath" >> Makefile
echo "EXE=$exe" >> Makefile
echo "SUPPORTS_SHARED_LIBRARIES=$shared_libraries_supported" >> Makefile
echo "SHAREDCCCOMPOPTS=$sharedcccompopts" >> Makefile
echo "MKSHAREDLIBRPATH=$mksharedlibrpath" >> Makefile
echo "NATDYNLINKOPTS=$natdynlinkopts" >> Makefile
cat >> Makefile <<EOF
SYSLIB=-l\$(1)
#ml let syslib x = "-l"^x;;
### How to build a static library
MKLIB=ar rc \$(1) \$(2); ranlib \$(1)
#ml let mklib out files opts = Printf.sprintf "ar rc %s %s %s; ranlib %s" out opts files out;;
EOF
echo "ARCH=$arch" >> Makefile
echo "MODEL=$model" >> Makefile
echo "SYSTEM=$system" >> Makefile
echo "NATIVECC=$nativecc" >> Makefile
echo "NATIVECCCOMPOPTS=$nativecccompopts" >> Makefile
echo "NATIVECCPROFOPTS=$nativeccprofopts" >> Makefile
echo "NATIVECCLINKOPTS=$nativecclinkopts" >> Makefile
echo "NATIVECCRPATH=$nativeccrpath" >> Makefile
echo "NATIVECCLIBS=$cclibs $dllib" >> Makefile
echo "ASM=$as" >> Makefile
echo "ASPP=$aspp" >> Makefile
echo "ASPPPROFFLAGS=$asppprofflags" >> Makefile
echo "PROFILING=$profiling" >> Makefile
echo "DYNLINKOPTS=$dllib" >> Makefile
echo "OTHERLIBRARIES=$otherlibraries" >> Makefile
echo "CC_PROFILE=$cc_profile" >> Makefile
echo "SYSTHREAD_SUPPORT=$systhread_support" >> Makefile
echo "PARTIALLD=$partialld" >> Makefile
echo "PACKLD=\$(PARTIALLD) \$(NATIVECCLINKOPTS) -o " \
| sed -e 's/ $/\\ /' >> Makefile
echo "DLLCCCOMPOPTS=$dllccompopts" >> Makefile
echo "IFLEXDIR=$iflexdir" >> Makefile
echo "O=o" >> Makefile
echo "A=a" >> Makefile
echo "SO=$SO" >> Makefile
echo "EXT_OBJ=.o" >> Makefile
echo "EXT_ASM=.s" >> Makefile
echo "EXT_LIB=.a" >> Makefile
echo "EXT_DLL=$SO" >> Makefile
echo "EXTRALIBS=" >> Makefile
echo "CCOMPTYPE=cc" >> Makefile
echo "TOOLCHAIN=$TOOLCHAIN" >> Makefile
echo "NATDYNLINK=$natdynlink" >> Makefile
echo "CMXS=$cmxs" >> Makefile
echo "MKEXE=$mkexe" >> Makefile
echo "MKEXEDEBUGFLAG=$mkexedebugflag" >> Makefile
echo "MKDLL=$mksharedlib" >> Makefile
echo "MKMAINDLL=$mkmaindll" >> Makefile
echo "RUNTIMED=${debugruntime}" >>Makefile
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
echo "WITH_CAMLP4=${with_camlp4}" >>Makefile
echo "WITH_DEBUGGER=${with_debugger}" >>Makefile
echo "WITH_OCAMLDOC=${with_ocamldoc}" >>Makefile
echo "WITH_OCAMLBUILD=${with_ocamlbuild}" >>Makefile
echo "ASM_CFI_SUPPORTED=$asm_cfi_supported" >> Makefile
echo "WITH_FRAME_POINTERS=$with_frame_pointers" >> Makefile
echo "TARGET=$target" >> Makefile
echo "HOST=$host" >> Makefile
if [ "$ostype" = Cygwin ]; then
echo "DIFF=diff -q --strip-trailing-cr" >>Makefile
fi
cat >> Makefile << EOF
ROOTDIR=$rootdir
CAMLRUN=${camlrun}\$(EXE)
OCAMLRUN=\$(CAMLRUN)
CAMLC_BIN_BOOT = \$(CAMLRUN) \$(ROOTDIR)/boot/ocamlc
CAMLC_BIN_BYTE = \$(CAMLRUN) \$(ROOTDIR)/ocamlc
CAMLC_BIN_OPT = \$(ROOTDIR)/ocamlc.opt
CAMLOPT_BIN_BYTE = \$(CAMLRUN) \$(ROOTDIR)/ocamlopt
CAMLOPT_BIN_OPT = \$(ROOTDIR)/ocamlopt.opt
CAMLC_BIN = @ . \$(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; \$\${CAMLC_BIN}
CAMLOPT_BIN = @ . \$(ROOTDIR)/config/ocamlcomp; PS4=""; set -x; \$\${CAMLOPT_BIN}
CAMLC_BIN_CMD_TO_EVAL = . \$(ROOTDIR)/config/ocamlcomp; echo \$\${CAMLC_BIN}
CAMLOPT_BIN_CMD_TO_EVAL = . \$(ROOTDIR)/config/ocamlcomp; echo \$\${CAMLOPT_BIN}
EOF
rm -f tst hasgot.c
rm -f ../m.h ../s.h ../Makefile
mv m.h s.h Makefile ..
rm -f ../ocamlcomp
cd .. && make -f Makefile.switch-compiler disable COMPILER="CAMLC" VARIANT="BYTE"
# Print a summary
inf
inf "** Configuration summary **"
inf
inf "Directories where OCaml will be installed:"
inf " binaries.................. $bindir"
inf " standard library.......... $libdir"
inf " manual pages.............. $mandir (with extension .$manext)"
inf "Configuration for the bytecode compiler:"
inf " C compiler used........... $bytecc"
inf " options for compiling..... $bytecccompopts"
inf " options for linking....... $bytecclinkopts $cclibs $dllib $curseslibs $pthread_link"
if $shared_libraries_supported; then
inf " shared libraries are supported"
inf " options for compiling..... $sharedcccompopts $bytecccompopts"
inf " command for building...... $mksharedlib -o lib.so $mksharedlibrpath/a/path objs"
else
inf " shared libraries not supported"
fi
inf "Configuration for the native-code compiler:"
if test "$arch" = "none"; then
inf " (not supported on this platform)"
else
if test "$model" = "default"; then
inf " hardware architecture..... $arch"
else
inf " hardware architecture..... $arch ($model)"
fi
if test "$system" = "unknown"; then : ; else
inf " OS variant................ $system"
fi
inf " C compiler used........... $nativecc"
inf " options for compiling..... $nativecccompopts"
inf " options for linking....... $nativecclinkopts $cclibs"
inf " assembler ................ $as"
inf " preprocessed assembler ... $aspp"
if test "$asm_cfi_supported" = "true"; then
inf " assembler supports CFI ... yes"
else
inf " assembler supports CFI ... no"
fi
if test "$with_frame_pointers" = "true"; then
inf " with frame pointers....... yes"
else
inf " with frame pointers....... no"
fi
echo " native dynlink ........... $natdynlink"
inf " native dynlink ........... $natdynlink"
if test "$profiling" = "prof"; then
inf " profiling with gprof ..... supported"
else
inf " profiling with gprof ..... not supported"
fi
fi
build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. (Patch by Adrien Nader!) This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. build: prepend "with_" to camlp4/ocamldebug-{en,dis}abling variables. This makes the variable names more coherent and is in preparation for another patch that will allow disabling ocamldoc and ocamlbuild. This changes the interface of the configuration somewhat but I don't think anything outside of the ocaml tree reads the Makefile.config file that gets installed in order to see whether the debugger and camlp4 have been built. It also changes a .mli which might be problematic but I also believe it is safe and we have time to see if there's a bad impact. It also adds a configure switch to skip building ocamldebug. While at it, it fixes a PR number in the Changes file. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13942 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-28 08:52:14 -07:00
if test "$with_debugger" = "ocamldebugger"; then
inf "Source-level replay debugger: supported"
else
inf "Source-level replay debugger: not supported"
fi
if test "$debugruntime" = "runtimed"; then
inf "Debug runtime will be compiled and installed"
fi
inf "Additional libraries supported:"
inf " $otherlibraries"
inf "Configuration for the \"num\" library:"
inf " target architecture ...... $bng_arch (asm level $bng_asm_level)"
if $has_graph; then
inf "Configuration for the \"graph\" library:"
inf " options for compiling .... $x11_include"
inf " options for linking ...... $x11_link"
else
inf "The \"graph\" library: not supported"
fi
inf
inf "** OCaml configuration completed successfully **"
inf
if test ! -z "$MACOSX_DEPLOYMENT_TARGET"; then
wrn "The environment variable MACOSX_DEPLOYMENT_TARGET is set.\n" \
"This will probably prevent compiling the OCaml system."
fi