1636a995dSmlcreech# Generated from ltmain.m4sh. 2636a995dSmlcreech 3*6acb2cf6Svapier# ltmain.sh (GNU libtool) 2.2.6 4636a995dSmlcreech# Written by Gordon Matzigkeit <[email protected]>, 1996 5636a995dSmlcreech 6636a995dSmlcreech# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. 7636a995dSmlcreech# This is free software; see the source for copying conditions. There is NO 8636a995dSmlcreech# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9636a995dSmlcreech 10636a995dSmlcreech# GNU Libtool is free software; you can redistribute it and/or modify 1171eb93eaSdrh# it under the terms of the GNU General Public License as published by 1271eb93eaSdrh# the Free Software Foundation; either version 2 of the License, or 1371eb93eaSdrh# (at your option) any later version. 1471eb93eaSdrh# 15636a995dSmlcreech# As a special exception to the GNU General Public License, 16636a995dSmlcreech# if you distribute this file as part of a program or library that 17636a995dSmlcreech# is built using GNU Libtool, you may include this file under the 18636a995dSmlcreech# same distribution terms that you use for the rest of that program. 19636a995dSmlcreech# 20636a995dSmlcreech# GNU Libtool is distributed in the hope that it will be useful, but 2171eb93eaSdrh# WITHOUT ANY WARRANTY; without even the implied warranty of 2271eb93eaSdrh# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 2371eb93eaSdrh# General Public License for more details. 2471eb93eaSdrh# 2571eb93eaSdrh# You should have received a copy of the GNU General Public License 26636a995dSmlcreech# along with GNU Libtool; see the file COPYING. If not, a copy 27636a995dSmlcreech# can be downloaded from http://www.gnu.org/licenses/gpl.html, 28636a995dSmlcreech# or obtained by writing to the Free Software Foundation, Inc., 29636a995dSmlcreech# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 3071eb93eaSdrh 31636a995dSmlcreech# Usage: $progname [OPTION]... [MODE-ARG]... 32636a995dSmlcreech# 33636a995dSmlcreech# Provide generalized library-building support services. 34636a995dSmlcreech# 35636a995dSmlcreech# --config show all configuration variables 36636a995dSmlcreech# --debug enable verbose shell tracing 37636a995dSmlcreech# -n, --dry-run display commands without modifying any files 38636a995dSmlcreech# --features display basic configuration information and exit 39636a995dSmlcreech# --mode=MODE use operation mode MODE 40636a995dSmlcreech# --preserve-dup-deps don't remove duplicate dependency libraries 41636a995dSmlcreech# --quiet, --silent don't print informational messages 42636a995dSmlcreech# --tag=TAG use configuration variables from tag TAG 43636a995dSmlcreech# -v, --verbose print informational messages (default) 44636a995dSmlcreech# --version print version information 45636a995dSmlcreech# -h, --help print short or long help message 46636a995dSmlcreech# 47636a995dSmlcreech# MODE must be one of the following: 48636a995dSmlcreech# 49636a995dSmlcreech# clean remove files from the build directory 50636a995dSmlcreech# compile compile a source file into a libtool object 51636a995dSmlcreech# execute automatically set library path, then run a program 52636a995dSmlcreech# finish complete the installation of libtool libraries 53636a995dSmlcreech# install install libraries or executables 54636a995dSmlcreech# link create a library or an executable 55636a995dSmlcreech# uninstall remove libraries from an installed directory 56636a995dSmlcreech# 57636a995dSmlcreech# MODE-ARGS vary depending on the MODE. 58636a995dSmlcreech# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 59636a995dSmlcreech# 60636a995dSmlcreech# When reporting a bug, please describe a test case to reproduce it and 61636a995dSmlcreech# include the following information: 62636a995dSmlcreech# 63636a995dSmlcreech# host-triplet: $host 64636a995dSmlcreech# shell: $SHELL 65636a995dSmlcreech# compiler: $LTCC 66636a995dSmlcreech# compiler flags: $LTCFLAGS 67636a995dSmlcreech# linker: $LD (gnu? $with_gnu_ld) 68*6acb2cf6Svapier# $progname: (GNU libtool) 2.2.6 69636a995dSmlcreech# automake: $automake_version 70636a995dSmlcreech# autoconf: $autoconf_version 71636a995dSmlcreech# 72636a995dSmlcreech# Report bugs to <[email protected]>. 73636a995dSmlcreech 74636a995dSmlcreechPROGRAM=ltmain.sh 75636a995dSmlcreechPACKAGE=libtool 76*6acb2cf6SvapierVERSION=2.2.6 77636a995dSmlcreechTIMESTAMP="" 78*6acb2cf6Svapierpackage_revision=1.3012 79636a995dSmlcreech 80636a995dSmlcreech# Be Bourne compatible 81636a995dSmlcreechif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 82636a995dSmlcreech emulate sh 83636a995dSmlcreech NULLCMD=: 84636a995dSmlcreech # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 85636a995dSmlcreech # is contrary to our usage. Disable this feature. 86636a995dSmlcreech alias -g '${1+"$@"}'='"$@"' 87636a995dSmlcreech setopt NO_GLOB_SUBST 88636a995dSmlcreechelse 89636a995dSmlcreech case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 90636a995dSmlcreechfi 91636a995dSmlcreechBIN_SH=xpg4; export BIN_SH # for Tru64 92636a995dSmlcreechDUALCASE=1; export DUALCASE # for MKS sh 93636a995dSmlcreech 94636a995dSmlcreech# NLS nuisances: We save the old values to restore during execute mode. 95636a995dSmlcreech# Only set LANG and LC_ALL to C if already set. 96636a995dSmlcreech# These must not be set unconditionally because not all systems understand 97636a995dSmlcreech# e.g. LANG=C (notably SCO). 98636a995dSmlcreechlt_user_locale= 99636a995dSmlcreechlt_safe_locale= 100636a995dSmlcreechfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 101636a995dSmlcreechdo 102636a995dSmlcreech eval "if test \"\${$lt_var+set}\" = set; then 103636a995dSmlcreech save_$lt_var=\$$lt_var 104636a995dSmlcreech $lt_var=C 105636a995dSmlcreech export $lt_var 106636a995dSmlcreech lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 107636a995dSmlcreech lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 108636a995dSmlcreech fi" 109636a995dSmlcreechdone 110636a995dSmlcreech 111636a995dSmlcreech$lt_unset CDPATH 112636a995dSmlcreech 113636a995dSmlcreech 114636a995dSmlcreech 115636a995dSmlcreech 116636a995dSmlcreech 117636a995dSmlcreech: ${CP="cp -f"} 118636a995dSmlcreech: ${ECHO="echo"} 119636a995dSmlcreech: ${EGREP="/usr/bin/grep -E"} 120636a995dSmlcreech: ${FGREP="/usr/bin/grep -F"} 121636a995dSmlcreech: ${GREP="/usr/bin/grep"} 122636a995dSmlcreech: ${LN_S="ln -s"} 123636a995dSmlcreech: ${MAKE="make"} 124636a995dSmlcreech: ${MKDIR="mkdir"} 125636a995dSmlcreech: ${MV="mv -f"} 126636a995dSmlcreech: ${RM="rm -f"} 127636a995dSmlcreech: ${SED="/opt/local/bin/gsed"} 128636a995dSmlcreech: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 129636a995dSmlcreech: ${Xsed="$SED -e 1s/^X//"} 130636a995dSmlcreech 131636a995dSmlcreech# Global variables: 132636a995dSmlcreechEXIT_SUCCESS=0 133636a995dSmlcreechEXIT_FAILURE=1 134636a995dSmlcreechEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 135636a995dSmlcreechEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 136636a995dSmlcreech 137636a995dSmlcreechexit_status=$EXIT_SUCCESS 138636a995dSmlcreech 139636a995dSmlcreech# Make sure IFS has a sensible default 140636a995dSmlcreechlt_nl=' 141636a995dSmlcreech' 142636a995dSmlcreechIFS=" $lt_nl" 143636a995dSmlcreech 144636a995dSmlcreechdirname="s,/[^/]*$,," 145636a995dSmlcreechbasename="s,^.*/,," 146636a995dSmlcreech 147636a995dSmlcreech# func_dirname_and_basename file append nondir_replacement 148636a995dSmlcreech# perform func_basename and func_dirname in a single function 149636a995dSmlcreech# call: 150636a995dSmlcreech# dirname: Compute the dirname of FILE. If nonempty, 151636a995dSmlcreech# add APPEND to the result, otherwise set result 152636a995dSmlcreech# to NONDIR_REPLACEMENT. 153636a995dSmlcreech# value returned in "$func_dirname_result" 154636a995dSmlcreech# basename: Compute filename of FILE. 155636a995dSmlcreech# value retuned in "$func_basename_result" 156636a995dSmlcreech# Implementation must be kept synchronized with func_dirname 157636a995dSmlcreech# and func_basename. For efficiency, we do not delegate to 158636a995dSmlcreech# those functions but instead duplicate the functionality here. 159636a995dSmlcreechfunc_dirname_and_basename () 160636a995dSmlcreech{ 161636a995dSmlcreech # Extract subdirectory from the argument. 162636a995dSmlcreech func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` 163636a995dSmlcreech if test "X$func_dirname_result" = "X${1}"; then 164636a995dSmlcreech func_dirname_result="${3}" 165636a995dSmlcreech else 166636a995dSmlcreech func_dirname_result="$func_dirname_result${2}" 167636a995dSmlcreech fi 168636a995dSmlcreech func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` 169636a995dSmlcreech} 170636a995dSmlcreech 171636a995dSmlcreech# Generated shell functions inserted here. 1727f19c02fSvapier 1737f19c02fSvapier# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 1747f19c02fSvapier# is ksh but when the shell is invoked as "sh" and the current value of 1757f19c02fSvapier# the _XPG environment variable is not equal to 1 (one), the special 1767f19c02fSvapier# positional parameter $0, within a function call, is the name of the 1777f19c02fSvapier# function. 1787f19c02fSvapierprogpath="$0" 1797f19c02fSvapier 1807f19c02fSvapier# The name of this program: 181636a995dSmlcreech# In the unlikely event $progname began with a '-', it would play havoc with 182636a995dSmlcreech# func_echo (imagine progname=-n), so we prepend ./ in that case: 183636a995dSmlcreechfunc_dirname_and_basename "$progpath" 184636a995dSmlcreechprogname=$func_basename_result 185636a995dSmlcreechcase $progname in 186636a995dSmlcreech -*) progname=./$progname ;; 187636a995dSmlcreechesac 1887f19c02fSvapier 189636a995dSmlcreech# Make sure we have an absolute path for reexecution: 190636a995dSmlcreechcase $progpath in 191636a995dSmlcreech [\\/]*|[A-Za-z]:\\*) ;; 192636a995dSmlcreech *[\\/]*) 193636a995dSmlcreech progdir=$func_dirname_result 194636a995dSmlcreech progdir=`cd "$progdir" && pwd` 195636a995dSmlcreech progpath="$progdir/$progname" 196636a995dSmlcreech ;; 197636a995dSmlcreech *) 198636a995dSmlcreech save_IFS="$IFS" 199636a995dSmlcreech IFS=: 200636a995dSmlcreech for progdir in $PATH; do 201636a995dSmlcreech IFS="$save_IFS" 202636a995dSmlcreech test -x "$progdir/$progname" && break 203636a995dSmlcreech done 204636a995dSmlcreech IFS="$save_IFS" 205636a995dSmlcreech test -n "$progdir" || progdir=`pwd` 206636a995dSmlcreech progpath="$progdir/$progname" 207636a995dSmlcreech ;; 208636a995dSmlcreechesac 20971eb93eaSdrh 21071eb93eaSdrh# Sed substitution that helps us do robust quoting. It backslashifies 21171eb93eaSdrh# metacharacters that are still active within double-quoted strings. 21262507b65Sa.rottmannXsed="${SED}"' -e 1s/^X//' 213636a995dSmlcreechsed_quote_subst='s/\([`"$\\]\)/\\\1/g' 214636a995dSmlcreech 215636a995dSmlcreech# Same as above, but do not quote variable references. 216636a995dSmlcreechdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 217636a995dSmlcreech 218636a995dSmlcreech# Re-`\' parameter expansions in output of double_quote_subst that were 219636a995dSmlcreech# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 220636a995dSmlcreech# in input to double_quote_subst, that '$' was protected from expansion. 221636a995dSmlcreech# Since each input `\' is now two `\'s, look for any number of runs of 222636a995dSmlcreech# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 223636a995dSmlcreechbs='\\' 224636a995dSmlcreechbs2='\\\\' 225636a995dSmlcreechbs4='\\\\\\\\' 226636a995dSmlcreechdollar='\$' 227636a995dSmlcreechsed_double_backslash="\ 228636a995dSmlcreech s/$bs4/&\\ 229636a995dSmlcreech/g 230636a995dSmlcreech s/^$bs2$dollar/$bs&/ 231636a995dSmlcreech s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 232636a995dSmlcreech s/\n//g" 233636a995dSmlcreech 234636a995dSmlcreech# Standard options: 235636a995dSmlcreechopt_dry_run=false 236636a995dSmlcreechopt_help=false 237636a995dSmlcreechopt_quiet=false 238636a995dSmlcreechopt_verbose=false 239636a995dSmlcreechopt_warning=: 240636a995dSmlcreech 241636a995dSmlcreech# func_echo arg... 242636a995dSmlcreech# Echo program name prefixed message, along with the current mode 243636a995dSmlcreech# name if it has been set yet. 244636a995dSmlcreechfunc_echo () 245636a995dSmlcreech{ 246636a995dSmlcreech $ECHO "$progname${mode+: }$mode: $*" 247636a995dSmlcreech} 248636a995dSmlcreech 249636a995dSmlcreech# func_verbose arg... 250636a995dSmlcreech# Echo program name prefixed message in verbose mode only. 251636a995dSmlcreechfunc_verbose () 252636a995dSmlcreech{ 253636a995dSmlcreech $opt_verbose && func_echo ${1+"$@"} 254636a995dSmlcreech 255636a995dSmlcreech # A bug in bash halts the script if the last line of a function 256636a995dSmlcreech # fails when set -e is in force, so we need another command to 257636a995dSmlcreech # work around that: 258636a995dSmlcreech : 259636a995dSmlcreech} 260636a995dSmlcreech 261636a995dSmlcreech# func_error arg... 262636a995dSmlcreech# Echo program name prefixed message to standard error. 263636a995dSmlcreechfunc_error () 264636a995dSmlcreech{ 265636a995dSmlcreech $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 266636a995dSmlcreech} 267636a995dSmlcreech 268636a995dSmlcreech# func_warning arg... 269636a995dSmlcreech# Echo program name prefixed warning message to standard error. 270636a995dSmlcreechfunc_warning () 271636a995dSmlcreech{ 272636a995dSmlcreech $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 273636a995dSmlcreech 274636a995dSmlcreech # bash bug again: 275636a995dSmlcreech : 276636a995dSmlcreech} 277636a995dSmlcreech 278636a995dSmlcreech# func_fatal_error arg... 279636a995dSmlcreech# Echo program name prefixed message to standard error, and exit. 280636a995dSmlcreechfunc_fatal_error () 281636a995dSmlcreech{ 282636a995dSmlcreech func_error ${1+"$@"} 283636a995dSmlcreech exit $EXIT_FAILURE 284636a995dSmlcreech} 285636a995dSmlcreech 286636a995dSmlcreech# func_fatal_help arg... 287636a995dSmlcreech# Echo program name prefixed message to standard error, followed by 288636a995dSmlcreech# a help hint, and exit. 289636a995dSmlcreechfunc_fatal_help () 290636a995dSmlcreech{ 291636a995dSmlcreech func_error ${1+"$@"} 292636a995dSmlcreech func_fatal_error "$help" 293636a995dSmlcreech} 294636a995dSmlcreechhelp="Try \`$progname --help' for more information." ## default 295636a995dSmlcreech 296636a995dSmlcreech 297636a995dSmlcreech# func_grep expression filename 298636a995dSmlcreech# Check whether EXPRESSION matches any line of FILENAME, without output. 299636a995dSmlcreechfunc_grep () 300636a995dSmlcreech{ 301636a995dSmlcreech $GREP "$1" "$2" >/dev/null 2>&1 302636a995dSmlcreech} 303636a995dSmlcreech 304636a995dSmlcreech 305636a995dSmlcreech# func_mkdir_p directory-path 306636a995dSmlcreech# Make sure the entire path to DIRECTORY-PATH is available. 307636a995dSmlcreechfunc_mkdir_p () 308636a995dSmlcreech{ 309636a995dSmlcreech my_directory_path="$1" 310636a995dSmlcreech my_dir_list= 311636a995dSmlcreech 312636a995dSmlcreech if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 313636a995dSmlcreech 314636a995dSmlcreech # Protect directory names starting with `-' 315636a995dSmlcreech case $my_directory_path in 316636a995dSmlcreech -*) my_directory_path="./$my_directory_path" ;; 31762507b65Sa.rottmann esac 31871eb93eaSdrh 319636a995dSmlcreech # While some portion of DIR does not yet exist... 320636a995dSmlcreech while test ! -d "$my_directory_path"; do 321636a995dSmlcreech # ...make a list in topmost first order. Use a colon delimited 322636a995dSmlcreech # list incase some portion of path contains whitespace. 323636a995dSmlcreech my_dir_list="$my_directory_path:$my_dir_list" 32471eb93eaSdrh 325636a995dSmlcreech # If the last portion added has no slash in it, the list is done 326636a995dSmlcreech case $my_directory_path in */*) ;; *) break ;; esac 32762507b65Sa.rottmann 328636a995dSmlcreech # ...otherwise throw away the child directory and loop 329636a995dSmlcreech my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` 3307f19c02fSvapier done 331636a995dSmlcreech my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` 3327f19c02fSvapier 333636a995dSmlcreech save_mkdir_p_IFS="$IFS"; IFS=':' 334636a995dSmlcreech for my_dir in $my_dir_list; do 335636a995dSmlcreech IFS="$save_mkdir_p_IFS" 336636a995dSmlcreech # mkdir can fail with a `File exist' error if two processes 337636a995dSmlcreech # try to create one of the directories concurrently. Don't 338636a995dSmlcreech # stop in that case! 339636a995dSmlcreech $MKDIR "$my_dir" 2>/dev/null || : 340636a995dSmlcreech done 341636a995dSmlcreech IFS="$save_mkdir_p_IFS" 342636a995dSmlcreech 343636a995dSmlcreech # Bail out if we (or some other process) failed to create a directory. 344636a995dSmlcreech test -d "$my_directory_path" || \ 345636a995dSmlcreech func_fatal_error "Failed to create \`$1'" 346636a995dSmlcreech fi 347636a995dSmlcreech} 348636a995dSmlcreech 349964dbb1eSa.rottmann 3507f19c02fSvapier# func_mktempdir [string] 3517f19c02fSvapier# Make a temporary directory that won't clash with other running 3527f19c02fSvapier# libtool processes, and avoids race conditions if possible. If 3537f19c02fSvapier# given, STRING is the basename for that directory. 3547f19c02fSvapierfunc_mktempdir () 3557f19c02fSvapier{ 3567f19c02fSvapier my_template="${TMPDIR-/tmp}/${1-$progname}" 3577f19c02fSvapier 358636a995dSmlcreech if test "$opt_dry_run" = ":"; then 3597f19c02fSvapier # Return a directory name, but don't create it in dry-run mode 3607f19c02fSvapier my_tmpdir="${my_template}-$$" 3617f19c02fSvapier else 3627f19c02fSvapier 3637f19c02fSvapier # If mktemp works, use that first and foremost 3647f19c02fSvapier my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 3657f19c02fSvapier 3667f19c02fSvapier if test ! -d "$my_tmpdir"; then 3677f19c02fSvapier # Failing that, at least try and use $RANDOM to avoid a race 3687f19c02fSvapier my_tmpdir="${my_template}-${RANDOM-0}$$" 3697f19c02fSvapier 3707f19c02fSvapier save_mktempdir_umask=`umask` 3717f19c02fSvapier umask 0077 372636a995dSmlcreech $MKDIR "$my_tmpdir" 3737f19c02fSvapier umask $save_mktempdir_umask 3747f19c02fSvapier fi 3757f19c02fSvapier 3767f19c02fSvapier # If we're not in dry-run mode, bomb out on failure 377636a995dSmlcreech test -d "$my_tmpdir" || \ 378636a995dSmlcreech func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 3797f19c02fSvapier fi 3807f19c02fSvapier 381636a995dSmlcreech $ECHO "X$my_tmpdir" | $Xsed 3827f19c02fSvapier} 3837f19c02fSvapier 3847f19c02fSvapier 385636a995dSmlcreech# func_quote_for_eval arg 386636a995dSmlcreech# Aesthetically quote ARG to be evaled later. 387636a995dSmlcreech# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 388636a995dSmlcreech# is double-quoted, suitable for a subsequent eval, whereas 389636a995dSmlcreech# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 390636a995dSmlcreech# which are still active within double quotes backslashified. 391636a995dSmlcreechfunc_quote_for_eval () 3927f19c02fSvapier{ 393636a995dSmlcreech case $1 in 394636a995dSmlcreech *[\\\`\"\$]*) 395636a995dSmlcreech func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; 396636a995dSmlcreech *) 397636a995dSmlcreech func_quote_for_eval_unquoted_result="$1" ;; 3987f19c02fSvapier esac 399636a995dSmlcreech 400636a995dSmlcreech case $func_quote_for_eval_unquoted_result in 401636a995dSmlcreech # Double-quote args containing shell metacharacters to delay 402636a995dSmlcreech # word splitting, command substitution and and variable 403636a995dSmlcreech # expansion for a subsequent eval. 404636a995dSmlcreech # Many Bourne shells cannot handle close brackets correctly 405636a995dSmlcreech # in scan sets, so we specify it separately. 406636a995dSmlcreech *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 407636a995dSmlcreech func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 408636a995dSmlcreech ;; 409636a995dSmlcreech *) 410636a995dSmlcreech func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 411636a995dSmlcreech esac 412636a995dSmlcreech} 413636a995dSmlcreech 414636a995dSmlcreech 415636a995dSmlcreech# func_quote_for_expand arg 416636a995dSmlcreech# Aesthetically quote ARG to be evaled later; same as above, 417636a995dSmlcreech# but do not quote variable references. 418636a995dSmlcreechfunc_quote_for_expand () 419636a995dSmlcreech{ 420636a995dSmlcreech case $1 in 421636a995dSmlcreech *[\\\`\"]*) 422636a995dSmlcreech my_arg=`$ECHO "X$1" | $Xsed \ 423636a995dSmlcreech -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 424636a995dSmlcreech *) 425636a995dSmlcreech my_arg="$1" ;; 426636a995dSmlcreech esac 427636a995dSmlcreech 428636a995dSmlcreech case $my_arg in 429636a995dSmlcreech # Double-quote args containing shell metacharacters to delay 430636a995dSmlcreech # word splitting and command substitution for a subsequent eval. 431636a995dSmlcreech # Many Bourne shells cannot handle close brackets correctly 432636a995dSmlcreech # in scan sets, so we specify it separately. 433636a995dSmlcreech *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 434636a995dSmlcreech my_arg="\"$my_arg\"" 435636a995dSmlcreech ;; 436636a995dSmlcreech esac 437636a995dSmlcreech 438636a995dSmlcreech func_quote_for_expand_result="$my_arg" 439636a995dSmlcreech} 440636a995dSmlcreech 441636a995dSmlcreech 442636a995dSmlcreech# func_show_eval cmd [fail_exp] 443636a995dSmlcreech# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 444636a995dSmlcreech# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 445636a995dSmlcreech# is given, then evaluate it. 446636a995dSmlcreechfunc_show_eval () 447636a995dSmlcreech{ 448636a995dSmlcreech my_cmd="$1" 449636a995dSmlcreech my_fail_exp="${2-:}" 450636a995dSmlcreech 451636a995dSmlcreech ${opt_silent-false} || { 452636a995dSmlcreech func_quote_for_expand "$my_cmd" 453636a995dSmlcreech eval "func_echo $func_quote_for_expand_result" 454636a995dSmlcreech } 455636a995dSmlcreech 456636a995dSmlcreech if ${opt_dry_run-false}; then :; else 457636a995dSmlcreech eval "$my_cmd" 458636a995dSmlcreech my_status=$? 459636a995dSmlcreech if test "$my_status" -eq 0; then :; else 460636a995dSmlcreech eval "(exit $my_status); $my_fail_exp" 461636a995dSmlcreech fi 462636a995dSmlcreech fi 463636a995dSmlcreech} 464636a995dSmlcreech 465636a995dSmlcreech 466636a995dSmlcreech# func_show_eval_locale cmd [fail_exp] 467636a995dSmlcreech# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 468636a995dSmlcreech# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 469636a995dSmlcreech# is given, then evaluate it. Use the saved locale for evaluation. 470636a995dSmlcreechfunc_show_eval_locale () 471636a995dSmlcreech{ 472636a995dSmlcreech my_cmd="$1" 473636a995dSmlcreech my_fail_exp="${2-:}" 474636a995dSmlcreech 475636a995dSmlcreech ${opt_silent-false} || { 476636a995dSmlcreech func_quote_for_expand "$my_cmd" 477636a995dSmlcreech eval "func_echo $func_quote_for_expand_result" 478636a995dSmlcreech } 479636a995dSmlcreech 480636a995dSmlcreech if ${opt_dry_run-false}; then :; else 481636a995dSmlcreech eval "$lt_user_locale 482636a995dSmlcreech $my_cmd" 483636a995dSmlcreech my_status=$? 484636a995dSmlcreech eval "$lt_safe_locale" 485636a995dSmlcreech if test "$my_status" -eq 0; then :; else 486636a995dSmlcreech eval "(exit $my_status); $my_fail_exp" 487636a995dSmlcreech fi 488636a995dSmlcreech fi 489636a995dSmlcreech} 490636a995dSmlcreech 491636a995dSmlcreech 492636a995dSmlcreech 493636a995dSmlcreech 494636a995dSmlcreech 495636a995dSmlcreech# func_version 496636a995dSmlcreech# Echo version message to standard output and exit. 497636a995dSmlcreechfunc_version () 498636a995dSmlcreech{ 499636a995dSmlcreech $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { 500636a995dSmlcreech s/^# // 501636a995dSmlcreech s/^# *$// 502636a995dSmlcreech s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 503636a995dSmlcreech p 504636a995dSmlcreech }' < "$progpath" 505636a995dSmlcreech exit $? 506636a995dSmlcreech} 507636a995dSmlcreech 508636a995dSmlcreech# func_usage 509636a995dSmlcreech# Echo short help message to standard output and exit. 510636a995dSmlcreechfunc_usage () 511636a995dSmlcreech{ 512636a995dSmlcreech $SED -n '/^# Usage:/,/# -h/ { 513636a995dSmlcreech s/^# // 514636a995dSmlcreech s/^# *$// 515636a995dSmlcreech s/\$progname/'$progname'/ 516636a995dSmlcreech p 517636a995dSmlcreech }' < "$progpath" 518636a995dSmlcreech $ECHO 519636a995dSmlcreech $ECHO "run \`$progname --help | more' for full usage" 520636a995dSmlcreech exit $? 521636a995dSmlcreech} 522636a995dSmlcreech 523636a995dSmlcreech# func_help 524636a995dSmlcreech# Echo long help message to standard output and exit. 525636a995dSmlcreechfunc_help () 526636a995dSmlcreech{ 527636a995dSmlcreech $SED -n '/^# Usage:/,/# Report bugs to/ { 528636a995dSmlcreech s/^# // 529636a995dSmlcreech s/^# *$// 530636a995dSmlcreech s*\$progname*'$progname'* 531636a995dSmlcreech s*\$host*'"$host"'* 532636a995dSmlcreech s*\$SHELL*'"$SHELL"'* 533636a995dSmlcreech s*\$LTCC*'"$LTCC"'* 534636a995dSmlcreech s*\$LTCFLAGS*'"$LTCFLAGS"'* 535636a995dSmlcreech s*\$LD*'"$LD"'* 536636a995dSmlcreech s/\$with_gnu_ld/'"$with_gnu_ld"'/ 537636a995dSmlcreech s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 538636a995dSmlcreech s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 539636a995dSmlcreech p 540636a995dSmlcreech }' < "$progpath" 541636a995dSmlcreech exit $? 542636a995dSmlcreech} 543636a995dSmlcreech 544636a995dSmlcreech# func_missing_arg argname 545636a995dSmlcreech# Echo program name prefixed message to standard error and set global 546636a995dSmlcreech# exit_cmd. 547636a995dSmlcreechfunc_missing_arg () 548636a995dSmlcreech{ 549636a995dSmlcreech func_error "missing argument for $1" 550636a995dSmlcreech exit_cmd=exit 551636a995dSmlcreech} 552636a995dSmlcreech 553636a995dSmlcreechexit_cmd=: 554636a995dSmlcreech 555636a995dSmlcreech 556636a995dSmlcreech 557636a995dSmlcreech 558636a995dSmlcreech 559636a995dSmlcreech# Check that we have a working $ECHO. 560636a995dSmlcreechif test "X$1" = X--no-reexec; then 561636a995dSmlcreech # Discard the --no-reexec flag, and continue. 562636a995dSmlcreech shift 563636a995dSmlcreechelif test "X$1" = X--fallback-echo; then 564636a995dSmlcreech # Avoid inline document here, it may be left over 565636a995dSmlcreech : 566636a995dSmlcreechelif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then 567636a995dSmlcreech # Yippee, $ECHO works! 568636a995dSmlcreech : 569636a995dSmlcreechelse 570636a995dSmlcreech # Restart under the correct shell, and then maybe $ECHO will work. 571636a995dSmlcreech exec $SHELL "$progpath" --no-reexec ${1+"$@"} 572636a995dSmlcreechfi 573636a995dSmlcreech# Same for EGREP, and just to be sure, do LTCC as well 574636a995dSmlcreechif test "x$EGREP" = x ; then 575636a995dSmlcreech EGREP=egrep 576636a995dSmlcreechfi 577636a995dSmlcreechif test "x$LTCC" = x ; then 578636a995dSmlcreech LTCC=${CC-gcc} 579636a995dSmlcreechfi 580636a995dSmlcreech 581636a995dSmlcreechif test "X$1" = X--fallback-echo; then 582636a995dSmlcreech # used as fallback echo 583636a995dSmlcreech shift 584636a995dSmlcreech cat <<EOF 585636a995dSmlcreech$* 586636a995dSmlcreechEOF 587636a995dSmlcreech exit $EXIT_SUCCESS 588636a995dSmlcreechfi 589636a995dSmlcreech 590636a995dSmlcreechmagic="%%%MAGIC variable%%%" 591636a995dSmlcreechmagic_exe="%%%MAGIC EXE variable%%%" 592636a995dSmlcreech 593636a995dSmlcreech# Global variables. 594636a995dSmlcreech# $mode is unset 595636a995dSmlcreechnonopt= 596636a995dSmlcreechexecute_dlfiles= 597636a995dSmlcreechpreserve_args= 598636a995dSmlcreechlo2o="s/\\.lo\$/.${objext}/" 599636a995dSmlcreecho2lo="s/\\.${objext}\$/.lo/" 600636a995dSmlcreechextracted_archives= 601636a995dSmlcreechextracted_serial=0 602636a995dSmlcreech 603636a995dSmlcreechopt_dry_run=false 604636a995dSmlcreechopt_duplicate_deps=false 605636a995dSmlcreechopt_silent=false 606636a995dSmlcreechopt_debug=: 607636a995dSmlcreech 608636a995dSmlcreech# If this variable is set in any of the actions, the command in it 609636a995dSmlcreech# will be execed at the end. This prevents here-documents from being 610636a995dSmlcreech# left over by shells. 611636a995dSmlcreechexec_cmd= 612636a995dSmlcreech 613636a995dSmlcreech# func_fatal_configuration arg... 614636a995dSmlcreech# Echo program name prefixed message to standard error, followed by 615636a995dSmlcreech# a configuration failure hint, and exit. 616636a995dSmlcreechfunc_fatal_configuration () 617636a995dSmlcreech{ 618636a995dSmlcreech func_error ${1+"$@"} 619636a995dSmlcreech func_error "See the $PACKAGE documentation for more information." 620636a995dSmlcreech func_fatal_error "Fatal configuration error." 621636a995dSmlcreech} 622636a995dSmlcreech 623636a995dSmlcreech 624636a995dSmlcreech# func_config 625636a995dSmlcreech# Display the configuration for all the tags in this script. 626636a995dSmlcreechfunc_config () 627636a995dSmlcreech{ 628636a995dSmlcreech re_begincf='^# ### BEGIN LIBTOOL' 629636a995dSmlcreech re_endcf='^# ### END LIBTOOL' 630636a995dSmlcreech 631636a995dSmlcreech # Default configuration. 632636a995dSmlcreech $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 633636a995dSmlcreech 634636a995dSmlcreech # Now print the configurations for the tags. 635636a995dSmlcreech for tagname in $taglist; do 636636a995dSmlcreech $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 637636a995dSmlcreech done 638636a995dSmlcreech 639636a995dSmlcreech exit $? 640636a995dSmlcreech} 641636a995dSmlcreech 642636a995dSmlcreech# func_features 643636a995dSmlcreech# Display the features supported by this script. 644636a995dSmlcreechfunc_features () 645636a995dSmlcreech{ 646636a995dSmlcreech $ECHO "host: $host" 647636a995dSmlcreech if test "$build_libtool_libs" = yes; then 648636a995dSmlcreech $ECHO "enable shared libraries" 649636a995dSmlcreech else 650636a995dSmlcreech $ECHO "disable shared libraries" 651636a995dSmlcreech fi 652636a995dSmlcreech if test "$build_old_libs" = yes; then 653636a995dSmlcreech $ECHO "enable static libraries" 654636a995dSmlcreech else 655636a995dSmlcreech $ECHO "disable static libraries" 656636a995dSmlcreech fi 657636a995dSmlcreech 658636a995dSmlcreech exit $? 659636a995dSmlcreech} 660636a995dSmlcreech 661636a995dSmlcreech# func_enable_tag tagname 662636a995dSmlcreech# Verify that TAGNAME is valid, and either flag an error and exit, or 663636a995dSmlcreech# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 664636a995dSmlcreech# variable here. 665636a995dSmlcreechfunc_enable_tag () 666636a995dSmlcreech{ 667636a995dSmlcreech # Global variable: 668636a995dSmlcreech tagname="$1" 669636a995dSmlcreech 670636a995dSmlcreech re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 671636a995dSmlcreech re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 672636a995dSmlcreech sed_extractcf="/$re_begincf/,/$re_endcf/p" 673636a995dSmlcreech 674636a995dSmlcreech # Validate tagname. 675636a995dSmlcreech case $tagname in 676636a995dSmlcreech *[!-_A-Za-z0-9,/]*) 677636a995dSmlcreech func_fatal_error "invalid tag name: $tagname" 678636a995dSmlcreech ;; 679636a995dSmlcreech esac 680636a995dSmlcreech 681636a995dSmlcreech # Don't test for the "default" C tag, as we know it's 682636a995dSmlcreech # there but not specially marked. 683636a995dSmlcreech case $tagname in 684636a995dSmlcreech CC) ;; 685636a995dSmlcreech *) 686636a995dSmlcreech if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 687636a995dSmlcreech taglist="$taglist $tagname" 688636a995dSmlcreech 689636a995dSmlcreech # Evaluate the configuration. Be careful to quote the path 690636a995dSmlcreech # and the sed script, to avoid splitting on whitespace, but 691636a995dSmlcreech # also don't use non-portable quotes within backquotes within 692636a995dSmlcreech # quotes we have to do it in 2 steps: 693636a995dSmlcreech extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 694636a995dSmlcreech eval "$extractedcf" 695636a995dSmlcreech else 696636a995dSmlcreech func_error "ignoring unknown tag $tagname" 697964dbb1eSa.rottmann fi 698964dbb1eSa.rottmann ;; 699636a995dSmlcreech esac 700636a995dSmlcreech} 701636a995dSmlcreech 702636a995dSmlcreech# Parse options once, thoroughly. This comes as soon as possible in 703636a995dSmlcreech# the script to make things like `libtool --version' happen quickly. 704636a995dSmlcreech{ 705636a995dSmlcreech 706636a995dSmlcreech # Shorthand for --mode=foo, only valid as the first argument 707636a995dSmlcreech case $1 in 708636a995dSmlcreech clean|clea|cle|cl) 709636a995dSmlcreech shift; set dummy --mode clean ${1+"$@"}; shift 710964dbb1eSa.rottmann ;; 711636a995dSmlcreech compile|compil|compi|comp|com|co|c) 712636a995dSmlcreech shift; set dummy --mode compile ${1+"$@"}; shift 713636a995dSmlcreech ;; 714636a995dSmlcreech execute|execut|execu|exec|exe|ex|e) 715636a995dSmlcreech shift; set dummy --mode execute ${1+"$@"}; shift 716636a995dSmlcreech ;; 717636a995dSmlcreech finish|finis|fini|fin|fi|f) 718636a995dSmlcreech shift; set dummy --mode finish ${1+"$@"}; shift 719636a995dSmlcreech ;; 720636a995dSmlcreech install|instal|insta|inst|ins|in|i) 721636a995dSmlcreech shift; set dummy --mode install ${1+"$@"}; shift 722636a995dSmlcreech ;; 723636a995dSmlcreech link|lin|li|l) 724636a995dSmlcreech shift; set dummy --mode link ${1+"$@"}; shift 725636a995dSmlcreech ;; 726636a995dSmlcreech uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 727636a995dSmlcreech shift; set dummy --mode uninstall ${1+"$@"}; shift 728964dbb1eSa.rottmann ;; 729964dbb1eSa.rottmann esac 730636a995dSmlcreech 731636a995dSmlcreech # Parse non-mode specific arguments: 732636a995dSmlcreech while test "$#" -gt 0; do 733636a995dSmlcreech opt="$1" 734636a995dSmlcreech shift 735636a995dSmlcreech 736636a995dSmlcreech case $opt in 737636a995dSmlcreech --config) func_config ;; 738636a995dSmlcreech 739636a995dSmlcreech --debug) preserve_args="$preserve_args $opt" 740636a995dSmlcreech func_echo "enabling shell trace mode" 741636a995dSmlcreech opt_debug='set -x' 742636a995dSmlcreech $opt_debug 743636a995dSmlcreech ;; 744636a995dSmlcreech 745636a995dSmlcreech -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break 746636a995dSmlcreech execute_dlfiles="$execute_dlfiles $1" 747636a995dSmlcreech shift 748636a995dSmlcreech ;; 749636a995dSmlcreech 750636a995dSmlcreech --dry-run | -n) opt_dry_run=: ;; 751636a995dSmlcreech --features) func_features ;; 752636a995dSmlcreech --finish) mode="finish" ;; 753636a995dSmlcreech 754636a995dSmlcreech --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break 755636a995dSmlcreech case $1 in 756636a995dSmlcreech # Valid mode arguments: 757636a995dSmlcreech clean) ;; 758636a995dSmlcreech compile) ;; 759636a995dSmlcreech execute) ;; 760636a995dSmlcreech finish) ;; 761636a995dSmlcreech install) ;; 762636a995dSmlcreech link) ;; 763636a995dSmlcreech relink) ;; 764636a995dSmlcreech uninstall) ;; 765636a995dSmlcreech 766636a995dSmlcreech # Catch anything else as an error 767636a995dSmlcreech *) func_error "invalid argument for $opt" 768636a995dSmlcreech exit_cmd=exit 769636a995dSmlcreech break 770964dbb1eSa.rottmann ;; 771964dbb1eSa.rottmann esac 772636a995dSmlcreech 773636a995dSmlcreech mode="$1" 774636a995dSmlcreech shift 775636a995dSmlcreech ;; 776636a995dSmlcreech 777636a995dSmlcreech --preserve-dup-deps) 778636a995dSmlcreech opt_duplicate_deps=: ;; 779636a995dSmlcreech 780636a995dSmlcreech --quiet|--silent) preserve_args="$preserve_args $opt" 781636a995dSmlcreech opt_silent=: 782636a995dSmlcreech ;; 783636a995dSmlcreech 784636a995dSmlcreech --verbose| -v) preserve_args="$preserve_args $opt" 785636a995dSmlcreech opt_silent=false 786636a995dSmlcreech ;; 787636a995dSmlcreech 788636a995dSmlcreech --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break 789636a995dSmlcreech preserve_args="$preserve_args $opt $1" 790636a995dSmlcreech func_enable_tag "$1" # tagname is set here 791636a995dSmlcreech shift 792636a995dSmlcreech ;; 793636a995dSmlcreech 794636a995dSmlcreech # Separate optargs to long options: 795636a995dSmlcreech -dlopen=*|--mode=*|--tag=*) 796636a995dSmlcreech func_opt_split "$opt" 797636a995dSmlcreech set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} 798636a995dSmlcreech shift 799636a995dSmlcreech ;; 800636a995dSmlcreech 801636a995dSmlcreech -\?|-h) func_usage ;; 802636a995dSmlcreech --help) opt_help=: ;; 803636a995dSmlcreech --version) func_version ;; 804636a995dSmlcreech 805636a995dSmlcreech -*) func_fatal_help "unrecognized option \`$opt'" ;; 806636a995dSmlcreech 807636a995dSmlcreech *) nonopt="$opt" 808636a995dSmlcreech break 809636a995dSmlcreech ;; 810636a995dSmlcreech esac 811636a995dSmlcreech done 812636a995dSmlcreech 813636a995dSmlcreech 814636a995dSmlcreech case $host in 815*6acb2cf6Svapier *cygwin* | *mingw* | *pw32* | *cegcc*) 816636a995dSmlcreech # don't eliminate duplications in $postdeps and $predeps 817636a995dSmlcreech opt_duplicate_compiler_generated_deps=: 818636a995dSmlcreech ;; 819636a995dSmlcreech *) 820636a995dSmlcreech opt_duplicate_compiler_generated_deps=$opt_duplicate_deps 821636a995dSmlcreech ;; 822636a995dSmlcreech esac 823636a995dSmlcreech 824636a995dSmlcreech # Having warned about all mis-specified options, bail out if 825636a995dSmlcreech # anything was wrong. 826636a995dSmlcreech $exit_cmd $EXIT_FAILURE 827636a995dSmlcreech} 828636a995dSmlcreech 829636a995dSmlcreech# func_check_version_match 830636a995dSmlcreech# Ensure that we are using m4 macros, and libtool script from the same 831636a995dSmlcreech# release of libtool. 832636a995dSmlcreechfunc_check_version_match () 833636a995dSmlcreech{ 834636a995dSmlcreech if test "$package_revision" != "$macro_revision"; then 835636a995dSmlcreech if test "$VERSION" != "$macro_version"; then 836636a995dSmlcreech if test -z "$macro_version"; then 837636a995dSmlcreech cat >&2 <<_LT_EOF 838636a995dSmlcreech$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 839636a995dSmlcreech$progname: definition of this LT_INIT comes from an older release. 840636a995dSmlcreech$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 841636a995dSmlcreech$progname: and run autoconf again. 842636a995dSmlcreech_LT_EOF 843636a995dSmlcreech else 844636a995dSmlcreech cat >&2 <<_LT_EOF 845636a995dSmlcreech$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 846636a995dSmlcreech$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 847636a995dSmlcreech$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 848636a995dSmlcreech$progname: and run autoconf again. 849636a995dSmlcreech_LT_EOF 850636a995dSmlcreech fi 851636a995dSmlcreech else 852636a995dSmlcreech cat >&2 <<_LT_EOF 853636a995dSmlcreech$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 854636a995dSmlcreech$progname: but the definition of this LT_INIT comes from revision $macro_revision. 855636a995dSmlcreech$progname: You should recreate aclocal.m4 with macros from revision $package_revision 856636a995dSmlcreech$progname: of $PACKAGE $VERSION and run autoconf again. 857636a995dSmlcreech_LT_EOF 858636a995dSmlcreech fi 859636a995dSmlcreech 860636a995dSmlcreech exit $EXIT_MISMATCH 861636a995dSmlcreech fi 862636a995dSmlcreech} 863636a995dSmlcreech 864636a995dSmlcreech 865636a995dSmlcreech## ----------- ## 866636a995dSmlcreech## Main. ## 867636a995dSmlcreech## ----------- ## 868636a995dSmlcreech 869636a995dSmlcreech$opt_help || { 870636a995dSmlcreech # Sanity checks first: 871636a995dSmlcreech func_check_version_match 872636a995dSmlcreech 873636a995dSmlcreech if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 874636a995dSmlcreech func_fatal_configuration "not configured to build any kind of library" 875636a995dSmlcreech fi 876636a995dSmlcreech 877636a995dSmlcreech test -z "$mode" && func_fatal_error "error: you must specify a MODE." 878636a995dSmlcreech 879636a995dSmlcreech 880636a995dSmlcreech # Darwin sucks 881636a995dSmlcreech eval std_shrext=\"$shrext_cmds\" 882636a995dSmlcreech 883636a995dSmlcreech 884636a995dSmlcreech # Only execute mode is allowed to have -dlopen flags. 885636a995dSmlcreech if test -n "$execute_dlfiles" && test "$mode" != execute; then 886636a995dSmlcreech func_error "unrecognized option \`-dlopen'" 887636a995dSmlcreech $ECHO "$help" 1>&2 888636a995dSmlcreech exit $EXIT_FAILURE 889636a995dSmlcreech fi 890636a995dSmlcreech 891636a995dSmlcreech # Change the help message to a mode-specific one. 892636a995dSmlcreech generic_help="$help" 893636a995dSmlcreech help="Try \`$progname --help --mode=$mode' for more information." 894636a995dSmlcreech} 895636a995dSmlcreech 896636a995dSmlcreech 897636a995dSmlcreech# func_lalib_p file 898636a995dSmlcreech# True iff FILE is a libtool `.la' library or `.lo' object file. 899636a995dSmlcreech# This function is only a basic sanity check; it will hardly flush out 900636a995dSmlcreech# determined imposters. 901636a995dSmlcreechfunc_lalib_p () 902636a995dSmlcreech{ 903*6acb2cf6Svapier test -f "$1" && 904636a995dSmlcreech $SED -e 4q "$1" 2>/dev/null \ 905636a995dSmlcreech | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 906636a995dSmlcreech} 907636a995dSmlcreech 908636a995dSmlcreech# func_lalib_unsafe_p file 909636a995dSmlcreech# True iff FILE is a libtool `.la' library or `.lo' object file. 910636a995dSmlcreech# This function implements the same check as func_lalib_p without 911636a995dSmlcreech# resorting to external programs. To this end, it redirects stdin and 912636a995dSmlcreech# closes it afterwards, without saving the original file descriptor. 913636a995dSmlcreech# As a safety measure, use it only where a negative result would be 914636a995dSmlcreech# fatal anyway. Works if `file' does not exist. 915636a995dSmlcreechfunc_lalib_unsafe_p () 916636a995dSmlcreech{ 917636a995dSmlcreech lalib_p=no 918*6acb2cf6Svapier if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 919636a995dSmlcreech for lalib_p_l in 1 2 3 4 920636a995dSmlcreech do 921636a995dSmlcreech read lalib_p_line 922636a995dSmlcreech case "$lalib_p_line" in 923636a995dSmlcreech \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 924636a995dSmlcreech esac 925636a995dSmlcreech done 926636a995dSmlcreech exec 0<&5 5<&- 927636a995dSmlcreech fi 928636a995dSmlcreech test "$lalib_p" = yes 929636a995dSmlcreech} 930636a995dSmlcreech 931636a995dSmlcreech# func_ltwrapper_script_p file 932636a995dSmlcreech# True iff FILE is a libtool wrapper script 933636a995dSmlcreech# This function is only a basic sanity check; it will hardly flush out 934636a995dSmlcreech# determined imposters. 935636a995dSmlcreechfunc_ltwrapper_script_p () 936636a995dSmlcreech{ 937636a995dSmlcreech func_lalib_p "$1" 938636a995dSmlcreech} 939636a995dSmlcreech 940636a995dSmlcreech# func_ltwrapper_executable_p file 941636a995dSmlcreech# True iff FILE is a libtool wrapper executable 942636a995dSmlcreech# This function is only a basic sanity check; it will hardly flush out 943636a995dSmlcreech# determined imposters. 944636a995dSmlcreechfunc_ltwrapper_executable_p () 945636a995dSmlcreech{ 946636a995dSmlcreech func_ltwrapper_exec_suffix= 947636a995dSmlcreech case $1 in 948636a995dSmlcreech *.exe) ;; 949636a995dSmlcreech *) func_ltwrapper_exec_suffix=.exe ;; 950636a995dSmlcreech esac 951636a995dSmlcreech $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 952636a995dSmlcreech} 953636a995dSmlcreech 954636a995dSmlcreech# func_ltwrapper_scriptname file 955636a995dSmlcreech# Assumes file is an ltwrapper_executable 956636a995dSmlcreech# uses $file to determine the appropriate filename for a 957636a995dSmlcreech# temporary ltwrapper_script. 958636a995dSmlcreechfunc_ltwrapper_scriptname () 959636a995dSmlcreech{ 960636a995dSmlcreech func_ltwrapper_scriptname_result="" 961636a995dSmlcreech if func_ltwrapper_executable_p "$1"; then 962636a995dSmlcreech func_dirname_and_basename "$1" "" "." 963636a995dSmlcreech func_stripname '' '.exe' "$func_basename_result" 964636a995dSmlcreech func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 965636a995dSmlcreech fi 966636a995dSmlcreech} 967636a995dSmlcreech 968636a995dSmlcreech# func_ltwrapper_p file 969636a995dSmlcreech# True iff FILE is a libtool wrapper script or wrapper executable 970636a995dSmlcreech# This function is only a basic sanity check; it will hardly flush out 971636a995dSmlcreech# determined imposters. 972636a995dSmlcreechfunc_ltwrapper_p () 973636a995dSmlcreech{ 974636a995dSmlcreech func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 975636a995dSmlcreech} 976636a995dSmlcreech 977636a995dSmlcreech 978636a995dSmlcreech# func_execute_cmds commands fail_cmd 979636a995dSmlcreech# Execute tilde-delimited COMMANDS. 980636a995dSmlcreech# If FAIL_CMD is given, eval that upon failure. 981636a995dSmlcreech# FAIL_CMD may read-access the current command in variable CMD! 982636a995dSmlcreechfunc_execute_cmds () 983636a995dSmlcreech{ 984636a995dSmlcreech $opt_debug 985636a995dSmlcreech save_ifs=$IFS; IFS='~' 986636a995dSmlcreech for cmd in $1; do 987636a995dSmlcreech IFS=$save_ifs 988636a995dSmlcreech eval cmd=\"$cmd\" 989636a995dSmlcreech func_show_eval "$cmd" "${2-:}" 990636a995dSmlcreech done 991636a995dSmlcreech IFS=$save_ifs 992636a995dSmlcreech} 993636a995dSmlcreech 994636a995dSmlcreech 995636a995dSmlcreech# func_source file 996636a995dSmlcreech# Source FILE, adding directory component if necessary. 997636a995dSmlcreech# Note that it is not necessary on cygwin/mingw to append a dot to 998636a995dSmlcreech# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 999636a995dSmlcreech# behavior happens only for exec(3), not for open(2)! Also, sourcing 1000636a995dSmlcreech# `FILE.' does not work on cygwin managed mounts. 1001636a995dSmlcreechfunc_source () 1002636a995dSmlcreech{ 1003636a995dSmlcreech $opt_debug 1004636a995dSmlcreech case $1 in 1005636a995dSmlcreech */* | *\\*) . "$1" ;; 1006636a995dSmlcreech *) . "./$1" ;; 1007636a995dSmlcreech esac 1008964dbb1eSa.rottmann} 1009964dbb1eSa.rottmann 10107f19c02fSvapier 10117f19c02fSvapier# func_infer_tag arg 10127f19c02fSvapier# Infer tagged configuration to use if any are available and 10137f19c02fSvapier# if one wasn't chosen via the "--tag" command line option. 10147f19c02fSvapier# Only attempt this if the compiler in the base compile 10157f19c02fSvapier# command doesn't match the default compiler. 10167f19c02fSvapier# arg is usually of the form 'gcc ...' 10177f19c02fSvapierfunc_infer_tag () 10187f19c02fSvapier{ 1019636a995dSmlcreech $opt_debug 10207f19c02fSvapier if test -n "$available_tags" && test -z "$tagname"; then 10217f19c02fSvapier CC_quoted= 10227f19c02fSvapier for arg in $CC; do 1023636a995dSmlcreech func_quote_for_eval "$arg" 1024636a995dSmlcreech CC_quoted="$CC_quoted $func_quote_for_eval_result" 10257f19c02fSvapier done 10267f19c02fSvapier case $@ in 10277f19c02fSvapier # Blanks in the command may have been stripped by the calling shell, 10287f19c02fSvapier # but not from the CC environment variable when configure was run. 1029636a995dSmlcreech " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; 10307f19c02fSvapier # Blanks at the start of $base_compile will cause this to fail 10317f19c02fSvapier # if we don't check for them as well. 10327f19c02fSvapier *) 10337f19c02fSvapier for z in $available_tags; do 1034636a995dSmlcreech if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 10357f19c02fSvapier # Evaluate the configuration. 10367f19c02fSvapier eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 10377f19c02fSvapier CC_quoted= 10387f19c02fSvapier for arg in $CC; do 10397f19c02fSvapier # Double-quote args containing other shell metacharacters. 1040636a995dSmlcreech func_quote_for_eval "$arg" 1041636a995dSmlcreech CC_quoted="$CC_quoted $func_quote_for_eval_result" 10427f19c02fSvapier done 10437f19c02fSvapier case "$@ " in 1044636a995dSmlcreech " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) 10457f19c02fSvapier # The compiler in the base compile command matches 10467f19c02fSvapier # the one in the tagged configuration. 10477f19c02fSvapier # Assume this is the tagged configuration we want. 10487f19c02fSvapier tagname=$z 10497f19c02fSvapier break 10507f19c02fSvapier ;; 10517f19c02fSvapier esac 10527f19c02fSvapier fi 10537f19c02fSvapier done 10547f19c02fSvapier # If $tagname still isn't set, then no tagged configuration 10557f19c02fSvapier # was found and let the user know that the "--tag" command 10567f19c02fSvapier # line option must be used. 10577f19c02fSvapier if test -z "$tagname"; then 1058636a995dSmlcreech func_echo "unable to infer tagged configuration" 1059636a995dSmlcreech func_fatal_error "specify a tag with \`--tag'" 10607f19c02fSvapier# else 1061636a995dSmlcreech# func_verbose "using $tagname tagged configuration" 10627f19c02fSvapier fi 10637f19c02fSvapier ;; 10647f19c02fSvapier esac 10657f19c02fSvapier fi 10667f19c02fSvapier} 10677f19c02fSvapier 10687f19c02fSvapier 1069636a995dSmlcreech 1070636a995dSmlcreech# func_write_libtool_object output_name pic_name nonpic_name 1071636a995dSmlcreech# Create a libtool object file (analogous to a ".la" file), 1072636a995dSmlcreech# but don't create it if we're doing a dry run. 1073636a995dSmlcreechfunc_write_libtool_object () 10747f19c02fSvapier{ 1075636a995dSmlcreech write_libobj=${1} 107671eb93eaSdrh if test "$build_libtool_libs" = yes; then 1077636a995dSmlcreech write_lobj=\'${2}\' 107871eb93eaSdrh else 1079636a995dSmlcreech write_lobj=none 108071eb93eaSdrh fi 1081636a995dSmlcreech 108271eb93eaSdrh if test "$build_old_libs" = yes; then 1083636a995dSmlcreech write_oldobj=\'${3}\' 108471eb93eaSdrh else 1085636a995dSmlcreech write_oldobj=none 108671eb93eaSdrh fi 108771eb93eaSdrh 1088636a995dSmlcreech $opt_dry_run || { 1089636a995dSmlcreech cat >${write_libobj}T <<EOF 1090636a995dSmlcreech# $write_libobj - a libtool object file 1091636a995dSmlcreech# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1092636a995dSmlcreech# 1093636a995dSmlcreech# Please DO NOT delete this file! 1094636a995dSmlcreech# It is necessary for linking the library. 10957f19c02fSvapier 1096636a995dSmlcreech# Name of the PIC object. 1097636a995dSmlcreechpic_object=$write_lobj 109871eb93eaSdrh 1099636a995dSmlcreech# Name of the non-PIC object 1100636a995dSmlcreechnon_pic_object=$write_oldobj 110171eb93eaSdrh 1102636a995dSmlcreechEOF 1103636a995dSmlcreech $MV "${write_libobj}T" "${write_libobj}" 1104636a995dSmlcreech } 1105636a995dSmlcreech} 110671eb93eaSdrh 1107636a995dSmlcreech# func_mode_compile arg... 1108636a995dSmlcreechfunc_mode_compile () 1109636a995dSmlcreech{ 1110636a995dSmlcreech $opt_debug 111171eb93eaSdrh # Get the compilation command and the source file. 111271eb93eaSdrh base_compile= 1113964dbb1eSa.rottmann srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1114964dbb1eSa.rottmann suppress_opt=yes 111571eb93eaSdrh suppress_output= 1116964dbb1eSa.rottmann arg_mode=normal 1117964dbb1eSa.rottmann libobj= 1118964dbb1eSa.rottmann later= 1119636a995dSmlcreech pie_flag= 112071eb93eaSdrh 112171eb93eaSdrh for arg 112271eb93eaSdrh do 11237f19c02fSvapier case $arg_mode in 1124964dbb1eSa.rottmann arg ) 1125964dbb1eSa.rottmann # do not "continue". Instead, add this to base_compile 1126964dbb1eSa.rottmann lastarg="$arg" 1127964dbb1eSa.rottmann arg_mode=normal 112871eb93eaSdrh ;; 112971eb93eaSdrh 1130964dbb1eSa.rottmann target ) 1131964dbb1eSa.rottmann libobj="$arg" 1132964dbb1eSa.rottmann arg_mode=normal 113371eb93eaSdrh continue 113471eb93eaSdrh ;; 113571eb93eaSdrh 1136964dbb1eSa.rottmann normal ) 113771eb93eaSdrh # Accept any command-line options. 113871eb93eaSdrh case $arg in 113971eb93eaSdrh -o) 1140636a995dSmlcreech test -n "$libobj" && \ 1141636a995dSmlcreech func_fatal_error "you cannot specify \`-o' more than once" 1142964dbb1eSa.rottmann arg_mode=target 114371eb93eaSdrh continue 114471eb93eaSdrh ;; 114571eb93eaSdrh 1146636a995dSmlcreech -pie | -fpie | -fPIE) 1147636a995dSmlcreech pie_flag="$pie_flag $arg" 1148636a995dSmlcreech continue 1149636a995dSmlcreech ;; 1150636a995dSmlcreech 1151636a995dSmlcreech -shared | -static | -prefer-pic | -prefer-non-pic) 1152964dbb1eSa.rottmann later="$later $arg" 115371eb93eaSdrh continue 115471eb93eaSdrh ;; 115571eb93eaSdrh 1156964dbb1eSa.rottmann -no-suppress) 1157964dbb1eSa.rottmann suppress_opt=no 115871eb93eaSdrh continue 115971eb93eaSdrh ;; 116071eb93eaSdrh 116171eb93eaSdrh -Xcompiler) 1162964dbb1eSa.rottmann arg_mode=arg # the next one goes into the "base_compile" arg list 1163964dbb1eSa.rottmann continue # The current "srcfile" will either be retained or 1164964dbb1eSa.rottmann ;; # replaced later. I would guess that would be a bug. 116571eb93eaSdrh 116671eb93eaSdrh -Wc,*) 1167636a995dSmlcreech func_stripname '-Wc,' '' "$arg" 1168636a995dSmlcreech args=$func_stripname_result 116971eb93eaSdrh lastarg= 117062507b65Sa.rottmann save_ifs="$IFS"; IFS=',' 117171eb93eaSdrh for arg in $args; do 117271eb93eaSdrh IFS="$save_ifs" 1173636a995dSmlcreech func_quote_for_eval "$arg" 1174636a995dSmlcreech lastarg="$lastarg $func_quote_for_eval_result" 117571eb93eaSdrh done 117671eb93eaSdrh IFS="$save_ifs" 1177636a995dSmlcreech func_stripname ' ' '' "$lastarg" 1178636a995dSmlcreech lastarg=$func_stripname_result 117971eb93eaSdrh 118071eb93eaSdrh # Add the arguments to base_compile. 118171eb93eaSdrh base_compile="$base_compile $lastarg" 118271eb93eaSdrh continue 118371eb93eaSdrh ;; 118471eb93eaSdrh 1185964dbb1eSa.rottmann *) 118671eb93eaSdrh # Accept the current argument as the source file. 1187964dbb1eSa.rottmann # The previous "srcfile" becomes the current argument. 1188964dbb1eSa.rottmann # 118971eb93eaSdrh lastarg="$srcfile" 119071eb93eaSdrh srcfile="$arg" 1191964dbb1eSa.rottmann ;; 1192964dbb1eSa.rottmann esac # case $arg 1193964dbb1eSa.rottmann ;; 1194964dbb1eSa.rottmann esac # case $arg_mode 119571eb93eaSdrh 119671eb93eaSdrh # Aesthetically quote the previous argument. 1197636a995dSmlcreech func_quote_for_eval "$lastarg" 1198636a995dSmlcreech base_compile="$base_compile $func_quote_for_eval_result" 1199964dbb1eSa.rottmann done # for arg 120071eb93eaSdrh 1201964dbb1eSa.rottmann case $arg_mode in 1202964dbb1eSa.rottmann arg) 1203636a995dSmlcreech func_fatal_error "you must specify an argument for -Xcompile" 120471eb93eaSdrh ;; 1205964dbb1eSa.rottmann target) 1206636a995dSmlcreech func_fatal_error "you must specify a target with \`-o'" 120771eb93eaSdrh ;; 1208964dbb1eSa.rottmann *) 1209964dbb1eSa.rottmann # Get the name of the library object. 1210636a995dSmlcreech test -z "$libobj" && { 1211636a995dSmlcreech func_basename "$srcfile" 1212636a995dSmlcreech libobj="$func_basename_result" 1213636a995dSmlcreech } 1214964dbb1eSa.rottmann ;; 121571eb93eaSdrh esac 121671eb93eaSdrh 121771eb93eaSdrh # Recognize several different file suffixes. 121871eb93eaSdrh # If the user specifies -o file.o, it is replaced with file.lo 121971eb93eaSdrh case $libobj in 1220636a995dSmlcreech *.[cCFSifmso] | \ 1221636a995dSmlcreech *.ada | *.adb | *.ads | *.asm | \ 1222636a995dSmlcreech *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 1223636a995dSmlcreech *.[fF][09]? | *.for | *.java | *.obj | *.sx) 1224636a995dSmlcreech func_xform "$libobj" 1225636a995dSmlcreech libobj=$func_xform_result 1226636a995dSmlcreech ;; 122771eb93eaSdrh esac 122871eb93eaSdrh 122971eb93eaSdrh case $libobj in 1230636a995dSmlcreech *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 123171eb93eaSdrh *) 1232636a995dSmlcreech func_fatal_error "cannot determine name of library object from \`$libobj'" 123371eb93eaSdrh ;; 123471eb93eaSdrh esac 123571eb93eaSdrh 12367f19c02fSvapier func_infer_tag $base_compile 1237964dbb1eSa.rottmann 1238964dbb1eSa.rottmann for arg in $later; do 1239964dbb1eSa.rottmann case $arg in 1240636a995dSmlcreech -shared) 1241636a995dSmlcreech test "$build_libtool_libs" != yes && \ 1242636a995dSmlcreech func_fatal_configuration "can not build a shared library" 1243636a995dSmlcreech build_old_libs=no 1244636a995dSmlcreech continue 1245636a995dSmlcreech ;; 1246636a995dSmlcreech 1247964dbb1eSa.rottmann -static) 1248636a995dSmlcreech build_libtool_libs=no 1249964dbb1eSa.rottmann build_old_libs=yes 1250964dbb1eSa.rottmann continue 1251964dbb1eSa.rottmann ;; 1252964dbb1eSa.rottmann 1253964dbb1eSa.rottmann -prefer-pic) 1254964dbb1eSa.rottmann pic_mode=yes 1255964dbb1eSa.rottmann continue 1256964dbb1eSa.rottmann ;; 1257964dbb1eSa.rottmann 1258964dbb1eSa.rottmann -prefer-non-pic) 1259964dbb1eSa.rottmann pic_mode=no 1260964dbb1eSa.rottmann continue 1261964dbb1eSa.rottmann ;; 1262964dbb1eSa.rottmann esac 1263964dbb1eSa.rottmann done 1264964dbb1eSa.rottmann 1265636a995dSmlcreech func_quote_for_eval "$libobj" 1266636a995dSmlcreech test "X$libobj" != "X$func_quote_for_eval_result" \ 1267636a995dSmlcreech && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 1268636a995dSmlcreech && func_warning "libobj name \`$libobj' may not contain shell special characters." 1269636a995dSmlcreech func_dirname_and_basename "$obj" "/" "" 1270636a995dSmlcreech objname="$func_basename_result" 1271636a995dSmlcreech xdir="$func_dirname_result" 1272964dbb1eSa.rottmann lobj=${xdir}$objdir/$objname 1273964dbb1eSa.rottmann 1274636a995dSmlcreech test -z "$base_compile" && \ 1275636a995dSmlcreech func_fatal_help "you must specify a compilation command" 127671eb93eaSdrh 127771eb93eaSdrh # Delete any leftover library objects. 127871eb93eaSdrh if test "$build_old_libs" = yes; then 1279964dbb1eSa.rottmann removelist="$obj $lobj $libobj ${libobj}T" 128071eb93eaSdrh else 1281964dbb1eSa.rottmann removelist="$lobj $libobj ${libobj}T" 128271eb93eaSdrh fi 128371eb93eaSdrh 128471eb93eaSdrh # On Cygwin there's no "real" PIC flag so we must build both object types 128571eb93eaSdrh case $host_os in 1286*6acb2cf6Svapier cygwin* | mingw* | pw32* | os2* | cegcc*) 128771eb93eaSdrh pic_mode=default 128871eb93eaSdrh ;; 128971eb93eaSdrh esac 129071eb93eaSdrh if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 129171eb93eaSdrh # non-PIC code in shared libraries is not supported 129271eb93eaSdrh pic_mode=default 129371eb93eaSdrh fi 129471eb93eaSdrh 129571eb93eaSdrh # Calculate the filename of the output object if compiler does 129671eb93eaSdrh # not support -o with -c 129771eb93eaSdrh if test "$compiler_c_o" = no; then 1298636a995dSmlcreech output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 129971eb93eaSdrh lockfile="$output_obj.lock" 130071eb93eaSdrh else 1301964dbb1eSa.rottmann output_obj= 130271eb93eaSdrh need_locks=no 130371eb93eaSdrh lockfile= 130471eb93eaSdrh fi 130571eb93eaSdrh 130671eb93eaSdrh # Lock this critical section if it is needed 130771eb93eaSdrh # We use this script file to make the link, it avoids creating a new file 130871eb93eaSdrh if test "$need_locks" = yes; then 1309636a995dSmlcreech until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 1310636a995dSmlcreech func_echo "Waiting for $lockfile to be removed" 131171eb93eaSdrh sleep 2 131271eb93eaSdrh done 131371eb93eaSdrh elif test "$need_locks" = warn; then 131471eb93eaSdrh if test -f "$lockfile"; then 1315636a995dSmlcreech $ECHO "\ 131671eb93eaSdrh*** ERROR, $lockfile exists and contains: 131771eb93eaSdrh`cat $lockfile 2>/dev/null` 131871eb93eaSdrh 131971eb93eaSdrhThis indicates that another process is trying to use the same 132071eb93eaSdrhtemporary object file, and libtool could not work around it because 132171eb93eaSdrhyour compiler does not support \`-c' and \`-o' together. If you 132271eb93eaSdrhrepeat this compilation, it may succeed, by chance, but you had better 132371eb93eaSdrhavoid parallel builds (make -j) in this platform, or get a better 132471eb93eaSdrhcompiler." 132571eb93eaSdrh 1326636a995dSmlcreech $opt_dry_run || $RM $removelist 13277f19c02fSvapier exit $EXIT_FAILURE 132871eb93eaSdrh fi 1329636a995dSmlcreech removelist="$removelist $output_obj" 1330636a995dSmlcreech $ECHO "$srcfile" > "$lockfile" 133171eb93eaSdrh fi 133271eb93eaSdrh 1333636a995dSmlcreech $opt_dry_run || $RM $removelist 1334636a995dSmlcreech removelist="$removelist $lockfile" 1335636a995dSmlcreech trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 1336636a995dSmlcreech 133771eb93eaSdrh if test -n "$fix_srcfile_path"; then 133871eb93eaSdrh eval srcfile=\"$fix_srcfile_path\" 133971eb93eaSdrh fi 1340636a995dSmlcreech func_quote_for_eval "$srcfile" 1341636a995dSmlcreech qsrcfile=$func_quote_for_eval_result 1342964dbb1eSa.rottmann 134371eb93eaSdrh # Only build a PIC object if we are building libtool libraries. 134471eb93eaSdrh if test "$build_libtool_libs" = yes; then 134571eb93eaSdrh # Without this assignment, base_compile gets emptied. 134671eb93eaSdrh fbsd_hideous_sh_bug=$base_compile 134771eb93eaSdrh 134871eb93eaSdrh if test "$pic_mode" != no; then 13497f19c02fSvapier command="$base_compile $qsrcfile $pic_flag" 135071eb93eaSdrh else 135171eb93eaSdrh # Don't build PIC code 13527f19c02fSvapier command="$base_compile $qsrcfile" 135371eb93eaSdrh fi 135471eb93eaSdrh 1355636a995dSmlcreech func_mkdir_p "$xdir$objdir" 1356964dbb1eSa.rottmann 1357964dbb1eSa.rottmann if test -z "$output_obj"; then 1358964dbb1eSa.rottmann # Place PIC objects in $objdir 1359964dbb1eSa.rottmann command="$command -o $lobj" 136071eb93eaSdrh fi 136171eb93eaSdrh 1362636a995dSmlcreech func_show_eval_locale "$command" \ 1363636a995dSmlcreech 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 136471eb93eaSdrh 136571eb93eaSdrh if test "$need_locks" = warn && 1366964dbb1eSa.rottmann test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1367636a995dSmlcreech $ECHO "\ 136871eb93eaSdrh*** ERROR, $lockfile contains: 136971eb93eaSdrh`cat $lockfile 2>/dev/null` 137071eb93eaSdrh 137171eb93eaSdrhbut it should contain: 137271eb93eaSdrh$srcfile 137371eb93eaSdrh 137471eb93eaSdrhThis indicates that another process is trying to use the same 137571eb93eaSdrhtemporary object file, and libtool could not work around it because 137671eb93eaSdrhyour compiler does not support \`-c' and \`-o' together. If you 137771eb93eaSdrhrepeat this compilation, it may succeed, by chance, but you had better 137871eb93eaSdrhavoid parallel builds (make -j) in this platform, or get a better 137971eb93eaSdrhcompiler." 138071eb93eaSdrh 1381636a995dSmlcreech $opt_dry_run || $RM $removelist 13827f19c02fSvapier exit $EXIT_FAILURE 138371eb93eaSdrh fi 138471eb93eaSdrh 138571eb93eaSdrh # Just move the object if needed, then go on to compile the next one 1386964dbb1eSa.rottmann if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 1387636a995dSmlcreech func_show_eval '$MV "$output_obj" "$lobj"' \ 1388636a995dSmlcreech 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 138971eb93eaSdrh fi 139071eb93eaSdrh 139171eb93eaSdrh # Allow error messages only from the first compilation. 1392964dbb1eSa.rottmann if test "$suppress_opt" = yes; then 139371eb93eaSdrh suppress_output=' >/dev/null 2>&1' 139471eb93eaSdrh fi 1395964dbb1eSa.rottmann fi 139671eb93eaSdrh 139771eb93eaSdrh # Only build a position-dependent object if we build old libraries. 139871eb93eaSdrh if test "$build_old_libs" = yes; then 139971eb93eaSdrh if test "$pic_mode" != yes; then 140071eb93eaSdrh # Don't build PIC code 1401636a995dSmlcreech command="$base_compile $qsrcfile$pie_flag" 140271eb93eaSdrh else 14037f19c02fSvapier command="$base_compile $qsrcfile $pic_flag" 140471eb93eaSdrh fi 140571eb93eaSdrh if test "$compiler_c_o" = yes; then 140671eb93eaSdrh command="$command -o $obj" 140771eb93eaSdrh fi 140871eb93eaSdrh 140971eb93eaSdrh # Suppress compiler output if we already did a PIC compilation. 141071eb93eaSdrh command="$command$suppress_output" 1411636a995dSmlcreech func_show_eval_locale "$command" \ 1412636a995dSmlcreech '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 141371eb93eaSdrh 141471eb93eaSdrh if test "$need_locks" = warn && 1415964dbb1eSa.rottmann test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1416636a995dSmlcreech $ECHO "\ 141771eb93eaSdrh*** ERROR, $lockfile contains: 141871eb93eaSdrh`cat $lockfile 2>/dev/null` 141971eb93eaSdrh 142071eb93eaSdrhbut it should contain: 142171eb93eaSdrh$srcfile 142271eb93eaSdrh 142371eb93eaSdrhThis indicates that another process is trying to use the same 142471eb93eaSdrhtemporary object file, and libtool could not work around it because 142571eb93eaSdrhyour compiler does not support \`-c' and \`-o' together. If you 142671eb93eaSdrhrepeat this compilation, it may succeed, by chance, but you had better 142771eb93eaSdrhavoid parallel builds (make -j) in this platform, or get a better 142871eb93eaSdrhcompiler." 142971eb93eaSdrh 1430636a995dSmlcreech $opt_dry_run || $RM $removelist 14317f19c02fSvapier exit $EXIT_FAILURE 143271eb93eaSdrh fi 143371eb93eaSdrh 143471eb93eaSdrh # Just move the object if needed 1435964dbb1eSa.rottmann if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1436636a995dSmlcreech func_show_eval '$MV "$output_obj" "$obj"' \ 1437636a995dSmlcreech 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 143871eb93eaSdrh fi 143971eb93eaSdrh fi 144071eb93eaSdrh 1441636a995dSmlcreech $opt_dry_run || { 1442636a995dSmlcreech func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 144371eb93eaSdrh 144471eb93eaSdrh # Unlock the critical section if it was locked 144571eb93eaSdrh if test "$need_locks" != no; then 1446636a995dSmlcreech removelist=$lockfile 1447636a995dSmlcreech $RM "$lockfile" 1448636a995dSmlcreech fi 1449636a995dSmlcreech } 1450636a995dSmlcreech 1451636a995dSmlcreech exit $EXIT_SUCCESS 1452636a995dSmlcreech} 1453636a995dSmlcreech 1454636a995dSmlcreech$opt_help || { 1455636a995dSmlcreechtest "$mode" = compile && func_mode_compile ${1+"$@"} 1456636a995dSmlcreech} 1457636a995dSmlcreech 1458636a995dSmlcreechfunc_mode_help () 1459636a995dSmlcreech{ 1460636a995dSmlcreech # We need to display help for each of the modes. 1461636a995dSmlcreech case $mode in 1462636a995dSmlcreech "") 1463636a995dSmlcreech # Generic help is extracted from the usage comments 1464636a995dSmlcreech # at the start of this file. 1465636a995dSmlcreech func_help 1466636a995dSmlcreech ;; 1467636a995dSmlcreech 1468636a995dSmlcreech clean) 1469636a995dSmlcreech $ECHO \ 1470636a995dSmlcreech"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 1471636a995dSmlcreech 1472636a995dSmlcreechRemove files from the build directory. 1473636a995dSmlcreech 1474636a995dSmlcreechRM is the name of the program to use to delete files associated with each FILE 1475636a995dSmlcreech(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 1476636a995dSmlcreechto RM. 1477636a995dSmlcreech 1478636a995dSmlcreechIf FILE is a libtool library, object or program, all the files associated 1479636a995dSmlcreechwith it are deleted. Otherwise, only FILE itself is deleted using RM." 1480636a995dSmlcreech ;; 1481636a995dSmlcreech 1482636a995dSmlcreech compile) 1483636a995dSmlcreech $ECHO \ 1484636a995dSmlcreech"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 1485636a995dSmlcreech 1486636a995dSmlcreechCompile a source file into a libtool library object. 1487636a995dSmlcreech 1488636a995dSmlcreechThis mode accepts the following additional options: 1489636a995dSmlcreech 1490636a995dSmlcreech -o OUTPUT-FILE set the output file name to OUTPUT-FILE 1491636a995dSmlcreech -no-suppress do not suppress compiler output for multiple passes 1492636a995dSmlcreech -prefer-pic try to building PIC objects only 1493636a995dSmlcreech -prefer-non-pic try to building non-PIC objects only 1494636a995dSmlcreech -shared do not build a \`.o' file suitable for static linking 1495636a995dSmlcreech -static only build a \`.o' file suitable for static linking 1496636a995dSmlcreech 1497636a995dSmlcreechCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 1498636a995dSmlcreechfrom the given SOURCEFILE. 1499636a995dSmlcreech 1500636a995dSmlcreechThe output file name is determined by removing the directory component from 1501636a995dSmlcreechSOURCEFILE, then substituting the C source code suffix \`.c' with the 1502636a995dSmlcreechlibrary object suffix, \`.lo'." 1503636a995dSmlcreech ;; 1504636a995dSmlcreech 1505636a995dSmlcreech execute) 1506636a995dSmlcreech $ECHO \ 1507636a995dSmlcreech"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 1508636a995dSmlcreech 1509636a995dSmlcreechAutomatically set library path, then run a program. 1510636a995dSmlcreech 1511636a995dSmlcreechThis mode accepts the following additional options: 1512636a995dSmlcreech 1513636a995dSmlcreech -dlopen FILE add the directory containing FILE to the library path 1514636a995dSmlcreech 1515636a995dSmlcreechThis mode sets the library path environment variable according to \`-dlopen' 1516636a995dSmlcreechflags. 1517636a995dSmlcreech 1518636a995dSmlcreechIf any of the ARGS are libtool executable wrappers, then they are translated 1519636a995dSmlcreechinto their corresponding uninstalled binary, and any of their required library 1520636a995dSmlcreechdirectories are added to the library path. 1521636a995dSmlcreech 1522636a995dSmlcreechThen, COMMAND is executed, with ARGS as arguments." 1523636a995dSmlcreech ;; 1524636a995dSmlcreech 1525636a995dSmlcreech finish) 1526636a995dSmlcreech $ECHO \ 1527636a995dSmlcreech"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 1528636a995dSmlcreech 1529636a995dSmlcreechComplete the installation of libtool libraries. 1530636a995dSmlcreech 1531636a995dSmlcreechEach LIBDIR is a directory that contains libtool libraries. 1532636a995dSmlcreech 1533636a995dSmlcreechThe commands that this mode executes may require superuser privileges. Use 1534636a995dSmlcreechthe \`--dry-run' option if you just want to see what would be executed." 1535636a995dSmlcreech ;; 1536636a995dSmlcreech 1537636a995dSmlcreech install) 1538636a995dSmlcreech $ECHO \ 1539636a995dSmlcreech"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 1540636a995dSmlcreech 1541636a995dSmlcreechInstall executables or libraries. 1542636a995dSmlcreech 1543636a995dSmlcreechINSTALL-COMMAND is the installation command. The first component should be 1544636a995dSmlcreecheither the \`install' or \`cp' program. 1545636a995dSmlcreech 1546636a995dSmlcreechThe following components of INSTALL-COMMAND are treated specially: 1547636a995dSmlcreech 1548636a995dSmlcreech -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation 1549636a995dSmlcreech 1550636a995dSmlcreechThe rest of the components are interpreted as arguments to that command (only 1551636a995dSmlcreechBSD-compatible install options are recognized)." 1552636a995dSmlcreech ;; 1553636a995dSmlcreech 1554636a995dSmlcreech link) 1555636a995dSmlcreech $ECHO \ 1556636a995dSmlcreech"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 1557636a995dSmlcreech 1558636a995dSmlcreechLink object files or libraries together to form another library, or to 1559636a995dSmlcreechcreate an executable program. 1560636a995dSmlcreech 1561636a995dSmlcreechLINK-COMMAND is a command using the C compiler that you would use to create 1562636a995dSmlcreecha program from several object files. 1563636a995dSmlcreech 1564636a995dSmlcreechThe following components of LINK-COMMAND are treated specially: 1565636a995dSmlcreech 1566636a995dSmlcreech -all-static do not do any dynamic linking at all 1567636a995dSmlcreech -avoid-version do not add a version suffix if possible 1568636a995dSmlcreech -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 1569636a995dSmlcreech -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 1570636a995dSmlcreech -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 1571636a995dSmlcreech -export-symbols SYMFILE 1572636a995dSmlcreech try to export only the symbols listed in SYMFILE 1573636a995dSmlcreech -export-symbols-regex REGEX 1574636a995dSmlcreech try to export only the symbols matching REGEX 1575636a995dSmlcreech -LLIBDIR search LIBDIR for required installed libraries 1576636a995dSmlcreech -lNAME OUTPUT-FILE requires the installed library libNAME 1577636a995dSmlcreech -module build a library that can dlopened 1578636a995dSmlcreech -no-fast-install disable the fast-install mode 1579636a995dSmlcreech -no-install link a not-installable executable 1580636a995dSmlcreech -no-undefined declare that a library does not refer to external symbols 1581636a995dSmlcreech -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 1582636a995dSmlcreech -objectlist FILE Use a list of object files found in FILE to specify objects 1583636a995dSmlcreech -precious-files-regex REGEX 1584636a995dSmlcreech don't remove output files matching REGEX 1585636a995dSmlcreech -release RELEASE specify package release information 1586636a995dSmlcreech -rpath LIBDIR the created library will eventually be installed in LIBDIR 1587636a995dSmlcreech -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 1588636a995dSmlcreech -shared only do dynamic linking of libtool libraries 1589636a995dSmlcreech -shrext SUFFIX override the standard shared library file extension 1590636a995dSmlcreech -static do not do any dynamic linking of uninstalled libtool libraries 1591636a995dSmlcreech -static-libtool-libs 1592636a995dSmlcreech do not do any dynamic linking of libtool libraries 1593636a995dSmlcreech -version-info CURRENT[:REVISION[:AGE]] 1594636a995dSmlcreech specify library version info [each variable defaults to 0] 1595636a995dSmlcreech -weak LIBNAME declare that the target provides the LIBNAME interface 1596636a995dSmlcreech 1597636a995dSmlcreechAll other options (arguments beginning with \`-') are ignored. 1598636a995dSmlcreech 1599636a995dSmlcreechEvery other argument is treated as a filename. Files ending in \`.la' are 1600636a995dSmlcreechtreated as uninstalled libtool libraries, other files are standard or library 1601636a995dSmlcreechobject files. 1602636a995dSmlcreech 1603636a995dSmlcreechIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 1604636a995dSmlcreechonly library objects (\`.lo' files) may be specified, and \`-rpath' is 1605636a995dSmlcreechrequired, except when creating a convenience library. 1606636a995dSmlcreech 1607636a995dSmlcreechIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 1608636a995dSmlcreechusing \`ar' and \`ranlib', or on Windows using \`lib'. 1609636a995dSmlcreech 1610636a995dSmlcreechIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 1611636a995dSmlcreechis created, otherwise an executable program is created." 1612636a995dSmlcreech ;; 1613636a995dSmlcreech 1614636a995dSmlcreech uninstall) 1615636a995dSmlcreech $ECHO \ 1616636a995dSmlcreech"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 1617636a995dSmlcreech 1618636a995dSmlcreechRemove libraries from an installation directory. 1619636a995dSmlcreech 1620636a995dSmlcreechRM is the name of the program to use to delete files associated with each FILE 1621636a995dSmlcreech(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 1622636a995dSmlcreechto RM. 1623636a995dSmlcreech 1624636a995dSmlcreechIf FILE is a libtool library, all the files associated with it are deleted. 1625636a995dSmlcreechOtherwise, only FILE itself is deleted using RM." 1626636a995dSmlcreech ;; 1627636a995dSmlcreech 1628636a995dSmlcreech *) 1629636a995dSmlcreech func_fatal_help "invalid operation mode \`$mode'" 1630636a995dSmlcreech ;; 1631636a995dSmlcreech esac 1632636a995dSmlcreech 1633636a995dSmlcreech $ECHO 1634636a995dSmlcreech $ECHO "Try \`$progname --help' for more information about other modes." 1635636a995dSmlcreech 1636636a995dSmlcreech exit $? 1637636a995dSmlcreech} 1638636a995dSmlcreech 1639636a995dSmlcreech # Now that we've collected a possible --mode arg, show help if necessary 1640636a995dSmlcreech $opt_help && func_mode_help 1641636a995dSmlcreech 1642636a995dSmlcreech 1643636a995dSmlcreech# func_mode_execute arg... 1644636a995dSmlcreechfunc_mode_execute () 1645636a995dSmlcreech{ 1646636a995dSmlcreech $opt_debug 1647636a995dSmlcreech # The first argument is the command name. 1648636a995dSmlcreech cmd="$nonopt" 1649636a995dSmlcreech test -z "$cmd" && \ 1650636a995dSmlcreech func_fatal_help "you must specify a COMMAND" 1651636a995dSmlcreech 1652636a995dSmlcreech # Handle -dlopen flags immediately. 1653636a995dSmlcreech for file in $execute_dlfiles; do 1654636a995dSmlcreech test -f "$file" \ 1655636a995dSmlcreech || func_fatal_help "\`$file' is not a file" 1656636a995dSmlcreech 1657636a995dSmlcreech dir= 1658636a995dSmlcreech case $file in 1659636a995dSmlcreech *.la) 1660636a995dSmlcreech # Check to see that this really is a libtool archive. 1661636a995dSmlcreech func_lalib_unsafe_p "$file" \ 1662636a995dSmlcreech || func_fatal_help "\`$lib' is not a valid libtool archive" 1663636a995dSmlcreech 1664636a995dSmlcreech # Read the libtool library. 1665636a995dSmlcreech dlname= 1666636a995dSmlcreech library_names= 1667636a995dSmlcreech func_source "$file" 1668636a995dSmlcreech 1669636a995dSmlcreech # Skip this library if it cannot be dlopened. 1670636a995dSmlcreech if test -z "$dlname"; then 1671636a995dSmlcreech # Warn if it was a shared library. 1672636a995dSmlcreech test -n "$library_names" && \ 1673636a995dSmlcreech func_warning "\`$file' was not linked with \`-export-dynamic'" 1674636a995dSmlcreech continue 167571eb93eaSdrh fi 167671eb93eaSdrh 1677636a995dSmlcreech func_dirname "$file" "" "." 1678636a995dSmlcreech dir="$func_dirname_result" 1679636a995dSmlcreech 1680636a995dSmlcreech if test -f "$dir/$objdir/$dlname"; then 1681636a995dSmlcreech dir="$dir/$objdir" 1682636a995dSmlcreech else 1683636a995dSmlcreech if test ! -f "$dir/$dlname"; then 1684636a995dSmlcreech func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1685636a995dSmlcreech fi 1686636a995dSmlcreech fi 1687636a995dSmlcreech ;; 1688636a995dSmlcreech 1689636a995dSmlcreech *.lo) 1690636a995dSmlcreech # Just add the directory containing the .lo file. 1691636a995dSmlcreech func_dirname "$file" "" "." 1692636a995dSmlcreech dir="$func_dirname_result" 1693636a995dSmlcreech ;; 1694636a995dSmlcreech 1695636a995dSmlcreech *) 1696636a995dSmlcreech func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 1697636a995dSmlcreech continue 1698636a995dSmlcreech ;; 1699636a995dSmlcreech esac 1700636a995dSmlcreech 1701636a995dSmlcreech # Get the absolute pathname. 1702636a995dSmlcreech absdir=`cd "$dir" && pwd` 1703636a995dSmlcreech test -n "$absdir" && dir="$absdir" 1704636a995dSmlcreech 1705636a995dSmlcreech # Now add the directory to shlibpath_var. 1706636a995dSmlcreech if eval "test -z \"\$$shlibpath_var\""; then 1707636a995dSmlcreech eval "$shlibpath_var=\"\$dir\"" 1708636a995dSmlcreech else 1709636a995dSmlcreech eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 1710636a995dSmlcreech fi 1711636a995dSmlcreech done 1712636a995dSmlcreech 1713636a995dSmlcreech # This variable tells wrapper scripts just to set shlibpath_var 1714636a995dSmlcreech # rather than running their programs. 1715636a995dSmlcreech libtool_execute_magic="$magic" 1716636a995dSmlcreech 1717636a995dSmlcreech # Check if any of the arguments is a wrapper script. 1718636a995dSmlcreech args= 1719636a995dSmlcreech for file 1720636a995dSmlcreech do 1721636a995dSmlcreech case $file in 1722636a995dSmlcreech -*) ;; 1723636a995dSmlcreech *) 1724636a995dSmlcreech # Do a test to see if this is really a libtool program. 1725636a995dSmlcreech if func_ltwrapper_script_p "$file"; then 1726636a995dSmlcreech func_source "$file" 1727636a995dSmlcreech # Transform arg to wrapped name. 1728636a995dSmlcreech file="$progdir/$program" 1729636a995dSmlcreech elif func_ltwrapper_executable_p "$file"; then 1730636a995dSmlcreech func_ltwrapper_scriptname "$file" 1731636a995dSmlcreech func_source "$func_ltwrapper_scriptname_result" 1732636a995dSmlcreech # Transform arg to wrapped name. 1733636a995dSmlcreech file="$progdir/$program" 1734636a995dSmlcreech fi 1735636a995dSmlcreech ;; 1736636a995dSmlcreech esac 1737636a995dSmlcreech # Quote arguments (to preserve shell metacharacters). 1738636a995dSmlcreech func_quote_for_eval "$file" 1739636a995dSmlcreech args="$args $func_quote_for_eval_result" 1740636a995dSmlcreech done 1741636a995dSmlcreech 1742636a995dSmlcreech if test "X$opt_dry_run" = Xfalse; then 1743636a995dSmlcreech if test -n "$shlibpath_var"; then 1744636a995dSmlcreech # Export the shlibpath_var. 1745636a995dSmlcreech eval "export $shlibpath_var" 1746636a995dSmlcreech fi 1747636a995dSmlcreech 1748636a995dSmlcreech # Restore saved environment variables 1749636a995dSmlcreech for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 1750636a995dSmlcreech do 1751636a995dSmlcreech eval "if test \"\${save_$lt_var+set}\" = set; then 1752636a995dSmlcreech $lt_var=\$save_$lt_var; export $lt_var 1753636a995dSmlcreech else 1754636a995dSmlcreech $lt_unset $lt_var 1755636a995dSmlcreech fi" 1756636a995dSmlcreech done 1757636a995dSmlcreech 1758636a995dSmlcreech # Now prepare to actually exec the command. 1759636a995dSmlcreech exec_cmd="\$cmd$args" 1760636a995dSmlcreech else 1761636a995dSmlcreech # Display what would be done. 1762636a995dSmlcreech if test -n "$shlibpath_var"; then 1763636a995dSmlcreech eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 1764636a995dSmlcreech $ECHO "export $shlibpath_var" 1765636a995dSmlcreech fi 1766636a995dSmlcreech $ECHO "$cmd$args" 1767636a995dSmlcreech exit $EXIT_SUCCESS 1768636a995dSmlcreech fi 1769636a995dSmlcreech} 1770636a995dSmlcreech 1771636a995dSmlcreechtest "$mode" = execute && func_mode_execute ${1+"$@"} 1772636a995dSmlcreech 1773636a995dSmlcreech 1774636a995dSmlcreech# func_mode_finish arg... 1775636a995dSmlcreechfunc_mode_finish () 1776636a995dSmlcreech{ 1777636a995dSmlcreech $opt_debug 1778636a995dSmlcreech libdirs="$nonopt" 1779636a995dSmlcreech admincmds= 1780636a995dSmlcreech 1781636a995dSmlcreech if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 1782636a995dSmlcreech for dir 1783636a995dSmlcreech do 1784636a995dSmlcreech libdirs="$libdirs $dir" 1785636a995dSmlcreech done 1786636a995dSmlcreech 1787636a995dSmlcreech for libdir in $libdirs; do 1788636a995dSmlcreech if test -n "$finish_cmds"; then 1789636a995dSmlcreech # Do each command in the finish commands. 1790636a995dSmlcreech func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 1791636a995dSmlcreech'"$cmd"'"' 1792636a995dSmlcreech fi 1793636a995dSmlcreech if test -n "$finish_eval"; then 1794636a995dSmlcreech # Do the single finish_eval. 1795636a995dSmlcreech eval cmds=\"$finish_eval\" 1796636a995dSmlcreech $opt_dry_run || eval "$cmds" || admincmds="$admincmds 1797636a995dSmlcreech $cmds" 1798636a995dSmlcreech fi 1799636a995dSmlcreech done 1800636a995dSmlcreech fi 1801636a995dSmlcreech 1802636a995dSmlcreech # Exit here if they wanted silent mode. 1803636a995dSmlcreech $opt_silent && exit $EXIT_SUCCESS 1804636a995dSmlcreech 1805636a995dSmlcreech $ECHO "X----------------------------------------------------------------------" | $Xsed 1806636a995dSmlcreech $ECHO "Libraries have been installed in:" 1807636a995dSmlcreech for libdir in $libdirs; do 1808636a995dSmlcreech $ECHO " $libdir" 1809636a995dSmlcreech done 1810636a995dSmlcreech $ECHO 1811636a995dSmlcreech $ECHO "If you ever happen to want to link against installed libraries" 1812636a995dSmlcreech $ECHO "in a given directory, LIBDIR, you must either use libtool, and" 1813636a995dSmlcreech $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" 1814636a995dSmlcreech $ECHO "flag during linking and do at least one of the following:" 1815636a995dSmlcreech if test -n "$shlibpath_var"; then 1816636a995dSmlcreech $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" 1817636a995dSmlcreech $ECHO " during execution" 1818636a995dSmlcreech fi 1819636a995dSmlcreech if test -n "$runpath_var"; then 1820636a995dSmlcreech $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" 1821636a995dSmlcreech $ECHO " during linking" 1822636a995dSmlcreech fi 1823636a995dSmlcreech if test -n "$hardcode_libdir_flag_spec"; then 1824636a995dSmlcreech libdir=LIBDIR 1825636a995dSmlcreech eval flag=\"$hardcode_libdir_flag_spec\" 1826636a995dSmlcreech 1827636a995dSmlcreech $ECHO " - use the \`$flag' linker flag" 1828636a995dSmlcreech fi 1829636a995dSmlcreech if test -n "$admincmds"; then 1830636a995dSmlcreech $ECHO " - have your system administrator run these commands:$admincmds" 1831636a995dSmlcreech fi 1832636a995dSmlcreech if test -f /etc/ld.so.conf; then 1833636a995dSmlcreech $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 1834636a995dSmlcreech fi 1835636a995dSmlcreech $ECHO 1836636a995dSmlcreech 1837636a995dSmlcreech $ECHO "See any operating system documentation about shared libraries for" 1838636a995dSmlcreech case $host in 1839636a995dSmlcreech solaris2.[6789]|solaris2.1[0-9]) 1840636a995dSmlcreech $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" 1841636a995dSmlcreech $ECHO "pages." 1842636a995dSmlcreech ;; 1843636a995dSmlcreech *) 1844636a995dSmlcreech $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." 1845636a995dSmlcreech ;; 1846636a995dSmlcreech esac 1847636a995dSmlcreech $ECHO "X----------------------------------------------------------------------" | $Xsed 1848636a995dSmlcreech exit $EXIT_SUCCESS 1849636a995dSmlcreech} 1850636a995dSmlcreech 1851636a995dSmlcreechtest "$mode" = finish && func_mode_finish ${1+"$@"} 1852636a995dSmlcreech 1853636a995dSmlcreech 1854636a995dSmlcreech# func_mode_install arg... 1855636a995dSmlcreechfunc_mode_install () 1856636a995dSmlcreech{ 1857636a995dSmlcreech $opt_debug 1858636a995dSmlcreech # There may be an optional sh(1) argument at the beginning of 1859636a995dSmlcreech # install_prog (especially on Windows NT). 1860636a995dSmlcreech if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 1861636a995dSmlcreech # Allow the use of GNU shtool's install command. 1862636a995dSmlcreech $ECHO "X$nonopt" | $GREP shtool >/dev/null; then 1863636a995dSmlcreech # Aesthetically quote it. 1864636a995dSmlcreech func_quote_for_eval "$nonopt" 1865636a995dSmlcreech install_prog="$func_quote_for_eval_result " 1866636a995dSmlcreech arg=$1 1867636a995dSmlcreech shift 1868636a995dSmlcreech else 1869636a995dSmlcreech install_prog= 1870636a995dSmlcreech arg=$nonopt 1871636a995dSmlcreech fi 1872636a995dSmlcreech 1873636a995dSmlcreech # The real first argument should be the name of the installation program. 1874636a995dSmlcreech # Aesthetically quote it. 1875636a995dSmlcreech func_quote_for_eval "$arg" 1876636a995dSmlcreech install_prog="$install_prog$func_quote_for_eval_result" 1877636a995dSmlcreech 1878636a995dSmlcreech # We need to accept at least all the BSD install flags. 1879636a995dSmlcreech dest= 1880636a995dSmlcreech files= 1881636a995dSmlcreech opts= 1882636a995dSmlcreech prev= 1883636a995dSmlcreech install_type= 1884636a995dSmlcreech isdir=no 1885636a995dSmlcreech stripme= 1886636a995dSmlcreech for arg 1887636a995dSmlcreech do 1888636a995dSmlcreech if test -n "$dest"; then 1889636a995dSmlcreech files="$files $dest" 1890636a995dSmlcreech dest=$arg 1891636a995dSmlcreech continue 1892636a995dSmlcreech fi 1893636a995dSmlcreech 1894636a995dSmlcreech case $arg in 1895636a995dSmlcreech -d) isdir=yes ;; 1896636a995dSmlcreech -f) 1897636a995dSmlcreech case " $install_prog " in 1898636a995dSmlcreech *[\\\ /]cp\ *) ;; 1899636a995dSmlcreech *) prev=$arg ;; 1900636a995dSmlcreech esac 1901636a995dSmlcreech ;; 1902636a995dSmlcreech -g | -m | -o) 1903636a995dSmlcreech prev=$arg 1904636a995dSmlcreech ;; 1905636a995dSmlcreech -s) 1906636a995dSmlcreech stripme=" -s" 1907636a995dSmlcreech continue 1908636a995dSmlcreech ;; 1909636a995dSmlcreech -*) 1910636a995dSmlcreech ;; 1911636a995dSmlcreech *) 1912636a995dSmlcreech # If the previous option needed an argument, then skip it. 1913636a995dSmlcreech if test -n "$prev"; then 1914636a995dSmlcreech prev= 1915636a995dSmlcreech else 1916636a995dSmlcreech dest=$arg 1917636a995dSmlcreech continue 1918636a995dSmlcreech fi 1919636a995dSmlcreech ;; 1920636a995dSmlcreech esac 1921636a995dSmlcreech 1922636a995dSmlcreech # Aesthetically quote the argument. 1923636a995dSmlcreech func_quote_for_eval "$arg" 1924636a995dSmlcreech install_prog="$install_prog $func_quote_for_eval_result" 1925636a995dSmlcreech done 1926636a995dSmlcreech 1927636a995dSmlcreech test -z "$install_prog" && \ 1928636a995dSmlcreech func_fatal_help "you must specify an install program" 1929636a995dSmlcreech 1930636a995dSmlcreech test -n "$prev" && \ 1931636a995dSmlcreech func_fatal_help "the \`$prev' option requires an argument" 1932636a995dSmlcreech 1933636a995dSmlcreech if test -z "$files"; then 1934636a995dSmlcreech if test -z "$dest"; then 1935636a995dSmlcreech func_fatal_help "no file or destination specified" 1936636a995dSmlcreech else 1937636a995dSmlcreech func_fatal_help "you must specify a destination" 1938636a995dSmlcreech fi 1939636a995dSmlcreech fi 1940636a995dSmlcreech 1941636a995dSmlcreech # Strip any trailing slash from the destination. 1942636a995dSmlcreech func_stripname '' '/' "$dest" 1943636a995dSmlcreech dest=$func_stripname_result 1944636a995dSmlcreech 1945636a995dSmlcreech # Check to see that the destination is a directory. 1946636a995dSmlcreech test -d "$dest" && isdir=yes 1947636a995dSmlcreech if test "$isdir" = yes; then 1948636a995dSmlcreech destdir="$dest" 1949636a995dSmlcreech destname= 1950636a995dSmlcreech else 1951636a995dSmlcreech func_dirname_and_basename "$dest" "" "." 1952636a995dSmlcreech destdir="$func_dirname_result" 1953636a995dSmlcreech destname="$func_basename_result" 1954636a995dSmlcreech 1955636a995dSmlcreech # Not a directory, so check to see that there is only one file specified. 1956636a995dSmlcreech set dummy $files; shift 1957636a995dSmlcreech test "$#" -gt 1 && \ 1958636a995dSmlcreech func_fatal_help "\`$dest' is not a directory" 1959636a995dSmlcreech fi 1960636a995dSmlcreech case $destdir in 1961636a995dSmlcreech [\\/]* | [A-Za-z]:[\\/]*) ;; 1962636a995dSmlcreech *) 1963636a995dSmlcreech for file in $files; do 1964636a995dSmlcreech case $file in 1965636a995dSmlcreech *.lo) ;; 1966636a995dSmlcreech *) 1967636a995dSmlcreech func_fatal_help "\`$destdir' must be an absolute directory name" 1968636a995dSmlcreech ;; 1969636a995dSmlcreech esac 1970636a995dSmlcreech done 1971636a995dSmlcreech ;; 1972636a995dSmlcreech esac 1973636a995dSmlcreech 1974636a995dSmlcreech # This variable tells wrapper scripts just to set variables rather 1975636a995dSmlcreech # than running their programs. 1976636a995dSmlcreech libtool_install_magic="$magic" 1977636a995dSmlcreech 1978636a995dSmlcreech staticlibs= 1979636a995dSmlcreech future_libdirs= 1980636a995dSmlcreech current_libdirs= 1981636a995dSmlcreech for file in $files; do 1982636a995dSmlcreech 1983636a995dSmlcreech # Do each installation. 1984636a995dSmlcreech case $file in 1985636a995dSmlcreech *.$libext) 1986636a995dSmlcreech # Do the static libraries later. 1987636a995dSmlcreech staticlibs="$staticlibs $file" 1988636a995dSmlcreech ;; 1989636a995dSmlcreech 1990636a995dSmlcreech *.la) 1991636a995dSmlcreech # Check to see that this really is a libtool archive. 1992636a995dSmlcreech func_lalib_unsafe_p "$file" \ 1993636a995dSmlcreech || func_fatal_help "\`$file' is not a valid libtool archive" 1994636a995dSmlcreech 1995636a995dSmlcreech library_names= 1996636a995dSmlcreech old_library= 1997636a995dSmlcreech relink_command= 1998636a995dSmlcreech func_source "$file" 1999636a995dSmlcreech 2000636a995dSmlcreech # Add the libdir to current_libdirs if it is the destination. 2001636a995dSmlcreech if test "X$destdir" = "X$libdir"; then 2002636a995dSmlcreech case "$current_libdirs " in 2003636a995dSmlcreech *" $libdir "*) ;; 2004636a995dSmlcreech *) current_libdirs="$current_libdirs $libdir" ;; 2005636a995dSmlcreech esac 2006636a995dSmlcreech else 2007636a995dSmlcreech # Note the libdir as a future libdir. 2008636a995dSmlcreech case "$future_libdirs " in 2009636a995dSmlcreech *" $libdir "*) ;; 2010636a995dSmlcreech *) future_libdirs="$future_libdirs $libdir" ;; 2011636a995dSmlcreech esac 2012636a995dSmlcreech fi 2013636a995dSmlcreech 2014636a995dSmlcreech func_dirname "$file" "/" "" 2015636a995dSmlcreech dir="$func_dirname_result" 2016636a995dSmlcreech dir="$dir$objdir" 2017636a995dSmlcreech 2018636a995dSmlcreech if test -n "$relink_command"; then 2019636a995dSmlcreech # Determine the prefix the user has applied to our future dir. 2020636a995dSmlcreech inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` 2021636a995dSmlcreech 2022636a995dSmlcreech # Don't allow the user to place us outside of our expected 2023636a995dSmlcreech # location b/c this prevents finding dependent libraries that 2024636a995dSmlcreech # are installed to the same prefix. 2025636a995dSmlcreech # At present, this check doesn't affect windows .dll's that 2026636a995dSmlcreech # are installed into $libdir/../bin (currently, that works fine) 2027636a995dSmlcreech # but it's something to keep an eye on. 2028636a995dSmlcreech test "$inst_prefix_dir" = "$destdir" && \ 2029636a995dSmlcreech func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2030636a995dSmlcreech 2031636a995dSmlcreech if test -n "$inst_prefix_dir"; then 2032636a995dSmlcreech # Stick the inst_prefix_dir data into the link command. 2033636a995dSmlcreech relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2034636a995dSmlcreech else 2035636a995dSmlcreech relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` 2036636a995dSmlcreech fi 2037636a995dSmlcreech 2038636a995dSmlcreech func_warning "relinking \`$file'" 2039636a995dSmlcreech func_show_eval "$relink_command" \ 2040636a995dSmlcreech 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2041636a995dSmlcreech fi 2042636a995dSmlcreech 2043636a995dSmlcreech # See the names of the shared library. 2044636a995dSmlcreech set dummy $library_names; shift 2045636a995dSmlcreech if test -n "$1"; then 2046636a995dSmlcreech realname="$1" 2047636a995dSmlcreech shift 2048636a995dSmlcreech 2049636a995dSmlcreech srcname="$realname" 2050636a995dSmlcreech test -n "$relink_command" && srcname="$realname"T 2051636a995dSmlcreech 2052636a995dSmlcreech # Install the shared library and build the symlinks. 2053636a995dSmlcreech func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ 2054636a995dSmlcreech 'exit $?' 2055636a995dSmlcreech tstripme="$stripme" 2056636a995dSmlcreech case $host_os in 2057*6acb2cf6Svapier cygwin* | mingw* | pw32* | cegcc*) 2058636a995dSmlcreech case $realname in 2059636a995dSmlcreech *.dll.a) 2060636a995dSmlcreech tstripme="" 2061636a995dSmlcreech ;; 2062636a995dSmlcreech esac 2063636a995dSmlcreech ;; 2064636a995dSmlcreech esac 2065636a995dSmlcreech if test -n "$tstripme" && test -n "$striplib"; then 2066636a995dSmlcreech func_show_eval "$striplib $destdir/$realname" 'exit $?' 2067636a995dSmlcreech fi 2068636a995dSmlcreech 2069636a995dSmlcreech if test "$#" -gt 0; then 2070636a995dSmlcreech # Delete the old symlinks, and create new ones. 2071636a995dSmlcreech # Try `ln -sf' first, because the `ln' binary might depend on 2072636a995dSmlcreech # the symlink we replace! Solaris /bin/ln does not understand -f, 2073636a995dSmlcreech # so we also need to try rm && ln -s. 2074636a995dSmlcreech for linkname 2075636a995dSmlcreech do 2076636a995dSmlcreech test "$linkname" != "$realname" \ 2077636a995dSmlcreech && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 2078636a995dSmlcreech done 2079636a995dSmlcreech fi 2080636a995dSmlcreech 2081636a995dSmlcreech # Do each command in the postinstall commands. 2082636a995dSmlcreech lib="$destdir/$realname" 2083636a995dSmlcreech func_execute_cmds "$postinstall_cmds" 'exit $?' 2084636a995dSmlcreech fi 2085636a995dSmlcreech 2086636a995dSmlcreech # Install the pseudo-library for information purposes. 2087636a995dSmlcreech func_basename "$file" 2088636a995dSmlcreech name="$func_basename_result" 2089636a995dSmlcreech instname="$dir/$name"i 2090636a995dSmlcreech func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 2091636a995dSmlcreech 2092636a995dSmlcreech # Maybe install the static library, too. 2093636a995dSmlcreech test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 2094636a995dSmlcreech ;; 2095636a995dSmlcreech 2096636a995dSmlcreech *.lo) 2097636a995dSmlcreech # Install (i.e. copy) a libtool object. 2098636a995dSmlcreech 2099636a995dSmlcreech # Figure out destination file name, if it wasn't already specified. 2100636a995dSmlcreech if test -n "$destname"; then 2101636a995dSmlcreech destfile="$destdir/$destname" 2102636a995dSmlcreech else 2103636a995dSmlcreech func_basename "$file" 2104636a995dSmlcreech destfile="$func_basename_result" 2105636a995dSmlcreech destfile="$destdir/$destfile" 2106636a995dSmlcreech fi 2107636a995dSmlcreech 2108636a995dSmlcreech # Deduce the name of the destination old-style object file. 2109636a995dSmlcreech case $destfile in 2110636a995dSmlcreech *.lo) 2111636a995dSmlcreech func_lo2o "$destfile" 2112636a995dSmlcreech staticdest=$func_lo2o_result 2113636a995dSmlcreech ;; 2114636a995dSmlcreech *.$objext) 2115636a995dSmlcreech staticdest="$destfile" 2116636a995dSmlcreech destfile= 2117636a995dSmlcreech ;; 2118636a995dSmlcreech *) 2119636a995dSmlcreech func_fatal_help "cannot copy a libtool object to \`$destfile'" 2120636a995dSmlcreech ;; 2121636a995dSmlcreech esac 2122636a995dSmlcreech 2123636a995dSmlcreech # Install the libtool object if requested. 2124636a995dSmlcreech test -n "$destfile" && \ 2125636a995dSmlcreech func_show_eval "$install_prog $file $destfile" 'exit $?' 2126636a995dSmlcreech 2127636a995dSmlcreech # Install the old object if enabled. 2128636a995dSmlcreech if test "$build_old_libs" = yes; then 2129636a995dSmlcreech # Deduce the name of the old-style object file. 2130636a995dSmlcreech func_lo2o "$file" 2131636a995dSmlcreech staticobj=$func_lo2o_result 2132636a995dSmlcreech func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 2133636a995dSmlcreech fi 21347f19c02fSvapier exit $EXIT_SUCCESS 213571eb93eaSdrh ;; 213671eb93eaSdrh 2137636a995dSmlcreech *) 2138636a995dSmlcreech # Figure out destination file name, if it wasn't already specified. 2139636a995dSmlcreech if test -n "$destname"; then 2140636a995dSmlcreech destfile="$destdir/$destname" 2141636a995dSmlcreech else 2142636a995dSmlcreech func_basename "$file" 2143636a995dSmlcreech destfile="$func_basename_result" 2144636a995dSmlcreech destfile="$destdir/$destfile" 2145636a995dSmlcreech fi 2146636a995dSmlcreech 2147636a995dSmlcreech # If the file is missing, and there is a .exe on the end, strip it 2148636a995dSmlcreech # because it is most likely a libtool script we actually want to 2149636a995dSmlcreech # install 2150636a995dSmlcreech stripped_ext="" 2151636a995dSmlcreech case $file in 2152636a995dSmlcreech *.exe) 2153636a995dSmlcreech if test ! -f "$file"; then 2154636a995dSmlcreech func_stripname '' '.exe' "$file" 2155636a995dSmlcreech file=$func_stripname_result 2156636a995dSmlcreech stripped_ext=".exe" 2157636a995dSmlcreech fi 2158636a995dSmlcreech ;; 2159636a995dSmlcreech esac 2160636a995dSmlcreech 2161636a995dSmlcreech # Do a test to see if this is really a libtool program. 2162636a995dSmlcreech case $host in 2163636a995dSmlcreech *cygwin* | *mingw*) 2164636a995dSmlcreech if func_ltwrapper_executable_p "$file"; then 2165636a995dSmlcreech func_ltwrapper_scriptname "$file" 2166636a995dSmlcreech wrapper=$func_ltwrapper_scriptname_result 2167636a995dSmlcreech else 2168636a995dSmlcreech func_stripname '' '.exe' "$file" 2169636a995dSmlcreech wrapper=$func_stripname_result 2170636a995dSmlcreech fi 2171636a995dSmlcreech ;; 2172636a995dSmlcreech *) 2173636a995dSmlcreech wrapper=$file 2174636a995dSmlcreech ;; 2175636a995dSmlcreech esac 2176636a995dSmlcreech if func_ltwrapper_script_p "$wrapper"; then 2177636a995dSmlcreech notinst_deplibs= 2178636a995dSmlcreech relink_command= 2179636a995dSmlcreech 2180636a995dSmlcreech func_source "$wrapper" 2181636a995dSmlcreech 2182636a995dSmlcreech # Check the variables that should have been set. 2183636a995dSmlcreech test -z "$generated_by_libtool_version" && \ 2184636a995dSmlcreech func_fatal_error "invalid libtool wrapper script \`$wrapper'" 2185636a995dSmlcreech 2186636a995dSmlcreech finalize=yes 2187636a995dSmlcreech for lib in $notinst_deplibs; do 2188636a995dSmlcreech # Check to see that each library is installed. 2189636a995dSmlcreech libdir= 2190636a995dSmlcreech if test -f "$lib"; then 2191636a995dSmlcreech func_source "$lib" 2192636a995dSmlcreech fi 2193636a995dSmlcreech libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 2194636a995dSmlcreech if test -n "$libdir" && test ! -f "$libfile"; then 2195636a995dSmlcreech func_warning "\`$lib' has not been installed in \`$libdir'" 2196636a995dSmlcreech finalize=no 2197636a995dSmlcreech fi 2198636a995dSmlcreech done 2199636a995dSmlcreech 2200636a995dSmlcreech relink_command= 2201636a995dSmlcreech func_source "$wrapper" 2202636a995dSmlcreech 2203636a995dSmlcreech outputname= 2204636a995dSmlcreech if test "$fast_install" = no && test -n "$relink_command"; then 2205636a995dSmlcreech $opt_dry_run || { 2206636a995dSmlcreech if test "$finalize" = yes; then 2207636a995dSmlcreech tmpdir=`func_mktempdir` 2208636a995dSmlcreech func_basename "$file$stripped_ext" 2209636a995dSmlcreech file="$func_basename_result" 2210636a995dSmlcreech outputname="$tmpdir/$file" 2211636a995dSmlcreech # Replace the output file specification. 2212636a995dSmlcreech relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 2213636a995dSmlcreech 2214636a995dSmlcreech $opt_silent || { 2215636a995dSmlcreech func_quote_for_expand "$relink_command" 2216636a995dSmlcreech eval "func_echo $func_quote_for_expand_result" 2217636a995dSmlcreech } 2218636a995dSmlcreech if eval "$relink_command"; then : 2219636a995dSmlcreech else 2220636a995dSmlcreech func_error "error: relink \`$file' with the above command before installing it" 2221636a995dSmlcreech $opt_dry_run || ${RM}r "$tmpdir" 2222636a995dSmlcreech continue 2223636a995dSmlcreech fi 2224636a995dSmlcreech file="$outputname" 2225636a995dSmlcreech else 2226636a995dSmlcreech func_warning "cannot relink \`$file'" 2227636a995dSmlcreech fi 2228636a995dSmlcreech } 2229636a995dSmlcreech else 2230636a995dSmlcreech # Install the binary that we compiled earlier. 2231636a995dSmlcreech file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 2232636a995dSmlcreech fi 2233636a995dSmlcreech fi 2234636a995dSmlcreech 2235636a995dSmlcreech # remove .exe since cygwin /usr/bin/install will append another 2236636a995dSmlcreech # one anyway 2237636a995dSmlcreech case $install_prog,$host in 2238636a995dSmlcreech */usr/bin/install*,*cygwin*) 2239636a995dSmlcreech case $file:$destfile in 2240636a995dSmlcreech *.exe:*.exe) 2241636a995dSmlcreech # this is ok 2242636a995dSmlcreech ;; 2243636a995dSmlcreech *.exe:*) 2244636a995dSmlcreech destfile=$destfile.exe 2245636a995dSmlcreech ;; 2246636a995dSmlcreech *:*.exe) 2247636a995dSmlcreech func_stripname '' '.exe' "$destfile" 2248636a995dSmlcreech destfile=$func_stripname_result 2249636a995dSmlcreech ;; 2250636a995dSmlcreech esac 2251636a995dSmlcreech ;; 2252636a995dSmlcreech esac 2253636a995dSmlcreech func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 2254636a995dSmlcreech $opt_dry_run || if test -n "$outputname"; then 2255636a995dSmlcreech ${RM}r "$tmpdir" 2256636a995dSmlcreech fi 2257636a995dSmlcreech ;; 2258636a995dSmlcreech esac 2259636a995dSmlcreech done 2260636a995dSmlcreech 2261636a995dSmlcreech for file in $staticlibs; do 2262636a995dSmlcreech func_basename "$file" 2263636a995dSmlcreech name="$func_basename_result" 2264636a995dSmlcreech 2265636a995dSmlcreech # Set up the ranlib parameters. 2266636a995dSmlcreech oldlib="$destdir/$name" 2267636a995dSmlcreech 2268636a995dSmlcreech func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 2269636a995dSmlcreech 2270636a995dSmlcreech if test -n "$stripme" && test -n "$old_striplib"; then 2271636a995dSmlcreech func_show_eval "$old_striplib $oldlib" 'exit $?' 2272636a995dSmlcreech fi 2273636a995dSmlcreech 2274636a995dSmlcreech # Do each command in the postinstall commands. 2275636a995dSmlcreech func_execute_cmds "$old_postinstall_cmds" 'exit $?' 2276636a995dSmlcreech done 2277636a995dSmlcreech 2278636a995dSmlcreech test -n "$future_libdirs" && \ 2279636a995dSmlcreech func_warning "remember to run \`$progname --finish$future_libdirs'" 2280636a995dSmlcreech 2281636a995dSmlcreech if test -n "$current_libdirs"; then 2282636a995dSmlcreech # Maybe just do a dry run. 2283636a995dSmlcreech $opt_dry_run && current_libdirs=" -n$current_libdirs" 2284636a995dSmlcreech exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 2285636a995dSmlcreech else 2286636a995dSmlcreech exit $EXIT_SUCCESS 2287636a995dSmlcreech fi 2288636a995dSmlcreech} 2289636a995dSmlcreech 2290636a995dSmlcreechtest "$mode" = install && func_mode_install ${1+"$@"} 2291636a995dSmlcreech 2292636a995dSmlcreech 2293636a995dSmlcreech# func_generate_dlsyms outputname originator pic_p 2294636a995dSmlcreech# Extract symbols from dlprefiles and create ${outputname}S.o with 2295636a995dSmlcreech# a dlpreopen symbol table. 2296636a995dSmlcreechfunc_generate_dlsyms () 2297636a995dSmlcreech{ 2298636a995dSmlcreech $opt_debug 2299636a995dSmlcreech my_outputname="$1" 2300636a995dSmlcreech my_originator="$2" 2301636a995dSmlcreech my_pic_p="${3-no}" 2302636a995dSmlcreech my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 2303636a995dSmlcreech my_dlsyms= 2304636a995dSmlcreech 2305636a995dSmlcreech if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 2306636a995dSmlcreech if test -n "$NM" && test -n "$global_symbol_pipe"; then 2307636a995dSmlcreech my_dlsyms="${my_outputname}S.c" 2308636a995dSmlcreech else 2309636a995dSmlcreech func_error "not configured to extract global symbols from dlpreopened files" 2310636a995dSmlcreech fi 2311636a995dSmlcreech fi 2312636a995dSmlcreech 2313636a995dSmlcreech if test -n "$my_dlsyms"; then 2314636a995dSmlcreech case $my_dlsyms in 2315636a995dSmlcreech "") ;; 2316636a995dSmlcreech *.c) 2317636a995dSmlcreech # Discover the nlist of each of the dlfiles. 2318636a995dSmlcreech nlist="$output_objdir/${my_outputname}.nm" 2319636a995dSmlcreech 2320636a995dSmlcreech func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 2321636a995dSmlcreech 2322636a995dSmlcreech # Parse the name list into a source file. 2323636a995dSmlcreech func_verbose "creating $output_objdir/$my_dlsyms" 2324636a995dSmlcreech 2325636a995dSmlcreech $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 2326636a995dSmlcreech/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 2327636a995dSmlcreech/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 2328636a995dSmlcreech 2329636a995dSmlcreech#ifdef __cplusplus 2330636a995dSmlcreechextern \"C\" { 2331636a995dSmlcreech#endif 2332636a995dSmlcreech 2333636a995dSmlcreech/* External symbol declarations for the compiler. */\ 2334636a995dSmlcreech" 2335636a995dSmlcreech 2336636a995dSmlcreech if test "$dlself" = yes; then 2337636a995dSmlcreech func_verbose "generating symbol list for \`$output'" 2338636a995dSmlcreech 2339636a995dSmlcreech $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 2340636a995dSmlcreech 2341636a995dSmlcreech # Add our own program objects to the symbol list. 2342636a995dSmlcreech progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 2343636a995dSmlcreech for progfile in $progfiles; do 2344636a995dSmlcreech func_verbose "extracting global C symbols from \`$progfile'" 2345636a995dSmlcreech $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" 2346636a995dSmlcreech done 2347636a995dSmlcreech 2348636a995dSmlcreech if test -n "$exclude_expsyms"; then 2349636a995dSmlcreech $opt_dry_run || { 2350636a995dSmlcreech eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 2351636a995dSmlcreech eval '$MV "$nlist"T "$nlist"' 2352636a995dSmlcreech } 2353636a995dSmlcreech fi 2354636a995dSmlcreech 2355636a995dSmlcreech if test -n "$export_symbols_regex"; then 2356636a995dSmlcreech $opt_dry_run || { 2357636a995dSmlcreech eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 2358636a995dSmlcreech eval '$MV "$nlist"T "$nlist"' 2359636a995dSmlcreech } 2360636a995dSmlcreech fi 2361636a995dSmlcreech 2362636a995dSmlcreech # Prepare the list of exported symbols 2363636a995dSmlcreech if test -z "$export_symbols"; then 2364636a995dSmlcreech export_symbols="$output_objdir/$outputname.exp" 2365636a995dSmlcreech $opt_dry_run || { 2366636a995dSmlcreech $RM $export_symbols 2367636a995dSmlcreech eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 2368636a995dSmlcreech case $host in 2369*6acb2cf6Svapier *cygwin* | *mingw* | *cegcc* ) 2370636a995dSmlcreech eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 2371636a995dSmlcreech eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 2372636a995dSmlcreech ;; 2373636a995dSmlcreech esac 2374636a995dSmlcreech } 2375636a995dSmlcreech else 2376636a995dSmlcreech $opt_dry_run || { 2377636a995dSmlcreech eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 2378636a995dSmlcreech eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 2379636a995dSmlcreech eval '$MV "$nlist"T "$nlist"' 2380636a995dSmlcreech case $host in 2381*6acb2cf6Svapier *cygwin | *mingw* | *cegcc* ) 2382636a995dSmlcreech eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 2383636a995dSmlcreech eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 2384636a995dSmlcreech ;; 2385636a995dSmlcreech esac 2386636a995dSmlcreech } 2387636a995dSmlcreech fi 2388636a995dSmlcreech fi 2389636a995dSmlcreech 2390636a995dSmlcreech for dlprefile in $dlprefiles; do 2391636a995dSmlcreech func_verbose "extracting global C symbols from \`$dlprefile'" 2392636a995dSmlcreech func_basename "$dlprefile" 2393636a995dSmlcreech name="$func_basename_result" 2394636a995dSmlcreech $opt_dry_run || { 2395636a995dSmlcreech eval '$ECHO ": $name " >> "$nlist"' 2396636a995dSmlcreech eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" 2397636a995dSmlcreech } 2398636a995dSmlcreech done 2399636a995dSmlcreech 2400636a995dSmlcreech $opt_dry_run || { 2401636a995dSmlcreech # Make sure we have at least an empty file. 2402636a995dSmlcreech test -f "$nlist" || : > "$nlist" 2403636a995dSmlcreech 2404636a995dSmlcreech if test -n "$exclude_expsyms"; then 2405636a995dSmlcreech $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 2406636a995dSmlcreech $MV "$nlist"T "$nlist" 2407636a995dSmlcreech fi 2408636a995dSmlcreech 2409636a995dSmlcreech # Try sorting and uniquifying the output. 2410636a995dSmlcreech if $GREP -v "^: " < "$nlist" | 2411636a995dSmlcreech if sort -k 3 </dev/null >/dev/null 2>&1; then 2412636a995dSmlcreech sort -k 3 2413636a995dSmlcreech else 2414636a995dSmlcreech sort +2 2415636a995dSmlcreech fi | 2416636a995dSmlcreech uniq > "$nlist"S; then 2417636a995dSmlcreech : 2418636a995dSmlcreech else 2419636a995dSmlcreech $GREP -v "^: " < "$nlist" > "$nlist"S 2420636a995dSmlcreech fi 2421636a995dSmlcreech 2422636a995dSmlcreech if test -f "$nlist"S; then 2423636a995dSmlcreech eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 2424636a995dSmlcreech else 2425636a995dSmlcreech $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" 2426636a995dSmlcreech fi 2427636a995dSmlcreech 2428636a995dSmlcreech $ECHO >> "$output_objdir/$my_dlsyms" "\ 2429636a995dSmlcreech 2430636a995dSmlcreech/* The mapping between symbol names and symbols. */ 2431636a995dSmlcreechtypedef struct { 2432636a995dSmlcreech const char *name; 2433636a995dSmlcreech void *address; 2434636a995dSmlcreech} lt_dlsymlist; 2435636a995dSmlcreech" 2436636a995dSmlcreech case $host in 2437*6acb2cf6Svapier *cygwin* | *mingw* | *cegcc* ) 2438636a995dSmlcreech $ECHO >> "$output_objdir/$my_dlsyms" "\ 2439636a995dSmlcreech/* DATA imports from DLLs on WIN32 con't be const, because 2440636a995dSmlcreech runtime relocations are performed -- see ld's documentation 2441636a995dSmlcreech on pseudo-relocs. */" 2442636a995dSmlcreech lt_dlsym_const= ;; 2443636a995dSmlcreech *osf5*) 2444636a995dSmlcreech echo >> "$output_objdir/$my_dlsyms" "\ 2445636a995dSmlcreech/* This system does not cope well with relocations in const data */" 2446636a995dSmlcreech lt_dlsym_const= ;; 2447636a995dSmlcreech *) 2448636a995dSmlcreech lt_dlsym_const=const ;; 2449636a995dSmlcreech esac 2450636a995dSmlcreech 2451636a995dSmlcreech $ECHO >> "$output_objdir/$my_dlsyms" "\ 2452636a995dSmlcreechextern $lt_dlsym_const lt_dlsymlist 2453636a995dSmlcreechlt_${my_prefix}_LTX_preloaded_symbols[]; 2454636a995dSmlcreech$lt_dlsym_const lt_dlsymlist 2455636a995dSmlcreechlt_${my_prefix}_LTX_preloaded_symbols[] = 2456636a995dSmlcreech{\ 2457636a995dSmlcreech { \"$my_originator\", (void *) 0 }," 2458636a995dSmlcreech 2459636a995dSmlcreech case $need_lib_prefix in 2460636a995dSmlcreech no) 2461636a995dSmlcreech eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 2462636a995dSmlcreech ;; 2463636a995dSmlcreech *) 2464636a995dSmlcreech eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 2465636a995dSmlcreech ;; 2466636a995dSmlcreech esac 2467636a995dSmlcreech $ECHO >> "$output_objdir/$my_dlsyms" "\ 2468636a995dSmlcreech {0, (void *) 0} 2469636a995dSmlcreech}; 2470636a995dSmlcreech 2471636a995dSmlcreech/* This works around a problem in FreeBSD linker */ 2472636a995dSmlcreech#ifdef FREEBSD_WORKAROUND 2473636a995dSmlcreechstatic const void *lt_preloaded_setup() { 2474636a995dSmlcreech return lt_${my_prefix}_LTX_preloaded_symbols; 2475636a995dSmlcreech} 2476636a995dSmlcreech#endif 2477636a995dSmlcreech 2478636a995dSmlcreech#ifdef __cplusplus 2479636a995dSmlcreech} 2480636a995dSmlcreech#endif\ 2481636a995dSmlcreech" 2482636a995dSmlcreech } # !$opt_dry_run 2483636a995dSmlcreech 2484636a995dSmlcreech pic_flag_for_symtable= 2485636a995dSmlcreech case "$compile_command " in 2486636a995dSmlcreech *" -static "*) ;; 2487636a995dSmlcreech *) 2488636a995dSmlcreech case $host in 2489636a995dSmlcreech # compiling the symbol table file with pic_flag works around 2490636a995dSmlcreech # a FreeBSD bug that causes programs to crash when -lm is 2491636a995dSmlcreech # linked before any other PIC object. But we must not use 2492636a995dSmlcreech # pic_flag when linking with -static. The problem exists in 2493636a995dSmlcreech # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 2494636a995dSmlcreech *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 2495636a995dSmlcreech pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 2496636a995dSmlcreech *-*-hpux*) 2497636a995dSmlcreech pic_flag_for_symtable=" $pic_flag" ;; 2498636a995dSmlcreech *) 2499636a995dSmlcreech if test "X$my_pic_p" != Xno; then 2500636a995dSmlcreech pic_flag_for_symtable=" $pic_flag" 2501636a995dSmlcreech fi 2502636a995dSmlcreech ;; 2503636a995dSmlcreech esac 2504636a995dSmlcreech ;; 2505636a995dSmlcreech esac 2506636a995dSmlcreech symtab_cflags= 2507636a995dSmlcreech for arg in $LTCFLAGS; do 2508636a995dSmlcreech case $arg in 2509636a995dSmlcreech -pie | -fpie | -fPIE) ;; 2510636a995dSmlcreech *) symtab_cflags="$symtab_cflags $arg" ;; 2511636a995dSmlcreech esac 2512636a995dSmlcreech done 2513636a995dSmlcreech 2514636a995dSmlcreech # Now compile the dynamic symbol file. 2515636a995dSmlcreech func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 2516636a995dSmlcreech 2517636a995dSmlcreech # Clean up the generated files. 2518636a995dSmlcreech func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 2519636a995dSmlcreech 2520636a995dSmlcreech # Transform the symbol file into the correct name. 2521636a995dSmlcreech symfileobj="$output_objdir/${my_outputname}S.$objext" 2522636a995dSmlcreech case $host in 2523*6acb2cf6Svapier *cygwin* | *mingw* | *cegcc* ) 2524636a995dSmlcreech if test -f "$output_objdir/$my_outputname.def"; then 2525636a995dSmlcreech compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 2526636a995dSmlcreech finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 2527636a995dSmlcreech else 2528636a995dSmlcreech compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2529636a995dSmlcreech finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2530636a995dSmlcreech fi 2531636a995dSmlcreech ;; 2532636a995dSmlcreech *) 2533636a995dSmlcreech compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2534636a995dSmlcreech finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` 2535636a995dSmlcreech ;; 2536636a995dSmlcreech esac 2537636a995dSmlcreech ;; 2538636a995dSmlcreech *) 2539636a995dSmlcreech func_fatal_error "unknown suffix for \`$my_dlsyms'" 2540636a995dSmlcreech ;; 2541636a995dSmlcreech esac 2542636a995dSmlcreech else 2543636a995dSmlcreech # We keep going just in case the user didn't refer to 2544636a995dSmlcreech # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 2545636a995dSmlcreech # really was required. 2546636a995dSmlcreech 2547636a995dSmlcreech # Nullify the symbol file. 2548636a995dSmlcreech compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 2549636a995dSmlcreech finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 2550636a995dSmlcreech fi 2551636a995dSmlcreech} 2552636a995dSmlcreech 2553636a995dSmlcreech# func_win32_libid arg 2554636a995dSmlcreech# return the library type of file 'arg' 2555636a995dSmlcreech# 2556636a995dSmlcreech# Need a lot of goo to handle *both* DLLs and import libs 2557636a995dSmlcreech# Has to be a shell function in order to 'eat' the argument 2558636a995dSmlcreech# that is supplied when $file_magic_command is called. 2559636a995dSmlcreechfunc_win32_libid () 2560636a995dSmlcreech{ 2561636a995dSmlcreech $opt_debug 2562636a995dSmlcreech win32_libid_type="unknown" 2563636a995dSmlcreech win32_fileres=`file -L $1 2>/dev/null` 2564636a995dSmlcreech case $win32_fileres in 2565636a995dSmlcreech *ar\ archive\ import\ library*) # definitely import 2566636a995dSmlcreech win32_libid_type="x86 archive import" 2567636a995dSmlcreech ;; 2568636a995dSmlcreech *ar\ archive*) # could be an import, or static 2569636a995dSmlcreech if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 2570636a995dSmlcreech $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 2571636a995dSmlcreech win32_nmres=`eval $NM -f posix -A $1 | 2572636a995dSmlcreech $SED -n -e ' 2573636a995dSmlcreech 1,100{ 2574636a995dSmlcreech / I /{ 2575636a995dSmlcreech s,.*,import, 2576636a995dSmlcreech p 2577636a995dSmlcreech q 2578636a995dSmlcreech } 2579636a995dSmlcreech }'` 2580636a995dSmlcreech case $win32_nmres in 2581636a995dSmlcreech import*) win32_libid_type="x86 archive import";; 2582636a995dSmlcreech *) win32_libid_type="x86 archive static";; 2583636a995dSmlcreech esac 2584636a995dSmlcreech fi 2585636a995dSmlcreech ;; 2586636a995dSmlcreech *DLL*) 2587636a995dSmlcreech win32_libid_type="x86 DLL" 2588636a995dSmlcreech ;; 2589636a995dSmlcreech *executable*) # but shell scripts are "executable" too... 2590636a995dSmlcreech case $win32_fileres in 2591636a995dSmlcreech *MS\ Windows\ PE\ Intel*) 2592636a995dSmlcreech win32_libid_type="x86 DLL" 2593636a995dSmlcreech ;; 2594636a995dSmlcreech esac 2595636a995dSmlcreech ;; 2596636a995dSmlcreech esac 2597636a995dSmlcreech $ECHO "$win32_libid_type" 2598636a995dSmlcreech} 2599636a995dSmlcreech 2600636a995dSmlcreech 2601636a995dSmlcreech 2602636a995dSmlcreech# func_extract_an_archive dir oldlib 2603636a995dSmlcreechfunc_extract_an_archive () 2604636a995dSmlcreech{ 2605636a995dSmlcreech $opt_debug 2606636a995dSmlcreech f_ex_an_ar_dir="$1"; shift 2607636a995dSmlcreech f_ex_an_ar_oldlib="$1" 2608636a995dSmlcreech func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' 2609636a995dSmlcreech if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 2610636a995dSmlcreech : 2611636a995dSmlcreech else 2612636a995dSmlcreech func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 2613636a995dSmlcreech fi 2614636a995dSmlcreech} 2615636a995dSmlcreech 2616636a995dSmlcreech 2617636a995dSmlcreech# func_extract_archives gentop oldlib ... 2618636a995dSmlcreechfunc_extract_archives () 2619636a995dSmlcreech{ 2620636a995dSmlcreech $opt_debug 2621636a995dSmlcreech my_gentop="$1"; shift 2622636a995dSmlcreech my_oldlibs=${1+"$@"} 2623636a995dSmlcreech my_oldobjs="" 2624636a995dSmlcreech my_xlib="" 2625636a995dSmlcreech my_xabs="" 2626636a995dSmlcreech my_xdir="" 2627636a995dSmlcreech 2628636a995dSmlcreech for my_xlib in $my_oldlibs; do 2629636a995dSmlcreech # Extract the objects. 2630636a995dSmlcreech case $my_xlib in 2631636a995dSmlcreech [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 2632636a995dSmlcreech *) my_xabs=`pwd`"/$my_xlib" ;; 2633636a995dSmlcreech esac 2634636a995dSmlcreech func_basename "$my_xlib" 2635636a995dSmlcreech my_xlib="$func_basename_result" 2636636a995dSmlcreech my_xlib_u=$my_xlib 2637636a995dSmlcreech while :; do 2638636a995dSmlcreech case " $extracted_archives " in 2639636a995dSmlcreech *" $my_xlib_u "*) 2640636a995dSmlcreech func_arith $extracted_serial + 1 2641636a995dSmlcreech extracted_serial=$func_arith_result 2642636a995dSmlcreech my_xlib_u=lt$extracted_serial-$my_xlib ;; 2643636a995dSmlcreech *) break ;; 2644636a995dSmlcreech esac 2645636a995dSmlcreech done 2646636a995dSmlcreech extracted_archives="$extracted_archives $my_xlib_u" 2647636a995dSmlcreech my_xdir="$my_gentop/$my_xlib_u" 2648636a995dSmlcreech 2649636a995dSmlcreech func_mkdir_p "$my_xdir" 2650636a995dSmlcreech 2651636a995dSmlcreech case $host in 2652636a995dSmlcreech *-darwin*) 2653636a995dSmlcreech func_verbose "Extracting $my_xabs" 2654636a995dSmlcreech # Do not bother doing anything if just a dry run 2655636a995dSmlcreech $opt_dry_run || { 2656636a995dSmlcreech darwin_orig_dir=`pwd` 2657636a995dSmlcreech cd $my_xdir || exit $? 2658636a995dSmlcreech darwin_archive=$my_xabs 2659636a995dSmlcreech darwin_curdir=`pwd` 2660636a995dSmlcreech darwin_base_archive=`basename "$darwin_archive"` 2661636a995dSmlcreech darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 2662636a995dSmlcreech if test -n "$darwin_arches"; then 2663636a995dSmlcreech darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 2664636a995dSmlcreech darwin_arch= 2665636a995dSmlcreech func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 2666636a995dSmlcreech for darwin_arch in $darwin_arches ; do 2667636a995dSmlcreech func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 2668636a995dSmlcreech $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 2669636a995dSmlcreech cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 2670636a995dSmlcreech func_extract_an_archive "`pwd`" "${darwin_base_archive}" 2671636a995dSmlcreech cd "$darwin_curdir" 2672636a995dSmlcreech $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 2673636a995dSmlcreech done # $darwin_arches 2674636a995dSmlcreech ## Okay now we've a bunch of thin objects, gotta fatten them up :) 2675636a995dSmlcreech darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 2676636a995dSmlcreech darwin_file= 2677636a995dSmlcreech darwin_files= 2678636a995dSmlcreech for darwin_file in $darwin_filelist; do 2679636a995dSmlcreech darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 2680636a995dSmlcreech $LIPO -create -output "$darwin_file" $darwin_files 2681636a995dSmlcreech done # $darwin_filelist 2682636a995dSmlcreech $RM -rf unfat-$$ 2683636a995dSmlcreech cd "$darwin_orig_dir" 2684636a995dSmlcreech else 2685636a995dSmlcreech cd $darwin_orig_dir 2686636a995dSmlcreech func_extract_an_archive "$my_xdir" "$my_xabs" 2687636a995dSmlcreech fi # $darwin_arches 2688636a995dSmlcreech } # !$opt_dry_run 2689636a995dSmlcreech ;; 2690636a995dSmlcreech *) 2691636a995dSmlcreech func_extract_an_archive "$my_xdir" "$my_xabs" 2692636a995dSmlcreech ;; 2693636a995dSmlcreech esac 2694636a995dSmlcreech my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 2695636a995dSmlcreech done 2696636a995dSmlcreech 2697636a995dSmlcreech func_extract_archives_result="$my_oldobjs" 2698636a995dSmlcreech} 2699636a995dSmlcreech 2700636a995dSmlcreech 2701636a995dSmlcreech 2702*6acb2cf6Svapier# func_emit_wrapper_part1 [arg=no] 2703636a995dSmlcreech# 2704*6acb2cf6Svapier# Emit the first part of a libtool wrapper script on stdout. 2705*6acb2cf6Svapier# For more information, see the description associated with 2706*6acb2cf6Svapier# func_emit_wrapper(), below. 2707*6acb2cf6Svapierfunc_emit_wrapper_part1 () 2708636a995dSmlcreech{ 2709*6acb2cf6Svapier func_emit_wrapper_part1_arg1=no 2710636a995dSmlcreech if test -n "$1" ; then 2711*6acb2cf6Svapier func_emit_wrapper_part1_arg1=$1 2712636a995dSmlcreech fi 2713636a995dSmlcreech 2714636a995dSmlcreech $ECHO "\ 2715636a995dSmlcreech#! $SHELL 2716636a995dSmlcreech 2717636a995dSmlcreech# $output - temporary wrapper script for $objdir/$outputname 2718636a995dSmlcreech# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 2719636a995dSmlcreech# 2720636a995dSmlcreech# The $output program cannot be directly executed until all the libtool 2721636a995dSmlcreech# libraries that it depends on are installed. 2722636a995dSmlcreech# 2723636a995dSmlcreech# This wrapper script should never be moved out of the build directory. 2724636a995dSmlcreech# If it is, it will not operate correctly. 2725636a995dSmlcreech 2726636a995dSmlcreech# Sed substitution that helps us do robust quoting. It backslashifies 2727636a995dSmlcreech# metacharacters that are still active within double-quoted strings. 2728636a995dSmlcreechXsed='${SED} -e 1s/^X//' 2729636a995dSmlcreechsed_quote_subst='$sed_quote_subst' 2730636a995dSmlcreech 2731636a995dSmlcreech# Be Bourne compatible 2732636a995dSmlcreechif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 2733636a995dSmlcreech emulate sh 2734636a995dSmlcreech NULLCMD=: 2735636a995dSmlcreech # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 2736636a995dSmlcreech # is contrary to our usage. Disable this feature. 2737636a995dSmlcreech alias -g '\${1+\"\$@\"}'='\"\$@\"' 2738636a995dSmlcreech setopt NO_GLOB_SUBST 2739636a995dSmlcreechelse 2740636a995dSmlcreech case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 2741636a995dSmlcreechfi 2742636a995dSmlcreechBIN_SH=xpg4; export BIN_SH # for Tru64 2743636a995dSmlcreechDUALCASE=1; export DUALCASE # for MKS sh 2744636a995dSmlcreech 2745636a995dSmlcreech# The HP-UX ksh and POSIX shell print the target directory to stdout 2746636a995dSmlcreech# if CDPATH is set. 2747636a995dSmlcreech(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 2748636a995dSmlcreech 2749636a995dSmlcreechrelink_command=\"$relink_command\" 2750636a995dSmlcreech 2751636a995dSmlcreech# This environment variable determines our operation mode. 2752636a995dSmlcreechif test \"\$libtool_install_magic\" = \"$magic\"; then 2753636a995dSmlcreech # install mode needs the following variables: 2754636a995dSmlcreech generated_by_libtool_version='$macro_version' 2755636a995dSmlcreech notinst_deplibs='$notinst_deplibs' 2756636a995dSmlcreechelse 2757636a995dSmlcreech # When we are sourced in execute mode, \$file and \$ECHO are already set. 2758636a995dSmlcreech if test \"\$libtool_execute_magic\" != \"$magic\"; then 2759636a995dSmlcreech ECHO=\"$qecho\" 2760636a995dSmlcreech file=\"\$0\" 2761636a995dSmlcreech # Make sure echo works. 2762636a995dSmlcreech if test \"X\$1\" = X--no-reexec; then 2763636a995dSmlcreech # Discard the --no-reexec flag, and continue. 2764636a995dSmlcreech shift 2765636a995dSmlcreech elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then 2766636a995dSmlcreech # Yippee, \$ECHO works! 2767636a995dSmlcreech : 2768636a995dSmlcreech else 2769636a995dSmlcreech # Restart under the correct shell, and then maybe \$ECHO will work. 2770636a995dSmlcreech exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 2771636a995dSmlcreech fi 2772636a995dSmlcreech fi\ 2773636a995dSmlcreech" 2774636a995dSmlcreech $ECHO "\ 2775636a995dSmlcreech 2776636a995dSmlcreech # Find the directory that this script lives in. 2777636a995dSmlcreech thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 2778636a995dSmlcreech test \"x\$thisdir\" = \"x\$file\" && thisdir=. 2779636a995dSmlcreech 2780636a995dSmlcreech # Follow symbolic links until we get to the real thisdir. 2781636a995dSmlcreech file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 2782636a995dSmlcreech while test -n \"\$file\"; do 2783636a995dSmlcreech destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 2784636a995dSmlcreech 2785636a995dSmlcreech # If there was a directory component, then change thisdir. 2786636a995dSmlcreech if test \"x\$destdir\" != \"x\$file\"; then 2787636a995dSmlcreech case \"\$destdir\" in 2788636a995dSmlcreech [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 2789636a995dSmlcreech *) thisdir=\"\$thisdir/\$destdir\" ;; 2790636a995dSmlcreech esac 2791636a995dSmlcreech fi 2792636a995dSmlcreech 2793636a995dSmlcreech file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 2794636a995dSmlcreech file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 2795636a995dSmlcreech done 2796*6acb2cf6Svapier" 2797*6acb2cf6Svapier} 2798*6acb2cf6Svapier# end: func_emit_wrapper_part1 2799*6acb2cf6Svapier 2800*6acb2cf6Svapier# func_emit_wrapper_part2 [arg=no] 2801*6acb2cf6Svapier# 2802*6acb2cf6Svapier# Emit the second part of a libtool wrapper script on stdout. 2803*6acb2cf6Svapier# For more information, see the description associated with 2804*6acb2cf6Svapier# func_emit_wrapper(), below. 2805*6acb2cf6Svapierfunc_emit_wrapper_part2 () 2806*6acb2cf6Svapier{ 2807*6acb2cf6Svapier func_emit_wrapper_part2_arg1=no 2808*6acb2cf6Svapier if test -n "$1" ; then 2809*6acb2cf6Svapier func_emit_wrapper_part2_arg1=$1 2810*6acb2cf6Svapier fi 2811*6acb2cf6Svapier 2812*6acb2cf6Svapier $ECHO "\ 2813636a995dSmlcreech 2814636a995dSmlcreech # Usually 'no', except on cygwin/mingw when embedded into 2815636a995dSmlcreech # the cwrapper. 2816*6acb2cf6Svapier WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 2817636a995dSmlcreech if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 2818636a995dSmlcreech # special case for '.' 2819636a995dSmlcreech if test \"\$thisdir\" = \".\"; then 2820636a995dSmlcreech thisdir=\`pwd\` 2821636a995dSmlcreech fi 2822636a995dSmlcreech # remove .libs from thisdir 2823636a995dSmlcreech case \"\$thisdir\" in 2824636a995dSmlcreech *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; 2825636a995dSmlcreech $objdir ) thisdir=. ;; 2826636a995dSmlcreech esac 2827636a995dSmlcreech fi 2828636a995dSmlcreech 2829636a995dSmlcreech # Try to get the absolute directory name. 2830636a995dSmlcreech absdir=\`cd \"\$thisdir\" && pwd\` 2831636a995dSmlcreech test -n \"\$absdir\" && thisdir=\"\$absdir\" 2832636a995dSmlcreech" 2833636a995dSmlcreech 2834636a995dSmlcreech if test "$fast_install" = yes; then 2835636a995dSmlcreech $ECHO "\ 2836636a995dSmlcreech program=lt-'$outputname'$exeext 2837636a995dSmlcreech progdir=\"\$thisdir/$objdir\" 2838636a995dSmlcreech 2839636a995dSmlcreech if test ! -f \"\$progdir/\$program\" || 2840636a995dSmlcreech { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 2841636a995dSmlcreech test \"X\$file\" != \"X\$progdir/\$program\"; }; then 2842636a995dSmlcreech 2843636a995dSmlcreech file=\"\$\$-\$program\" 2844636a995dSmlcreech 2845636a995dSmlcreech if test ! -d \"\$progdir\"; then 2846636a995dSmlcreech $MKDIR \"\$progdir\" 2847636a995dSmlcreech else 2848636a995dSmlcreech $RM \"\$progdir/\$file\" 2849636a995dSmlcreech fi" 2850636a995dSmlcreech 2851636a995dSmlcreech $ECHO "\ 2852636a995dSmlcreech 2853636a995dSmlcreech # relink executable if necessary 2854636a995dSmlcreech if test -n \"\$relink_command\"; then 2855636a995dSmlcreech if relink_command_output=\`eval \$relink_command 2>&1\`; then : 2856636a995dSmlcreech else 2857636a995dSmlcreech $ECHO \"\$relink_command_output\" >&2 2858636a995dSmlcreech $RM \"\$progdir/\$file\" 2859636a995dSmlcreech exit 1 2860636a995dSmlcreech fi 2861636a995dSmlcreech fi 2862636a995dSmlcreech 2863636a995dSmlcreech $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 2864636a995dSmlcreech { $RM \"\$progdir/\$program\"; 2865636a995dSmlcreech $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 2866636a995dSmlcreech $RM \"\$progdir/\$file\" 2867636a995dSmlcreech fi" 2868636a995dSmlcreech else 2869636a995dSmlcreech $ECHO "\ 2870636a995dSmlcreech program='$outputname' 2871636a995dSmlcreech progdir=\"\$thisdir/$objdir\" 2872636a995dSmlcreech" 2873636a995dSmlcreech fi 2874636a995dSmlcreech 2875636a995dSmlcreech $ECHO "\ 2876636a995dSmlcreech 2877636a995dSmlcreech if test -f \"\$progdir/\$program\"; then" 2878636a995dSmlcreech 2879636a995dSmlcreech # Export our shlibpath_var if we have one. 2880636a995dSmlcreech if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 2881636a995dSmlcreech $ECHO "\ 2882636a995dSmlcreech # Add our own library path to $shlibpath_var 2883636a995dSmlcreech $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 2884636a995dSmlcreech 2885636a995dSmlcreech # Some systems cannot cope with colon-terminated $shlibpath_var 2886636a995dSmlcreech # The second colon is a workaround for a bug in BeOS R4 sed 2887636a995dSmlcreech $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 2888636a995dSmlcreech 2889636a995dSmlcreech export $shlibpath_var 2890636a995dSmlcreech" 2891636a995dSmlcreech fi 2892636a995dSmlcreech 2893636a995dSmlcreech # fixup the dll searchpath if we need to. 2894636a995dSmlcreech if test -n "$dllsearchpath"; then 2895636a995dSmlcreech $ECHO "\ 2896636a995dSmlcreech # Add the dll search path components to the executable PATH 2897636a995dSmlcreech PATH=$dllsearchpath:\$PATH 2898636a995dSmlcreech" 2899636a995dSmlcreech fi 2900636a995dSmlcreech 2901636a995dSmlcreech $ECHO "\ 2902636a995dSmlcreech if test \"\$libtool_execute_magic\" != \"$magic\"; then 2903636a995dSmlcreech # Run the actual program with our arguments. 2904636a995dSmlcreech" 2905636a995dSmlcreech case $host in 2906636a995dSmlcreech # Backslashes separate directories on plain windows 2907*6acb2cf6Svapier *-*-mingw | *-*-os2* | *-cegcc*) 2908636a995dSmlcreech $ECHO "\ 2909636a995dSmlcreech exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 2910636a995dSmlcreech" 2911636a995dSmlcreech ;; 2912636a995dSmlcreech 2913636a995dSmlcreech *) 2914636a995dSmlcreech $ECHO "\ 2915636a995dSmlcreech exec \"\$progdir/\$program\" \${1+\"\$@\"} 2916636a995dSmlcreech" 2917636a995dSmlcreech ;; 2918636a995dSmlcreech esac 2919636a995dSmlcreech $ECHO "\ 2920636a995dSmlcreech \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 2921636a995dSmlcreech exit 1 2922636a995dSmlcreech fi 2923636a995dSmlcreech else 2924636a995dSmlcreech # The program doesn't exist. 2925636a995dSmlcreech \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 2926636a995dSmlcreech \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 2927636a995dSmlcreech $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 2928636a995dSmlcreech exit 1 2929636a995dSmlcreech fi 2930636a995dSmlcreechfi\ 2931636a995dSmlcreech" 2932636a995dSmlcreech} 2933*6acb2cf6Svapier# end: func_emit_wrapper_part2 2934*6acb2cf6Svapier 2935*6acb2cf6Svapier 2936*6acb2cf6Svapier# func_emit_wrapper [arg=no] 2937*6acb2cf6Svapier# 2938*6acb2cf6Svapier# Emit a libtool wrapper script on stdout. 2939*6acb2cf6Svapier# Don't directly open a file because we may want to 2940*6acb2cf6Svapier# incorporate the script contents within a cygwin/mingw 2941*6acb2cf6Svapier# wrapper executable. Must ONLY be called from within 2942*6acb2cf6Svapier# func_mode_link because it depends on a number of variables 2943*6acb2cf6Svapier# set therein. 2944*6acb2cf6Svapier# 2945*6acb2cf6Svapier# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 2946*6acb2cf6Svapier# variable will take. If 'yes', then the emitted script 2947*6acb2cf6Svapier# will assume that the directory in which it is stored is 2948*6acb2cf6Svapier# the $objdir directory. This is a cygwin/mingw-specific 2949*6acb2cf6Svapier# behavior. 2950*6acb2cf6Svapierfunc_emit_wrapper () 2951*6acb2cf6Svapier{ 2952*6acb2cf6Svapier func_emit_wrapper_arg1=no 2953*6acb2cf6Svapier if test -n "$1" ; then 2954*6acb2cf6Svapier func_emit_wrapper_arg1=$1 2955*6acb2cf6Svapier fi 2956*6acb2cf6Svapier 2957*6acb2cf6Svapier # split this up so that func_emit_cwrapperexe_src 2958*6acb2cf6Svapier # can call each part independently. 2959*6acb2cf6Svapier func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" 2960*6acb2cf6Svapier func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" 2961*6acb2cf6Svapier} 2962*6acb2cf6Svapier 2963*6acb2cf6Svapier 2964*6acb2cf6Svapier# func_to_host_path arg 2965*6acb2cf6Svapier# 2966*6acb2cf6Svapier# Convert paths to host format when used with build tools. 2967*6acb2cf6Svapier# Intended for use with "native" mingw (where libtool itself 2968*6acb2cf6Svapier# is running under the msys shell), or in the following cross- 2969*6acb2cf6Svapier# build environments: 2970*6acb2cf6Svapier# $build $host 2971*6acb2cf6Svapier# mingw (msys) mingw [e.g. native] 2972*6acb2cf6Svapier# cygwin mingw 2973*6acb2cf6Svapier# *nix + wine mingw 2974*6acb2cf6Svapier# where wine is equipped with the `winepath' executable. 2975*6acb2cf6Svapier# In the native mingw case, the (msys) shell automatically 2976*6acb2cf6Svapier# converts paths for any non-msys applications it launches, 2977*6acb2cf6Svapier# but that facility isn't available from inside the cwrapper. 2978*6acb2cf6Svapier# Similar accommodations are necessary for $host mingw and 2979*6acb2cf6Svapier# $build cygwin. Calling this function does no harm for other 2980*6acb2cf6Svapier# $host/$build combinations not listed above. 2981*6acb2cf6Svapier# 2982*6acb2cf6Svapier# ARG is the path (on $build) that should be converted to 2983*6acb2cf6Svapier# the proper representation for $host. The result is stored 2984*6acb2cf6Svapier# in $func_to_host_path_result. 2985*6acb2cf6Svapierfunc_to_host_path () 2986*6acb2cf6Svapier{ 2987*6acb2cf6Svapier func_to_host_path_result="$1" 2988*6acb2cf6Svapier if test -n "$1" ; then 2989*6acb2cf6Svapier case $host in 2990*6acb2cf6Svapier *mingw* ) 2991*6acb2cf6Svapier lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 2992*6acb2cf6Svapier case $build in 2993*6acb2cf6Svapier *mingw* ) # actually, msys 2994*6acb2cf6Svapier # awkward: cmd appends spaces to result 2995*6acb2cf6Svapier lt_sed_strip_trailing_spaces="s/[ ]*\$//" 2996*6acb2cf6Svapier func_to_host_path_tmp1=`( cmd //c echo "$1" |\ 2997*6acb2cf6Svapier $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 2998*6acb2cf6Svapier func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 2999*6acb2cf6Svapier $SED -e "$lt_sed_naive_backslashify"` 3000*6acb2cf6Svapier ;; 3001*6acb2cf6Svapier *cygwin* ) 3002*6acb2cf6Svapier func_to_host_path_tmp1=`cygpath -w "$1"` 3003*6acb2cf6Svapier func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 3004*6acb2cf6Svapier $SED -e "$lt_sed_naive_backslashify"` 3005*6acb2cf6Svapier ;; 3006*6acb2cf6Svapier * ) 3007*6acb2cf6Svapier # Unfortunately, winepath does not exit with a non-zero 3008*6acb2cf6Svapier # error code, so we are forced to check the contents of 3009*6acb2cf6Svapier # stdout. On the other hand, if the command is not 3010*6acb2cf6Svapier # found, the shell will set an exit code of 127 and print 3011*6acb2cf6Svapier # *an error message* to stdout. So we must check for both 3012*6acb2cf6Svapier # error code of zero AND non-empty stdout, which explains 3013*6acb2cf6Svapier # the odd construction: 3014*6acb2cf6Svapier func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` 3015*6acb2cf6Svapier if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then 3016*6acb2cf6Svapier func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ 3017*6acb2cf6Svapier $SED -e "$lt_sed_naive_backslashify"` 3018*6acb2cf6Svapier else 3019*6acb2cf6Svapier # Allow warning below. 3020*6acb2cf6Svapier func_to_host_path_result="" 3021*6acb2cf6Svapier fi 3022*6acb2cf6Svapier ;; 3023*6acb2cf6Svapier esac 3024*6acb2cf6Svapier if test -z "$func_to_host_path_result" ; then 3025*6acb2cf6Svapier func_error "Could not determine host path corresponding to" 3026*6acb2cf6Svapier func_error " '$1'" 3027*6acb2cf6Svapier func_error "Continuing, but uninstalled executables may not work." 3028*6acb2cf6Svapier # Fallback: 3029*6acb2cf6Svapier func_to_host_path_result="$1" 3030*6acb2cf6Svapier fi 3031*6acb2cf6Svapier ;; 3032*6acb2cf6Svapier esac 3033*6acb2cf6Svapier fi 3034*6acb2cf6Svapier} 3035*6acb2cf6Svapier# end: func_to_host_path 3036*6acb2cf6Svapier 3037*6acb2cf6Svapier# func_to_host_pathlist arg 3038*6acb2cf6Svapier# 3039*6acb2cf6Svapier# Convert pathlists to host format when used with build tools. 3040*6acb2cf6Svapier# See func_to_host_path(), above. This function supports the 3041*6acb2cf6Svapier# following $build/$host combinations (but does no harm for 3042*6acb2cf6Svapier# combinations not listed here): 3043*6acb2cf6Svapier# $build $host 3044*6acb2cf6Svapier# mingw (msys) mingw [e.g. native] 3045*6acb2cf6Svapier# cygwin mingw 3046*6acb2cf6Svapier# *nix + wine mingw 3047*6acb2cf6Svapier# 3048*6acb2cf6Svapier# Path separators are also converted from $build format to 3049*6acb2cf6Svapier# $host format. If ARG begins or ends with a path separator 3050*6acb2cf6Svapier# character, it is preserved (but converted to $host format) 3051*6acb2cf6Svapier# on output. 3052*6acb2cf6Svapier# 3053*6acb2cf6Svapier# ARG is a pathlist (on $build) that should be converted to 3054*6acb2cf6Svapier# the proper representation on $host. The result is stored 3055*6acb2cf6Svapier# in $func_to_host_pathlist_result. 3056*6acb2cf6Svapierfunc_to_host_pathlist () 3057*6acb2cf6Svapier{ 3058*6acb2cf6Svapier func_to_host_pathlist_result="$1" 3059*6acb2cf6Svapier if test -n "$1" ; then 3060*6acb2cf6Svapier case $host in 3061*6acb2cf6Svapier *mingw* ) 3062*6acb2cf6Svapier lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 3063*6acb2cf6Svapier # Remove leading and trailing path separator characters from 3064*6acb2cf6Svapier # ARG. msys behavior is inconsistent here, cygpath turns them 3065*6acb2cf6Svapier # into '.;' and ';.', and winepath ignores them completely. 3066*6acb2cf6Svapier func_to_host_pathlist_tmp2="$1" 3067*6acb2cf6Svapier # Once set for this call, this variable should not be 3068*6acb2cf6Svapier # reassigned. It is used in tha fallback case. 3069*6acb2cf6Svapier func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ 3070*6acb2cf6Svapier $SED -e 's|^:*||' -e 's|:*$||'` 3071*6acb2cf6Svapier case $build in 3072*6acb2cf6Svapier *mingw* ) # Actually, msys. 3073*6acb2cf6Svapier # Awkward: cmd appends spaces to result. 3074*6acb2cf6Svapier lt_sed_strip_trailing_spaces="s/[ ]*\$//" 3075*6acb2cf6Svapier func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ 3076*6acb2cf6Svapier $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` 3077*6acb2cf6Svapier func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 3078*6acb2cf6Svapier $SED -e "$lt_sed_naive_backslashify"` 3079*6acb2cf6Svapier ;; 3080*6acb2cf6Svapier *cygwin* ) 3081*6acb2cf6Svapier func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` 3082*6acb2cf6Svapier func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ 3083*6acb2cf6Svapier $SED -e "$lt_sed_naive_backslashify"` 3084*6acb2cf6Svapier ;; 3085*6acb2cf6Svapier * ) 3086*6acb2cf6Svapier # unfortunately, winepath doesn't convert pathlists 3087*6acb2cf6Svapier func_to_host_pathlist_result="" 3088*6acb2cf6Svapier func_to_host_pathlist_oldIFS=$IFS 3089*6acb2cf6Svapier IFS=: 3090*6acb2cf6Svapier for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do 3091*6acb2cf6Svapier IFS=$func_to_host_pathlist_oldIFS 3092*6acb2cf6Svapier if test -n "$func_to_host_pathlist_f" ; then 3093*6acb2cf6Svapier func_to_host_path "$func_to_host_pathlist_f" 3094*6acb2cf6Svapier if test -n "$func_to_host_path_result" ; then 3095*6acb2cf6Svapier if test -z "$func_to_host_pathlist_result" ; then 3096*6acb2cf6Svapier func_to_host_pathlist_result="$func_to_host_path_result" 3097*6acb2cf6Svapier else 3098*6acb2cf6Svapier func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" 3099*6acb2cf6Svapier fi 3100*6acb2cf6Svapier fi 3101*6acb2cf6Svapier fi 3102*6acb2cf6Svapier IFS=: 3103*6acb2cf6Svapier done 3104*6acb2cf6Svapier IFS=$func_to_host_pathlist_oldIFS 3105*6acb2cf6Svapier ;; 3106*6acb2cf6Svapier esac 3107*6acb2cf6Svapier if test -z "$func_to_host_pathlist_result" ; then 3108*6acb2cf6Svapier func_error "Could not determine the host path(s) corresponding to" 3109*6acb2cf6Svapier func_error " '$1'" 3110*6acb2cf6Svapier func_error "Continuing, but uninstalled executables may not work." 3111*6acb2cf6Svapier # Fallback. This may break if $1 contains DOS-style drive 3112*6acb2cf6Svapier # specifications. The fix is not to complicate the expression 3113*6acb2cf6Svapier # below, but for the user to provide a working wine installation 3114*6acb2cf6Svapier # with winepath so that path translation in the cross-to-mingw 3115*6acb2cf6Svapier # case works properly. 3116*6acb2cf6Svapier lt_replace_pathsep_nix_to_dos="s|:|;|g" 3117*6acb2cf6Svapier func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ 3118*6acb2cf6Svapier $SED -e "$lt_replace_pathsep_nix_to_dos"` 3119*6acb2cf6Svapier fi 3120*6acb2cf6Svapier # Now, add the leading and trailing path separators back 3121*6acb2cf6Svapier case "$1" in 3122*6acb2cf6Svapier :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" 3123*6acb2cf6Svapier ;; 3124*6acb2cf6Svapier esac 3125*6acb2cf6Svapier case "$1" in 3126*6acb2cf6Svapier *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" 3127*6acb2cf6Svapier ;; 3128*6acb2cf6Svapier esac 3129*6acb2cf6Svapier ;; 3130*6acb2cf6Svapier esac 3131*6acb2cf6Svapier fi 3132*6acb2cf6Svapier} 3133*6acb2cf6Svapier# end: func_to_host_pathlist 3134636a995dSmlcreech 3135636a995dSmlcreech# func_emit_cwrapperexe_src 3136636a995dSmlcreech# emit the source code for a wrapper executable on stdout 3137636a995dSmlcreech# Must ONLY be called from within func_mode_link because 3138636a995dSmlcreech# it depends on a number of variable set therein. 3139636a995dSmlcreechfunc_emit_cwrapperexe_src () 3140636a995dSmlcreech{ 3141636a995dSmlcreech cat <<EOF 3142636a995dSmlcreech 3143636a995dSmlcreech/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 3144636a995dSmlcreech Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3145636a995dSmlcreech 3146636a995dSmlcreech The $output program cannot be directly executed until all the libtool 3147636a995dSmlcreech libraries that it depends on are installed. 3148636a995dSmlcreech 3149636a995dSmlcreech This wrapper executable should never be moved out of the build directory. 3150636a995dSmlcreech If it is, it will not operate correctly. 3151636a995dSmlcreech 3152636a995dSmlcreech Currently, it simply execs the wrapper *script* "$SHELL $output", 3153636a995dSmlcreech but could eventually absorb all of the scripts functionality and 3154636a995dSmlcreech exec $objdir/$outputname directly. 3155636a995dSmlcreech*/ 3156636a995dSmlcreechEOF 3157636a995dSmlcreech cat <<"EOF" 3158636a995dSmlcreech#include <stdio.h> 3159636a995dSmlcreech#include <stdlib.h> 3160636a995dSmlcreech#ifdef _MSC_VER 3161636a995dSmlcreech# include <direct.h> 3162636a995dSmlcreech# include <process.h> 3163636a995dSmlcreech# include <io.h> 3164636a995dSmlcreech# define setmode _setmode 3165636a995dSmlcreech#else 3166636a995dSmlcreech# include <unistd.h> 3167636a995dSmlcreech# include <stdint.h> 3168636a995dSmlcreech# ifdef __CYGWIN__ 3169636a995dSmlcreech# include <io.h> 3170*6acb2cf6Svapier# define HAVE_SETENV 3171*6acb2cf6Svapier# ifdef __STRICT_ANSI__ 3172*6acb2cf6Svapierchar *realpath (const char *, char *); 3173*6acb2cf6Svapierint putenv (char *); 3174*6acb2cf6Svapierint setenv (const char *, const char *, int); 3175*6acb2cf6Svapier# endif 3176636a995dSmlcreech# endif 3177636a995dSmlcreech#endif 3178636a995dSmlcreech#include <malloc.h> 3179636a995dSmlcreech#include <stdarg.h> 3180636a995dSmlcreech#include <assert.h> 3181636a995dSmlcreech#include <string.h> 3182636a995dSmlcreech#include <ctype.h> 3183636a995dSmlcreech#include <errno.h> 3184636a995dSmlcreech#include <fcntl.h> 3185636a995dSmlcreech#include <sys/stat.h> 3186636a995dSmlcreech 3187636a995dSmlcreech#if defined(PATH_MAX) 3188636a995dSmlcreech# define LT_PATHMAX PATH_MAX 3189636a995dSmlcreech#elif defined(MAXPATHLEN) 3190636a995dSmlcreech# define LT_PATHMAX MAXPATHLEN 3191636a995dSmlcreech#else 3192636a995dSmlcreech# define LT_PATHMAX 1024 3193636a995dSmlcreech#endif 3194636a995dSmlcreech 3195636a995dSmlcreech#ifndef S_IXOTH 3196636a995dSmlcreech# define S_IXOTH 0 3197636a995dSmlcreech#endif 3198636a995dSmlcreech#ifndef S_IXGRP 3199636a995dSmlcreech# define S_IXGRP 0 3200636a995dSmlcreech#endif 3201636a995dSmlcreech 3202636a995dSmlcreech#ifdef _MSC_VER 3203636a995dSmlcreech# define S_IXUSR _S_IEXEC 3204636a995dSmlcreech# define stat _stat 3205636a995dSmlcreech# ifndef _INTPTR_T_DEFINED 3206636a995dSmlcreech# define intptr_t int 3207636a995dSmlcreech# endif 3208636a995dSmlcreech#endif 3209636a995dSmlcreech 3210636a995dSmlcreech#ifndef DIR_SEPARATOR 3211636a995dSmlcreech# define DIR_SEPARATOR '/' 3212636a995dSmlcreech# define PATH_SEPARATOR ':' 3213636a995dSmlcreech#endif 3214636a995dSmlcreech 3215636a995dSmlcreech#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 3216636a995dSmlcreech defined (__OS2__) 3217636a995dSmlcreech# define HAVE_DOS_BASED_FILE_SYSTEM 3218636a995dSmlcreech# define FOPEN_WB "wb" 3219636a995dSmlcreech# ifndef DIR_SEPARATOR_2 3220636a995dSmlcreech# define DIR_SEPARATOR_2 '\\' 3221636a995dSmlcreech# endif 3222636a995dSmlcreech# ifndef PATH_SEPARATOR_2 3223636a995dSmlcreech# define PATH_SEPARATOR_2 ';' 3224636a995dSmlcreech# endif 3225636a995dSmlcreech#endif 3226636a995dSmlcreech 3227636a995dSmlcreech#ifndef DIR_SEPARATOR_2 3228636a995dSmlcreech# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 3229636a995dSmlcreech#else /* DIR_SEPARATOR_2 */ 3230636a995dSmlcreech# define IS_DIR_SEPARATOR(ch) \ 3231636a995dSmlcreech (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 3232636a995dSmlcreech#endif /* DIR_SEPARATOR_2 */ 3233636a995dSmlcreech 3234636a995dSmlcreech#ifndef PATH_SEPARATOR_2 3235636a995dSmlcreech# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 3236636a995dSmlcreech#else /* PATH_SEPARATOR_2 */ 3237636a995dSmlcreech# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 3238636a995dSmlcreech#endif /* PATH_SEPARATOR_2 */ 3239636a995dSmlcreech 3240636a995dSmlcreech#ifdef __CYGWIN__ 3241636a995dSmlcreech# define FOPEN_WB "wb" 3242636a995dSmlcreech#endif 3243636a995dSmlcreech 3244636a995dSmlcreech#ifndef FOPEN_WB 3245636a995dSmlcreech# define FOPEN_WB "w" 3246636a995dSmlcreech#endif 3247636a995dSmlcreech#ifndef _O_BINARY 3248636a995dSmlcreech# define _O_BINARY 0 3249636a995dSmlcreech#endif 3250636a995dSmlcreech 3251636a995dSmlcreech#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 3252636a995dSmlcreech#define XFREE(stale) do { \ 3253636a995dSmlcreech if (stale) { free ((void *) stale); stale = 0; } \ 3254636a995dSmlcreech} while (0) 3255636a995dSmlcreech 3256636a995dSmlcreech#undef LTWRAPPER_DEBUGPRINTF 3257636a995dSmlcreech#if defined DEBUGWRAPPER 3258636a995dSmlcreech# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args 3259636a995dSmlcreechstatic void 3260636a995dSmlcreechltwrapper_debugprintf (const char *fmt, ...) 3261636a995dSmlcreech{ 3262636a995dSmlcreech va_list args; 3263636a995dSmlcreech va_start (args, fmt); 3264636a995dSmlcreech (void) vfprintf (stderr, fmt, args); 3265636a995dSmlcreech va_end (args); 3266636a995dSmlcreech} 3267636a995dSmlcreech#else 3268636a995dSmlcreech# define LTWRAPPER_DEBUGPRINTF(args) 3269636a995dSmlcreech#endif 3270636a995dSmlcreech 3271636a995dSmlcreechconst char *program_name = NULL; 3272636a995dSmlcreech 3273636a995dSmlcreechvoid *xmalloc (size_t num); 3274636a995dSmlcreechchar *xstrdup (const char *string); 3275636a995dSmlcreechconst char *base_name (const char *name); 3276636a995dSmlcreechchar *find_executable (const char *wrapper); 3277636a995dSmlcreechchar *chase_symlinks (const char *pathspec); 3278636a995dSmlcreechint make_executable (const char *path); 3279636a995dSmlcreechint check_executable (const char *path); 3280636a995dSmlcreechchar *strendzap (char *str, const char *pat); 3281636a995dSmlcreechvoid lt_fatal (const char *message, ...); 3282*6acb2cf6Svapiervoid lt_setenv (const char *name, const char *value); 3283*6acb2cf6Svapierchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 3284*6acb2cf6Svapiervoid lt_opt_process_env_set (const char *arg); 3285*6acb2cf6Svapiervoid lt_opt_process_env_prepend (const char *arg); 3286*6acb2cf6Svapiervoid lt_opt_process_env_append (const char *arg); 3287*6acb2cf6Svapierint lt_split_name_value (const char *arg, char** name, char** value); 3288*6acb2cf6Svapiervoid lt_update_exe_path (const char *name, const char *value); 3289*6acb2cf6Svapiervoid lt_update_lib_path (const char *name, const char *value); 3290636a995dSmlcreech 3291*6acb2cf6Svapierstatic const char *script_text_part1 = 3292636a995dSmlcreechEOF 3293636a995dSmlcreech 3294*6acb2cf6Svapier func_emit_wrapper_part1 yes | 3295*6acb2cf6Svapier $SED -e 's/\([\\"]\)/\\\1/g' \ 3296*6acb2cf6Svapier -e 's/^/ "/' -e 's/$/\\n"/' 3297*6acb2cf6Svapier echo ";" 3298*6acb2cf6Svapier cat <<EOF 3299*6acb2cf6Svapier 3300*6acb2cf6Svapierstatic const char *script_text_part2 = 3301*6acb2cf6SvapierEOF 3302*6acb2cf6Svapier func_emit_wrapper_part2 yes | 3303636a995dSmlcreech $SED -e 's/\([\\"]\)/\\\1/g' \ 3304636a995dSmlcreech -e 's/^/ "/' -e 's/$/\\n"/' 3305636a995dSmlcreech echo ";" 3306636a995dSmlcreech 3307636a995dSmlcreech cat <<EOF 3308636a995dSmlcreechconst char * MAGIC_EXE = "$magic_exe"; 3309*6acb2cf6Svapierconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 3310*6acb2cf6SvapierEOF 3311*6acb2cf6Svapier 3312*6acb2cf6Svapier if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 3313*6acb2cf6Svapier func_to_host_pathlist "$temp_rpath" 3314*6acb2cf6Svapier cat <<EOF 3315*6acb2cf6Svapierconst char * LIB_PATH_VALUE = "$func_to_host_pathlist_result"; 3316*6acb2cf6SvapierEOF 3317*6acb2cf6Svapier else 3318*6acb2cf6Svapier cat <<"EOF" 3319*6acb2cf6Svapierconst char * LIB_PATH_VALUE = ""; 3320*6acb2cf6SvapierEOF 3321*6acb2cf6Svapier fi 3322*6acb2cf6Svapier 3323*6acb2cf6Svapier if test -n "$dllsearchpath"; then 3324*6acb2cf6Svapier func_to_host_pathlist "$dllsearchpath:" 3325*6acb2cf6Svapier cat <<EOF 3326*6acb2cf6Svapierconst char * EXE_PATH_VARNAME = "PATH"; 3327*6acb2cf6Svapierconst char * EXE_PATH_VALUE = "$func_to_host_pathlist_result"; 3328*6acb2cf6SvapierEOF 3329*6acb2cf6Svapier else 3330*6acb2cf6Svapier cat <<"EOF" 3331*6acb2cf6Svapierconst char * EXE_PATH_VARNAME = ""; 3332*6acb2cf6Svapierconst char * EXE_PATH_VALUE = ""; 3333*6acb2cf6SvapierEOF 3334*6acb2cf6Svapier fi 3335*6acb2cf6Svapier 3336*6acb2cf6Svapier if test "$fast_install" = yes; then 3337*6acb2cf6Svapier cat <<EOF 3338*6acb2cf6Svapierconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 3339*6acb2cf6SvapierEOF 3340*6acb2cf6Svapier else 3341*6acb2cf6Svapier cat <<EOF 3342*6acb2cf6Svapierconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 3343*6acb2cf6SvapierEOF 3344*6acb2cf6Svapier fi 3345*6acb2cf6Svapier 3346*6acb2cf6Svapier 3347*6acb2cf6Svapier cat <<"EOF" 3348*6acb2cf6Svapier 3349*6acb2cf6Svapier#define LTWRAPPER_OPTION_PREFIX "--lt-" 3350*6acb2cf6Svapier#define LTWRAPPER_OPTION_PREFIX_LENGTH 5 3351*6acb2cf6Svapier 3352*6acb2cf6Svapierstatic const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH; 3353*6acb2cf6Svapierstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 3354*6acb2cf6Svapier 3355*6acb2cf6Svapierstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 3356*6acb2cf6Svapier 3357*6acb2cf6Svapierstatic const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7; 3358*6acb2cf6Svapierstatic const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set"; 3359*6acb2cf6Svapier /* argument is putenv-style "foo=bar", value of foo is set to bar */ 3360*6acb2cf6Svapier 3361*6acb2cf6Svapierstatic const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11; 3362*6acb2cf6Svapierstatic const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend"; 3363*6acb2cf6Svapier /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */ 3364*6acb2cf6Svapier 3365*6acb2cf6Svapierstatic const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10; 3366*6acb2cf6Svapierstatic const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append"; 3367*6acb2cf6Svapier /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */ 3368636a995dSmlcreech 3369636a995dSmlcreechint 3370636a995dSmlcreechmain (int argc, char *argv[]) 3371636a995dSmlcreech{ 3372636a995dSmlcreech char **newargz; 3373*6acb2cf6Svapier int newargc; 3374636a995dSmlcreech char *tmp_pathspec; 3375636a995dSmlcreech char *actual_cwrapper_path; 3376*6acb2cf6Svapier char *actual_cwrapper_name; 3377*6acb2cf6Svapier char *target_name; 3378*6acb2cf6Svapier char *lt_argv_zero; 3379636a995dSmlcreech intptr_t rval = 127; 3380636a995dSmlcreech 3381636a995dSmlcreech int i; 3382636a995dSmlcreech 3383636a995dSmlcreech program_name = (char *) xstrdup (base_name (argv[0])); 3384636a995dSmlcreech LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0])); 3385636a995dSmlcreech LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name)); 3386636a995dSmlcreech 3387636a995dSmlcreech /* very simple arg parsing; don't want to rely on getopt */ 3388636a995dSmlcreech for (i = 1; i < argc; i++) 3389636a995dSmlcreech { 3390636a995dSmlcreech if (strcmp (argv[i], dumpscript_opt) == 0) 3391636a995dSmlcreech { 3392636a995dSmlcreechEOF 3393636a995dSmlcreech case "$host" in 3394636a995dSmlcreech *mingw* | *cygwin* ) 3395636a995dSmlcreech # make stdout use "unix" line endings 3396636a995dSmlcreech echo " setmode(1,_O_BINARY);" 3397636a995dSmlcreech ;; 3398636a995dSmlcreech esac 3399636a995dSmlcreech 3400*6acb2cf6Svapier cat <<"EOF" 3401*6acb2cf6Svapier printf ("%s", script_text_part1); 3402*6acb2cf6Svapier printf ("%s", script_text_part2); 3403636a995dSmlcreech return 0; 3404636a995dSmlcreech } 3405636a995dSmlcreech } 3406636a995dSmlcreech 3407*6acb2cf6Svapier newargz = XMALLOC (char *, argc + 1); 3408636a995dSmlcreech tmp_pathspec = find_executable (argv[0]); 3409636a995dSmlcreech if (tmp_pathspec == NULL) 3410636a995dSmlcreech lt_fatal ("Couldn't find %s", argv[0]); 3411636a995dSmlcreech LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n", 3412636a995dSmlcreech tmp_pathspec)); 3413636a995dSmlcreech 3414636a995dSmlcreech actual_cwrapper_path = chase_symlinks (tmp_pathspec); 3415636a995dSmlcreech LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n", 3416636a995dSmlcreech actual_cwrapper_path)); 3417636a995dSmlcreech XFREE (tmp_pathspec); 3418636a995dSmlcreech 3419*6acb2cf6Svapier actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path)); 3420*6acb2cf6Svapier strendzap (actual_cwrapper_path, actual_cwrapper_name); 3421636a995dSmlcreech 3422*6acb2cf6Svapier /* wrapper name transforms */ 3423*6acb2cf6Svapier strendzap (actual_cwrapper_name, ".exe"); 3424*6acb2cf6Svapier tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 3425*6acb2cf6Svapier XFREE (actual_cwrapper_name); 3426*6acb2cf6Svapier actual_cwrapper_name = tmp_pathspec; 3427636a995dSmlcreech tmp_pathspec = 0; 3428*6acb2cf6Svapier 3429*6acb2cf6Svapier /* target_name transforms -- use actual target program name; might have lt- prefix */ 3430*6acb2cf6Svapier target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 3431*6acb2cf6Svapier strendzap (target_name, ".exe"); 3432*6acb2cf6Svapier tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 3433*6acb2cf6Svapier XFREE (target_name); 3434*6acb2cf6Svapier target_name = tmp_pathspec; 3435*6acb2cf6Svapier tmp_pathspec = 0; 3436*6acb2cf6Svapier 3437*6acb2cf6Svapier LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n", 3438*6acb2cf6Svapier target_name)); 3439636a995dSmlcreechEOF 3440636a995dSmlcreech 3441636a995dSmlcreech cat <<EOF 3442*6acb2cf6Svapier newargz[0] = 3443636a995dSmlcreech XMALLOC (char, (strlen (actual_cwrapper_path) + 3444*6acb2cf6Svapier strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 3445*6acb2cf6Svapier strcpy (newargz[0], actual_cwrapper_path); 3446*6acb2cf6Svapier strcat (newargz[0], "$objdir"); 3447*6acb2cf6Svapier strcat (newargz[0], "/"); 3448636a995dSmlcreechEOF 3449636a995dSmlcreech 3450*6acb2cf6Svapier cat <<"EOF" 3451*6acb2cf6Svapier /* stop here, and copy so we don't have to do this twice */ 3452*6acb2cf6Svapier tmp_pathspec = xstrdup (newargz[0]); 3453*6acb2cf6Svapier 3454*6acb2cf6Svapier /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 3455*6acb2cf6Svapier strcat (newargz[0], actual_cwrapper_name); 3456*6acb2cf6Svapier 3457*6acb2cf6Svapier /* DO want the lt- prefix here if it exists, so use target_name */ 3458*6acb2cf6Svapier lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 3459*6acb2cf6Svapier XFREE (tmp_pathspec); 3460*6acb2cf6Svapier tmp_pathspec = NULL; 3461*6acb2cf6SvapierEOF 3462636a995dSmlcreech 3463636a995dSmlcreech case $host_os in 3464636a995dSmlcreech mingw*) 3465636a995dSmlcreech cat <<"EOF" 3466636a995dSmlcreech { 3467636a995dSmlcreech char* p; 3468*6acb2cf6Svapier while ((p = strchr (newargz[0], '\\')) != NULL) 3469*6acb2cf6Svapier { 3470*6acb2cf6Svapier *p = '/'; 3471*6acb2cf6Svapier } 3472*6acb2cf6Svapier while ((p = strchr (lt_argv_zero, '\\')) != NULL) 3473636a995dSmlcreech { 3474636a995dSmlcreech *p = '/'; 3475636a995dSmlcreech } 3476636a995dSmlcreech } 3477636a995dSmlcreechEOF 3478636a995dSmlcreech ;; 3479636a995dSmlcreech esac 3480636a995dSmlcreech 3481636a995dSmlcreech cat <<"EOF" 3482*6acb2cf6Svapier XFREE (target_name); 3483636a995dSmlcreech XFREE (actual_cwrapper_path); 3484*6acb2cf6Svapier XFREE (actual_cwrapper_name); 3485636a995dSmlcreech 3486*6acb2cf6Svapier lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 3487*6acb2cf6Svapier lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 3488*6acb2cf6Svapier lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 3489*6acb2cf6Svapier lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 3490636a995dSmlcreech 3491*6acb2cf6Svapier newargc=0; 3492636a995dSmlcreech for (i = 1; i < argc; i++) 3493636a995dSmlcreech { 3494*6acb2cf6Svapier if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0) 3495*6acb2cf6Svapier { 3496*6acb2cf6Svapier if (argv[i][env_set_opt_len] == '=') 3497*6acb2cf6Svapier { 3498*6acb2cf6Svapier const char *p = argv[i] + env_set_opt_len + 1; 3499*6acb2cf6Svapier lt_opt_process_env_set (p); 3500*6acb2cf6Svapier } 3501*6acb2cf6Svapier else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc) 3502*6acb2cf6Svapier { 3503*6acb2cf6Svapier lt_opt_process_env_set (argv[++i]); /* don't copy */ 3504*6acb2cf6Svapier } 3505*6acb2cf6Svapier else 3506*6acb2cf6Svapier lt_fatal ("%s missing required argument", env_set_opt); 3507*6acb2cf6Svapier continue; 3508*6acb2cf6Svapier } 3509*6acb2cf6Svapier if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0) 3510*6acb2cf6Svapier { 3511*6acb2cf6Svapier if (argv[i][env_prepend_opt_len] == '=') 3512*6acb2cf6Svapier { 3513*6acb2cf6Svapier const char *p = argv[i] + env_prepend_opt_len + 1; 3514*6acb2cf6Svapier lt_opt_process_env_prepend (p); 3515*6acb2cf6Svapier } 3516*6acb2cf6Svapier else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc) 3517*6acb2cf6Svapier { 3518*6acb2cf6Svapier lt_opt_process_env_prepend (argv[++i]); /* don't copy */ 3519*6acb2cf6Svapier } 3520*6acb2cf6Svapier else 3521*6acb2cf6Svapier lt_fatal ("%s missing required argument", env_prepend_opt); 3522*6acb2cf6Svapier continue; 3523*6acb2cf6Svapier } 3524*6acb2cf6Svapier if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0) 3525*6acb2cf6Svapier { 3526*6acb2cf6Svapier if (argv[i][env_append_opt_len] == '=') 3527*6acb2cf6Svapier { 3528*6acb2cf6Svapier const char *p = argv[i] + env_append_opt_len + 1; 3529*6acb2cf6Svapier lt_opt_process_env_append (p); 3530*6acb2cf6Svapier } 3531*6acb2cf6Svapier else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc) 3532*6acb2cf6Svapier { 3533*6acb2cf6Svapier lt_opt_process_env_append (argv[++i]); /* don't copy */ 3534*6acb2cf6Svapier } 3535*6acb2cf6Svapier else 3536*6acb2cf6Svapier lt_fatal ("%s missing required argument", env_append_opt); 3537*6acb2cf6Svapier continue; 3538*6acb2cf6Svapier } 3539*6acb2cf6Svapier if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0) 3540*6acb2cf6Svapier { 3541*6acb2cf6Svapier /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 3542*6acb2cf6Svapier namespace, but it is not one of the ones we know about and 3543*6acb2cf6Svapier have already dealt with, above (inluding dump-script), then 3544*6acb2cf6Svapier report an error. Otherwise, targets might begin to believe 3545*6acb2cf6Svapier they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 3546*6acb2cf6Svapier namespace. The first time any user complains about this, we'll 3547*6acb2cf6Svapier need to make LTWRAPPER_OPTION_PREFIX a configure-time option 3548*6acb2cf6Svapier or a configure.ac-settable value. 3549*6acb2cf6Svapier */ 3550*6acb2cf6Svapier lt_fatal ("Unrecognized option in %s namespace: '%s'", 3551*6acb2cf6Svapier ltwrapper_option_prefix, argv[i]); 3552*6acb2cf6Svapier } 3553*6acb2cf6Svapier /* otherwise ... */ 3554*6acb2cf6Svapier newargz[++newargc] = xstrdup (argv[i]); 3555*6acb2cf6Svapier } 3556*6acb2cf6Svapier newargz[++newargc] = NULL; 3557*6acb2cf6Svapier 3558*6acb2cf6Svapier LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>"))); 3559*6acb2cf6Svapier for (i = 0; i < newargc; i++) 3560*6acb2cf6Svapier { 3561*6acb2cf6Svapier LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>"))); 3562636a995dSmlcreech } 3563636a995dSmlcreech 3564636a995dSmlcreechEOF 3565636a995dSmlcreech 3566636a995dSmlcreech case $host_os in 3567636a995dSmlcreech mingw*) 3568*6acb2cf6Svapier cat <<"EOF" 3569636a995dSmlcreech /* execv doesn't actually work on mingw as expected on unix */ 3570*6acb2cf6Svapier rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 3571636a995dSmlcreech if (rval == -1) 3572636a995dSmlcreech { 3573636a995dSmlcreech /* failed to start process */ 3574*6acb2cf6Svapier LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); 3575636a995dSmlcreech return 127; 3576636a995dSmlcreech } 3577636a995dSmlcreech return rval; 3578636a995dSmlcreechEOF 3579636a995dSmlcreech ;; 3580636a995dSmlcreech *) 3581*6acb2cf6Svapier cat <<"EOF" 3582*6acb2cf6Svapier execv (lt_argv_zero, newargz); 3583636a995dSmlcreech return rval; /* =127, but avoids unused variable warning */ 3584636a995dSmlcreechEOF 3585636a995dSmlcreech ;; 3586636a995dSmlcreech esac 3587636a995dSmlcreech 3588636a995dSmlcreech cat <<"EOF" 3589*6acb2cf6Svapier} 3590636a995dSmlcreech 3591636a995dSmlcreechvoid * 3592636a995dSmlcreechxmalloc (size_t num) 3593636a995dSmlcreech{ 3594636a995dSmlcreech void *p = (void *) malloc (num); 3595636a995dSmlcreech if (!p) 3596636a995dSmlcreech lt_fatal ("Memory exhausted"); 3597636a995dSmlcreech 3598636a995dSmlcreech return p; 3599636a995dSmlcreech} 3600636a995dSmlcreech 3601636a995dSmlcreechchar * 3602636a995dSmlcreechxstrdup (const char *string) 3603636a995dSmlcreech{ 3604636a995dSmlcreech return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 3605636a995dSmlcreech string) : NULL; 3606636a995dSmlcreech} 3607636a995dSmlcreech 3608636a995dSmlcreechconst char * 3609636a995dSmlcreechbase_name (const char *name) 3610636a995dSmlcreech{ 3611636a995dSmlcreech const char *base; 3612636a995dSmlcreech 3613636a995dSmlcreech#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 3614636a995dSmlcreech /* Skip over the disk name in MSDOS pathnames. */ 3615636a995dSmlcreech if (isalpha ((unsigned char) name[0]) && name[1] == ':') 3616636a995dSmlcreech name += 2; 3617636a995dSmlcreech#endif 3618636a995dSmlcreech 3619636a995dSmlcreech for (base = name; *name; name++) 3620636a995dSmlcreech if (IS_DIR_SEPARATOR (*name)) 3621636a995dSmlcreech base = name + 1; 3622636a995dSmlcreech return base; 3623636a995dSmlcreech} 3624636a995dSmlcreech 3625636a995dSmlcreechint 3626636a995dSmlcreechcheck_executable (const char *path) 3627636a995dSmlcreech{ 3628636a995dSmlcreech struct stat st; 3629636a995dSmlcreech 3630636a995dSmlcreech LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", 3631636a995dSmlcreech path ? (*path ? path : "EMPTY!") : "NULL!")); 3632636a995dSmlcreech if ((!path) || (!*path)) 3633636a995dSmlcreech return 0; 3634636a995dSmlcreech 3635636a995dSmlcreech if ((stat (path, &st) >= 0) 3636636a995dSmlcreech && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 3637636a995dSmlcreech return 1; 3638636a995dSmlcreech else 3639636a995dSmlcreech return 0; 3640636a995dSmlcreech} 3641636a995dSmlcreech 3642636a995dSmlcreechint 3643636a995dSmlcreechmake_executable (const char *path) 3644636a995dSmlcreech{ 3645636a995dSmlcreech int rval = 0; 3646636a995dSmlcreech struct stat st; 3647636a995dSmlcreech 3648636a995dSmlcreech LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", 3649636a995dSmlcreech path ? (*path ? path : "EMPTY!") : "NULL!")); 3650636a995dSmlcreech if ((!path) || (!*path)) 3651636a995dSmlcreech return 0; 3652636a995dSmlcreech 3653636a995dSmlcreech if (stat (path, &st) >= 0) 3654636a995dSmlcreech { 3655636a995dSmlcreech rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 3656636a995dSmlcreech } 3657636a995dSmlcreech return rval; 3658636a995dSmlcreech} 3659636a995dSmlcreech 3660636a995dSmlcreech/* Searches for the full path of the wrapper. Returns 3661636a995dSmlcreech newly allocated full path name if found, NULL otherwise 3662636a995dSmlcreech Does not chase symlinks, even on platforms that support them. 3663636a995dSmlcreech*/ 3664636a995dSmlcreechchar * 3665636a995dSmlcreechfind_executable (const char *wrapper) 3666636a995dSmlcreech{ 3667636a995dSmlcreech int has_slash = 0; 3668636a995dSmlcreech const char *p; 3669636a995dSmlcreech const char *p_next; 3670636a995dSmlcreech /* static buffer for getcwd */ 3671636a995dSmlcreech char tmp[LT_PATHMAX + 1]; 3672636a995dSmlcreech int tmp_len; 3673636a995dSmlcreech char *concat_name; 3674636a995dSmlcreech 3675636a995dSmlcreech LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", 3676636a995dSmlcreech wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); 3677636a995dSmlcreech 3678636a995dSmlcreech if ((wrapper == NULL) || (*wrapper == '\0')) 3679636a995dSmlcreech return NULL; 3680636a995dSmlcreech 3681636a995dSmlcreech /* Absolute path? */ 3682636a995dSmlcreech#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 3683636a995dSmlcreech if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 3684636a995dSmlcreech { 3685636a995dSmlcreech concat_name = xstrdup (wrapper); 3686636a995dSmlcreech if (check_executable (concat_name)) 3687636a995dSmlcreech return concat_name; 3688636a995dSmlcreech XFREE (concat_name); 3689636a995dSmlcreech } 3690636a995dSmlcreech else 3691636a995dSmlcreech { 3692636a995dSmlcreech#endif 3693636a995dSmlcreech if (IS_DIR_SEPARATOR (wrapper[0])) 3694636a995dSmlcreech { 3695636a995dSmlcreech concat_name = xstrdup (wrapper); 3696636a995dSmlcreech if (check_executable (concat_name)) 3697636a995dSmlcreech return concat_name; 3698636a995dSmlcreech XFREE (concat_name); 3699636a995dSmlcreech } 3700636a995dSmlcreech#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 3701636a995dSmlcreech } 3702636a995dSmlcreech#endif 3703636a995dSmlcreech 3704636a995dSmlcreech for (p = wrapper; *p; p++) 3705636a995dSmlcreech if (*p == '/') 3706636a995dSmlcreech { 3707636a995dSmlcreech has_slash = 1; 3708636a995dSmlcreech break; 3709636a995dSmlcreech } 3710636a995dSmlcreech if (!has_slash) 3711636a995dSmlcreech { 3712636a995dSmlcreech /* no slashes; search PATH */ 3713636a995dSmlcreech const char *path = getenv ("PATH"); 3714636a995dSmlcreech if (path != NULL) 3715636a995dSmlcreech { 3716636a995dSmlcreech for (p = path; *p; p = p_next) 3717636a995dSmlcreech { 3718636a995dSmlcreech const char *q; 3719636a995dSmlcreech size_t p_len; 3720636a995dSmlcreech for (q = p; *q; q++) 3721636a995dSmlcreech if (IS_PATH_SEPARATOR (*q)) 3722636a995dSmlcreech break; 3723636a995dSmlcreech p_len = q - p; 3724636a995dSmlcreech p_next = (*q == '\0' ? q : q + 1); 3725636a995dSmlcreech if (p_len == 0) 3726636a995dSmlcreech { 3727636a995dSmlcreech /* empty path: current directory */ 3728636a995dSmlcreech if (getcwd (tmp, LT_PATHMAX) == NULL) 3729636a995dSmlcreech lt_fatal ("getcwd failed"); 3730636a995dSmlcreech tmp_len = strlen (tmp); 3731636a995dSmlcreech concat_name = 3732636a995dSmlcreech XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 3733636a995dSmlcreech memcpy (concat_name, tmp, tmp_len); 3734636a995dSmlcreech concat_name[tmp_len] = '/'; 3735636a995dSmlcreech strcpy (concat_name + tmp_len + 1, wrapper); 3736636a995dSmlcreech } 3737636a995dSmlcreech else 3738636a995dSmlcreech { 3739636a995dSmlcreech concat_name = 3740636a995dSmlcreech XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 3741636a995dSmlcreech memcpy (concat_name, p, p_len); 3742636a995dSmlcreech concat_name[p_len] = '/'; 3743636a995dSmlcreech strcpy (concat_name + p_len + 1, wrapper); 3744636a995dSmlcreech } 3745636a995dSmlcreech if (check_executable (concat_name)) 3746636a995dSmlcreech return concat_name; 3747636a995dSmlcreech XFREE (concat_name); 3748636a995dSmlcreech } 3749636a995dSmlcreech } 3750636a995dSmlcreech /* not found in PATH; assume curdir */ 3751636a995dSmlcreech } 3752636a995dSmlcreech /* Relative path | not found in path: prepend cwd */ 3753636a995dSmlcreech if (getcwd (tmp, LT_PATHMAX) == NULL) 3754636a995dSmlcreech lt_fatal ("getcwd failed"); 3755636a995dSmlcreech tmp_len = strlen (tmp); 3756636a995dSmlcreech concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 3757636a995dSmlcreech memcpy (concat_name, tmp, tmp_len); 3758636a995dSmlcreech concat_name[tmp_len] = '/'; 3759636a995dSmlcreech strcpy (concat_name + tmp_len + 1, wrapper); 3760636a995dSmlcreech 3761636a995dSmlcreech if (check_executable (concat_name)) 3762636a995dSmlcreech return concat_name; 3763636a995dSmlcreech XFREE (concat_name); 3764636a995dSmlcreech return NULL; 3765636a995dSmlcreech} 3766636a995dSmlcreech 3767636a995dSmlcreechchar * 3768636a995dSmlcreechchase_symlinks (const char *pathspec) 3769636a995dSmlcreech{ 3770636a995dSmlcreech#ifndef S_ISLNK 3771636a995dSmlcreech return xstrdup (pathspec); 3772636a995dSmlcreech#else 3773636a995dSmlcreech char buf[LT_PATHMAX]; 3774636a995dSmlcreech struct stat s; 3775636a995dSmlcreech char *tmp_pathspec = xstrdup (pathspec); 3776636a995dSmlcreech char *p; 3777636a995dSmlcreech int has_symlinks = 0; 3778636a995dSmlcreech while (strlen (tmp_pathspec) && !has_symlinks) 3779636a995dSmlcreech { 3780636a995dSmlcreech LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", 3781636a995dSmlcreech tmp_pathspec)); 3782636a995dSmlcreech if (lstat (tmp_pathspec, &s) == 0) 3783636a995dSmlcreech { 3784636a995dSmlcreech if (S_ISLNK (s.st_mode) != 0) 3785636a995dSmlcreech { 3786636a995dSmlcreech has_symlinks = 1; 3787636a995dSmlcreech break; 3788636a995dSmlcreech } 3789636a995dSmlcreech 3790636a995dSmlcreech /* search backwards for last DIR_SEPARATOR */ 3791636a995dSmlcreech p = tmp_pathspec + strlen (tmp_pathspec) - 1; 3792636a995dSmlcreech while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 3793636a995dSmlcreech p--; 3794636a995dSmlcreech if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 3795636a995dSmlcreech { 3796636a995dSmlcreech /* no more DIR_SEPARATORS left */ 3797636a995dSmlcreech break; 3798636a995dSmlcreech } 3799636a995dSmlcreech *p = '\0'; 3800636a995dSmlcreech } 3801636a995dSmlcreech else 3802636a995dSmlcreech { 3803636a995dSmlcreech char *errstr = strerror (errno); 3804636a995dSmlcreech lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); 3805636a995dSmlcreech } 3806636a995dSmlcreech } 3807636a995dSmlcreech XFREE (tmp_pathspec); 3808636a995dSmlcreech 3809636a995dSmlcreech if (!has_symlinks) 3810636a995dSmlcreech { 3811636a995dSmlcreech return xstrdup (pathspec); 3812636a995dSmlcreech } 3813636a995dSmlcreech 3814636a995dSmlcreech tmp_pathspec = realpath (pathspec, buf); 3815636a995dSmlcreech if (tmp_pathspec == 0) 3816636a995dSmlcreech { 3817636a995dSmlcreech lt_fatal ("Could not follow symlinks for %s", pathspec); 3818636a995dSmlcreech } 3819636a995dSmlcreech return xstrdup (tmp_pathspec); 3820636a995dSmlcreech#endif 3821636a995dSmlcreech} 3822636a995dSmlcreech 3823636a995dSmlcreechchar * 3824636a995dSmlcreechstrendzap (char *str, const char *pat) 3825636a995dSmlcreech{ 3826636a995dSmlcreech size_t len, patlen; 3827636a995dSmlcreech 3828636a995dSmlcreech assert (str != NULL); 3829636a995dSmlcreech assert (pat != NULL); 3830636a995dSmlcreech 3831636a995dSmlcreech len = strlen (str); 3832636a995dSmlcreech patlen = strlen (pat); 3833636a995dSmlcreech 3834636a995dSmlcreech if (patlen <= len) 3835636a995dSmlcreech { 3836636a995dSmlcreech str += len - patlen; 3837636a995dSmlcreech if (strcmp (str, pat) == 0) 3838636a995dSmlcreech *str = '\0'; 3839636a995dSmlcreech } 3840636a995dSmlcreech return str; 3841636a995dSmlcreech} 3842636a995dSmlcreech 3843636a995dSmlcreechstatic void 3844636a995dSmlcreechlt_error_core (int exit_status, const char *mode, 3845636a995dSmlcreech const char *message, va_list ap) 3846636a995dSmlcreech{ 3847636a995dSmlcreech fprintf (stderr, "%s: %s: ", program_name, mode); 3848636a995dSmlcreech vfprintf (stderr, message, ap); 3849636a995dSmlcreech fprintf (stderr, ".\n"); 3850636a995dSmlcreech 3851636a995dSmlcreech if (exit_status >= 0) 3852636a995dSmlcreech exit (exit_status); 3853636a995dSmlcreech} 3854636a995dSmlcreech 3855636a995dSmlcreechvoid 3856636a995dSmlcreechlt_fatal (const char *message, ...) 3857636a995dSmlcreech{ 3858636a995dSmlcreech va_list ap; 3859636a995dSmlcreech va_start (ap, message); 3860636a995dSmlcreech lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 3861636a995dSmlcreech va_end (ap); 3862636a995dSmlcreech} 3863*6acb2cf6Svapier 3864*6acb2cf6Svapiervoid 3865*6acb2cf6Svapierlt_setenv (const char *name, const char *value) 3866*6acb2cf6Svapier{ 3867*6acb2cf6Svapier LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", 3868*6acb2cf6Svapier (name ? name : "<NULL>"), 3869*6acb2cf6Svapier (value ? value : "<NULL>"))); 3870*6acb2cf6Svapier { 3871*6acb2cf6Svapier#ifdef HAVE_SETENV 3872*6acb2cf6Svapier /* always make a copy, for consistency with !HAVE_SETENV */ 3873*6acb2cf6Svapier char *str = xstrdup (value); 3874*6acb2cf6Svapier setenv (name, str, 1); 3875*6acb2cf6Svapier#else 3876*6acb2cf6Svapier int len = strlen (name) + 1 + strlen (value) + 1; 3877*6acb2cf6Svapier char *str = XMALLOC (char, len); 3878*6acb2cf6Svapier sprintf (str, "%s=%s", name, value); 3879*6acb2cf6Svapier if (putenv (str) != EXIT_SUCCESS) 3880*6acb2cf6Svapier { 3881*6acb2cf6Svapier XFREE (str); 3882*6acb2cf6Svapier } 3883*6acb2cf6Svapier#endif 3884*6acb2cf6Svapier } 3885*6acb2cf6Svapier} 3886*6acb2cf6Svapier 3887*6acb2cf6Svapierchar * 3888*6acb2cf6Svapierlt_extend_str (const char *orig_value, const char *add, int to_end) 3889*6acb2cf6Svapier{ 3890*6acb2cf6Svapier char *new_value; 3891*6acb2cf6Svapier if (orig_value && *orig_value) 3892*6acb2cf6Svapier { 3893*6acb2cf6Svapier int orig_value_len = strlen (orig_value); 3894*6acb2cf6Svapier int add_len = strlen (add); 3895*6acb2cf6Svapier new_value = XMALLOC (char, add_len + orig_value_len + 1); 3896*6acb2cf6Svapier if (to_end) 3897*6acb2cf6Svapier { 3898*6acb2cf6Svapier strcpy (new_value, orig_value); 3899*6acb2cf6Svapier strcpy (new_value + orig_value_len, add); 3900*6acb2cf6Svapier } 3901*6acb2cf6Svapier else 3902*6acb2cf6Svapier { 3903*6acb2cf6Svapier strcpy (new_value, add); 3904*6acb2cf6Svapier strcpy (new_value + add_len, orig_value); 3905*6acb2cf6Svapier } 3906*6acb2cf6Svapier } 3907*6acb2cf6Svapier else 3908*6acb2cf6Svapier { 3909*6acb2cf6Svapier new_value = xstrdup (add); 3910*6acb2cf6Svapier } 3911*6acb2cf6Svapier return new_value; 3912*6acb2cf6Svapier} 3913*6acb2cf6Svapier 3914*6acb2cf6Svapierint 3915*6acb2cf6Svapierlt_split_name_value (const char *arg, char** name, char** value) 3916*6acb2cf6Svapier{ 3917*6acb2cf6Svapier const char *p; 3918*6acb2cf6Svapier int len; 3919*6acb2cf6Svapier if (!arg || !*arg) 3920*6acb2cf6Svapier return 1; 3921*6acb2cf6Svapier 3922*6acb2cf6Svapier p = strchr (arg, (int)'='); 3923*6acb2cf6Svapier 3924*6acb2cf6Svapier if (!p) 3925*6acb2cf6Svapier return 1; 3926*6acb2cf6Svapier 3927*6acb2cf6Svapier *value = xstrdup (++p); 3928*6acb2cf6Svapier 3929*6acb2cf6Svapier len = strlen (arg) - strlen (*value); 3930*6acb2cf6Svapier *name = XMALLOC (char, len); 3931*6acb2cf6Svapier strncpy (*name, arg, len-1); 3932*6acb2cf6Svapier (*name)[len - 1] = '\0'; 3933*6acb2cf6Svapier 3934*6acb2cf6Svapier return 0; 3935*6acb2cf6Svapier} 3936*6acb2cf6Svapier 3937*6acb2cf6Svapiervoid 3938*6acb2cf6Svapierlt_opt_process_env_set (const char *arg) 3939*6acb2cf6Svapier{ 3940*6acb2cf6Svapier char *name = NULL; 3941*6acb2cf6Svapier char *value = NULL; 3942*6acb2cf6Svapier 3943*6acb2cf6Svapier if (lt_split_name_value (arg, &name, &value) != 0) 3944*6acb2cf6Svapier { 3945*6acb2cf6Svapier XFREE (name); 3946*6acb2cf6Svapier XFREE (value); 3947*6acb2cf6Svapier lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); 3948*6acb2cf6Svapier } 3949*6acb2cf6Svapier 3950*6acb2cf6Svapier lt_setenv (name, value); 3951*6acb2cf6Svapier XFREE (name); 3952*6acb2cf6Svapier XFREE (value); 3953*6acb2cf6Svapier} 3954*6acb2cf6Svapier 3955*6acb2cf6Svapiervoid 3956*6acb2cf6Svapierlt_opt_process_env_prepend (const char *arg) 3957*6acb2cf6Svapier{ 3958*6acb2cf6Svapier char *name = NULL; 3959*6acb2cf6Svapier char *value = NULL; 3960*6acb2cf6Svapier char *new_value = NULL; 3961*6acb2cf6Svapier 3962*6acb2cf6Svapier if (lt_split_name_value (arg, &name, &value) != 0) 3963*6acb2cf6Svapier { 3964*6acb2cf6Svapier XFREE (name); 3965*6acb2cf6Svapier XFREE (value); 3966*6acb2cf6Svapier lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); 3967*6acb2cf6Svapier } 3968*6acb2cf6Svapier 3969*6acb2cf6Svapier new_value = lt_extend_str (getenv (name), value, 0); 3970*6acb2cf6Svapier lt_setenv (name, new_value); 3971*6acb2cf6Svapier XFREE (new_value); 3972*6acb2cf6Svapier XFREE (name); 3973*6acb2cf6Svapier XFREE (value); 3974*6acb2cf6Svapier} 3975*6acb2cf6Svapier 3976*6acb2cf6Svapiervoid 3977*6acb2cf6Svapierlt_opt_process_env_append (const char *arg) 3978*6acb2cf6Svapier{ 3979*6acb2cf6Svapier char *name = NULL; 3980*6acb2cf6Svapier char *value = NULL; 3981*6acb2cf6Svapier char *new_value = NULL; 3982*6acb2cf6Svapier 3983*6acb2cf6Svapier if (lt_split_name_value (arg, &name, &value) != 0) 3984*6acb2cf6Svapier { 3985*6acb2cf6Svapier XFREE (name); 3986*6acb2cf6Svapier XFREE (value); 3987*6acb2cf6Svapier lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); 3988*6acb2cf6Svapier } 3989*6acb2cf6Svapier 3990*6acb2cf6Svapier new_value = lt_extend_str (getenv (name), value, 1); 3991*6acb2cf6Svapier lt_setenv (name, new_value); 3992*6acb2cf6Svapier XFREE (new_value); 3993*6acb2cf6Svapier XFREE (name); 3994*6acb2cf6Svapier XFREE (value); 3995*6acb2cf6Svapier} 3996*6acb2cf6Svapier 3997*6acb2cf6Svapiervoid 3998*6acb2cf6Svapierlt_update_exe_path (const char *name, const char *value) 3999*6acb2cf6Svapier{ 4000*6acb2cf6Svapier LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 4001*6acb2cf6Svapier (name ? name : "<NULL>"), 4002*6acb2cf6Svapier (value ? value : "<NULL>"))); 4003*6acb2cf6Svapier 4004*6acb2cf6Svapier if (name && *name && value && *value) 4005*6acb2cf6Svapier { 4006*6acb2cf6Svapier char *new_value = lt_extend_str (getenv (name), value, 0); 4007*6acb2cf6Svapier /* some systems can't cope with a ':'-terminated path #' */ 4008*6acb2cf6Svapier int len = strlen (new_value); 4009*6acb2cf6Svapier while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 4010*6acb2cf6Svapier { 4011*6acb2cf6Svapier new_value[len-1] = '\0'; 4012*6acb2cf6Svapier } 4013*6acb2cf6Svapier lt_setenv (name, new_value); 4014*6acb2cf6Svapier XFREE (new_value); 4015*6acb2cf6Svapier } 4016*6acb2cf6Svapier} 4017*6acb2cf6Svapier 4018*6acb2cf6Svapiervoid 4019*6acb2cf6Svapierlt_update_lib_path (const char *name, const char *value) 4020*6acb2cf6Svapier{ 4021*6acb2cf6Svapier LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 4022*6acb2cf6Svapier (name ? name : "<NULL>"), 4023*6acb2cf6Svapier (value ? value : "<NULL>"))); 4024*6acb2cf6Svapier 4025*6acb2cf6Svapier if (name && *name && value && *value) 4026*6acb2cf6Svapier { 4027*6acb2cf6Svapier char *new_value = lt_extend_str (getenv (name), value, 0); 4028*6acb2cf6Svapier lt_setenv (name, new_value); 4029*6acb2cf6Svapier XFREE (new_value); 4030*6acb2cf6Svapier } 4031*6acb2cf6Svapier} 4032*6acb2cf6Svapier 4033*6acb2cf6Svapier 4034636a995dSmlcreechEOF 4035636a995dSmlcreech} 4036636a995dSmlcreech# end: func_emit_cwrapperexe_src 4037636a995dSmlcreech 4038636a995dSmlcreech# func_mode_link arg... 4039636a995dSmlcreechfunc_mode_link () 4040636a995dSmlcreech{ 4041636a995dSmlcreech $opt_debug 404271eb93eaSdrh case $host in 4043*6acb2cf6Svapier *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 404471eb93eaSdrh # It is impossible to link a dll without this setting, and 404571eb93eaSdrh # we shouldn't force the makefile maintainer to figure out 404671eb93eaSdrh # which system we are compiling for in order to pass an extra 4047964dbb1eSa.rottmann # flag for every libtool invocation. 404871eb93eaSdrh # allow_undefined=no 404971eb93eaSdrh 405071eb93eaSdrh # FIXME: Unfortunately, there are problems with the above when trying 405171eb93eaSdrh # to make a dll which has undefined symbols, in which case not 405271eb93eaSdrh # even a static library is built. For now, we need to specify 405371eb93eaSdrh # -no-undefined on the libtool link line when we can be certain 405471eb93eaSdrh # that all symbols are satisfied, otherwise we get a static library. 405571eb93eaSdrh allow_undefined=yes 405671eb93eaSdrh ;; 405771eb93eaSdrh *) 405871eb93eaSdrh allow_undefined=yes 405971eb93eaSdrh ;; 406071eb93eaSdrh esac 4061636a995dSmlcreech libtool_args=$nonopt 4062964dbb1eSa.rottmann base_compile="$nonopt $@" 4063636a995dSmlcreech compile_command=$nonopt 4064636a995dSmlcreech finalize_command=$nonopt 406571eb93eaSdrh 406671eb93eaSdrh compile_rpath= 406771eb93eaSdrh finalize_rpath= 406871eb93eaSdrh compile_shlibpath= 406971eb93eaSdrh finalize_shlibpath= 407071eb93eaSdrh convenience= 407171eb93eaSdrh old_convenience= 407271eb93eaSdrh deplibs= 407371eb93eaSdrh old_deplibs= 407471eb93eaSdrh compiler_flags= 407571eb93eaSdrh linker_flags= 407671eb93eaSdrh dllsearchpath= 407771eb93eaSdrh lib_search_path=`pwd` 407862507b65Sa.rottmann inst_prefix_dir= 4079636a995dSmlcreech new_inherited_linker_flags= 408071eb93eaSdrh 408171eb93eaSdrh avoid_version=no 408271eb93eaSdrh dlfiles= 408371eb93eaSdrh dlprefiles= 408471eb93eaSdrh dlself=no 408571eb93eaSdrh export_dynamic=no 408671eb93eaSdrh export_symbols= 408771eb93eaSdrh export_symbols_regex= 408871eb93eaSdrh generated= 408971eb93eaSdrh libobjs= 409071eb93eaSdrh ltlibs= 409171eb93eaSdrh module=no 409271eb93eaSdrh no_install=no 409371eb93eaSdrh objs= 4094964dbb1eSa.rottmann non_pic_objects= 4095964dbb1eSa.rottmann precious_files_regex= 409671eb93eaSdrh prefer_static_libs=no 409771eb93eaSdrh preload=no 409871eb93eaSdrh prev= 409971eb93eaSdrh prevarg= 410071eb93eaSdrh release= 410171eb93eaSdrh rpath= 410271eb93eaSdrh xrpath= 410371eb93eaSdrh perm_rpath= 410471eb93eaSdrh temp_rpath= 410571eb93eaSdrh thread_safe=no 410671eb93eaSdrh vinfo= 4107964dbb1eSa.rottmann vinfo_number=no 4108636a995dSmlcreech weak_libs= 4109636a995dSmlcreech single_module="${wl}-single_module" 41107f19c02fSvapier func_infer_tag $base_compile 411171eb93eaSdrh 411271eb93eaSdrh # We need to know -static, to get the right output filenames. 411371eb93eaSdrh for arg 411471eb93eaSdrh do 411571eb93eaSdrh case $arg in 4116636a995dSmlcreech -shared) 4117636a995dSmlcreech test "$build_libtool_libs" != yes && \ 4118636a995dSmlcreech func_fatal_configuration "can not build a shared library" 4119636a995dSmlcreech build_old_libs=no 4120636a995dSmlcreech break 4121636a995dSmlcreech ;; 4122636a995dSmlcreech -all-static | -static | -static-libtool-libs) 4123636a995dSmlcreech case $arg in 4124636a995dSmlcreech -all-static) 412571eb93eaSdrh if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 4126636a995dSmlcreech func_warning "complete static linking is impossible in this configuration" 412771eb93eaSdrh fi 412871eb93eaSdrh if test -n "$link_static_flag"; then 412971eb93eaSdrh dlopen_self=$dlopen_self_static 413071eb93eaSdrh fi 41317f19c02fSvapier prefer_static_libs=yes 4132636a995dSmlcreech ;; 4133636a995dSmlcreech -static) 413471eb93eaSdrh if test -z "$pic_flag" && test -n "$link_static_flag"; then 413571eb93eaSdrh dlopen_self=$dlopen_self_static 413671eb93eaSdrh fi 41377f19c02fSvapier prefer_static_libs=built 4138636a995dSmlcreech ;; 4139636a995dSmlcreech -static-libtool-libs) 4140636a995dSmlcreech if test -z "$pic_flag" && test -n "$link_static_flag"; then 4141636a995dSmlcreech dlopen_self=$dlopen_self_static 414271eb93eaSdrh fi 4143636a995dSmlcreech prefer_static_libs=yes 4144636a995dSmlcreech ;; 4145636a995dSmlcreech esac 414671eb93eaSdrh build_libtool_libs=no 414771eb93eaSdrh build_old_libs=yes 414871eb93eaSdrh break 414971eb93eaSdrh ;; 415071eb93eaSdrh esac 415171eb93eaSdrh done 415271eb93eaSdrh 415371eb93eaSdrh # See if our shared archives depend on static archives. 415471eb93eaSdrh test -n "$old_archive_from_new_cmds" && build_old_libs=yes 415571eb93eaSdrh 415671eb93eaSdrh # Go through the arguments, transforming them on the way. 4157964dbb1eSa.rottmann while test "$#" -gt 0; do 415871eb93eaSdrh arg="$1" 415971eb93eaSdrh shift 4160636a995dSmlcreech func_quote_for_eval "$arg" 4161636a995dSmlcreech qarg=$func_quote_for_eval_unquoted_result 4162636a995dSmlcreech func_append libtool_args " $func_quote_for_eval_result" 416371eb93eaSdrh 416471eb93eaSdrh # If the previous option needs an argument, assign it. 416571eb93eaSdrh if test -n "$prev"; then 416671eb93eaSdrh case $prev in 416771eb93eaSdrh output) 4168636a995dSmlcreech func_append compile_command " @OUTPUT@" 4169636a995dSmlcreech func_append finalize_command " @OUTPUT@" 417071eb93eaSdrh ;; 417171eb93eaSdrh esac 417271eb93eaSdrh 417371eb93eaSdrh case $prev in 417471eb93eaSdrh dlfiles|dlprefiles) 417571eb93eaSdrh if test "$preload" = no; then 417671eb93eaSdrh # Add the symbol object into the linking commands. 4177636a995dSmlcreech func_append compile_command " @SYMFILE@" 4178636a995dSmlcreech func_append finalize_command " @SYMFILE@" 417971eb93eaSdrh preload=yes 418071eb93eaSdrh fi 418171eb93eaSdrh case $arg in 418271eb93eaSdrh *.la | *.lo) ;; # We handle these cases below. 418371eb93eaSdrh force) 418471eb93eaSdrh if test "$dlself" = no; then 418571eb93eaSdrh dlself=needless 418671eb93eaSdrh export_dynamic=yes 418771eb93eaSdrh fi 418871eb93eaSdrh prev= 418971eb93eaSdrh continue 419071eb93eaSdrh ;; 419171eb93eaSdrh self) 419271eb93eaSdrh if test "$prev" = dlprefiles; then 419371eb93eaSdrh dlself=yes 419471eb93eaSdrh elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 419571eb93eaSdrh dlself=yes 419671eb93eaSdrh else 419771eb93eaSdrh dlself=needless 419871eb93eaSdrh export_dynamic=yes 419971eb93eaSdrh fi 420071eb93eaSdrh prev= 420171eb93eaSdrh continue 420271eb93eaSdrh ;; 420371eb93eaSdrh *) 420471eb93eaSdrh if test "$prev" = dlfiles; then 420571eb93eaSdrh dlfiles="$dlfiles $arg" 420671eb93eaSdrh else 420771eb93eaSdrh dlprefiles="$dlprefiles $arg" 420871eb93eaSdrh fi 420971eb93eaSdrh prev= 421071eb93eaSdrh continue 421171eb93eaSdrh ;; 421271eb93eaSdrh esac 421371eb93eaSdrh ;; 421471eb93eaSdrh expsyms) 421571eb93eaSdrh export_symbols="$arg" 4216636a995dSmlcreech test -f "$arg" \ 4217636a995dSmlcreech || func_fatal_error "symbol file \`$arg' does not exist" 421871eb93eaSdrh prev= 421971eb93eaSdrh continue 422071eb93eaSdrh ;; 422171eb93eaSdrh expsyms_regex) 422271eb93eaSdrh export_symbols_regex="$arg" 422371eb93eaSdrh prev= 422471eb93eaSdrh continue 422571eb93eaSdrh ;; 4226636a995dSmlcreech framework) 4227636a995dSmlcreech case $host in 4228636a995dSmlcreech *-*-darwin*) 4229636a995dSmlcreech case "$deplibs " in 4230636a995dSmlcreech *" $qarg.ltframework "*) ;; 4231636a995dSmlcreech *) deplibs="$deplibs $qarg.ltframework" # this is fixed later 4232636a995dSmlcreech ;; 4233636a995dSmlcreech esac 4234636a995dSmlcreech ;; 4235636a995dSmlcreech esac 4236636a995dSmlcreech prev= 4237636a995dSmlcreech continue 4238636a995dSmlcreech ;; 423962507b65Sa.rottmann inst_prefix) 424062507b65Sa.rottmann inst_prefix_dir="$arg" 424171eb93eaSdrh prev= 424271eb93eaSdrh continue 424371eb93eaSdrh ;; 4244964dbb1eSa.rottmann objectlist) 4245964dbb1eSa.rottmann if test -f "$arg"; then 4246964dbb1eSa.rottmann save_arg=$arg 4247964dbb1eSa.rottmann moreargs= 4248636a995dSmlcreech for fil in `cat "$save_arg"` 4249964dbb1eSa.rottmann do 4250964dbb1eSa.rottmann# moreargs="$moreargs $fil" 4251964dbb1eSa.rottmann arg=$fil 4252964dbb1eSa.rottmann # A libtool-controlled object. 4253964dbb1eSa.rottmann 4254964dbb1eSa.rottmann # Check to see that this really is a libtool object. 4255636a995dSmlcreech if func_lalib_unsafe_p "$arg"; then 4256964dbb1eSa.rottmann pic_object= 4257964dbb1eSa.rottmann non_pic_object= 4258964dbb1eSa.rottmann 4259964dbb1eSa.rottmann # Read the .lo file 4260636a995dSmlcreech func_source "$arg" 4261964dbb1eSa.rottmann 4262636a995dSmlcreech if test -z "$pic_object" || 4263964dbb1eSa.rottmann test -z "$non_pic_object" || 4264636a995dSmlcreech test "$pic_object" = none && 4265964dbb1eSa.rottmann test "$non_pic_object" = none; then 4266636a995dSmlcreech func_fatal_error "cannot find name of object for \`$arg'" 4267964dbb1eSa.rottmann fi 4268964dbb1eSa.rottmann 4269964dbb1eSa.rottmann # Extract subdirectory from the argument. 4270636a995dSmlcreech func_dirname "$arg" "/" "" 4271636a995dSmlcreech xdir="$func_dirname_result" 4272964dbb1eSa.rottmann 4273964dbb1eSa.rottmann if test "$pic_object" != none; then 4274964dbb1eSa.rottmann # Prepend the subdirectory the object is found in. 4275964dbb1eSa.rottmann pic_object="$xdir$pic_object" 4276964dbb1eSa.rottmann 4277964dbb1eSa.rottmann if test "$prev" = dlfiles; then 4278964dbb1eSa.rottmann if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 4279964dbb1eSa.rottmann dlfiles="$dlfiles $pic_object" 4280964dbb1eSa.rottmann prev= 4281964dbb1eSa.rottmann continue 4282964dbb1eSa.rottmann else 4283964dbb1eSa.rottmann # If libtool objects are unsupported, then we need to preload. 4284964dbb1eSa.rottmann prev=dlprefiles 4285964dbb1eSa.rottmann fi 4286964dbb1eSa.rottmann fi 4287964dbb1eSa.rottmann 4288964dbb1eSa.rottmann # CHECK ME: I think I busted this. -Ossama 4289964dbb1eSa.rottmann if test "$prev" = dlprefiles; then 4290964dbb1eSa.rottmann # Preload the old-style object. 4291964dbb1eSa.rottmann dlprefiles="$dlprefiles $pic_object" 4292964dbb1eSa.rottmann prev= 4293964dbb1eSa.rottmann fi 4294964dbb1eSa.rottmann 4295964dbb1eSa.rottmann # A PIC object. 4296636a995dSmlcreech func_append libobjs " $pic_object" 4297964dbb1eSa.rottmann arg="$pic_object" 4298964dbb1eSa.rottmann fi 4299964dbb1eSa.rottmann 4300964dbb1eSa.rottmann # Non-PIC object. 4301964dbb1eSa.rottmann if test "$non_pic_object" != none; then 4302964dbb1eSa.rottmann # Prepend the subdirectory the object is found in. 4303964dbb1eSa.rottmann non_pic_object="$xdir$non_pic_object" 4304964dbb1eSa.rottmann 4305964dbb1eSa.rottmann # A standard non-PIC object 4306636a995dSmlcreech func_append non_pic_objects " $non_pic_object" 4307964dbb1eSa.rottmann if test -z "$pic_object" || test "$pic_object" = none ; then 4308964dbb1eSa.rottmann arg="$non_pic_object" 4309964dbb1eSa.rottmann fi 43107f19c02fSvapier else 43117f19c02fSvapier # If the PIC object exists, use it instead. 43127f19c02fSvapier # $xdir was prepended to $pic_object above. 43137f19c02fSvapier non_pic_object="$pic_object" 4314636a995dSmlcreech func_append non_pic_objects " $non_pic_object" 4315964dbb1eSa.rottmann fi 4316964dbb1eSa.rottmann else 4317964dbb1eSa.rottmann # Only an error if not doing a dry-run. 4318636a995dSmlcreech if $opt_dry_run; then 4319964dbb1eSa.rottmann # Extract subdirectory from the argument. 4320636a995dSmlcreech func_dirname "$arg" "/" "" 4321636a995dSmlcreech xdir="$func_dirname_result" 4322964dbb1eSa.rottmann 4323636a995dSmlcreech func_lo2o "$arg" 4324636a995dSmlcreech pic_object=$xdir$objdir/$func_lo2o_result 4325636a995dSmlcreech non_pic_object=$xdir$func_lo2o_result 4326636a995dSmlcreech func_append libobjs " $pic_object" 4327636a995dSmlcreech func_append non_pic_objects " $non_pic_object" 4328636a995dSmlcreech else 4329636a995dSmlcreech func_fatal_error "\`$arg' is not a valid libtool object" 4330964dbb1eSa.rottmann fi 4331964dbb1eSa.rottmann fi 4332964dbb1eSa.rottmann done 4333964dbb1eSa.rottmann else 4334636a995dSmlcreech func_fatal_error "link input file \`$arg' does not exist" 4335964dbb1eSa.rottmann fi 4336964dbb1eSa.rottmann arg=$save_arg 4337964dbb1eSa.rottmann prev= 4338964dbb1eSa.rottmann continue 4339964dbb1eSa.rottmann ;; 4340636a995dSmlcreech precious_regex) 4341636a995dSmlcreech precious_files_regex="$arg" 4342636a995dSmlcreech prev= 4343636a995dSmlcreech continue 4344636a995dSmlcreech ;; 4345636a995dSmlcreech release) 4346636a995dSmlcreech release="-$arg" 4347636a995dSmlcreech prev= 4348636a995dSmlcreech continue 4349636a995dSmlcreech ;; 435071eb93eaSdrh rpath | xrpath) 435171eb93eaSdrh # We need an absolute path. 435271eb93eaSdrh case $arg in 435371eb93eaSdrh [\\/]* | [A-Za-z]:[\\/]*) ;; 435471eb93eaSdrh *) 4355636a995dSmlcreech func_fatal_error "only absolute run-paths are allowed" 435671eb93eaSdrh ;; 435771eb93eaSdrh esac 435871eb93eaSdrh if test "$prev" = rpath; then 435971eb93eaSdrh case "$rpath " in 436071eb93eaSdrh *" $arg "*) ;; 436171eb93eaSdrh *) rpath="$rpath $arg" ;; 436271eb93eaSdrh esac 436371eb93eaSdrh else 436471eb93eaSdrh case "$xrpath " in 436571eb93eaSdrh *" $arg "*) ;; 436671eb93eaSdrh *) xrpath="$xrpath $arg" ;; 436771eb93eaSdrh esac 436871eb93eaSdrh fi 436971eb93eaSdrh prev= 437071eb93eaSdrh continue 437171eb93eaSdrh ;; 4372636a995dSmlcreech shrext) 4373636a995dSmlcreech shrext_cmds="$arg" 437471eb93eaSdrh prev= 437571eb93eaSdrh continue 437671eb93eaSdrh ;; 4377636a995dSmlcreech weak) 4378636a995dSmlcreech weak_libs="$weak_libs $arg" 437971eb93eaSdrh prev= 438071eb93eaSdrh continue 438171eb93eaSdrh ;; 4382964dbb1eSa.rottmann xcclinker) 4383964dbb1eSa.rottmann linker_flags="$linker_flags $qarg" 4384964dbb1eSa.rottmann compiler_flags="$compiler_flags $qarg" 4385964dbb1eSa.rottmann prev= 4386636a995dSmlcreech func_append compile_command " $qarg" 4387636a995dSmlcreech func_append finalize_command " $qarg" 4388964dbb1eSa.rottmann continue 4389964dbb1eSa.rottmann ;; 4390636a995dSmlcreech xcompiler) 4391636a995dSmlcreech compiler_flags="$compiler_flags $qarg" 43927f19c02fSvapier prev= 4393636a995dSmlcreech func_append compile_command " $qarg" 4394636a995dSmlcreech func_append finalize_command " $qarg" 43957f19c02fSvapier continue 43967f19c02fSvapier ;; 4397636a995dSmlcreech xlinker) 4398636a995dSmlcreech linker_flags="$linker_flags $qarg" 4399636a995dSmlcreech compiler_flags="$compiler_flags $wl$qarg" 44007f19c02fSvapier prev= 4401636a995dSmlcreech func_append compile_command " $wl$qarg" 4402636a995dSmlcreech func_append finalize_command " $wl$qarg" 44037f19c02fSvapier continue 44047f19c02fSvapier ;; 440571eb93eaSdrh *) 440671eb93eaSdrh eval "$prev=\"\$arg\"" 440771eb93eaSdrh prev= 440871eb93eaSdrh continue 440971eb93eaSdrh ;; 441071eb93eaSdrh esac 4411964dbb1eSa.rottmann fi # test -n "$prev" 441271eb93eaSdrh 441371eb93eaSdrh prevarg="$arg" 441471eb93eaSdrh 441571eb93eaSdrh case $arg in 441671eb93eaSdrh -all-static) 441771eb93eaSdrh if test -n "$link_static_flag"; then 4418636a995dSmlcreech # See comment for -static flag below, for more details. 4419636a995dSmlcreech func_append compile_command " $link_static_flag" 4420636a995dSmlcreech func_append finalize_command " $link_static_flag" 442171eb93eaSdrh fi 442271eb93eaSdrh continue 442371eb93eaSdrh ;; 442471eb93eaSdrh 442571eb93eaSdrh -allow-undefined) 442671eb93eaSdrh # FIXME: remove this flag sometime in the future. 4427636a995dSmlcreech func_fatal_error "\`-allow-undefined' must not be used because it is the default" 442871eb93eaSdrh ;; 442971eb93eaSdrh 443071eb93eaSdrh -avoid-version) 443171eb93eaSdrh avoid_version=yes 443271eb93eaSdrh continue 443371eb93eaSdrh ;; 443471eb93eaSdrh 443571eb93eaSdrh -dlopen) 443671eb93eaSdrh prev=dlfiles 443771eb93eaSdrh continue 443871eb93eaSdrh ;; 443971eb93eaSdrh 444071eb93eaSdrh -dlpreopen) 444171eb93eaSdrh prev=dlprefiles 444271eb93eaSdrh continue 444371eb93eaSdrh ;; 444471eb93eaSdrh 444571eb93eaSdrh -export-dynamic) 444671eb93eaSdrh export_dynamic=yes 444771eb93eaSdrh continue 444871eb93eaSdrh ;; 444971eb93eaSdrh 445071eb93eaSdrh -export-symbols | -export-symbols-regex) 445171eb93eaSdrh if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 4452636a995dSmlcreech func_fatal_error "more than one -exported-symbols argument is not allowed" 445371eb93eaSdrh fi 445471eb93eaSdrh if test "X$arg" = "X-export-symbols"; then 445571eb93eaSdrh prev=expsyms 445671eb93eaSdrh else 445771eb93eaSdrh prev=expsyms_regex 445871eb93eaSdrh fi 445971eb93eaSdrh continue 446071eb93eaSdrh ;; 446171eb93eaSdrh 4462636a995dSmlcreech -framework) 4463636a995dSmlcreech prev=framework 44647f19c02fSvapier continue 44657f19c02fSvapier ;; 44667f19c02fSvapier 446762507b65Sa.rottmann -inst-prefix-dir) 446862507b65Sa.rottmann prev=inst_prefix 446962507b65Sa.rottmann continue 447062507b65Sa.rottmann ;; 447162507b65Sa.rottmann 447271eb93eaSdrh # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 447371eb93eaSdrh # so, if we see these flags be careful not to treat them like -L 447471eb93eaSdrh -L[A-Z][A-Z]*:*) 447571eb93eaSdrh case $with_gcc/$host in 4476964dbb1eSa.rottmann no/*-*-irix* | /*-*-irix*) 4477636a995dSmlcreech func_append compile_command " $arg" 4478636a995dSmlcreech func_append finalize_command " $arg" 447971eb93eaSdrh ;; 448071eb93eaSdrh esac 448171eb93eaSdrh continue 448271eb93eaSdrh ;; 448371eb93eaSdrh 448471eb93eaSdrh -L*) 4485636a995dSmlcreech func_stripname '-L' '' "$arg" 4486636a995dSmlcreech dir=$func_stripname_result 4487*6acb2cf6Svapier if test -z "$dir"; then 4488*6acb2cf6Svapier if test "$#" -gt 0; then 4489*6acb2cf6Svapier func_fatal_error "require no space between \`-L' and \`$1'" 4490*6acb2cf6Svapier else 4491*6acb2cf6Svapier func_fatal_error "need path for \`-L' option" 4492*6acb2cf6Svapier fi 4493*6acb2cf6Svapier fi 449471eb93eaSdrh # We need an absolute path. 449571eb93eaSdrh case $dir in 449671eb93eaSdrh [\\/]* | [A-Za-z]:[\\/]*) ;; 449771eb93eaSdrh *) 449871eb93eaSdrh absdir=`cd "$dir" && pwd` 4499636a995dSmlcreech test -z "$absdir" && \ 4500636a995dSmlcreech func_fatal_error "cannot determine absolute directory name of \`$dir'" 450171eb93eaSdrh dir="$absdir" 450271eb93eaSdrh ;; 450371eb93eaSdrh esac 450471eb93eaSdrh case "$deplibs " in 450571eb93eaSdrh *" -L$dir "*) ;; 450671eb93eaSdrh *) 450771eb93eaSdrh deplibs="$deplibs -L$dir" 450871eb93eaSdrh lib_search_path="$lib_search_path $dir" 450971eb93eaSdrh ;; 451071eb93eaSdrh esac 451171eb93eaSdrh case $host in 4512*6acb2cf6Svapier *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 4513636a995dSmlcreech testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` 451471eb93eaSdrh case :$dllsearchpath: in 451571eb93eaSdrh *":$dir:"*) ;; 4516*6acb2cf6Svapier ::) dllsearchpath=$dir;; 451771eb93eaSdrh *) dllsearchpath="$dllsearchpath:$dir";; 451871eb93eaSdrh esac 45197f19c02fSvapier case :$dllsearchpath: in 45207f19c02fSvapier *":$testbindir:"*) ;; 4521*6acb2cf6Svapier ::) dllsearchpath=$testbindir;; 45227f19c02fSvapier *) dllsearchpath="$dllsearchpath:$testbindir";; 45237f19c02fSvapier esac 452471eb93eaSdrh ;; 452571eb93eaSdrh esac 452671eb93eaSdrh continue 452771eb93eaSdrh ;; 452871eb93eaSdrh 452971eb93eaSdrh -l*) 453071eb93eaSdrh if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 453171eb93eaSdrh case $host in 4532*6acb2cf6Svapier *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) 453371eb93eaSdrh # These systems don't actually have a C or math library (as such) 453471eb93eaSdrh continue 453571eb93eaSdrh ;; 45367f19c02fSvapier *-*-os2*) 453771eb93eaSdrh # These systems don't actually have a C library (as such) 453871eb93eaSdrh test "X$arg" = "X-lc" && continue 453971eb93eaSdrh ;; 45407f19c02fSvapier *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 454162507b65Sa.rottmann # Do not include libc due to us having libc/libc_r. 454262507b65Sa.rottmann test "X$arg" = "X-lc" && continue 454371eb93eaSdrh ;; 4544964dbb1eSa.rottmann *-*-rhapsody* | *-*-darwin1.[012]) 4545964dbb1eSa.rottmann # Rhapsody C and math libraries are in the System framework 4546636a995dSmlcreech deplibs="$deplibs System.ltframework" 4547964dbb1eSa.rottmann continue 45487f19c02fSvapier ;; 45497f19c02fSvapier *-*-sco3.2v5* | *-*-sco5v6*) 45507f19c02fSvapier # Causes problems with __ctype 45517f19c02fSvapier test "X$arg" = "X-lc" && continue 45527f19c02fSvapier ;; 45537f19c02fSvapier *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 45547f19c02fSvapier # Compiler inserts libc in the correct place for threads to work 45557f19c02fSvapier test "X$arg" = "X-lc" && continue 45567f19c02fSvapier ;; 455771eb93eaSdrh esac 455862507b65Sa.rottmann elif test "X$arg" = "X-lc_r"; then 455971eb93eaSdrh case $host in 45607f19c02fSvapier *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 456171eb93eaSdrh # Do not include libc_r directly, use -pthread flag. 456271eb93eaSdrh continue 456371eb93eaSdrh ;; 456471eb93eaSdrh esac 456571eb93eaSdrh fi 456671eb93eaSdrh deplibs="$deplibs $arg" 456771eb93eaSdrh continue 456871eb93eaSdrh ;; 456971eb93eaSdrh 457071eb93eaSdrh -module) 457171eb93eaSdrh module=yes 457271eb93eaSdrh continue 457371eb93eaSdrh ;; 457471eb93eaSdrh 4575636a995dSmlcreech # Tru64 UNIX uses -model [arg] to determine the layout of C++ 4576636a995dSmlcreech # classes, name mangling, and exception handling. 4577636a995dSmlcreech # Darwin uses the -arch flag to determine output architecture. 4578636a995dSmlcreech -model|-arch|-isysroot) 4579964dbb1eSa.rottmann compiler_flags="$compiler_flags $arg" 4580636a995dSmlcreech func_append compile_command " $arg" 4581636a995dSmlcreech func_append finalize_command " $arg" 4582636a995dSmlcreech prev=xcompiler 4583964dbb1eSa.rottmann continue 4584964dbb1eSa.rottmann ;; 4585964dbb1eSa.rottmann 4586636a995dSmlcreech -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 4587636a995dSmlcreech compiler_flags="$compiler_flags $arg" 4588636a995dSmlcreech func_append compile_command " $arg" 4589636a995dSmlcreech func_append finalize_command " $arg" 4590636a995dSmlcreech case "$new_inherited_linker_flags " in 4591636a995dSmlcreech *" $arg "*) ;; 4592636a995dSmlcreech * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; 4593636a995dSmlcreech esac 4594636a995dSmlcreech continue 4595636a995dSmlcreech ;; 4596636a995dSmlcreech 4597636a995dSmlcreech -multi_module) 4598636a995dSmlcreech single_module="${wl}-multi_module" 4599964dbb1eSa.rottmann continue 4600964dbb1eSa.rottmann ;; 4601964dbb1eSa.rottmann 460271eb93eaSdrh -no-fast-install) 460371eb93eaSdrh fast_install=no 460471eb93eaSdrh continue 460571eb93eaSdrh ;; 460671eb93eaSdrh 460771eb93eaSdrh -no-install) 460871eb93eaSdrh case $host in 4609*6acb2cf6Svapier *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 461071eb93eaSdrh # The PATH hackery in wrapper scripts is required on Windows 4611636a995dSmlcreech # and Darwin in order for the loader to find any dlls it needs. 4612636a995dSmlcreech func_warning "\`-no-install' is ignored for $host" 4613636a995dSmlcreech func_warning "assuming \`-no-fast-install' instead" 461471eb93eaSdrh fast_install=no 461571eb93eaSdrh ;; 461671eb93eaSdrh *) no_install=yes ;; 461771eb93eaSdrh esac 461871eb93eaSdrh continue 461971eb93eaSdrh ;; 462071eb93eaSdrh 462171eb93eaSdrh -no-undefined) 462271eb93eaSdrh allow_undefined=no 462371eb93eaSdrh continue 462471eb93eaSdrh ;; 462571eb93eaSdrh 4626964dbb1eSa.rottmann -objectlist) 4627964dbb1eSa.rottmann prev=objectlist 4628964dbb1eSa.rottmann continue 4629964dbb1eSa.rottmann ;; 4630964dbb1eSa.rottmann 463171eb93eaSdrh -o) prev=output ;; 463271eb93eaSdrh 4633964dbb1eSa.rottmann -precious-files-regex) 4634964dbb1eSa.rottmann prev=precious_regex 4635964dbb1eSa.rottmann continue 4636964dbb1eSa.rottmann ;; 4637964dbb1eSa.rottmann 463871eb93eaSdrh -release) 463971eb93eaSdrh prev=release 464071eb93eaSdrh continue 464171eb93eaSdrh ;; 464271eb93eaSdrh 464371eb93eaSdrh -rpath) 464471eb93eaSdrh prev=rpath 464571eb93eaSdrh continue 464671eb93eaSdrh ;; 464771eb93eaSdrh 464871eb93eaSdrh -R) 464971eb93eaSdrh prev=xrpath 465071eb93eaSdrh continue 465171eb93eaSdrh ;; 465271eb93eaSdrh 465371eb93eaSdrh -R*) 4654636a995dSmlcreech func_stripname '-R' '' "$arg" 4655636a995dSmlcreech dir=$func_stripname_result 465671eb93eaSdrh # We need an absolute path. 465771eb93eaSdrh case $dir in 465871eb93eaSdrh [\\/]* | [A-Za-z]:[\\/]*) ;; 465971eb93eaSdrh *) 4660636a995dSmlcreech func_fatal_error "only absolute run-paths are allowed" 466171eb93eaSdrh ;; 466271eb93eaSdrh esac 466371eb93eaSdrh case "$xrpath " in 466471eb93eaSdrh *" $dir "*) ;; 466571eb93eaSdrh *) xrpath="$xrpath $dir" ;; 466671eb93eaSdrh esac 466771eb93eaSdrh continue 466871eb93eaSdrh ;; 466971eb93eaSdrh 4670636a995dSmlcreech -shared) 4671636a995dSmlcreech # The effects of -shared are defined in a previous loop. 4672636a995dSmlcreech continue 4673636a995dSmlcreech ;; 4674636a995dSmlcreech 4675636a995dSmlcreech -shrext) 4676636a995dSmlcreech prev=shrext 4677636a995dSmlcreech continue 4678636a995dSmlcreech ;; 4679636a995dSmlcreech 4680636a995dSmlcreech -static | -static-libtool-libs) 468171eb93eaSdrh # The effects of -static are defined in a previous loop. 468271eb93eaSdrh # We used to do the same as -all-static on platforms that 468371eb93eaSdrh # didn't have a PIC flag, but the assumption that the effects 468471eb93eaSdrh # would be equivalent was wrong. It would break on at least 468571eb93eaSdrh # Digital Unix and AIX. 468671eb93eaSdrh continue 468771eb93eaSdrh ;; 468871eb93eaSdrh 468971eb93eaSdrh -thread-safe) 469071eb93eaSdrh thread_safe=yes 469171eb93eaSdrh continue 469271eb93eaSdrh ;; 469371eb93eaSdrh 469471eb93eaSdrh -version-info) 469571eb93eaSdrh prev=vinfo 469671eb93eaSdrh continue 469771eb93eaSdrh ;; 4698636a995dSmlcreech 4699964dbb1eSa.rottmann -version-number) 4700964dbb1eSa.rottmann prev=vinfo 4701964dbb1eSa.rottmann vinfo_number=yes 4702964dbb1eSa.rottmann continue 4703964dbb1eSa.rottmann ;; 470471eb93eaSdrh 4705636a995dSmlcreech -weak) 4706636a995dSmlcreech prev=weak 4707636a995dSmlcreech continue 4708636a995dSmlcreech ;; 4709636a995dSmlcreech 471071eb93eaSdrh -Wc,*) 4711636a995dSmlcreech func_stripname '-Wc,' '' "$arg" 4712636a995dSmlcreech args=$func_stripname_result 471371eb93eaSdrh arg= 471462507b65Sa.rottmann save_ifs="$IFS"; IFS=',' 471571eb93eaSdrh for flag in $args; do 471671eb93eaSdrh IFS="$save_ifs" 4717636a995dSmlcreech func_quote_for_eval "$flag" 4718636a995dSmlcreech arg="$arg $wl$func_quote_for_eval_result" 4719636a995dSmlcreech compiler_flags="$compiler_flags $func_quote_for_eval_result" 472071eb93eaSdrh done 472171eb93eaSdrh IFS="$save_ifs" 4722636a995dSmlcreech func_stripname ' ' '' "$arg" 4723636a995dSmlcreech arg=$func_stripname_result 472471eb93eaSdrh ;; 472571eb93eaSdrh 472671eb93eaSdrh -Wl,*) 4727636a995dSmlcreech func_stripname '-Wl,' '' "$arg" 4728636a995dSmlcreech args=$func_stripname_result 472971eb93eaSdrh arg= 473062507b65Sa.rottmann save_ifs="$IFS"; IFS=',' 473171eb93eaSdrh for flag in $args; do 473271eb93eaSdrh IFS="$save_ifs" 4733636a995dSmlcreech func_quote_for_eval "$flag" 4734636a995dSmlcreech arg="$arg $wl$func_quote_for_eval_result" 4735636a995dSmlcreech compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" 4736636a995dSmlcreech linker_flags="$linker_flags $func_quote_for_eval_result" 473771eb93eaSdrh done 473871eb93eaSdrh IFS="$save_ifs" 4739636a995dSmlcreech func_stripname ' ' '' "$arg" 4740636a995dSmlcreech arg=$func_stripname_result 474171eb93eaSdrh ;; 474271eb93eaSdrh 474371eb93eaSdrh -Xcompiler) 474471eb93eaSdrh prev=xcompiler 474571eb93eaSdrh continue 474671eb93eaSdrh ;; 474771eb93eaSdrh 474871eb93eaSdrh -Xlinker) 474971eb93eaSdrh prev=xlinker 475071eb93eaSdrh continue 475171eb93eaSdrh ;; 475271eb93eaSdrh 4753964dbb1eSa.rottmann -XCClinker) 4754964dbb1eSa.rottmann prev=xcclinker 4755964dbb1eSa.rottmann continue 4756964dbb1eSa.rottmann ;; 4757964dbb1eSa.rottmann 4758636a995dSmlcreech # -msg_* for osf cc 4759636a995dSmlcreech -msg_*) 4760636a995dSmlcreech func_quote_for_eval "$arg" 4761636a995dSmlcreech arg="$func_quote_for_eval_result" 4762636a995dSmlcreech ;; 4763636a995dSmlcreech 4764636a995dSmlcreech # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 4765636a995dSmlcreech # -r[0-9][0-9]* specifies the processor on the SGI compiler 4766636a995dSmlcreech # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 4767636a995dSmlcreech # +DA*, +DD* enable 64-bit mode on the HP compiler 4768636a995dSmlcreech # -q* pass through compiler args for the IBM compiler 4769636a995dSmlcreech # -m*, -t[45]*, -txscale* pass through architecture-specific 4770636a995dSmlcreech # compiler args for GCC 4771636a995dSmlcreech # -F/path gives path to uninstalled frameworks, gcc on darwin 4772636a995dSmlcreech # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 4773636a995dSmlcreech # @file GCC response files 4774636a995dSmlcreech -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 4775636a995dSmlcreech -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 4776636a995dSmlcreech func_quote_for_eval "$arg" 4777636a995dSmlcreech arg="$func_quote_for_eval_result" 4778636a995dSmlcreech func_append compile_command " $arg" 4779636a995dSmlcreech func_append finalize_command " $arg" 4780636a995dSmlcreech compiler_flags="$compiler_flags $arg" 4781636a995dSmlcreech continue 4782636a995dSmlcreech ;; 4783636a995dSmlcreech 478471eb93eaSdrh # Some other compiler flag. 478571eb93eaSdrh -* | +*) 4786636a995dSmlcreech func_quote_for_eval "$arg" 4787636a995dSmlcreech arg="$func_quote_for_eval_result" 478871eb93eaSdrh ;; 478971eb93eaSdrh 4790964dbb1eSa.rottmann *.$objext) 4791964dbb1eSa.rottmann # A standard object. 4792964dbb1eSa.rottmann objs="$objs $arg" 4793964dbb1eSa.rottmann ;; 4794964dbb1eSa.rottmann 4795964dbb1eSa.rottmann *.lo) 4796964dbb1eSa.rottmann # A libtool-controlled object. 4797964dbb1eSa.rottmann 4798964dbb1eSa.rottmann # Check to see that this really is a libtool object. 4799636a995dSmlcreech if func_lalib_unsafe_p "$arg"; then 4800964dbb1eSa.rottmann pic_object= 4801964dbb1eSa.rottmann non_pic_object= 4802964dbb1eSa.rottmann 4803964dbb1eSa.rottmann # Read the .lo file 4804636a995dSmlcreech func_source "$arg" 4805964dbb1eSa.rottmann 4806636a995dSmlcreech if test -z "$pic_object" || 4807964dbb1eSa.rottmann test -z "$non_pic_object" || 4808636a995dSmlcreech test "$pic_object" = none && 4809964dbb1eSa.rottmann test "$non_pic_object" = none; then 4810636a995dSmlcreech func_fatal_error "cannot find name of object for \`$arg'" 4811964dbb1eSa.rottmann fi 4812964dbb1eSa.rottmann 4813964dbb1eSa.rottmann # Extract subdirectory from the argument. 4814636a995dSmlcreech func_dirname "$arg" "/" "" 4815636a995dSmlcreech xdir="$func_dirname_result" 4816964dbb1eSa.rottmann 4817964dbb1eSa.rottmann if test "$pic_object" != none; then 4818964dbb1eSa.rottmann # Prepend the subdirectory the object is found in. 4819964dbb1eSa.rottmann pic_object="$xdir$pic_object" 4820964dbb1eSa.rottmann 482171eb93eaSdrh if test "$prev" = dlfiles; then 482271eb93eaSdrh if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 4823964dbb1eSa.rottmann dlfiles="$dlfiles $pic_object" 482471eb93eaSdrh prev= 482571eb93eaSdrh continue 482671eb93eaSdrh else 482771eb93eaSdrh # If libtool objects are unsupported, then we need to preload. 482871eb93eaSdrh prev=dlprefiles 482971eb93eaSdrh fi 483071eb93eaSdrh fi 483171eb93eaSdrh 4832964dbb1eSa.rottmann # CHECK ME: I think I busted this. -Ossama 483371eb93eaSdrh if test "$prev" = dlprefiles; then 483471eb93eaSdrh # Preload the old-style object. 4835964dbb1eSa.rottmann dlprefiles="$dlprefiles $pic_object" 483671eb93eaSdrh prev= 4837964dbb1eSa.rottmann fi 4838964dbb1eSa.rottmann 4839964dbb1eSa.rottmann # A PIC object. 4840636a995dSmlcreech func_append libobjs " $pic_object" 4841964dbb1eSa.rottmann arg="$pic_object" 4842964dbb1eSa.rottmann fi 4843964dbb1eSa.rottmann 4844964dbb1eSa.rottmann # Non-PIC object. 4845964dbb1eSa.rottmann if test "$non_pic_object" != none; then 4846964dbb1eSa.rottmann # Prepend the subdirectory the object is found in. 4847964dbb1eSa.rottmann non_pic_object="$xdir$non_pic_object" 4848964dbb1eSa.rottmann 4849964dbb1eSa.rottmann # A standard non-PIC object 4850636a995dSmlcreech func_append non_pic_objects " $non_pic_object" 4851964dbb1eSa.rottmann if test -z "$pic_object" || test "$pic_object" = none ; then 4852964dbb1eSa.rottmann arg="$non_pic_object" 4853964dbb1eSa.rottmann fi 48547f19c02fSvapier else 48557f19c02fSvapier # If the PIC object exists, use it instead. 48567f19c02fSvapier # $xdir was prepended to $pic_object above. 48577f19c02fSvapier non_pic_object="$pic_object" 4858636a995dSmlcreech func_append non_pic_objects " $non_pic_object" 4859964dbb1eSa.rottmann fi 486071eb93eaSdrh else 4861964dbb1eSa.rottmann # Only an error if not doing a dry-run. 4862636a995dSmlcreech if $opt_dry_run; then 4863964dbb1eSa.rottmann # Extract subdirectory from the argument. 4864636a995dSmlcreech func_dirname "$arg" "/" "" 4865636a995dSmlcreech xdir="$func_dirname_result" 4866964dbb1eSa.rottmann 4867636a995dSmlcreech func_lo2o "$arg" 4868636a995dSmlcreech pic_object=$xdir$objdir/$func_lo2o_result 4869636a995dSmlcreech non_pic_object=$xdir$func_lo2o_result 4870636a995dSmlcreech func_append libobjs " $pic_object" 4871636a995dSmlcreech func_append non_pic_objects " $non_pic_object" 4872636a995dSmlcreech else 4873636a995dSmlcreech func_fatal_error "\`$arg' is not a valid libtool object" 4874964dbb1eSa.rottmann fi 487571eb93eaSdrh fi 487671eb93eaSdrh ;; 487771eb93eaSdrh 487871eb93eaSdrh *.$libext) 487971eb93eaSdrh # An archive. 488071eb93eaSdrh deplibs="$deplibs $arg" 488171eb93eaSdrh old_deplibs="$old_deplibs $arg" 488271eb93eaSdrh continue 488371eb93eaSdrh ;; 488471eb93eaSdrh 488571eb93eaSdrh *.la) 488671eb93eaSdrh # A libtool-controlled library. 488771eb93eaSdrh 488871eb93eaSdrh if test "$prev" = dlfiles; then 488971eb93eaSdrh # This library was specified with -dlopen. 489071eb93eaSdrh dlfiles="$dlfiles $arg" 489171eb93eaSdrh prev= 489271eb93eaSdrh elif test "$prev" = dlprefiles; then 489371eb93eaSdrh # The library was specified with -dlpreopen. 489471eb93eaSdrh dlprefiles="$dlprefiles $arg" 489571eb93eaSdrh prev= 489671eb93eaSdrh else 489771eb93eaSdrh deplibs="$deplibs $arg" 489871eb93eaSdrh fi 489971eb93eaSdrh continue 490071eb93eaSdrh ;; 490171eb93eaSdrh 490271eb93eaSdrh # Some other compiler argument. 490371eb93eaSdrh *) 490471eb93eaSdrh # Unknown arguments in both finalize_command and compile_command need 490571eb93eaSdrh # to be aesthetically quoted because they are evaled later. 4906636a995dSmlcreech func_quote_for_eval "$arg" 4907636a995dSmlcreech arg="$func_quote_for_eval_result" 490871eb93eaSdrh ;; 490971eb93eaSdrh esac # arg 491071eb93eaSdrh 491171eb93eaSdrh # Now actually substitute the argument into the commands. 491271eb93eaSdrh if test -n "$arg"; then 4913636a995dSmlcreech func_append compile_command " $arg" 4914636a995dSmlcreech func_append finalize_command " $arg" 491571eb93eaSdrh fi 491671eb93eaSdrh done # argument parsing loop 491771eb93eaSdrh 4918636a995dSmlcreech test -n "$prev" && \ 4919636a995dSmlcreech func_fatal_help "the \`$prevarg' option requires an argument" 492071eb93eaSdrh 492171eb93eaSdrh if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 492271eb93eaSdrh eval arg=\"$export_dynamic_flag_spec\" 4923636a995dSmlcreech func_append compile_command " $arg" 4924636a995dSmlcreech func_append finalize_command " $arg" 492571eb93eaSdrh fi 492671eb93eaSdrh 4927964dbb1eSa.rottmann oldlibs= 492871eb93eaSdrh # calculate the name of the file, without its directory 4929636a995dSmlcreech func_basename "$output" 4930636a995dSmlcreech outputname="$func_basename_result" 493171eb93eaSdrh libobjs_save="$libobjs" 493271eb93eaSdrh 493371eb93eaSdrh if test -n "$shlibpath_var"; then 493471eb93eaSdrh # get the directories listed in $shlibpath_var 4935636a995dSmlcreech eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 493671eb93eaSdrh else 493771eb93eaSdrh shlib_search_path= 493871eb93eaSdrh fi 493971eb93eaSdrh eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 494071eb93eaSdrh eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 494171eb93eaSdrh 4942636a995dSmlcreech func_dirname "$output" "/" "" 4943636a995dSmlcreech output_objdir="$func_dirname_result$objdir" 494471eb93eaSdrh # Create the object directory. 4945636a995dSmlcreech func_mkdir_p "$output_objdir" 494671eb93eaSdrh 494771eb93eaSdrh # Determine the type of output 494871eb93eaSdrh case $output in 494971eb93eaSdrh "") 4950636a995dSmlcreech func_fatal_help "you must specify an output file" 495171eb93eaSdrh ;; 495271eb93eaSdrh *.$libext) linkmode=oldlib ;; 495371eb93eaSdrh *.lo | *.$objext) linkmode=obj ;; 495471eb93eaSdrh *.la) linkmode=lib ;; 495571eb93eaSdrh *) linkmode=prog ;; # Anything else should be a program. 495671eb93eaSdrh esac 495771eb93eaSdrh 495871eb93eaSdrh specialdeplibs= 4959964dbb1eSa.rottmann 496071eb93eaSdrh libs= 496171eb93eaSdrh # Find all interdependent deplibs by searching for libraries 496271eb93eaSdrh # that are linked more than once (e.g. -la -lb -la) 496371eb93eaSdrh for deplib in $deplibs; do 4964636a995dSmlcreech if $opt_duplicate_deps ; then 496571eb93eaSdrh case "$libs " in 496671eb93eaSdrh *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 496771eb93eaSdrh esac 496862507b65Sa.rottmann fi 496971eb93eaSdrh libs="$libs $deplib" 497071eb93eaSdrh done 4971964dbb1eSa.rottmann 4972964dbb1eSa.rottmann if test "$linkmode" = lib; then 4973964dbb1eSa.rottmann libs="$predeps $libs $compiler_lib_search_path $postdeps" 4974964dbb1eSa.rottmann 4975964dbb1eSa.rottmann # Compute libraries that are listed more than once in $predeps 4976964dbb1eSa.rottmann # $postdeps and mark them as special (i.e., whose duplicates are 4977964dbb1eSa.rottmann # not to be eliminated). 4978964dbb1eSa.rottmann pre_post_deps= 4979636a995dSmlcreech if $opt_duplicate_compiler_generated_deps; then 4980964dbb1eSa.rottmann for pre_post_dep in $predeps $postdeps; do 4981964dbb1eSa.rottmann case "$pre_post_deps " in 4982964dbb1eSa.rottmann *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 4983964dbb1eSa.rottmann esac 4984964dbb1eSa.rottmann pre_post_deps="$pre_post_deps $pre_post_dep" 4985964dbb1eSa.rottmann done 4986964dbb1eSa.rottmann fi 4987964dbb1eSa.rottmann pre_post_deps= 4988964dbb1eSa.rottmann fi 4989964dbb1eSa.rottmann 499071eb93eaSdrh deplibs= 499171eb93eaSdrh newdependency_libs= 499271eb93eaSdrh newlib_search_path= 499371eb93eaSdrh need_relink=no # whether we're linking any uninstalled libtool libraries 499471eb93eaSdrh notinst_deplibs= # not-installed libtool libraries 4995636a995dSmlcreech notinst_path= # paths that contain not-installed libtool libraries 4996636a995dSmlcreech 499771eb93eaSdrh case $linkmode in 499871eb93eaSdrh lib) 4999636a995dSmlcreech passes="conv dlpreopen link" 500071eb93eaSdrh for file in $dlfiles $dlprefiles; do 500171eb93eaSdrh case $file in 500271eb93eaSdrh *.la) ;; 500371eb93eaSdrh *) 5004636a995dSmlcreech func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 500571eb93eaSdrh ;; 500671eb93eaSdrh esac 500771eb93eaSdrh done 500871eb93eaSdrh ;; 500971eb93eaSdrh prog) 501071eb93eaSdrh compile_deplibs= 501171eb93eaSdrh finalize_deplibs= 501271eb93eaSdrh alldeplibs=no 501371eb93eaSdrh newdlfiles= 501471eb93eaSdrh newdlprefiles= 501571eb93eaSdrh passes="conv scan dlopen dlpreopen link" 501671eb93eaSdrh ;; 501771eb93eaSdrh *) passes="conv" 501871eb93eaSdrh ;; 501971eb93eaSdrh esac 5020636a995dSmlcreech 502171eb93eaSdrh for pass in $passes; do 5022636a995dSmlcreech # The preopen pass in lib mode reverses $deplibs; put it back here 5023636a995dSmlcreech # so that -L comes before libs that need it for instance... 5024636a995dSmlcreech if test "$linkmode,$pass" = "lib,link"; then 5025636a995dSmlcreech ## FIXME: Find the place where the list is rebuilt in the wrong 5026636a995dSmlcreech ## order, and fix it there properly 5027636a995dSmlcreech tmp_deplibs= 5028636a995dSmlcreech for deplib in $deplibs; do 5029636a995dSmlcreech tmp_deplibs="$deplib $tmp_deplibs" 5030636a995dSmlcreech done 5031636a995dSmlcreech deplibs="$tmp_deplibs" 5032636a995dSmlcreech fi 5033636a995dSmlcreech 5034964dbb1eSa.rottmann if test "$linkmode,$pass" = "lib,link" || 5035964dbb1eSa.rottmann test "$linkmode,$pass" = "prog,scan"; then 5036964dbb1eSa.rottmann libs="$deplibs" 503762507b65Sa.rottmann deplibs= 5038964dbb1eSa.rottmann fi 5039964dbb1eSa.rottmann if test "$linkmode" = prog; then 5040964dbb1eSa.rottmann case $pass in 5041964dbb1eSa.rottmann dlopen) libs="$dlfiles" ;; 504271eb93eaSdrh dlpreopen) libs="$dlprefiles" ;; 504371eb93eaSdrh link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 504471eb93eaSdrh esac 504571eb93eaSdrh fi 5046636a995dSmlcreech if test "$linkmode,$pass" = "lib,dlpreopen"; then 5047636a995dSmlcreech # Collect and forward deplibs of preopened libtool libs 5048636a995dSmlcreech for lib in $dlprefiles; do 5049636a995dSmlcreech # Ignore non-libtool-libs 5050636a995dSmlcreech dependency_libs= 5051636a995dSmlcreech case $lib in 5052636a995dSmlcreech *.la) func_source "$lib" ;; 5053636a995dSmlcreech esac 5054636a995dSmlcreech 5055636a995dSmlcreech # Collect preopened libtool deplibs, except any this library 5056636a995dSmlcreech # has declared as weak libs 5057636a995dSmlcreech for deplib in $dependency_libs; do 5058636a995dSmlcreech deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` 5059636a995dSmlcreech case " $weak_libs " in 5060636a995dSmlcreech *" $deplib_base "*) ;; 5061636a995dSmlcreech *) deplibs="$deplibs $deplib" ;; 5062636a995dSmlcreech esac 5063636a995dSmlcreech done 5064636a995dSmlcreech done 5065636a995dSmlcreech libs="$dlprefiles" 5066636a995dSmlcreech fi 5067964dbb1eSa.rottmann if test "$pass" = dlopen; then 5068964dbb1eSa.rottmann # Collect dlpreopened libraries 5069964dbb1eSa.rottmann save_deplibs="$deplibs" 5070964dbb1eSa.rottmann deplibs= 5071964dbb1eSa.rottmann fi 5072636a995dSmlcreech 507371eb93eaSdrh for deplib in $libs; do 507471eb93eaSdrh lib= 507571eb93eaSdrh found=no 507671eb93eaSdrh case $deplib in 5077636a995dSmlcreech -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 5078964dbb1eSa.rottmann if test "$linkmode,$pass" = "prog,link"; then 5079964dbb1eSa.rottmann compile_deplibs="$deplib $compile_deplibs" 5080964dbb1eSa.rottmann finalize_deplibs="$deplib $finalize_deplibs" 5081964dbb1eSa.rottmann else 50827f19c02fSvapier compiler_flags="$compiler_flags $deplib" 5083636a995dSmlcreech if test "$linkmode" = lib ; then 5084636a995dSmlcreech case "$new_inherited_linker_flags " in 5085636a995dSmlcreech *" $deplib "*) ;; 5086636a995dSmlcreech * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 5087636a995dSmlcreech esac 5088636a995dSmlcreech fi 5089964dbb1eSa.rottmann fi 5090964dbb1eSa.rottmann continue 5091964dbb1eSa.rottmann ;; 509271eb93eaSdrh -l*) 5093964dbb1eSa.rottmann if test "$linkmode" != lib && test "$linkmode" != prog; then 5094636a995dSmlcreech func_warning "\`-l' is ignored for archives/objects" 509571eb93eaSdrh continue 509671eb93eaSdrh fi 5097636a995dSmlcreech func_stripname '-l' '' "$deplib" 5098636a995dSmlcreech name=$func_stripname_result 5099636a995dSmlcreech if test "$linkmode" = lib; then 5100636a995dSmlcreech searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 5101636a995dSmlcreech else 5102636a995dSmlcreech searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 5103636a995dSmlcreech fi 5104636a995dSmlcreech for searchdir in $searchdirs; do 51057f19c02fSvapier for search_ext in .la $std_shrext .so .a; do 510671eb93eaSdrh # Search the libtool library 5107964dbb1eSa.rottmann lib="$searchdir/lib${name}${search_ext}" 510871eb93eaSdrh if test -f "$lib"; then 5109964dbb1eSa.rottmann if test "$search_ext" = ".la"; then 511071eb93eaSdrh found=yes 5111964dbb1eSa.rottmann else 5112964dbb1eSa.rottmann found=no 511371eb93eaSdrh fi 5114964dbb1eSa.rottmann break 2 5115964dbb1eSa.rottmann fi 5116964dbb1eSa.rottmann done 511771eb93eaSdrh done 511871eb93eaSdrh if test "$found" != yes; then 511971eb93eaSdrh # deplib doesn't seem to be a libtool library 512071eb93eaSdrh if test "$linkmode,$pass" = "prog,link"; then 512171eb93eaSdrh compile_deplibs="$deplib $compile_deplibs" 512271eb93eaSdrh finalize_deplibs="$deplib $finalize_deplibs" 512371eb93eaSdrh else 512471eb93eaSdrh deplibs="$deplib $deplibs" 5125964dbb1eSa.rottmann test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 512671eb93eaSdrh fi 512771eb93eaSdrh continue 5128964dbb1eSa.rottmann else # deplib is a libtool library 5129964dbb1eSa.rottmann # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 5130964dbb1eSa.rottmann # We need to do some special things here, and not later. 5131964dbb1eSa.rottmann if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 5132964dbb1eSa.rottmann case " $predeps $postdeps " in 5133964dbb1eSa.rottmann *" $deplib "*) 5134636a995dSmlcreech if func_lalib_p "$lib"; then 5135964dbb1eSa.rottmann library_names= 5136964dbb1eSa.rottmann old_library= 5137636a995dSmlcreech func_source "$lib" 5138964dbb1eSa.rottmann for l in $old_library $library_names; do 5139964dbb1eSa.rottmann ll="$l" 5140964dbb1eSa.rottmann done 5141964dbb1eSa.rottmann if test "X$ll" = "X$old_library" ; then # only static version available 5142964dbb1eSa.rottmann found=no 5143636a995dSmlcreech func_dirname "$lib" "" "." 5144636a995dSmlcreech ladir="$func_dirname_result" 5145964dbb1eSa.rottmann lib=$ladir/$old_library 5146964dbb1eSa.rottmann if test "$linkmode,$pass" = "prog,link"; then 5147964dbb1eSa.rottmann compile_deplibs="$deplib $compile_deplibs" 5148964dbb1eSa.rottmann finalize_deplibs="$deplib $finalize_deplibs" 5149964dbb1eSa.rottmann else 5150964dbb1eSa.rottmann deplibs="$deplib $deplibs" 5151964dbb1eSa.rottmann test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 5152964dbb1eSa.rottmann fi 5153964dbb1eSa.rottmann continue 5154964dbb1eSa.rottmann fi 5155964dbb1eSa.rottmann fi 5156964dbb1eSa.rottmann ;; 5157964dbb1eSa.rottmann *) ;; 5158964dbb1eSa.rottmann esac 5159964dbb1eSa.rottmann fi 516071eb93eaSdrh fi 516171eb93eaSdrh ;; # -l 5162636a995dSmlcreech *.ltframework) 5163636a995dSmlcreech if test "$linkmode,$pass" = "prog,link"; then 5164636a995dSmlcreech compile_deplibs="$deplib $compile_deplibs" 5165636a995dSmlcreech finalize_deplibs="$deplib $finalize_deplibs" 5166636a995dSmlcreech else 5167636a995dSmlcreech deplibs="$deplib $deplibs" 5168636a995dSmlcreech if test "$linkmode" = lib ; then 5169636a995dSmlcreech case "$new_inherited_linker_flags " in 5170636a995dSmlcreech *" $deplib "*) ;; 5171636a995dSmlcreech * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; 5172636a995dSmlcreech esac 5173636a995dSmlcreech fi 5174636a995dSmlcreech fi 5175636a995dSmlcreech continue 5176636a995dSmlcreech ;; 517771eb93eaSdrh -L*) 517871eb93eaSdrh case $linkmode in 517971eb93eaSdrh lib) 518071eb93eaSdrh deplibs="$deplib $deplibs" 5181964dbb1eSa.rottmann test "$pass" = conv && continue 518271eb93eaSdrh newdependency_libs="$deplib $newdependency_libs" 5183636a995dSmlcreech func_stripname '-L' '' "$deplib" 5184636a995dSmlcreech newlib_search_path="$newlib_search_path $func_stripname_result" 518571eb93eaSdrh ;; 518671eb93eaSdrh prog) 5187964dbb1eSa.rottmann if test "$pass" = conv; then 518871eb93eaSdrh deplibs="$deplib $deplibs" 518971eb93eaSdrh continue 519071eb93eaSdrh fi 5191964dbb1eSa.rottmann if test "$pass" = scan; then 519271eb93eaSdrh deplibs="$deplib $deplibs" 519371eb93eaSdrh else 519471eb93eaSdrh compile_deplibs="$deplib $compile_deplibs" 519571eb93eaSdrh finalize_deplibs="$deplib $finalize_deplibs" 519671eb93eaSdrh fi 5197636a995dSmlcreech func_stripname '-L' '' "$deplib" 5198636a995dSmlcreech newlib_search_path="$newlib_search_path $func_stripname_result" 519971eb93eaSdrh ;; 520071eb93eaSdrh *) 5201636a995dSmlcreech func_warning "\`-L' is ignored for archives/objects" 520271eb93eaSdrh ;; 520371eb93eaSdrh esac # linkmode 520471eb93eaSdrh continue 520571eb93eaSdrh ;; # -L 520671eb93eaSdrh -R*) 5207964dbb1eSa.rottmann if test "$pass" = link; then 5208636a995dSmlcreech func_stripname '-R' '' "$deplib" 5209636a995dSmlcreech dir=$func_stripname_result 521071eb93eaSdrh # Make sure the xrpath contains only unique directories. 521171eb93eaSdrh case "$xrpath " in 521271eb93eaSdrh *" $dir "*) ;; 521371eb93eaSdrh *) xrpath="$xrpath $dir" ;; 521471eb93eaSdrh esac 521571eb93eaSdrh fi 521671eb93eaSdrh deplibs="$deplib $deplibs" 521771eb93eaSdrh continue 521871eb93eaSdrh ;; 521971eb93eaSdrh *.la) lib="$deplib" ;; 522071eb93eaSdrh *.$libext) 5221964dbb1eSa.rottmann if test "$pass" = conv; then 522271eb93eaSdrh deplibs="$deplib $deplibs" 522371eb93eaSdrh continue 522471eb93eaSdrh fi 522571eb93eaSdrh case $linkmode in 522671eb93eaSdrh lib) 5227636a995dSmlcreech # Linking convenience modules into shared libraries is allowed, 5228636a995dSmlcreech # but linking other static libraries is non-portable. 5229636a995dSmlcreech case " $dlpreconveniencelibs " in 5230636a995dSmlcreech *" $deplib "*) ;; 5231636a995dSmlcreech *) 52327f19c02fSvapier valid_a_lib=no 52337f19c02fSvapier case $deplibs_check_method in 52347f19c02fSvapier match_pattern*) 5235636a995dSmlcreech set dummy $deplibs_check_method; shift 5236636a995dSmlcreech match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 5237636a995dSmlcreech if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ 52387f19c02fSvapier | $EGREP "$match_pattern_regex" > /dev/null; then 52397f19c02fSvapier valid_a_lib=yes 52407f19c02fSvapier fi 52417f19c02fSvapier ;; 52427f19c02fSvapier pass_all) 52437f19c02fSvapier valid_a_lib=yes 52447f19c02fSvapier ;; 52457f19c02fSvapier esac 52467f19c02fSvapier if test "$valid_a_lib" != yes; then 5247636a995dSmlcreech $ECHO 5248636a995dSmlcreech $ECHO "*** Warning: Trying to link with static lib archive $deplib." 5249636a995dSmlcreech $ECHO "*** I have the capability to make that library automatically link in when" 5250636a995dSmlcreech $ECHO "*** you link to this library. But I can only do this if you have a" 5251636a995dSmlcreech $ECHO "*** shared version of the library, which you do not appear to have" 5252636a995dSmlcreech $ECHO "*** because the file extensions .$libext of this argument makes me believe" 5253636a995dSmlcreech $ECHO "*** that it is just a static archive that I should not use here." 525471eb93eaSdrh else 5255636a995dSmlcreech $ECHO 5256636a995dSmlcreech $ECHO "*** Warning: Linking the shared library $output against the" 5257636a995dSmlcreech $ECHO "*** static library $deplib is not portable!" 525871eb93eaSdrh deplibs="$deplib $deplibs" 525971eb93eaSdrh fi 5260636a995dSmlcreech ;; 5261636a995dSmlcreech esac 526271eb93eaSdrh continue 526371eb93eaSdrh ;; 526471eb93eaSdrh prog) 5265964dbb1eSa.rottmann if test "$pass" != link; then 526671eb93eaSdrh deplibs="$deplib $deplibs" 526771eb93eaSdrh else 526871eb93eaSdrh compile_deplibs="$deplib $compile_deplibs" 526971eb93eaSdrh finalize_deplibs="$deplib $finalize_deplibs" 527071eb93eaSdrh fi 527171eb93eaSdrh continue 527271eb93eaSdrh ;; 527371eb93eaSdrh esac # linkmode 527471eb93eaSdrh ;; # *.$libext 527571eb93eaSdrh *.lo | *.$objext) 5276964dbb1eSa.rottmann if test "$pass" = conv; then 5277964dbb1eSa.rottmann deplibs="$deplib $deplibs" 5278964dbb1eSa.rottmann elif test "$linkmode" = prog; then 5279964dbb1eSa.rottmann if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 528071eb93eaSdrh # If there is no dlopen support or we're linking statically, 528171eb93eaSdrh # we need to preload. 528271eb93eaSdrh newdlprefiles="$newdlprefiles $deplib" 528371eb93eaSdrh compile_deplibs="$deplib $compile_deplibs" 528471eb93eaSdrh finalize_deplibs="$deplib $finalize_deplibs" 528571eb93eaSdrh else 528671eb93eaSdrh newdlfiles="$newdlfiles $deplib" 528771eb93eaSdrh fi 5288964dbb1eSa.rottmann fi 528971eb93eaSdrh continue 529071eb93eaSdrh ;; 529171eb93eaSdrh %DEPLIBS%) 529271eb93eaSdrh alldeplibs=yes 529371eb93eaSdrh continue 529471eb93eaSdrh ;; 529571eb93eaSdrh esac # case $deplib 5296636a995dSmlcreech 5297964dbb1eSa.rottmann if test "$found" = yes || test -f "$lib"; then : 529871eb93eaSdrh else 5299636a995dSmlcreech func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 530071eb93eaSdrh fi 530171eb93eaSdrh 530271eb93eaSdrh # Check to see that this really is a libtool archive. 5303636a995dSmlcreech func_lalib_unsafe_p "$lib" \ 5304636a995dSmlcreech || func_fatal_error "\`$lib' is not a valid libtool archive" 530571eb93eaSdrh 5306636a995dSmlcreech func_dirname "$lib" "" "." 5307636a995dSmlcreech ladir="$func_dirname_result" 530871eb93eaSdrh 530971eb93eaSdrh dlname= 531071eb93eaSdrh dlopen= 531171eb93eaSdrh dlpreopen= 531271eb93eaSdrh libdir= 531371eb93eaSdrh library_names= 531471eb93eaSdrh old_library= 5315636a995dSmlcreech inherited_linker_flags= 531671eb93eaSdrh # If the library was installed with an old release of libtool, 5317964dbb1eSa.rottmann # it will not redefine variables installed, or shouldnotlink 531871eb93eaSdrh installed=yes 5319964dbb1eSa.rottmann shouldnotlink=no 53207f19c02fSvapier avoidtemprpath= 53217f19c02fSvapier 532271eb93eaSdrh 532371eb93eaSdrh # Read the .la file 5324636a995dSmlcreech func_source "$lib" 532571eb93eaSdrh 5326636a995dSmlcreech # Convert "-framework foo" to "foo.ltframework" 5327636a995dSmlcreech if test -n "$inherited_linker_flags"; then 5328636a995dSmlcreech tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` 5329636a995dSmlcreech for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 5330636a995dSmlcreech case " $new_inherited_linker_flags " in 5331636a995dSmlcreech *" $tmp_inherited_linker_flag "*) ;; 5332636a995dSmlcreech *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; 5333636a995dSmlcreech esac 5334636a995dSmlcreech done 5335636a995dSmlcreech fi 5336636a995dSmlcreech dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 533771eb93eaSdrh if test "$linkmode,$pass" = "lib,link" || 533871eb93eaSdrh test "$linkmode,$pass" = "prog,scan" || 5339964dbb1eSa.rottmann { test "$linkmode" != prog && test "$linkmode" != lib; }; then 534071eb93eaSdrh test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 534171eb93eaSdrh test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 534271eb93eaSdrh fi 534371eb93eaSdrh 5344964dbb1eSa.rottmann if test "$pass" = conv; then 534571eb93eaSdrh # Only check for convenience libraries 534671eb93eaSdrh deplibs="$lib $deplibs" 534771eb93eaSdrh if test -z "$libdir"; then 534871eb93eaSdrh if test -z "$old_library"; then 5349636a995dSmlcreech func_fatal_error "cannot find name of link library for \`$lib'" 535071eb93eaSdrh fi 535171eb93eaSdrh # It is a libtool convenience library, so add in its objects. 535271eb93eaSdrh convenience="$convenience $ladir/$objdir/$old_library" 535371eb93eaSdrh old_convenience="$old_convenience $ladir/$objdir/$old_library" 5354636a995dSmlcreech elif test "$linkmode" != prog && test "$linkmode" != lib; then 5355636a995dSmlcreech func_fatal_error "\`$lib' is not a convenience library" 5356636a995dSmlcreech fi 535771eb93eaSdrh tmp_libs= 535871eb93eaSdrh for deplib in $dependency_libs; do 535971eb93eaSdrh deplibs="$deplib $deplibs" 5360636a995dSmlcreech if $opt_duplicate_deps ; then 536171eb93eaSdrh case "$tmp_libs " in 536271eb93eaSdrh *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 536371eb93eaSdrh esac 536462507b65Sa.rottmann fi 536571eb93eaSdrh tmp_libs="$tmp_libs $deplib" 536671eb93eaSdrh done 536771eb93eaSdrh continue 536871eb93eaSdrh fi # $pass = conv 536971eb93eaSdrh 5370964dbb1eSa.rottmann 537171eb93eaSdrh # Get the name of the library we link against. 537271eb93eaSdrh linklib= 537371eb93eaSdrh for l in $old_library $library_names; do 537471eb93eaSdrh linklib="$l" 537571eb93eaSdrh done 537671eb93eaSdrh if test -z "$linklib"; then 5377636a995dSmlcreech func_fatal_error "cannot find name of link library for \`$lib'" 537871eb93eaSdrh fi 537971eb93eaSdrh 538071eb93eaSdrh # This library was specified with -dlopen. 5381964dbb1eSa.rottmann if test "$pass" = dlopen; then 538271eb93eaSdrh if test -z "$libdir"; then 5383636a995dSmlcreech func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 538471eb93eaSdrh fi 53857f19c02fSvapier if test -z "$dlname" || 53867f19c02fSvapier test "$dlopen_support" != yes || 53877f19c02fSvapier test "$build_libtool_libs" = no; then 538871eb93eaSdrh # If there is no dlname, no dlopen support or we're linking 5389964dbb1eSa.rottmann # statically, we need to preload. We also need to preload any 5390964dbb1eSa.rottmann # dependent libraries so libltdl's deplib preloader doesn't 5391964dbb1eSa.rottmann # bomb out in the load deplibs phase. 5392964dbb1eSa.rottmann dlprefiles="$dlprefiles $lib $dependency_libs" 539371eb93eaSdrh else 539471eb93eaSdrh newdlfiles="$newdlfiles $lib" 539571eb93eaSdrh fi 539671eb93eaSdrh continue 539771eb93eaSdrh fi # $pass = dlopen 539871eb93eaSdrh 539971eb93eaSdrh # We need an absolute path. 540071eb93eaSdrh case $ladir in 540171eb93eaSdrh [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 540271eb93eaSdrh *) 540371eb93eaSdrh abs_ladir=`cd "$ladir" && pwd` 540471eb93eaSdrh if test -z "$abs_ladir"; then 5405636a995dSmlcreech func_warning "cannot determine absolute directory name of \`$ladir'" 5406636a995dSmlcreech func_warning "passing it literally to the linker, although it might fail" 540771eb93eaSdrh abs_ladir="$ladir" 540871eb93eaSdrh fi 540971eb93eaSdrh ;; 541071eb93eaSdrh esac 5411636a995dSmlcreech func_basename "$lib" 5412636a995dSmlcreech laname="$func_basename_result" 541371eb93eaSdrh 541471eb93eaSdrh # Find the relevant object directory and library name. 541571eb93eaSdrh if test "X$installed" = Xyes; then 541671eb93eaSdrh if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 5417636a995dSmlcreech func_warning "library \`$lib' was moved." 541871eb93eaSdrh dir="$ladir" 541971eb93eaSdrh absdir="$abs_ladir" 542071eb93eaSdrh libdir="$abs_ladir" 542171eb93eaSdrh else 542271eb93eaSdrh dir="$libdir" 542371eb93eaSdrh absdir="$libdir" 542471eb93eaSdrh fi 54257f19c02fSvapier test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 54267f19c02fSvapier else 54277f19c02fSvapier if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 54287f19c02fSvapier dir="$ladir" 54297f19c02fSvapier absdir="$abs_ladir" 54307f19c02fSvapier # Remove this search path later 54317f19c02fSvapier notinst_path="$notinst_path $abs_ladir" 543271eb93eaSdrh else 543371eb93eaSdrh dir="$ladir/$objdir" 543471eb93eaSdrh absdir="$abs_ladir/$objdir" 543571eb93eaSdrh # Remove this search path later 543671eb93eaSdrh notinst_path="$notinst_path $abs_ladir" 54377f19c02fSvapier fi 543871eb93eaSdrh fi # $installed = yes 5439636a995dSmlcreech func_stripname 'lib' '.la' "$laname" 5440636a995dSmlcreech name=$func_stripname_result 544171eb93eaSdrh 544271eb93eaSdrh # This library was specified with -dlpreopen. 5443964dbb1eSa.rottmann if test "$pass" = dlpreopen; then 5444636a995dSmlcreech if test -z "$libdir" && test "$linkmode" = prog; then 5445636a995dSmlcreech func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 544671eb93eaSdrh fi 544771eb93eaSdrh # Prefer using a static library (so that no silly _DYNAMIC symbols 544871eb93eaSdrh # are required to link). 544971eb93eaSdrh if test -n "$old_library"; then 545071eb93eaSdrh newdlprefiles="$newdlprefiles $dir/$old_library" 5451636a995dSmlcreech # Keep a list of preopened convenience libraries to check 5452636a995dSmlcreech # that they are being used correctly in the link pass. 5453636a995dSmlcreech test -z "$libdir" && \ 5454636a995dSmlcreech dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" 545571eb93eaSdrh # Otherwise, use the dlname, so that lt_dlopen finds it. 545671eb93eaSdrh elif test -n "$dlname"; then 545771eb93eaSdrh newdlprefiles="$newdlprefiles $dir/$dlname" 545871eb93eaSdrh else 545971eb93eaSdrh newdlprefiles="$newdlprefiles $dir/$linklib" 546071eb93eaSdrh fi 546171eb93eaSdrh fi # $pass = dlpreopen 546271eb93eaSdrh 546371eb93eaSdrh if test -z "$libdir"; then 546471eb93eaSdrh # Link the convenience library 5465964dbb1eSa.rottmann if test "$linkmode" = lib; then 546671eb93eaSdrh deplibs="$dir/$old_library $deplibs" 546771eb93eaSdrh elif test "$linkmode,$pass" = "prog,link"; then 546871eb93eaSdrh compile_deplibs="$dir/$old_library $compile_deplibs" 546971eb93eaSdrh finalize_deplibs="$dir/$old_library $finalize_deplibs" 547071eb93eaSdrh else 5471964dbb1eSa.rottmann deplibs="$lib $deplibs" # used for prog,scan pass 547271eb93eaSdrh fi 547371eb93eaSdrh continue 547471eb93eaSdrh fi 547571eb93eaSdrh 5476964dbb1eSa.rottmann 5477964dbb1eSa.rottmann if test "$linkmode" = prog && test "$pass" != link; then 547871eb93eaSdrh newlib_search_path="$newlib_search_path $ladir" 547971eb93eaSdrh deplibs="$lib $deplibs" 548071eb93eaSdrh 548171eb93eaSdrh linkalldeplibs=no 548271eb93eaSdrh if test "$link_all_deplibs" != no || test -z "$library_names" || 548371eb93eaSdrh test "$build_libtool_libs" = no; then 548471eb93eaSdrh linkalldeplibs=yes 548571eb93eaSdrh fi 548671eb93eaSdrh 548771eb93eaSdrh tmp_libs= 548871eb93eaSdrh for deplib in $dependency_libs; do 548971eb93eaSdrh case $deplib in 5490636a995dSmlcreech -L*) func_stripname '-L' '' "$deplib" 5491636a995dSmlcreech newlib_search_path="$newlib_search_path $func_stripname_result" 5492636a995dSmlcreech ;; 549371eb93eaSdrh esac 549471eb93eaSdrh # Need to link against all dependency_libs? 5495964dbb1eSa.rottmann if test "$linkalldeplibs" = yes; then 549671eb93eaSdrh deplibs="$deplib $deplibs" 549771eb93eaSdrh else 549871eb93eaSdrh # Need to hardcode shared library paths 549971eb93eaSdrh # or/and link against static libraries 550071eb93eaSdrh newdependency_libs="$deplib $newdependency_libs" 550171eb93eaSdrh fi 5502636a995dSmlcreech if $opt_duplicate_deps ; then 550371eb93eaSdrh case "$tmp_libs " in 550471eb93eaSdrh *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 550571eb93eaSdrh esac 550662507b65Sa.rottmann fi 550771eb93eaSdrh tmp_libs="$tmp_libs $deplib" 550871eb93eaSdrh done # for deplib 550971eb93eaSdrh continue 551071eb93eaSdrh fi # $linkmode = prog... 551171eb93eaSdrh 5512964dbb1eSa.rottmann if test "$linkmode,$pass" = "prog,link"; then 551371eb93eaSdrh if test -n "$library_names" && 5514636a995dSmlcreech { { test "$prefer_static_libs" = no || 5515636a995dSmlcreech test "$prefer_static_libs,$installed" = "built,yes"; } || 5516636a995dSmlcreech test -z "$old_library"; }; then 5517964dbb1eSa.rottmann # We need to hardcode the library path 55187f19c02fSvapier if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 5519964dbb1eSa.rottmann # Make sure the rpath contains only unique directories. 5520636a995dSmlcreech case "$temp_rpath:" in 5521636a995dSmlcreech *"$absdir:"*) ;; 5522636a995dSmlcreech *) temp_rpath="$temp_rpath$absdir:" ;; 5523964dbb1eSa.rottmann esac 5524964dbb1eSa.rottmann fi 552562507b65Sa.rottmann 552662507b65Sa.rottmann # Hardcode the library path. 552762507b65Sa.rottmann # Skip directories that are in the system default run-time 552862507b65Sa.rottmann # search path. 552962507b65Sa.rottmann case " $sys_lib_dlsearch_path " in 553062507b65Sa.rottmann *" $absdir "*) ;; 553162507b65Sa.rottmann *) 553262507b65Sa.rottmann case "$compile_rpath " in 553362507b65Sa.rottmann *" $absdir "*) ;; 553462507b65Sa.rottmann *) compile_rpath="$compile_rpath $absdir" 553562507b65Sa.rottmann esac 553662507b65Sa.rottmann ;; 553762507b65Sa.rottmann esac 553862507b65Sa.rottmann case " $sys_lib_dlsearch_path " in 553962507b65Sa.rottmann *" $libdir "*) ;; 554062507b65Sa.rottmann *) 554162507b65Sa.rottmann case "$finalize_rpath " in 554262507b65Sa.rottmann *" $libdir "*) ;; 554362507b65Sa.rottmann *) finalize_rpath="$finalize_rpath $libdir" 554462507b65Sa.rottmann esac 554562507b65Sa.rottmann ;; 554662507b65Sa.rottmann esac 554771eb93eaSdrh fi # $linkmode,$pass = prog,link... 554871eb93eaSdrh 554971eb93eaSdrh if test "$alldeplibs" = yes && 555071eb93eaSdrh { test "$deplibs_check_method" = pass_all || 555171eb93eaSdrh { test "$build_libtool_libs" = yes && 555271eb93eaSdrh test -n "$library_names"; }; }; then 555371eb93eaSdrh # We only need to search for static libraries 555471eb93eaSdrh continue 555571eb93eaSdrh fi 5556964dbb1eSa.rottmann fi 555771eb93eaSdrh 5558964dbb1eSa.rottmann link_static=no # Whether the deplib will be linked statically 55597f19c02fSvapier use_static_libs=$prefer_static_libs 55607f19c02fSvapier if test "$use_static_libs" = built && test "$installed" = yes; then 55617f19c02fSvapier use_static_libs=no 55627f19c02fSvapier fi 5563964dbb1eSa.rottmann if test -n "$library_names" && 55647f19c02fSvapier { test "$use_static_libs" = no || test -z "$old_library"; }; then 5565636a995dSmlcreech case $host in 5566*6acb2cf6Svapier *cygwin* | *mingw* | *cegcc*) 5567636a995dSmlcreech # No point in relinking DLLs because paths are not encoded 5568636a995dSmlcreech notinst_deplibs="$notinst_deplibs $lib" 5569636a995dSmlcreech need_relink=no 5570636a995dSmlcreech ;; 5571636a995dSmlcreech *) 557271eb93eaSdrh if test "$installed" = no; then 557371eb93eaSdrh notinst_deplibs="$notinst_deplibs $lib" 557471eb93eaSdrh need_relink=yes 557571eb93eaSdrh fi 5576636a995dSmlcreech ;; 5577636a995dSmlcreech esac 5578964dbb1eSa.rottmann # This is a shared library 5579964dbb1eSa.rottmann 5580636a995dSmlcreech # Warn about portability, can't link against -module's on some 5581636a995dSmlcreech # systems (darwin). Don't bleat about dlopened modules though! 5582636a995dSmlcreech dlopenmodule="" 5583636a995dSmlcreech for dlpremoduletest in $dlprefiles; do 5584636a995dSmlcreech if test "X$dlpremoduletest" = "X$lib"; then 5585636a995dSmlcreech dlopenmodule="$dlpremoduletest" 5586636a995dSmlcreech break 5587964dbb1eSa.rottmann fi 5588636a995dSmlcreech done 5589636a995dSmlcreech if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 5590636a995dSmlcreech $ECHO 5591636a995dSmlcreech if test "$linkmode" = prog; then 5592636a995dSmlcreech $ECHO "*** Warning: Linking the executable $output against the loadable module" 5593636a995dSmlcreech else 5594636a995dSmlcreech $ECHO "*** Warning: Linking the shared library $output against the loadable module" 5595636a995dSmlcreech fi 5596636a995dSmlcreech $ECHO "*** $linklib is not portable!" 5597964dbb1eSa.rottmann fi 5598964dbb1eSa.rottmann if test "$linkmode" = lib && 5599964dbb1eSa.rottmann test "$hardcode_into_libs" = yes; then 5600964dbb1eSa.rottmann # Hardcode the library path. 5601964dbb1eSa.rottmann # Skip directories that are in the system default run-time 5602964dbb1eSa.rottmann # search path. 5603964dbb1eSa.rottmann case " $sys_lib_dlsearch_path " in 5604964dbb1eSa.rottmann *" $absdir "*) ;; 5605964dbb1eSa.rottmann *) 5606964dbb1eSa.rottmann case "$compile_rpath " in 5607964dbb1eSa.rottmann *" $absdir "*) ;; 5608964dbb1eSa.rottmann *) compile_rpath="$compile_rpath $absdir" 5609964dbb1eSa.rottmann esac 5610964dbb1eSa.rottmann ;; 5611964dbb1eSa.rottmann esac 5612964dbb1eSa.rottmann case " $sys_lib_dlsearch_path " in 5613964dbb1eSa.rottmann *" $libdir "*) ;; 5614964dbb1eSa.rottmann *) 5615964dbb1eSa.rottmann case "$finalize_rpath " in 5616964dbb1eSa.rottmann *" $libdir "*) ;; 5617964dbb1eSa.rottmann *) finalize_rpath="$finalize_rpath $libdir" 5618964dbb1eSa.rottmann esac 5619964dbb1eSa.rottmann ;; 5620964dbb1eSa.rottmann esac 5621964dbb1eSa.rottmann fi 562271eb93eaSdrh 562371eb93eaSdrh if test -n "$old_archive_from_expsyms_cmds"; then 562471eb93eaSdrh # figure out the soname 562571eb93eaSdrh set dummy $library_names 5626636a995dSmlcreech shift 5627636a995dSmlcreech realname="$1" 5628636a995dSmlcreech shift 5629636a995dSmlcreech libname=`eval "\\$ECHO \"$libname_spec\""` 563071eb93eaSdrh # use dlname if we got it. it's perfectly good, no? 563171eb93eaSdrh if test -n "$dlname"; then 563271eb93eaSdrh soname="$dlname" 563371eb93eaSdrh elif test -n "$soname_spec"; then 563471eb93eaSdrh # bleh windows 563571eb93eaSdrh case $host in 5636*6acb2cf6Svapier *cygwin* | mingw* | *cegcc*) 5637636a995dSmlcreech func_arith $current - $age 5638636a995dSmlcreech major=$func_arith_result 563971eb93eaSdrh versuffix="-$major" 564071eb93eaSdrh ;; 564171eb93eaSdrh esac 564271eb93eaSdrh eval soname=\"$soname_spec\" 564371eb93eaSdrh else 564471eb93eaSdrh soname="$realname" 564571eb93eaSdrh fi 564671eb93eaSdrh 564771eb93eaSdrh # Make a new name for the extract_expsyms_cmds to use 564871eb93eaSdrh soroot="$soname" 5649636a995dSmlcreech func_basename "$soroot" 5650636a995dSmlcreech soname="$func_basename_result" 5651636a995dSmlcreech func_stripname 'lib' '.dll' "$soname" 5652636a995dSmlcreech newlib=libimp-$func_stripname_result.a 565371eb93eaSdrh 565471eb93eaSdrh # If the library has no export list, then create one now 565571eb93eaSdrh if test -f "$output_objdir/$soname-def"; then : 565671eb93eaSdrh else 5657636a995dSmlcreech func_verbose "extracting exported symbol list from \`$soname'" 5658636a995dSmlcreech func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 565971eb93eaSdrh fi 566071eb93eaSdrh 566171eb93eaSdrh # Create $newlib 566271eb93eaSdrh if test -f "$output_objdir/$newlib"; then :; else 5663636a995dSmlcreech func_verbose "generating import library for \`$soname'" 5664636a995dSmlcreech func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 566571eb93eaSdrh fi 566671eb93eaSdrh # make sure the library variables are pointing to the new library 566771eb93eaSdrh dir=$output_objdir 566871eb93eaSdrh linklib=$newlib 5669964dbb1eSa.rottmann fi # test -n "$old_archive_from_expsyms_cmds" 567071eb93eaSdrh 5671964dbb1eSa.rottmann if test "$linkmode" = prog || test "$mode" != relink; then 567271eb93eaSdrh add_shlibpath= 567371eb93eaSdrh add_dir= 567471eb93eaSdrh add= 567571eb93eaSdrh lib_linked=yes 567671eb93eaSdrh case $hardcode_action in 567771eb93eaSdrh immediate | unsupported) 567871eb93eaSdrh if test "$hardcode_direct" = no; then 567971eb93eaSdrh add="$dir/$linklib" 5680964dbb1eSa.rottmann case $host in 56817f19c02fSvapier *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 56827f19c02fSvapier *-*-sysv4*uw2*) add_dir="-L$dir" ;; 56837f19c02fSvapier *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 56847f19c02fSvapier *-*-unixware7*) add_dir="-L$dir" ;; 5685964dbb1eSa.rottmann *-*-darwin* ) 5686636a995dSmlcreech # if the lib is a (non-dlopened) module then we can not 5687636a995dSmlcreech # link against it, someone is ignoring the earlier warnings 56887f19c02fSvapier if /usr/bin/file -L $add 2> /dev/null | 5689636a995dSmlcreech $GREP ": [^:]* bundle" >/dev/null ; then 5690636a995dSmlcreech if test "X$dlopenmodule" != "X$lib"; then 5691636a995dSmlcreech $ECHO "*** Warning: lib $linklib is a module, not a shared library" 5692964dbb1eSa.rottmann if test -z "$old_library" ; then 5693636a995dSmlcreech $ECHO 5694636a995dSmlcreech $ECHO "*** And there doesn't seem to be a static archive available" 5695636a995dSmlcreech $ECHO "*** The link will probably fail, sorry" 5696964dbb1eSa.rottmann else 5697964dbb1eSa.rottmann add="$dir/$old_library" 5698964dbb1eSa.rottmann fi 5699636a995dSmlcreech elif test -n "$old_library"; then 5700636a995dSmlcreech add="$dir/$old_library" 5701636a995dSmlcreech fi 5702964dbb1eSa.rottmann fi 5703964dbb1eSa.rottmann esac 570471eb93eaSdrh elif test "$hardcode_minus_L" = no; then 570571eb93eaSdrh case $host in 570671eb93eaSdrh *-*-sunos*) add_shlibpath="$dir" ;; 570771eb93eaSdrh esac 570871eb93eaSdrh add_dir="-L$dir" 570971eb93eaSdrh add="-l$name" 571071eb93eaSdrh elif test "$hardcode_shlibpath_var" = no; then 571171eb93eaSdrh add_shlibpath="$dir" 571271eb93eaSdrh add="-l$name" 571371eb93eaSdrh else 571471eb93eaSdrh lib_linked=no 571571eb93eaSdrh fi 571671eb93eaSdrh ;; 571771eb93eaSdrh relink) 5718636a995dSmlcreech if test "$hardcode_direct" = yes && 5719636a995dSmlcreech test "$hardcode_direct_absolute" = no; then 572071eb93eaSdrh add="$dir/$linklib" 572171eb93eaSdrh elif test "$hardcode_minus_L" = yes; then 572271eb93eaSdrh add_dir="-L$dir" 572362507b65Sa.rottmann # Try looking first in the location we're being installed to. 572462507b65Sa.rottmann if test -n "$inst_prefix_dir"; then 57257f19c02fSvapier case $libdir in 5726964dbb1eSa.rottmann [\\/]*) 5727964dbb1eSa.rottmann add_dir="$add_dir -L$inst_prefix_dir$libdir" 572862507b65Sa.rottmann ;; 572962507b65Sa.rottmann esac 573062507b65Sa.rottmann fi 573171eb93eaSdrh add="-l$name" 573271eb93eaSdrh elif test "$hardcode_shlibpath_var" = yes; then 573371eb93eaSdrh add_shlibpath="$dir" 573471eb93eaSdrh add="-l$name" 573571eb93eaSdrh else 573671eb93eaSdrh lib_linked=no 573771eb93eaSdrh fi 573871eb93eaSdrh ;; 573971eb93eaSdrh *) lib_linked=no ;; 574071eb93eaSdrh esac 574171eb93eaSdrh 574271eb93eaSdrh if test "$lib_linked" != yes; then 5743636a995dSmlcreech func_fatal_configuration "unsupported hardcode properties" 574471eb93eaSdrh fi 574571eb93eaSdrh 574671eb93eaSdrh if test -n "$add_shlibpath"; then 574771eb93eaSdrh case :$compile_shlibpath: in 574871eb93eaSdrh *":$add_shlibpath:"*) ;; 574971eb93eaSdrh *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 575071eb93eaSdrh esac 575171eb93eaSdrh fi 5752964dbb1eSa.rottmann if test "$linkmode" = prog; then 575371eb93eaSdrh test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 575471eb93eaSdrh test -n "$add" && compile_deplibs="$add $compile_deplibs" 575571eb93eaSdrh else 575671eb93eaSdrh test -n "$add_dir" && deplibs="$add_dir $deplibs" 575771eb93eaSdrh test -n "$add" && deplibs="$add $deplibs" 5758636a995dSmlcreech if test "$hardcode_direct" != yes && 5759636a995dSmlcreech test "$hardcode_minus_L" != yes && 576071eb93eaSdrh test "$hardcode_shlibpath_var" = yes; then 576171eb93eaSdrh case :$finalize_shlibpath: in 576271eb93eaSdrh *":$libdir:"*) ;; 576371eb93eaSdrh *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 576471eb93eaSdrh esac 576571eb93eaSdrh fi 576671eb93eaSdrh fi 576771eb93eaSdrh fi 576871eb93eaSdrh 5769964dbb1eSa.rottmann if test "$linkmode" = prog || test "$mode" = relink; then 577071eb93eaSdrh add_shlibpath= 577171eb93eaSdrh add_dir= 577271eb93eaSdrh add= 577371eb93eaSdrh # Finalize command for both is simple: just hardcode it. 5774636a995dSmlcreech if test "$hardcode_direct" = yes && 5775636a995dSmlcreech test "$hardcode_direct_absolute" = no; then 577671eb93eaSdrh add="$libdir/$linklib" 577771eb93eaSdrh elif test "$hardcode_minus_L" = yes; then 577871eb93eaSdrh add_dir="-L$libdir" 577971eb93eaSdrh add="-l$name" 578071eb93eaSdrh elif test "$hardcode_shlibpath_var" = yes; then 578171eb93eaSdrh case :$finalize_shlibpath: in 578271eb93eaSdrh *":$libdir:"*) ;; 578371eb93eaSdrh *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 578471eb93eaSdrh esac 578571eb93eaSdrh add="-l$name" 5786964dbb1eSa.rottmann elif test "$hardcode_automatic" = yes; then 57877f19c02fSvapier if test -n "$inst_prefix_dir" && 57887f19c02fSvapier test -f "$inst_prefix_dir$libdir/$linklib" ; then 5789964dbb1eSa.rottmann add="$inst_prefix_dir$libdir/$linklib" 5790964dbb1eSa.rottmann else 5791964dbb1eSa.rottmann add="$libdir/$linklib" 5792964dbb1eSa.rottmann fi 579371eb93eaSdrh else 579471eb93eaSdrh # We cannot seem to hardcode it, guess we'll fake it. 579571eb93eaSdrh add_dir="-L$libdir" 579662507b65Sa.rottmann # Try looking first in the location we're being installed to. 579762507b65Sa.rottmann if test -n "$inst_prefix_dir"; then 57987f19c02fSvapier case $libdir in 5799964dbb1eSa.rottmann [\\/]*) 5800964dbb1eSa.rottmann add_dir="$add_dir -L$inst_prefix_dir$libdir" 580162507b65Sa.rottmann ;; 580262507b65Sa.rottmann esac 580362507b65Sa.rottmann fi 580471eb93eaSdrh add="-l$name" 580571eb93eaSdrh fi 580671eb93eaSdrh 5807964dbb1eSa.rottmann if test "$linkmode" = prog; then 580871eb93eaSdrh test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 580971eb93eaSdrh test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 581071eb93eaSdrh else 581171eb93eaSdrh test -n "$add_dir" && deplibs="$add_dir $deplibs" 581271eb93eaSdrh test -n "$add" && deplibs="$add $deplibs" 581371eb93eaSdrh fi 581471eb93eaSdrh fi 5815964dbb1eSa.rottmann elif test "$linkmode" = prog; then 581671eb93eaSdrh # Here we assume that one of hardcode_direct or hardcode_minus_L 581771eb93eaSdrh # is not unsupported. This is valid on all known static and 581871eb93eaSdrh # shared platforms. 581971eb93eaSdrh if test "$hardcode_direct" != unsupported; then 582071eb93eaSdrh test -n "$old_library" && linklib="$old_library" 582171eb93eaSdrh compile_deplibs="$dir/$linklib $compile_deplibs" 582271eb93eaSdrh finalize_deplibs="$dir/$linklib $finalize_deplibs" 582371eb93eaSdrh else 582471eb93eaSdrh compile_deplibs="-l$name -L$dir $compile_deplibs" 582571eb93eaSdrh finalize_deplibs="-l$name -L$dir $finalize_deplibs" 582671eb93eaSdrh fi 582771eb93eaSdrh elif test "$build_libtool_libs" = yes; then 582871eb93eaSdrh # Not a shared library 582971eb93eaSdrh if test "$deplibs_check_method" != pass_all; then 583071eb93eaSdrh # We're trying link a shared library against a static one 583171eb93eaSdrh # but the system doesn't support it. 583271eb93eaSdrh 583371eb93eaSdrh # Just print a warning and add the library to dependency_libs so 583471eb93eaSdrh # that the program can be linked against the static library. 5835636a995dSmlcreech $ECHO 5836636a995dSmlcreech $ECHO "*** Warning: This system can not link to static lib archive $lib." 5837636a995dSmlcreech $ECHO "*** I have the capability to make that library automatically link in when" 5838636a995dSmlcreech $ECHO "*** you link to this library. But I can only do this if you have a" 5839636a995dSmlcreech $ECHO "*** shared version of the library, which you do not appear to have." 584071eb93eaSdrh if test "$module" = yes; then 5841636a995dSmlcreech $ECHO "*** But as you try to build a module library, libtool will still create " 5842636a995dSmlcreech $ECHO "*** a static module, that should work as long as the dlopening application" 5843636a995dSmlcreech $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." 584471eb93eaSdrh if test -z "$global_symbol_pipe"; then 5845636a995dSmlcreech $ECHO 5846636a995dSmlcreech $ECHO "*** However, this would only work if libtool was able to extract symbol" 5847636a995dSmlcreech $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 5848636a995dSmlcreech $ECHO "*** not find such a program. So, this module is probably useless." 5849636a995dSmlcreech $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 585071eb93eaSdrh fi 585171eb93eaSdrh if test "$build_old_libs" = no; then 585271eb93eaSdrh build_libtool_libs=module 585371eb93eaSdrh build_old_libs=yes 585471eb93eaSdrh else 585571eb93eaSdrh build_libtool_libs=no 585671eb93eaSdrh fi 585771eb93eaSdrh fi 585871eb93eaSdrh else 585971eb93eaSdrh deplibs="$dir/$old_library $deplibs" 586071eb93eaSdrh link_static=yes 586171eb93eaSdrh fi 586271eb93eaSdrh fi # link shared/static library? 586371eb93eaSdrh 5864964dbb1eSa.rottmann if test "$linkmode" = lib; then 586571eb93eaSdrh if test -n "$dependency_libs" && 58667f19c02fSvapier { test "$hardcode_into_libs" != yes || 58677f19c02fSvapier test "$build_old_libs" = yes || 5868964dbb1eSa.rottmann test "$link_static" = yes; }; then 586971eb93eaSdrh # Extract -R from dependency_libs 587071eb93eaSdrh temp_deplibs= 587171eb93eaSdrh for libdir in $dependency_libs; do 587271eb93eaSdrh case $libdir in 5873636a995dSmlcreech -R*) func_stripname '-R' '' "$libdir" 5874636a995dSmlcreech temp_xrpath=$func_stripname_result 587571eb93eaSdrh case " $xrpath " in 587671eb93eaSdrh *" $temp_xrpath "*) ;; 587771eb93eaSdrh *) xrpath="$xrpath $temp_xrpath";; 587871eb93eaSdrh esac;; 587971eb93eaSdrh *) temp_deplibs="$temp_deplibs $libdir";; 588071eb93eaSdrh esac 588171eb93eaSdrh done 588271eb93eaSdrh dependency_libs="$temp_deplibs" 588371eb93eaSdrh fi 588471eb93eaSdrh 588571eb93eaSdrh newlib_search_path="$newlib_search_path $absdir" 588671eb93eaSdrh # Link against this library 588771eb93eaSdrh test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 588871eb93eaSdrh # ... and its dependency_libs 588971eb93eaSdrh tmp_libs= 589071eb93eaSdrh for deplib in $dependency_libs; do 589171eb93eaSdrh newdependency_libs="$deplib $newdependency_libs" 5892636a995dSmlcreech if $opt_duplicate_deps ; then 589371eb93eaSdrh case "$tmp_libs " in 589471eb93eaSdrh *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 589571eb93eaSdrh esac 589662507b65Sa.rottmann fi 589771eb93eaSdrh tmp_libs="$tmp_libs $deplib" 589871eb93eaSdrh done 589971eb93eaSdrh 5900964dbb1eSa.rottmann if test "$link_all_deplibs" != no; then 590171eb93eaSdrh # Add the search paths of all dependency libraries 590271eb93eaSdrh for deplib in $dependency_libs; do 590371eb93eaSdrh case $deplib in 590471eb93eaSdrh -L*) path="$deplib" ;; 590571eb93eaSdrh *.la) 5906636a995dSmlcreech func_dirname "$deplib" "" "." 5907636a995dSmlcreech dir="$func_dirname_result" 590871eb93eaSdrh # We need an absolute path. 590971eb93eaSdrh case $dir in 591071eb93eaSdrh [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 591171eb93eaSdrh *) 591271eb93eaSdrh absdir=`cd "$dir" && pwd` 591371eb93eaSdrh if test -z "$absdir"; then 5914636a995dSmlcreech func_warning "cannot determine absolute directory name of \`$dir'" 591571eb93eaSdrh absdir="$dir" 591671eb93eaSdrh fi 591771eb93eaSdrh ;; 591871eb93eaSdrh esac 5919636a995dSmlcreech if $GREP "^installed=no" $deplib > /dev/null; then 5920964dbb1eSa.rottmann case $host in 5921964dbb1eSa.rottmann *-*-darwin*) 5922636a995dSmlcreech depdepl= 5923964dbb1eSa.rottmann eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 5924964dbb1eSa.rottmann if test -n "$deplibrary_names" ; then 5925964dbb1eSa.rottmann for tmp in $deplibrary_names ; do 5926964dbb1eSa.rottmann depdepl=$tmp 5927964dbb1eSa.rottmann done 5928636a995dSmlcreech if test -f "$absdir/$objdir/$depdepl" ; then 5929636a995dSmlcreech depdepl="$absdir/$objdir/$depdepl" 5930636a995dSmlcreech darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 5931636a995dSmlcreech if test -z "$darwin_install_name"; then 5932636a995dSmlcreech darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 5933964dbb1eSa.rottmann fi 5934636a995dSmlcreech compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 5935636a995dSmlcreech linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" 5936636a995dSmlcreech path= 5937964dbb1eSa.rottmann fi 5938636a995dSmlcreech fi 5939964dbb1eSa.rottmann ;; 5940964dbb1eSa.rottmann *) 5941636a995dSmlcreech path="-L$absdir/$objdir" 5942964dbb1eSa.rottmann ;; 5943964dbb1eSa.rottmann esac 5944636a995dSmlcreech else 5945636a995dSmlcreech eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5946636a995dSmlcreech test -z "$libdir" && \ 5947636a995dSmlcreech func_fatal_error "\`$deplib' is not a valid libtool archive" 5948636a995dSmlcreech test "$absdir" != "$libdir" && \ 5949636a995dSmlcreech func_warning "\`$deplib' seems to be moved" 5950636a995dSmlcreech 5951636a995dSmlcreech path="-L$absdir" 5952964dbb1eSa.rottmann fi 595371eb93eaSdrh ;; 5954964dbb1eSa.rottmann esac 5955964dbb1eSa.rottmann case " $deplibs " in 59567f19c02fSvapier *" $path "*) ;; 59577f19c02fSvapier *) deplibs="$path $deplibs" ;; 5958964dbb1eSa.rottmann esac 595971eb93eaSdrh done 596071eb93eaSdrh fi # link_all_deplibs != no 596171eb93eaSdrh fi # linkmode = lib 596271eb93eaSdrh done # for deplib in $libs 5963636a995dSmlcreech if test "$pass" = link; then 5964636a995dSmlcreech if test "$linkmode" = "prog"; then 5965636a995dSmlcreech compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 5966636a995dSmlcreech finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 5967636a995dSmlcreech else 5968636a995dSmlcreech compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 5969636a995dSmlcreech fi 5970636a995dSmlcreech fi 5971964dbb1eSa.rottmann dependency_libs="$newdependency_libs" 5972964dbb1eSa.rottmann if test "$pass" = dlpreopen; then 597371eb93eaSdrh # Link the dlpreopened libraries before other libraries 597471eb93eaSdrh for deplib in $save_deplibs; do 597571eb93eaSdrh deplibs="$deplib $deplibs" 597671eb93eaSdrh done 597771eb93eaSdrh fi 5978964dbb1eSa.rottmann if test "$pass" != dlopen; then 5979964dbb1eSa.rottmann if test "$pass" != conv; then 598071eb93eaSdrh # Make sure lib_search_path contains only unique directories. 598171eb93eaSdrh lib_search_path= 598271eb93eaSdrh for dir in $newlib_search_path; do 598371eb93eaSdrh case "$lib_search_path " in 598471eb93eaSdrh *" $dir "*) ;; 598571eb93eaSdrh *) lib_search_path="$lib_search_path $dir" ;; 598671eb93eaSdrh esac 598771eb93eaSdrh done 598871eb93eaSdrh newlib_search_path= 598971eb93eaSdrh fi 599071eb93eaSdrh 599171eb93eaSdrh if test "$linkmode,$pass" != "prog,link"; then 599271eb93eaSdrh vars="deplibs" 599371eb93eaSdrh else 599471eb93eaSdrh vars="compile_deplibs finalize_deplibs" 599571eb93eaSdrh fi 599671eb93eaSdrh for var in $vars dependency_libs; do 599771eb93eaSdrh # Add libraries to $var in reverse order 599871eb93eaSdrh eval tmp_libs=\"\$$var\" 599971eb93eaSdrh new_libs= 600071eb93eaSdrh for deplib in $tmp_libs; do 6001964dbb1eSa.rottmann # FIXME: Pedantically, this is the right thing to do, so 6002964dbb1eSa.rottmann # that some nasty dependency loop isn't accidentally 6003964dbb1eSa.rottmann # broken: 6004964dbb1eSa.rottmann #new_libs="$deplib $new_libs" 6005964dbb1eSa.rottmann # Pragmatically, this seems to cause very few problems in 6006964dbb1eSa.rottmann # practice: 600771eb93eaSdrh case $deplib in 600871eb93eaSdrh -L*) new_libs="$deplib $new_libs" ;; 6009964dbb1eSa.rottmann -R*) ;; 601071eb93eaSdrh *) 6011964dbb1eSa.rottmann # And here is the reason: when a library appears more 6012964dbb1eSa.rottmann # than once as an explicit dependence of a library, or 6013964dbb1eSa.rottmann # is implicitly linked in more than once by the 6014964dbb1eSa.rottmann # compiler, it is considered special, and multiple 6015964dbb1eSa.rottmann # occurrences thereof are not removed. Compare this 6016964dbb1eSa.rottmann # with having the same library being listed as a 6017964dbb1eSa.rottmann # dependency of multiple other libraries: in this case, 6018964dbb1eSa.rottmann # we know (pedantically, we assume) the library does not 6019964dbb1eSa.rottmann # need to be listed more than once, so we keep only the 6020964dbb1eSa.rottmann # last copy. This is not always right, but it is rare 6021964dbb1eSa.rottmann # enough that we require users that really mean to play 6022964dbb1eSa.rottmann # such unportable linking tricks to link the library 6023964dbb1eSa.rottmann # using -Wl,-lname, so that libtool does not consider it 6024964dbb1eSa.rottmann # for duplicate removal. 602571eb93eaSdrh case " $specialdeplibs " in 602671eb93eaSdrh *" $deplib "*) new_libs="$deplib $new_libs" ;; 602771eb93eaSdrh *) 602871eb93eaSdrh case " $new_libs " in 602971eb93eaSdrh *" $deplib "*) ;; 603071eb93eaSdrh *) new_libs="$deplib $new_libs" ;; 603171eb93eaSdrh esac 603271eb93eaSdrh ;; 603371eb93eaSdrh esac 603471eb93eaSdrh ;; 603571eb93eaSdrh esac 603671eb93eaSdrh done 603771eb93eaSdrh tmp_libs= 603871eb93eaSdrh for deplib in $new_libs; do 603971eb93eaSdrh case $deplib in 604071eb93eaSdrh -L*) 604171eb93eaSdrh case " $tmp_libs " in 604271eb93eaSdrh *" $deplib "*) ;; 604371eb93eaSdrh *) tmp_libs="$tmp_libs $deplib" ;; 604471eb93eaSdrh esac 604571eb93eaSdrh ;; 604671eb93eaSdrh *) tmp_libs="$tmp_libs $deplib" ;; 604771eb93eaSdrh esac 604871eb93eaSdrh done 604971eb93eaSdrh eval $var=\"$tmp_libs\" 605071eb93eaSdrh done # for var 605171eb93eaSdrh fi 60527f19c02fSvapier # Last step: remove runtime libs from dependency_libs 60537f19c02fSvapier # (they stay in deplibs) 6054964dbb1eSa.rottmann tmp_libs= 6055964dbb1eSa.rottmann for i in $dependency_libs ; do 6056964dbb1eSa.rottmann case " $predeps $postdeps $compiler_lib_search_path " in 6057964dbb1eSa.rottmann *" $i "*) 6058964dbb1eSa.rottmann i="" 6059964dbb1eSa.rottmann ;; 6060964dbb1eSa.rottmann esac 6061964dbb1eSa.rottmann if test -n "$i" ; then 6062964dbb1eSa.rottmann tmp_libs="$tmp_libs $i" 606362507b65Sa.rottmann fi 6064964dbb1eSa.rottmann done 6065964dbb1eSa.rottmann dependency_libs=$tmp_libs 606671eb93eaSdrh done # for pass 6067964dbb1eSa.rottmann if test "$linkmode" = prog; then 606871eb93eaSdrh dlfiles="$newdlfiles" 6069636a995dSmlcreech fi 6070636a995dSmlcreech if test "$linkmode" = prog || test "$linkmode" = lib; then 607171eb93eaSdrh dlprefiles="$newdlprefiles" 607271eb93eaSdrh fi 607371eb93eaSdrh 607471eb93eaSdrh case $linkmode in 607571eb93eaSdrh oldlib) 607671eb93eaSdrh if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 6077636a995dSmlcreech func_warning "\`-dlopen' is ignored for archives" 607871eb93eaSdrh fi 607971eb93eaSdrh 6080636a995dSmlcreech case " $deplibs" in 6081636a995dSmlcreech *\ -l* | *\ -L*) 6082636a995dSmlcreech func_warning "\`-l' and \`-L' are ignored for archives" ;; 6083636a995dSmlcreech esac 608471eb93eaSdrh 6085636a995dSmlcreech test -n "$rpath" && \ 6086636a995dSmlcreech func_warning "\`-rpath' is ignored for archives" 608771eb93eaSdrh 6088636a995dSmlcreech test -n "$xrpath" && \ 6089636a995dSmlcreech func_warning "\`-R' is ignored for archives" 609071eb93eaSdrh 6091636a995dSmlcreech test -n "$vinfo" && \ 6092636a995dSmlcreech func_warning "\`-version-info/-version-number' is ignored for archives" 609371eb93eaSdrh 6094636a995dSmlcreech test -n "$release" && \ 6095636a995dSmlcreech func_warning "\`-release' is ignored for archives" 6096636a995dSmlcreech 6097636a995dSmlcreech test -n "$export_symbols$export_symbols_regex" && \ 6098636a995dSmlcreech func_warning "\`-export-symbols' is ignored for archives" 609971eb93eaSdrh 610071eb93eaSdrh # Now set the variables for building old libraries. 610171eb93eaSdrh build_libtool_libs=no 610271eb93eaSdrh oldlibs="$output" 610371eb93eaSdrh objs="$objs$old_deplibs" 610471eb93eaSdrh ;; 610571eb93eaSdrh 610671eb93eaSdrh lib) 610771eb93eaSdrh # Make sure we only generate libraries of the form `libNAME.la'. 610871eb93eaSdrh case $outputname in 610971eb93eaSdrh lib*) 6110636a995dSmlcreech func_stripname 'lib' '.la' "$outputname" 6111636a995dSmlcreech name=$func_stripname_result 61127f19c02fSvapier eval shared_ext=\"$shrext_cmds\" 611371eb93eaSdrh eval libname=\"$libname_spec\" 611471eb93eaSdrh ;; 611571eb93eaSdrh *) 6116636a995dSmlcreech test "$module" = no && \ 6117636a995dSmlcreech func_fatal_help "libtool library \`$output' must begin with \`lib'" 6118636a995dSmlcreech 611971eb93eaSdrh if test "$need_lib_prefix" != no; then 612071eb93eaSdrh # Add the "lib" prefix for modules if required 6121636a995dSmlcreech func_stripname '' '.la' "$outputname" 6122636a995dSmlcreech name=$func_stripname_result 61237f19c02fSvapier eval shared_ext=\"$shrext_cmds\" 612471eb93eaSdrh eval libname=\"$libname_spec\" 612571eb93eaSdrh else 6126636a995dSmlcreech func_stripname '' '.la' "$outputname" 6127636a995dSmlcreech libname=$func_stripname_result 612871eb93eaSdrh fi 612971eb93eaSdrh ;; 613071eb93eaSdrh esac 613171eb93eaSdrh 613271eb93eaSdrh if test -n "$objs"; then 613371eb93eaSdrh if test "$deplibs_check_method" != pass_all; then 6134636a995dSmlcreech func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 613571eb93eaSdrh else 6136636a995dSmlcreech $ECHO 6137636a995dSmlcreech $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 6138636a995dSmlcreech $ECHO "*** objects $objs is not portable!" 613971eb93eaSdrh libobjs="$libobjs $objs" 614071eb93eaSdrh fi 614171eb93eaSdrh fi 614271eb93eaSdrh 6143636a995dSmlcreech test "$dlself" != no && \ 6144636a995dSmlcreech func_warning "\`-dlopen self' is ignored for libtool libraries" 614571eb93eaSdrh 614671eb93eaSdrh set dummy $rpath 6147636a995dSmlcreech shift 6148636a995dSmlcreech test "$#" -gt 1 && \ 6149636a995dSmlcreech func_warning "ignoring multiple \`-rpath's for a libtool library" 6150636a995dSmlcreech 6151636a995dSmlcreech install_libdir="$1" 615271eb93eaSdrh 615371eb93eaSdrh oldlibs= 615471eb93eaSdrh if test -z "$rpath"; then 615571eb93eaSdrh if test "$build_libtool_libs" = yes; then 615671eb93eaSdrh # Building a libtool convenience library. 6157964dbb1eSa.rottmann # Some compilers have problems with a `.al' extension so 6158964dbb1eSa.rottmann # convenience libraries should have the same extension an 6159964dbb1eSa.rottmann # archive normally would. 616071eb93eaSdrh oldlibs="$output_objdir/$libname.$libext $oldlibs" 616171eb93eaSdrh build_libtool_libs=convenience 616271eb93eaSdrh build_old_libs=yes 616371eb93eaSdrh fi 616471eb93eaSdrh 6165636a995dSmlcreech test -n "$vinfo" && \ 6166636a995dSmlcreech func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 616771eb93eaSdrh 6168636a995dSmlcreech test -n "$release" && \ 6169636a995dSmlcreech func_warning "\`-release' is ignored for convenience libraries" 617071eb93eaSdrh else 617171eb93eaSdrh 617271eb93eaSdrh # Parse the version information argument. 617362507b65Sa.rottmann save_ifs="$IFS"; IFS=':' 617471eb93eaSdrh set dummy $vinfo 0 0 0 6175636a995dSmlcreech shift 617671eb93eaSdrh IFS="$save_ifs" 617771eb93eaSdrh 6178636a995dSmlcreech test -n "$7" && \ 6179636a995dSmlcreech func_fatal_help "too many parameters to \`-version-info'" 618071eb93eaSdrh 6181964dbb1eSa.rottmann # convert absolute version numbers to libtool ages 6182964dbb1eSa.rottmann # this retains compatibility with .la files and attempts 6183964dbb1eSa.rottmann # to make the code below a bit more comprehensible 6184964dbb1eSa.rottmann 6185964dbb1eSa.rottmann case $vinfo_number in 6186964dbb1eSa.rottmann yes) 6187636a995dSmlcreech number_major="$1" 6188636a995dSmlcreech number_minor="$2" 6189636a995dSmlcreech number_revision="$3" 6190964dbb1eSa.rottmann # 6191964dbb1eSa.rottmann # There are really only two kinds -- those that 6192964dbb1eSa.rottmann # use the current revision as the major version 6193964dbb1eSa.rottmann # and those that subtract age and use age as 6194964dbb1eSa.rottmann # a minor version. But, then there is irix 6195964dbb1eSa.rottmann # which has an extra 1 added just for fun 6196964dbb1eSa.rottmann # 6197964dbb1eSa.rottmann case $version_type in 6198636a995dSmlcreech darwin|linux|osf|windows|none) 6199636a995dSmlcreech func_arith $number_major + $number_minor 6200636a995dSmlcreech current=$func_arith_result 6201964dbb1eSa.rottmann age="$number_minor" 6202964dbb1eSa.rottmann revision="$number_revision" 6203964dbb1eSa.rottmann ;; 6204964dbb1eSa.rottmann freebsd-aout|freebsd-elf|sunos) 6205964dbb1eSa.rottmann current="$number_major" 6206964dbb1eSa.rottmann revision="$number_minor" 6207964dbb1eSa.rottmann age="0" 6208964dbb1eSa.rottmann ;; 6209964dbb1eSa.rottmann irix|nonstopux) 6210636a995dSmlcreech func_arith $number_major + $number_minor 6211636a995dSmlcreech current=$func_arith_result 6212964dbb1eSa.rottmann age="$number_minor" 6213964dbb1eSa.rottmann revision="$number_minor" 6214636a995dSmlcreech lt_irix_increment=no 6215964dbb1eSa.rottmann ;; 6216964dbb1eSa.rottmann esac 6217964dbb1eSa.rottmann ;; 6218964dbb1eSa.rottmann no) 6219636a995dSmlcreech current="$1" 6220636a995dSmlcreech revision="$2" 6221636a995dSmlcreech age="$3" 6222964dbb1eSa.rottmann ;; 6223964dbb1eSa.rottmann esac 622471eb93eaSdrh 622571eb93eaSdrh # Check that each of the things are valid numbers. 622671eb93eaSdrh case $current in 62277f19c02fSvapier 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; 622871eb93eaSdrh *) 6229636a995dSmlcreech func_error "CURRENT \`$current' must be a nonnegative integer" 6230636a995dSmlcreech func_fatal_error "\`$vinfo' is not valid version information" 623171eb93eaSdrh ;; 623271eb93eaSdrh esac 623371eb93eaSdrh 623471eb93eaSdrh case $revision in 62357f19c02fSvapier 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; 623671eb93eaSdrh *) 6237636a995dSmlcreech func_error "REVISION \`$revision' must be a nonnegative integer" 6238636a995dSmlcreech func_fatal_error "\`$vinfo' is not valid version information" 623971eb93eaSdrh ;; 624071eb93eaSdrh esac 624171eb93eaSdrh 624271eb93eaSdrh case $age in 62437f19c02fSvapier 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; 624471eb93eaSdrh *) 6245636a995dSmlcreech func_error "AGE \`$age' must be a nonnegative integer" 6246636a995dSmlcreech func_fatal_error "\`$vinfo' is not valid version information" 624771eb93eaSdrh ;; 624871eb93eaSdrh esac 624971eb93eaSdrh 6250964dbb1eSa.rottmann if test "$age" -gt "$current"; then 6251636a995dSmlcreech func_error "AGE \`$age' is greater than the current interface number \`$current'" 6252636a995dSmlcreech func_fatal_error "\`$vinfo' is not valid version information" 625371eb93eaSdrh fi 625471eb93eaSdrh 625571eb93eaSdrh # Calculate the version variables. 625671eb93eaSdrh major= 625771eb93eaSdrh versuffix= 625871eb93eaSdrh verstring= 625971eb93eaSdrh case $version_type in 626071eb93eaSdrh none) ;; 626171eb93eaSdrh 626271eb93eaSdrh darwin) 626371eb93eaSdrh # Like Linux, but with the current version available in 626471eb93eaSdrh # verstring for coding it into the library header 6265636a995dSmlcreech func_arith $current - $age 6266636a995dSmlcreech major=.$func_arith_result 626771eb93eaSdrh versuffix="$major.$age.$revision" 626871eb93eaSdrh # Darwin ld doesn't like 0 for these options... 6269636a995dSmlcreech func_arith $current + 1 6270636a995dSmlcreech minor_current=$func_arith_result 6271636a995dSmlcreech xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 6272636a995dSmlcreech verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 627371eb93eaSdrh ;; 627471eb93eaSdrh 627571eb93eaSdrh freebsd-aout) 627671eb93eaSdrh major=".$current" 627771eb93eaSdrh versuffix=".$current.$revision"; 627871eb93eaSdrh ;; 627971eb93eaSdrh 628071eb93eaSdrh freebsd-elf) 628171eb93eaSdrh major=".$current" 6282636a995dSmlcreech versuffix=".$current" 628371eb93eaSdrh ;; 628471eb93eaSdrh 628562507b65Sa.rottmann irix | nonstopux) 6286636a995dSmlcreech if test "X$lt_irix_increment" = "Xno"; then 6287636a995dSmlcreech func_arith $current - $age 6288636a995dSmlcreech else 6289636a995dSmlcreech func_arith $current - $age + 1 6290636a995dSmlcreech fi 6291636a995dSmlcreech major=$func_arith_result 629262507b65Sa.rottmann 629362507b65Sa.rottmann case $version_type in 629462507b65Sa.rottmann nonstopux) verstring_prefix=nonstopux ;; 629562507b65Sa.rottmann *) verstring_prefix=sgi ;; 629662507b65Sa.rottmann esac 629762507b65Sa.rottmann verstring="$verstring_prefix$major.$revision" 629871eb93eaSdrh 629971eb93eaSdrh # Add in all the interfaces that we are compatible with. 630071eb93eaSdrh loop=$revision 6301964dbb1eSa.rottmann while test "$loop" -ne 0; do 6302636a995dSmlcreech func_arith $revision - $loop 6303636a995dSmlcreech iface=$func_arith_result 6304636a995dSmlcreech func_arith $loop - 1 6305636a995dSmlcreech loop=$func_arith_result 630662507b65Sa.rottmann verstring="$verstring_prefix$major.$iface:$verstring" 630771eb93eaSdrh done 630871eb93eaSdrh 630971eb93eaSdrh # Before this point, $major must not contain `.'. 631071eb93eaSdrh major=.$major 631171eb93eaSdrh versuffix="$major.$revision" 631271eb93eaSdrh ;; 631371eb93eaSdrh 631471eb93eaSdrh linux) 6315636a995dSmlcreech func_arith $current - $age 6316636a995dSmlcreech major=.$func_arith_result 631771eb93eaSdrh versuffix="$major.$age.$revision" 631871eb93eaSdrh ;; 631971eb93eaSdrh 632071eb93eaSdrh osf) 6321636a995dSmlcreech func_arith $current - $age 6322636a995dSmlcreech major=.$func_arith_result 632371eb93eaSdrh versuffix=".$current.$age.$revision" 632471eb93eaSdrh verstring="$current.$age.$revision" 632571eb93eaSdrh 632671eb93eaSdrh # Add in all the interfaces that we are compatible with. 632771eb93eaSdrh loop=$age 6328964dbb1eSa.rottmann while test "$loop" -ne 0; do 6329636a995dSmlcreech func_arith $current - $loop 6330636a995dSmlcreech iface=$func_arith_result 6331636a995dSmlcreech func_arith $loop - 1 6332636a995dSmlcreech loop=$func_arith_result 633371eb93eaSdrh verstring="$verstring:${iface}.0" 633471eb93eaSdrh done 633571eb93eaSdrh 633671eb93eaSdrh # Make executables depend on our current version. 633771eb93eaSdrh verstring="$verstring:${current}.0" 633871eb93eaSdrh ;; 633971eb93eaSdrh 6340636a995dSmlcreech qnx) 6341636a995dSmlcreech major=".$current" 6342636a995dSmlcreech versuffix=".$current" 6343636a995dSmlcreech ;; 6344636a995dSmlcreech 634571eb93eaSdrh sunos) 634671eb93eaSdrh major=".$current" 634771eb93eaSdrh versuffix=".$current.$revision" 634871eb93eaSdrh ;; 634971eb93eaSdrh 635071eb93eaSdrh windows) 635171eb93eaSdrh # Use '-' rather than '.', since we only want one 635271eb93eaSdrh # extension on DOS 8.3 filesystems. 6353636a995dSmlcreech func_arith $current - $age 6354636a995dSmlcreech major=$func_arith_result 635571eb93eaSdrh versuffix="-$major" 635671eb93eaSdrh ;; 635771eb93eaSdrh 635871eb93eaSdrh *) 6359636a995dSmlcreech func_fatal_configuration "unknown library version type \`$version_type'" 636071eb93eaSdrh ;; 636171eb93eaSdrh esac 636271eb93eaSdrh 636371eb93eaSdrh # Clear the version info if we defaulted, and they specified a release. 636471eb93eaSdrh if test -z "$vinfo" && test -n "$release"; then 636571eb93eaSdrh major= 636662507b65Sa.rottmann case $version_type in 636762507b65Sa.rottmann darwin) 636862507b65Sa.rottmann # we can't check for "0.0" in archive_cmds due to quoting 636962507b65Sa.rottmann # problems, so we reset it completely 6370964dbb1eSa.rottmann verstring= 637162507b65Sa.rottmann ;; 637262507b65Sa.rottmann *) 637362507b65Sa.rottmann verstring="0.0" 637462507b65Sa.rottmann ;; 637562507b65Sa.rottmann esac 637671eb93eaSdrh if test "$need_version" = no; then 637771eb93eaSdrh versuffix= 637871eb93eaSdrh else 637971eb93eaSdrh versuffix=".0.0" 638071eb93eaSdrh fi 638171eb93eaSdrh fi 638271eb93eaSdrh 638371eb93eaSdrh # Remove version info from name if versioning should be avoided 638471eb93eaSdrh if test "$avoid_version" = yes && test "$need_version" = no; then 638571eb93eaSdrh major= 638671eb93eaSdrh versuffix= 638771eb93eaSdrh verstring="" 638871eb93eaSdrh fi 638971eb93eaSdrh 639071eb93eaSdrh # Check to see if the archive will have undefined symbols. 639171eb93eaSdrh if test "$allow_undefined" = yes; then 639271eb93eaSdrh if test "$allow_undefined_flag" = unsupported; then 6393636a995dSmlcreech func_warning "undefined symbols not allowed in $host shared libraries" 639471eb93eaSdrh build_libtool_libs=no 639571eb93eaSdrh build_old_libs=yes 639671eb93eaSdrh fi 639771eb93eaSdrh else 639871eb93eaSdrh # Don't allow undefined symbols. 639971eb93eaSdrh allow_undefined_flag="$no_undefined_flag" 640071eb93eaSdrh fi 6401636a995dSmlcreech 640271eb93eaSdrh fi 640371eb93eaSdrh 6404636a995dSmlcreech func_generate_dlsyms "$libname" "$libname" "yes" 6405636a995dSmlcreech libobjs="$libobjs $symfileobj" 6406636a995dSmlcreech test "X$libobjs" = "X " && libobjs= 6407636a995dSmlcreech 640871eb93eaSdrh if test "$mode" != relink; then 6409964dbb1eSa.rottmann # Remove our outputs, but don't remove object files since they 6410964dbb1eSa.rottmann # may have been created when compiling PIC objects. 6411964dbb1eSa.rottmann removelist= 6412636a995dSmlcreech tempremovelist=`$ECHO "$output_objdir/*"` 6413964dbb1eSa.rottmann for p in $tempremovelist; do 6414964dbb1eSa.rottmann case $p in 6415*6acb2cf6Svapier *.$objext | *.gcno) 6416964dbb1eSa.rottmann ;; 6417964dbb1eSa.rottmann $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 64187f19c02fSvapier if test "X$precious_files_regex" != "X"; then 6419636a995dSmlcreech if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 6420964dbb1eSa.rottmann then 6421964dbb1eSa.rottmann continue 6422964dbb1eSa.rottmann fi 64237f19c02fSvapier fi 6424964dbb1eSa.rottmann removelist="$removelist $p" 6425964dbb1eSa.rottmann ;; 6426964dbb1eSa.rottmann *) ;; 6427964dbb1eSa.rottmann esac 6428964dbb1eSa.rottmann done 6429636a995dSmlcreech test -n "$removelist" && \ 6430636a995dSmlcreech func_show_eval "${RM}r \$removelist" 643171eb93eaSdrh fi 643271eb93eaSdrh 643371eb93eaSdrh # Now set the variables for building old libraries. 643471eb93eaSdrh if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 643571eb93eaSdrh oldlibs="$oldlibs $output_objdir/$libname.$libext" 643671eb93eaSdrh 643771eb93eaSdrh # Transform .lo files to .o files. 6438636a995dSmlcreech oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 643971eb93eaSdrh fi 644071eb93eaSdrh 644171eb93eaSdrh # Eliminate all temporary directories. 6442636a995dSmlcreech #for path in $notinst_path; do 6443636a995dSmlcreech # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` 6444636a995dSmlcreech # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` 6445636a995dSmlcreech # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` 6446636a995dSmlcreech #done 644771eb93eaSdrh 644871eb93eaSdrh if test -n "$xrpath"; then 644971eb93eaSdrh # If the user specified any rpath flags, then add them. 645071eb93eaSdrh temp_xrpath= 645171eb93eaSdrh for libdir in $xrpath; do 645271eb93eaSdrh temp_xrpath="$temp_xrpath -R$libdir" 645371eb93eaSdrh case "$finalize_rpath " in 645471eb93eaSdrh *" $libdir "*) ;; 645571eb93eaSdrh *) finalize_rpath="$finalize_rpath $libdir" ;; 645671eb93eaSdrh esac 645771eb93eaSdrh done 6458964dbb1eSa.rottmann if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 645971eb93eaSdrh dependency_libs="$temp_xrpath $dependency_libs" 646071eb93eaSdrh fi 646171eb93eaSdrh fi 646271eb93eaSdrh 646371eb93eaSdrh # Make sure dlfiles contains only unique files that won't be dlpreopened 646471eb93eaSdrh old_dlfiles="$dlfiles" 646571eb93eaSdrh dlfiles= 646671eb93eaSdrh for lib in $old_dlfiles; do 646771eb93eaSdrh case " $dlprefiles $dlfiles " in 646871eb93eaSdrh *" $lib "*) ;; 646971eb93eaSdrh *) dlfiles="$dlfiles $lib" ;; 647071eb93eaSdrh esac 647171eb93eaSdrh done 647271eb93eaSdrh 647371eb93eaSdrh # Make sure dlprefiles contains only unique files 647471eb93eaSdrh old_dlprefiles="$dlprefiles" 647571eb93eaSdrh dlprefiles= 647671eb93eaSdrh for lib in $old_dlprefiles; do 647771eb93eaSdrh case "$dlprefiles " in 647871eb93eaSdrh *" $lib "*) ;; 647971eb93eaSdrh *) dlprefiles="$dlprefiles $lib" ;; 648071eb93eaSdrh esac 648171eb93eaSdrh done 648271eb93eaSdrh 648371eb93eaSdrh if test "$build_libtool_libs" = yes; then 648471eb93eaSdrh if test -n "$rpath"; then 648571eb93eaSdrh case $host in 6486*6acb2cf6Svapier *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) 648771eb93eaSdrh # these systems don't actually have a c library (as such)! 648871eb93eaSdrh ;; 648971eb93eaSdrh *-*-rhapsody* | *-*-darwin1.[012]) 649071eb93eaSdrh # Rhapsody C library is in the System framework 6491636a995dSmlcreech deplibs="$deplibs System.ltframework" 649271eb93eaSdrh ;; 649371eb93eaSdrh *-*-netbsd*) 649471eb93eaSdrh # Don't link with libc until the a.out ld.so is fixed. 649571eb93eaSdrh ;; 64967f19c02fSvapier *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 649762507b65Sa.rottmann # Do not include libc due to us having libc/libc_r. 64987f19c02fSvapier ;; 64997f19c02fSvapier *-*-sco3.2v5* | *-*-sco5v6*) 65007f19c02fSvapier # Causes problems with __ctype 65017f19c02fSvapier ;; 65027f19c02fSvapier *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 65037f19c02fSvapier # Compiler inserts libc in the correct place for threads to work 650471eb93eaSdrh ;; 650571eb93eaSdrh *) 650671eb93eaSdrh # Add libc to deplibs on all other systems if necessary. 6507964dbb1eSa.rottmann if test "$build_libtool_need_lc" = "yes"; then 650871eb93eaSdrh deplibs="$deplibs -lc" 650971eb93eaSdrh fi 651071eb93eaSdrh ;; 651171eb93eaSdrh esac 651271eb93eaSdrh fi 651371eb93eaSdrh 651471eb93eaSdrh # Transform deplibs into only deplibs that can be linked in shared. 651571eb93eaSdrh name_save=$name 651671eb93eaSdrh libname_save=$libname 651771eb93eaSdrh release_save=$release 651871eb93eaSdrh versuffix_save=$versuffix 651971eb93eaSdrh major_save=$major 652071eb93eaSdrh # I'm not sure if I'm treating the release correctly. I think 652171eb93eaSdrh # release should show up in the -l (ie -lgmp5) so we don't want to 652271eb93eaSdrh # add it in twice. Is that correct? 652371eb93eaSdrh release="" 652471eb93eaSdrh versuffix="" 652571eb93eaSdrh major="" 652671eb93eaSdrh newdeplibs= 652771eb93eaSdrh droppeddeps=no 652871eb93eaSdrh case $deplibs_check_method in 652971eb93eaSdrh pass_all) 653071eb93eaSdrh # Don't check for shared/static. Everything works. 653171eb93eaSdrh # This might be a little naive. We might want to check 653271eb93eaSdrh # whether the library exists or not. But this is on 653371eb93eaSdrh # osf3 & osf4 and I'm not really sure... Just 6534964dbb1eSa.rottmann # implementing what was already the behavior. 653571eb93eaSdrh newdeplibs=$deplibs 653671eb93eaSdrh ;; 653771eb93eaSdrh test_compile) 653871eb93eaSdrh # This code stresses the "libraries are programs" paradigm to its 653971eb93eaSdrh # limits. Maybe even breaks it. We compile a program, linking it 654071eb93eaSdrh # against the deplibs as a proxy for the library. Then we can check 654171eb93eaSdrh # whether they linked in statically or dynamically with ldd. 6542636a995dSmlcreech $opt_dry_run || $RM conftest.c 654371eb93eaSdrh cat > conftest.c <<EOF 654471eb93eaSdrh int main() { return 0; } 654571eb93eaSdrhEOF 6546636a995dSmlcreech $opt_dry_run || $RM conftest 6547636a995dSmlcreech if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 654871eb93eaSdrh ldd_output=`ldd conftest` 654971eb93eaSdrh for i in $deplibs; do 6550636a995dSmlcreech case $i in 6551636a995dSmlcreech -l*) 6552636a995dSmlcreech func_stripname -l '' "$i" 6553636a995dSmlcreech name=$func_stripname_result 6554964dbb1eSa.rottmann if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6555964dbb1eSa.rottmann case " $predeps $postdeps " in 6556964dbb1eSa.rottmann *" $i "*) 6557964dbb1eSa.rottmann newdeplibs="$newdeplibs $i" 6558964dbb1eSa.rottmann i="" 6559964dbb1eSa.rottmann ;; 6560964dbb1eSa.rottmann esac 6561964dbb1eSa.rottmann fi 6562964dbb1eSa.rottmann if test -n "$i" ; then 6563636a995dSmlcreech libname=`eval "\\$ECHO \"$libname_spec\""` 6564636a995dSmlcreech deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 6565636a995dSmlcreech set dummy $deplib_matches; shift 6566636a995dSmlcreech deplib_match=$1 656771eb93eaSdrh if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 656871eb93eaSdrh newdeplibs="$newdeplibs $i" 656971eb93eaSdrh else 657071eb93eaSdrh droppeddeps=yes 6571636a995dSmlcreech $ECHO 6572636a995dSmlcreech $ECHO "*** Warning: dynamic linker does not accept needed library $i." 6573636a995dSmlcreech $ECHO "*** I have the capability to make that library automatically link in when" 6574636a995dSmlcreech $ECHO "*** you link to this library. But I can only do this if you have a" 6575636a995dSmlcreech $ECHO "*** shared version of the library, which I believe you do not have" 6576636a995dSmlcreech $ECHO "*** because a test_compile did reveal that the linker did not use it for" 6577636a995dSmlcreech $ECHO "*** its dynamic dependency list that programs get resolved with at runtime." 6578964dbb1eSa.rottmann fi 657971eb93eaSdrh fi 6580636a995dSmlcreech ;; 6581636a995dSmlcreech *) 658271eb93eaSdrh newdeplibs="$newdeplibs $i" 6583636a995dSmlcreech ;; 6584636a995dSmlcreech esac 658571eb93eaSdrh done 658671eb93eaSdrh else 6587964dbb1eSa.rottmann # Error occurred in the first compile. Let's try to salvage 658862507b65Sa.rottmann # the situation: Compile a separate program for each library. 658971eb93eaSdrh for i in $deplibs; do 6590636a995dSmlcreech case $i in 6591636a995dSmlcreech -l*) 6592636a995dSmlcreech func_stripname -l '' "$i" 6593636a995dSmlcreech name=$func_stripname_result 6594636a995dSmlcreech $opt_dry_run || $RM conftest 6595636a995dSmlcreech if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 659671eb93eaSdrh ldd_output=`ldd conftest` 6597964dbb1eSa.rottmann if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6598964dbb1eSa.rottmann case " $predeps $postdeps " in 6599964dbb1eSa.rottmann *" $i "*) 6600964dbb1eSa.rottmann newdeplibs="$newdeplibs $i" 6601964dbb1eSa.rottmann i="" 6602964dbb1eSa.rottmann ;; 6603964dbb1eSa.rottmann esac 6604964dbb1eSa.rottmann fi 6605964dbb1eSa.rottmann if test -n "$i" ; then 6606636a995dSmlcreech libname=`eval "\\$ECHO \"$libname_spec\""` 6607636a995dSmlcreech deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 6608636a995dSmlcreech set dummy $deplib_matches; shift 6609636a995dSmlcreech deplib_match=$1 661071eb93eaSdrh if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 661171eb93eaSdrh newdeplibs="$newdeplibs $i" 661271eb93eaSdrh else 661371eb93eaSdrh droppeddeps=yes 6614636a995dSmlcreech $ECHO 6615636a995dSmlcreech $ECHO "*** Warning: dynamic linker does not accept needed library $i." 6616636a995dSmlcreech $ECHO "*** I have the capability to make that library automatically link in when" 6617636a995dSmlcreech $ECHO "*** you link to this library. But I can only do this if you have a" 6618636a995dSmlcreech $ECHO "*** shared version of the library, which you do not appear to have" 6619636a995dSmlcreech $ECHO "*** because a test_compile did reveal that the linker did not use this one" 6620636a995dSmlcreech $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime." 6621964dbb1eSa.rottmann fi 662271eb93eaSdrh fi 662371eb93eaSdrh else 662471eb93eaSdrh droppeddeps=yes 6625636a995dSmlcreech $ECHO 6626636a995dSmlcreech $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 6627636a995dSmlcreech $ECHO "*** make it link in! You will probably need to install it or some" 6628636a995dSmlcreech $ECHO "*** library that it depends on before this library will be fully" 6629636a995dSmlcreech $ECHO "*** functional. Installing it before continuing would be even better." 663071eb93eaSdrh fi 6631636a995dSmlcreech ;; 6632636a995dSmlcreech *) 663371eb93eaSdrh newdeplibs="$newdeplibs $i" 6634636a995dSmlcreech ;; 6635636a995dSmlcreech esac 663671eb93eaSdrh done 663771eb93eaSdrh fi 663871eb93eaSdrh ;; 663971eb93eaSdrh file_magic*) 6640636a995dSmlcreech set dummy $deplibs_check_method; shift 6641636a995dSmlcreech file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 664271eb93eaSdrh for a_deplib in $deplibs; do 6643636a995dSmlcreech case $a_deplib in 6644636a995dSmlcreech -l*) 6645636a995dSmlcreech func_stripname -l '' "$a_deplib" 6646636a995dSmlcreech name=$func_stripname_result 6647964dbb1eSa.rottmann if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6648964dbb1eSa.rottmann case " $predeps $postdeps " in 6649964dbb1eSa.rottmann *" $a_deplib "*) 6650964dbb1eSa.rottmann newdeplibs="$newdeplibs $a_deplib" 6651964dbb1eSa.rottmann a_deplib="" 6652964dbb1eSa.rottmann ;; 6653964dbb1eSa.rottmann esac 6654964dbb1eSa.rottmann fi 6655964dbb1eSa.rottmann if test -n "$a_deplib" ; then 6656636a995dSmlcreech libname=`eval "\\$ECHO \"$libname_spec\""` 665771eb93eaSdrh for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 665871eb93eaSdrh potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 665971eb93eaSdrh for potent_lib in $potential_libs; do 666071eb93eaSdrh # Follow soft links. 6661636a995dSmlcreech if ls -lLd "$potent_lib" 2>/dev/null | 6662636a995dSmlcreech $GREP " -> " >/dev/null; then 666371eb93eaSdrh continue 666471eb93eaSdrh fi 666571eb93eaSdrh # The statement above tries to avoid entering an 666671eb93eaSdrh # endless loop below, in case of cyclic links. 666771eb93eaSdrh # We might still enter an endless loop, since a link 666871eb93eaSdrh # loop can be closed while we follow links, 666971eb93eaSdrh # but so what? 667071eb93eaSdrh potlib="$potent_lib" 667171eb93eaSdrh while test -h "$potlib" 2>/dev/null; do 667262507b65Sa.rottmann potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 667371eb93eaSdrh case $potliblink in 667471eb93eaSdrh [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 6675636a995dSmlcreech *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 667671eb93eaSdrh esac 667771eb93eaSdrh done 6678636a995dSmlcreech if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 6679636a995dSmlcreech $SED -e 10q | 6680636a995dSmlcreech $EGREP "$file_magic_regex" > /dev/null; then 668171eb93eaSdrh newdeplibs="$newdeplibs $a_deplib" 668271eb93eaSdrh a_deplib="" 668371eb93eaSdrh break 2 668471eb93eaSdrh fi 668571eb93eaSdrh done 668671eb93eaSdrh done 6687964dbb1eSa.rottmann fi 668871eb93eaSdrh if test -n "$a_deplib" ; then 668971eb93eaSdrh droppeddeps=yes 6690636a995dSmlcreech $ECHO 6691636a995dSmlcreech $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 6692636a995dSmlcreech $ECHO "*** I have the capability to make that library automatically link in when" 6693636a995dSmlcreech $ECHO "*** you link to this library. But I can only do this if you have a" 6694636a995dSmlcreech $ECHO "*** shared version of the library, which you do not appear to have" 6695636a995dSmlcreech $ECHO "*** because I did check the linker path looking for a file starting" 669662507b65Sa.rottmann if test -z "$potlib" ; then 6697636a995dSmlcreech $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 669862507b65Sa.rottmann else 6699636a995dSmlcreech $ECHO "*** with $libname and none of the candidates passed a file format test" 6700636a995dSmlcreech $ECHO "*** using a file magic. Last file checked: $potlib" 670162507b65Sa.rottmann fi 670271eb93eaSdrh fi 6703636a995dSmlcreech ;; 6704636a995dSmlcreech *) 670571eb93eaSdrh # Add a -L argument. 670671eb93eaSdrh newdeplibs="$newdeplibs $a_deplib" 6707636a995dSmlcreech ;; 6708636a995dSmlcreech esac 670971eb93eaSdrh done # Gone through all deplibs. 671071eb93eaSdrh ;; 671171eb93eaSdrh match_pattern*) 6712636a995dSmlcreech set dummy $deplibs_check_method; shift 6713636a995dSmlcreech match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 671471eb93eaSdrh for a_deplib in $deplibs; do 6715636a995dSmlcreech case $a_deplib in 6716636a995dSmlcreech -l*) 6717636a995dSmlcreech func_stripname -l '' "$a_deplib" 6718636a995dSmlcreech name=$func_stripname_result 6719964dbb1eSa.rottmann if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6720964dbb1eSa.rottmann case " $predeps $postdeps " in 6721964dbb1eSa.rottmann *" $a_deplib "*) 6722964dbb1eSa.rottmann newdeplibs="$newdeplibs $a_deplib" 6723964dbb1eSa.rottmann a_deplib="" 6724964dbb1eSa.rottmann ;; 6725964dbb1eSa.rottmann esac 6726964dbb1eSa.rottmann fi 6727964dbb1eSa.rottmann if test -n "$a_deplib" ; then 6728636a995dSmlcreech libname=`eval "\\$ECHO \"$libname_spec\""` 672971eb93eaSdrh for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 673071eb93eaSdrh potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 673171eb93eaSdrh for potent_lib in $potential_libs; do 6732964dbb1eSa.rottmann potlib="$potent_lib" # see symlink-check above in file_magic test 6733636a995dSmlcreech if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ 6734636a995dSmlcreech $EGREP "$match_pattern_regex" > /dev/null; then 673571eb93eaSdrh newdeplibs="$newdeplibs $a_deplib" 673671eb93eaSdrh a_deplib="" 673771eb93eaSdrh break 2 673871eb93eaSdrh fi 673971eb93eaSdrh done 674071eb93eaSdrh done 6741964dbb1eSa.rottmann fi 674271eb93eaSdrh if test -n "$a_deplib" ; then 674371eb93eaSdrh droppeddeps=yes 6744636a995dSmlcreech $ECHO 6745636a995dSmlcreech $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 6746636a995dSmlcreech $ECHO "*** I have the capability to make that library automatically link in when" 6747636a995dSmlcreech $ECHO "*** you link to this library. But I can only do this if you have a" 6748636a995dSmlcreech $ECHO "*** shared version of the library, which you do not appear to have" 6749636a995dSmlcreech $ECHO "*** because I did check the linker path looking for a file starting" 675062507b65Sa.rottmann if test -z "$potlib" ; then 6751636a995dSmlcreech $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 675262507b65Sa.rottmann else 6753636a995dSmlcreech $ECHO "*** with $libname and none of the candidates passed a file format test" 6754636a995dSmlcreech $ECHO "*** using a regex pattern. Last file checked: $potlib" 675562507b65Sa.rottmann fi 675671eb93eaSdrh fi 6757636a995dSmlcreech ;; 6758636a995dSmlcreech *) 675971eb93eaSdrh # Add a -L argument. 676071eb93eaSdrh newdeplibs="$newdeplibs $a_deplib" 6761636a995dSmlcreech ;; 6762636a995dSmlcreech esac 676371eb93eaSdrh done # Gone through all deplibs. 676471eb93eaSdrh ;; 676571eb93eaSdrh none | unknown | *) 676671eb93eaSdrh newdeplibs="" 6767636a995dSmlcreech tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ 6768636a995dSmlcreech -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` 6769964dbb1eSa.rottmann if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6770964dbb1eSa.rottmann for i in $predeps $postdeps ; do 6771964dbb1eSa.rottmann # can't use Xsed below, because $i might contain '/' 6772636a995dSmlcreech tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` 6773964dbb1eSa.rottmann done 677471eb93eaSdrh fi 6775636a995dSmlcreech if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | 6776636a995dSmlcreech $GREP . >/dev/null; then 6777636a995dSmlcreech $ECHO 6778964dbb1eSa.rottmann if test "X$deplibs_check_method" = "Xnone"; then 6779636a995dSmlcreech $ECHO "*** Warning: inter-library dependencies are not supported in this platform." 6780964dbb1eSa.rottmann else 6781636a995dSmlcreech $ECHO "*** Warning: inter-library dependencies are not known to be supported." 6782964dbb1eSa.rottmann fi 6783636a995dSmlcreech $ECHO "*** All declared inter-library dependencies are being dropped." 678471eb93eaSdrh droppeddeps=yes 678571eb93eaSdrh fi 678671eb93eaSdrh ;; 678771eb93eaSdrh esac 678871eb93eaSdrh versuffix=$versuffix_save 678971eb93eaSdrh major=$major_save 679071eb93eaSdrh release=$release_save 679171eb93eaSdrh libname=$libname_save 679271eb93eaSdrh name=$name_save 679371eb93eaSdrh 679471eb93eaSdrh case $host in 679571eb93eaSdrh *-*-rhapsody* | *-*-darwin1.[012]) 6796636a995dSmlcreech # On Rhapsody replace the C library with the System framework 6797636a995dSmlcreech newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 679871eb93eaSdrh ;; 679971eb93eaSdrh esac 680071eb93eaSdrh 680171eb93eaSdrh if test "$droppeddeps" = yes; then 680271eb93eaSdrh if test "$module" = yes; then 6803636a995dSmlcreech $ECHO 6804636a995dSmlcreech $ECHO "*** Warning: libtool could not satisfy all declared inter-library" 6805636a995dSmlcreech $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 6806636a995dSmlcreech $ECHO "*** a static module, that should work as long as the dlopening" 6807636a995dSmlcreech $ECHO "*** application is linked with the -dlopen flag." 680871eb93eaSdrh if test -z "$global_symbol_pipe"; then 6809636a995dSmlcreech $ECHO 6810636a995dSmlcreech $ECHO "*** However, this would only work if libtool was able to extract symbol" 6811636a995dSmlcreech $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" 6812636a995dSmlcreech $ECHO "*** not find such a program. So, this module is probably useless." 6813636a995dSmlcreech $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." 681471eb93eaSdrh fi 681571eb93eaSdrh if test "$build_old_libs" = no; then 681671eb93eaSdrh oldlibs="$output_objdir/$libname.$libext" 681771eb93eaSdrh build_libtool_libs=module 681871eb93eaSdrh build_old_libs=yes 681971eb93eaSdrh else 682071eb93eaSdrh build_libtool_libs=no 682171eb93eaSdrh fi 682271eb93eaSdrh else 6823636a995dSmlcreech $ECHO "*** The inter-library dependencies that have been dropped here will be" 6824636a995dSmlcreech $ECHO "*** automatically added whenever a program is linked with this library" 6825636a995dSmlcreech $ECHO "*** or is declared to -dlopen it." 682671eb93eaSdrh 6827964dbb1eSa.rottmann if test "$allow_undefined" = no; then 6828636a995dSmlcreech $ECHO 6829636a995dSmlcreech $ECHO "*** Since this library must not contain undefined symbols," 6830636a995dSmlcreech $ECHO "*** because either the platform does not support them or" 6831636a995dSmlcreech $ECHO "*** it was explicitly requested with -no-undefined," 6832636a995dSmlcreech $ECHO "*** libtool will only create a static version of it." 683371eb93eaSdrh if test "$build_old_libs" = no; then 683471eb93eaSdrh oldlibs="$output_objdir/$libname.$libext" 683571eb93eaSdrh build_libtool_libs=module 683671eb93eaSdrh build_old_libs=yes 683771eb93eaSdrh else 683871eb93eaSdrh build_libtool_libs=no 683971eb93eaSdrh fi 684071eb93eaSdrh fi 684171eb93eaSdrh fi 684271eb93eaSdrh fi 684371eb93eaSdrh # Done checking deplibs! 684471eb93eaSdrh deplibs=$newdeplibs 684571eb93eaSdrh fi 6846636a995dSmlcreech # Time to change all our "foo.ltframework" stuff back to "-framework foo" 6847636a995dSmlcreech case $host in 6848636a995dSmlcreech *-*-darwin*) 6849636a995dSmlcreech newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6850636a995dSmlcreech new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6851636a995dSmlcreech deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 6852636a995dSmlcreech ;; 6853636a995dSmlcreech esac 68547f19c02fSvapier 68557f19c02fSvapier # move library search paths that coincide with paths to not yet 68567f19c02fSvapier # installed libraries to the beginning of the library search list 68577f19c02fSvapier new_libs= 68587f19c02fSvapier for path in $notinst_path; do 68597f19c02fSvapier case " $new_libs " in 68607f19c02fSvapier *" -L$path/$objdir "*) ;; 68617f19c02fSvapier *) 68627f19c02fSvapier case " $deplibs " in 68637f19c02fSvapier *" -L$path/$objdir "*) 68647f19c02fSvapier new_libs="$new_libs -L$path/$objdir" ;; 68657f19c02fSvapier esac 68667f19c02fSvapier ;; 68677f19c02fSvapier esac 68687f19c02fSvapier done 68697f19c02fSvapier for deplib in $deplibs; do 68707f19c02fSvapier case $deplib in 68717f19c02fSvapier -L*) 68727f19c02fSvapier case " $new_libs " in 68737f19c02fSvapier *" $deplib "*) ;; 68747f19c02fSvapier *) new_libs="$new_libs $deplib" ;; 68757f19c02fSvapier esac 68767f19c02fSvapier ;; 68777f19c02fSvapier *) new_libs="$new_libs $deplib" ;; 68787f19c02fSvapier esac 68797f19c02fSvapier done 68807f19c02fSvapier deplibs="$new_libs" 68817f19c02fSvapier 688271eb93eaSdrh # All the library-specific variables (install_libdir is set above). 688371eb93eaSdrh library_names= 688471eb93eaSdrh old_library= 688571eb93eaSdrh dlname= 688671eb93eaSdrh 688771eb93eaSdrh # Test again, we may have decided not to build it any more 688871eb93eaSdrh if test "$build_libtool_libs" = yes; then 6889964dbb1eSa.rottmann if test "$hardcode_into_libs" = yes; then 689071eb93eaSdrh # Hardcode the library paths 689171eb93eaSdrh hardcode_libdirs= 689271eb93eaSdrh dep_rpath= 689371eb93eaSdrh rpath="$finalize_rpath" 689471eb93eaSdrh test "$mode" != relink && rpath="$compile_rpath$rpath" 689571eb93eaSdrh for libdir in $rpath; do 689671eb93eaSdrh if test -n "$hardcode_libdir_flag_spec"; then 689771eb93eaSdrh if test -n "$hardcode_libdir_separator"; then 689871eb93eaSdrh if test -z "$hardcode_libdirs"; then 689971eb93eaSdrh hardcode_libdirs="$libdir" 690071eb93eaSdrh else 690171eb93eaSdrh # Just accumulate the unique libdirs. 690271eb93eaSdrh case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 690371eb93eaSdrh *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 690471eb93eaSdrh ;; 690571eb93eaSdrh *) 690671eb93eaSdrh hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 690771eb93eaSdrh ;; 690871eb93eaSdrh esac 690971eb93eaSdrh fi 691071eb93eaSdrh else 691171eb93eaSdrh eval flag=\"$hardcode_libdir_flag_spec\" 691271eb93eaSdrh dep_rpath="$dep_rpath $flag" 691371eb93eaSdrh fi 691471eb93eaSdrh elif test -n "$runpath_var"; then 691571eb93eaSdrh case "$perm_rpath " in 691671eb93eaSdrh *" $libdir "*) ;; 691771eb93eaSdrh *) perm_rpath="$perm_rpath $libdir" ;; 691871eb93eaSdrh esac 691971eb93eaSdrh fi 692071eb93eaSdrh done 692171eb93eaSdrh # Substitute the hardcoded libdirs into the rpath. 692271eb93eaSdrh if test -n "$hardcode_libdir_separator" && 692371eb93eaSdrh test -n "$hardcode_libdirs"; then 692471eb93eaSdrh libdir="$hardcode_libdirs" 6925964dbb1eSa.rottmann if test -n "$hardcode_libdir_flag_spec_ld"; then 6926964dbb1eSa.rottmann eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 6927964dbb1eSa.rottmann else 692871eb93eaSdrh eval dep_rpath=\"$hardcode_libdir_flag_spec\" 692971eb93eaSdrh fi 6930964dbb1eSa.rottmann fi 693171eb93eaSdrh if test -n "$runpath_var" && test -n "$perm_rpath"; then 693271eb93eaSdrh # We should set the runpath_var. 693371eb93eaSdrh rpath= 693471eb93eaSdrh for dir in $perm_rpath; do 693571eb93eaSdrh rpath="$rpath$dir:" 693671eb93eaSdrh done 693771eb93eaSdrh eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 693871eb93eaSdrh fi 693971eb93eaSdrh test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 694071eb93eaSdrh fi 694171eb93eaSdrh 694271eb93eaSdrh shlibpath="$finalize_shlibpath" 694371eb93eaSdrh test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 694471eb93eaSdrh if test -n "$shlibpath"; then 694571eb93eaSdrh eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 694671eb93eaSdrh fi 694771eb93eaSdrh 694871eb93eaSdrh # Get the real and link names of the library. 69497f19c02fSvapier eval shared_ext=\"$shrext_cmds\" 695071eb93eaSdrh eval library_names=\"$library_names_spec\" 695171eb93eaSdrh set dummy $library_names 6952636a995dSmlcreech shift 6953636a995dSmlcreech realname="$1" 6954636a995dSmlcreech shift 695571eb93eaSdrh 695671eb93eaSdrh if test -n "$soname_spec"; then 695771eb93eaSdrh eval soname=\"$soname_spec\" 695871eb93eaSdrh else 695971eb93eaSdrh soname="$realname" 696071eb93eaSdrh fi 6961964dbb1eSa.rottmann if test -z "$dlname"; then 6962964dbb1eSa.rottmann dlname=$soname 6963964dbb1eSa.rottmann fi 696471eb93eaSdrh 696571eb93eaSdrh lib="$output_objdir/$realname" 69667f19c02fSvapier linknames= 696771eb93eaSdrh for link 696871eb93eaSdrh do 696971eb93eaSdrh linknames="$linknames $link" 697071eb93eaSdrh done 697171eb93eaSdrh 697271eb93eaSdrh # Use standard objects if they are pic 6973636a995dSmlcreech test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 6974636a995dSmlcreech test "X$libobjs" = "X " && libobjs= 6975636a995dSmlcreech 6976636a995dSmlcreech delfiles= 6977636a995dSmlcreech if test -n "$export_symbols" && test -n "$include_expsyms"; then 6978636a995dSmlcreech $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 6979636a995dSmlcreech export_symbols="$output_objdir/$libname.uexp" 6980636a995dSmlcreech delfiles="$delfiles $export_symbols" 6981636a995dSmlcreech fi 6982636a995dSmlcreech 6983636a995dSmlcreech orig_export_symbols= 6984636a995dSmlcreech case $host_os in 6985*6acb2cf6Svapier cygwin* | mingw* | cegcc*) 6986636a995dSmlcreech if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 6987636a995dSmlcreech # exporting using user supplied symfile 6988636a995dSmlcreech if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 6989636a995dSmlcreech # and it's NOT already a .def file. Must figure out 6990636a995dSmlcreech # which of the given symbols are data symbols and tag 6991636a995dSmlcreech # them as such. So, trigger use of export_symbols_cmds. 6992636a995dSmlcreech # export_symbols gets reassigned inside the "prepare 6993636a995dSmlcreech # the list of exported symbols" if statement, so the 6994636a995dSmlcreech # include_expsyms logic still works. 6995636a995dSmlcreech orig_export_symbols="$export_symbols" 6996636a995dSmlcreech export_symbols= 6997636a995dSmlcreech always_export_symbols=yes 6998636a995dSmlcreech fi 6999636a995dSmlcreech fi 7000636a995dSmlcreech ;; 7001636a995dSmlcreech esac 700271eb93eaSdrh 700371eb93eaSdrh # Prepare the list of exported symbols 700471eb93eaSdrh if test -z "$export_symbols"; then 700571eb93eaSdrh if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 7006636a995dSmlcreech func_verbose "generating symbol list for \`$libname.la'" 700771eb93eaSdrh export_symbols="$output_objdir/$libname.exp" 7008636a995dSmlcreech $opt_dry_run || $RM $export_symbols 7009964dbb1eSa.rottmann cmds=$export_symbols_cmds 701062507b65Sa.rottmann save_ifs="$IFS"; IFS='~' 701171eb93eaSdrh for cmd in $cmds; do 701271eb93eaSdrh IFS="$save_ifs" 7013964dbb1eSa.rottmann eval cmd=\"$cmd\" 7014636a995dSmlcreech func_len " $cmd" 7015636a995dSmlcreech len=$func_len_result 7016636a995dSmlcreech if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 7017636a995dSmlcreech func_show_eval "$cmd" 'exit $?' 7018964dbb1eSa.rottmann skipped_export=false 7019964dbb1eSa.rottmann else 7020964dbb1eSa.rottmann # The command line is too long to execute in one step. 7021636a995dSmlcreech func_verbose "using reloadable object file for export list..." 7022964dbb1eSa.rottmann skipped_export=: 70237f19c02fSvapier # Break out early, otherwise skipped_export may be 70247f19c02fSvapier # set to false by a later but shorter cmd. 70257f19c02fSvapier break 7026964dbb1eSa.rottmann fi 702771eb93eaSdrh done 702871eb93eaSdrh IFS="$save_ifs" 7029636a995dSmlcreech if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 7030636a995dSmlcreech func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 7031636a995dSmlcreech func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 703271eb93eaSdrh fi 703371eb93eaSdrh fi 703471eb93eaSdrh fi 703571eb93eaSdrh 703671eb93eaSdrh if test -n "$export_symbols" && test -n "$include_expsyms"; then 7037636a995dSmlcreech tmp_export_symbols="$export_symbols" 7038636a995dSmlcreech test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 7039636a995dSmlcreech $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 7040636a995dSmlcreech fi 7041636a995dSmlcreech 7042636a995dSmlcreech if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 7043636a995dSmlcreech # The given exports_symbols file has to be filtered, so filter it. 7044636a995dSmlcreech func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 7045636a995dSmlcreech # FIXME: $output_objdir/$libname.filter potentially contains lots of 7046636a995dSmlcreech # 's' commands which not all seds can handle. GNU sed should be fine 7047636a995dSmlcreech # though. Also, the filter scales superlinearly with the number of 7048636a995dSmlcreech # global variables. join(1) would be nice here, but unfortunately 7049636a995dSmlcreech # isn't a blessed tool. 7050636a995dSmlcreech $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 7051636a995dSmlcreech delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 7052636a995dSmlcreech export_symbols=$output_objdir/$libname.def 7053636a995dSmlcreech $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 705471eb93eaSdrh fi 705571eb93eaSdrh 7056964dbb1eSa.rottmann tmp_deplibs= 7057964dbb1eSa.rottmann for test_deplib in $deplibs; do 7058964dbb1eSa.rottmann case " $convenience " in 7059964dbb1eSa.rottmann *" $test_deplib "*) ;; 7060964dbb1eSa.rottmann *) 7061964dbb1eSa.rottmann tmp_deplibs="$tmp_deplibs $test_deplib" 7062964dbb1eSa.rottmann ;; 7063964dbb1eSa.rottmann esac 7064964dbb1eSa.rottmann done 7065964dbb1eSa.rottmann deplibs="$tmp_deplibs" 7066964dbb1eSa.rottmann 706771eb93eaSdrh if test -n "$convenience"; then 7068636a995dSmlcreech if test -n "$whole_archive_flag_spec" && 7069636a995dSmlcreech test "$compiler_needs_object" = yes && 7070636a995dSmlcreech test -z "$libobjs"; then 7071636a995dSmlcreech # extract the archives, so we have objects to list. 7072636a995dSmlcreech # TODO: could optimize this to just extract one archive. 7073636a995dSmlcreech whole_archive_flag_spec= 7074636a995dSmlcreech fi 707571eb93eaSdrh if test -n "$whole_archive_flag_spec"; then 7076964dbb1eSa.rottmann save_libobjs=$libobjs 707771eb93eaSdrh eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 7078636a995dSmlcreech test "X$libobjs" = "X " && libobjs= 707971eb93eaSdrh else 708071eb93eaSdrh gentop="$output_objdir/${outputname}x" 708171eb93eaSdrh generated="$generated $gentop" 708271eb93eaSdrh 70837f19c02fSvapier func_extract_archives $gentop $convenience 70847f19c02fSvapier libobjs="$libobjs $func_extract_archives_result" 7085636a995dSmlcreech test "X$libobjs" = "X " && libobjs= 708671eb93eaSdrh fi 708771eb93eaSdrh fi 708871eb93eaSdrh 708971eb93eaSdrh if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 709071eb93eaSdrh eval flag=\"$thread_safe_flag_spec\" 709171eb93eaSdrh linker_flags="$linker_flags $flag" 709271eb93eaSdrh fi 709371eb93eaSdrh 709471eb93eaSdrh # Make a backup of the uninstalled library when relinking 709571eb93eaSdrh if test "$mode" = relink; then 7096636a995dSmlcreech $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 709771eb93eaSdrh fi 709871eb93eaSdrh 709971eb93eaSdrh # Do each of the archive commands. 7100964dbb1eSa.rottmann if test "$module" = yes && test -n "$module_cmds" ; then 7101964dbb1eSa.rottmann if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 7102964dbb1eSa.rottmann eval test_cmds=\"$module_expsym_cmds\" 7103964dbb1eSa.rottmann cmds=$module_expsym_cmds 710471eb93eaSdrh else 7105964dbb1eSa.rottmann eval test_cmds=\"$module_cmds\" 7106964dbb1eSa.rottmann cmds=$module_cmds 7107964dbb1eSa.rottmann fi 7108964dbb1eSa.rottmann else 7109964dbb1eSa.rottmann if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 7110964dbb1eSa.rottmann eval test_cmds=\"$archive_expsym_cmds\" 7111964dbb1eSa.rottmann cmds=$archive_expsym_cmds 7112964dbb1eSa.rottmann else 7113964dbb1eSa.rottmann eval test_cmds=\"$archive_cmds\" 7114964dbb1eSa.rottmann cmds=$archive_cmds 7115964dbb1eSa.rottmann fi 7116964dbb1eSa.rottmann fi 7117964dbb1eSa.rottmann 71187f19c02fSvapier if test "X$skipped_export" != "X:" && 7119636a995dSmlcreech func_len " $test_cmds" && 7120636a995dSmlcreech len=$func_len_result && 7121636a995dSmlcreech test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 7122964dbb1eSa.rottmann : 7123964dbb1eSa.rottmann else 7124636a995dSmlcreech # The command line is too long to link in one step, link piecewise 7125636a995dSmlcreech # or, if using GNU ld and skipped_export is not :, use a linker 7126636a995dSmlcreech # script. 7127964dbb1eSa.rottmann 7128964dbb1eSa.rottmann # Save the value of $output and $libobjs because we want to 7129964dbb1eSa.rottmann # use them later. If we have whole_archive_flag_spec, we 7130964dbb1eSa.rottmann # want to use save_libobjs as it was before 7131964dbb1eSa.rottmann # whole_archive_flag_spec was expanded, because we can't 7132964dbb1eSa.rottmann # assume the linker understands whole_archive_flag_spec. 7133964dbb1eSa.rottmann # This may have to be revisited, in case too many 7134964dbb1eSa.rottmann # convenience libraries get linked in and end up exceeding 7135964dbb1eSa.rottmann # the spec. 7136964dbb1eSa.rottmann if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 7137964dbb1eSa.rottmann save_libobjs=$libobjs 7138964dbb1eSa.rottmann fi 7139964dbb1eSa.rottmann save_output=$output 7140636a995dSmlcreech output_la=`$ECHO "X$output" | $Xsed -e "$basename"` 7141964dbb1eSa.rottmann 7142964dbb1eSa.rottmann # Clear the reloadable object creation command queue and 7143964dbb1eSa.rottmann # initialize k to one. 7144964dbb1eSa.rottmann test_cmds= 7145964dbb1eSa.rottmann concat_cmds= 7146964dbb1eSa.rottmann objlist= 7147964dbb1eSa.rottmann last_robj= 7148964dbb1eSa.rottmann k=1 7149636a995dSmlcreech 7150636a995dSmlcreech if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 7151636a995dSmlcreech output=${output_objdir}/${output_la}.lnkscript 7152636a995dSmlcreech func_verbose "creating GNU ld script: $output" 7153636a995dSmlcreech $ECHO 'INPUT (' > $output 7154636a995dSmlcreech for obj in $save_libobjs 7155636a995dSmlcreech do 7156636a995dSmlcreech $ECHO "$obj" >> $output 7157636a995dSmlcreech done 7158636a995dSmlcreech $ECHO ')' >> $output 7159636a995dSmlcreech delfiles="$delfiles $output" 7160636a995dSmlcreech elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 7161636a995dSmlcreech output=${output_objdir}/${output_la}.lnk 7162636a995dSmlcreech func_verbose "creating linker input file list: $output" 7163636a995dSmlcreech : > $output 7164636a995dSmlcreech set x $save_libobjs 7165636a995dSmlcreech shift 7166636a995dSmlcreech firstobj= 7167636a995dSmlcreech if test "$compiler_needs_object" = yes; then 7168636a995dSmlcreech firstobj="$1 " 7169636a995dSmlcreech shift 7170636a995dSmlcreech fi 7171636a995dSmlcreech for obj 7172636a995dSmlcreech do 7173636a995dSmlcreech $ECHO "$obj" >> $output 7174636a995dSmlcreech done 7175636a995dSmlcreech delfiles="$delfiles $output" 7176636a995dSmlcreech output=$firstobj\"$file_list_spec$output\" 7177636a995dSmlcreech else 7178636a995dSmlcreech if test -n "$save_libobjs"; then 7179636a995dSmlcreech func_verbose "creating reloadable object files..." 71807f19c02fSvapier output=$output_objdir/$output_la-${k}.$objext 7181636a995dSmlcreech eval test_cmds=\"$reload_cmds\" 7182636a995dSmlcreech func_len " $test_cmds" 7183636a995dSmlcreech len0=$func_len_result 7184636a995dSmlcreech len=$len0 7185636a995dSmlcreech 7186964dbb1eSa.rottmann # Loop over the list of objects to be linked. 7187964dbb1eSa.rottmann for obj in $save_libobjs 7188964dbb1eSa.rottmann do 7189636a995dSmlcreech func_len " $obj" 7190636a995dSmlcreech func_arith $len + $func_len_result 7191636a995dSmlcreech len=$func_arith_result 7192964dbb1eSa.rottmann if test "X$objlist" = X || 7193636a995dSmlcreech test "$len" -lt "$max_cmd_len"; then 7194636a995dSmlcreech func_append objlist " $obj" 7195964dbb1eSa.rottmann else 7196964dbb1eSa.rottmann # The command $test_cmds is almost too long, add a 7197964dbb1eSa.rottmann # command to the queue. 7198964dbb1eSa.rottmann if test "$k" -eq 1 ; then 7199964dbb1eSa.rottmann # The first file doesn't have a previous command to add. 7200964dbb1eSa.rottmann eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 7201964dbb1eSa.rottmann else 7202964dbb1eSa.rottmann # All subsequent reloadable object files will link in 7203964dbb1eSa.rottmann # the last one created. 7204636a995dSmlcreech eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" 7205964dbb1eSa.rottmann fi 72067f19c02fSvapier last_robj=$output_objdir/$output_la-${k}.$objext 7207636a995dSmlcreech func_arith $k + 1 7208636a995dSmlcreech k=$func_arith_result 72097f19c02fSvapier output=$output_objdir/$output_la-${k}.$objext 7210964dbb1eSa.rottmann objlist=$obj 7211636a995dSmlcreech func_len " $last_robj" 7212636a995dSmlcreech func_arith $len0 + $func_len_result 7213636a995dSmlcreech len=$func_arith_result 721462507b65Sa.rottmann fi 721562507b65Sa.rottmann done 7216964dbb1eSa.rottmann # Handle the remaining objects by creating one last 7217964dbb1eSa.rottmann # reloadable object file. All subsequent reloadable object 7218964dbb1eSa.rottmann # files will link in the last one created. 7219964dbb1eSa.rottmann test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 7220964dbb1eSa.rottmann eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 7221636a995dSmlcreech if test -n "$last_robj"; then 7222636a995dSmlcreech eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 7223636a995dSmlcreech fi 7224636a995dSmlcreech delfiles="$delfiles $output" 7225964dbb1eSa.rottmann 7226636a995dSmlcreech else 7227636a995dSmlcreech output= 7228964dbb1eSa.rottmann fi 7229964dbb1eSa.rottmann 7230636a995dSmlcreech if ${skipped_export-false}; then 7231636a995dSmlcreech func_verbose "generating symbol list for \`$libname.la'" 7232636a995dSmlcreech export_symbols="$output_objdir/$libname.exp" 7233636a995dSmlcreech $opt_dry_run || $RM $export_symbols 7234636a995dSmlcreech libobjs=$output 7235636a995dSmlcreech # Append the command to create the export file. 7236636a995dSmlcreech test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 7237636a995dSmlcreech eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 7238636a995dSmlcreech if test -n "$last_robj"; then 7239636a995dSmlcreech eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 7240636a995dSmlcreech fi 7241636a995dSmlcreech fi 7242964dbb1eSa.rottmann 7243636a995dSmlcreech test -n "$save_libobjs" && 7244636a995dSmlcreech func_verbose "creating a temporary reloadable object file: $output" 7245964dbb1eSa.rottmann 7246964dbb1eSa.rottmann # Loop through the commands generated above and execute them. 7247964dbb1eSa.rottmann save_ifs="$IFS"; IFS='~' 7248964dbb1eSa.rottmann for cmd in $concat_cmds; do 7249964dbb1eSa.rottmann IFS="$save_ifs" 7250636a995dSmlcreech $opt_silent || { 7251636a995dSmlcreech func_quote_for_expand "$cmd" 7252636a995dSmlcreech eval "func_echo $func_quote_for_expand_result" 7253636a995dSmlcreech } 7254636a995dSmlcreech $opt_dry_run || eval "$cmd" || { 7255636a995dSmlcreech lt_exit=$? 7256636a995dSmlcreech 7257636a995dSmlcreech # Restore the uninstalled library and exit 7258636a995dSmlcreech if test "$mode" = relink; then 7259636a995dSmlcreech ( cd "$output_objdir" && \ 7260636a995dSmlcreech $RM "${realname}T" && \ 7261636a995dSmlcreech $MV "${realname}U" "$realname" ) 7262636a995dSmlcreech fi 7263636a995dSmlcreech 7264636a995dSmlcreech exit $lt_exit 7265636a995dSmlcreech } 7266964dbb1eSa.rottmann done 7267964dbb1eSa.rottmann IFS="$save_ifs" 7268964dbb1eSa.rottmann 7269636a995dSmlcreech if test -n "$export_symbols_regex" && ${skipped_export-false}; then 7270636a995dSmlcreech func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 7271636a995dSmlcreech func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 7272636a995dSmlcreech fi 7273636a995dSmlcreech fi 7274636a995dSmlcreech 7275636a995dSmlcreech if ${skipped_export-false}; then 7276636a995dSmlcreech if test -n "$export_symbols" && test -n "$include_expsyms"; then 7277636a995dSmlcreech tmp_export_symbols="$export_symbols" 7278636a995dSmlcreech test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 7279636a995dSmlcreech $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' 7280636a995dSmlcreech fi 7281636a995dSmlcreech 7282636a995dSmlcreech if test -n "$orig_export_symbols"; then 7283636a995dSmlcreech # The given exports_symbols file has to be filtered, so filter it. 7284636a995dSmlcreech func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 7285636a995dSmlcreech # FIXME: $output_objdir/$libname.filter potentially contains lots of 7286636a995dSmlcreech # 's' commands which not all seds can handle. GNU sed should be fine 7287636a995dSmlcreech # though. Also, the filter scales superlinearly with the number of 7288636a995dSmlcreech # global variables. join(1) would be nice here, but unfortunately 7289636a995dSmlcreech # isn't a blessed tool. 7290636a995dSmlcreech $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 7291636a995dSmlcreech delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" 7292636a995dSmlcreech export_symbols=$output_objdir/$libname.def 7293636a995dSmlcreech $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 7294636a995dSmlcreech fi 7295636a995dSmlcreech fi 7296636a995dSmlcreech 7297964dbb1eSa.rottmann libobjs=$output 7298964dbb1eSa.rottmann # Restore the value of output. 7299964dbb1eSa.rottmann output=$save_output 7300964dbb1eSa.rottmann 7301964dbb1eSa.rottmann if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 7302964dbb1eSa.rottmann eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 7303636a995dSmlcreech test "X$libobjs" = "X " && libobjs= 7304964dbb1eSa.rottmann fi 7305964dbb1eSa.rottmann # Expand the library linking commands again to reset the 7306964dbb1eSa.rottmann # value of $libobjs for piecewise linking. 7307964dbb1eSa.rottmann 7308964dbb1eSa.rottmann # Do each of the archive commands. 7309964dbb1eSa.rottmann if test "$module" = yes && test -n "$module_cmds" ; then 7310964dbb1eSa.rottmann if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 7311964dbb1eSa.rottmann cmds=$module_expsym_cmds 7312964dbb1eSa.rottmann else 7313964dbb1eSa.rottmann cmds=$module_cmds 7314964dbb1eSa.rottmann fi 7315964dbb1eSa.rottmann else 7316964dbb1eSa.rottmann if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 7317964dbb1eSa.rottmann cmds=$archive_expsym_cmds 7318964dbb1eSa.rottmann else 7319964dbb1eSa.rottmann cmds=$archive_cmds 7320964dbb1eSa.rottmann fi 7321964dbb1eSa.rottmann fi 732271eb93eaSdrh fi 7323636a995dSmlcreech 7324636a995dSmlcreech if test -n "$delfiles"; then 7325636a995dSmlcreech # Append the command to remove temporary files to $cmds. 7326636a995dSmlcreech eval cmds=\"\$cmds~\$RM $delfiles\" 7327636a995dSmlcreech fi 7328636a995dSmlcreech 7329636a995dSmlcreech # Add any objects from preloaded convenience libraries 7330636a995dSmlcreech if test -n "$dlprefiles"; then 7331636a995dSmlcreech gentop="$output_objdir/${outputname}x" 7332636a995dSmlcreech generated="$generated $gentop" 7333636a995dSmlcreech 7334636a995dSmlcreech func_extract_archives $gentop $dlprefiles 7335636a995dSmlcreech libobjs="$libobjs $func_extract_archives_result" 7336636a995dSmlcreech test "X$libobjs" = "X " && libobjs= 7337636a995dSmlcreech fi 7338636a995dSmlcreech 733962507b65Sa.rottmann save_ifs="$IFS"; IFS='~' 734071eb93eaSdrh for cmd in $cmds; do 734171eb93eaSdrh IFS="$save_ifs" 7342964dbb1eSa.rottmann eval cmd=\"$cmd\" 7343636a995dSmlcreech $opt_silent || { 7344636a995dSmlcreech func_quote_for_expand "$cmd" 7345636a995dSmlcreech eval "func_echo $func_quote_for_expand_result" 7346636a995dSmlcreech } 7347636a995dSmlcreech $opt_dry_run || eval "$cmd" || { 73487f19c02fSvapier lt_exit=$? 73497f19c02fSvapier 73507f19c02fSvapier # Restore the uninstalled library and exit 73517f19c02fSvapier if test "$mode" = relink; then 7352636a995dSmlcreech ( cd "$output_objdir" && \ 7353636a995dSmlcreech $RM "${realname}T" && \ 7354636a995dSmlcreech $MV "${realname}U" "$realname" ) 73557f19c02fSvapier fi 73567f19c02fSvapier 73577f19c02fSvapier exit $lt_exit 73587f19c02fSvapier } 735971eb93eaSdrh done 736071eb93eaSdrh IFS="$save_ifs" 736171eb93eaSdrh 736271eb93eaSdrh # Restore the uninstalled library and exit 736371eb93eaSdrh if test "$mode" = relink; then 7364636a995dSmlcreech $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 73657f19c02fSvapier 73667f19c02fSvapier if test -n "$convenience"; then 73677f19c02fSvapier if test -z "$whole_archive_flag_spec"; then 7368636a995dSmlcreech func_show_eval '${RM}r "$gentop"' 73697f19c02fSvapier fi 73707f19c02fSvapier fi 73717f19c02fSvapier 73727f19c02fSvapier exit $EXIT_SUCCESS 737371eb93eaSdrh fi 737471eb93eaSdrh 737571eb93eaSdrh # Create links to the real library. 737671eb93eaSdrh for linkname in $linknames; do 737771eb93eaSdrh if test "$realname" != "$linkname"; then 7378636a995dSmlcreech func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 737971eb93eaSdrh fi 738071eb93eaSdrh done 738171eb93eaSdrh 738271eb93eaSdrh # If -module or -export-dynamic was specified, set the dlname. 738371eb93eaSdrh if test "$module" = yes || test "$export_dynamic" = yes; then 738471eb93eaSdrh # On all known operating systems, these are identical. 738571eb93eaSdrh dlname="$soname" 738671eb93eaSdrh fi 738771eb93eaSdrh fi 738871eb93eaSdrh ;; 738971eb93eaSdrh 739071eb93eaSdrh obj) 739171eb93eaSdrh if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7392636a995dSmlcreech func_warning "\`-dlopen' is ignored for objects" 739371eb93eaSdrh fi 739471eb93eaSdrh 7395636a995dSmlcreech case " $deplibs" in 7396636a995dSmlcreech *\ -l* | *\ -L*) 7397636a995dSmlcreech func_warning "\`-l' and \`-L' are ignored for objects" ;; 7398636a995dSmlcreech esac 739971eb93eaSdrh 7400636a995dSmlcreech test -n "$rpath" && \ 7401636a995dSmlcreech func_warning "\`-rpath' is ignored for objects" 740271eb93eaSdrh 7403636a995dSmlcreech test -n "$xrpath" && \ 7404636a995dSmlcreech func_warning "\`-R' is ignored for objects" 740571eb93eaSdrh 7406636a995dSmlcreech test -n "$vinfo" && \ 7407636a995dSmlcreech func_warning "\`-version-info' is ignored for objects" 7408636a995dSmlcreech 7409636a995dSmlcreech test -n "$release" && \ 7410636a995dSmlcreech func_warning "\`-release' is ignored for objects" 741171eb93eaSdrh 741271eb93eaSdrh case $output in 741371eb93eaSdrh *.lo) 7414636a995dSmlcreech test -n "$objs$old_deplibs" && \ 7415636a995dSmlcreech func_fatal_error "cannot build library object \`$output' from non-libtool objects" 7416636a995dSmlcreech 7417636a995dSmlcreech libobj=$output 7418636a995dSmlcreech func_lo2o "$libobj" 7419636a995dSmlcreech obj=$func_lo2o_result 742071eb93eaSdrh ;; 742171eb93eaSdrh *) 742271eb93eaSdrh libobj= 742371eb93eaSdrh obj="$output" 742471eb93eaSdrh ;; 742571eb93eaSdrh esac 742671eb93eaSdrh 742771eb93eaSdrh # Delete the old objects. 7428636a995dSmlcreech $opt_dry_run || $RM $obj $libobj 742971eb93eaSdrh 743071eb93eaSdrh # Objects from convenience libraries. This assumes 743171eb93eaSdrh # single-version convenience libraries. Whenever we create 743271eb93eaSdrh # different ones for PIC/non-PIC, this we'll have to duplicate 743371eb93eaSdrh # the extraction. 743471eb93eaSdrh reload_conv_objs= 743571eb93eaSdrh gentop= 743671eb93eaSdrh # reload_cmds runs $LD directly, so let us get rid of 7437636a995dSmlcreech # -Wl from whole_archive_flag_spec and hope we can get by with 7438636a995dSmlcreech # turning comma into space.. 743971eb93eaSdrh wl= 744071eb93eaSdrh 744171eb93eaSdrh if test -n "$convenience"; then 744271eb93eaSdrh if test -n "$whole_archive_flag_spec"; then 7443636a995dSmlcreech eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 7444636a995dSmlcreech reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 744571eb93eaSdrh else 744671eb93eaSdrh gentop="$output_objdir/${obj}x" 744771eb93eaSdrh generated="$generated $gentop" 744871eb93eaSdrh 74497f19c02fSvapier func_extract_archives $gentop $convenience 74507f19c02fSvapier reload_conv_objs="$reload_objs $func_extract_archives_result" 745171eb93eaSdrh fi 745271eb93eaSdrh fi 745371eb93eaSdrh 745471eb93eaSdrh # Create the old-style object. 7455636a995dSmlcreech reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 745671eb93eaSdrh 745771eb93eaSdrh output="$obj" 7458636a995dSmlcreech func_execute_cmds "$reload_cmds" 'exit $?' 745971eb93eaSdrh 746071eb93eaSdrh # Exit if we aren't doing a library object file. 746171eb93eaSdrh if test -z "$libobj"; then 746271eb93eaSdrh if test -n "$gentop"; then 7463636a995dSmlcreech func_show_eval '${RM}r "$gentop"' 746471eb93eaSdrh fi 746571eb93eaSdrh 74667f19c02fSvapier exit $EXIT_SUCCESS 746771eb93eaSdrh fi 746871eb93eaSdrh 746971eb93eaSdrh if test "$build_libtool_libs" != yes; then 747071eb93eaSdrh if test -n "$gentop"; then 7471636a995dSmlcreech func_show_eval '${RM}r "$gentop"' 747271eb93eaSdrh fi 747371eb93eaSdrh 747471eb93eaSdrh # Create an invalid libtool object if no PIC, so that we don't 747571eb93eaSdrh # accidentally link it into a program. 7476964dbb1eSa.rottmann # $show "echo timestamp > $libobj" 7477636a995dSmlcreech # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 74787f19c02fSvapier exit $EXIT_SUCCESS 747971eb93eaSdrh fi 748071eb93eaSdrh 748171eb93eaSdrh if test -n "$pic_flag" || test "$pic_mode" != default; then 748271eb93eaSdrh # Only do commands if we really have different PIC objects. 748371eb93eaSdrh reload_objs="$libobjs $reload_conv_objs" 748471eb93eaSdrh output="$libobj" 7485636a995dSmlcreech func_execute_cmds "$reload_cmds" 'exit $?' 748671eb93eaSdrh fi 748771eb93eaSdrh 748871eb93eaSdrh if test -n "$gentop"; then 7489636a995dSmlcreech func_show_eval '${RM}r "$gentop"' 749071eb93eaSdrh fi 749171eb93eaSdrh 74927f19c02fSvapier exit $EXIT_SUCCESS 749371eb93eaSdrh ;; 749471eb93eaSdrh 749571eb93eaSdrh prog) 749671eb93eaSdrh case $host in 7497636a995dSmlcreech *cygwin*) func_stripname '' '.exe' "$output" 7498636a995dSmlcreech output=$func_stripname_result.exe;; 749971eb93eaSdrh esac 7500636a995dSmlcreech test -n "$vinfo" && \ 7501636a995dSmlcreech func_warning "\`-version-info' is ignored for programs" 750271eb93eaSdrh 7503636a995dSmlcreech test -n "$release" && \ 7504636a995dSmlcreech func_warning "\`-release' is ignored for programs" 750571eb93eaSdrh 7506636a995dSmlcreech test "$preload" = yes \ 7507636a995dSmlcreech && test "$dlopen_support" = unknown \ 7508636a995dSmlcreech && test "$dlopen_self" = unknown \ 7509636a995dSmlcreech && test "$dlopen_self_static" = unknown && \ 7510636a995dSmlcreech func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 751171eb93eaSdrh 751271eb93eaSdrh case $host in 751371eb93eaSdrh *-*-rhapsody* | *-*-darwin1.[012]) 751471eb93eaSdrh # On Rhapsody replace the C library is the System framework 7515636a995dSmlcreech compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 7516636a995dSmlcreech finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` 7517964dbb1eSa.rottmann ;; 7518964dbb1eSa.rottmann esac 7519964dbb1eSa.rottmann 752062507b65Sa.rottmann case $host in 7521636a995dSmlcreech *-*-darwin*) 752262507b65Sa.rottmann # Don't allow lazy linking, it breaks C++ global constructors 7523636a995dSmlcreech # But is supposedly fixed on 10.4 or later (yay!). 7524964dbb1eSa.rottmann if test "$tagname" = CXX ; then 7525636a995dSmlcreech case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 7526636a995dSmlcreech 10.[0123]) 752762507b65Sa.rottmann compile_command="$compile_command ${wl}-bind_at_load" 752862507b65Sa.rottmann finalize_command="$finalize_command ${wl}-bind_at_load" 7529636a995dSmlcreech ;; 7530636a995dSmlcreech esac 7531964dbb1eSa.rottmann fi 7532636a995dSmlcreech # Time to change all our "foo.ltframework" stuff back to "-framework foo" 7533636a995dSmlcreech compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 7534636a995dSmlcreech finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` 753571eb93eaSdrh ;; 753671eb93eaSdrh esac 753771eb93eaSdrh 75387f19c02fSvapier 75397f19c02fSvapier # move library search paths that coincide with paths to not yet 75407f19c02fSvapier # installed libraries to the beginning of the library search list 75417f19c02fSvapier new_libs= 75427f19c02fSvapier for path in $notinst_path; do 75437f19c02fSvapier case " $new_libs " in 75447f19c02fSvapier *" -L$path/$objdir "*) ;; 75457f19c02fSvapier *) 75467f19c02fSvapier case " $compile_deplibs " in 75477f19c02fSvapier *" -L$path/$objdir "*) 75487f19c02fSvapier new_libs="$new_libs -L$path/$objdir" ;; 75497f19c02fSvapier esac 75507f19c02fSvapier ;; 75517f19c02fSvapier esac 75527f19c02fSvapier done 75537f19c02fSvapier for deplib in $compile_deplibs; do 75547f19c02fSvapier case $deplib in 75557f19c02fSvapier -L*) 75567f19c02fSvapier case " $new_libs " in 75577f19c02fSvapier *" $deplib "*) ;; 75587f19c02fSvapier *) new_libs="$new_libs $deplib" ;; 75597f19c02fSvapier esac 75607f19c02fSvapier ;; 75617f19c02fSvapier *) new_libs="$new_libs $deplib" ;; 75627f19c02fSvapier esac 75637f19c02fSvapier done 75647f19c02fSvapier compile_deplibs="$new_libs" 75657f19c02fSvapier 75667f19c02fSvapier 756771eb93eaSdrh compile_command="$compile_command $compile_deplibs" 756871eb93eaSdrh finalize_command="$finalize_command $finalize_deplibs" 756971eb93eaSdrh 757071eb93eaSdrh if test -n "$rpath$xrpath"; then 757171eb93eaSdrh # If the user specified any rpath flags, then add them. 757271eb93eaSdrh for libdir in $rpath $xrpath; do 757371eb93eaSdrh # This is the magic to use -rpath. 757471eb93eaSdrh case "$finalize_rpath " in 757571eb93eaSdrh *" $libdir "*) ;; 757671eb93eaSdrh *) finalize_rpath="$finalize_rpath $libdir" ;; 757771eb93eaSdrh esac 757871eb93eaSdrh done 757971eb93eaSdrh fi 758071eb93eaSdrh 758171eb93eaSdrh # Now hardcode the library paths 758271eb93eaSdrh rpath= 758371eb93eaSdrh hardcode_libdirs= 758471eb93eaSdrh for libdir in $compile_rpath $finalize_rpath; do 758571eb93eaSdrh if test -n "$hardcode_libdir_flag_spec"; then 758671eb93eaSdrh if test -n "$hardcode_libdir_separator"; then 758771eb93eaSdrh if test -z "$hardcode_libdirs"; then 758871eb93eaSdrh hardcode_libdirs="$libdir" 758971eb93eaSdrh else 759071eb93eaSdrh # Just accumulate the unique libdirs. 759171eb93eaSdrh case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 759271eb93eaSdrh *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 759371eb93eaSdrh ;; 759471eb93eaSdrh *) 759571eb93eaSdrh hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 759671eb93eaSdrh ;; 759771eb93eaSdrh esac 759871eb93eaSdrh fi 759971eb93eaSdrh else 760071eb93eaSdrh eval flag=\"$hardcode_libdir_flag_spec\" 760171eb93eaSdrh rpath="$rpath $flag" 760271eb93eaSdrh fi 760371eb93eaSdrh elif test -n "$runpath_var"; then 760471eb93eaSdrh case "$perm_rpath " in 760571eb93eaSdrh *" $libdir "*) ;; 760671eb93eaSdrh *) perm_rpath="$perm_rpath $libdir" ;; 760771eb93eaSdrh esac 760871eb93eaSdrh fi 760971eb93eaSdrh case $host in 7610*6acb2cf6Svapier *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 7611636a995dSmlcreech testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 761271eb93eaSdrh case :$dllsearchpath: in 761371eb93eaSdrh *":$libdir:"*) ;; 7614*6acb2cf6Svapier ::) dllsearchpath=$libdir;; 761571eb93eaSdrh *) dllsearchpath="$dllsearchpath:$libdir";; 761671eb93eaSdrh esac 76177f19c02fSvapier case :$dllsearchpath: in 76187f19c02fSvapier *":$testbindir:"*) ;; 7619*6acb2cf6Svapier ::) dllsearchpath=$testbindir;; 76207f19c02fSvapier *) dllsearchpath="$dllsearchpath:$testbindir";; 76217f19c02fSvapier esac 762271eb93eaSdrh ;; 762371eb93eaSdrh esac 762471eb93eaSdrh done 762571eb93eaSdrh # Substitute the hardcoded libdirs into the rpath. 762671eb93eaSdrh if test -n "$hardcode_libdir_separator" && 762771eb93eaSdrh test -n "$hardcode_libdirs"; then 762871eb93eaSdrh libdir="$hardcode_libdirs" 762971eb93eaSdrh eval rpath=\" $hardcode_libdir_flag_spec\" 763071eb93eaSdrh fi 763171eb93eaSdrh compile_rpath="$rpath" 763271eb93eaSdrh 763371eb93eaSdrh rpath= 763471eb93eaSdrh hardcode_libdirs= 763571eb93eaSdrh for libdir in $finalize_rpath; do 763671eb93eaSdrh if test -n "$hardcode_libdir_flag_spec"; then 763771eb93eaSdrh if test -n "$hardcode_libdir_separator"; then 763871eb93eaSdrh if test -z "$hardcode_libdirs"; then 763971eb93eaSdrh hardcode_libdirs="$libdir" 764071eb93eaSdrh else 764171eb93eaSdrh # Just accumulate the unique libdirs. 764271eb93eaSdrh case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 764371eb93eaSdrh *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 764471eb93eaSdrh ;; 764571eb93eaSdrh *) 764671eb93eaSdrh hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 764771eb93eaSdrh ;; 764871eb93eaSdrh esac 764971eb93eaSdrh fi 765071eb93eaSdrh else 765171eb93eaSdrh eval flag=\"$hardcode_libdir_flag_spec\" 765271eb93eaSdrh rpath="$rpath $flag" 765371eb93eaSdrh fi 765471eb93eaSdrh elif test -n "$runpath_var"; then 765571eb93eaSdrh case "$finalize_perm_rpath " in 765671eb93eaSdrh *" $libdir "*) ;; 765771eb93eaSdrh *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 765871eb93eaSdrh esac 765971eb93eaSdrh fi 766071eb93eaSdrh done 766171eb93eaSdrh # Substitute the hardcoded libdirs into the rpath. 766271eb93eaSdrh if test -n "$hardcode_libdir_separator" && 766371eb93eaSdrh test -n "$hardcode_libdirs"; then 766471eb93eaSdrh libdir="$hardcode_libdirs" 766571eb93eaSdrh eval rpath=\" $hardcode_libdir_flag_spec\" 766671eb93eaSdrh fi 766771eb93eaSdrh finalize_rpath="$rpath" 766871eb93eaSdrh 766971eb93eaSdrh if test -n "$libobjs" && test "$build_old_libs" = yes; then 767071eb93eaSdrh # Transform all the library objects into standard objects. 7671636a995dSmlcreech compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 7672636a995dSmlcreech finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 767371eb93eaSdrh fi 767471eb93eaSdrh 7675636a995dSmlcreech func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 7676636a995dSmlcreech 7677636a995dSmlcreech # template prelinking step 7678636a995dSmlcreech if test -n "$prelink_cmds"; then 7679636a995dSmlcreech func_execute_cmds "$prelink_cmds" 'exit $?' 768071eb93eaSdrh fi 768171eb93eaSdrh 7682636a995dSmlcreech wrappers_required=yes 76837f19c02fSvapier case $host in 76847f19c02fSvapier *cygwin* | *mingw* ) 7685636a995dSmlcreech if test "$build_libtool_libs" != yes; then 7686636a995dSmlcreech wrappers_required=no 76877f19c02fSvapier fi 76887f19c02fSvapier ;; 7689*6acb2cf6Svapier *cegcc) 7690*6acb2cf6Svapier # Disable wrappers for cegcc, we are cross compiling anyway. 7691*6acb2cf6Svapier wrappers_required=no 7692*6acb2cf6Svapier ;; 76937f19c02fSvapier *) 7694964dbb1eSa.rottmann if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 7695636a995dSmlcreech wrappers_required=no 7696636a995dSmlcreech fi 7697636a995dSmlcreech ;; 7698636a995dSmlcreech esac 7699636a995dSmlcreech if test "$wrappers_required" = no; then 770071eb93eaSdrh # Replace the output file specification. 7701636a995dSmlcreech compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 770271eb93eaSdrh link_command="$compile_command$compile_rpath" 770371eb93eaSdrh 770471eb93eaSdrh # We have no uninstalled library dependencies, so finalize right now. 7705636a995dSmlcreech exit_status=0 7706636a995dSmlcreech func_show_eval "$link_command" 'exit_status=$?' 770771eb93eaSdrh 770871eb93eaSdrh # Delete the generated files. 7709636a995dSmlcreech if test -f "$output_objdir/${outputname}S.${objext}"; then 7710636a995dSmlcreech func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 771171eb93eaSdrh fi 771271eb93eaSdrh 77137f19c02fSvapier exit $exit_status 771471eb93eaSdrh fi 771571eb93eaSdrh 771671eb93eaSdrh if test -n "$compile_shlibpath$finalize_shlibpath"; then 771771eb93eaSdrh compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 771871eb93eaSdrh fi 771971eb93eaSdrh if test -n "$finalize_shlibpath"; then 772071eb93eaSdrh finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 772171eb93eaSdrh fi 772271eb93eaSdrh 772371eb93eaSdrh compile_var= 772471eb93eaSdrh finalize_var= 772571eb93eaSdrh if test -n "$runpath_var"; then 772671eb93eaSdrh if test -n "$perm_rpath"; then 772771eb93eaSdrh # We should set the runpath_var. 772871eb93eaSdrh rpath= 772971eb93eaSdrh for dir in $perm_rpath; do 773071eb93eaSdrh rpath="$rpath$dir:" 773171eb93eaSdrh done 773271eb93eaSdrh compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 773371eb93eaSdrh fi 773471eb93eaSdrh if test -n "$finalize_perm_rpath"; then 773571eb93eaSdrh # We should set the runpath_var. 773671eb93eaSdrh rpath= 773771eb93eaSdrh for dir in $finalize_perm_rpath; do 773871eb93eaSdrh rpath="$rpath$dir:" 773971eb93eaSdrh done 774071eb93eaSdrh finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 774171eb93eaSdrh fi 774271eb93eaSdrh fi 774371eb93eaSdrh 774471eb93eaSdrh if test "$no_install" = yes; then 774571eb93eaSdrh # We don't need to create a wrapper script. 774671eb93eaSdrh link_command="$compile_var$compile_command$compile_rpath" 774771eb93eaSdrh # Replace the output file specification. 7748636a995dSmlcreech link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 774971eb93eaSdrh # Delete the old output file. 7750636a995dSmlcreech $opt_dry_run || $RM $output 775171eb93eaSdrh # Link the executable and exit 7752636a995dSmlcreech func_show_eval "$link_command" 'exit $?' 77537f19c02fSvapier exit $EXIT_SUCCESS 775471eb93eaSdrh fi 775571eb93eaSdrh 775671eb93eaSdrh if test "$hardcode_action" = relink; then 775771eb93eaSdrh # Fast installation is not supported 775871eb93eaSdrh link_command="$compile_var$compile_command$compile_rpath" 775971eb93eaSdrh relink_command="$finalize_var$finalize_command$finalize_rpath" 776071eb93eaSdrh 7761636a995dSmlcreech func_warning "this platform does not like uninstalled shared libraries" 7762636a995dSmlcreech func_warning "\`$output' will be relinked during installation" 776371eb93eaSdrh else 776471eb93eaSdrh if test "$fast_install" != no; then 776571eb93eaSdrh link_command="$finalize_var$compile_command$finalize_rpath" 776671eb93eaSdrh if test "$fast_install" = yes; then 7767636a995dSmlcreech relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` 776871eb93eaSdrh else 776971eb93eaSdrh # fast_install is set to needless 777071eb93eaSdrh relink_command= 777171eb93eaSdrh fi 777271eb93eaSdrh else 777371eb93eaSdrh link_command="$compile_var$compile_command$compile_rpath" 777471eb93eaSdrh relink_command="$finalize_var$finalize_command$finalize_rpath" 777571eb93eaSdrh fi 777671eb93eaSdrh fi 777771eb93eaSdrh 777871eb93eaSdrh # Replace the output file specification. 7779636a995dSmlcreech link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 778071eb93eaSdrh 778171eb93eaSdrh # Delete the old output files. 7782636a995dSmlcreech $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 778371eb93eaSdrh 7784636a995dSmlcreech func_show_eval "$link_command" 'exit $?' 778571eb93eaSdrh 778671eb93eaSdrh # Now create the wrapper script. 7787636a995dSmlcreech func_verbose "creating $output" 778871eb93eaSdrh 778971eb93eaSdrh # Quote the relink command for shipping. 779071eb93eaSdrh if test -n "$relink_command"; then 779171eb93eaSdrh # Preserve any variables that may affect compiler behavior 779271eb93eaSdrh for var in $variables_saved_for_relink; do 779371eb93eaSdrh if eval test -z \"\${$var+set}\"; then 7794636a995dSmlcreech relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 779571eb93eaSdrh elif eval var_value=\$$var; test -z "$var_value"; then 779671eb93eaSdrh relink_command="$var=; export $var; $relink_command" 779771eb93eaSdrh else 7798636a995dSmlcreech func_quote_for_eval "$var_value" 7799636a995dSmlcreech relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 780071eb93eaSdrh fi 780171eb93eaSdrh done 780262507b65Sa.rottmann relink_command="(cd `pwd`; $relink_command)" 7803636a995dSmlcreech relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 780471eb93eaSdrh fi 780571eb93eaSdrh 7806636a995dSmlcreech # Quote $ECHO for shipping. 7807636a995dSmlcreech if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then 78087f19c02fSvapier case $progpath in 78097f19c02fSvapier [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 78107f19c02fSvapier *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 781171eb93eaSdrh esac 7812636a995dSmlcreech qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` 781371eb93eaSdrh else 7814636a995dSmlcreech qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` 781571eb93eaSdrh fi 781671eb93eaSdrh 7817636a995dSmlcreech # Only actually do things if not in dry run mode. 7818636a995dSmlcreech $opt_dry_run || { 781971eb93eaSdrh # win32 will think the script is a binary if it has 782071eb93eaSdrh # a .exe suffix, so we strip it off here. 782171eb93eaSdrh case $output in 7822636a995dSmlcreech *.exe) func_stripname '' '.exe' "$output" 7823636a995dSmlcreech output=$func_stripname_result ;; 782471eb93eaSdrh esac 782571eb93eaSdrh # test for cygwin because mv fails w/o .exe extensions 782671eb93eaSdrh case $host in 7827964dbb1eSa.rottmann *cygwin*) 7828964dbb1eSa.rottmann exeext=.exe 7829636a995dSmlcreech func_stripname '' '.exe' "$outputname" 7830636a995dSmlcreech outputname=$func_stripname_result ;; 783171eb93eaSdrh *) exeext= ;; 783271eb93eaSdrh esac 7833964dbb1eSa.rottmann case $host in 7834964dbb1eSa.rottmann *cygwin* | *mingw* ) 7835636a995dSmlcreech func_dirname_and_basename "$output" "" "." 7836636a995dSmlcreech output_name=$func_basename_result 7837636a995dSmlcreech output_path=$func_dirname_result 78387f19c02fSvapier cwrappersource="$output_path/$objdir/lt-$output_name.c" 78397f19c02fSvapier cwrapper="$output_path/$output_name.exe" 7840636a995dSmlcreech $RM $cwrappersource $cwrapper 7841636a995dSmlcreech trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 7842964dbb1eSa.rottmann 7843636a995dSmlcreech func_emit_cwrapperexe_src > $cwrappersource 7844964dbb1eSa.rottmann 7845*6acb2cf6Svapier # The wrapper executable is built using the $host compiler, 7846*6acb2cf6Svapier # because it contains $host paths and files. If cross- 7847*6acb2cf6Svapier # compiling, it, like the target executable, must be 7848*6acb2cf6Svapier # executed on the $host or under an emulation environment. 7849636a995dSmlcreech $opt_dry_run || { 7850636a995dSmlcreech $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 7851636a995dSmlcreech $STRIP $cwrapper 7852636a995dSmlcreech } 7853636a995dSmlcreech 7854636a995dSmlcreech # Now, create the wrapper script for func_source use: 7855636a995dSmlcreech func_ltwrapper_scriptname $cwrapper 7856636a995dSmlcreech $RM $func_ltwrapper_scriptname_result 7857636a995dSmlcreech trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 7858636a995dSmlcreech $opt_dry_run || { 7859636a995dSmlcreech # note: this script will not be executed, so do not chmod. 7860636a995dSmlcreech if test "x$build" = "x$host" ; then 7861636a995dSmlcreech $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 7862636a995dSmlcreech else 7863636a995dSmlcreech func_emit_wrapper no > $func_ltwrapper_scriptname_result 7864636a995dSmlcreech fi 7865636a995dSmlcreech } 7866964dbb1eSa.rottmann ;; 786771eb93eaSdrh * ) 7868636a995dSmlcreech $RM $output 7869636a995dSmlcreech trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 7870636a995dSmlcreech 7871636a995dSmlcreech func_emit_wrapper no > $output 7872636a995dSmlcreech chmod +x $output 787371eb93eaSdrh ;; 787471eb93eaSdrh esac 7875636a995dSmlcreech } 78767f19c02fSvapier exit $EXIT_SUCCESS 787771eb93eaSdrh ;; 787871eb93eaSdrh esac 787971eb93eaSdrh 788071eb93eaSdrh # See if we need to build an old-fashioned archive. 788171eb93eaSdrh for oldlib in $oldlibs; do 788271eb93eaSdrh 788371eb93eaSdrh if test "$build_libtool_libs" = convenience; then 7884636a995dSmlcreech oldobjs="$libobjs_save $symfileobj" 788571eb93eaSdrh addlibs="$convenience" 788671eb93eaSdrh build_libtool_libs=no 788771eb93eaSdrh else 788871eb93eaSdrh if test "$build_libtool_libs" = module; then 788971eb93eaSdrh oldobjs="$libobjs_save" 789071eb93eaSdrh build_libtool_libs=no 789171eb93eaSdrh else 7892964dbb1eSa.rottmann oldobjs="$old_deplibs $non_pic_objects" 7893636a995dSmlcreech if test "$preload" = yes && test -f "$symfileobj"; then 7894636a995dSmlcreech oldobjs="$oldobjs $symfileobj" 7895636a995dSmlcreech fi 789671eb93eaSdrh fi 789771eb93eaSdrh addlibs="$old_convenience" 789871eb93eaSdrh fi 789971eb93eaSdrh 790071eb93eaSdrh if test -n "$addlibs"; then 790171eb93eaSdrh gentop="$output_objdir/${outputname}x" 790271eb93eaSdrh generated="$generated $gentop" 790371eb93eaSdrh 79047f19c02fSvapier func_extract_archives $gentop $addlibs 79057f19c02fSvapier oldobjs="$oldobjs $func_extract_archives_result" 790671eb93eaSdrh fi 790771eb93eaSdrh 790871eb93eaSdrh # Do each command in the archive commands. 790971eb93eaSdrh if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 7910964dbb1eSa.rottmann cmds=$old_archive_from_new_cmds 791171eb93eaSdrh else 7912636a995dSmlcreech 7913636a995dSmlcreech # Add any objects from preloaded convenience libraries 7914636a995dSmlcreech if test -n "$dlprefiles"; then 7915636a995dSmlcreech gentop="$output_objdir/${outputname}x" 7916636a995dSmlcreech generated="$generated $gentop" 7917636a995dSmlcreech 7918636a995dSmlcreech func_extract_archives $gentop $dlprefiles 7919636a995dSmlcreech oldobjs="$oldobjs $func_extract_archives_result" 7920636a995dSmlcreech fi 7921636a995dSmlcreech 79227f19c02fSvapier # POSIX demands no paths to be encoded in archives. We have 79237f19c02fSvapier # to avoid creating archives with duplicate basenames if we 79247f19c02fSvapier # might have to extract them afterwards, e.g., when creating a 79257f19c02fSvapier # static archive out of a convenience library, or when linking 79267f19c02fSvapier # the entirety of a libtool archive into another (currently 79277f19c02fSvapier # not supported by libtool). 79287f19c02fSvapier if (for obj in $oldobjs 79297f19c02fSvapier do 7930636a995dSmlcreech func_basename "$obj" 7931636a995dSmlcreech $ECHO "$func_basename_result" 79327f19c02fSvapier done | sort | sort -uc >/dev/null 2>&1); then 79337f19c02fSvapier : 79347f19c02fSvapier else 7935636a995dSmlcreech $ECHO "copying selected object files to avoid basename conflicts..." 79367f19c02fSvapier gentop="$output_objdir/${outputname}x" 79377f19c02fSvapier generated="$generated $gentop" 7938636a995dSmlcreech func_mkdir_p "$gentop" 79397f19c02fSvapier save_oldobjs=$oldobjs 79407f19c02fSvapier oldobjs= 79417f19c02fSvapier counter=1 79427f19c02fSvapier for obj in $save_oldobjs 79437f19c02fSvapier do 7944636a995dSmlcreech func_basename "$obj" 7945636a995dSmlcreech objbase="$func_basename_result" 79467f19c02fSvapier case " $oldobjs " in 79477f19c02fSvapier " ") oldobjs=$obj ;; 79487f19c02fSvapier *[\ /]"$objbase "*) 79497f19c02fSvapier while :; do 79507f19c02fSvapier # Make sure we don't pick an alternate name that also 79517f19c02fSvapier # overlaps. 79527f19c02fSvapier newobj=lt$counter-$objbase 7953636a995dSmlcreech func_arith $counter + 1 7954636a995dSmlcreech counter=$func_arith_result 79557f19c02fSvapier case " $oldobjs " in 79567f19c02fSvapier *[\ /]"$newobj "*) ;; 79577f19c02fSvapier *) if test ! -f "$gentop/$newobj"; then break; fi ;; 79587f19c02fSvapier esac 79597f19c02fSvapier done 7960636a995dSmlcreech func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 79617f19c02fSvapier oldobjs="$oldobjs $gentop/$newobj" 79627f19c02fSvapier ;; 79637f19c02fSvapier *) oldobjs="$oldobjs $obj" ;; 79647f19c02fSvapier esac 79657f19c02fSvapier done 79667f19c02fSvapier fi 7967964dbb1eSa.rottmann eval cmds=\"$old_archive_cmds\" 7968964dbb1eSa.rottmann 7969636a995dSmlcreech func_len " $cmds" 7970636a995dSmlcreech len=$func_len_result 7971636a995dSmlcreech if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 7972964dbb1eSa.rottmann cmds=$old_archive_cmds 797371eb93eaSdrh else 7974964dbb1eSa.rottmann # the command line is too long to link in one step, link in parts 7975636a995dSmlcreech func_verbose "using piecewise archive linking..." 7976964dbb1eSa.rottmann save_RANLIB=$RANLIB 7977964dbb1eSa.rottmann RANLIB=: 7978964dbb1eSa.rottmann objlist= 7979964dbb1eSa.rottmann concat_cmds= 7980964dbb1eSa.rottmann save_oldobjs=$oldobjs 7981636a995dSmlcreech oldobjs= 7982964dbb1eSa.rottmann # Is there a better way of finding the last object in the list? 7983964dbb1eSa.rottmann for obj in $save_oldobjs 7984964dbb1eSa.rottmann do 7985964dbb1eSa.rottmann last_oldobj=$obj 7986964dbb1eSa.rottmann done 7987636a995dSmlcreech eval test_cmds=\"$old_archive_cmds\" 7988636a995dSmlcreech func_len " $test_cmds" 7989636a995dSmlcreech len0=$func_len_result 7990636a995dSmlcreech len=$len0 7991964dbb1eSa.rottmann for obj in $save_oldobjs 7992964dbb1eSa.rottmann do 7993636a995dSmlcreech func_len " $obj" 7994636a995dSmlcreech func_arith $len + $func_len_result 7995636a995dSmlcreech len=$func_arith_result 7996636a995dSmlcreech func_append objlist " $obj" 7997636a995dSmlcreech if test "$len" -lt "$max_cmd_len"; then 7998964dbb1eSa.rottmann : 7999964dbb1eSa.rottmann else 8000964dbb1eSa.rottmann # the above command should be used before it gets too long 8001964dbb1eSa.rottmann oldobjs=$objlist 8002964dbb1eSa.rottmann if test "$obj" = "$last_oldobj" ; then 8003964dbb1eSa.rottmann RANLIB=$save_RANLIB 8004964dbb1eSa.rottmann fi 8005964dbb1eSa.rottmann test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8006964dbb1eSa.rottmann eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 8007964dbb1eSa.rottmann objlist= 8008636a995dSmlcreech len=$len0 800971eb93eaSdrh fi 801071eb93eaSdrh done 8011964dbb1eSa.rottmann RANLIB=$save_RANLIB 8012964dbb1eSa.rottmann oldobjs=$objlist 8013964dbb1eSa.rottmann if test "X$oldobjs" = "X" ; then 8014964dbb1eSa.rottmann eval cmds=\"\$concat_cmds\" 8015964dbb1eSa.rottmann else 8016964dbb1eSa.rottmann eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 8017964dbb1eSa.rottmann fi 8018964dbb1eSa.rottmann fi 801971eb93eaSdrh fi 8020636a995dSmlcreech func_execute_cmds "$cmds" 'exit $?' 802171eb93eaSdrh done 802271eb93eaSdrh 8023636a995dSmlcreech test -n "$generated" && \ 8024636a995dSmlcreech func_show_eval "${RM}r$generated" 802571eb93eaSdrh 802671eb93eaSdrh # Now create the libtool archive. 802771eb93eaSdrh case $output in 802871eb93eaSdrh *.la) 802971eb93eaSdrh old_library= 803071eb93eaSdrh test "$build_old_libs" = yes && old_library="$libname.$libext" 8031636a995dSmlcreech func_verbose "creating $output" 803271eb93eaSdrh 803371eb93eaSdrh # Preserve any variables that may affect compiler behavior 803471eb93eaSdrh for var in $variables_saved_for_relink; do 803571eb93eaSdrh if eval test -z \"\${$var+set}\"; then 8036636a995dSmlcreech relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 803771eb93eaSdrh elif eval var_value=\$$var; test -z "$var_value"; then 803871eb93eaSdrh relink_command="$var=; export $var; $relink_command" 803971eb93eaSdrh else 8040636a995dSmlcreech func_quote_for_eval "$var_value" 8041636a995dSmlcreech relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 804271eb93eaSdrh fi 804371eb93eaSdrh done 804471eb93eaSdrh # Quote the link command for shipping. 80457f19c02fSvapier relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 8046636a995dSmlcreech relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` 8047964dbb1eSa.rottmann if test "$hardcode_automatic" = yes ; then 8048964dbb1eSa.rottmann relink_command= 8049964dbb1eSa.rottmann fi 80507f19c02fSvapier 805171eb93eaSdrh # Only create the output if not a dry run. 8052636a995dSmlcreech $opt_dry_run || { 805371eb93eaSdrh for installed in no yes; do 805471eb93eaSdrh if test "$installed" = yes; then 805571eb93eaSdrh if test -z "$install_libdir"; then 805671eb93eaSdrh break 805771eb93eaSdrh fi 805871eb93eaSdrh output="$output_objdir/$outputname"i 805971eb93eaSdrh # Replace all uninstalled libtool libraries with the installed ones 806071eb93eaSdrh newdependency_libs= 806171eb93eaSdrh for deplib in $dependency_libs; do 806271eb93eaSdrh case $deplib in 806371eb93eaSdrh *.la) 8064636a995dSmlcreech func_basename "$deplib" 8065636a995dSmlcreech name="$func_basename_result" 806662507b65Sa.rottmann eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 8067636a995dSmlcreech test -z "$libdir" && \ 8068636a995dSmlcreech func_fatal_error "\`$deplib' is not a valid libtool archive" 8069636a995dSmlcreech if test "x$EGREP" = x ; then 80707f19c02fSvapier EGREP=egrep 80717f19c02fSvapier fi 80727f19c02fSvapier # We do not want portage's install root ($D) present. Check only for 80737f19c02fSvapier # this if the .la is being installed. 80747f19c02fSvapier if test "$installed" = yes && test "$D"; then 80757f19c02fSvapier eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` 80767f19c02fSvapier else 80777f19c02fSvapier mynewdependency_lib="$libdir/$name" 80787f19c02fSvapier fi 80797f19c02fSvapier # Do not add duplicates 80807f19c02fSvapier if test "$mynewdependency_lib"; then 80817f19c02fSvapier my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` 80827f19c02fSvapier if test -z "$my_little_ninja_foo_1"; then 80837f19c02fSvapier newdependency_libs="$newdependency_libs $mynewdependency_lib" 80847f19c02fSvapier fi 80857f19c02fSvapier fi 808671eb93eaSdrh ;; 80877f19c02fSvapier *) 80887f19c02fSvapier if test "$installed" = yes; then 80897f19c02fSvapier # Rather use S=WORKDIR if our version of portage supports it. 80907f19c02fSvapier # This is because some ebuild (gcc) do not use $S as buildroot. 80917f19c02fSvapier if test "$PWORKDIR"; then 80927f19c02fSvapier S="$PWORKDIR" 80937f19c02fSvapier fi 80947f19c02fSvapier # We do not want portage's build root ($S) present. 80957f19c02fSvapier my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"` 80967f19c02fSvapier # We do not want portage's install root ($D) present. 80977f19c02fSvapier my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"` 80987f19c02fSvapier if test -n "$my_little_ninja_foo_2" && test "$S"; then 80997f19c02fSvapier mynewdependency_lib="" 81007f19c02fSvapier elif test -n "$my_little_ninja_foo_3" && test "$D"; then 81017f19c02fSvapier eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` 81027f19c02fSvapier else 81037f19c02fSvapier mynewdependency_lib="$deplib" 81047f19c02fSvapier fi 81057f19c02fSvapier else 81067f19c02fSvapier mynewdependency_lib="$deplib" 81077f19c02fSvapier fi 81087f19c02fSvapier # Do not add duplicates 81097f19c02fSvapier if test "$mynewdependency_lib"; then 81107f19c02fSvapier my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"` 81117f19c02fSvapier if test -z "$my_little_ninja_foo_4"; then 81127f19c02fSvapier newdependency_libs="$newdependency_libs $mynewdependency_lib" 81137f19c02fSvapier fi 81147f19c02fSvapier fi 81157f19c02fSvapier ;; 811671eb93eaSdrh esac 811771eb93eaSdrh done 811871eb93eaSdrh dependency_libs="$newdependency_libs" 811971eb93eaSdrh newdlfiles= 8120636a995dSmlcreech 812171eb93eaSdrh for lib in $dlfiles; do 8122636a995dSmlcreech case $lib in 8123636a995dSmlcreech *.la) 8124636a995dSmlcreech func_basename "$lib" 8125636a995dSmlcreech name="$func_basename_result" 812662507b65Sa.rottmann eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 8127636a995dSmlcreech test -z "$libdir" && \ 8128636a995dSmlcreech func_fatal_error "\`$lib' is not a valid libtool archive" 812971eb93eaSdrh newdlfiles="$newdlfiles $libdir/$name" 8130636a995dSmlcreech ;; 8131636a995dSmlcreech *) newdlfiles="$newdlfiles $lib" ;; 8132636a995dSmlcreech esac 813371eb93eaSdrh done 813471eb93eaSdrh dlfiles="$newdlfiles" 813571eb93eaSdrh newdlprefiles= 813671eb93eaSdrh for lib in $dlprefiles; do 8137636a995dSmlcreech case $lib in 8138636a995dSmlcreech *.la) 8139636a995dSmlcreech # Only pass preopened files to the pseudo-archive (for 8140636a995dSmlcreech # eventual linking with the app. that links it) if we 8141636a995dSmlcreech # didn't already link the preopened objects directly into 8142636a995dSmlcreech # the library: 8143636a995dSmlcreech func_basename "$lib" 8144636a995dSmlcreech name="$func_basename_result" 814562507b65Sa.rottmann eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 8146636a995dSmlcreech test -z "$libdir" && \ 8147636a995dSmlcreech func_fatal_error "\`$lib' is not a valid libtool archive" 814871eb93eaSdrh newdlprefiles="$newdlprefiles $libdir/$name" 8149636a995dSmlcreech ;; 8150636a995dSmlcreech esac 815171eb93eaSdrh done 815271eb93eaSdrh dlprefiles="$newdlprefiles" 8153964dbb1eSa.rottmann else 8154964dbb1eSa.rottmann newdlfiles= 8155964dbb1eSa.rottmann for lib in $dlfiles; do 8156964dbb1eSa.rottmann case $lib in 8157964dbb1eSa.rottmann [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 8158964dbb1eSa.rottmann *) abs=`pwd`"/$lib" ;; 8159964dbb1eSa.rottmann esac 8160964dbb1eSa.rottmann newdlfiles="$newdlfiles $abs" 8161964dbb1eSa.rottmann done 8162964dbb1eSa.rottmann dlfiles="$newdlfiles" 8163964dbb1eSa.rottmann newdlprefiles= 8164964dbb1eSa.rottmann for lib in $dlprefiles; do 8165964dbb1eSa.rottmann case $lib in 8166964dbb1eSa.rottmann [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 8167964dbb1eSa.rottmann *) abs=`pwd`"/$lib" ;; 8168964dbb1eSa.rottmann esac 8169964dbb1eSa.rottmann newdlprefiles="$newdlprefiles $abs" 8170964dbb1eSa.rottmann done 8171964dbb1eSa.rottmann dlprefiles="$newdlprefiles" 817271eb93eaSdrh fi 8173636a995dSmlcreech $RM $output 817471eb93eaSdrh # place dlname in correct position for cygwin 817571eb93eaSdrh tdlname=$dlname 817671eb93eaSdrh case $host,$output,$installed,$module,$dlname in 8177*6acb2cf6Svapier *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 817871eb93eaSdrh esac 81797f19c02fSvapier # Do not add duplicates 81807f19c02fSvapier if test "$installed" = yes && test "$D"; then 81817f19c02fSvapier install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'` 81827f19c02fSvapier fi 8183636a995dSmlcreech $ECHO > $output "\ 818471eb93eaSdrh# $outputname - a libtool library file 8185636a995dSmlcreech# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 818671eb93eaSdrh# 818771eb93eaSdrh# Please DO NOT delete this file! 818871eb93eaSdrh# It is necessary for linking the library. 818971eb93eaSdrh 819071eb93eaSdrh# The name that we can dlopen(3). 819171eb93eaSdrhdlname='$tdlname' 819271eb93eaSdrh 819371eb93eaSdrh# Names of this library. 819471eb93eaSdrhlibrary_names='$library_names' 819571eb93eaSdrh 819671eb93eaSdrh# The name of the static archive. 819771eb93eaSdrhold_library='$old_library' 819871eb93eaSdrh 8199636a995dSmlcreech# Linker flags that can not go in dependency_libs. 8200636a995dSmlcreechinherited_linker_flags='$new_inherited_linker_flags' 8201636a995dSmlcreech 820271eb93eaSdrh# Libraries that this one depends upon. 820371eb93eaSdrhdependency_libs='$dependency_libs' 820471eb93eaSdrh 8205636a995dSmlcreech# Names of additional weak libraries provided by this library 8206636a995dSmlcreechweak_library_names='$weak_libs' 8207636a995dSmlcreech 820871eb93eaSdrh# Version information for $libname. 820971eb93eaSdrhcurrent=$current 821071eb93eaSdrhage=$age 821171eb93eaSdrhrevision=$revision 821271eb93eaSdrh 821371eb93eaSdrh# Is this an already installed library? 821471eb93eaSdrhinstalled=$installed 821571eb93eaSdrh 8216964dbb1eSa.rottmann# Should we warn about portability when linking against -modules? 8217964dbb1eSa.rottmannshouldnotlink=$module 8218964dbb1eSa.rottmann 821971eb93eaSdrh# Files to dlopen/dlpreopen 822071eb93eaSdrhdlopen='$dlfiles' 822171eb93eaSdrhdlpreopen='$dlprefiles' 822271eb93eaSdrh 822371eb93eaSdrh# Directory that this library needs to be installed in: 822471eb93eaSdrhlibdir='$install_libdir'" 8225964dbb1eSa.rottmann if test "$installed" = no && test "$need_relink" = yes; then 8226636a995dSmlcreech $ECHO >> $output "\ 822771eb93eaSdrhrelink_command=\"$relink_command\"" 822871eb93eaSdrh fi 822971eb93eaSdrh done 8230636a995dSmlcreech } 823171eb93eaSdrh 823271eb93eaSdrh # Do a symbolic link so that the libtool archive can be found in 823371eb93eaSdrh # LD_LIBRARY_PATH before the program is installed. 8234636a995dSmlcreech func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 823571eb93eaSdrh ;; 823671eb93eaSdrh esac 82377f19c02fSvapier exit $EXIT_SUCCESS 82387f19c02fSvapier} 823971eb93eaSdrh 8240636a995dSmlcreech{ test "$mode" = link || test "$mode" = relink; } && 8241636a995dSmlcreech func_mode_link ${1+"$@"} 824271eb93eaSdrh 824371eb93eaSdrh 8244636a995dSmlcreech# func_mode_uninstall arg... 8245636a995dSmlcreechfunc_mode_uninstall () 8246636a995dSmlcreech{ 8247636a995dSmlcreech $opt_debug 8248636a995dSmlcreech RM="$nonopt" 824971eb93eaSdrh files= 825071eb93eaSdrh rmforce= 825171eb93eaSdrh exit_status=0 825271eb93eaSdrh 825371eb93eaSdrh # This variable tells wrapper scripts just to set variables rather 825471eb93eaSdrh # than running their programs. 825571eb93eaSdrh libtool_install_magic="$magic" 825671eb93eaSdrh 825771eb93eaSdrh for arg 825871eb93eaSdrh do 825971eb93eaSdrh case $arg in 8260636a995dSmlcreech -f) RM="$RM $arg"; rmforce=yes ;; 8261636a995dSmlcreech -*) RM="$RM $arg" ;; 826271eb93eaSdrh *) files="$files $arg" ;; 826371eb93eaSdrh esac 826471eb93eaSdrh done 826571eb93eaSdrh 8266636a995dSmlcreech test -z "$RM" && \ 8267636a995dSmlcreech func_fatal_help "you must specify an RM program" 826871eb93eaSdrh 826971eb93eaSdrh rmdirs= 827071eb93eaSdrh 8271964dbb1eSa.rottmann origobjdir="$objdir" 827271eb93eaSdrh for file in $files; do 8273636a995dSmlcreech func_dirname "$file" "" "." 8274636a995dSmlcreech dir="$func_dirname_result" 8275636a995dSmlcreech if test "X$dir" = X.; then 8276964dbb1eSa.rottmann objdir="$origobjdir" 827771eb93eaSdrh else 8278964dbb1eSa.rottmann objdir="$dir/$origobjdir" 827971eb93eaSdrh fi 8280636a995dSmlcreech func_basename "$file" 8281636a995dSmlcreech name="$func_basename_result" 8282964dbb1eSa.rottmann test "$mode" = uninstall && objdir="$dir" 828371eb93eaSdrh 828471eb93eaSdrh # Remember objdir for removal later, being careful to avoid duplicates 8285964dbb1eSa.rottmann if test "$mode" = clean; then 828671eb93eaSdrh case " $rmdirs " in 828771eb93eaSdrh *" $objdir "*) ;; 828871eb93eaSdrh *) rmdirs="$rmdirs $objdir" ;; 828971eb93eaSdrh esac 829071eb93eaSdrh fi 829171eb93eaSdrh 829271eb93eaSdrh # Don't error if the file doesn't exist and rm -f was used. 8293636a995dSmlcreech if { test -L "$file"; } >/dev/null 2>&1 || 8294636a995dSmlcreech { test -h "$file"; } >/dev/null 2>&1 || 8295636a995dSmlcreech test -f "$file"; then 829671eb93eaSdrh : 829771eb93eaSdrh elif test -d "$file"; then 829871eb93eaSdrh exit_status=1 829971eb93eaSdrh continue 830071eb93eaSdrh elif test "$rmforce" = yes; then 830171eb93eaSdrh continue 830271eb93eaSdrh fi 830371eb93eaSdrh 830471eb93eaSdrh rmfiles="$file" 830571eb93eaSdrh 830671eb93eaSdrh case $name in 830771eb93eaSdrh *.la) 830871eb93eaSdrh # Possibly a libtool archive, so verify it. 8309636a995dSmlcreech if func_lalib_p "$file"; then 8310636a995dSmlcreech func_source $dir/$name 831171eb93eaSdrh 831271eb93eaSdrh # Delete the libtool libraries and symlinks. 831371eb93eaSdrh for n in $library_names; do 831471eb93eaSdrh rmfiles="$rmfiles $objdir/$n" 831571eb93eaSdrh done 831671eb93eaSdrh test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 831771eb93eaSdrh 83187f19c02fSvapier case "$mode" in 83197f19c02fSvapier clean) 83207f19c02fSvapier case " $library_names " in 83217f19c02fSvapier # " " in the beginning catches empty $dlname 83227f19c02fSvapier *" $dlname "*) ;; 83237f19c02fSvapier *) rmfiles="$rmfiles $objdir/$dlname" ;; 83247f19c02fSvapier esac 83257f19c02fSvapier test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 83267f19c02fSvapier ;; 83277f19c02fSvapier uninstall) 832871eb93eaSdrh if test -n "$library_names"; then 832971eb93eaSdrh # Do each command in the postuninstall commands. 8330636a995dSmlcreech func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 833171eb93eaSdrh fi 833271eb93eaSdrh 833371eb93eaSdrh if test -n "$old_library"; then 833471eb93eaSdrh # Do each command in the old_postuninstall commands. 8335636a995dSmlcreech func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 833671eb93eaSdrh fi 833771eb93eaSdrh # FIXME: should reinstall the best remaining shared library. 83387f19c02fSvapier ;; 83397f19c02fSvapier esac 834071eb93eaSdrh fi 834171eb93eaSdrh ;; 834271eb93eaSdrh 834371eb93eaSdrh *.lo) 8344964dbb1eSa.rottmann # Possibly a libtool object, so verify it. 8345636a995dSmlcreech if func_lalib_p "$file"; then 8346964dbb1eSa.rottmann 8347964dbb1eSa.rottmann # Read the .lo file 8348636a995dSmlcreech func_source $dir/$name 8349964dbb1eSa.rottmann 8350964dbb1eSa.rottmann # Add PIC object to the list of files to remove. 8351636a995dSmlcreech if test -n "$pic_object" && 8352636a995dSmlcreech test "$pic_object" != none; then 8353964dbb1eSa.rottmann rmfiles="$rmfiles $dir/$pic_object" 8354964dbb1eSa.rottmann fi 8355964dbb1eSa.rottmann 8356964dbb1eSa.rottmann # Add non-PIC object to the list of files to remove. 8357636a995dSmlcreech if test -n "$non_pic_object" && 8358636a995dSmlcreech test "$non_pic_object" != none; then 8359964dbb1eSa.rottmann rmfiles="$rmfiles $dir/$non_pic_object" 8360964dbb1eSa.rottmann fi 836171eb93eaSdrh fi 836271eb93eaSdrh ;; 836371eb93eaSdrh 836471eb93eaSdrh *) 8365964dbb1eSa.rottmann if test "$mode" = clean ; then 8366964dbb1eSa.rottmann noexename=$name 8367964dbb1eSa.rottmann case $file in 8368964dbb1eSa.rottmann *.exe) 8369636a995dSmlcreech func_stripname '' '.exe' "$file" 8370636a995dSmlcreech file=$func_stripname_result 8371636a995dSmlcreech func_stripname '' '.exe' "$name" 8372636a995dSmlcreech noexename=$func_stripname_result 8373964dbb1eSa.rottmann # $file with .exe has already been added to rmfiles, 8374964dbb1eSa.rottmann # add $file without .exe 8375964dbb1eSa.rottmann rmfiles="$rmfiles $file" 8376964dbb1eSa.rottmann ;; 8377964dbb1eSa.rottmann esac 837871eb93eaSdrh # Do a test to see if this is a libtool program. 8379636a995dSmlcreech if func_ltwrapper_p "$file"; then 8380636a995dSmlcreech if func_ltwrapper_executable_p "$file"; then 8381636a995dSmlcreech func_ltwrapper_scriptname "$file" 838271eb93eaSdrh relink_command= 8383636a995dSmlcreech func_source $func_ltwrapper_scriptname_result 8384636a995dSmlcreech rmfiles="$rmfiles $func_ltwrapper_scriptname_result" 8385636a995dSmlcreech else 8386636a995dSmlcreech relink_command= 8387636a995dSmlcreech func_source $dir/$noexename 8388636a995dSmlcreech fi 838971eb93eaSdrh 8390964dbb1eSa.rottmann # note $name still contains .exe if it was in $file originally 8391964dbb1eSa.rottmann # as does the version of $file that was added into $rmfiles 839271eb93eaSdrh rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 839371eb93eaSdrh if test "$fast_install" = yes && test -n "$relink_command"; then 839471eb93eaSdrh rmfiles="$rmfiles $objdir/lt-$name" 839571eb93eaSdrh fi 8396964dbb1eSa.rottmann if test "X$noexename" != "X$name" ; then 8397964dbb1eSa.rottmann rmfiles="$rmfiles $objdir/lt-${noexename}.c" 8398964dbb1eSa.rottmann fi 8399964dbb1eSa.rottmann fi 840071eb93eaSdrh fi 840171eb93eaSdrh ;; 840271eb93eaSdrh esac 8403636a995dSmlcreech func_show_eval "$RM $rmfiles" 'exit_status=1' 840471eb93eaSdrh done 8405964dbb1eSa.rottmann objdir="$origobjdir" 840671eb93eaSdrh 840771eb93eaSdrh # Try to remove the ${objdir}s in the directories where we deleted files 840871eb93eaSdrh for dir in $rmdirs; do 840971eb93eaSdrh if test -d "$dir"; then 8410636a995dSmlcreech func_show_eval "rmdir $dir >/dev/null 2>&1" 841171eb93eaSdrh fi 841271eb93eaSdrh done 841371eb93eaSdrh 841471eb93eaSdrh exit $exit_status 8415636a995dSmlcreech} 841671eb93eaSdrh 8417636a995dSmlcreech{ test "$mode" = uninstall || test "$mode" = clean; } && 8418636a995dSmlcreech func_mode_uninstall ${1+"$@"} 841971eb93eaSdrh 8420636a995dSmlcreechtest -z "$mode" && { 8421636a995dSmlcreech help="$generic_help" 8422636a995dSmlcreech func_fatal_help "you must specify a MODE" 8423636a995dSmlcreech} 8424636a995dSmlcreech 8425636a995dSmlcreechtest -z "$exec_cmd" && \ 8426636a995dSmlcreech func_fatal_help "invalid operation mode \`$mode'" 842771eb93eaSdrh 842871eb93eaSdrhif test -n "$exec_cmd"; then 8429636a995dSmlcreech eval exec "$exec_cmd" 84307f19c02fSvapier exit $EXIT_FAILURE 843171eb93eaSdrhfi 843271eb93eaSdrh 8433636a995dSmlcreechexit $exit_status 843471eb93eaSdrh 843571eb93eaSdrh 8436964dbb1eSa.rottmann# The TAGs below are defined such that we never get into a situation 8437964dbb1eSa.rottmann# in which we disable both kinds of libraries. Given conflicting 8438964dbb1eSa.rottmann# choices, we go for a static library, that is the most portable, 8439964dbb1eSa.rottmann# since we can't tell whether shared libraries were disabled because 8440964dbb1eSa.rottmann# the user asked for that or because the platform doesn't support 8441964dbb1eSa.rottmann# them. This is particularly important on AIX, because we don't 8442964dbb1eSa.rottmann# support having both static and shared libraries enabled at the same 8443964dbb1eSa.rottmann# time on that platform, so we default to a shared-only configuration. 8444964dbb1eSa.rottmann# If a disable-shared tag is given, we'll fallback to a static-only 8445964dbb1eSa.rottmann# configuration. But we'll never go from static-only to shared-only. 8446964dbb1eSa.rottmann 8447964dbb1eSa.rottmann# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 8448636a995dSmlcreechbuild_libtool_libs=no 8449636a995dSmlcreechbuild_old_libs=yes 8450964dbb1eSa.rottmann# ### END LIBTOOL TAG CONFIG: disable-shared 8451964dbb1eSa.rottmann 8452964dbb1eSa.rottmann# ### BEGIN LIBTOOL TAG CONFIG: disable-static 8453636a995dSmlcreechbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 8454964dbb1eSa.rottmann# ### END LIBTOOL TAG CONFIG: disable-static 8455964dbb1eSa.rottmann 845671eb93eaSdrh# Local Variables: 845771eb93eaSdrh# mode:shell-script 845871eb93eaSdrh# sh-indentation:2 845971eb93eaSdrh# End: 8460636a995dSmlcreech# vi:sw=2 8461636a995dSmlcreech 8462