1996-02-13 08:29:09 -08:00
|
|
|
#! /bin/sh
|
|
|
|
|
2016-02-18 07:11:59 -08:00
|
|
|
#**************************************************************************
|
|
|
|
#* *
|
|
|
|
#* 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 Lesser General Public License version 2.1, with the *
|
|
|
|
#* special exception on linking described in the file LICENSE. *
|
|
|
|
#* *
|
|
|
|
#**************************************************************************
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2015-08-04 05:12:47 -07:00
|
|
|
ocamlversion=`head -1 VERSION`
|
|
|
|
echo "Configuring OCaml version $ocamlversion"
|
2015-03-04 11:56:45 -08:00
|
|
|
|
2001-07-14 09:54:17 -07:00
|
|
|
configure_options="$*"
|
1999-03-10 01:51:16 -08:00
|
|
|
prefix=/usr/local
|
|
|
|
bindir=''
|
2015-07-17 07:31:05 -07:00
|
|
|
target_bindir=''
|
1999-03-10 01:51:16 -08:00
|
|
|
libdir=''
|
|
|
|
mandir=''
|
1996-02-13 08:29:09 -08:00
|
|
|
manext=1
|
|
|
|
host_type=unknown
|
2013-06-30 04:41:40 -07:00
|
|
|
target_type=""
|
2000-12-12 02:26:02 -08:00
|
|
|
ccoption=''
|
2007-10-30 05:37:16 -07:00
|
|
|
asoption=''
|
|
|
|
asppoption=''
|
1996-02-13 08:29:09 -08:00
|
|
|
cclibs=''
|
2000-10-27 08:18:24 -07:00
|
|
|
curseslibs=''
|
1998-03-13 11:59:11 -08:00
|
|
|
mathlib='-lm'
|
2001-08-28 07:47:48 -07:00
|
|
|
dllib=''
|
1996-06-19 02:43:01 -07:00
|
|
|
x11_include_dir=''
|
|
|
|
x11_lib_dir=''
|
2016-07-29 07:07:10 -07:00
|
|
|
libunwind_include_dir=''
|
|
|
|
libunwind_lib_dir=''
|
|
|
|
libunwind_available=false
|
|
|
|
disable_libunwind=false
|
2012-02-07 04:43:34 -08:00
|
|
|
graph_wanted=yes
|
2003-09-12 00:36:15 -07:00
|
|
|
pthread_wanted=yes
|
2002-11-15 08:36:39 -08:00
|
|
|
dl_defs=''
|
2017-03-08 06:17:05 -08:00
|
|
|
verbose=false
|
2013-07-28 08:52:14 -07:00
|
|
|
with_curses=yes
|
2016-12-20 07:54:20 -08:00
|
|
|
debugruntime=false
|
2015-11-20 08:54:26 -08:00
|
|
|
with_instrumented_runtime=false
|
2013-07-28 08:52:14 -07:00
|
|
|
with_sharedlibs=yes
|
2006-08-18 07:52:19 -07:00
|
|
|
partialld="ld -r"
|
2013-07-28 08:52:14 -07:00
|
|
|
with_debugger=ocamldebugger
|
2013-07-28 08:52:17 -07:00
|
|
|
with_ocamldoc=ocamldoc
|
2013-06-03 11:03:59 -07:00
|
|
|
with_frame_pointers=false
|
2016-07-29 07:07:10 -07:00
|
|
|
with_spacetime=false
|
2016-08-02 09:52:07 -07:00
|
|
|
with_profinfo=false
|
|
|
|
profinfo_width=0
|
2014-05-12 00:29:24 -07:00
|
|
|
no_naked_pointers=false
|
2016-01-01 05:06:17 -08:00
|
|
|
native_compiler=true
|
2013-06-30 05:42:23 -07:00
|
|
|
TOOLPREF=""
|
2013-09-04 08:12:37 -07:00
|
|
|
with_cfi=true
|
2016-01-06 08:48:37 -08:00
|
|
|
flambda=false
|
2016-07-13 02:04:16 -07:00
|
|
|
safe_string=false
|
2016-12-06 08:18:04 -08:00
|
|
|
afl_instrument=false
|
2016-01-06 11:55:44 -08:00
|
|
|
max_testsuite_dir_retries=0
|
2016-07-06 07:37:56 -07:00
|
|
|
with_cplugins=true
|
|
|
|
with_fpic=false
|
1999-12-09 10:53:52 -08:00
|
|
|
|
2001-12-07 06:23:01 -08:00
|
|
|
# Try to turn internationalization off, can cause config.guess to malfunction!
|
|
|
|
unset LANG
|
2006-04-16 16:28:22 -07:00
|
|
|
unset LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME
|
2001-12-07 06:23:01 -08:00
|
|
|
|
2003-08-20 08:10:58 -07:00
|
|
|
# Turn off some MacOS X debugging stuff, same reason
|
|
|
|
unset RC_TRACE_ARCHIVES RC_TRACE_DYLIBS RC_TRACE_PREBINDING_DISABLED
|
|
|
|
|
2013-06-27 12:10:08 -07:00
|
|
|
# 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() {
|
2014-10-29 09:29:18 -07:00
|
|
|
printf "[ERROR!] %b\n" "$*" 1>&3
|
2013-06-27 12:10:08 -07:00
|
|
|
exit 2
|
|
|
|
}
|
|
|
|
|
|
|
|
exec 3>&1
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Parse command-line arguments
|
|
|
|
|
|
|
|
while : ; do
|
|
|
|
case "$1" in
|
|
|
|
"") break;;
|
1999-03-10 01:51:16 -08:00
|
|
|
-prefix|--prefix)
|
|
|
|
prefix=$2; shift;;
|
1997-10-24 08:49:12 -07:00
|
|
|
-bindir|--bindir)
|
|
|
|
bindir=$2; shift;;
|
2015-07-17 07:31:05 -07:00
|
|
|
-target-bindir|--target-bindir)
|
|
|
|
target_bindir="$2"; shift;;
|
1997-10-24 08:49:12 -07:00
|
|
|
-libdir|--libdir)
|
|
|
|
libdir=$2; shift;;
|
|
|
|
-mandir|--mandir)
|
2002-04-24 02:26:32 -07:00
|
|
|
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
|
1997-10-24 08:49:12 -07:00
|
|
|
shift;;
|
2016-07-29 07:07:10 -07:00
|
|
|
-libunwinddir|--libunwinddir)
|
|
|
|
libunwind_include_dir=$2/include;
|
|
|
|
libunwind_lib_dir=$2/lib;
|
|
|
|
shift;;
|
|
|
|
-libunwindlib|--libunwindlib)
|
|
|
|
libunwind_lib_dir=$2; shift;;
|
|
|
|
-libunwindinclude|--libunwindinclude)
|
|
|
|
libunwind_include_dir=$2; shift;;
|
|
|
|
-disable-libunwind|--disable-libunwind)
|
|
|
|
disable_libunwind=true;;
|
1997-10-24 08:49:12 -07:00
|
|
|
-host*|--host*)
|
|
|
|
host_type=$2; shift;;
|
2013-06-30 04:41:40 -07:00
|
|
|
-target*|--target*)
|
|
|
|
target_type=$2; shift;;
|
1997-10-24 08:49:12 -07:00
|
|
|
-cc*)
|
2000-12-12 02:26:02 -08:00
|
|
|
ccoption="$2"; shift;;
|
2007-10-30 05:37:16 -07:00
|
|
|
-as)
|
|
|
|
asoption="$2"; shift;;
|
|
|
|
-aspp)
|
|
|
|
asppoption="$2"; shift;;
|
1997-10-24 08:49:12 -07:00
|
|
|
-lib*)
|
2000-10-27 08:18:24 -07:00
|
|
|
cclibs="$2 $cclibs"; shift;;
|
2012-02-07 04:43:34 -08:00
|
|
|
-no-curses|--no-curses)
|
2013-07-28 08:52:14 -07:00
|
|
|
with_curses=no;;
|
2012-02-07 04:43:34 -08:00
|
|
|
-no-shared-libs|--no-shared-libs)
|
2013-07-28 08:52:14 -07:00
|
|
|
with_sharedlibs=no;;
|
1997-10-24 08:49:12 -07:00
|
|
|
-x11include*|--x11include*)
|
|
|
|
x11_include_dir=$2; shift;;
|
|
|
|
-x11lib*|--x11lib*)
|
|
|
|
x11_lib_dir=$2; shift;;
|
2012-02-07 04:43:34 -08:00
|
|
|
-no-graph|--no-graph) graph_wanted=no;;
|
1997-11-10 10:20:48 -08:00
|
|
|
-with-pthread*|--with-pthread*)
|
2003-07-17 01:38:28 -07:00
|
|
|
;; # Ignored for backward compatibility
|
2003-09-12 00:36:15 -07:00
|
|
|
-no-pthread*|--no-pthread*)
|
|
|
|
pthread_wanted=no;;
|
2010-01-20 08:26:46 -08:00
|
|
|
-partialld|--partialld)
|
|
|
|
partialld="$2"; shift;;
|
2002-11-15 08:36:39 -08:00
|
|
|
-dldefs*|--dldefs*)
|
|
|
|
dl_defs="$2"; shift;;
|
|
|
|
-dllibs*|--dllibs*)
|
|
|
|
dllib="$2"; shift;;
|
1999-11-30 08:07:38 -08:00
|
|
|
-verbose|--verbose)
|
2017-03-08 06:17:05 -08:00
|
|
|
verbose=true;;
|
2011-03-17 09:18:05 -07:00
|
|
|
-with-debug-runtime|--with-debug-runtime)
|
2016-12-20 07:54:20 -08:00
|
|
|
debugruntime=true;;
|
2015-11-20 08:54:26 -08:00
|
|
|
-with-instrumented-runtime|--with-instrumented-runtime)
|
|
|
|
with_instrumented_runtime=true;;
|
2013-07-28 08:52:14 -07:00
|
|
|
-no-debugger|--no-debugger)
|
|
|
|
with_debugger="";;
|
2013-07-28 08:52:17 -07:00
|
|
|
-no-ocamldoc|--no-ocamldoc)
|
|
|
|
with_ocamldoc="";;
|
|
|
|
-no-ocamlbuild|--no-ocamlbuild)
|
2015-12-26 07:08:31 -08:00
|
|
|
;; # ignored for backward compatibility
|
2013-06-03 11:03:59 -07:00
|
|
|
-with-frame-pointers|--with-frame-pointers)
|
|
|
|
with_frame_pointers=true;;
|
2014-05-12 00:29:24 -07:00
|
|
|
-no-naked-pointers|--no-naked-pointers)
|
|
|
|
no_naked_pointers=true;;
|
2016-07-29 07:07:10 -07:00
|
|
|
-spacetime|--spacetime)
|
2016-08-02 09:52:07 -07:00
|
|
|
with_spacetime=true; with_profinfo=true; profinfo_width=26;;
|
|
|
|
-reserved-header-bits|--reserved-header-bits)
|
|
|
|
with_spacetime=false; with_profinfo=true; profinfo_width=$2;shift
|
|
|
|
case $profinfo_width in
|
|
|
|
0) with_profinfo=false;;
|
|
|
|
[0123456789]);;
|
|
|
|
1?|2?);;
|
|
|
|
3[012]);;
|
|
|
|
*) err "--reserved-header-bits argument must be less than 32"
|
|
|
|
esac
|
|
|
|
;;
|
2013-09-04 08:12:37 -07:00
|
|
|
-no-cfi|--no-cfi)
|
|
|
|
with_cfi=false;;
|
2016-06-01 02:38:41 -07:00
|
|
|
-no-native-compiler|--no-native-compiler)
|
2016-01-01 05:06:17 -08:00
|
|
|
native_compiler=false;;
|
2016-06-01 02:38:41 -07:00
|
|
|
-flambda|--flambda)
|
2016-01-06 08:48:37 -08:00
|
|
|
flambda=true;;
|
2016-07-06 07:37:56 -07:00
|
|
|
-no-cplugins|--no-cplugins)
|
|
|
|
with_cplugins=false;;
|
|
|
|
-fPIC|--fPIC)
|
|
|
|
with_fpic=true;;
|
2016-07-13 02:04:16 -07:00
|
|
|
-safe-string|--safe-string)
|
|
|
|
safe_string=true;;
|
2016-12-06 08:18:04 -08:00
|
|
|
-afl-instrument)
|
|
|
|
afl_instrument=true;;
|
2014-10-29 09:29:18 -07:00
|
|
|
*) if echo "$1" | grep -q -e '^--\?[a-zA-Z0-9-]\+='; then
|
|
|
|
err "configure expects arguments of the form '-prefix /foo/bar'," \
|
|
|
|
"not '-prefix=/foo/bar' (note the '=')."
|
|
|
|
else
|
|
|
|
err "Unknown option \"$1\"."
|
|
|
|
fi;;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
1997-10-24 08:49:12 -07:00
|
|
|
# Sanity checks
|
|
|
|
|
1999-03-10 01:51:16 -08:00
|
|
|
case "$prefix" in
|
|
|
|
/*) ;;
|
2013-06-27 12:10:08 -07:00
|
|
|
*) err "The -prefix directory must be absolute.";;
|
1999-03-10 01:51:16 -08:00
|
|
|
esac
|
1997-10-24 08:49:12 -07:00
|
|
|
case "$bindir" in
|
|
|
|
/*) ;;
|
1999-03-10 01:51:16 -08:00
|
|
|
"") ;;
|
2012-01-26 05:02:51 -08:00
|
|
|
'$(PREFIX)/'*) ;;
|
2013-06-27 12:10:08 -07:00
|
|
|
*) err 'The -bindir directory must be absolute or relative to $(PREFIX).';;
|
1997-10-24 08:49:12 -07:00
|
|
|
esac
|
|
|
|
case "$libdir" in
|
|
|
|
/*) ;;
|
1999-03-10 01:51:16 -08:00
|
|
|
"") ;;
|
2012-01-26 05:02:51 -08:00
|
|
|
'$(PREFIX)/'*) ;;
|
2013-06-27 12:10:08 -07:00
|
|
|
*) err 'The -libdir directory must be absolute or relative to $(PREFIX).';;
|
1997-10-24 08:49:12 -07:00
|
|
|
esac
|
|
|
|
case "$mandir" in
|
|
|
|
/*) ;;
|
1999-03-10 01:51:16 -08:00
|
|
|
"") ;;
|
2012-01-26 05:02:51 -08:00
|
|
|
'$(PREFIX)/'*) ;;
|
2013-06-27 12:10:08 -07:00
|
|
|
*) err 'The -mandir directory must be absolute or relative to $(PREFIX).';;
|
1997-10-24 08:49:12 -07:00
|
|
|
esac
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Generate the files
|
|
|
|
|
|
|
|
cd config/auto-aux
|
|
|
|
rm -f s.h m.h Makefile
|
|
|
|
touch s.h m.h Makefile
|
|
|
|
|
2001-02-21 19:37:29 -08:00
|
|
|
# Write options to Makefile
|
|
|
|
|
|
|
|
echo "# generated by ./configure $configure_options" >> Makefile
|
2016-07-13 07:02:51 -07:00
|
|
|
echo "CONFIGURE_ARGS=$configure_options" >> Makefile
|
2001-02-21 19:37:29 -08:00
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Where to install
|
|
|
|
|
1999-03-10 01:51:16 -08:00
|
|
|
echo "PREFIX=$prefix" >> Makefile
|
|
|
|
case "$bindir" in
|
|
|
|
"") echo 'BINDIR=$(PREFIX)/bin' >> Makefile
|
|
|
|
bindir="$prefix/bin";;
|
|
|
|
*) echo "BINDIR=$bindir" >> Makefile;;
|
|
|
|
esac
|
2016-12-21 01:01:11 -08:00
|
|
|
|
|
|
|
echo 'BYTERUN=$(BINDIR)/ocamlrun' >> Makefile
|
|
|
|
|
1999-03-10 01:51:16 -08:00
|
|
|
case "$libdir" in
|
|
|
|
"") echo 'LIBDIR=$(PREFIX)/lib/ocaml' >> Makefile
|
|
|
|
libdir="$prefix/lib/ocaml";;
|
|
|
|
*) echo "LIBDIR=$libdir" >> Makefile;;
|
|
|
|
esac
|
2002-06-27 04:36:02 -07:00
|
|
|
echo 'STUBLIBDIR=$(LIBDIR)/stublibs' >> Makefile
|
1999-03-10 01:51:16 -08:00
|
|
|
case "$mandir" in
|
2002-04-24 02:26:32 -07:00
|
|
|
"") echo 'MANDIR=$(PREFIX)/man' >> Makefile
|
|
|
|
mandir="$prefix/man";;
|
1999-03-10 01:51:16 -08:00
|
|
|
*) echo "MANDIR=$mandir" >> Makefile;;
|
|
|
|
esac
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "MANEXT=$manext" >> Makefile
|
|
|
|
|
|
|
|
# Determine the system type
|
|
|
|
|
1996-02-25 06:45:47 -08:00
|
|
|
if test "$host_type" = "unknown"; then
|
2016-11-26 15:28:02 -08:00
|
|
|
if host_type=`sh ../gnu/config.guess`; then :; else
|
2013-06-27 12:10:08 -07:00
|
|
|
err "Cannot guess host type. You must specify one with the -host option."
|
1996-02-25 06:45:47 -08:00
|
|
|
fi
|
|
|
|
fi
|
2016-11-26 15:28:02 -08:00
|
|
|
if host=`sh ../gnu/config.sub $host_type`; then :; else
|
2013-06-27 12:10:08 -07:00
|
|
|
err "Please specify the correct host type with the -host option"
|
1996-02-25 06:45:47 -08:00
|
|
|
fi
|
2013-06-30 04:41:40 -07:00
|
|
|
inf "Configuring for host $host ..."
|
|
|
|
|
|
|
|
if test -n "$target_type"; then
|
|
|
|
target="$target_type"
|
2013-06-30 05:42:23 -07:00
|
|
|
TOOLPREF="${target}-"
|
2013-06-30 04:41:40 -07:00
|
|
|
else
|
|
|
|
target="$host"
|
|
|
|
fi
|
|
|
|
inf "Configuring for target $target ..."
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2015-07-17 07:31:05 -07:00
|
|
|
if [ x"$host" = x"$target" ]; then
|
|
|
|
cross_compiler=false
|
|
|
|
else
|
|
|
|
cross_compiler=true
|
|
|
|
fi
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Do we have gcc?
|
|
|
|
|
2000-12-12 02:26:02 -08:00
|
|
|
if test -z "$ccoption"; then
|
2013-06-30 05:42:23 -07:00
|
|
|
if sh ./searchpath "${TOOLPREF}gcc"; then
|
|
|
|
cc="${TOOLPREF}gcc"
|
1996-02-13 08:29:09 -08:00
|
|
|
else
|
2015-07-17 07:31:05 -07:00
|
|
|
if $cross_compiler; then
|
2013-06-30 05:42:23 -07:00
|
|
|
err "No cross-compiler found for ${target}.\n" \
|
|
|
|
"It should be named ${TOOLPREF}gcc and be in the PATH."
|
2015-07-17 07:31:05 -07:00
|
|
|
else
|
|
|
|
cc="cc"
|
2013-06-30 05:42:23 -07:00
|
|
|
fi
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
2000-12-12 02:26:02 -08:00
|
|
|
else
|
|
|
|
cc="$ccoption"
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
2013-06-30 05:42:23 -07:00
|
|
|
inf "Using compiler $cc."
|
|
|
|
|
2015-08-04 05:12:47 -07:00
|
|
|
# Determine the C compiler family (GCC, Clang, etc)
|
2002-11-15 08:36:39 -08:00
|
|
|
|
2015-08-04 05:12:47 -07:00
|
|
|
ccfamily=`$cc -E cckind.c | grep '^[a-z]' | tr -s ' ' '-'`
|
|
|
|
case $? in
|
|
|
|
0) inf "Compiler family and version: $ccfamily.";;
|
|
|
|
*) err "Unable to preprocess the test program.\n" \
|
|
|
|
"Make sure the C compiler $cc is properly installed.";;
|
1997-03-21 02:44:35 -08:00
|
|
|
esac
|
|
|
|
|
1997-03-11 01:25:23 -08:00
|
|
|
# Configure the bytecode compiler
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2016-11-08 06:47:06 -08:00
|
|
|
# The BYTECC make variable defines which compiler and options to use
|
|
|
|
# to compile C code intended to be used by OCaml bytecode programs.
|
2016-12-21 06:36:44 -08:00
|
|
|
# It is used inside OCaml's build system.
|
|
|
|
|
|
|
|
# The BYTECODE_C_COMPILER make variable says how the C compiler should be
|
|
|
|
# invoked to process a third-party C source file passed to ocamlc
|
|
|
|
# when no -cc command-line option has been specified.
|
2016-11-08 06:47:06 -08:00
|
|
|
|
|
|
|
# The BYTECCCOMPOPTS make variable contains options to pass to the C
|
|
|
|
# compiler but only when compiling C files that belong to the OCaml
|
|
|
|
# distribution.
|
|
|
|
# In other words, when ocamlc is called to compile a third-party C
|
|
|
|
# source file, it will _not_ pass these options to the C compiler.
|
|
|
|
|
|
|
|
# The SHAREDCCCOMPOPTS make variable contains options to use to compile C
|
|
|
|
# source files so that the resulting object files can then be integrated
|
|
|
|
# into shared libraries. It is passed to BYTECC for both C source files
|
|
|
|
# in the OCaml distribution and third-party C source files compiled
|
|
|
|
# with ocamlc.
|
|
|
|
|
1997-03-11 01:25:23 -08:00
|
|
|
bytecc="$cc"
|
2007-11-15 05:21:15 -08:00
|
|
|
mkexe="\$(BYTECC)"
|
2012-07-26 12:21:54 -07:00
|
|
|
mkexedebugflag="-g"
|
1997-03-11 01:25:23 -08:00
|
|
|
bytecccompopts=""
|
2016-11-08 06:47:06 -08:00
|
|
|
byteccprivatecompopts=""
|
2017-03-13 05:21:17 -07:00
|
|
|
ldflags=""
|
2000-08-10 07:41:24 -07:00
|
|
|
ostype="Unix"
|
2000-08-10 02:58:08 -07:00
|
|
|
exe=""
|
2007-11-15 05:21:15 -08:00
|
|
|
iflexdir=""
|
2013-12-17 01:58:47 -08:00
|
|
|
SO="so"
|
2013-06-30 05:42:23 -07:00
|
|
|
TOOLCHAIN="cc"
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2015-08-04 05:12:47 -07:00
|
|
|
# Choose reasonable options based on compiler kind
|
|
|
|
# We select high optimization levels, provided we can turn off:
|
|
|
|
# - strict type-based aliasing analysis (too risky for the OCaml runtime)
|
|
|
|
# - strict no-overflow conditions on signed integer arithmetic
|
|
|
|
# (the OCaml runtime assumes Java-style behavior of signed integer arith.)
|
2015-10-25 03:31:59 -07:00
|
|
|
# Concerning optimization level, -O3 is somewhat risky, so take -O2.
|
2015-08-04 05:12:47 -07:00
|
|
|
# Concerning language version, gnu99 is ISO C99 plus GNU extensions
|
2015-10-25 03:31:59 -07:00
|
|
|
# that are often used in standard headers. Older GCC versions
|
|
|
|
# defaults to gnu89, which is not C99. Clang defaults to gnu99 or
|
|
|
|
# gnu11, which is fine.
|
2015-08-04 05:12:47 -07:00
|
|
|
|
|
|
|
case "$ocamlversion" in
|
|
|
|
*+dev*) gcc_warnings="-Wall -Werror";;
|
|
|
|
*) gcc_warnings="-Wall";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$ccfamily" in
|
|
|
|
clang-*)
|
2016-11-08 06:47:06 -08:00
|
|
|
bytecccompopts="-O2 -fno-strict-aliasing -fwrapv";
|
|
|
|
byteccprivatecompopts="$gcc_warnings";;
|
2015-08-04 05:12:47 -07:00
|
|
|
gcc-[012]-*)
|
2015-11-27 00:33:28 -08:00
|
|
|
# Some versions known to miscompile OCaml, e,g, 2.7.2.1, some 2.96.
|
2015-08-04 05:12:47 -07:00
|
|
|
# Plus: C99 support unknown.
|
2016-02-16 04:23:31 -08:00
|
|
|
err "This version of GCC is too old. Please use GCC version 4.2 or above.";;
|
2015-10-25 03:31:59 -07:00
|
|
|
gcc-3-*|gcc-4-[01])
|
|
|
|
# No -fwrapv option before GCC 3.4.
|
|
|
|
# Known problems with -fwrapv fixed in 4.2 only.
|
2015-11-27 00:33:28 -08:00
|
|
|
wrn "This version of GCC is rather old. Reducing optimization level."
|
2015-10-25 03:31:59 -07:00
|
|
|
wrn "Consider using GCC version 4.2 or above."
|
2016-11-08 06:47:06 -08:00
|
|
|
bytecccompopts="-std=gnu99 -O";
|
|
|
|
byteccprivatecompopts="$gcc_warnings";;
|
2016-10-27 07:36:49 -07:00
|
|
|
gcc-4-*)
|
2016-11-04 04:29:10 -07:00
|
|
|
bytecccompopts="-std=gnu99 -O2 -fno-strict-aliasing -fwrapv \
|
|
|
|
-fno-builtin-memcmp";
|
2016-11-08 06:47:06 -08:00
|
|
|
byteccprivatecompopts="$gcc_warnings";;
|
2016-10-27 07:36:49 -07:00
|
|
|
gcc-*)
|
2016-11-08 06:47:06 -08:00
|
|
|
bytecccompopts="-O2 -fno-strict-aliasing -fwrapv";
|
|
|
|
byteccprivatecompopts="$gcc_warnings";;
|
2015-08-04 05:12:47 -07:00
|
|
|
*)
|
|
|
|
bytecccompopts="-O";;
|
|
|
|
esac
|
|
|
|
|
2016-11-17 02:03:09 -08:00
|
|
|
byteccprivatecompopts="-DCAML_NAME_SPACE $byteccprivatecompopts"
|
|
|
|
|
2015-08-04 05:12:47 -07:00
|
|
|
# Adjust according to target
|
|
|
|
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$bytecc,$target" in
|
2001-12-04 02:54:14 -08:00
|
|
|
*,*-*-rhapsody*)
|
2015-08-04 05:12:47 -07:00
|
|
|
bytecccompopts="$bytecccompopts -DSHRINKED_GNUC"
|
1998-03-13 11:59:11 -08:00
|
|
|
mathlib="";;
|
2001-12-04 02:54:14 -08:00
|
|
|
*,*-*-darwin*)
|
2006-06-29 02:45:10 -07:00
|
|
|
mathlib=""
|
2013-03-22 10:57:53 -07:00
|
|
|
mkexe="$mkexe -Wl,-no_compact_unwind"
|
2006-08-18 07:52:19 -07:00
|
|
|
# Tell gcc that we can use 32-bit code addresses for threaded code
|
2008-12-03 10:09:09 -08:00
|
|
|
# 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;;
|
2014-10-15 06:34:58 -07:00
|
|
|
*,*-*-haiku*)
|
|
|
|
# No -lm library
|
|
|
|
mathlib="";;
|
1999-05-18 11:46:17 -07:00
|
|
|
*,*-*-beos*)
|
|
|
|
# No -lm library
|
|
|
|
mathlib="";;
|
2013-06-30 05:42:23 -07:00
|
|
|
*gcc,alpha*-*-osf*)
|
2000-07-27 04:12:54 -07:00
|
|
|
if cc="$bytecc" sh ./hasgot -mieee; then
|
|
|
|
bytecccompopts="-mieee $bytecccompopts";
|
|
|
|
fi
|
2000-03-10 06:30:16 -08:00
|
|
|
# Put code and static data in lower 4GB
|
2017-03-13 05:21:17 -07:00
|
|
|
ldflags="-Wl,-T,12000000 -Wl,-D,14000000"
|
2000-03-10 06:30:16 -08:00
|
|
|
# Tell gcc that we can use 32-bit code addresses for threaded code
|
|
|
|
echo "#define ARCH_CODE32" >> m.h;;
|
2001-07-02 04:35:04 -07:00
|
|
|
cc,alpha*-*-osf*)
|
2000-07-27 04:03:20 -07:00
|
|
|
bytecccompopts="-std1 -ieee";;
|
2013-06-30 05:42:23 -07:00
|
|
|
*gcc*,alpha*-*-linux*)
|
2001-11-23 06:55:25 -08:00
|
|
|
if cc="$bytecc" sh ./hasgot -mieee; then
|
|
|
|
bytecccompopts="-mieee $bytecccompopts";
|
|
|
|
fi;;
|
2015-08-04 05:12:47 -07:00
|
|
|
*,mips-*-irix6*)
|
1997-03-11 01:25:23 -08:00
|
|
|
# Turn off warning "unused library"
|
2017-03-13 05:21:17 -07:00
|
|
|
ldflags="-n32 -Wl,-woff,84";;
|
2001-06-25 07:40:07 -07:00
|
|
|
*,alpha*-*-unicos*)
|
1998-06-23 09:47:02 -07:00
|
|
|
# For the Cray T3E
|
2015-08-04 05:12:47 -07:00
|
|
|
bytecccompopts="$bytecccompopts -DUMK";;
|
2004-08-20 10:04:35 -07:00
|
|
|
*,powerpc-*-aix*)
|
2015-08-04 05:12:47 -07:00
|
|
|
# Avoid name-space pollution by requiring Unix98-conformant includes
|
2015-12-30 20:54:07 -08:00
|
|
|
bytecccompopts="$bytecccompopts -D_XOPEN_SOURCE=500 -D_ALL_SOURCE";;
|
2015-08-04 05:12:47 -07:00
|
|
|
*,*-*-cygwin*)
|
2015-02-04 20:28:25 -08:00
|
|
|
case $target in
|
|
|
|
i686-*) flavor=cygwin;;
|
|
|
|
x86_64-*) flavor=cygwin64;;
|
|
|
|
*) err "unknown cygwin variant";;
|
|
|
|
esac
|
2015-08-04 05:12:47 -07:00
|
|
|
bytecccompopts="$bytecccompopts -U_WIN32"
|
2013-07-28 08:52:14 -07:00
|
|
|
if test $with_sharedlibs = yes; then
|
2015-02-04 20:28:25 -08:00
|
|
|
flexlink="flexlink -chain $flavor -merge-manifest -stack 16777216"
|
2016-04-08 02:11:45 -07:00
|
|
|
flexdir=`$flexlink -where | tr -d '\015'`
|
2010-01-20 08:26:46 -08:00
|
|
|
if test -z "$flexdir"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
wrn "flexlink not found: native shared libraries won't be available."
|
2013-07-28 08:52:14 -07:00
|
|
|
with_sharedlibs=no
|
2010-01-20 08:26:46 -08:00
|
|
|
else
|
|
|
|
iflexdir="-I\"$flexdir\""
|
|
|
|
mkexe="$flexlink -exe"
|
2012-07-26 12:21:54 -07:00
|
|
|
mkexedebugflag="-link -g"
|
2010-01-20 08:26:46 -08:00
|
|
|
fi
|
2009-05-20 04:52:42 -07:00
|
|
|
fi
|
2013-12-03 06:43:02 -08:00
|
|
|
if test $with_sharedlibs = no; then
|
|
|
|
mkexe="$mkexe -Wl,--stack,16777216"
|
2017-03-13 05:21:17 -07:00
|
|
|
ldflags="-Wl,--stack,16777216"
|
2013-12-03 06:43:02 -08:00
|
|
|
fi
|
2000-08-10 02:58:08 -07:00
|
|
|
exe=".exe"
|
|
|
|
ostype="Cygwin";;
|
2015-08-04 05:12:47 -07:00
|
|
|
*,*-*-mingw*)
|
2013-06-30 05:42:23 -07:00
|
|
|
dllccompopt="-DCAML_DLL"
|
2013-07-28 08:52:14 -07:00
|
|
|
if test $with_sharedlibs = yes; then
|
2013-06-30 05:42:23 -07:00
|
|
|
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."
|
2013-07-28 08:52:14 -07:00
|
|
|
with_sharedlibs=no
|
2013-06-30 05:42:23 -07:00
|
|
|
else
|
|
|
|
iflexdir="-I\"$flexdir\""
|
|
|
|
mkexe="$flexlink -exe"
|
|
|
|
mkexedebugflag="-link -g"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
exe=".exe"
|
|
|
|
ostype="Win32"
|
|
|
|
TOOLCHAIN="mingw"
|
2013-12-17 01:58:47 -08:00
|
|
|
SO="dll"
|
2013-06-30 05:42:23 -07:00
|
|
|
;;
|
2015-08-04 05:12:47 -07:00
|
|
|
*,x86_64-*-linux*)
|
2003-06-30 01:28:48 -07:00
|
|
|
# Tell gcc that we can use 32-bit code addresses for threaded code
|
2006-01-04 08:55:50 -08:00
|
|
|
# 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;;
|
1997-03-11 01:25:23 -08:00
|
|
|
esac
|
|
|
|
|
2015-08-04 05:12:47 -07:00
|
|
|
# Configure compiler to use in further tests.
|
1997-03-11 01:25:23 -08:00
|
|
|
|
2017-03-13 05:21:17 -07:00
|
|
|
cc="$bytecc $ldflags"
|
1999-11-30 08:07:38 -08:00
|
|
|
export cc cclibs verbose
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2015-08-04 05:12:47 -07:00
|
|
|
# Check C compiler.
|
1997-09-02 05:55:01 -07:00
|
|
|
|
2017-03-13 05:21:17 -07:00
|
|
|
cc="$bytecc $bytecccompopts $byteccprivatecompopts $ldflags" sh ./runtest ansi.c
|
1997-09-02 05:55:01 -07:00
|
|
|
case $? in
|
2015-08-04 05:12:47 -07:00
|
|
|
0) inf "The C compiler is ISO C99 compliant." ;;
|
2015-09-11 04:58:31 -07:00
|
|
|
1) wrn "The C compiler is ANSI / ISO C90 compliant, but not ISO C99" \
|
|
|
|
"compliant.";;
|
2015-08-04 05:12:47 -07:00
|
|
|
2) err "The C compiler $cc is not ISO C compliant.\n" \
|
|
|
|
"You need an ISO C99 compiler to build OCaml.";;
|
2013-06-30 05:42:23 -07:00
|
|
|
*)
|
2015-07-17 07:31:05 -07:00
|
|
|
if $cross_compiler; then
|
2013-06-30 05:42:23 -07:00
|
|
|
wrn "Unable to compile the test program.\n" \
|
|
|
|
"This failure is expected for cross-compilation:\n" \
|
2015-08-04 05:12:47 -07:00
|
|
|
"we will assume the C compiler is ISO C99-compliant."
|
2013-06-30 05:42:23 -07:00
|
|
|
else
|
|
|
|
err "Unable to compile the test program.\n" \
|
|
|
|
"Make sure the C compiler $cc is properly installed."
|
|
|
|
fi;;
|
1997-09-02 05:55:01 -07:00
|
|
|
esac
|
|
|
|
|
2015-07-17 07:31:05 -07:00
|
|
|
# For cross-compilation, we need a host-based ocamlrun and ocamlyacc,
|
|
|
|
# and the user must specify the target BINDIR
|
|
|
|
if $cross_compiler; then
|
2013-06-30 04:41:39 -07:00
|
|
|
if ! sh ./searchpath ocamlrun; then
|
2013-11-29 05:04:38 -08:00
|
|
|
err "Cross-compilation requires an ocaml runtime environment\n" \
|
|
|
|
"(the ocamlrun binary). Moreover, its version must be the same\n" \
|
|
|
|
"as the one you're trying to build (`cut -f1 -d+ < ../../VERSION`)."
|
2013-06-30 04:41:39 -07:00
|
|
|
else
|
2015-07-17 07:31:05 -07:00
|
|
|
ocaml_system_version=`ocamlrun -version | sed 's/[^0-9]*\([0-9.]*\).*/\1/'`
|
|
|
|
ocaml_source_version=`sed -n '1 s/\([0-9\.]*\).*/\1/ p' < ../../VERSION`
|
2013-06-30 04:41:39 -07:00
|
|
|
if test x"$ocaml_system_version" != x"$ocaml_source_version"; then
|
2013-11-29 05:04:38 -08:00
|
|
|
err "While you have an ocaml runtime environment, its version\n" \
|
2015-09-11 04:58:31 -07:00
|
|
|
"($ocaml_system_version) doesn't match the version of these\n" \
|
|
|
|
"sources ($ocaml_source_version)."
|
2013-06-30 04:41:39 -07:00
|
|
|
else
|
2015-07-17 07:31:05 -07:00
|
|
|
echo "CAMLRUN=`./searchpath -p ocamlrun`" >> Makefile
|
2013-06-30 04:41:39 -07:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-07-17 07:31:05 -07:00
|
|
|
if ! sh ./searchpath ocamlyacc; then
|
|
|
|
err "Cross-compilation requires an ocamlyacc binary."
|
|
|
|
else
|
|
|
|
ocamlyacc 2>/dev/null
|
|
|
|
if test "$?" -ne 1; then
|
2015-09-11 04:58:31 -07:00
|
|
|
err "While you have an ocamlyacc binary, it cannot be executed" \
|
|
|
|
"successfully."
|
2015-07-17 07:31:05 -07:00
|
|
|
else
|
|
|
|
echo "CAMLYACC=`./searchpath -p ocamlyacc`" >> Makefile
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$target_bindir" ]; then
|
|
|
|
err "Cross-compilation requires -target-bindir."
|
|
|
|
else
|
|
|
|
echo "TARGET_BINDIR=$target_bindir" >> Makefile
|
|
|
|
fi
|
|
|
|
fi # cross-compiler
|
|
|
|
|
2013-11-29 05:04:38 -08:00
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Check the sizes of data types
|
2014-04-15 10:09:13 -07:00
|
|
|
# OCaml needs a 32 or 64 bit architecture, a 32-bit integer type and
|
|
|
|
# a 64-bit integer type
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Checking the sizes of integers and pointers..."
|
2013-06-27 14:09:25 -07:00
|
|
|
ret=`sh ./runtest sizes.c`
|
2014-04-15 10:09:13 -07:00
|
|
|
# $1 = sizeof(int)
|
|
|
|
# $2 = sizeof(long)
|
|
|
|
# $3 = sizeof(pointers)
|
|
|
|
# $4 = sizeof(short)
|
|
|
|
# $5 = sizeof(long long)
|
2013-06-27 14:09:25 -07:00
|
|
|
|
2013-06-30 05:42:23 -07:00
|
|
|
if test "$?" -eq 0; then
|
|
|
|
set $ret
|
2014-04-15 10:09:13 -07:00
|
|
|
case "$3" in
|
|
|
|
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;;
|
|
|
|
*) err "This architecture seems to be neither 32 bits nor 64 bits.\n" \
|
|
|
|
"OCaml won't run on this architecture.";;
|
2013-06-30 05:42:23 -07:00
|
|
|
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
|
2014-04-15 10:09:13 -07:00
|
|
|
set 4 4 4 2 8
|
2013-06-30 05:42:23 -07:00
|
|
|
arch64=false;;
|
|
|
|
x86_64-*-mingw*) inf "Wow! A 64 bit architecture!"
|
|
|
|
echo "#define ARCH_SIXTYFOUR" >> m.h
|
2014-04-15 10:09:13 -07:00
|
|
|
set 4 4 8 2 8
|
2013-06-30 05:42:23 -07:00
|
|
|
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
|
1998-06-23 06:39:54 -07:00
|
|
|
fi
|
|
|
|
|
2014-04-15 10:09:13 -07:00
|
|
|
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
|
|
|
|
|
|
|
|
if test $2 != 8 && test $5 != 8; then
|
|
|
|
err "Sorry, we can't find a 64-bit integer type\n" \
|
|
|
|
"(sizeof(long) = $2, sizeof(long long) = $5)\n" \
|
|
|
|
"OCaml won't run on this architecture."
|
|
|
|
fi
|
|
|
|
|
1998-06-23 06:39:54 -07:00
|
|
|
echo "#define SIZEOF_INT $1" >> m.h
|
|
|
|
echo "#define SIZEOF_LONG $2" >> m.h
|
2005-09-22 07:21:50 -07:00
|
|
|
echo "#define SIZEOF_PTR $3" >> m.h
|
1998-06-23 06:39:54 -07:00
|
|
|
echo "#define SIZEOF_SHORT $4" >> m.h
|
2014-04-15 10:09:13 -07:00
|
|
|
echo "#define SIZEOF_LONGLONG $5" >> m.h
|
2005-09-24 02:19:09 -07:00
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Determine endianness
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
sh ./runtest endian.c
|
1996-02-13 08:29:09 -08:00
|
|
|
case $? in
|
2013-06-27 12:10:08 -07:00
|
|
|
0) inf "This is a big-endian architecture."
|
1996-07-01 05:43:28 -07:00
|
|
|
echo "#define ARCH_BIG_ENDIAN" >> m.h;;
|
2013-06-27 12:10:08 -07:00
|
|
|
1) inf "This is a little-endian architecture."
|
1996-07-01 05:43:28 -07:00
|
|
|
echo "#undef ARCH_BIG_ENDIAN" >> m.h;;
|
2015-09-11 04:58:31 -07:00
|
|
|
2) err "This architecture seems to be neither big endian nor little" \
|
|
|
|
"endian.\n OCaml won't run on this architecture.";;
|
2013-06-30 05:42:23 -07:00
|
|
|
*) 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" \
|
2015-09-11 04:58:31 -07:00
|
|
|
"You will have to figure out endianness yourself\n" \
|
|
|
|
"(option ARCH_BIG_ENDIAN in m.h).";;
|
2013-06-30 05:42:23 -07:00
|
|
|
esac;;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Determine alignment constraints
|
|
|
|
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$target" in
|
2011-07-20 02:17:07 -07:00
|
|
|
sparc*-*-*|hppa*-*-*|arm*-*-*|mips*-*-*)
|
2003-03-10 09:04:00 -08:00
|
|
|
# On Sparc V9 with certain versions of gcc, determination of double
|
2003-10-21 06:17:06 -07:00
|
|
|
# alignment is not reliable (PR#1521), hence force it.
|
|
|
|
# Same goes for hppa.
|
2010-08-02 07:37:22 -07:00
|
|
|
# PR#5088 suggests same problem on ARM.
|
2011-07-20 02:17:07 -07:00
|
|
|
# PR#5280 reports same problem on MIPS.
|
2004-06-12 07:50:52 -07:00
|
|
|
# But there's a knack (PR#2572):
|
2006-04-16 16:28:22 -07:00
|
|
|
# if we're in 64-bit mode (sizeof(long) == 8),
|
2004-06-12 07:50:52 -07:00
|
|
|
# we must not doubleword-align floats...
|
|
|
|
if test $2 = 8; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Doubles can be word-aligned."
|
2004-06-12 07:50:52 -07:00
|
|
|
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h
|
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Doubles must be doubleword-aligned."
|
2004-06-12 07:50:52 -07:00
|
|
|
echo "#define ARCH_ALIGN_DOUBLE" >> m.h
|
|
|
|
fi;;
|
2003-03-10 09:04:00 -08:00
|
|
|
*)
|
|
|
|
sh ./runtest dblalign.c
|
|
|
|
case $? in
|
2013-06-27 12:10:08 -07:00
|
|
|
0) inf "Doubles can be word-aligned."
|
2003-03-10 09:04:00 -08:00
|
|
|
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
|
2013-06-27 12:10:08 -07:00
|
|
|
1) inf "Doubles must be doubleword-aligned."
|
2003-03-10 09:04:00 -08:00
|
|
|
echo "#define ARCH_ALIGN_DOUBLE" >> m.h;;
|
2013-06-30 05:42:23 -07:00
|
|
|
*) case "$target" in
|
|
|
|
*-*-mingw*) inf "Doubles can be word-aligned."
|
|
|
|
echo "#undef ARCH_ALIGN_DOUBLE" >> m.h;;
|
2015-09-11 04:58:31 -07:00
|
|
|
*) wrn "Something went wrong during alignment determination for" \
|
|
|
|
"doubles.\n" \
|
2013-06-30 05:42:23 -07:00
|
|
|
"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;;
|
2003-03-10 09:04:00 -08:00
|
|
|
esac;;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
2014-04-15 10:09:13 -07:00
|
|
|
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
|
2000-03-10 09:36:31 -08:00
|
|
|
|
2001-08-28 07:47:48 -07:00
|
|
|
# Shared library support
|
|
|
|
|
|
|
|
shared_libraries_supported=false
|
2002-11-15 08:36:39 -08:00
|
|
|
dl_needs_underscore=false
|
2001-08-28 07:47:48 -07:00
|
|
|
sharedcccompopts=''
|
2016-02-03 07:03:06 -08:00
|
|
|
mksharedlib='shared-libs-not-available'
|
2001-08-28 07:47:48 -07:00
|
|
|
byteccrpath=''
|
2001-10-30 01:32:32 -08:00
|
|
|
mksharedlibrpath=''
|
2007-11-06 07:16:56 -08:00
|
|
|
natdynlinkopts=""
|
2001-08-28 07:47:48 -07:00
|
|
|
|
2013-07-28 08:52:14 -07:00
|
|
|
if test $with_sharedlibs = "yes"; then
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$target" in
|
2007-11-06 07:16:56 -08:00
|
|
|
*-*-cygwin*)
|
2007-11-15 05:21:15 -08:00
|
|
|
mksharedlib="$flexlink"
|
2007-11-15 07:18:28 -08:00
|
|
|
mkmaindll="$flexlink -maindll"
|
2007-11-06 07:16:56 -08:00
|
|
|
shared_libraries_supported=true;;
|
2013-06-30 05:42:23 -07:00
|
|
|
*-*-mingw*)
|
|
|
|
mksharedlib="$flexlink"
|
|
|
|
mkmaindll="$flexlink -maindll"
|
|
|
|
shared_libraries_supported=true;;
|
2001-08-28 07:47:48 -07:00
|
|
|
alpha*-*-osf*)
|
|
|
|
case "$bytecc" in
|
2013-06-30 05:42:23 -07:00
|
|
|
*gcc*)
|
2004-04-18 01:59:03 -07:00
|
|
|
sharedcccompopts="-fPIC"
|
2007-11-15 05:21:15 -08:00
|
|
|
mksharedlib="$bytecc -shared"
|
2004-04-18 01:59:03 -07:00
|
|
|
byteccrpath="-Wl,-rpath,"
|
|
|
|
mksharedlibrpath="-Wl,-rpath,"
|
|
|
|
shared_libraries_supported=true;;
|
|
|
|
cc*)
|
|
|
|
sharedcccompopts=""
|
2007-11-15 05:21:15 -08:00
|
|
|
mksharedlib="ld -shared -expect_unresolved '*'"
|
2004-04-18 01:59:03 -07:00
|
|
|
byteccrpath="-Wl,-rpath,"
|
|
|
|
mksharedlibrpath="-rpath "
|
|
|
|
shared_libraries_supported=true;;
|
|
|
|
esac;;
|
2001-09-05 03:44:19 -07:00
|
|
|
*-*-solaris2*)
|
2001-08-28 07:47:48 -07:00
|
|
|
case "$bytecc" in
|
2013-06-30 05:42:23 -07:00
|
|
|
*gcc*)
|
2001-08-28 07:47:48 -07:00
|
|
|
sharedcccompopts="-fPIC"
|
2001-10-25 04:31:12 -07:00
|
|
|
if sh ./solaris-ld; then
|
2015-10-27 10:16:08 -07:00
|
|
|
mksharedlib="ld -G"
|
2001-12-20 16:26:38 -08:00
|
|
|
byteccrpath="-R"
|
2001-10-30 01:32:32 -08:00
|
|
|
mksharedlibrpath="-R"
|
2001-09-05 03:44:19 -07:00
|
|
|
else
|
2007-11-15 05:21:15 -08:00
|
|
|
mksharedlib="$bytecc -shared"
|
2017-03-13 05:21:17 -07:00
|
|
|
ldflags="$ldflags -Wl,-E"
|
2008-04-15 23:50:31 -07:00
|
|
|
natdynlinkopts="-Wl,-E"
|
2001-10-25 04:31:12 -07:00
|
|
|
byteccrpath="-Wl,-rpath,"
|
2001-12-20 16:26:38 -08:00
|
|
|
mksharedlibrpath="-Wl,-rpath,"
|
2001-10-25 04:31:12 -07:00
|
|
|
fi
|
2002-07-23 07:12:03 -07:00
|
|
|
shared_libraries_supported=true;;
|
2001-08-28 07:47:48 -07:00
|
|
|
*)
|
|
|
|
sharedcccompopts="-KPIC"
|
2001-12-20 16:26:38 -08:00
|
|
|
byteccrpath="-R"
|
|
|
|
mksharedlibrpath="-R"
|
2007-11-15 05:21:15 -08:00
|
|
|
mksharedlib="/usr/ccs/bin/ld -G"
|
2002-07-23 07:12:03 -07:00
|
|
|
shared_libraries_supported=true;;
|
2001-08-28 07:47:48 -07:00
|
|
|
esac;;
|
2002-05-25 01:33:26 -07:00
|
|
|
mips*-*-irix[56]*)
|
2001-08-28 07:47:48 -07:00
|
|
|
case "$bytecc" in
|
|
|
|
cc*) sharedcccompopts="";;
|
2013-06-30 05:42:23 -07:00
|
|
|
*gcc*) sharedcccompopts="-fPIC";;
|
2001-08-28 07:47:48 -07:00
|
|
|
esac
|
2007-11-15 05:21:15 -08:00
|
|
|
mksharedlib="ld -shared -rdata_shared"
|
2001-08-28 07:47:48 -07:00
|
|
|
byteccrpath="-Wl,-rpath,"
|
2001-10-30 01:32:32 -08:00
|
|
|
mksharedlibrpath="-rpath "
|
2001-08-28 07:47:48 -07:00
|
|
|
shared_libraries_supported=true;;
|
2011-08-04 07:31:34 -07:00
|
|
|
i[3456]86-*-darwin[89].*)
|
Build dylibs, not bundles, on macOS. (#988)
Generally, OCaml creates dynamic libraries in three cases:
* when building bytecode stubs (dllX.so);
* when building a .cmxs plugin;
* when building a .native.so or even .byte.so.
Right now, this results in DLLs on Windows and ELF shared objects on Linux,
all of which can be dynamically loaded (with dlopen() or equivalent) or
linked against (with the -l linker flag or equivalent). However, on macOS,
this is not the case.
macOS has two kinds of dynamic libraries: "bundles" and "dylibs". Prior to
the version 10.4, there have been significant differences between these,
which I will not describe in this commit because 10.4 has long became
irrelevant. After 10.4, there are only two differences:
* rpath is handled slightly differently.
* dylibs can be linked against, with the -l linker flag;
Before this commit, ocamlc/ocamlopt on macOS produce bundles, when using
the .so extension for the output file. After this commit, OCaml on macOS
will produce dylibs, when using the same extension. The rationale is as
follows:
* For bytecode stubs and plugins, the exact structure of which is essentially
an implementation detail of the OCaml runtime, nothing will change because
they can still be dynamically loaded.
* For .native.so and .byte.so objects, there are two changes:
1. The objects can be linked against with the -l flag.
2. The objects can be linked with the -cclib -shared flag, which is
what ocamlbuild and perhaps other buildsystems pass when building
a shared object through -output-obj/-output-complete-obj.
2017-02-24 06:41:42 -08:00
|
|
|
mksharedlib="$bytecc -shared -flat_namespace -undefined suppress \
|
2015-09-11 04:58:31 -07:00
|
|
|
-read_only_relocs suppress"
|
2007-11-12 09:26:00 -08:00
|
|
|
bytecccompopts="$dl_defs $bytecccompopts"
|
|
|
|
dl_needs_underscore=false
|
|
|
|
shared_libraries_supported=true;;
|
2006-08-30 02:40:56 -07:00
|
|
|
*-apple-darwin*)
|
Build dylibs, not bundles, on macOS. (#988)
Generally, OCaml creates dynamic libraries in three cases:
* when building bytecode stubs (dllX.so);
* when building a .cmxs plugin;
* when building a .native.so or even .byte.so.
Right now, this results in DLLs on Windows and ELF shared objects on Linux,
all of which can be dynamically loaded (with dlopen() or equivalent) or
linked against (with the -l linker flag or equivalent). However, on macOS,
this is not the case.
macOS has two kinds of dynamic libraries: "bundles" and "dylibs". Prior to
the version 10.4, there have been significant differences between these,
which I will not describe in this commit because 10.4 has long became
irrelevant. After 10.4, there are only two differences:
* rpath is handled slightly differently.
* dylibs can be linked against, with the -l linker flag;
Before this commit, ocamlc/ocamlopt on macOS produce bundles, when using
the .so extension for the output file. After this commit, OCaml on macOS
will produce dylibs, when using the same extension. The rationale is as
follows:
* For bytecode stubs and plugins, the exact structure of which is essentially
an implementation detail of the OCaml runtime, nothing will change because
they can still be dynamically loaded.
* For .native.so and .byte.so objects, there are two changes:
1. The objects can be linked against with the -l flag.
2. The objects can be linked with the -cclib -shared flag, which is
what ocamlbuild and perhaps other buildsystems pass when building
a shared object through -output-obj/-output-complete-obj.
2017-02-24 06:41:42 -08:00
|
|
|
mksharedlib="$bytecc -shared -flat_namespace -undefined suppress \
|
2015-09-11 04:58:31 -07:00
|
|
|
-Wl,-no_compact_unwind"
|
2003-01-09 04:01:51 -08:00
|
|
|
bytecccompopts="$dl_defs $bytecccompopts"
|
2007-11-12 09:26:00 -08:00
|
|
|
dl_needs_underscore=false
|
2003-01-09 04:01:51 -08:00
|
|
|
shared_libraries_supported=true;;
|
2017-03-07 03:09:41 -08:00
|
|
|
*-*-linux*|*-*-freebsd[3-9]*|*-*-freebsd[1-9][0-9]*\
|
2016-12-28 06:55:40 -08:00
|
|
|
|*-*-openbsd*|*-*-netbsd*|*-*-dragonfly*|*-*-gnu*|*-*-haiku*)
|
2007-11-10 04:29:28 -08:00
|
|
|
sharedcccompopts="-fPIC"
|
2007-11-15 05:21:15 -08:00
|
|
|
mksharedlib="$bytecc -shared"
|
2017-03-13 05:21:17 -07:00
|
|
|
ldflags="$ldflags -Wl,-E"
|
2007-11-10 04:29:28 -08:00
|
|
|
byteccrpath="-Wl,-rpath,"
|
|
|
|
mksharedlibrpath="-Wl,-rpath,"
|
2016-12-28 06:55:40 -08:00
|
|
|
natdynlinkopts="-Wl,-E"
|
2007-11-10 04:29:28 -08:00
|
|
|
shared_libraries_supported=true;;
|
2001-08-28 07:47:48 -07:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2007-11-15 07:18:28 -08:00
|
|
|
if test -z "$mkmaindll"; then
|
|
|
|
mkmaindll=$mksharedlib
|
|
|
|
fi
|
|
|
|
|
2010-05-25 04:10:59 -07:00
|
|
|
# Configure native dynlink
|
|
|
|
|
|
|
|
natdynlink=false
|
|
|
|
|
2013-07-28 08:52:14 -07:00
|
|
|
if test $with_sharedlibs = "yes"; then
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$target" in
|
2010-05-25 04:10:59 -07:00
|
|
|
*-*-cygwin*) natdynlink=true;;
|
2013-07-28 08:52:18 -07:00
|
|
|
*-*-mingw*) natdynlink=true;;
|
2010-05-25 04:10:59 -07:00
|
|
|
i[3456]86-*-linux*) natdynlink=true;;
|
2012-06-26 09:01:05 -07:00
|
|
|
i[3456]86-*-gnu*) natdynlink=true;;
|
2010-05-25 04:10:59 -07:00
|
|
|
x86_64-*-linux*) natdynlink=true;;
|
2011-08-04 07:31:34 -07:00
|
|
|
i[3456]86-*-darwin[89].*) natdynlink=true;;
|
|
|
|
i[3456]86-*-darwin*)
|
2010-05-28 04:40:00 -07:00
|
|
|
if test $arch64 == true; then
|
|
|
|
natdynlink=true
|
|
|
|
fi;;
|
2012-01-23 07:44:01 -08:00
|
|
|
x86_64-*-darwin*) natdynlink=true;;
|
2015-10-28 07:41:31 -07:00
|
|
|
s390x*-*-linux*) natdynlink=true;;
|
2012-06-26 09:01:05 -07:00
|
|
|
powerpc*-*-linux*) natdynlink=true;;
|
|
|
|
sparc*-*-linux*) natdynlink=true;;
|
2010-05-31 03:09:32 -07:00
|
|
|
i686-*-kfreebsd*) natdynlink=true;;
|
|
|
|
x86_64-*-kfreebsd*) natdynlink=true;;
|
2016-07-29 12:43:22 -07:00
|
|
|
x86_64-*-dragonfly*) natdynlink=true;;
|
2014-05-13 06:14:12 -07:00
|
|
|
i[3456]86-*-freebsd*) natdynlink=true;;
|
2011-03-17 15:34:52 -07:00
|
|
|
x86_64-*-freebsd*) natdynlink=true;;
|
2014-05-13 06:14:12 -07:00
|
|
|
i[3456]86-*-openbsd*) natdynlink=true;;
|
2011-03-17 15:34:52 -07:00
|
|
|
x86_64-*-openbsd*) natdynlink=true;;
|
2014-05-13 06:14:12 -07:00
|
|
|
i[3456]86-*-netbsd*) natdynlink=true;;
|
2011-03-17 15:34:52 -07:00
|
|
|
x86_64-*-netbsd*) natdynlink=true;;
|
2010-05-31 03:09:32 -07:00
|
|
|
i386-*-gnu0.3) natdynlink=true;;
|
2014-10-15 06:34:58 -07:00
|
|
|
i[3456]86-*-haiku*) natdynlink=true;;
|
2012-02-04 02:15:24 -08:00
|
|
|
arm*-*-linux*) natdynlink=true;;
|
2014-08-22 06:45:02 -07:00
|
|
|
arm*-*-freebsd*) natdynlink=true;;
|
2016-03-16 17:50:37 -07:00
|
|
|
earm*-*-netbsd*) natdynlink=true;;
|
2013-07-18 09:09:20 -07:00
|
|
|
aarch64-*-linux*) natdynlink=true;;
|
2010-05-25 04:10:59 -07:00
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-25 03:00:39 -07:00
|
|
|
if test $natdynlink = "true"; then
|
|
|
|
cmxs="cmxs"
|
|
|
|
else
|
|
|
|
cmxs="cmxa"
|
|
|
|
fi
|
|
|
|
|
2010-05-25 04:10:59 -07:00
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Configure the native-code compiler
|
|
|
|
|
2016-11-08 06:47:06 -08:00
|
|
|
# The NATIVECC make variable defines which compiler and options to use
|
|
|
|
# to compile C code intended to be used by OCaml native programs.
|
2016-12-21 06:36:44 -08:00
|
|
|
# It is used inside OCaml's build system.
|
|
|
|
|
|
|
|
# The NATIVE_C_COMPILER make variable says how the C compiler should be
|
|
|
|
# invoked to process a third-party C source file passed to ocamlopt
|
|
|
|
# when no -cc command-line option has been specified.
|
2016-11-08 06:47:06 -08:00
|
|
|
|
|
|
|
# The NATIVECCCOMPOPTS make variable contains options to pass to the C
|
|
|
|
# compiler, but only when compiling C files that belong to the OCaml
|
|
|
|
# distribution.
|
|
|
|
# In other words, when ocamlopt is called to compile a third-party C
|
|
|
|
# source file, it will _not_ pass these options to the C compiler.
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
arch=none
|
|
|
|
model=default
|
|
|
|
system=unknown
|
|
|
|
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$target" in
|
2003-01-03 08:02:12 -08:00
|
|
|
sparc*-*-solaris2.*) arch=sparc; system=solaris;;
|
|
|
|
sparc*-*-*bsd*) arch=sparc; system=bsd;;
|
|
|
|
sparc*-*-linux*) arch=sparc; system=linux;;
|
2006-04-16 16:28:22 -07:00
|
|
|
sparc*-*-gnu*) arch=sparc; system=gnu;;
|
2010-05-25 04:12:48 -07:00
|
|
|
i[3456]86-*-linux*) arch=i386; system=linux_`sh ./runtest elf.c`;;
|
1999-10-14 06:34:17 -07:00
|
|
|
i[3456]86-*-*bsd*) arch=i386; system=bsd_`sh ./runtest elf.c`;;
|
2009-05-20 04:52:42 -07:00
|
|
|
i[3456]86-*-solaris*) if $arch64; then
|
|
|
|
arch=amd64; system=solaris
|
|
|
|
else
|
|
|
|
arch=i386; system=solaris
|
|
|
|
fi;;
|
2014-10-15 06:34:58 -07:00
|
|
|
i[3456]86-*-haiku*) arch=i386; system=beos;;
|
1999-05-18 11:46:17 -07:00
|
|
|
i[3456]86-*-beos*) arch=i386; system=beos;;
|
2000-08-10 02:58:08 -07:00
|
|
|
i[3456]86-*-cygwin*) arch=i386; system=cygwin;;
|
2008-12-03 10:09:09 -08:00
|
|
|
i[3456]86-*-darwin*) if $arch64; then
|
|
|
|
arch=amd64; system=macosx
|
|
|
|
else
|
|
|
|
arch=i386; system=macosx
|
|
|
|
fi;;
|
2006-04-16 16:28:22 -07:00
|
|
|
i[3456]86-*-gnu*) arch=i386; system=gnu;;
|
2013-06-30 05:42:23 -07:00
|
|
|
i[3456]86-*-mingw*) arch=i386; system=mingw;;
|
2015-07-30 02:07:09 -07:00
|
|
|
powerpc64le*-*-linux*) arch=power; model=ppc64le; system=elf;;
|
2015-07-20 08:41:44 -07:00
|
|
|
powerpc*-*-linux*) arch=power;
|
|
|
|
if $arch64; then model=ppc64; else model=ppc; fi
|
|
|
|
system=elf;;
|
2006-09-20 10:44:05 -07:00
|
|
|
powerpc-*-netbsd*) arch=power; model=ppc; system=elf;;
|
2013-06-24 01:17:30 -07:00
|
|
|
powerpc-*-openbsd*) arch=power; model=ppc; system=bsd_elf;;
|
2015-10-28 07:41:31 -07:00
|
|
|
s390x*-*-linux*) arch=s390x; model=z10; system=elf;;
|
2012-10-23 23:20:45 -07:00
|
|
|
armv6*-*-linux-gnueabihf) arch=arm; model=armv6; system=linux_eabihf;;
|
2012-02-04 02:15:24 -08:00
|
|
|
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;;
|
2014-08-22 06:45:02 -07:00
|
|
|
armv6*-*-freebsd*) arch=arm; model=armv6; system=freebsd;;
|
2016-02-16 04:23:31 -08:00
|
|
|
earmv6*-*-netbsd*) arch=arm; model=armv6; system=netbsd;;
|
|
|
|
earmv7*-*-netbsd*) arch=arm; model=armv7; system=netbsd;;
|
2012-02-04 02:15:24 -08:00
|
|
|
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;;
|
2014-05-13 06:14:12 -07:00
|
|
|
arm*-*-openbsd*) arch=arm; system=bsd;;
|
|
|
|
zaurus*-*-openbsd*) arch=arm; system=bsd;;
|
2003-06-30 01:28:48 -07:00
|
|
|
x86_64-*-linux*) arch=amd64; system=linux;;
|
2006-04-16 16:28:22 -07:00
|
|
|
x86_64-*-gnu*) arch=amd64; system=gnu;;
|
2016-07-29 12:43:22 -07:00
|
|
|
x86_64-*-dragonfly*) arch=amd64; system=dragonfly;;
|
2004-05-16 02:09:23 -07:00
|
|
|
x86_64-*-freebsd*) arch=amd64; system=freebsd;;
|
2005-11-08 06:00:23 -08:00
|
|
|
x86_64-*-netbsd*) arch=amd64; system=netbsd;;
|
2004-07-13 05:19:15 -07:00
|
|
|
x86_64-*-openbsd*) arch=amd64; system=openbsd;;
|
2012-01-23 07:18:22 -08:00
|
|
|
x86_64-*-darwin*) arch=amd64; system=macosx;;
|
2013-06-30 05:42:23 -07:00
|
|
|
x86_64-*-mingw*) arch=amd64; system=mingw;;
|
2013-07-18 09:09:20 -07:00
|
|
|
aarch64-*-linux*) arch=arm64; system=linux;;
|
2013-12-03 06:43:02 -08:00
|
|
|
x86_64-*-cygwin*) arch=amd64; system=cygwin;;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
2008-01-11 08:13:18 -08:00
|
|
|
# Some platforms exist both in 32-bit and 64-bit variants, not distinguished
|
2013-06-30 04:41:40 -07:00
|
|
|
# by $target. Turn off native code compilation on platforms where 64-bit mode
|
2015-07-24 05:31:42 -07:00
|
|
|
# is not supported (PR#4441).
|
|
|
|
# Sometimes, it's 32-bit mode that is not supported (PR#6722).
|
2008-01-11 08:13:18 -08:00
|
|
|
|
2015-07-24 05:31:42 -07:00
|
|
|
case "$arch64,$arch,$model" in
|
|
|
|
true,sparc,*|true,power,ppc|false,amd64,*)
|
2008-01-11 08:13:18 -08:00
|
|
|
arch=none; model=default; system=unknown;;
|
2015-07-24 05:31:42 -07:00
|
|
|
esac
|
2008-01-11 08:13:18 -08:00
|
|
|
|
2016-01-01 05:06:17 -08:00
|
|
|
case "$native_compiler" in
|
|
|
|
true) ;;
|
|
|
|
false)
|
2016-03-16 17:50:37 -07:00
|
|
|
arch=none; model=default; system=unknown; natdynlink=false;;
|
2016-01-01 05:06:17 -08:00
|
|
|
esac
|
|
|
|
|
2000-12-12 02:26:02 -08:00
|
|
|
if test -z "$ccoption"; then
|
2011-12-17 03:21:24 -08:00
|
|
|
nativecc="$bytecc"
|
2000-12-12 02:26:02 -08:00
|
|
|
else
|
|
|
|
nativecc="$ccoption"
|
|
|
|
fi
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2015-08-04 05:12:47 -07:00
|
|
|
nativecccompopts="$bytecccompopts"
|
2016-11-30 07:05:59 -08:00
|
|
|
nativeccprivatecompopts="$byteccprivatecompopts"
|
2015-08-25 07:15:54 -07:00
|
|
|
nativeccprofopts=''
|
2001-08-28 07:47:48 -07:00
|
|
|
nativeccrpath="$byteccrpath"
|
1997-02-03 06:41:42 -08:00
|
|
|
|
2015-09-13 15:13:59 -07:00
|
|
|
case "$arch,$nativecc,$system,$model" in
|
2015-08-04 05:12:47 -07:00
|
|
|
*,*,rhapsody,*) if $arch64; then partialld="ld -r -arch ppc64"; fi;;
|
2008-12-03 10:09:09 -08:00
|
|
|
amd64,gcc*,macosx,*) partialld="ld -r -arch x86_64";;
|
2009-05-20 04:52:42 -07:00
|
|
|
amd64,gcc*,solaris,*) partialld="ld -r -m elf_x86_64";;
|
2015-07-30 02:07:09 -07:00
|
|
|
power,gcc*,elf,ppc) partialld="ld -r -m elf32ppclinux";;
|
|
|
|
power,gcc*,elf,ppc64) partialld="ld -r -m elf64ppc";;
|
|
|
|
power,gcc*,elf,ppc64le) partialld="ld -r -m elf64lppc";;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
1998-08-06 07:25:24 -07:00
|
|
|
asppprofflags='-DPROFILING'
|
1996-09-18 06:24:56 -07:00
|
|
|
|
2013-06-27 12:46:02 -07:00
|
|
|
case "$arch,$system" in
|
2014-10-03 12:26:10 -07:00
|
|
|
amd64,macosx) if sh ./searchpath clang; then
|
2013-01-13 06:22:14 -08:00
|
|
|
as='clang -arch x86_64 -c'
|
|
|
|
aspp='clang -arch x86_64 -c'
|
|
|
|
else
|
2013-06-30 05:42:23 -07:00
|
|
|
as="${TOOLPREF}as -arch x86_64"
|
|
|
|
aspp="${TOOLPREF}gcc -arch x86_64 -c"
|
2013-01-13 06:22:14 -08:00
|
|
|
fi;;
|
2013-06-30 05:42:23 -07:00
|
|
|
amd64,solaris) as="${TOOLPREF}as --64"
|
|
|
|
aspp="${TOOLPREF}gcc -m64 -c";;
|
|
|
|
i386,solaris) as="${TOOLPREF}as"
|
2016-10-05 07:45:18 -07:00
|
|
|
aspp="${TOOLPREF}gcc -c";;
|
2015-07-20 08:41:44 -07:00
|
|
|
power,elf) if $arch64; then
|
|
|
|
as="${TOOLPREF}as -a64 -mppc64"
|
|
|
|
aspp="${TOOLPREF}gcc -m64 -c"
|
|
|
|
else
|
|
|
|
as="${TOOLPREF}as -mppc"
|
|
|
|
aspp="${TOOLPREF}gcc -m32 -c"
|
|
|
|
fi;;
|
2015-10-31 04:34:27 -07:00
|
|
|
s390x,elf) as="${TOOLPREF}as -m 64 -march=$model"
|
2015-10-28 07:41:31 -07:00
|
|
|
aspp="${TOOLPREF}gcc -c -Wa,-march=$model";;
|
2013-06-30 05:42:23 -07:00
|
|
|
sparc,solaris) as="${TOOLPREF}as"
|
2013-06-30 04:03:01 -07:00
|
|
|
case "$cc" in
|
2013-06-30 05:42:23 -07:00
|
|
|
*gcc*) aspp="${TOOLPREF}gcc -c";;
|
2014-05-02 09:35:48 -07:00
|
|
|
*) aspp="${TOOLPREF}as -P";;
|
2013-06-30 04:03:01 -07:00
|
|
|
esac;;
|
2014-08-22 06:45:02 -07:00
|
|
|
arm,freebsd) as="${TOOLPREF}cc -c"
|
|
|
|
aspp="${TOOLPREF}cc -c";;
|
2016-07-29 12:43:22 -07:00
|
|
|
*,dragonfly) as="${TOOLPREF}as"
|
|
|
|
aspp="${TOOLPREF}cc -c";;
|
2014-05-02 09:35:48 -07:00
|
|
|
*,freebsd) as="${TOOLPREF}as"
|
|
|
|
aspp="${TOOLPREF}cc -c";;
|
2013-09-04 08:12:37 -07:00
|
|
|
amd64,*|arm,*|arm64,*|i386,*|power,bsd*|sparc,*)
|
2013-06-30 05:42:23 -07:00
|
|
|
as="${TOOLPREF}as"
|
2016-12-04 07:23:45 -08:00
|
|
|
case "$ccfamily" in
|
|
|
|
clang-*)
|
|
|
|
aspp="${TOOLPREF}clang -c"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
aspp="${TOOLPREF}gcc -c"
|
|
|
|
;;
|
|
|
|
esac;;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
2007-10-30 05:37:16 -07:00
|
|
|
if test -n "$asoption"; then as="$asoption"; fi
|
|
|
|
if test -n "$asppoption"; then aspp="$asppoption"; fi
|
|
|
|
|
2002-12-02 04:31:19 -08:00
|
|
|
cc_profile='-pg'
|
2013-06-27 12:46:02 -07:00
|
|
|
case "$arch,$system" in
|
2016-11-25 06:57:14 -08:00
|
|
|
i386,linux_elf) profiling='true';;
|
|
|
|
i386,gnu) profiling='true';;
|
|
|
|
i386,bsd_elf) profiling='true';;
|
|
|
|
amd64,macosx) profiling='true';;
|
|
|
|
i386,macosx) profiling='true';;
|
|
|
|
sparc,bsd) profiling='true';;
|
2013-06-27 12:46:02 -07:00
|
|
|
sparc,solaris)
|
2016-11-25 06:57:14 -08:00
|
|
|
profiling='true'
|
2002-12-02 04:31:19 -08:00
|
|
|
case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
|
2016-11-25 06:57:14 -08:00
|
|
|
amd64,linux) profiling='true';;
|
|
|
|
amd64,openbsd) profiling='true';;
|
|
|
|
amd64,freebsd) profiling='true';;
|
|
|
|
amd64,netbsd) profiling='true';;
|
|
|
|
arm,netbsd) profiling='true';;
|
|
|
|
amd64,gnu) profiling='true';;
|
|
|
|
arm,linux*) profiling='true';;
|
|
|
|
power,elf) profiling='true';;
|
|
|
|
power,bsd*) profiling='true';;
|
|
|
|
*) profiling='false';;
|
1998-11-06 07:39:18 -08:00
|
|
|
esac
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Where is ranlib?
|
|
|
|
|
2013-06-30 05:42:23 -07:00
|
|
|
if sh ./searchpath ${TOOLPREF}ranlib; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "ranlib found"
|
2013-06-30 05:42:23 -07:00
|
|
|
echo "RANLIB=${TOOLPREF}ranlib" >> Makefile
|
|
|
|
echo "RANLIBCMD=${TOOLPREF}ranlib" >> Makefile
|
1996-02-13 08:29:09 -08:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "ranlib not used"
|
2013-06-30 05:42:23 -07:00
|
|
|
echo "RANLIB=${TOOLPREF}ar rs" >> Makefile
|
1996-11-07 02:54:28 -08:00
|
|
|
echo "RANLIBCMD=" >> Makefile
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
2013-06-30 05:42:23 -07:00
|
|
|
echo "ARCMD=${TOOLPREF}ar" >> Makefile
|
|
|
|
|
2012-01-16 01:05:37 -08:00
|
|
|
|
2013-06-30 05:42:23 -07:00
|
|
|
# Write the OS type (Unix or Cygwin)
|
|
|
|
|
|
|
|
echo "#define OCAML_OS_TYPE \"$ostype\"" >> s.h
|
|
|
|
echo "#define OCAML_STDLIB_DIR \"$libdir\"" >> s.h
|
2012-01-16 01:05:37 -08:00
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Do #! scripts work?
|
|
|
|
|
2016-11-26 19:41:30 -08:00
|
|
|
printf "#!%s\nexit 1\n" `command -v cat` > hashbang4
|
|
|
|
chmod +x hashbang4
|
|
|
|
|
|
|
|
if ( (./hashbang || ./hashbang2 || ./hashbang3 || ./hashbang4) >/dev/null); then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "#! appears to work in shell scripts."
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$target" in
|
1998-10-29 07:54:13 -08:00
|
|
|
*-*-sunos*|*-*-unicos*)
|
2013-06-30 04:03:01 -07:00
|
|
|
wrn "We won't use it, though, because under SunOS and Unicos it breaks " \
|
2013-06-27 12:10:08 -07:00
|
|
|
"on pathnames longer than 30 characters"
|
2016-05-03 08:39:45 -07:00
|
|
|
echo "HASHBANGSCRIPTS=false" >> Makefile;;
|
2000-08-10 02:58:08 -07:00
|
|
|
*-*-cygwin*)
|
2013-06-30 04:03:01 -07:00
|
|
|
wrn "We won't use it, though, because of conflicts with .exe extension " \
|
2013-06-27 12:10:08 -07:00
|
|
|
"under Cygwin"
|
2016-05-03 08:39:45 -07:00
|
|
|
echo "HASHBANGSCRIPTS=false" >> Makefile;;
|
2013-06-30 05:42:23 -07:00
|
|
|
*-*-mingw*)
|
2015-07-17 07:31:05 -07:00
|
|
|
inf "We won't use it, though, because it's on the target platform " \
|
|
|
|
"it would be used and windows doesn't support it."
|
2016-05-03 08:39:45 -07:00
|
|
|
echo "HASHBANGSCRIPTS=false" >> Makefile;;
|
2000-08-10 02:58:08 -07:00
|
|
|
*)
|
2016-05-03 08:39:45 -07:00
|
|
|
echo "HASHBANGSCRIPTS=true" >> Makefile;;
|
1997-08-22 01:52:38 -07:00
|
|
|
esac
|
1996-02-13 08:29:09 -08:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "No support for #! in shell scripts"
|
2016-05-03 08:39:45 -07:00
|
|
|
echo "HASHBANGSCRIPTS=false" >> Makefile
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
2002-03-15 06:38:37 -08:00
|
|
|
# Use 64-bit file offset if possible
|
|
|
|
|
|
|
|
bytecccompopts="$bytecccompopts -D_FILE_OFFSET_BITS=64"
|
|
|
|
nativecccompopts="$nativecccompopts -D_FILE_OFFSET_BITS=64"
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Check the semantics of signal handlers
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot sigaction sigprocmask; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "POSIX signal handling found."
|
1999-11-16 01:49:12 -08:00
|
|
|
echo "#define POSIX_SIGNALS" >> s.h
|
1996-02-13 08:29:09 -08:00
|
|
|
else
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./runtest signals.c; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Signals have the BSD semantics."
|
1996-02-21 02:49:46 -08:00
|
|
|
echo "#define BSD_SIGNALS" >> s.h
|
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Signals have the System V semantics."
|
1996-02-21 02:49:46 -08:00
|
|
|
fi
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot sigsetmask; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "sigsetmask() found"
|
1996-02-21 02:49:46 -08:00
|
|
|
echo "#define HAS_SIGSETMASK" >> s.h
|
|
|
|
fi
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
2009-04-01 09:08:37 -07:00
|
|
|
# For the Pervasives module
|
|
|
|
|
2011-06-04 01:55:55 -07:00
|
|
|
if sh ./hasgot2 -i math.h $mathlib expm1 log1p hypot copysign; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "expm1(), log1p(), hypot(), copysign() found."
|
2011-06-04 01:55:55 -07:00
|
|
|
echo "#define HAS_C99_FLOAT_OPS" >> s.h
|
2009-04-01 09:08:37 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
# For the Sys module
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2006-01-04 08:55:50 -08:00
|
|
|
if sh ./hasgot getrusage; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "getrusage() found."
|
2006-01-04 08:55:50 -08:00
|
|
|
echo "#define HAS_GETRUSAGE" >> s.h
|
|
|
|
fi
|
|
|
|
|
1998-02-24 02:43:14 -08:00
|
|
|
if sh ./hasgot times; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "times() found."
|
1998-02-24 02:43:14 -08:00
|
|
|
echo "#define HAS_TIMES" >> s.h
|
|
|
|
fi
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# For the terminfo module
|
|
|
|
|
2013-07-28 08:52:14 -07:00
|
|
|
if test "$with_curses" = "yes"; then
|
2001-07-02 05:10:31 -07:00
|
|
|
for libs in "" "-lcurses" "-ltermcap" "-lcurses -ltermcap" "-lncurses"; do
|
2000-10-27 08:18:24 -07:00
|
|
|
if sh ./hasgot $libs tgetent tgetstr tgetnum tputs; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "termcap functions found (with libraries '$libs')"
|
2000-10-27 08:18:24 -07:00
|
|
|
echo "#define HAS_TERMCAP" >> s.h
|
|
|
|
curseslibs="${libs}"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2016-01-16 03:24:14 -08:00
|
|
|
# For instrumented runtime
|
|
|
|
# (clock_gettime needs -lrt for glibc before 2.17)
|
|
|
|
if $with_instrumented_runtime; then
|
|
|
|
with_instrumented_runtime=false #enabled it only if found
|
|
|
|
for libs in "" "-lrt"; do
|
|
|
|
if sh ./hasgot $libs clock_gettime; then
|
|
|
|
inf "clock_gettime functions found (with libraries '$libs')"
|
|
|
|
instrumented_runtime_libs="${libs}"
|
|
|
|
with_instrumented_runtime=true;
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if ! $with_instrumented_runtime; then
|
2016-02-16 04:23:31 -08:00
|
|
|
err "clock_gettime functions not found. " \
|
|
|
|
"Instrumented runtime can't be built."
|
2016-01-16 03:24:14 -08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1996-04-01 07:22:44 -08:00
|
|
|
# Configuration for the libraries
|
|
|
|
|
2013-06-30 05:58:34 -07:00
|
|
|
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"
|
1996-04-01 07:22:44 -08:00
|
|
|
|
2016-08-01 04:59:40 -07:00
|
|
|
# Spacetime profiling is only available for native code on 64-bit targets.
|
2016-07-29 07:07:10 -07:00
|
|
|
|
|
|
|
case "$native_compiler" in
|
2016-08-01 04:59:40 -07:00
|
|
|
true)
|
|
|
|
if $arch64; then
|
|
|
|
otherlibraries="$otherlibraries raw_spacetime_lib"
|
|
|
|
fi
|
|
|
|
;;
|
2016-07-29 07:07:10 -07:00
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# For the Unix library
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_sockets=no
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot socket socketpair bind listen accept connect; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "You have BSD sockets."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_SOCKETS" >> s.h
|
1997-02-23 08:29:36 -08:00
|
|
|
has_sockets=yes
|
2014-10-15 06:34:58 -07:00
|
|
|
elif sh ./hasgot -lnsl -lsocket socket socketpair bind listen accept connect
|
|
|
|
then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "You have BSD sockets (with libraries '-lnsl -lsocket')"
|
1996-02-13 08:29:09 -08:00
|
|
|
cclibs="$cclibs -lnsl -lsocket"
|
|
|
|
echo "#define HAS_SOCKETS" >> s.h
|
1997-02-23 08:29:36 -08:00
|
|
|
has_sockets=yes
|
2014-10-15 06:34:58 -07:00
|
|
|
elif sh ./hasgot -lnetwork socket socketpair bind listen accept connect; then
|
|
|
|
echo "You have BSD sockets (with library '-lnetwork')"
|
|
|
|
cclibs="$cclibs -lnetwork"
|
|
|
|
echo "#define HAS_SOCKETS" >> s.h
|
|
|
|
has_sockets=yes
|
2013-06-30 05:42:24 -07:00
|
|
|
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
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
1999-12-17 04:42:16 -08:00
|
|
|
if sh ./hasgot -i sys/socket.h -t socklen_t; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "socklen_t is defined in <sys/socket.h>"
|
1999-12-17 04:42:16 -08:00
|
|
|
echo "#define HAS_SOCKLEN_T" >> s.h
|
|
|
|
fi
|
|
|
|
|
2001-06-19 03:01:57 -07:00
|
|
|
if sh ./hasgot inet_aton; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "inet_aton() found."
|
2001-06-19 03:01:57 -07:00
|
|
|
echo "#define HAS_INET_ATON" >> s.h
|
|
|
|
fi
|
|
|
|
|
2004-04-09 08:25:19 -07:00
|
|
|
if sh ./hasgot -i sys/types.h -i sys/socket.h -i netinet/in.h \
|
|
|
|
-t 'struct sockaddr_in6' \
|
2004-04-09 06:25:23 -07:00
|
|
|
&& sh ./hasgot getaddrinfo getnameinfo inet_pton inet_ntop; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "IPv6 is supported."
|
2004-04-09 06:25:23 -07:00
|
|
|
echo "#define HAS_IPV6" >> s.h
|
|
|
|
fi
|
|
|
|
|
2014-08-27 02:58:33 -07:00
|
|
|
if sh ./hasgot -i stdint.h; then
|
|
|
|
inf "stdint.h found."
|
|
|
|
echo "#define HAS_STDINT_H" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i unistd.h; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "unistd.h found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_UNISTD" >> s.h
|
|
|
|
fi
|
|
|
|
|
2002-03-02 01:16:39 -08:00
|
|
|
if sh ./hasgot -i sys/types.h -t off_t; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "off_t is defined in <sys/types.h>"
|
2002-03-02 01:16:39 -08:00
|
|
|
echo "#define HAS_OFF_T" >> s.h
|
|
|
|
fi
|
|
|
|
|
2000-02-29 08:15:40 -08:00
|
|
|
if sh ./hasgot -i sys/types.h -i dirent.h; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "dirent.h found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_DIRENT" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot rewinddir; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "rewinddir() found."
|
1996-06-25 02:27:34 -07:00
|
|
|
echo "#define HAS_REWINDDIR" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot lockf; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "lockf() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_LOCKF" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot mkfifo; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "mkfifo() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_MKFIFO" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot getcwd; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "getcwd() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_GETCWD" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot getwd; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "getwd() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_GETWD" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot getpriority setpriority; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "getpriority() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_GETPRIORITY" >> s.h
|
|
|
|
fi
|
|
|
|
|
2000-02-29 08:15:40 -08:00
|
|
|
if sh ./hasgot -i sys/types.h -i utime.h && sh ./hasgot utime; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "utime() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_UTIME" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot utimes; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "utimes() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_UTIMES" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot dup2; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "dup2() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_DUP2" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot fchmod fchown; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "fchmod() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_FCHMOD" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot truncate ftruncate; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "truncate() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_TRUNCATE" >> s.h
|
|
|
|
fi
|
|
|
|
|
2000-08-08 05:37:53 -07:00
|
|
|
select_include=''
|
|
|
|
if sh ./hasgot -i sys/types.h -i sys/select.h; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "sys/select.h found."
|
2000-08-08 05:37:53 -07:00
|
|
|
echo "#define HAS_SYS_SELECT_H" >> s.h
|
|
|
|
select_include='-i sys/select.h'
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_select=no
|
2000-08-08 05:37:53 -07:00
|
|
|
if sh ./hasgot select && \
|
|
|
|
sh ./hasgot -i sys/types.h $select_include -t fd_set ; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "select() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_SELECT" >> s.h
|
1996-04-03 02:01:15 -08:00
|
|
|
has_select=yes
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
2016-05-14 04:39:28 -07:00
|
|
|
if sh ./hasgot nanosleep ; then
|
|
|
|
inf "nanosleep() found."
|
|
|
|
echo "#define HAS_NANOSLEEP" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot symlink readlink lstat; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "symlink() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_SYMLINK" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_wait=no
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot waitpid; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "waitpid() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_WAITPID" >> s.h
|
1996-06-25 02:27:34 -07:00
|
|
|
has_wait=yes
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot wait4; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "wait4() found."
|
1996-06-25 02:27:34 -07:00
|
|
|
echo "#define HAS_WAIT4" >> s.h
|
|
|
|
has_wait=yes
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
2000-02-29 08:15:40 -08:00
|
|
|
if sh ./hasgot -i limits.h && sh ./runtest getgroups.c; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "getgroups() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_GETGROUPS" >> s.h
|
|
|
|
fi
|
|
|
|
|
2009-04-01 09:50:10 -07:00
|
|
|
if sh ./hasgot -i limits.h -i grp.h && sh ./runtest setgroups.c; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "setgroups() found."
|
2009-04-01 09:50:10 -07:00
|
|
|
echo "#define HAS_SETGROUPS" >> s.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
if sh ./hasgot -i limits.h -i grp.h && sh ./runtest initgroups.c; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "initgroups() found."
|
2009-04-01 09:50:10 -07:00
|
|
|
echo "#define HAS_INITGROUPS" >> s.h
|
|
|
|
fi
|
|
|
|
|
2000-04-05 11:30:22 -07:00
|
|
|
if sh ./hasgot -i termios.h &&
|
1997-04-11 07:27:45 -07:00
|
|
|
sh ./hasgot tcgetattr tcsetattr tcsendbreak tcflush tcflow; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "POSIX termios found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_TERMIOS" >> s.h
|
|
|
|
fi
|
|
|
|
|
2011-12-17 03:21:24 -08:00
|
|
|
if sh ./runtest async_io.c; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Asynchronous I/O are supported."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_ASYNC_IO" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_setitimer=no
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot setitimer; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "setitimer() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_SETITIMER" >> s.h
|
1996-04-03 02:01:15 -08:00
|
|
|
has_setitimer="yes"
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot gethostname; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "gethostname() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_GETHOSTNAME" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot -i sys/utsname.h && sh ./hasgot uname; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "uname() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_UNAME" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
has_gettimeofday=no
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot gettimeofday; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "gettimeofday() found."
|
1996-02-13 08:29:09 -08:00
|
|
|
echo "#define HAS_GETTIMEOFDAY" >> s.h
|
1996-04-03 02:01:15 -08:00
|
|
|
has_gettimeofday="yes"
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
|
|
|
|
1997-04-11 07:27:45 -07:00
|
|
|
if sh ./hasgot mktime; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "mktime() found."
|
1996-06-24 09:35:58 -07:00
|
|
|
echo "#define HAS_MKTIME" >> s.h
|
|
|
|
fi
|
|
|
|
|
2013-07-01 14:33:22 -07:00
|
|
|
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
|
1997-02-14 08:29:10 -08:00
|
|
|
|
1998-04-30 06:38:50 -07:00
|
|
|
if sh ./hasgot putenv; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "putenv() found."
|
1998-04-30 06:38:50 -07:00
|
|
|
echo "#define HAS_PUTENV" >> s.h
|
|
|
|
fi
|
|
|
|
|
1999-05-15 08:05:54 -07:00
|
|
|
if sh ./hasgot -i locale.h && sh ./hasgot setlocale; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "setlocale() and <locale.h> found."
|
1999-05-15 08:05:54 -07:00
|
|
|
echo "#define HAS_LOCALE" >> s.h
|
|
|
|
fi
|
|
|
|
|
2007-11-12 09:26:00 -08:00
|
|
|
|
|
|
|
if sh ./hasgot $dllib dlopen; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "dlopen() found."
|
2003-01-09 00:42:13 -08:00
|
|
|
elif sh ./hasgot $dllib -ldl dlopen; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "dlopen() found in -ldl."
|
2002-11-15 08:36:39 -08:00
|
|
|
dllib="$dllib -ldl"
|
2003-01-09 04:01:51 -08:00
|
|
|
else
|
2013-06-30 05:42:23 -07:00
|
|
|
case "$target" in
|
|
|
|
*-*-mingw*) ;;
|
|
|
|
*) shared_libraries_supported=false
|
|
|
|
esac
|
2003-01-09 04:01:51 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if $shared_libraries_supported; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Dynamic loading of shared libraries is supported."
|
2003-01-09 04:01:51 -08:00
|
|
|
echo "#define SUPPORT_DYNAMIC_LINKING" >> s.h
|
|
|
|
if $dl_needs_underscore; then
|
|
|
|
echo '#define DL_NEEDS_UNDERSCORE' >>s.h
|
|
|
|
fi
|
1999-11-30 08:07:38 -08:00
|
|
|
fi
|
|
|
|
|
2000-02-29 08:15:40 -08:00
|
|
|
if sh ./hasgot -i sys/types.h -i sys/mman.h && sh ./hasgot mmap munmap; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "mmap() found."
|
2000-02-25 05:43:57 -08:00
|
|
|
echo "#define HAS_MMAP" >> s.h
|
|
|
|
fi
|
|
|
|
|
2012-04-04 05:12:02 -07:00
|
|
|
if sh ./hasgot pwrite; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "pwrite() found"
|
2012-04-04 05:12:02 -07:00
|
|
|
echo "#define HAS_PWRITE" >> s.h
|
|
|
|
fi
|
|
|
|
|
2015-03-05 03:02:53 -08:00
|
|
|
nanosecond_stat=none
|
|
|
|
for i in 1 2 3; do
|
2015-09-11 04:58:31 -07:00
|
|
|
if sh ./trycompile -DHAS_NANOSECOND_STAT=$i nanosecond_stat.c; then
|
|
|
|
nanosecond_stat=$i; break
|
|
|
|
fi
|
2015-03-05 03:02:53 -08:00
|
|
|
done
|
|
|
|
if test $nanosecond_stat != "none"; then
|
|
|
|
inf "stat() supports nanosecond precision."
|
|
|
|
echo "#define HAS_NANOSECOND_STAT $nanosecond_stat" >> s.h
|
|
|
|
fi
|
|
|
|
|
2002-05-04 02:58:01 -07:00
|
|
|
nargs=none
|
2002-05-06 01:29:52 -07:00
|
|
|
for i in 5 6; do
|
2016-02-16 04:23:31 -08:00
|
|
|
if sh ./trycompile -DSYS_${system} -DNUM_ARGS=${i} gethostbyname.c; then
|
|
|
|
nargs=$i;
|
|
|
|
break;
|
|
|
|
fi
|
2002-05-04 02:58:01 -07:00
|
|
|
done
|
|
|
|
if test $nargs != "none"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "gethostbyname_r() found (with ${nargs} arguments)."
|
2002-05-04 02:58:01 -07:00
|
|
|
echo "#define HAS_GETHOSTBYNAME_R $nargs" >> s.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
nargs=none
|
2002-05-06 01:29:52 -07:00
|
|
|
for i in 7 8; do
|
2016-02-16 04:23:31 -08:00
|
|
|
if sh ./trycompile -DSYS_${system} -DNUM_ARGS=${i} gethostbyaddr.c; then
|
|
|
|
nargs=$i;
|
|
|
|
break;
|
|
|
|
fi
|
2002-05-04 02:58:01 -07:00
|
|
|
done
|
|
|
|
if test $nargs != "none"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "gethostbyaddr_r() found (with ${nargs} arguments)."
|
2002-05-04 02:58:01 -07:00
|
|
|
echo "#define HAS_GETHOSTBYADDR_R $nargs" >> s.h
|
|
|
|
fi
|
|
|
|
|
2014-05-30 05:49:24 -07:00
|
|
|
if sh ./hasgot mkstemp; then
|
|
|
|
inf "mkstemp() found"
|
|
|
|
echo "#define HAS_MKSTEMP" >> s.h
|
|
|
|
fi
|
|
|
|
|
2014-10-15 06:34:58 -07:00
|
|
|
if sh ./hasgot nice; then
|
|
|
|
inf "nice() found"
|
|
|
|
echo "#define HAS_NICE" >> s.h
|
|
|
|
fi
|
|
|
|
|
2017-02-13 09:05:19 -08:00
|
|
|
if sh ./hasgot dup3; then
|
|
|
|
inf "dup3() found"
|
|
|
|
echo "#define HAS_DUP3" >> s.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
if sh ./hasgot pipe2; then
|
|
|
|
inf "pipe2() found"
|
|
|
|
echo "#define HAS_PIPE2" >> s.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
if sh ./hasgot accept4; then
|
|
|
|
inf "accept4() found"
|
|
|
|
echo "#define HAS_ACCEPT4" >> s.h
|
|
|
|
fi
|
|
|
|
|
1997-02-23 08:29:36 -08:00
|
|
|
# Determine if the debugger is supported
|
|
|
|
|
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
|
1997-02-23 08:29:36 -08:00
|
|
|
fi
|
|
|
|
|
2001-08-08 01:30:26 -07:00
|
|
|
# Determine if system stack overflows can be detected
|
|
|
|
|
2003-05-23 02:15:34 -07:00
|
|
|
case "$arch,$system" in
|
2014-10-15 06:34:58 -07:00
|
|
|
i386,linux_elf|amd64,linux|power,rhapsody|amd64,macosx|i386,macosx \
|
|
|
|
|amd64,openbsd|i386,bsd_elf)
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "System stack overflow can be detected."
|
2003-09-25 01:17:13 -07:00
|
|
|
echo "#define HAS_STACK_OVERFLOW_DETECTION" >> s.h;;
|
2003-05-02 05:48:55 -07:00
|
|
|
*)
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Cannot detect system stack overflow.";;
|
2003-05-02 05:48:55 -07:00
|
|
|
esac
|
|
|
|
|
2009-03-16 07:36:51 -07:00
|
|
|
# Determine the target architecture for the "num" library
|
2008-12-03 10:09:09 -08:00
|
|
|
|
|
|
|
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;;
|
2013-07-18 09:09:20 -07:00
|
|
|
arm64) bng_arch=arm64; bng_asm_level=1;;
|
2008-12-03 10:09:09 -08:00
|
|
|
*) bng_arch=generic; bng_asm_level=0;;
|
1996-02-13 08:29:09 -08:00
|
|
|
esac
|
|
|
|
|
2003-10-24 02:18:01 -07:00
|
|
|
echo "BNG_ARCH=$bng_arch" >> Makefile
|
|
|
|
echo "BNG_ASM_LEVEL=$bng_asm_level" >> Makefile
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2003-07-17 01:38:28 -07:00
|
|
|
# Determine if the POSIX threads library is supported
|
1996-04-03 02:01:15 -08:00
|
|
|
|
2005-05-09 06:39:17 -07:00
|
|
|
systhread_support=false
|
|
|
|
|
2003-09-12 00:36:15 -07:00
|
|
|
if test "$pthread_wanted" = "yes"; then
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$target" in
|
2007-10-08 07:19:34 -07:00
|
|
|
*-*-solaris*) pthread_link="-lpthread -lposix4"
|
|
|
|
pthread_caml_link="-cclib -lpthread -cclib -lposix4";;
|
2016-07-29 12:43:22 -07:00
|
|
|
*-*-dragon*) pthread_link="-pthread"
|
|
|
|
pthread_caml_link="-cclib -pthread";;
|
2007-10-08 07:19:34 -07:00
|
|
|
*-*-freebsd*) pthread_link="-pthread"
|
|
|
|
pthread_caml_link="-cclib -pthread";;
|
|
|
|
*-*-openbsd*) pthread_link="-pthread"
|
|
|
|
pthread_caml_link="-cclib -pthread";;
|
2014-10-15 06:34:58 -07:00
|
|
|
*-*-haiku*) pthread_link=""
|
|
|
|
pthread_caml_link="";;
|
2007-10-08 07:19:34 -07:00
|
|
|
*) pthread_link="-lpthread"
|
|
|
|
pthread_caml_link="-cclib -lpthread";;
|
2000-03-09 01:08:58 -08:00
|
|
|
esac
|
2014-10-03 12:26:10 -07:00
|
|
|
if sh ./hasgot -i pthread.h $pthread_link pthread_self; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "POSIX threads library supported."
|
2005-05-09 06:39:17 -07:00
|
|
|
systhread_support=true
|
2004-07-13 05:19:15 -07:00
|
|
|
otherlibraries="$otherlibraries systhreads"
|
|
|
|
bytecccompopts="$bytecccompopts -D_REENTRANT"
|
|
|
|
nativecccompopts="$nativecccompopts -D_REENTRANT"
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$target" in
|
2016-07-29 12:43:22 -07:00
|
|
|
*-*-freebsd*|*-*-dragonfly*)
|
2004-07-13 05:19:15 -07:00
|
|
|
bytecccompopts="$bytecccompopts -D_THREAD_SAFE"
|
|
|
|
nativecccompopts="$nativecccompopts -D_THREAD_SAFE";;
|
|
|
|
*-*-openbsd*)
|
|
|
|
bytecccompopts="$bytecccompopts -pthread"
|
|
|
|
asppflags="$asppflags -pthread"
|
|
|
|
nativecccompopts="$nativecccompopts -pthread";;
|
|
|
|
esac
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Options for linking with POSIX threads: $pthread_link"
|
2004-07-13 05:19:15 -07:00
|
|
|
if sh ./hasgot $pthread_link sigwait; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "sigwait() found"
|
2004-07-13 05:19:15 -07:00
|
|
|
echo "#define HAS_SIGWAIT" >> s.h
|
|
|
|
fi
|
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "POSIX threads not found."
|
2004-07-13 05:19:15 -07:00
|
|
|
pthread_link=""
|
2003-07-29 08:35:12 -07:00
|
|
|
fi
|
2007-02-07 02:31:36 -08:00
|
|
|
else
|
|
|
|
pthread_link=""
|
2003-09-12 00:36:15 -07:00
|
|
|
fi
|
2014-10-15 06:34:58 -07:00
|
|
|
echo "PTHREAD_LINK=$pthread_link" >> Makefile
|
|
|
|
echo "PTHREAD_CAML_LINK=$pthread_caml_link" >> Makefile
|
2003-07-17 01:38:28 -07:00
|
|
|
|
|
|
|
# Determine if the bytecode thread library is supported
|
|
|
|
|
|
|
|
if test "$has_select" = "yes" \
|
1996-04-03 02:01:15 -08:00
|
|
|
&& test "$has_setitimer" = "yes" \
|
1996-06-25 02:27:34 -07:00
|
|
|
&& test "$has_gettimeofday" = "yes" \
|
|
|
|
&& test "$has_wait" = "yes"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Bytecode threads library supported."
|
1996-04-03 02:01:15 -08:00
|
|
|
otherlibraries="$otherlibraries threads"
|
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Bytecode threads library not supported (missing system calls)"
|
1996-04-03 02:01:15 -08:00
|
|
|
fi
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Determine the location of X include files and libraries
|
|
|
|
|
2012-02-01 13:30:35 -08:00
|
|
|
# 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.
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
x11_include="not found"
|
1996-04-02 00:40:00 -08:00
|
|
|
x11_link="not found"
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2012-02-01 13:30:35 -08:00
|
|
|
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 \
|
2001-10-30 05:40:42 -08:00
|
|
|
$x11_include_dir \
|
|
|
|
\
|
2009-07-20 04:51:50 -07:00
|
|
|
/usr/X11R7/include \
|
|
|
|
/usr/include/X11R7 \
|
|
|
|
/usr/local/X11R7/include \
|
|
|
|
/usr/local/include/X11R7 \
|
|
|
|
/opt/X11R7/include \
|
|
|
|
\
|
2001-10-30 05:40:42 -08:00
|
|
|
/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 \
|
|
|
|
; \
|
2012-02-01 13:30:35 -08:00
|
|
|
do
|
|
|
|
if test -f $dir/X11/X.h; then
|
|
|
|
x11_include_dir=$dir
|
|
|
|
x11_include="-I$dir"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2012-02-01 13:30:35 -08:00
|
|
|
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
|
2001-10-30 05:40:42 -08:00
|
|
|
|
2012-02-01 13:30:35 -08:00
|
|
|
for dir in \
|
2001-10-30 05:40:42 -08:00
|
|
|
$x11_lib_dir \
|
|
|
|
$x11_try_lib_dir \
|
|
|
|
\
|
2005-04-17 01:22:59 -07:00
|
|
|
/usr/X11R6/lib64 \
|
2001-10-30 05:40:42 -08:00
|
|
|
/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 \
|
|
|
|
\
|
2008-01-11 08:13:18 -08:00
|
|
|
/usr/lib64 \
|
2001-10-30 05:40:42 -08:00
|
|
|
/usr/lib \
|
|
|
|
/usr/local/lib \
|
|
|
|
/usr/unsupported/lib \
|
|
|
|
/usr/athena/lib \
|
|
|
|
/usr/lpp/Xamples/lib \
|
2002-07-23 07:12:03 -07:00
|
|
|
/lib/usr/lib/X11 \
|
2001-10-30 05:40:42 -08:00
|
|
|
\
|
|
|
|
/usr/openwin/lib \
|
2012-03-08 11:52:03 -08:00
|
|
|
/usr/openwin/share/lib \
|
|
|
|
\
|
|
|
|
/usr/lib/i386-linux-gnu \
|
|
|
|
/usr/lib/x86_64-linux-gnu \
|
2001-10-30 05:40:42 -08:00
|
|
|
; \
|
2012-02-01 13:30:35 -08:00
|
|
|
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"
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$target" in
|
2016-07-29 12:43:22 -07:00
|
|
|
*-*-freebsd*|*-*-dragonfly*) x11_link="-L$dir -lX11";;
|
2012-02-01 13:30:35 -08:00
|
|
|
*-kfreebsd*-gnu) x11_link="-L$dir -lX11";;
|
|
|
|
*-*-*bsd*) x11_link="-R$dir -L$dir -lX11";;
|
|
|
|
*) x11_link="-L$dir -lX11";;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
break
|
1999-11-30 08:07:38 -08:00
|
|
|
fi
|
2012-02-01 13:30:35 -08:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x11_include" != "not found"; then
|
|
|
|
if test "$x11_include" = "-I/usr/include"; then
|
|
|
|
x11_include=""
|
1996-02-13 08:29:09 -08:00
|
|
|
fi
|
2014-10-03 12:26:10 -07:00
|
|
|
if sh ./hasgot $x11_include $x11_link -i X11/Xlib.h XrmInitialize; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "X11 works"
|
2012-02-01 13:30:35 -08:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
wrn "Cannot compile X11 program."
|
2012-02-01 13:30:35 -08:00
|
|
|
x11_include="not found"
|
|
|
|
fi
|
|
|
|
fi
|
1996-02-13 08:29:09 -08:00
|
|
|
|
2012-02-07 04:43:34 -08:00
|
|
|
has_graph=false
|
1996-04-02 00:40:00 -08:00
|
|
|
if test "$x11_include" = "not found" || test "$x11_link" = "not found"
|
1996-02-13 08:29:09 -08:00
|
|
|
then
|
2013-06-27 12:10:08 -07:00
|
|
|
wrn 'X11 not found, the "graph" library will not be supported.'
|
2012-02-07 04:43:34 -08:00
|
|
|
x11_include="not found"
|
|
|
|
x11_link="not found"
|
1996-04-01 07:22:44 -08:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Options for compiling for X11: $x11_include"
|
|
|
|
inf "Options for linking with X11: $x11_link"
|
2012-02-07 04:43:34 -08:00
|
|
|
if test "$graph_wanted" = yes
|
|
|
|
then
|
|
|
|
has_graph=true
|
|
|
|
otherlibraries="$otherlibraries graph"
|
|
|
|
fi
|
1996-04-01 07:22:44 -08:00
|
|
|
fi
|
2007-02-07 02:31:36 -08:00
|
|
|
echo "X11_INCLUDES=$x11_include" >> Makefile
|
|
|
|
echo "X11_LINK=$x11_link" >> Makefile
|
1996-04-01 07:22:44 -08:00
|
|
|
|
2010-05-19 04:29:38 -07:00
|
|
|
# Look for BFD library
|
|
|
|
|
2017-03-21 04:16:31 -07:00
|
|
|
if $shared_libraries_supported && ./hasgot -DPACKAGE=ocaml -i bfd.h ; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "BFD library found."
|
2017-03-21 04:16:31 -07:00
|
|
|
if sh ./hasgot -DPACKAGE=ocaml -lbfd bfd_openr; then
|
|
|
|
LIBBFD_LINK="-lbfd"
|
|
|
|
inf "BFD links with $LIBBFD_LINK"
|
|
|
|
echo "#define HAS_LIBBFD" >> s.h
|
|
|
|
elif sh ./hasgot -DPACKAGE=ocaml -lbfd -ldl bfd_openr; then
|
|
|
|
LIBBFD_LINK="-lbfd -ldl"
|
|
|
|
inf "BFD links with $LIBBFD_LINK"
|
|
|
|
echo "#define HAS_LIBBFD" >> s.h
|
|
|
|
elif sh ./hasgot -DPACKAGE=ocaml -lbfd -ldl -liberty bfd_openr; then
|
|
|
|
LIBBFD_LINK="-lbfd -ldl -liberty"
|
|
|
|
inf "BFD links with $LIBBFD_LINK"
|
|
|
|
echo "#define HAS_LIBBFD" >> s.h
|
|
|
|
elif sh ./hasgot -DPACKAGE=ocaml -lbfd -ldl -liberty -lz bfd_openr; then
|
|
|
|
LIBBFD_LINK="-lbfd -ldl -liberty -lz"
|
|
|
|
inf "BFD links with $LIBBFD_LINK"
|
|
|
|
echo "#define HAS_LIBBFD" >> s.h
|
|
|
|
else
|
|
|
|
wrn "Could not determine link options for the BFD library"
|
|
|
|
LIBBFD_LINK=
|
|
|
|
fi
|
|
|
|
echo "LIBBFD_LINK=$LIBBFD_LINK" >> Makefile
|
2017-03-23 00:35:20 -07:00
|
|
|
echo LIBBFD_INCLUDE= >>Makefile
|
2015-07-15 07:53:12 -07:00
|
|
|
elif sh ./hasgot -DPACKAGE=ocaml -I/opt/local/include -i bfd.h && \
|
|
|
|
sh ./hasgot -DPACKAGE=ocaml -L/opt/local/lib -lbfd -ldl \
|
|
|
|
-liberty -lz -lintl bfd_openr
|
|
|
|
then
|
|
|
|
# MacOSX with binutils from MacPorts
|
|
|
|
inf "BFD library found."
|
|
|
|
echo "#define HAS_LIBBFD" >> s.h
|
|
|
|
echo "LIBBFD_LINK=-L/opt/local/lib -lbfd -ldl -liberty -lz -lintl" >> Makefile
|
|
|
|
echo LIBBFD_INCLUDE=-I/opt/local/include >>Makefile
|
2010-05-19 04:29:38 -07:00
|
|
|
else
|
2015-07-15 07:53:12 -07:00
|
|
|
wrn "BFD library not found, 'objinfo' will be unable to display info" \
|
|
|
|
" on .cmxs files."
|
2010-05-19 04:29:38 -07:00
|
|
|
echo "LIBBFD_LINK=" >> Makefile
|
2015-07-15 07:53:12 -07:00
|
|
|
echo "LIBBFD_INCLUDE=" >> Makefile
|
2010-05-19 04:29:38 -07:00
|
|
|
fi
|
|
|
|
|
2012-02-21 09:41:02 -08:00
|
|
|
# Check whether assembler supports CFI directives
|
|
|
|
|
|
|
|
asm_cfi_supported=false
|
|
|
|
|
2012-06-17 01:17:43 -07:00
|
|
|
export as aspp
|
2012-02-21 09:41:02 -08:00
|
|
|
|
2013-09-04 08:12:37 -07:00
|
|
|
if ! $with_cfi; then
|
|
|
|
echo "CFI support: disabled by command-line option -no-cfi"
|
|
|
|
elif sh ./tryassemble cfi.S; then
|
2012-02-21 09:41:02 -08:00
|
|
|
echo "#define ASM_CFI_SUPPORTED" >> m.h
|
|
|
|
asm_cfi_supported=true
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Assembler supports CFI"
|
2012-06-17 01:17:43 -07:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Assembler does not support CFI"
|
2012-02-21 09:41:02 -08:00
|
|
|
fi
|
|
|
|
|
2013-06-03 11:03:59 -07:00
|
|
|
if test "$with_frame_pointers" = "true"; then
|
2013-06-30 04:41:40 -07:00
|
|
|
case "$target,$cc" in
|
2016-12-04 12:52:49 -08:00
|
|
|
x86_64-*-linux*,gcc*|x86_64-*-linux*,clang*)
|
2013-06-20 09:26:19 -07:00
|
|
|
nativecccompopts="$nativecccompopts -g -fno-omit-frame-pointer"
|
|
|
|
bytecccompopts="$bytecccompopts -g -fno-omit-frame-pointer"
|
|
|
|
echo "#define WITH_FRAME_POINTERS" >> m.h
|
|
|
|
;;
|
2013-06-27 12:10:08 -07:00
|
|
|
*) err "Unsupported architecture with frame pointers";;
|
2013-06-11 04:58:44 -07:00
|
|
|
esac
|
2013-06-03 11:03:59 -07:00
|
|
|
fi
|
|
|
|
|
2014-05-12 00:29:24 -07:00
|
|
|
if $no_naked_pointers; then
|
|
|
|
echo "#define NO_NAKED_POINTERS" >> m.h
|
|
|
|
fi
|
2013-06-03 11:03:59 -07:00
|
|
|
|
2015-11-20 08:54:26 -08:00
|
|
|
# Check for mmap support for huge pages and contiguous heap
|
|
|
|
if sh ./runtest mmap-huge.c; then
|
|
|
|
has_huge_pages=true
|
|
|
|
echo "#define HAS_HUGE_PAGES" >>s.h
|
|
|
|
echo "#define HUGE_PAGE_SIZE (4 * 1024 * 1024)" >>s.h
|
|
|
|
inf "mmap supports huge pages"
|
|
|
|
else
|
|
|
|
has_huge_pages=false
|
|
|
|
fi
|
|
|
|
|
2016-07-29 07:07:10 -07:00
|
|
|
# Spacetime profiling, including libunwind detection
|
|
|
|
|
|
|
|
# The number of bits used for profiling information is configurable here.
|
|
|
|
# The more bits used for profiling, the smaller will be Max_wosize.
|
|
|
|
# Note that PROFINFO_WIDTH must still be defined even if not configuring
|
|
|
|
# for Spacetime (see comment in byterun/caml/mlvalues.h on [Profinfo_hd]).
|
|
|
|
echo "#define PROFINFO_WIDTH $profinfo_width" >> m.h
|
2016-08-02 09:52:07 -07:00
|
|
|
if $with_profinfo; then
|
|
|
|
echo "#define WITH_PROFINFO" >> m.h
|
|
|
|
fi
|
|
|
|
|
2016-07-29 07:07:10 -07:00
|
|
|
if $with_spacetime; then
|
|
|
|
case "$arch,$system" in
|
|
|
|
amd64,*)
|
|
|
|
spacetime_supported=true
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
spacetime_supported=false
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
libunwind_warning=false
|
|
|
|
if $spacetime_supported; then
|
|
|
|
echo "Spacetime profiling will be available."
|
|
|
|
echo "#define WITH_SPACETIME" >> m.h
|
|
|
|
if $disable_libunwind; then
|
|
|
|
has_libunwind=no
|
|
|
|
libunwind_available=false
|
|
|
|
echo "libunwind support for Spacetime profiling was explicitly disabled."
|
|
|
|
else
|
|
|
|
# On Mac OS X, we always use the system libunwind.
|
|
|
|
if test "$libunwind_lib_dir" != ""; then
|
|
|
|
case "$arch,$system" in
|
|
|
|
amd64,macosx)
|
|
|
|
inf "[WARNING] -libunwind* options are ignored on Mac OS X"
|
|
|
|
libunwind_warning=true
|
|
|
|
libunwind_lib="-framework System"
|
|
|
|
libunwind_lib_temp="$libunwind_lib"
|
|
|
|
# We need unwinding information at runtime, but since we use
|
|
|
|
# -no_compact_unwind, we also need -keep_dwarf_unwind otherwise
|
|
|
|
# the OS X linker will chuck away the DWARF-like (.eh_frame)
|
|
|
|
# information. (Older versions of OS X don't provide this.)
|
|
|
|
mkexe="$mkexe -Wl,-keep_dwarf_unwind"
|
|
|
|
mksharedlib="$mksharedlib -Wl,-keep_dwarf_unwind"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
libunwind_lib="-L$libunwind_lib_dir -lunwind -lunwind-x86_64"
|
|
|
|
libunwind_lib_temp="-Xl $libunwind_lib"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
case "$arch,$system" in
|
|
|
|
amd64,macosx)
|
|
|
|
libunwind_lib="-framework System"
|
|
|
|
libunwind_lib_temp="$libunwind_lib"
|
|
|
|
mkexe="$mkexe -Wl,-keep_dwarf_unwind"
|
|
|
|
mksharedlib="$mksharedlib -Wl,-keep_dwarf_unwind"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
libunwind_lib="-lunwind -lunwind-x86_64"
|
|
|
|
libunwind_lib_temp="$libunwind_lib"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
if test "$libunwind_include_dir" != ""; then
|
|
|
|
case "$arch,$system" in
|
|
|
|
amd64,macosx)
|
|
|
|
if ! $libunwind_warning; then
|
|
|
|
inf "[WARNING] -libunwind* options are ignored on Mac OS X"
|
|
|
|
fi
|
|
|
|
libunwind_include=""
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
libunwind_include="-I$libunwind_include_dir"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
libunwind_include=""
|
|
|
|
fi
|
|
|
|
if sh ./hasgot -i libunwind.h $libunwind_lib_temp $libunwind_include; \
|
|
|
|
then
|
|
|
|
echo "#define HAS_LIBUNWIND" >> s.h
|
|
|
|
has_libunwind=yes
|
|
|
|
libunwind_available=true
|
|
|
|
echo "libunwind support for Spacetime profiling will be available."
|
|
|
|
else
|
|
|
|
has_libunwind=no
|
|
|
|
libunwind_available=false
|
|
|
|
echo "libunwind support for Spacetime profiling will not be available."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Spacetime profiling is not available on 32-bit platforms."
|
|
|
|
with_spacetime=false
|
|
|
|
libunwind_available=false
|
|
|
|
has_libunwind=no
|
|
|
|
fi
|
|
|
|
fi
|
2016-07-06 07:37:56 -07:00
|
|
|
|
|
|
|
if ! $shared_libraries_supported; then
|
|
|
|
with_cplugins=false
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $with_fpic; then
|
|
|
|
bytecccompopts="$bytecccompopts $sharedcccompopts"
|
|
|
|
nativecccompopts="$nativecccompopts $sharedcccompopts"
|
|
|
|
aspp="$aspp $sharedcccompopts"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if $with_cplugins; then
|
|
|
|
echo "#define CAML_WITH_CPLUGINS" >> m.h
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $with_fpic; then
|
|
|
|
echo "#define CAML_WITH_FPIC" >> m.h
|
|
|
|
fi
|
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
# Finish generated files
|
|
|
|
|
1998-03-13 11:59:11 -08:00
|
|
|
cclibs="$cclibs $mathlib"
|
1998-02-26 04:46:56 -08:00
|
|
|
|
2016-11-08 06:47:06 -08:00
|
|
|
echo "BYTECC=$bytecc $bytecccompopts" >> Makefile
|
2016-12-21 06:36:44 -08:00
|
|
|
echo "BYTECODE_C_COMPILER=$bytecc $bytecccompopts $sharedcccompopts" \
|
|
|
|
>> Makefile
|
2016-11-08 06:47:06 -08:00
|
|
|
echo "BYTECCCOMPOPTS=$byteccprivatecompopts" >> Makefile
|
2017-03-13 05:21:17 -07:00
|
|
|
echo "LDFLAGS=$ldflags" >> Makefile
|
2016-01-16 03:24:14 -08:00
|
|
|
echo "BYTECCLIBS=$cclibs $dllib $curseslibs $pthread_link \
|
|
|
|
$instrumented_runtime_libs" >> Makefile
|
2001-08-28 07:47:48 -07:00
|
|
|
echo "BYTECCRPATH=$byteccrpath" >> Makefile
|
2000-08-10 02:58:08 -07:00
|
|
|
echo "EXE=$exe" >> Makefile
|
2001-08-28 07:47:48 -07:00
|
|
|
echo "SUPPORTS_SHARED_LIBRARIES=$shared_libraries_supported" >> Makefile
|
|
|
|
echo "SHAREDCCCOMPOPTS=$sharedcccompopts" >> Makefile
|
2001-10-30 01:32:32 -08:00
|
|
|
echo "MKSHAREDLIBRPATH=$mksharedlibrpath" >> Makefile
|
2007-11-06 07:16:56 -08:00
|
|
|
echo "NATDYNLINKOPTS=$natdynlinkopts" >> Makefile
|
2007-02-07 02:31:36 -08:00
|
|
|
cat >> Makefile <<EOF
|
|
|
|
SYSLIB=-l\$(1)
|
2007-02-08 06:41:57 -08:00
|
|
|
#ml let syslib x = "-l"^x;;
|
2007-02-07 02:31:36 -08:00
|
|
|
|
|
|
|
### How to build a static library
|
2015-04-26 13:50:20 -07:00
|
|
|
MKLIB=${TOOLPREF}ar rc \$(1) \$(2); ${TOOLPREF}ranlib \$(1)
|
2016-03-02 08:07:33 -08:00
|
|
|
#ml let mklib out files opts = (* "" *)
|
2016-02-16 04:23:31 -08:00
|
|
|
#ml Printf.sprintf "${TOOLPREF}ar rc %s %s %s; ${TOOLPREF}ranlib %s"
|
|
|
|
#ml out opts files out;;
|
2007-02-07 02:31:36 -08:00
|
|
|
EOF
|
1998-02-26 04:46:56 -08:00
|
|
|
echo "ARCH=$arch" >> Makefile
|
|
|
|
echo "MODEL=$model" >> Makefile
|
|
|
|
echo "SYSTEM=$system" >> Makefile
|
2016-11-08 06:47:06 -08:00
|
|
|
echo "NATIVECC=$nativecc $nativecccompopts" >> Makefile
|
2016-12-21 06:36:44 -08:00
|
|
|
echo "NATIVE_C_COMPILER=$nativecc $nativecccompopts" >> Makefile
|
2016-11-30 07:05:59 -08:00
|
|
|
echo "NATIVECCCOMPOPTS=$nativeccprivatecompopts" >> Makefile
|
2002-03-11 02:12:43 -08:00
|
|
|
echo "NATIVECCPROFOPTS=$nativeccprofopts" >> Makefile
|
2001-08-28 07:47:48 -07:00
|
|
|
echo "NATIVECCRPATH=$nativeccrpath" >> Makefile
|
2002-06-03 07:22:12 -07:00
|
|
|
echo "NATIVECCLIBS=$cclibs $dllib" >> Makefile
|
2007-10-30 05:37:16 -07:00
|
|
|
echo "ASM=$as" >> Makefile
|
1998-02-26 04:46:56 -08:00
|
|
|
echo "ASPP=$aspp" >> Makefile
|
1998-08-06 07:25:24 -07:00
|
|
|
echo "ASPPPROFFLAGS=$asppprofflags" >> Makefile
|
1998-11-06 07:39:18 -08:00
|
|
|
echo "PROFILING=$profiling" >> Makefile
|
1999-11-30 08:07:38 -08:00
|
|
|
echo "DYNLINKOPTS=$dllib" >> Makefile
|
1996-04-01 07:22:44 -08:00
|
|
|
echo "OTHERLIBRARIES=$otherlibraries" >> Makefile
|
2002-12-02 04:31:19 -08:00
|
|
|
echo "CC_PROFILE=$cc_profile" >> Makefile
|
2007-02-07 02:31:36 -08:00
|
|
|
echo "SYSTHREAD_SUPPORT=$systhread_support" >> Makefile
|
2017-03-13 02:45:22 -07:00
|
|
|
echo "PACKLD=$partialld -o\\ " >> Makefile
|
2007-11-15 05:21:15 -08:00
|
|
|
echo "IFLEXDIR=$iflexdir" >> Makefile
|
2007-02-07 02:31:36 -08:00
|
|
|
echo "O=o" >> Makefile
|
|
|
|
echo "A=a" >> Makefile
|
2013-06-30 05:42:23 -07:00
|
|
|
echo "SO=$SO" >> Makefile
|
2007-02-07 02:31:36 -08:00
|
|
|
echo "EXT_OBJ=.o" >> Makefile
|
|
|
|
echo "EXT_ASM=.s" >> Makefile
|
|
|
|
echo "EXT_LIB=.a" >> Makefile
|
2013-12-17 01:58:47 -08:00
|
|
|
echo "EXT_DLL=.$SO" >> Makefile
|
2007-02-07 02:31:36 -08:00
|
|
|
echo "EXTRALIBS=" >> Makefile
|
|
|
|
echo "CCOMPTYPE=cc" >> Makefile
|
2013-06-30 05:42:23 -07:00
|
|
|
echo "TOOLCHAIN=$TOOLCHAIN" >> Makefile
|
2010-05-25 03:00:39 -07:00
|
|
|
echo "NATDYNLINK=$natdynlink" >> Makefile
|
2007-11-06 07:16:56 -08:00
|
|
|
echo "CMXS=$cmxs" >> Makefile
|
2007-11-15 05:21:15 -08:00
|
|
|
echo "MKEXE=$mkexe" >> Makefile
|
2012-07-26 12:21:54 -07:00
|
|
|
echo "MKEXEDEBUGFLAG=$mkexedebugflag" >> Makefile
|
2007-11-15 05:21:15 -08:00
|
|
|
echo "MKDLL=$mksharedlib" >> Makefile
|
2007-11-15 07:18:28 -08:00
|
|
|
echo "MKMAINDLL=$mkmaindll" >> Makefile
|
2011-03-17 09:18:05 -07:00
|
|
|
echo "RUNTIMED=${debugruntime}" >>Makefile
|
2015-11-20 08:54:26 -08:00
|
|
|
echo "RUNTIMEI=${with_instrumented_runtime}" >>Makefile
|
2013-07-28 08:52:14 -07:00
|
|
|
echo "WITH_DEBUGGER=${with_debugger}" >>Makefile
|
2013-07-28 08:52:17 -07:00
|
|
|
echo "WITH_OCAMLDOC=${with_ocamldoc}" >>Makefile
|
2012-02-21 09:41:02 -08:00
|
|
|
echo "ASM_CFI_SUPPORTED=$asm_cfi_supported" >> Makefile
|
2013-06-03 11:03:59 -07:00
|
|
|
echo "WITH_FRAME_POINTERS=$with_frame_pointers" >> Makefile
|
2016-07-29 07:07:10 -07:00
|
|
|
echo "WITH_SPACETIME=$with_spacetime" >> Makefile
|
2016-08-02 09:52:07 -07:00
|
|
|
echo "WITH_PROFINFO=$with_profinfo" >> Makefile
|
2016-07-29 07:07:10 -07:00
|
|
|
echo "LIBUNWIND_AVAILABLE=$libunwind_available" >> Makefile
|
|
|
|
echo "LIBUNWIND_INCLUDE_FLAGS=$libunwind_include" >> Makefile
|
|
|
|
echo "LIBUNWIND_LINK_FLAGS=$libunwind_lib" >> Makefile
|
|
|
|
echo "PROFINFO_WIDTH=$profinfo_width" >> Makefile
|
2016-07-06 07:37:56 -07:00
|
|
|
echo "WITH_CPLUGINS=$with_cplugins" >> Makefile
|
|
|
|
echo "WITH_FPIC=$with_fpic" >> Makefile
|
2013-07-01 14:33:21 -07:00
|
|
|
echo "TARGET=$target" >> Makefile
|
|
|
|
echo "HOST=$host" >> Makefile
|
2013-05-06 11:01:34 -07:00
|
|
|
if [ "$ostype" = Cygwin ]; then
|
|
|
|
echo "DIFF=diff -q --strip-trailing-cr" >>Makefile
|
|
|
|
fi
|
2016-01-06 08:48:37 -08:00
|
|
|
echo "FLAMBDA=$flambda" >> Makefile
|
2016-07-13 02:04:16 -07:00
|
|
|
echo "SAFE_STRING=$safe_string" >> Makefile
|
2016-12-06 08:18:04 -08:00
|
|
|
echo "AFL_INSTRUMENT=$afl_instrument" >> Makefile
|
2016-01-06 11:55:44 -08:00
|
|
|
echo "MAX_TESTSUITE_DIR_RETRIES=$max_testsuite_dir_retries" >> Makefile
|
2013-05-06 11:01:34 -07:00
|
|
|
|
1996-02-13 08:29:09 -08:00
|
|
|
|
|
|
|
rm -f tst hasgot.c
|
|
|
|
rm -f ../m.h ../s.h ../Makefile
|
|
|
|
mv m.h s.h Makefile ..
|
1996-04-01 07:22:44 -08:00
|
|
|
|
|
|
|
# Print a summary
|
|
|
|
|
2013-06-27 12:10:08 -07:00
|
|
|
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"
|
2017-03-13 05:21:17 -07:00
|
|
|
inf " options for linking....... $ldflags $cclibs $dllib" \
|
2015-09-11 04:58:31 -07:00
|
|
|
"$curseslibs $pthread_link"
|
2001-08-28 07:47:48 -07:00
|
|
|
if $shared_libraries_supported; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " shared libraries are supported"
|
|
|
|
inf " options for compiling..... $sharedcccompopts $bytecccompopts"
|
2015-09-11 04:58:31 -07:00
|
|
|
inf " command for building...... $mksharedlib -o lib.so" \
|
|
|
|
"$mksharedlibrpath/a/path objs"
|
2001-08-28 07:47:48 -07:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " shared libraries not supported"
|
2001-08-28 07:47:48 -07:00
|
|
|
fi
|
1996-04-01 07:22:44 -08:00
|
|
|
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Configuration for the native-code compiler:"
|
1996-04-01 07:22:44 -08:00
|
|
|
if test "$arch" = "none"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " (not supported on this platform)"
|
1996-04-01 07:22:44 -08:00
|
|
|
else
|
|
|
|
if test "$model" = "default"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " hardware architecture..... $arch"
|
1996-04-01 07:22:44 -08:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " hardware architecture..... $arch ($model)"
|
1996-04-01 07:22:44 -08:00
|
|
|
fi
|
|
|
|
if test "$system" = "unknown"; then : ; else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " OS variant................ $system"
|
1996-04-01 07:22:44 -08:00
|
|
|
fi
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " C compiler used........... $nativecc"
|
|
|
|
inf " options for compiling..... $nativecccompopts"
|
2017-03-13 02:45:22 -07:00
|
|
|
inf " options for linking....... $cclibs"
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " assembler ................ $as"
|
|
|
|
inf " preprocessed assembler ... $aspp"
|
2012-02-21 09:41:02 -08:00
|
|
|
if test "$asm_cfi_supported" = "true"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " assembler supports CFI ... yes"
|
2012-02-21 09:41:02 -08:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " assembler supports CFI ... no"
|
2012-02-21 09:41:02 -08:00
|
|
|
fi
|
2013-06-03 11:03:59 -07:00
|
|
|
if test "$with_frame_pointers" = "true"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " with frame pointers....... yes"
|
2013-06-03 11:03:59 -07:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " with frame pointers....... no"
|
2013-06-03 11:03:59 -07:00
|
|
|
fi
|
2014-05-12 00:29:24 -07:00
|
|
|
if $no_naked_pointers; then
|
|
|
|
inf " naked pointers forbidden.. yes"
|
|
|
|
else
|
|
|
|
inf " naked pointers forbidden.. no"
|
|
|
|
fi
|
2016-07-29 07:07:10 -07:00
|
|
|
if $with_spacetime; then
|
|
|
|
inf " spacetime profiling....... yes"
|
|
|
|
inf " ... with libunwind...... $has_libunwind"
|
|
|
|
else
|
|
|
|
inf " spacetime profiling....... no"
|
|
|
|
fi
|
2016-08-02 09:52:07 -07:00
|
|
|
if $with_profinfo; then
|
|
|
|
inf " reserved bits in header... $profinfo_width"
|
|
|
|
else
|
|
|
|
inf " reserved bits in header... no"
|
|
|
|
fi
|
2016-07-29 07:07:10 -07:00
|
|
|
case "$arch,$system" in
|
|
|
|
amd64,macosx)
|
|
|
|
;;
|
|
|
|
amd64,*)
|
|
|
|
if test "$has_libunwind" = "yes"; then
|
|
|
|
if test "$libunwind_include_dir" != ""; then
|
|
|
|
inf " libunwind include dir..... $libunwind_include_dir"
|
|
|
|
fi
|
|
|
|
if test "$libunwind_lib_dir" != ""; then
|
|
|
|
inf " libunwind library dir..... $libunwind_lib_dir"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
2016-07-06 07:37:56 -07:00
|
|
|
if $with_cplugins; then
|
|
|
|
inf " C plugins................. yes"
|
|
|
|
else
|
|
|
|
inf " C plugins................. no"
|
|
|
|
fi
|
|
|
|
if $with_fpic; then
|
|
|
|
inf " compile with -fPIC........ yes"
|
|
|
|
else
|
|
|
|
inf " compile with -fPIC........ no"
|
|
|
|
fi
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " native dynlink ........... $natdynlink"
|
2016-11-25 06:57:14 -08:00
|
|
|
if $profiling; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " profiling with gprof ..... supported"
|
1998-11-06 07:39:18 -08:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf " profiling with gprof ..... not supported"
|
1998-11-06 07:39:18 -08:00
|
|
|
fi
|
2016-01-06 08:48:37 -08:00
|
|
|
if test "$flambda" = "true"; then
|
|
|
|
inf " using flambda middle-end . yes"
|
|
|
|
else
|
|
|
|
inf " using flambda middle-end . no"
|
|
|
|
fi
|
2016-07-13 02:04:16 -07:00
|
|
|
if test "$safe_string" = "true"; then
|
|
|
|
inf " safe strings ............. yes"
|
|
|
|
else
|
|
|
|
inf " safe strings ............. no"
|
|
|
|
fi
|
2016-12-06 08:18:04 -08:00
|
|
|
if test "$afl_instrument" = "true"; then
|
|
|
|
inf " afl-fuzz always enabled .. yes"
|
|
|
|
else
|
|
|
|
inf " afl-fuzz always enabled .. no"
|
|
|
|
fi
|
1996-04-01 07:22:44 -08:00
|
|
|
fi
|
|
|
|
|
2013-07-28 08:52:14 -07:00
|
|
|
if test "$with_debugger" = "ocamldebugger"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Source-level replay debugger: supported"
|
1997-02-23 08:29:36 -08:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Source-level replay debugger: not supported"
|
1997-02-23 08:29:36 -08:00
|
|
|
fi
|
|
|
|
|
2016-12-20 07:54:20 -08:00
|
|
|
if $debugruntime; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Debug runtime will be compiled and installed"
|
2011-03-17 09:18:05 -07:00
|
|
|
fi
|
|
|
|
|
2015-11-20 08:54:26 -08:00
|
|
|
if $with_instrumented_runtime; then
|
|
|
|
inf "Instrumented runtime will be compiled and installed"
|
|
|
|
fi
|
|
|
|
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Additional libraries supported:"
|
|
|
|
inf " $otherlibraries"
|
1996-04-01 07:22:44 -08:00
|
|
|
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Configuration for the \"num\" library:"
|
|
|
|
inf " target architecture ...... $bng_arch (asm level $bng_asm_level)"
|
1996-04-03 02:01:15 -08:00
|
|
|
|
2012-02-07 04:43:34 -08:00
|
|
|
if $has_graph; then
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "Configuration for the \"graph\" library:"
|
|
|
|
inf " options for compiling .... $x11_include"
|
|
|
|
inf " options for linking ...... $x11_link"
|
2012-02-07 04:43:34 -08:00
|
|
|
else
|
2013-06-27 12:10:08 -07:00
|
|
|
inf "The \"graph\" library: not supported"
|
1996-04-01 07:22:44 -08:00
|
|
|
fi
|
|
|
|
|
2013-06-27 12:10:08 -07:00
|
|
|
inf
|
|
|
|
inf "** OCaml configuration completed successfully **"
|
|
|
|
inf
|
2012-02-09 10:41:53 -08:00
|
|
|
|
|
|
|
if test ! -z "$MACOSX_DEPLOYMENT_TARGET"; then
|
2013-06-27 12:10:08 -07:00
|
|
|
wrn "The environment variable MACOSX_DEPLOYMENT_TARGET is set.\n" \
|
|
|
|
"This will probably prevent compiling the OCaml system."
|
2012-02-09 10:41:53 -08:00
|
|
|
fi
|