FFI-Raw

 view release on metacpan or  search on metacpan

deps/libffi/testsuite/lib/target-libpath.exp  view on Meta::CPAN

# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.

# This file was contributed by John David Anglin (dave.anglin@nrc-cnrc.gc.ca)

set orig_environment_saved 0
set orig_ld_library_path_saved 0
set orig_ld_run_path_saved 0
set orig_shlib_path_saved 0
set orig_ld_libraryn32_path_saved 0
set orig_ld_library64_path_saved 0
set orig_ld_library_path_32_saved 0
set orig_ld_library_path_64_saved 0
set orig_dyld_library_path_saved 0
set orig_path_saved 0

#######################################
# proc set_ld_library_path_env_vars { }
#######################################

proc set_ld_library_path_env_vars { } {
  global ld_library_path
  global orig_environment_saved
  global orig_ld_library_path_saved
  global orig_ld_run_path_saved
  global orig_shlib_path_saved
  global orig_ld_libraryn32_path_saved
  global orig_ld_library64_path_saved
  global orig_ld_library_path_32_saved
  global orig_ld_library_path_64_saved
  global orig_dyld_library_path_saved
  global orig_path_saved
  global orig_ld_library_path
  global orig_ld_run_path
  global orig_shlib_path
  global orig_ld_libraryn32_path
  global orig_ld_library64_path
  global orig_ld_library_path_32
  global orig_ld_library_path_64
  global orig_dyld_library_path
  global orig_path
  global GCC_EXEC_PREFIX

  # Set the relocated compiler prefix, but only if the user hasn't specified one.
  if { [info exists GCC_EXEC_PREFIX] && ![info exists env(GCC_EXEC_PREFIX)] } {
    setenv GCC_EXEC_PREFIX "$GCC_EXEC_PREFIX"
  }

  # Setting the ld library path causes trouble when testing cross-compilers.
  if { [is_remote target] } {
    return
  }

  if { $orig_environment_saved == 0 } {
    global env

    set orig_environment_saved 1

    # Save the original environment.
    if [info exists env(LD_LIBRARY_PATH)] {
      set orig_ld_library_path "$env(LD_LIBRARY_PATH)"
      set orig_ld_library_path_saved 1
    }
    if [info exists env(LD_RUN_PATH)] {
      set orig_ld_run_path "$env(LD_RUN_PATH)"
      set orig_ld_run_path_saved 1
    }
    if [info exists env(SHLIB_PATH)] {
      set orig_shlib_path "$env(SHLIB_PATH)"
      set orig_shlib_path_saved 1
    }
    if [info exists env(LD_LIBRARYN32_PATH)] {
      set orig_ld_libraryn32_path "$env(LD_LIBRARYN32_PATH)"
      set orig_ld_libraryn32_path_saved 1
    }
    if [info exists env(LD_LIBRARY64_PATH)] {
      set orig_ld_library64_path "$env(LD_LIBRARY64_PATH)"
      set orig_ld_library64_path_saved 1
    }
    if [info exists env(LD_LIBRARY_PATH_32)] {
      set orig_ld_library_path_32 "$env(LD_LIBRARY_PATH_32)"
      set orig_ld_library_path_32_saved 1
    }
    if [info exists env(LD_LIBRARY_PATH_64)] {
      set orig_ld_library_path_64 "$env(LD_LIBRARY_PATH_64)"
      set orig_ld_library_path_64_saved 1
    }
    if [info exists env(DYLD_LIBRARY_PATH)] {
      set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)"
      set orig_dyld_library_path_saved 1
    }
    if [info exists env(PATH)] {
      set orig_path "$env(PATH)"
      set orig_path_saved 1
    }
  }

  # We need to set ld library path in the environment.  Currently,
  # unix.exp doesn't set the environment correctly for all systems.
  # It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a
  # program.  We also need the environment set for compilations, etc.
  #
  # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
  # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH



( run in 1.219 second using v1.01-cache-2.11-cpan-71847e10f99 )