diff options
author | Rickard Green <[email protected]> | 2010-02-03 12:56:25 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-02-03 19:04:55 +0100 |
commit | 1b78e85c9b6097f0d1940793e5fed4e08c0794f9 (patch) | |
tree | 10ede523234396673be3a77a8d5dbdee20dee696 | |
parent | 639e0b2ac0fb85335511efcf79327d1f4dfacbc3 (diff) | |
download | otp-1b78e85c9b6097f0d1940793e5fed4e08c0794f9.tar.gz otp-1b78e85c9b6097f0d1940793e5fed4e08c0794f9.tar.bz2 otp-1b78e85c9b6097f0d1940793e5fed4e08c0794f9.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.
47 files changed, 4979 insertions, 2310 deletions
diff --git a/Makefile.in b/Makefile.in index 8e97edfd84..2dcc89144d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,6 +27,9 @@ SHELL = /bin/sh # The top directory in which Erlang is unpacked ERL_TOP = @ERL_TOP@ +# OTP release +OTP = @OTP@ + # erts (Erlang RunTime System) version ERTS = @ERTS@ @@ -41,48 +44,105 @@ ERTS = @ERTS@ # configure. # -# prefix from autoconf, default is /usr/local (must be an absolute path) -prefix = @prefix@ -exec_prefix = @exec_prefix@ +# prefix from configure, default is /usr/local (must be an absolute path) +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +# Locations where we should install according to configure. These location +# may be prefixed by $(DESTDIR) and/or $(EXTRA_PREFIX) (see below). +bindir = @bindir@ +libdir = @libdir@ + +# Where Erlang/OTP is located +libdir_suffix = /erlang +erlang_libdir = $(libdir)$(libdir_suffix) +erlang_bindir = $(erlang_libdir)/bin -# The following can be set in case you install Erlang in a different -# location from where you have configured it to run. This can be -# useful e.g. when installing on a server that stores the files with a -# different path from where the clients access them. Or when building -# rpms. -#INSTALL_PREFIX = -# Naah...override `prefix' instead. +# +# By default we install relative symbolic links for $(ERL_BASE_PUB_FILES) +# from $(bindir) to $(erlang_bindir) as long as they are both prefixed +# by $(exec_prefix) (and are otherwise reasonable). This behavior can be +# overridden by passing BINDIR_SYMLINKS=<HOW>, where <HOW> is either +# absolute or relative. +# + +# $ make DESTDIR=<...> install +# +# DESTDIR can be set in case you want to install Erlang in a different +# location than where you have configured it to run. This can be +# useful, e.g. when installing on a server that stores the files with a +# different path than where the clients access them, when building +# rpms, or cross compiling, etc. DESTDIR will prefix the actual +# installation which will only be able to run once the DESTDIR prefix +# has disappeard, e.g. the part after DESTDIR has been packed and +# unpacked without DESTDIR. The name DESTDIR have been chosen since it +# is the GNU coding standard way of doing it. +# +# If INSTALL_PREFIX is set but not DESTDIR, DESTDIR will be set to +# INSTALL_PREFIX. INSTALL_PREFIX has been buggy for a long time. It was +# initially intended to have the same effect as DESTDIR. This effect was, +# however, lost even before it was first released :-( In all released OTP +# versions up to R13B03, INSTALL_PREFIX has behaved as EXTRA_PREFIX do +# today (see below). + +ifeq ($(DESTDIR),) +ifneq ($(INSTALL_PREFIX),) +DESTDIR=$(INSTALL_PREFIX) +endif +else +ifneq ($(INSTALL_PREFIX),) +ifneq ($(DESTDIR),$(INSTALL_PREFIX)) +$(error Both DESTDIR="$(DESTDIR)" and INSTALL_PREFIX="$(INSTALL_PREFIX)" have been set and have been set differently! Please, only set one of them) +endif +endif +endif -# The directory in which user executables (ERL_BASE_PUB_FILES) are put -BINDIR = $(INSTALL_PREFIX)@bindir@ +# $ make EXTRA_PREFIX=<...> install +# +# EXTRA_PREFIX behaves exactly as the buggy INSTALL_PREFIX behaved in +# pre R13B04 releases. It adds a prefix to all installation paths which +# will be used by the actuall installation. That is, the installation +# needs to be located at this location when run. This is useful if you +# want to try out the system, running test suites, etc, before doing the +# real install using the configuration you have set up using `configure'. +# A similar thing can be done by overriding `prefix' if only default +# installation directories are used. However, the installation can get +# sprawled out all over the place if the user use `--bindir', `--libdir', +# etc, and it is possible that `prefix' wont have any effect at all. That +# is, it is not at all the same thing as using EXTRA_PREFIX in the +# general case. It is also nice to be able to supply this feature if +# someone should have relied on the old buggy INSTALL_PREFIX. + +# The directory in which user executables (ERL_BASE_PUB_FILES) are installed +BINDIR = $(DESTDIR)$(EXTRA_PREFIX)$(bindir) # # Erlang base public files # ERL_BASE_PUB_FILES=erl erlc epmd run_erl to_erl dialyzer typer escript -# The directory which will contain installed Erlang version. -# (ILIBDIR is supposed to be LIBDIR *without* the install prefix) -ERLANG_LIBDIR = $(INSTALL_PREFIX)@libdir@/erlang -ERLANG_ILIBDIR = @libdir@/erlang +# ERLANG_INST_LIBDIR is the top directory where the Erlang installation +# will be located when running. +ERLANG_INST_LIBDIR=$(EXTRA_PREFIX)$(erlang_libdir) +ERLANG_INST_BINDIR= $(ERLANG_INST_LIBDIR)/bin -# You can *not* change these two, they have to stay this way for now. -ERLANG_BINDIR = $(ERLANG_LIBDIR)/bin -ERLANG_ERTSBINDIR = $(ERLANG_LIBDIR)/$(ERTS)/bin +# ERLANG_LIBDIR is the top directory where the Erlang installation is copied +# during installation. If DESTDIR != "", it cannot be run from this location. +ERLANG_LIBDIR = $(DESTDIR)$(ERLANG_INST_LIBDIR) # The directory in which man pages for above executables are put -ERL_MAN1DIR = $(INSTALL_PREFIX)@mandir@/man1 +ERL_MAN1DIR = $(DESTDIR)$(EXTRA_PREFIX)@mandir@/man1 ERL_MAN1EXT = 1 # The directory in which Erlang private man pages are put. In order # not to clutter up the man namespace these are by default put in the -# Erlang private directory $(ERLANG_ILIBDIR)/man. If you want to -# install the man pages together with the rest give the argument -# "--disable-erlang-mandir" when you run configure, which will set -# MAN_DIR to @mandir@. +# Erlang private directory $(ERLANG_LIBDIR)/man (\@erl_mandir\@ is set +# to $(erlang_libdir)/man). If you want to install the man pages +# together with the rest give the argument "--disable-erlang-mandir" +# when you run configure, which will set \@erl_mandir\@ to \@mandir\@. # If you want a special suffix on the manpages set ERL_MANEXT to # this suffix, e.g. "erl" -ERL_MANDIR = $(INSTALL_PREFIX)@erl_mandir@ +ERL_MANDIR = $(DESTDIR)$(EXTRA_PREFIX)@erl_mandir@ ERL_MANEXT = # ---------------------------------------------------------------------- @@ -93,6 +153,19 @@ MAKE = @MAKE_PROG@ # This should be set to the target "arch-vendor-os" export TARGET = @TARGET@ +BOOTSTRAP_ONLY = @BOOTSTRAP_ONLY@ + +CROSS_COMPILING = @CROSS_COMPILING@ +ifeq ($(CROSS_COMPILING),yes) +INSTALL_CROSS = -cross +else +ifneq ($(DESTDIR),) +INSTALL_CROSS = -cross +else +INSTALL_CROSS = +endif +endif + # A BSD compatible install program INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -107,6 +180,12 @@ RANLIB = @RANLIB@ # ---------------------------------------------------------------------- +# By default we require an Erlang/OTP of the same release as the one +# we cross compile. +ERL_XCOMP_FORCE_DIFFERENT_OTP = no + +# ---------------------------------------------------------------------- + # # The directory where at least the primary bootstrap is placed under. # @@ -136,6 +215,57 @@ BOOT_PREFIX=$(WIN32_WRAPPER_PATH):$(BOOTSTRAP_ROOT)/bootstrap/bin: else BOOT_PREFIX=$(BOOTSTRAP_ROOT)/bootstrap/bin: endif + +# ---------------------------------------------------------------------- + +# The following is currently only used for determining what to prevent +# usage of during strict install or release. +include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk +CC = @CC@ +LD = @LD@ +CXX = @CXX@ + +IBIN_DIR = $(ERL_TOP)/ibin +# +# If $(OTP_STRICT_INSTALL) equals `yes' we prefix the PATH with $(IBIN_DIR) +# when doing `release' or `install'. This directory contains `erlc', `gcc', +# `ld' etc, that unconditionally will fail if used. This is used during the +# daily builds in order to pick up on things being erroneously built during +# the `release' and `install' phases. +# +INST_FORBID = gcc g++ cc c++ cxx cl gcc.sh cc.sh ld ld.sh +INST_FORBID += javac.sh javac guavac gcj jikes bock +INST_FORBID += $(notdir $(CC)) $(notdir $(LD)) $(notdir $(CXX)) +INST_FORBID += $(notdir $(DED_CC)) $(notdir $(DED_LD)) +INST_FORBID += $(ERL_BASE_PUB_FILES) +IBIN_FILES = $(addprefix $(IBIN_DIR)/,$(sort $(INST_FORBID))) # sort will + # remove + # duplicates + +ifeq ($(OTP_STRICT_INSTALL),yes) + +INST_PATH_PREFIX=$(IBIN_DIR): +INST_DEP = strict_install +ifneq ($(CROSS_COMPILING),yes) +INST_DEP += strict_install_all_bootstraps +endif + +else # --- Normal case, i.e., not strict install --- + +# +# By default we allow build during install and release phase; therefore, +# make sure that the bootstrap system is available in the path. +# +INST_PATH_PREFIX=$(BOOT_PREFIX) +# If cross compiling `erlc', in path might have be used; therefore, +# avoid triggering a bootstrap build... +INST_DEP = +ifneq ($(CROSS_COMPILING),yes) +INST_DEP += all_bootstraps +endif + +endif # --- Normal case, i.e., not strict install --- + # ---------------------------------------------------------------------- # Fix up RELEASE_ROOT/TESTROOT havoc ifeq ($(RELEASE_ROOT),) @@ -164,13 +294,54 @@ endif # * build additional compilers and copy them into bootstrap/lib # * use the bootstrap erl and erlc to build all the libs # -all: all_bootstraps \ - libs local_setup dialyzer + +.PHONY: all bootstrap all_bootstraps + +ifneq ($(CROSS_COMPILING),yes) +# Not cross compiling + +ifeq ($(BOOTSTRAP_ONLY),yes) +all: bootstrap +else +# The normal case; not cross compiling, and not bootstrap only build. +all: bootstrap libs local_setup dialyzer +endif + +else +# Cross compiling + +all: cross_check_erl depend emulator libs start_scripts dialyzer + +endif + +cross_check_erl: + @PATH=$(BOOT_PREFIX)$${PATH} $(ERL_TOP)/make/cross_check_erl \ + -target $(TARGET) -otp $(OTP) -erl_top $(ERL_TOP) \ + -force $(ERL_XCOMP_FORCE_DIFFERENT_OTP) + +is_cross_configured: + @echo @CROSS_COMPILING@ + +target_configured: + @echo @TARGET@ + +bootstrap: depend all_bootstraps + + + +ifeq ($(OTP_STRICT_INSTALL),yes) + +.PHONY: strict_install_all_bootstraps + +strict_install_all_bootstraps: + $(MAKE) BOOT_PREFIX=$(INST_PATH_PREFIX) OTP_STRICT_INSTALL=$(OTP_STRICT_INSTALL) all_bootstraps + +endif # With all bootstraps we mean all bootstrapping that is done when # the system is delivered in open source, the primary # bootstrap is not included, it requires a pre built emulator... -all_bootstraps: depend emulator \ +all_bootstraps: emulator \ bootstrap_setup \ secondary_bootstrap_build secondary_bootstrap_copy \ tertiary_bootstrap_build tertiary_bootstrap_copy \ @@ -193,11 +364,15 @@ noboot_install: .PHONY: release release_docs -release: +release: $(INST_DEP) ifeq ($(OTP_SMALL_BUILD),true) - cd $(ERL_TOP)/lib && $(MAKE) TESTROOT=$(RELEASE_ROOT) release + cd $(ERL_TOP)/lib && \ + ERL_TOP=$(ERL_TOP) PATH=$(INST_PATH_PREFIX)$${PATH} \ + $(MAKE) TESTROOT=$(RELEASE_ROOT) release else - cd $(ERL_TOP)/lib && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) release + cd $(ERL_TOP)/lib && \ + ERL_TOP=$(ERL_TOP) PATH=$(INST_PATH_PREFIX)$${PATH} \ + $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) release ifneq ($(findstring vxworks,$(TARGET)),vxworks) @if test -f lib/dialyzer/SKIP ; then \ echo "=== Skipping dialyzer, reason:" ; \ @@ -205,11 +380,14 @@ ifneq ($(findstring vxworks,$(TARGET)),vxworks) echo "===" ; \ else \ cd $(ERL_TOP)/lib/dialyzer && \ - $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) release ; \ + ERL_TOP=$(ERL_TOP) PATH=$(INST_PATH_PREFIX)$${PATH} \ + $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) release ; \ fi endif endif - cd $(ERL_TOP)/erts && $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) release + cd $(ERL_TOP)/erts && \ + ERL_TOP=$(ERL_TOP) PATH=$(INST_PATH_PREFIX)$${PATH} \ + $(MAKE) BUILD_ALL=1 TESTROOT=$(RELEASE_ROOT) release # --------------------------------------------------------------- # Target only used when building commercial ERTS patches @@ -353,7 +531,6 @@ secondary_bootstrap_copy: cp $$x $$TF; \ true; \ done - rm -f lib/hipe/ebin/*.beam # if test -f lib/hipe/ebin/hipe.beam ; then cp lib/hipe/ebin/*.beam $(BOOTSTRAP_ROOT)/bootstrap/lib/hipe/ebin; fi if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools ; fi if test ! -d $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; then mkdir $(BOOTSTRAP_ROOT)/bootstrap/lib/parsetools/ebin ; fi @@ -654,9 +831,13 @@ primary_bootstrap_copy: KERNEL_PRELOAD = otp_ring0 init erl_prim_loader prim_inet prim_file zlib prim_zip erlang KERNEL_PRELOAD_BEAMS=$(KERNEL_PRELOAD:%=$(BOOTSTRAP_TOP)/lib/kernel/ebin/%.beam) +start_scripts: + @cd erts/start_scripts \ + && ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)$${PATH} $(MAKE) script + # Creates "erl" and "erlc" scripts in bin/erl which uses the libraries in lib local_setup: - @rm -f erts/bin/erl erts/bin/erlc erts/bin/cerl + @rm -f bin/erl bin/erlc bin/cerl @cd erts && \ ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)$${PATH} \ $(MAKE) local_setup @@ -729,7 +910,9 @@ bootstrap_nc_for_ne_no_debug_sym: # # Order is important here, don't change it! # -install: install.dirs install.emulator install.libs install.Install install.bin +INST_DEP += install.dirs install.emulator install.libs install.Install install.bin + +install: $(INST_DEP) install-docs: ERL_TOP=$(ERL_TOP) INSTALLROOT=$(ERLANG_LIBDIR) PATH=$(BOOT_PREFIX)$${PATH} \ @@ -738,17 +921,17 @@ install-docs: install.emulator: cd erts && \ - ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)$${PATH} \ + ERL_TOP=$(ERL_TOP) PATH=$(INST_PATH_PREFIX)$${PATH} \ $(MAKE) TESTROOT=$(ERLANG_LIBDIR) release install.libs: ifeq ($(OTP_SMALL_BUILD),true) cd lib && \ - ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)$${PATH} \ + ERL_TOP=$(ERL_TOP) PATH=$(INST_PATH_PREFIX)$${PATH} \ $(MAKE) TESTROOT=$(ERLANG_LIBDIR) release else cd lib && \ - ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)$${PATH} \ + ERL_TOP=$(ERL_TOP) PATH=$(INST_PATH_PREFIX)$${PATH} \ $(MAKE) TESTROOT=$(ERLANG_LIBDIR) BUILD_ALL=true release @if test -f lib/dialyzer/SKIP ; then \ echo "=== Skipping dialyzer, reason:" ; \ @@ -756,22 +939,27 @@ else echo "===" ; \ else \ cd lib/dialyzer && \ - ERL_TOP=$(ERL_TOP) PATH=$(BOOT_PREFIX)$${PATH} \ + ERL_TOP=$(ERL_TOP) PATH=$(INST_PATH_PREFIX)$${PATH} \ $(MAKE) TESTROOT=$(ERLANG_LIBDIR) BUILD_ALL=true release ; \ fi endif install.Install: - cd $(ERLANG_LIBDIR) && ./Install -minimal $(ERLANG_LIBDIR) + (cd $(ERLANG_LIBDIR) \ + && ./Install $(INSTALL_CROSS) -minimal $(ERLANG_INST_LIBDIR)) # # Install erlang base public files # + install.bin: - for file in $(ERL_BASE_PUB_FILES); do \ - rm -f $(BINDIR)/$$file; \ - ${LN_S} $(ERLANG_BINDIR)/$$file $(BINDIR)/$$file; \ - done + @ DESTDIR="$(DESTDIR)" EXTRA_PREFIX="$(EXTRA_PREFIX)" \ + LN_S="$(LN_S)" BINDIR_SYMLINKS="$(BINDIR_SYMLINKS)" \ + $(ERL_TOP)/make/install_bin \ + --bindir "$(bindir)" \ + --erlang-bindir "$(erlang_bindir)" \ + --exec-prefix "$(exec_prefix)" \ + $(ERL_BASE_PUB_FILES) # # Directories needed before we can install @@ -781,6 +969,17 @@ install.dirs: ${MKSUBDIRS} $(ERLANG_LIBDIR) ${MKSUBDIRS} $(ERLANG_LIBDIR)/usr/lib +.PHONY: strict_install + +strict_install: $(IBIN_DIR) $(IBIN_FILES) + +$(IBIN_FILES): $(ERL_TOP)/make/unexpected_use + rm -f $@ + (cd $(dir $@) && $(LN_S) $(ERL_TOP)/make/unexpected_use $(notdir $@)) + +$(IBIN_DIR): + $(MKSUBDIRS) $@ + # ---------------------------------------------------------------------- .PHONY: clean eclean bootstrap_root_clean bootstrap_clean @@ -790,7 +989,7 @@ install.dirs: # clean: check_recreate_primary_bootstrap - rm -f *~ *.bak config.log config.status prebuilt.files + rm -f *~ *.bak config.log config.status prebuilt.files ibin/* find . -type f -name SKIP -print | xargs $(RM) cd erts && ERL_TOP=$(ERL_TOP) $(MAKE) clean cd lib && ERL_TOP=$(ERL_TOP) $(MAKE) clean BUILD_ALL=true @@ -13,7 +13,7 @@ The source code for Erlang/OTP can also be found in a Git repository: %CopyrightBegin% -Copyright Ericsson AB 1998-2009. All Rights Reserved. +Copyright Ericsson AB 1998-2010. All Rights Reserved. The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in @@ -221,9 +221,87 @@ Step 5 builds the Erlang/OTP system. On a fast computer, this will take about Erlang/OTP system which you can try by typing "bin/erl". This should start up Erlang/OTP and give you a prompt. -Step 6 is optional. It installs Erlang/OTP (if you change your -mind about where you wish to install you can rerun step 4, without -having to do step 5 again). +Step 6 is optional. It installs Erlang/OTP at a standardized location (if you +change your mind about where you wish to install you can rerun step 4, +without having to do step 5 again). + +Alternative installation procedures: +* Staged install using DESTDIR. You can perform the install phase in a + temporary directory and later move the installation into its correct location + by use of the DESTDIR variable: 'make DESTDIR=<tmp install dir> install' + The installation will be created in a location prefixed by $DESTDIR. It + can, however, not be run from there. It needs to be moved into the correct + location before it can be run. If DESTDIR have not been set but INSTALL_PREFIX + has been set, DESTDIR will be set to INSTALL_PREFIX. Note that INSTALL_PREFIX + in pre R13B04 was buggy and behaved as EXTRA_PREFIX (see below). There are + lots of areas of use for an installation procedure using DESTDIR, e.g. when + creating a package, cross compiling, etc. Here is an example where the + installation should be located under /opt/local: + $ ./configure --prefix=/opt/local + $ make + $ mkdir /tmp/erlang-build + $ make DESTDIR=/tmp/erlang-build install + $ cd /tmp/erlang-build/opt/local + $ # gnu-tar is used in this example + $ tar -zcf /home/me/my-erlang-build.tgz * + $ su - + Password: ***** + $ cd /opt/local + $ tar -zxf /home/me/my-erlang-build.tgz +* Test install using EXTRA_PREFIX. Note that EXTRA_PREFIX is similar to + DESTDIR, but it does not have the same effect as DESTDIR. The EXTRA_PREFIX + variable will prefix all installation paths, and the installation can and + have to be run from there. That is, it can be useful if you want to try the + system out, running test suites, etc, before doing the real install without + EXTRA_PREFIX. +* Install using the `release' target. Instead of doing `make install' you can + creat the installation in whatever directory you like using the `release' + target and run the `Install' script yourself. RELEASE_ROOT is used for + specifying the directory where the installation should be created. This is + what by default ends up under `/usr/local/lib/erlang' if you do the install + using `make install'. All installation paths provided in the `configure' + phase are ignored, as well as DESTDIR, and INSTALL_PREFIX. If you want links + from a specific `bin' directory to the installation you have to set those up + yourself. An example where Erlang/OTP should be located at /home/me/OTP: + $ ./configure + $ make + $ make RELEASE_ROOT=/home/me/OTP release + $ cd /home/me/OTP + $ ./Install -minimal /home/me/OTP + $ mkdir -p /home/me/bin + $ cd /home/me/bin + $ ln -s /home/me/OTP/bin/erl erl + $ ln -s /home/me/OTP/bin/erlc erlc + $ ln -s /home/me/OTP/bin/escript escript + ... + The `Install' script should currently be invoked as follows in the + directory where it resides: + `./Install [-cross] [-minimal|-sasl] <ERL_ROOT>' + where: + -minimal - Creates an installation that starts up a minimal amount + of applications, i.e., only kernel and stdlib are started. + The minimal system is normally enough. + -sasl - Creates an installation that also starts up the sasl + application. + -cross - For cross compilation. Informs the install script that it + is run on the build machine. + <ERL_ROOT> - The absolute path to the Erlang installation to use at run + time. This is often the same as the current working + directory, but does not have to be. It can follow any other + path through the file system to the same directory. + + If neither -minimal, nor -sasl is passed as argument you will be prompted. + +When doing `make install' and the default installation prefix is used, relative +symbolic links will be created from /usr/local/bin to all public executables in +the Erlang installation. The installation phase will try to create relative +symbolic links as long as `--bindir' and the Erlang bin directory, located under +`--libdir', both have `--exec-prefix' as prefix. Where `--exec-prefix' +defaults to `--prefix'. `--prefix', `--exec-prefix', `--bindir', and `--libdir' +are all arguments that can be passed to `configure'. One can however force +relative, or absolute links by passing BINDIR_SYMLINKS=relative|absolute +as arguments to make during the install phase. Note that such a request might +cause a failure if the request cannot be satisfied. The source tree is delivered with a lot of platform independent build results already pre-built. If you want to remove these pre-built diff --git a/TAR.include b/TAR.include index 6446b5de94..78be579869 100644 --- a/TAR.include +++ b/TAR.include @@ -4,12 +4,15 @@ Makefile.in README README.win32 configure.in +aclocal.m4 otp_build lib/Makefile lib/configure lib/configure.in +lib/configure.in.src prebuild.skip prebuild.delete +erl-build-tool-vars.sh bootstrap/lib/*/ebin bootstrap/lib/*/include bootstrap/bin/start*.script diff --git a/aclocal.m4 b/aclocal.m4 new file mode 120000 index 0000000000..32ceb26f5a --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1 @@ +erts/aclocal.m4
\ No newline at end of file diff --git a/configure.in b/configure.in index 7ddffd85ad..19ef304a1a 100644 --- a/configure.in +++ b/configure.in @@ -1,8 +1,28 @@ dnl Process this file with autoconf to produce a configure script. + +dnl %CopyrightBegin% +dnl +dnl Copyright Ericsson AB 1998-2010. All Rights Reserved. +dnl +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. +dnl +dnl %CopyrightEnd% + AC_PREREQ(2.8)dnl AC_INIT() +LM_PRECIOUS_VARS + default_cache_file=./config.cache if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then @@ -19,6 +39,18 @@ if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then cache_file=/dev/null fi +case "X$ERL_TOP" in + X) + ;; + X/*) + test -f $ERL_TOP/erts/emulator/beam/beam_emu.c || { + AC_MSG_ERROR([Invalid \$ERL_TOP]) + } + srcdir="$ERL_TOP";; + *) + AC_MSG_ERROR([\$ERL_TOP needs to be absolute]);; +esac + dnl How to set srcdir absolute is taken from the GNU Emacs distribution #### Make srcdir absolute, if it isn't already. It's important to #### avoid running the path through pwd unnecessary, since pwd can @@ -43,7 +75,7 @@ esac # # Now srcdir is absolute and also the top of Erlang distribution, ERL_TOP. # -ERL_TOP=${srcdir} +test "X$ERL_TOP" != "X" || ERL_TOP="$srcdir" AC_SUBST(ERL_TOP) dnl @@ -65,11 +97,35 @@ fi TARGET=$host AC_SUBST(TARGET) +if test X$cross_compiling = Xyes; then + CROSS_COMPILING=yes +else + CROSS_COMPILING=no +fi +AC_SUBST(CROSS_COMPILING) + + +AC_ARG_ENABLE(bootstrap-only, +[ --enable-bootstrap-only enable bootstrap only configuration], +[ if test "X$enableval" = "Xyes"; then + BOOTSTRAP_ONLY=yes + else + BOOTSTRAP_ONLY=no + fi +], +BOOTSTRAP_ONLY=no) + +AC_SUBST(BOOTSTRAP_ONLY) + +if test $CROSS_COMPILING = yes -a $BOOTSTRAP_ONLY = yes; then + AC_MSG_ERROR([Cannot both cross compile and build a bootstrap system]) +fi dnl Checks for programs. AC_PROG_CC - +AC_PROG_CXX +AC_CHECK_TOOL(LD, [ld]) # # We need GNU make, complain if we can't find it @@ -123,11 +179,17 @@ AC_PROG_LN_S AC_PROG_RANLIB # -# Get erts version from erts/vsn.mk +# Get erts version and otp release from erts/vsn.mk # -[ERTS=erts-`sed -n 's/^VSN[ ]*=[ ]*\([0-9.]\)/\1/p' < erts/vsn.mk`] +AC_MSG_CHECKING([ERTS version]) +[ERTS=erts-`sed -n "s/^VSN[ ]*=[ ]*\(.*\)/\1/p" < $ERL_TOP/erts/vsn.mk`] +AC_MSG_RESULT([$ERTS]) AC_SUBST(ERTS) +AC_MSG_CHECKING([OTP release]) +[OTP=OTP-`sed -n "s/^SYSTEM_VSN[ ]*=[ ]*\(.*\)/\1/p" < $ERL_TOP/erts/vsn.mk`] +AC_MSG_RESULT([$OTP]) +AC_SUBST(OTP) AC_ARG_ENABLE(threads, [ --enable-threads enable async thread support @@ -147,6 +209,11 @@ AC_ARG_ENABLE(kernel-poll, AC_ARG_ENABLE(hipe, [ --enable-hipe enable hipe support --disable-hipe disable hipe support]) + +AC_ARG_WITH(javac, +[ --with-javac=JAVAC specify Java compiler to use + --with-javac use a Java compiler if found (default) + --without-javac don't use any Java compiler]) AC_ARG_ENABLE(megaco_flex_scanner_lineno, [ --enable-megaco-flex-scanner-lineno enable megaco flex scanner lineno @@ -176,8 +243,8 @@ AC_ARG_ENABLE(erlang-mandir, [ --disable-erlang-mandir do not install Erlang man pages in a private directory], [ case "$enableval" in no) erl_mandir=$mandir ;; - *) erl_mandir='$(ERLANG_ILIBDIR)/man' ;; - esac ], erl_mandir='$(ERLANG_ILIBDIR)/man') + *) erl_mandir='$(erlang_libdir)/man' ;; + esac ], erl_mandir='$(erlang_libdir)/man') AC_SUBST(erl_mandir) AC_ARG_ENABLE(darwin-universal, diff --git a/erl-build-tool-vars.sh b/erl-build-tool-vars.sh new file mode 100644 index 0000000000..c6f25d7f79 --- /dev/null +++ b/erl-build-tool-vars.sh @@ -0,0 +1,28 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2010. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# + +# +# erl_build_tool_vars - Build tool configuration variables currently +# reqognized by `configure' scripts in OTP. +# +# NOTE: +# 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" diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 index e9a0cc228f..8002ed3d34 100644 --- a/erts/aclocal.m4 +++ b/erts/aclocal.m4 @@ -1,19 +1,19 @@ dnl dnl %CopyrightBegin% -dnl -dnl Copyright Ericsson AB 1998-2009. All Rights Reserved. -dnl +dnl +dnl Copyright Ericsson AB 1998-2010. All Rights Reserved. +dnl dnl The contents of this file are subject to the Erlang Public License, dnl Version 1.1, (the "License"); you may not use this file except in dnl compliance with the License. You should have received a copy of the dnl Erlang Public License along with this software. If not, it can be dnl retrieved online at http://www.erlang.org/. -dnl +dnl dnl Software distributed under the License is distributed on an "AS IS" dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See dnl the License for the specific language governing rights and limitations dnl under the License. -dnl +dnl dnl %CopyrightEnd% dnl @@ -25,6 +25,63 @@ dnl could/should be part of autoconf are prefixed LM_, macros specific dnl to the Erlang system are prefixed ERL_. dnl +AC_DEFUN(LM_PRECIOUS_VARS, +[ + +dnl ERL_TOP +AC_ARG_VAR(ERL_TOP, [Erlang/OTP top source directory]) + +dnl Tools +AC_ARG_VAR(CC, [C compiler]) +AC_ARG_VAR(CFLAGS, [C compiler flags]) +AC_ARG_VAR(STATIC_CFLAGS, [C compiler static flags]) +AC_ARG_VAR(CFLAG_RUNTIME_LIBRARY_PATH, [runtime library path linker flag passed via C compiler]) +AC_ARG_VAR(CPP, [C/C++ preprocessor]) +AC_ARG_VAR(CPPFLAGS, [C/C++ preprocessor flags]) +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(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(RANLIB, [ranlib]) +AC_ARG_VAR(AR, [ar]) + +dnl Cross system root +AC_ARG_VAR(erl_xcomp_sysroot, [Absolute cross system root path (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_isysroot, [Absolute cross system root include path (only used when cross compiling)]) + +dnl Cross compilation variables +AC_ARG_VAR(erl_xcomp_bigendian, [big endian system: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_clock_gettime_correction, [clock_gettime() can be used for time correction: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_nptl, [have Native POSIX Thread Library: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_usable_sigusrx, [SIGUSR1 and SIGUSR2 can be used: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_linux_usable_sigaltstack, [have working sigaltstack(): yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_poll, [have working poll(): yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_kqueue, [have working kqueue(): yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_putenv_copy, [putenv() stores key-value copy: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_reliable_fpe, [have reliable floating point exceptions: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_getaddrinfo, [have working getaddrinfo() for both IPv4 and IPv6: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_gethrvtime_procfs_ioctl, [have working gethrvtime() which can be used with procfs ioctl(): yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_clock_gettime_cpu_time, [clock_gettime() can be used for retrieving process CPU time: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_after_morecore_hook, [__after_morecore_hook can track malloc()s core memory usage: yes|no (only used when cross compiling)]) +AC_ARG_VAR(erl_xcomp_dlsym_brk_wrappers, [dlsym(RTLD_NEXT, _) brk wrappers can track malloc()s core memory usage: yes|no (only used when cross compiling)]) + +]) + +AC_DEFUN(ERL_XCOMP_SYSROOT_INIT, +[ +erl_xcomp_without_sysroot=no +if test "$cross_compiling" = "yes"; then + test "$erl_xcomp_sysroot" != "" || erl_xcomp_without_sysroot=yes + test "$erl_xcomp_isysroot" != "" || erl_xcomp_isysroot="$erl_xcomp_sysroot" +else + erl_xcomp_sysroot= + erl_xcomp_isysroot= +fi +]) + dnl ---------------------------------------------------------------------- dnl dnl LM_FIND_EMU_CC @@ -113,11 +170,15 @@ dnl ---------------------------------------------------------------------- dnl dnl LM_PROG_INSTALL_DIR dnl +dnl This macro may be used by any OTP application. +dnl dnl Figure out how to create directories with parents. dnl (In my opinion INSTALL_DIR is a bad name, MKSUBDIRS or something is better) dnl dnl We prefer 'install -d', but use 'mkdir -p' if it exists. dnl If none of these methods works, we give up. +dnl + AC_DEFUN(LM_PROG_INSTALL_DIR, [AC_CACHE_CHECK(how to create a directory including parents, @@ -412,189 +473,84 @@ fi dnl ---------------------------------------------------------------------- dnl -dnl ERL_FIND_ETHR_LIB +dnl LM_CHECK_THR_LIB dnl -dnl Find a thread library to use. Sets ETHR_LIBS to libraries to link -dnl with, ETHR_X_LIBS to extra libraries to link with (same as ETHR_LIBS -dnl except that the ethread lib itself is not included), ETHR_DEFS to -dnl defines to compile with, ETHR_THR_LIB_BASE to the name of the -dnl thread library which the ethread library is based on, and ETHR_LIB_NAME -dnl to the name of the library where the ethread implementation is located. -dnl ERL_FIND_ETHR_LIB currently searches for 'pthreads', and -dnl 'win32_threads'. If no thread library was found ETHR_LIBS, ETHR_X_LIBS, -dnl ETHR_DEFS, ETHR_THR_LIB_BASE, and ETHR_LIB_NAME are all set to the -dnl empty string. +dnl This macro may be used by any OTP application. +dnl +dnl LM_CHECK_THR_LIB sets THR_LIBS, THR_DEFS, and THR_LIB_NAME. It also +dnl checks for some pthread headers which will appear in DEFS or config.h. dnl -AC_DEFUN(ERL_FIND_ETHR_LIB, +AC_DEFUN(LM_CHECK_THR_LIB, [ -ethr_modified_default_stack_size= - -dnl Name of lib where ethread implementation is located -ethr_lib_name=ethread - -ETHR_THR_LIB_BASE= -ETHR_THR_LIB_BASE_NAME= -ETHR_X_LIBS= -ETHR_LIBS= -ETHR_LIB_NAME= -ETHR_DEFS= - -dnl if test "x$host_os" = "x"; then -dnl AC_CANONICAL_HOST -dnl fi - dnl win32? AC_MSG_CHECKING([for native win32 threads]) if test "X$host_os" = "Xwin32"; then AC_MSG_RESULT(yes) - # * _WIN32_WINNT >= 0x0400 is needed for - # TryEnterCriticalSection - # * _WIN32_WINNT >= 0x0403 is needed for - # InitializeCriticalSectionAndSpinCount - # The ethread lib will refuse to build if _WIN32_WINNT < 0x0403. - # - # -D_WIN32_WINNT should have been defined in $CPPFLAGS; fetch it - # and save it in ETHR_DEFS. - found_win32_winnt=no - for cppflag in $CPPFLAGS; do - case $cppflag in - -DWINVER*) - ETHR_DEFS="$ETHR_DEFS $cppflag" - ;; - -D_WIN32_WINNT*) - ETHR_DEFS="$ETHR_DEFS $cppflag" - found_win32_winnt=yes - ;; - *) - ;; - esac - done - if test $found_win32_winnt = no; then - AC_MSG_ERROR([-D_WIN32_WINNT missing in CPPFLAGS]) - fi - ETHR_X_LIBS= - ETHR_THR_LIB_BASE=win32_threads - AC_DEFINE(ETHR_WIN32_THREADS, 1, [Define if you have win32 threads]) + THR_DEFS="-DWIN32_THREADS" + THR_LIBS= + THR_LIB_NAME=win32_threads else AC_MSG_RESULT(no) + THR_DEFS= + THR_LIBS= + THR_LIB_NAME= dnl Try to find POSIX threads dnl The usual pthread lib... - AC_CHECK_LIB(pthread, pthread_create, ETHR_X_LIBS="-lpthread") + AC_CHECK_LIB(pthread, pthread_create, THR_LIBS="-lpthread") dnl FreeBSD has pthreads in special c library, c_r... - if test "x$ETHR_X_LIBS" = "x"; then - AC_CHECK_LIB(c_r, pthread_create, ETHR_X_LIBS="-lc_r") + if test "x$THR_LIBS" = "x"; then + AC_CHECK_LIB(c_r, pthread_create, THR_LIBS="-lc_r") fi dnl On ofs1 the '-pthread' switch should be used - if test "x$ETHR_X_LIBS" = "x"; then + if test "x$THR_LIBS" = "x"; then AC_MSG_CHECKING([if the '-pthread' switch can be used]) saved_cflags=$CFLAGS CFLAGS="$CFLAGS -pthread" AC_TRY_LINK([#include <pthread.h>], pthread_create((void*)0,(void*)0,(void*)0,(void*)0);, - [ETHR_DEFS="-pthread" - ETHR_X_LIBS="-pthread"]) + [THR_DEFS="-pthread" + THR_LIBS="-pthread"]) CFLAGS=$saved_cflags - if test "x$ETHR_X_LIBS" != "x"; then + if test "x$THR_LIBS" != "x"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi fi - if test "x$ETHR_X_LIBS" != "x"; then - ETHR_DEFS="$ETHR_DEFS -D_THREAD_SAFE -D_REENTRANT" - ETHR_THR_LIB_BASE=pthread - AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads]) + if test "x$THR_LIBS" != "x"; then + THR_DEFS="$THR_DEFS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS" + THR_LIB_NAME=pthread case $host_os in - openbsd*) - # The default stack size is insufficient for our needs - # on OpenBSD. We increase it to 256 kilo words. - ethr_modified_default_stack_size=256;; solaris*) - ETHR_DEFS="$ETHR_DEFS -D_POSIX_PTHREAD_SEMANTICS" ;; + THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS" ;; linux*) - ETHR_DEFS="$ETHR_DEFS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_GNU_SOURCE" - - if test X$cross_compiling = Xyes; then - if test "X$erl_xcomp_linux_usable_sigusrx" = "X"; then - usable_sigusrx=yes - usable_sigusrx_guessed=yes - else - usable_sigusrx=$erl_xcomp_linux_usable_sigusrx - usable_sigusrx_guessed=no - fi - if test "X$erl_xcomp_linux_usable_sigaltstack" = "X"; then - usable_sigaltstack=yes - usable_sigaltstack_guessed=yes - else - usable_sigaltstack=$erl_xcomp_linux_usable_sigaltstack - usable_sigaltstack_guessed=no - fi - else - # FIXME: Test for actual problems instead of kernel versions - linux_kernel_vsn_=`uname -r` - case $linux_kernel_vsn_ in - [[0-1]].*|2.[[0-1]]|2.[[0-1]].*) - usable_sigusrx=no - usable_sigaltstack=no;; - 2.[[2-3]]|2.[[2-3]].*) - usable_sigusrx=yes - usable_sigaltstack=no;; - *) - usable_sigusrx=yes - usable_sigaltstack=yes;; - esac - usable_sigusrx_guessed=no - usable_sigaltstack_guessed=no - fi - - AC_MSG_CHECKING(if SIGUSR1 and SIGUSR2 can be used) - AC_MSG_RESULT($usable_sigusrx) - if test $usable_sigusrx_guessed = yes; then - AC_MSG_WARN([result $usable_sigusrx guessed because of cross compilation]) - fi - if test $usable_sigusrx = no; then - ETHR_DEFS="$ETHR_DEFS -DETHR_UNUSABLE_SIGUSRX" - fi - - AC_MSG_CHECKING(if sigaltstack can be used) - AC_MSG_RESULT($usable_sigaltstack) - if test $usable_sigaltstack_guessed = yes; then - AC_MSG_WARN([result $usable_sigaltstack guessed because of cross compilation]) - fi - if test $usable_sigaltstack = no; then - ETHR_DEFS="$ETHR_DEFS -DETHR_UNUSABLE_SIGALTSTACK" - fi + THR_DEFS="$THR_DEFS -D_POSIX_THREAD_SAFE_FUNCTIONS" AC_MSG_CHECKING(for Native POSIX Thread Library) if test X$cross_compiling = Xyes; then - if test "X$erl_xcomp_linux_nptl" = "X"; then - nptl=yes - nptl_guessed=yes - else - nptl=$erl_xcomp_linux_nptl - nptl_guessed=no - fi + case X$erl_xcomp_linux_nptl in + X) nptl=cross;; + Xyes|Xno) 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_guessed=no fi AC_MSG_RESULT($nptl) - if test $nptl_guessed = yes; then - AC_MSG_WARN([result $nptl guessed because of cross compilation]) - fi - if test $nptl = yes; then - ETHR_THR_LIB_BASE_NAME=nptl + if test $nptl = cross; then + nptl=yes + AC_MSG_WARN([result yes guessed because of cross compilation]) fi if test $nptl = yes; then need_nptl_incldir=no @@ -604,6 +560,11 @@ dnl On ofs1 the '-pthread' switch should be used nptl_path="$C_INCLUDE_PATH:$CPATH" if test X$cross_compiling != Xyes; then nptl_path="$nptl_path:/usr/local/include:/usr/include" + else + IROOT="$erl_xcomp_isysroot" + test "$IROOT" != "" || IROOT="$erl_xcomp_sysroot" + test "$IROOT" != "" || AC_MSG_ERROR([Don't know where to search for includes! Please set erl_xcomp_isysroot]) + nptl_path="$nptl_path:$IROOT/usr/local/include:$IROOT/usr/include" fi nptl_ws_path= save_ifs="$IFS"; IFS=":" @@ -618,7 +579,7 @@ dnl On ofs1 the '-pthread' switch should be used AC_CHECK_HEADER($dir/nptl/pthread.h, nptl_incldir=$dir/nptl) if test "x$nptl_incldir" != "x"; then - ETHR_DEFS="$ETHR_DEFS -isystem $nptl_incldir" + THR_DEFS="$THR_DEFS -isystem $nptl_incldir" break fi done @@ -627,6 +588,158 @@ dnl On ofs1 the '-pthread' switch should be used fi fi fi + ;; + *) ;; + esac + + dnl We sometimes need THR_DEFS in order to find certain headers + dnl (at least for pthread.h on osf1). + saved_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $THR_DEFS" + + dnl + dnl Check for headers + dnl + + AC_CHECK_HEADER(pthread.h, + AC_DEFINE(HAVE_PTHREAD_H, 1, \ +[Define if you have the <pthread.h> header file.])) + + dnl Some Linuxes have <pthread/mit/pthread.h> instead of <pthread.h> + AC_CHECK_HEADER(pthread/mit/pthread.h, \ + AC_DEFINE(HAVE_MIT_PTHREAD_H, 1, \ +[Define if the pthread.h header file is in pthread/mit directory.])) + + dnl restore CPPFLAGS + CPPFLAGS=$saved_cppflags + + fi +fi + +]) + +dnl ---------------------------------------------------------------------- +dnl +dnl ERL_FIND_ETHR_LIB +dnl +dnl NOTE! This macro may be changed at any time! Should *only* be used by +dnl ERTS! +dnl +dnl Find a thread library to use. Sets ETHR_LIBS to libraries to link +dnl with, ETHR_X_LIBS to extra libraries to link with (same as ETHR_LIBS +dnl except that the ethread lib itself is not included), ETHR_DEFS to +dnl defines to compile with, ETHR_THR_LIB_BASE to the name of the +dnl thread library which the ethread library is based on, and ETHR_LIB_NAME +dnl to the name of the library where the ethread implementation is located. +dnl ERL_FIND_ETHR_LIB currently searches for 'pthreads', and +dnl 'win32_threads'. If no thread library was found ETHR_LIBS, ETHR_X_LIBS, +dnl ETHR_DEFS, ETHR_THR_LIB_BASE, and ETHR_LIB_NAME are all set to the +dnl empty string. +dnl + +AC_DEFUN(ERL_FIND_ETHR_LIB, +[ + +LM_CHECK_THR_LIB + +ETHR_THR_LIB_BASE="$THR_LIB_NAME" +ETHR_DEFS="$THR_DEFS" +ETHR_X_LIBS="$THR_LIBS" +ETHR_LIBS= +ETHR_LIB_NAME= + +ethr_modified_default_stack_size= + +dnl Name of lib where ethread implementation is located +ethr_lib_name=ethread + +case "$THR_LIB_NAME" in + + win32_threads) + # * _WIN32_WINNT >= 0x0400 is needed for + # TryEnterCriticalSection + # * _WIN32_WINNT >= 0x0403 is needed for + # InitializeCriticalSectionAndSpinCount + # The ethread lib will refuse to build if _WIN32_WINNT < 0x0403. + # + # -D_WIN32_WINNT should have been defined in $CPPFLAGS; fetch it + # and save it in ETHR_DEFS. + found_win32_winnt=no + for cppflag in $CPPFLAGS; do + case $cppflag in + -DWINVER*) + ETHR_DEFS="$ETHR_DEFS $cppflag" + ;; + -D_WIN32_WINNT*) + ETHR_DEFS="$ETHR_DEFS $cppflag" + found_win32_winnt=yes + ;; + *) + ;; + esac + done + if test $found_win32_winnt = no; then + AC_MSG_ERROR([-D_WIN32_WINNT missing in CPPFLAGS]) + fi + AC_DEFINE(ETHR_WIN32_THREADS, 1, [Define if you have win32 threads]) + ;; + + pthread) + AC_DEFINE(ETHR_PTHREADS, 1, [Define if you have pthreads]) + case $host_os in + openbsd*) + # The default stack size is insufficient for our needs + # on OpenBSD. We increase it to 256 kilo words. + ethr_modified_default_stack_size=256;; + linux*) + ETHR_DEFS="$ETHR_DEFS -D_GNU_SOURCE" + + if test X$cross_compiling = Xyes; then + case X$erl_xcomp_linux_usable_sigusrx in + X) usable_sigusrx=cross;; + Xyes|Xno) usable_sigusrx=$erl_xcomp_linux_usable_sigusrx;; + *) AC_MSG_ERROR([Bad erl_xcomp_linux_usable_sigusrx value: $erl_xcomp_linux_usable_sigusrx]);; + esac + case X$erl_xcomp_linux_usable_sigaltstack in + X) usable_sigaltstack=cross;; + Xyes|Xno) usable_sigaltstack=$erl_xcomp_linux_usable_sigaltstack;; + *) AC_MSG_ERROR([Bad erl_xcomp_linux_usable_sigaltstack value: $erl_xcomp_linux_usable_sigaltstack]);; + esac + else + # FIXME: Test for actual problems instead of kernel versions + linux_kernel_vsn_=`uname -r` + case $linux_kernel_vsn_ in + [[0-1]].*|2.[[0-1]]|2.[[0-1]].*) + usable_sigusrx=no + usable_sigaltstack=no;; + 2.[[2-3]]|2.[[2-3]].*) + usable_sigusrx=yes + usable_sigaltstack=no;; + *) + usable_sigusrx=yes + usable_sigaltstack=yes;; + esac + fi + + AC_MSG_CHECKING(if SIGUSR1 and SIGUSR2 can be used) + AC_MSG_RESULT($usable_sigusrx) + if test $usable_sigusrx = cross; then + usable_sigusrx=yes + AC_MSG_WARN([result yes guessed because of cross compilation]) + fi + if test $usable_sigusrx = no; then + ETHR_DEFS="$ETHR_DEFS -DETHR_UNUSABLE_SIGUSRX" + fi + + AC_MSG_CHECKING(if sigaltstack can be used) + AC_MSG_RESULT($usable_sigaltstack) + if test $usable_sigaltstack = cross; then + usable_sigaltstack=yes + AC_MSG_WARN([result yes guessed because of cross compilation]) + fi + if test $usable_sigaltstack = no; then + ETHR_DEFS="$ETHR_DEFS -DETHR_UNUSABLE_SIGALTSTACK" + fi AC_DEFINE(ETHR_INIT_MUTEX_IN_CHILD_AT_FORK, 1, \ [Define if mutexes should be reinitialized (instead of unlocked) in child at fork.]) ;; @@ -635,20 +748,18 @@ dnl On ofs1 the '-pthread' switch should be used dnl We sometimes need ETHR_DEFS in order to find certain headers dnl (at least for pthread.h on osf1). - saved_cppflags=$CPPFLAGS + saved_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ETHR_DEFS" dnl We need the thread library in order to find some functions - saved_libs=$LIBS + saved_libs="$LIBS" LIBS="$LIBS $ETHR_X_LIBS" - - dnl dnl Check for headers dnl - AC_CHECK_HEADER(pthread.h, + AC_CHECK_HEADER(pthread.h, \ AC_DEFINE(ETHR_HAVE_PTHREAD_H, 1, \ [Define if you have the <pthread.h> header file.])) @@ -684,8 +795,8 @@ dnl On ofs1 the '-pthread' switch should be used AC_CHECK_FUNC(pthread_spin_lock, \ AC_DEFINE(ETHR_HAVE_PTHREAD_SPIN_LOCK, 1, \ [Define if you have the pthread_spin_lock function.])) - case $host_os in - linux*) # Writers may get starved + case "$force_linux_pthread_rwlocks-$host_os" in + yes-linux*) # Writers may get starved # TODO: write a test that tests the implementation ;; *) @@ -702,9 +813,10 @@ dnl On ofs1 the '-pthread' switch should be used LIBS=$saved_libs dnl restore CPPFLAGS CPPFLAGS=$saved_cppflags - - fi -fi + ;; + *) + ;; +esac AC_MSG_CHECKING([whether default stack size should be modified]) if test "x$ethr_modified_default_stack_size" != "x"; then @@ -735,7 +847,6 @@ AC_SUBST(ETHR_LIBS) AC_SUBST(ETHR_LIB_NAME) AC_SUBST(ETHR_DEFS) AC_SUBST(ETHR_THR_LIB_BASE) -AC_SUBST(ETHR_THR_LIB_BASE_NAME) ]) @@ -789,12 +900,6 @@ case $clock_gettime_correction in unknown) if test x$clock_gettime_compiles = xyes; then if test X$cross_compiling != Xyes; then - if test "X$erl_xcomp_linux_clock_gettime_correction" = "Xno"; then - erl_cv_time_correction=times - else - erl_cv_time_correction=clock_gettime - fi - else linux_kernel_vsn_=`uname -r` case $linux_kernel_vsn_ in [[0-1]].*|2.[[0-5]]|2.[[0-5]].*) @@ -802,6 +907,19 @@ case $clock_gettime_correction in *) erl_cv_time_correction=clock_gettime;; esac + else + case X$erl_xcomp_linux_clock_gettime_correction in + X) + erl_cv_time_correction=cross;; + Xyes|Xno) + if test $erl_xcomp_linux_clock_gettime_correction = yes; then + erl_cv_time_correction=clock_gettime + else + erl_cv_time_correction=times + fi;; + *) + AC_MSG_ERROR([Bad erl_xcomp_linux_clock_gettime_correction value: $erl_xcomp_linux_clock_gettime_correction]);; + esac fi else erl_cv_time_correction=times @@ -826,8 +944,9 @@ case $erl_cv_time_correction in AC_DEFINE(CORRECT_USING_TIMES,[], [Define if you do not have a high-res. timer & want to use times() instead]) ;; - clock_gettime) - if test X$cross_compiling = Xyes -a X$erl_xcomp_linux_clock_gettime_correction = X; then + clock_gettime|cross) + if test $erl_cv_time_correction = cross; then + erl_cv_time_correction=clock_gettime AC_MSG_WARN([result clock_gettime guessed because of cross compilation]) fi xrtlib="-lrt" @@ -892,11 +1011,20 @@ int main() { ], erl_gethrvtime=procfs_ioctl, erl_gethrvtime=false, -if test "x$erl_xcomp_gethrvtime_procfs_ioctl" = "xyes"; then - erl_gethrvtime=procfs_ioctl -else - erl_gethrvtime=false -fi) +[ +case X$erl_xcomp_gethrvtime_procfs_ioctl in + X) + erl_gethrvtime=cross;; + Xyes|Xno) + if test $erl_xcomp_gethrvtime_procfs_ioctl = yes; then + erl_gethrvtime=procfs_ioctl + else + erl_gethrvtime=false + fi;; + *) + AC_MSG_ERROR([Bad erl_xcomp_gethrvtime_procfs_ioctl value: $erl_xcomp_gethrvtime_procfs_ioctl]);; +esac +]) case $erl_gethrvtime in procfs_ioctl) @@ -905,7 +1033,13 @@ case $erl_gethrvtime in AC_MSG_RESULT(uses ioctl to procfs) ;; *) - AC_MSG_RESULT(not working) + if test $erl_gethrvtime = cross; then + erl_gethrvtime=false + AC_MSG_RESULT(cross) + AC_MSG_WARN([result 'not working' guessed because of cross compilation]) + else + AC_MSG_RESULT(not working) + fi dnl dnl Check if clock_gettime (linux) is working @@ -938,29 +1072,35 @@ case $erl_gethrvtime in exit(0); return 0; } ], - erl_clock_gettime=true, - erl_clock_gettime=false, - if test "x$erl_xcomp_clock_gettime" = "xyes"; then - erl_clock_gettime=true - else - erl_clock_gettime=false - fi) + erl_clock_gettime=yes, + erl_clock_gettime=no, + [ + case X$erl_xcomp_clock_gettime_cpu_time in + X) erl_clock_gettime=cross;; + Xyes|Xno) erl_clock_gettime=$erl_xcomp_clock_gettime_cpu_time;; + *) AC_MSG_ERROR([Bad erl_xcomp_clock_gettime_cpu_time value: $erl_xcomp_clock_gettime_cpu_time]);; + esac + ]) LIBS=$save_libs case $host_os in linux*) - AC_MSG_RESULT([not stable, disabled]) + AC_MSG_RESULT([no; not stable]) LIBRT=$xrtlib ;; *) + AC_MSG_RESULT($erl_clock_gettime) case $erl_clock_gettime in - true) + yes) AC_DEFINE(HAVE_CLOCK_GETTIME,[], [define if clock_gettime() works for getting process time]) - AC_MSG_RESULT(using clock_gettime) LIBRT=-lrt ;; + cross) + erl_clock_gettime=no + AC_MSG_WARN([result no guessed because of cross compilation]) + LIBRT=$xrtlib + ;; *) - AC_MSG_RESULT(not working) LIBRT=$xrtlib ;; esac diff --git a/erts/autoconf/win32.config.cache b/erts/autoconf/win32.config.cache index 51cfa13785..31dfe510cd 100755 --- a/erts/autoconf/win32.config.cache +++ b/erts/autoconf/win32.config.cache @@ -186,10 +186,12 @@ ac_cv_prog_CC=${ac_cv_prog_CC=cc.sh} ac_cv_prog_CPP=${ac_cv_prog_CPP='cc.sh -E'} ac_cv_prog_CXX=${ac_cv_prog_CXX=cc.sh} ac_cv_prog_DED_LD=${ac_cv_prog_DED_LD=ld.sh} +ac_cv_prog_ac_ct_DED_LD=${ac_cv_prog_ac_ct_DED_LD=ld.sh} ac_cv_prog_M4=${ac_cv_prog_M4=m4} ac_cv_prog_PERL=${ac_cv_prog_PERL=perl} ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=true} -ac_cv_prog_ac_ct_LD=${ac_cv_prog_ac_ct_LD=ld} +ac_cv_prog_LD=${ac_cv_prog_LD=ld.sh} +ac_cv_prog_ac_ct_LD=${ac_cv_prog_ac_ct_LD=ld.sh} ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes} ac_cv_prog_cc_stdc=${ac_cv_prog_cc_stdc=} ac_cv_prog_cxx_g=${ac_cv_prog_cxx_g=no} diff --git a/erts/configure.in b/erts/configure.in index 48d236351b..1892a7a1f4 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -23,6 +23,8 @@ dnl autoconf convention that should be cleaned up. AC_INIT(vsn.mk) AC_PREREQ(2.59) +LM_PRECIOUS_VARS + if test "x$no_recursion" != "xyes" -a "x$OVERRIDE_CONFIG_CACHE" = "x"; then # We do not want to use a common cache! cache_file=/dev/null @@ -84,6 +86,9 @@ if test "X$host" != "Xfree_source" -a "X$host" != "Xwin32"; then else host_os=$host fi + +ERL_XCOMP_SYSROOT_INIT + AC_ISC_POSIX AC_CONFIG_HEADER($host/config.h:config.h.in include/internal/$host/ethread_header_config.h:include/internal/ethread_header_config.h.in include/$host/erl_int_sizes_config.h:include/erl_int_sizes_config.h.in) @@ -94,6 +99,22 @@ enable_child_waiter_thread=no ENABLE_ALLOC_TYPE_VARS= AC_SUBST(ENABLE_ALLOC_TYPE_VARS) +AC_ARG_ENABLE(bootstrap-only, +[ --enable-bootstrap-only enable bootstrap only configuration], +[ if test "X$enableval" = "Xyes"; then + # Disable stuff not necessary in a bootstrap only system in order + # to speed up things by reducing the amount of stuff needing to be + # built... + enable_threads=no + enable_smp_support=no + with_termcap=no + with_ssl=no + with_ssl_zlib=no + enable_hipe=no + enable_sctp=no + fi +]) + AC_ARG_ENABLE(threads, [ --enable-threads enable async thread support --disable-threads disable async thread support], @@ -734,8 +755,17 @@ HCC='$(CC)' AC_SUBST(HCC) HCFLAGS="" AC_SUBST(HCFLAGS) HCFLAGS="$HCFLAGS -I${ERL_TOP}/erts/$host" vxworks_reclaim="" AC_SUBST(vxworks_reclaim) -LD='$(CC)' AC_SUBST(LD) +dnl We want to use $(CC) as linker for the emulator regardless of +dnl what the user say. This might not be the right way to do it, but +dnl for now that is the way we do it. +USER_LD=$LD +USER_LDFLAGS="$LDFLAGS" +LD='$(CC)' +AC_SUBST(LD) + +LDFLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" +AC_SUBST(LDFLAG_RUNTIME_LIBRARY_PATH) dnl Check for cygwin and object/exe files extension dnl AC_CYGWIN is deprecated @@ -1474,9 +1504,11 @@ fi fi -if test "x$erl_xcomp_bigendian" != "x"; then - ac_cv_c_bigendian=$erl_xcomp_bigendian -fi +case X$erl_xcomp_bigendian in + X) ;; + Xyes|Xno) ac_cv_c_bigendian=$erl_xcomp_bigendian;; + *) AC_MSG_ERROR([Bad erl_xcomp_bigendian value: $erl_xcomp_bigendian]);; +esac AC_C_BIGENDIAN @@ -1514,18 +1546,22 @@ int main(int argc, char **argv) { } } ],, have_getaddrinfo=no, - if test "x$erl_xcomp_getaddrinfo" != "x"; then - have_getaddrinfo=$erl_xcomp_getaddrinfo - else - have_getaddrinfo=no - fi) - if test $have_getaddrinfo = yes; then - AC_MSG_RESULT(yes) + [ + case X$erl_xcomp_getaddrinfo in + X) have_getaddrinfo=cross;; + Xyes|Xno) have_getaddrinfo=$erl_xcomp_getaddrinfo;; + *) AC_MSG_ERROR([Bad erl_xcomp_getaddrinfo value: $erl_xcomp_getaddrinfo]);; + esac + ]) + AC_MSG_RESULT($have_getaddrinfo) + case $have_getaddrinfo in + yes) AC_DEFINE(HAVE_GETADDRINFO, [1], - [Define to 1 if you have a good `getaddrinfo' function.]) - else - AC_MSG_RESULT(no) - fi + [Define to 1 if you have a good `getaddrinfo' function.]);; + cross) + AC_MSG_WARN([result no guessed because of cross compilation]);; + *) ;; + esac fi AC_CHECK_FUNCS([getnameinfo getipnodebyname getipnodebyaddr gethostbyname2]) @@ -1807,16 +1843,21 @@ int main(void) ], erts_cv___after_morecore_hook_can_track_malloc=yes, erts_cv___after_morecore_hook_can_track_malloc=no, - if test "x$erl_xcomp_after_morecore_hook" != "x"; then - erts_cv___after_morecore_hook_can_track_malloc=$erl_xcomp_after_morecore_hook - else - erts_cv___after_morecore_hook_can_track_malloc=no - fi)]) + [ + case X$erl_xcomp_after_morecore_hook in + X) erts_cv___after_morecore_hook_can_track_malloc=cross;; + Xyes|Xno) erts_cv___after_morecore_hook_can_track_malloc=$erl_xcomp_after_morecore_hook;; + *) AC_MSG_ERROR([Bad erl_xcomp_after_morecore_hook value: $erl_xcomp_after_morecore_hook]);; + esac + ] + )]) -if test $erts_cv___after_morecore_hook_can_track_malloc = yes; then - AC_DEFINE(ERTS___AFTER_MORECORE_HOOK_CAN_TRACK_MALLOC, 1, \ -[Define if __after_morecore_hook can track malloc()s core memory use.]) -fi +case $erts_cv___after_morecore_hook_can_track_malloc in + yes) AC_DEFINE(ERTS___AFTER_MORECORE_HOOK_CAN_TRACK_MALLOC, 1, \ +[Define if __after_morecore_hook can track malloc()s core memory use.]);; + cross) AC_MSG_WARN([result no guessed because of cross compilation]);; + *) ;; +esac if test "x$ac_cv_func_sbrk" = "xyes"; then AC_CACHE_CHECK([types of sbrk()s return value and argument], @@ -2069,15 +2110,21 @@ int main(void) ], erts_cv_brk_wrappers_can_track_malloc=yes, erts_cv_brk_wrappers_can_track_malloc=no, - if test "x$erl_xcomp_dlsym_brk_wrappers" != "x"; then - erts_cv_brk_wrappers_can_track_malloc=$erl_xcomp_dlsym_brk_wrappers - else - erts_cv_brk_wrappers_can_track_malloc=no - fi)]) - if test $erts_cv_brk_wrappers_can_track_malloc = yes; then + [ + case X$erl_xcomp_dlsym_brk_wrappers in + X) erts_cv_brk_wrappers_can_track_malloc=cross;; + Xyes|Xno) erts_cv_brk_wrappers_can_track_malloc=$erl_xcomp_dlsym_brk_wrappers;; + *) AC_MSG_ERROR([Bad erl_xcomp_dlsym_brk_wrappers value: $erl_xcomp_dlsym_brk_wrappers]);; + esac + ])]) + case $erts_cv_brk_wrappers_can_track_malloc in + yes) AC_DEFINE(ERTS_BRK_WRAPPERS_CAN_TRACK_MALLOC, 1, \ -[Define if sbrk()/brk() wrappers can track malloc()s core memory use]) - fi +[Define if sbrk()/brk() wrappers can track malloc()s core memory use]);; + cross) + AC_MSG_WARN([result no guessed because of cross compilation]);; + *) ;; + esac fi dnl Restore LIBS @@ -2090,7 +2137,7 @@ LM_SYS_MULTICAST ERL_TIME_CORRECTION AC_CHECK_PROG(M4, m4, m4) dnl check to auto-enable hipe here... -if test X${enable_hipe} != Xno; then +if test "$cross_compiling" != "yes" && test X${enable_hipe} != Xno; then if test -z "$M4"; then enable_hipe=no AC_MSG_NOTICE([HiPE disabled as no valid m4 is found in PATH]) @@ -2657,21 +2704,26 @@ int main(int argc, const char **argv) return do_check(); } ], -erl_ok=reliable, -erl_ok=unreliable, -if test "x$erl_xcomp_reliable_fpe" = "xyes"; then - erl_ok=reliable -else - erl_ok=unreliable -fi) - if test $erl_ok = unreliable; then - AC_DEFINE(NO_FPE_SIGNALS,[], - [Define if floating points exceptions are non-existing/not reliable]) - AC_MSG_RESULT([unreliable; testing in software instead]) - FPE=unreliable - else +erl_ok=yes, +erl_ok=no, +[ +case X$erl_xcomp_reliable_fpe in + X) erl_ok=cross;; + Xyes|Xno) erl_ok=$erl_xcomp_reliable_fpe;; + *) AC_MSG_ERROR([Bad erl_xcomp_reliable_fpe value: $erl_xcomp_reliable_fpe]);; +esac +]) + + if test $erl_ok = yes; then + FPE=reliable AC_MSG_RESULT(reliable) - FPE=reliable + else + FPE=unreliable + AC_MSG_RESULT([unreliable; testing in software instead]) + AC_DEFINE(NO_FPE_SIGNALS,[],[Define if floating points exceptions are non-existing/not reliable]) + if test $erl_ok = cross; then + AC_MSG_WARN([result unreliable guessed because of cross compilation]) + fi fi fi @@ -2837,45 +2889,46 @@ main() ], poll_works=yes, poll_works=no, -poll_works=$erl_xcomp_poll) - -if test "X$poll_works" != "X"; then - guessed_poll_works=no -else - guessed_poll_works=yes - case $host_os in - darwin*) poll_works=no;; - *) poll_works=yes;; - esac -fi +[ +case X$erl_xcomp_poll in + X) poll_works=cross;; + Xyes|Xno) poll_works=$erl_xcomp_poll;; + *) AC_MSG_ERROR([Bad erl_xcomp_poll value: $erl_xcomp_poll]);; +esac +]) fi -case $poll_works in -yes) - AC_DEFINE(ERTS_USE_POLL, 1, [Define if poll() should be used instead of select()]) - AC_MSG_RESULT(yes) - ;; -*) +case $poll_works-$host_os in + no-*|cross-darwin*) # # The USE_SELECT define is used by the ssl application (should not # be used by erts). # - poll_works=no AC_DEFINE(USE_SELECT, 1, [Define if select() should be used instead of poll()]) - AC_MSG_RESULT([no; non-existing, broken, or based on select()]) - ;; + if test $poll_works = cross; then + AC_MSG_RESULT(cross) + AC_MSG_WARN([result no guessed based on OS ($host_os) because of cross compilation]) + else + AC_MSG_RESULT([no; non-existing, broken, or based on select()]) + fi + poll_works=no;; + yes-*|cross-*) + AC_DEFINE(ERTS_USE_POLL, 1, [Define if poll() should be used instead of select()]) + if test $poll_works = cross; then + AC_MSG_RESULT(cross) + AC_MSG_WARN([result yes guessed based on OS ($host_os) because of cross compilation]) + else + AC_MSG_RESULT(yes) + fi + poll_works=yes;; esac -if test $guessed_poll_works = yes; then - AC_MSG_WARN([result $poll_works guessed based on OS ($host_os) because of cross compilation]) -fi - # # If kqueue() found, check that it can be selected or polled on... # if test $have_kernel_poll = kqueue; then - if test $poll_works = true; then + if test $poll_works = yes; then kqueue_with=poll else kqueue_with=select @@ -2907,19 +2960,25 @@ int main(void) { return 0; } ], - ok_kqueue=true, - ok_kqueue=false, - if test "x$erl_xcomp_kqueue" = "xyes"; then - ok_kqueue=true - else - ok_kqueue=false - fi) - if test $ok_kqueue = true; then - AC_MSG_RESULT(yes); - else - AC_MSG_RESULT(no); + ok_kqueue=yes, + ok_kqueue=no, + [ + case X$erl_xcomp_kqueue in + X) ok_kqueue=cross;; + Xyes|Xno) ok_kqueue=$erl_xcomp_kqueue;; + *) AC_MSG_ERROR([Bad erl_xcomp_kqueue value: $erl_xcomp_kqueue]);; + esac + ]) + AC_MSG_RESULT($ok_kqueue); + case $ok_kqueue in + yes) + ;; + cross) have_kernel_poll=no - fi + AC_MSG_WARN([result no guessed because of cross compilation]);; + *) + have_kernel_poll=no;; + esac fi # @@ -3006,16 +3065,23 @@ int main(void) { ], copying_putenv=yes, copying_putenv=no, -if test "x$erl_xcomp_putenv_copy" != "x"; then - copying_putenv=$erl_xcomp_putenv_copy -else - copying_putenv=no -fi) +[ +case X$erl_xcomp_putenv_copy in + X) copying_putenv=cross;; + Xyes|Xno) copying_putenv=$erl_xcomp_putenv_copy;; + *) AC_MSG_ERROR([Bad erl_xcomp_putenv_copy value: $erl_xcomp_putenv_copy]);; +esac +]) -if test $copying_putenv = yes; then - AC_DEFINE(HAVE_COPYING_PUTENV,[1],[Define if you have a putenv() that stores a copy of the key-value pair]) -fi AC_MSG_RESULT($copying_putenv) +case $copying_putenv in + yes) + AC_DEFINE(HAVE_COPYING_PUTENV,[1],\ +[Define if you have a putenv() that stores a copy of the key-value pair]);; + cross) + AC_MSG_WARN([result no guessed because of cross compilation]);; + *) ;; +esac dnl ---------------------------------------------------------------------- dnl Stuff that should be moved into their respective application @@ -3043,29 +3109,39 @@ dnl crypto # #-------------------------------------------------------------------- -DED_INCLUDE="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host" +DED_SYS_INCLUDE="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host -I${ERL_TOP}/erts/include/internal -I${ERL_TOP}/erts/include/internal/$host -I${ERL_TOP}/erts/emulator/sys/$ERLANG_OSTYPE" -DED_CFLAGS="$DED_INCLUDE $CFLAGS $CPPFLAGS $EMU_THR_DEFS" +if test "X$ETHR_DEFS" = "X"; then + DED_THR_DEFS="-D_THREAD_SAFE -D_REENTRANT" +else + DED_THR_DEFS="$ETHR_DEFS" +fi +DED_EMU_THR_DEFS=$EMU_THR_DEFS +DED_CFLAGS="$CFLAGS $CPPFLAGS" if test "x$GCC" = xyes; then DED_CFLAGS="$DED_CFLAGS -fPIC" fi -STATIC_CFLAGS="" +DED_EXT=so +case $host_os in + win32) DED_EXT=dll;; + darwin*) + DED_CFLAGS="$DED_CFLAGS -fno-common" + if test "X$STATIC_CFLAGS" = "X"; then + STATIC_CFLAGS="-mdynamic-no-pic" + fi;; + *) + ;; +esac -# If DED_LD is set in environment, we expect all DED variables to be specified -# (cross compiling) +# If DED_LD is set in environment, we expect all DED_LD* variables +# to be specified (cross compiling) if test "x$DED_LD" = "x"; then -if test "x$LD" = "x"; then - DED_LD=ld -else - DED_LD=$LD -fi DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" - case $host_os in win32) - DED_LD=ld.sh + DED_LD="ld.sh" DED_LDFLAGS="-dll" DED_LD_FLAG_RUNTIME_LIBRARY_PATH= ;; @@ -3099,21 +3175,20 @@ case $host_os in if test X${enable_darwin_universal} = Xyes; then DED_LDFLAGS="-arch ppc -arch i386 $DED_LDFLAGS" fi - DED_CFLAGS="$DED_CFLAGS -fno-common" DED_LD="$CC" - DED_LD_FLAG_RUNTIME_LIBRARY_PATH= - STATIC_CFLAGS="-mdynamic-no-pic" + DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) DED_LD="$CC" + DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared -Wl,-Bsymbolic" - DED_LD_FLAG_RUNTIME_LIBRARY_PATH= if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-m64 $DED_LDFLAGS" fi ;; freebsd*) DED_LD="$CC" + DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-m64 $DED_LDFLAGS" @@ -3131,8 +3206,16 @@ case $host_os in ;; esac +if test "$DED_LD" = "" && test "$USER_LD" != ""; then + DED_LD="$USER_LD" + DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" fi +fi # "x$DED_LD" = "x" + +AC_CHECK_TOOL(DED_LD, ld, false) +test "$DED_LD" != "false" || AC_MSG_ERROR([No linker found]) + AC_MSG_CHECKING(for compiler flags for loadable drivers) AC_MSG_RESULT([$DED_CFLAGS]) AC_MSG_CHECKING(for linker for loadable drivers) @@ -3146,10 +3229,14 @@ else AC_MSG_RESULT([not found]) fi +AC_SUBST(DED_EXT) +AC_SUBST(DED_SYS_INCLUDE) AC_SUBST(DED_CFLAGS) AC_SUBST(DED_LD) AC_SUBST(DED_LDFLAGS) AC_SUBST(DED_LD_FLAG_RUNTIME_LIBRARY_PATH) +AC_SUBST(DED_THR_DEFS) +AC_SUBST(DED_EMU_THR_DEFS) AC_SUBST(STATIC_CFLAGS) dnl @@ -3172,6 +3259,9 @@ dnl use "PATH/include" and "PATH/lib". AC_SUBST(SSL_INCLUDE) AC_SUBST(SSL_ROOT) AC_SUBST(SSL_LIBDIR) +AC_SUBST(SSL_CC_RUNTIME_LIBRARY_PATH) +AC_SUBST(SSL_LD_RUNTIME_LIBRARY_PATH) +AC_SUBST(SSL_DED_LD_RUNTIME_LIBRARY_PATH) AC_SUBST(SSL_DYNAMIC_ONLY) AC_SUBST(SSL_LINK_WITH_KERBEROS) AC_SUBST(STATIC_KERBEROS_LIBS) @@ -3179,6 +3269,8 @@ AC_SUBST(SSL_LINK_WITH_ZLIB) AC_SUBST(STATIC_ZLIB_LIBS) AC_SUBST(OPENSSL_CMD) +std_ssl_locations="/usr/local /usr/sfw /opt/local /usr /usr/pkg /usr/local/openssl /usr/lib/openssl /usr/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl" + AC_ARG_WITH(ssl-zlib, [ --with-ssl-zlib=PATH specify location of ZLib to be used by OpenSSL --with-ssl-zlib link SSL with Zlib (default if found) @@ -3188,18 +3280,20 @@ AC_ARG_WITH(ssl-zlib, if test "x$with_ssl_zlib" = "xno"; then SSL_LINK_WITH_ZLIB=no STATIC_ZLIB_LIBS= -elif test "x$with_ssl_zlib" = "xyes" -o "x$with_ssl_zlib" = "x" ;then - if test "x$MIXED_CYGWIN" = "xyes"; then +elif test "x$with_ssl_zlib" = "xyes" || test "x$with_ssl_zlib" = "x"; then + if test $erl_xcomp_without_sysroot = yes; then + AC_MSG_WARN([Cannot search for zlib; missing cross system root (erl_xcomp_sysroot).]) + SSL_LINK_WITH_ZLIB=no + STATIC_ZLIB_LIBS= + elif test "x$MIXED_CYGWIN" = "xyes"; then SSL_LINK_WITH_ZLIB=no STATIC_ZLIB_LIBS= else SSL_LINK_WITH_ZLIB=no STATIC_ZLIB_LIBS= AC_MSG_CHECKING(for static ZLib to be used by SSL in standard locations) - for dir in /usr/local /usr/sfw /usr /usr/pkg \ - /usr/local/openssl /usr/lib/openssl /usr/openssl \ - /usr/local/ssl /usr/lib/ssl /usr/ssl - do + for rdir in $std_ssl_locations; do + dir="$erl_xcomp_sysroot$rdir" if test "x$ac_cv_sizeof_void_p" = "x8"; then if test -f "$dir/lib64/libz.a"; then SSL_LINK_WITH_ZLIB=yes @@ -3280,14 +3374,21 @@ done SSL_DYNAMIC_ONLY=$enable_dynamic_ssl -if test "x$with_ssl" = "xno"; then +case "$erl_xcomp_without_sysroot-$with_ssl" in + yes-* | no-no) SSL_APP= CRYPTO_APP= SSH_APP= + if test "$with_ssl" = "no"; then + skip="User gave --without-ssl option" + else + skip="Cannot search for ssl; missing cross system root (erl_xcomp_sysroot)." + fi for a in ssl crypto ssh; do - echo "User gave --without-ssl option" > $ERL_TOP/lib/$a/SKIP + echo "$skip" > $ERL_TOP/lib/$a/SKIP done -elif test "x$with_ssl" = "xyes" -o "x$with_ssl" = "x" ;then + ;; + no-yes | no- ) # On windows, we could try to find the installation # of Shining Light OpenSSL, which can be found by poking in # the uninstall section in the registry, it's worth a try... @@ -3314,20 +3415,19 @@ elif test "x$with_ssl" = "xyes" -o "x$with_ssl" = "x" ;then SSH_APP=ssh AC_MSG_CHECKING(for OpenSSL >= 0.9.7 in standard locations) - for dir in $extra_dir /cygdrive/c/OpenSSL \ - /usr/local /usr/sfw /opt/local /usr /usr/pkg \ - /usr/local/openssl /usr/lib/openssl /usr/openssl \ - /usr/local/ssl /usr/lib/ssl /usr/ssl - do - if test -f $dir/include/openssl/opensslv.h; then + for rdir in $extra_dir /cygdrive/c/OpenSSL $std_ssl_locations; do + dir="$erl_xcomp_sysroot$rdir" + if test -f "$erl_xcomp_isysroot$rdir/include/openssl/opensslv.h"; then is_real_ssl=yes SSL_ROOT="$dir" if test "x$MIXED_CYGWIN" = "xyes" ; then - if test -f "$dir/lib/VC/ssleay32.lib" -o \ - -f "$dir/lib/VC/openssl.lib"; then + if test -f "$dir/lib/VC/ssleay32.lib" || \ + test -f "$dir/lib/VC/openssl.lib"; then + SSL_RUNTIME_LIBDIR="$rdir/lib/VC" SSL_LIBDIR="$dir/lib/VC" - elif test -f "$dir/lib/ssleay32.lib" -o \ - -f "$dir/lib/openssl.lib"; then + elif test -f "$dir/lib/ssleay32.lib" || \ + test -f "$dir/lib/openssl.lib"; then + SSL_RUNTIME_LIBDIR="$rdir/lib" SSL_LIBDIR="$dir/lib" else is_real_ssl=no @@ -3335,31 +3435,42 @@ elif test "x$with_ssl" = "xyes" -o "x$with_ssl" = "x" ;then else if test "x$ac_cv_sizeof_void_p" = "x8"; then if test -f "$dir/lib64/libcrypto.a"; then + SSL_RUNTIME_LIBDIR="$rdir/lib64" SSL_LIBDIR="$dir/lib64" elif test -f "$dir/lib/64/libcrypto.a"; then + SSL_RUNTIME_LIBDIR="$rdir/lib/64" SSL_LIBDIR="$dir/lib/64" elif test -f "$dir/lib64/libcrypto.so"; then + SSL_RUNTIME_LIBDIR="$rdir/lib64" SSL_LIBDIR="$dir/lib64" elif test -f "$dir/lib/64/libcrypto.so"; then + SSL_RUNTIME_LIBDIR="$rdir/lib/64" SSL_LIBDIR="$dir/lib/64" else + SSL_RUNTIME_LIBDIR="$rdir/lib" SSL_LIBDIR="$dir/lib" fi else + SSL_RUNTIME_LIBDIR="$rdir/lib" SSL_LIBDIR="$dir/lib" fi fi if test '!' -f $SSL_LIBDIR/libcrypto.a; then SSL_DYNAMIC_ONLY=yes fi - SSL_BINDIR="$dir/bin" + SSL_BINDIR="$rdir/bin" dnl Should one use EXEEXT or ac_exeext? - if test -f "$SSL_BINDIR/openssl$EXEEXT"; then + if test -f "$erl_xcomp_sysroot$SSL_BINDIR/openssl$EXEEXT"; then + if test "$cross_compiling" = "yes"; then + dnl Cannot test it; hope it is working... + OPENSSL_CMD="$SSL_BINDIR/openssl" + else if "$SSL_BINDIR/openssl" version > /dev/null 2>&1; then OPENSSL_CMD="$SSL_BINDIR/openssl" else is_real_ssl=no fi + fi else is_real_ssl=no fi @@ -3403,7 +3514,7 @@ dnl Should one use EXEEXT or ac_exeext? LIBS="$saveLIBS" fi fi - if test "x$ssl_found" = "xyes" -a "x$ssl_linkable" = "xyes" ; then + if test "x$ssl_found" = "xyes" && test "x$ssl_linkable" = "xyes"; then AC_MSG_RESULT([$dir]) break; fi @@ -3417,13 +3528,14 @@ dnl Should one use EXEEXT or ac_exeext? dnl case $host_os in openbsd*) - if test -f /usr/include/openssl/opensslv.h; then + if test -f "$erl_xcomp_isysroot/usr/include/openssl/opensslv.h"; then # Trust OpenBSD to have everything the in the correct locations. ssl_found=yes ssl_linkable=yes - SSL_ROOT="/usr/sbin" + SSL_ROOT="$erl_xcomp_sysroot/usr" AC_MSG_RESULT([$SSL_ROOT]) - SSL_LIB="/usr/lib" + SSL_RUNTIME_LIB="/usr/lib" + SSL_LIB="$erl_xcomp_sysroot/usr/lib" SSL_BINDIR="/usr/sbin" OPENSSL_CMD="$SSL_BINDIR/openssl" dnl OpenBSD requires us to link with -L and -l @@ -3436,7 +3548,7 @@ dnl Now, certain linuxes have a 64bit libcrypto dnl that cannot build shared libraries (i.e. not PIC) dnl One could argue that this is wrong, but dnl so it is - be adoptable - if test "x$ssl_found" = "xyes" -a "x$ssl_linkable" = "xyes" -a "x$SSL_DYNAMIC_ONLY" != "xyes" ; then + if test "$ssl_found" = "yes" && test "$ssl_linkable" = "yes" && test "$SSL_DYNAMIC_ONLY" != "yes"; then case $host_os in linux*) saveCFLAGS="$CFLAGS" @@ -3468,7 +3580,7 @@ dnl so it is - be adoptable - if test "x$ssl_found" != "xyes" -o "x$ssl_linkable" != "xyes"; then + if test "x$ssl_found" != "xyes" || test "x$ssl_linkable" != "xyes"; then if test "x$ssl_found" = "xyes"; then AC_MSG_RESULT([found; but not usable]) else @@ -3483,13 +3595,21 @@ dnl so it is - be adoptable echo "No usable OpenSSL found" > $ERL_TOP/lib/$a/SKIP done fi -else + ;; + *) + if test "$cross_compiling" = "yes"; then + case "$with_ssl" in + "$erl_xcomp_sysroot"*) ;; + *) AC_MSG_ERROR([Invalid path to option --with-ssl=PATH (not a subdirectory to cross system root)]);; + esac + fi + # Option given with PATH to package if test ! -d "$with_ssl" ; then AC_MSG_ERROR(Invalid path to option --with-ssl=PATH) fi SSL_ROOT="$with_ssl" - if test "x$MIXED_CYGWIN" = "xyes" -a -d "$with_ssl/lib/VC"; then + if test "x$MIXED_CYGWIN" = "xyes" && test -d "$with_ssl/lib/VC"; then SSL_LIBDIR="$with_ssl/lib/VC" elif test "x$ac_cv_sizeof_void_p" = "x8"; then if test -f "$with_ssl/lib64/libcrypto.a"; then @@ -3514,7 +3634,12 @@ else SSL_APP=ssl CRYPTO_APP=crypto SSH_APP=ssh -fi + if test "$cross_compiling" = "yes"; then + SSL_RUNTIME_LIBDIR=`echo "$SSL_LIBDIR" | sed -n "s|^$erl_xcomp_sysroot\(.*\)\$|\1|p"` + else + SSL_RUNTIME_LIBDIR="$SSL_LIBDIR" + fi +esac if test "x$SSL_APP" != "x" ; then dnl We found openssl, now check if we use kerberos 5 support @@ -3530,19 +3655,19 @@ if test "x$SSL_APP" != "x" ; then AC_MSG_RESULT([yes]) ssl_krb5_enabled=yes if test "x$SSL_DYNAMIC_ONLY" != "xyes"; then - if test -f $SSL_LIBDIR/libkrb5.a; then + if test -f "$SSL_LIBDIR/libkrb5.a"; then SSL_LINK_WITH_KERBEROS=yes STATIC_KERBEROS_LIBS="$SSL_LIBDIR/libkrb5.a" - if test -f $SSL_LIBDIR/libkrb5support.a; then + if test -f "$SSL_LIBDIR/libkrb5support.a"; then STATIC_KERBEROS_LIBS="$STATIC_KERBEROS_LIBS $SSL_LIBDIR/libkrb5support.a" fi - if test -f $SSL_LIBDIR/libk5crypto.a; then + if test -f "$SSL_LIBDIR/libk5crypto.a"; then STATIC_KERBEROS_LIBS="$STATIC_KERBEROS_LIBS $SSL_LIBDIR/libk5crypto.a" fi - if test -f $SSL_LIBDIR/libresolv.a; then + if test -f "$SSL_LIBDIR/libresolv.a"; then STATIC_KERBEROS_LIBS="$STATIC_KERBEROS_LIBS $SSL_LIBDIR/libresolv.a" fi - if test -f $SSL_LIBDIR/libcom_err.a; then + if test -f "$SSL_LIBDIR/libcom_err.a"; then STATIC_KERBEROS_LIBS="$STATIC_KERBEROS_LIBS $SSL_LIBDIR/libcom_err.a" fi else @@ -3568,10 +3693,12 @@ if test "x$SSL_APP" != "x" ; then SSL_KRB5_INCLUDE= if test "x$ssl_krb5_enabled" = "xyes" ; then AC_MSG_CHECKING(for krb5.h in standard locations) - for dir in $extra_dir $SSL_ROOT/include $SSL_ROOT/include/openssl \ - $SSL_ROOT/include/kerberos /cygdrive/c/kerberos/include \ - /usr/local/kerberos/include /usr/kerberos/include \ - /usr/include + for dir in $extra_dir "$SSL_ROOT/include" "$SSL_ROOT/include/openssl" \ + "$SSL_ROOT/include/kerberos" \ + "$erl_xcomp_isysroot/cygdrive/c/kerberos/include" \ + "$erl_xcomp_isysroot/usr/local/kerberos/include" \ + "$erl_xcomp_isysroot/usr/kerberos/include" \ + "$erl_xcomp_isysroot/usr/include" do if test -f "$dir/krb5.h" ; then SSL_KRB5_INCLUDE="$dir" @@ -3596,6 +3723,99 @@ fi done # while test ssl_done != yes +SSL_CC_RUNTIME_LIBRARY_PATH= +SSL_LD_RUNTIME_LIBRARY_PATH= +SSL_DED_LD_RUNTIME_LIBRARY_PATH= +cc_rflg="$CFLAG_RUNTIME_LIBRARY_PATH" +ld_rflg="$LDFLAG_RUNTIME_LIBRARY_PATH" +ded_ld_rflg="$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" + +if test "$SSL_APP" != "" && test "$SSL_DYNAMIC_ONLY" = "yes" && \ + { test "$cc_rflg" != "" || test "$ld_rflg" != "" || test "$ded_ld_rflg" != ""; } ; then + + AC_MSG_CHECKING(for ssl runtime library path to use) + + libdirs="/lib" + + if test "$ac_cv_sizeof_void_p" = "8"; then + dir_lib64=no + dir_lib_64=no + + case "$SSL_RUNTIME_LIBDIR" in + */lib/64 | */lib/64/ ) dir_lib_64=yes;; + */lib64 | */lib64/ ) dir_lib64=yes;; + *) ;; + esac + + for dir in $std_ssl_locations; do + test $dir_lib_64 = no && + test -d "$erl_xcomp_sysroot$dir/lib/64" && + dir_lib_64=yes + test $dir_lib64 = no && + test -d "$erl_xcomp_sysroot$dir/lib64" && + dir_lib64=yes + done + + test $dir_lib_64 = yes && libdirs="/lib/64 $libdirs" + test $dir_lib64 = yes && libdirs="/lib64 $libdirs" + fi + + for type in std x_std curr; do + + cc_rpath="$cc_rflg$SSL_RUNTIME_LIBDIR" + ld_rpath="$ld_rflg$SSL_RUNTIME_LIBDIR" + ded_ld_rpath="$ded_ld_rflg$SSL_RUNTIME_LIBDIR" + rpath="$SSL_RUNTIME_LIBDIR" + + if test $type != curr; then + for ldir in $libdirs; do + for dir in $std_ssl_locations; do + test "$SSL_LIBDIR" != "$dir$ldir" || continue + test $type != x_std || test -d "$dir$ldir" || continue + test "$cc_rflg" = "" || + cc_rpath="$cc_rpath $cc_rflg$dir$ldir" + test "$ld_rflg" = "" || + ld_rpath="$ld_rpath $ld_rflg$dir$ldir" + test "$ded_ld_rflg" = "" || + ded_ld_rpath="$ded_ld_rpath $ded_ld_rflg$dir$ldir" + rpath="$rpath:$dir$ldir" + done + done + fi + + saveCFLAGS="$CFLAGS" + saveLDFLAGS="$LDFLAGS" + saveLIBS="$LIBS" + CFLAGS="$CFLAGS $SSL_INCLUDE" + LDFLAGS="$LDFLAGS $ld_rpath -L$SSL_LIBDIR" + LIBS="-lcrypto" + AC_TRY_LINK([ + #include <stdio.h> + #include <openssl/hmac.h> + ], + [ + HMAC_CTX hc; + HMAC_CTX_init(&hc); + ], + [rpath_success=yes], + [rpath_success=no]) + CFLAGS="$saveCFLAGS" + LDFLAGS="$saveLDFLAGS" + LIBS="$saveLIBS" + + test "$rpath_success" = "yes" && break + done + + test "$rpath_success" = "yes" || { cc_rpath=; ld_rpath=; ded_ld_rpath=; rpath=; } + + SSL_CC_RUNTIME_LIBRARY_PATH="$cc_rpath" + SSL_LD_RUNTIME_LIBRARY_PATH="$ld_rpath" + SSL_DED_LD_RUNTIME_LIBRARY_PATH="$ded_ld_rpath" + + AC_MSG_RESULT([$rpath]) + test "$rpath" != "" || AC_MSG_WARN([Cannot set run path during linking]) +fi + #-------------------------------------------------------------------- # Os mon stuff. #-------------------------------------------------------------------- @@ -3614,6 +3834,11 @@ case $host_os in os_mon_programs="$os_mon_programs cpu_sup" ;; esac + +AC_ARG_WITH(javac, +[ --with-javac=JAVAC specify Java compiler to use + --with-javac use a Java compiler if found (default) + --without-javac don't use any Java compiler]) dnl dnl Then there are a number of apps which needs a java compiler... @@ -3625,7 +3850,20 @@ for a in $need_java ; do /bin/rm -f $ERL_TOP/lib/$a/SKIP done -AC_CHECK_PROGS(JAVAC, javac.sh javac guavac gcj jikes bock) +if test "X$with_javac" = "Xno"; then + for a in $need_java ; do + echo "Java compiler disabled by user" > $ERL_TOP/lib/$a/SKIP + done + +else # begin - try to find javac + +if test "X$with_javac" != "Xyes" -a "X$with_javac" != "X"; then + check_javac=$with_javac +else + check_javac="javac.sh javac guavac gcj jikes bock" +fi + +AC_CHECK_PROGS(JAVAC, $check_javac) if test -n "$JAVAC"; then dnl Make sure it's at least JDK 1.5 AC_CACHE_CHECK(for JDK version 1.5, @@ -3637,6 +3875,11 @@ if test -n "$JAVAC"; then fi fi if test -z "$JAVAC"; then + + if test "X$with_javac" != "X"; then + AC_MSG_ERROR([No java compiler found in PATH (checked for $check_javac)]) + fi + AC_MSG_WARN([Could not find any usable java compiler, will skip: jinterface]) for a in $need_java ; do @@ -3644,14 +3887,15 @@ if test -z "$JAVAC"; then done fi +fi # end - try to find javac + dnl dnl Orber has a c++ example, this isn't the right way to check for dnl it, but.... dnl -CXXFLAGS= AC_SUBST(CXXFLAGS) dnl this deliberately does not believe that 'gcc' is a C++ compiler -AC_CHECK_PROGS(CXX, $CCC c++ g++ CC cxx cc++ cl, false) +AC_CHECK_TOOLS(CXX, [$CCC c++ g++ CC cxx cc++ cl], false) # Remove SKIP file from previous run /bin/rm -f $ERL_TOP/lib/orber/SKIP @@ -3788,6 +4032,5 @@ dnl ../lib/orber/c_src/$host/Makefile:../lib/orber/c_src/Makefile.in ../lib/runtime_tools/c_src/$host/Makefile:../lib/runtime_tools/c_src/Makefile.in ../lib/tools/c_src/$host/Makefile:../lib/tools/c_src/Makefile.in - ../lib/asn1/c_src/$host/Makefile:../lib/asn1/c_src/Makefile.in ) diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in index a9acab640e..3db4fcba61 100644 --- a/erts/etc/common/Makefile.in +++ b/erts/etc/common/Makefile.in @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1996-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1996-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # @@ -359,12 +359,9 @@ $(OBJDIR)/escript.o: escript.c ifeq ($(TARGET),win32) -$(BINDIR)/$(ERLEXEC): $(OBJDIR)/erlexec.o $(OBJDIR)/win_erlexec.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) dbg +$(BINDIR)/$(ERLEXEC): $(OBJDIR)/erlexec.o $(OBJDIR)/win_erlexec.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) $(LD) -dll $(LDFLAGS) -o $@ $(OBJDIR)/erlexec.o $(OBJDIR)/win_erlexec.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) $(ERLEXEC_XLIBS) -dbg: - echo DBG - $(BINDIR)/erl@EXEEXT@: $(OBJDIR)/erl.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) $(LD) $(LDFLAGS) -o $@ $(OBJDIR)/erl.o $(OBJDIR)/init_file.o $(OBJDIR)/$(ERLRES_OBJ) diff --git a/erts/etc/unix/Install.src b/erts/etc/unix/Install.src index 410a77d91c..22357b057f 100644 --- a/erts/etc/unix/Install.src +++ b/erts/etc/unix/Install.src @@ -1,25 +1,26 @@ #!/bin/sh # # %CopyrightBegin% -# -# Copyright Ericsson AB 1996-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1996-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# -# %CopyrightEnd% -# -# Patch $ERL_ROOT/emulator/obj/Makefile.dist & make # +# %CopyrightEnd% # +usage=" +Usage: + Install [-cross] [-minimal|-sasl] <ERL_ROOT> +" start_option=query unset cross while [ $# -ne 0 ]; do @@ -42,7 +43,8 @@ fi if [ -z "$ERL_ROOT" -o ! -d "$ERL_ROOT" ] then - echo "Install: need ERL_ROOT directory as argument" + echo "Install: need <ERL_ROOT> directory as argument" >&2 + echo $usage >&2 exit 1 fi @@ -50,15 +52,17 @@ case ":$ERL_ROOT" in :/*) ;; *) - echo "Install: need an absolute path to ERL_ROOT" + echo "Install: need an absolute path to <ERL_ROOT>" >&2 + echo $usage >&2 exit 1 ;; esac if [ ! -d "$ERL_ROOT/erts-%I_VSN%/bin" ] then - echo "Install: The directory $ERL_ROOT/erts-%I_VSN%/bin does not exist" - echo " Bad location or erts module not un-tared" + echo "Install: The directory $ERL_ROOT/erts-%I_VSN%/bin does not exist" >&2 + echo " Bad location or erts module not un-tared" >&2 + echo $usage >&2 exit 1 fi @@ -67,20 +71,6 @@ then mkdir $ERL_ROOT/bin fi -# -# Fetch target system. -# -SYS=`(uname -s) 2>/dev/null` || SYS=unknown -REL=`(uname -r) 2>/dev/null` || REL=unknown -case $SYS:$REL in - SunOS:5.*) - TARGET=sunos5 ;; - Linux:*) - TARGET=linux ;; - *) - TARGET="" ;; -esac - cd $ERL_ROOT/erts-%I_VSN%/bin sed -e "s;%FINAL_ROOTDIR%;$TARGET_ERL_ROOT;" erl.src > erl @@ -111,7 +101,7 @@ if [ -h epmd ]; then /bin/rm -f epmd fi -ln -s $TARGET_ERL_ROOT/erts-%I_VSN%/bin/epmd epmd +ln -s ../erts-%I_VSN%/bin/epmd epmd cp -p $ERL_ROOT/erts-%I_VSN%/bin/run_erl . cp -p $ERL_ROOT/erts-%I_VSN%/bin/to_erl . @@ -150,19 +140,6 @@ cp -p $Name.boot start.boot cp -p ../releases/%I_SYSTEM_VSN%/$Name.script start.script # -# We always run ranlib unless Solaris/SunOS 5 -# but ignore failures. -# -if [ "X$TARGET" != "Xsunos5" -a -d $ERL_ROOT/usr/lib ]; then - cd $ERL_ROOT/usr/lib - for library in lib*.a - do - (ranlib $library) > /dev/null 2>&1 - done -fi - - -# # Fixing the man pages # diff --git a/erts/start_scripts/Makefile b/erts/start_scripts/Makefile index 862f7285bc..4df7568484 100644 --- a/erts/start_scripts/Makefile +++ b/erts/start_scripts/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1997-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # include $(ERL_TOP)/make/target.mk @@ -74,13 +74,13 @@ $(SS_ROOT)/start_clean.script \ $(SS_ROOT)/start_clean.boot: $(SS_ROOT)/start_clean.rel $(INSTALL_DIR) $(SS_TMP) ( cd $(SS_TMP) && \ - $(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) -o $@ $< ) + $(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) -o $(SS_ROOT) $< ) $(SS_ROOT)/start_sasl.script \ $(SS_ROOT)/start_sasl.boot: $(SS_ROOT)/start_sasl.rel $(INSTALL_DIR) $(SS_TMP) ( cd $(SS_TMP) && \ - $(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) -o $@ $< ) + $(ERLC) $(SASL_FLAGS) $(SCRIPT_PATH) -o $(SS_ROOT) $< ) $(SS_ROOT)/start_clean.rel: $(SS_ROOT)/start_clean.rel.src \ ../vsn.mk \ diff --git a/erts/test/Makefile b/erts/test/Makefile index 47e41a3625..796403e182 100644 --- a/erts/test/Makefile +++ b/erts/test/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1997-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # @@ -29,6 +29,7 @@ EBIN = . MODULES= \ erlc_SUITE \ + install_SUITE \ nt_SUITE \ otp_SUITE \ ethread_SUITE \ @@ -42,6 +43,8 @@ ERL_FILES= $(MODULES:%=%.erl) TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) +EXTRA_FILES = install_SUITE_data/install_bin + # ---------------------------------------------------- # Release directory specification # ---------------------------------------------------- @@ -56,10 +59,14 @@ ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/test_server/include # Targets # ---------------------------------------------------- -tests debug opt: $(TARGET_FILES) +tests debug opt: $(TARGET_FILES) $(EXTRA_FILES) + +install_SUITE_data/install_bin: ../../make/install_bin + rm -f $@ + cp -p $< $@ clean: - rm -f $(TARGET_FILES) + rm -f $(TARGET_FILES) $(EXTRA_FILES) rm -f core *~ docs: diff --git a/erts/test/install_SUITE.erl b/erts/test/install_SUITE.erl new file mode 100644 index 0000000000..b11f65480d --- /dev/null +++ b/erts/test/install_SUITE.erl @@ -0,0 +1,727 @@ +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2010. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% + + +%%%------------------------------------------------------------------- +%%% File : install_SUITE.erl +%%% Author : Rickard Green +%%% Description : +%%% +%%% Created : 12 Jan 2010 by Rickard Green +%%%------------------------------------------------------------------- +-module(install_SUITE). + +%-define(line_trace, 1). + +-export([all/1, init_per_suite/1, end_per_suite/1, + init_per_testcase/2, fin_per_testcase/2]). + +-export([bin_default/1, + bin_default_dirty/1, + bin_outside_eprfx/1, + bin_outside_eprfx_dirty/1, + bin_unreasonable_path/1, + bin_not_abs/1, + 'bin white space'/1, + bin_no_srcfile/1, + bin_unreachable_absolute/1, + bin_unreachable_relative/1, + bin_same_dir/1, + bin_ok_symlink/1, + bin_dirname_fail/1, + bin_no_use_dirname_fail/1]). + +-define(DEFAULT_TIMEOUT, ?t:minutes(1)). +-define(JOIN(A,B,C), filename:join(A, B, C)). + +-include("test_server.hrl"). + +-record(inst, {mkdirs = true, + symlinks = true, + cmd_prefix = "", + ln_s = "ln -s", + test_prefix = "", + destdir = "", + extra_prefix = "", + exec_prefix = "", + bindir = "", + erlang_bindir = "", + bindir_symlinks = ""}). + +need_symlink_cases() -> + [bin_unreachable_absolute, + bin_unreachable_relative, + bin_same_dir, + bin_ok_symlink, + bin_dirname_fail, + bin_no_use_dirname_fail]. + +dont_need_symlink_cases() -> + [bin_default, + bin_default_dirty, + bin_outside_eprfx, + bin_outside_eprfx_dirty, + bin_not_abs, + bin_unreasonable_path, + 'bin white space', + bin_no_srcfile]. + +all(suite) -> + dont_need_symlink_cases() ++ need_symlink_cases(). + +%% +%% The test cases +%% + +bin_default(Config) when is_list(Config) -> + ?line E = "/usr/local", + ?line Bs = "/usr/local/bin", + ?line Be = Bs, + ?line EBs = "/usr/local/lib/erlang/bin", + ?line EBe = EBs, + ?line RP = "../lib/erlang/bin", + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "absolute"} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}}; + {true, _} -> + ?line {ok,{relative,B,RP}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + +bin_default_dirty(Config) when is_list(Config) -> + ?line E = "/usr/./local/lib/..", + ?line Bs = "/usr/local//lib/../lib/erlang/../../bin", + ?line Be = "/usr/local/lib/../lib/erlang/../../bin", + ?line EBs = "/usr/local/lib/../lib/erlang/../erlang/bin/x/y/../..//", + ?line EBe = "/usr/local/lib/../lib/erlang/../erlang/bin/x/y/../..", + ?line RP = "../lib/erlang/bin", + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "absolute"} -> + ?line {ok,{absolute, + B,join([TP,EP,EBe])}}; + {true, _} -> + ?line {ok,{relative,B,RP}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + + +bin_outside_eprfx(Config) when is_list(Config) -> + ?line E = "/usr/local", + ?line Bs = "/usr/bin", + ?line Be = Bs, + ?line EBs = "/usr/local/lib/erlang/bin", + ?line EBe = EBs, + ?line RP = "../local/lib/erlang/bin", + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "relative"} -> + ?line {ok,{relative,B,RP}}; + {true, _} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + + +bin_outside_eprfx_dirty(Config) when is_list(Config) -> + ?line E = "/usr/local/lib/..", + ?line Bs = "/usr/local/lib/../../bin", + ?line Be = Bs, + ?line EBs = "/usr/local/lib/erlang/bin", + ?line EBe = EBs, + ?line RP = "../local/lib/erlang/bin", + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "relative"} -> + ?line {ok,{relative,B,RP}}; + {true, _} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + +bin_unreasonable_path(Config) when is_list(Config) -> + ?line E = "/usr/local/../../..", + ?line Bs = "/usr/local/../../../bin", + ?line Be = Bs, + ?line EBs = "/usr/local/../../../bin_unreasonable_path/usr/local/lib/erlang/bin", + ?line EBe = EBs, + ?line RP = "../bin_unreasonable_path/usr/local/lib/erlang/bin", + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {TP, SL, BSL} of + {_, false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {_, false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {"", true, "relative"} -> + {error, unreasonable_path}; + {"", true, _} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}}; + {_, true, "absolute"} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}}; + _ -> + ?line {ok,{relative,B,RP}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + +bin_unreachable_absolute(Config) when is_list(Config) -> + TDir = ?config(test_dir, Config), + make_dirs(TDir, "/opt/local/lib/erlang/usr/bin"), + make_dirs(TDir, "/opt/local/lib/erlang/bin"), + Erl = join([TDir, "/opt/local/lib/erlang/bin/erl"]), + Erlc = join([TDir, "/opt/local/lib/erlang/bin/erlc"]), + make_dirs(TDir, "/usr/local/lib"), + make_dirs(TDir, "/usr/local/bin"), + ok = file:write_file(Erl, "erl"), + ok = file:write_file(Erlc, "erlc"), + ok = file:make_symlink("../../../opt/local/lib/erlang/usr", + join([TDir, "/usr/local/lib/erlang"])), + ?line E = "/usr/local", + ?line Bs = "/usr/local/bin", + ?line Be = Bs, + ?line EBs = "/usr/local/lib/erlang/../bin", + ?line EBe = EBs, + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "relative"} -> + {error, unreachable_absolute}; + {true, _} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + +bin_unreachable_relative(Config) when is_list(Config) -> + TDir = ?config(test_dir, Config), + make_dirs(TDir, "/opt/local/lib/erlang/bin"), + make_dirs(TDir, "/opt/local/bin"), + make_dirs(TDir, "/usr/local/lib/erlang/bin"), + Erl = join([TDir, "/usr/local/lib/erlang/bin/erl"]), + Erlc = join([TDir, "/usr/local/lib/erlang/bin/erlc"]), + ok = file:write_file(Erl, "erl"), + ok = file:write_file(Erlc, "erlc"), + ok = file:make_symlink("../../opt/local/bin", + join([TDir, "/usr/local/bin"])), + + ?line E = "/usr/local", + ?line Bs = "/usr/local/bin", + ?line Be = Bs, + ?line EBs = "/usr/local/lib/erlang/bin", + ?line EBe = EBs, + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "relative"} -> + {error, unreachable_relative}; + {true, _} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + +bin_ok_symlink(Config) when is_list(Config) -> + TDir = ?config(test_dir, Config), + make_dirs(TDir, "/usr/local/bin"), + make_dirs(TDir, "/opt/local/lib/erlang/bin"), + Erl = join([TDir, "/opt/local/lib/erlang/bin/erl"]), + Erlc = join([TDir, "/opt/local/lib/erlang/bin/erlc"]), + ok = file:write_file(Erl, "erl"), + ok = file:write_file(Erlc, "erlc"), + ok = file:make_symlink("../../opt/local/lib", + join([TDir, "/usr/local/lib"])), + ?line E = "/usr/local", + ?line Bs = "/usr/local/bin", + ?line Be = Bs, + ?line EBs = "/usr/local/lib/erlang/bin", + ?line EBe = EBs, + ?line RP = "../lib/erlang/bin", + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "absolute"} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}}; + {true, _} -> + ?line {ok,{relative,B,RP}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + +bin_same_dir(Config) when is_list(Config) -> + TDir = ?config(test_dir, Config), + make_dirs(TDir, "/usr/local/bin"), + make_dirs(TDir, "/usr/local/lib"), + ok = file:make_symlink("..", join([TDir, "/usr/local/lib/erlang"])), + Erl = join([TDir, "/usr/local/lib/erlang/bin/erl"]), + Erlc = join([TDir, "/usr/local/lib/erlang/bin/erlc"]), + ok = file:write_file(Erl, "erl"), + ok = file:write_file(Erlc, "erlc"), + ChkRes = fun (Res, _) -> + expect({error, target_and_source_same_dir}, Res) + end, + install_bin(Config, + #inst{mkdirs = false, + exec_prefix = "/usr/local", + bindir = "/usr/local/bin", + erlang_bindir = "/usr/local/lib/erlang/bin"}, + ChkRes). + +bin_not_abs(Config) when is_list(Config) -> + ChkRes = fun (Res, #inst{test_prefix = TP}) -> + case TP of + "" -> + expect({error, {not_abs, 'bindir'}}, Res); + _ -> + B = join([TP, "/usr/local/bin"]), + {ok, {relative, B, "../lib/erlang/bin"}} + end + end, + install_bin(Config, + #inst{exec_prefix = "/usr/local", + bindir = "usr/local/bin", + erlang_bindir = "/usr/local/lib/erlang/bin"}, + ChkRes). + + +'bin white space'(Config) when is_list(Config) -> + ?line E = "/u s r/local", + ?line Bs = "/u s r/local/b i n", + ?line Be = Bs, + ?line EBs = "/u s r/local/lib/erl ang/bin", + ?line EBe = EBs, + ?line RP = "../lib/erl ang/bin", + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "absolute"} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}}; + {true, _} -> + ?line {ok,{relative,B,RP}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + +bin_dirname_fail(Config) when is_list(Config) -> + ?line E = "/opt", + ?line Bs = "/opt/lib/../bin", + ?line Be = Bs, + ?line EBs = "/opt/lib/erlang/otp/bin", + ?line EBe = EBs, + ?line CMDPRFX = "PATH="++?config(data_dir,Config)++":"++os:getenv("PATH"), + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "relative"} -> + ?line {error, dirname_failed}; + {true, _} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{cmd_prefix = CMDPRFX, + exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + +bin_no_use_dirname_fail(Config) when is_list(Config) -> + ?line E = "/opt", + ?line Bs = "/opt/bin", + ?line Be = Bs, + ?line EBs = "/opt/lib/erlang/otp/bin", + ?line EBe = EBs, + ?line RP = "../lib/erlang/otp/bin", + ?line CMDPRFX = "PATH="++?config(data_dir,Config)++":"++os:getenv("PATH"), + ChkRes = fun (Res, #inst{test_prefix = TP, + destdir = D, + extra_prefix = EP, + bindir_symlinks = BSL, + symlinks = SL}) -> + ?line B = join([TP, D, EP, Be]), + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false, _} -> + ?line {ok,{absolute, + B,join([TP,D,EP,EBe])}}; + {true, "absolute"} -> + ?line {ok,{absolute,B,join([TP,EP,EBe])}}; + {true, _} -> + ?line {ok,{relative,B,RP}} + end, + expect(Expct, Res) + end, + install_bin(Config, #inst{cmd_prefix = CMDPRFX, + exec_prefix = E, + bindir = Bs, + erlang_bindir = EBs}, ChkRes). + +bin_no_srcfile(Config) when is_list(Config) -> + TDir = ?config(test_dir, Config), + make_dirs(TDir, "/opt/local/bin"), + make_dirs(TDir, "/opt/local/lib/erlang/bin"), + Erl = join([TDir, "/opt/local/lib/erlang/bin/erl"]), + ok = file:write_file(Erl, "erl"), + Erlc = join([TDir, "/opt/local/lib/erlang/bin/erlc"]), + RP_Erlc = "../lib/erlang/bin/erlc", + ChkRes = fun (Res, #inst{bindir_symlinks = BSL, + symlinks = SL}) -> + Expct = case {SL, BSL} of + {false, _} when BSL == "relative"; + BSL == "absolute" -> + ?line {error, no_ln_s}; + {false,_} -> + ?line {error,{no_srcfile, Erlc}}; + {true, "absolute"} -> + ?line {error,{no_srcfile, Erlc}}; + {true, _} -> + ?line {error,{no_srcfile, RP_Erlc}} + end, + expect(Expct, Res) + end, + install_bin(Config, + #inst{mkdirs = false, + exec_prefix = "/opt/local", + bindir = "/opt/local/bin", + erlang_bindir = "/opt/local/lib/erlang/bin"}, + ChkRes). + +%% +%% +%% Auxiliary functions +%% +%% + +expect(X, X) -> + ?t:format("result: ~p~n", [X]), + ?t:format("-----------------------------------------------~n", []), + ok; +expect(X, Y) -> + ?t:format("expected: ~p~n", [X]), + ?t:format("got : ~p~n", [Y]), + ?t:format("-----------------------------------------------~n", []), + ?t:fail({X,Y}). + +init_per_suite(Config) -> + PD = ?config(priv_dir, Config), + SymLinks = case ?t:os_type() of + {win32, _} -> false; + _ -> + case file:make_symlink("nothing", + filename:join(PD, + "symlink_test")) of + ok -> true; + _ -> false + end + end, + [{symlinks, SymLinks} | Config]. + +end_per_suite(_Config) -> + ok. + +init_per_testcase(Case, Config) -> + init_per_testcase_aux(?config(symlinks,Config),?t:os_type(),Case,Config). + +init_per_testcase_aux(_, {win32, _}, _Case, _Config) -> + {skip, "Not on windows"}; +init_per_testcase_aux(false, OsType, Case, Config) -> + case lists:member(Case, need_symlink_cases()) of + false -> init_per_testcase_aux(true, OsType, Case, Config); + true -> {skip, "Cannot create symbolic links"} + end; +init_per_testcase_aux(true, _OsType, Case, Config) -> + Dog = ?t:timetrap(?DEFAULT_TIMEOUT), + [{watchdog, Dog}, + {testcase, Case}, + {test_dir, make_dirs(?config(priv_dir, Config), atom_to_list(Case))} + | Config]. + +fin_per_testcase(_Case, Config) -> + Dog = ?config(watchdog, Config), + ?t:timetrap_cancel(Dog), + ok. + + +make_dirs(Root, Suffix) -> + do_make_dirs(Root, string:tokens(Suffix, [$/])). + +do_make_dirs(_Root, []) -> + ""; +do_make_dirs(Root, [D|Ds]) -> + Dir = filename:join(Root, D), + case file:make_dir(Dir) of + {error, eexist} -> ok; + ok -> ok; + Err -> exit({make_dir, Err}) + end, + filename:join(Dir, do_make_dirs(Dir, Ds)). + +install_bin(Config, #inst{mkdirs = MkDirs, + exec_prefix = EXEC_PREFIX, + bindir = BINDIR, + erlang_bindir = ERLANG_BINDIR} = Inst, ChkRes) -> + PDir = ?config(priv_dir, Config), + TDir = ?config(test_dir, Config), + TD = atom_to_list(?config(testcase, Config)), + case MkDirs of + false -> ok; + true -> + make_dirs(TDir, EXEC_PREFIX), + make_dirs(TDir, BINDIR), + make_dirs(TDir, ERLANG_BINDIR), + Erl = join([TDir, ERLANG_BINDIR, "/erl"]), + Erlc = join([TDir, ERLANG_BINDIR, "/erlc"]), + ok = file:write_file(Erl, "erl"), + ok = file:write_file(Erlc, "erlc") + end, + + install_bin2(Config, Inst#inst{destdir = TDir}, ChkRes), + install_bin2(Config, Inst#inst{extra_prefix = TDir}, ChkRes), + install_bin2(Config, Inst#inst{destdir = PDir, + extra_prefix = "/"++TD}, ChkRes), + install_bin2(Config, + Inst#inst{test_prefix = TDir, + exec_prefix = join([TDir, EXEC_PREFIX]), + bindir = join([TDir, BINDIR]), + erlang_bindir = join([TDir, ERLANG_BINDIR])}, + ChkRes), + case ?config(symlinks, Config) of + true -> ok; + false -> {comment, "No symlink tests run, since symlinks not working"} + end. + + +install_bin2(Config, Inst, ChkRes) -> + install_bin3(Config, Inst#inst{symlinks = false, + ln_s = "ln"}, ChkRes), + install_bin3(Config, Inst#inst{symlinks = false, + ln_s = "ln", + bindir_symlinks = "relative"}, ChkRes), + install_bin3(Config, Inst#inst{symlinks = false, + ln_s = "ln", + bindir_symlinks = "absolute"}, ChkRes), + install_bin3(Config, Inst#inst{symlinks = false, + ln_s = "cp -p"}, ChkRes), + install_bin3(Config, Inst#inst{symlinks = false, + ln_s = "cp -p", + bindir_symlinks = "relative"}, ChkRes), + install_bin3(Config, Inst#inst{symlinks = false, + ln_s = "cp -p", + bindir_symlinks = "absolute"}, ChkRes), + case ?config(symlinks, Config) of + true -> + install_bin3(Config, Inst#inst{symlinks = true, + ln_s = "ln -s"}, ChkRes), + install_bin3(Config, Inst#inst{symlinks = true, + ln_s = "ln -s", + bindir_symlinks = "relative"}, ChkRes), + install_bin3(Config, Inst#inst{symlinks = true, + ln_s = "ln -s", + bindir_symlinks = "absolute"}, ChkRes); + false -> + ok + end. + + + +install_bin3(Config, + #inst{cmd_prefix = CMD_PRFX, + ln_s = LN_S, + destdir = DESTDIR, + extra_prefix = EXTRA_PREFIX, + exec_prefix = EXEC_PREFIX, + bindir = BINDIR, + erlang_bindir = ERLANG_BINDIR, + bindir_symlinks = BINDIR_SYMLINKS} = Inst, + ChkRes) -> + Test = ?config(testcase, Config), + DDir = ?config(data_dir, Config), + TDir = ?config(test_dir, Config), + InstallBin = filename:join(DDir, "install_bin"), + ResFile = filename:join(TDir, atom_to_list(Test) ++ "-result.txt"), + Cmd = CMD_PRFX ++ " " + ++ InstallBin ++ " --ln_s \"" ++ LN_S + ++ "\" --destdir \"" ++ DESTDIR + ++ "\" --extra-prefix \"" ++ EXTRA_PREFIX + ++ "\" --bindir-symlinks \"" ++ BINDIR_SYMLINKS + ++ "\" --bindir \"" ++ BINDIR + ++ "\" --erlang-bindir \"" ++ ERLANG_BINDIR + ++ "\" --exec-prefix \"" ++ EXEC_PREFIX + ++ "\" --test-file \"" ++ ResFile ++ "\" erl erlc", + + ?t:format("CMD_PRFX = \"~s\"~n" + "LN_S = \"~s\"~n" + "BINDIR_SYMLINKS = \"~s\"~n" + "exec_prefix = \"~s\"~n" + "bindir = \"~s\"~n" + "erlang_bindir = \"~s\"~n" + "EXTRA_PREFIX = \"~s\"~n" + "DESTDIR = \"~s\"~n", + [CMD_PRFX, LN_S, BINDIR_SYMLINKS, EXEC_PREFIX, BINDIR, + ERLANG_BINDIR, EXTRA_PREFIX, DESTDIR]), + + ?t:format("$ ~s~n", [Cmd]), + CmdOutput = os:cmd(Cmd), + ?t:format("~s~n", [CmdOutput]), + ChkRes(case file:consult(ResFile) of + {ok, [Res]} -> Res; + Err -> exit({result, Err}) + end, + Inst). + +join("") -> + ""; +join([""|Ds]) -> + join(Ds); +join([D|Ds]) -> + "/" ++ string:strip(D, both, $/) ++ join(Ds). + diff --git a/erts/test/install_SUITE_data/dirname b/erts/test/install_SUITE_data/dirname new file mode 100755 index 0000000000..ecdbef95dd --- /dev/null +++ b/erts/test/install_SUITE_data/dirname @@ -0,0 +1,2 @@ +#!/bin/sh +exit 1 diff --git a/lib/Makefile b/lib/Makefile index 66062068b2..f5ffc6f166 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1996-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1996-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% include $(ERL_TOP)/make/target.mk @@ -51,7 +51,7 @@ else # -------------- # ERTS_SUB_DIRECTORIES = stdlib sasl kernel compiler - OTHER_SUB_DIRECTORIES = tools + OTHER_SUB_DIRECTORIES = tools test_server ifdef BUILD_ALL ifeq ($(findstring win32,$(TARGET)),win32) # BUILD_ALL on win32 OTHER_SUB_DIRECTORIES += \ @@ -60,7 +60,7 @@ else public_key ssl toolbar tv observer debugger reltool odbc runtime_tools \ cosTransactions cosEvent cosTime cosNotification cosProperty \ cosFileTransfer cosEventDomain et megaco webtool \ - xmerl edoc eunit ssh inviso typer docbuilder erl_docgen test_server common_test percept + xmerl edoc eunit ssh inviso typer docbuilder erl_docgen common_test percept # dialyzer OTHER_SUB_DIRECTORIES += hipe else # BUILD_ALL on unix @@ -70,7 +70,7 @@ else pman public_key ssl toolbar tv observer odbc \ runtime_tools cosTransactions cosEvent cosTime cosNotification \ cosProperty cosFileTransfer cosEventDomain et megaco webtool \ - xmerl edoc eunit ssh inviso typer docbuilder erl_docgen test_server common_test percept + xmerl edoc eunit ssh inviso typer docbuilder erl_docgen common_test percept # dialyzer OTHER_SUB_DIRECTORIES += hipe $(TSP_APP) endif diff --git a/lib/asn1/c_src/Makefile b/lib/asn1/c_src/Makefile index 53da8fd035..906c513fad 100644 --- a/lib/asn1/c_src/Makefile +++ b/lib/asn1/c_src/Makefile @@ -1,20 +1,132 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2002-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2002-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # # -include $(ERL_TOP)/make/run_make.mk +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk +include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk + +CC = $(DED_CC) +LD = $(DED_LD) +LIBS = $(DED_LIBS) + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../vsn.mk +VSN=$(ASN1_VSN) + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/asn1-$(VSN) + + +# ---------------------------------------------------- +# FLAGS misc +# ---------------------------------------------------- +ifeq ($(TYPE),debug) +TYPEMARKER = .debug +else +TYPEMARKER = +endif + +EI_LIBDIR = $(ERL_TOP)/lib/erl_interface/obj$(TYPEMARKER)/$(TARGET) + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +EI_INCLUDES = -I$(ERL_TOP)/lib/erl_interface/include +CFLAGS = $(DED_INCLUDES) $(EI_INCLUDES) $(DED_CFLAGS) +LDFLAGS += $(DED_LDFLAGS) + +LD_INCL_EI = -L$(EI_LIBDIR) + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +C_FILES = asn1_erl_driver.c + + +ifeq ($(TARGET),win32) +LD_EI = -lei_md +SHARED_OBJ_FILES = $(LIBDIR)/asn1_erl_drv.dll +OBJ_FILES = $(OBJDIR)/asn1_erl_drv.o +CLIB_FLAGS = +LN=cp +else +LD_EI = -lei +OBJ_FILES = $(OBJDIR)/asn1_erl_drv.o +ifeq ($(findstring vxworks,$(TARGET)),vxworks) +SHARED_OBJ_FILES = $(LIBDIR)/asn1_erl_drv.eld +CLIB_FLAGS = +else +SHARED_OBJ_FILES = $(LIBDIR)/asn1_erl_drv.so +CLIB_FLAGS = -lc +endif +LN= ln -s +endif + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +opt: $(OBJDIR) $(LIBDIR) $(SHARED_OBJ_FILES) + +debug: opt + +clean: + rm -f core *~ + rm -f $(LIBDIR)/* + rm -f $(OBJDIR)/* + +docs: + +# ---------------------------------------------------- +# Special Build Targets +# ---------------------------------------------------- + + +$(OBJ_FILES): $(C_FILES) + $(CC) -c $(CFLAGS) -o $(OBJ_FILES) $(C_FILES) + +$(SHARED_OBJ_FILES): $(OBJ_FILES) + $(LD) $(LDFLAGS) $(LD_INCL_EI) -o $(SHARED_OBJ_FILES) $(OBJ_FILES) $(LD_EI) $(CLIB_FLAGS) $(LIBS) + +$(LIBDIR): + -mkdir -p $(LIBDIR) + +$(OBJDIR): + -mkdir -p $(OBJDIR) + + + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + $(INSTALL_DIR) $(RELSYSDIR)/priv/lib + $(INSTALL_DATA) $(SHARED_OBJ_FILES) $(RELSYSDIR)/priv/lib + $(INSTALL_DIR) $(RELSYSDIR)/c_src + $(INSTALL_DATA) $(C_FILES) $(RELSYSDIR)/c_src + +release_docs_spec: + diff --git a/lib/asn1/c_src/Makefile.in b/lib/asn1/c_src/Makefile.in deleted file mode 100644 index b4a0cddba1..0000000000 --- a/lib/asn1/c_src/Makefile.in +++ /dev/null @@ -1,139 +0,0 @@ -# -# %CopyrightBegin% -# -# Copyright Ericsson AB 2002-2009. All Rights Reserved. -# -# The contents of this file are subject to the Erlang Public License, -# Version 1.1, (the "License"); you may not use this file except in -# compliance with the License. You should have received a copy of the -# Erlang Public License along with this software. If not, it can be -# retrieved online at http://www.erlang.org/. -# -# Software distributed under the License is distributed on an "AS IS" -# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -# the License for the specific language governing rights and limitations -# under the License. -# -# %CopyrightEnd% -# -# -include $(ERL_TOP)/make/target.mk -include $(ERL_TOP)/make/$(TARGET)/otp.mk - -ERLANG_OSTYPE = @ERLANG_OSTYPE@ - -CC = @CC@ - -LD = @DED_LD@ -LIBS = @LIBS@ - -LIBDIR = $(ERL_TOP)/lib/asn1/priv/lib/$(TARGET) -OBJDIR = $(ERL_TOP)/lib/asn1/priv/obj/$(TARGET) - -# ---------------------------------------------------- -# Application version -# ---------------------------------------------------- -include ../vsn.mk -VSN=$(ASN1_VSN) - -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH)/lib/asn1-$(VSN) - - -# ---------------------------------------------------- -# FLAGS misc -# ---------------------------------------------------- -ifeq ($(TYPE),debug) -TYPEMARKER = .debug -else -TYPEMARKER = -endif - -EI_LIBDIR = $(ERL_TOP)/lib/erl_interface/obj$(TYPEMARKER)/$(TARGET) - -# ---------------------------------------------------- -# FLAGS -# ---------------------------------------------------- -EI_INCLUDES = -I$(ERL_TOP)/lib/erl_interface/include -DRIVER_INCLUDES = -I$(ERL_TOP)/erts/emulator/beam \ - -I$(ERL_TOP)/erts/emulator/sys/$(ERLANG_OSTYPE) -CFLAGS = $(DRIVER_INCLUDES) $(EI_INCLUDES) @DED_CFLAGS@ -LDFLAGS += @DED_LDFLAGS@ - -LD_INCL_EI = -L$(EI_LIBDIR) - -# ---------------------------------------------------- -# Target Specs -# ---------------------------------------------------- - -C_FILES = asn1_erl_driver.c - - -ifeq ($(TARGET),win32) -LD_EI = -lei_md -SHARED_OBJ_FILES = $(LIBDIR)/asn1_erl_drv.dll -OBJ_FILES = $(OBJDIR)/asn1_erl_drv.o -CLIB_FLAGS = -LN=cp -else -LD_EI = -lei -OBJ_FILES = $(OBJDIR)/asn1_erl_drv.o -ifeq ($(findstring vxworks,$(TARGET)),vxworks) -SHARED_OBJ_FILES = $(LIBDIR)/asn1_erl_drv.eld -CLIB_FLAGS = -else -SHARED_OBJ_FILES = $(LIBDIR)/asn1_erl_drv.so -CLIB_FLAGS = -lc -endif -LN= ln -s -endif - -# ---------------------------------------------------- -# Targets -# ---------------------------------------------------- - -opt: $(OBJDIR) $(LIBDIR) $(SHARED_OBJ_FILES) - -debug: opt - -clean: - rm -f core *~ - rm -f $(LIBDIR)/* - rm -f $(OBJDIR)/* - -docs: - -# ---------------------------------------------------- -# Special Build Targets -# ---------------------------------------------------- - - -$(OBJ_FILES): $(C_FILES) $(OBJDIR) - $(CC) -c $(CFLAGS) -o $(OBJ_FILES) $(C_FILES) - -$(SHARED_OBJ_FILES): $(OBJ_FILES) $(LIBDIR) - $(LD) $(LDFLAGS) $(LD_INCL_EI) -o $(SHARED_OBJ_FILES) $(OBJ_FILES) $(LD_EI) $(CLIB_FLAGS) $(LIBS) - -$(LIBDIR): - -mkdir -p $(LIBDIR) - -$(OBJDIR): - -mkdir -p $(OBJDIR) - - - -# ---------------------------------------------------- -# Release Target -# ---------------------------------------------------- -include $(ERL_TOP)/make/otp_release_targets.mk - -release_spec: opt - $(INSTALL_DIR) $(RELSYSDIR)/priv/lib - $(INSTALL_DATA) $(SHARED_OBJ_FILES) $(RELSYSDIR)/priv/lib - $(INSTALL_DIR) $(RELSYSDIR)/c_src - $(INSTALL_DATA) $(C_FILES) $(RELSYSDIR)/c_src - -release_docs_spec: - diff --git a/lib/configure.in b/lib/configure.in deleted file mode 100644 index 7732556c46..0000000000 --- a/lib/configure.in +++ /dev/null @@ -1,37 +0,0 @@ -dnl Turn of caching -define([AC_CACHE_LOAD], )dnl -define([AC_CACHE_SAVE], )dnl - -dnl Process this file with autoconf to produce a configure script. -AC_INIT - -dnl -dnl This is just to run configure in all applications that need it. -dnl - -if test -z "$ERL_TOP" || test ! -d $ERL_TOP ; then - AC_MSG_ERROR(You need to set the environment variable ERL_TOP!) -fi -erl_top=${ERL_TOP} -AC_CONFIG_AUX_DIRS($erl_top/erts/autoconf) - -dnl Version 2.55 of autoconf generate code that assume a -dnl sub directory isn't a link. Internally at Ericsson -dnl some OTP application directories are soft links. -dnl An added "/." solves this problem. -dnl -dnl The arguments to AC_CONFIG_SUBDIRS should be literals -dnl but a bug in autoconf 2.13 breaks conditional use -dnl of multiple AC_CONFIG_SUBDIRS so we do it the "wrong" -dnl way to force correct code. - -appdirs="" -for d in * ; do - if test -f "$d/configure" ; then - appdirs="$appdirs $d/." - fi -done - -AC_CONFIG_SUBDIRS($appdirs) - -AC_OUTPUT diff --git a/lib/configure.in.src b/lib/configure.in.src new file mode 100644 index 0000000000..792a7f932a --- /dev/null +++ b/lib/configure.in.src @@ -0,0 +1,61 @@ +dnl +dnl %CopyrightBegin% +dnl +dnl Copyright Ericsson AB 1999-2010. All Rights Reserved. +dnl +dnl The contents of this file are subject to the Erlang Public License, +dnl Version 1.1, (the "License"); you may not use this file except in +dnl compliance with the License. You should have received a copy of the +dnl Erlang Public License along with this software. If not, it can be +dnl retrieved online at http://www.erlang.org/. +dnl +dnl Software distributed under the License is distributed on an "AS IS" +dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +dnl the License for the specific language governing rights and limitations +dnl under the License. +dnl +dnl %CopyrightEnd% +dnl + +dnl Turn of caching +define([AC_CACHE_LOAD], )dnl +define([AC_CACHE_SAVE], )dnl + +dnl Process this file with autoconf to produce a configure script. +AC_INIT + +dnl +dnl This is just to run configure in all applications that need it. +dnl + +if test -z "$ERL_TOP" || test ! -d $ERL_TOP ; then + AC_MSG_ERROR(You need to set the environment variable ERL_TOP!) +fi +erl_top=${ERL_TOP} +AC_CONFIG_AUX_DIRS($erl_top/erts/autoconf) + +AC_ARG_ENABLE(bootstrap-only, +[ --enable-bootstrap-only enable bootstrap only configuration], +[ if test "X$enableval" = "Xyes"; then + bootstrap_only=yes + else + bootstrap_only=no + fi +], +bootstrap_only=no) + +# Multiple versions of autoconf generates code that +# don't work on all platforms (e.g. SunOS 5.8) if +# sub directories are soft links. Internally at Ericsson +# some OTP application directories are soft links. +# An added "/." solves this problem. + +@BOOTSTRAP_CONFIGURE_APPS@ + +if test $bootstrap_only = no; then + +@NON_BOOTSTRAP_CONFIGURE_APPS@ + +fi + +AC_OUTPUT diff --git a/lib/crypto/c_src/Makefile.in b/lib/crypto/c_src/Makefile.in index 29263d7ac7..c62ebde27b 100644 --- a/lib/crypto/c_src/Makefile.in +++ b/lib/crypto/c_src/Makefile.in @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1999-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # include $(ERL_TOP)/make/target.mk @@ -81,20 +81,12 @@ ifeq ($(HOST_OS),) HOST_OS := $(shell $(ERL_TOP)/erts/autoconf/config.guess) endif DYNAMIC_CRYPTO_LIB=@SSL_DYNAMIC_ONLY@ -LD_R_FLAG=@DED_LD_FLAG_RUNTIME_LIBRARY_PATH@ -ifeq ($(strip $(LD_R_FLAG)),) -LD_R_OPT = -else -ifeq ($(DYNAMIC_CRYPTO_LIB),yes) -LD_R_OPT = $(LD_R_FLAG)$(SSL_LIBDIR) -else -LD_R_OPT = -endif -endif ifeq ($(DYNAMIC_CRYPTO_LIB),yes) -CRYPTO_LINK_LIB=-L$(SSL_LIBDIR) -lcrypto +SSL_DED_LD_RUNTIME_LIBRARY_PATH = @SSL_DED_LD_RUNTIME_LIBRARY_PATH@ +CRYPTO_LINK_LIB=$(SSL_DED_LD_RUNTIME_LIBRARY_PATH) -L$(SSL_LIBDIR) -lcrypto else +SSL_DED_LD_RUNTIME_LIBRARY_PATH= CRYPTO_LINK_LIB=$(SSL_LIBDIR)/libcrypto.a endif @@ -116,11 +108,11 @@ $(OBJDIR)/%.o: %.c $(LIBDIR)/crypto_drv.so: $(OBJS) $(INSTALL_DIR) $(LIBDIR) - $(LD) $(LDFLAGS) $(LD_R_OPT) -o $@ $^ $(LDLIBS) $(CRYPTO_LINK_LIB) + $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(CRYPTO_LINK_LIB) $(LIBDIR)/crypto_drv.dll: $(OBJS) $(INSTALL_DIR) $(LIBDIR) - $(LD) $(LDFLAGS) -o $@ -L$(SSL_LIBDIR) $(OBJS) -llibeay32 + $(LD) $(LDFLAGS) -o $@ $(SSL_DED_LD_RUNTIME_LIBRARY_PATH) -L$(SSL_LIBDIR) $(OBJS) -llibeay32 clean: rm -f $(DYN_DRIVER) $(OBJS) diff --git a/lib/erl_interface/configure.in b/lib/erl_interface/configure.in index 2f5b5673bb..7728cb97be 100644 --- a/lib/erl_interface/configure.in +++ b/lib/erl_interface/configure.in @@ -1,19 +1,19 @@ # -*- Autoconf -*- # %CopyrightBegin% -# -# Copyright Ericsson AB 2000-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2000-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # # Process this file with autoconf to produce a configure script. @@ -65,18 +65,12 @@ fi TARGET=$host AC_SUBST(TARGET) -AC_CONFIG_HEADER([src/$host/config.h:src/auxdir/config.h.in]) +AC_CONFIG_HEADER([src/$host/config.h:config.h.in]) dnl ---------------------------------------------------------------------- dnl Optional features dnl ---------------------------------------------------------------------- -AC_ARG_WITH(xcomp-conf, -[ --with-xcompconf=PATH path to cross compilation configuration]) -if test "x$with_xcompconf" != "xno" -a "x$with_xcompconf" != "x" ; then - . $with_xcompconf -fi - # Use --disable-threads to force building single threaded libs even # if pthreads exists (for test purposes). AC_ARG_ENABLE(threads, @@ -95,9 +89,8 @@ AC_PROG_CC AC_PROG_CPP dnl AC_PROG_LIBTOOL AC_PROG_RANLIB -if test "x$LD" = "x"; then - AC_CHECK_TOOL([LD],[ld],[ld]) -fi +AC_CHECK_PROG(LD, ld.sh) +AC_CHECK_TOOL(LD, ld, '$(CC)') AC_SUBST(LD) AC_CHECK_SIZEOF(short) @@ -110,8 +103,8 @@ if test $ac_cv_sizeof_void_p = 8; then CFLAGS="$CFLAGS -DEI_64BIT" fi -AC_CHECK_PROG(AR, ar, ar, false) -if test "$ac_cv_prog_AR" = false; then +AC_CHECK_TOOL(AR, ar, false) +if test "$AR" = false; then AC_MSG_ERROR([No 'ar' command found in PATH]) fi @@ -164,7 +157,7 @@ AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h>], [socklen_t mylen;], [AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SOCKLEN_T)], + AC_DEFINE(HAVE_SOCKLEN_T, [], [Define if you have the `socklen_t' type])], [AC_MSG_RESULT(no)]) # Checks for library functions. @@ -209,7 +202,7 @@ if test "x$with_gmp" = "xyes" ;then AC_CHECK_HEADER($dir/include/gmp.h, ac_cv_gmp=yes, ac_cv_gmp=no) if test $ac_cv_gmp = yes ; then CFLAGS="$CFLAGS -I$dir/include -L$dir/lib" - AC_DEFINE(HAVE_GMP_H) + AC_DEFINE(HAVE_GMP_H, [], [Define if you have "gmp.h"]) break fi done @@ -226,7 +219,7 @@ elif test "x$with_gmp" != "xno" -a -n "$with_gmp" ;then fi AC_MSG_RESULT(yes) CFLAGS="$CFLAGS -I$with_gmp/include -L$with_gmp/lib" - AC_DEFINE(HAVE_GMP_H) + AC_DEFINE(HAVE_GMP_H, [], [Define if you have "gmp.h"]) AC_CHECK_LIB(gmp, __gmpz_export) # FIXME return ERROR if no lib fi @@ -279,110 +272,43 @@ AC_SUBST(MIXED_CYGWIN) dnl dnl Threads dnl -found_threads=no THR_LIBS= THR_DEFS= -EI_THREADS="false" AC_SUBST(THR_LIBS) AC_SUBST(THR_DEFS) AC_SUBST(EI_THREADS) case "$threads_disabled" in - no) - AC_MSG_CHECKING([for native win32 threads]) - if test "X$host_os" = "Xwin32"; then - THR_DEFS="-DWIN32_THREADS" - found_threads=yes - EI_THREADS="true" - AC_MSG_RESULT([yes]) - AC_MSG_CHECKING([for __declspec(thread) usability]) - if test "X$GCC" = "Xyes"; then - AC_MSG_RESULT([no]) - else - THR_DEFS="$THR_DEFS -DUSE_DECLSPEC_THREAD" - AC_MSG_RESULT([yes]) - fi + no) + LM_CHECK_THR_LIB + + case "$THR_LIB_NAME" in + "") + EI_THREADS="false" + ;; + win32_threads) + EI_THREADS="true" + AC_MSG_CHECKING([for __declspec(thread) usability]) + if test "X$GCC" = "Xyes"; then + AC_MSG_RESULT([no]) else - AC_MSG_RESULT(no) - - dnl Check for POSIX threads - - pthread_lib="" - AC_CHECK_LIB(pthread, - pthread_create, - [found_threads=yes - EI_THREADS="true" - THR_LIBS="-lpthread" - THR_DEFS="-D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS" - pthread_lib=pthread]) - - # FreeBSD has pthreads in special c library, c_r - if test $found_threads = no; then - AC_CHECK_LIB(c_r, - pthread_create, - [found_threads=yes - EI_THREADS="true" - THR_LIBS="-lc_r" - THR_DEFS="-D_REENTRANT -D_THREAD_SAFE -DPOSIX_THREADS" - pthread_lib=c_r]) - fi - - if test "x$pthread_lib" != "x"; then - AC_CHECK_LIB($pthread_lib,pthread_atfork,AC_DEFINE(HAVE_PTHREAD_ATFORK)) - AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H)) - dnl Some Linuxes have <pthread/mit/pthread.h> instead of <pthread.h> - AC_CHECK_HEADER(pthread/mit/pthread.h, AC_DEFINE(HAVE_MIT_PTHREAD_H)) - case $host_os in - solaris*) - THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS";; - linux*) - dnl NPTL test stolen from $ERL_TOP/erts/aclocal.m4 - AC_MSG_CHECKING(for Native POSIX Thread Library) - case `getconf GNU_LIBPTHREAD_VERSION 2>/dev/null` in - nptl*) nptl=yes;; - NPTL*) nptl=yes;; - *) nptl=no;; - esac - AC_MSG_RESULT($nptl) - if test $nptl = yes; then - need_nptl_incldir=no - AC_CHECK_HEADER(nptl/pthread.h, need_nptl_incldir=yes) - if test $need_nptl_incldir = yes; then - # Ahh... - nptl_path="$C_INCLUDE_PATH:$CPATH:/usr/local/include:/usr/include" - nptl_ws_path= - save_ifs="$IFS"; IFS=":" - for dir in $nptl_path; do - if test "x$dir" != "x"; then - nptl_ws_path="$nptl_ws_path $dir" - fi - done - IFS=$save_ifs - nptl_incldir= - for dir in $nptl_ws_path; do - AC_CHECK_HEADER($dir/nptl/pthread.h, - nptl_incldir=$dir/nptl) - if test "x$nptl_incldir" != "x"; then - THR_DEFS="$THR_DEFS -isystem $nptl_incldir" - break - fi - done - if test "x$nptl_incldir" = "x"; then - AC_MSG_ERROR(Failed to locate nptl system include directory) - fi - fi - fi - - ;; - *) - ;; - esac - fi + THR_DEFS="$THR_DEFS -DUSE_DECLSPEC_THREAD" + AC_MSG_RESULT([yes]) fi ;; - yes) - # Threads disabled - ;; + pthread) + EI_THREADS="true" + ;; + *) + EI_THREADS="true" + AC_MSG_WARN([Unexpected thread library: $THR_LIB_NAME]) + ;; + esac + ;; + yes) + # Threads disabled + EI_THREADS="false" + ;; esac # --------------------------------------------------------------------------- @@ -413,12 +339,10 @@ fi # FIXME We want to use libtool but until then.... # --------------------------------------------------------------------------- -AC_SUBST(DED_CFLAGS) -dnl AC_SUBST(DED_LD) -dnl AC_SUBST(DED_LDFLAGS) +AC_SUBST(LIB_CFLAGS) if test "X$host" = "Xwin32"; then - DED_CFLAGS="$CFLAGS" + LIB_CFLAGS="$CFLAGS" else case $host_os in darwin*) @@ -427,9 +351,9 @@ else esac if test "x$GCC" = xyes; then - DED_CFLAGS="$CFLAGS -fPIC" + LIB_CFLAGS="$CFLAGS -fPIC" else - DED_CFLAGS="$CFLAGS" + LIB_CFLAGS="$CFLAGS" fi fi diff --git a/lib/erl_interface/src/Makefile.in b/lib/erl_interface/src/Makefile.in index b8ee5c83c7..ec094789ce 100644 --- a/lib/erl_interface/src/Makefile.in +++ b/lib/erl_interface/src/Makefile.in @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1997-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1997-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # @@ -106,7 +106,7 @@ WARNFLAGS = @WFLAGS@ endif ifneq ($(findstring ose,$(TARGET)),ose) -CFLAGS = @DED_CFLAGS@ $(WARNFLAGS) $(INCFLAGS) $(TYPE_FLAGS) +CFLAGS = @LIB_CFLAGS@ $(WARNFLAGS) $(INCFLAGS) $(TYPE_FLAGS) else CFLAGS = @CFLAGS@ $(INCFLAGS) endif diff --git a/lib/erl_interface/src/auxdir/config.h.in b/lib/erl_interface/src/auxdir/config.h.in deleted file mode 100644 index 523c766993..0000000000 --- a/lib/erl_interface/src/auxdir/config.h.in +++ /dev/null @@ -1,277 +0,0 @@ -/* config.h.in. Generated from configure.in by autoheader. */ - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if you have the <arpa/inet.h> header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the `clock_gettime' function. */ -#undef HAVE_CLOCK_GETTIME - -/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you - don't. */ -#undef HAVE_DECL_STRERROR_R - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - -/* Define to 1 if you have the `dup2' function. */ -#undef HAVE_DUP2 - -/* Define to 1 if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `gethostbyaddr' function. */ -#undef HAVE_GETHOSTBYADDR - -/* Define to 1 if you have the `gethostbyname' function. */ -#undef HAVE_GETHOSTBYNAME - -/* Define to 1 if you have the `gethostbyname_r' function. */ -#undef HAVE_GETHOSTBYNAME_R - -/* Define to 1 if you have the `gethostname' function. */ -#undef HAVE_GETHOSTNAME - -/* Define to 1 if you have the `gethrtime' function. */ -#undef HAVE_GETHRTIME - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the <gmp.h> header file. */ -#undef HAVE_GMP_H - -/* Define to 1 if you have the `inet_ntoa' function. */ -#undef HAVE_INET_NTOA - -/* Define to 1 if you have the <inttypes.h> header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `gmp' library (-lgmp). */ -#undef HAVE_LIBGMP - -/* Define to 1 if you have the `m' library (-lm). */ -#undef HAVE_LIBM - -/* Define to 1 if you have the `nsl' library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Define to 1 if you have the `resolv' library (-lresolv). */ -#undef HAVE_LIBRESOLV - -/* Define to 1 if you have the `socket' library (-lsocket). */ -#undef HAVE_LIBSOCKET - -/* Define to 1 if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the <malloc.h> header file. */ -#undef HAVE_MALLOC_H - -/* Define to 1 if you have the `memchr' function. */ -#undef HAVE_MEMCHR - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have the <netdb.h> header file. */ -#undef HAVE_NETDB_H - -/* Define to 1 if you have the <netinet/in.h> header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the <pthread/mit/pthread.h> header file. */ -#undef HAVE_MIT_PTHREAD_H - -/* Define to 1 if you have the <pthread.h> header file. */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ -#undef HAVE_REALLOC - -/* Define if you have the res_gethostbyname function. */ -#undef HAVE_RES_GETHOSTBYNAME - -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - -/* Define to 1 if you have the `socket' function. */ -#undef HAVE_SOCKET - -/* Define to 1 if you have the <stddef.h> header file. */ -#undef HAVE_STDDEF_H - -/* Define to 1 if you have the <stdint.h> header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define to 1 if you have the `strerror_r' function. */ -#undef HAVE_STRERROR_R - -/* Define to 1 if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strrchr' function. */ -#undef HAVE_STRRCHR - -/* Define to 1 if you have the `strstr' function. */ -#undef HAVE_STRSTR - -/* Define to 1 if you have the <sys/param.h> header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the <sys/select.h> header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the <sys/socket.h> header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the <sys/types.h> header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the `uname' function. */ -#undef HAVE_UNAME - -/* Define to 1 if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define to 1 if you have the <vfork.h> header file. */ -#undef HAVE_VFORK_H - -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF - -/* Define to 1 if `fork' works. */ -#undef HAVE_WORKING_FORK - -/* Define to 1 if `vfork' works. */ -#undef HAVE_WORKING_VFORK - -/* Define if you have the writev function. */ -#undef HAVE_WRITEV - -/* Define if you have the socklen_t datatype */ -#undef HAVE_SOCKLEN_T - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* Define to the type of arg 1 for `select'. */ -#undef SELECT_TYPE_ARG1 - -/* Define to the type of args 2, 3 and 4 for `select'. */ -#undef SELECT_TYPE_ARG234 - -/* Define to the type of arg 5 for `select'. */ -#undef SELECT_TYPE_ARG5 - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if strerror_r returns char *. */ -#undef STRERROR_R_CHAR_P - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef gid_t - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to `int' if <sys/types.h> does not define. */ -#undef pid_t - -/* Define to rpl_realloc if the replacement function should be used. */ -#undef realloc - -/* Define to `unsigned' if <sys/types.h> does not define. */ -#undef size_t - -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef uid_t - -/* Define as `fork' if `vfork' does not work. */ -#undef vfork - -/* Define to empty if the keyword `volatile' does not work. Warning: valid - code using `volatile' can become incorrect without. Disable with care. */ -#undef volatile diff --git a/lib/hipe/rtl/Makefile b/lib/hipe/rtl/Makefile index beab8da547..55d20af8af 100644 --- a/lib/hipe/rtl/Makefile +++ b/lib/hipe/rtl/Makefile @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # @@ -113,8 +113,11 @@ HIPE_MKLITERALS=$(ERL_TOP)/bin/$(TARGET)/hipe_mkliterals hipe_literals.hrl: $(HIPE_MKLITERALS) $(HIPE_MKLITERALS) -e > hipe_literals.hrl +# Need to generate hipe.hrl from one and only one target in one and only +# one makefile; otherwise, clearmake will force rebuilds of hipe over and +# over again. ../main/hipe.hrl: ../vsn.mk ../main/hipe.hrl.src - sed -e "s;%VSN%;$(HIPE_VSN);" ../main/hipe.hrl.src > ../main/hipe.hrl + (cd ../main && $(MAKE) hipe.hrl) $(EBIN)/hipe_rtl.beam: hipe_rtl.hrl ../main/hipe.hrl $(EBIN)/hipe_rtl_arch.beam: hipe_rtl.hrl hipe_literals.hrl diff --git a/lib/megaco/configure.in b/lib/megaco/configure.in index 297d618369..8f94a4efcf 100644 --- a/lib/megaco/configure.in +++ b/lib/megaco/configure.in @@ -1,20 +1,20 @@ dnl Process this file with autoconf to produce a configure script. -*-m4-*- dnl dnl %CopyrightBegin% -dnl -dnl Copyright Ericsson AB 2001-2009. All Rights Reserved. -dnl +dnl +dnl Copyright Ericsson AB 2001-2010. All Rights Reserved. +dnl dnl The contents of this file are subject to the Erlang Public License, dnl Version 1.1, (the "License"); you may not use this file except in dnl compliance with the License. You should have received a copy of the dnl Erlang Public License along with this software. If not, it can be dnl retrieved online at http://www.erlang.org/. -dnl +dnl dnl Software distributed under the License is distributed on an "AS IS" dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See dnl the License for the specific language governing rights and limitations dnl under the License. -dnl +dnl dnl %CopyrightEnd% dnl @@ -145,12 +145,14 @@ AC_ARG_ENABLE(megaco_flex_scanner_lineno, AC_SUBST(ENABLE_MEGACO_FLEX_SCANNER_LINENO) +dnl This is the os flavour, should be unix, vxworks or win32 +if test "X$host" = "Xwin32"; then + ERLANG_OSTYPE=win32 +else + ERLANG_OSTYPE=unix +fi -dnl -dnl C compiler (related) defs -dnl - -AC_PROG_CC +AC_SUBST(ERLANG_OSTYPE) dnl Magic test for clearcase. if test -d ../../system; then @@ -158,33 +160,55 @@ if test -d ../../system; then else OTP_EXTRA_FLAGS= fi +AC_SUBST(OTP_EXTRA_FLAGS) + +dnl +dnl If ${ERL_TOP}/make/otp_ded.mk.in exists and contains DED_MK_VSN > 0, +dnl every thing releted to compiling Dynamic Erlang Drivers can be found +dnl in $(ERL_TOP)/make/$(TARGET)/ded.mk at compile time. If not, try to +dnl figure these things out. +dnl + +AC_MSG_CHECKING([for usable Dynamic Erlang Driver configuration]) +[ + ded_mk_in="${ERL_TOP}/make/otp_ded.mk.in" + ded_mk_vsn= + test -r "$ded_mk_in" && + ded_mk_vsn=`sed -n "s/^DED_MK_VSN[ ]*=[ ]*\(.*\)/\1/p" < "$ded_mk_in"` + test "$ded_mk_vsn" != "" || ded_mk_vsn=0 +] + +if test $ded_mk_vsn -gt 0; then + +HAVE_USABLE_OTP_DED_MK=yes +AC_MSG_RESULT([yes]) +CC=false +AC_SUBST(CC) +DED_LD=false +AC_SUBST(DED_LD) + +else dnl --- begin no usable otp_ded.mk.in --- + +HAVE_USABLE_OTP_DED_MK=no +AC_MSG_RESULT([no]) dnl -dnl The ErlDrvEntry struct changed in R13 (another field) +dnl C compiler (related) defs dnl -AC_CHECK_MEMBERS([struct ErlDrvEntry.stop_select], - [ - CFLAGS="$CFLAGS -DMEGACO_DRV_ENTRY_HAS_STOP_SELECT" - ], - [], - [ - #include "erl_driver.h" - ]) +AC_PROG_CC dnl dnl Flags to the C compiler dnl -dnl make sure we find config.h -CFLAGS="$CFLAGS -I${ERL_TOP}/erts/$host -I${ERL_TOP}/erts/include/$host $OTP_EXTRA_FLAGS" if test "X$host" = "Xwin32"; then DED_CFLAGS="$CFLAGS" else case $host_os in darwin*) - CFLAGS="$CFLAGS -no-cpp-precomp" + CFLAGS="$CFLAGS -no-cpp-precomp -fno-common" ;; esac @@ -196,22 +220,10 @@ else fi dnl emulator includes needed -DED_INCLUDE="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host" - -DED_CFLAGS="$DED_INCLUDE $DED_CFLAGS" - - +DED_INCLUDES="-I${ERL_TOP}/erts/emulator/beam -I${ERL_TOP}/erts/include -I${ERL_TOP}/erts/include/$host -I${ERL_TOP}/erts/include/internal -I${ERL_TOP}/erts/include/internal/$host -I${ERL_TOP}/erts/emulator/sys/$ERLANG_OSTYPE" -AC_SUBST(DED_CFLAGS) - - -AC_CHECK_PROGS(DED_LD, [ld.sh ld], no_ld) -if test "$DED_LD" = no_ld; then - AC_MSG_ERROR([ld is required to build the flex scanner!]) -fi +DED_THR_DEFS="-D_THREAD_SAFE -D_REENTRANT" - -AC_MSG_CHECKING(for linker flags for loadable drivers) case $host_os in win32) DED_LDFLAGS="-dll" @@ -230,33 +242,36 @@ case $host_os in # Mach-O linker, a shared lib and a loadable # object file is not the same thing. DED_LDFLAGS="-bundle -flat_namespace -undefined suppress" - DED_CFLAGS="$DED_CFLAGS -fno-common" + DED_LD="$CC" ;; *) # assume GNU linker and ELF DED_LDFLAGS="-shared" ;; esac + +AC_CHECK_PROGS(DED_LD, [$LD ld.sh]) +AC_CHECK_TOOL(DED_LD, ld, no_ld) +if test "$DED_LD" = no_ld; then + AC_MSG_ERROR([ld is required to build the flex scanner!]) +fi + +AC_MSG_CHECKING(for linker flags for loadable drivers) DED_LDFLAGS="$LDFLAGS $DED_LDFLAGS" AC_MSG_RESULT([$DED_LDFLAGS]) -AC_SUBST(DED_LDFLAGS) +fi dnl --- end no usable otp_ded.mk.in --- + +AC_SUBST(HAVE_USABLE_OTP_DED_MK) +AC_SUBST(DED_CFLAGS) +AC_SUBST(DED_INCLUDES) +AC_SUBST(DED_THR_DEFS) +AC_SUBST(DED_LDFLAGS) AC_CHECK_PROG(PERL, perl, perl, no_perl) if test "$PERL" = no_perl; then AC_MSG_ERROR([Perl is required to build the flex scanner!]) fi - -dnl This is the os flavour, should be unix, vxworks or win32 -if test "X$host" = "Xwin32"; then - ERLANG_OSTYPE=win32 -else - ERLANG_OSTYPE=unix -fi - -AC_SUBST(ERLANG_OSTYPE) - - AC_OUTPUT(src/flex/$host/Makefile:src/flex/Makefile.in) diff --git a/lib/megaco/src/flex/Makefile.in b/lib/megaco/src/flex/Makefile.in index 782d6a4807..6ce9b34617 100644 --- a/lib/megaco/src/flex/Makefile.in +++ b/lib/megaco/src/flex/Makefile.in @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2001-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2001-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% include $(ERL_TOP)/make/target.mk @@ -23,13 +23,30 @@ MEGACO_INCLUDEDIR = ../../include include $(ERL_TOP)/make/$(TARGET)/otp.mk - # ---------------------------------------------------- # Application version # ---------------------------------------------------- include ../../vsn.mk VSN=$(MEGACO_VSN) +# ---------------------------------------------------- +# Dynamic Erlang Driver +# ---------------------------------------------------- +HAVE_USABLE_OTP_DED_MK = @HAVE_USABLE_OTP_DED_MK@ + +ifeq ($(HAVE_USABLE_OTP_DED_MK),yes) +# otp_ded.mk will be used on R13B04 and later +include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk +else +# megacos configure provide the info instead +DED_CC = @CC@ +DED__NOWARN_NOTHR_CFLAGS = @DED_CFLAGS@ +DED_THR_DEFS = @DED_THR_DEFS@ +DED_LD = @DED_LD@ +DED_LDFLAGS = @DED_LDFLAGS@ +DED_INCLUDES = @DED_INCLUDES@ +DED_EXT = so +endif # ---------------------------------------------------- # The following variables differ on different systems, we set @@ -39,16 +56,16 @@ VSN=$(MEGACO_VSN) FLEX_VSN = $(shell flex --version) -TMP_CFLAGS = @DED_CFLAGS@ +TMP_CFLAGS = $(DED__NOWARN_NOTHR_CFLAGS) @OTP_EXTRA_FLAGS@ ifeq ($(TYPE),valgrind) CFLAGS = $(subst -O2, , $(TMP_CFLAGS)) -DVALGRIND else CFLAGS = $(TMP_CFLAGS) endif -CC = @CC@ -CFLAGS_MT = $(CFLAGS) -D_THREAD_SAFE -D_REENTRANT -LD = @DED_LD@ -LDFLAGS = @DED_LDFLAGS@ +CC = $(DED_CC) +CFLAGS_MT = $(CFLAGS) $(DED_THR_DEFS) +LD = $(DED_LD) +LDFLAGS = $(DED_LDFLAGS) LEX = @LEX@ LEXLIB = @LEXLIB@ PERL = @PERL@ @@ -87,18 +104,13 @@ ENABLE_MEGACO_FLEX_SCANNER_LINENO = @ENABLE_MEGACO_FLEX_SCANNER_LINENO@ endif endif - -SYSINCLUDE = -I$(ERL_TOP)/erts/emulator/beam \ - -I$(ERL_TOP)/erts/emulator/sys/$(ERLANG_OSTYPE) ifeq ($(findstring vxworks,$(TARGET)),vxworks) - SYSINCLUDE += -I$(ERL_TOP)/erts/etc/vxworks + DED_INCLUDES += -I$(ERL_TOP)/erts/etc/vxworks endif -DRIVER_INCLUDES = $(SYSINCLUDE) - PRIVDIR = ../../priv LIBDIR = $(PRIVDIR)/lib/$(TARGET) - +OBJDIR = $(PRIVDIR)/obj/$(TARGET) # ---------------------------------------------------- # Release directory specification @@ -138,8 +150,8 @@ ifeq ($(findstring vxworks,$(TARGET)),vxworks) FLEX_SCANNER_SO = SOLIBS = $(FLEX_SCANNER_SO) else -FLEX_SCANNER_SO = $(LIBDIR)/$(STD_DRV).so -FLEX_SCANNER_MT_SO = $(LIBDIR)/$(MT_DRV).so +FLEX_SCANNER_SO = $(LIBDIR)/$(STD_DRV).$(DED_EXT) +FLEX_SCANNER_MT_SO = $(LIBDIR)/$(MT_DRV).$(DED_EXT) SOLIBS = $(FLEX_SCANNER_SO) $(FLEX_SCANNER_MT_SO) endif endif @@ -175,7 +187,7 @@ else CFLAGS += -DMFS_FLEX_DEBUG=0 endif -CFLAGS += $(DRIVER_INCLUDES) $(DRV_FLAGS) -funroll-loops -Wall +CFLAGS += $(DED_INCLUDES) -I$(ERL_TOP)/erts/$(TARGET) $(DRV_FLAGS) -funroll-loops -Wall #ifneq ($(FLEX_VSN),) #CFLAGS += -DFLEX_VERSION="$(FLEX_VSN)" @@ -379,18 +391,30 @@ $(STD_DRV).c: $(STD_DRV).flex $(MT_DRV).c: $(MT_DRV).flex $(LEX) $(MT_LEX_FLAGS) -P$* -o$@ $< -solibs: $(LIBDIR) $(SOLIBS) +solibs: $(LIBDIR) $(OBJDIR) $(SOLIBS) + +$(OBJDIR)/$(STD_DRV).o: $(STD_DRV).c + @echo "compiling std driver:" + $(CC) -c $(STD_DRV_NAME) $(CFLAGS) -o $@ $< + +$(OBJDIR)/$(MT_DRV).o: $(MT_DRV).c + @echo "compiling multi-threaded driver:" + $(CC) -c $(MT_DRV_NAME) $(CFLAGS_MT) -o $@ $< + # No need to link with -lfl as we have also defined %option noyywrap - # and having -lfl doesn't work under Darwin for some reason. - Sean -$(LIBDIR)/$(STD_DRV).so: $(STD_DRV).c - @echo "std driver:" - $(CC) $(STD_DRV_NAME) $(CFLAGS) $(LDFLAGS) -o $(LIBDIR)/$(STD_DRV).so $< +$(LIBDIR)/$(STD_DRV).$(DED_EXT): $(OBJDIR)/$(STD_DRV).o + @echo "linking std driver:" + $(LD) $(LDFLAGS) -o $@ $< -$(LIBDIR)/$(MT_DRV).so: $(MT_DRV).c - @echo "multi-threaded driver:" - $(CC) $(MT_DRV_NAME) $(CFLAGS_MT) $(LDFLAGS) -o $(LIBDIR)/$(MT_DRV).so $< +$(LIBDIR)/$(MT_DRV).$(DED_EXT): $(OBJDIR)/$(MT_DRV).o + @echo "linking multi-threaded driver:" + $(LD) $(LDFLAGS) -o $@ $< $(LIBDIR): -mkdir -p $(LIBDIR) +$(OBJDIR): + -mkdir -p $(OBJDIR) + diff --git a/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src b/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src index b96a69415d..9b4f717201 100644 --- a/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src +++ b/lib/megaco/src/flex/megaco_flex_scanner_drv.flex.src @@ -1,19 +1,19 @@ /* * %CopyrightBegin% - * - * Copyright Ericsson AB 2001-2009. All Rights Reserved. - * + * + * Copyright Ericsson AB 2001-2010. All Rights Reserved. + * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in * compliance with the License. You should have received a copy of the * Erlang Public License along with this software. If not, it can be * retrieved online at http://www.erlang.org/. - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. - * + * * %CopyrightEnd% * * ---------------------------------------------------------------------- @@ -354,9 +354,6 @@ static ErlDrvEntry mfs_entry = { MEGACO_DRIVER_FLAGS, /* driver_flags, used for port lock indication */ NULL, /* handle2, emulator internal use */ NULL /* process_exit, Called when a process monitor fires */ -#if defined(MEGACO_DRV_ENTRY_HAS_STOP_SELECT) - ,NULL /* stop_select, Called to close an event object */ -#endif }; diff --git a/lib/odbc/aclocal.m4 b/lib/odbc/aclocal.m4 new file mode 120000 index 0000000000..151fd5ea5a --- /dev/null +++ b/lib/odbc/aclocal.m4 @@ -0,0 +1 @@ +../../erts/aclocal.m4
\ No newline at end of file diff --git a/lib/odbc/c_src/Makefile.in b/lib/odbc/c_src/Makefile.in index 6a9a174417..ed3eeb1d42 100644 --- a/lib/odbc/c_src/Makefile.in +++ b/lib/odbc/c_src/Makefile.in @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1999-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # @@ -78,11 +78,11 @@ ODBC_INCLUDE = @ODBC_INCLUDE@ # FLAGS # ---------------------------------------------------- CC = @CC@ -CFLAGS = $(TYPEFLAGS) @CFLAGS@ +CFLAGS = $(TYPEFLAGS) @CFLAGS@ @THR_DEFS@ @DEFS@ EI_LDFLAGS = -L$(EI_ROOT)/obj$(TYPEMARKER)/$(TARGET) -LD = @DED_LD@ +LD = @LD@ LDFLAGS = $(ODBC_LIB) $(EI_LDFLAGS) -LIBS = @LIBS@ $(EI_LIB) +LIBS = @LIBS@ @THR_LIBS@ $(EI_LIB) INCLUDES = -I. $(ODBC_INCLUDE) $(EI_INCLUDE) TARGET_FLAGS = @TARGET_FLAGS@ @@ -106,17 +106,17 @@ docs: # ---------------------------------------------------- ifdef UNIX_TARGET -$(UNIX_TARGET): $(BIN_DIR) $(OBJ_DIR)/odbcserver.o +$(UNIX_TARGET): $(OBJ_DIR)/odbcserver.o $(CC) $(CFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(LDFLAGS) $(LIBS) endif ifdef WIN32_TARGET -$(WIN32_TARGET): $(BIN_DIR) $(OBJ_DIR)/odbcserver.o +$(WIN32_TARGET): $(OBJ_DIR)/odbcserver.o $(LD) $(LDFLAGS) -o $@ $(OBJ_DIR)/odbcserver.o $(ENTRY_OBJ) \ $(LIBS) $(ENTRY_LDFLAGS) endif -$(OBJ_DIR)/odbcserver.o: $(OBJ_DIR) odbcserver.c +$(OBJ_DIR)/odbcserver.o: odbcserver.c $(CC) $(CFLAGS) $(INCLUDES) $(TARGET_FLAGS) -o $@ -c odbcserver.c create_dirs: diff --git a/lib/odbc/configure.in b/lib/odbc/configure.in index 77b576ee88..24e286c290 100644 --- a/lib/odbc/configure.in +++ b/lib/odbc/configure.in @@ -25,6 +25,15 @@ else host_os=win32 fi +if test "$with_odbc" = "no"; then + + rm -f "$ERL_TOP/lib/odbc/SKIP" + echo "odbc disabled by user." > "$ERL_TOP/lib/odbc/SKIP" + +else dnl "$with_odbc" != "no" + +ERL_XCOMP_SYSROOT_INIT + dnl Checks for programs. AC_PROG_CC @@ -48,8 +57,11 @@ fi AC_SUBST(MIXED_CYGWIN_VC) AC_PROG_MAKE_SET -AC_CHECK_PROGS(DED_LD, [ld.sh ld], '$(CC)') -AC_SUBST(DED_LD) + +AC_CHECK_PROG(LD, ld.sh) +AC_CHECK_TOOL(LD, ld, '$(CC)') + +AC_SUBST(LD) # Sockets #-------------------------------------------------------------------- @@ -83,50 +95,6 @@ AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"])) dnl Checks for header files. AC_HEADER_STDC -case $have_pthread_lib-$host_os in - yes-linux*) - dnl NPTL test stolen from $ERL_TOP/erts/aclocal.m4 - AC_MSG_CHECKING(for Native POSIX Thread Library) - case `getconf GNU_LIBPTHREAD_VERSION 2>/dev/null` in - nptl*) nptl=yes;; - NPTL*) nptl=yes;; - *) nptl=no;; - esac - AC_MSG_RESULT($nptl) - if test $nptl = yes; then - need_nptl_incldir=no - AC_CHECK_HEADER(nptl/pthread.h, need_nptl_incldir=yes) - if test $need_nptl_incldir = yes; then - # Ahh... - nptl_path="$C_INCLUDE_PATH:$CPATH:/usr/local/include:/usr/include" - nptl_ws_path= - save_ifs="$IFS"; IFS=":" - for dir in $nptl_path; do - if test "x$dir" != "x"; then - nptl_ws_path="$nptl_ws_path $dir" - fi - done - IFS=$save_ifs - nptl_incldir= - for dir in $nptl_ws_path; do - AC_CHECK_HEADER($dir/nptl/pthread.h, - nptl_incldir=$dir/nptl) - if test "x$nptl_incldir" != "x"; then - CFLAGS="$CFLAGS -isystem $nptl_incldir" - dnl CPPFLAGS is for configure internal use - CPPFLAGS="$CPPFLAGS -isystem $nptl_incldir" - break - fi - done - if test "x$nptl_incldir" = "x"; then - AC_MSG_ERROR(Failed to locate nptl system include directory) - fi - fi - fi - ;; - *) - ;; -esac AC_CHECK_HEADERS([fcntl.h netdb.h stdlib.h string.h sys/socket.h]) dnl Checks for typedefs, structures, and compiler characteristics. @@ -137,20 +105,18 @@ dnl Checks for library functions. AC_CHECK_FUNCS([memset socket]) # ODBC -/bin/rm -f $ERL_TOP/lib/odbc/SKIP +/bin/rm -f "$ERL_TOP/lib/odbc/SKIP" -have_pthread_lib=no -have_odbc_lib=no - +LM_CHECK_THR_LIB +AC_SUBST(THR_DEFS) +AC_SUBST(THR_LIBS) + +odbc_lib_link_success=no AC_SUBST(TARGET_FLAGS) case $host_os in darwin*) TARGET_FLAGS="-DUNIX" - AC_CHECK_LIB(pthread, pthread_create, - [AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have the pthread library (-lpthread).]) - LIBS="$LIBS -lpthread" - have_pthread_lib=yes]) - if test ! -d "$with_odbc"; then + if test ! -d "$with_odbc" || test "$with_odbc" = "yes" ; then ODBC_LIB= -L"/usr/lib" ODBC_INCLUDE="-I/usr/lib/include" else @@ -158,7 +124,7 @@ AC_SUBST(TARGET_FLAGS) ODBC_INCLUDE="-I$with_odbc/include" fi - AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc" odbc_lib_link_sucess=yes]) + AC_CHECK_LIB(iodbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -liodbc"; odbc_lib_link_success=yes]) ;; win32|cygwin) TARGET_FLAGS="-DWIN32" @@ -170,48 +136,64 @@ AC_SUBST(TARGET_FLAGS) ODBC_LIB=-L"$with_odbc/lib" ODBC_INCLUDE="-I$with_odbc/include" fi - AC_CHECK_LIB(odbc32, main, [ODBC_LIB="$ODBC_LIB -lodbc32" odbc_lib_link_sucess=yes]) + AC_CHECK_LIB(odbc32, main, [ODBC_LIB="$ODBC_LIB -lodbc32"; odbc_lib_link_success=yes]) ;; *) - TARGET_FLAGS="-DUNIX" - AC_CHECK_LIB(pthread, pthread_create, - [AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have the pthread library (-lpthread).]) - LIBS="$LIBS -lpthread" - have_pthread_lib=yes]) - if test ! -d "$with_odbc"; then - AC_MSG_CHECKING([for odbc in standard locations]) - for dir in /usr/local/odbc /usr/local /usr/odbc \ - /usr /opt/local/pgm/odbc /usr/local/pgm/odbc - do - if test -f "$dir/include/sql.h"; then - is_odbc_std_location=yes - ODBC_LIB=-L"$dir/lib" - ODBC_INCLUDE="-I$dir/include" - break - fi - done - if test "x$is_odbc_std_location" != "xyes"; then - AC_MSG_RESULT(no) - AC_MSG_WARN([No odbc library found skipping odbc]) - echo "No odbc library found" > $ERL_TOP/lib/odbc/SKIP - else - AC_MSG_RESULT($ODBC_LIB) - AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc" odbc_lib_link_sucess=yes]) - fi - else - ODBC_LIB=-L"$with_odbc/lib" - ODBC_INCLUDE="-I$with_odbc/include" - AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc" odbc_lib_link_sucess=yes]) - fi + TARGET_FLAGS="-DUNIX" + case "$erl_xcomp_without_sysroot-$with_odbc" in + yes-yes | yes- ) + msg="Dont know where to search for odbc (setting erl_xcomp_sysroot will help)" + AC_MSG_WARN([$msg]) + echo "$msg" > "$ERL_TOP/lib/odbc/SKIP" + odbc_lib_link_success=wont_try + ;; + no- ) + AC_CHECK_SIZEOF(void *) + AC_MSG_CHECKING([for odbc in standard locations]) + for rdir in /usr/local/odbc /usr/local /usr/odbc \ + /usr /opt/local/pgm/odbc /usr/local/pgm/odbc; do + test -f "$erl_xcomp_isysroot$rdir/include/sql.h" || continue + is_odbc_std_location=yes + libdir="$erl_xcomp_sysroot$rdir/lib" + if test "$ac_cv_sizeof_void_p" = "8"; then + dnl "/." in test is important (dir symlinks) + if test -d "${libdir}64/."; then + libdir="${libdir}64" + elif test -d "${libdir}/64/."; then + libdir="${libdir}/64" + fi + fi + ODBC_LIB="-L$libdir" + ODBC_INCLUDE="-I$erl_xcomp_isysroot$rdir/include" + break + done + if test "x$is_odbc_std_location" != "xyes"; then + AC_MSG_RESULT(no) + AC_MSG_WARN([No odbc library found skipping odbc]) + echo "No odbc library found" > "$ERL_TOP/lib/odbc/SKIP" + else + AC_MSG_RESULT($ODBC_LIB) + AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; odbc_lib_link_success=yes]) + fi + ;; + + no-*) + ODBC_LIB=-L"$with_odbc/lib" + ODBC_INCLUDE="-I$with_odbc/include" + AC_CHECK_LIB(odbc, SQLAllocHandle,[ODBC_LIB="$ODBC_LIB -lodbc"; odbc_lib_link_success=yes]) + ;; + esac ;; esac -if test "x$odbc_lib_link_sucess" != "xyes"; then +if test $odbc_lib_link_success = no; then AC_MSG_WARN(["ODBC library - link check failed"]) echo "ODBC library - link check failed" > $ERL_TOP/lib/odbc/SKIP fi - + AC_SUBST(ODBC_LIB) AC_SUBST(ODBC_INCLUDE) +fi dnl "$with_odbc" != "no" + AC_OUTPUT(c_src/$host/Makefile:c_src/Makefile.in) diff --git a/lib/runtime_tools/c_src/Makefile.in b/lib/runtime_tools/c_src/Makefile.in index 05b5598e51..840de39f07 100644 --- a/lib/runtime_tools/c_src/Makefile.in +++ b/lib/runtime_tools/c_src/Makefile.in @@ -1,23 +1,24 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1999-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # include $(ERL_TOP)/make/target.mk include $(ERL_TOP)/make/$(TARGET)/otp.mk +include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk # ---------------------------------------------------- # Application version @@ -30,20 +31,14 @@ VSN=$(RUNTIME_TOOLS_VSN) # reasonable defaults, if something different is needed it should # be set for that system only. # ---------------------------------------------------- -CC = @CC@ -CFLAGS = @DED_CFLAGS@ -LD = @DED_LD@ +CC = $(DED_CC) +CFLAGS = $(DED_CFLAGS) +LD = $(DED_LD) SHELL = /bin/sh -LIBS = @LIBS@ -LDFLAGS += @DED_LDFLAGS@ -ERLANG_OSTYPE = @ERLANG_OSTYPE@ - -SYSINCLUDE = -I$(ERL_TOP)/erts/emulator/beam \ - -I$(ERL_TOP)/erts/emulator/sys/$(ERLANG_OSTYPE) \ - -I$(ERL_TOP)/erts/include/internal \ - -I$(ERL_TOP)/erts/include/internal/$(ERLANG_OSTYPE) \ - -I$(ERL_TOP)/erts/include \ - -I$(ERL_TOP)/erts/include/$(ERLANG_OSTYPE) +LIBS = $(DED_LIBS) +LDFLAGS += $(DED_LDFLAGS) + +SYSINCLUDE = $(DED_SYS_INCLUDE) ifeq ($(findstring vxworks,$(TARGET)),vxworks) SYSINCLUDE += -I$(ERL_TOP)/erts/etc/vxworks endif diff --git a/lib/ssl/c_src/Makefile.in b/lib/ssl/c_src/Makefile.in index bd1b2f9375..49a209f2eb 100644 --- a/lib/ssl/c_src/Makefile.in +++ b/lib/ssl/c_src/Makefile.in @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 1999-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 1999-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # @@ -106,6 +106,7 @@ SSL_MAKEFILE = endif CC_R_FLAG=@CFLAG_RUNTIME_LIBRARY_PATH@ + ifeq ($(findstring @,$(CC_R_FLAG)),@) # Old erts configure used which hasn't replaced @CFLAG_RUNTIME_LIBRARY_PATH@; # we try our best here instead... @@ -127,6 +128,12 @@ else CC_R_OPT = $(CC_R_FLAG)$(SSL_LIBDIR) endif +SSL_CC_RUNTIME_LIBRARY_PATH=@SSL_CC_RUNTIME_LIBRARY_PATH@ +# Sigh... +ifeq ($(findstring @,$(SSL_CC_RUNTIME_LIBRARY_PATH)),@) +SSL_CC_RUNTIME_LIBRARY_PATH = $(CC_R_OPT) +endif + SSL_LINK_LIB=-L$(SSL_LIBDIR) -lssl -lcrypto else # not dynamic crypto lib (default from R11B-5) @@ -134,6 +141,7 @@ NEED_KERBEROS=@SSL_LINK_WITH_KERBEROS@ NEED_ZLIB=@SSL_LINK_WITH_ZLIB@ SSL_MAKEFILE = CC_R_OPT = +SSL_CC_RUNTIME_LIBRARY_PATH= SSL_LINK_LIB = $(SSL_LIBDIR)/libssl.a $(SSL_LIBDIR)/libcrypto.a ifeq ($(NEED_KERBEROS),yes) SSL_LINK_LIB += @STATIC_KERBEROS_LIBS@ @@ -163,11 +171,11 @@ $(OBJDIR)/%$(obj): %.c # Unix $(BINDIR)/ssl_esock: $(OBJS) - $(CC) $(CC_R_OPT) $(PLAIN_CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SSL_LINK_LIB) + $(CC) $(PLAIN_CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SSL_CC_RUNTIME_LIBRARY_PATH) $(SSL_LINK_LIB) # Win32/Cygwin $(BINDIR)/ssl_esock.exe: $(OBJS) - $(LD) -L$(SSL_LIBDIR) -o $@ $^ -lwsock32 -llibeay32 -lssleay32 + $(LD) $(SSL_CC_RUNTIME_LIBRARY_PATH) -L$(SSL_LIBDIR) -o $@ $^ -lwsock32 -llibeay32 -lssleay32 # Unix only, and only when linking statically $(SSL_MAKEFILE): diff --git a/lib/wx/c_src/Makefile.in b/lib/wx/c_src/Makefile.in index 2f04b1dbf6..5a0b4ce8ef 100644 --- a/lib/wx/c_src/Makefile.in +++ b/lib/wx/c_src/Makefile.in @@ -1,19 +1,19 @@ # # %CopyrightBegin% -# -# Copyright Ericsson AB 2008-2009. All Rights Reserved. -# +# +# Copyright Ericsson AB 2008-2010. All Rights Reserved. +# # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with this software. If not, it can be # retrieved online at http://www.erlang.org/. -# +# # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See # the License for the specific language governing rights and limitations # under the License. -# +# # %CopyrightEnd% # @@ -47,14 +47,11 @@ ERL_DIR = @ERLANG_ROOT_DIR@ ERL_INCS = -I$(ERL_DIR)/usr/include else -ERLANG_OSTYPE = @WXERL_SYS_TYPE@ - -ERL_INCS= -I$(ERL_TOP)/erts/emulator/beam \ - -I$(ERL_TOP)/erts/emulator/sys/$(ERLANG_OSTYPE) \ - -I$(ERL_TOP)/erts/include/internal \ - -I$(ERL_TOP)/erts/include/internal/$(ERLANG_OSTYPE) \ - -I$(ERL_TOP)/erts/include \ - -I$(ERL_TOP)/erts/include/$(ERLANG_OSTYPE) + +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp_ded.mk + +ERL_INCS= $(DED_INCLUDES) endif diff --git a/lib/wx/configure.in b/lib/wx/configure.in index 2b47f86baa..855c0c975e 100755 --- a/lib/wx/configure.in +++ b/lib/wx/configure.in @@ -1,20 +1,20 @@ dnl Process this file with autoconf to produce a configure script. -*-m4-*- dnl %CopyrightBegin% -dnl -dnl Copyright Ericsson AB 2008-2009. All Rights Reserved. -dnl +dnl +dnl Copyright Ericsson AB 2008-2010. All Rights Reserved. +dnl dnl The contents of this file are subject to the Erlang Public License, dnl Version 1.1, (the "License"); you may not use this file except in dnl compliance with the License. You should have received a copy of the dnl Erlang Public License along with this software. If not, it can be dnl retrieved online at http://www.erlang.org/. -dnl +dnl dnl Software distributed under the License is distributed on an "AS IS" dnl basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See dnl the License for the specific language governing rights and limitations dnl under the License. -dnl +dnl dnl %CopyrightEnd% AC_INIT() @@ -244,7 +244,10 @@ AC_SUBST(ERLANG_ROOT_DIR) dnl dnl Check for wxwidgets dnl -if test X"$MIXED_CYGWIN_VC" != X"yes" ; then +if test "$cross_compiling" = "yes"; then + echo "Cross compilation of the wx driver is not supported yet, wx will NOT be usable" > ./CONF_INFO + WXERL_CAN_BUILD_DRIVER=false +elif test X"$MIXED_CYGWIN_VC" != X"yes" ; then m4_include(wxwin.m4) AM_OPTIONS_WXCONFIG @@ -306,7 +309,7 @@ define(wx_warn_text,[ if test X"$WX_BUILDING_INSIDE_ERLSRC" != X"true" ; then AC_MSG_ERROR([wx_warn_text]) else - echo "wxWidgets not found, wx will NOT be useable" > ./CONF_INFO + echo "wxWidgets not found, wx will NOT be usable" > ./CONF_INFO WXERL_CAN_BUILD_DRIVER=false AC_MSG_WARN([wx_warn_text]) fi @@ -378,6 +381,8 @@ else AC_SUBST(WX_RESCOMP) fi +if test "$WXERL_CAN_BUILD_DRIVER" != "false"; then + AC_SUBST(WX_HAVE_STATIC_LIBS) AC_SUBST(RC_FILE_TYPE) @@ -544,6 +549,8 @@ if test X"$CAN_LINK_WX" != X"yes" ; then AC_MSG_WARN([Can not link wx program are all developer packages installed?]) fi +fi dnl - if test "$WXERL_CAN_BUILD_DRIVER" != "false" + AC_SUBST(WXERL_CAN_BUILD_DRIVER) ############################################################################# diff --git a/make/cross_check_erl b/make/cross_check_erl new file mode 100755 index 0000000000..cb9dadfb32 --- /dev/null +++ b/make/cross_check_erl @@ -0,0 +1,147 @@ +#!/bin/sh +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2010. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# Author: Rickard Green +# + +target= +build_otp= +erl_top= +force=no + +while [ $# -gt 0 ]; do + case "$1" in + -target) + shift + test $# -gt 0 || { echo "$0: Missing target" 1>&2; exit 1; } + target="$1";; + -otp) + shift + test $# -gt 0 || { echo "$0: Missing otp release" 1>&2; exit 1; } + build_otp="$1";; + -erl_top) + shift + test $# -gt 0 || { echo "$0: Missing erl top" 1>&2; exit 1; } + erl_top="$1";; + -force) + shift + test $# -gt 0 || { echo "$0: Missing force value" 1>&2; exit 1; } + force=$1;; + *) + echo "$0: Bad argument: $1" 1>&2 + exit 1;; + esac + shift +done + +test "X$target" != "X" || { echo "$0: Missing target" 1>&2; exit 1; } +test "X$build_otp" != "X" || { echo "$0: Missing otp release" 1>&2; exit 1; } +test "X$erl_top" != "X" || { echo "$0: Missing erl top" 1>&2; exit 1; } +test "X$force" != "X" || { echo "$0: Missing force value" 1>&2; exit 1; } + +cd $erl_top + +cat > cross_check_erl.erl <<\EOF +% +% Copyright Ericsson AB 2010. All Rights Reserved. +% +% The contents of this file are subject to the Erlang Public License, +% Version 1.1, (the "License"); you may not use this file except in +% compliance with the License. You should have received a copy of the +% Erlang Public License along with this software. If not, it can be +% retrieved online at http://www.erlang.org/. +% +% Software distributed under the License is distributed on an "AS IS" +% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +% the License for the specific language governing rights and limitations +% under the License. +% + +-module(cross_check_erl). + +-export([start/0]). + +start() -> + OTP = case catch erlang:system_info(otp_release) of + {'EXIT', _} -> "OTP"; + Rel -> "OTP-" ++ Rel + end, + io:format("~s~n", [OTP]), + init:stop(). + +EOF + +erlc cross_check_erl.erl 2>/dev/null \ + && used_otp=`erl -noshell -noinput -pa . -run cross_check_erl 2>/dev/null` + +res=$? + +rm -f cross_check_erl.erl cross_check_erl.beam + +test $res -eq 0 || { + cat 1>&2 <<EOF +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* ERROR: No usable Erlang/OTP system for the build machine found! Cannot +* cross compile without such a system. +* +* Either build a bootstrap system for the build machine, or provide +* an Erlang/$build_otp system in the \$PATH, and try again. For more +* information on cross compiling Erlang/$build_otp, see the +* \$ERL_TOP/xcomp/README file. +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +EOF + exit 1 +} + +test "X$build_otp" = "X$used_otp" || { + test $force = yes || { + cat 1>&2 <<EOF +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* ERROR: Trying to cross compile an Erlang/$build_otp system with a different +* Erlang/$used_otp system. When cross compiling you should compile +* with an Erlang/OTP system of the same release. It is possible, +* however not recomended, to force the cross compilation even though +* the wrong Erlang/OTP system is used. For more information on this, +* and cross compiling Erlang/$build_otp in general, see the +* \$ERL_TOP/xcomp/README file. +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +EOF + exit 1 + } + + cat <<EOF +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* WARNING: Cross compiling an Erlang/$build_otp system with a different +* Erlang/$used_otp system. When cross compiling you should compile +* with an Erlang/OTP system of the same release. This build might +* fail, or silently produce suboptimal code. For more information on +* cross compiling Erlang/$build_otp, see the \$ERL_TOP/xcomp/README +* file. +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +EOF +} + +cat <<EOF +* +* Cross compiling Erlang/$build_otp for: $target +* +EOF + +exit 0 diff --git a/make/install_bin b/make/install_bin new file mode 100755 index 0000000000..0d3e82266e --- /dev/null +++ b/make/install_bin @@ -0,0 +1,702 @@ +#!/bin/sh +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2010. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# Author: Rickard Green +# + +# +# NOTE! This script needs to be portable since it is run on all platforms +# (besides win32). Keep this in mind when updating it. +# + +## set `INST_BIN_DEBUG=true' in environment when debugging the script to +## avoid removing, and creating stuff etc... + +## +## We do not reset these variables, since values may be passed either via +## environment, or command line arguments. +## +#bindir= +#exec_prefix= +#erlang_bindir= +#DESTDIR= +#EXTRA_PREFIX= +#BINDIR_SYMLINKS= +#LN_S= +tst= + +# +# When this script communicates with the user it talks of the parameters +# as they are given to configure if such exist (currently --bindir, and +# --exec-prefix); otherwise, as the variable names used in the top +# Makefile (which calls this script). +# + +path_variables="DESTDIR EXTRA_PREFIX exec_prefix bindir erlang_bindir" +DQ= + +dbg= +test "$INST_BIN_DEBUG" != "true" || dbg=true + +while [ $# -gt 1 ]; do + case "$1" in + --bindir) bindir="$2";; + --exec-prefix) exec_prefix="$2";; + --erlang-bindir) erlang_bindir="$2";; + --destdir) DESTDIR="$2";; + --extra-prefix) EXTRA_PREFIX="$2";; + --bindir-symlinks) BINDIR_SYMLINKS="$2";; + --ln_s) LN_S="$2";; + --test-file) tst="$2";; + *) break;; + esac + shift + shift +done + + +test $# -gt 0 || { + echo " ERROR: Missing files to install" 1>&2 + test "$tst" = "" || echo "{error,{arg,missing_files}}." > $tst + exit 1; +} +test "$bindir" != "" || { + echo " ERROR: Missing --bindir" 1>&2 + test "$tst" = "" || echo "{error,{arg,missing_bindir}}." > $tst + exit 1 +} +test "$exec_prefix" != "" || { + echo " ERROR: Missing --exec-prefix" 1>&2 + test "$tst" = "" || echo "{error,{arg,missing_exec_prefix}}." > $tst + exit 1 +} +test "$erlang_bindir" != "" || { + echo " ERROR: Missing erlang_bindir" 1>&2 + test "$tst" = "" || echo "{error,{arg,missing_erlang_bindir}}." > $tst + exit 1 +} + +# Make sure all paths are absolute +for dir_var in $path_variables; do + eval "dir_path=\"\$$dir_var\"" + + case "$dir_path" in + /*) ;; + "") + # Empty DESTDIR or EXTRA_PREFIX which is ok + case $dir_var in + DESTDIR|EXTRA_PREFIX) ;; + *) + echo " ERROR: Internal error: \$$dir_var is empty" 1>&2 + test "$tst" = "" || echo "{error,{empty,$dir_var}}." > $tst + exit 1;; + esac + continue;; + *) + case $dir_var in + bindir) flag="--bindir=";; + exec_prefix) flag="--exec-prefix=";; + erlang_bindir) flag="erlang_bindir=";; + DESTDIR) flag="DESTDIR=";; + EXTRA_PREFIX) flag="EXTRA_PREFIX=";; + *) flag="";; # Need to update the script... + esac + cat 1>&2 <<EOF + ERROR: Found path to a directory which was not absolute. All paths needs to + be absolute. + + $flag"$dir_path" +EOF + test "$tst" = "" || echo "{error,{not_abs,'$dir_var'}}." > $tst + exit 1;; + esac + case "$dir_path" in + *[!A-Za-z0-9/=_.-]*) DQ="\"";; + *) ;; + esac +done + +# We place temporary check files in the source dir and the target dir. These +# can later be used to verify that our modifications of the paths are +# successful. + +test "$dbg" = "true" || { + bchk_file="tmp-erlang-install-bin.$$" + ebchk_file="tmp-erlang-install-erl-bin.$$" + bchk="$DESTDIR$EXTRA_PREFIX$bindir/$bchk_file" + ebchk="$DESTDIR$EXTRA_PREFIX$erlang_bindir/$ebchk_file" + chk_txt="Temporary Erlang/OTP install file." + chk_err=no + + # Make sure we haven't got any old ones... + rm -f "$bchk" "$ebchk" + + { { echo "$chk_txt" > "$ebchk"; } 2>/dev/null && test -r "$ebchk"; } || { + cat 1>&2 <<EOF + ERROR: Cannot create files in 'erlang_bindir'. + +EOF + chk_err=no_create_erlang_bindir + } + + { { echo "$chk_txt" > "$bchk"; } 2>/dev/null && test -r "$bchk"; } || { + cat 1>&2 <<EOF + ERROR: Cannot create files in '--bindir'. + +EOF + chk_err=no_create_bindir + } + + + { test $chk_err != no || + test ! -f "$DESTDIR$EXTRA_PREFIX$bindir/$ebchk_file"; } || { + # Refuse to install in the same directory as the source... + cat 1>&2 <<EOF + ERROR: '--bindir' and 'erlang_bindir' both points to the same directory. This + can be due to symbolic directory links. + +EOF + chk_err=target_and_source_same_dir + } + + test $chk_err = no || { + cat 1>&2 <<EOF + --bindir="$bindir" + erlang_bindir="$erlang_bindir" + EXTRA_PREFIX="$EXTRA_PREFIX" + DESTDIR="$DESTDIR" + + Note that all absolute directory paths are prefixed by + \$DESTDIR\$EXTRA_PREFIX when accessed. +EOF + rm -f "$bchk" "$ebchk" + test "$tst" = "" || echo "{error,$chk_err}." > $tst + exit 1 + } +} + +dirty=no + +# Make all paths look good (remove all `.' dirs, `//', and trailing `/'). +for dir_var in $path_variables; do + eval "dir_path=\"\$$dir_var\"" + test "$dir_path" != "" || continue + + ndp= + save_IFS=$IFS + IFS=/ + for dir in $dir_path; do + case "$dir" in + "" | ".") continue;; + "..") + case $dir_var in + bindir|erlang_bindir|exec_prefix) dirty=yes;; + *) ;; + esac;; + *) ;; + esac + ndp="$ndp/$dir" + done + IFS=$save_IFS + test "$ndp" != "" || ndp="/" + eval "$dir_var=\"$ndp\"" +done + +iprfx="$DESTDIR$EXTRA_PREFIX" + +# Make sure we didn't mess up +{ $dbg test -f "$iprfx$bindir/$bchk_file" && + $dbg test -f "$iprfx$erlang_bindir/$ebchk_file"; } || { + cat 1>&2 <<EOF + ERROR: Internal error: Unsuccessfully trimmed the paths + + --bindir="$bindir" + erlang_bindir="$erlang_bindir" + --exec-prefix="$exec_prefix" + EXTRA_PREFIX="$EXTRA_PREFIX" + DESTDIR="$DESTDIR" +EOF + $dbg rm -f "$bchk" "$ebchk" + test "$tst" = "" || echo "{error,bad_trim}." > $tst + exit 1 +} + +# Now all paths look good... + + +# $ln_s should be either 'ln -s', 'ln', or 'cp -p'. We don't want to +# maks hard links, so make sure we got 'ln -s'; otherwise, use 'cp -p' + +# This is the fallback if we haven't got 'ln -s' +ln_s="cp -p" +type=copy +paths=absolute +abspath_reason=no_ln_s +src_dir="$iprfx$erlang_bindir" + +case "X${LN_S}X" in + Xln[\ \ ]*X|X*[\ \ ]ln[\ \ ]*X) + # Got `ln'; check that we also got `-s' flag + case "X${LN_S}X" in + X*[\ \ ]-sX|X*[\ \ ]-s[\ \ ]*X) + # Ok; seems like we got `ln -s' + ln_s="ln -s" + type=link + paths="$BINDIR_SYMLINKS" + test "$BINDIR_SYMLINKS" = "absolute" && abspath_reason=request + # $DESTDIR should *not* be part of src_dir when linking + src_dir="$EXTRA_PREFIX$erlang_bindir" + ;; + *) ;; + esac;; + *) ;; +esac + +case "$paths" in + absolute|relative) ;; + *) paths=undetermined;; +esac + +# Determine if we should use absolute or relative paths for links +test $paths != absolute && { + # If $paths is undetermined, use absolute paths unless both $bindir + # and $erlang_bindir are prefixed by $exec_prefix (which is the normal + # case) + test $paths = relative || paths=absolute + abspath_reason=not_prefix + resolved_bindir="$bindir" + resolved_erlang_bindir="$erlang_bindir" + resolved_exec_prefix="$exec_prefix" + case "$bindir" in + "$exec_prefix"*) + case "$erlang_bindir" in + "$exec_prefix"*) paths=relative;; + *) ;; + esac;; + *);; + esac + # Now paths=absolute|relative + + # If we got dirty paths (contains ..) and are going for relative links, + # we need to resolve the paths + test $dirty-$paths = yes-relative && { + # Need to resolve $bindir and $erlang_bindir paths + for dir_var in bindir erlang_bindir exec_prefix; do + eval "dir_path=\"\$$dir_var\"" + + ndp="/" + save_IFS=$IFS + IFS=/ + for dir in $dir_path; do + case "$dir" in + "") ;; + "..") + test "$ndp" != "/" || { + IFS=$save_IFS + paths=absolute + abspath_reason=unreasonable_path + break 2 + } + ndp=`dirname "$ndp" 2>/dev/null` || { + IFS=$save_IFS + paths=absolute + abspath_reason=dirname_failed + break 2 + };; + *) + if test "$ndp" = "/"; then + ndp="/$dir" + else + ndp="$ndp/$dir" + fi;; + esac + done + IFS=$save_IFS + test "$ndp" != "" || ndp="/" + eval "resolved_$dir_var=\"$ndp\"" + done + } + + # If we still are going for relative and relative symbolic links have + # not been explicitly requested check that the resolved paths still + # are prefixed by exec_prefix + test $paths = relative && test "$BINDIR_SYMLINKS" != "relative" && { + paths=absolute + abspath_reason=not_prefix + case "$resolved_bindir" in + "$resolved_exec_prefix"*) + case "$resolved_erlang_bindir" in + "$resolved_exec_prefix"*) + paths=relative;; + *) ;; + esac;; + *) ;; + esac + } + + # If we still are going for relative check that resolved paths are + # reachable (might not be if the directory structure contains symbolic + # directory links). + test $paths = relative && { + ($dbg test -r "$iprfx$resolved_bindir/$bchk_file" && + $dbg test -r "$iprfx$resolved_erlang_bindir/$ebchk_file" && + $dbg cd "$iprfx$resolved_bindir" && + $dbg test -r "./$bchk_file" && + $dbg cd "$iprfx$resolved_erlang_bindir" && + $dbg test -r "./$ebchk_file") || { + paths=absolute + abspath_reason=unreachable_absolute + } + } + + + # If we still are going for relative, calculate the relative path from + # $resolved_bindir to $resolved_erlang_bindir and verify that we + # can reach $erlang_bindir from $bindir via calculated relative path + test $paths = relative && { + relpath= + common= + + save_IFS=$IFS + IFS=/ + + build=false + for dir in $resolved_erlang_bindir; do + test "$dir" != "" || continue + test $build = false || { relpath="$relpath/$dir"; continue; } + cand="${common}/$dir" + case "$resolved_bindir" in + "$cand"*) common="$cand";; + *) relpath="$dir"; build=true;; + esac + done + + check= + build=false + test "$common" != "" || build=true + + for dir in $resolved_bindir; do + test "$dir" != "" || continue + test $build = true || { + check="${check}/$dir" + test "$check" != "$common" || build=true + continue + } + if test "$relpath" = ""; then + relpath=".." + else + relpath="../$relpath" + fi + done + + IFS=$save_IFS + + test "$relpath" != "" || { + cat 1>&2 <<EOF + ERROR: Internal error: Computed relative path: . + + --bindir="$bindir" + erlang_bindir="$erlang_bindir" + --exec-prefix="$exec_prefix" + EXTRA_PREFIX="$EXTRA_PREFIX" + DESTDIR="$DESTDIR" + BINDIR_SYMLINKS="$BINDIR_SYMLINKS" +EOF + $dbg rm -f "$bchk" "$ebchk" + test "$tst" = "" || echo "{error,empty_relpath}." > $tst + exit 1 + } + + # Verify that it works otherwise go for absolute links + if ($dbg cd "$iprfx$bindir" 2>/dev/null && \ + $dbg test -r "$relpath/$ebchk_file"); then + src_dir="$relpath" + else + abspath_reason=unreachable_relative + paths=absolute + fi + } +} + +# Don't need the temporary check files anymore +$dbg rm -f "$bchk" "$ebchk" + +# If we reverted to absolute paths we may have to abort or notify the user +# about this... +case "$paths-$BINDIR_SYMLINKS" in + absolute-absolute) # User requested absolute and got it + case "$abspath_reason" in + no_ln_s) + cat <<EOF + ERROR: Cannot install absolute symbolic links in the '--bindir' directory, + since 'ln -s' does not work. If you want to install using 'cp -p' + invoke 'make install' without setting BINDIR_SYMLINKS. + + --bindir="$bindir" + erlang_bindir="$erlang_bindir" + --exec-prefix="$exec_prefix" + EXTRA_PREFIX="$EXTRA_PREFIX" + DESTDIR="$DESTDIR" + BINDIR_SYMLINKS="$BINDIR_SYMLINKS" + + Note that all absolute directory paths are prefixed by + \$DESTDIR\$EXTRA_PREFIX when accessed. +EOF + test "$tst" = "" || echo "{error,$abspath_reason}." > $tst + exit 1;; # Abort... + *) + ;; + esac;; + + absolute-relative) # User forced relative symbolic links, but we need + # to revert to absolute symbolic links. Print error + # message and abort. + + case "$abspath_reason" in + no_ln_s) + cat 1>&2 <<EOF + ERROR: Cannot install relative symbolic links in the '--bindir' directory, + since 'ln -s' does not work. If you want to install using 'cp -p' do + not set BINDIR_SYMLINKS, and invoke 'make install' again. + +EOF + ;; + not_prefix) + cat 1>&2 <<EOF + ERROR: Internal error: Should not have reverted to absolute paths just + because '--exec-prefix' was not a prefix of '--bindir' and/or + 'erlang_bindir' since relative symbolic links were forced. + +EOF + ;; + unreasonable_path) + cat 1>&2 <<EOF + ERROR: Refusing to install relative symbolic links, since the relative path + potentially could go via \$DESTDIR\$EXTRA_PREFIX/. Make your install + paths a bit more reasonable (preferably) or, do not invoke + 'make install' with 'BINDIR_SYMLINKS=relative'. + +EOF + ;; + unreachable_absolute) + cat 1>&2 <<EOF + ERROR: Could not find '--bindir' and/or 'erlang_bindir' after resolving paths. + The directory structure probably consists of symbolic directory links. + Refusing to install obviously incorrect relative symbolic links. In + order to install absolute symbolic links, invoke 'make install' without + 'BINDIR_SYMLINKS=relative'. + +EOF + ;; + unreachable_relative) + cat 1>&2 <<EOF + ERROR: Could not find 'erlang_bindir' from '--bindir' via computed relative + path. This probably due to symbolic directory links. Refusing to install + obviously incorrect relative symbolic links. In order to install + absolute symbolic links, invoke 'make install' without + 'BINDIR_SYMLINKS=relative'. + + Computed relative path="$relpath" +EOF + ;; + dirname_failed) + cat 1>&2 <<EOF + ERROR: Cannot install relative symbolic links since the 'dirname' command + failed while computing the relative path. The 'dirname' command is only + needed when '--bindir', 'erlang_bindir', and/or '--exec-prefix' contain + relative parts, i.e., '..' parts. If you modify your install paths, it + may be possible to install relative symbolic links. In order to install + absolute symbolic links, invoke 'make install' without + 'BINDIR_SYMLINKS=relative'. + +EOF + ;; + *) + cat 1>&2 <<EOF + ERROR: Refusing to install relative symbolic links. The error description for + \"$abspath_reason\" is however missing. + +EOF + ;; + esac + cat 1>&2 <<EOF + --bindir="$bindir" + erlang_bindir="$erlang_bindir" + --exec-prefix="$exec_prefix" + EXTRA_PREFIX="$EXTRA_PREFIX" + DESTDIR="$DESTDIR" + BINDIR_SYMLINKS="$BINDIR_SYMLINKS" + + Note that all absolute directory paths are prefixed by + \$DESTDIR\$EXTRA_PREFIX when accessed. +EOF + test "$tst" = "" || echo "{error,$abspath_reason}." > $tst + exit 1;; # Abort... + + absolute-*) # Notify the user that we reverted to absolute symbolic links + cat <<EOF +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +EOF + case "$abspath_reason" in + no_ln_s) + cat <<EOF + NOTE: Cannot install symbolic links in the '--bindir' directory, since + 'ln -s' does not work. Will create copies using 'cp -p' instead. + +EOF + ;; + not_prefix) + cat <<EOF + NOTE: Installing absolute symbolic links in the '--bindir' directory to the + 'erlang_bindir' directory instead of relative ones. This since at least + one of these directories is not prefixed by '--exec-prefix'. It is + possible to force relative symbolic links if you want that by invoking + the install as 'make BINDIR_SYMLINKS=relative install'. + +EOF + ;; + + unreasonable_path) + cat <<EOF + NOTE: Installing absolute symbolic links in the '--bindir' directory to the + 'erlang_bindir' directory instead of relative ones. This since it + potentially would pass outside of '\$DESTDIR\$EXTRA_PREFIX/'. + +EOF + ;; + unreachable_absolute) + cat <<EOF + NOTE: Installing absolute symbolic links in the '--bindir' directory to the + 'erlang_bindir' instead of relative ones. This since at least one of + these directory could not be found after resolving paths. This is + probably due to symbolic directory links. + +EOF + ;; + unreachable_relative) + cat <<EOF + NOTE: Installing absolute symbolic links in the '--bindir' directory to the + 'erlang_bindir' directory instead of relative ones. This since the + 'erlang_bindir' directory could not be found from the '--bindir' + directory using the computed relative path. This is probably due + to symbolic directory links. + + Computed relative path="$relpath" +EOF + ;; + dirname_failed) + cat 1>&2 <<EOF + NOTE: Installing absolute symbolic links in the '--bindir' directory to the + 'erlang_bindir' directory instead of relative ones. This since the + 'dirname' command failed while computing the relative path. The + 'dirname' command is only needed when '--bindir', 'erlang_bindir', + and/or '--exec-prefix' contain relative parts, i.e., '..' parts. If + you modify your install paths, it may be possible to install relative + symbolic links. + +EOF + ;; + *) + cat 1>&2 <<EOF + NOTE: Installing absolute symbolic links in the '--bindir' directory + to the 'erlang_bindir' instead of relative ones. The notification + description for "$abspath_reason" is however missing. + +EOF + ;; + esac + + cat <<EOF + --bindir="$bindir" + erlang_bindir="$erlang_bindir" + --exec-prefix="$exec_prefix" + EXTRA_PREFIX="$EXTRA_PREFIX" + DESTDIR="$DESTDIR" + BINDIR_SYMLINKS="$BINDIR_SYMLINKS" + + Note that all absolute directory paths are prefixed by + \$DESTDIR\$EXTRA_PREFIX when accessed. +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +EOF + ;; + + *) # relative links + ;; +esac + +# Now paths=absolute|relative and src_dir is correct (relative bindir) + +# cd into "$iprfx$bindir" and do it from there... +echo cd "$DQ$iprfx$bindir$DQ" +$dbg cd "$iprfx$bindir" || { + test "$tst" = "" || echo "{error,cd_bin_failed}." > $tst + exit 1 +} + +# Verify that the source files actually exist (done in a separate pass +# before we modify anything, so we leave it untouched if it should fail). +# Note that we will not find them under $src_dir if we use absolute symbolic +# links and $DESTDIR != "". In this case (actually all cases) they can then +# be found under $iprfx$erlang_bindir +test_src_dir="$src_dir" +test "$paths-$type" != "absolute-link" || test_src_dir="$iprfx$erlang_bindir" + +for file in "$@"; do + test "$file" != "" || continue + src_file="$test_src_dir/$file" + $dbg test -f "$src_file" || { + cat 1>&2 <<EOF + ERROR: Missing source file: $src_file + + --bindir="$bindir" + erlang_bindir="$erlang_bindir" + --exec-prefix="$exec_prefix" + EXTRA_PREFIX="$EXTRA_PREFIX" + DESTDIR="$DESTDIR" + BINDIR_SYMLINKS="$BINDIR_SYMLINKS" + + Note that all absolute directory paths are prefixed by + \$DESTDIR\$EXTRA_PREFIX when accessed. +EOF + test "$tst" = "" || echo "{error,{no_srcfile,\"$src_file\"}}." > $tst + exit 1 + } +done + +# Remove after possible old install (done in a separate pass since I think +# the output looks nicer than if mixed). Note that we cannot test for existance +# in a portable way, so force remove. +for file in "$@"; do + test "$file" != "" || continue + echo rm -f "$file" + $dbg rm -f "$file" +done + +# do it +for file in "$@"; do + echo $ln_s "$DQ$src_dir/$file$DQ" "$file" + $dbg $ln_s "$src_dir/$file" "$file" || { + test "$tst" = "" || echo "{error,{$type,\"$file\",failed}}." > $tst + exit 1 + } +done + +test "$tst" = "" || echo "{ok,{$paths,\"$iprfx$bindir\",\"$src_dir\"}}." > $tst + +exit 0 # Done diff --git a/make/otp_ded.mk.in b/make/otp_ded.mk.in index 0a91a42df5..e719312473 100644 --- a/make/otp_ded.mk.in +++ b/make/otp_ded.mk.in @@ -1,22 +1,48 @@ #-*-makefile-*- ; force emacs to enter makefile-mode # ---------------------------------------------------- -# Make include file for otp +# %CopyrightBegin% # -# Copyright (C) 1996, Ericsson Telecommunications -# Author: Lars Thorsen +# Copyright Ericsson AB 2009-2010. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +# The version. +# +# Note that it is important that the version is +# explicitly expressed here. Some applications need to +# be able to check this value *before* configure has +# been run and generated otp_ded.mk +DED_MK_VSN = 1 +# ---------------------------------------------------- +# Variables needed for building Dynamic Erlang Drivers # ---------------------------------------------------- DED_CC = @CC@ +DED_GCC = @GCC@ DED_LD = @DED_LD@ DED_LDFLAGS = @DED_LDFLAGS@ -DED__NOWARN_CFLAGS = @DED_CFLAGS@ -DED_CFLAGS = @WFLAGS@ @DED_CFLAGS@ +DED__NOWARN_NOTHR_CFLAGS = @DED_CFLAGS@ +DED__NOTHR_CFLAGS = @WFLAGS@ @DED_CFLAGS@ +DED__NOWARN_CFLAGS = @DED_EMU_THR_DEFS@ @DED_CFLAGS@ +DED_THR_DEFS = @DED_THR_DEFS@ +DED_EMU_THR_DEFS = @DED_EMU_THR_DEFS@ +DED_WARN_FLAGS = @WFLAGS@ +DED_CFLAGS = @WFLAGS@ @DED_EMU_THR_DEFS@ @DED_CFLAGS@ DED_LIBS = @LIBS@ +DED_EXT = @DED_EXT@ ERLANG_OSTYPE = @ERLANG_OSTYPE@ -TARGET = @host@ PRIVDIR = ../priv OBJDIR = $(PRIVDIR)/obj/$(TARGET) LIBDIR = $(PRIVDIR)/lib/$(TARGET) -DED_SYS_INCLUDE = -I$(ERL_TOP)/erts/emulator/beam \ - -I$(ERL_TOP)/erts/emulator/sys/$(ERLANG_OSTYPE) - +DED_SYS_INCLUDE = @DED_SYS_INCLUDE@ DED_INCLUDES = $(DED_SYS_INCLUDE) diff --git a/make/unexpected_use b/make/unexpected_use new file mode 100755 index 0000000000..d7543a7d83 --- /dev/null +++ b/make/unexpected_use @@ -0,0 +1,29 @@ +#!/bin/sh +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2010. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# + +prog=`basename "$0"` || prog="$0" + +cat 1>&2 <<EOF +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + ERROR: Unexpected use of '$prog' in 'install', or 'release' phase. +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +EOF + +exit 1 @@ -28,23 +28,33 @@ clearmake=false # # NOTE: lazy_configure depends on '.' always being last directory if [ -z "$ONLY_ERTS" ]; then - AUTOCONF_SUBDIRS="lib lib/*" + AUTOCONF_SUBDIRS="lib lib/* lib/test_server/src" fi AUTOCONF_SUBDIRS="$AUTOCONF_SUBDIRS erts ." +# `bootstrap_apps' should include application that are built, or +# partly built in one of the bootstrap phases. Applications that +# only get some static includes copied into the bootstrap directory +# should not be included. +bootstrap_apps="erts lib/asn1 lib/compiler lib/hipe lib/ic lib/kernel lib/parsetools lib/sasl lib/snmp lib/stdlib lib/syntax_tools" + +# We will quote a bit more than needed, but the important thing is that +# all that needs quoting will be quoted... +DONT_QUOTE="A-Za-z0-9/=_+-" + # Utility functions usage () { - echo "Available options:" + echo "Available options (-a switch select all applications):" echo " setup [-a] [<configure parameters>] - does autoconf, configure and boot." echo " all [-a] <dir> - does autoconf, configure, boot, release" echo " autoconf - (re)build the configure scripts" echo " configure [<configure parameters>] - does the actual configuration" - echo " smp [-a] - build a small Erlang system, smp flavor" - echo " hybrid [-a] - build a small Erlang system, hybrid flavor" - echo " boot [-a] - bootstraps and build system (after configure)" + echo " boot [-a] - bootstraps and builds the system (after configure)" echo " release <target_dir> - creates a small release to <target_dir>" echo " release [-a] <target_dir> - creates full release to <target_dir>" + echo " smp [-a] - build an Erlang system, smp flavor only" + echo " hybrid [-a] - build an Erlang system, hybrid flavor only" echo " tests <dir> - Build testsuites to <dir>" echo "" echo "These are for cleaning up an open source distribution" @@ -64,9 +74,6 @@ usage () echo "Before trying to build for vxworks, consider the following option" echo " env_vxworks <cpu> - echo environment settings for vxworks, use with eval" echo "" - echo "Before trying to cross compile, set environment via the following option" - echo "Please note that the path to the configuration file should be absolute." - echo " env_cross <absolute path to cross conf file> - echo environment settings for cross compilation, use with eval" case $version_controller in none) ;; @@ -102,84 +109,32 @@ usage () esac } -export_cross_env () -{ - if [ "x$ERL_XCOMP_CONF" != "x" ]; then - export erl_xcomp_host - export erl_xcomp_configure_flags - export erl_xcomp_cc - export erl_xcomp_ld - export erl_xcomp_cflags - export erl_xcomp_cpp - export erl_xcomp_ldflags - export erl_xcomp_ranlib - export erl_xcomp_ar - export erl_xcomp_ded_ld - export erl_xcomp_ded_ldflags - export erl_xcomp_ded_ld_runtime_library_path - export erl_xcomp_bigendian - export erl_xcomp_linux_clock_gettime_correction - export erl_xcomp_linux_nptl - export erl_xcomp_linux_usable_sigusrx - export erl_xcomp_linux_usable_sigaltstack - export erl_xcomp_poll - export erl_xcomp_kqueue - export erl_xcomp_putenv_copy - export erl_xcomp_reliable_fpe - export erl_xcomp_getaddrinfo - export erl_xcomp_gethrvtime_procfs_ioctl - export erl_xcomp_clock_gettime - export erl_xcomp_after_morecore_hook - export erl_xcomp_dlsym_brk_wrappers - fi -} - -xcomp_fail () +hide_vars () { - echo "The mandatory cross compilation variable '"$1"' is not set, aborting..." >&2 - exit 1 -} - -source_xcomp_file () -{ - case x$1 in - x/*) - ;; - x) - echo "env_cross requires path to cross compilation configuration" >&2 - exit 1;; - x*) - echo "An absoulute path to the cross compilation file is required: $1" >&2 - exit 1;; - esac - - if [ ! -f $1 ]; then - echo "No such file: $1" >&2 - exit 1 + script= + for var in "$@"; do + if [ "X$var" != "X" ]; then + script="$script test \"X\$$var\" = \"X\" || hidden_$var=\$$var; unset $var;" + fi + done + if [ "X$script" != "X" ]; then + eval "$script" fi - - . $1 + unset script } -finalize_xcomp_conf () +restore_vars () { - if test "x$erl_xcomp_host" = "x"; then - xcomp_fail erl_xcomp_host - fi - - if test "x$erl_xcomp_target" != "x"; then - echo "The 'erl_xcomp_target' configuration variable should no longer be used." >&2 - echo "For more information see the xcomp/README file." >&2 - exit 1; - fi - - OVERRIDE_TARGET=`$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host` - if test $? -ne 0; then - exit $? + script= + for var in "$@"; do + if [ "X$var" != "X" ]; then + script="$script unset $var; test \"X\$hidden_$var\" = \"X\" || { $var=\$hidden_$var; export $var; } ; unset hidden_$var;" + fi + done + if [ "X$script" != "X" ]; then + eval "$script" fi - TARGET=$OVERRIDE_TARGET - - return 0 + unset script } @@ -190,6 +145,7 @@ check_erltop () if [ -f ./otp_build -a -f ./erts/autoconf/config.guess ]; then ERLTOP_FORCED=true ERL_TOP=`/bin/pwd` + export ERL_TOP else echo "The environment variable ERL_TOP must be set." >&2 exit 1 @@ -221,27 +177,36 @@ determine_version_controller () fi fi } - # Execution of the different options # Special static config flags for certain platforms are set here set_config_flags () { + # * Extra flags to pass to configure are placed in `CONFIG_FLAGS'. + # * The command line is no longer added to `CONFIG_FLAGS' by + # `set_config_flags'. It is instead passed directly to + # `run_configure', or added to `CONFIG_FLAGS' at some other + # place. + # * `CONFIG_FLAGS' may contain flags when `set_config_flags' is + # called. These flags should survive the call to `set_config_flags' + # (in the cross compilation case the whole command line as well as + # the cross configuration have been moved here). + if target_contains linux; then XX=`echo $* | grep -v able-hipe` if [ "$*" = "$XX" ]; then - CONFIG_FLAGS="--disable-hipe" + CONFIG_FLAGS="$CONFIG_FLAGS --disable-hipe" fi fi if target_contains "univel-sysv4"; then - CONFIG_FLAGS="--x-libraries=/usr/lib/X11" + CONFIG_FLAGS="$CONFIG_FLAGS --x-libraries=/usr/lib/X11" fi if target_contains free_source; then CONFIG_FLAGS="$CONFIG_FLAGS --host=$TARGET" fi if target_contains win32; then - CONFIG_FLAGS="--build=$BUILDSYS build_alias=win32 --host=win32 --target=win32" + CONFIG_FLAGS="--build=$BUILDSYS build_alias=win32 --host=win32 --target=win32 $CONFIG_FLAGS" else # Link SSL static for all binary distributions if not overridden XX=`echo $* | grep -v dynamic-ssl-lib` @@ -255,12 +220,61 @@ set_config_flags () CONFIG_FLAGS="$CONFIG_FLAGS --cache-file=$OVERRIDE_CONFIG_CACHE" fi - CONFIG_FLAGS="$CONFIG_FLAGS $*" + env_to_config_flags $erl_build_tool_vars + export CONFIG_FLAGS; } - + +create_lib_configure_in() +{ + cd $ERL_TOP + + # Multiple versions of autoconf generates code that + # don't work on all platforms (e.g. SunOS 5.8) if + # sub directories are soft links. Internally at Ericsson + # some OTP application directories are soft links. + # An added "/." solves this problem. + + sdirs= + for lib_app in $bootstrap_apps; do + case $lib_app in + lib/*) + if [ -f "$lib_app/configure.in" ]; then + app=`echo "$lib_app" | sed "s|lib/\(.*\)|\1|"` + sdirs="${sdirs}test ! -f $app/configure || AC_CONFIG_SUBDIRS($app/.)\n" + fi;; + *) + ;; + esac + done + + sed_bootstrap="s%@BOOTSTRAP_CONFIGURE_APPS@%$sdirs%g" + + sdirs= + for lib_app in lib/*; do + is_bapp=false + for bapp in $bootstrap_apps; do + test $bapp != $lib_app || { is_bapp=true; break; } + done + if [ $is_bapp = false ] && [ -f "$lib_app/configure.in" ]; then + app=`echo "$lib_app" | sed "s|lib/\(.*\)|\1|"` + sdirs="${sdirs} test ! -f $app/configure || AC_CONFIG_SUBDIRS($app/.)\n" + fi + done + + sed_non_bootstrap="s%@NON_BOOTSTRAP_CONFIGURE_APPS@%$sdirs%g" + + rm -f lib/configure.in + sed "$sed_bootstrap;$sed_non_bootstrap" > lib/configure.in < lib/configure.in.src || { + echo "Failed to create lib/configure.in" + exit 1 + } +} + do_autoconf () { + create_lib_configure_in + if target_contains win32; then # Select the correct autoconf on cygwin save_want_autoconf_ver=$WANT_AUTOCONF_VER @@ -285,17 +299,8 @@ do_autoconf () ;; esac - if [ -d erts/autom4te.cache ]; then - echo "Cleaning erts/autom4te.cache" - rm -f erts/autom4te.cache/* - fi - - save_ot="$OVERRIDE_TARGET" - save_t="$TARGET" if [ ! -z "$OVERRIDE_CONFIGURE" ]; then echo "Autoconf disabled on target $TARGET, but is performed on host" >&2 - OVERRIDE_TARGET= - export OVERRIDE_TARGET # We still use erts configure for erl_interface and VxWorks case "$TARGET" in *vxworks*) @@ -305,23 +310,30 @@ do_autoconf () -e 's,lib/megaco,,'` ;; esac - TARGET=`$ERL_TOP/erts/autoconf/config.guess` fi + hide_vars OVERRIDE_TARGET TARGET + TARGET=$BUILDSYS + export TARGET + for d in $AUTOCONF_SUBDIRS; do - if [ -f $d/configure.in ]; then - echo "=== running autoconf in $d" - ( cd $d && autoconf ) || exit 1 - fi - if [ x$d = x"erts" ]; then - echo "=== running autoheader in $d" - ( cd $d && autoheader configure.in > config.h.in ) \ - || exit 1 - fi + file="$d/configure.in" + [ -f "$file" ] || continue + echo "" + [ ! -d "$d/autom4te.cache" ] || { + echo "=== cleaning $d/autom4te.cache" + rm -f "$d"/autom4te.cache/* + } + echo "=== running autoconf in $d" + ( cd "$d" && autoconf ) || exit 1 + chdr=`cat "$file" | sed -n "s|.*\(AC_CONFIG_HEADER\).*|\1|p"` + [ "$chdr" = "AC_CONFIG_HEADER" ] || continue + echo "=== running autoheader in $d" + ( cd "$d" && autoheader ) || exit 1 done - OVERRIDE_TARGET="$save_ot" - export OVERRIDE_TARGET - TARGET="$save_t" + + restore_vars OVERRIDE_TARGET TARGET + if target_contains win32; then WANT_AUTOCONF_VER=$save_want_autoconf_ver export WANT_AUTOCONF_VER @@ -338,22 +350,176 @@ mk_targetdir () fi } +run_configure () +{ + cdir="$ERL_TOP" + [ -z "$ONLY_ERTS" ] || { + cdir="$ERL_TOP/erts" + CONFIG_FLAGS="$CONFIG_FLAGS --no-recursion" + } + + echo "$cdir/configure $CONFIG_FLAGS" ${1+"$@"} + (cd "$cdir" && $config_eval ./configure $CONFIG_FLAGS ${1+"$@"}) || exit 1 +} + +env_to_config_flags () +{ + for env_var in "$@"; do + script="echo $env_var=\$$env_var; unset $env_var >/dev/null 2>&1" + env_arg=`eval $script` + case $env_arg in + "$env_var=") + ;; + *[!$DONT_QUOTE]*) + config_eval=eval + new_arg=`echo "X$env_arg" | sed "s|^X||;s|\([^$DONT_QUOTE]\)|\\\\\\\\\1|g"` + CONFIG_FLAGS="$CONFIG_FLAGS $new_arg";; + *) + CONFIG_FLAGS="$CONFIG_FLAGS $env_arg";; + esac + eval unset $env_var + done +} + +try_cross_configure () +{ + cross_configure=no + host_value= + build_value= + + # Get `erl_xcomp_vars' + . "$ERL_TOP/xcomp/erl-xcomp-vars.sh" || exit 1 + + for arg in ${1+"$@"}; do + case "$arg" in + --host=*) + host_value=`echo $x | sed "s|^--host=\(.*\)|\1|"`;; + --build=*) + build_value=`echo $x | sed "s|^--build=\(.*\)|\1|"`;; + --xcomp-conf=*) + cross_configure=yes;; + *) + ;; + esac + done + + test $cross_configure = yes || { + + test "X$host_value" = "X" || { + + test "X$build_value" != "X" || build_value="$BUILDSYS" + + build_sys=`$ERL_TOP/erts/autoconf/config.sub "$build_value"` || exit 1 + host_sys=`$ERL_TOP/erts/autoconf/config.sub "$host_value"` || exit 1 + + + test "$host_sys" = "$build_sys" || cross_configure=yes + } + } + + test $cross_configure = yes || return 1 + + # cross configure... + CONFIG_FLAGS= + + env_to_config_flags $erl_build_tool_vars $erl_xcomp_vars + + for arg in ${1+"$@"}; do + case "$arg" in + --host=*) + host_value=`echo $x | sed "s|^--host=\(.*\)|\1|"`;; + --build=*) + build_value=`echo $x | sed "s|^--build=\(.*\)|\1|"`;; + --xcomp-conf=*) + xcomp_conf=`echo "X$arg" | sed "s|^X--xcomp-conf=\(.*\)\$|\1|g"` + test "X$xcomp_conf" != "X" || { + echo "$0: Missing xcomp-conf file name" + exit 1 + } + test -f "$xcomp_conf" || { + echo "$0: Missing xcomp-conf file: $xcomp_conf" + exit 1 + } + . "$xcomp_conf" + test $? -eq 0 || { + echo "$0: Failed to read xcomp-conf file: $conf" + exit 1 + } + test "X$erl_xcomp_build" = "X" || build_value="$erl_xcomp_build" + test "X$erl_xcomp_host" = "X" || host_value="$erl_xcomp_host" + unset erl_xcomp_build + unset erl_xcomp_host + CONFIG_FLAGS="$CONFIG_FLAGS $erl_xcomp_configure_flags" + unset erl_xcomp_configure_flags + env_to_config_flags $erl_build_tool_vars $erl_xcomp_vars;; + *[!$DONT_QUOTE]*) + config_eval=eval + new_arg=`echo "X$arg" | sed "s|^X||;s|\([^$DONT_QUOTE]\)|\\\\\\\\\1|g"` + CONFIG_FLAGS="$CONFIG_FLAGS $new_arg";; + *) + CONFIG_FLAGS="$CONFIG_FLAGS $arg";; + esac + done + + CONFIG_FLAGS="--host=$host_value $CONFIG_FLAGS" + test "X$build_value" != "Xguess" || build_value="$BUILDSYS" + test "X$build_value" = "X" || CONFIG_FLAGS="--build=$build_value $CONFIG_FLAGS" + + # Configure build system for boot strap + cat <<EOF + +* +* Configuring the bootstrap build system... +* + +EOF + + # hide build tools environment which is for the cross configure + set_config_flags $CONFIG_FLAGS + hide_vars CONFIG_FLAGS + + set_config_flags + run_configure --enable-bootstrap-only + + # restore the hidden build tools environment for the cross configure + restore_vars CONFIG_FLAGS + + COMPFIX="" + cat <<EOF + +* +* Configuring the cross host system ($host_value)... +* + +EOF + # We don't pass the command line here since we already have moved it + # into CONFIG_FLAGS + run_configure + + return 0 +} + do_configure () { setup_make mk_targetdir - save_ot="$OVERRIDE_TARGET" - save_t="$TARGET" + + # Get `erl_build_tool_vars' + . "$ERL_TOP/erl-build-tool-vars.sh" || exit 1 + if [ ! -z "$OVERRIDE_CONFIGURE" ]; then case $TARGET in vxworks_*) ( cd erts/autoconf && \ $ERL_TOP/erts/autoconf/configure.vxworks $TARGET ) - echo "Configuring for build host too..." >&2 - OVERRIDE_TARGET= - export OVERRIDE_TARGET - TARGET=`$ERL_TOP/erts/autoconf/config.guess` - mk_targetdir;; + echo "Configuring for build system too..." >&2 + hide_vars OVERRIDE_TARGET TARGET + TARGET=$BUILDSYS + export TARGET + mk_targetdir + set_config_flags "$@" + run_configure "$@" + restore_vars OVERRIDE_TARGET TARGET;; *) echo "Unexpected target when ordinary configure is" \ "overridden" >&2 @@ -362,110 +528,13 @@ do_configure () exit 1;; esac else - if [ "x$OVERRIDE_TARGET" != "x" -a "x$OVERRIDE_TARGET" != "xwin32" ]; then - save_CONFIG_FLAGS="$CONFIG_FLAGS" - if [ "x$erl_xcomp_configure_flags" != "x" ]; then - set_config_flags $erl_xcomp_configure_flags - else - set_config_flags $CONFIG_FLAGS "$@" - fi - COMPFIX="" - save_CC="$CC" - save_LD="$LD" - save_CFLAGS="$CFLAGS" - save_LDFLAGS="$LDFLAGS" - save_RANLIB="$RANLIB" - save_AR="$AR" - save_DED_LD="$DED_LD" - save_DED_LDFLAGS="$DED_LDFLAGS" - save_DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" - save_CPP="$CPP" - if [ "x$erl_xcomp_cc" != "x" ]; then - CC="$erl_xcomp_cc" - fi - if [ "x$erl_xcomp_cpp" != "x" ]; then - CPP="$erl_xcomp_cpp" - fi - if [ "x$erl_xcomp_ld" != "x" ]; then - LD="$erl_xcomp_ld" - fi - if [ "x$erl_xcomp_cflags" != "x" ]; then - CFLAGS="$erl_xcomp_cflags" - fi - if [ "x$erl_xcomp_ldflags" != "x" ]; then - LDFLAGS="$erl_xcomp_ldflags" - fi - if [ "x$erl_xcomp_ranlib" != "x" ]; then - RANLIB="$erl_xcomp_ranlib" - fi - if [ "x$erl_xcomp_ar" != "x" ]; then - AR="$erl_xcomp_ar" - fi - if [ "x$erl_xcomp_ded_ld" != "x" ]; then - DED_LD="$erl_xcomp_ded_ld" - fi - if [ "x$erl_xcomp_ded_ld_runtime_library_path" != "x" ]; then - DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$erl_xcomp_ded_ld_runtime_library_path" - fi - if [ "x$erl_xcomp_ded_ldflags" != "x" ]; then - DED_LDFLAGS="$erl_xcomp_ded_ldflags" - fi - export CC LD CFLAGS LDFLAGS RANLIB AR DED_LD DED_LDFLAGS DED_LD_FLAG_RUNTIME_LIBRARY_PATH CPP - - # - # The environment for compilers, cflags et al are sometimes hard - # to pass along in recursive configure, why each cross configure - # is run separately instead. This variable (crossdirs) need to - # be updated whenever a new application needs a configure - # of it's own, at least until I get the recirsive configure - # to work for the complicated environment needed by i.e. vxworks - # compilers. It's a kludge, but a working one... - # - - if [ -z "$ONLY_ERTS" ]; then - crossdirs="erts lib/common_test lib/erl_interface lib/gs lib/megaco lib/odbc lib/snmp lib/wx" - else - crossdirs="erts" - fi - - export_cross_env - - for d in $crossdirs; do - echo "== Entering $d ==" - echo "./configure --build=$BUILDSYS --host=$erl_xcomp_host $CONFIG_FLAGS" - (cd $ERL_TOP/$d; ./configure --build=$BUILDSYS --host=$erl_xcomp_host $CONFIG_FLAGS) || exit 1 - echo "== Leaving $d ==" - done - - CC="$save_CC" - LD="$save_LD" - CFLAGS="$save_CFLAGS" - LDFLAGS="$save_LDFLAGS" - RANLIB="$save_RANLIB" - AR="$save_AR" - DED_LD="$save_DED_LD" - DED_LDFLAGS="$save_DED_LDFLAGS" - DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$save_DED_LD_FLAG_RUNTIME_LIBRARY_PATH" - CPP="$save_CPP" - export CC LD CFLAGS LDFLAGS RANLIB AR DED_LD DED_LDFLAGS DED_LD_FLAG_RUNTIME_LIBRARY_PATH CPP - echo "Configuring for build host too..." >&2 - OVERRIDE_TARGET= - export OVERRIDE_TARGET - TARGET=`$ERL_TOP/erts/autoconf/config.guess` - mk_targetdir - CONFIG_FLAGS="$save_CONFIG_FLAGS" + try_cross_configure "$@" + if [ $cross_configure = no ]; then + CONFIG_FLAGS= + set_config_flags "$@" + run_configure "$@" fi fi - set_config_flags $CONFIG_FLAGS "$@" - if [ -z "$ONLY_ERTS" ]; then - ./configure $CONFIG_FLAGS || exit 1 - else - echo "erts/configure $CONFIG_FLAGS" - (cd $ERL_TOP/erts; ./configure $CONFIG_FLAGS) || exit 1 - fi - OVERRIDE_TARGET="$save_ot" - export OVERRIDE_TARGET - TARGET="$save_t" } do_lazy_configure () @@ -475,7 +544,10 @@ do_lazy_configure () echo "Not supported for cross compilation" >&2 exit 1 fi - set_config_flags $CONFIG_FLAGS "$@" + CONFIG_FLAGS= + set_config_flags "$@" + CONFIGURE_FLAGS="$@" + [ "$CONFIG_FLAGS" = "" ] || CONFIGURE_FLAGS="$CONFIG_FLAGS $CONFIGURE_FLAGS" for c_dir in $AUTOCONF_SUBDIRS; do if test -f $ERL_TOP/$c_dir/configure.in; then dir=$ERL_TOP/$c_dir @@ -490,7 +562,7 @@ do_lazy_configure () $MAKE -f $ERL_TOP/make/lazy_configure.mk \ MAKE="$MAKE" TARGET=$TARGET \ ERL_TOP=$ERL_TOP \ - CONFIGURE_FLAGS="$CONFIG_FLAGS" \ + CONFIGURE_FLAGS="$CONFIGURE_FLAGS" \ CONFIGURE_DIR=$dir \ EXTRA_CONFIGURE_DEPENDENCIES=$xc_dep \ EXTRA_CONFIG_STATUS_DEPENDENCIES=$xcs_dep \ @@ -633,16 +705,6 @@ echo_env_vxworks () echo_envinfo } -echo_env_cross () -{ - source_xcomp_file $1 - finalize_xcomp_conf - echo_env_erltop - echo_setenv ERL_XCOMP_CONF $1 ';' - echo_setenv OVERRIDE_TARGET $OVERRIDE_TARGET - echo_envinfo -} - echo_env_win32 () { #echo_envinfo @@ -814,31 +876,21 @@ do_noboot_lib_and_erts () { setup_make EMULATORS=emulator + if [ X`$MAKE is_cross_configured` = Xyes ]; then + TARGET=`$MAKE target_configured` + fi if [ "x$MAKE" != "x$clearmake" ]; then $MAKE MAKE="$MAKE" TARGET=$TARGET OTP_SMALL_BUILD=$OTP_SMALL_BUILD depend || exit 1; fi $MAKE MAKE="$MAKE" TARGET=$TARGET OTP_SMALL_BUILD=$OTP_SMALL_BUILD TYPE=$TYPE FLAVOR=$FLAVOR noboot || exit 1 } -do_primary_cross () -{ - save_t="$TARGET" - save_ot="$OVERRIDE_TARGET" - OVERRIDE_TARGET= - export OVERRIDE_TARGET - TARGET=`$ERL_TOP/erts/autoconf/config.guess` - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET primary_bootstrap || exit 1; - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET all_bootstraps || exit 1 - OVERRIDE_TARGET="$save_ot" - export OVERRIDE_TARGET - TARGET="$save_t" -} - do_primary () { setup_make if [ "x$OVERRIDE_TARGET" != "x" -a "x$OVERRIDE_TARGET" != "xwin32" ]; then - do_primary_cross + echo "OVERRIDE_TARGET set" >&2 + exit 1 else $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET primary_bootstrap || exit 1; fi @@ -1029,59 +1081,54 @@ do_cancel_prel () echo '*****************************************************' } - - -do_boot_cross () -{ - SAVE_TARGET=$TARGET - SAVE_OVERRIDE_TARGET=$OVERRIDE_TARGET - OVERRIDE_TARGET= - TARGET=`$ERL_TOP/erts/autoconf/config.guess` - - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET all_bootstraps || exit 1; - - TARGET=$SAVE_TARGET - OVERRIDE_TARGET=$SAVE_OVERRIDE_TARGET - - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET libs || exit 1; - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET depend || exit 1; - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET emulator || exit 1; -} - -do_boot_emu_cross () -{ - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET emulator || exit 1; -} do_boot () { setup_make - if [ "x$OVERRIDE_TARGET" != "x" -a "x$OVERRIDE_TARGET" != "xwin32" ]; then - do_boot_cross - else - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET all || exit 1 + + # Bootstrap if we are cross compiling + if [ X`$MAKE is_cross_configured` = Xyes ]; then + TARGET=$BUILDSYS + $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT CROSS_COMPILING=no TARGET=$TARGET bootstrap || exit 1 + TARGET=`$MAKE target_configured` + elif [ "x$OVERRIDE_TARGET" != "x" -a "x$OVERRIDE_TARGET" != "xwin32" ]; then + hide_vars OVERRIDE_TARGET TARGET + TARGET=$BUILDSYS + $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET bootstrap || exit 1 + + restore_vars OVERRIDE_TARGET TARGET fi + + # Build it (including bootstrap if not cross compiling) + $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET all || exit 1 } do_boot_emu () { setup_make - if [ "x$OVERRIDE_TARGET" != "x" -a "x$OVERRIDE_TARGET" != "xwin32" ]; then - do_boot_emu_cross - else - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET emulator || exit 1 + if [ X`$MAKE is_cross_configured` = Xyes ]; then + TARGET=`$MAKE target_configured` fi + $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET emulator || exit 1 } do_release () { setup_make - $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET RELEASE_ROOT=$1 release || exit 1 + if [ X`$MAKE is_cross_configured` = Xyes ]; then + TARGET=`$MAKE target_configured` + fi + $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET \ + RELEASE_ROOT=$1 OTP_STRICT_INSTALL=$OTP_STRICT_INSTALL \ + release || exit 1 } do_tests () { setup_make + if [ X`$MAKE is_cross_configured` = Xyes ]; then + TARGET=`$MAKE target_configured` + fi if [ X"$1" = X"" ]; then $MAKE MAKE="$MAKE" TARGET=$TARGET release_tests || exit 1 else @@ -1232,10 +1279,6 @@ esac if [ ! -z "$OVERRIDE_TARGET" ]; then TARGET="$OVERRIDE_TARGET" -else - if [ "x$erl_xcomp_host" != "x" ]; then - finalize_xcomp_conf - fi fi # Setting a bootstrap root is inherently very dangerous now that the bootstrap @@ -1263,10 +1306,6 @@ else fi export OTP_SMALL_BUILD -if [ "x$ERL_XCOMP_CONF" != "x" ]; then - . $ERL_XCOMP_CONF -fi - TYPE= case "$1" in all) diff --git a/prebuild.skip b/prebuild.skip index 1f88ed4c6d..e366c6a164 100644 --- a/prebuild.skip +++ b/prebuild.skip @@ -1,3 +1,4 @@ Makefile bin bootstrap/bin +ibin diff --git a/xcomp/README b/xcomp/README index dfda81fc8e..4cb577471a 100644 --- a/xcomp/README +++ b/xcomp/README @@ -1,10 +1,10 @@ -================================================================================ - Cross compiling Erlang/OTP -================================================================================ +=============================================================================== + Cross compiling Erlang/OTP +=============================================================================== %CopyrightBegin% -Copyright Ericsson AB 2009. All Rights Reserved. +Copyright Ericsson AB 2009-2010. All Rights Reserved. The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in @@ -19,200 +19,413 @@ under the License. %CopyrightEnd% -================================================================================ +=============================================================================== + +This document describes how to cross compile Erlang/OTP. Note that the support +for cross compiling Erlang/OTP is in its early stage of development, and +should be considered as experimental. You are encouraged to read the whole +document before attempting to cross compile Erlang/OTP. + +Building Erlang/OTP can be done either by using the `$ERL_TOP/otp_build' +script, or by invoking `configure' and `make' directly. The +`erl-xcomp.conf.template' file contains all available configuration variables +and can be used as a template when creating a configuration. See +`erl-xcomp-TileraMDE2.0-tilepro.conf` and `erl-xcomp-x86_64-saf-linux-gnu.conf' +for examples of working configurations. + +The configuration files can be passed to `$ERL_TOP/otp_build configure' using +the `--xcomp-conf' command line argument. Note that `configure' doesn't accept +this command line argument. When using the `configure' script directly, pass +the configuration variables as arguments to `configure' (or exported in the +environment). If the default behavior of a variable is satisfactory, the +variable doesn't need to be set. However, the `configure' script will issue a +warning when a default value is used. When a variable has been set, no warning +will be issued. + +All Erlang/OTP applications except the `wx' application can be cross compiled. +The build of the `wx' driver will currently be automatically disabled when +cross compiling. + +Note, that `$ERL_TOP/otp_build configure' will produce a default configuration +that differs from what `$ERL_TOP/configure' will produce by default. For +example, currently `--disable-dynamic-ssl-lib' is added to the +`$ERL_TOP/configure' command line arguments unless `--enable-dynamic-ssl-lib' +has been explicitly passed. The defaults used by `$ERL_TOP/otp_build configure' +may change at any time without prior notice. + +The build system, including cross compilation configuration variables used, +may be subject to non backward compatible changes without prior notice. +Current cross build system has been tested when cross compiling some Linux/GNU +systems, but has only been partly tested for more esoteric platforms. The +VxWorks example file is highly dependent on our environment and is here more +or less only for internal use. -This directory contains a configuration file template and configuration examples -for cross compiling Erlang/OTP. The configuration files contain configuration -variables and should be supplied to the $ERL_TOP/otp_build when setting up an -appropriate environment for cross compiling. The currently used configuration -variables are described later in this document. +Please submit any patches for cross compiling in a way consistent with this +system. All input is welcome as we have a very limited set of cross compiling +environments to test with. If a new configuration variable is needed, add it +to `$ERL_TOP/xcomp/erl-xcomp.conf.template', and use it in `configure.in'. +Other files that might need to be updated are: +- `$ERL_TOP/xcomp/erl-xcomp-vars.sh' +- `$ERL_TOP/erl-build-tool-vars.sh' +- `$ERL_TOP/erts/aclocal.m4' +- `$ERL_TOP/xcomp/README' +- `$ERL_TOP/xcomp/erl-xcomp-*.conf' +Note that this might be an incomplete list of files that need to be updated. -The erl-xcomp.conf.template contains all available configuration variables -and can be used as a template when creating a configuration. See the -erl-xcomp-TileraMDE2.0-tilepro.conf for an example of a working configuration -file. +General information on how to submit patches can be found at: + http://wiki.github.com/erlang/otp/submitting-patches -Instead of using the configuration files one can export the configuration -variables as ordinary environment variables before calling otp_build. If -default behavior of a variable is satisfactory, the variable need not to -be set and exported. +======= Build and Install ===================================================== -Note that the support for cross compiling is in its early stage of development, -and should be considered as experimental. The build system including cross -compilation configuration variables used may be subject to non backward -compatible changes without prior notice. It works for cross compiling some -Linux/GNU systems, but has only been partly tested for more esoteric platforms. -The VxWorks example file is highly dependent on our environment and is here -more or less only for internal use. + [1] -Please submit any patches for cross compiling in a way consistent with this -system. If a new configuration variable is needed for your system, add it to the -template file, use it in otp_build, aclocal.m4 and/or configure.in. All input is -welcome as we cannot possibly have all cross compiling environments out there to -test with. +Change directory into the top directory of the Erlang/OTP source tree. -General information on how to submit patches can be found at: - http://wiki.github.com/erlang/otp/submitting-patches + $ cd $ERL_TOP + +------- Build ----------------------------------------------------------------- + +In order to compile Erlang code, a small Erlang bootstrap system has to be +built, or an Erlang/OTP system of the same release as the one being built +has to be provided in the `$PATH'. The Erlang/OTP for the target system will +be built using this Erlang system, together with the cross compilation tools +provided. + +If you want to build using a compatible Erlang/OTP system in the `$PATH', +jump to [3]. + +-- Building a bootstrap system -- + + [2] + + $ ./configure --enable-bootstrap-only + $ make + +The `--enable-bootstrap-only' argument to `configure' isn't strictly necessary, +but will speed things up. It will only run `configure' in applications +necessary for the bootstrap, and will disable a lot of things not needed by +the bootstrap system. If you run `configure' without `--enable-boostrap-only' +you also have to run make as `make bootstrap'; otherwise, the whole system will +be built. + +-- Cross building the system -- + + [3] + + $ ./configure --build=<BUILD> --host=<HOST> [Other Configure Args] + $ make + +<BUILD> should equal the CPU-VENDOR-OS triplet of the system that you build +on. If you execute `$ERL_TOP/erts/autoconf/config.guess', it will in most +cases print the triplet you want to use for this. + +<HOST> is the system that you build for. It does not have to be a full +CPU-VENDOR-OS triplet, but can be. The full CPU-VENDOR-OS triplet will be +created by executing `$ERL_TOP/erts/autoconf/config.sub <HOST>'. If +`config.sub' fails, you need to be more specific. + +Pass the cross compilation variables as command line arguments to `configure' +using a `<VAR>=<VALUE>' syntax (or export them in the environment). Note that +you can *not* pass a configuration file using `--xcomp-conf=<FILE>' when you +invoke `configure' directly. The `--xcomp-conf=<FILE>' argument can only +be passed to `$ERL_TOP/otp_build configure'. + +`make' will verify that the Erlang/OTP system used when building is of the +same release as the system being built, and will fail if this is not the case. +It is possible, however not recommended, to force the cross compilation even +though the wrong Erlang/OTP system is used. This by invoking `make' like this: +`make ERL_XCOMP_FORCE_DIFFERENT_OTP=yes'. Note that this build might fail, +silently produce suboptimal code, or silently produce erroneous code. + +-- Installing -- + +You can either install using the installation paths determined by `configure' +[4], or install manually using [5]. + + [4] + + $ make install DESTDIR=<TEMPORARY_PREFIX> + +`make install' will install at a location specified when doing `configure'. +`configure' arguments specifying where the installation should reside are for +example: `--prefix', `--exec-prefix', `--libdir', `--bindir', etc. By default +it will install under `/usr/local'. You typically do not want to install your +cross build under `/usr/local' on your build machine. Using `DESTDIR' will +cause the installation paths to be prefixed by `$DESTDIR'. This makes it +possible to install and package the installation on the build machine without +having to place the installation in the same directory on the build machine as +it should be executed from on the target machine. + +When `make install' has finished, change directory into `$DESTDIR', package +the system, move it to the target machine, and unpack it. Note that the +installation will only be working on the target machine at the location +determined by `configure'. + +Installing manually: + + [5] + + $ make release RELEASE_ROOT=<RELEASE_DIR> + +`make release' will copy what you have built for the target machine to +`<RELEASE_DIR>'. The `Install' script will not be run. The content of +`<RELEASE_DIR>' is what by default ends up in `/usr/local/lib/erlang'. -== Build and Install =========================================================== +The `Install' script used when installing Erlang/OTP requires common Unix +tools such as `sed' to be present in your `$PATH'. If your target system +does not have such tools, you need to run the `Install' script on your +build machine before packaging Erlang/OTP. The `Install' script should +currently be invoked as follows in the directory where it resides +(the top directory): + `./Install [-cross] [-minimal|-sasl] <ERL_ROOT>' + where: + -minimal - Creates an installation that starts up a minimal amount + of applications, i.e., only `kernel' and `stdlib' are + started. The minimal system is normally enough. + -sasl - Creates an installation that also starts up the `sasl' + application. + -cross - For cross compilation. Informs the install script that it + is run on the build machine. + <ERL_ROOT> - The absolute path to the Erlang installation to use at run + time. This is often the same as the current working + directory, but does not have to be. It can follow any other + path through the file system to the same directory. +If neither `-minimal', nor `-sasl' is passed as argument you will be +prompted. - [1] $ cd $ERL_TOP +You can now either: -Either set up your cross compilation variables in the environment manually, -or set up the environment using a configuration file by executing: - [2] $ eval `./otp_build env_cross <ABSOLUTE_PATH_TO_XCONF_FILE>` + [6] -Configure and build Erlang/OTP: - [3] $ ./otp_build configure - [4] $ ./otp_build boot -a - [5] $ ./otp_build release -a <ABSOLUTE_PATH_TO_RELEASE_ROOT> +* Decide where the installation should be located on the target machine, run + the `Install' script on the build machine, and package the installed + installation. The installation just need to be unpacked at the right + location on the target machine: -The Install script used when installing Erlang/OTP requires common Unix -tools such as 'sed' to be present in your PATH. If your target system -does not have such tools, you need to run the Install script on your -build machine before packing Erlang/OTP. If so, run the Install script -like follows; otherwise skip [6] and [7]: - [6] $ cd <ABSOLUTE_PATH_TO_RELEASE_ROOT> - [7] $ ./Install -cross <ABSOLUTE_INSTALL_ROOT_ON_TARGET> # answer questions + $ cd <RELEASE_DIR> + $ ./Install -cross [-minimal|-sasl] <ABSOLUTE_INSTALL_DIR_ON_TARGET> -Pack Erlang/OTP as follows (gnu tar is assumed): - [8] $ cd <ABSOLUTE_PATH_TO_RELEASE_ROOT> - [9] $ tar -zcf <WHERE_TO_SAVE_THE_RELEASE>/<RELEASE_NAME>.tar.gz * + [7] -Install Erlang/OTP on the target system like follows. If you ran the Install -script before packing ([6] and [7]) you should skip [12]: - [10] $ cd <ABSOLUTE_INSTALL_ROOT_ON_TARGET> - [11] $ tar -zxf <WHERE_THE_PACKED_RELEASE_EXIST>/<RELEASE_NAME>.tar.gz - [12] $ ./Install <ABSOLUTE_INSTALL_ROOT_ON_TARGET> # answer questions +* Package the installation in <RELEASE_DIR>, place it wherever you want on + your target machine, and run the `Install' script on your target machine: -<ABSOLUTE_INSTALL_ROOT_ON_TARGET> usually equals current working directory -when you run the Install script on the target system, but does not have to. -It can follow another path through the file system to the same directory. -<ABSOLUTE_INSTALL_ROOT_ON_TARGET> is the path that will be used when running -Erlang/OTP and is the path that have to be available at run time. + $ cd <ABSOLUTE_INSTALL_DIR_ON_TARGET> + $ ./Install [-minimal|-sasl] <ABSOLUTE_INSTALL_DIR_ON_TARGET> -== Currently used configuration variables ====================================== +-- Building with the `otp_build' script -- --- Mandatory ------------------------------------------------------------------- + [8] -* erl_xcomp_host - Target system. The value will be passed as '--host' argument to the configure - script. It does not have to be a full CPU-VENDOR-OS triplet, but can be. The - full CPU-VENDOR-OS triplet will be created by: - $ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host + $ cd $ERL_TOP --- Optional -------------------------------------------------------------------- + [9] -* erl_xcomp_configure_flags - To override the configure flags for a special target system, you - can set this variable which overrides configure parameters on the - command line and instead uses the specified options. The variable - leaves the build-host system untouched. + $ ./otp_build configure [--build=<BUILD>] [--host=<HOST>] \ + [--with-xcomp-conf=<FILE>] [Other Configure Args] --- Optional build environment flags -- +If you have your cross compilation configuration in a file, pass it using the +`--xcomp-conf=<FILE>' command line argument. If not, pass the configuration +variables on the command line using a `<VAR>=<VALUE>' syntax (or in the +environment). -If the cross compilation tools aren't prefixed by '$erl_xcomp_host-', -you will have to use these configuration variables in order to use the -right cross compilation tools. +`--build=<BUILD>', and `--host=<HOST>' are the same as described at [3]. +The `--xcomp-conf=<FILE>' argument causes `otp_build' to read the cross +compilation configuration from `<FILE>'. All of these arguments are in this +case optional, but `<BUILD>', and `<HOST>' must be given either by passing +`--build=<BUILD>' and `--host=<HOST>' on the command line, or by setting +`erl_xcomp_build=<HOST>', and `erl_xcomp_host=<HOST>' in `<FILE>' and +passing the `--xcomp-conf=<FILE>' argument. -* erl_xcomp_cc - C compiler. +`otp_build configure' will configure both for the boostrap system on the +build machine and the cross host system. -* erl_xcomp_ld - Linker. + [10] -* erl_xcomp_cflags - C compiler flags. + $ ./otp_build boot -a -* erl_xcomp_cpp - C pre processor. + 'otp_build boot -a' will first build a bootstrap system +for the build machine and then do the cross build of the system. -* erl_xcomp_ldflags - Linker flags. + [11] -* erl_xcomp_ranlib - Ranlib program. + $ ./otp_build release -a <RELEASE_DIR> -* erl_xcomp_ar - Ar program. +'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]. -* erl_xcomp_ded_ld - Dynamic Erlang Driver linker. +======== Currently used configuration variables =============================== -* erl_xcomp_ded_ldflags - Dynamic Erlang Driver linker flags. +Note that you cannot define arbitrary variables in a cross compilation +configuration file. Only the ones listed below will be guaranteed to be +visible throughout the whole execution of all `configure' scripts. Other +variables needs to be defined as arguments to `configure' or exported in +the environment. -* erl_xcomp_ded_ld_runtime_library_path - Dynamic Erlang Driver runtime linker path. +-------- `otp_build' only variables ------------------------------------------- --- Optional feature, or bug tests -- +Variables in this section are only used, when configuring Erlang/OTP for +cross compilation using `$ERL_TOP/otp_build configure'. + +NOTE! These variables currently have *no* effect if you configure using the +`configure' script directly. + +* erl_xcomp_build - Build system. + This value will be passed as `--build=$erl_xcomp_build' argument to the + `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, + but can be. The full CPU-VENDOR-OS triplet will be created by: + `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build' + If `erl_xcomp_build=guess', the build system will be guessed using: + `$ERL_TOP/erts/autoconf/config.guess'. + +* erl_xcomp_host - Cross host system. + This value will be passed as `--host=$erl_xcomp_host' argument to the + `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, + but can be. The full CPU-VENDOR-OS triplet will be created by: + `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host' + +* erl_xcomp_configure_flags - Extra configure flags. + Extra flags to pass to the `configure' script. + +-------- Cross compiler and other tools to use -------------------------------- + +If the cross compilation tools are prefixed by `<HOST>-' you probably do +not need to set these variables (where `<HOST>' is what has been passed as +`--host=<HOST>' argument to `configure'). + +* CC - C compiler. + +* CFLAGS - C compiler flags. + +* STATIC_CFLAGS - Static C compiler flags. + +* CFLAG_RUNTIME_LIBRARY_PATH - C compiler runtime library path flag. + This flag should set a specific runtime library path for the shared + library at link time. Note that this is actually a linker flag, but it + needs to be passed via the compiler. + +* CPP - C pre-processor. + +* CPPFLAGS - C pre-processor flags. + +* CXX - C++ compiler. + +* CXXFLAGS - C++ compiler flags. + +* LD - Linker + +* LDFLAGS - Linker flags. + +-- Dynamic Erlang Driver linker flags. -- + +NOTE! Either define all or non of the DED_LD* variables. + +* DED_LD - Linker. + +* DED_LDFLAGS - Linker flags. + +* DED_LD_FLAG_RUNTIME_LIBRARY_PATH - Linker runtime library path flag. + This flag should set a specific runtime library path for the shared + library at link time. + +-- Other tools -- + +* RANLIB - ranlib + +* AR - ar + +-------- Cross System Root Locations ------------------------------------------ + +* erl_xcomp_sysroot - Absolute cross system root path. + The absolute path to the system root of the cross compilation + environment. Currently, the `crypto', `odbc', `ssh' and `ssl' + applications need the system root. These applications will be skipped + if the system root has not been set. The system root might be needed + for other things too. If this is the case and the system root has not + been set, `configure' will fail and request you to set it. + +* erl_xcomp_isysroot - Absolute cross include system root path. + The absolute path to the system root for includes of the cross + compilation environment. If not set, this value defaults to + `$erl_xcomp_sysroot', i.e., only set this value if the include system + root path is not the same as the system root path. + +-------- Optional feature, or bug tests --------------------------------------- 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. +The `configure' script will issue a warning when a default value is used. +When a variable has been set, no warning will be issued. + * erl_xcomp_bigendian - yes|no - If yes, the target system must be big endian. If no, little endian. This can - often be automatically detected, but not always. If not automatically - detected, configure will fail unless this variable is set. No default value - is used, i.e., configure will try to figure this out automatically. - -* erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to yes) - If yes, clock_gettime(CLOCK_MONOTONIC, _) on the target system must work. - This variable is recommended to be set to no on Linux systems with kernel - versions less than 2.6. - -* erl_xcomp_linux_nptl - yes|no (defaults to yes on Linux; otherwise, no) - If yes, the target system must have NPTL (Native POSIX Thread Library). - Older Linux systems have LinuxThreads instead of NPTL (Linux kernel - versions typically less than 2.6). - -* erl_xcomp_linux_usable_sigusrx - yes|no (defaults to yes) - If yes, the SIGUSR1 and SIGUSR2 must be usable by the ERTS. Old - LinuxThreads thread libraries (Linux kernel versions less than 2.2) used - these signals and made them unusable by the ERTS. - -* erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to yes) - If yes, sigaltstack() must be usable on the target system. sigaltstack() - on Linux kernel versions less than 2.4 are broken. - -* erl_xcomp_poll - yes|no (defaults to no on Darwin/MacOSX; otherwise, yes) - If yes, the target system must have a working poll() implementation that also - can handle devices. If no, select() will be used instead of poll(). - -* erl_xcomp_kqueue - yes|no (defaults to no) - If yes, the target system must have a working kqueue() implementation that - returns a file descriptor which can be used by poll() and/or select(). - If no and the target system has not got epoll() or /dev/poll, the kernel-poll - feature will be disabled. - -* erl_xcomp_putenv_copy - yes|no (defaults to no) - If yes, the target system must have a putenv() implementation that stores a - copy of the key/value pair. - -* erl_xcomp_reliable_fpe - yes|no (defaults to no) - If yes, the target system must have reliable floating point exceptions. - -* erl_xcomp_getaddrinfo - yes|no (defaults to no) - If yes, the target system must have a working getaddrinfo() implementation - that can handle both IPv4 and IPv6. - -* erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to no) - If yes, the target system must have a working gethrvtime() implementation - and is used with procfs ioctl(). - -* erl_xcomp_clock_gettime - yes|no (defaults to no) - If yes, the target system must have a working clock_gettime() implementation - that can be used for retrieving process CPU time. - -* erl_xcomp_after_morecore_hook - yes|no (defaults to no) - If yes, the target system must have a working __after_morecore_hook that can - be used for tracking used malloc() implementations core memory usage. - -* erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to no) - If yes, the target system must have a working dlsym(RTLD_NEXT, <S>) - implementation that can be used on 'brk' and 'sbrk' symbols used by the - malloc() implementation in use, and by this track the malloc() implementations - core memory usage. - -================================================================================ + If `yes', the target system must be big endian. If `no', little endian. + This can often be automatically detected, but not always. If not + automatically detected, `configure' will fail unless this variable is + set. No default value is used, i.e., `configure' will try to figure + this out automatically. + +* erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to `yes' on + Linux; otherwise, `no') + If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on the target system must + work. This variable is recommended to be set to `no' on Linux systems + with kernel versions less than 2.6. + +* erl_xcomp_linux_nptl - yes|no (defaults to `yes' on Linux; otherwise, `no') + If `yes', the target system must have NPTL (Native POSIX Thread Library). + Older Linux systems have LinuxThreads instead of NPTL (Linux kernel + versions typically less than 2.6). + +* erl_xcomp_linux_usable_sigusrx - yes|no (defaults to `yes') + If `yes', the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. + Old LinuxThreads thread libraries (Linux kernel versions less than 2.2) + used these signals and made them unusable by the ERTS. + +* erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to `yes' on Linux; + otherwise, `no') + If `yes', `sigaltstack()' must be usable on the target system. + `sigaltstack()' on Linux kernel versions less than 2.4 are broken. + +* erl_xcomp_poll - yes|no (defaults to `no' on Darwin/MacOSX; otherwise, `yes') + If `yes', the target system must have a working `poll()' implementation + that also can handle devices. If `no', `select()' will be used instead of + `poll()'. + +* erl_xcomp_kqueue - yes|no (defaults to `no') + If `yes', the target system must have a working `kqueue()' implementation + that returns a file descriptor which can be used by `poll()' and/or + `select()'. If `no' and the target system has not got `epoll()' or + `/dev/poll', the kernel-poll feature will be disabled. + +* erl_xcomp_putenv_copy - yes|no (defaults to `no') + If `yes', the target system must have a `putenv()' implementation that + stores a copy of the key/value pair. + +* erl_xcomp_reliable_fpe - yes|no (defaults to `no') + If `yes', the target system must have reliable floating point exceptions. + +* erl_xcomp_getaddrinfo - yes|no (defaults to `no') + If `yes', the target system must have a working `getaddrinfo()' + implementation that can handle both IPv4 and IPv6. + +* erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to `no') + If `yes', the target system must have a working `gethrvtime()' + implementation and is used with procfs `ioctl()'. + +* erl_xcomp_clock_gettime_cpu_time - yes|no (defaults to `no') + If `yes', the target system must have a working `clock_gettime()' + implementation that can be used for retrieving process CPU time. + +* erl_xcomp_after_morecore_hook - yes|no (defaults to `no') + If `yes', the target system must have a working `__after_morecore_hook' + that can be used for tracking used `malloc()' implementations core memory + usage. + +* erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to `no') + If `yes', the target system must have a working `dlsym(RTLD_NEXT, <S>)' + implementation that can be used on `brk' and `sbrk' symbols used by the + `malloc()' implementation in use, and by this track the `malloc()' + implementations core memory usage. + +=============================================================================== diff --git a/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf b/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf index c8e7212e1f..67da8b5abb 100644 --- a/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf +++ b/xcomp/erl-xcomp-TileraMDE2.0-tilepro.conf @@ -1,200 +1,236 @@ -### -### %CopyrightBegin% -### -### Copyright Ericsson AB 2009. All Rights Reserved. -### -### The contents of this file are subject to the Erlang Public License, -### Version 1.1, (the "License"); you may not use this file except in -### compliance with the License. You should have received a copy of the -### Erlang Public License along with this software. If not, it can be -### retrieved online at http://www.erlang.org/. -### -### Software distributed under the License is distributed on an "AS IS" -### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -### the License for the specific language governing rights and limitations -### under the License. -### -### %CopyrightEnd% -### -### File: erl-xcomp-TileraMDE2.0-tilepro.conf -### Author: Rickard Green -### - -### ---------------------------------------------------------------------------- -### When cross compiling Erlang/OTP, copy this file and set the variables -### needed below. Then pass the path to the copy of this file as an argument -### to "eval `otp_build env_cross <absolute path to erl-xcomp.conf file>`". -### ---------------------------------------------------------------------------- - -### ---------------------------------------------------------------------------- -### Variables in the following section *have* to be set. -### - - -## -## Target system. The value will be passed as '--host' argument to the configure -## script. It does not have to be a full CPU-VENDOR-OS tripplet, but can be. The -## full CPU-VENDOR-OS tripplet will be created by: -## $ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host -## +#### -*-shell-script-*- +#### +#### %CopyrightBegin% +#### +#### Copyright Ericsson AB 2009-2010. All Rights Reserved. +#### +#### The contents of this file are subject to the Erlang Public License, +#### Version 1.1, (the "License"); you may not use this file except in +#### compliance with the License. You should have received a copy of the +#### Erlang Public License along with this software. If not, it can be +#### retrieved online at http://www.erlang.org/. +#### +#### Software distributed under the License is distributed on an "AS IS" +#### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +#### the License for the specific language governing rights and limitations +#### under the License. +#### +#### %CopyrightEnd% +#### +#### File: erl-xcomp-TileraMDE2.0-tilepro.conf +#### Author: Rickard Green +#### +#### -------------------------------------------------------------------------- +#### When cross compiling Erlang/OTP using `otp_build', copy this file and set +#### the variables needed below. Then pass the path to the copy of this file as +#### an argument to `otp_build' in the configure stage: +#### `otp_build configure --xcomp-conf=<FILE>' +#### -------------------------------------------------------------------------- + +### Note that you cannot define arbitrary variables in a cross compilation +### configuration file. Only the ones listed below will be guaranteed to be +### visible throughout the whole execution of all `configure' scripts. Other +### variables needs to be defined as arguments to `configure' or exported in +### the environment. + +### ---- `otp_build' only variables ------------------------------------------- + +### Variables in this section are only used, when configuring Erlang/OTP for +### cross compilation using `$ERL_TOP/otp_build configure'. + +### NOTE! These variables currently have *no* effect if you configure using the +### `configure' script directly. + +## erl_xcomp_build - Build system. +## This value will be passed as `--build=$erl_xcomp_build' argument to the +## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, +## but can be. The full CPU-VENDOR-OS triplet will be created by: +## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build' +## If `erl_xcomp_build=guess', the build system will be guessed using: +## `$ERL_TOP/erts/autoconf/config.guess'. +erl_xcomp_build=guess + +## erl_xcomp_host - Cross host system. +## This value will be passed as `--host=$erl_xcomp_host' argument to the +## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, +## but can be. The full CPU-VENDOR-OS triplet will be created by: +## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host' erl_xcomp_host=tile -### ---------------------------------------------------------------------------- -### ---------------------------------------------------------------------------- -### To override the configure flags for a special target system, You -### can set this variable which overrides configure parameters on the -### command line and instead uses the specified options. The variable -### leaves the build-host system untouched. -### ---------------------------------------------------------------------------- +## erl_xcomp_configure_flags - Extra configure flags. +## Extra flags to pass to the `configure' script. erl_xcomp_configure_flags="--without-termcap" -###----------------------------------------------------------------------------- -### You can specify a specific CC or LD for the build target (the cross -### compiler) here along with magic CFLAGS and/or LDFLAGS if needed -### ar and ranlib might also be specified if needed. -###----------------------------------------------------------------------------- +### ---- Cross compiler and other tools to use -------------------------------- -erl_xcomp_cc= +### If the cross compilation tools are prefixed by `<HOST>-' you probably do +### not need to set these variables (where `<HOST>' is what has been passed as +### `--host=<HOST>' argument to `configure'). -erl_xcomp_ld= +## CC - C compiler. +#CC= -erl_xcomp_cflags= +## CFLAGS - C compiler flags. +#CFLAGS= -erl_xcomp_cpp= +## STATIC_CFLAGS - Static C compiler flags. +#STATIC_CFLAGS= -erl_xcomp_ldflags= +## CFLAG_RUNTIME_LIBRARY_PATH - C compiler runtime library path flag. +## This flag should set a specific runtime library path for the shared +## library at link time. Note that this is actually a linker flag, but it +## needs to be passed via the compiler. +#CFLAG_RUNTIME_LIBRARY_PATH= -erl_xcomp_ranlib= +## CPP - C pre-processor. +#CPP= -erl_xcomp_ar= +## CPPFLAGS - C pre-processor flags. +#CPPFLAGS= -###----------------------------------------------------------------------------- -### The ded_ls and ded_ldflags variables control linking of dynamically loaded -### erlang drivers. On i.e. Linux these are set to -### $(CC) and "-shared" respectively, but other OS'es might need other -### programs and flags to build a dynamic library. -### erl_xcomp_ded_ld_runtime_library_path is the flag to set a -### specific runtime library path for the shared library at link time, -### usually this should be left empty. -###----------------------------------------------------------------------------- +## CXX - C++ compiler. +#CXX= -erl_xcomp_ded_ld= +## CXXFLAGS - C++ compiler flags. +#CXXFLAGS= -erl_xcomp_ded_ldflags= +## LD - Linker +#LD= -erl_xcomp_ded_ld_runtime_library_path= +## LDFLAGS - Linker flags. +#LDFLAGS= -### -### Optional feature, or bug tests -### -### 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. -### +### -- Dynamic Erlang Driver linker flags. -- + +### NOTE! Either define all or non of the DED_LD* variables. + +## DED_LD - Linker. +#DED_LD= + +## DED_LDFLAGS - Linker flags. +#DED_LDFLAGS= + +## DED_LD_FLAG_RUNTIME_LIBRARY_PATH - Linker runtime library path flag. +## This flag should set a specific runtime library path for the shared +## library at link time. +#DED_LD_FLAG_RUNTIME_LIBRARY_PATH= + +### -- Other tools -- + +## RANLIB - ranlib +#RANLIB= + +## AR - ar +#AR= + +### ---- Cross System Root Locations ------------------------------------------ + +## erl_xcomp_sysroot - Absolute cross system root path. +## The absolute path to the system root of the cross compilation +## environment. Currently, the `crypto', `odbc', `ssh' and `ssl' +## applications need the system root. These applications will be skipped +## if the system root has not been set. The system root might be needed +## for other things too. If this is the case and the system root has not +## been set, `configure' will fail and request you to set it. +erl_xcomp_sysroot="$TILERA_ROOT/tile" + +## erl_xcomp_isysroot - Absolute cross include system root path. +## The absolute path to the system root for includes of the cross +## compilation environment. If not set, this value defaults to +## `$erl_xcomp_sysroot', i.e., only set this value if the include system +## root path is not the same as the system root path. +#erl_xcomp_isysroot= + +### ---- Optional feature, or bug tests --------------------------------------- + +### 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. + +### The `configure' script will issue a warning when a default value is used. +### When a variable has been set, no warning will be issued. -## ## erl_xcomp_bigendian - yes|no -## If yes, the target system must be big endian. If no, little endian. This -## can often be automatically detected, but not always. If not automatically -## detected, configure will fail unless this variable is set. No default value -## is used, i.e., configure will try to figure this out automatically. -erl_xcomp_bigendian= - -## -## erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to yes) -## If yes, clock_gettime(CLOCK_MONOTONIC, _) on the target system must work. -## This variable is recommended to be set to no on Linux systems with kernel -## versions less than 2.6. -## -erl_xcomp_linux_clock_gettime_correction=yes - -## -## erl_xcomp_linux_nptl - yes|no (defaults to yes on Linux; otherwise, no) -## If yes, the target system must have NPTL (Native POSIX Thread Library). -## Older Linux systems have LinuxThreads instead of NPTL (Linux kernel -## versions typically less than 2.6). -## -erl_xcomp_linux_nptl=yes - -## -## erl_xcomp_linux_usable_sigusrx - yes|no (defaults to yes) -## If yes, the SIGUSR1 and SIGUSR2 must be usable by the ERTS. Old -## LinuxThreads thread libraries (Linux kernel versions less than 2.2) used -## these signals and made them unusable by the ERTS. -## -erl_xcomp_linux_usable_sigusrx=yes - -## -## erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to yes) -## If yes, sigaltstack() must be usable on the target system. sigaltstack() -## on Linux kernel versions less than 2.4 are broken. -## -erl_xcomp_linux_usable_sigaltstack=yes - -## -## erl_xcomp_poll - yes|no (defaults to no on Darwin/MacOSX; otherwise, yes) -## If yes, the target system must have a working poll() implementation that -## also can handle devices. If no, select() will be used instead of poll(). -## -erl_xcomp_poll=yes - -## -## erl_xcomp_kqueue - yes|no (defaults to no) -## If yes, the target system must have a working kqueue() implementation that -## returns a file descriptor which can be used by poll() and/or select(). -## If no and the target system has not got epoll() or /dev/poll, the -## kernel-poll feature will be disabled. -## -erl_xcomp_kqueue= - -## -## erl_xcomp_putenv_copy - yes|no (defaults to no) -## If yes, the target system must have a putenv() implementation that stores a -## copy of the key/value pair. -## -erl_xcomp_putenv_copy= - -## -## erl_xcomp_reliable_fpe - yes|no (defaults to no) -## If yes, the target system must have reliable floating point exceptions. -## -erl_xcomp_reliable_fpe= - -## -## erl_xcomp_getaddrinfo - yes|no (defaults to no) -## If yes, the target system must have a working getaddrinfo() implementation -## that can handle both IPv4 and IPv6. -## +## If `yes', the target system must be big endian. If `no', little endian. +## This can often be automatically detected, but not always. If not +## automatically detected, `configure' will fail unless this variable is +## set. No default value is used, i.e., `configure' will try to figure +## this out automatically. +#erl_xcomp_bigendian= + +## erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to `yes' on +## Linux; otherwise, `no') +## If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on the target system must +## work. This variable is recommended to be set to `no' on Linux systems +## with kernel versions less than 2.6. +#erl_xcomp_linux_clock_gettime_correction= + +## erl_xcomp_linux_nptl - yes|no (defaults to `yes' on Linux; otherwise, `no') +## If `yes', the target system must have NPTL (Native POSIX Thread Library). +## Older Linux systems have LinuxThreads instead of NPTL (Linux kernel +## versions typically less than 2.6). +#erl_xcomp_linux_nptl= + +## erl_xcomp_linux_usable_sigusrx - yes|no (defaults to `yes') +## If `yes', the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. +## Old LinuxThreads thread libraries (Linux kernel versions less than 2.2) +## used these signals and made them unusable by the ERTS. +#erl_xcomp_linux_usable_sigusrx= + +## erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to `yes' on Linux; +## otherwise, `no') +## If `yes', `sigaltstack()' must be usable on the target system. +## `sigaltstack()' on Linux kernel versions less than 2.4 are broken. +#erl_xcomp_linux_usable_sigaltstack= + +## erl_xcomp_poll - yes|no (defaults to `no' on Darwin/MacOSX; otherwise, `yes') +## If `yes', the target system must have a working `poll()' implementation +## that also can handle devices. If `no', `select()' will be used instead of +## `poll()'. +#erl_xcomp_poll= + +## erl_xcomp_kqueue - yes|no (defaults to `no') +## If `yes', the target system must have a working `kqueue()' implementation +## that returns a file descriptor which can be used by `poll()' and/or +## `select()'. If `no' and the target system has not got `epoll()' or +## `/dev/poll', the kernel-poll feature will be disabled. +#erl_xcomp_kqueue= + +## erl_xcomp_putenv_copy - yes|no (defaults to `no') +## If `yes', the target system must have a `putenv()' implementation that +## stores a copy of the key/value pair. +#erl_xcomp_putenv_copy= + +## erl_xcomp_reliable_fpe - yes|no (defaults to `no') +## If `yes', the target system must have reliable floating point exceptions. +#erl_xcomp_reliable_fpe= + +## erl_xcomp_getaddrinfo - yes|no (defaults to `no') +## If `yes', the target system must have a working `getaddrinfo()' +## implementation that can handle both IPv4 and IPv6. erl_xcomp_getaddrinfo=yes -## -## erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to no) -## If yes, the target system must have a working gethrvtime() implementation -## and is used with procfs ioctl(). -## -erl_xcomp_gethrvtime_procfs_ioctl= - -## -## erl_xcomp_clock_gettime - yes|no (defaults to no) -## If yes, the target system must have a working clock_gettime() -## implementation that can be used for retrieving process CPU time. -## -erl_xcomp_clock_gettime= - -## -## erl_xcomp_after_morecore_hook - yes|no (defaults to no) -## If yes, the target system must have a working __after_morecore_hook that -## can be used for tracking used malloc() implementations core memory usage. -## -erl_xcomp_after_morecore_hook= - -## -## erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to no) -## If yes, the target system must have a working dlsym(RTLD_NEXT, <S>) -## implementation that can be used on 'brk' and 'sbrk' symbols used by the -## malloc() implementation in use, and by this track the malloc() -## implementations core memory usage. -## -erl_xcomp_dlsym_brk_wrappers= - -### ---------------------------------------------------------------------------- +## erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to `no') +## If `yes', the target system must have a working `gethrvtime()' +## implementation and is used with procfs `ioctl()'. +#erl_xcomp_gethrvtime_procfs_ioctl= + +## erl_xcomp_clock_gettime_cpu_time - yes|no (defaults to `no') +## If `yes', the target system must have a working `clock_gettime()' +## implementation that can be used for retrieving process CPU time. +#erl_xcomp_clock_gettime_cpu_time= + +## erl_xcomp_after_morecore_hook - yes|no (defaults to `no') +## If `yes', the target system must have a working `__after_morecore_hook' +## that can be used for tracking used `malloc()' implementations core memory +## usage. +#erl_xcomp_after_morecore_hook= + +## erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to `no') +## If `yes', the target system must have a working `dlsym(RTLD_NEXT, <S>)' +## implementation that can be used on `brk' and `sbrk' symbols used by the +## `malloc()' implementation in use, and by this track the `malloc()' +## implementations core memory usage. +#erl_xcomp_dlsym_brk_wrappers= + +#### -------------------------------------------------------------------------- diff --git a/xcomp/erl-xcomp-vars.sh b/xcomp/erl-xcomp-vars.sh new file mode 100644 index 0000000000..d9972eb3db --- /dev/null +++ b/xcomp/erl-xcomp-vars.sh @@ -0,0 +1,29 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2010. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# + +# +# erl_xcomp_vars - Cross configuration variables currently reqognized by +# `configure' scripts in OTP. +# +# NOTE: +# When updating, also update $ERL_TOP/xcomp/{README,erl-xcomp.conf.template}, +# and precious variables in $ERL_TOP/erts/aclocal.m4. +# + +erl_xcomp_vars="erl_xcomp_sysroot erl_xcomp_isysroot erl_xcomp_bigendian erl_xcomp_linux_clock_gettime_correction erl_xcomp_linux_nptl erl_xcomp_linux_usable_sigusrx erl_xcomp_linux_usable_sigaltstack erl_xcomp_poll erl_xcomp_kqueue erl_xcomp_putenv_copy erl_xcomp_reliable_fpe erl_xcomp_getaddrinfo erl_xcomp_gethrvtime_procfs_ioctl erl_xcomp_clock_gettime_cpu_time erl_xcomp_after_morecore_hook erl_xcomp_dlsym_brk_wrappers" diff --git a/xcomp/erl-xcomp-vxworks_ppc32.conf b/xcomp/erl-xcomp-vxworks_ppc32.conf index 19a9327239..fbd23c2fb9 100644 --- a/xcomp/erl-xcomp-vxworks_ppc32.conf +++ b/xcomp/erl-xcomp-vxworks_ppc32.conf @@ -1,199 +1,236 @@ -### -### %CopyrightBegin% -### -### Copyright Ericsson AB 2009. All Rights Reserved. -### -### The contents of this file are subject to the Erlang Public License, -### Version 1.1, (the "License"); you may not use this file except in -### compliance with the License. You should have received a copy of the -### Erlang Public License along with this software. If not, it can be -### retrieved online at http://www.erlang.org/. -### -### Software distributed under the License is distributed on an "AS IS" -### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -### the License for the specific language governing rights and limitations -### under the License. -### -### %CopyrightEnd% -### -### File: erl-xcomp-vxworks_ppc32.conf -### Author: Rickard Green/Patrik Nyblom -### - -### ---------------------------------------------------------------------------- -### When cross compiling Erlang/OTP, copy this file and set the variables -### needed below. Then pass the path to the copy of this file as an argument -### to "eval `otp_build env_cross <absolute path to erl-xcomp.conf file>`". -### ---------------------------------------------------------------------------- - -### ---------------------------------------------------------------------------- -### Variables in the following section *have* to be set. -### - -## -## Target system. The value will be passed as '--host' argument to the configure -## script. It does not have to be a full CPU-VENDOR-OS tripplet, but can be. The -## full CPU-VENDOR-OS tripplet will be created by: -## $ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host -## +#### -*-shell-script-*- +#### +#### %CopyrightBegin% +#### +#### Copyright Ericsson AB 2009-2010. All Rights Reserved. +#### +#### The contents of this file are subject to the Erlang Public License, +#### Version 1.1, (the "License"); you may not use this file except in +#### compliance with the License. You should have received a copy of the +#### Erlang Public License along with this software. If not, it can be +#### retrieved online at http://www.erlang.org/. +#### +#### Software distributed under the License is distributed on an "AS IS" +#### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +#### the License for the specific language governing rights and limitations +#### under the License. +#### +#### %CopyrightEnd% +#### +#### File: erl-xcomp-vxworks_ppc32.conf +#### Author: Rickard Green/Patrik Nyblom +#### +#### -------------------------------------------------------------------------- +#### When cross compiling Erlang/OTP using `otp_build', copy this file and set +#### the variables needed below. Then pass the path to the copy of this file as +#### an argument to `otp_build' in the configure stage: +#### `otp_build configure --xcomp-conf=<FILE>' +#### -------------------------------------------------------------------------- + +### Note that you cannot define arbitrary variables in a cross compilation +### configuration file. Only the ones listed below will be guaranteed to be +### visible throughout the whole execution of all `configure' scripts. Other +### variables needs to be defined as arguments to `configure' or exported in +### the environment. + +### ---- `otp_build' only variables ------------------------------------------- + +### Variables in this section are only used, when configuring Erlang/OTP for +### cross compilation using `$ERL_TOP/otp_build configure'. + +### NOTE! These variables currently have *no* effect if you configure using the +### `configure' script directly. + +## erl_xcomp_build - Build system. +## This value will be passed as `--build=$erl_xcomp_build' argument to the +## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, +## but can be. The full CPU-VENDOR-OS triplet will be created by: +## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build' +## If `erl_xcomp_build=guess', the build system will be guessed using: +## `$ERL_TOP/erts/autoconf/config.guess'. +erl_xcomp_build=guess + +## erl_xcomp_host - Cross host system. +## This value will be passed as `--host=$erl_xcomp_host' argument to the +## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, +## but can be. The full CPU-VENDOR-OS triplet will be created by: +## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host' erl_xcomp_host=powerpc-wrs-vxworks -### ---------------------------------------------------------------------------- -### ---------------------------------------------------------------------------- -### To override the configure flags for a special target system, You -### can set this variable which overrides configure parameters on the -### command line and instead uses the specified options. The variable -### leaves the build-host system untouched. -### ---------------------------------------------------------------------------- -erl_xcomp_configure_flags="--without-termcap" +## erl_xcomp_configure_flags - Extra configure flags. +## Extra flags to pass to the `configure' script. +erl_xcomp_configure_flags="--disable-threads --without-termcap" -###----------------------------------------------------------------------------- -### You can specify a specific CC or LD for the build target (the cross -### compiler) here along with magic CFLAGS and/or LDFLAGS if needed -### ar and ranlib might also be specified if needed. -###----------------------------------------------------------------------------- +### ---- Cross compiler and other tools to use -------------------------------- -erl_xcomp_cc="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ccppc" +### If the cross compilation tools are prefixed by `<HOST>-' you probably do +### not need to set these variables (where `<HOST>' is what has been passed as +### `--host=<HOST>' argument to `configure'). -erl_xcomp_ld="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ldppc" +## CC - C compiler. +CC="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ccppc" -erl_xcomp_cflags="-DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -DWANT_NONBLOCKING -DHAVE_SENS -DHAVE_MEMMOVE -DVXWORKS -I$WIND_BASE/vxworks-6.3/target/h -I$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/lib/gcc/powerpc-wrs-vxworks/3.4.4/include -I$WIND_BASE/vxworks-6.3/target/h/wrn/coreip -I$WIND_BASE/vxworks-6.3/target/h -mstrict-align -fvolatile -fno-builtin -mlongcall" +## CFLAGS - C compiler flags. +CFLAGS="-DCPU=PPC32 -DTOOL_FAMILY=gnu -DTOOL=gnu -DWANT_NONBLOCKING -DHAVE_SENS -DHAVE_MEMMOVE -DVXWORKS -I$WIND_BASE/vxworks-6.3/target/h -I$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/lib/gcc/powerpc-wrs-vxworks/3.4.4/include -I$WIND_BASE/vxworks-6.3/target/h/wrn/coreip -I$WIND_BASE/vxworks-6.3/target/h -mstrict-align -fvolatile -fno-builtin -mlongcall" -erl_xcomp_cpp="$erl_xcomp_cc $erl_xcomp_cflags -E" +## STATIC_CFLAGS - Static C compiler flags. +#STATIC_CFLAGS= -erl_xcomp_ldflags="-mlongcall" +## CFLAG_RUNTIME_LIBRARY_PATH - C compiler runtime library path flag. +## This flag should set a specific runtime library path for the shared +## library at link time. Note that this is actually a linker flag, but it +## needs to be passed via the compiler. +#CFLAG_RUNTIME_LIBRARY_PATH= -erl_xcomp_ranlib="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ranlibppc" +## CPP - C pre-processor. +CPP="$CC $CFLAGS -E" -erl_xcomp_ar="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/arppc" +## CPPFLAGS - C pre-processor flags. +#CPPFLAGS= -###----------------------------------------------------------------------------- -### The ded_ls and ded_ldflags variables control linking of dynamically loaded -### erlang drivers. On i.e. Linux these are set to -### $(CC) and "-shared" respectively, but other OS'es might need other -### programs and flags to build a dynamic library. -### erl_xcomp_ded_ld_runtime_library_path is the flag to set a -### specific runtime library path for the shared library at link time, -### usually this should be left empty. -###----------------------------------------------------------------------------- +## CXX - C++ compiler. +#CXX= -erl_xcomp_ded_ld= +## CXXFLAGS - C++ compiler flags. +#CXXFLAGS= -erl_xcomp_ded_ldflags= +## LD - Linker +LD="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ldppc" -erl_xcomp_ded_ld_runtime_library_path= +## LDFLAGS - Linker flags. +LDFLAGS="-mlongcall" -### -### Optional feature, or bug tests -### -### 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. -### +### -- Dynamic Erlang Driver linker flags. -- + +### NOTE! Either define all or non of the DED_LD* variables. + +## DED_LD - Linker. +#DED_LD= + +## DED_LDFLAGS - Linker flags. +#DED_LDFLAGS= + +## DED_LD_FLAG_RUNTIME_LIBRARY_PATH - Linker runtime library path flag. +## This flag should set a specific runtime library path for the shared +## library at link time. +#DED_LD_FLAG_RUNTIME_LIBRARY_PATH= + +### -- Other tools -- + +## RANLIB - ranlib +RANLIB="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/ranlibppc" + +## AR - ar +AR="$WIND_BASE/gnu/3.4.4-vxworks-6.3/$WIND_HOST_TYPE/bin/arppc" + +### ---- Cross System Root Locations ------------------------------------------ + +## erl_xcomp_sysroot - Absolute cross system root path. +## The absolute path to the system root of the cross compilation +## environment. Currently, the `crypto', `odbc', `ssh' and `ssl' +## applications need the system root. These applications will be skipped +## if the system root has not been set. The system root might be needed +## for other things too. If this is the case and the system root has not +## been set, `configure' will fail and request you to set it. +#erl_xcomp_sysroot= + +## erl_xcomp_isysroot - Absolute cross include system root path. +## The absolute path to the system root for includes of the cross +## compilation environment. If not set, this value defaults to +## `$erl_xcomp_sysroot', i.e., only set this value if the include system +## root path is not the same as the system root path. +#erl_xcomp_isysroot= + +### ---- Optional feature, or bug tests --------------------------------------- + +### 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. + +### The `configure' script will issue a warning when a default value is used. +### When a variable has been set, no warning will be issued. -## ## erl_xcomp_bigendian - yes|no -## If yes, the target system must be big endian. If no, little endian. This -## can often be automatically detected, but not always. If not automatically -## detected, configure will fail unless this variable is set. No default value -## is used, i.e., configure will try to figure this out automatically. +## If `yes', the target system must be big endian. If `no', little endian. +## This can often be automatically detected, but not always. If not +## automatically detected, `configure' will fail unless this variable is +## set. No default value is used, i.e., `configure' will try to figure +## this out automatically. erl_xcomp_bigendian=yes -## -## erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to yes) -## If yes, clock_gettime(CLOCK_MONOTONIC, _) on the target system must work. -## This variable is recommended to be set to no on Linux systems with kernel -## versions less than 2.6. -## -erl_xcomp_linux_clock_gettime_correction= - -## -## erl_xcomp_linux_nptl - yes|no (defaults to yes on Linux; otherwise, no) -## If yes, the target system must have NPTL (Native POSIX Thread Library). -## Older Linux systems have LinuxThreads instead of NPTL (Linux kernel -## versions typically less than 2.6). -## -erl_xcomp_linux_nptl= - -## -## erl_xcomp_linux_usable_sigusrx - yes|no (defaults to yes) -## If yes, the SIGUSR1 and SIGUSR2 must be usable by the ERTS. Old -## LinuxThreads thread libraries (Linux kernel versions less than 2.2) used -## these signals and made them unusable by the ERTS. -## -erl_xcomp_linux_usable_sigusrx= - -## -## erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to yes) -## If yes, sigaltstack() must be usable on the target system. sigaltstack() -## on Linux kernel versions less than 2.4 are broken. -## -erl_xcomp_linux_usable_sigaltstack= - -## -## erl_xcomp_poll - yes|no (defaults to no on Darwin/MacOSX; otherwise, yes) -## If yes, the target system must have a working poll() implementation that -## also can handle devices. If no, select() will be used instead of poll(). -## -erl_xcomp_poll= - -## -## erl_xcomp_kqueue - yes|no (defaults to no) -## If yes, the target system must have a working kqueue() implementation that -## returns a file descriptor which can be used by poll() and/or select(). -## If no and the target system has not got epoll() or /dev/poll, the -## kernel-poll feature will be disabled. -## -erl_xcomp_kqueue= - -## -## erl_xcomp_putenv_copy - yes|no (defaults to no) -## If yes, the target system must have a putenv() implementation that stores a -## copy of the key/value pair. -## -erl_xcomp_putenv_copy= - -## -## erl_xcomp_reliable_fpe - yes|no (defaults to no) -## If yes, the target system must have reliable floating point exceptions. -## -erl_xcomp_reliable_fpe= - -## -## erl_xcomp_getaddrinfo - yes|no (defaults to no) -## If yes, the target system must have a working getaddrinfo() implementation -## that can handle both IPv4 and IPv6. -## -erl_xcomp_getaddrinfo= - -## -## erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to no) -## If yes, the target system must have a working gethrvtime() implementation -## and is used with procfs ioctl(). -## -erl_xcomp_gethrvtime_procfs_ioctl= - -## -## erl_xcomp_clock_gettime - yes|no (defaults to no) -## If yes, the target system must have a working clock_gettime() -## implementation that can be used for retrieving process CPU time. -## -erl_xcomp_clock_gettime= - -## -## erl_xcomp_after_morecore_hook - yes|no (defaults to no) -## If yes, the target system must have a working __after_morecore_hook that -## can be used for tracking used malloc() implementations core memory usage. -## -erl_xcomp_after_morecore_hook= - -## -## erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to no) -## If yes, the target system must have a working dlsym(RTLD_NEXT, <S>) -## implementation that can be used on 'brk' and 'sbrk' symbols used by the -## malloc() implementation in use, and by this track the malloc() -## implementations core memory usage. -## -erl_xcomp_dlsym_brk_wrappers= - -### ---------------------------------------------------------------------------- +## erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to `yes' on +## Linux; otherwise, `no') +## If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on the target system must +## work. This variable is recommended to be set to `no' on Linux systems +## with kernel versions less than 2.6. +#erl_xcomp_linux_clock_gettime_correction= + +## erl_xcomp_linux_nptl - yes|no (defaults to `yes' on Linux; otherwise, `no') +## If `yes', the target system must have NPTL (Native POSIX Thread Library). +## Older Linux systems have LinuxThreads instead of NPTL (Linux kernel +## versions typically less than 2.6). +#erl_xcomp_linux_nptl= + +## erl_xcomp_linux_usable_sigusrx - yes|no (defaults to `yes') +## If `yes', the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. +## Old LinuxThreads thread libraries (Linux kernel versions less than 2.2) +## used these signals and made them unusable by the ERTS. +#erl_xcomp_linux_usable_sigusrx= + +## erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to `yes' on Linux; +## otherwise, `no') +## If `yes', `sigaltstack()' must be usable on the target system. +## `sigaltstack()' on Linux kernel versions less than 2.4 are broken. +#erl_xcomp_linux_usable_sigaltstack= + +## erl_xcomp_poll - yes|no (defaults to `no' on Darwin/MacOSX; otherwise, `yes') +## If `yes', the target system must have a working `poll()' implementation +## that also can handle devices. If `no', `select()' will be used instead of +## `poll()'. +#erl_xcomp_poll= + +## erl_xcomp_kqueue - yes|no (defaults to `no') +## If `yes', the target system must have a working `kqueue()' implementation +## that returns a file descriptor which can be used by `poll()' and/or +## `select()'. If `no' and the target system has not got `epoll()' or +## `/dev/poll', the kernel-poll feature will be disabled. +#erl_xcomp_kqueue= + +## erl_xcomp_putenv_copy - yes|no (defaults to `no') +## If `yes', the target system must have a `putenv()' implementation that +## stores a copy of the key/value pair. +#erl_xcomp_putenv_copy= + +## erl_xcomp_reliable_fpe - yes|no (defaults to `no') +## If `yes', the target system must have reliable floating point exceptions. +#erl_xcomp_reliable_fpe= + +## erl_xcomp_getaddrinfo - yes|no (defaults to `no') +## If `yes', the target system must have a working `getaddrinfo()' +## implementation that can handle both IPv4 and IPv6. +#erl_xcomp_getaddrinfo= + +## erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to `no') +## If `yes', the target system must have a working `gethrvtime()' +## implementation and is used with procfs `ioctl()'. +#erl_xcomp_gethrvtime_procfs_ioctl= + +## erl_xcomp_clock_gettime_cpu_time - yes|no (defaults to `no') +## If `yes', the target system must have a working `clock_gettime()' +## implementation that can be used for retrieving process CPU time. +#erl_xcomp_clock_gettime_cpu_time= + +## erl_xcomp_after_morecore_hook - yes|no (defaults to `no') +## If `yes', the target system must have a working `__after_morecore_hook' +## that can be used for tracking used `malloc()' implementations core memory +## usage. +#erl_xcomp_after_morecore_hook= + +## erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to `no') +## If `yes', the target system must have a working `dlsym(RTLD_NEXT, <S>)' +## implementation that can be used on `brk' and `sbrk' symbols used by the +## `malloc()' implementation in use, and by this track the `malloc()' +## implementations core memory usage. +#erl_xcomp_dlsym_brk_wrappers= + +#### -------------------------------------------------------------------------- diff --git a/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf b/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf new file mode 100644 index 0000000000..b6730cff0a --- /dev/null +++ b/xcomp/erl-xcomp-x86_64-saf-linux-gnu.conf @@ -0,0 +1,236 @@ +#### -*-shell-script-*- +#### +#### %CopyrightBegin% +#### +#### Copyright Ericsson AB 2010. All Rights Reserved. +#### +#### The contents of this file are subject to the Erlang Public License, +#### Version 1.1, (the "License"); you may not use this file except in +#### compliance with the License. You should have received a copy of the +#### Erlang Public License along with this software. If not, it can be +#### retrieved online at http://www.erlang.org/. +#### +#### Software distributed under the License is distributed on an "AS IS" +#### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +#### the License for the specific language governing rights and limitations +#### under the License. +#### +#### %CopyrightEnd% +#### +#### File: erl-xcomp-x86_64-saf-linux-gnu.conf +#### Author: Rickard Green +#### +#### -------------------------------------------------------------------------- +#### When cross compiling Erlang/OTP using `otp_build', copy this file and set +#### the variables needed below. Then pass the path to the copy of this file as +#### an argument to `otp_build' in the configure stage: +#### `otp_build configure --xcomp-conf=<FILE>' +#### -------------------------------------------------------------------------- + +### Note that you cannot define arbitrary variables in a cross compilation +### configuration file. Only the ones listed below will be guaranteed to be +### visible throughout the whole execution of all `configure' scripts. Other +### variables needs to be defined as arguments to `configure' or exported in +### the environment. + +### ---- `otp_build' only variables ------------------------------------------- + +### Variables in this section are only used, when configuring Erlang/OTP for +### cross compilation using `$ERL_TOP/otp_build configure'. + +### NOTE! These variables currently have *no* effect if you configure using the +### `configure' script directly. + +## erl_xcomp_build - Build system. +## This value will be passed as `--build=$erl_xcomp_build' argument to the +## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, +## but can be. The full CPU-VENDOR-OS triplet will be created by: +## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build' +## If `erl_xcomp_build=guess', the build system will be guessed using: +## `$ERL_TOP/erts/autoconf/config.guess'. +erl_xcomp_build=guess + +## erl_xcomp_host - Cross host system. +## This value will be passed as `--host=$erl_xcomp_host' argument to the +## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, +## but can be. The full CPU-VENDOR-OS triplet will be created by: +## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host' +erl_xcomp_host=x86_64-saf-linux-gnu + +## erl_xcomp_configure_flags - Extra configure flags. +## Extra flags to pass to the `configure' script. +#erl_xcomp_configure_flags= + +### ---- Cross compiler and other tools to use -------------------------------- + +### If the cross compilation tools are prefixed by `<HOST>-' you probably do +### not need to set these variables (where `<HOST>' is what has been passed as +### `--host=<HOST>' argument to `configure'). + +## CC - C compiler. +CC=x86_64-saf-gcc + +## CFLAGS - C compiler flags. +#CFLAGS= + +## STATIC_CFLAGS - Static C compiler flags. +#STATIC_CFLAGS= + +## CFLAG_RUNTIME_LIBRARY_PATH - C compiler runtime library path flag. +## This flag should set a specific runtime library path for the shared +## library at link time. Note that this is actually a linker flag, but it +## needs to be passed via the compiler. +#CFLAG_RUNTIME_LIBRARY_PATH= + +## CPP - C pre-processor. +#CPP= + +## CPPFLAGS - C pre-processor flags. +#CPPFLAGS= + +## CXX - C++ compiler. +CXX=x86_64-saf-g++ + +## CXXFLAGS - C++ compiler flags. +#CXXFLAGS= + +## LD - Linker +LD=x86_64-saf-ld + +## LDFLAGS - Linker flags. +#LDFLAGS= + +### -- Dynamic Erlang Driver linker flags. -- + +### NOTE! Either define all or non of the DED_LD* variables. + +## DED_LD - Linker. +#DED_LD= + +## DED_LDFLAGS - Linker flags. +#DED_LDFLAGS= + +## DED_LD_FLAG_RUNTIME_LIBRARY_PATH - Linker runtime library path flag. +## This flag should set a specific runtime library path for the shared +## library at link time. +#DED_LD_FLAG_RUNTIME_LIBRARY_PATH= + +### -- Other tools -- + +## RANLIB - ranlib +RANLIB=x86_64-saf-ranlib + +## AR - ar +AR=x86_64-saf-ar + +### ---- Cross System Root Locations ------------------------------------------ + +## erl_xcomp_sysroot - Absolute cross system root path. +## The absolute path to the system root of the cross compilation +## environment. Currently, the `crypto', `odbc', `ssh' and `ssl' +## applications need the system root. These applications will be skipped +## if the system root has not been set. The system root might be needed +## for other things too. If this is the case and the system root has not +## been set, `configure' will fail and request you to set it. +erl_xcomp_sysroot="$SAF_SYSROOT_X86_64" + +## erl_xcomp_isysroot - Absolute cross include system root path. +## The absolute path to the system root for includes of the cross +## compilation environment. If not set, this value defaults to +## `$erl_xcomp_sysroot', i.e., only set this value if the include system +## root path is not the same as the system root path. +#erl_xcomp_isysroot= + +### ---- Optional feature, or bug tests --------------------------------------- + +### 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. + +### The `configure' script will issue a warning when a default value is used. +### When a variable has been set, no warning will be issued. + +## erl_xcomp_bigendian - yes|no +## If `yes', the target system must be big endian. If `no', little endian. +## This can often be automatically detected, but not always. If not +## automatically detected, `configure' will fail unless this variable is +## set. No default value is used, i.e., `configure' will try to figure +## this out automatically. +#erl_xcomp_bigendian= + +## erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to `yes' on +## Linux; otherwise, `no') +## If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on the target system must +## work. This variable is recommended to be set to `no' on Linux systems +## with kernel versions less than 2.6. +#erl_xcomp_linux_clock_gettime_correction= + +## erl_xcomp_linux_nptl - yes|no (defaults to `yes' on Linux; otherwise, `no') +## If `yes', the target system must have NPTL (Native POSIX Thread Library). +## Older Linux systems have LinuxThreads instead of NPTL (Linux kernel +## versions typically less than 2.6). +#erl_xcomp_linux_nptl= + +## erl_xcomp_linux_usable_sigusrx - yes|no (defaults to `yes') +## If `yes', the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. +## Old LinuxThreads thread libraries (Linux kernel versions less than 2.2) +## used these signals and made them unusable by the ERTS. +#erl_xcomp_linux_usable_sigusrx= + +## erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to `yes' on Linux; +## otherwise, `no') +## If `yes', `sigaltstack()' must be usable on the target system. +## `sigaltstack()' on Linux kernel versions less than 2.4 are broken. +#erl_xcomp_linux_usable_sigaltstack= + +## erl_xcomp_poll - yes|no (defaults to `no' on Darwin/MacOSX; otherwise, `yes') +## If `yes', the target system must have a working `poll()' implementation +## that also can handle devices. If `no', `select()' will be used instead of +## `poll()'. +#erl_xcomp_poll= + +## erl_xcomp_kqueue - yes|no (defaults to `no') +## If `yes', the target system must have a working `kqueue()' implementation +## that returns a file descriptor which can be used by `poll()' and/or +## `select()'. If `no' and the target system has not got `epoll()' or +## `/dev/poll', the kernel-poll feature will be disabled. +#erl_xcomp_kqueue= + +## erl_xcomp_putenv_copy - yes|no (defaults to `no') +## If `yes', the target system must have a `putenv()' implementation that +## stores a copy of the key/value pair. +#erl_xcomp_putenv_copy= + +## erl_xcomp_reliable_fpe - yes|no (defaults to `no') +## If `yes', the target system must have reliable floating point exceptions. +#erl_xcomp_reliable_fpe= + +## erl_xcomp_getaddrinfo - yes|no (defaults to `no') +## If `yes', the target system must have a working `getaddrinfo()' +## implementation that can handle both IPv4 and IPv6. +erl_xcomp_getaddrinfo=yes + +## erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to `no') +## If `yes', the target system must have a working `gethrvtime()' +## implementation and is used with procfs `ioctl()'. +#erl_xcomp_gethrvtime_procfs_ioctl= + +## erl_xcomp_clock_gettime_cpu_time - yes|no (defaults to `no') +## If `yes', the target system must have a working `clock_gettime()' +## implementation that can be used for retrieving process CPU time. +#erl_xcomp_clock_gettime_cpu_time= + +## erl_xcomp_after_morecore_hook - yes|no (defaults to `no') +## If `yes', the target system must have a working `__after_morecore_hook' +## that can be used for tracking used `malloc()' implementations core memory +## usage. +erl_xcomp_after_morecore_hook=yes + +## erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to `no') +## If `yes', the target system must have a working `dlsym(RTLD_NEXT, <S>)' +## implementation that can be used on `brk' and `sbrk' symbols used by the +## `malloc()' implementation in use, and by this track the `malloc()' +## implementations core memory usage. +#erl_xcomp_dlsym_brk_wrappers= + +#### -------------------------------------------------------------------------- diff --git a/xcomp/erl-xcomp.conf.template b/xcomp/erl-xcomp.conf.template index bed365e754..9242318577 100644 --- a/xcomp/erl-xcomp.conf.template +++ b/xcomp/erl-xcomp.conf.template @@ -1,198 +1,236 @@ -### -### %CopyrightBegin% -### -### Copyright Ericsson AB 2009. All Rights Reserved. -### -### The contents of this file are subject to the Erlang Public License, -### Version 1.1, (the "License"); you may not use this file except in -### compliance with the License. You should have received a copy of the -### Erlang Public License along with this software. If not, it can be -### retrieved online at http://www.erlang.org/. -### -### Software distributed under the License is distributed on an "AS IS" -### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -### the License for the specific language governing rights and limitations -### under the License. -### -### %CopyrightEnd% -### -### File: erl-xcomp.conf -### Author: Rickard Green -### - -### ---------------------------------------------------------------------------- -### When cross compiling Erlang/OTP, copy this file and set the variables -### needed below. Then pass the path to the copy of this file as an argument -### to "eval `otp_build env_cross <absolute path to erl-xcomp.conf file>`". -### ---------------------------------------------------------------------------- - -### ---------------------------------------------------------------------------- -### Variables in the following section *have* to be set. -### - -## -## Target system. The value will be passed as '--host' argument to the configure -## script. It does not have to be a full CPU-VENDOR-OS tripplet, but can be. The -## full CPU-VENDOR-OS tripplet will be created by: -## $ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host -## -erl_xcomp_host= - -### ---------------------------------------------------------------------------- -### To override the configure flags for a special target system, You -### can set this variable which overrides configure parameters on the -### command line and instead uses the specified options. The variable -### leaves the build-host system untouched. -### ---------------------------------------------------------------------------- -erl_xcomp_configure_flags= - -###----------------------------------------------------------------------------- -### You can specify a specific CC or LD for the build target (the cross -### compiler) here along with magic CFLAGS and/or LDFLAGS if needed -### ar and ranlib might also be specified if needed. -###----------------------------------------------------------------------------- - -erl_xcomp_cc= - -erl_xcomp_ld= - -erl_xcomp_cflags= - -erl_xcomp_cpp= - -erl_xcomp_ldflags= - -erl_xcomp_ranlib= - -erl_xcomp_ar= - -###----------------------------------------------------------------------------- -### The ded_ls and ded_ldflags variables control linking of dynamically loaded -### erlang drivers. On i.e. Linux these are set to -### $(CC) and "-shared" respectively, but other OS'es might need other -### programs and flags to build a dynamic library. -### erl_xcomp_ded_ld_runtime_library_path is the flag to set a -### specific runtime library path for the shared library at link time, -### usually this should be left empty. -###----------------------------------------------------------------------------- - -erl_xcomp_ded_ld= - -erl_xcomp_ded_ldflags= - -erl_xcomp_ded_ld_runtime_library_path= - -### -### Optional feature, or bug tests -### -### 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. -### - -## +#### -*-shell-script-*- +#### +#### %CopyrightBegin% +#### +#### Copyright Ericsson AB 2009-2010. All Rights Reserved. +#### +#### The contents of this file are subject to the Erlang Public License, +#### Version 1.1, (the "License"); you may not use this file except in +#### compliance with the License. You should have received a copy of the +#### Erlang Public License along with this software. If not, it can be +#### retrieved online at http://www.erlang.org/. +#### +#### Software distributed under the License is distributed on an "AS IS" +#### basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +#### the License for the specific language governing rights and limitations +#### under the License. +#### +#### %CopyrightEnd% +#### +#### File: erl-xcomp.conf.template +#### Author: Rickard Green +#### +#### -------------------------------------------------------------------------- +#### When cross compiling Erlang/OTP using `otp_build', copy this file and set +#### the variables needed below. Then pass the path to the copy of this file as +#### an argument to `otp_build' in the configure stage: +#### `otp_build configure --xcomp-conf=<FILE>' +#### -------------------------------------------------------------------------- + +### Note that you cannot define arbitrary variables in a cross compilation +### configuration file. Only the ones listed below will be guaranteed to be +### visible throughout the whole execution of all `configure' scripts. Other +### variables needs to be defined as arguments to `configure' or exported in +### the environment. + +### ---- `otp_build' only variables ------------------------------------------- + +### Variables in this section are only used, when configuring Erlang/OTP for +### cross compilation using `$ERL_TOP/otp_build configure'. + +### NOTE! These variables currently have *no* effect if you configure using the +### `configure' script directly. + +## erl_xcomp_build - Build system. +## This value will be passed as `--build=$erl_xcomp_build' argument to the +## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, +## but can be. The full CPU-VENDOR-OS triplet will be created by: +## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_build' +## If `erl_xcomp_build=guess', the build system will be guessed using: +## `$ERL_TOP/erts/autoconf/config.guess'. +#erl_xcomp_build= + +## erl_xcomp_host - Cross host system. +## This value will be passed as `--host=$erl_xcomp_host' argument to the +## `configure' script. It does not have to be a full CPU-VENDOR-OS triplet, +## but can be. The full CPU-VENDOR-OS triplet will be created by: +## `$ERL_TOP/erts/autoconf/config.sub $erl_xcomp_host' +#erl_xcomp_host= + +## erl_xcomp_configure_flags - Extra configure flags. +## Extra flags to pass to the `configure' script. +#erl_xcomp_configure_flags= + +### ---- Cross compiler and other tools to use -------------------------------- + +### If the cross compilation tools are prefixed by `<HOST>-' you probably do +### not need to set these variables (where `<HOST>' is what has been passed as +### `--host=<HOST>' argument to `configure'). + +## CC - C compiler. +#CC= + +## CFLAGS - C compiler flags. +#CFLAGS= + +## STATIC_CFLAGS - Static C compiler flags. +#STATIC_CFLAGS= + +## CFLAG_RUNTIME_LIBRARY_PATH - C compiler runtime library path flag. +## This flag should set a specific runtime library path for the shared +## library at link time. Note that this is actually a linker flag, but it +## needs to be passed via the compiler. +#CFLAG_RUNTIME_LIBRARY_PATH= + +## CPP - C pre-processor. +#CPP= + +## CPPFLAGS - C pre-processor flags. +#CPPFLAGS= + +## CXX - C++ compiler. +#CXX= + +## CXXFLAGS - C++ compiler flags. +#CXXFLAGS= + +## LD - Linker +#LD= + +## LDFLAGS - Linker flags. +#LDFLAGS= + +### -- Dynamic Erlang Driver linker flags. -- + +### NOTE! Either define all or non of the DED_LD* variables. + +## DED_LD - Linker. +#DED_LD= + +## DED_LDFLAGS - Linker flags. +#DED_LDFLAGS= + +## DED_LD_FLAG_RUNTIME_LIBRARY_PATH - Linker runtime library path flag. +## This flag should set a specific runtime library path for the shared +## library at link time. +#DED_LD_FLAG_RUNTIME_LIBRARY_PATH= + +### -- Other tools -- + +## RANLIB - ranlib +#RANLIB= + +## AR - ar +#AR= + +### ---- Cross System Root Locations ------------------------------------------ + +## erl_xcomp_sysroot - Absolute cross system root path. +## The absolute path to the system root of the cross compilation +## environment. Currently, the `crypto', `odbc', `ssh' and `ssl' +## applications need the system root. These applications will be skipped +## if the system root has not been set. The system root might be needed +## for other things too. If this is the case and the system root has not +## been set, `configure' will fail and request you to set it. +#erl_xcomp_sysroot= + +## erl_xcomp_isysroot - Absolute cross include system root path. +## The absolute path to the system root for includes of the cross +## compilation environment. If not set, this value defaults to +## `$erl_xcomp_sysroot', i.e., only set this value if the include system +## root path is not the same as the system root path. +#erl_xcomp_isysroot= + +### ---- Optional feature, or bug tests --------------------------------------- + +### 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. + +### The `configure' script will issue a warning when a default value is used. +### When a variable has been set, no warning will be issued. + ## erl_xcomp_bigendian - yes|no -## If yes, the target system must be big endian. If no, little endian. This -## can often be automatically detected, but not always. If not automatically -## detected, configure will fail unless this variable is set. No default value -## is used, i.e., configure will try to figure this out automatically. -erl_xcomp_bigendian= - -## -## erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to yes) -## If yes, clock_gettime(CLOCK_MONOTONIC, _) on the target system must work. -## This variable is recommended to be set to no on Linux systems with kernel -## versions less than 2.6. -## -erl_xcomp_linux_clock_gettime_correction= - -## -## erl_xcomp_linux_nptl - yes|no (defaults to yes on Linux; otherwise, no) -## If yes, the target system must have NPTL (Native POSIX Thread Library). -## Older Linux systems have LinuxThreads instead of NPTL (Linux kernel -## versions typically less than 2.6). -## -erl_xcomp_linux_nptl= - -## -## erl_xcomp_linux_usable_sigusrx - yes|no (defaults to yes) -## If yes, the SIGUSR1 and SIGUSR2 must be usable by the ERTS. Old -## LinuxThreads thread libraries (Linux kernel versions less than 2.2) used -## these signals and made them unusable by the ERTS. -## -erl_xcomp_linux_usable_sigusrx= - -## -## erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to yes) -## If yes, sigaltstack() must be usable on the target system. sigaltstack() -## on Linux kernel versions less than 2.4 are broken. -## -erl_xcomp_linux_usable_sigaltstack= - -## -## erl_xcomp_poll - yes|no (defaults to no on Darwin/MacOSX; otherwise, yes) -## If yes, the target system must have a working poll() implementation that -## also can handle devices. If no, select() will be used instead of poll(). -## -erl_xcomp_poll= - -## -## erl_xcomp_kqueue - yes|no (defaults to no) -## If yes, the target system must have a working kqueue() implementation that -## returns a file descriptor which can be used by poll() and/or select(). -## If no and the target system has not got epoll() or /dev/poll, the -## kernel-poll feature will be disabled. -## -erl_xcomp_kqueue= - -## -## erl_xcomp_putenv_copy - yes|no (defaults to no) -## If yes, the target system must have a putenv() implementation that stores a -## copy of the key/value pair. -## -erl_xcomp_putenv_copy= - -## -## erl_xcomp_reliable_fpe - yes|no (defaults to no) -## If yes, the target system must have reliable floating point exceptions. -## -erl_xcomp_reliable_fpe= - -## -## erl_xcomp_getaddrinfo - yes|no (defaults to no) -## If yes, the target system must have a working getaddrinfo() implementation -## that can handle both IPv4 and IPv6. -## -erl_xcomp_getaddrinfo= - -## -## erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to no) -## If yes, the target system must have a working gethrvtime() implementation -## and is used with procfs ioctl(). -## -erl_xcomp_gethrvtime_procfs_ioctl= - -## -## erl_xcomp_clock_gettime - yes|no (defaults to no) -## If yes, the target system must have a working clock_gettime() -## implementation that can be used for retrieving process CPU time. -## -erl_xcomp_clock_gettime= - -## -## erl_xcomp_after_morecore_hook - yes|no (defaults to no) -## If yes, the target system must have a working __after_morecore_hook that -## can be used for tracking used malloc() implementations core memory usage. -## -erl_xcomp_after_morecore_hook= - -## -## erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to no) -## If yes, the target system must have a working dlsym(RTLD_NEXT, <S>) -## implementation that can be used on 'brk' and 'sbrk' symbols used by the -## malloc() implementation in use, and by this track the malloc() -## implementations core memory usage. -## -erl_xcomp_dlsym_brk_wrappers= - -### ---------------------------------------------------------------------------- +## If `yes', the target system must be big endian. If `no', little endian. +## This can often be automatically detected, but not always. If not +## automatically detected, `configure' will fail unless this variable is +## set. No default value is used, i.e., `configure' will try to figure +## this out automatically. +#erl_xcomp_bigendian= + +## erl_xcomp_linux_clock_gettime_correction - yes|no (defaults to `yes' on +## Linux; otherwise, `no') +## If `yes', `clock_gettime(CLOCK_MONOTONIC, _)' on the target system must +## work. This variable is recommended to be set to `no' on Linux systems +## with kernel versions less than 2.6. +#erl_xcomp_linux_clock_gettime_correction= + +## erl_xcomp_linux_nptl - yes|no (defaults to `yes' on Linux; otherwise, `no') +## If `yes', the target system must have NPTL (Native POSIX Thread Library). +## Older Linux systems have LinuxThreads instead of NPTL (Linux kernel +## versions typically less than 2.6). +#erl_xcomp_linux_nptl= + +## erl_xcomp_linux_usable_sigusrx - yes|no (defaults to `yes') +## If `yes', the `SIGUSR1' and `SIGUSR2' signals must be usable by the ERTS. +## Old LinuxThreads thread libraries (Linux kernel versions less than 2.2) +## used these signals and made them unusable by the ERTS. +#erl_xcomp_linux_usable_sigusrx= + +## erl_xcomp_linux_usable_sigaltstack - yes|no (defaults to `yes' on Linux; +## otherwise, `no') +## If `yes', `sigaltstack()' must be usable on the target system. +## `sigaltstack()' on Linux kernel versions less than 2.4 are broken. +#erl_xcomp_linux_usable_sigaltstack= + +## erl_xcomp_poll - yes|no (defaults to `no' on Darwin/MacOSX; otherwise, `yes') +## If `yes', the target system must have a working `poll()' implementation +## that also can handle devices. If `no', `select()' will be used instead of +## `poll()'. +#erl_xcomp_poll= + +## erl_xcomp_kqueue - yes|no (defaults to `no') +## If `yes', the target system must have a working `kqueue()' implementation +## that returns a file descriptor which can be used by `poll()' and/or +## `select()'. If `no' and the target system has not got `epoll()' or +## `/dev/poll', the kernel-poll feature will be disabled. +#erl_xcomp_kqueue= + +## erl_xcomp_putenv_copy - yes|no (defaults to `no') +## If `yes', the target system must have a `putenv()' implementation that +## stores a copy of the key/value pair. +#erl_xcomp_putenv_copy= + +## erl_xcomp_reliable_fpe - yes|no (defaults to `no') +## If `yes', the target system must have reliable floating point exceptions. +#erl_xcomp_reliable_fpe= + +## erl_xcomp_getaddrinfo - yes|no (defaults to `no') +## If `yes', the target system must have a working `getaddrinfo()' +## implementation that can handle both IPv4 and IPv6. +#erl_xcomp_getaddrinfo= + +## erl_xcomp_gethrvtime_procfs_ioctl - yes|no (defaults to `no') +## If `yes', the target system must have a working `gethrvtime()' +## implementation and is used with procfs `ioctl()'. +#erl_xcomp_gethrvtime_procfs_ioctl= + +## erl_xcomp_clock_gettime_cpu_time - yes|no (defaults to `no') +## If `yes', the target system must have a working `clock_gettime()' +## implementation that can be used for retrieving process CPU time. +#erl_xcomp_clock_gettime_cpu_time= + +## erl_xcomp_after_morecore_hook - yes|no (defaults to `no') +## If `yes', the target system must have a working `__after_morecore_hook' +## that can be used for tracking used `malloc()' implementations core memory +## usage. +#erl_xcomp_after_morecore_hook= + +## erl_xcomp_dlsym_brk_wrappers - yes|no (defaults to `no') +## If `yes', the target system must have a working `dlsym(RTLD_NEXT, <S>)' +## implementation that can be used on `brk' and `sbrk' symbols used by the +## `malloc()' implementation in use, and by this track the `malloc()' +## implementations core memory usage. +#erl_xcomp_dlsym_brk_wrappers= + +#### -------------------------------------------------------------------------- |