complibs: disable building shared libs
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Apr 06 22:30:57 2011 +0200 (2011-04-06)
changeset 23810ca0f85a4b2a
parent 2380 40fe96dff39e
child 2382 cbd07f3dd6e3
complibs: disable building shared libs

Managing the shared version of the companion libraries
has become cumbersome.

Also, it will one day be possible to use the companion
libraries from the host distribution, and then we will
be able to easily use either shared or static libs.

As a side note, while working on the canadian-rework
series, it has become quite more complex to properly
handle shared companion libraries, as they need to be
built both for the build and gost systems. That's not
easy to handle. At all.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/companion_libs.in
scripts/build/companion_libs/cloog.sh
scripts/build/companion_libs/gmp.sh
scripts/build/companion_libs/libelf.sh
scripts/build/companion_libs/mpc.sh
scripts/build/companion_libs/mpfr.sh
scripts/build/companion_libs/ppl.sh
scripts/build/internals.sh
scripts/crosstool-NG.sh.in
scripts/functions
scripts/wrapper.c
scripts/wrapper.in
     1.1 --- a/config/companion_libs.in	Wed Apr 06 21:34:22 2011 +0200
     1.2 +++ b/config/companion_libs.in	Wed Apr 06 22:30:57 2011 +0200
     1.3 @@ -48,10 +48,6 @@
     1.4      bool
     1.5      default n
     1.6  
     1.7 -config WRAPPER_NEEDED
     1.8 -    bool
     1.9 -    default n
    1.10 -
    1.11  config GMP
    1.12      bool
    1.13      select COMPLIBS
    1.14 @@ -113,11 +109,6 @@
    1.15  
    1.16  comment "Companion libraries common options"
    1.17  
    1.18 -config COMPLIBS_BACKUP
    1.19 -    bool
    1.20 -    default y
    1.21 -    depends on ! COMPLIBS_SHARED
    1.22 -
    1.23  config COMPLIBS_CHECK
    1.24      bool
    1.25      prompt "Check the companion libraries builds (!!! READ HELP!!!)"
    1.26 @@ -136,52 +127,6 @@
    1.27        building PPL on my machine takes roughly 1'40", while checking it takes
    1.28        about 1h40'...
    1.29  
    1.30 -config COMPLIBS_SHARED
    1.31 -    bool
    1.32 -    prompt "Build shared companion libraries"
    1.33 -    default n
    1.34 -    depends on COMPLIBS
    1.35 -    depends on ! STATIC_TOOLCHAIN
    1.36 -    select WRAPPER_NEEDED
    1.37 -    help
    1.38 -      By default, the companion libraries will be build static. If you want to
    1.39 -      build shared libraries, then you can say 'Y' here, but a wrapper will be
    1.40 -      needed (see: "docs/4 - Building the toolchain.txt", in the section
    1.41 -      "Tools wrapper").
    1.42 -      
    1.43 -      It is highly recommended that you keep static libraries.
    1.44 -
    1.45 -choice
    1.46 -    bool
    1.47 -    prompt "|  Install tools wrapper as:"
    1.48 -    depends on WRAPPER_NEEDED
    1.49 -    default TOOLS_WRAPPER_SHELL
    1.50 -
    1.51 -config TOOLS_WRAPPER_SCRIPT
    1.52 -    bool
    1.53 -    prompt "shell script"
    1.54 -    help
    1.55 -      If your host has a shell, then you should say 'Y' here, to use
    1.56 -      a (very very simple) shell script as wrapper.
    1.57 -      
    1.58 -      See: "docs/4 - Building the toolchain.txt", in the section "Tools wrapper".
    1.59 -
    1.60 -config TOOLS_WRAPPER_EXEC
    1.61 -    bool
    1.62 -    prompt "executable"
    1.63 -    help
    1.64 -      If your host lacks a shell, then you should say 'Y' here, to use
    1.65 -      an executable.
    1.66 -      
    1.67 -      See: "docs/4 - Building the toolchain.txt", in the section "Tools wrapper".
    1.68 -
    1.69 -endchoice
    1.70 -
    1.71 -config TOOLS_WRAPPER
    1.72 -    string
    1.73 -    default "script" if TOOLS_WRAPPER_SCRIPT
    1.74 -    default "exec"   if TOOLS_WRAPPER_EXEC
    1.75 -
    1.76  endif # COMPLIBS
    1.77  
    1.78  endmenu
     2.1 --- a/scripts/build/companion_libs/cloog.sh	Wed Apr 06 21:34:22 2011 +0200
     2.2 +++ b/scripts/build/companion_libs/cloog.sh	Wed Apr 06 22:30:57 2011 +0200
     2.3 @@ -37,8 +37,6 @@
     2.4  
     2.5  do_cloog() {
     2.6      local _t
     2.7 -    local cloog_LDFLAGS
     2.8 -    local -a cloog_opts
     2.9  
    2.10      # Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
    2.11      # while versions 0.15.4 onward do have the version in the dirname.
    2.12 @@ -54,17 +52,9 @@
    2.13  
    2.14      CT_DoLog EXTRA "Configuring CLooG/ppl"
    2.15  
    2.16 -    if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
    2.17 -        cloog_opts+=( --enable-shared --disable-static )
    2.18 -    else
    2.19 -        cloog_opts+=( --disable-shared --enable-static )
    2.20 -        cloog_opts+=( --with-host-libstdcxx='-lstdc++' )
    2.21 -        cloog_LDFLAGS='-lm'
    2.22 -    fi
    2.23 -
    2.24      CT_DoExecLog CFG                            \
    2.25      CFLAGS="${CT_CFLAGS_FOR_HOST}"              \
    2.26 -    LDFLAGS="${cloog_LDFLAGS}"                  \
    2.27 +    LDFLAGS="-lm"                               \
    2.28      "${CT_SRC_DIR}/cloog-ppl${_t}/configure"    \
    2.29          --build=${CT_BUILD}                     \
    2.30          --host=${CT_HOST}                       \
    2.31 @@ -72,7 +62,9 @@
    2.32          --with-gmp="${CT_COMPLIBS_DIR}"         \
    2.33          --with-ppl="${CT_COMPLIBS_DIR}"         \
    2.34          --with-bits=gmp                         \
    2.35 -        "${cloog_opts[@]}"
    2.36 +        --with-host-libstdcxx='-lstdc++'        \
    2.37 +        --disable-shared                        \
    2.38 +        --enable-static
    2.39  
    2.40      CT_DoLog EXTRA "Building CLooG/ppl"
    2.41      CT_DoExecLog ALL make ${JOBSFLAGS} libcloog.la
     3.1 --- a/scripts/build/companion_libs/gmp.sh	Wed Apr 06 21:34:22 2011 +0200
     3.2 +++ b/scripts/build/companion_libs/gmp.sh	Wed Apr 06 22:30:57 2011 +0200
     3.3 @@ -21,8 +21,6 @@
     3.4  }
     3.5  
     3.6  do_gmp() {
     3.7 -    local -a gmp_opts
     3.8 -
     3.9      mkdir -p "${CT_BUILD_DIR}/build-gmp"
    3.10      cd "${CT_BUILD_DIR}/build-gmp"
    3.11  
    3.12 @@ -30,12 +28,6 @@
    3.13  
    3.14      CT_DoLog EXTRA "Configuring GMP"
    3.15  
    3.16 -    if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
    3.17 -        gmp_opts+=( --enable-shared --disable-static )
    3.18 -    else
    3.19 -        gmp_opts+=( --disable-shared --enable-static )
    3.20 -    fi
    3.21 -
    3.22      CT_DoExecLog CFG                                \
    3.23      CFLAGS="${CT_CFLAGS_FOR_HOST} -fexceptions"     \
    3.24      "${CT_SRC_DIR}/gmp-${CT_GMP_VERSION}/configure" \
    3.25 @@ -45,7 +37,8 @@
    3.26          --enable-fft                                \
    3.27          --enable-mpbsd                              \
    3.28          --enable-cxx                                \
    3.29 -        "${gmp_opts[@]}"
    3.30 +        --disable-shared                            \
    3.31 +        --enable-static
    3.32  
    3.33      CT_DoLog EXTRA "Building GMP"
    3.34      CT_DoExecLog ALL make ${JOBSFLAGS}
     4.1 --- a/scripts/build/companion_libs/libelf.sh	Wed Apr 06 21:34:22 2011 +0200
     4.2 +++ b/scripts/build/companion_libs/libelf.sh	Wed Apr 06 22:30:57 2011 +0200
     4.3 @@ -22,20 +22,12 @@
     4.4  if [ "${CT_LIBELF}" = "y" ]; then
     4.5  
     4.6  do_libelf() {
     4.7 -    local -a libelf_opts
     4.8 -
     4.9      CT_DoStep INFO "Installing libelf"
    4.10      mkdir -p "${CT_BUILD_DIR}/build-libelf"
    4.11      CT_Pushd "${CT_BUILD_DIR}/build-libelf"
    4.12  
    4.13      CT_DoLog EXTRA "Configuring libelf"
    4.14  
    4.15 -    if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
    4.16 -        libelf_opts+=( --enable-shared --disable-static )
    4.17 -    else
    4.18 -        libelf_opts+=( --disable-shared --enable-static )
    4.19 -    fi
    4.20 -
    4.21      CT_DoExecLog CFG                                        \
    4.22      CC="${CT_HOST}-gcc"                                     \
    4.23      CFLAGS="-fPIC"                                          \
    4.24 @@ -47,7 +39,8 @@
    4.25          --enable-compat                                     \
    4.26          --enable-elf64                                      \
    4.27          --enable-extended-format                            \
    4.28 -        "${libelf_opts[@]}"
    4.29 +        --disable-shared                                    \
    4.30 +        --enable-static
    4.31  
    4.32      CT_DoLog EXTRA "Building libelf"
    4.33      CT_DoExecLog ALL make
     5.1 --- a/scripts/build/companion_libs/mpc.sh	Wed Apr 06 21:34:22 2011 +0200
     5.2 +++ b/scripts/build/companion_libs/mpc.sh	Wed Apr 06 22:30:57 2011 +0200
     5.3 @@ -22,8 +22,6 @@
     5.4  }
     5.5  
     5.6  do_mpc() {
     5.7 -    local -a mpc_opts
     5.8 -
     5.9      mkdir -p "${CT_BUILD_DIR}/build-mpc"
    5.10      cd "${CT_BUILD_DIR}/build-mpc"
    5.11  
    5.12 @@ -31,12 +29,6 @@
    5.13  
    5.14      CT_DoLog EXTRA "Configuring MPC"
    5.15  
    5.16 -    if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
    5.17 -        mpc_opts+=( --enable-shared --disable-static )
    5.18 -    else
    5.19 -        mpc_opts+=( --disable-shared --enable-static )
    5.20 -    fi
    5.21 -
    5.22      CT_DoExecLog CFG                                \
    5.23      CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
    5.24      "${CT_SRC_DIR}/mpc-${CT_MPC_VERSION}/configure" \
    5.25 @@ -45,7 +37,8 @@
    5.26          --prefix="${CT_COMPLIBS_DIR}"               \
    5.27          --with-gmp="${CT_COMPLIBS_DIR}"             \
    5.28          --with-mpfr="${CT_COMPLIBS_DIR}"            \
    5.29 -        "${mpc_opts[@]}"
    5.30 +        --disable-shared                            \
    5.31 +        --enable-static
    5.32  
    5.33      CT_DoLog EXTRA "Building MPC"
    5.34      CT_DoExecLog ALL make ${JOBSFLAGS}
     6.1 --- a/scripts/build/companion_libs/mpfr.sh	Wed Apr 06 21:34:22 2011 +0200
     6.2 +++ b/scripts/build/companion_libs/mpfr.sh	Wed Apr 06 22:30:57 2011 +0200
     6.3 @@ -64,8 +64,6 @@
     6.4  }
     6.5  
     6.6  do_mpfr() {
     6.7 -    local -a mpfr_opts
     6.8 -
     6.9      mkdir -p "${CT_BUILD_DIR}/build-mpfr"
    6.10      cd "${CT_BUILD_DIR}/build-mpfr"
    6.11  
    6.12 @@ -79,11 +77,6 @@
    6.13          *)          mpfr_opts+=( --enable-thread-safe  );;
    6.14      esac
    6.15  
    6.16 -    if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
    6.17 -        mpfr_opts+=( --enable-shared --disable-static )
    6.18 -    else
    6.19 -        mpfr_opts+=( --disable-shared --enable-static )
    6.20 -    fi
    6.21  
    6.22      CT_DoLog EXTRA "Configuring MPFR"
    6.23      CT_DoExecLog CFG                                    \
    6.24 @@ -94,7 +87,8 @@
    6.25          --host=${CT_HOST}                               \
    6.26          --prefix="${CT_COMPLIBS_DIR}"                   \
    6.27          --with-gmp="${CT_COMPLIBS_DIR}"                 \
    6.28 -        "${mpfr_opts[@]}"
    6.29 +        --disable-shared                                \
    6.30 +        --enable-static
    6.31  
    6.32      CT_DoLog EXTRA "Building MPFR"
    6.33      CT_DoExecLog ALL make ${JOBSFLAGS}
     7.1 --- a/scripts/build/companion_libs/ppl.sh	Wed Apr 06 21:34:22 2011 +0200
     7.2 +++ b/scripts/build/companion_libs/ppl.sh	Wed Apr 06 22:30:57 2011 +0200
     7.3 @@ -24,8 +24,6 @@
     7.4  }
     7.5  
     7.6  do_ppl() {
     7.7 -    local -a ppl_opts
     7.8 -
     7.9      mkdir -p "${CT_BUILD_DIR}/build-ppl"
    7.10      cd "${CT_BUILD_DIR}/build-ppl"
    7.11  
    7.12 @@ -33,11 +31,6 @@
    7.13  
    7.14      CT_DoLog EXTRA "Configuring PPL"
    7.15  
    7.16 -    if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
    7.17 -        ppl_opts+=( --enable-shared --disable-static )
    7.18 -    else
    7.19 -        ppl_opts+=( --disable-shared --enable-static )
    7.20 -    fi
    7.21  
    7.22      CT_DoExecLog CFG                                \
    7.23      CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
    7.24 @@ -54,7 +47,8 @@
    7.25          --disable-assertions                        \
    7.26          --disable-ppl_lcdd                          \
    7.27          --disable-ppl_lpsol                         \
    7.28 -        "${ppl_opts[@]}"
    7.29 +        --disable-shared                            \
    7.30 +        --enable-static
    7.31  
    7.32      # Maybe-options:
    7.33      # --enable-interfaces=...
     8.1 --- a/scripts/build/internals.sh	Wed Apr 06 21:34:22 2011 +0200
     8.2 +++ b/scripts/build/internals.sh	Wed Apr 06 22:30:57 2011 +0200
     8.3 @@ -87,56 +87,6 @@
     8.4      done
     8.5      CT_Popd
     8.6  
     8.7 -    # If using the companion libraries, we need a wrapper
     8.8 -    # that will set LD_LIBRARY_PATH approriately
     8.9 -    if [ "${CT_WRAPPER_NEEDED}" = "y" ]; then
    8.10 -        CT_DoLog EXTRA "Installing toolchain wrappers"
    8.11 -        CT_Pushd "${CT_PREFIX_DIR}/bin"
    8.12 -
    8.13 -        case "$CT_SYS_OS" in
    8.14 -            Darwin|FreeBSD)
    8.15 -                # wrapper does not work (when using readlink -m)
    8.16 -                CT_DoLog WARN "Forcing usage of binary tool wrapper"
    8.17 -                CT_TOOLS_WRAPPER="exec"
    8.18 -                ;;
    8.19 -        esac
    8.20 -        # Install the wrapper
    8.21 -        case "${CT_TOOLS_WRAPPER}" in
    8.22 -            script)
    8.23 -                CT_DoExecLog DEBUG install                              \
    8.24 -                                   -m 0755                              \
    8.25 -                                   "${CT_LIB_DIR}/scripts/wrapper.in"   \
    8.26 -                                   ".${CT_TARGET}-wrapper"
    8.27 -                ;;
    8.28 -            exec)
    8.29 -                CT_DoExecLog DEBUG "${CT_HOST}-gcc"                           \
    8.30 -                                   -Wall -Wextra -Werror                      \
    8.31 -                                   -Os                                        \
    8.32 -                                   "${CT_LIB_DIR}/scripts/wrapper.c"          \
    8.33 -                                   -o ".${CT_TARGET}-wrapper"
    8.34 -                if [ "${CT_DEBUG_CT}" != "y" ]; then
    8.35 -                    # If not debugging crosstool-NG, strip the wrapper
    8.36 -                    CT_DoExecLog DEBUG "${CT_HOST}-strip" ".${CT_TARGET}-wrapper"
    8.37 -                fi
    8.38 -                ;;
    8.39 -        esac
    8.40 -
    8.41 -        # Replace every tools with the wrapper
    8.42 -        # Do it unconditionally, even for those tools that happen to be shell
    8.43 -        # scripts, we don't know if they would in the end spawn a binary...
    8.44 -        # Just skip symlinks
    8.45 -        for _t in "${CT_TARGET}-"*; do
    8.46 -            if [ ! -L "${_t}" ]; then
    8.47 -                CT_DoExecLog ALL mv "${_t}" ".${_t}"
    8.48 -                CT_DoExecLog ALL ln ".${CT_TARGET}-wrapper" "${_t}"
    8.49 -            fi
    8.50 -        done
    8.51 -
    8.52 -        # Get rid of the wrapper, we're using hardlinks
    8.53 -        CT_DoExecLog DEBUG rm -f ".${CT_TARGET}-wrapper"
    8.54 -        CT_Popd
    8.55 -    fi
    8.56 -
    8.57      CT_DoLog EXTRA "Removing access to the build system tools"
    8.58      CT_DoExecLog DEBUG rm -rf "${CT_PREFIX_DIR}/buildtools"
    8.59  
     9.1 --- a/scripts/crosstool-NG.sh.in	Wed Apr 06 21:34:22 2011 +0200
     9.2 +++ b/scripts/crosstool-NG.sh.in	Wed Apr 06 22:30:57 2011 +0200
     9.3 @@ -158,14 +158,7 @@
     9.4  CT_BUILDTOOLS_PREFIX_DIR="${CT_WORK_DIR}/${CT_TARGET}/buildtools"
     9.5  CT_STATE_DIR="${CT_WORK_DIR}/${CT_TARGET}/state"
     9.6  CT_CONFIG_DIR="${CT_BUILD_DIR}/configs"
     9.7 -if [ "${CT_COMPLIBS_SHARED}" = "y" ]; then
     9.8 -    CT_COMPLIBS_DIR="${CT_PREFIX_DIR}"
     9.9 -    # Set LD_LIBRARY_PATH to point to prefix/lib so we can find our own
    9.10 -    # libraries; add as first path, so we get hit first by the dynamic linker
    9.11 -    CT_SetLibPath "${CT_COMPLIBS_DIR}/lib" first
    9.12 -else
    9.13 -    CT_COMPLIBS_DIR="${CT_BUILD_DIR}/static"
    9.14 -fi
    9.15 +CT_COMPLIBS_DIR="${CT_BUILD_DIR}/static"
    9.16  
    9.17  # Compute test suite install directory
    9.18  CT_TEST_SUITE_DIR=${CT_INSTALL_DIR}/test-suite
    10.1 --- a/scripts/functions	Wed Apr 06 21:34:22 2011 +0200
    10.2 +++ b/scripts/functions	Wed Apr 06 22:30:57 2011 +0200
    10.3 @@ -1030,9 +1030,6 @@
    10.4                             /^(UID|EUID)=/d;
    10.5                             /^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh"
    10.6  
    10.7 -    if [ "${CT_COMPLIBS_BACKUP}" = "y" ]; then
    10.8 -        CT_DoTarballIfExists "${CT_COMPLIBS_DIR}" "${state_dir}/complibs_dir"
    10.9 -    fi
   10.10      CT_DoTarballIfExists "${CT_BUILDTOOLS_PREFIX_DIR}" "${state_dir}/buildtools_dir"
   10.11      CT_DoTarballIfExists "${CT_CONFIG_DIR}" "${state_dir}/config_dir"
   10.12      CT_DoTarballIfExists "${CT_CC_CORE_STATIC_PREFIX_DIR}" "${state_dir}/cc_core_static_prefix_dir"
   10.13 @@ -1071,9 +1068,6 @@
   10.14      CT_DoExtractTarballIfExists "${state_dir}/cc_core_static_prefix_dir" "${CT_CC_CORE_STATIC_PREFIX_DIR}"
   10.15      CT_DoExtractTarballIfExists "${state_dir}/config_dir" "${CT_CONFIG_DIR}"
   10.16      CT_DoExtractTarballIfExists "${state_dir}/buildtools_dir" "${CT_BUILDTOOLS_PREFIX_DIR}"
   10.17 -    if [ "${CT_COMPLIBS_BACKUP}" = "y" ]; then
   10.18 -        CT_DoExtractTarballIfExists "${state_dir}/complibs_dir" "${CT_COMPLIBS_DIR}"
   10.19 -    fi
   10.20  
   10.21      # Restore the environment, discarding any error message
   10.22      # (for example, read-only bash internals)
    11.1 --- a/scripts/wrapper.c	Wed Apr 06 21:34:22 2011 +0200
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,136 +0,0 @@
    11.4 -#include <limits.h>
    11.5 -#include <stdlib.h>
    11.6 -#include <stdio.h>
    11.7 -#include <string.h>
    11.8 -#include <sys/types.h>
    11.9 -#include <sys/stat.h>
   11.10 -#include <unistd.h>
   11.11 -#include <errno.h>
   11.12 -
   11.13 -#ifdef	__APPLE__
   11.14 -#define LDLP "DYLD_LIBRARY_PATH"
   11.15 -#else
   11.16 -#define LDLP "LD_LIBRARY_PATH"
   11.17 -#endif
   11.18 -
   11.19 -/* Needed for execve */
   11.20 -extern char **environ;
   11.21 -
   11.22 -int main( int argc,
   11.23 -          char** argv )
   11.24 -{
   11.25 -  char *fullname;   /* 'fullname' is used to store the absolute path to the
   11.26 -                       tool being executed; it serves as a base to compute
   11.27 -                       the realname of that tool, and the directory holding
   11.28 -                       our runtime libraries */
   11.29 -  char *realname;   /* 'realname' is the real name of the tool, that is what
   11.30 -                       the wrapper is currently impersonating */
   11.31 -  char *basedir;    /* 'libdir' contains our runtime libraries */
   11.32 -
   11.33 -  char *lastslash;  /* Temporary variables now */
   11.34 -  char *ldlibpath;
   11.35 -  size_t len;
   11.36 -  int execve_ret;
   11.37 -
   11.38 -  /* Avoid the warning-treated-as-error: "error: unused parameter 'argc'" */
   11.39 -  len = argc;
   11.40 -
   11.41 -  /* In case we have a relative or absolute pathname (ie. contains a slash),
   11.42 -   * then realpath wll work. But if the tool was found in the PATH, realpath
   11.43 -   * won't work, and we'll have to search ourselves.
   11.44 -   * This if{}else{} block allocates memory for fullname. */
   11.45 -  if( strchr( argv[0], '/' ) ) {
   11.46 -    fullname = (char*) malloc( PATH_MAX * sizeof(char) );
   11.47 -    if( ! realpath( argv[0], fullname ) ) {
   11.48 -      perror( "tool wrapper" );
   11.49 -      exit( 1 );
   11.50 -    }
   11.51 -  } else {
   11.52 -    char *path;
   11.53 -    char *mypath;
   11.54 -    char *colon;
   11.55 -    char *testname;
   11.56 -    struct stat st;
   11.57 -
   11.58 -    fullname = NULL;
   11.59 -    colon = mypath = path = strdup( getenv( "PATH" ) );
   11.60 -    while( colon ) {
   11.61 -      colon = strchr( mypath, ':' );
   11.62 -      if( colon ) {
   11.63 -        *colon = '\0';
   11.64 -      }
   11.65 -      testname = strdup( mypath );
   11.66 -      testname = (char*) realloc( testname,   strlen( testname )
   11.67 -                                            + strlen( argv[0] )
   11.68 -                                            + 2 * sizeof(char) );
   11.69 -      memset( testname + strlen( testname ),
   11.70 -              0,
   11.71 -              strlen( argv[0] ) + 2 * sizeof(char) );
   11.72 -      strcat( testname, "/" );
   11.73 -      strcat( testname, argv[0] );
   11.74 -      if( stat( testname, &st ) == 0 ) {
   11.75 -        /* OK, exists. Is it a regular file, or a
   11.76 -         * symlink, which the current user may execute? */
   11.77 -        if( S_ISREG( st.st_mode ) && ! access( testname, X_OK | R_OK ) ) {
   11.78 -          fullname = strdup( testname );
   11.79 -          break;
   11.80 -        }
   11.81 -      }
   11.82 -      free( testname );
   11.83 -      mypath = colon + 1;
   11.84 -    }
   11.85 -    free( path );
   11.86 -    if( ! fullname ) {
   11.87 -      fprintf( stderr, "tool wrapper: %s: command not found\n", argv[0] );
   11.88 -      exit( 1 );
   11.89 -    }
   11.90 -  }
   11.91 -
   11.92 -  /* Duplicate my own name to add the 'dot' to tool name */
   11.93 -  realname = strdup( fullname );
   11.94 -  realname = (char*) realloc( realname, strlen( realname) + 2 * sizeof(char) );
   11.95 -  realname[ strlen( realname ) + 1 ] = '\0';
   11.96 -
   11.97 -  /* Add the dot after the last '/' */
   11.98 -  lastslash = strrchr( realname, '/' );
   11.99 -  memmove( lastslash + 1, lastslash, strlen( lastslash ) );
  11.100 -  *( lastslash + 1 ) = '.';
  11.101 -
  11.102 -  /* Compute the basedir of the tool */
  11.103 -  basedir = strdup( fullname );
  11.104 -  lastslash = strrchr( basedir, '/' );
  11.105 -  *lastslash = '\0';
  11.106 -  lastslash = strrchr( basedir, '/' );
  11.107 -  *lastslash = '\0';
  11.108 -
  11.109 -  /* Append '/lib' */
  11.110 -  len = strlen( basedir );
  11.111 -  basedir = (char*) realloc( basedir, len + 5 );
  11.112 -  *( basedir + len ) = '\0';
  11.113 -  strcat( basedir, "/lib" );
  11.114 -
  11.115 -  /* Now add the directory with our runtime libraries to the
  11.116 -     front of the library search path, LD_LIBRARY_PATH */
  11.117 -  ldlibpath = getenv(LDLP);
  11.118 -  if( ldlibpath ) {
  11.119 -    basedir = (char*) realloc( basedir,   strlen( basedir )
  11.120 -                                        + strlen( ldlibpath )
  11.121 -                                        + 2 * sizeof(char) );
  11.122 -    strcat( basedir, ":" );
  11.123 -    strcat( basedir, ldlibpath );
  11.124 -  }
  11.125 -
  11.126 -  if( setenv( LDLP, basedir, 1 ) ) {
  11.127 -    errno = ENOMEM;
  11.128 -    perror( "tool wrapper" );
  11.129 -    exit( 1 );
  11.130 -  }
  11.131 -
  11.132 -  /* Execute the real tool, now */
  11.133 -  execve_ret = execve( realname, argv, environ );
  11.134 -
  11.135 -  /* In case something went wrong above, print a
  11.136 -     diagnostic message, and exit with error code 1 */
  11.137 -  perror( "tool wrapper" );
  11.138 -  return 1;
  11.139 -}
    12.1 --- a/scripts/wrapper.in	Wed Apr 06 21:34:22 2011 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,20 +0,0 @@
    12.4 -#!/bin/sh
    12.5 -
    12.6 -# this wrapper will not work under BSD systems or others
    12.7 -# not containig the GNU readlink.
    12.8 -# Under those, wrapper.c will forcibly be used
    12.9 -# regardless of the config file setting.
   12.10 -
   12.11 -canonicalizedname=$(readlink -nm "${0}")
   12.12 -dirname="$(dirname "${canonicalizedname}")"
   12.13 -basename="$(basename "${canonicalizedname}")"
   12.14 -
   12.15 -ld_lib_path="$(dirname "${dirname}")/lib"
   12.16 -
   12.17 -case ":${LD_LIBRARY_PATH}:" in
   12.18 -    *":${ld_lib_path}:"*)   ;;
   12.19 -    *)  LD_LIBRARY_PATH="${ld_lib_path}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}";;
   12.20 -esac
   12.21 -
   12.22 -export LD_LIBRARY_PATH
   12.23 -exec "${dirname}/.${basename}" "$@"