diff options
Diffstat (limited to 'erts')
-rw-r--r-- | erts/aclocal.m4 | 498 | ||||
-rwxr-xr-x | erts/autoconf/win32.config.cache | 4 | ||||
-rw-r--r-- | erts/configure.in | 545 | ||||
-rw-r--r-- | erts/etc/common/Makefile.in | 15 | ||||
-rw-r--r-- | erts/etc/unix/Install.src | 57 | ||||
-rw-r--r-- | erts/start_scripts/Makefile | 14 | ||||
-rw-r--r-- | erts/test/Makefile | 21 | ||||
-rw-r--r-- | erts/test/install_SUITE.erl | 727 | ||||
-rwxr-xr-x | erts/test/install_SUITE_data/dirname | 2 |
9 files changed, 1489 insertions, 394 deletions
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 |