aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2010-02-08 14:02:06 +0000
committerErlang/OTP <[email protected]>2010-02-08 14:02:06 +0000
commit2db75179169db7ae0126f4d12d6f8a16fded84eb (patch)
treeb36f9b7e7ca0d8c618e974fb1358362d9facdc34
parent62718c973354c80ed6f568574790dec17e9787b8 (diff)
downloadotp-2db75179169db7ae0126f4d12d6f8a16fded84eb.tar.gz
otp-2db75179169db7ae0126f4d12d6f8a16fded84eb.tar.bz2
otp-2db75179169db7ae0126f4d12d6f8a16fded84eb.zip
OTP-8323 Cross compilation improvements and other build system
improvements. Most notable: Lots of cross compilation improvements. The old cross compilation support was more or less non-existing as well as broken. Please, note that the cross compilation support should still be considered as experimental. Also note that old cross compilation configurations cannot be used without modifications. For more information on cross compiling Erlang/OTP see the $ERL_TOP/xcomp/README file. Support for staged install using <url href="http://www.gnu.org/prep/standards/html_node/DESTDIR.html">D ESTDIR</url>. The old broken INSTALL_PREFIX has also been fixed. For more information see the $ERL_TOP/README file. Documentation of the release target of the top Makefile. For more information see the $ERL_TOP/README file. make install now by default creates relative symbolic links instead of absolute ones. For more information see the $ERL_TOP/README file. $ERL_TOP/configure --help=recursive now works and prints help for all applications with configure scripts. Doing make install, or make release directly after make all no longer triggers miscellaneous rebuilds. Existing bootstrap system is now used when doing make install, or make release without a preceding make all. The crypto and ssl applications use the same runtime library path when dynamically linking against libssl.so and libcrypto.so. The runtime library search path has also been extended. The configure scripts of erl_interface and odbc now search for thread libraries and thread library quirks the same way as erts do. The configure script of the odbc application now also looks for odbc libraries in lib64 and lib/64 directories when building on a 64-bit system. The config.h.in file in the erl_interface application is now automatically generated in instead of statically updated which reduces the risk of configure tests without any effect.
-rw-r--r--erl-build-tool-vars.sh2
-rw-r--r--erts/aclocal.m449
-rw-r--r--erts/configure.in48
-rw-r--r--xcomp/README36
-rw-r--r--xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf33
-rw-r--r--xcomp/erl-xcomp-vxworks_ppc32.conf33
-rw-r--r--xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf33
-rw-r--r--xcomp/erl-xcomp.conf.template33
8 files changed, 218 insertions, 49 deletions
diff --git a/erl-build-tool-vars.sh b/erl-build-tool-vars.sh
index c6f25d7f79..f66dc2d286 100644
--- a/erl-build-tool-vars.sh
+++ b/erl-build-tool-vars.sh
@@ -25,4 +25,4 @@
# When updating, also update $ERL_TOP/xcomp/{README,erl-xcomp.conf.template},
# and precious variables in $ERL_TOP/erts/aclocal.m4.
#
-erl_build_tool_vars="CC CFLAGS STATIC_CFLAGS CFLAG_RUNTIME_LIBRARY_PATH CPP CPPFLAGS CXX CXXFLAGS LD LDFLAGS DED_LD DED_LDFLAGS DED_LD_FLAG_RUNTIME_LIBRARY_PATH RANLIB AR"
+erl_build_tool_vars="CC CFLAGS STATIC_CFLAGS CFLAG_RUNTIME_LIBRARY_PATH CPP CPPFLAGS CXX CXXFLAGS LD LDFLAGS LIBS DED_LD DED_LDFLAGS DED_LD_FLAG_RUNTIME_LIBRARY_PATH LFS_CFLAGS LFS_LDFLAGS LFS_LIBS RANLIB AR GETCONF"
diff --git a/erts/aclocal.m4 b/erts/aclocal.m4
index 8002ed3d34..8052b2d67d 100644
--- a/erts/aclocal.m4
+++ b/erts/aclocal.m4
@@ -42,11 +42,16 @@ AC_ARG_VAR(CXX, [C++ compiler])
AC_ARG_VAR(CXXFLAGS, [C++ compiler flags])
AC_ARG_VAR(LD, [linker (is often overridden by configure)])
AC_ARG_VAR(LDFLAGS, [linker flags (can be risky to set since LD may be overriden by configure)])
+AC_ARG_VAR(LIBS, [libraries])
AC_ARG_VAR(DED_LD, [linker for Dynamic Erlang Drivers (set all DED_LD* variables or none)])
AC_ARG_VAR(DED_LDFLAGS, [linker flags for Dynamic Erlang Drivers (set all DED_LD* variables or none)])
AC_ARG_VAR(DED_LD_FLAG_RUNTIME_LIBRARY_PATH, [runtime library path linker flag for Dynamic Erlang Drivers (set all DED_LD* variables or none)])
+AC_ARG_VAR(LFS_CFLAGS, [large file support C compiler flags (set all LFS_* variables or none)])
+AC_ARG_VAR(LFS_LDFLAGS, [large file support linker flags (set all LFS_* variables or none)])
+AC_ARG_VAR(LFS_LIBS, [large file support libraries (set all LFS_* variables or none)])
AC_ARG_VAR(RANLIB, [ranlib])
AC_ARG_VAR(AR, [ar])
+AC_ARG_VAR(GETCONF, [getconf])
dnl Cross system root
AC_ARG_VAR(erl_xcomp_sysroot, [Absolute cross system root path (only used when cross compiling)])
@@ -82,6 +87,29 @@ else
fi
])
+AC_DEFUN(LM_CHECK_GETCONF,
+[
+if test "$cross_compiling" != "yes"; then
+ AC_CHECK_PROG([GETCONF], [getconf], [getconf], [false])
+else
+ dnl First check if we got a `<HOST>-getconf' in $PATH
+ host_getconf="$host_alias-getconf"
+ AC_CHECK_PROG([GETCONF], [$host_getconf], [$host_getconf], [false])
+ if test "$GETCONF" = "false" && test "$erl_xcomp_sysroot" != ""; then
+ dnl We should perhaps give up if we have'nt found it by now, but at
+ dnl least in one Tilera MDE `getconf' under sysroot is a bourne
+ dnl shell script which we can use. We try to find `<HOST>-getconf'
+ dnl or `getconf' under sysconf, but only under sysconf since
+ dnl `getconf' in $PATH is almost guaranteed to be for the build
+ dnl machine.
+ GETCONF=
+ prfx="$erl_xcomp_sysroot"
+ AC_PATH_TOOL([GETCONF], [getconf], [false],
+ ["$prfx/usr/bin:$prfx/bin:$prfx/usr/local/bin"])
+ fi
+fi
+])
+
dnl ----------------------------------------------------------------------
dnl
dnl LM_FIND_EMU_CC
@@ -533,19 +561,22 @@ dnl On ofs1 the '-pthread' switch should be used
linux*)
THR_DEFS="$THR_DEFS -D_POSIX_THREAD_SAFE_FUNCTIONS"
+ LM_CHECK_GETCONF
AC_MSG_CHECKING(for Native POSIX Thread Library)
- if test X$cross_compiling = Xyes; then
- case X$erl_xcomp_linux_nptl in
- X) nptl=cross;;
- Xyes|Xno) nptl=$erl_xcomp_linux_nptl;;
+ libpthr_vsn=`$GETCONF GNU_LIBPTHREAD_VERSION 2>/dev/null`
+ if test $? -eq 0; then
+ case "$libpthr_vsn" in
+ *nptl*|*NPTL*) nptl=yes;;
+ *) nptl=no;;
+ esac
+ elif test "$cross_compiling" = "yes"; then
+ case "$erl_xcomp_linux_nptl" in
+ "") nptl=cross;;
+ yes|no) nptl=$erl_xcomp_linux_nptl;;
*) AC_MSG_ERROR([Bad erl_xcomp_linux_nptl value: $erl_xcomp_linux_nptl]);;
esac
else
- case `getconf GNU_LIBPTHREAD_VERSION 2>/dev/null` in
- nptl*) nptl=yes;;
- NPTL*) nptl=yes;;
- *) nptl=no;;
- esac
+ nptl=no
fi
AC_MSG_RESULT($nptl)
if test $nptl = cross; then
diff --git a/erts/configure.in b/erts/configure.in
index 1892a7a1f4..3d57c2307e 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -449,16 +449,44 @@ case $host_os in
;;
esac
+lfs_conf=ok
+lfs_source=none
+if test "${LFS_CFLAGS+set}" = "set" || \
+ test "${LFS_LDFLAGS+set}" = "set" || \
+ test "${LFS_LIBS+set}" = "set"; then
+ lfs_source=user
+else
+ LM_CHECK_GETCONF
+ test "$GETCONF" = "false" || lfs_source=getconf
+fi
-dnl
-dnl Use the getconf utility if it exists
-dnl to find large file support flags.
-dnl
-if type getconf >/dev/null 2>&1; then
- CFLAGS="$CFLAGS `getconf LFS_CFLAGS 2>/dev/null`"
- DEBUG_CFLAGS="$DEBUG_CFLAGS `getconf LFS_CFLAGS 2>/dev/null`"
- LDFLAGS="$LDFLAGS `getconf LFS_LDFLAGS 2>/dev/null`"
- LIBS="$LIBS `getconf LFS_LIBS 2>/dev/null`"
+if test "$lfs_source" = "none"; then
+ AC_MSG_WARN([Do not know how to check for large file support flags; no getconf is available])
+else
+ for var in CFLAGS LDFLAGS LIBS; do
+ AC_MSG_CHECKING([for large file support $var])
+ if test $lfs_source = user; then
+ eval "lfs_val=\"\$LFS_$var\""
+ else
+ eval "lfs_var=LFS_$var"
+ lfs_val=`$GETCONF $lfs_var 2>/dev/null` || lfs_conf=failed
+ if test $lfs_conf = failed; then
+ AC_MSG_RESULT([failed])
+ break
+ fi
+ eval "$lfs_var=\"$lfs_val\""
+ fi
+ test "$lfs_val" != "" || lfs_val=none
+ AC_MSG_RESULT([$lfs_val])
+ done
+ if test $lfs_conf = failed; then
+ AC_MSG_WARN([Check for large file support flags failed; $GETCONF failed])
+ else
+ CFLAGS="$CFLAGS $LFS_CFLAGS"
+ DEBUG_CFLAGS="$DEBUG_CFLAGS $LFS_CFLAGS"
+ LDFLAGS="$LDFLAGS $LFS_LDFLAGS"
+ LIBS="$LIBS $LFS_LIBS"
+ fi
fi
if test "x$GCC" = xyes; then
@@ -664,7 +692,7 @@ fi
AC_PROG_LN_S
-AC_CHECK_PROG(AR, ar, ar, false)
+AC_CHECK_TOOL([AR], [ar], [false])
if test "$ac_cv_prog_AR" = false; then
AC_MSG_ERROR([No 'ar' command found in PATH])
fi
diff --git a/xcomp/README b/xcomp/README
index 4cb577471a..f4285cd16f 100644
--- a/xcomp/README
+++ b/xcomp/README
@@ -1,5 +1,5 @@
===============================================================================
- Cross compiling Erlang/OTP
+ Cross Compiling Erlang/OTP
===============================================================================
%CopyrightBegin%
@@ -244,14 +244,14 @@ build machine and the cross host system.
$ ./otp_build boot -a
- 'otp_build boot -a' will first build a bootstrap system
-for the build machine and then do the cross build of the system.
+`otp_build boot -a' will first build a bootstrap system for the build machine
+and then do the cross build of the system.
[11]
$ ./otp_build release -a <RELEASE_DIR>
-'otp_build release -a' will do the same as [5], and you will after this have
+`otp_build release -a' will do the same as [5], and you will after this have
to do a manual install either by doing [6], or [7].
======== Currently used configuration variables ===============================
@@ -312,13 +312,15 @@ not need to set these variables (where `<HOST>' is what has been passed as
* CXXFLAGS - C++ compiler flags.
-* LD - Linker
+* LD - Linker.
* LDFLAGS - Linker flags.
--- Dynamic Erlang Driver linker flags. --
+* LIBS - Libraries.
-NOTE! Either define all or non of the DED_LD* variables.
+-- Dynamic Erlang Driver linker flags --
+
+NOTE! Either set all or non of the DED_LD* variables.
* DED_LD - Linker.
@@ -328,11 +330,23 @@ NOTE! Either define all or non of the DED_LD* variables.
This flag should set a specific runtime library path for the shared
library at link time.
+-- Large file support --
+
+NOTE! Either set all or non of the LFS_* variables.
+
+* LFS_CFLAGS - Large file support C compiler flags.
+
+* LFS_LDFLAGS - Large file support linker flags.
+
+* LFS_LIBS - Large file support libraries.
+
-- Other tools --
-* RANLIB - ranlib
+* RANLIB - `ranlib' archive index tool.
-* AR - ar
+* AR - `ar' archiving tool.
+
+* GETCONF - `getconf' system configuration inspection tool.
-------- Cross System Root Locations ------------------------------------------
@@ -356,6 +370,10 @@ These tests cannot (always) be done automatically when cross compiling. You
usually does not need to set these variables. Only set these if you really
know what you are doing.
+Note that some of these values will override results of tests performed
+by `configure', and some will not be used until `configure' is sure that
+it cannot figure the result out.
+
The `configure' script will issue a warning when a default value is used.
When a variable has been set, no warning will be issued.
diff --git a/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf b/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf
index 67da8b5abb..5ceb4ec145 100644
--- a/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf
+++ b/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf
@@ -94,15 +94,18 @@ erl_xcomp_configure_flags="--without-termcap"
## CXXFLAGS - C++ compiler flags.
#CXXFLAGS=
-## LD - Linker
+## LD - Linker.
#LD=
## LDFLAGS - Linker flags.
#LDFLAGS=
-### -- Dynamic Erlang Driver linker flags. --
+## LIBS - Libraries.
+#LIBS=
-### NOTE! Either define all or non of the DED_LD* variables.
+### -- Dynamic Erlang Driver linker flags --
+
+### NOTE! Either set all or non of the DED_LD* variables.
## DED_LD - Linker.
#DED_LD=
@@ -115,14 +118,30 @@ erl_xcomp_configure_flags="--without-termcap"
## library at link time.
#DED_LD_FLAG_RUNTIME_LIBRARY_PATH=
+### -- Large file support --
+
+### NOTE! Either set all or non of the LFS_* variables.
+
+## LFS_CFLAGS - Large file support C compiler flags.
+#LFS_CFLAGS=
+
+## LFS_LDFLAGS - Large file support linker flags.
+#LFS_LDFLAGS=
+
+## LFS_LIBS - Large file support libraries.
+#LFS_LIBS=
+
### -- Other tools --
-## RANLIB - ranlib
+## RANLIB - `ranlib' archive index tool.
#RANLIB=
-## AR - ar
+## AR - `ar' archiving tool.
#AR=
+## GETCONF - `getconf' system configuration inspection tool.
+#GETCONF=
+
### ---- Cross System Root Locations ------------------------------------------
## erl_xcomp_sysroot - Absolute cross system root path.
@@ -147,6 +166,10 @@ erl_xcomp_sysroot="$TILERA_ROOT/tile"
### usually does not need to set these variables. Only set these if you really
### know what you are doing.
+### Note that some of these values will override results of tests performed
+### by `configure', and some will not be used until `configure' is sure that
+### it cannot figure the result out.
+
### The `configure' script will issue a warning when a default value is used.
### When a variable has been set, no warning will be issued.
diff --git a/xcomp/erl-xcomp-vxworks_ppc32.conf b/xcomp/erl-xcomp-vxworks_ppc32.conf
index fbd23c2fb9..aa7c652d80 100644
--- a/xcomp/erl-xcomp-vxworks_ppc32.conf
+++ b/xcomp/erl-xcomp-vxworks_ppc32.conf
@@ -94,15 +94,18 @@ CPP="$CC $CFLAGS -E"
## CXXFLAGS - C++ compiler flags.
#CXXFLAGS=
-## LD - Linker
+## LD - Linker.
LD="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ldppc"
## LDFLAGS - Linker flags.
LDFLAGS="-mlongcall"
-### -- Dynamic Erlang Driver linker flags. --
+## LIBS - Libraries.
+#LIBS=
-### NOTE! Either define all or non of the DED_LD* variables.
+### -- Dynamic Erlang Driver linker flags --
+
+### NOTE! Either set all or non of the DED_LD* variables.
## DED_LD - Linker.
#DED_LD=
@@ -115,14 +118,30 @@ LDFLAGS="-mlongcall"
## library at link time.
#DED_LD_FLAG_RUNTIME_LIBRARY_PATH=
+### -- Large file support --
+
+### NOTE! Either set all or non of the LFS_* variables.
+
+## LFS_CFLAGS - Large file support C compiler flags.
+#LFS_CFLAGS=
+
+## LFS_LDFLAGS - Large file support linker flags.
+#LFS_LDFLAGS=
+
+## LFS_LIBS - Large file support libraries.
+#LFS_LIBS=
+
### -- Other tools --
-## RANLIB - ranlib
+## RANLIB - `ranlib' archive index tool.
RANLIB="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ranlibppc"
-## AR - ar
+## AR - `ar' archiving tool.
AR="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/arppc"
+## GETCONF - `getconf' system configuration inspection tool.
+#GETCONF=
+
### ---- Cross System Root Locations ------------------------------------------
## erl_xcomp_sysroot - Absolute cross system root path.
@@ -147,6 +166,10 @@ AR="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/arppc"
### usually does not need to set these variables. Only set these if you really
### know what you are doing.
+### Note that some of these values will override results of tests performed
+### by `configure', and some will not be used until `configure' is sure that
+### it cannot figure the result out.
+
### The `configure' script will issue a warning when a default value is used.
### When a variable has been set, no warning will be issued.
diff --git a/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf b/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf
index b6730cff0a..1d57876172 100644
--- a/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf
+++ b/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf
@@ -94,15 +94,18 @@ CXX=x86_64-saf-g++
## CXXFLAGS - C++ compiler flags.
#CXXFLAGS=
-## LD - Linker
+## LD - Linker.
LD=x86_64-saf-ld
## LDFLAGS - Linker flags.
#LDFLAGS=
-### -- Dynamic Erlang Driver linker flags. --
+## LIBS - Libraries.
+#LIBS=
-### NOTE! Either define all or non of the DED_LD* variables.
+### -- Dynamic Erlang Driver linker flags --
+
+### NOTE! Either set all or non of the DED_LD* variables.
## DED_LD - Linker.
#DED_LD=
@@ -115,14 +118,30 @@ LD=x86_64-saf-ld
## library at link time.
#DED_LD_FLAG_RUNTIME_LIBRARY_PATH=
+### -- Large file support --
+
+### NOTE! Either set all or non of the LFS_* variables.
+
+## LFS_CFLAGS - Large file support C compiler flags.
+#LFS_CFLAGS=
+
+## LFS_LDFLAGS - Large file support linker flags.
+#LFS_LDFLAGS=
+
+## LFS_LIBS - Large file support libraries.
+#LFS_LIBS=
+
### -- Other tools --
-## RANLIB - ranlib
+## RANLIB - `ranlib' archive index tool.
RANLIB=x86_64-saf-ranlib
-## AR - ar
+## AR - `ar' archiving tool.
AR=x86_64-saf-ar
+## GETCONF - `getconf' system configuration inspection tool.
+#GETCONF=
+
### ---- Cross System Root Locations ------------------------------------------
## erl_xcomp_sysroot - Absolute cross system root path.
@@ -147,6 +166,10 @@ erl_xcomp_sysroot="$SAF_SYSROOT_X86_64"
### usually does not need to set these variables. Only set these if you really
### know what you are doing.
+### Note that some of these values will override results of tests performed
+### by `configure', and some will not be used until `configure' is sure that
+### it cannot figure the result out.
+
### The `configure' script will issue a warning when a default value is used.
### When a variable has been set, no warning will be issued.
diff --git a/xcomp/erl-xcomp.conf.template b/xcomp/erl-xcomp.conf.template
index 9242318577..afbef66af1 100644
--- a/xcomp/erl-xcomp.conf.template
+++ b/xcomp/erl-xcomp.conf.template
@@ -94,15 +94,18 @@
## CXXFLAGS - C++ compiler flags.
#CXXFLAGS=
-## LD - Linker
+## LD - Linker.
#LD=
## LDFLAGS - Linker flags.
#LDFLAGS=
-### -- Dynamic Erlang Driver linker flags. --
+## LIBS - Libraries.
+#LIBS=
-### NOTE! Either define all or non of the DED_LD* variables.
+### -- Dynamic Erlang Driver linker flags --
+
+### NOTE! Either set all or non of the DED_LD* variables.
## DED_LD - Linker.
#DED_LD=
@@ -115,14 +118,30 @@
## library at link time.
#DED_LD_FLAG_RUNTIME_LIBRARY_PATH=
+### -- Large file support --
+
+### NOTE! Either set all or non of the LFS_* variables.
+
+## LFS_CFLAGS - Large file support C compiler flags.
+#LFS_CFLAGS=
+
+## LFS_LDFLAGS - Large file support linker flags.
+#LFS_LDFLAGS=
+
+## LFS_LIBS - Large file support libraries.
+#LFS_LIBS=
+
### -- Other tools --
-## RANLIB - ranlib
+## RANLIB - `ranlib' archive index tool.
#RANLIB=
-## AR - ar
+## AR - `ar' archiving tool.
#AR=
+## GETCONF - `getconf' system configuration inspection tool.
+#GETCONF=
+
### ---- Cross System Root Locations ------------------------------------------
## erl_xcomp_sysroot - Absolute cross system root path.
@@ -147,6 +166,10 @@
### usually does not need to set these variables. Only set these if you really
### know what you are doing.
+### Note that some of these values will override results of tests performed
+### by `configure', and some will not be used until `configure' is sure that
+### it cannot figure the result out.
+
### The `configure' script will issue a warning when a default value is used.
### When a variable has been set, no warning will be issued.