ltmain.sh revision 238106
1238106Sdes 2238106Sdes# libtool (GNU libtool) 2.4 3238106Sdes# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 4238106Sdes 5238106Sdes# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 6238106Sdes# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 7238106Sdes# This is free software; see the source for copying conditions. There is NO 8238106Sdes# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9238106Sdes 10238106Sdes# GNU Libtool is free software; you can redistribute it and/or modify 11238106Sdes# it under the terms of the GNU General Public License as published by 12238106Sdes# the Free Software Foundation; either version 2 of the License, or 13238106Sdes# (at your option) any later version. 14238106Sdes# 15238106Sdes# As a special exception to the GNU General Public License, 16238106Sdes# if you distribute this file as part of a program or library that 17238106Sdes# is built using GNU Libtool, you may include this file under the 18238106Sdes# same distribution terms that you use for the rest of that program. 19238106Sdes# 20238106Sdes# GNU Libtool is distributed in the hope that it will be useful, but 21238106Sdes# WITHOUT ANY WARRANTY; without even the implied warranty of 22238106Sdes# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23238106Sdes# General Public License for more details. 24238106Sdes# 25238106Sdes# You should have received a copy of the GNU General Public License 26238106Sdes# along with GNU Libtool; see the file COPYING. If not, a copy 27238106Sdes# can be downloaded from http://www.gnu.org/licenses/gpl.html, 28238106Sdes# or obtained by writing to the Free Software Foundation, Inc., 29238106Sdes# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 30238106Sdes 31238106Sdes# Usage: $progname [OPTION]... [MODE-ARG]... 32238106Sdes# 33238106Sdes# Provide generalized library-building support services. 34238106Sdes# 35238106Sdes# --config show all configuration variables 36238106Sdes# --debug enable verbose shell tracing 37238106Sdes# -n, --dry-run display commands without modifying any files 38238106Sdes# --features display basic configuration information and exit 39238106Sdes# --mode=MODE use operation mode MODE 40238106Sdes# --preserve-dup-deps don't remove duplicate dependency libraries 41238106Sdes# --quiet, --silent don't print informational messages 42238106Sdes# --no-quiet, --no-silent 43238106Sdes# print informational messages (default) 44238106Sdes# --tag=TAG use configuration variables from tag TAG 45238106Sdes# -v, --verbose print more informational messages than default 46238106Sdes# --no-verbose don't print the extra informational messages 47238106Sdes# --version print version information 48238106Sdes# -h, --help, --help-all print short, long, or detailed help message 49238106Sdes# 50238106Sdes# MODE must be one of the following: 51238106Sdes# 52238106Sdes# clean remove files from the build directory 53238106Sdes# compile compile a source file into a libtool object 54238106Sdes# execute automatically set library path, then run a program 55238106Sdes# finish complete the installation of libtool libraries 56238106Sdes# install install libraries or executables 57238106Sdes# link create a library or an executable 58238106Sdes# uninstall remove libraries from an installed directory 59238106Sdes# 60238106Sdes# MODE-ARGS vary depending on the MODE. When passed as first option, 61238106Sdes# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. 62238106Sdes# Try `$progname --help --mode=MODE' for a more detailed description of MODE. 63238106Sdes# 64238106Sdes# When reporting a bug, please describe a test case to reproduce it and 65238106Sdes# include the following information: 66238106Sdes# 67238106Sdes# host-triplet: $host 68238106Sdes# shell: $SHELL 69238106Sdes# compiler: $LTCC 70238106Sdes# compiler flags: $LTCFLAGS 71238106Sdes# linker: $LD (gnu? $with_gnu_ld) 72238106Sdes# $progname: (GNU libtool) 2.4 73238106Sdes# automake: $automake_version 74238106Sdes# autoconf: $autoconf_version 75238106Sdes# 76238106Sdes# Report bugs to <bug-libtool@gnu.org>. 77238106Sdes# GNU libtool home page: <http://www.gnu.org/software/libtool/>. 78238106Sdes# General help using GNU software: <http://www.gnu.org/gethelp/>. 79238106Sdes 80238106SdesPROGRAM=libtool 81238106SdesPACKAGE=libtool 82238106SdesVERSION=2.4 83238106SdesTIMESTAMP="" 84238106Sdespackage_revision=1.3293 85238106Sdes 86238106Sdes# Be Bourne compatible 87238106Sdesif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 88238106Sdes emulate sh 89238106Sdes NULLCMD=: 90238106Sdes # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 91238106Sdes # is contrary to our usage. Disable this feature. 92238106Sdes alias -g '${1+"$@"}'='"$@"' 93238106Sdes setopt NO_GLOB_SUBST 94238106Sdeselse 95238106Sdes case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 96238106Sdesfi 97238106SdesBIN_SH=xpg4; export BIN_SH # for Tru64 98238106SdesDUALCASE=1; export DUALCASE # for MKS sh 99238106Sdes 100238106Sdes# A function that is used when there is no print builtin or printf. 101238106Sdesfunc_fallback_echo () 102238106Sdes{ 103238106Sdes eval 'cat <<_LTECHO_EOF 104238106Sdes$1 105238106Sdes_LTECHO_EOF' 106238106Sdes} 107238106Sdes 108238106Sdes# NLS nuisances: We save the old values to restore during execute mode. 109238106Sdeslt_user_locale= 110238106Sdeslt_safe_locale= 111238106Sdesfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 112238106Sdesdo 113238106Sdes eval "if test \"\${$lt_var+set}\" = set; then 114238106Sdes save_$lt_var=\$$lt_var 115238106Sdes $lt_var=C 116238106Sdes export $lt_var 117238106Sdes lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" 118238106Sdes lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" 119238106Sdes fi" 120238106Sdesdone 121238106SdesLC_ALL=C 122238106SdesLANGUAGE=C 123238106Sdesexport LANGUAGE LC_ALL 124238106Sdes 125238106Sdes$lt_unset CDPATH 126238106Sdes 127238106Sdes 128238106Sdes# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 129238106Sdes# is ksh but when the shell is invoked as "sh" and the current value of 130238106Sdes# the _XPG environment variable is not equal to 1 (one), the special 131238106Sdes# positional parameter $0, within a function call, is the name of the 132238106Sdes# function. 133238106Sdesprogpath="$0" 134238106Sdes 135238106Sdes 136238106Sdes 137238106Sdes: ${CP="cp -f"} 138238106Sdestest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} 139238106Sdes: ${EGREP="/bin/grep -E"} 140238106Sdes: ${FGREP="/bin/grep -F"} 141238106Sdes: ${GREP="/bin/grep"} 142238106Sdes: ${LN_S="ln -s"} 143238106Sdes: ${MAKE="make"} 144238106Sdes: ${MKDIR="mkdir"} 145238106Sdes: ${MV="mv -f"} 146238106Sdes: ${RM="rm -f"} 147238106Sdes: ${SED="/bin/sed"} 148238106Sdes: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 149238106Sdes: ${Xsed="$SED -e 1s/^X//"} 150238106Sdes 151238106Sdes# Global variables: 152238106SdesEXIT_SUCCESS=0 153238106SdesEXIT_FAILURE=1 154238106SdesEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 155238106SdesEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 156238106Sdes 157238106Sdesexit_status=$EXIT_SUCCESS 158238106Sdes 159238106Sdes# Make sure IFS has a sensible default 160238106Sdeslt_nl=' 161238106Sdes' 162238106SdesIFS=" $lt_nl" 163238106Sdes 164238106Sdesdirname="s,/[^/]*$,," 165238106Sdesbasename="s,^.*/,," 166238106Sdes 167238106Sdes# func_dirname file append nondir_replacement 168238106Sdes# Compute the dirname of FILE. If nonempty, add APPEND to the result, 169238106Sdes# otherwise set result to NONDIR_REPLACEMENT. 170238106Sdesfunc_dirname () 171238106Sdes{ 172238106Sdes func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` 173238106Sdes if test "X$func_dirname_result" = "X${1}"; then 174238106Sdes func_dirname_result="${3}" 175238106Sdes else 176238106Sdes func_dirname_result="$func_dirname_result${2}" 177238106Sdes fi 178238106Sdes} # func_dirname may be replaced by extended shell implementation 179238106Sdes 180238106Sdes 181238106Sdes# func_basename file 182238106Sdesfunc_basename () 183238106Sdes{ 184238106Sdes func_basename_result=`$ECHO "${1}" | $SED "$basename"` 185238106Sdes} # func_basename may be replaced by extended shell implementation 186238106Sdes 187238106Sdes 188238106Sdes# func_dirname_and_basename file append nondir_replacement 189238106Sdes# perform func_basename and func_dirname in a single function 190238106Sdes# call: 191238106Sdes# dirname: Compute the dirname of FILE. If nonempty, 192238106Sdes# add APPEND to the result, otherwise set result 193238106Sdes# to NONDIR_REPLACEMENT. 194238106Sdes# value returned in "$func_dirname_result" 195238106Sdes# basename: Compute filename of FILE. 196238106Sdes# value retuned in "$func_basename_result" 197238106Sdes# Implementation must be kept synchronized with func_dirname 198238106Sdes# and func_basename. For efficiency, we do not delegate to 199238106Sdes# those functions but instead duplicate the functionality here. 200238106Sdesfunc_dirname_and_basename () 201238106Sdes{ 202238106Sdes # Extract subdirectory from the argument. 203238106Sdes func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` 204238106Sdes if test "X$func_dirname_result" = "X${1}"; then 205238106Sdes func_dirname_result="${3}" 206238106Sdes else 207238106Sdes func_dirname_result="$func_dirname_result${2}" 208238106Sdes fi 209238106Sdes func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` 210238106Sdes} # func_dirname_and_basename may be replaced by extended shell implementation 211238106Sdes 212238106Sdes 213238106Sdes# func_stripname prefix suffix name 214238106Sdes# strip PREFIX and SUFFIX off of NAME. 215238106Sdes# PREFIX and SUFFIX must not contain globbing or regex special 216238106Sdes# characters, hashes, percent signs, but SUFFIX may contain a leading 217238106Sdes# dot (in which case that matches only a dot). 218238106Sdes# func_strip_suffix prefix name 219238106Sdesfunc_stripname () 220238106Sdes{ 221238106Sdes case ${2} in 222238106Sdes .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; 223238106Sdes *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; 224238106Sdes esac 225238106Sdes} # func_stripname may be replaced by extended shell implementation 226238106Sdes 227238106Sdes 228238106Sdes# These SED scripts presuppose an absolute path with a trailing slash. 229238106Sdespathcar='s,^/\([^/]*\).*$,\1,' 230238106Sdespathcdr='s,^/[^/]*,,' 231238106Sdesremovedotparts=':dotsl 232238106Sdes s@/\./@/@g 233238106Sdes t dotsl 234238106Sdes s,/\.$,/,' 235238106Sdescollapseslashes='s@/\{1,\}@/@g' 236238106Sdesfinalslash='s,/*$,/,' 237238106Sdes 238238106Sdes# func_normal_abspath PATH 239238106Sdes# Remove doubled-up and trailing slashes, "." path components, 240238106Sdes# and cancel out any ".." path components in PATH after making 241238106Sdes# it an absolute path. 242238106Sdes# value returned in "$func_normal_abspath_result" 243238106Sdesfunc_normal_abspath () 244238106Sdes{ 245238106Sdes # Start from root dir and reassemble the path. 246238106Sdes func_normal_abspath_result= 247238106Sdes func_normal_abspath_tpath=$1 248238106Sdes func_normal_abspath_altnamespace= 249238106Sdes case $func_normal_abspath_tpath in 250238106Sdes "") 251238106Sdes # Empty path, that just means $cwd. 252238106Sdes func_stripname '' '/' "`pwd`" 253238106Sdes func_normal_abspath_result=$func_stripname_result 254238106Sdes return 255238106Sdes ;; 256238106Sdes # The next three entries are used to spot a run of precisely 257238106Sdes # two leading slashes without using negated character classes; 258238106Sdes # we take advantage of case's first-match behaviour. 259238106Sdes ///*) 260238106Sdes # Unusual form of absolute path, do nothing. 261238106Sdes ;; 262238106Sdes //*) 263238106Sdes # Not necessarily an ordinary path; POSIX reserves leading '//' 264238106Sdes # and for example Cygwin uses it to access remote file shares 265238106Sdes # over CIFS/SMB, so we conserve a leading double slash if found. 266238106Sdes func_normal_abspath_altnamespace=/ 267238106Sdes ;; 268238106Sdes /*) 269238106Sdes # Absolute path, do nothing. 270238106Sdes ;; 271238106Sdes *) 272238106Sdes # Relative path, prepend $cwd. 273238106Sdes func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 274238106Sdes ;; 275238106Sdes esac 276238106Sdes # Cancel out all the simple stuff to save iterations. We also want 277238106Sdes # the path to end with a slash for ease of parsing, so make sure 278238106Sdes # there is one (and only one) here. 279238106Sdes func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 280238106Sdes -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` 281238106Sdes while :; do 282238106Sdes # Processed it all yet? 283238106Sdes if test "$func_normal_abspath_tpath" = / ; then 284238106Sdes # If we ascended to the root using ".." the result may be empty now. 285238106Sdes if test -z "$func_normal_abspath_result" ; then 286238106Sdes func_normal_abspath_result=/ 287238106Sdes fi 288238106Sdes break 289238106Sdes fi 290238106Sdes func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 291238106Sdes -e "$pathcar"` 292238106Sdes func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 293238106Sdes -e "$pathcdr"` 294238106Sdes # Figure out what to do with it 295238106Sdes case $func_normal_abspath_tcomponent in 296238106Sdes "") 297238106Sdes # Trailing empty path component, ignore it. 298238106Sdes ;; 299238106Sdes ..) 300238106Sdes # Parent dir; strip last assembled component from result. 301238106Sdes func_dirname "$func_normal_abspath_result" 302238106Sdes func_normal_abspath_result=$func_dirname_result 303238106Sdes ;; 304238106Sdes *) 305238106Sdes # Actual path component, append it. 306238106Sdes func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent 307238106Sdes ;; 308238106Sdes esac 309238106Sdes done 310238106Sdes # Restore leading double-slash if one was found on entry. 311238106Sdes func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 312238106Sdes} 313238106Sdes 314238106Sdes# func_relative_path SRCDIR DSTDIR 315238106Sdes# generates a relative path from SRCDIR to DSTDIR, with a trailing 316238106Sdes# slash if non-empty, suitable for immediately appending a filename 317238106Sdes# without needing to append a separator. 318238106Sdes# value returned in "$func_relative_path_result" 319238106Sdesfunc_relative_path () 320238106Sdes{ 321238106Sdes func_relative_path_result= 322238106Sdes func_normal_abspath "$1" 323238106Sdes func_relative_path_tlibdir=$func_normal_abspath_result 324238106Sdes func_normal_abspath "$2" 325238106Sdes func_relative_path_tbindir=$func_normal_abspath_result 326238106Sdes 327238106Sdes # Ascend the tree starting from libdir 328238106Sdes while :; do 329238106Sdes # check if we have found a prefix of bindir 330238106Sdes case $func_relative_path_tbindir in 331238106Sdes $func_relative_path_tlibdir) 332238106Sdes # found an exact match 333238106Sdes func_relative_path_tcancelled= 334238106Sdes break 335238106Sdes ;; 336238106Sdes $func_relative_path_tlibdir*) 337238106Sdes # found a matching prefix 338238106Sdes func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 339238106Sdes func_relative_path_tcancelled=$func_stripname_result 340238106Sdes if test -z "$func_relative_path_result"; then 341238106Sdes func_relative_path_result=. 342238106Sdes fi 343238106Sdes break 344238106Sdes ;; 345238106Sdes *) 346238106Sdes func_dirname $func_relative_path_tlibdir 347238106Sdes func_relative_path_tlibdir=${func_dirname_result} 348238106Sdes if test "x$func_relative_path_tlibdir" = x ; then 349238106Sdes # Have to descend all the way to the root! 350238106Sdes func_relative_path_result=../$func_relative_path_result 351238106Sdes func_relative_path_tcancelled=$func_relative_path_tbindir 352238106Sdes break 353238106Sdes fi 354238106Sdes func_relative_path_result=../$func_relative_path_result 355238106Sdes ;; 356238106Sdes esac 357238106Sdes done 358238106Sdes 359238106Sdes # Now calculate path; take care to avoid doubling-up slashes. 360238106Sdes func_stripname '' '/' "$func_relative_path_result" 361238106Sdes func_relative_path_result=$func_stripname_result 362238106Sdes func_stripname '/' '/' "$func_relative_path_tcancelled" 363238106Sdes if test "x$func_stripname_result" != x ; then 364238106Sdes func_relative_path_result=${func_relative_path_result}/${func_stripname_result} 365238106Sdes fi 366238106Sdes 367238106Sdes # Normalisation. If bindir is libdir, return empty string, 368238106Sdes # else relative path ending with a slash; either way, target 369238106Sdes # file name can be directly appended. 370238106Sdes if test ! -z "$func_relative_path_result"; then 371238106Sdes func_stripname './' '' "$func_relative_path_result/" 372238106Sdes func_relative_path_result=$func_stripname_result 373238106Sdes fi 374238106Sdes} 375238106Sdes 376238106Sdes# The name of this program: 377238106Sdesfunc_dirname_and_basename "$progpath" 378238106Sdesprogname=$func_basename_result 379238106Sdes 380238106Sdes# Make sure we have an absolute path for reexecution: 381238106Sdescase $progpath in 382238106Sdes [\\/]*|[A-Za-z]:\\*) ;; 383238106Sdes *[\\/]*) 384238106Sdes progdir=$func_dirname_result 385238106Sdes progdir=`cd "$progdir" && pwd` 386238106Sdes progpath="$progdir/$progname" 387238106Sdes ;; 388238106Sdes *) 389238106Sdes save_IFS="$IFS" 390238106Sdes IFS=: 391238106Sdes for progdir in $PATH; do 392238106Sdes IFS="$save_IFS" 393238106Sdes test -x "$progdir/$progname" && break 394238106Sdes done 395238106Sdes IFS="$save_IFS" 396238106Sdes test -n "$progdir" || progdir=`pwd` 397238106Sdes progpath="$progdir/$progname" 398238106Sdes ;; 399238106Sdesesac 400238106Sdes 401238106Sdes# Sed substitution that helps us do robust quoting. It backslashifies 402238106Sdes# metacharacters that are still active within double-quoted strings. 403238106SdesXsed="${SED}"' -e 1s/^X//' 404238106Sdessed_quote_subst='s/\([`"$\\]\)/\\\1/g' 405238106Sdes 406238106Sdes# Same as above, but do not quote variable references. 407238106Sdesdouble_quote_subst='s/\(["`\\]\)/\\\1/g' 408238106Sdes 409238106Sdes# Sed substitution that turns a string into a regex matching for the 410238106Sdes# string literally. 411238106Sdessed_make_literal_regex='s,[].[^$\\*\/],\\&,g' 412238106Sdes 413238106Sdes# Sed substitution that converts a w32 file name or path 414238106Sdes# which contains forward slashes, into one that contains 415238106Sdes# (escaped) backslashes. A very naive implementation. 416238106Sdeslt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 417238106Sdes 418238106Sdes# Re-`\' parameter expansions in output of double_quote_subst that were 419238106Sdes# `\'-ed in input to the same. If an odd number of `\' preceded a '$' 420238106Sdes# in input to double_quote_subst, that '$' was protected from expansion. 421238106Sdes# Since each input `\' is now two `\'s, look for any number of runs of 422238106Sdes# four `\'s followed by two `\'s and then a '$'. `\' that '$'. 423238106Sdesbs='\\' 424238106Sdesbs2='\\\\' 425238106Sdesbs4='\\\\\\\\' 426238106Sdesdollar='\$' 427238106Sdessed_double_backslash="\ 428238106Sdes s/$bs4/&\\ 429238106Sdes/g 430238106Sdes s/^$bs2$dollar/$bs&/ 431238106Sdes s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g 432238106Sdes s/\n//g" 433238106Sdes 434238106Sdes# Standard options: 435238106Sdesopt_dry_run=false 436238106Sdesopt_help=false 437238106Sdesopt_quiet=false 438238106Sdesopt_verbose=false 439238106Sdesopt_warning=: 440238106Sdes 441238106Sdes# func_echo arg... 442238106Sdes# Echo program name prefixed message, along with the current mode 443238106Sdes# name if it has been set yet. 444238106Sdesfunc_echo () 445238106Sdes{ 446238106Sdes $ECHO "$progname: ${opt_mode+$opt_mode: }$*" 447238106Sdes} 448238106Sdes 449238106Sdes# func_verbose arg... 450238106Sdes# Echo program name prefixed message in verbose mode only. 451238106Sdesfunc_verbose () 452238106Sdes{ 453238106Sdes $opt_verbose && func_echo ${1+"$@"} 454238106Sdes 455238106Sdes # A bug in bash halts the script if the last line of a function 456238106Sdes # fails when set -e is in force, so we need another command to 457238106Sdes # work around that: 458238106Sdes : 459238106Sdes} 460238106Sdes 461238106Sdes# func_echo_all arg... 462238106Sdes# Invoke $ECHO with all args, space-separated. 463238106Sdesfunc_echo_all () 464238106Sdes{ 465238106Sdes $ECHO "$*" 466238106Sdes} 467238106Sdes 468238106Sdes# func_error arg... 469238106Sdes# Echo program name prefixed message to standard error. 470238106Sdesfunc_error () 471238106Sdes{ 472238106Sdes $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 473238106Sdes} 474238106Sdes 475238106Sdes# func_warning arg... 476238106Sdes# Echo program name prefixed warning message to standard error. 477238106Sdesfunc_warning () 478238106Sdes{ 479238106Sdes $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 480238106Sdes 481238106Sdes # bash bug again: 482238106Sdes : 483238106Sdes} 484238106Sdes 485238106Sdes# func_fatal_error arg... 486238106Sdes# Echo program name prefixed message to standard error, and exit. 487238106Sdesfunc_fatal_error () 488238106Sdes{ 489238106Sdes func_error ${1+"$@"} 490238106Sdes exit $EXIT_FAILURE 491238106Sdes} 492238106Sdes 493238106Sdes# func_fatal_help arg... 494238106Sdes# Echo program name prefixed message to standard error, followed by 495238106Sdes# a help hint, and exit. 496238106Sdesfunc_fatal_help () 497238106Sdes{ 498238106Sdes func_error ${1+"$@"} 499238106Sdes func_fatal_error "$help" 500238106Sdes} 501238106Sdeshelp="Try \`$progname --help' for more information." ## default 502238106Sdes 503238106Sdes 504238106Sdes# func_grep expression filename 505238106Sdes# Check whether EXPRESSION matches any line of FILENAME, without output. 506238106Sdesfunc_grep () 507238106Sdes{ 508238106Sdes $GREP "$1" "$2" >/dev/null 2>&1 509238106Sdes} 510238106Sdes 511238106Sdes 512238106Sdes# func_mkdir_p directory-path 513238106Sdes# Make sure the entire path to DIRECTORY-PATH is available. 514238106Sdesfunc_mkdir_p () 515238106Sdes{ 516238106Sdes my_directory_path="$1" 517238106Sdes my_dir_list= 518238106Sdes 519238106Sdes if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then 520238106Sdes 521238106Sdes # Protect directory names starting with `-' 522238106Sdes case $my_directory_path in 523238106Sdes -*) my_directory_path="./$my_directory_path" ;; 524238106Sdes esac 525238106Sdes 526238106Sdes # While some portion of DIR does not yet exist... 527238106Sdes while test ! -d "$my_directory_path"; do 528238106Sdes # ...make a list in topmost first order. Use a colon delimited 529238106Sdes # list incase some portion of path contains whitespace. 530238106Sdes my_dir_list="$my_directory_path:$my_dir_list" 531238106Sdes 532238106Sdes # If the last portion added has no slash in it, the list is done 533238106Sdes case $my_directory_path in */*) ;; *) break ;; esac 534238106Sdes 535238106Sdes # ...otherwise throw away the child directory and loop 536238106Sdes my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` 537238106Sdes done 538238106Sdes my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` 539238106Sdes 540238106Sdes save_mkdir_p_IFS="$IFS"; IFS=':' 541238106Sdes for my_dir in $my_dir_list; do 542238106Sdes IFS="$save_mkdir_p_IFS" 543238106Sdes # mkdir can fail with a `File exist' error if two processes 544238106Sdes # try to create one of the directories concurrently. Don't 545238106Sdes # stop in that case! 546238106Sdes $MKDIR "$my_dir" 2>/dev/null || : 547238106Sdes done 548238106Sdes IFS="$save_mkdir_p_IFS" 549238106Sdes 550238106Sdes # Bail out if we (or some other process) failed to create a directory. 551238106Sdes test -d "$my_directory_path" || \ 552238106Sdes func_fatal_error "Failed to create \`$1'" 553238106Sdes fi 554238106Sdes} 555238106Sdes 556238106Sdes 557238106Sdes# func_mktempdir [string] 558238106Sdes# Make a temporary directory that won't clash with other running 559238106Sdes# libtool processes, and avoids race conditions if possible. If 560238106Sdes# given, STRING is the basename for that directory. 561238106Sdesfunc_mktempdir () 562238106Sdes{ 563238106Sdes my_template="${TMPDIR-/tmp}/${1-$progname}" 564238106Sdes 565238106Sdes if test "$opt_dry_run" = ":"; then 566238106Sdes # Return a directory name, but don't create it in dry-run mode 567238106Sdes my_tmpdir="${my_template}-$$" 568238106Sdes else 569238106Sdes 570238106Sdes # If mktemp works, use that first and foremost 571238106Sdes my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 572238106Sdes 573238106Sdes if test ! -d "$my_tmpdir"; then 574238106Sdes # Failing that, at least try and use $RANDOM to avoid a race 575238106Sdes my_tmpdir="${my_template}-${RANDOM-0}$$" 576238106Sdes 577238106Sdes save_mktempdir_umask=`umask` 578238106Sdes umask 0077 579238106Sdes $MKDIR "$my_tmpdir" 580238106Sdes umask $save_mktempdir_umask 581238106Sdes fi 582238106Sdes 583238106Sdes # If we're not in dry-run mode, bomb out on failure 584238106Sdes test -d "$my_tmpdir" || \ 585238106Sdes func_fatal_error "cannot create temporary directory \`$my_tmpdir'" 586238106Sdes fi 587238106Sdes 588238106Sdes $ECHO "$my_tmpdir" 589238106Sdes} 590238106Sdes 591238106Sdes 592238106Sdes# func_quote_for_eval arg 593238106Sdes# Aesthetically quote ARG to be evaled later. 594238106Sdes# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT 595238106Sdes# is double-quoted, suitable for a subsequent eval, whereas 596238106Sdes# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters 597238106Sdes# which are still active within double quotes backslashified. 598238106Sdesfunc_quote_for_eval () 599238106Sdes{ 600238106Sdes case $1 in 601238106Sdes *[\\\`\"\$]*) 602238106Sdes func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; 603238106Sdes *) 604238106Sdes func_quote_for_eval_unquoted_result="$1" ;; 605238106Sdes esac 606238106Sdes 607238106Sdes case $func_quote_for_eval_unquoted_result in 608238106Sdes # Double-quote args containing shell metacharacters to delay 609238106Sdes # word splitting, command substitution and and variable 610238106Sdes # expansion for a subsequent eval. 611238106Sdes # Many Bourne shells cannot handle close brackets correctly 612238106Sdes # in scan sets, so we specify it separately. 613238106Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 614238106Sdes func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" 615238106Sdes ;; 616238106Sdes *) 617238106Sdes func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" 618238106Sdes esac 619238106Sdes} 620238106Sdes 621238106Sdes 622238106Sdes# func_quote_for_expand arg 623238106Sdes# Aesthetically quote ARG to be evaled later; same as above, 624238106Sdes# but do not quote variable references. 625238106Sdesfunc_quote_for_expand () 626238106Sdes{ 627238106Sdes case $1 in 628238106Sdes *[\\\`\"]*) 629238106Sdes my_arg=`$ECHO "$1" | $SED \ 630238106Sdes -e "$double_quote_subst" -e "$sed_double_backslash"` ;; 631238106Sdes *) 632238106Sdes my_arg="$1" ;; 633238106Sdes esac 634238106Sdes 635238106Sdes case $my_arg in 636238106Sdes # Double-quote args containing shell metacharacters to delay 637238106Sdes # word splitting and command substitution for a subsequent eval. 638238106Sdes # Many Bourne shells cannot handle close brackets correctly 639238106Sdes # in scan sets, so we specify it separately. 640238106Sdes *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 641238106Sdes my_arg="\"$my_arg\"" 642238106Sdes ;; 643238106Sdes esac 644238106Sdes 645238106Sdes func_quote_for_expand_result="$my_arg" 646238106Sdes} 647238106Sdes 648238106Sdes 649238106Sdes# func_show_eval cmd [fail_exp] 650238106Sdes# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 651238106Sdes# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 652238106Sdes# is given, then evaluate it. 653238106Sdesfunc_show_eval () 654238106Sdes{ 655238106Sdes my_cmd="$1" 656238106Sdes my_fail_exp="${2-:}" 657238106Sdes 658238106Sdes ${opt_silent-false} || { 659238106Sdes func_quote_for_expand "$my_cmd" 660238106Sdes eval "func_echo $func_quote_for_expand_result" 661238106Sdes } 662238106Sdes 663238106Sdes if ${opt_dry_run-false}; then :; else 664238106Sdes eval "$my_cmd" 665238106Sdes my_status=$? 666238106Sdes if test "$my_status" -eq 0; then :; else 667238106Sdes eval "(exit $my_status); $my_fail_exp" 668238106Sdes fi 669238106Sdes fi 670238106Sdes} 671238106Sdes 672238106Sdes 673238106Sdes# func_show_eval_locale cmd [fail_exp] 674238106Sdes# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is 675238106Sdes# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 676238106Sdes# is given, then evaluate it. Use the saved locale for evaluation. 677238106Sdesfunc_show_eval_locale () 678238106Sdes{ 679238106Sdes my_cmd="$1" 680238106Sdes my_fail_exp="${2-:}" 681238106Sdes 682238106Sdes ${opt_silent-false} || { 683238106Sdes func_quote_for_expand "$my_cmd" 684238106Sdes eval "func_echo $func_quote_for_expand_result" 685238106Sdes } 686238106Sdes 687238106Sdes if ${opt_dry_run-false}; then :; else 688238106Sdes eval "$lt_user_locale 689238106Sdes $my_cmd" 690238106Sdes my_status=$? 691238106Sdes eval "$lt_safe_locale" 692238106Sdes if test "$my_status" -eq 0; then :; else 693238106Sdes eval "(exit $my_status); $my_fail_exp" 694238106Sdes fi 695238106Sdes fi 696238106Sdes} 697238106Sdes 698238106Sdes# func_tr_sh 699238106Sdes# Turn $1 into a string suitable for a shell variable name. 700238106Sdes# Result is stored in $func_tr_sh_result. All characters 701238106Sdes# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 702238106Sdes# if $1 begins with a digit, a '_' is prepended as well. 703238106Sdesfunc_tr_sh () 704238106Sdes{ 705238106Sdes case $1 in 706238106Sdes [0-9]* | *[!a-zA-Z0-9_]*) 707238106Sdes func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` 708238106Sdes ;; 709238106Sdes * ) 710238106Sdes func_tr_sh_result=$1 711238106Sdes ;; 712238106Sdes esac 713238106Sdes} 714238106Sdes 715238106Sdes 716238106Sdes# func_version 717238106Sdes# Echo version message to standard output and exit. 718238106Sdesfunc_version () 719238106Sdes{ 720238106Sdes $opt_debug 721238106Sdes 722238106Sdes $SED -n '/(C)/!b go 723238106Sdes :more 724238106Sdes /\./!{ 725238106Sdes N 726238106Sdes s/\n# / / 727238106Sdes b more 728238106Sdes } 729238106Sdes :go 730238106Sdes /^# '$PROGRAM' (GNU /,/# warranty; / { 731238106Sdes s/^# // 732238106Sdes s/^# *$// 733238106Sdes s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ 734238106Sdes p 735238106Sdes }' < "$progpath" 736238106Sdes exit $? 737238106Sdes} 738238106Sdes 739238106Sdes# func_usage 740238106Sdes# Echo short help message to standard output and exit. 741238106Sdesfunc_usage () 742238106Sdes{ 743238106Sdes $opt_debug 744238106Sdes 745238106Sdes $SED -n '/^# Usage:/,/^# *.*--help/ { 746238106Sdes s/^# // 747238106Sdes s/^# *$// 748238106Sdes s/\$progname/'$progname'/ 749238106Sdes p 750238106Sdes }' < "$progpath" 751238106Sdes echo 752238106Sdes $ECHO "run \`$progname --help | more' for full usage" 753238106Sdes exit $? 754238106Sdes} 755238106Sdes 756238106Sdes# func_help [NOEXIT] 757238106Sdes# Echo long help message to standard output and exit, 758238106Sdes# unless 'noexit' is passed as argument. 759238106Sdesfunc_help () 760238106Sdes{ 761238106Sdes $opt_debug 762238106Sdes 763238106Sdes $SED -n '/^# Usage:/,/# Report bugs to/ { 764238106Sdes :print 765238106Sdes s/^# // 766238106Sdes s/^# *$// 767238106Sdes s*\$progname*'$progname'* 768238106Sdes s*\$host*'"$host"'* 769238106Sdes s*\$SHELL*'"$SHELL"'* 770238106Sdes s*\$LTCC*'"$LTCC"'* 771238106Sdes s*\$LTCFLAGS*'"$LTCFLAGS"'* 772238106Sdes s*\$LD*'"$LD"'* 773238106Sdes s/\$with_gnu_ld/'"$with_gnu_ld"'/ 774238106Sdes s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ 775238106Sdes s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ 776238106Sdes p 777238106Sdes d 778238106Sdes } 779238106Sdes /^# .* home page:/b print 780238106Sdes /^# General help using/b print 781238106Sdes ' < "$progpath" 782238106Sdes ret=$? 783238106Sdes if test -z "$1"; then 784238106Sdes exit $ret 785238106Sdes fi 786238106Sdes} 787238106Sdes 788238106Sdes# func_missing_arg argname 789238106Sdes# Echo program name prefixed message to standard error and set global 790238106Sdes# exit_cmd. 791238106Sdesfunc_missing_arg () 792238106Sdes{ 793238106Sdes $opt_debug 794238106Sdes 795238106Sdes func_error "missing argument for $1." 796238106Sdes exit_cmd=exit 797238106Sdes} 798238106Sdes 799238106Sdes 800238106Sdes# func_split_short_opt shortopt 801238106Sdes# Set func_split_short_opt_name and func_split_short_opt_arg shell 802238106Sdes# variables after splitting SHORTOPT after the 2nd character. 803238106Sdesfunc_split_short_opt () 804238106Sdes{ 805238106Sdes my_sed_short_opt='1s/^\(..\).*$/\1/;q' 806238106Sdes my_sed_short_rest='1s/^..\(.*\)$/\1/;q' 807238106Sdes 808238106Sdes func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` 809238106Sdes func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` 810238106Sdes} # func_split_short_opt may be replaced by extended shell implementation 811238106Sdes 812238106Sdes 813238106Sdes# func_split_long_opt longopt 814238106Sdes# Set func_split_long_opt_name and func_split_long_opt_arg shell 815238106Sdes# variables after splitting LONGOPT at the `=' sign. 816238106Sdesfunc_split_long_opt () 817238106Sdes{ 818238106Sdes my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' 819238106Sdes my_sed_long_arg='1s/^--[^=]*=//' 820238106Sdes 821238106Sdes func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` 822238106Sdes func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` 823238106Sdes} # func_split_long_opt may be replaced by extended shell implementation 824238106Sdes 825238106Sdesexit_cmd=: 826238106Sdes 827238106Sdes 828238106Sdes 829238106Sdes 830238106Sdes 831238106Sdesmagic="%%%MAGIC variable%%%" 832238106Sdesmagic_exe="%%%MAGIC EXE variable%%%" 833238106Sdes 834238106Sdes# Global variables. 835238106Sdesnonopt= 836238106Sdespreserve_args= 837238106Sdeslo2o="s/\\.lo\$/.${objext}/" 838238106Sdeso2lo="s/\\.${objext}\$/.lo/" 839238106Sdesextracted_archives= 840238106Sdesextracted_serial=0 841238106Sdes 842238106Sdes# If this variable is set in any of the actions, the command in it 843238106Sdes# will be execed at the end. This prevents here-documents from being 844238106Sdes# left over by shells. 845238106Sdesexec_cmd= 846238106Sdes 847238106Sdes# func_append var value 848238106Sdes# Append VALUE to the end of shell variable VAR. 849238106Sdesfunc_append () 850238106Sdes{ 851238106Sdes eval "${1}=\$${1}\${2}" 852238106Sdes} # func_append may be replaced by extended shell implementation 853238106Sdes 854238106Sdes# func_append_quoted var value 855238106Sdes# Quote VALUE and append to the end of shell variable VAR, separated 856238106Sdes# by a space. 857238106Sdesfunc_append_quoted () 858238106Sdes{ 859238106Sdes func_quote_for_eval "${2}" 860238106Sdes eval "${1}=\$${1}\\ \$func_quote_for_eval_result" 861238106Sdes} # func_append_quoted may be replaced by extended shell implementation 862238106Sdes 863238106Sdes 864238106Sdes# func_arith arithmetic-term... 865238106Sdesfunc_arith () 866238106Sdes{ 867238106Sdes func_arith_result=`expr "${@}"` 868238106Sdes} # func_arith may be replaced by extended shell implementation 869238106Sdes 870238106Sdes 871238106Sdes# func_len string 872238106Sdes# STRING may not start with a hyphen. 873238106Sdesfunc_len () 874238106Sdes{ 875238106Sdes func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` 876238106Sdes} # func_len may be replaced by extended shell implementation 877238106Sdes 878238106Sdes 879238106Sdes# func_lo2o object 880238106Sdesfunc_lo2o () 881238106Sdes{ 882238106Sdes func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` 883238106Sdes} # func_lo2o may be replaced by extended shell implementation 884238106Sdes 885238106Sdes 886238106Sdes# func_xform libobj-or-source 887238106Sdesfunc_xform () 888238106Sdes{ 889238106Sdes func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` 890238106Sdes} # func_xform may be replaced by extended shell implementation 891238106Sdes 892238106Sdes 893238106Sdes# func_fatal_configuration arg... 894238106Sdes# Echo program name prefixed message to standard error, followed by 895238106Sdes# a configuration failure hint, and exit. 896238106Sdesfunc_fatal_configuration () 897238106Sdes{ 898238106Sdes func_error ${1+"$@"} 899238106Sdes func_error "See the $PACKAGE documentation for more information." 900238106Sdes func_fatal_error "Fatal configuration error." 901238106Sdes} 902238106Sdes 903238106Sdes 904238106Sdes# func_config 905238106Sdes# Display the configuration for all the tags in this script. 906238106Sdesfunc_config () 907238106Sdes{ 908238106Sdes re_begincf='^# ### BEGIN LIBTOOL' 909238106Sdes re_endcf='^# ### END LIBTOOL' 910238106Sdes 911238106Sdes # Default configuration. 912238106Sdes $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 913238106Sdes 914238106Sdes # Now print the configurations for the tags. 915238106Sdes for tagname in $taglist; do 916238106Sdes $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 917238106Sdes done 918238106Sdes 919238106Sdes exit $? 920238106Sdes} 921238106Sdes 922238106Sdes# func_features 923238106Sdes# Display the features supported by this script. 924238106Sdesfunc_features () 925238106Sdes{ 926238106Sdes echo "host: $host" 927238106Sdes if test "$build_libtool_libs" = yes; then 928238106Sdes echo "enable shared libraries" 929238106Sdes else 930238106Sdes echo "disable shared libraries" 931238106Sdes fi 932238106Sdes if test "$build_old_libs" = yes; then 933238106Sdes echo "enable static libraries" 934238106Sdes else 935238106Sdes echo "disable static libraries" 936238106Sdes fi 937238106Sdes 938238106Sdes exit $? 939238106Sdes} 940238106Sdes 941238106Sdes# func_enable_tag tagname 942238106Sdes# Verify that TAGNAME is valid, and either flag an error and exit, or 943238106Sdes# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 944238106Sdes# variable here. 945238106Sdesfunc_enable_tag () 946238106Sdes{ 947238106Sdes # Global variable: 948238106Sdes tagname="$1" 949238106Sdes 950238106Sdes re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 951238106Sdes re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 952238106Sdes sed_extractcf="/$re_begincf/,/$re_endcf/p" 953238106Sdes 954238106Sdes # Validate tagname. 955238106Sdes case $tagname in 956238106Sdes *[!-_A-Za-z0-9,/]*) 957238106Sdes func_fatal_error "invalid tag name: $tagname" 958238106Sdes ;; 959238106Sdes esac 960238106Sdes 961238106Sdes # Don't test for the "default" C tag, as we know it's 962238106Sdes # there but not specially marked. 963238106Sdes case $tagname in 964238106Sdes CC) ;; 965238106Sdes *) 966238106Sdes if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 967238106Sdes taglist="$taglist $tagname" 968238106Sdes 969238106Sdes # Evaluate the configuration. Be careful to quote the path 970238106Sdes # and the sed script, to avoid splitting on whitespace, but 971238106Sdes # also don't use non-portable quotes within backquotes within 972238106Sdes # quotes we have to do it in 2 steps: 973238106Sdes extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 974238106Sdes eval "$extractedcf" 975238106Sdes else 976238106Sdes func_error "ignoring unknown tag $tagname" 977238106Sdes fi 978238106Sdes ;; 979238106Sdes esac 980238106Sdes} 981238106Sdes 982238106Sdes# func_check_version_match 983238106Sdes# Ensure that we are using m4 macros, and libtool script from the same 984238106Sdes# release of libtool. 985238106Sdesfunc_check_version_match () 986238106Sdes{ 987238106Sdes if test "$package_revision" != "$macro_revision"; then 988238106Sdes if test "$VERSION" != "$macro_version"; then 989238106Sdes if test -z "$macro_version"; then 990238106Sdes cat >&2 <<_LT_EOF 991238106Sdes$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 992238106Sdes$progname: definition of this LT_INIT comes from an older release. 993238106Sdes$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 994238106Sdes$progname: and run autoconf again. 995238106Sdes_LT_EOF 996238106Sdes else 997238106Sdes cat >&2 <<_LT_EOF 998238106Sdes$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 999238106Sdes$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 1000238106Sdes$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 1001238106Sdes$progname: and run autoconf again. 1002238106Sdes_LT_EOF 1003238106Sdes fi 1004238106Sdes else 1005238106Sdes cat >&2 <<_LT_EOF 1006238106Sdes$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 1007238106Sdes$progname: but the definition of this LT_INIT comes from revision $macro_revision. 1008238106Sdes$progname: You should recreate aclocal.m4 with macros from revision $package_revision 1009238106Sdes$progname: of $PACKAGE $VERSION and run autoconf again. 1010238106Sdes_LT_EOF 1011238106Sdes fi 1012238106Sdes 1013238106Sdes exit $EXIT_MISMATCH 1014238106Sdes fi 1015238106Sdes} 1016238106Sdes 1017238106Sdes 1018238106Sdes# Shorthand for --mode=foo, only valid as the first argument 1019238106Sdescase $1 in 1020238106Sdesclean|clea|cle|cl) 1021238106Sdes shift; set dummy --mode clean ${1+"$@"}; shift 1022238106Sdes ;; 1023238106Sdescompile|compil|compi|comp|com|co|c) 1024238106Sdes shift; set dummy --mode compile ${1+"$@"}; shift 1025238106Sdes ;; 1026238106Sdesexecute|execut|execu|exec|exe|ex|e) 1027238106Sdes shift; set dummy --mode execute ${1+"$@"}; shift 1028238106Sdes ;; 1029238106Sdesfinish|finis|fini|fin|fi|f) 1030238106Sdes shift; set dummy --mode finish ${1+"$@"}; shift 1031238106Sdes ;; 1032238106Sdesinstall|instal|insta|inst|ins|in|i) 1033238106Sdes shift; set dummy --mode install ${1+"$@"}; shift 1034238106Sdes ;; 1035238106Sdeslink|lin|li|l) 1036238106Sdes shift; set dummy --mode link ${1+"$@"}; shift 1037238106Sdes ;; 1038238106Sdesuninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 1039238106Sdes shift; set dummy --mode uninstall ${1+"$@"}; shift 1040238106Sdes ;; 1041238106Sdesesac 1042238106Sdes 1043238106Sdes 1044238106Sdes 1045238106Sdes# Option defaults: 1046238106Sdesopt_debug=: 1047238106Sdesopt_dry_run=false 1048238106Sdesopt_config=false 1049238106Sdesopt_preserve_dup_deps=false 1050238106Sdesopt_features=false 1051238106Sdesopt_finish=false 1052238106Sdesopt_help=false 1053238106Sdesopt_help_all=false 1054238106Sdesopt_silent=: 1055238106Sdesopt_verbose=: 1056238106Sdesopt_silent=false 1057238106Sdesopt_verbose=false 1058238106Sdes 1059238106Sdes 1060238106Sdes# Parse options once, thoroughly. This comes as soon as possible in the 1061238106Sdes# script to make things like `--version' happen as quickly as we can. 1062238106Sdes{ 1063238106Sdes # this just eases exit handling 1064238106Sdes while test $# -gt 0; do 1065238106Sdes opt="$1" 1066238106Sdes shift 1067238106Sdes case $opt in 1068238106Sdes --debug|-x) opt_debug='set -x' 1069238106Sdes func_echo "enabling shell trace mode" 1070238106Sdes $opt_debug 1071238106Sdes ;; 1072238106Sdes --dry-run|--dryrun|-n) 1073238106Sdes opt_dry_run=: 1074238106Sdes ;; 1075238106Sdes --config) 1076238106Sdes opt_config=: 1077238106Sdesfunc_config 1078238106Sdes ;; 1079238106Sdes --dlopen|-dlopen) 1080238106Sdes optarg="$1" 1081238106Sdes opt_dlopen="${opt_dlopen+$opt_dlopen 1082238106Sdes}$optarg" 1083238106Sdes shift 1084238106Sdes ;; 1085238106Sdes --preserve-dup-deps) 1086238106Sdes opt_preserve_dup_deps=: 1087238106Sdes ;; 1088238106Sdes --features) 1089238106Sdes opt_features=: 1090238106Sdesfunc_features 1091238106Sdes ;; 1092238106Sdes --finish) 1093238106Sdes opt_finish=: 1094238106Sdesset dummy --mode finish ${1+"$@"}; shift 1095238106Sdes ;; 1096238106Sdes --help) 1097238106Sdes opt_help=: 1098238106Sdes ;; 1099238106Sdes --help-all) 1100238106Sdes opt_help_all=: 1101238106Sdesopt_help=': help-all' 1102238106Sdes ;; 1103238106Sdes --mode) 1104238106Sdes test $# = 0 && func_missing_arg $opt && break 1105238106Sdes optarg="$1" 1106238106Sdes opt_mode="$optarg" 1107238106Sdescase $optarg in 1108238106Sdes # Valid mode arguments: 1109238106Sdes clean|compile|execute|finish|install|link|relink|uninstall) ;; 1110238106Sdes 1111238106Sdes # Catch anything else as an error 1112238106Sdes *) func_error "invalid argument for $opt" 1113238106Sdes exit_cmd=exit 1114238106Sdes break 1115238106Sdes ;; 1116238106Sdesesac 1117238106Sdes shift 1118238106Sdes ;; 1119238106Sdes --no-silent|--no-quiet) 1120238106Sdes opt_silent=false 1121238106Sdesfunc_append preserve_args " $opt" 1122238106Sdes ;; 1123238106Sdes --no-verbose) 1124238106Sdes opt_verbose=false 1125238106Sdesfunc_append preserve_args " $opt" 1126238106Sdes ;; 1127238106Sdes --silent|--quiet) 1128238106Sdes opt_silent=: 1129238106Sdesfunc_append preserve_args " $opt" 1130238106Sdes opt_verbose=false 1131238106Sdes ;; 1132238106Sdes --verbose|-v) 1133238106Sdes opt_verbose=: 1134238106Sdesfunc_append preserve_args " $opt" 1135238106Sdesopt_silent=false 1136238106Sdes ;; 1137238106Sdes --tag) 1138238106Sdes test $# = 0 && func_missing_arg $opt && break 1139238106Sdes optarg="$1" 1140238106Sdes opt_tag="$optarg" 1141238106Sdesfunc_append preserve_args " $opt $optarg" 1142238106Sdesfunc_enable_tag "$optarg" 1143238106Sdes shift 1144238106Sdes ;; 1145238106Sdes 1146238106Sdes -\?|-h) func_usage ;; 1147238106Sdes --help) func_help ;; 1148238106Sdes --version) func_version ;; 1149238106Sdes 1150238106Sdes # Separate optargs to long options: 1151238106Sdes --*=*) 1152238106Sdes func_split_long_opt "$opt" 1153238106Sdes set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} 1154238106Sdes shift 1155238106Sdes ;; 1156238106Sdes 1157238106Sdes # Separate non-argument short options: 1158238106Sdes -\?*|-h*|-n*|-v*) 1159238106Sdes func_split_short_opt "$opt" 1160238106Sdes set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} 1161238106Sdes shift 1162238106Sdes ;; 1163238106Sdes 1164238106Sdes --) break ;; 1165238106Sdes -*) func_fatal_help "unrecognized option \`$opt'" ;; 1166238106Sdes *) set dummy "$opt" ${1+"$@"}; shift; break ;; 1167238106Sdes esac 1168238106Sdes done 1169238106Sdes 1170238106Sdes # Validate options: 1171238106Sdes 1172238106Sdes # save first non-option argument 1173238106Sdes if test "$#" -gt 0; then 1174238106Sdes nonopt="$opt" 1175238106Sdes shift 1176238106Sdes fi 1177238106Sdes 1178238106Sdes # preserve --debug 1179238106Sdes test "$opt_debug" = : || func_append preserve_args " --debug" 1180238106Sdes 1181238106Sdes case $host in 1182238106Sdes *cygwin* | *mingw* | *pw32* | *cegcc*) 1183238106Sdes # don't eliminate duplications in $postdeps and $predeps 1184238106Sdes opt_duplicate_compiler_generated_deps=: 1185238106Sdes ;; 1186238106Sdes *) 1187238106Sdes opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 1188238106Sdes ;; 1189238106Sdes esac 1190238106Sdes 1191238106Sdes $opt_help || { 1192238106Sdes # Sanity checks first: 1193238106Sdes func_check_version_match 1194238106Sdes 1195238106Sdes if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 1196238106Sdes func_fatal_configuration "not configured to build any kind of library" 1197238106Sdes fi 1198238106Sdes 1199238106Sdes # Darwin sucks 1200238106Sdes eval std_shrext=\"$shrext_cmds\" 1201238106Sdes 1202238106Sdes # Only execute mode is allowed to have -dlopen flags. 1203238106Sdes if test -n "$opt_dlopen" && test "$opt_mode" != execute; then 1204238106Sdes func_error "unrecognized option \`-dlopen'" 1205238106Sdes $ECHO "$help" 1>&2 1206238106Sdes exit $EXIT_FAILURE 1207238106Sdes fi 1208238106Sdes 1209238106Sdes # Change the help message to a mode-specific one. 1210238106Sdes generic_help="$help" 1211238106Sdes help="Try \`$progname --help --mode=$opt_mode' for more information." 1212238106Sdes } 1213238106Sdes 1214238106Sdes 1215238106Sdes # Bail if the options were screwed 1216238106Sdes $exit_cmd $EXIT_FAILURE 1217238106Sdes} 1218238106Sdes 1219238106Sdes 1220238106Sdes 1221238106Sdes 1222238106Sdes## ----------- ## 1223238106Sdes## Main. ## 1224238106Sdes## ----------- ## 1225238106Sdes 1226238106Sdes# func_lalib_p file 1227238106Sdes# True iff FILE is a libtool `.la' library or `.lo' object file. 1228238106Sdes# This function is only a basic sanity check; it will hardly flush out 1229238106Sdes# determined imposters. 1230238106Sdesfunc_lalib_p () 1231238106Sdes{ 1232238106Sdes test -f "$1" && 1233238106Sdes $SED -e 4q "$1" 2>/dev/null \ 1234238106Sdes | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 1235238106Sdes} 1236238106Sdes 1237238106Sdes# func_lalib_unsafe_p file 1238238106Sdes# True iff FILE is a libtool `.la' library or `.lo' object file. 1239238106Sdes# This function implements the same check as func_lalib_p without 1240238106Sdes# resorting to external programs. To this end, it redirects stdin and 1241238106Sdes# closes it afterwards, without saving the original file descriptor. 1242238106Sdes# As a safety measure, use it only where a negative result would be 1243238106Sdes# fatal anyway. Works if `file' does not exist. 1244238106Sdesfunc_lalib_unsafe_p () 1245238106Sdes{ 1246238106Sdes lalib_p=no 1247238106Sdes if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 1248238106Sdes for lalib_p_l in 1 2 3 4 1249238106Sdes do 1250238106Sdes read lalib_p_line 1251238106Sdes case "$lalib_p_line" in 1252238106Sdes \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 1253238106Sdes esac 1254238106Sdes done 1255238106Sdes exec 0<&5 5<&- 1256238106Sdes fi 1257238106Sdes test "$lalib_p" = yes 1258238106Sdes} 1259238106Sdes 1260238106Sdes# func_ltwrapper_script_p file 1261238106Sdes# True iff FILE is a libtool wrapper script 1262238106Sdes# This function is only a basic sanity check; it will hardly flush out 1263238106Sdes# determined imposters. 1264238106Sdesfunc_ltwrapper_script_p () 1265238106Sdes{ 1266238106Sdes func_lalib_p "$1" 1267238106Sdes} 1268238106Sdes 1269238106Sdes# func_ltwrapper_executable_p file 1270238106Sdes# True iff FILE is a libtool wrapper executable 1271238106Sdes# This function is only a basic sanity check; it will hardly flush out 1272238106Sdes# determined imposters. 1273238106Sdesfunc_ltwrapper_executable_p () 1274238106Sdes{ 1275238106Sdes func_ltwrapper_exec_suffix= 1276238106Sdes case $1 in 1277238106Sdes *.exe) ;; 1278238106Sdes *) func_ltwrapper_exec_suffix=.exe ;; 1279238106Sdes esac 1280238106Sdes $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 1281238106Sdes} 1282238106Sdes 1283238106Sdes# func_ltwrapper_scriptname file 1284238106Sdes# Assumes file is an ltwrapper_executable 1285238106Sdes# uses $file to determine the appropriate filename for a 1286238106Sdes# temporary ltwrapper_script. 1287238106Sdesfunc_ltwrapper_scriptname () 1288238106Sdes{ 1289238106Sdes func_dirname_and_basename "$1" "" "." 1290238106Sdes func_stripname '' '.exe' "$func_basename_result" 1291238106Sdes func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" 1292238106Sdes} 1293238106Sdes 1294238106Sdes# func_ltwrapper_p file 1295238106Sdes# True iff FILE is a libtool wrapper script or wrapper executable 1296238106Sdes# This function is only a basic sanity check; it will hardly flush out 1297238106Sdes# determined imposters. 1298238106Sdesfunc_ltwrapper_p () 1299238106Sdes{ 1300238106Sdes func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 1301238106Sdes} 1302238106Sdes 1303238106Sdes 1304238106Sdes# func_execute_cmds commands fail_cmd 1305238106Sdes# Execute tilde-delimited COMMANDS. 1306238106Sdes# If FAIL_CMD is given, eval that upon failure. 1307238106Sdes# FAIL_CMD may read-access the current command in variable CMD! 1308238106Sdesfunc_execute_cmds () 1309238106Sdes{ 1310238106Sdes $opt_debug 1311238106Sdes save_ifs=$IFS; IFS='~' 1312238106Sdes for cmd in $1; do 1313238106Sdes IFS=$save_ifs 1314238106Sdes eval cmd=\"$cmd\" 1315238106Sdes func_show_eval "$cmd" "${2-:}" 1316238106Sdes done 1317238106Sdes IFS=$save_ifs 1318238106Sdes} 1319238106Sdes 1320238106Sdes 1321238106Sdes# func_source file 1322238106Sdes# Source FILE, adding directory component if necessary. 1323238106Sdes# Note that it is not necessary on cygwin/mingw to append a dot to 1324238106Sdes# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 1325238106Sdes# behavior happens only for exec(3), not for open(2)! Also, sourcing 1326238106Sdes# `FILE.' does not work on cygwin managed mounts. 1327238106Sdesfunc_source () 1328238106Sdes{ 1329238106Sdes $opt_debug 1330238106Sdes case $1 in 1331238106Sdes */* | *\\*) . "$1" ;; 1332238106Sdes *) . "./$1" ;; 1333238106Sdes esac 1334238106Sdes} 1335238106Sdes 1336238106Sdes 1337238106Sdes# func_resolve_sysroot PATH 1338238106Sdes# Replace a leading = in PATH with a sysroot. Store the result into 1339238106Sdes# func_resolve_sysroot_result 1340238106Sdesfunc_resolve_sysroot () 1341238106Sdes{ 1342238106Sdes func_resolve_sysroot_result=$1 1343238106Sdes case $func_resolve_sysroot_result in 1344238106Sdes =*) 1345238106Sdes func_stripname '=' '' "$func_resolve_sysroot_result" 1346238106Sdes func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 1347238106Sdes ;; 1348238106Sdes esac 1349238106Sdes} 1350238106Sdes 1351238106Sdes# func_replace_sysroot PATH 1352238106Sdes# If PATH begins with the sysroot, replace it with = and 1353238106Sdes# store the result into func_replace_sysroot_result. 1354238106Sdesfunc_replace_sysroot () 1355238106Sdes{ 1356238106Sdes case "$lt_sysroot:$1" in 1357238106Sdes ?*:"$lt_sysroot"*) 1358238106Sdes func_stripname "$lt_sysroot" '' "$1" 1359238106Sdes func_replace_sysroot_result="=$func_stripname_result" 1360238106Sdes ;; 1361238106Sdes *) 1362238106Sdes # Including no sysroot. 1363238106Sdes func_replace_sysroot_result=$1 1364238106Sdes ;; 1365238106Sdes esac 1366238106Sdes} 1367238106Sdes 1368238106Sdes# func_infer_tag arg 1369238106Sdes# Infer tagged configuration to use if any are available and 1370238106Sdes# if one wasn't chosen via the "--tag" command line option. 1371238106Sdes# Only attempt this if the compiler in the base compile 1372238106Sdes# command doesn't match the default compiler. 1373238106Sdes# arg is usually of the form 'gcc ...' 1374238106Sdesfunc_infer_tag () 1375238106Sdes{ 1376238106Sdes $opt_debug 1377238106Sdes if test -n "$available_tags" && test -z "$tagname"; then 1378238106Sdes CC_quoted= 1379238106Sdes for arg in $CC; do 1380238106Sdes func_append_quoted CC_quoted "$arg" 1381238106Sdes done 1382238106Sdes CC_expanded=`func_echo_all $CC` 1383238106Sdes CC_quoted_expanded=`func_echo_all $CC_quoted` 1384238106Sdes case $@ in 1385238106Sdes # Blanks in the command may have been stripped by the calling shell, 1386238106Sdes # but not from the CC environment variable when configure was run. 1387238106Sdes " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1388238106Sdes " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 1389238106Sdes # Blanks at the start of $base_compile will cause this to fail 1390238106Sdes # if we don't check for them as well. 1391238106Sdes *) 1392238106Sdes for z in $available_tags; do 1393238106Sdes if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 1394238106Sdes # Evaluate the configuration. 1395238106Sdes eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 1396238106Sdes CC_quoted= 1397238106Sdes for arg in $CC; do 1398238106Sdes # Double-quote args containing other shell metacharacters. 1399238106Sdes func_append_quoted CC_quoted "$arg" 1400238106Sdes done 1401238106Sdes CC_expanded=`func_echo_all $CC` 1402238106Sdes CC_quoted_expanded=`func_echo_all $CC_quoted` 1403238106Sdes case "$@ " in 1404238106Sdes " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 1405238106Sdes " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 1406238106Sdes # The compiler in the base compile command matches 1407238106Sdes # the one in the tagged configuration. 1408238106Sdes # Assume this is the tagged configuration we want. 1409238106Sdes tagname=$z 1410238106Sdes break 1411238106Sdes ;; 1412238106Sdes esac 1413238106Sdes fi 1414238106Sdes done 1415238106Sdes # If $tagname still isn't set, then no tagged configuration 1416238106Sdes # was found and let the user know that the "--tag" command 1417238106Sdes # line option must be used. 1418238106Sdes if test -z "$tagname"; then 1419238106Sdes func_echo "unable to infer tagged configuration" 1420238106Sdes func_fatal_error "specify a tag with \`--tag'" 1421238106Sdes# else 1422238106Sdes# func_verbose "using $tagname tagged configuration" 1423238106Sdes fi 1424238106Sdes ;; 1425238106Sdes esac 1426238106Sdes fi 1427238106Sdes} 1428238106Sdes 1429238106Sdes 1430238106Sdes 1431238106Sdes# func_write_libtool_object output_name pic_name nonpic_name 1432238106Sdes# Create a libtool object file (analogous to a ".la" file), 1433238106Sdes# but don't create it if we're doing a dry run. 1434238106Sdesfunc_write_libtool_object () 1435238106Sdes{ 1436238106Sdes write_libobj=${1} 1437238106Sdes if test "$build_libtool_libs" = yes; then 1438238106Sdes write_lobj=\'${2}\' 1439238106Sdes else 1440238106Sdes write_lobj=none 1441238106Sdes fi 1442238106Sdes 1443238106Sdes if test "$build_old_libs" = yes; then 1444238106Sdes write_oldobj=\'${3}\' 1445238106Sdes else 1446238106Sdes write_oldobj=none 1447238106Sdes fi 1448238106Sdes 1449238106Sdes $opt_dry_run || { 1450238106Sdes cat >${write_libobj}T <<EOF 1451238106Sdes# $write_libobj - a libtool object file 1452238106Sdes# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 1453238106Sdes# 1454238106Sdes# Please DO NOT delete this file! 1455238106Sdes# It is necessary for linking the library. 1456238106Sdes 1457238106Sdes# Name of the PIC object. 1458238106Sdespic_object=$write_lobj 1459238106Sdes 1460238106Sdes# Name of the non-PIC object 1461238106Sdesnon_pic_object=$write_oldobj 1462238106Sdes 1463238106SdesEOF 1464238106Sdes $MV "${write_libobj}T" "${write_libobj}" 1465238106Sdes } 1466238106Sdes} 1467238106Sdes 1468238106Sdes 1469238106Sdes################################################## 1470238106Sdes# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 1471238106Sdes################################################## 1472238106Sdes 1473238106Sdes# func_convert_core_file_wine_to_w32 ARG 1474238106Sdes# Helper function used by file name conversion functions when $build is *nix, 1475238106Sdes# and $host is mingw, cygwin, or some other w32 environment. Relies on a 1476238106Sdes# correctly configured wine environment available, with the winepath program 1477238106Sdes# in $build's $PATH. 1478238106Sdes# 1479238106Sdes# ARG is the $build file name to be converted to w32 format. 1480238106Sdes# Result is available in $func_convert_core_file_wine_to_w32_result, and will 1481238106Sdes# be empty on error (or when ARG is empty) 1482238106Sdesfunc_convert_core_file_wine_to_w32 () 1483238106Sdes{ 1484238106Sdes $opt_debug 1485238106Sdes func_convert_core_file_wine_to_w32_result="$1" 1486238106Sdes if test -n "$1"; then 1487238106Sdes # Unfortunately, winepath does not exit with a non-zero error code, so we 1488238106Sdes # are forced to check the contents of stdout. On the other hand, if the 1489238106Sdes # command is not found, the shell will set an exit code of 127 and print 1490238106Sdes # *an error message* to stdout. So we must check for both error code of 1491238106Sdes # zero AND non-empty stdout, which explains the odd construction: 1492238106Sdes func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 1493238106Sdes if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then 1494238106Sdes func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 1495238106Sdes $SED -e "$lt_sed_naive_backslashify"` 1496238106Sdes else 1497238106Sdes func_convert_core_file_wine_to_w32_result= 1498238106Sdes fi 1499238106Sdes fi 1500238106Sdes} 1501238106Sdes# end: func_convert_core_file_wine_to_w32 1502238106Sdes 1503238106Sdes 1504238106Sdes# func_convert_core_path_wine_to_w32 ARG 1505238106Sdes# Helper function used by path conversion functions when $build is *nix, and 1506238106Sdes# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 1507238106Sdes# configured wine environment available, with the winepath program in $build's 1508238106Sdes# $PATH. Assumes ARG has no leading or trailing path separator characters. 1509238106Sdes# 1510238106Sdes# ARG is path to be converted from $build format to win32. 1511238106Sdes# Result is available in $func_convert_core_path_wine_to_w32_result. 1512238106Sdes# Unconvertible file (directory) names in ARG are skipped; if no directory names 1513238106Sdes# are convertible, then the result may be empty. 1514238106Sdesfunc_convert_core_path_wine_to_w32 () 1515238106Sdes{ 1516238106Sdes $opt_debug 1517238106Sdes # unfortunately, winepath doesn't convert paths, only file names 1518238106Sdes func_convert_core_path_wine_to_w32_result="" 1519238106Sdes if test -n "$1"; then 1520238106Sdes oldIFS=$IFS 1521238106Sdes IFS=: 1522238106Sdes for func_convert_core_path_wine_to_w32_f in $1; do 1523238106Sdes IFS=$oldIFS 1524238106Sdes func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 1525238106Sdes if test -n "$func_convert_core_file_wine_to_w32_result" ; then 1526238106Sdes if test -z "$func_convert_core_path_wine_to_w32_result"; then 1527238106Sdes func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" 1528238106Sdes else 1529238106Sdes func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 1530238106Sdes fi 1531238106Sdes fi 1532238106Sdes done 1533238106Sdes IFS=$oldIFS 1534238106Sdes fi 1535238106Sdes} 1536238106Sdes# end: func_convert_core_path_wine_to_w32 1537238106Sdes 1538238106Sdes 1539238106Sdes# func_cygpath ARGS... 1540238106Sdes# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 1541238106Sdes# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 1542238106Sdes# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 1543238106Sdes# (2), returns the Cygwin file name or path in func_cygpath_result (input 1544238106Sdes# file name or path is assumed to be in w32 format, as previously converted 1545238106Sdes# from $build's *nix or MSYS format). In case (3), returns the w32 file name 1546238106Sdes# or path in func_cygpath_result (input file name or path is assumed to be in 1547238106Sdes# Cygwin format). Returns an empty string on error. 1548238106Sdes# 1549238106Sdes# ARGS are passed to cygpath, with the last one being the file name or path to 1550238106Sdes# be converted. 1551238106Sdes# 1552238106Sdes# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 1553238106Sdes# environment variable; do not put it in $PATH. 1554238106Sdesfunc_cygpath () 1555238106Sdes{ 1556238106Sdes $opt_debug 1557238106Sdes if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 1558238106Sdes func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 1559238106Sdes if test "$?" -ne 0; then 1560238106Sdes # on failure, ensure result is empty 1561238106Sdes func_cygpath_result= 1562238106Sdes fi 1563238106Sdes else 1564238106Sdes func_cygpath_result= 1565238106Sdes func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" 1566238106Sdes fi 1567238106Sdes} 1568238106Sdes#end: func_cygpath 1569238106Sdes 1570238106Sdes 1571238106Sdes# func_convert_core_msys_to_w32 ARG 1572238106Sdes# Convert file name or path ARG from MSYS format to w32 format. Return 1573238106Sdes# result in func_convert_core_msys_to_w32_result. 1574238106Sdesfunc_convert_core_msys_to_w32 () 1575238106Sdes{ 1576238106Sdes $opt_debug 1577238106Sdes # awkward: cmd appends spaces to result 1578238106Sdes func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 1579238106Sdes $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` 1580238106Sdes} 1581238106Sdes#end: func_convert_core_msys_to_w32 1582238106Sdes 1583238106Sdes 1584238106Sdes# func_convert_file_check ARG1 ARG2 1585238106Sdes# Verify that ARG1 (a file name in $build format) was converted to $host 1586238106Sdes# format in ARG2. Otherwise, emit an error message, but continue (resetting 1587238106Sdes# func_to_host_file_result to ARG1). 1588238106Sdesfunc_convert_file_check () 1589238106Sdes{ 1590238106Sdes $opt_debug 1591238106Sdes if test -z "$2" && test -n "$1" ; then 1592238106Sdes func_error "Could not determine host file name corresponding to" 1593238106Sdes func_error " \`$1'" 1594238106Sdes func_error "Continuing, but uninstalled executables may not work." 1595238106Sdes # Fallback: 1596238106Sdes func_to_host_file_result="$1" 1597238106Sdes fi 1598238106Sdes} 1599238106Sdes# end func_convert_file_check 1600238106Sdes 1601238106Sdes 1602238106Sdes# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 1603238106Sdes# Verify that FROM_PATH (a path in $build format) was converted to $host 1604238106Sdes# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 1605238106Sdes# func_to_host_file_result to a simplistic fallback value (see below). 1606238106Sdesfunc_convert_path_check () 1607238106Sdes{ 1608238106Sdes $opt_debug 1609238106Sdes if test -z "$4" && test -n "$3"; then 1610238106Sdes func_error "Could not determine the host path corresponding to" 1611238106Sdes func_error " \`$3'" 1612238106Sdes func_error "Continuing, but uninstalled executables may not work." 1613238106Sdes # Fallback. This is a deliberately simplistic "conversion" and 1614238106Sdes # should not be "improved". See libtool.info. 1615238106Sdes if test "x$1" != "x$2"; then 1616238106Sdes lt_replace_pathsep_chars="s|$1|$2|g" 1617238106Sdes func_to_host_path_result=`echo "$3" | 1618238106Sdes $SED -e "$lt_replace_pathsep_chars"` 1619238106Sdes else 1620238106Sdes func_to_host_path_result="$3" 1621238106Sdes fi 1622238106Sdes fi 1623238106Sdes} 1624238106Sdes# end func_convert_path_check 1625238106Sdes 1626238106Sdes 1627238106Sdes# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 1628238106Sdes# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 1629238106Sdes# and appending REPL if ORIG matches BACKPAT. 1630238106Sdesfunc_convert_path_front_back_pathsep () 1631238106Sdes{ 1632238106Sdes $opt_debug 1633238106Sdes case $4 in 1634238106Sdes $1 ) func_to_host_path_result="$3$func_to_host_path_result" 1635238106Sdes ;; 1636238106Sdes esac 1637238106Sdes case $4 in 1638238106Sdes $2 ) func_append func_to_host_path_result "$3" 1639238106Sdes ;; 1640238106Sdes esac 1641238106Sdes} 1642238106Sdes# end func_convert_path_front_back_pathsep 1643238106Sdes 1644238106Sdes 1645238106Sdes################################################## 1646238106Sdes# $build to $host FILE NAME CONVERSION FUNCTIONS # 1647238106Sdes################################################## 1648238106Sdes# invoked via `$to_host_file_cmd ARG' 1649238106Sdes# 1650238106Sdes# In each case, ARG is the path to be converted from $build to $host format. 1651238106Sdes# Result will be available in $func_to_host_file_result. 1652238106Sdes 1653238106Sdes 1654238106Sdes# func_to_host_file ARG 1655238106Sdes# Converts the file name ARG from $build format to $host format. Return result 1656238106Sdes# in func_to_host_file_result. 1657238106Sdesfunc_to_host_file () 1658238106Sdes{ 1659238106Sdes $opt_debug 1660238106Sdes $to_host_file_cmd "$1" 1661238106Sdes} 1662238106Sdes# end func_to_host_file 1663238106Sdes 1664238106Sdes 1665238106Sdes# func_to_tool_file ARG LAZY 1666238106Sdes# converts the file name ARG from $build format to toolchain format. Return 1667238106Sdes# result in func_to_tool_file_result. If the conversion in use is listed 1668238106Sdes# in (the comma separated) LAZY, no conversion takes place. 1669238106Sdesfunc_to_tool_file () 1670238106Sdes{ 1671238106Sdes $opt_debug 1672238106Sdes case ,$2, in 1673238106Sdes *,"$to_tool_file_cmd",*) 1674238106Sdes func_to_tool_file_result=$1 1675238106Sdes ;; 1676238106Sdes *) 1677238106Sdes $to_tool_file_cmd "$1" 1678238106Sdes func_to_tool_file_result=$func_to_host_file_result 1679238106Sdes ;; 1680238106Sdes esac 1681238106Sdes} 1682238106Sdes# end func_to_tool_file 1683238106Sdes 1684238106Sdes 1685238106Sdes# func_convert_file_noop ARG 1686238106Sdes# Copy ARG to func_to_host_file_result. 1687238106Sdesfunc_convert_file_noop () 1688238106Sdes{ 1689238106Sdes func_to_host_file_result="$1" 1690238106Sdes} 1691238106Sdes# end func_convert_file_noop 1692238106Sdes 1693238106Sdes 1694238106Sdes# func_convert_file_msys_to_w32 ARG 1695238106Sdes# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 1696238106Sdes# conversion to w32 is not available inside the cwrapper. Returns result in 1697238106Sdes# func_to_host_file_result. 1698238106Sdesfunc_convert_file_msys_to_w32 () 1699238106Sdes{ 1700238106Sdes $opt_debug 1701238106Sdes func_to_host_file_result="$1" 1702238106Sdes if test -n "$1"; then 1703238106Sdes func_convert_core_msys_to_w32 "$1" 1704238106Sdes func_to_host_file_result="$func_convert_core_msys_to_w32_result" 1705238106Sdes fi 1706238106Sdes func_convert_file_check "$1" "$func_to_host_file_result" 1707238106Sdes} 1708238106Sdes# end func_convert_file_msys_to_w32 1709238106Sdes 1710238106Sdes 1711238106Sdes# func_convert_file_cygwin_to_w32 ARG 1712238106Sdes# Convert file name ARG from Cygwin to w32 format. Returns result in 1713238106Sdes# func_to_host_file_result. 1714238106Sdesfunc_convert_file_cygwin_to_w32 () 1715238106Sdes{ 1716238106Sdes $opt_debug 1717238106Sdes func_to_host_file_result="$1" 1718238106Sdes if test -n "$1"; then 1719238106Sdes # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 1720238106Sdes # LT_CYGPATH in this case. 1721238106Sdes func_to_host_file_result=`cygpath -m "$1"` 1722238106Sdes fi 1723238106Sdes func_convert_file_check "$1" "$func_to_host_file_result" 1724238106Sdes} 1725238106Sdes# end func_convert_file_cygwin_to_w32 1726238106Sdes 1727238106Sdes 1728238106Sdes# func_convert_file_nix_to_w32 ARG 1729238106Sdes# Convert file name ARG from *nix to w32 format. Requires a wine environment 1730238106Sdes# and a working winepath. Returns result in func_to_host_file_result. 1731238106Sdesfunc_convert_file_nix_to_w32 () 1732238106Sdes{ 1733238106Sdes $opt_debug 1734238106Sdes func_to_host_file_result="$1" 1735238106Sdes if test -n "$1"; then 1736238106Sdes func_convert_core_file_wine_to_w32 "$1" 1737238106Sdes func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" 1738238106Sdes fi 1739238106Sdes func_convert_file_check "$1" "$func_to_host_file_result" 1740238106Sdes} 1741238106Sdes# end func_convert_file_nix_to_w32 1742238106Sdes 1743238106Sdes 1744238106Sdes# func_convert_file_msys_to_cygwin ARG 1745238106Sdes# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 1746238106Sdes# Returns result in func_to_host_file_result. 1747238106Sdesfunc_convert_file_msys_to_cygwin () 1748238106Sdes{ 1749238106Sdes $opt_debug 1750238106Sdes func_to_host_file_result="$1" 1751238106Sdes if test -n "$1"; then 1752238106Sdes func_convert_core_msys_to_w32 "$1" 1753238106Sdes func_cygpath -u "$func_convert_core_msys_to_w32_result" 1754238106Sdes func_to_host_file_result="$func_cygpath_result" 1755238106Sdes fi 1756238106Sdes func_convert_file_check "$1" "$func_to_host_file_result" 1757238106Sdes} 1758238106Sdes# end func_convert_file_msys_to_cygwin 1759238106Sdes 1760238106Sdes 1761238106Sdes# func_convert_file_nix_to_cygwin ARG 1762238106Sdes# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 1763238106Sdes# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 1764238106Sdes# in func_to_host_file_result. 1765238106Sdesfunc_convert_file_nix_to_cygwin () 1766238106Sdes{ 1767238106Sdes $opt_debug 1768238106Sdes func_to_host_file_result="$1" 1769238106Sdes if test -n "$1"; then 1770238106Sdes # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 1771238106Sdes func_convert_core_file_wine_to_w32 "$1" 1772238106Sdes func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 1773238106Sdes func_to_host_file_result="$func_cygpath_result" 1774238106Sdes fi 1775238106Sdes func_convert_file_check "$1" "$func_to_host_file_result" 1776238106Sdes} 1777238106Sdes# end func_convert_file_nix_to_cygwin 1778238106Sdes 1779238106Sdes 1780238106Sdes############################################# 1781238106Sdes# $build to $host PATH CONVERSION FUNCTIONS # 1782238106Sdes############################################# 1783238106Sdes# invoked via `$to_host_path_cmd ARG' 1784238106Sdes# 1785238106Sdes# In each case, ARG is the path to be converted from $build to $host format. 1786238106Sdes# The result will be available in $func_to_host_path_result. 1787238106Sdes# 1788238106Sdes# Path separators are also converted from $build format to $host format. If 1789238106Sdes# ARG begins or ends with a path separator character, it is preserved (but 1790238106Sdes# converted to $host format) on output. 1791238106Sdes# 1792238106Sdes# All path conversion functions are named using the following convention: 1793238106Sdes# file name conversion function : func_convert_file_X_to_Y () 1794238106Sdes# path conversion function : func_convert_path_X_to_Y () 1795238106Sdes# where, for any given $build/$host combination the 'X_to_Y' value is the 1796238106Sdes# same. If conversion functions are added for new $build/$host combinations, 1797238106Sdes# the two new functions must follow this pattern, or func_init_to_host_path_cmd 1798238106Sdes# will break. 1799238106Sdes 1800238106Sdes 1801238106Sdes# func_init_to_host_path_cmd 1802238106Sdes# Ensures that function "pointer" variable $to_host_path_cmd is set to the 1803238106Sdes# appropriate value, based on the value of $to_host_file_cmd. 1804238106Sdesto_host_path_cmd= 1805238106Sdesfunc_init_to_host_path_cmd () 1806238106Sdes{ 1807238106Sdes $opt_debug 1808238106Sdes if test -z "$to_host_path_cmd"; then 1809238106Sdes func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 1810238106Sdes to_host_path_cmd="func_convert_path_${func_stripname_result}" 1811238106Sdes fi 1812238106Sdes} 1813238106Sdes 1814238106Sdes 1815238106Sdes# func_to_host_path ARG 1816238106Sdes# Converts the path ARG from $build format to $host format. Return result 1817238106Sdes# in func_to_host_path_result. 1818238106Sdesfunc_to_host_path () 1819238106Sdes{ 1820238106Sdes $opt_debug 1821238106Sdes func_init_to_host_path_cmd 1822238106Sdes $to_host_path_cmd "$1" 1823238106Sdes} 1824238106Sdes# end func_to_host_path 1825238106Sdes 1826238106Sdes 1827238106Sdes# func_convert_path_noop ARG 1828238106Sdes# Copy ARG to func_to_host_path_result. 1829238106Sdesfunc_convert_path_noop () 1830238106Sdes{ 1831238106Sdes func_to_host_path_result="$1" 1832238106Sdes} 1833238106Sdes# end func_convert_path_noop 1834238106Sdes 1835238106Sdes 1836238106Sdes# func_convert_path_msys_to_w32 ARG 1837238106Sdes# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 1838238106Sdes# conversion to w32 is not available inside the cwrapper. Returns result in 1839238106Sdes# func_to_host_path_result. 1840238106Sdesfunc_convert_path_msys_to_w32 () 1841238106Sdes{ 1842238106Sdes $opt_debug 1843238106Sdes func_to_host_path_result="$1" 1844238106Sdes if test -n "$1"; then 1845238106Sdes # Remove leading and trailing path separator characters from ARG. MSYS 1846238106Sdes # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 1847238106Sdes # and winepath ignores them completely. 1848238106Sdes func_stripname : : "$1" 1849238106Sdes func_to_host_path_tmp1=$func_stripname_result 1850238106Sdes func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 1851238106Sdes func_to_host_path_result="$func_convert_core_msys_to_w32_result" 1852238106Sdes func_convert_path_check : ";" \ 1853238106Sdes "$func_to_host_path_tmp1" "$func_to_host_path_result" 1854238106Sdes func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1855238106Sdes fi 1856238106Sdes} 1857238106Sdes# end func_convert_path_msys_to_w32 1858238106Sdes 1859238106Sdes 1860238106Sdes# func_convert_path_cygwin_to_w32 ARG 1861238106Sdes# Convert path ARG from Cygwin to w32 format. Returns result in 1862238106Sdes# func_to_host_file_result. 1863238106Sdesfunc_convert_path_cygwin_to_w32 () 1864238106Sdes{ 1865238106Sdes $opt_debug 1866238106Sdes func_to_host_path_result="$1" 1867238106Sdes if test -n "$1"; then 1868238106Sdes # See func_convert_path_msys_to_w32: 1869238106Sdes func_stripname : : "$1" 1870238106Sdes func_to_host_path_tmp1=$func_stripname_result 1871238106Sdes func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 1872238106Sdes func_convert_path_check : ";" \ 1873238106Sdes "$func_to_host_path_tmp1" "$func_to_host_path_result" 1874238106Sdes func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1875238106Sdes fi 1876238106Sdes} 1877238106Sdes# end func_convert_path_cygwin_to_w32 1878238106Sdes 1879238106Sdes 1880238106Sdes# func_convert_path_nix_to_w32 ARG 1881238106Sdes# Convert path ARG from *nix to w32 format. Requires a wine environment and 1882238106Sdes# a working winepath. Returns result in func_to_host_file_result. 1883238106Sdesfunc_convert_path_nix_to_w32 () 1884238106Sdes{ 1885238106Sdes $opt_debug 1886238106Sdes func_to_host_path_result="$1" 1887238106Sdes if test -n "$1"; then 1888238106Sdes # See func_convert_path_msys_to_w32: 1889238106Sdes func_stripname : : "$1" 1890238106Sdes func_to_host_path_tmp1=$func_stripname_result 1891238106Sdes func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 1892238106Sdes func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" 1893238106Sdes func_convert_path_check : ";" \ 1894238106Sdes "$func_to_host_path_tmp1" "$func_to_host_path_result" 1895238106Sdes func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 1896238106Sdes fi 1897238106Sdes} 1898238106Sdes# end func_convert_path_nix_to_w32 1899238106Sdes 1900238106Sdes 1901238106Sdes# func_convert_path_msys_to_cygwin ARG 1902238106Sdes# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 1903238106Sdes# Returns result in func_to_host_file_result. 1904238106Sdesfunc_convert_path_msys_to_cygwin () 1905238106Sdes{ 1906238106Sdes $opt_debug 1907238106Sdes func_to_host_path_result="$1" 1908238106Sdes if test -n "$1"; then 1909238106Sdes # See func_convert_path_msys_to_w32: 1910238106Sdes func_stripname : : "$1" 1911238106Sdes func_to_host_path_tmp1=$func_stripname_result 1912238106Sdes func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 1913238106Sdes func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 1914238106Sdes func_to_host_path_result="$func_cygpath_result" 1915238106Sdes func_convert_path_check : : \ 1916238106Sdes "$func_to_host_path_tmp1" "$func_to_host_path_result" 1917238106Sdes func_convert_path_front_back_pathsep ":*" "*:" : "$1" 1918238106Sdes fi 1919238106Sdes} 1920238106Sdes# end func_convert_path_msys_to_cygwin 1921238106Sdes 1922238106Sdes 1923238106Sdes# func_convert_path_nix_to_cygwin ARG 1924238106Sdes# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 1925238106Sdes# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 1926238106Sdes# func_to_host_file_result. 1927238106Sdesfunc_convert_path_nix_to_cygwin () 1928238106Sdes{ 1929238106Sdes $opt_debug 1930238106Sdes func_to_host_path_result="$1" 1931238106Sdes if test -n "$1"; then 1932238106Sdes # Remove leading and trailing path separator characters from 1933238106Sdes # ARG. msys behavior is inconsistent here, cygpath turns them 1934238106Sdes # into '.;' and ';.', and winepath ignores them completely. 1935238106Sdes func_stripname : : "$1" 1936238106Sdes func_to_host_path_tmp1=$func_stripname_result 1937238106Sdes func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 1938238106Sdes func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 1939238106Sdes func_to_host_path_result="$func_cygpath_result" 1940238106Sdes func_convert_path_check : : \ 1941238106Sdes "$func_to_host_path_tmp1" "$func_to_host_path_result" 1942238106Sdes func_convert_path_front_back_pathsep ":*" "*:" : "$1" 1943238106Sdes fi 1944238106Sdes} 1945238106Sdes# end func_convert_path_nix_to_cygwin 1946238106Sdes 1947238106Sdes 1948238106Sdes# func_mode_compile arg... 1949238106Sdesfunc_mode_compile () 1950238106Sdes{ 1951238106Sdes $opt_debug 1952238106Sdes # Get the compilation command and the source file. 1953238106Sdes base_compile= 1954238106Sdes srcfile="$nonopt" # always keep a non-empty value in "srcfile" 1955238106Sdes suppress_opt=yes 1956238106Sdes suppress_output= 1957238106Sdes arg_mode=normal 1958238106Sdes libobj= 1959238106Sdes later= 1960238106Sdes pie_flag= 1961238106Sdes 1962238106Sdes for arg 1963238106Sdes do 1964238106Sdes case $arg_mode in 1965238106Sdes arg ) 1966238106Sdes # do not "continue". Instead, add this to base_compile 1967238106Sdes lastarg="$arg" 1968238106Sdes arg_mode=normal 1969238106Sdes ;; 1970238106Sdes 1971238106Sdes target ) 1972238106Sdes libobj="$arg" 1973238106Sdes arg_mode=normal 1974238106Sdes continue 1975238106Sdes ;; 1976238106Sdes 1977238106Sdes normal ) 1978238106Sdes # Accept any command-line options. 1979238106Sdes case $arg in 1980238106Sdes -o) 1981238106Sdes test -n "$libobj" && \ 1982238106Sdes func_fatal_error "you cannot specify \`-o' more than once" 1983238106Sdes arg_mode=target 1984238106Sdes continue 1985238106Sdes ;; 1986238106Sdes 1987238106Sdes -pie | -fpie | -fPIE) 1988238106Sdes func_append pie_flag " $arg" 1989238106Sdes continue 1990238106Sdes ;; 1991238106Sdes 1992238106Sdes -shared | -static | -prefer-pic | -prefer-non-pic) 1993238106Sdes func_append later " $arg" 1994238106Sdes continue 1995238106Sdes ;; 1996238106Sdes 1997238106Sdes -no-suppress) 1998238106Sdes suppress_opt=no 1999238106Sdes continue 2000238106Sdes ;; 2001238106Sdes 2002238106Sdes -Xcompiler) 2003238106Sdes arg_mode=arg # the next one goes into the "base_compile" arg list 2004238106Sdes continue # The current "srcfile" will either be retained or 2005238106Sdes ;; # replaced later. I would guess that would be a bug. 2006238106Sdes 2007238106Sdes -Wc,*) 2008238106Sdes func_stripname '-Wc,' '' "$arg" 2009238106Sdes args=$func_stripname_result 2010238106Sdes lastarg= 2011238106Sdes save_ifs="$IFS"; IFS=',' 2012238106Sdes for arg in $args; do 2013238106Sdes IFS="$save_ifs" 2014238106Sdes func_append_quoted lastarg "$arg" 2015238106Sdes done 2016238106Sdes IFS="$save_ifs" 2017238106Sdes func_stripname ' ' '' "$lastarg" 2018238106Sdes lastarg=$func_stripname_result 2019238106Sdes 2020238106Sdes # Add the arguments to base_compile. 2021238106Sdes func_append base_compile " $lastarg" 2022238106Sdes continue 2023238106Sdes ;; 2024238106Sdes 2025238106Sdes *) 2026238106Sdes # Accept the current argument as the source file. 2027238106Sdes # The previous "srcfile" becomes the current argument. 2028238106Sdes # 2029238106Sdes lastarg="$srcfile" 2030238106Sdes srcfile="$arg" 2031238106Sdes ;; 2032238106Sdes esac # case $arg 2033238106Sdes ;; 2034238106Sdes esac # case $arg_mode 2035238106Sdes 2036238106Sdes # Aesthetically quote the previous argument. 2037238106Sdes func_append_quoted base_compile "$lastarg" 2038238106Sdes done # for arg 2039238106Sdes 2040238106Sdes case $arg_mode in 2041238106Sdes arg) 2042238106Sdes func_fatal_error "you must specify an argument for -Xcompile" 2043238106Sdes ;; 2044238106Sdes target) 2045238106Sdes func_fatal_error "you must specify a target with \`-o'" 2046238106Sdes ;; 2047238106Sdes *) 2048238106Sdes # Get the name of the library object. 2049238106Sdes test -z "$libobj" && { 2050238106Sdes func_basename "$srcfile" 2051238106Sdes libobj="$func_basename_result" 2052238106Sdes } 2053238106Sdes ;; 2054238106Sdes esac 2055238106Sdes 2056238106Sdes # Recognize several different file suffixes. 2057238106Sdes # If the user specifies -o file.o, it is replaced with file.lo 2058238106Sdes case $libobj in 2059238106Sdes *.[cCFSifmso] | \ 2060238106Sdes *.ada | *.adb | *.ads | *.asm | \ 2061238106Sdes *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 2062238106Sdes *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) 2063238106Sdes func_xform "$libobj" 2064238106Sdes libobj=$func_xform_result 2065238106Sdes ;; 2066238106Sdes esac 2067238106Sdes 2068238106Sdes case $libobj in 2069238106Sdes *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 2070238106Sdes *) 2071238106Sdes func_fatal_error "cannot determine name of library object from \`$libobj'" 2072238106Sdes ;; 2073238106Sdes esac 2074238106Sdes 2075238106Sdes func_infer_tag $base_compile 2076238106Sdes 2077238106Sdes for arg in $later; do 2078238106Sdes case $arg in 2079238106Sdes -shared) 2080238106Sdes test "$build_libtool_libs" != yes && \ 2081238106Sdes func_fatal_configuration "can not build a shared library" 2082238106Sdes build_old_libs=no 2083238106Sdes continue 2084238106Sdes ;; 2085238106Sdes 2086238106Sdes -static) 2087238106Sdes build_libtool_libs=no 2088238106Sdes build_old_libs=yes 2089238106Sdes continue 2090238106Sdes ;; 2091238106Sdes 2092238106Sdes -prefer-pic) 2093238106Sdes pic_mode=yes 2094238106Sdes continue 2095238106Sdes ;; 2096238106Sdes 2097238106Sdes -prefer-non-pic) 2098238106Sdes pic_mode=no 2099238106Sdes continue 2100238106Sdes ;; 2101238106Sdes esac 2102238106Sdes done 2103238106Sdes 2104238106Sdes func_quote_for_eval "$libobj" 2105238106Sdes test "X$libobj" != "X$func_quote_for_eval_result" \ 2106238106Sdes && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 2107238106Sdes && func_warning "libobj name \`$libobj' may not contain shell special characters." 2108238106Sdes func_dirname_and_basename "$obj" "/" "" 2109238106Sdes objname="$func_basename_result" 2110238106Sdes xdir="$func_dirname_result" 2111238106Sdes lobj=${xdir}$objdir/$objname 2112238106Sdes 2113238106Sdes test -z "$base_compile" && \ 2114238106Sdes func_fatal_help "you must specify a compilation command" 2115238106Sdes 2116238106Sdes # Delete any leftover library objects. 2117238106Sdes if test "$build_old_libs" = yes; then 2118238106Sdes removelist="$obj $lobj $libobj ${libobj}T" 2119238106Sdes else 2120238106Sdes removelist="$lobj $libobj ${libobj}T" 2121238106Sdes fi 2122238106Sdes 2123238106Sdes # On Cygwin there's no "real" PIC flag so we must build both object types 2124238106Sdes case $host_os in 2125238106Sdes cygwin* | mingw* | pw32* | os2* | cegcc*) 2126238106Sdes pic_mode=default 2127238106Sdes ;; 2128238106Sdes esac 2129238106Sdes if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 2130238106Sdes # non-PIC code in shared libraries is not supported 2131238106Sdes pic_mode=default 2132238106Sdes fi 2133238106Sdes 2134238106Sdes # Calculate the filename of the output object if compiler does 2135238106Sdes # not support -o with -c 2136238106Sdes if test "$compiler_c_o" = no; then 2137238106Sdes output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} 2138238106Sdes lockfile="$output_obj.lock" 2139238106Sdes else 2140238106Sdes output_obj= 2141238106Sdes need_locks=no 2142238106Sdes lockfile= 2143238106Sdes fi 2144238106Sdes 2145238106Sdes # Lock this critical section if it is needed 2146238106Sdes # We use this script file to make the link, it avoids creating a new file 2147238106Sdes if test "$need_locks" = yes; then 2148238106Sdes until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 2149238106Sdes func_echo "Waiting for $lockfile to be removed" 2150238106Sdes sleep 2 2151238106Sdes done 2152238106Sdes elif test "$need_locks" = warn; then 2153238106Sdes if test -f "$lockfile"; then 2154238106Sdes $ECHO "\ 2155238106Sdes*** ERROR, $lockfile exists and contains: 2156238106Sdes`cat $lockfile 2>/dev/null` 2157238106Sdes 2158238106SdesThis indicates that another process is trying to use the same 2159238106Sdestemporary object file, and libtool could not work around it because 2160238106Sdesyour compiler does not support \`-c' and \`-o' together. If you 2161238106Sdesrepeat this compilation, it may succeed, by chance, but you had better 2162238106Sdesavoid parallel builds (make -j) in this platform, or get a better 2163238106Sdescompiler." 2164238106Sdes 2165238106Sdes $opt_dry_run || $RM $removelist 2166238106Sdes exit $EXIT_FAILURE 2167238106Sdes fi 2168238106Sdes func_append removelist " $output_obj" 2169238106Sdes $ECHO "$srcfile" > "$lockfile" 2170238106Sdes fi 2171238106Sdes 2172238106Sdes $opt_dry_run || $RM $removelist 2173238106Sdes func_append removelist " $lockfile" 2174238106Sdes trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 2175238106Sdes 2176238106Sdes func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 2177238106Sdes srcfile=$func_to_tool_file_result 2178238106Sdes func_quote_for_eval "$srcfile" 2179238106Sdes qsrcfile=$func_quote_for_eval_result 2180238106Sdes 2181238106Sdes # Only build a PIC object if we are building libtool libraries. 2182238106Sdes if test "$build_libtool_libs" = yes; then 2183238106Sdes # Without this assignment, base_compile gets emptied. 2184238106Sdes fbsd_hideous_sh_bug=$base_compile 2185238106Sdes 2186238106Sdes if test "$pic_mode" != no; then 2187238106Sdes command="$base_compile $qsrcfile $pic_flag" 2188238106Sdes else 2189238106Sdes # Don't build PIC code 2190238106Sdes command="$base_compile $qsrcfile" 2191238106Sdes fi 2192238106Sdes 2193238106Sdes func_mkdir_p "$xdir$objdir" 2194238106Sdes 2195238106Sdes if test -z "$output_obj"; then 2196238106Sdes # Place PIC objects in $objdir 2197238106Sdes func_append command " -o $lobj" 2198238106Sdes fi 2199238106Sdes 2200238106Sdes func_show_eval_locale "$command" \ 2201238106Sdes 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 2202238106Sdes 2203238106Sdes if test "$need_locks" = warn && 2204238106Sdes test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2205238106Sdes $ECHO "\ 2206238106Sdes*** ERROR, $lockfile contains: 2207238106Sdes`cat $lockfile 2>/dev/null` 2208238106Sdes 2209238106Sdesbut it should contain: 2210238106Sdes$srcfile 2211238106Sdes 2212238106SdesThis indicates that another process is trying to use the same 2213238106Sdestemporary object file, and libtool could not work around it because 2214238106Sdesyour compiler does not support \`-c' and \`-o' together. If you 2215238106Sdesrepeat this compilation, it may succeed, by chance, but you had better 2216238106Sdesavoid parallel builds (make -j) in this platform, or get a better 2217238106Sdescompiler." 2218238106Sdes 2219238106Sdes $opt_dry_run || $RM $removelist 2220238106Sdes exit $EXIT_FAILURE 2221238106Sdes fi 2222238106Sdes 2223238106Sdes # Just move the object if needed, then go on to compile the next one 2224238106Sdes if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 2225238106Sdes func_show_eval '$MV "$output_obj" "$lobj"' \ 2226238106Sdes 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2227238106Sdes fi 2228238106Sdes 2229238106Sdes # Allow error messages only from the first compilation. 2230238106Sdes if test "$suppress_opt" = yes; then 2231238106Sdes suppress_output=' >/dev/null 2>&1' 2232238106Sdes fi 2233238106Sdes fi 2234238106Sdes 2235238106Sdes # Only build a position-dependent object if we build old libraries. 2236238106Sdes if test "$build_old_libs" = yes; then 2237238106Sdes if test "$pic_mode" != yes; then 2238238106Sdes # Don't build PIC code 2239238106Sdes command="$base_compile $qsrcfile$pie_flag" 2240238106Sdes else 2241238106Sdes command="$base_compile $qsrcfile $pic_flag" 2242238106Sdes fi 2243238106Sdes if test "$compiler_c_o" = yes; then 2244238106Sdes func_append command " -o $obj" 2245238106Sdes fi 2246238106Sdes 2247238106Sdes # Suppress compiler output if we already did a PIC compilation. 2248238106Sdes func_append command "$suppress_output" 2249238106Sdes func_show_eval_locale "$command" \ 2250238106Sdes '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 2251238106Sdes 2252238106Sdes if test "$need_locks" = warn && 2253238106Sdes test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 2254238106Sdes $ECHO "\ 2255238106Sdes*** ERROR, $lockfile contains: 2256238106Sdes`cat $lockfile 2>/dev/null` 2257238106Sdes 2258238106Sdesbut it should contain: 2259238106Sdes$srcfile 2260238106Sdes 2261238106SdesThis indicates that another process is trying to use the same 2262238106Sdestemporary object file, and libtool could not work around it because 2263238106Sdesyour compiler does not support \`-c' and \`-o' together. If you 2264238106Sdesrepeat this compilation, it may succeed, by chance, but you had better 2265238106Sdesavoid parallel builds (make -j) in this platform, or get a better 2266238106Sdescompiler." 2267238106Sdes 2268238106Sdes $opt_dry_run || $RM $removelist 2269238106Sdes exit $EXIT_FAILURE 2270238106Sdes fi 2271238106Sdes 2272238106Sdes # Just move the object if needed 2273238106Sdes if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 2274238106Sdes func_show_eval '$MV "$output_obj" "$obj"' \ 2275238106Sdes 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 2276238106Sdes fi 2277238106Sdes fi 2278238106Sdes 2279238106Sdes $opt_dry_run || { 2280238106Sdes func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 2281238106Sdes 2282238106Sdes # Unlock the critical section if it was locked 2283238106Sdes if test "$need_locks" != no; then 2284238106Sdes removelist=$lockfile 2285238106Sdes $RM "$lockfile" 2286238106Sdes fi 2287238106Sdes } 2288238106Sdes 2289238106Sdes exit $EXIT_SUCCESS 2290238106Sdes} 2291238106Sdes 2292238106Sdes$opt_help || { 2293238106Sdes test "$opt_mode" = compile && func_mode_compile ${1+"$@"} 2294238106Sdes} 2295238106Sdes 2296238106Sdesfunc_mode_help () 2297238106Sdes{ 2298238106Sdes # We need to display help for each of the modes. 2299238106Sdes case $opt_mode in 2300238106Sdes "") 2301238106Sdes # Generic help is extracted from the usage comments 2302238106Sdes # at the start of this file. 2303238106Sdes func_help 2304238106Sdes ;; 2305238106Sdes 2306238106Sdes clean) 2307238106Sdes $ECHO \ 2308238106Sdes"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 2309238106Sdes 2310238106SdesRemove files from the build directory. 2311238106Sdes 2312238106SdesRM is the name of the program to use to delete files associated with each FILE 2313238106Sdes(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2314238106Sdesto RM. 2315238106Sdes 2316238106SdesIf FILE is a libtool library, object or program, all the files associated 2317238106Sdeswith it are deleted. Otherwise, only FILE itself is deleted using RM." 2318238106Sdes ;; 2319238106Sdes 2320238106Sdes compile) 2321238106Sdes $ECHO \ 2322238106Sdes"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 2323238106Sdes 2324238106SdesCompile a source file into a libtool library object. 2325238106Sdes 2326238106SdesThis mode accepts the following additional options: 2327238106Sdes 2328238106Sdes -o OUTPUT-FILE set the output file name to OUTPUT-FILE 2329238106Sdes -no-suppress do not suppress compiler output for multiple passes 2330238106Sdes -prefer-pic try to build PIC objects only 2331238106Sdes -prefer-non-pic try to build non-PIC objects only 2332238106Sdes -shared do not build a \`.o' file suitable for static linking 2333238106Sdes -static only build a \`.o' file suitable for static linking 2334238106Sdes -Wc,FLAG pass FLAG directly to the compiler 2335238106Sdes 2336238106SdesCOMPILE-COMMAND is a command to be used in creating a \`standard' object file 2337238106Sdesfrom the given SOURCEFILE. 2338238106Sdes 2339238106SdesThe output file name is determined by removing the directory component from 2340238106SdesSOURCEFILE, then substituting the C source code suffix \`.c' with the 2341238106Sdeslibrary object suffix, \`.lo'." 2342238106Sdes ;; 2343238106Sdes 2344238106Sdes execute) 2345238106Sdes $ECHO \ 2346238106Sdes"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 2347238106Sdes 2348238106SdesAutomatically set library path, then run a program. 2349238106Sdes 2350238106SdesThis mode accepts the following additional options: 2351238106Sdes 2352238106Sdes -dlopen FILE add the directory containing FILE to the library path 2353238106Sdes 2354238106SdesThis mode sets the library path environment variable according to \`-dlopen' 2355238106Sdesflags. 2356238106Sdes 2357238106SdesIf any of the ARGS are libtool executable wrappers, then they are translated 2358238106Sdesinto their corresponding uninstalled binary, and any of their required library 2359238106Sdesdirectories are added to the library path. 2360238106Sdes 2361238106SdesThen, COMMAND is executed, with ARGS as arguments." 2362238106Sdes ;; 2363238106Sdes 2364238106Sdes finish) 2365238106Sdes $ECHO \ 2366238106Sdes"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 2367238106Sdes 2368238106SdesComplete the installation of libtool libraries. 2369238106Sdes 2370238106SdesEach LIBDIR is a directory that contains libtool libraries. 2371238106Sdes 2372238106SdesThe commands that this mode executes may require superuser privileges. Use 2373238106Sdesthe \`--dry-run' option if you just want to see what would be executed." 2374238106Sdes ;; 2375238106Sdes 2376238106Sdes install) 2377238106Sdes $ECHO \ 2378238106Sdes"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 2379238106Sdes 2380238106SdesInstall executables or libraries. 2381238106Sdes 2382238106SdesINSTALL-COMMAND is the installation command. The first component should be 2383238106Sdeseither the \`install' or \`cp' program. 2384238106Sdes 2385238106SdesThe following components of INSTALL-COMMAND are treated specially: 2386238106Sdes 2387238106Sdes -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 2388238106Sdes 2389238106SdesThe rest of the components are interpreted as arguments to that command (only 2390238106SdesBSD-compatible install options are recognized)." 2391238106Sdes ;; 2392238106Sdes 2393238106Sdes link) 2394238106Sdes $ECHO \ 2395238106Sdes"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 2396238106Sdes 2397238106SdesLink object files or libraries together to form another library, or to 2398238106Sdescreate an executable program. 2399238106Sdes 2400238106SdesLINK-COMMAND is a command using the C compiler that you would use to create 2401238106Sdesa program from several object files. 2402238106Sdes 2403238106SdesThe following components of LINK-COMMAND are treated specially: 2404238106Sdes 2405238106Sdes -all-static do not do any dynamic linking at all 2406238106Sdes -avoid-version do not add a version suffix if possible 2407238106Sdes -bindir BINDIR specify path to binaries directory (for systems where 2408238106Sdes libraries must be found in the PATH setting at runtime) 2409238106Sdes -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 2410238106Sdes -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 2411238106Sdes -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 2412238106Sdes -export-symbols SYMFILE 2413238106Sdes try to export only the symbols listed in SYMFILE 2414238106Sdes -export-symbols-regex REGEX 2415238106Sdes try to export only the symbols matching REGEX 2416238106Sdes -LLIBDIR search LIBDIR for required installed libraries 2417238106Sdes -lNAME OUTPUT-FILE requires the installed library libNAME 2418238106Sdes -module build a library that can dlopened 2419238106Sdes -no-fast-install disable the fast-install mode 2420238106Sdes -no-install link a not-installable executable 2421238106Sdes -no-undefined declare that a library does not refer to external symbols 2422238106Sdes -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 2423238106Sdes -objectlist FILE Use a list of object files found in FILE to specify objects 2424238106Sdes -precious-files-regex REGEX 2425238106Sdes don't remove output files matching REGEX 2426238106Sdes -release RELEASE specify package release information 2427238106Sdes -rpath LIBDIR the created library will eventually be installed in LIBDIR 2428238106Sdes -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 2429238106Sdes -shared only do dynamic linking of libtool libraries 2430238106Sdes -shrext SUFFIX override the standard shared library file extension 2431238106Sdes -static do not do any dynamic linking of uninstalled libtool libraries 2432238106Sdes -static-libtool-libs 2433238106Sdes do not do any dynamic linking of libtool libraries 2434238106Sdes -version-info CURRENT[:REVISION[:AGE]] 2435238106Sdes specify library version info [each variable defaults to 0] 2436238106Sdes -weak LIBNAME declare that the target provides the LIBNAME interface 2437238106Sdes -Wc,FLAG 2438238106Sdes -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 2439238106Sdes -Wl,FLAG 2440238106Sdes -Xlinker FLAG pass linker-specific FLAG directly to the linker 2441238106Sdes -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 2442238106Sdes 2443238106SdesAll other options (arguments beginning with \`-') are ignored. 2444238106Sdes 2445238106SdesEvery other argument is treated as a filename. Files ending in \`.la' are 2446238106Sdestreated as uninstalled libtool libraries, other files are standard or library 2447238106Sdesobject files. 2448238106Sdes 2449238106SdesIf the OUTPUT-FILE ends in \`.la', then a libtool library is created, 2450238106Sdesonly library objects (\`.lo' files) may be specified, and \`-rpath' is 2451238106Sdesrequired, except when creating a convenience library. 2452238106Sdes 2453238106SdesIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 2454238106Sdesusing \`ar' and \`ranlib', or on Windows using \`lib'. 2455238106Sdes 2456238106SdesIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 2457238106Sdesis created, otherwise an executable program is created." 2458238106Sdes ;; 2459238106Sdes 2460238106Sdes uninstall) 2461238106Sdes $ECHO \ 2462238106Sdes"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 2463238106Sdes 2464238106SdesRemove libraries from an installation directory. 2465238106Sdes 2466238106SdesRM is the name of the program to use to delete files associated with each FILE 2467238106Sdes(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 2468238106Sdesto RM. 2469238106Sdes 2470238106SdesIf FILE is a libtool library, all the files associated with it are deleted. 2471238106SdesOtherwise, only FILE itself is deleted using RM." 2472238106Sdes ;; 2473238106Sdes 2474238106Sdes *) 2475238106Sdes func_fatal_help "invalid operation mode \`$opt_mode'" 2476238106Sdes ;; 2477238106Sdes esac 2478238106Sdes 2479238106Sdes echo 2480238106Sdes $ECHO "Try \`$progname --help' for more information about other modes." 2481238106Sdes} 2482238106Sdes 2483238106Sdes# Now that we've collected a possible --mode arg, show help if necessary 2484238106Sdesif $opt_help; then 2485238106Sdes if test "$opt_help" = :; then 2486238106Sdes func_mode_help 2487238106Sdes else 2488238106Sdes { 2489238106Sdes func_help noexit 2490238106Sdes for opt_mode in compile link execute install finish uninstall clean; do 2491238106Sdes func_mode_help 2492238106Sdes done 2493238106Sdes } | sed -n '1p; 2,$s/^Usage:/ or: /p' 2494238106Sdes { 2495238106Sdes func_help noexit 2496238106Sdes for opt_mode in compile link execute install finish uninstall clean; do 2497238106Sdes echo 2498238106Sdes func_mode_help 2499238106Sdes done 2500238106Sdes } | 2501238106Sdes sed '1d 2502238106Sdes /^When reporting/,/^Report/{ 2503238106Sdes H 2504238106Sdes d 2505238106Sdes } 2506238106Sdes $x 2507238106Sdes /information about other modes/d 2508238106Sdes /more detailed .*MODE/d 2509238106Sdes s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 2510238106Sdes fi 2511238106Sdes exit $? 2512238106Sdesfi 2513238106Sdes 2514238106Sdes 2515238106Sdes# func_mode_execute arg... 2516238106Sdesfunc_mode_execute () 2517238106Sdes{ 2518238106Sdes $opt_debug 2519238106Sdes # The first argument is the command name. 2520238106Sdes cmd="$nonopt" 2521238106Sdes test -z "$cmd" && \ 2522238106Sdes func_fatal_help "you must specify a COMMAND" 2523238106Sdes 2524238106Sdes # Handle -dlopen flags immediately. 2525238106Sdes for file in $opt_dlopen; do 2526238106Sdes test -f "$file" \ 2527238106Sdes || func_fatal_help "\`$file' is not a file" 2528238106Sdes 2529238106Sdes dir= 2530238106Sdes case $file in 2531238106Sdes *.la) 2532238106Sdes func_resolve_sysroot "$file" 2533238106Sdes file=$func_resolve_sysroot_result 2534238106Sdes 2535238106Sdes # Check to see that this really is a libtool archive. 2536238106Sdes func_lalib_unsafe_p "$file" \ 2537238106Sdes || func_fatal_help "\`$lib' is not a valid libtool archive" 2538238106Sdes 2539238106Sdes # Read the libtool library. 2540238106Sdes dlname= 2541238106Sdes library_names= 2542238106Sdes func_source "$file" 2543238106Sdes 2544238106Sdes # Skip this library if it cannot be dlopened. 2545238106Sdes if test -z "$dlname"; then 2546238106Sdes # Warn if it was a shared library. 2547238106Sdes test -n "$library_names" && \ 2548238106Sdes func_warning "\`$file' was not linked with \`-export-dynamic'" 2549238106Sdes continue 2550238106Sdes fi 2551238106Sdes 2552238106Sdes func_dirname "$file" "" "." 2553238106Sdes dir="$func_dirname_result" 2554238106Sdes 2555238106Sdes if test -f "$dir/$objdir/$dlname"; then 2556238106Sdes func_append dir "/$objdir" 2557238106Sdes else 2558238106Sdes if test ! -f "$dir/$dlname"; then 2559238106Sdes func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 2560238106Sdes fi 2561238106Sdes fi 2562238106Sdes ;; 2563238106Sdes 2564238106Sdes *.lo) 2565238106Sdes # Just add the directory containing the .lo file. 2566238106Sdes func_dirname "$file" "" "." 2567238106Sdes dir="$func_dirname_result" 2568238106Sdes ;; 2569238106Sdes 2570238106Sdes *) 2571238106Sdes func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 2572238106Sdes continue 2573238106Sdes ;; 2574238106Sdes esac 2575238106Sdes 2576238106Sdes # Get the absolute pathname. 2577238106Sdes absdir=`cd "$dir" && pwd` 2578238106Sdes test -n "$absdir" && dir="$absdir" 2579238106Sdes 2580238106Sdes # Now add the directory to shlibpath_var. 2581238106Sdes if eval "test -z \"\$$shlibpath_var\""; then 2582238106Sdes eval "$shlibpath_var=\"\$dir\"" 2583238106Sdes else 2584238106Sdes eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 2585238106Sdes fi 2586238106Sdes done 2587238106Sdes 2588238106Sdes # This variable tells wrapper scripts just to set shlibpath_var 2589238106Sdes # rather than running their programs. 2590238106Sdes libtool_execute_magic="$magic" 2591238106Sdes 2592238106Sdes # Check if any of the arguments is a wrapper script. 2593238106Sdes args= 2594238106Sdes for file 2595238106Sdes do 2596238106Sdes case $file in 2597238106Sdes -* | *.la | *.lo ) ;; 2598238106Sdes *) 2599238106Sdes # Do a test to see if this is really a libtool program. 2600238106Sdes if func_ltwrapper_script_p "$file"; then 2601238106Sdes func_source "$file" 2602238106Sdes # Transform arg to wrapped name. 2603238106Sdes file="$progdir/$program" 2604238106Sdes elif func_ltwrapper_executable_p "$file"; then 2605238106Sdes func_ltwrapper_scriptname "$file" 2606238106Sdes func_source "$func_ltwrapper_scriptname_result" 2607238106Sdes # Transform arg to wrapped name. 2608238106Sdes file="$progdir/$program" 2609238106Sdes fi 2610238106Sdes ;; 2611238106Sdes esac 2612238106Sdes # Quote arguments (to preserve shell metacharacters). 2613238106Sdes func_append_quoted args "$file" 2614238106Sdes done 2615238106Sdes 2616238106Sdes if test "X$opt_dry_run" = Xfalse; then 2617238106Sdes if test -n "$shlibpath_var"; then 2618238106Sdes # Export the shlibpath_var. 2619238106Sdes eval "export $shlibpath_var" 2620238106Sdes fi 2621238106Sdes 2622238106Sdes # Restore saved environment variables 2623238106Sdes for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 2624238106Sdes do 2625238106Sdes eval "if test \"\${save_$lt_var+set}\" = set; then 2626238106Sdes $lt_var=\$save_$lt_var; export $lt_var 2627238106Sdes else 2628238106Sdes $lt_unset $lt_var 2629238106Sdes fi" 2630238106Sdes done 2631238106Sdes 2632238106Sdes # Now prepare to actually exec the command. 2633238106Sdes exec_cmd="\$cmd$args" 2634238106Sdes else 2635238106Sdes # Display what would be done. 2636238106Sdes if test -n "$shlibpath_var"; then 2637238106Sdes eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 2638238106Sdes echo "export $shlibpath_var" 2639238106Sdes fi 2640238106Sdes $ECHO "$cmd$args" 2641238106Sdes exit $EXIT_SUCCESS 2642238106Sdes fi 2643238106Sdes} 2644238106Sdes 2645238106Sdestest "$opt_mode" = execute && func_mode_execute ${1+"$@"} 2646238106Sdes 2647238106Sdes 2648238106Sdes# func_mode_finish arg... 2649238106Sdesfunc_mode_finish () 2650238106Sdes{ 2651238106Sdes $opt_debug 2652238106Sdes libs= 2653238106Sdes libdirs= 2654238106Sdes admincmds= 2655238106Sdes 2656238106Sdes for opt in "$nonopt" ${1+"$@"} 2657238106Sdes do 2658238106Sdes if test -d "$opt"; then 2659238106Sdes func_append libdirs " $opt" 2660238106Sdes 2661238106Sdes elif test -f "$opt"; then 2662238106Sdes if func_lalib_unsafe_p "$opt"; then 2663238106Sdes func_append libs " $opt" 2664238106Sdes else 2665238106Sdes func_warning "\`$opt' is not a valid libtool archive" 2666238106Sdes fi 2667238106Sdes 2668238106Sdes else 2669238106Sdes func_fatal_error "invalid argument \`$opt'" 2670238106Sdes fi 2671238106Sdes done 2672238106Sdes 2673238106Sdes if test -n "$libs"; then 2674238106Sdes if test -n "$lt_sysroot"; then 2675238106Sdes sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 2676238106Sdes sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 2677238106Sdes else 2678238106Sdes sysroot_cmd= 2679238106Sdes fi 2680238106Sdes 2681238106Sdes # Remove sysroot references 2682238106Sdes if $opt_dry_run; then 2683238106Sdes for lib in $libs; do 2684238106Sdes echo "removing references to $lt_sysroot and \`=' prefixes from $lib" 2685238106Sdes done 2686238106Sdes else 2687238106Sdes tmpdir=`func_mktempdir` 2688238106Sdes for lib in $libs; do 2689238106Sdes sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 2690238106Sdes > $tmpdir/tmp-la 2691238106Sdes mv -f $tmpdir/tmp-la $lib 2692238106Sdes done 2693238106Sdes ${RM}r "$tmpdir" 2694238106Sdes fi 2695238106Sdes fi 2696238106Sdes 2697238106Sdes if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2698238106Sdes for libdir in $libdirs; do 2699238106Sdes if test -n "$finish_cmds"; then 2700238106Sdes # Do each command in the finish commands. 2701238106Sdes func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 2702238106Sdes'"$cmd"'"' 2703238106Sdes fi 2704238106Sdes if test -n "$finish_eval"; then 2705238106Sdes # Do the single finish_eval. 2706238106Sdes eval cmds=\"$finish_eval\" 2707238106Sdes $opt_dry_run || eval "$cmds" || func_append admincmds " 2708238106Sdes $cmds" 2709238106Sdes fi 2710238106Sdes done 2711238106Sdes fi 2712238106Sdes 2713238106Sdes # Exit here if they wanted silent mode. 2714238106Sdes $opt_silent && exit $EXIT_SUCCESS 2715238106Sdes 2716238106Sdes if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 2717238106Sdes echo "----------------------------------------------------------------------" 2718238106Sdes echo "Libraries have been installed in:" 2719238106Sdes for libdir in $libdirs; do 2720238106Sdes $ECHO " $libdir" 2721238106Sdes done 2722238106Sdes echo 2723238106Sdes echo "If you ever happen to want to link against installed libraries" 2724238106Sdes echo "in a given directory, LIBDIR, you must either use libtool, and" 2725238106Sdes echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 2726238106Sdes echo "flag during linking and do at least one of the following:" 2727238106Sdes if test -n "$shlibpath_var"; then 2728238106Sdes echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 2729238106Sdes echo " during execution" 2730238106Sdes fi 2731238106Sdes if test -n "$runpath_var"; then 2732238106Sdes echo " - add LIBDIR to the \`$runpath_var' environment variable" 2733238106Sdes echo " during linking" 2734238106Sdes fi 2735238106Sdes if test -n "$hardcode_libdir_flag_spec"; then 2736238106Sdes libdir=LIBDIR 2737238106Sdes eval flag=\"$hardcode_libdir_flag_spec\" 2738238106Sdes 2739238106Sdes $ECHO " - use the \`$flag' linker flag" 2740238106Sdes fi 2741238106Sdes if test -n "$admincmds"; then 2742238106Sdes $ECHO " - have your system administrator run these commands:$admincmds" 2743238106Sdes fi 2744238106Sdes if test -f /etc/ld.so.conf; then 2745238106Sdes echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 2746238106Sdes fi 2747238106Sdes echo 2748238106Sdes 2749238106Sdes echo "See any operating system documentation about shared libraries for" 2750238106Sdes case $host in 2751238106Sdes solaris2.[6789]|solaris2.1[0-9]) 2752238106Sdes echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 2753238106Sdes echo "pages." 2754238106Sdes ;; 2755238106Sdes *) 2756238106Sdes echo "more information, such as the ld(1) and ld.so(8) manual pages." 2757238106Sdes ;; 2758238106Sdes esac 2759238106Sdes echo "----------------------------------------------------------------------" 2760238106Sdes fi 2761238106Sdes exit $EXIT_SUCCESS 2762238106Sdes} 2763238106Sdes 2764238106Sdestest "$opt_mode" = finish && func_mode_finish ${1+"$@"} 2765238106Sdes 2766238106Sdes 2767238106Sdes# func_mode_install arg... 2768238106Sdesfunc_mode_install () 2769238106Sdes{ 2770238106Sdes $opt_debug 2771238106Sdes # There may be an optional sh(1) argument at the beginning of 2772238106Sdes # install_prog (especially on Windows NT). 2773238106Sdes if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 2774238106Sdes # Allow the use of GNU shtool's install command. 2775238106Sdes case $nonopt in *shtool*) :;; *) false;; esac; then 2776238106Sdes # Aesthetically quote it. 2777238106Sdes func_quote_for_eval "$nonopt" 2778238106Sdes install_prog="$func_quote_for_eval_result " 2779238106Sdes arg=$1 2780238106Sdes shift 2781238106Sdes else 2782238106Sdes install_prog= 2783238106Sdes arg=$nonopt 2784238106Sdes fi 2785238106Sdes 2786238106Sdes # The real first argument should be the name of the installation program. 2787238106Sdes # Aesthetically quote it. 2788238106Sdes func_quote_for_eval "$arg" 2789238106Sdes func_append install_prog "$func_quote_for_eval_result" 2790238106Sdes install_shared_prog=$install_prog 2791238106Sdes case " $install_prog " in 2792238106Sdes *[\\\ /]cp\ *) install_cp=: ;; 2793238106Sdes *) install_cp=false ;; 2794238106Sdes esac 2795238106Sdes 2796238106Sdes # We need to accept at least all the BSD install flags. 2797238106Sdes dest= 2798238106Sdes files= 2799238106Sdes opts= 2800238106Sdes prev= 2801238106Sdes install_type= 2802238106Sdes isdir=no 2803238106Sdes stripme= 2804238106Sdes no_mode=: 2805238106Sdes for arg 2806238106Sdes do 2807238106Sdes arg2= 2808238106Sdes if test -n "$dest"; then 2809238106Sdes func_append files " $dest" 2810238106Sdes dest=$arg 2811238106Sdes continue 2812238106Sdes fi 2813238106Sdes 2814238106Sdes case $arg in 2815238106Sdes -d) isdir=yes ;; 2816238106Sdes -f) 2817238106Sdes if $install_cp; then :; else 2818238106Sdes prev=$arg 2819238106Sdes fi 2820238106Sdes ;; 2821238106Sdes -g | -m | -o) 2822238106Sdes prev=$arg 2823238106Sdes ;; 2824238106Sdes -s) 2825238106Sdes stripme=" -s" 2826238106Sdes continue 2827238106Sdes ;; 2828238106Sdes -*) 2829238106Sdes ;; 2830238106Sdes *) 2831238106Sdes # If the previous option needed an argument, then skip it. 2832238106Sdes if test -n "$prev"; then 2833238106Sdes if test "x$prev" = x-m && test -n "$install_override_mode"; then 2834238106Sdes arg2=$install_override_mode 2835238106Sdes no_mode=false 2836238106Sdes fi 2837238106Sdes prev= 2838238106Sdes else 2839238106Sdes dest=$arg 2840238106Sdes continue 2841238106Sdes fi 2842238106Sdes ;; 2843238106Sdes esac 2844238106Sdes 2845238106Sdes # Aesthetically quote the argument. 2846238106Sdes func_quote_for_eval "$arg" 2847238106Sdes func_append install_prog " $func_quote_for_eval_result" 2848238106Sdes if test -n "$arg2"; then 2849238106Sdes func_quote_for_eval "$arg2" 2850238106Sdes fi 2851238106Sdes func_append install_shared_prog " $func_quote_for_eval_result" 2852238106Sdes done 2853238106Sdes 2854238106Sdes test -z "$install_prog" && \ 2855238106Sdes func_fatal_help "you must specify an install program" 2856238106Sdes 2857238106Sdes test -n "$prev" && \ 2858238106Sdes func_fatal_help "the \`$prev' option requires an argument" 2859238106Sdes 2860238106Sdes if test -n "$install_override_mode" && $no_mode; then 2861238106Sdes if $install_cp; then :; else 2862238106Sdes func_quote_for_eval "$install_override_mode" 2863238106Sdes func_append install_shared_prog " -m $func_quote_for_eval_result" 2864238106Sdes fi 2865238106Sdes fi 2866238106Sdes 2867238106Sdes if test -z "$files"; then 2868238106Sdes if test -z "$dest"; then 2869238106Sdes func_fatal_help "no file or destination specified" 2870238106Sdes else 2871238106Sdes func_fatal_help "you must specify a destination" 2872238106Sdes fi 2873238106Sdes fi 2874238106Sdes 2875238106Sdes # Strip any trailing slash from the destination. 2876238106Sdes func_stripname '' '/' "$dest" 2877238106Sdes dest=$func_stripname_result 2878238106Sdes 2879238106Sdes # Check to see that the destination is a directory. 2880238106Sdes test -d "$dest" && isdir=yes 2881238106Sdes if test "$isdir" = yes; then 2882238106Sdes destdir="$dest" 2883238106Sdes destname= 2884238106Sdes else 2885238106Sdes func_dirname_and_basename "$dest" "" "." 2886238106Sdes destdir="$func_dirname_result" 2887238106Sdes destname="$func_basename_result" 2888238106Sdes 2889238106Sdes # Not a directory, so check to see that there is only one file specified. 2890238106Sdes set dummy $files; shift 2891238106Sdes test "$#" -gt 1 && \ 2892238106Sdes func_fatal_help "\`$dest' is not a directory" 2893238106Sdes fi 2894238106Sdes case $destdir in 2895238106Sdes [\\/]* | [A-Za-z]:[\\/]*) ;; 2896238106Sdes *) 2897238106Sdes for file in $files; do 2898238106Sdes case $file in 2899238106Sdes *.lo) ;; 2900238106Sdes *) 2901238106Sdes func_fatal_help "\`$destdir' must be an absolute directory name" 2902238106Sdes ;; 2903238106Sdes esac 2904238106Sdes done 2905238106Sdes ;; 2906238106Sdes esac 2907238106Sdes 2908238106Sdes # This variable tells wrapper scripts just to set variables rather 2909238106Sdes # than running their programs. 2910238106Sdes libtool_install_magic="$magic" 2911238106Sdes 2912238106Sdes staticlibs= 2913238106Sdes future_libdirs= 2914238106Sdes current_libdirs= 2915238106Sdes for file in $files; do 2916238106Sdes 2917238106Sdes # Do each installation. 2918238106Sdes case $file in 2919238106Sdes *.$libext) 2920238106Sdes # Do the static libraries later. 2921238106Sdes func_append staticlibs " $file" 2922238106Sdes ;; 2923238106Sdes 2924238106Sdes *.la) 2925238106Sdes func_resolve_sysroot "$file" 2926238106Sdes file=$func_resolve_sysroot_result 2927238106Sdes 2928238106Sdes # Check to see that this really is a libtool archive. 2929238106Sdes func_lalib_unsafe_p "$file" \ 2930238106Sdes || func_fatal_help "\`$file' is not a valid libtool archive" 2931238106Sdes 2932238106Sdes library_names= 2933238106Sdes old_library= 2934238106Sdes relink_command= 2935238106Sdes func_source "$file" 2936238106Sdes 2937238106Sdes # Add the libdir to current_libdirs if it is the destination. 2938238106Sdes if test "X$destdir" = "X$libdir"; then 2939238106Sdes case "$current_libdirs " in 2940238106Sdes *" $libdir "*) ;; 2941238106Sdes *) func_append current_libdirs " $libdir" ;; 2942238106Sdes esac 2943238106Sdes else 2944238106Sdes # Note the libdir as a future libdir. 2945238106Sdes case "$future_libdirs " in 2946238106Sdes *" $libdir "*) ;; 2947238106Sdes *) func_append future_libdirs " $libdir" ;; 2948238106Sdes esac 2949238106Sdes fi 2950238106Sdes 2951238106Sdes func_dirname "$file" "/" "" 2952238106Sdes dir="$func_dirname_result" 2953238106Sdes func_append dir "$objdir" 2954238106Sdes 2955238106Sdes if test -n "$relink_command"; then 2956238106Sdes # Determine the prefix the user has applied to our future dir. 2957238106Sdes inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 2958238106Sdes 2959238106Sdes # Don't allow the user to place us outside of our expected 2960238106Sdes # location b/c this prevents finding dependent libraries that 2961238106Sdes # are installed to the same prefix. 2962238106Sdes # At present, this check doesn't affect windows .dll's that 2963238106Sdes # are installed into $libdir/../bin (currently, that works fine) 2964238106Sdes # but it's something to keep an eye on. 2965238106Sdes test "$inst_prefix_dir" = "$destdir" && \ 2966238106Sdes func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" 2967238106Sdes 2968238106Sdes if test -n "$inst_prefix_dir"; then 2969238106Sdes # Stick the inst_prefix_dir data into the link command. 2970238106Sdes relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 2971238106Sdes else 2972238106Sdes relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 2973238106Sdes fi 2974238106Sdes 2975238106Sdes func_warning "relinking \`$file'" 2976238106Sdes func_show_eval "$relink_command" \ 2977238106Sdes 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' 2978238106Sdes fi 2979238106Sdes 2980238106Sdes # See the names of the shared library. 2981238106Sdes set dummy $library_names; shift 2982238106Sdes if test -n "$1"; then 2983238106Sdes realname="$1" 2984238106Sdes shift 2985238106Sdes 2986238106Sdes srcname="$realname" 2987238106Sdes test -n "$relink_command" && srcname="$realname"T 2988238106Sdes 2989238106Sdes # Install the shared library and build the symlinks. 2990238106Sdes func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 2991238106Sdes 'exit $?' 2992238106Sdes tstripme="$stripme" 2993238106Sdes case $host_os in 2994238106Sdes cygwin* | mingw* | pw32* | cegcc*) 2995238106Sdes case $realname in 2996238106Sdes *.dll.a) 2997238106Sdes tstripme="" 2998238106Sdes ;; 2999238106Sdes esac 3000238106Sdes ;; 3001238106Sdes esac 3002238106Sdes if test -n "$tstripme" && test -n "$striplib"; then 3003238106Sdes func_show_eval "$striplib $destdir/$realname" 'exit $?' 3004238106Sdes fi 3005238106Sdes 3006238106Sdes if test "$#" -gt 0; then 3007238106Sdes # Delete the old symlinks, and create new ones. 3008238106Sdes # Try `ln -sf' first, because the `ln' binary might depend on 3009238106Sdes # the symlink we replace! Solaris /bin/ln does not understand -f, 3010238106Sdes # so we also need to try rm && ln -s. 3011238106Sdes for linkname 3012238106Sdes do 3013238106Sdes test "$linkname" != "$realname" \ 3014238106Sdes && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 3015238106Sdes done 3016238106Sdes fi 3017238106Sdes 3018238106Sdes # Do each command in the postinstall commands. 3019238106Sdes lib="$destdir/$realname" 3020238106Sdes func_execute_cmds "$postinstall_cmds" 'exit $?' 3021238106Sdes fi 3022238106Sdes 3023238106Sdes # Install the pseudo-library for information purposes. 3024238106Sdes func_basename "$file" 3025238106Sdes name="$func_basename_result" 3026238106Sdes instname="$dir/$name"i 3027238106Sdes func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 3028238106Sdes 3029238106Sdes # Maybe install the static library, too. 3030238106Sdes test -n "$old_library" && func_append staticlibs " $dir/$old_library" 3031238106Sdes ;; 3032238106Sdes 3033238106Sdes *.lo) 3034238106Sdes # Install (i.e. copy) a libtool object. 3035238106Sdes 3036238106Sdes # Figure out destination file name, if it wasn't already specified. 3037238106Sdes if test -n "$destname"; then 3038238106Sdes destfile="$destdir/$destname" 3039238106Sdes else 3040238106Sdes func_basename "$file" 3041238106Sdes destfile="$func_basename_result" 3042238106Sdes destfile="$destdir/$destfile" 3043238106Sdes fi 3044238106Sdes 3045238106Sdes # Deduce the name of the destination old-style object file. 3046238106Sdes case $destfile in 3047238106Sdes *.lo) 3048238106Sdes func_lo2o "$destfile" 3049238106Sdes staticdest=$func_lo2o_result 3050238106Sdes ;; 3051238106Sdes *.$objext) 3052238106Sdes staticdest="$destfile" 3053238106Sdes destfile= 3054238106Sdes ;; 3055238106Sdes *) 3056238106Sdes func_fatal_help "cannot copy a libtool object to \`$destfile'" 3057238106Sdes ;; 3058238106Sdes esac 3059238106Sdes 3060238106Sdes # Install the libtool object if requested. 3061238106Sdes test -n "$destfile" && \ 3062238106Sdes func_show_eval "$install_prog $file $destfile" 'exit $?' 3063238106Sdes 3064238106Sdes # Install the old object if enabled. 3065238106Sdes if test "$build_old_libs" = yes; then 3066238106Sdes # Deduce the name of the old-style object file. 3067238106Sdes func_lo2o "$file" 3068238106Sdes staticobj=$func_lo2o_result 3069238106Sdes func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 3070238106Sdes fi 3071238106Sdes exit $EXIT_SUCCESS 3072238106Sdes ;; 3073238106Sdes 3074238106Sdes *) 3075238106Sdes # Figure out destination file name, if it wasn't already specified. 3076238106Sdes if test -n "$destname"; then 3077238106Sdes destfile="$destdir/$destname" 3078238106Sdes else 3079238106Sdes func_basename "$file" 3080238106Sdes destfile="$func_basename_result" 3081238106Sdes destfile="$destdir/$destfile" 3082238106Sdes fi 3083238106Sdes 3084238106Sdes # If the file is missing, and there is a .exe on the end, strip it 3085238106Sdes # because it is most likely a libtool script we actually want to 3086238106Sdes # install 3087238106Sdes stripped_ext="" 3088238106Sdes case $file in 3089238106Sdes *.exe) 3090238106Sdes if test ! -f "$file"; then 3091238106Sdes func_stripname '' '.exe' "$file" 3092238106Sdes file=$func_stripname_result 3093238106Sdes stripped_ext=".exe" 3094238106Sdes fi 3095238106Sdes ;; 3096238106Sdes esac 3097238106Sdes 3098238106Sdes # Do a test to see if this is really a libtool program. 3099238106Sdes case $host in 3100238106Sdes *cygwin* | *mingw*) 3101238106Sdes if func_ltwrapper_executable_p "$file"; then 3102238106Sdes func_ltwrapper_scriptname "$file" 3103238106Sdes wrapper=$func_ltwrapper_scriptname_result 3104238106Sdes else 3105238106Sdes func_stripname '' '.exe' "$file" 3106238106Sdes wrapper=$func_stripname_result 3107238106Sdes fi 3108238106Sdes ;; 3109238106Sdes *) 3110238106Sdes wrapper=$file 3111238106Sdes ;; 3112238106Sdes esac 3113238106Sdes if func_ltwrapper_script_p "$wrapper"; then 3114238106Sdes notinst_deplibs= 3115238106Sdes relink_command= 3116238106Sdes 3117238106Sdes func_source "$wrapper" 3118238106Sdes 3119238106Sdes # Check the variables that should have been set. 3120238106Sdes test -z "$generated_by_libtool_version" && \ 3121238106Sdes func_fatal_error "invalid libtool wrapper script \`$wrapper'" 3122238106Sdes 3123238106Sdes finalize=yes 3124238106Sdes for lib in $notinst_deplibs; do 3125238106Sdes # Check to see that each library is installed. 3126238106Sdes libdir= 3127238106Sdes if test -f "$lib"; then 3128238106Sdes func_source "$lib" 3129238106Sdes fi 3130238106Sdes libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test 3131238106Sdes if test -n "$libdir" && test ! -f "$libfile"; then 3132238106Sdes func_warning "\`$lib' has not been installed in \`$libdir'" 3133238106Sdes finalize=no 3134238106Sdes fi 3135238106Sdes done 3136238106Sdes 3137238106Sdes relink_command= 3138238106Sdes func_source "$wrapper" 3139238106Sdes 3140238106Sdes outputname= 3141238106Sdes if test "$fast_install" = no && test -n "$relink_command"; then 3142238106Sdes $opt_dry_run || { 3143238106Sdes if test "$finalize" = yes; then 3144238106Sdes tmpdir=`func_mktempdir` 3145238106Sdes func_basename "$file$stripped_ext" 3146238106Sdes file="$func_basename_result" 3147238106Sdes outputname="$tmpdir/$file" 3148238106Sdes # Replace the output file specification. 3149238106Sdes relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 3150238106Sdes 3151238106Sdes $opt_silent || { 3152238106Sdes func_quote_for_expand "$relink_command" 3153238106Sdes eval "func_echo $func_quote_for_expand_result" 3154238106Sdes } 3155238106Sdes if eval "$relink_command"; then : 3156238106Sdes else 3157238106Sdes func_error "error: relink \`$file' with the above command before installing it" 3158238106Sdes $opt_dry_run || ${RM}r "$tmpdir" 3159238106Sdes continue 3160238106Sdes fi 3161238106Sdes file="$outputname" 3162238106Sdes else 3163238106Sdes func_warning "cannot relink \`$file'" 3164238106Sdes fi 3165238106Sdes } 3166238106Sdes else 3167238106Sdes # Install the binary that we compiled earlier. 3168238106Sdes file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 3169238106Sdes fi 3170238106Sdes fi 3171238106Sdes 3172238106Sdes # remove .exe since cygwin /usr/bin/install will append another 3173238106Sdes # one anyway 3174238106Sdes case $install_prog,$host in 3175238106Sdes */usr/bin/install*,*cygwin*) 3176238106Sdes case $file:$destfile in 3177238106Sdes *.exe:*.exe) 3178238106Sdes # this is ok 3179238106Sdes ;; 3180238106Sdes *.exe:*) 3181238106Sdes destfile=$destfile.exe 3182238106Sdes ;; 3183238106Sdes *:*.exe) 3184238106Sdes func_stripname '' '.exe' "$destfile" 3185238106Sdes destfile=$func_stripname_result 3186238106Sdes ;; 3187238106Sdes esac 3188238106Sdes ;; 3189238106Sdes esac 3190238106Sdes func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 3191238106Sdes $opt_dry_run || if test -n "$outputname"; then 3192238106Sdes ${RM}r "$tmpdir" 3193238106Sdes fi 3194238106Sdes ;; 3195238106Sdes esac 3196238106Sdes done 3197238106Sdes 3198238106Sdes for file in $staticlibs; do 3199238106Sdes func_basename "$file" 3200238106Sdes name="$func_basename_result" 3201238106Sdes 3202238106Sdes # Set up the ranlib parameters. 3203238106Sdes oldlib="$destdir/$name" 3204238106Sdes 3205238106Sdes func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 3206238106Sdes 3207238106Sdes if test -n "$stripme" && test -n "$old_striplib"; then 3208238106Sdes func_show_eval "$old_striplib $oldlib" 'exit $?' 3209238106Sdes fi 3210238106Sdes 3211238106Sdes # Do each command in the postinstall commands. 3212238106Sdes func_execute_cmds "$old_postinstall_cmds" 'exit $?' 3213238106Sdes done 3214238106Sdes 3215238106Sdes test -n "$future_libdirs" && \ 3216238106Sdes func_warning "remember to run \`$progname --finish$future_libdirs'" 3217238106Sdes 3218238106Sdes if test -n "$current_libdirs"; then 3219238106Sdes # Maybe just do a dry run. 3220238106Sdes $opt_dry_run && current_libdirs=" -n$current_libdirs" 3221238106Sdes exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 3222238106Sdes else 3223238106Sdes exit $EXIT_SUCCESS 3224238106Sdes fi 3225238106Sdes} 3226238106Sdes 3227238106Sdestest "$opt_mode" = install && func_mode_install ${1+"$@"} 3228238106Sdes 3229238106Sdes 3230238106Sdes# func_generate_dlsyms outputname originator pic_p 3231238106Sdes# Extract symbols from dlprefiles and create ${outputname}S.o with 3232238106Sdes# a dlpreopen symbol table. 3233238106Sdesfunc_generate_dlsyms () 3234238106Sdes{ 3235238106Sdes $opt_debug 3236238106Sdes my_outputname="$1" 3237238106Sdes my_originator="$2" 3238238106Sdes my_pic_p="${3-no}" 3239238106Sdes my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` 3240238106Sdes my_dlsyms= 3241238106Sdes 3242238106Sdes if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3243238106Sdes if test -n "$NM" && test -n "$global_symbol_pipe"; then 3244238106Sdes my_dlsyms="${my_outputname}S.c" 3245238106Sdes else 3246238106Sdes func_error "not configured to extract global symbols from dlpreopened files" 3247238106Sdes fi 3248238106Sdes fi 3249238106Sdes 3250238106Sdes if test -n "$my_dlsyms"; then 3251238106Sdes case $my_dlsyms in 3252238106Sdes "") ;; 3253238106Sdes *.c) 3254238106Sdes # Discover the nlist of each of the dlfiles. 3255238106Sdes nlist="$output_objdir/${my_outputname}.nm" 3256238106Sdes 3257238106Sdes func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 3258238106Sdes 3259238106Sdes # Parse the name list into a source file. 3260238106Sdes func_verbose "creating $output_objdir/$my_dlsyms" 3261238106Sdes 3262238106Sdes $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 3263238106Sdes/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ 3264238106Sdes/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ 3265238106Sdes 3266238106Sdes#ifdef __cplusplus 3267238106Sdesextern \"C\" { 3268238106Sdes#endif 3269238106Sdes 3270238106Sdes#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 3271238106Sdes#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 3272238106Sdes#endif 3273238106Sdes 3274238106Sdes/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 3275238106Sdes#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) 3276238106Sdes/* DATA imports from DLLs on WIN32 con't be const, because runtime 3277238106Sdes relocations are performed -- see ld's documentation on pseudo-relocs. */ 3278238106Sdes# define LT_DLSYM_CONST 3279238106Sdes#elif defined(__osf__) 3280238106Sdes/* This system does not cope well with relocations in const data. */ 3281238106Sdes# define LT_DLSYM_CONST 3282238106Sdes#else 3283238106Sdes# define LT_DLSYM_CONST const 3284238106Sdes#endif 3285238106Sdes 3286238106Sdes/* External symbol declarations for the compiler. */\ 3287238106Sdes" 3288238106Sdes 3289238106Sdes if test "$dlself" = yes; then 3290238106Sdes func_verbose "generating symbol list for \`$output'" 3291238106Sdes 3292238106Sdes $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 3293238106Sdes 3294238106Sdes # Add our own program objects to the symbol list. 3295238106Sdes progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 3296238106Sdes for progfile in $progfiles; do 3297238106Sdes func_to_tool_file "$progfile" func_convert_file_msys_to_w32 3298238106Sdes func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" 3299238106Sdes $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 3300238106Sdes done 3301238106Sdes 3302238106Sdes if test -n "$exclude_expsyms"; then 3303238106Sdes $opt_dry_run || { 3304238106Sdes eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 3305238106Sdes eval '$MV "$nlist"T "$nlist"' 3306238106Sdes } 3307238106Sdes fi 3308238106Sdes 3309238106Sdes if test -n "$export_symbols_regex"; then 3310238106Sdes $opt_dry_run || { 3311238106Sdes eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 3312238106Sdes eval '$MV "$nlist"T "$nlist"' 3313238106Sdes } 3314238106Sdes fi 3315238106Sdes 3316238106Sdes # Prepare the list of exported symbols 3317238106Sdes if test -z "$export_symbols"; then 3318238106Sdes export_symbols="$output_objdir/$outputname.exp" 3319238106Sdes $opt_dry_run || { 3320238106Sdes $RM $export_symbols 3321238106Sdes eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 3322238106Sdes case $host in 3323238106Sdes *cygwin* | *mingw* | *cegcc* ) 3324238106Sdes eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3325238106Sdes eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 3326238106Sdes ;; 3327238106Sdes esac 3328238106Sdes } 3329238106Sdes else 3330238106Sdes $opt_dry_run || { 3331238106Sdes eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 3332238106Sdes eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 3333238106Sdes eval '$MV "$nlist"T "$nlist"' 3334238106Sdes case $host in 3335238106Sdes *cygwin* | *mingw* | *cegcc* ) 3336238106Sdes eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 3337238106Sdes eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 3338238106Sdes ;; 3339238106Sdes esac 3340238106Sdes } 3341238106Sdes fi 3342238106Sdes fi 3343238106Sdes 3344238106Sdes for dlprefile in $dlprefiles; do 3345238106Sdes func_verbose "extracting global C symbols from \`$dlprefile'" 3346238106Sdes func_basename "$dlprefile" 3347238106Sdes name="$func_basename_result" 3348238106Sdes case $host in 3349238106Sdes *cygwin* | *mingw* | *cegcc* ) 3350238106Sdes # if an import library, we need to obtain dlname 3351238106Sdes if func_win32_import_lib_p "$dlprefile"; then 3352238106Sdes func_tr_sh "$dlprefile" 3353238106Sdes eval "curr_lafile=\$libfile_$func_tr_sh_result" 3354238106Sdes dlprefile_dlbasename="" 3355238106Sdes if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 3356238106Sdes # Use subshell, to avoid clobbering current variable values 3357238106Sdes dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 3358238106Sdes if test -n "$dlprefile_dlname" ; then 3359238106Sdes func_basename "$dlprefile_dlname" 3360238106Sdes dlprefile_dlbasename="$func_basename_result" 3361238106Sdes else 3362238106Sdes # no lafile. user explicitly requested -dlpreopen <import library>. 3363238106Sdes $sharedlib_from_linklib_cmd "$dlprefile" 3364238106Sdes dlprefile_dlbasename=$sharedlib_from_linklib_result 3365238106Sdes fi 3366238106Sdes fi 3367238106Sdes $opt_dry_run || { 3368238106Sdes if test -n "$dlprefile_dlbasename" ; then 3369238106Sdes eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 3370238106Sdes else 3371238106Sdes func_warning "Could not compute DLL name from $name" 3372238106Sdes eval '$ECHO ": $name " >> "$nlist"' 3373238106Sdes fi 3374238106Sdes func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3375238106Sdes eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 3376238106Sdes $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 3377238106Sdes } 3378238106Sdes else # not an import lib 3379238106Sdes $opt_dry_run || { 3380238106Sdes eval '$ECHO ": $name " >> "$nlist"' 3381238106Sdes func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3382238106Sdes eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 3383238106Sdes } 3384238106Sdes fi 3385238106Sdes ;; 3386238106Sdes *) 3387238106Sdes $opt_dry_run || { 3388238106Sdes eval '$ECHO ": $name " >> "$nlist"' 3389238106Sdes func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 3390238106Sdes eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 3391238106Sdes } 3392238106Sdes ;; 3393238106Sdes esac 3394238106Sdes done 3395238106Sdes 3396238106Sdes $opt_dry_run || { 3397238106Sdes # Make sure we have at least an empty file. 3398238106Sdes test -f "$nlist" || : > "$nlist" 3399238106Sdes 3400238106Sdes if test -n "$exclude_expsyms"; then 3401238106Sdes $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 3402238106Sdes $MV "$nlist"T "$nlist" 3403238106Sdes fi 3404238106Sdes 3405238106Sdes # Try sorting and uniquifying the output. 3406238106Sdes if $GREP -v "^: " < "$nlist" | 3407238106Sdes if sort -k 3 </dev/null >/dev/null 2>&1; then 3408238106Sdes sort -k 3 3409238106Sdes else 3410238106Sdes sort +2 3411238106Sdes fi | 3412238106Sdes uniq > "$nlist"S; then 3413238106Sdes : 3414238106Sdes else 3415238106Sdes $GREP -v "^: " < "$nlist" > "$nlist"S 3416238106Sdes fi 3417238106Sdes 3418238106Sdes if test -f "$nlist"S; then 3419238106Sdes eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 3420238106Sdes else 3421238106Sdes echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 3422238106Sdes fi 3423238106Sdes 3424238106Sdes echo >> "$output_objdir/$my_dlsyms" "\ 3425238106Sdes 3426238106Sdes/* The mapping between symbol names and symbols. */ 3427238106Sdestypedef struct { 3428238106Sdes const char *name; 3429238106Sdes void *address; 3430238106Sdes} lt_dlsymlist; 3431238106Sdesextern LT_DLSYM_CONST lt_dlsymlist 3432238106Sdeslt_${my_prefix}_LTX_preloaded_symbols[]; 3433238106SdesLT_DLSYM_CONST lt_dlsymlist 3434238106Sdeslt_${my_prefix}_LTX_preloaded_symbols[] = 3435238106Sdes{\ 3436238106Sdes { \"$my_originator\", (void *) 0 }," 3437238106Sdes 3438238106Sdes case $need_lib_prefix in 3439238106Sdes no) 3440238106Sdes eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 3441238106Sdes ;; 3442238106Sdes *) 3443238106Sdes eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 3444238106Sdes ;; 3445238106Sdes esac 3446238106Sdes echo >> "$output_objdir/$my_dlsyms" "\ 3447238106Sdes {0, (void *) 0} 3448238106Sdes}; 3449238106Sdes 3450238106Sdes/* This works around a problem in FreeBSD linker */ 3451238106Sdes#ifdef FREEBSD_WORKAROUND 3452238106Sdesstatic const void *lt_preloaded_setup() { 3453238106Sdes return lt_${my_prefix}_LTX_preloaded_symbols; 3454238106Sdes} 3455238106Sdes#endif 3456238106Sdes 3457238106Sdes#ifdef __cplusplus 3458238106Sdes} 3459238106Sdes#endif\ 3460238106Sdes" 3461238106Sdes } # !$opt_dry_run 3462238106Sdes 3463238106Sdes pic_flag_for_symtable= 3464238106Sdes case "$compile_command " in 3465238106Sdes *" -static "*) ;; 3466238106Sdes *) 3467238106Sdes case $host in 3468238106Sdes # compiling the symbol table file with pic_flag works around 3469238106Sdes # a FreeBSD bug that causes programs to crash when -lm is 3470238106Sdes # linked before any other PIC object. But we must not use 3471238106Sdes # pic_flag when linking with -static. The problem exists in 3472238106Sdes # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 3473238106Sdes *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 3474238106Sdes pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 3475238106Sdes *-*-hpux*) 3476238106Sdes pic_flag_for_symtable=" $pic_flag" ;; 3477238106Sdes *) 3478238106Sdes if test "X$my_pic_p" != Xno; then 3479238106Sdes pic_flag_for_symtable=" $pic_flag" 3480238106Sdes fi 3481238106Sdes ;; 3482238106Sdes esac 3483238106Sdes ;; 3484238106Sdes esac 3485238106Sdes symtab_cflags= 3486238106Sdes for arg in $LTCFLAGS; do 3487238106Sdes case $arg in 3488238106Sdes -pie | -fpie | -fPIE) ;; 3489238106Sdes *) func_append symtab_cflags " $arg" ;; 3490238106Sdes esac 3491238106Sdes done 3492238106Sdes 3493238106Sdes # Now compile the dynamic symbol file. 3494238106Sdes func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 3495238106Sdes 3496238106Sdes # Clean up the generated files. 3497238106Sdes func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' 3498238106Sdes 3499238106Sdes # Transform the symbol file into the correct name. 3500238106Sdes symfileobj="$output_objdir/${my_outputname}S.$objext" 3501238106Sdes case $host in 3502238106Sdes *cygwin* | *mingw* | *cegcc* ) 3503238106Sdes if test -f "$output_objdir/$my_outputname.def"; then 3504238106Sdes compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3505238106Sdes finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 3506238106Sdes else 3507238106Sdes compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3508238106Sdes finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3509238106Sdes fi 3510238106Sdes ;; 3511238106Sdes *) 3512238106Sdes compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3513238106Sdes finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 3514238106Sdes ;; 3515238106Sdes esac 3516238106Sdes ;; 3517238106Sdes *) 3518238106Sdes func_fatal_error "unknown suffix for \`$my_dlsyms'" 3519238106Sdes ;; 3520238106Sdes esac 3521238106Sdes else 3522238106Sdes # We keep going just in case the user didn't refer to 3523238106Sdes # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 3524238106Sdes # really was required. 3525238106Sdes 3526238106Sdes # Nullify the symbol file. 3527238106Sdes compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 3528238106Sdes finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 3529238106Sdes fi 3530238106Sdes} 3531238106Sdes 3532238106Sdes# func_win32_libid arg 3533238106Sdes# return the library type of file 'arg' 3534238106Sdes# 3535238106Sdes# Need a lot of goo to handle *both* DLLs and import libs 3536238106Sdes# Has to be a shell function in order to 'eat' the argument 3537238106Sdes# that is supplied when $file_magic_command is called. 3538238106Sdes# Despite the name, also deal with 64 bit binaries. 3539238106Sdesfunc_win32_libid () 3540238106Sdes{ 3541238106Sdes $opt_debug 3542238106Sdes win32_libid_type="unknown" 3543238106Sdes win32_fileres=`file -L $1 2>/dev/null` 3544238106Sdes case $win32_fileres in 3545238106Sdes *ar\ archive\ import\ library*) # definitely import 3546238106Sdes win32_libid_type="x86 archive import" 3547238106Sdes ;; 3548238106Sdes *ar\ archive*) # could be an import, or static 3549238106Sdes # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 3550238106Sdes if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 3551238106Sdes $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 3552238106Sdes func_to_tool_file "$1" func_convert_file_msys_to_w32 3553238106Sdes win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 3554238106Sdes $SED -n -e ' 3555238106Sdes 1,100{ 3556238106Sdes / I /{ 3557238106Sdes s,.*,import, 3558238106Sdes p 3559238106Sdes q 3560238106Sdes } 3561238106Sdes }'` 3562238106Sdes case $win32_nmres in 3563238106Sdes import*) win32_libid_type="x86 archive import";; 3564238106Sdes *) win32_libid_type="x86 archive static";; 3565238106Sdes esac 3566238106Sdes fi 3567238106Sdes ;; 3568238106Sdes *DLL*) 3569238106Sdes win32_libid_type="x86 DLL" 3570238106Sdes ;; 3571238106Sdes *executable*) # but shell scripts are "executable" too... 3572238106Sdes case $win32_fileres in 3573238106Sdes *MS\ Windows\ PE\ Intel*) 3574238106Sdes win32_libid_type="x86 DLL" 3575238106Sdes ;; 3576238106Sdes esac 3577238106Sdes ;; 3578238106Sdes esac 3579238106Sdes $ECHO "$win32_libid_type" 3580238106Sdes} 3581238106Sdes 3582238106Sdes# func_cygming_dll_for_implib ARG 3583238106Sdes# 3584238106Sdes# Platform-specific function to extract the 3585238106Sdes# name of the DLL associated with the specified 3586238106Sdes# import library ARG. 3587238106Sdes# Invoked by eval'ing the libtool variable 3588238106Sdes# $sharedlib_from_linklib_cmd 3589238106Sdes# Result is available in the variable 3590238106Sdes# $sharedlib_from_linklib_result 3591238106Sdesfunc_cygming_dll_for_implib () 3592238106Sdes{ 3593238106Sdes $opt_debug 3594238106Sdes sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 3595238106Sdes} 3596238106Sdes 3597238106Sdes# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 3598238106Sdes# 3599238106Sdes# The is the core of a fallback implementation of a 3600238106Sdes# platform-specific function to extract the name of the 3601238106Sdes# DLL associated with the specified import library LIBNAME. 3602238106Sdes# 3603238106Sdes# SECTION_NAME is either .idata$6 or .idata$7, depending 3604238106Sdes# on the platform and compiler that created the implib. 3605238106Sdes# 3606238106Sdes# Echos the name of the DLL associated with the 3607238106Sdes# specified import library. 3608238106Sdesfunc_cygming_dll_for_implib_fallback_core () 3609238106Sdes{ 3610238106Sdes $opt_debug 3611238106Sdes match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 3612238106Sdes $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 3613238106Sdes $SED '/^Contents of section '"$match_literal"':/{ 3614238106Sdes # Place marker at beginning of archive member dllname section 3615238106Sdes s/.*/====MARK====/ 3616238106Sdes p 3617238106Sdes d 3618238106Sdes } 3619238106Sdes # These lines can sometimes be longer than 43 characters, but 3620238106Sdes # are always uninteresting 3621238106Sdes /:[ ]*file format pe[i]\{,1\}-/d 3622238106Sdes /^In archive [^:]*:/d 3623238106Sdes # Ensure marker is printed 3624238106Sdes /^====MARK====/p 3625238106Sdes # Remove all lines with less than 43 characters 3626238106Sdes /^.\{43\}/!d 3627238106Sdes # From remaining lines, remove first 43 characters 3628238106Sdes s/^.\{43\}//' | 3629238106Sdes $SED -n ' 3630238106Sdes # Join marker and all lines until next marker into a single line 3631238106Sdes /^====MARK====/ b para 3632238106Sdes H 3633238106Sdes $ b para 3634238106Sdes b 3635238106Sdes :para 3636238106Sdes x 3637238106Sdes s/\n//g 3638238106Sdes # Remove the marker 3639238106Sdes s/^====MARK====// 3640238106Sdes # Remove trailing dots and whitespace 3641238106Sdes s/[\. \t]*$// 3642238106Sdes # Print 3643238106Sdes /./p' | 3644238106Sdes # we now have a list, one entry per line, of the stringified 3645238106Sdes # contents of the appropriate section of all members of the 3646238106Sdes # archive which possess that section. Heuristic: eliminate 3647238106Sdes # all those which have a first or second character that is 3648238106Sdes # a '.' (that is, objdump's representation of an unprintable 3649238106Sdes # character.) This should work for all archives with less than 3650238106Sdes # 0x302f exports -- but will fail for DLLs whose name actually 3651238106Sdes # begins with a literal '.' or a single character followed by 3652238106Sdes # a '.'. 3653238106Sdes # 3654238106Sdes # Of those that remain, print the first one. 3655238106Sdes $SED -e '/^\./d;/^.\./d;q' 3656238106Sdes} 3657238106Sdes 3658238106Sdes# func_cygming_gnu_implib_p ARG 3659238106Sdes# This predicate returns with zero status (TRUE) if 3660238106Sdes# ARG is a GNU/binutils-style import library. Returns 3661238106Sdes# with nonzero status (FALSE) otherwise. 3662238106Sdesfunc_cygming_gnu_implib_p () 3663238106Sdes{ 3664238106Sdes $opt_debug 3665238106Sdes func_to_tool_file "$1" func_convert_file_msys_to_w32 3666238106Sdes func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` 3667238106Sdes test -n "$func_cygming_gnu_implib_tmp" 3668238106Sdes} 3669238106Sdes 3670238106Sdes# func_cygming_ms_implib_p ARG 3671238106Sdes# This predicate returns with zero status (TRUE) if 3672238106Sdes# ARG is an MS-style import library. Returns 3673238106Sdes# with nonzero status (FALSE) otherwise. 3674238106Sdesfunc_cygming_ms_implib_p () 3675238106Sdes{ 3676238106Sdes $opt_debug 3677238106Sdes func_to_tool_file "$1" func_convert_file_msys_to_w32 3678238106Sdes func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 3679238106Sdes test -n "$func_cygming_ms_implib_tmp" 3680238106Sdes} 3681238106Sdes 3682238106Sdes# func_cygming_dll_for_implib_fallback ARG 3683238106Sdes# Platform-specific function to extract the 3684238106Sdes# name of the DLL associated with the specified 3685238106Sdes# import library ARG. 3686238106Sdes# 3687238106Sdes# This fallback implementation is for use when $DLLTOOL 3688238106Sdes# does not support the --identify-strict option. 3689238106Sdes# Invoked by eval'ing the libtool variable 3690238106Sdes# $sharedlib_from_linklib_cmd 3691238106Sdes# Result is available in the variable 3692238106Sdes# $sharedlib_from_linklib_result 3693238106Sdesfunc_cygming_dll_for_implib_fallback () 3694238106Sdes{ 3695238106Sdes $opt_debug 3696238106Sdes if func_cygming_gnu_implib_p "$1" ; then 3697238106Sdes # binutils import library 3698238106Sdes sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 3699238106Sdes elif func_cygming_ms_implib_p "$1" ; then 3700238106Sdes # ms-generated import library 3701238106Sdes sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 3702238106Sdes else 3703238106Sdes # unknown 3704238106Sdes sharedlib_from_linklib_result="" 3705238106Sdes fi 3706238106Sdes} 3707238106Sdes 3708238106Sdes 3709238106Sdes# func_extract_an_archive dir oldlib 3710238106Sdesfunc_extract_an_archive () 3711238106Sdes{ 3712238106Sdes $opt_debug 3713238106Sdes f_ex_an_ar_dir="$1"; shift 3714238106Sdes f_ex_an_ar_oldlib="$1" 3715238106Sdes if test "$lock_old_archive_extraction" = yes; then 3716238106Sdes lockfile=$f_ex_an_ar_oldlib.lock 3717238106Sdes until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 3718238106Sdes func_echo "Waiting for $lockfile to be removed" 3719238106Sdes sleep 2 3720238106Sdes done 3721238106Sdes fi 3722238106Sdes func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 3723238106Sdes 'stat=$?; rm -f "$lockfile"; exit $stat' 3724238106Sdes if test "$lock_old_archive_extraction" = yes; then 3725238106Sdes $opt_dry_run || rm -f "$lockfile" 3726238106Sdes fi 3727238106Sdes if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 3728238106Sdes : 3729238106Sdes else 3730238106Sdes func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 3731238106Sdes fi 3732238106Sdes} 3733238106Sdes 3734238106Sdes 3735238106Sdes# func_extract_archives gentop oldlib ... 3736238106Sdesfunc_extract_archives () 3737238106Sdes{ 3738238106Sdes $opt_debug 3739238106Sdes my_gentop="$1"; shift 3740238106Sdes my_oldlibs=${1+"$@"} 3741238106Sdes my_oldobjs="" 3742238106Sdes my_xlib="" 3743238106Sdes my_xabs="" 3744238106Sdes my_xdir="" 3745238106Sdes 3746238106Sdes for my_xlib in $my_oldlibs; do 3747238106Sdes # Extract the objects. 3748238106Sdes case $my_xlib in 3749238106Sdes [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 3750238106Sdes *) my_xabs=`pwd`"/$my_xlib" ;; 3751238106Sdes esac 3752238106Sdes func_basename "$my_xlib" 3753238106Sdes my_xlib="$func_basename_result" 3754238106Sdes my_xlib_u=$my_xlib 3755238106Sdes while :; do 3756238106Sdes case " $extracted_archives " in 3757238106Sdes *" $my_xlib_u "*) 3758238106Sdes func_arith $extracted_serial + 1 3759238106Sdes extracted_serial=$func_arith_result 3760238106Sdes my_xlib_u=lt$extracted_serial-$my_xlib ;; 3761238106Sdes *) break ;; 3762238106Sdes esac 3763238106Sdes done 3764238106Sdes extracted_archives="$extracted_archives $my_xlib_u" 3765238106Sdes my_xdir="$my_gentop/$my_xlib_u" 3766238106Sdes 3767238106Sdes func_mkdir_p "$my_xdir" 3768238106Sdes 3769238106Sdes case $host in 3770238106Sdes *-darwin*) 3771238106Sdes func_verbose "Extracting $my_xabs" 3772238106Sdes # Do not bother doing anything if just a dry run 3773238106Sdes $opt_dry_run || { 3774238106Sdes darwin_orig_dir=`pwd` 3775238106Sdes cd $my_xdir || exit $? 3776238106Sdes darwin_archive=$my_xabs 3777238106Sdes darwin_curdir=`pwd` 3778238106Sdes darwin_base_archive=`basename "$darwin_archive"` 3779238106Sdes darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 3780238106Sdes if test -n "$darwin_arches"; then 3781238106Sdes darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 3782238106Sdes darwin_arch= 3783238106Sdes func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 3784238106Sdes for darwin_arch in $darwin_arches ; do 3785238106Sdes func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3786238106Sdes $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 3787238106Sdes cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 3788238106Sdes func_extract_an_archive "`pwd`" "${darwin_base_archive}" 3789238106Sdes cd "$darwin_curdir" 3790238106Sdes $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 3791238106Sdes done # $darwin_arches 3792238106Sdes ## Okay now we've a bunch of thin objects, gotta fatten them up :) 3793238106Sdes darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` 3794238106Sdes darwin_file= 3795238106Sdes darwin_files= 3796238106Sdes for darwin_file in $darwin_filelist; do 3797238106Sdes darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 3798238106Sdes $LIPO -create -output "$darwin_file" $darwin_files 3799238106Sdes done # $darwin_filelist 3800238106Sdes $RM -rf unfat-$$ 3801238106Sdes cd "$darwin_orig_dir" 3802238106Sdes else 3803238106Sdes cd $darwin_orig_dir 3804238106Sdes func_extract_an_archive "$my_xdir" "$my_xabs" 3805238106Sdes fi # $darwin_arches 3806238106Sdes } # !$opt_dry_run 3807238106Sdes ;; 3808238106Sdes *) 3809238106Sdes func_extract_an_archive "$my_xdir" "$my_xabs" 3810238106Sdes ;; 3811238106Sdes esac 3812238106Sdes my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 3813238106Sdes done 3814238106Sdes 3815238106Sdes func_extract_archives_result="$my_oldobjs" 3816238106Sdes} 3817238106Sdes 3818238106Sdes 3819238106Sdes# func_emit_wrapper [arg=no] 3820238106Sdes# 3821238106Sdes# Emit a libtool wrapper script on stdout. 3822238106Sdes# Don't directly open a file because we may want to 3823238106Sdes# incorporate the script contents within a cygwin/mingw 3824238106Sdes# wrapper executable. Must ONLY be called from within 3825238106Sdes# func_mode_link because it depends on a number of variables 3826238106Sdes# set therein. 3827238106Sdes# 3828238106Sdes# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 3829238106Sdes# variable will take. If 'yes', then the emitted script 3830238106Sdes# will assume that the directory in which it is stored is 3831238106Sdes# the $objdir directory. This is a cygwin/mingw-specific 3832238106Sdes# behavior. 3833238106Sdesfunc_emit_wrapper () 3834238106Sdes{ 3835238106Sdes func_emit_wrapper_arg1=${1-no} 3836238106Sdes 3837238106Sdes $ECHO "\ 3838238106Sdes#! $SHELL 3839238106Sdes 3840238106Sdes# $output - temporary wrapper script for $objdir/$outputname 3841238106Sdes# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 3842238106Sdes# 3843238106Sdes# The $output program cannot be directly executed until all the libtool 3844238106Sdes# libraries that it depends on are installed. 3845238106Sdes# 3846238106Sdes# This wrapper script should never be moved out of the build directory. 3847238106Sdes# If it is, it will not operate correctly. 3848238106Sdes 3849238106Sdes# Sed substitution that helps us do robust quoting. It backslashifies 3850238106Sdes# metacharacters that are still active within double-quoted strings. 3851238106Sdessed_quote_subst='$sed_quote_subst' 3852238106Sdes 3853238106Sdes# Be Bourne compatible 3854238106Sdesif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 3855238106Sdes emulate sh 3856238106Sdes NULLCMD=: 3857238106Sdes # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 3858238106Sdes # is contrary to our usage. Disable this feature. 3859238106Sdes alias -g '\${1+\"\$@\"}'='\"\$@\"' 3860238106Sdes setopt NO_GLOB_SUBST 3861238106Sdeselse 3862238106Sdes case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 3863238106Sdesfi 3864238106SdesBIN_SH=xpg4; export BIN_SH # for Tru64 3865238106SdesDUALCASE=1; export DUALCASE # for MKS sh 3866238106Sdes 3867238106Sdes# The HP-UX ksh and POSIX shell print the target directory to stdout 3868238106Sdes# if CDPATH is set. 3869238106Sdes(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 3870238106Sdes 3871238106Sdesrelink_command=\"$relink_command\" 3872238106Sdes 3873238106Sdes# This environment variable determines our operation mode. 3874238106Sdesif test \"\$libtool_install_magic\" = \"$magic\"; then 3875238106Sdes # install mode needs the following variables: 3876238106Sdes generated_by_libtool_version='$macro_version' 3877238106Sdes notinst_deplibs='$notinst_deplibs' 3878238106Sdeselse 3879238106Sdes # When we are sourced in execute mode, \$file and \$ECHO are already set. 3880238106Sdes if test \"\$libtool_execute_magic\" != \"$magic\"; then 3881238106Sdes file=\"\$0\"" 3882238106Sdes 3883238106Sdes qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 3884238106Sdes $ECHO "\ 3885238106Sdes 3886238106Sdes# A function that is used when there is no print builtin or printf. 3887238106Sdesfunc_fallback_echo () 3888238106Sdes{ 3889238106Sdes eval 'cat <<_LTECHO_EOF 3890238106Sdes\$1 3891238106Sdes_LTECHO_EOF' 3892238106Sdes} 3893238106Sdes ECHO=\"$qECHO\" 3894238106Sdes fi 3895238106Sdes 3896238106Sdes# Very basic option parsing. These options are (a) specific to 3897238106Sdes# the libtool wrapper, (b) are identical between the wrapper 3898238106Sdes# /script/ and the wrapper /executable/ which is used only on 3899238106Sdes# windows platforms, and (c) all begin with the string "--lt-" 3900238106Sdes# (application programs are unlikely to have options which match 3901238106Sdes# this pattern). 3902238106Sdes# 3903238106Sdes# There are only two supported options: --lt-debug and 3904238106Sdes# --lt-dump-script. There is, deliberately, no --lt-help. 3905238106Sdes# 3906238106Sdes# The first argument to this parsing function should be the 3907238106Sdes# script's $0 value, followed by "$@". 3908238106Sdeslt_option_debug= 3909238106Sdesfunc_parse_lt_options () 3910238106Sdes{ 3911238106Sdes lt_script_arg0=\$0 3912238106Sdes shift 3913238106Sdes for lt_opt 3914238106Sdes do 3915238106Sdes case \"\$lt_opt\" in 3916238106Sdes --lt-debug) lt_option_debug=1 ;; 3917238106Sdes --lt-dump-script) 3918238106Sdes lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 3919238106Sdes test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 3920238106Sdes lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 3921238106Sdes cat \"\$lt_dump_D/\$lt_dump_F\" 3922238106Sdes exit 0 3923238106Sdes ;; 3924238106Sdes --lt-*) 3925238106Sdes \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 3926238106Sdes exit 1 3927238106Sdes ;; 3928238106Sdes esac 3929238106Sdes done 3930238106Sdes 3931238106Sdes # Print the debug banner immediately: 3932238106Sdes if test -n \"\$lt_option_debug\"; then 3933238106Sdes echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 3934238106Sdes fi 3935238106Sdes} 3936238106Sdes 3937238106Sdes# Used when --lt-debug. Prints its arguments to stdout 3938238106Sdes# (redirection is the responsibility of the caller) 3939238106Sdesfunc_lt_dump_args () 3940238106Sdes{ 3941238106Sdes lt_dump_args_N=1; 3942238106Sdes for lt_arg 3943238106Sdes do 3944238106Sdes \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" 3945238106Sdes lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 3946238106Sdes done 3947238106Sdes} 3948238106Sdes 3949238106Sdes# Core function for launching the target application 3950238106Sdesfunc_exec_program_core () 3951238106Sdes{ 3952238106Sdes" 3953238106Sdes case $host in 3954238106Sdes # Backslashes separate directories on plain windows 3955238106Sdes *-*-mingw | *-*-os2* | *-cegcc*) 3956238106Sdes $ECHO "\ 3957238106Sdes if test -n \"\$lt_option_debug\"; then 3958238106Sdes \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 3959238106Sdes func_lt_dump_args \${1+\"\$@\"} 1>&2 3960238106Sdes fi 3961238106Sdes exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 3962238106Sdes" 3963238106Sdes ;; 3964238106Sdes 3965238106Sdes *) 3966238106Sdes $ECHO "\ 3967238106Sdes if test -n \"\$lt_option_debug\"; then 3968238106Sdes \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 3969238106Sdes func_lt_dump_args \${1+\"\$@\"} 1>&2 3970238106Sdes fi 3971238106Sdes exec \"\$progdir/\$program\" \${1+\"\$@\"} 3972238106Sdes" 3973238106Sdes ;; 3974238106Sdes esac 3975238106Sdes $ECHO "\ 3976238106Sdes \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 3977238106Sdes exit 1 3978238106Sdes} 3979238106Sdes 3980238106Sdes# A function to encapsulate launching the target application 3981238106Sdes# Strips options in the --lt-* namespace from \$@ and 3982238106Sdes# launches target application with the remaining arguments. 3983238106Sdesfunc_exec_program () 3984238106Sdes{ 3985238106Sdes for lt_wr_arg 3986238106Sdes do 3987238106Sdes case \$lt_wr_arg in 3988238106Sdes --lt-*) ;; 3989238106Sdes *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 3990238106Sdes esac 3991238106Sdes shift 3992238106Sdes done 3993238106Sdes func_exec_program_core \${1+\"\$@\"} 3994238106Sdes} 3995238106Sdes 3996238106Sdes # Parse options 3997238106Sdes func_parse_lt_options \"\$0\" \${1+\"\$@\"} 3998238106Sdes 3999238106Sdes # Find the directory that this script lives in. 4000238106Sdes thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 4001238106Sdes test \"x\$thisdir\" = \"x\$file\" && thisdir=. 4002238106Sdes 4003238106Sdes # Follow symbolic links until we get to the real thisdir. 4004238106Sdes file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 4005238106Sdes while test -n \"\$file\"; do 4006238106Sdes destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 4007238106Sdes 4008238106Sdes # If there was a directory component, then change thisdir. 4009238106Sdes if test \"x\$destdir\" != \"x\$file\"; then 4010238106Sdes case \"\$destdir\" in 4011238106Sdes [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 4012238106Sdes *) thisdir=\"\$thisdir/\$destdir\" ;; 4013238106Sdes esac 4014238106Sdes fi 4015238106Sdes 4016238106Sdes file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 4017238106Sdes file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 4018238106Sdes done 4019238106Sdes 4020238106Sdes # Usually 'no', except on cygwin/mingw when embedded into 4021238106Sdes # the cwrapper. 4022238106Sdes WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 4023238106Sdes if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 4024238106Sdes # special case for '.' 4025238106Sdes if test \"\$thisdir\" = \".\"; then 4026238106Sdes thisdir=\`pwd\` 4027238106Sdes fi 4028238106Sdes # remove .libs from thisdir 4029238106Sdes case \"\$thisdir\" in 4030238106Sdes *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 4031238106Sdes $objdir ) thisdir=. ;; 4032238106Sdes esac 4033238106Sdes fi 4034238106Sdes 4035238106Sdes # Try to get the absolute directory name. 4036238106Sdes absdir=\`cd \"\$thisdir\" && pwd\` 4037238106Sdes test -n \"\$absdir\" && thisdir=\"\$absdir\" 4038238106Sdes" 4039238106Sdes 4040238106Sdes if test "$fast_install" = yes; then 4041238106Sdes $ECHO "\ 4042238106Sdes program=lt-'$outputname'$exeext 4043238106Sdes progdir=\"\$thisdir/$objdir\" 4044238106Sdes 4045238106Sdes if test ! -f \"\$progdir/\$program\" || 4046238106Sdes { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 4047238106Sdes test \"X\$file\" != \"X\$progdir/\$program\"; }; then 4048238106Sdes 4049238106Sdes file=\"\$\$-\$program\" 4050238106Sdes 4051238106Sdes if test ! -d \"\$progdir\"; then 4052238106Sdes $MKDIR \"\$progdir\" 4053238106Sdes else 4054238106Sdes $RM \"\$progdir/\$file\" 4055238106Sdes fi" 4056238106Sdes 4057238106Sdes $ECHO "\ 4058238106Sdes 4059238106Sdes # relink executable if necessary 4060238106Sdes if test -n \"\$relink_command\"; then 4061238106Sdes if relink_command_output=\`eval \$relink_command 2>&1\`; then : 4062238106Sdes else 4063238106Sdes $ECHO \"\$relink_command_output\" >&2 4064238106Sdes $RM \"\$progdir/\$file\" 4065238106Sdes exit 1 4066238106Sdes fi 4067238106Sdes fi 4068238106Sdes 4069238106Sdes $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 4070238106Sdes { $RM \"\$progdir/\$program\"; 4071238106Sdes $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 4072238106Sdes $RM \"\$progdir/\$file\" 4073238106Sdes fi" 4074238106Sdes else 4075238106Sdes $ECHO "\ 4076238106Sdes program='$outputname' 4077238106Sdes progdir=\"\$thisdir/$objdir\" 4078238106Sdes" 4079238106Sdes fi 4080238106Sdes 4081238106Sdes $ECHO "\ 4082238106Sdes 4083238106Sdes if test -f \"\$progdir/\$program\"; then" 4084238106Sdes 4085238106Sdes # fixup the dll searchpath if we need to. 4086238106Sdes # 4087238106Sdes # Fix the DLL searchpath if we need to. Do this before prepending 4088238106Sdes # to shlibpath, because on Windows, both are PATH and uninstalled 4089238106Sdes # libraries must come first. 4090238106Sdes if test -n "$dllsearchpath"; then 4091238106Sdes $ECHO "\ 4092238106Sdes # Add the dll search path components to the executable PATH 4093238106Sdes PATH=$dllsearchpath:\$PATH 4094238106Sdes" 4095238106Sdes fi 4096238106Sdes 4097238106Sdes # Export our shlibpath_var if we have one. 4098238106Sdes if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4099238106Sdes $ECHO "\ 4100238106Sdes # Add our own library path to $shlibpath_var 4101238106Sdes $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 4102238106Sdes 4103238106Sdes # Some systems cannot cope with colon-terminated $shlibpath_var 4104238106Sdes # The second colon is a workaround for a bug in BeOS R4 sed 4105238106Sdes $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 4106238106Sdes 4107238106Sdes export $shlibpath_var 4108238106Sdes" 4109238106Sdes fi 4110238106Sdes 4111238106Sdes $ECHO "\ 4112238106Sdes if test \"\$libtool_execute_magic\" != \"$magic\"; then 4113238106Sdes # Run the actual program with our arguments. 4114238106Sdes func_exec_program \${1+\"\$@\"} 4115238106Sdes fi 4116238106Sdes else 4117238106Sdes # The program doesn't exist. 4118238106Sdes \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 4119238106Sdes \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 4120238106Sdes \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 4121238106Sdes exit 1 4122238106Sdes fi 4123238106Sdesfi\ 4124238106Sdes" 4125238106Sdes} 4126238106Sdes 4127238106Sdes 4128238106Sdes# func_emit_cwrapperexe_src 4129238106Sdes# emit the source code for a wrapper executable on stdout 4130238106Sdes# Must ONLY be called from within func_mode_link because 4131238106Sdes# it depends on a number of variable set therein. 4132238106Sdesfunc_emit_cwrapperexe_src () 4133238106Sdes{ 4134238106Sdes cat <<EOF 4135238106Sdes 4136238106Sdes/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4137238106Sdes Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 4138238106Sdes 4139238106Sdes The $output program cannot be directly executed until all the libtool 4140238106Sdes libraries that it depends on are installed. 4141238106Sdes 4142238106Sdes This wrapper executable should never be moved out of the build directory. 4143238106Sdes If it is, it will not operate correctly. 4144238106Sdes*/ 4145238106SdesEOF 4146238106Sdes cat <<"EOF" 4147238106Sdes#ifdef _MSC_VER 4148238106Sdes# define _CRT_SECURE_NO_DEPRECATE 1 4149238106Sdes#endif 4150238106Sdes#include <stdio.h> 4151238106Sdes#include <stdlib.h> 4152238106Sdes#ifdef _MSC_VER 4153238106Sdes# include <direct.h> 4154238106Sdes# include <process.h> 4155238106Sdes# include <io.h> 4156238106Sdes#else 4157238106Sdes# include <unistd.h> 4158238106Sdes# include <stdint.h> 4159238106Sdes# ifdef __CYGWIN__ 4160238106Sdes# include <io.h> 4161238106Sdes# endif 4162238106Sdes#endif 4163238106Sdes#include <malloc.h> 4164238106Sdes#include <stdarg.h> 4165238106Sdes#include <assert.h> 4166238106Sdes#include <string.h> 4167238106Sdes#include <ctype.h> 4168238106Sdes#include <errno.h> 4169238106Sdes#include <fcntl.h> 4170238106Sdes#include <sys/stat.h> 4171238106Sdes 4172238106Sdes/* declarations of non-ANSI functions */ 4173238106Sdes#if defined(__MINGW32__) 4174238106Sdes# ifdef __STRICT_ANSI__ 4175238106Sdesint _putenv (const char *); 4176238106Sdes# endif 4177238106Sdes#elif defined(__CYGWIN__) 4178238106Sdes# ifdef __STRICT_ANSI__ 4179238106Sdeschar *realpath (const char *, char *); 4180238106Sdesint putenv (char *); 4181238106Sdesint setenv (const char *, const char *, int); 4182238106Sdes# endif 4183238106Sdes/* #elif defined (other platforms) ... */ 4184238106Sdes#endif 4185238106Sdes 4186238106Sdes/* portability defines, excluding path handling macros */ 4187238106Sdes#if defined(_MSC_VER) 4188238106Sdes# define setmode _setmode 4189238106Sdes# define stat _stat 4190238106Sdes# define chmod _chmod 4191238106Sdes# define getcwd _getcwd 4192238106Sdes# define putenv _putenv 4193238106Sdes# define S_IXUSR _S_IEXEC 4194238106Sdes# ifndef _INTPTR_T_DEFINED 4195238106Sdes# define _INTPTR_T_DEFINED 4196238106Sdes# define intptr_t int 4197238106Sdes# endif 4198238106Sdes#elif defined(__MINGW32__) 4199238106Sdes# define setmode _setmode 4200238106Sdes# define stat _stat 4201238106Sdes# define chmod _chmod 4202238106Sdes# define getcwd _getcwd 4203238106Sdes# define putenv _putenv 4204238106Sdes#elif defined(__CYGWIN__) 4205238106Sdes# define HAVE_SETENV 4206238106Sdes# define FOPEN_WB "wb" 4207238106Sdes/* #elif defined (other platforms) ... */ 4208238106Sdes#endif 4209238106Sdes 4210238106Sdes#if defined(PATH_MAX) 4211238106Sdes# define LT_PATHMAX PATH_MAX 4212238106Sdes#elif defined(MAXPATHLEN) 4213238106Sdes# define LT_PATHMAX MAXPATHLEN 4214238106Sdes#else 4215238106Sdes# define LT_PATHMAX 1024 4216238106Sdes#endif 4217238106Sdes 4218238106Sdes#ifndef S_IXOTH 4219238106Sdes# define S_IXOTH 0 4220238106Sdes#endif 4221238106Sdes#ifndef S_IXGRP 4222238106Sdes# define S_IXGRP 0 4223238106Sdes#endif 4224238106Sdes 4225238106Sdes/* path handling portability macros */ 4226238106Sdes#ifndef DIR_SEPARATOR 4227238106Sdes# define DIR_SEPARATOR '/' 4228238106Sdes# define PATH_SEPARATOR ':' 4229238106Sdes#endif 4230238106Sdes 4231238106Sdes#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4232238106Sdes defined (__OS2__) 4233238106Sdes# define HAVE_DOS_BASED_FILE_SYSTEM 4234238106Sdes# define FOPEN_WB "wb" 4235238106Sdes# ifndef DIR_SEPARATOR_2 4236238106Sdes# define DIR_SEPARATOR_2 '\\' 4237238106Sdes# endif 4238238106Sdes# ifndef PATH_SEPARATOR_2 4239238106Sdes# define PATH_SEPARATOR_2 ';' 4240238106Sdes# endif 4241238106Sdes#endif 4242238106Sdes 4243238106Sdes#ifndef DIR_SEPARATOR_2 4244238106Sdes# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4245238106Sdes#else /* DIR_SEPARATOR_2 */ 4246238106Sdes# define IS_DIR_SEPARATOR(ch) \ 4247238106Sdes (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4248238106Sdes#endif /* DIR_SEPARATOR_2 */ 4249238106Sdes 4250238106Sdes#ifndef PATH_SEPARATOR_2 4251238106Sdes# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 4252238106Sdes#else /* PATH_SEPARATOR_2 */ 4253238106Sdes# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 4254238106Sdes#endif /* PATH_SEPARATOR_2 */ 4255238106Sdes 4256238106Sdes#ifndef FOPEN_WB 4257238106Sdes# define FOPEN_WB "w" 4258238106Sdes#endif 4259238106Sdes#ifndef _O_BINARY 4260238106Sdes# define _O_BINARY 0 4261238106Sdes#endif 4262238106Sdes 4263238106Sdes#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4264238106Sdes#define XFREE(stale) do { \ 4265238106Sdes if (stale) { free ((void *) stale); stale = 0; } \ 4266238106Sdes} while (0) 4267238106Sdes 4268238106Sdes#if defined(LT_DEBUGWRAPPER) 4269238106Sdesstatic int lt_debug = 1; 4270238106Sdes#else 4271238106Sdesstatic int lt_debug = 0; 4272238106Sdes#endif 4273238106Sdes 4274238106Sdesconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 4275238106Sdes 4276238106Sdesvoid *xmalloc (size_t num); 4277238106Sdeschar *xstrdup (const char *string); 4278238106Sdesconst char *base_name (const char *name); 4279238106Sdeschar *find_executable (const char *wrapper); 4280238106Sdeschar *chase_symlinks (const char *pathspec); 4281238106Sdesint make_executable (const char *path); 4282238106Sdesint check_executable (const char *path); 4283238106Sdeschar *strendzap (char *str, const char *pat); 4284238106Sdesvoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 4285238106Sdesvoid lt_fatal (const char *file, int line, const char *message, ...); 4286238106Sdesstatic const char *nonnull (const char *s); 4287238106Sdesstatic const char *nonempty (const char *s); 4288238106Sdesvoid lt_setenv (const char *name, const char *value); 4289238106Sdeschar *lt_extend_str (const char *orig_value, const char *add, int to_end); 4290238106Sdesvoid lt_update_exe_path (const char *name, const char *value); 4291238106Sdesvoid lt_update_lib_path (const char *name, const char *value); 4292238106Sdeschar **prepare_spawn (char **argv); 4293238106Sdesvoid lt_dump_script (FILE *f); 4294238106SdesEOF 4295238106Sdes 4296238106Sdes cat <<EOF 4297238106Sdesvolatile const char * MAGIC_EXE = "$magic_exe"; 4298238106Sdesconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 4299238106SdesEOF 4300238106Sdes 4301238106Sdes if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 4302238106Sdes func_to_host_path "$temp_rpath" 4303238106Sdes cat <<EOF 4304238106Sdesconst char * LIB_PATH_VALUE = "$func_to_host_path_result"; 4305238106SdesEOF 4306238106Sdes else 4307238106Sdes cat <<"EOF" 4308238106Sdesconst char * LIB_PATH_VALUE = ""; 4309238106SdesEOF 4310238106Sdes fi 4311238106Sdes 4312238106Sdes if test -n "$dllsearchpath"; then 4313238106Sdes func_to_host_path "$dllsearchpath:" 4314238106Sdes cat <<EOF 4315238106Sdesconst char * EXE_PATH_VARNAME = "PATH"; 4316238106Sdesconst char * EXE_PATH_VALUE = "$func_to_host_path_result"; 4317238106SdesEOF 4318238106Sdes else 4319238106Sdes cat <<"EOF" 4320238106Sdesconst char * EXE_PATH_VARNAME = ""; 4321238106Sdesconst char * EXE_PATH_VALUE = ""; 4322238106SdesEOF 4323238106Sdes fi 4324238106Sdes 4325238106Sdes if test "$fast_install" = yes; then 4326238106Sdes cat <<EOF 4327238106Sdesconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 4328238106SdesEOF 4329238106Sdes else 4330238106Sdes cat <<EOF 4331238106Sdesconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 4332238106SdesEOF 4333238106Sdes fi 4334238106Sdes 4335238106Sdes 4336238106Sdes cat <<"EOF" 4337238106Sdes 4338238106Sdes#define LTWRAPPER_OPTION_PREFIX "--lt-" 4339238106Sdes 4340238106Sdesstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 4341238106Sdesstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 4342238106Sdesstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 4343238106Sdes 4344238106Sdesint 4345238106Sdesmain (int argc, char *argv[]) 4346238106Sdes{ 4347238106Sdes char **newargz; 4348238106Sdes int newargc; 4349238106Sdes char *tmp_pathspec; 4350238106Sdes char *actual_cwrapper_path; 4351238106Sdes char *actual_cwrapper_name; 4352238106Sdes char *target_name; 4353238106Sdes char *lt_argv_zero; 4354238106Sdes intptr_t rval = 127; 4355238106Sdes 4356238106Sdes int i; 4357238106Sdes 4358238106Sdes program_name = (char *) xstrdup (base_name (argv[0])); 4359238106Sdes newargz = XMALLOC (char *, argc + 1); 4360238106Sdes 4361238106Sdes /* very simple arg parsing; don't want to rely on getopt 4362238106Sdes * also, copy all non cwrapper options to newargz, except 4363238106Sdes * argz[0], which is handled differently 4364238106Sdes */ 4365238106Sdes newargc=0; 4366238106Sdes for (i = 1; i < argc; i++) 4367238106Sdes { 4368238106Sdes if (strcmp (argv[i], dumpscript_opt) == 0) 4369238106Sdes { 4370238106SdesEOF 4371238106Sdes case "$host" in 4372238106Sdes *mingw* | *cygwin* ) 4373238106Sdes # make stdout use "unix" line endings 4374238106Sdes echo " setmode(1,_O_BINARY);" 4375238106Sdes ;; 4376238106Sdes esac 4377238106Sdes 4378238106Sdes cat <<"EOF" 4379238106Sdes lt_dump_script (stdout); 4380238106Sdes return 0; 4381238106Sdes } 4382238106Sdes if (strcmp (argv[i], debug_opt) == 0) 4383238106Sdes { 4384238106Sdes lt_debug = 1; 4385238106Sdes continue; 4386238106Sdes } 4387238106Sdes if (strcmp (argv[i], ltwrapper_option_prefix) == 0) 4388238106Sdes { 4389238106Sdes /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 4390238106Sdes namespace, but it is not one of the ones we know about and 4391238106Sdes have already dealt with, above (inluding dump-script), then 4392238106Sdes report an error. Otherwise, targets might begin to believe 4393238106Sdes they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 4394238106Sdes namespace. The first time any user complains about this, we'll 4395238106Sdes need to make LTWRAPPER_OPTION_PREFIX a configure-time option 4396238106Sdes or a configure.ac-settable value. 4397238106Sdes */ 4398238106Sdes lt_fatal (__FILE__, __LINE__, 4399238106Sdes "unrecognized %s option: '%s'", 4400238106Sdes ltwrapper_option_prefix, argv[i]); 4401238106Sdes } 4402238106Sdes /* otherwise ... */ 4403238106Sdes newargz[++newargc] = xstrdup (argv[i]); 4404238106Sdes } 4405238106Sdes newargz[++newargc] = NULL; 4406238106Sdes 4407238106SdesEOF 4408238106Sdes cat <<EOF 4409238106Sdes /* The GNU banner must be the first non-error debug message */ 4410238106Sdes lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n"); 4411238106SdesEOF 4412238106Sdes cat <<"EOF" 4413238106Sdes lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 4414238106Sdes lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 4415238106Sdes 4416238106Sdes tmp_pathspec = find_executable (argv[0]); 4417238106Sdes if (tmp_pathspec == NULL) 4418238106Sdes lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 4419238106Sdes lt_debugprintf (__FILE__, __LINE__, 4420238106Sdes "(main) found exe (before symlink chase) at: %s\n", 4421238106Sdes tmp_pathspec); 4422238106Sdes 4423238106Sdes actual_cwrapper_path = chase_symlinks (tmp_pathspec); 4424238106Sdes lt_debugprintf (__FILE__, __LINE__, 4425238106Sdes "(main) found exe (after symlink chase) at: %s\n", 4426238106Sdes actual_cwrapper_path); 4427238106Sdes XFREE (tmp_pathspec); 4428238106Sdes 4429238106Sdes actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 4430238106Sdes strendzap (actual_cwrapper_path, actual_cwrapper_name); 4431238106Sdes 4432238106Sdes /* wrapper name transforms */ 4433238106Sdes strendzap (actual_cwrapper_name, ".exe"); 4434238106Sdes tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 4435238106Sdes XFREE (actual_cwrapper_name); 4436238106Sdes actual_cwrapper_name = tmp_pathspec; 4437238106Sdes tmp_pathspec = 0; 4438238106Sdes 4439238106Sdes /* target_name transforms -- use actual target program name; might have lt- prefix */ 4440238106Sdes target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 4441238106Sdes strendzap (target_name, ".exe"); 4442238106Sdes tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 4443238106Sdes XFREE (target_name); 4444238106Sdes target_name = tmp_pathspec; 4445238106Sdes tmp_pathspec = 0; 4446238106Sdes 4447238106Sdes lt_debugprintf (__FILE__, __LINE__, 4448238106Sdes "(main) libtool target name: %s\n", 4449238106Sdes target_name); 4450238106SdesEOF 4451238106Sdes 4452238106Sdes cat <<EOF 4453238106Sdes newargz[0] = 4454238106Sdes XMALLOC (char, (strlen (actual_cwrapper_path) + 4455238106Sdes strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 4456238106Sdes strcpy (newargz[0], actual_cwrapper_path); 4457238106Sdes strcat (newargz[0], "$objdir"); 4458238106Sdes strcat (newargz[0], "/"); 4459238106SdesEOF 4460238106Sdes 4461238106Sdes cat <<"EOF" 4462238106Sdes /* stop here, and copy so we don't have to do this twice */ 4463238106Sdes tmp_pathspec = xstrdup (newargz[0]); 4464238106Sdes 4465238106Sdes /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 4466238106Sdes strcat (newargz[0], actual_cwrapper_name); 4467238106Sdes 4468238106Sdes /* DO want the lt- prefix here if it exists, so use target_name */ 4469238106Sdes lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 4470238106Sdes XFREE (tmp_pathspec); 4471238106Sdes tmp_pathspec = NULL; 4472238106SdesEOF 4473238106Sdes 4474238106Sdes case $host_os in 4475238106Sdes mingw*) 4476238106Sdes cat <<"EOF" 4477238106Sdes { 4478238106Sdes char* p; 4479238106Sdes while ((p = strchr (newargz[0], '\\')) != NULL) 4480238106Sdes { 4481238106Sdes *p = '/'; 4482238106Sdes } 4483238106Sdes while ((p = strchr (lt_argv_zero, '\\')) != NULL) 4484238106Sdes { 4485238106Sdes *p = '/'; 4486238106Sdes } 4487238106Sdes } 4488238106SdesEOF 4489238106Sdes ;; 4490238106Sdes esac 4491238106Sdes 4492238106Sdes cat <<"EOF" 4493238106Sdes XFREE (target_name); 4494238106Sdes XFREE (actual_cwrapper_path); 4495238106Sdes XFREE (actual_cwrapper_name); 4496238106Sdes 4497238106Sdes lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 4498238106Sdes lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 4499238106Sdes /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 4500238106Sdes be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 4501238106Sdes because on Windows, both *_VARNAMEs are PATH but uninstalled 4502238106Sdes libraries must come first. */ 4503238106Sdes lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 4504238106Sdes lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 4505238106Sdes 4506238106Sdes lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 4507238106Sdes nonnull (lt_argv_zero)); 4508238106Sdes for (i = 0; i < newargc; i++) 4509238106Sdes { 4510238106Sdes lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 4511238106Sdes i, nonnull (newargz[i])); 4512238106Sdes } 4513238106Sdes 4514238106SdesEOF 4515238106Sdes 4516238106Sdes case $host_os in 4517238106Sdes mingw*) 4518238106Sdes cat <<"EOF" 4519238106Sdes /* execv doesn't actually work on mingw as expected on unix */ 4520238106Sdes newargz = prepare_spawn (newargz); 4521238106Sdes rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 4522238106Sdes if (rval == -1) 4523238106Sdes { 4524238106Sdes /* failed to start process */ 4525238106Sdes lt_debugprintf (__FILE__, __LINE__, 4526238106Sdes "(main) failed to launch target \"%s\": %s\n", 4527238106Sdes lt_argv_zero, nonnull (strerror (errno))); 4528238106Sdes return 127; 4529238106Sdes } 4530238106Sdes return rval; 4531238106SdesEOF 4532238106Sdes ;; 4533238106Sdes *) 4534238106Sdes cat <<"EOF" 4535238106Sdes execv (lt_argv_zero, newargz); 4536238106Sdes return rval; /* =127, but avoids unused variable warning */ 4537238106SdesEOF 4538238106Sdes ;; 4539238106Sdes esac 4540238106Sdes 4541238106Sdes cat <<"EOF" 4542238106Sdes} 4543238106Sdes 4544238106Sdesvoid * 4545238106Sdesxmalloc (size_t num) 4546238106Sdes{ 4547238106Sdes void *p = (void *) malloc (num); 4548238106Sdes if (!p) 4549238106Sdes lt_fatal (__FILE__, __LINE__, "memory exhausted"); 4550238106Sdes 4551238106Sdes return p; 4552238106Sdes} 4553238106Sdes 4554238106Sdeschar * 4555238106Sdesxstrdup (const char *string) 4556238106Sdes{ 4557238106Sdes return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 4558238106Sdes string) : NULL; 4559238106Sdes} 4560238106Sdes 4561238106Sdesconst char * 4562238106Sdesbase_name (const char *name) 4563238106Sdes{ 4564238106Sdes const char *base; 4565238106Sdes 4566238106Sdes#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4567238106Sdes /* Skip over the disk name in MSDOS pathnames. */ 4568238106Sdes if (isalpha ((unsigned char) name[0]) && name[1] == ':') 4569238106Sdes name += 2; 4570238106Sdes#endif 4571238106Sdes 4572238106Sdes for (base = name; *name; name++) 4573238106Sdes if (IS_DIR_SEPARATOR (*name)) 4574238106Sdes base = name + 1; 4575238106Sdes return base; 4576238106Sdes} 4577238106Sdes 4578238106Sdesint 4579238106Sdescheck_executable (const char *path) 4580238106Sdes{ 4581238106Sdes struct stat st; 4582238106Sdes 4583238106Sdes lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 4584238106Sdes nonempty (path)); 4585238106Sdes if ((!path) || (!*path)) 4586238106Sdes return 0; 4587238106Sdes 4588238106Sdes if ((stat (path, &st) >= 0) 4589238106Sdes && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 4590238106Sdes return 1; 4591238106Sdes else 4592238106Sdes return 0; 4593238106Sdes} 4594238106Sdes 4595238106Sdesint 4596238106Sdesmake_executable (const char *path) 4597238106Sdes{ 4598238106Sdes int rval = 0; 4599238106Sdes struct stat st; 4600238106Sdes 4601238106Sdes lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 4602238106Sdes nonempty (path)); 4603238106Sdes if ((!path) || (!*path)) 4604238106Sdes return 0; 4605238106Sdes 4606238106Sdes if (stat (path, &st) >= 0) 4607238106Sdes { 4608238106Sdes rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 4609238106Sdes } 4610238106Sdes return rval; 4611238106Sdes} 4612238106Sdes 4613238106Sdes/* Searches for the full path of the wrapper. Returns 4614238106Sdes newly allocated full path name if found, NULL otherwise 4615238106Sdes Does not chase symlinks, even on platforms that support them. 4616238106Sdes*/ 4617238106Sdeschar * 4618238106Sdesfind_executable (const char *wrapper) 4619238106Sdes{ 4620238106Sdes int has_slash = 0; 4621238106Sdes const char *p; 4622238106Sdes const char *p_next; 4623238106Sdes /* static buffer for getcwd */ 4624238106Sdes char tmp[LT_PATHMAX + 1]; 4625238106Sdes int tmp_len; 4626238106Sdes char *concat_name; 4627238106Sdes 4628238106Sdes lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 4629238106Sdes nonempty (wrapper)); 4630238106Sdes 4631238106Sdes if ((wrapper == NULL) || (*wrapper == '\0')) 4632238106Sdes return NULL; 4633238106Sdes 4634238106Sdes /* Absolute path? */ 4635238106Sdes#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4636238106Sdes if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 4637238106Sdes { 4638238106Sdes concat_name = xstrdup (wrapper); 4639238106Sdes if (check_executable (concat_name)) 4640238106Sdes return concat_name; 4641238106Sdes XFREE (concat_name); 4642238106Sdes } 4643238106Sdes else 4644238106Sdes { 4645238106Sdes#endif 4646238106Sdes if (IS_DIR_SEPARATOR (wrapper[0])) 4647238106Sdes { 4648238106Sdes concat_name = xstrdup (wrapper); 4649238106Sdes if (check_executable (concat_name)) 4650238106Sdes return concat_name; 4651238106Sdes XFREE (concat_name); 4652238106Sdes } 4653238106Sdes#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 4654238106Sdes } 4655238106Sdes#endif 4656238106Sdes 4657238106Sdes for (p = wrapper; *p; p++) 4658238106Sdes if (*p == '/') 4659238106Sdes { 4660238106Sdes has_slash = 1; 4661238106Sdes break; 4662238106Sdes } 4663238106Sdes if (!has_slash) 4664238106Sdes { 4665238106Sdes /* no slashes; search PATH */ 4666238106Sdes const char *path = getenv ("PATH"); 4667238106Sdes if (path != NULL) 4668238106Sdes { 4669238106Sdes for (p = path; *p; p = p_next) 4670238106Sdes { 4671238106Sdes const char *q; 4672238106Sdes size_t p_len; 4673238106Sdes for (q = p; *q; q++) 4674238106Sdes if (IS_PATH_SEPARATOR (*q)) 4675238106Sdes break; 4676238106Sdes p_len = q - p; 4677238106Sdes p_next = (*q == '\0' ? q : q + 1); 4678238106Sdes if (p_len == 0) 4679238106Sdes { 4680238106Sdes /* empty path: current directory */ 4681238106Sdes if (getcwd (tmp, LT_PATHMAX) == NULL) 4682238106Sdes lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4683238106Sdes nonnull (strerror (errno))); 4684238106Sdes tmp_len = strlen (tmp); 4685238106Sdes concat_name = 4686238106Sdes XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4687238106Sdes memcpy (concat_name, tmp, tmp_len); 4688238106Sdes concat_name[tmp_len] = '/'; 4689238106Sdes strcpy (concat_name + tmp_len + 1, wrapper); 4690238106Sdes } 4691238106Sdes else 4692238106Sdes { 4693238106Sdes concat_name = 4694238106Sdes XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 4695238106Sdes memcpy (concat_name, p, p_len); 4696238106Sdes concat_name[p_len] = '/'; 4697238106Sdes strcpy (concat_name + p_len + 1, wrapper); 4698238106Sdes } 4699238106Sdes if (check_executable (concat_name)) 4700238106Sdes return concat_name; 4701238106Sdes XFREE (concat_name); 4702238106Sdes } 4703238106Sdes } 4704238106Sdes /* not found in PATH; assume curdir */ 4705238106Sdes } 4706238106Sdes /* Relative path | not found in path: prepend cwd */ 4707238106Sdes if (getcwd (tmp, LT_PATHMAX) == NULL) 4708238106Sdes lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 4709238106Sdes nonnull (strerror (errno))); 4710238106Sdes tmp_len = strlen (tmp); 4711238106Sdes concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 4712238106Sdes memcpy (concat_name, tmp, tmp_len); 4713238106Sdes concat_name[tmp_len] = '/'; 4714238106Sdes strcpy (concat_name + tmp_len + 1, wrapper); 4715238106Sdes 4716238106Sdes if (check_executable (concat_name)) 4717238106Sdes return concat_name; 4718238106Sdes XFREE (concat_name); 4719238106Sdes return NULL; 4720238106Sdes} 4721238106Sdes 4722238106Sdeschar * 4723238106Sdeschase_symlinks (const char *pathspec) 4724238106Sdes{ 4725238106Sdes#ifndef S_ISLNK 4726238106Sdes return xstrdup (pathspec); 4727238106Sdes#else 4728238106Sdes char buf[LT_PATHMAX]; 4729238106Sdes struct stat s; 4730238106Sdes char *tmp_pathspec = xstrdup (pathspec); 4731238106Sdes char *p; 4732238106Sdes int has_symlinks = 0; 4733238106Sdes while (strlen (tmp_pathspec) && !has_symlinks) 4734238106Sdes { 4735238106Sdes lt_debugprintf (__FILE__, __LINE__, 4736238106Sdes "checking path component for symlinks: %s\n", 4737238106Sdes tmp_pathspec); 4738238106Sdes if (lstat (tmp_pathspec, &s) == 0) 4739238106Sdes { 4740238106Sdes if (S_ISLNK (s.st_mode) != 0) 4741238106Sdes { 4742238106Sdes has_symlinks = 1; 4743238106Sdes break; 4744238106Sdes } 4745238106Sdes 4746238106Sdes /* search backwards for last DIR_SEPARATOR */ 4747238106Sdes p = tmp_pathspec + strlen (tmp_pathspec) - 1; 4748238106Sdes while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4749238106Sdes p--; 4750238106Sdes if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 4751238106Sdes { 4752238106Sdes /* no more DIR_SEPARATORS left */ 4753238106Sdes break; 4754238106Sdes } 4755238106Sdes *p = '\0'; 4756238106Sdes } 4757238106Sdes else 4758238106Sdes { 4759238106Sdes lt_fatal (__FILE__, __LINE__, 4760238106Sdes "error accessing file \"%s\": %s", 4761238106Sdes tmp_pathspec, nonnull (strerror (errno))); 4762238106Sdes } 4763238106Sdes } 4764238106Sdes XFREE (tmp_pathspec); 4765238106Sdes 4766238106Sdes if (!has_symlinks) 4767238106Sdes { 4768238106Sdes return xstrdup (pathspec); 4769238106Sdes } 4770238106Sdes 4771238106Sdes tmp_pathspec = realpath (pathspec, buf); 4772238106Sdes if (tmp_pathspec == 0) 4773238106Sdes { 4774238106Sdes lt_fatal (__FILE__, __LINE__, 4775238106Sdes "could not follow symlinks for %s", pathspec); 4776238106Sdes } 4777238106Sdes return xstrdup (tmp_pathspec); 4778238106Sdes#endif 4779238106Sdes} 4780238106Sdes 4781238106Sdeschar * 4782238106Sdesstrendzap (char *str, const char *pat) 4783238106Sdes{ 4784238106Sdes size_t len, patlen; 4785238106Sdes 4786238106Sdes assert (str != NULL); 4787238106Sdes assert (pat != NULL); 4788238106Sdes 4789238106Sdes len = strlen (str); 4790238106Sdes patlen = strlen (pat); 4791238106Sdes 4792238106Sdes if (patlen <= len) 4793238106Sdes { 4794238106Sdes str += len - patlen; 4795238106Sdes if (strcmp (str, pat) == 0) 4796238106Sdes *str = '\0'; 4797238106Sdes } 4798238106Sdes return str; 4799238106Sdes} 4800238106Sdes 4801238106Sdesvoid 4802238106Sdeslt_debugprintf (const char *file, int line, const char *fmt, ...) 4803238106Sdes{ 4804238106Sdes va_list args; 4805238106Sdes if (lt_debug) 4806238106Sdes { 4807238106Sdes (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 4808238106Sdes va_start (args, fmt); 4809238106Sdes (void) vfprintf (stderr, fmt, args); 4810238106Sdes va_end (args); 4811238106Sdes } 4812238106Sdes} 4813238106Sdes 4814238106Sdesstatic void 4815238106Sdeslt_error_core (int exit_status, const char *file, 4816238106Sdes int line, const char *mode, 4817238106Sdes const char *message, va_list ap) 4818238106Sdes{ 4819238106Sdes fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 4820238106Sdes vfprintf (stderr, message, ap); 4821238106Sdes fprintf (stderr, ".\n"); 4822238106Sdes 4823238106Sdes if (exit_status >= 0) 4824238106Sdes exit (exit_status); 4825238106Sdes} 4826238106Sdes 4827238106Sdesvoid 4828238106Sdeslt_fatal (const char *file, int line, const char *message, ...) 4829238106Sdes{ 4830238106Sdes va_list ap; 4831238106Sdes va_start (ap, message); 4832238106Sdes lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 4833238106Sdes va_end (ap); 4834238106Sdes} 4835238106Sdes 4836238106Sdesstatic const char * 4837238106Sdesnonnull (const char *s) 4838238106Sdes{ 4839238106Sdes return s ? s : "(null)"; 4840238106Sdes} 4841238106Sdes 4842238106Sdesstatic const char * 4843238106Sdesnonempty (const char *s) 4844238106Sdes{ 4845238106Sdes return (s && !*s) ? "(empty)" : nonnull (s); 4846238106Sdes} 4847238106Sdes 4848238106Sdesvoid 4849238106Sdeslt_setenv (const char *name, const char *value) 4850238106Sdes{ 4851238106Sdes lt_debugprintf (__FILE__, __LINE__, 4852238106Sdes "(lt_setenv) setting '%s' to '%s'\n", 4853238106Sdes nonnull (name), nonnull (value)); 4854238106Sdes { 4855238106Sdes#ifdef HAVE_SETENV 4856238106Sdes /* always make a copy, for consistency with !HAVE_SETENV */ 4857238106Sdes char *str = xstrdup (value); 4858238106Sdes setenv (name, str, 1); 4859238106Sdes#else 4860238106Sdes int len = strlen (name) + 1 + strlen (value) + 1; 4861238106Sdes char *str = XMALLOC (char, len); 4862238106Sdes sprintf (str, "%s=%s", name, value); 4863238106Sdes if (putenv (str) != EXIT_SUCCESS) 4864238106Sdes { 4865238106Sdes XFREE (str); 4866238106Sdes } 4867238106Sdes#endif 4868238106Sdes } 4869238106Sdes} 4870238106Sdes 4871238106Sdeschar * 4872238106Sdeslt_extend_str (const char *orig_value, const char *add, int to_end) 4873238106Sdes{ 4874238106Sdes char *new_value; 4875238106Sdes if (orig_value && *orig_value) 4876238106Sdes { 4877238106Sdes int orig_value_len = strlen (orig_value); 4878238106Sdes int add_len = strlen (add); 4879238106Sdes new_value = XMALLOC (char, add_len + orig_value_len + 1); 4880238106Sdes if (to_end) 4881238106Sdes { 4882238106Sdes strcpy (new_value, orig_value); 4883238106Sdes strcpy (new_value + orig_value_len, add); 4884238106Sdes } 4885238106Sdes else 4886238106Sdes { 4887238106Sdes strcpy (new_value, add); 4888238106Sdes strcpy (new_value + add_len, orig_value); 4889238106Sdes } 4890238106Sdes } 4891238106Sdes else 4892238106Sdes { 4893238106Sdes new_value = xstrdup (add); 4894238106Sdes } 4895238106Sdes return new_value; 4896238106Sdes} 4897238106Sdes 4898238106Sdesvoid 4899238106Sdeslt_update_exe_path (const char *name, const char *value) 4900238106Sdes{ 4901238106Sdes lt_debugprintf (__FILE__, __LINE__, 4902238106Sdes "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 4903238106Sdes nonnull (name), nonnull (value)); 4904238106Sdes 4905238106Sdes if (name && *name && value && *value) 4906238106Sdes { 4907238106Sdes char *new_value = lt_extend_str (getenv (name), value, 0); 4908238106Sdes /* some systems can't cope with a ':'-terminated path #' */ 4909238106Sdes int len = strlen (new_value); 4910238106Sdes while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 4911238106Sdes { 4912238106Sdes new_value[len-1] = '\0'; 4913238106Sdes } 4914238106Sdes lt_setenv (name, new_value); 4915238106Sdes XFREE (new_value); 4916238106Sdes } 4917238106Sdes} 4918238106Sdes 4919238106Sdesvoid 4920238106Sdeslt_update_lib_path (const char *name, const char *value) 4921238106Sdes{ 4922238106Sdes lt_debugprintf (__FILE__, __LINE__, 4923238106Sdes "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 4924238106Sdes nonnull (name), nonnull (value)); 4925238106Sdes 4926238106Sdes if (name && *name && value && *value) 4927238106Sdes { 4928238106Sdes char *new_value = lt_extend_str (getenv (name), value, 0); 4929238106Sdes lt_setenv (name, new_value); 4930238106Sdes XFREE (new_value); 4931238106Sdes } 4932238106Sdes} 4933238106Sdes 4934238106SdesEOF 4935238106Sdes case $host_os in 4936238106Sdes mingw*) 4937238106Sdes cat <<"EOF" 4938238106Sdes 4939238106Sdes/* Prepares an argument vector before calling spawn(). 4940238106Sdes Note that spawn() does not by itself call the command interpreter 4941238106Sdes (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 4942238106Sdes ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 4943238106Sdes GetVersionEx(&v); 4944238106Sdes v.dwPlatformId == VER_PLATFORM_WIN32_NT; 4945238106Sdes }) ? "cmd.exe" : "command.com"). 4946238106Sdes Instead it simply concatenates the arguments, separated by ' ', and calls 4947238106Sdes CreateProcess(). We must quote the arguments since Win32 CreateProcess() 4948238106Sdes interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 4949238106Sdes special way: 4950238106Sdes - Space and tab are interpreted as delimiters. They are not treated as 4951238106Sdes delimiters if they are surrounded by double quotes: "...". 4952238106Sdes - Unescaped double quotes are removed from the input. Their only effect is 4953238106Sdes that within double quotes, space and tab are treated like normal 4954238106Sdes characters. 4955238106Sdes - Backslashes not followed by double quotes are not special. 4956238106Sdes - But 2*n+1 backslashes followed by a double quote become 4957238106Sdes n backslashes followed by a double quote (n >= 0): 4958238106Sdes \" -> " 4959238106Sdes \\\" -> \" 4960238106Sdes \\\\\" -> \\" 4961238106Sdes */ 4962238106Sdes#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" 4963238106Sdes#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" 4964238106Sdeschar ** 4965238106Sdesprepare_spawn (char **argv) 4966238106Sdes{ 4967238106Sdes size_t argc; 4968238106Sdes char **new_argv; 4969238106Sdes size_t i; 4970238106Sdes 4971238106Sdes /* Count number of arguments. */ 4972238106Sdes for (argc = 0; argv[argc] != NULL; argc++) 4973238106Sdes ; 4974238106Sdes 4975238106Sdes /* Allocate new argument vector. */ 4976238106Sdes new_argv = XMALLOC (char *, argc + 1); 4977238106Sdes 4978238106Sdes /* Put quoted arguments into the new argument vector. */ 4979238106Sdes for (i = 0; i < argc; i++) 4980238106Sdes { 4981238106Sdes const char *string = argv[i]; 4982238106Sdes 4983238106Sdes if (string[0] == '\0') 4984238106Sdes new_argv[i] = xstrdup ("\"\""); 4985238106Sdes else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 4986238106Sdes { 4987238106Sdes int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 4988238106Sdes size_t length; 4989238106Sdes unsigned int backslashes; 4990238106Sdes const char *s; 4991238106Sdes char *quoted_string; 4992238106Sdes char *p; 4993238106Sdes 4994238106Sdes length = 0; 4995238106Sdes backslashes = 0; 4996238106Sdes if (quote_around) 4997238106Sdes length++; 4998238106Sdes for (s = string; *s != '\0'; s++) 4999238106Sdes { 5000238106Sdes char c = *s; 5001238106Sdes if (c == '"') 5002238106Sdes length += backslashes + 1; 5003238106Sdes length++; 5004238106Sdes if (c == '\\') 5005238106Sdes backslashes++; 5006238106Sdes else 5007238106Sdes backslashes = 0; 5008238106Sdes } 5009238106Sdes if (quote_around) 5010238106Sdes length += backslashes + 1; 5011238106Sdes 5012238106Sdes quoted_string = XMALLOC (char, length + 1); 5013238106Sdes 5014238106Sdes p = quoted_string; 5015238106Sdes backslashes = 0; 5016238106Sdes if (quote_around) 5017238106Sdes *p++ = '"'; 5018238106Sdes for (s = string; *s != '\0'; s++) 5019238106Sdes { 5020238106Sdes char c = *s; 5021238106Sdes if (c == '"') 5022238106Sdes { 5023238106Sdes unsigned int j; 5024238106Sdes for (j = backslashes + 1; j > 0; j--) 5025238106Sdes *p++ = '\\'; 5026238106Sdes } 5027238106Sdes *p++ = c; 5028238106Sdes if (c == '\\') 5029238106Sdes backslashes++; 5030238106Sdes else 5031238106Sdes backslashes = 0; 5032238106Sdes } 5033238106Sdes if (quote_around) 5034238106Sdes { 5035238106Sdes unsigned int j; 5036238106Sdes for (j = backslashes; j > 0; j--) 5037238106Sdes *p++ = '\\'; 5038238106Sdes *p++ = '"'; 5039238106Sdes } 5040238106Sdes *p = '\0'; 5041238106Sdes 5042238106Sdes new_argv[i] = quoted_string; 5043238106Sdes } 5044238106Sdes else 5045238106Sdes new_argv[i] = (char *) string; 5046238106Sdes } 5047238106Sdes new_argv[argc] = NULL; 5048238106Sdes 5049238106Sdes return new_argv; 5050238106Sdes} 5051238106SdesEOF 5052238106Sdes ;; 5053238106Sdes esac 5054238106Sdes 5055238106Sdes cat <<"EOF" 5056238106Sdesvoid lt_dump_script (FILE* f) 5057238106Sdes{ 5058238106SdesEOF 5059238106Sdes func_emit_wrapper yes | 5060238106Sdes $SED -e 's/\([\\"]\)/\\\1/g' \ 5061238106Sdes -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' 5062238106Sdes 5063238106Sdes cat <<"EOF" 5064238106Sdes} 5065238106SdesEOF 5066238106Sdes} 5067238106Sdes# end: func_emit_cwrapperexe_src 5068238106Sdes 5069238106Sdes# func_win32_import_lib_p ARG 5070238106Sdes# True if ARG is an import lib, as indicated by $file_magic_cmd 5071238106Sdesfunc_win32_import_lib_p () 5072238106Sdes{ 5073238106Sdes $opt_debug 5074238106Sdes case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 5075238106Sdes *import*) : ;; 5076238106Sdes *) false ;; 5077238106Sdes esac 5078238106Sdes} 5079238106Sdes 5080238106Sdes# func_mode_link arg... 5081238106Sdesfunc_mode_link () 5082238106Sdes{ 5083238106Sdes $opt_debug 5084238106Sdes case $host in 5085238106Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5086238106Sdes # It is impossible to link a dll without this setting, and 5087238106Sdes # we shouldn't force the makefile maintainer to figure out 5088238106Sdes # which system we are compiling for in order to pass an extra 5089238106Sdes # flag for every libtool invocation. 5090238106Sdes # allow_undefined=no 5091238106Sdes 5092238106Sdes # FIXME: Unfortunately, there are problems with the above when trying 5093238106Sdes # to make a dll which has undefined symbols, in which case not 5094238106Sdes # even a static library is built. For now, we need to specify 5095238106Sdes # -no-undefined on the libtool link line when we can be certain 5096238106Sdes # that all symbols are satisfied, otherwise we get a static library. 5097238106Sdes allow_undefined=yes 5098238106Sdes ;; 5099238106Sdes *) 5100238106Sdes allow_undefined=yes 5101238106Sdes ;; 5102238106Sdes esac 5103238106Sdes libtool_args=$nonopt 5104238106Sdes base_compile="$nonopt $@" 5105238106Sdes compile_command=$nonopt 5106238106Sdes finalize_command=$nonopt 5107238106Sdes 5108238106Sdes compile_rpath= 5109238106Sdes finalize_rpath= 5110238106Sdes compile_shlibpath= 5111238106Sdes finalize_shlibpath= 5112238106Sdes convenience= 5113238106Sdes old_convenience= 5114238106Sdes deplibs= 5115238106Sdes old_deplibs= 5116238106Sdes compiler_flags= 5117238106Sdes linker_flags= 5118238106Sdes dllsearchpath= 5119238106Sdes lib_search_path=`pwd` 5120238106Sdes inst_prefix_dir= 5121238106Sdes new_inherited_linker_flags= 5122238106Sdes 5123238106Sdes avoid_version=no 5124238106Sdes bindir= 5125238106Sdes dlfiles= 5126238106Sdes dlprefiles= 5127238106Sdes dlself=no 5128238106Sdes export_dynamic=no 5129238106Sdes export_symbols= 5130238106Sdes export_symbols_regex= 5131238106Sdes generated= 5132238106Sdes libobjs= 5133238106Sdes ltlibs= 5134238106Sdes module=no 5135238106Sdes no_install=no 5136238106Sdes objs= 5137238106Sdes non_pic_objects= 5138238106Sdes precious_files_regex= 5139238106Sdes prefer_static_libs=no 5140238106Sdes preload=no 5141238106Sdes prev= 5142238106Sdes prevarg= 5143238106Sdes release= 5144238106Sdes rpath= 5145238106Sdes xrpath= 5146238106Sdes perm_rpath= 5147238106Sdes temp_rpath= 5148238106Sdes thread_safe=no 5149238106Sdes vinfo= 5150238106Sdes vinfo_number=no 5151238106Sdes weak_libs= 5152238106Sdes single_module="${wl}-single_module" 5153238106Sdes func_infer_tag $base_compile 5154238106Sdes 5155238106Sdes # We need to know -static, to get the right output filenames. 5156238106Sdes for arg 5157238106Sdes do 5158238106Sdes case $arg in 5159238106Sdes -shared) 5160238106Sdes test "$build_libtool_libs" != yes && \ 5161238106Sdes func_fatal_configuration "can not build a shared library" 5162238106Sdes build_old_libs=no 5163238106Sdes break 5164238106Sdes ;; 5165238106Sdes -all-static | -static | -static-libtool-libs) 5166238106Sdes case $arg in 5167238106Sdes -all-static) 5168238106Sdes if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 5169238106Sdes func_warning "complete static linking is impossible in this configuration" 5170238106Sdes fi 5171238106Sdes if test -n "$link_static_flag"; then 5172238106Sdes dlopen_self=$dlopen_self_static 5173238106Sdes fi 5174238106Sdes prefer_static_libs=yes 5175238106Sdes ;; 5176238106Sdes -static) 5177238106Sdes if test -z "$pic_flag" && test -n "$link_static_flag"; then 5178238106Sdes dlopen_self=$dlopen_self_static 5179238106Sdes fi 5180238106Sdes prefer_static_libs=built 5181238106Sdes ;; 5182238106Sdes -static-libtool-libs) 5183238106Sdes if test -z "$pic_flag" && test -n "$link_static_flag"; then 5184238106Sdes dlopen_self=$dlopen_self_static 5185238106Sdes fi 5186238106Sdes prefer_static_libs=yes 5187238106Sdes ;; 5188238106Sdes esac 5189238106Sdes build_libtool_libs=no 5190238106Sdes build_old_libs=yes 5191238106Sdes break 5192238106Sdes ;; 5193238106Sdes esac 5194238106Sdes done 5195238106Sdes 5196238106Sdes # See if our shared archives depend on static archives. 5197238106Sdes test -n "$old_archive_from_new_cmds" && build_old_libs=yes 5198238106Sdes 5199238106Sdes # Go through the arguments, transforming them on the way. 5200238106Sdes while test "$#" -gt 0; do 5201238106Sdes arg="$1" 5202238106Sdes shift 5203238106Sdes func_quote_for_eval "$arg" 5204238106Sdes qarg=$func_quote_for_eval_unquoted_result 5205238106Sdes func_append libtool_args " $func_quote_for_eval_result" 5206238106Sdes 5207238106Sdes # If the previous option needs an argument, assign it. 5208238106Sdes if test -n "$prev"; then 5209238106Sdes case $prev in 5210238106Sdes output) 5211238106Sdes func_append compile_command " @OUTPUT@" 5212238106Sdes func_append finalize_command " @OUTPUT@" 5213238106Sdes ;; 5214238106Sdes esac 5215238106Sdes 5216238106Sdes case $prev in 5217238106Sdes bindir) 5218238106Sdes bindir="$arg" 5219238106Sdes prev= 5220238106Sdes continue 5221238106Sdes ;; 5222238106Sdes dlfiles|dlprefiles) 5223238106Sdes if test "$preload" = no; then 5224238106Sdes # Add the symbol object into the linking commands. 5225238106Sdes func_append compile_command " @SYMFILE@" 5226238106Sdes func_append finalize_command " @SYMFILE@" 5227238106Sdes preload=yes 5228238106Sdes fi 5229238106Sdes case $arg in 5230238106Sdes *.la | *.lo) ;; # We handle these cases below. 5231238106Sdes force) 5232238106Sdes if test "$dlself" = no; then 5233238106Sdes dlself=needless 5234238106Sdes export_dynamic=yes 5235238106Sdes fi 5236238106Sdes prev= 5237238106Sdes continue 5238238106Sdes ;; 5239238106Sdes self) 5240238106Sdes if test "$prev" = dlprefiles; then 5241238106Sdes dlself=yes 5242238106Sdes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 5243238106Sdes dlself=yes 5244238106Sdes else 5245238106Sdes dlself=needless 5246238106Sdes export_dynamic=yes 5247238106Sdes fi 5248238106Sdes prev= 5249238106Sdes continue 5250238106Sdes ;; 5251238106Sdes *) 5252238106Sdes if test "$prev" = dlfiles; then 5253238106Sdes func_append dlfiles " $arg" 5254238106Sdes else 5255238106Sdes func_append dlprefiles " $arg" 5256238106Sdes fi 5257238106Sdes prev= 5258238106Sdes continue 5259238106Sdes ;; 5260238106Sdes esac 5261238106Sdes ;; 5262238106Sdes expsyms) 5263238106Sdes export_symbols="$arg" 5264238106Sdes test -f "$arg" \ 5265238106Sdes || func_fatal_error "symbol file \`$arg' does not exist" 5266238106Sdes prev= 5267238106Sdes continue 5268238106Sdes ;; 5269238106Sdes expsyms_regex) 5270238106Sdes export_symbols_regex="$arg" 5271238106Sdes prev= 5272238106Sdes continue 5273238106Sdes ;; 5274238106Sdes framework) 5275238106Sdes case $host in 5276238106Sdes *-*-darwin*) 5277238106Sdes case "$deplibs " in 5278238106Sdes *" $qarg.ltframework "*) ;; 5279238106Sdes *) func_append deplibs " $qarg.ltframework" # this is fixed later 5280238106Sdes ;; 5281238106Sdes esac 5282238106Sdes ;; 5283238106Sdes esac 5284238106Sdes prev= 5285238106Sdes continue 5286238106Sdes ;; 5287238106Sdes inst_prefix) 5288238106Sdes inst_prefix_dir="$arg" 5289238106Sdes prev= 5290238106Sdes continue 5291238106Sdes ;; 5292238106Sdes objectlist) 5293238106Sdes if test -f "$arg"; then 5294238106Sdes save_arg=$arg 5295238106Sdes moreargs= 5296238106Sdes for fil in `cat "$save_arg"` 5297238106Sdes do 5298238106Sdes# func_append moreargs " $fil" 5299238106Sdes arg=$fil 5300238106Sdes # A libtool-controlled object. 5301238106Sdes 5302238106Sdes # Check to see that this really is a libtool object. 5303238106Sdes if func_lalib_unsafe_p "$arg"; then 5304238106Sdes pic_object= 5305238106Sdes non_pic_object= 5306238106Sdes 5307238106Sdes # Read the .lo file 5308238106Sdes func_source "$arg" 5309238106Sdes 5310238106Sdes if test -z "$pic_object" || 5311238106Sdes test -z "$non_pic_object" || 5312238106Sdes test "$pic_object" = none && 5313238106Sdes test "$non_pic_object" = none; then 5314238106Sdes func_fatal_error "cannot find name of object for \`$arg'" 5315238106Sdes fi 5316238106Sdes 5317238106Sdes # Extract subdirectory from the argument. 5318238106Sdes func_dirname "$arg" "/" "" 5319238106Sdes xdir="$func_dirname_result" 5320238106Sdes 5321238106Sdes if test "$pic_object" != none; then 5322238106Sdes # Prepend the subdirectory the object is found in. 5323238106Sdes pic_object="$xdir$pic_object" 5324238106Sdes 5325238106Sdes if test "$prev" = dlfiles; then 5326238106Sdes if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 5327238106Sdes func_append dlfiles " $pic_object" 5328238106Sdes prev= 5329238106Sdes continue 5330238106Sdes else 5331238106Sdes # If libtool objects are unsupported, then we need to preload. 5332238106Sdes prev=dlprefiles 5333238106Sdes fi 5334238106Sdes fi 5335238106Sdes 5336238106Sdes # CHECK ME: I think I busted this. -Ossama 5337238106Sdes if test "$prev" = dlprefiles; then 5338238106Sdes # Preload the old-style object. 5339238106Sdes func_append dlprefiles " $pic_object" 5340238106Sdes prev= 5341238106Sdes fi 5342238106Sdes 5343238106Sdes # A PIC object. 5344238106Sdes func_append libobjs " $pic_object" 5345238106Sdes arg="$pic_object" 5346238106Sdes fi 5347238106Sdes 5348238106Sdes # Non-PIC object. 5349238106Sdes if test "$non_pic_object" != none; then 5350238106Sdes # Prepend the subdirectory the object is found in. 5351238106Sdes non_pic_object="$xdir$non_pic_object" 5352238106Sdes 5353238106Sdes # A standard non-PIC object 5354238106Sdes func_append non_pic_objects " $non_pic_object" 5355238106Sdes if test -z "$pic_object" || test "$pic_object" = none ; then 5356238106Sdes arg="$non_pic_object" 5357238106Sdes fi 5358238106Sdes else 5359238106Sdes # If the PIC object exists, use it instead. 5360238106Sdes # $xdir was prepended to $pic_object above. 5361238106Sdes non_pic_object="$pic_object" 5362238106Sdes func_append non_pic_objects " $non_pic_object" 5363238106Sdes fi 5364238106Sdes else 5365238106Sdes # Only an error if not doing a dry-run. 5366238106Sdes if $opt_dry_run; then 5367238106Sdes # Extract subdirectory from the argument. 5368238106Sdes func_dirname "$arg" "/" "" 5369238106Sdes xdir="$func_dirname_result" 5370238106Sdes 5371238106Sdes func_lo2o "$arg" 5372238106Sdes pic_object=$xdir$objdir/$func_lo2o_result 5373238106Sdes non_pic_object=$xdir$func_lo2o_result 5374238106Sdes func_append libobjs " $pic_object" 5375238106Sdes func_append non_pic_objects " $non_pic_object" 5376238106Sdes else 5377238106Sdes func_fatal_error "\`$arg' is not a valid libtool object" 5378238106Sdes fi 5379238106Sdes fi 5380238106Sdes done 5381238106Sdes else 5382238106Sdes func_fatal_error "link input file \`$arg' does not exist" 5383238106Sdes fi 5384238106Sdes arg=$save_arg 5385238106Sdes prev= 5386238106Sdes continue 5387238106Sdes ;; 5388238106Sdes precious_regex) 5389238106Sdes precious_files_regex="$arg" 5390238106Sdes prev= 5391238106Sdes continue 5392238106Sdes ;; 5393238106Sdes release) 5394238106Sdes release="-$arg" 5395238106Sdes prev= 5396238106Sdes continue 5397238106Sdes ;; 5398238106Sdes rpath | xrpath) 5399238106Sdes # We need an absolute path. 5400238106Sdes case $arg in 5401238106Sdes [\\/]* | [A-Za-z]:[\\/]*) ;; 5402238106Sdes *) 5403238106Sdes func_fatal_error "only absolute run-paths are allowed" 5404238106Sdes ;; 5405238106Sdes esac 5406238106Sdes if test "$prev" = rpath; then 5407238106Sdes case "$rpath " in 5408238106Sdes *" $arg "*) ;; 5409238106Sdes *) func_append rpath " $arg" ;; 5410238106Sdes esac 5411238106Sdes else 5412238106Sdes case "$xrpath " in 5413238106Sdes *" $arg "*) ;; 5414238106Sdes *) func_append xrpath " $arg" ;; 5415238106Sdes esac 5416238106Sdes fi 5417238106Sdes prev= 5418238106Sdes continue 5419238106Sdes ;; 5420238106Sdes shrext) 5421238106Sdes shrext_cmds="$arg" 5422238106Sdes prev= 5423238106Sdes continue 5424238106Sdes ;; 5425238106Sdes weak) 5426238106Sdes func_append weak_libs " $arg" 5427238106Sdes prev= 5428238106Sdes continue 5429238106Sdes ;; 5430238106Sdes xcclinker) 5431238106Sdes func_append linker_flags " $qarg" 5432238106Sdes func_append compiler_flags " $qarg" 5433238106Sdes prev= 5434238106Sdes func_append compile_command " $qarg" 5435238106Sdes func_append finalize_command " $qarg" 5436238106Sdes continue 5437238106Sdes ;; 5438238106Sdes xcompiler) 5439238106Sdes func_append compiler_flags " $qarg" 5440238106Sdes prev= 5441238106Sdes func_append compile_command " $qarg" 5442238106Sdes func_append finalize_command " $qarg" 5443238106Sdes continue 5444238106Sdes ;; 5445238106Sdes xlinker) 5446238106Sdes func_append linker_flags " $qarg" 5447238106Sdes func_append compiler_flags " $wl$qarg" 5448238106Sdes prev= 5449238106Sdes func_append compile_command " $wl$qarg" 5450238106Sdes func_append finalize_command " $wl$qarg" 5451238106Sdes continue 5452238106Sdes ;; 5453238106Sdes *) 5454238106Sdes eval "$prev=\"\$arg\"" 5455238106Sdes prev= 5456238106Sdes continue 5457238106Sdes ;; 5458238106Sdes esac 5459238106Sdes fi # test -n "$prev" 5460238106Sdes 5461238106Sdes prevarg="$arg" 5462238106Sdes 5463238106Sdes case $arg in 5464238106Sdes -all-static) 5465238106Sdes if test -n "$link_static_flag"; then 5466238106Sdes # See comment for -static flag below, for more details. 5467238106Sdes func_append compile_command " $link_static_flag" 5468238106Sdes func_append finalize_command " $link_static_flag" 5469238106Sdes fi 5470238106Sdes continue 5471238106Sdes ;; 5472238106Sdes 5473238106Sdes -allow-undefined) 5474238106Sdes # FIXME: remove this flag sometime in the future. 5475238106Sdes func_fatal_error "\`-allow-undefined' must not be used because it is the default" 5476238106Sdes ;; 5477238106Sdes 5478238106Sdes -avoid-version) 5479238106Sdes avoid_version=yes 5480238106Sdes continue 5481238106Sdes ;; 5482238106Sdes 5483238106Sdes -bindir) 5484238106Sdes prev=bindir 5485238106Sdes continue 5486238106Sdes ;; 5487238106Sdes 5488238106Sdes -dlopen) 5489238106Sdes prev=dlfiles 5490238106Sdes continue 5491238106Sdes ;; 5492238106Sdes 5493238106Sdes -dlpreopen) 5494238106Sdes prev=dlprefiles 5495238106Sdes continue 5496238106Sdes ;; 5497238106Sdes 5498238106Sdes -export-dynamic) 5499238106Sdes export_dynamic=yes 5500238106Sdes continue 5501238106Sdes ;; 5502238106Sdes 5503238106Sdes -export-symbols | -export-symbols-regex) 5504238106Sdes if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 5505238106Sdes func_fatal_error "more than one -exported-symbols argument is not allowed" 5506238106Sdes fi 5507238106Sdes if test "X$arg" = "X-export-symbols"; then 5508238106Sdes prev=expsyms 5509238106Sdes else 5510238106Sdes prev=expsyms_regex 5511238106Sdes fi 5512238106Sdes continue 5513238106Sdes ;; 5514238106Sdes 5515238106Sdes -framework) 5516238106Sdes prev=framework 5517238106Sdes continue 5518238106Sdes ;; 5519238106Sdes 5520238106Sdes -inst-prefix-dir) 5521238106Sdes prev=inst_prefix 5522238106Sdes continue 5523238106Sdes ;; 5524238106Sdes 5525238106Sdes # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 5526238106Sdes # so, if we see these flags be careful not to treat them like -L 5527238106Sdes -L[A-Z][A-Z]*:*) 5528238106Sdes case $with_gcc/$host in 5529238106Sdes no/*-*-irix* | /*-*-irix*) 5530238106Sdes func_append compile_command " $arg" 5531238106Sdes func_append finalize_command " $arg" 5532238106Sdes ;; 5533238106Sdes esac 5534238106Sdes continue 5535238106Sdes ;; 5536238106Sdes 5537238106Sdes -L*) 5538238106Sdes func_stripname "-L" '' "$arg" 5539238106Sdes if test -z "$func_stripname_result"; then 5540238106Sdes if test "$#" -gt 0; then 5541238106Sdes func_fatal_error "require no space between \`-L' and \`$1'" 5542238106Sdes else 5543238106Sdes func_fatal_error "need path for \`-L' option" 5544238106Sdes fi 5545238106Sdes fi 5546238106Sdes func_resolve_sysroot "$func_stripname_result" 5547238106Sdes dir=$func_resolve_sysroot_result 5548238106Sdes # We need an absolute path. 5549238106Sdes case $dir in 5550238106Sdes [\\/]* | [A-Za-z]:[\\/]*) ;; 5551238106Sdes *) 5552238106Sdes absdir=`cd "$dir" && pwd` 5553238106Sdes test -z "$absdir" && \ 5554238106Sdes func_fatal_error "cannot determine absolute directory name of \`$dir'" 5555238106Sdes dir="$absdir" 5556238106Sdes ;; 5557238106Sdes esac 5558238106Sdes case "$deplibs " in 5559238106Sdes *" -L$dir "* | *" $arg "*) 5560238106Sdes # Will only happen for absolute or sysroot arguments 5561238106Sdes ;; 5562238106Sdes *) 5563238106Sdes # Preserve sysroot, but never include relative directories 5564238106Sdes case $dir in 5565238106Sdes [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 5566238106Sdes *) func_append deplibs " -L$dir" ;; 5567238106Sdes esac 5568238106Sdes func_append lib_search_path " $dir" 5569238106Sdes ;; 5570238106Sdes esac 5571238106Sdes case $host in 5572238106Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 5573238106Sdes testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 5574238106Sdes case :$dllsearchpath: in 5575238106Sdes *":$dir:"*) ;; 5576238106Sdes ::) dllsearchpath=$dir;; 5577238106Sdes *) func_append dllsearchpath ":$dir";; 5578238106Sdes esac 5579238106Sdes case :$dllsearchpath: in 5580238106Sdes *":$testbindir:"*) ;; 5581238106Sdes ::) dllsearchpath=$testbindir;; 5582238106Sdes *) func_append dllsearchpath ":$testbindir";; 5583238106Sdes esac 5584238106Sdes ;; 5585238106Sdes esac 5586238106Sdes continue 5587238106Sdes ;; 5588238106Sdes 5589238106Sdes -l*) 5590238106Sdes if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 5591238106Sdes case $host in 5592238106Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 5593238106Sdes # These systems don't actually have a C or math library (as such) 5594238106Sdes continue 5595238106Sdes ;; 5596238106Sdes *-*-os2*) 5597238106Sdes # These systems don't actually have a C library (as such) 5598238106Sdes test "X$arg" = "X-lc" && continue 5599238106Sdes ;; 5600238106Sdes *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5601238106Sdes # Do not include libc due to us having libc/libc_r. 5602238106Sdes test "X$arg" = "X-lc" && continue 5603238106Sdes ;; 5604238106Sdes *-*-rhapsody* | *-*-darwin1.[012]) 5605238106Sdes # Rhapsody C and math libraries are in the System framework 5606238106Sdes func_append deplibs " System.ltframework" 5607238106Sdes continue 5608238106Sdes ;; 5609238106Sdes *-*-sco3.2v5* | *-*-sco5v6*) 5610238106Sdes # Causes problems with __ctype 5611238106Sdes test "X$arg" = "X-lc" && continue 5612238106Sdes ;; 5613238106Sdes *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 5614238106Sdes # Compiler inserts libc in the correct place for threads to work 5615238106Sdes test "X$arg" = "X-lc" && continue 5616238106Sdes ;; 5617238106Sdes esac 5618238106Sdes elif test "X$arg" = "X-lc_r"; then 5619238106Sdes case $host in 5620238106Sdes *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 5621238106Sdes # Do not include libc_r directly, use -pthread flag. 5622238106Sdes continue 5623238106Sdes ;; 5624238106Sdes esac 5625238106Sdes fi 5626238106Sdes func_append deplibs " $arg" 5627238106Sdes continue 5628238106Sdes ;; 5629238106Sdes 5630238106Sdes -module) 5631238106Sdes module=yes 5632238106Sdes continue 5633238106Sdes ;; 5634238106Sdes 5635238106Sdes # Tru64 UNIX uses -model [arg] to determine the layout of C++ 5636238106Sdes # classes, name mangling, and exception handling. 5637238106Sdes # Darwin uses the -arch flag to determine output architecture. 5638238106Sdes -model|-arch|-isysroot|--sysroot) 5639238106Sdes func_append compiler_flags " $arg" 5640238106Sdes func_append compile_command " $arg" 5641238106Sdes func_append finalize_command " $arg" 5642238106Sdes prev=xcompiler 5643238106Sdes continue 5644238106Sdes ;; 5645238106Sdes 5646238106Sdes -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 5647238106Sdes func_append compiler_flags " $arg" 5648238106Sdes func_append compile_command " $arg" 5649238106Sdes func_append finalize_command " $arg" 5650238106Sdes case "$new_inherited_linker_flags " in 5651238106Sdes *" $arg "*) ;; 5652238106Sdes * ) func_append new_inherited_linker_flags " $arg" ;; 5653238106Sdes esac 5654238106Sdes continue 5655238106Sdes ;; 5656238106Sdes 5657238106Sdes -multi_module) 5658238106Sdes single_module="${wl}-multi_module" 5659238106Sdes continue 5660238106Sdes ;; 5661238106Sdes 5662238106Sdes -no-fast-install) 5663238106Sdes fast_install=no 5664238106Sdes continue 5665238106Sdes ;; 5666238106Sdes 5667238106Sdes -no-install) 5668238106Sdes case $host in 5669238106Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 5670238106Sdes # The PATH hackery in wrapper scripts is required on Windows 5671238106Sdes # and Darwin in order for the loader to find any dlls it needs. 5672238106Sdes func_warning "\`-no-install' is ignored for $host" 5673238106Sdes func_warning "assuming \`-no-fast-install' instead" 5674238106Sdes fast_install=no 5675238106Sdes ;; 5676238106Sdes *) no_install=yes ;; 5677238106Sdes esac 5678238106Sdes continue 5679238106Sdes ;; 5680238106Sdes 5681238106Sdes -no-undefined) 5682238106Sdes allow_undefined=no 5683238106Sdes continue 5684238106Sdes ;; 5685238106Sdes 5686238106Sdes -objectlist) 5687238106Sdes prev=objectlist 5688238106Sdes continue 5689238106Sdes ;; 5690238106Sdes 5691238106Sdes -o) prev=output ;; 5692238106Sdes 5693238106Sdes -precious-files-regex) 5694238106Sdes prev=precious_regex 5695238106Sdes continue 5696238106Sdes ;; 5697238106Sdes 5698238106Sdes -release) 5699238106Sdes prev=release 5700238106Sdes continue 5701238106Sdes ;; 5702238106Sdes 5703238106Sdes -rpath) 5704238106Sdes prev=rpath 5705238106Sdes continue 5706238106Sdes ;; 5707238106Sdes 5708238106Sdes -R) 5709238106Sdes prev=xrpath 5710238106Sdes continue 5711238106Sdes ;; 5712238106Sdes 5713238106Sdes -R*) 5714238106Sdes func_stripname '-R' '' "$arg" 5715238106Sdes dir=$func_stripname_result 5716238106Sdes # We need an absolute path. 5717238106Sdes case $dir in 5718238106Sdes [\\/]* | [A-Za-z]:[\\/]*) ;; 5719238106Sdes =*) 5720238106Sdes func_stripname '=' '' "$dir" 5721238106Sdes dir=$lt_sysroot$func_stripname_result 5722238106Sdes ;; 5723238106Sdes *) 5724238106Sdes func_fatal_error "only absolute run-paths are allowed" 5725238106Sdes ;; 5726238106Sdes esac 5727238106Sdes case "$xrpath " in 5728238106Sdes *" $dir "*) ;; 5729238106Sdes *) func_append xrpath " $dir" ;; 5730238106Sdes esac 5731238106Sdes continue 5732238106Sdes ;; 5733238106Sdes 5734238106Sdes -shared) 5735238106Sdes # The effects of -shared are defined in a previous loop. 5736238106Sdes continue 5737238106Sdes ;; 5738238106Sdes 5739238106Sdes -shrext) 5740238106Sdes prev=shrext 5741238106Sdes continue 5742238106Sdes ;; 5743238106Sdes 5744238106Sdes -static | -static-libtool-libs) 5745238106Sdes # The effects of -static are defined in a previous loop. 5746238106Sdes # We used to do the same as -all-static on platforms that 5747238106Sdes # didn't have a PIC flag, but the assumption that the effects 5748238106Sdes # would be equivalent was wrong. It would break on at least 5749238106Sdes # Digital Unix and AIX. 5750238106Sdes continue 5751238106Sdes ;; 5752238106Sdes 5753238106Sdes -thread-safe) 5754238106Sdes thread_safe=yes 5755238106Sdes continue 5756238106Sdes ;; 5757238106Sdes 5758238106Sdes -version-info) 5759238106Sdes prev=vinfo 5760238106Sdes continue 5761238106Sdes ;; 5762238106Sdes 5763238106Sdes -version-number) 5764238106Sdes prev=vinfo 5765238106Sdes vinfo_number=yes 5766238106Sdes continue 5767238106Sdes ;; 5768238106Sdes 5769238106Sdes -weak) 5770238106Sdes prev=weak 5771238106Sdes continue 5772238106Sdes ;; 5773238106Sdes 5774238106Sdes -Wc,*) 5775238106Sdes func_stripname '-Wc,' '' "$arg" 5776238106Sdes args=$func_stripname_result 5777238106Sdes arg= 5778238106Sdes save_ifs="$IFS"; IFS=',' 5779238106Sdes for flag in $args; do 5780238106Sdes IFS="$save_ifs" 5781238106Sdes func_quote_for_eval "$flag" 5782238106Sdes func_append arg " $func_quote_for_eval_result" 5783238106Sdes func_append compiler_flags " $func_quote_for_eval_result" 5784238106Sdes done 5785238106Sdes IFS="$save_ifs" 5786238106Sdes func_stripname ' ' '' "$arg" 5787238106Sdes arg=$func_stripname_result 5788238106Sdes ;; 5789238106Sdes 5790238106Sdes -Wl,*) 5791238106Sdes func_stripname '-Wl,' '' "$arg" 5792238106Sdes args=$func_stripname_result 5793238106Sdes arg= 5794238106Sdes save_ifs="$IFS"; IFS=',' 5795238106Sdes for flag in $args; do 5796238106Sdes IFS="$save_ifs" 5797238106Sdes func_quote_for_eval "$flag" 5798238106Sdes func_append arg " $wl$func_quote_for_eval_result" 5799238106Sdes func_append compiler_flags " $wl$func_quote_for_eval_result" 5800238106Sdes func_append linker_flags " $func_quote_for_eval_result" 5801238106Sdes done 5802238106Sdes IFS="$save_ifs" 5803238106Sdes func_stripname ' ' '' "$arg" 5804238106Sdes arg=$func_stripname_result 5805238106Sdes ;; 5806238106Sdes 5807238106Sdes -Xcompiler) 5808238106Sdes prev=xcompiler 5809238106Sdes continue 5810238106Sdes ;; 5811238106Sdes 5812238106Sdes -Xlinker) 5813238106Sdes prev=xlinker 5814238106Sdes continue 5815238106Sdes ;; 5816238106Sdes 5817238106Sdes -XCClinker) 5818238106Sdes prev=xcclinker 5819238106Sdes continue 5820238106Sdes ;; 5821238106Sdes 5822238106Sdes # -msg_* for osf cc 5823238106Sdes -msg_*) 5824238106Sdes func_quote_for_eval "$arg" 5825238106Sdes arg="$func_quote_for_eval_result" 5826238106Sdes ;; 5827238106Sdes 5828238106Sdes # Flags to be passed through unchanged, with rationale: 5829238106Sdes # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 5830238106Sdes # -r[0-9][0-9]* specify processor for the SGI compiler 5831238106Sdes # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 5832238106Sdes # +DA*, +DD* enable 64-bit mode for the HP compiler 5833238106Sdes # -q* compiler args for the IBM compiler 5834238106Sdes # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 5835238106Sdes # -F/path path to uninstalled frameworks, gcc on darwin 5836238106Sdes # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 5837238106Sdes # @file GCC response files 5838238106Sdes # -tp=* Portland pgcc target processor selection 5839238106Sdes # --sysroot=* for sysroot support 5840238106Sdes # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 5841238106Sdes -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 5842238106Sdes -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 5843238106Sdes -O*|-flto*|-fwhopr*|-fuse-linker-plugin) 5844238106Sdes func_quote_for_eval "$arg" 5845238106Sdes arg="$func_quote_for_eval_result" 5846238106Sdes func_append compile_command " $arg" 5847238106Sdes func_append finalize_command " $arg" 5848238106Sdes func_append compiler_flags " $arg" 5849238106Sdes continue 5850238106Sdes ;; 5851238106Sdes 5852238106Sdes # Some other compiler flag. 5853238106Sdes -* | +*) 5854238106Sdes func_quote_for_eval "$arg" 5855238106Sdes arg="$func_quote_for_eval_result" 5856238106Sdes ;; 5857238106Sdes 5858238106Sdes *.$objext) 5859238106Sdes # A standard object. 5860238106Sdes func_append objs " $arg" 5861238106Sdes ;; 5862238106Sdes 5863238106Sdes *.lo) 5864238106Sdes # A libtool-controlled object. 5865238106Sdes 5866238106Sdes # Check to see that this really is a libtool object. 5867238106Sdes if func_lalib_unsafe_p "$arg"; then 5868238106Sdes pic_object= 5869238106Sdes non_pic_object= 5870238106Sdes 5871238106Sdes # Read the .lo file 5872238106Sdes func_source "$arg" 5873238106Sdes 5874238106Sdes if test -z "$pic_object" || 5875238106Sdes test -z "$non_pic_object" || 5876238106Sdes test "$pic_object" = none && 5877238106Sdes test "$non_pic_object" = none; then 5878238106Sdes func_fatal_error "cannot find name of object for \`$arg'" 5879238106Sdes fi 5880238106Sdes 5881238106Sdes # Extract subdirectory from the argument. 5882238106Sdes func_dirname "$arg" "/" "" 5883238106Sdes xdir="$func_dirname_result" 5884238106Sdes 5885238106Sdes if test "$pic_object" != none; then 5886238106Sdes # Prepend the subdirectory the object is found in. 5887238106Sdes pic_object="$xdir$pic_object" 5888238106Sdes 5889238106Sdes if test "$prev" = dlfiles; then 5890238106Sdes if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 5891238106Sdes func_append dlfiles " $pic_object" 5892238106Sdes prev= 5893238106Sdes continue 5894238106Sdes else 5895238106Sdes # If libtool objects are unsupported, then we need to preload. 5896238106Sdes prev=dlprefiles 5897238106Sdes fi 5898238106Sdes fi 5899238106Sdes 5900238106Sdes # CHECK ME: I think I busted this. -Ossama 5901238106Sdes if test "$prev" = dlprefiles; then 5902238106Sdes # Preload the old-style object. 5903238106Sdes func_append dlprefiles " $pic_object" 5904238106Sdes prev= 5905238106Sdes fi 5906238106Sdes 5907238106Sdes # A PIC object. 5908238106Sdes func_append libobjs " $pic_object" 5909238106Sdes arg="$pic_object" 5910238106Sdes fi 5911238106Sdes 5912238106Sdes # Non-PIC object. 5913238106Sdes if test "$non_pic_object" != none; then 5914238106Sdes # Prepend the subdirectory the object is found in. 5915238106Sdes non_pic_object="$xdir$non_pic_object" 5916238106Sdes 5917238106Sdes # A standard non-PIC object 5918238106Sdes func_append non_pic_objects " $non_pic_object" 5919238106Sdes if test -z "$pic_object" || test "$pic_object" = none ; then 5920238106Sdes arg="$non_pic_object" 5921238106Sdes fi 5922238106Sdes else 5923238106Sdes # If the PIC object exists, use it instead. 5924238106Sdes # $xdir was prepended to $pic_object above. 5925238106Sdes non_pic_object="$pic_object" 5926238106Sdes func_append non_pic_objects " $non_pic_object" 5927238106Sdes fi 5928238106Sdes else 5929238106Sdes # Only an error if not doing a dry-run. 5930238106Sdes if $opt_dry_run; then 5931238106Sdes # Extract subdirectory from the argument. 5932238106Sdes func_dirname "$arg" "/" "" 5933238106Sdes xdir="$func_dirname_result" 5934238106Sdes 5935238106Sdes func_lo2o "$arg" 5936238106Sdes pic_object=$xdir$objdir/$func_lo2o_result 5937238106Sdes non_pic_object=$xdir$func_lo2o_result 5938238106Sdes func_append libobjs " $pic_object" 5939238106Sdes func_append non_pic_objects " $non_pic_object" 5940238106Sdes else 5941238106Sdes func_fatal_error "\`$arg' is not a valid libtool object" 5942238106Sdes fi 5943238106Sdes fi 5944238106Sdes ;; 5945238106Sdes 5946238106Sdes *.$libext) 5947238106Sdes # An archive. 5948238106Sdes func_append deplibs " $arg" 5949238106Sdes func_append old_deplibs " $arg" 5950238106Sdes continue 5951238106Sdes ;; 5952238106Sdes 5953238106Sdes *.la) 5954238106Sdes # A libtool-controlled library. 5955238106Sdes 5956238106Sdes func_resolve_sysroot "$arg" 5957238106Sdes if test "$prev" = dlfiles; then 5958238106Sdes # This library was specified with -dlopen. 5959238106Sdes func_append dlfiles " $func_resolve_sysroot_result" 5960238106Sdes prev= 5961238106Sdes elif test "$prev" = dlprefiles; then 5962238106Sdes # The library was specified with -dlpreopen. 5963238106Sdes func_append dlprefiles " $func_resolve_sysroot_result" 5964238106Sdes prev= 5965238106Sdes else 5966238106Sdes func_append deplibs " $func_resolve_sysroot_result" 5967238106Sdes fi 5968238106Sdes continue 5969238106Sdes ;; 5970238106Sdes 5971238106Sdes # Some other compiler argument. 5972238106Sdes *) 5973238106Sdes # Unknown arguments in both finalize_command and compile_command need 5974238106Sdes # to be aesthetically quoted because they are evaled later. 5975238106Sdes func_quote_for_eval "$arg" 5976238106Sdes arg="$func_quote_for_eval_result" 5977238106Sdes ;; 5978238106Sdes esac # arg 5979238106Sdes 5980238106Sdes # Now actually substitute the argument into the commands. 5981238106Sdes if test -n "$arg"; then 5982238106Sdes func_append compile_command " $arg" 5983238106Sdes func_append finalize_command " $arg" 5984238106Sdes fi 5985238106Sdes done # argument parsing loop 5986238106Sdes 5987238106Sdes test -n "$prev" && \ 5988238106Sdes func_fatal_help "the \`$prevarg' option requires an argument" 5989238106Sdes 5990238106Sdes if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 5991238106Sdes eval arg=\"$export_dynamic_flag_spec\" 5992238106Sdes func_append compile_command " $arg" 5993238106Sdes func_append finalize_command " $arg" 5994238106Sdes fi 5995238106Sdes 5996238106Sdes oldlibs= 5997238106Sdes # calculate the name of the file, without its directory 5998238106Sdes func_basename "$output" 5999238106Sdes outputname="$func_basename_result" 6000238106Sdes libobjs_save="$libobjs" 6001238106Sdes 6002238106Sdes if test -n "$shlibpath_var"; then 6003238106Sdes # get the directories listed in $shlibpath_var 6004238106Sdes eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` 6005238106Sdes else 6006238106Sdes shlib_search_path= 6007238106Sdes fi 6008238106Sdes eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 6009238106Sdes eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 6010238106Sdes 6011238106Sdes func_dirname "$output" "/" "" 6012238106Sdes output_objdir="$func_dirname_result$objdir" 6013238106Sdes func_to_tool_file "$output_objdir/" 6014238106Sdes tool_output_objdir=$func_to_tool_file_result 6015238106Sdes # Create the object directory. 6016238106Sdes func_mkdir_p "$output_objdir" 6017238106Sdes 6018238106Sdes # Determine the type of output 6019238106Sdes case $output in 6020238106Sdes "") 6021238106Sdes func_fatal_help "you must specify an output file" 6022238106Sdes ;; 6023238106Sdes *.$libext) linkmode=oldlib ;; 6024238106Sdes *.lo | *.$objext) linkmode=obj ;; 6025238106Sdes *.la) linkmode=lib ;; 6026238106Sdes *) linkmode=prog ;; # Anything else should be a program. 6027238106Sdes esac 6028238106Sdes 6029238106Sdes specialdeplibs= 6030238106Sdes 6031238106Sdes libs= 6032238106Sdes # Find all interdependent deplibs by searching for libraries 6033238106Sdes # that are linked more than once (e.g. -la -lb -la) 6034238106Sdes for deplib in $deplibs; do 6035238106Sdes if $opt_preserve_dup_deps ; then 6036238106Sdes case "$libs " in 6037238106Sdes *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6038238106Sdes esac 6039238106Sdes fi 6040238106Sdes func_append libs " $deplib" 6041238106Sdes done 6042238106Sdes 6043238106Sdes if test "$linkmode" = lib; then 6044238106Sdes libs="$predeps $libs $compiler_lib_search_path $postdeps" 6045238106Sdes 6046238106Sdes # Compute libraries that are listed more than once in $predeps 6047238106Sdes # $postdeps and mark them as special (i.e., whose duplicates are 6048238106Sdes # not to be eliminated). 6049238106Sdes pre_post_deps= 6050238106Sdes if $opt_duplicate_compiler_generated_deps; then 6051238106Sdes for pre_post_dep in $predeps $postdeps; do 6052238106Sdes case "$pre_post_deps " in 6053238106Sdes *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 6054238106Sdes esac 6055238106Sdes func_append pre_post_deps " $pre_post_dep" 6056238106Sdes done 6057238106Sdes fi 6058238106Sdes pre_post_deps= 6059238106Sdes fi 6060238106Sdes 6061238106Sdes deplibs= 6062238106Sdes newdependency_libs= 6063238106Sdes newlib_search_path= 6064238106Sdes need_relink=no # whether we're linking any uninstalled libtool libraries 6065238106Sdes notinst_deplibs= # not-installed libtool libraries 6066238106Sdes notinst_path= # paths that contain not-installed libtool libraries 6067238106Sdes 6068238106Sdes case $linkmode in 6069238106Sdes lib) 6070238106Sdes passes="conv dlpreopen link" 6071238106Sdes for file in $dlfiles $dlprefiles; do 6072238106Sdes case $file in 6073238106Sdes *.la) ;; 6074238106Sdes *) 6075238106Sdes func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" 6076238106Sdes ;; 6077238106Sdes esac 6078238106Sdes done 6079238106Sdes ;; 6080238106Sdes prog) 6081238106Sdes compile_deplibs= 6082238106Sdes finalize_deplibs= 6083238106Sdes alldeplibs=no 6084238106Sdes newdlfiles= 6085238106Sdes newdlprefiles= 6086238106Sdes passes="conv scan dlopen dlpreopen link" 6087238106Sdes ;; 6088238106Sdes *) passes="conv" 6089238106Sdes ;; 6090238106Sdes esac 6091238106Sdes 6092238106Sdes for pass in $passes; do 6093238106Sdes # The preopen pass in lib mode reverses $deplibs; put it back here 6094238106Sdes # so that -L comes before libs that need it for instance... 6095238106Sdes if test "$linkmode,$pass" = "lib,link"; then 6096238106Sdes ## FIXME: Find the place where the list is rebuilt in the wrong 6097238106Sdes ## order, and fix it there properly 6098238106Sdes tmp_deplibs= 6099238106Sdes for deplib in $deplibs; do 6100238106Sdes tmp_deplibs="$deplib $tmp_deplibs" 6101238106Sdes done 6102238106Sdes deplibs="$tmp_deplibs" 6103238106Sdes fi 6104238106Sdes 6105238106Sdes if test "$linkmode,$pass" = "lib,link" || 6106238106Sdes test "$linkmode,$pass" = "prog,scan"; then 6107238106Sdes libs="$deplibs" 6108238106Sdes deplibs= 6109238106Sdes fi 6110238106Sdes if test "$linkmode" = prog; then 6111238106Sdes case $pass in 6112238106Sdes dlopen) libs="$dlfiles" ;; 6113238106Sdes dlpreopen) libs="$dlprefiles" ;; 6114238106Sdes link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 6115238106Sdes esac 6116238106Sdes fi 6117238106Sdes if test "$linkmode,$pass" = "lib,dlpreopen"; then 6118238106Sdes # Collect and forward deplibs of preopened libtool libs 6119238106Sdes for lib in $dlprefiles; do 6120238106Sdes # Ignore non-libtool-libs 6121238106Sdes dependency_libs= 6122238106Sdes func_resolve_sysroot "$lib" 6123238106Sdes case $lib in 6124238106Sdes *.la) func_source "$func_resolve_sysroot_result" ;; 6125238106Sdes esac 6126238106Sdes 6127238106Sdes # Collect preopened libtool deplibs, except any this library 6128238106Sdes # has declared as weak libs 6129238106Sdes for deplib in $dependency_libs; do 6130238106Sdes func_basename "$deplib" 6131238106Sdes deplib_base=$func_basename_result 6132238106Sdes case " $weak_libs " in 6133238106Sdes *" $deplib_base "*) ;; 6134238106Sdes *) func_append deplibs " $deplib" ;; 6135238106Sdes esac 6136238106Sdes done 6137238106Sdes done 6138238106Sdes libs="$dlprefiles" 6139238106Sdes fi 6140238106Sdes if test "$pass" = dlopen; then 6141238106Sdes # Collect dlpreopened libraries 6142238106Sdes save_deplibs="$deplibs" 6143238106Sdes deplibs= 6144238106Sdes fi 6145238106Sdes 6146238106Sdes for deplib in $libs; do 6147238106Sdes lib= 6148238106Sdes found=no 6149238106Sdes case $deplib in 6150238106Sdes -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 6151238106Sdes if test "$linkmode,$pass" = "prog,link"; then 6152238106Sdes compile_deplibs="$deplib $compile_deplibs" 6153238106Sdes finalize_deplibs="$deplib $finalize_deplibs" 6154238106Sdes else 6155238106Sdes func_append compiler_flags " $deplib" 6156238106Sdes if test "$linkmode" = lib ; then 6157238106Sdes case "$new_inherited_linker_flags " in 6158238106Sdes *" $deplib "*) ;; 6159238106Sdes * ) func_append new_inherited_linker_flags " $deplib" ;; 6160238106Sdes esac 6161238106Sdes fi 6162238106Sdes fi 6163238106Sdes continue 6164238106Sdes ;; 6165238106Sdes -l*) 6166238106Sdes if test "$linkmode" != lib && test "$linkmode" != prog; then 6167238106Sdes func_warning "\`-l' is ignored for archives/objects" 6168238106Sdes continue 6169238106Sdes fi 6170238106Sdes func_stripname '-l' '' "$deplib" 6171238106Sdes name=$func_stripname_result 6172238106Sdes if test "$linkmode" = lib; then 6173238106Sdes searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 6174238106Sdes else 6175238106Sdes searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 6176238106Sdes fi 6177238106Sdes for searchdir in $searchdirs; do 6178238106Sdes for search_ext in .la $std_shrext .so .a; do 6179238106Sdes # Search the libtool library 6180238106Sdes lib="$searchdir/lib${name}${search_ext}" 6181238106Sdes if test -f "$lib"; then 6182238106Sdes if test "$search_ext" = ".la"; then 6183238106Sdes found=yes 6184238106Sdes else 6185238106Sdes found=no 6186238106Sdes fi 6187238106Sdes break 2 6188238106Sdes fi 6189238106Sdes done 6190238106Sdes done 6191238106Sdes if test "$found" != yes; then 6192238106Sdes # deplib doesn't seem to be a libtool library 6193238106Sdes if test "$linkmode,$pass" = "prog,link"; then 6194238106Sdes compile_deplibs="$deplib $compile_deplibs" 6195238106Sdes finalize_deplibs="$deplib $finalize_deplibs" 6196238106Sdes else 6197238106Sdes deplibs="$deplib $deplibs" 6198238106Sdes test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6199238106Sdes fi 6200238106Sdes continue 6201238106Sdes else # deplib is a libtool library 6202238106Sdes # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 6203238106Sdes # We need to do some special things here, and not later. 6204238106Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 6205238106Sdes case " $predeps $postdeps " in 6206238106Sdes *" $deplib "*) 6207238106Sdes if func_lalib_p "$lib"; then 6208238106Sdes library_names= 6209238106Sdes old_library= 6210238106Sdes func_source "$lib" 6211238106Sdes for l in $old_library $library_names; do 6212238106Sdes ll="$l" 6213238106Sdes done 6214238106Sdes if test "X$ll" = "X$old_library" ; then # only static version available 6215238106Sdes found=no 6216238106Sdes func_dirname "$lib" "" "." 6217238106Sdes ladir="$func_dirname_result" 6218238106Sdes lib=$ladir/$old_library 6219238106Sdes if test "$linkmode,$pass" = "prog,link"; then 6220238106Sdes compile_deplibs="$deplib $compile_deplibs" 6221238106Sdes finalize_deplibs="$deplib $finalize_deplibs" 6222238106Sdes else 6223238106Sdes deplibs="$deplib $deplibs" 6224238106Sdes test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 6225238106Sdes fi 6226238106Sdes continue 6227238106Sdes fi 6228238106Sdes fi 6229238106Sdes ;; 6230238106Sdes *) ;; 6231238106Sdes esac 6232238106Sdes fi 6233238106Sdes fi 6234238106Sdes ;; # -l 6235238106Sdes *.ltframework) 6236238106Sdes if test "$linkmode,$pass" = "prog,link"; then 6237238106Sdes compile_deplibs="$deplib $compile_deplibs" 6238238106Sdes finalize_deplibs="$deplib $finalize_deplibs" 6239238106Sdes else 6240238106Sdes deplibs="$deplib $deplibs" 6241238106Sdes if test "$linkmode" = lib ; then 6242238106Sdes case "$new_inherited_linker_flags " in 6243238106Sdes *" $deplib "*) ;; 6244238106Sdes * ) func_append new_inherited_linker_flags " $deplib" ;; 6245238106Sdes esac 6246238106Sdes fi 6247238106Sdes fi 6248238106Sdes continue 6249238106Sdes ;; 6250238106Sdes -L*) 6251238106Sdes case $linkmode in 6252238106Sdes lib) 6253238106Sdes deplibs="$deplib $deplibs" 6254238106Sdes test "$pass" = conv && continue 6255238106Sdes newdependency_libs="$deplib $newdependency_libs" 6256238106Sdes func_stripname '-L' '' "$deplib" 6257238106Sdes func_resolve_sysroot "$func_stripname_result" 6258238106Sdes func_append newlib_search_path " $func_resolve_sysroot_result" 6259238106Sdes ;; 6260238106Sdes prog) 6261238106Sdes if test "$pass" = conv; then 6262238106Sdes deplibs="$deplib $deplibs" 6263238106Sdes continue 6264238106Sdes fi 6265238106Sdes if test "$pass" = scan; then 6266238106Sdes deplibs="$deplib $deplibs" 6267238106Sdes else 6268238106Sdes compile_deplibs="$deplib $compile_deplibs" 6269238106Sdes finalize_deplibs="$deplib $finalize_deplibs" 6270238106Sdes fi 6271238106Sdes func_stripname '-L' '' "$deplib" 6272238106Sdes func_resolve_sysroot "$func_stripname_result" 6273238106Sdes func_append newlib_search_path " $func_resolve_sysroot_result" 6274238106Sdes ;; 6275238106Sdes *) 6276238106Sdes func_warning "\`-L' is ignored for archives/objects" 6277238106Sdes ;; 6278238106Sdes esac # linkmode 6279238106Sdes continue 6280238106Sdes ;; # -L 6281238106Sdes -R*) 6282238106Sdes if test "$pass" = link; then 6283238106Sdes func_stripname '-R' '' "$deplib" 6284238106Sdes func_resolve_sysroot "$func_stripname_result" 6285238106Sdes dir=$func_resolve_sysroot_result 6286238106Sdes # Make sure the xrpath contains only unique directories. 6287238106Sdes case "$xrpath " in 6288238106Sdes *" $dir "*) ;; 6289238106Sdes *) func_append xrpath " $dir" ;; 6290238106Sdes esac 6291238106Sdes fi 6292238106Sdes deplibs="$deplib $deplibs" 6293238106Sdes continue 6294238106Sdes ;; 6295238106Sdes *.la) 6296238106Sdes func_resolve_sysroot "$deplib" 6297238106Sdes lib=$func_resolve_sysroot_result 6298238106Sdes ;; 6299238106Sdes *.$libext) 6300238106Sdes if test "$pass" = conv; then 6301238106Sdes deplibs="$deplib $deplibs" 6302238106Sdes continue 6303238106Sdes fi 6304238106Sdes case $linkmode in 6305238106Sdes lib) 6306238106Sdes # Linking convenience modules into shared libraries is allowed, 6307238106Sdes # but linking other static libraries is non-portable. 6308238106Sdes case " $dlpreconveniencelibs " in 6309238106Sdes *" $deplib "*) ;; 6310238106Sdes *) 6311238106Sdes valid_a_lib=no 6312238106Sdes case $deplibs_check_method in 6313238106Sdes match_pattern*) 6314238106Sdes set dummy $deplibs_check_method; shift 6315238106Sdes match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 6316238106Sdes if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 6317238106Sdes | $EGREP "$match_pattern_regex" > /dev/null; then 6318238106Sdes valid_a_lib=yes 6319238106Sdes fi 6320238106Sdes ;; 6321238106Sdes pass_all) 6322238106Sdes valid_a_lib=yes 6323238106Sdes ;; 6324238106Sdes esac 6325238106Sdes if test "$valid_a_lib" != yes; then 6326238106Sdes echo 6327238106Sdes $ECHO "*** Warning: Trying to link with static lib archive $deplib." 6328238106Sdes echo "*** I have the capability to make that library automatically link in when" 6329238106Sdes echo "*** you link to this library. But I can only do this if you have a" 6330238106Sdes echo "*** shared version of the library, which you do not appear to have" 6331238106Sdes echo "*** because the file extensions .$libext of this argument makes me believe" 6332238106Sdes echo "*** that it is just a static archive that I should not use here." 6333238106Sdes else 6334238106Sdes echo 6335238106Sdes $ECHO "*** Warning: Linking the shared library $output against the" 6336238106Sdes $ECHO "*** static library $deplib is not portable!" 6337238106Sdes deplibs="$deplib $deplibs" 6338238106Sdes fi 6339238106Sdes ;; 6340238106Sdes esac 6341238106Sdes continue 6342238106Sdes ;; 6343238106Sdes prog) 6344238106Sdes if test "$pass" != link; then 6345238106Sdes deplibs="$deplib $deplibs" 6346238106Sdes else 6347238106Sdes compile_deplibs="$deplib $compile_deplibs" 6348238106Sdes finalize_deplibs="$deplib $finalize_deplibs" 6349238106Sdes fi 6350238106Sdes continue 6351238106Sdes ;; 6352238106Sdes esac # linkmode 6353238106Sdes ;; # *.$libext 6354238106Sdes *.lo | *.$objext) 6355238106Sdes if test "$pass" = conv; then 6356238106Sdes deplibs="$deplib $deplibs" 6357238106Sdes elif test "$linkmode" = prog; then 6358238106Sdes if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 6359238106Sdes # If there is no dlopen support or we're linking statically, 6360238106Sdes # we need to preload. 6361238106Sdes func_append newdlprefiles " $deplib" 6362238106Sdes compile_deplibs="$deplib $compile_deplibs" 6363238106Sdes finalize_deplibs="$deplib $finalize_deplibs" 6364238106Sdes else 6365238106Sdes func_append newdlfiles " $deplib" 6366238106Sdes fi 6367238106Sdes fi 6368238106Sdes continue 6369238106Sdes ;; 6370238106Sdes %DEPLIBS%) 6371238106Sdes alldeplibs=yes 6372238106Sdes continue 6373238106Sdes ;; 6374238106Sdes esac # case $deplib 6375238106Sdes 6376238106Sdes if test "$found" = yes || test -f "$lib"; then : 6377238106Sdes else 6378238106Sdes func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" 6379238106Sdes fi 6380238106Sdes 6381238106Sdes # Check to see that this really is a libtool archive. 6382238106Sdes func_lalib_unsafe_p "$lib" \ 6383238106Sdes || func_fatal_error "\`$lib' is not a valid libtool archive" 6384238106Sdes 6385238106Sdes func_dirname "$lib" "" "." 6386238106Sdes ladir="$func_dirname_result" 6387238106Sdes 6388238106Sdes dlname= 6389238106Sdes dlopen= 6390238106Sdes dlpreopen= 6391238106Sdes libdir= 6392238106Sdes library_names= 6393238106Sdes old_library= 6394238106Sdes inherited_linker_flags= 6395238106Sdes # If the library was installed with an old release of libtool, 6396238106Sdes # it will not redefine variables installed, or shouldnotlink 6397238106Sdes installed=yes 6398238106Sdes shouldnotlink=no 6399238106Sdes avoidtemprpath= 6400238106Sdes 6401238106Sdes 6402238106Sdes # Read the .la file 6403238106Sdes func_source "$lib" 6404238106Sdes 6405238106Sdes # Convert "-framework foo" to "foo.ltframework" 6406238106Sdes if test -n "$inherited_linker_flags"; then 6407238106Sdes tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 6408238106Sdes for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 6409238106Sdes case " $new_inherited_linker_flags " in 6410238106Sdes *" $tmp_inherited_linker_flag "*) ;; 6411238106Sdes *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 6412238106Sdes esac 6413238106Sdes done 6414238106Sdes fi 6415238106Sdes dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 6416238106Sdes if test "$linkmode,$pass" = "lib,link" || 6417238106Sdes test "$linkmode,$pass" = "prog,scan" || 6418238106Sdes { test "$linkmode" != prog && test "$linkmode" != lib; }; then 6419238106Sdes test -n "$dlopen" && func_append dlfiles " $dlopen" 6420238106Sdes test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 6421238106Sdes fi 6422238106Sdes 6423238106Sdes if test "$pass" = conv; then 6424238106Sdes # Only check for convenience libraries 6425238106Sdes deplibs="$lib $deplibs" 6426238106Sdes if test -z "$libdir"; then 6427238106Sdes if test -z "$old_library"; then 6428238106Sdes func_fatal_error "cannot find name of link library for \`$lib'" 6429238106Sdes fi 6430238106Sdes # It is a libtool convenience library, so add in its objects. 6431238106Sdes func_append convenience " $ladir/$objdir/$old_library" 6432238106Sdes func_append old_convenience " $ladir/$objdir/$old_library" 6433238106Sdes elif test "$linkmode" != prog && test "$linkmode" != lib; then 6434238106Sdes func_fatal_error "\`$lib' is not a convenience library" 6435238106Sdes fi 6436238106Sdes tmp_libs= 6437238106Sdes for deplib in $dependency_libs; do 6438238106Sdes deplibs="$deplib $deplibs" 6439238106Sdes if $opt_preserve_dup_deps ; then 6440238106Sdes case "$tmp_libs " in 6441238106Sdes *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6442238106Sdes esac 6443238106Sdes fi 6444238106Sdes func_append tmp_libs " $deplib" 6445238106Sdes done 6446238106Sdes continue 6447238106Sdes fi # $pass = conv 6448238106Sdes 6449238106Sdes 6450238106Sdes # Get the name of the library we link against. 6451238106Sdes linklib= 6452238106Sdes if test -n "$old_library" && 6453238106Sdes { test "$prefer_static_libs" = yes || 6454238106Sdes test "$prefer_static_libs,$installed" = "built,no"; }; then 6455238106Sdes linklib=$old_library 6456238106Sdes else 6457238106Sdes for l in $old_library $library_names; do 6458238106Sdes linklib="$l" 6459238106Sdes done 6460238106Sdes fi 6461238106Sdes if test -z "$linklib"; then 6462238106Sdes func_fatal_error "cannot find name of link library for \`$lib'" 6463238106Sdes fi 6464238106Sdes 6465238106Sdes # This library was specified with -dlopen. 6466238106Sdes if test "$pass" = dlopen; then 6467238106Sdes if test -z "$libdir"; then 6468238106Sdes func_fatal_error "cannot -dlopen a convenience library: \`$lib'" 6469238106Sdes fi 6470238106Sdes if test -z "$dlname" || 6471238106Sdes test "$dlopen_support" != yes || 6472238106Sdes test "$build_libtool_libs" = no; then 6473238106Sdes # If there is no dlname, no dlopen support or we're linking 6474238106Sdes # statically, we need to preload. We also need to preload any 6475238106Sdes # dependent libraries so libltdl's deplib preloader doesn't 6476238106Sdes # bomb out in the load deplibs phase. 6477238106Sdes func_append dlprefiles " $lib $dependency_libs" 6478238106Sdes else 6479238106Sdes func_append newdlfiles " $lib" 6480238106Sdes fi 6481238106Sdes continue 6482238106Sdes fi # $pass = dlopen 6483238106Sdes 6484238106Sdes # We need an absolute path. 6485238106Sdes case $ladir in 6486238106Sdes [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 6487238106Sdes *) 6488238106Sdes abs_ladir=`cd "$ladir" && pwd` 6489238106Sdes if test -z "$abs_ladir"; then 6490238106Sdes func_warning "cannot determine absolute directory name of \`$ladir'" 6491238106Sdes func_warning "passing it literally to the linker, although it might fail" 6492238106Sdes abs_ladir="$ladir" 6493238106Sdes fi 6494238106Sdes ;; 6495238106Sdes esac 6496238106Sdes func_basename "$lib" 6497238106Sdes laname="$func_basename_result" 6498238106Sdes 6499238106Sdes # Find the relevant object directory and library name. 6500238106Sdes if test "X$installed" = Xyes; then 6501238106Sdes if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6502238106Sdes func_warning "library \`$lib' was moved." 6503238106Sdes dir="$ladir" 6504238106Sdes absdir="$abs_ladir" 6505238106Sdes libdir="$abs_ladir" 6506238106Sdes else 6507238106Sdes dir="$lt_sysroot$libdir" 6508238106Sdes absdir="$lt_sysroot$libdir" 6509238106Sdes fi 6510238106Sdes test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 6511238106Sdes else 6512238106Sdes if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 6513238106Sdes dir="$ladir" 6514238106Sdes absdir="$abs_ladir" 6515238106Sdes # Remove this search path later 6516238106Sdes func_append notinst_path " $abs_ladir" 6517238106Sdes else 6518238106Sdes dir="$ladir/$objdir" 6519238106Sdes absdir="$abs_ladir/$objdir" 6520238106Sdes # Remove this search path later 6521238106Sdes func_append notinst_path " $abs_ladir" 6522238106Sdes fi 6523238106Sdes fi # $installed = yes 6524238106Sdes func_stripname 'lib' '.la' "$laname" 6525238106Sdes name=$func_stripname_result 6526238106Sdes 6527238106Sdes # This library was specified with -dlpreopen. 6528238106Sdes if test "$pass" = dlpreopen; then 6529238106Sdes if test -z "$libdir" && test "$linkmode" = prog; then 6530238106Sdes func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" 6531238106Sdes fi 6532238106Sdes case "$host" in 6533238106Sdes # special handling for platforms with PE-DLLs. 6534238106Sdes *cygwin* | *mingw* | *cegcc* ) 6535238106Sdes # Linker will automatically link against shared library if both 6536238106Sdes # static and shared are present. Therefore, ensure we extract 6537238106Sdes # symbols from the import library if a shared library is present 6538238106Sdes # (otherwise, the dlopen module name will be incorrect). We do 6539238106Sdes # this by putting the import library name into $newdlprefiles. 6540238106Sdes # We recover the dlopen module name by 'saving' the la file 6541238106Sdes # name in a special purpose variable, and (later) extracting the 6542238106Sdes # dlname from the la file. 6543238106Sdes if test -n "$dlname"; then 6544238106Sdes func_tr_sh "$dir/$linklib" 6545238106Sdes eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 6546238106Sdes func_append newdlprefiles " $dir/$linklib" 6547238106Sdes else 6548238106Sdes func_append newdlprefiles " $dir/$old_library" 6549238106Sdes # Keep a list of preopened convenience libraries to check 6550238106Sdes # that they are being used correctly in the link pass. 6551238106Sdes test -z "$libdir" && \ 6552238106Sdes func_append dlpreconveniencelibs " $dir/$old_library" 6553238106Sdes fi 6554238106Sdes ;; 6555238106Sdes * ) 6556238106Sdes # Prefer using a static library (so that no silly _DYNAMIC symbols 6557238106Sdes # are required to link). 6558238106Sdes if test -n "$old_library"; then 6559238106Sdes func_append newdlprefiles " $dir/$old_library" 6560238106Sdes # Keep a list of preopened convenience libraries to check 6561238106Sdes # that they are being used correctly in the link pass. 6562238106Sdes test -z "$libdir" && \ 6563238106Sdes func_append dlpreconveniencelibs " $dir/$old_library" 6564238106Sdes # Otherwise, use the dlname, so that lt_dlopen finds it. 6565238106Sdes elif test -n "$dlname"; then 6566238106Sdes func_append newdlprefiles " $dir/$dlname" 6567238106Sdes else 6568238106Sdes func_append newdlprefiles " $dir/$linklib" 6569238106Sdes fi 6570238106Sdes ;; 6571238106Sdes esac 6572238106Sdes fi # $pass = dlpreopen 6573238106Sdes 6574238106Sdes if test -z "$libdir"; then 6575238106Sdes # Link the convenience library 6576238106Sdes if test "$linkmode" = lib; then 6577238106Sdes deplibs="$dir/$old_library $deplibs" 6578238106Sdes elif test "$linkmode,$pass" = "prog,link"; then 6579238106Sdes compile_deplibs="$dir/$old_library $compile_deplibs" 6580238106Sdes finalize_deplibs="$dir/$old_library $finalize_deplibs" 6581238106Sdes else 6582238106Sdes deplibs="$lib $deplibs" # used for prog,scan pass 6583238106Sdes fi 6584238106Sdes continue 6585238106Sdes fi 6586238106Sdes 6587238106Sdes 6588238106Sdes if test "$linkmode" = prog && test "$pass" != link; then 6589238106Sdes func_append newlib_search_path " $ladir" 6590238106Sdes deplibs="$lib $deplibs" 6591238106Sdes 6592238106Sdes linkalldeplibs=no 6593238106Sdes if test "$link_all_deplibs" != no || test -z "$library_names" || 6594238106Sdes test "$build_libtool_libs" = no; then 6595238106Sdes linkalldeplibs=yes 6596238106Sdes fi 6597238106Sdes 6598238106Sdes tmp_libs= 6599238106Sdes for deplib in $dependency_libs; do 6600238106Sdes case $deplib in 6601238106Sdes -L*) func_stripname '-L' '' "$deplib" 6602238106Sdes func_resolve_sysroot "$func_stripname_result" 6603238106Sdes func_append newlib_search_path " $func_resolve_sysroot_result" 6604238106Sdes ;; 6605238106Sdes esac 6606238106Sdes # Need to link against all dependency_libs? 6607238106Sdes if test "$linkalldeplibs" = yes; then 6608238106Sdes deplibs="$deplib $deplibs" 6609238106Sdes else 6610238106Sdes # Need to hardcode shared library paths 6611238106Sdes # or/and link against static libraries 6612238106Sdes newdependency_libs="$deplib $newdependency_libs" 6613238106Sdes fi 6614238106Sdes if $opt_preserve_dup_deps ; then 6615238106Sdes case "$tmp_libs " in 6616238106Sdes *" $deplib "*) func_append specialdeplibs " $deplib" ;; 6617238106Sdes esac 6618238106Sdes fi 6619238106Sdes func_append tmp_libs " $deplib" 6620238106Sdes done # for deplib 6621238106Sdes continue 6622238106Sdes fi # $linkmode = prog... 6623238106Sdes 6624238106Sdes if test "$linkmode,$pass" = "prog,link"; then 6625238106Sdes if test -n "$library_names" && 6626238106Sdes { { test "$prefer_static_libs" = no || 6627238106Sdes test "$prefer_static_libs,$installed" = "built,yes"; } || 6628238106Sdes test -z "$old_library"; }; then 6629238106Sdes # We need to hardcode the library path 6630238106Sdes if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 6631238106Sdes # Make sure the rpath contains only unique directories. 6632238106Sdes case "$temp_rpath:" in 6633238106Sdes *"$absdir:"*) ;; 6634238106Sdes *) func_append temp_rpath "$absdir:" ;; 6635238106Sdes esac 6636238106Sdes fi 6637238106Sdes 6638238106Sdes # Hardcode the library path. 6639238106Sdes # Skip directories that are in the system default run-time 6640238106Sdes # search path. 6641238106Sdes case " $sys_lib_dlsearch_path " in 6642238106Sdes *" $absdir "*) ;; 6643238106Sdes *) 6644238106Sdes case "$compile_rpath " in 6645238106Sdes *" $absdir "*) ;; 6646238106Sdes *) func_append compile_rpath " $absdir" ;; 6647238106Sdes esac 6648238106Sdes ;; 6649238106Sdes esac 6650238106Sdes case " $sys_lib_dlsearch_path " in 6651238106Sdes *" $libdir "*) ;; 6652238106Sdes *) 6653238106Sdes case "$finalize_rpath " in 6654238106Sdes *" $libdir "*) ;; 6655238106Sdes *) func_append finalize_rpath " $libdir" ;; 6656238106Sdes esac 6657238106Sdes ;; 6658238106Sdes esac 6659238106Sdes fi # $linkmode,$pass = prog,link... 6660238106Sdes 6661238106Sdes if test "$alldeplibs" = yes && 6662238106Sdes { test "$deplibs_check_method" = pass_all || 6663238106Sdes { test "$build_libtool_libs" = yes && 6664238106Sdes test -n "$library_names"; }; }; then 6665238106Sdes # We only need to search for static libraries 6666238106Sdes continue 6667238106Sdes fi 6668238106Sdes fi 6669238106Sdes 6670238106Sdes link_static=no # Whether the deplib will be linked statically 6671238106Sdes use_static_libs=$prefer_static_libs 6672238106Sdes if test "$use_static_libs" = built && test "$installed" = yes; then 6673238106Sdes use_static_libs=no 6674238106Sdes fi 6675238106Sdes if test -n "$library_names" && 6676238106Sdes { test "$use_static_libs" = no || test -z "$old_library"; }; then 6677238106Sdes case $host in 6678238106Sdes *cygwin* | *mingw* | *cegcc*) 6679238106Sdes # No point in relinking DLLs because paths are not encoded 6680238106Sdes func_append notinst_deplibs " $lib" 6681238106Sdes need_relink=no 6682238106Sdes ;; 6683238106Sdes *) 6684238106Sdes if test "$installed" = no; then 6685238106Sdes func_append notinst_deplibs " $lib" 6686238106Sdes need_relink=yes 6687238106Sdes fi 6688238106Sdes ;; 6689238106Sdes esac 6690238106Sdes # This is a shared library 6691238106Sdes 6692238106Sdes # Warn about portability, can't link against -module's on some 6693238106Sdes # systems (darwin). Don't bleat about dlopened modules though! 6694238106Sdes dlopenmodule="" 6695238106Sdes for dlpremoduletest in $dlprefiles; do 6696238106Sdes if test "X$dlpremoduletest" = "X$lib"; then 6697238106Sdes dlopenmodule="$dlpremoduletest" 6698238106Sdes break 6699238106Sdes fi 6700238106Sdes done 6701238106Sdes if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then 6702238106Sdes echo 6703238106Sdes if test "$linkmode" = prog; then 6704238106Sdes $ECHO "*** Warning: Linking the executable $output against the loadable module" 6705238106Sdes else 6706238106Sdes $ECHO "*** Warning: Linking the shared library $output against the loadable module" 6707238106Sdes fi 6708238106Sdes $ECHO "*** $linklib is not portable!" 6709238106Sdes fi 6710238106Sdes if test "$linkmode" = lib && 6711238106Sdes test "$hardcode_into_libs" = yes; then 6712238106Sdes # Hardcode the library path. 6713238106Sdes # Skip directories that are in the system default run-time 6714238106Sdes # search path. 6715238106Sdes case " $sys_lib_dlsearch_path " in 6716238106Sdes *" $absdir "*) ;; 6717238106Sdes *) 6718238106Sdes case "$compile_rpath " in 6719238106Sdes *" $absdir "*) ;; 6720238106Sdes *) func_append compile_rpath " $absdir" ;; 6721238106Sdes esac 6722238106Sdes ;; 6723238106Sdes esac 6724238106Sdes case " $sys_lib_dlsearch_path " in 6725238106Sdes *" $libdir "*) ;; 6726238106Sdes *) 6727238106Sdes case "$finalize_rpath " in 6728238106Sdes *" $libdir "*) ;; 6729238106Sdes *) func_append finalize_rpath " $libdir" ;; 6730238106Sdes esac 6731238106Sdes ;; 6732238106Sdes esac 6733238106Sdes fi 6734238106Sdes 6735238106Sdes if test -n "$old_archive_from_expsyms_cmds"; then 6736238106Sdes # figure out the soname 6737238106Sdes set dummy $library_names 6738238106Sdes shift 6739238106Sdes realname="$1" 6740238106Sdes shift 6741238106Sdes libname=`eval "\\$ECHO \"$libname_spec\""` 6742238106Sdes # use dlname if we got it. it's perfectly good, no? 6743238106Sdes if test -n "$dlname"; then 6744238106Sdes soname="$dlname" 6745238106Sdes elif test -n "$soname_spec"; then 6746238106Sdes # bleh windows 6747238106Sdes case $host in 6748238106Sdes *cygwin* | mingw* | *cegcc*) 6749238106Sdes func_arith $current - $age 6750238106Sdes major=$func_arith_result 6751238106Sdes versuffix="-$major" 6752238106Sdes ;; 6753238106Sdes esac 6754238106Sdes eval soname=\"$soname_spec\" 6755238106Sdes else 6756238106Sdes soname="$realname" 6757238106Sdes fi 6758238106Sdes 6759238106Sdes # Make a new name for the extract_expsyms_cmds to use 6760238106Sdes soroot="$soname" 6761238106Sdes func_basename "$soroot" 6762238106Sdes soname="$func_basename_result" 6763238106Sdes func_stripname 'lib' '.dll' "$soname" 6764238106Sdes newlib=libimp-$func_stripname_result.a 6765238106Sdes 6766238106Sdes # If the library has no export list, then create one now 6767238106Sdes if test -f "$output_objdir/$soname-def"; then : 6768238106Sdes else 6769238106Sdes func_verbose "extracting exported symbol list from \`$soname'" 6770238106Sdes func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 6771238106Sdes fi 6772238106Sdes 6773238106Sdes # Create $newlib 6774238106Sdes if test -f "$output_objdir/$newlib"; then :; else 6775238106Sdes func_verbose "generating import library for \`$soname'" 6776238106Sdes func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 6777238106Sdes fi 6778238106Sdes # make sure the library variables are pointing to the new library 6779238106Sdes dir=$output_objdir 6780238106Sdes linklib=$newlib 6781238106Sdes fi # test -n "$old_archive_from_expsyms_cmds" 6782238106Sdes 6783238106Sdes if test "$linkmode" = prog || test "$opt_mode" != relink; then 6784238106Sdes add_shlibpath= 6785238106Sdes add_dir= 6786238106Sdes add= 6787238106Sdes lib_linked=yes 6788238106Sdes case $hardcode_action in 6789238106Sdes immediate | unsupported) 6790238106Sdes if test "$hardcode_direct" = no; then 6791238106Sdes add="$dir/$linklib" 6792238106Sdes case $host in 6793238106Sdes *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 6794238106Sdes *-*-sysv4*uw2*) add_dir="-L$dir" ;; 6795238106Sdes *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 6796238106Sdes *-*-unixware7*) add_dir="-L$dir" ;; 6797238106Sdes *-*-darwin* ) 6798238106Sdes # if the lib is a (non-dlopened) module then we can not 6799238106Sdes # link against it, someone is ignoring the earlier warnings 6800238106Sdes if /usr/bin/file -L $add 2> /dev/null | 6801238106Sdes $GREP ": [^:]* bundle" >/dev/null ; then 6802238106Sdes if test "X$dlopenmodule" != "X$lib"; then 6803238106Sdes $ECHO "*** Warning: lib $linklib is a module, not a shared library" 6804238106Sdes if test -z "$old_library" ; then 6805238106Sdes echo 6806238106Sdes echo "*** And there doesn't seem to be a static archive available" 6807238106Sdes echo "*** The link will probably fail, sorry" 6808238106Sdes else 6809238106Sdes add="$dir/$old_library" 6810238106Sdes fi 6811238106Sdes elif test -n "$old_library"; then 6812238106Sdes add="$dir/$old_library" 6813238106Sdes fi 6814238106Sdes fi 6815238106Sdes esac 6816238106Sdes elif test "$hardcode_minus_L" = no; then 6817238106Sdes case $host in 6818238106Sdes *-*-sunos*) add_shlibpath="$dir" ;; 6819238106Sdes esac 6820238106Sdes add_dir="-L$dir" 6821238106Sdes add="-l$name" 6822238106Sdes elif test "$hardcode_shlibpath_var" = no; then 6823238106Sdes add_shlibpath="$dir" 6824238106Sdes add="-l$name" 6825238106Sdes else 6826238106Sdes lib_linked=no 6827238106Sdes fi 6828238106Sdes ;; 6829238106Sdes relink) 6830238106Sdes if test "$hardcode_direct" = yes && 6831238106Sdes test "$hardcode_direct_absolute" = no; then 6832238106Sdes add="$dir/$linklib" 6833238106Sdes elif test "$hardcode_minus_L" = yes; then 6834238106Sdes add_dir="-L$dir" 6835238106Sdes # Try looking first in the location we're being installed to. 6836238106Sdes if test -n "$inst_prefix_dir"; then 6837238106Sdes case $libdir in 6838238106Sdes [\\/]*) 6839238106Sdes func_append add_dir " -L$inst_prefix_dir$libdir" 6840238106Sdes ;; 6841238106Sdes esac 6842238106Sdes fi 6843238106Sdes add="-l$name" 6844238106Sdes elif test "$hardcode_shlibpath_var" = yes; then 6845238106Sdes add_shlibpath="$dir" 6846238106Sdes add="-l$name" 6847238106Sdes else 6848238106Sdes lib_linked=no 6849238106Sdes fi 6850238106Sdes ;; 6851238106Sdes *) lib_linked=no ;; 6852238106Sdes esac 6853238106Sdes 6854238106Sdes if test "$lib_linked" != yes; then 6855238106Sdes func_fatal_configuration "unsupported hardcode properties" 6856238106Sdes fi 6857238106Sdes 6858238106Sdes if test -n "$add_shlibpath"; then 6859238106Sdes case :$compile_shlibpath: in 6860238106Sdes *":$add_shlibpath:"*) ;; 6861238106Sdes *) func_append compile_shlibpath "$add_shlibpath:" ;; 6862238106Sdes esac 6863238106Sdes fi 6864238106Sdes if test "$linkmode" = prog; then 6865238106Sdes test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 6866238106Sdes test -n "$add" && compile_deplibs="$add $compile_deplibs" 6867238106Sdes else 6868238106Sdes test -n "$add_dir" && deplibs="$add_dir $deplibs" 6869238106Sdes test -n "$add" && deplibs="$add $deplibs" 6870238106Sdes if test "$hardcode_direct" != yes && 6871238106Sdes test "$hardcode_minus_L" != yes && 6872238106Sdes test "$hardcode_shlibpath_var" = yes; then 6873238106Sdes case :$finalize_shlibpath: in 6874238106Sdes *":$libdir:"*) ;; 6875238106Sdes *) func_append finalize_shlibpath "$libdir:" ;; 6876238106Sdes esac 6877238106Sdes fi 6878238106Sdes fi 6879238106Sdes fi 6880238106Sdes 6881238106Sdes if test "$linkmode" = prog || test "$opt_mode" = relink; then 6882238106Sdes add_shlibpath= 6883238106Sdes add_dir= 6884238106Sdes add= 6885238106Sdes # Finalize command for both is simple: just hardcode it. 6886238106Sdes if test "$hardcode_direct" = yes && 6887238106Sdes test "$hardcode_direct_absolute" = no; then 6888238106Sdes add="$libdir/$linklib" 6889238106Sdes elif test "$hardcode_minus_L" = yes; then 6890238106Sdes add_dir="-L$libdir" 6891238106Sdes add="-l$name" 6892238106Sdes elif test "$hardcode_shlibpath_var" = yes; then 6893238106Sdes case :$finalize_shlibpath: in 6894238106Sdes *":$libdir:"*) ;; 6895238106Sdes *) func_append finalize_shlibpath "$libdir:" ;; 6896238106Sdes esac 6897238106Sdes add="-l$name" 6898238106Sdes elif test "$hardcode_automatic" = yes; then 6899238106Sdes if test -n "$inst_prefix_dir" && 6900238106Sdes test -f "$inst_prefix_dir$libdir/$linklib" ; then 6901238106Sdes add="$inst_prefix_dir$libdir/$linklib" 6902238106Sdes else 6903238106Sdes add="$libdir/$linklib" 6904238106Sdes fi 6905238106Sdes else 6906238106Sdes # We cannot seem to hardcode it, guess we'll fake it. 6907238106Sdes add_dir="-L$libdir" 6908238106Sdes # Try looking first in the location we're being installed to. 6909238106Sdes if test -n "$inst_prefix_dir"; then 6910238106Sdes case $libdir in 6911238106Sdes [\\/]*) 6912238106Sdes func_append add_dir " -L$inst_prefix_dir$libdir" 6913238106Sdes ;; 6914238106Sdes esac 6915238106Sdes fi 6916238106Sdes add="-l$name" 6917238106Sdes fi 6918238106Sdes 6919238106Sdes if test "$linkmode" = prog; then 6920238106Sdes test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 6921238106Sdes test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 6922238106Sdes else 6923238106Sdes test -n "$add_dir" && deplibs="$add_dir $deplibs" 6924238106Sdes test -n "$add" && deplibs="$add $deplibs" 6925238106Sdes fi 6926238106Sdes fi 6927238106Sdes elif test "$linkmode" = prog; then 6928238106Sdes # Here we assume that one of hardcode_direct or hardcode_minus_L 6929238106Sdes # is not unsupported. This is valid on all known static and 6930238106Sdes # shared platforms. 6931238106Sdes if test "$hardcode_direct" != unsupported; then 6932238106Sdes test -n "$old_library" && linklib="$old_library" 6933238106Sdes compile_deplibs="$dir/$linklib $compile_deplibs" 6934238106Sdes finalize_deplibs="$dir/$linklib $finalize_deplibs" 6935238106Sdes else 6936238106Sdes compile_deplibs="-l$name -L$dir $compile_deplibs" 6937238106Sdes finalize_deplibs="-l$name -L$dir $finalize_deplibs" 6938238106Sdes fi 6939238106Sdes elif test "$build_libtool_libs" = yes; then 6940238106Sdes # Not a shared library 6941238106Sdes if test "$deplibs_check_method" != pass_all; then 6942238106Sdes # We're trying link a shared library against a static one 6943238106Sdes # but the system doesn't support it. 6944238106Sdes 6945238106Sdes # Just print a warning and add the library to dependency_libs so 6946238106Sdes # that the program can be linked against the static library. 6947238106Sdes echo 6948238106Sdes $ECHO "*** Warning: This system can not link to static lib archive $lib." 6949238106Sdes echo "*** I have the capability to make that library automatically link in when" 6950238106Sdes echo "*** you link to this library. But I can only do this if you have a" 6951238106Sdes echo "*** shared version of the library, which you do not appear to have." 6952238106Sdes if test "$module" = yes; then 6953238106Sdes echo "*** But as you try to build a module library, libtool will still create " 6954238106Sdes echo "*** a static module, that should work as long as the dlopening application" 6955238106Sdes echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 6956238106Sdes if test -z "$global_symbol_pipe"; then 6957238106Sdes echo 6958238106Sdes echo "*** However, this would only work if libtool was able to extract symbol" 6959238106Sdes echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 6960238106Sdes echo "*** not find such a program. So, this module is probably useless." 6961238106Sdes echo "*** \`nm' from GNU binutils and a full rebuild may help." 6962238106Sdes fi 6963238106Sdes if test "$build_old_libs" = no; then 6964238106Sdes build_libtool_libs=module 6965238106Sdes build_old_libs=yes 6966238106Sdes else 6967238106Sdes build_libtool_libs=no 6968238106Sdes fi 6969238106Sdes fi 6970238106Sdes else 6971238106Sdes deplibs="$dir/$old_library $deplibs" 6972238106Sdes link_static=yes 6973238106Sdes fi 6974238106Sdes fi # link shared/static library? 6975238106Sdes 6976238106Sdes if test "$linkmode" = lib; then 6977238106Sdes if test -n "$dependency_libs" && 6978238106Sdes { test "$hardcode_into_libs" != yes || 6979238106Sdes test "$build_old_libs" = yes || 6980238106Sdes test "$link_static" = yes; }; then 6981238106Sdes # Extract -R from dependency_libs 6982238106Sdes temp_deplibs= 6983238106Sdes for libdir in $dependency_libs; do 6984238106Sdes case $libdir in 6985238106Sdes -R*) func_stripname '-R' '' "$libdir" 6986238106Sdes temp_xrpath=$func_stripname_result 6987238106Sdes case " $xrpath " in 6988238106Sdes *" $temp_xrpath "*) ;; 6989238106Sdes *) func_append xrpath " $temp_xrpath";; 6990238106Sdes esac;; 6991238106Sdes *) func_append temp_deplibs " $libdir";; 6992238106Sdes esac 6993238106Sdes done 6994238106Sdes dependency_libs="$temp_deplibs" 6995238106Sdes fi 6996238106Sdes 6997238106Sdes func_append newlib_search_path " $absdir" 6998238106Sdes # Link against this library 6999238106Sdes test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 7000238106Sdes # ... and its dependency_libs 7001238106Sdes tmp_libs= 7002238106Sdes for deplib in $dependency_libs; do 7003238106Sdes newdependency_libs="$deplib $newdependency_libs" 7004238106Sdes case $deplib in 7005238106Sdes -L*) func_stripname '-L' '' "$deplib" 7006238106Sdes func_resolve_sysroot "$func_stripname_result";; 7007238106Sdes *) func_resolve_sysroot "$deplib" ;; 7008238106Sdes esac 7009238106Sdes if $opt_preserve_dup_deps ; then 7010238106Sdes case "$tmp_libs " in 7011238106Sdes *" $func_resolve_sysroot_result "*) 7012238106Sdes func_append specialdeplibs " $func_resolve_sysroot_result" ;; 7013238106Sdes esac 7014238106Sdes fi 7015238106Sdes func_append tmp_libs " $func_resolve_sysroot_result" 7016238106Sdes done 7017238106Sdes 7018238106Sdes if test "$link_all_deplibs" != no; then 7019238106Sdes # Add the search paths of all dependency libraries 7020238106Sdes for deplib in $dependency_libs; do 7021238106Sdes path= 7022238106Sdes case $deplib in 7023238106Sdes -L*) path="$deplib" ;; 7024238106Sdes *.la) 7025238106Sdes func_resolve_sysroot "$deplib" 7026238106Sdes deplib=$func_resolve_sysroot_result 7027238106Sdes func_dirname "$deplib" "" "." 7028238106Sdes dir=$func_dirname_result 7029238106Sdes # We need an absolute path. 7030238106Sdes case $dir in 7031238106Sdes [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 7032238106Sdes *) 7033238106Sdes absdir=`cd "$dir" && pwd` 7034238106Sdes if test -z "$absdir"; then 7035238106Sdes func_warning "cannot determine absolute directory name of \`$dir'" 7036238106Sdes absdir="$dir" 7037238106Sdes fi 7038238106Sdes ;; 7039238106Sdes esac 7040238106Sdes if $GREP "^installed=no" $deplib > /dev/null; then 7041238106Sdes case $host in 7042238106Sdes *-*-darwin*) 7043238106Sdes depdepl= 7044238106Sdes eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 7045238106Sdes if test -n "$deplibrary_names" ; then 7046238106Sdes for tmp in $deplibrary_names ; do 7047238106Sdes depdepl=$tmp 7048238106Sdes done 7049238106Sdes if test -f "$absdir/$objdir/$depdepl" ; then 7050238106Sdes depdepl="$absdir/$objdir/$depdepl" 7051238106Sdes darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7052238106Sdes if test -z "$darwin_install_name"; then 7053238106Sdes darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 7054238106Sdes fi 7055238106Sdes func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" 7056238106Sdes func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" 7057238106Sdes path= 7058238106Sdes fi 7059238106Sdes fi 7060238106Sdes ;; 7061238106Sdes *) 7062238106Sdes path="-L$absdir/$objdir" 7063238106Sdes ;; 7064238106Sdes esac 7065238106Sdes else 7066238106Sdes eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 7067238106Sdes test -z "$libdir" && \ 7068238106Sdes func_fatal_error "\`$deplib' is not a valid libtool archive" 7069238106Sdes test "$absdir" != "$libdir" && \ 7070238106Sdes func_warning "\`$deplib' seems to be moved" 7071238106Sdes 7072238106Sdes path="-L$absdir" 7073238106Sdes fi 7074238106Sdes ;; 7075238106Sdes esac 7076238106Sdes case " $deplibs " in 7077238106Sdes *" $path "*) ;; 7078238106Sdes *) deplibs="$path $deplibs" ;; 7079238106Sdes esac 7080238106Sdes done 7081238106Sdes fi # link_all_deplibs != no 7082238106Sdes fi # linkmode = lib 7083238106Sdes done # for deplib in $libs 7084238106Sdes if test "$pass" = link; then 7085238106Sdes if test "$linkmode" = "prog"; then 7086238106Sdes compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 7087238106Sdes finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 7088238106Sdes else 7089238106Sdes compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7090238106Sdes fi 7091238106Sdes fi 7092238106Sdes dependency_libs="$newdependency_libs" 7093238106Sdes if test "$pass" = dlpreopen; then 7094238106Sdes # Link the dlpreopened libraries before other libraries 7095238106Sdes for deplib in $save_deplibs; do 7096238106Sdes deplibs="$deplib $deplibs" 7097238106Sdes done 7098238106Sdes fi 7099238106Sdes if test "$pass" != dlopen; then 7100238106Sdes if test "$pass" != conv; then 7101238106Sdes # Make sure lib_search_path contains only unique directories. 7102238106Sdes lib_search_path= 7103238106Sdes for dir in $newlib_search_path; do 7104238106Sdes case "$lib_search_path " in 7105238106Sdes *" $dir "*) ;; 7106238106Sdes *) func_append lib_search_path " $dir" ;; 7107238106Sdes esac 7108238106Sdes done 7109238106Sdes newlib_search_path= 7110238106Sdes fi 7111238106Sdes 7112238106Sdes if test "$linkmode,$pass" != "prog,link"; then 7113238106Sdes vars="deplibs" 7114238106Sdes else 7115238106Sdes vars="compile_deplibs finalize_deplibs" 7116238106Sdes fi 7117238106Sdes for var in $vars dependency_libs; do 7118238106Sdes # Add libraries to $var in reverse order 7119238106Sdes eval tmp_libs=\"\$$var\" 7120238106Sdes new_libs= 7121238106Sdes for deplib in $tmp_libs; do 7122238106Sdes # FIXME: Pedantically, this is the right thing to do, so 7123238106Sdes # that some nasty dependency loop isn't accidentally 7124238106Sdes # broken: 7125238106Sdes #new_libs="$deplib $new_libs" 7126238106Sdes # Pragmatically, this seems to cause very few problems in 7127238106Sdes # practice: 7128238106Sdes case $deplib in 7129238106Sdes -L*) new_libs="$deplib $new_libs" ;; 7130238106Sdes -R*) ;; 7131238106Sdes *) 7132238106Sdes # And here is the reason: when a library appears more 7133238106Sdes # than once as an explicit dependence of a library, or 7134238106Sdes # is implicitly linked in more than once by the 7135238106Sdes # compiler, it is considered special, and multiple 7136238106Sdes # occurrences thereof are not removed. Compare this 7137238106Sdes # with having the same library being listed as a 7138238106Sdes # dependency of multiple other libraries: in this case, 7139238106Sdes # we know (pedantically, we assume) the library does not 7140238106Sdes # need to be listed more than once, so we keep only the 7141238106Sdes # last copy. This is not always right, but it is rare 7142238106Sdes # enough that we require users that really mean to play 7143238106Sdes # such unportable linking tricks to link the library 7144238106Sdes # using -Wl,-lname, so that libtool does not consider it 7145238106Sdes # for duplicate removal. 7146238106Sdes case " $specialdeplibs " in 7147238106Sdes *" $deplib "*) new_libs="$deplib $new_libs" ;; 7148238106Sdes *) 7149238106Sdes case " $new_libs " in 7150238106Sdes *" $deplib "*) ;; 7151238106Sdes *) new_libs="$deplib $new_libs" ;; 7152238106Sdes esac 7153238106Sdes ;; 7154238106Sdes esac 7155238106Sdes ;; 7156238106Sdes esac 7157238106Sdes done 7158238106Sdes tmp_libs= 7159238106Sdes for deplib in $new_libs; do 7160238106Sdes case $deplib in 7161238106Sdes -L*) 7162238106Sdes case " $tmp_libs " in 7163238106Sdes *" $deplib "*) ;; 7164238106Sdes *) func_append tmp_libs " $deplib" ;; 7165238106Sdes esac 7166238106Sdes ;; 7167238106Sdes *) func_append tmp_libs " $deplib" ;; 7168238106Sdes esac 7169238106Sdes done 7170238106Sdes eval $var=\"$tmp_libs\" 7171238106Sdes done # for var 7172238106Sdes fi 7173238106Sdes # Last step: remove runtime libs from dependency_libs 7174238106Sdes # (they stay in deplibs) 7175238106Sdes tmp_libs= 7176238106Sdes for i in $dependency_libs ; do 7177238106Sdes case " $predeps $postdeps $compiler_lib_search_path " in 7178238106Sdes *" $i "*) 7179238106Sdes i="" 7180238106Sdes ;; 7181238106Sdes esac 7182238106Sdes if test -n "$i" ; then 7183238106Sdes func_append tmp_libs " $i" 7184238106Sdes fi 7185238106Sdes done 7186238106Sdes dependency_libs=$tmp_libs 7187238106Sdes done # for pass 7188238106Sdes if test "$linkmode" = prog; then 7189238106Sdes dlfiles="$newdlfiles" 7190238106Sdes fi 7191238106Sdes if test "$linkmode" = prog || test "$linkmode" = lib; then 7192238106Sdes dlprefiles="$newdlprefiles" 7193238106Sdes fi 7194238106Sdes 7195238106Sdes case $linkmode in 7196238106Sdes oldlib) 7197238106Sdes if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 7198238106Sdes func_warning "\`-dlopen' is ignored for archives" 7199238106Sdes fi 7200238106Sdes 7201238106Sdes case " $deplibs" in 7202238106Sdes *\ -l* | *\ -L*) 7203238106Sdes func_warning "\`-l' and \`-L' are ignored for archives" ;; 7204238106Sdes esac 7205238106Sdes 7206238106Sdes test -n "$rpath" && \ 7207238106Sdes func_warning "\`-rpath' is ignored for archives" 7208238106Sdes 7209238106Sdes test -n "$xrpath" && \ 7210238106Sdes func_warning "\`-R' is ignored for archives" 7211238106Sdes 7212238106Sdes test -n "$vinfo" && \ 7213238106Sdes func_warning "\`-version-info/-version-number' is ignored for archives" 7214238106Sdes 7215238106Sdes test -n "$release" && \ 7216238106Sdes func_warning "\`-release' is ignored for archives" 7217238106Sdes 7218238106Sdes test -n "$export_symbols$export_symbols_regex" && \ 7219238106Sdes func_warning "\`-export-symbols' is ignored for archives" 7220238106Sdes 7221238106Sdes # Now set the variables for building old libraries. 7222238106Sdes build_libtool_libs=no 7223238106Sdes oldlibs="$output" 7224238106Sdes func_append objs "$old_deplibs" 7225238106Sdes ;; 7226238106Sdes 7227238106Sdes lib) 7228238106Sdes # Make sure we only generate libraries of the form `libNAME.la'. 7229238106Sdes case $outputname in 7230238106Sdes lib*) 7231238106Sdes func_stripname 'lib' '.la' "$outputname" 7232238106Sdes name=$func_stripname_result 7233238106Sdes eval shared_ext=\"$shrext_cmds\" 7234238106Sdes eval libname=\"$libname_spec\" 7235238106Sdes ;; 7236238106Sdes *) 7237238106Sdes test "$module" = no && \ 7238238106Sdes func_fatal_help "libtool library \`$output' must begin with \`lib'" 7239238106Sdes 7240238106Sdes if test "$need_lib_prefix" != no; then 7241238106Sdes # Add the "lib" prefix for modules if required 7242238106Sdes func_stripname '' '.la' "$outputname" 7243238106Sdes name=$func_stripname_result 7244238106Sdes eval shared_ext=\"$shrext_cmds\" 7245238106Sdes eval libname=\"$libname_spec\" 7246238106Sdes else 7247238106Sdes func_stripname '' '.la' "$outputname" 7248238106Sdes libname=$func_stripname_result 7249238106Sdes fi 7250238106Sdes ;; 7251238106Sdes esac 7252238106Sdes 7253238106Sdes if test -n "$objs"; then 7254238106Sdes if test "$deplibs_check_method" != pass_all; then 7255238106Sdes func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 7256238106Sdes else 7257238106Sdes echo 7258238106Sdes $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 7259238106Sdes $ECHO "*** objects $objs is not portable!" 7260238106Sdes func_append libobjs " $objs" 7261238106Sdes fi 7262238106Sdes fi 7263238106Sdes 7264238106Sdes test "$dlself" != no && \ 7265238106Sdes func_warning "\`-dlopen self' is ignored for libtool libraries" 7266238106Sdes 7267238106Sdes set dummy $rpath 7268238106Sdes shift 7269238106Sdes test "$#" -gt 1 && \ 7270238106Sdes func_warning "ignoring multiple \`-rpath's for a libtool library" 7271238106Sdes 7272238106Sdes install_libdir="$1" 7273238106Sdes 7274238106Sdes oldlibs= 7275238106Sdes if test -z "$rpath"; then 7276238106Sdes if test "$build_libtool_libs" = yes; then 7277238106Sdes # Building a libtool convenience library. 7278238106Sdes # Some compilers have problems with a `.al' extension so 7279238106Sdes # convenience libraries should have the same extension an 7280238106Sdes # archive normally would. 7281238106Sdes oldlibs="$output_objdir/$libname.$libext $oldlibs" 7282238106Sdes build_libtool_libs=convenience 7283238106Sdes build_old_libs=yes 7284238106Sdes fi 7285238106Sdes 7286238106Sdes test -n "$vinfo" && \ 7287238106Sdes func_warning "\`-version-info/-version-number' is ignored for convenience libraries" 7288238106Sdes 7289238106Sdes test -n "$release" && \ 7290238106Sdes func_warning "\`-release' is ignored for convenience libraries" 7291238106Sdes else 7292238106Sdes 7293238106Sdes # Parse the version information argument. 7294238106Sdes save_ifs="$IFS"; IFS=':' 7295238106Sdes set dummy $vinfo 0 0 0 7296238106Sdes shift 7297238106Sdes IFS="$save_ifs" 7298238106Sdes 7299238106Sdes test -n "$7" && \ 7300238106Sdes func_fatal_help "too many parameters to \`-version-info'" 7301238106Sdes 7302238106Sdes # convert absolute version numbers to libtool ages 7303238106Sdes # this retains compatibility with .la files and attempts 7304238106Sdes # to make the code below a bit more comprehensible 7305238106Sdes 7306238106Sdes case $vinfo_number in 7307238106Sdes yes) 7308238106Sdes number_major="$1" 7309238106Sdes number_minor="$2" 7310238106Sdes number_revision="$3" 7311238106Sdes # 7312238106Sdes # There are really only two kinds -- those that 7313238106Sdes # use the current revision as the major version 7314238106Sdes # and those that subtract age and use age as 7315238106Sdes # a minor version. But, then there is irix 7316238106Sdes # which has an extra 1 added just for fun 7317238106Sdes # 7318238106Sdes case $version_type in 7319238106Sdes darwin|linux|osf|windows|none) 7320238106Sdes func_arith $number_major + $number_minor 7321238106Sdes current=$func_arith_result 7322238106Sdes age="$number_minor" 7323238106Sdes revision="$number_revision" 7324238106Sdes ;; 7325238106Sdes freebsd-aout|freebsd-elf|qnx|sunos) 7326238106Sdes current="$number_major" 7327238106Sdes revision="$number_minor" 7328238106Sdes age="0" 7329238106Sdes ;; 7330238106Sdes irix|nonstopux) 7331238106Sdes func_arith $number_major + $number_minor 7332238106Sdes current=$func_arith_result 7333238106Sdes age="$number_minor" 7334238106Sdes revision="$number_minor" 7335238106Sdes lt_irix_increment=no 7336238106Sdes ;; 7337238106Sdes esac 7338238106Sdes ;; 7339238106Sdes no) 7340238106Sdes current="$1" 7341238106Sdes revision="$2" 7342238106Sdes age="$3" 7343238106Sdes ;; 7344238106Sdes esac 7345238106Sdes 7346238106Sdes # Check that each of the things are valid numbers. 7347238106Sdes case $current in 7348238106Sdes 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]) ;; 7349238106Sdes *) 7350238106Sdes func_error "CURRENT \`$current' must be a nonnegative integer" 7351238106Sdes func_fatal_error "\`$vinfo' is not valid version information" 7352238106Sdes ;; 7353238106Sdes esac 7354238106Sdes 7355238106Sdes case $revision in 7356238106Sdes 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]) ;; 7357238106Sdes *) 7358238106Sdes func_error "REVISION \`$revision' must be a nonnegative integer" 7359238106Sdes func_fatal_error "\`$vinfo' is not valid version information" 7360238106Sdes ;; 7361238106Sdes esac 7362238106Sdes 7363238106Sdes case $age in 7364238106Sdes 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]) ;; 7365238106Sdes *) 7366238106Sdes func_error "AGE \`$age' must be a nonnegative integer" 7367238106Sdes func_fatal_error "\`$vinfo' is not valid version information" 7368238106Sdes ;; 7369238106Sdes esac 7370238106Sdes 7371238106Sdes if test "$age" -gt "$current"; then 7372238106Sdes func_error "AGE \`$age' is greater than the current interface number \`$current'" 7373238106Sdes func_fatal_error "\`$vinfo' is not valid version information" 7374238106Sdes fi 7375238106Sdes 7376238106Sdes # Calculate the version variables. 7377238106Sdes major= 7378238106Sdes versuffix= 7379238106Sdes verstring= 7380238106Sdes case $version_type in 7381238106Sdes none) ;; 7382238106Sdes 7383238106Sdes darwin) 7384238106Sdes # Like Linux, but with the current version available in 7385238106Sdes # verstring for coding it into the library header 7386238106Sdes func_arith $current - $age 7387238106Sdes major=.$func_arith_result 7388238106Sdes versuffix="$major.$age.$revision" 7389238106Sdes # Darwin ld doesn't like 0 for these options... 7390238106Sdes func_arith $current + 1 7391238106Sdes minor_current=$func_arith_result 7392238106Sdes xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 7393238106Sdes verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 7394238106Sdes ;; 7395238106Sdes 7396238106Sdes freebsd-aout) 7397238106Sdes major=".$current" 7398238106Sdes versuffix=".$current.$revision"; 7399238106Sdes ;; 7400238106Sdes 7401238106Sdes freebsd-elf) 7402238106Sdes major=".$current" 7403238106Sdes versuffix=".$current" 7404238106Sdes ;; 7405238106Sdes 7406238106Sdes irix | nonstopux) 7407238106Sdes if test "X$lt_irix_increment" = "Xno"; then 7408238106Sdes func_arith $current - $age 7409238106Sdes else 7410238106Sdes func_arith $current - $age + 1 7411238106Sdes fi 7412238106Sdes major=$func_arith_result 7413238106Sdes 7414238106Sdes case $version_type in 7415238106Sdes nonstopux) verstring_prefix=nonstopux ;; 7416238106Sdes *) verstring_prefix=sgi ;; 7417238106Sdes esac 7418238106Sdes verstring="$verstring_prefix$major.$revision" 7419238106Sdes 7420238106Sdes # Add in all the interfaces that we are compatible with. 7421238106Sdes loop=$revision 7422238106Sdes while test "$loop" -ne 0; do 7423238106Sdes func_arith $revision - $loop 7424238106Sdes iface=$func_arith_result 7425238106Sdes func_arith $loop - 1 7426238106Sdes loop=$func_arith_result 7427238106Sdes verstring="$verstring_prefix$major.$iface:$verstring" 7428238106Sdes done 7429238106Sdes 7430238106Sdes # Before this point, $major must not contain `.'. 7431238106Sdes major=.$major 7432238106Sdes versuffix="$major.$revision" 7433238106Sdes ;; 7434238106Sdes 7435238106Sdes linux) 7436238106Sdes func_arith $current - $age 7437238106Sdes major=.$func_arith_result 7438238106Sdes versuffix="$major.$age.$revision" 7439238106Sdes ;; 7440238106Sdes 7441238106Sdes osf) 7442238106Sdes func_arith $current - $age 7443238106Sdes major=.$func_arith_result 7444238106Sdes versuffix=".$current.$age.$revision" 7445238106Sdes verstring="$current.$age.$revision" 7446238106Sdes 7447238106Sdes # Add in all the interfaces that we are compatible with. 7448238106Sdes loop=$age 7449238106Sdes while test "$loop" -ne 0; do 7450238106Sdes func_arith $current - $loop 7451238106Sdes iface=$func_arith_result 7452238106Sdes func_arith $loop - 1 7453238106Sdes loop=$func_arith_result 7454238106Sdes verstring="$verstring:${iface}.0" 7455238106Sdes done 7456238106Sdes 7457238106Sdes # Make executables depend on our current version. 7458238106Sdes func_append verstring ":${current}.0" 7459238106Sdes ;; 7460238106Sdes 7461238106Sdes qnx) 7462238106Sdes major=".$current" 7463238106Sdes versuffix=".$current" 7464238106Sdes ;; 7465238106Sdes 7466238106Sdes sunos) 7467238106Sdes major=".$current" 7468238106Sdes versuffix=".$current.$revision" 7469238106Sdes ;; 7470238106Sdes 7471238106Sdes windows) 7472238106Sdes # Use '-' rather than '.', since we only want one 7473238106Sdes # extension on DOS 8.3 filesystems. 7474238106Sdes func_arith $current - $age 7475238106Sdes major=$func_arith_result 7476238106Sdes versuffix="-$major" 7477238106Sdes ;; 7478238106Sdes 7479238106Sdes *) 7480238106Sdes func_fatal_configuration "unknown library version type \`$version_type'" 7481238106Sdes ;; 7482238106Sdes esac 7483238106Sdes 7484238106Sdes # Clear the version info if we defaulted, and they specified a release. 7485238106Sdes if test -z "$vinfo" && test -n "$release"; then 7486238106Sdes major= 7487238106Sdes case $version_type in 7488238106Sdes darwin) 7489238106Sdes # we can't check for "0.0" in archive_cmds due to quoting 7490238106Sdes # problems, so we reset it completely 7491238106Sdes verstring= 7492238106Sdes ;; 7493238106Sdes *) 7494238106Sdes verstring="0.0" 7495238106Sdes ;; 7496238106Sdes esac 7497238106Sdes if test "$need_version" = no; then 7498238106Sdes versuffix= 7499238106Sdes else 7500238106Sdes versuffix=".0.0" 7501238106Sdes fi 7502238106Sdes fi 7503238106Sdes 7504238106Sdes # Remove version info from name if versioning should be avoided 7505238106Sdes if test "$avoid_version" = yes && test "$need_version" = no; then 7506238106Sdes major= 7507238106Sdes versuffix= 7508238106Sdes verstring="" 7509238106Sdes fi 7510238106Sdes 7511238106Sdes # Check to see if the archive will have undefined symbols. 7512238106Sdes if test "$allow_undefined" = yes; then 7513238106Sdes if test "$allow_undefined_flag" = unsupported; then 7514238106Sdes func_warning "undefined symbols not allowed in $host shared libraries" 7515238106Sdes build_libtool_libs=no 7516238106Sdes build_old_libs=yes 7517238106Sdes fi 7518238106Sdes else 7519238106Sdes # Don't allow undefined symbols. 7520238106Sdes allow_undefined_flag="$no_undefined_flag" 7521238106Sdes fi 7522238106Sdes 7523238106Sdes fi 7524238106Sdes 7525238106Sdes func_generate_dlsyms "$libname" "$libname" "yes" 7526238106Sdes func_append libobjs " $symfileobj" 7527238106Sdes test "X$libobjs" = "X " && libobjs= 7528238106Sdes 7529238106Sdes if test "$opt_mode" != relink; then 7530238106Sdes # Remove our outputs, but don't remove object files since they 7531238106Sdes # may have been created when compiling PIC objects. 7532238106Sdes removelist= 7533238106Sdes tempremovelist=`$ECHO "$output_objdir/*"` 7534238106Sdes for p in $tempremovelist; do 7535238106Sdes case $p in 7536238106Sdes *.$objext | *.gcno) 7537238106Sdes ;; 7538238106Sdes $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 7539238106Sdes if test "X$precious_files_regex" != "X"; then 7540238106Sdes if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 7541238106Sdes then 7542238106Sdes continue 7543238106Sdes fi 7544238106Sdes fi 7545238106Sdes func_append removelist " $p" 7546238106Sdes ;; 7547238106Sdes *) ;; 7548238106Sdes esac 7549238106Sdes done 7550238106Sdes test -n "$removelist" && \ 7551238106Sdes func_show_eval "${RM}r \$removelist" 7552238106Sdes fi 7553238106Sdes 7554238106Sdes # Now set the variables for building old libraries. 7555238106Sdes if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 7556238106Sdes func_append oldlibs " $output_objdir/$libname.$libext" 7557238106Sdes 7558238106Sdes # Transform .lo files to .o files. 7559238106Sdes oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` 7560238106Sdes fi 7561238106Sdes 7562238106Sdes # Eliminate all temporary directories. 7563238106Sdes #for path in $notinst_path; do 7564238106Sdes # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 7565238106Sdes # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 7566238106Sdes # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 7567238106Sdes #done 7568238106Sdes 7569238106Sdes if test -n "$xrpath"; then 7570238106Sdes # If the user specified any rpath flags, then add them. 7571238106Sdes temp_xrpath= 7572238106Sdes for libdir in $xrpath; do 7573238106Sdes func_replace_sysroot "$libdir" 7574238106Sdes func_append temp_xrpath " -R$func_replace_sysroot_result" 7575238106Sdes case "$finalize_rpath " in 7576238106Sdes *" $libdir "*) ;; 7577238106Sdes *) func_append finalize_rpath " $libdir" ;; 7578238106Sdes esac 7579238106Sdes done 7580238106Sdes if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 7581238106Sdes dependency_libs="$temp_xrpath $dependency_libs" 7582238106Sdes fi 7583238106Sdes fi 7584238106Sdes 7585238106Sdes # Make sure dlfiles contains only unique files that won't be dlpreopened 7586238106Sdes old_dlfiles="$dlfiles" 7587238106Sdes dlfiles= 7588238106Sdes for lib in $old_dlfiles; do 7589238106Sdes case " $dlprefiles $dlfiles " in 7590238106Sdes *" $lib "*) ;; 7591238106Sdes *) func_append dlfiles " $lib" ;; 7592238106Sdes esac 7593238106Sdes done 7594238106Sdes 7595238106Sdes # Make sure dlprefiles contains only unique files 7596238106Sdes old_dlprefiles="$dlprefiles" 7597238106Sdes dlprefiles= 7598238106Sdes for lib in $old_dlprefiles; do 7599238106Sdes case "$dlprefiles " in 7600238106Sdes *" $lib "*) ;; 7601238106Sdes *) func_append dlprefiles " $lib" ;; 7602238106Sdes esac 7603238106Sdes done 7604238106Sdes 7605238106Sdes if test "$build_libtool_libs" = yes; then 7606238106Sdes if test -n "$rpath"; then 7607238106Sdes case $host in 7608238106Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 7609238106Sdes # these systems don't actually have a c library (as such)! 7610238106Sdes ;; 7611238106Sdes *-*-rhapsody* | *-*-darwin1.[012]) 7612238106Sdes # Rhapsody C library is in the System framework 7613238106Sdes func_append deplibs " System.ltframework" 7614238106Sdes ;; 7615238106Sdes *-*-netbsd*) 7616238106Sdes # Don't link with libc until the a.out ld.so is fixed. 7617238106Sdes ;; 7618238106Sdes *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 7619238106Sdes # Do not include libc due to us having libc/libc_r. 7620238106Sdes ;; 7621238106Sdes *-*-sco3.2v5* | *-*-sco5v6*) 7622238106Sdes # Causes problems with __ctype 7623238106Sdes ;; 7624238106Sdes *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 7625238106Sdes # Compiler inserts libc in the correct place for threads to work 7626238106Sdes ;; 7627238106Sdes *) 7628238106Sdes # Add libc to deplibs on all other systems if necessary. 7629238106Sdes if test "$build_libtool_need_lc" = "yes"; then 7630238106Sdes func_append deplibs " -lc" 7631238106Sdes fi 7632238106Sdes ;; 7633238106Sdes esac 7634238106Sdes fi 7635238106Sdes 7636238106Sdes # Transform deplibs into only deplibs that can be linked in shared. 7637238106Sdes name_save=$name 7638238106Sdes libname_save=$libname 7639238106Sdes release_save=$release 7640238106Sdes versuffix_save=$versuffix 7641238106Sdes major_save=$major 7642238106Sdes # I'm not sure if I'm treating the release correctly. I think 7643238106Sdes # release should show up in the -l (ie -lgmp5) so we don't want to 7644238106Sdes # add it in twice. Is that correct? 7645238106Sdes release="" 7646238106Sdes versuffix="" 7647238106Sdes major="" 7648238106Sdes newdeplibs= 7649238106Sdes droppeddeps=no 7650238106Sdes case $deplibs_check_method in 7651238106Sdes pass_all) 7652238106Sdes # Don't check for shared/static. Everything works. 7653238106Sdes # This might be a little naive. We might want to check 7654238106Sdes # whether the library exists or not. But this is on 7655238106Sdes # osf3 & osf4 and I'm not really sure... Just 7656238106Sdes # implementing what was already the behavior. 7657238106Sdes newdeplibs=$deplibs 7658238106Sdes ;; 7659238106Sdes test_compile) 7660238106Sdes # This code stresses the "libraries are programs" paradigm to its 7661238106Sdes # limits. Maybe even breaks it. We compile a program, linking it 7662238106Sdes # against the deplibs as a proxy for the library. Then we can check 7663238106Sdes # whether they linked in statically or dynamically with ldd. 7664238106Sdes $opt_dry_run || $RM conftest.c 7665238106Sdes cat > conftest.c <<EOF 7666238106Sdes int main() { return 0; } 7667238106SdesEOF 7668238106Sdes $opt_dry_run || $RM conftest 7669238106Sdes if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 7670238106Sdes ldd_output=`ldd conftest` 7671238106Sdes for i in $deplibs; do 7672238106Sdes case $i in 7673238106Sdes -l*) 7674238106Sdes func_stripname -l '' "$i" 7675238106Sdes name=$func_stripname_result 7676238106Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7677238106Sdes case " $predeps $postdeps " in 7678238106Sdes *" $i "*) 7679238106Sdes func_append newdeplibs " $i" 7680238106Sdes i="" 7681238106Sdes ;; 7682238106Sdes esac 7683238106Sdes fi 7684238106Sdes if test -n "$i" ; then 7685238106Sdes libname=`eval "\\$ECHO \"$libname_spec\""` 7686238106Sdes deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7687238106Sdes set dummy $deplib_matches; shift 7688238106Sdes deplib_match=$1 7689238106Sdes if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7690238106Sdes func_append newdeplibs " $i" 7691238106Sdes else 7692238106Sdes droppeddeps=yes 7693238106Sdes echo 7694238106Sdes $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7695238106Sdes echo "*** I have the capability to make that library automatically link in when" 7696238106Sdes echo "*** you link to this library. But I can only do this if you have a" 7697238106Sdes echo "*** shared version of the library, which I believe you do not have" 7698238106Sdes echo "*** because a test_compile did reveal that the linker did not use it for" 7699238106Sdes echo "*** its dynamic dependency list that programs get resolved with at runtime." 7700238106Sdes fi 7701238106Sdes fi 7702238106Sdes ;; 7703238106Sdes *) 7704238106Sdes func_append newdeplibs " $i" 7705238106Sdes ;; 7706238106Sdes esac 7707238106Sdes done 7708238106Sdes else 7709238106Sdes # Error occurred in the first compile. Let's try to salvage 7710238106Sdes # the situation: Compile a separate program for each library. 7711238106Sdes for i in $deplibs; do 7712238106Sdes case $i in 7713238106Sdes -l*) 7714238106Sdes func_stripname -l '' "$i" 7715238106Sdes name=$func_stripname_result 7716238106Sdes $opt_dry_run || $RM conftest 7717238106Sdes if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 7718238106Sdes ldd_output=`ldd conftest` 7719238106Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7720238106Sdes case " $predeps $postdeps " in 7721238106Sdes *" $i "*) 7722238106Sdes func_append newdeplibs " $i" 7723238106Sdes i="" 7724238106Sdes ;; 7725238106Sdes esac 7726238106Sdes fi 7727238106Sdes if test -n "$i" ; then 7728238106Sdes libname=`eval "\\$ECHO \"$libname_spec\""` 7729238106Sdes deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 7730238106Sdes set dummy $deplib_matches; shift 7731238106Sdes deplib_match=$1 7732238106Sdes if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 7733238106Sdes func_append newdeplibs " $i" 7734238106Sdes else 7735238106Sdes droppeddeps=yes 7736238106Sdes echo 7737238106Sdes $ECHO "*** Warning: dynamic linker does not accept needed library $i." 7738238106Sdes echo "*** I have the capability to make that library automatically link in when" 7739238106Sdes echo "*** you link to this library. But I can only do this if you have a" 7740238106Sdes echo "*** shared version of the library, which you do not appear to have" 7741238106Sdes echo "*** because a test_compile did reveal that the linker did not use this one" 7742238106Sdes echo "*** as a dynamic dependency that programs can get resolved with at runtime." 7743238106Sdes fi 7744238106Sdes fi 7745238106Sdes else 7746238106Sdes droppeddeps=yes 7747238106Sdes echo 7748238106Sdes $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 7749238106Sdes echo "*** make it link in! You will probably need to install it or some" 7750238106Sdes echo "*** library that it depends on before this library will be fully" 7751238106Sdes echo "*** functional. Installing it before continuing would be even better." 7752238106Sdes fi 7753238106Sdes ;; 7754238106Sdes *) 7755238106Sdes func_append newdeplibs " $i" 7756238106Sdes ;; 7757238106Sdes esac 7758238106Sdes done 7759238106Sdes fi 7760238106Sdes ;; 7761238106Sdes file_magic*) 7762238106Sdes set dummy $deplibs_check_method; shift 7763238106Sdes file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7764238106Sdes for a_deplib in $deplibs; do 7765238106Sdes case $a_deplib in 7766238106Sdes -l*) 7767238106Sdes func_stripname -l '' "$a_deplib" 7768238106Sdes name=$func_stripname_result 7769238106Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7770238106Sdes case " $predeps $postdeps " in 7771238106Sdes *" $a_deplib "*) 7772238106Sdes func_append newdeplibs " $a_deplib" 7773238106Sdes a_deplib="" 7774238106Sdes ;; 7775238106Sdes esac 7776238106Sdes fi 7777238106Sdes if test -n "$a_deplib" ; then 7778238106Sdes libname=`eval "\\$ECHO \"$libname_spec\""` 7779238106Sdes if test -n "$file_magic_glob"; then 7780238106Sdes libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 7781238106Sdes else 7782238106Sdes libnameglob=$libname 7783238106Sdes fi 7784238106Sdes test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` 7785238106Sdes for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7786238106Sdes if test "$want_nocaseglob" = yes; then 7787238106Sdes shopt -s nocaseglob 7788238106Sdes potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7789238106Sdes $nocaseglob 7790238106Sdes else 7791238106Sdes potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 7792238106Sdes fi 7793238106Sdes for potent_lib in $potential_libs; do 7794238106Sdes # Follow soft links. 7795238106Sdes if ls -lLd "$potent_lib" 2>/dev/null | 7796238106Sdes $GREP " -> " >/dev/null; then 7797238106Sdes continue 7798238106Sdes fi 7799238106Sdes # The statement above tries to avoid entering an 7800238106Sdes # endless loop below, in case of cyclic links. 7801238106Sdes # We might still enter an endless loop, since a link 7802238106Sdes # loop can be closed while we follow links, 7803238106Sdes # but so what? 7804238106Sdes potlib="$potent_lib" 7805238106Sdes while test -h "$potlib" 2>/dev/null; do 7806238106Sdes potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 7807238106Sdes case $potliblink in 7808238106Sdes [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 7809238106Sdes *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; 7810238106Sdes esac 7811238106Sdes done 7812238106Sdes if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 7813238106Sdes $SED -e 10q | 7814238106Sdes $EGREP "$file_magic_regex" > /dev/null; then 7815238106Sdes func_append newdeplibs " $a_deplib" 7816238106Sdes a_deplib="" 7817238106Sdes break 2 7818238106Sdes fi 7819238106Sdes done 7820238106Sdes done 7821238106Sdes fi 7822238106Sdes if test -n "$a_deplib" ; then 7823238106Sdes droppeddeps=yes 7824238106Sdes echo 7825238106Sdes $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7826238106Sdes echo "*** I have the capability to make that library automatically link in when" 7827238106Sdes echo "*** you link to this library. But I can only do this if you have a" 7828238106Sdes echo "*** shared version of the library, which you do not appear to have" 7829238106Sdes echo "*** because I did check the linker path looking for a file starting" 7830238106Sdes if test -z "$potlib" ; then 7831238106Sdes $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 7832238106Sdes else 7833238106Sdes $ECHO "*** with $libname and none of the candidates passed a file format test" 7834238106Sdes $ECHO "*** using a file magic. Last file checked: $potlib" 7835238106Sdes fi 7836238106Sdes fi 7837238106Sdes ;; 7838238106Sdes *) 7839238106Sdes # Add a -L argument. 7840238106Sdes func_append newdeplibs " $a_deplib" 7841238106Sdes ;; 7842238106Sdes esac 7843238106Sdes done # Gone through all deplibs. 7844238106Sdes ;; 7845238106Sdes match_pattern*) 7846238106Sdes set dummy $deplibs_check_method; shift 7847238106Sdes match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7848238106Sdes for a_deplib in $deplibs; do 7849238106Sdes case $a_deplib in 7850238106Sdes -l*) 7851238106Sdes func_stripname -l '' "$a_deplib" 7852238106Sdes name=$func_stripname_result 7853238106Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7854238106Sdes case " $predeps $postdeps " in 7855238106Sdes *" $a_deplib "*) 7856238106Sdes func_append newdeplibs " $a_deplib" 7857238106Sdes a_deplib="" 7858238106Sdes ;; 7859238106Sdes esac 7860238106Sdes fi 7861238106Sdes if test -n "$a_deplib" ; then 7862238106Sdes libname=`eval "\\$ECHO \"$libname_spec\""` 7863238106Sdes for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 7864238106Sdes potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 7865238106Sdes for potent_lib in $potential_libs; do 7866238106Sdes potlib="$potent_lib" # see symlink-check above in file_magic test 7867238106Sdes if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 7868238106Sdes $EGREP "$match_pattern_regex" > /dev/null; then 7869238106Sdes func_append newdeplibs " $a_deplib" 7870238106Sdes a_deplib="" 7871238106Sdes break 2 7872238106Sdes fi 7873238106Sdes done 7874238106Sdes done 7875238106Sdes fi 7876238106Sdes if test -n "$a_deplib" ; then 7877238106Sdes droppeddeps=yes 7878238106Sdes echo 7879238106Sdes $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 7880238106Sdes echo "*** I have the capability to make that library automatically link in when" 7881238106Sdes echo "*** you link to this library. But I can only do this if you have a" 7882238106Sdes echo "*** shared version of the library, which you do not appear to have" 7883238106Sdes echo "*** because I did check the linker path looking for a file starting" 7884238106Sdes if test -z "$potlib" ; then 7885238106Sdes $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 7886238106Sdes else 7887238106Sdes $ECHO "*** with $libname and none of the candidates passed a file format test" 7888238106Sdes $ECHO "*** using a regex pattern. Last file checked: $potlib" 7889238106Sdes fi 7890238106Sdes fi 7891238106Sdes ;; 7892238106Sdes *) 7893238106Sdes # Add a -L argument. 7894238106Sdes func_append newdeplibs " $a_deplib" 7895238106Sdes ;; 7896238106Sdes esac 7897238106Sdes done # Gone through all deplibs. 7898238106Sdes ;; 7899238106Sdes none | unknown | *) 7900238106Sdes newdeplibs="" 7901238106Sdes tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 7902238106Sdes if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 7903238106Sdes for i in $predeps $postdeps ; do 7904238106Sdes # can't use Xsed below, because $i might contain '/' 7905238106Sdes tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` 7906238106Sdes done 7907238106Sdes fi 7908238106Sdes case $tmp_deplibs in 7909238106Sdes *[!\ \ ]*) 7910238106Sdes echo 7911238106Sdes if test "X$deplibs_check_method" = "Xnone"; then 7912238106Sdes echo "*** Warning: inter-library dependencies are not supported in this platform." 7913238106Sdes else 7914238106Sdes echo "*** Warning: inter-library dependencies are not known to be supported." 7915238106Sdes fi 7916238106Sdes echo "*** All declared inter-library dependencies are being dropped." 7917238106Sdes droppeddeps=yes 7918238106Sdes ;; 7919238106Sdes esac 7920238106Sdes ;; 7921238106Sdes esac 7922238106Sdes versuffix=$versuffix_save 7923238106Sdes major=$major_save 7924238106Sdes release=$release_save 7925238106Sdes libname=$libname_save 7926238106Sdes name=$name_save 7927238106Sdes 7928238106Sdes case $host in 7929238106Sdes *-*-rhapsody* | *-*-darwin1.[012]) 7930238106Sdes # On Rhapsody replace the C library with the System framework 7931238106Sdes newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 7932238106Sdes ;; 7933238106Sdes esac 7934238106Sdes 7935238106Sdes if test "$droppeddeps" = yes; then 7936238106Sdes if test "$module" = yes; then 7937238106Sdes echo 7938238106Sdes echo "*** Warning: libtool could not satisfy all declared inter-library" 7939238106Sdes $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 7940238106Sdes echo "*** a static module, that should work as long as the dlopening" 7941238106Sdes echo "*** application is linked with the -dlopen flag." 7942238106Sdes if test -z "$global_symbol_pipe"; then 7943238106Sdes echo 7944238106Sdes echo "*** However, this would only work if libtool was able to extract symbol" 7945238106Sdes echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 7946238106Sdes echo "*** not find such a program. So, this module is probably useless." 7947238106Sdes echo "*** \`nm' from GNU binutils and a full rebuild may help." 7948238106Sdes fi 7949238106Sdes if test "$build_old_libs" = no; then 7950238106Sdes oldlibs="$output_objdir/$libname.$libext" 7951238106Sdes build_libtool_libs=module 7952238106Sdes build_old_libs=yes 7953238106Sdes else 7954238106Sdes build_libtool_libs=no 7955238106Sdes fi 7956238106Sdes else 7957238106Sdes echo "*** The inter-library dependencies that have been dropped here will be" 7958238106Sdes echo "*** automatically added whenever a program is linked with this library" 7959238106Sdes echo "*** or is declared to -dlopen it." 7960238106Sdes 7961238106Sdes if test "$allow_undefined" = no; then 7962238106Sdes echo 7963238106Sdes echo "*** Since this library must not contain undefined symbols," 7964238106Sdes echo "*** because either the platform does not support them or" 7965238106Sdes echo "*** it was explicitly requested with -no-undefined," 7966238106Sdes echo "*** libtool will only create a static version of it." 7967238106Sdes if test "$build_old_libs" = no; then 7968238106Sdes oldlibs="$output_objdir/$libname.$libext" 7969238106Sdes build_libtool_libs=module 7970238106Sdes build_old_libs=yes 7971238106Sdes else 7972238106Sdes build_libtool_libs=no 7973238106Sdes fi 7974238106Sdes fi 7975238106Sdes fi 7976238106Sdes fi 7977238106Sdes # Done checking deplibs! 7978238106Sdes deplibs=$newdeplibs 7979238106Sdes fi 7980238106Sdes # Time to change all our "foo.ltframework" stuff back to "-framework foo" 7981238106Sdes case $host in 7982238106Sdes *-*-darwin*) 7983238106Sdes newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7984238106Sdes new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7985238106Sdes deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7986238106Sdes ;; 7987238106Sdes esac 7988238106Sdes 7989238106Sdes # move library search paths that coincide with paths to not yet 7990238106Sdes # installed libraries to the beginning of the library search list 7991238106Sdes new_libs= 7992238106Sdes for path in $notinst_path; do 7993238106Sdes case " $new_libs " in 7994238106Sdes *" -L$path/$objdir "*) ;; 7995238106Sdes *) 7996238106Sdes case " $deplibs " in 7997238106Sdes *" -L$path/$objdir "*) 7998238106Sdes func_append new_libs " -L$path/$objdir" ;; 7999238106Sdes esac 8000238106Sdes ;; 8001238106Sdes esac 8002238106Sdes done 8003238106Sdes for deplib in $deplibs; do 8004238106Sdes case $deplib in 8005238106Sdes -L*) 8006238106Sdes case " $new_libs " in 8007238106Sdes *" $deplib "*) ;; 8008238106Sdes *) func_append new_libs " $deplib" ;; 8009238106Sdes esac 8010238106Sdes ;; 8011238106Sdes *) func_append new_libs " $deplib" ;; 8012238106Sdes esac 8013238106Sdes done 8014238106Sdes deplibs="$new_libs" 8015238106Sdes 8016238106Sdes # All the library-specific variables (install_libdir is set above). 8017238106Sdes library_names= 8018238106Sdes old_library= 8019238106Sdes dlname= 8020238106Sdes 8021238106Sdes # Test again, we may have decided not to build it any more 8022238106Sdes if test "$build_libtool_libs" = yes; then 8023238106Sdes if test "$hardcode_into_libs" = yes; then 8024238106Sdes # Hardcode the library paths 8025238106Sdes hardcode_libdirs= 8026238106Sdes dep_rpath= 8027238106Sdes rpath="$finalize_rpath" 8028238106Sdes test "$opt_mode" != relink && rpath="$compile_rpath$rpath" 8029238106Sdes for libdir in $rpath; do 8030238106Sdes if test -n "$hardcode_libdir_flag_spec"; then 8031238106Sdes if test -n "$hardcode_libdir_separator"; then 8032238106Sdes func_replace_sysroot "$libdir" 8033238106Sdes libdir=$func_replace_sysroot_result 8034238106Sdes if test -z "$hardcode_libdirs"; then 8035238106Sdes hardcode_libdirs="$libdir" 8036238106Sdes else 8037238106Sdes # Just accumulate the unique libdirs. 8038238106Sdes case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8039238106Sdes *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8040238106Sdes ;; 8041238106Sdes *) 8042238106Sdes func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8043238106Sdes ;; 8044238106Sdes esac 8045238106Sdes fi 8046238106Sdes else 8047238106Sdes eval flag=\"$hardcode_libdir_flag_spec\" 8048238106Sdes func_append dep_rpath " $flag" 8049238106Sdes fi 8050238106Sdes elif test -n "$runpath_var"; then 8051238106Sdes case "$perm_rpath " in 8052238106Sdes *" $libdir "*) ;; 8053238106Sdes *) func_apped perm_rpath " $libdir" ;; 8054238106Sdes esac 8055238106Sdes fi 8056238106Sdes done 8057238106Sdes # Substitute the hardcoded libdirs into the rpath. 8058238106Sdes if test -n "$hardcode_libdir_separator" && 8059238106Sdes test -n "$hardcode_libdirs"; then 8060238106Sdes libdir="$hardcode_libdirs" 8061238106Sdes if test -n "$hardcode_libdir_flag_spec_ld"; then 8062238106Sdes eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" 8063238106Sdes else 8064238106Sdes eval dep_rpath=\"$hardcode_libdir_flag_spec\" 8065238106Sdes fi 8066238106Sdes fi 8067238106Sdes if test -n "$runpath_var" && test -n "$perm_rpath"; then 8068238106Sdes # We should set the runpath_var. 8069238106Sdes rpath= 8070238106Sdes for dir in $perm_rpath; do 8071238106Sdes func_append rpath "$dir:" 8072238106Sdes done 8073238106Sdes eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 8074238106Sdes fi 8075238106Sdes test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 8076238106Sdes fi 8077238106Sdes 8078238106Sdes shlibpath="$finalize_shlibpath" 8079238106Sdes test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 8080238106Sdes if test -n "$shlibpath"; then 8081238106Sdes eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 8082238106Sdes fi 8083238106Sdes 8084238106Sdes # Get the real and link names of the library. 8085238106Sdes eval shared_ext=\"$shrext_cmds\" 8086238106Sdes eval library_names=\"$library_names_spec\" 8087238106Sdes set dummy $library_names 8088238106Sdes shift 8089238106Sdes realname="$1" 8090238106Sdes shift 8091238106Sdes 8092238106Sdes if test -n "$soname_spec"; then 8093238106Sdes eval soname=\"$soname_spec\" 8094238106Sdes else 8095238106Sdes soname="$realname" 8096238106Sdes fi 8097238106Sdes if test -z "$dlname"; then 8098238106Sdes dlname=$soname 8099238106Sdes fi 8100238106Sdes 8101238106Sdes lib="$output_objdir/$realname" 8102238106Sdes linknames= 8103238106Sdes for link 8104238106Sdes do 8105238106Sdes func_append linknames " $link" 8106238106Sdes done 8107238106Sdes 8108238106Sdes # Use standard objects if they are pic 8109238106Sdes test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 8110238106Sdes test "X$libobjs" = "X " && libobjs= 8111238106Sdes 8112238106Sdes delfiles= 8113238106Sdes if test -n "$export_symbols" && test -n "$include_expsyms"; then 8114238106Sdes $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 8115238106Sdes export_symbols="$output_objdir/$libname.uexp" 8116238106Sdes func_append delfiles " $export_symbols" 8117238106Sdes fi 8118238106Sdes 8119238106Sdes orig_export_symbols= 8120238106Sdes case $host_os in 8121238106Sdes cygwin* | mingw* | cegcc*) 8122238106Sdes if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 8123238106Sdes # exporting using user supplied symfile 8124238106Sdes if test "x`$SED 1q $export_symbols`" != xEXPORTS; then 8125238106Sdes # and it's NOT already a .def file. Must figure out 8126238106Sdes # which of the given symbols are data symbols and tag 8127238106Sdes # them as such. So, trigger use of export_symbols_cmds. 8128238106Sdes # export_symbols gets reassigned inside the "prepare 8129238106Sdes # the list of exported symbols" if statement, so the 8130238106Sdes # include_expsyms logic still works. 8131238106Sdes orig_export_symbols="$export_symbols" 8132238106Sdes export_symbols= 8133238106Sdes always_export_symbols=yes 8134238106Sdes fi 8135238106Sdes fi 8136238106Sdes ;; 8137238106Sdes esac 8138238106Sdes 8139238106Sdes # Prepare the list of exported symbols 8140238106Sdes if test -z "$export_symbols"; then 8141238106Sdes if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 8142238106Sdes func_verbose "generating symbol list for \`$libname.la'" 8143238106Sdes export_symbols="$output_objdir/$libname.exp" 8144238106Sdes $opt_dry_run || $RM $export_symbols 8145238106Sdes cmds=$export_symbols_cmds 8146238106Sdes save_ifs="$IFS"; IFS='~' 8147238106Sdes for cmd1 in $cmds; do 8148238106Sdes IFS="$save_ifs" 8149238106Sdes # Take the normal branch if the nm_file_list_spec branch 8150238106Sdes # doesn't work or if tool conversion is not needed. 8151238106Sdes case $nm_file_list_spec~$to_tool_file_cmd in 8152238106Sdes *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 8153238106Sdes try_normal_branch=yes 8154238106Sdes eval cmd=\"$cmd1\" 8155238106Sdes func_len " $cmd" 8156238106Sdes len=$func_len_result 8157238106Sdes ;; 8158238106Sdes *) 8159238106Sdes try_normal_branch=no 8160238106Sdes ;; 8161238106Sdes esac 8162238106Sdes if test "$try_normal_branch" = yes \ 8163238106Sdes && { test "$len" -lt "$max_cmd_len" \ 8164238106Sdes || test "$max_cmd_len" -le -1; } 8165238106Sdes then 8166238106Sdes func_show_eval "$cmd" 'exit $?' 8167238106Sdes skipped_export=false 8168238106Sdes elif test -n "$nm_file_list_spec"; then 8169238106Sdes func_basename "$output" 8170238106Sdes output_la=$func_basename_result 8171238106Sdes save_libobjs=$libobjs 8172238106Sdes save_output=$output 8173238106Sdes output=${output_objdir}/${output_la}.nm 8174238106Sdes func_to_tool_file "$output" 8175238106Sdes libobjs=$nm_file_list_spec$func_to_tool_file_result 8176238106Sdes func_append delfiles " $output" 8177238106Sdes func_verbose "creating $NM input file list: $output" 8178238106Sdes for obj in $save_libobjs; do 8179238106Sdes func_to_tool_file "$obj" 8180238106Sdes $ECHO "$func_to_tool_file_result" 8181238106Sdes done > "$output" 8182238106Sdes eval cmd=\"$cmd1\" 8183238106Sdes func_show_eval "$cmd" 'exit $?' 8184238106Sdes output=$save_output 8185238106Sdes libobjs=$save_libobjs 8186238106Sdes skipped_export=false 8187238106Sdes else 8188238106Sdes # The command line is too long to execute in one step. 8189238106Sdes func_verbose "using reloadable object file for export list..." 8190238106Sdes skipped_export=: 8191238106Sdes # Break out early, otherwise skipped_export may be 8192238106Sdes # set to false by a later but shorter cmd. 8193238106Sdes break 8194238106Sdes fi 8195238106Sdes done 8196238106Sdes IFS="$save_ifs" 8197238106Sdes if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then 8198238106Sdes func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8199238106Sdes func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8200238106Sdes fi 8201238106Sdes fi 8202238106Sdes fi 8203238106Sdes 8204238106Sdes if test -n "$export_symbols" && test -n "$include_expsyms"; then 8205238106Sdes tmp_export_symbols="$export_symbols" 8206238106Sdes test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8207238106Sdes $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8208238106Sdes fi 8209238106Sdes 8210238106Sdes if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then 8211238106Sdes # The given exports_symbols file has to be filtered, so filter it. 8212238106Sdes func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8213238106Sdes # FIXME: $output_objdir/$libname.filter potentially contains lots of 8214238106Sdes # 's' commands which not all seds can handle. GNU sed should be fine 8215238106Sdes # though. Also, the filter scales superlinearly with the number of 8216238106Sdes # global variables. join(1) would be nice here, but unfortunately 8217238106Sdes # isn't a blessed tool. 8218238106Sdes $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8219238106Sdes func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8220238106Sdes export_symbols=$output_objdir/$libname.def 8221238106Sdes $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8222238106Sdes fi 8223238106Sdes 8224238106Sdes tmp_deplibs= 8225238106Sdes for test_deplib in $deplibs; do 8226238106Sdes case " $convenience " in 8227238106Sdes *" $test_deplib "*) ;; 8228238106Sdes *) 8229238106Sdes func_append tmp_deplibs " $test_deplib" 8230238106Sdes ;; 8231238106Sdes esac 8232238106Sdes done 8233238106Sdes deplibs="$tmp_deplibs" 8234238106Sdes 8235238106Sdes if test -n "$convenience"; then 8236238106Sdes if test -n "$whole_archive_flag_spec" && 8237238106Sdes test "$compiler_needs_object" = yes && 8238238106Sdes test -z "$libobjs"; then 8239238106Sdes # extract the archives, so we have objects to list. 8240238106Sdes # TODO: could optimize this to just extract one archive. 8241238106Sdes whole_archive_flag_spec= 8242238106Sdes fi 8243238106Sdes if test -n "$whole_archive_flag_spec"; then 8244238106Sdes save_libobjs=$libobjs 8245238106Sdes eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8246238106Sdes test "X$libobjs" = "X " && libobjs= 8247238106Sdes else 8248238106Sdes gentop="$output_objdir/${outputname}x" 8249238106Sdes func_append generated " $gentop" 8250238106Sdes 8251238106Sdes func_extract_archives $gentop $convenience 8252238106Sdes func_append libobjs " $func_extract_archives_result" 8253238106Sdes test "X$libobjs" = "X " && libobjs= 8254238106Sdes fi 8255238106Sdes fi 8256238106Sdes 8257238106Sdes if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 8258238106Sdes eval flag=\"$thread_safe_flag_spec\" 8259238106Sdes func_append linker_flags " $flag" 8260238106Sdes fi 8261238106Sdes 8262238106Sdes # Make a backup of the uninstalled library when relinking 8263238106Sdes if test "$opt_mode" = relink; then 8264238106Sdes $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 8265238106Sdes fi 8266238106Sdes 8267238106Sdes # Do each of the archive commands. 8268238106Sdes if test "$module" = yes && test -n "$module_cmds" ; then 8269238106Sdes if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8270238106Sdes eval test_cmds=\"$module_expsym_cmds\" 8271238106Sdes cmds=$module_expsym_cmds 8272238106Sdes else 8273238106Sdes eval test_cmds=\"$module_cmds\" 8274238106Sdes cmds=$module_cmds 8275238106Sdes fi 8276238106Sdes else 8277238106Sdes if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8278238106Sdes eval test_cmds=\"$archive_expsym_cmds\" 8279238106Sdes cmds=$archive_expsym_cmds 8280238106Sdes else 8281238106Sdes eval test_cmds=\"$archive_cmds\" 8282238106Sdes cmds=$archive_cmds 8283238106Sdes fi 8284238106Sdes fi 8285238106Sdes 8286238106Sdes if test "X$skipped_export" != "X:" && 8287238106Sdes func_len " $test_cmds" && 8288238106Sdes len=$func_len_result && 8289238106Sdes test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 8290238106Sdes : 8291238106Sdes else 8292238106Sdes # The command line is too long to link in one step, link piecewise 8293238106Sdes # or, if using GNU ld and skipped_export is not :, use a linker 8294238106Sdes # script. 8295238106Sdes 8296238106Sdes # Save the value of $output and $libobjs because we want to 8297238106Sdes # use them later. If we have whole_archive_flag_spec, we 8298238106Sdes # want to use save_libobjs as it was before 8299238106Sdes # whole_archive_flag_spec was expanded, because we can't 8300238106Sdes # assume the linker understands whole_archive_flag_spec. 8301238106Sdes # This may have to be revisited, in case too many 8302238106Sdes # convenience libraries get linked in and end up exceeding 8303238106Sdes # the spec. 8304238106Sdes if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 8305238106Sdes save_libobjs=$libobjs 8306238106Sdes fi 8307238106Sdes save_output=$output 8308238106Sdes func_basename "$output" 8309238106Sdes output_la=$func_basename_result 8310238106Sdes 8311238106Sdes # Clear the reloadable object creation command queue and 8312238106Sdes # initialize k to one. 8313238106Sdes test_cmds= 8314238106Sdes concat_cmds= 8315238106Sdes objlist= 8316238106Sdes last_robj= 8317238106Sdes k=1 8318238106Sdes 8319238106Sdes if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then 8320238106Sdes output=${output_objdir}/${output_la}.lnkscript 8321238106Sdes func_verbose "creating GNU ld script: $output" 8322238106Sdes echo 'INPUT (' > $output 8323238106Sdes for obj in $save_libobjs 8324238106Sdes do 8325238106Sdes func_to_tool_file "$obj" 8326238106Sdes $ECHO "$func_to_tool_file_result" >> $output 8327238106Sdes done 8328238106Sdes echo ')' >> $output 8329238106Sdes func_append delfiles " $output" 8330238106Sdes func_to_tool_file "$output" 8331238106Sdes output=$func_to_tool_file_result 8332238106Sdes elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then 8333238106Sdes output=${output_objdir}/${output_la}.lnk 8334238106Sdes func_verbose "creating linker input file list: $output" 8335238106Sdes : > $output 8336238106Sdes set x $save_libobjs 8337238106Sdes shift 8338238106Sdes firstobj= 8339238106Sdes if test "$compiler_needs_object" = yes; then 8340238106Sdes firstobj="$1 " 8341238106Sdes shift 8342238106Sdes fi 8343238106Sdes for obj 8344238106Sdes do 8345238106Sdes func_to_tool_file "$obj" 8346238106Sdes $ECHO "$func_to_tool_file_result" >> $output 8347238106Sdes done 8348238106Sdes func_append delfiles " $output" 8349238106Sdes func_to_tool_file "$output" 8350238106Sdes output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 8351238106Sdes else 8352238106Sdes if test -n "$save_libobjs"; then 8353238106Sdes func_verbose "creating reloadable object files..." 8354238106Sdes output=$output_objdir/$output_la-${k}.$objext 8355238106Sdes eval test_cmds=\"$reload_cmds\" 8356238106Sdes func_len " $test_cmds" 8357238106Sdes len0=$func_len_result 8358238106Sdes len=$len0 8359238106Sdes 8360238106Sdes # Loop over the list of objects to be linked. 8361238106Sdes for obj in $save_libobjs 8362238106Sdes do 8363238106Sdes func_len " $obj" 8364238106Sdes func_arith $len + $func_len_result 8365238106Sdes len=$func_arith_result 8366238106Sdes if test "X$objlist" = X || 8367238106Sdes test "$len" -lt "$max_cmd_len"; then 8368238106Sdes func_append objlist " $obj" 8369238106Sdes else 8370238106Sdes # The command $test_cmds is almost too long, add a 8371238106Sdes # command to the queue. 8372238106Sdes if test "$k" -eq 1 ; then 8373238106Sdes # The first file doesn't have a previous command to add. 8374238106Sdes reload_objs=$objlist 8375238106Sdes eval concat_cmds=\"$reload_cmds\" 8376238106Sdes else 8377238106Sdes # All subsequent reloadable object files will link in 8378238106Sdes # the last one created. 8379238106Sdes reload_objs="$objlist $last_robj" 8380238106Sdes eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 8381238106Sdes fi 8382238106Sdes last_robj=$output_objdir/$output_la-${k}.$objext 8383238106Sdes func_arith $k + 1 8384238106Sdes k=$func_arith_result 8385238106Sdes output=$output_objdir/$output_la-${k}.$objext 8386238106Sdes objlist=" $obj" 8387238106Sdes func_len " $last_robj" 8388238106Sdes func_arith $len0 + $func_len_result 8389238106Sdes len=$func_arith_result 8390238106Sdes fi 8391238106Sdes done 8392238106Sdes # Handle the remaining objects by creating one last 8393238106Sdes # reloadable object file. All subsequent reloadable object 8394238106Sdes # files will link in the last one created. 8395238106Sdes test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8396238106Sdes reload_objs="$objlist $last_robj" 8397238106Sdes eval concat_cmds=\"\${concat_cmds}$reload_cmds\" 8398238106Sdes if test -n "$last_robj"; then 8399238106Sdes eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" 8400238106Sdes fi 8401238106Sdes func_append delfiles " $output" 8402238106Sdes 8403238106Sdes else 8404238106Sdes output= 8405238106Sdes fi 8406238106Sdes 8407238106Sdes if ${skipped_export-false}; then 8408238106Sdes func_verbose "generating symbol list for \`$libname.la'" 8409238106Sdes export_symbols="$output_objdir/$libname.exp" 8410238106Sdes $opt_dry_run || $RM $export_symbols 8411238106Sdes libobjs=$output 8412238106Sdes # Append the command to create the export file. 8413238106Sdes test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 8414238106Sdes eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 8415238106Sdes if test -n "$last_robj"; then 8416238106Sdes eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 8417238106Sdes fi 8418238106Sdes fi 8419238106Sdes 8420238106Sdes test -n "$save_libobjs" && 8421238106Sdes func_verbose "creating a temporary reloadable object file: $output" 8422238106Sdes 8423238106Sdes # Loop through the commands generated above and execute them. 8424238106Sdes save_ifs="$IFS"; IFS='~' 8425238106Sdes for cmd in $concat_cmds; do 8426238106Sdes IFS="$save_ifs" 8427238106Sdes $opt_silent || { 8428238106Sdes func_quote_for_expand "$cmd" 8429238106Sdes eval "func_echo $func_quote_for_expand_result" 8430238106Sdes } 8431238106Sdes $opt_dry_run || eval "$cmd" || { 8432238106Sdes lt_exit=$? 8433238106Sdes 8434238106Sdes # Restore the uninstalled library and exit 8435238106Sdes if test "$opt_mode" = relink; then 8436238106Sdes ( cd "$output_objdir" && \ 8437238106Sdes $RM "${realname}T" && \ 8438238106Sdes $MV "${realname}U" "$realname" ) 8439238106Sdes fi 8440238106Sdes 8441238106Sdes exit $lt_exit 8442238106Sdes } 8443238106Sdes done 8444238106Sdes IFS="$save_ifs" 8445238106Sdes 8446238106Sdes if test -n "$export_symbols_regex" && ${skipped_export-false}; then 8447238106Sdes func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 8448238106Sdes func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 8449238106Sdes fi 8450238106Sdes fi 8451238106Sdes 8452238106Sdes if ${skipped_export-false}; then 8453238106Sdes if test -n "$export_symbols" && test -n "$include_expsyms"; then 8454238106Sdes tmp_export_symbols="$export_symbols" 8455238106Sdes test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" 8456238106Sdes $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 8457238106Sdes fi 8458238106Sdes 8459238106Sdes if test -n "$orig_export_symbols"; then 8460238106Sdes # The given exports_symbols file has to be filtered, so filter it. 8461238106Sdes func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" 8462238106Sdes # FIXME: $output_objdir/$libname.filter potentially contains lots of 8463238106Sdes # 's' commands which not all seds can handle. GNU sed should be fine 8464238106Sdes # though. Also, the filter scales superlinearly with the number of 8465238106Sdes # global variables. join(1) would be nice here, but unfortunately 8466238106Sdes # isn't a blessed tool. 8467238106Sdes $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 8468238106Sdes func_append delfiles " $export_symbols $output_objdir/$libname.filter" 8469238106Sdes export_symbols=$output_objdir/$libname.def 8470238106Sdes $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 8471238106Sdes fi 8472238106Sdes fi 8473238106Sdes 8474238106Sdes libobjs=$output 8475238106Sdes # Restore the value of output. 8476238106Sdes output=$save_output 8477238106Sdes 8478238106Sdes if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 8479238106Sdes eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 8480238106Sdes test "X$libobjs" = "X " && libobjs= 8481238106Sdes fi 8482238106Sdes # Expand the library linking commands again to reset the 8483238106Sdes # value of $libobjs for piecewise linking. 8484238106Sdes 8485238106Sdes # Do each of the archive commands. 8486238106Sdes if test "$module" = yes && test -n "$module_cmds" ; then 8487238106Sdes if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 8488238106Sdes cmds=$module_expsym_cmds 8489238106Sdes else 8490238106Sdes cmds=$module_cmds 8491238106Sdes fi 8492238106Sdes else 8493238106Sdes if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 8494238106Sdes cmds=$archive_expsym_cmds 8495238106Sdes else 8496238106Sdes cmds=$archive_cmds 8497238106Sdes fi 8498238106Sdes fi 8499238106Sdes fi 8500238106Sdes 8501238106Sdes if test -n "$delfiles"; then 8502238106Sdes # Append the command to remove temporary files to $cmds. 8503238106Sdes eval cmds=\"\$cmds~\$RM $delfiles\" 8504238106Sdes fi 8505238106Sdes 8506238106Sdes # Add any objects from preloaded convenience libraries 8507238106Sdes if test -n "$dlprefiles"; then 8508238106Sdes gentop="$output_objdir/${outputname}x" 8509238106Sdes func_append generated " $gentop" 8510238106Sdes 8511238106Sdes func_extract_archives $gentop $dlprefiles 8512238106Sdes func_append libobjs " $func_extract_archives_result" 8513238106Sdes test "X$libobjs" = "X " && libobjs= 8514238106Sdes fi 8515238106Sdes 8516238106Sdes save_ifs="$IFS"; IFS='~' 8517238106Sdes for cmd in $cmds; do 8518238106Sdes IFS="$save_ifs" 8519238106Sdes eval cmd=\"$cmd\" 8520238106Sdes $opt_silent || { 8521238106Sdes func_quote_for_expand "$cmd" 8522238106Sdes eval "func_echo $func_quote_for_expand_result" 8523238106Sdes } 8524238106Sdes $opt_dry_run || eval "$cmd" || { 8525238106Sdes lt_exit=$? 8526238106Sdes 8527238106Sdes # Restore the uninstalled library and exit 8528238106Sdes if test "$opt_mode" = relink; then 8529238106Sdes ( cd "$output_objdir" && \ 8530238106Sdes $RM "${realname}T" && \ 8531238106Sdes $MV "${realname}U" "$realname" ) 8532238106Sdes fi 8533238106Sdes 8534238106Sdes exit $lt_exit 8535238106Sdes } 8536238106Sdes done 8537238106Sdes IFS="$save_ifs" 8538238106Sdes 8539238106Sdes # Restore the uninstalled library and exit 8540238106Sdes if test "$opt_mode" = relink; then 8541238106Sdes $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 8542238106Sdes 8543238106Sdes if test -n "$convenience"; then 8544238106Sdes if test -z "$whole_archive_flag_spec"; then 8545238106Sdes func_show_eval '${RM}r "$gentop"' 8546238106Sdes fi 8547238106Sdes fi 8548238106Sdes 8549238106Sdes exit $EXIT_SUCCESS 8550238106Sdes fi 8551238106Sdes 8552238106Sdes # Create links to the real library. 8553238106Sdes for linkname in $linknames; do 8554238106Sdes if test "$realname" != "$linkname"; then 8555238106Sdes func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 8556238106Sdes fi 8557238106Sdes done 8558238106Sdes 8559238106Sdes # If -module or -export-dynamic was specified, set the dlname. 8560238106Sdes if test "$module" = yes || test "$export_dynamic" = yes; then 8561238106Sdes # On all known operating systems, these are identical. 8562238106Sdes dlname="$soname" 8563238106Sdes fi 8564238106Sdes fi 8565238106Sdes ;; 8566238106Sdes 8567238106Sdes obj) 8568238106Sdes if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 8569238106Sdes func_warning "\`-dlopen' is ignored for objects" 8570238106Sdes fi 8571238106Sdes 8572238106Sdes case " $deplibs" in 8573238106Sdes *\ -l* | *\ -L*) 8574238106Sdes func_warning "\`-l' and \`-L' are ignored for objects" ;; 8575238106Sdes esac 8576238106Sdes 8577238106Sdes test -n "$rpath" && \ 8578238106Sdes func_warning "\`-rpath' is ignored for objects" 8579238106Sdes 8580238106Sdes test -n "$xrpath" && \ 8581238106Sdes func_warning "\`-R' is ignored for objects" 8582238106Sdes 8583238106Sdes test -n "$vinfo" && \ 8584238106Sdes func_warning "\`-version-info' is ignored for objects" 8585238106Sdes 8586238106Sdes test -n "$release" && \ 8587238106Sdes func_warning "\`-release' is ignored for objects" 8588238106Sdes 8589238106Sdes case $output in 8590238106Sdes *.lo) 8591238106Sdes test -n "$objs$old_deplibs" && \ 8592238106Sdes func_fatal_error "cannot build library object \`$output' from non-libtool objects" 8593238106Sdes 8594238106Sdes libobj=$output 8595238106Sdes func_lo2o "$libobj" 8596238106Sdes obj=$func_lo2o_result 8597238106Sdes ;; 8598238106Sdes *) 8599238106Sdes libobj= 8600238106Sdes obj="$output" 8601238106Sdes ;; 8602238106Sdes esac 8603238106Sdes 8604238106Sdes # Delete the old objects. 8605238106Sdes $opt_dry_run || $RM $obj $libobj 8606238106Sdes 8607238106Sdes # Objects from convenience libraries. This assumes 8608238106Sdes # single-version convenience libraries. Whenever we create 8609238106Sdes # different ones for PIC/non-PIC, this we'll have to duplicate 8610238106Sdes # the extraction. 8611238106Sdes reload_conv_objs= 8612238106Sdes gentop= 8613238106Sdes # reload_cmds runs $LD directly, so let us get rid of 8614238106Sdes # -Wl from whole_archive_flag_spec and hope we can get by with 8615238106Sdes # turning comma into space.. 8616238106Sdes wl= 8617238106Sdes 8618238106Sdes if test -n "$convenience"; then 8619238106Sdes if test -n "$whole_archive_flag_spec"; then 8620238106Sdes eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 8621238106Sdes reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 8622238106Sdes else 8623238106Sdes gentop="$output_objdir/${obj}x" 8624238106Sdes func_append generated " $gentop" 8625238106Sdes 8626238106Sdes func_extract_archives $gentop $convenience 8627238106Sdes reload_conv_objs="$reload_objs $func_extract_archives_result" 8628238106Sdes fi 8629238106Sdes fi 8630238106Sdes 8631238106Sdes # If we're not building shared, we need to use non_pic_objs 8632238106Sdes test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" 8633238106Sdes 8634238106Sdes # Create the old-style object. 8635238106Sdes reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 8636238106Sdes 8637238106Sdes output="$obj" 8638238106Sdes func_execute_cmds "$reload_cmds" 'exit $?' 8639238106Sdes 8640238106Sdes # Exit if we aren't doing a library object file. 8641238106Sdes if test -z "$libobj"; then 8642238106Sdes if test -n "$gentop"; then 8643238106Sdes func_show_eval '${RM}r "$gentop"' 8644238106Sdes fi 8645238106Sdes 8646238106Sdes exit $EXIT_SUCCESS 8647238106Sdes fi 8648238106Sdes 8649238106Sdes if test "$build_libtool_libs" != yes; then 8650238106Sdes if test -n "$gentop"; then 8651238106Sdes func_show_eval '${RM}r "$gentop"' 8652238106Sdes fi 8653238106Sdes 8654238106Sdes # Create an invalid libtool object if no PIC, so that we don't 8655238106Sdes # accidentally link it into a program. 8656238106Sdes # $show "echo timestamp > $libobj" 8657238106Sdes # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 8658238106Sdes exit $EXIT_SUCCESS 8659238106Sdes fi 8660238106Sdes 8661238106Sdes if test -n "$pic_flag" || test "$pic_mode" != default; then 8662238106Sdes # Only do commands if we really have different PIC objects. 8663238106Sdes reload_objs="$libobjs $reload_conv_objs" 8664238106Sdes output="$libobj" 8665238106Sdes func_execute_cmds "$reload_cmds" 'exit $?' 8666238106Sdes fi 8667238106Sdes 8668238106Sdes if test -n "$gentop"; then 8669238106Sdes func_show_eval '${RM}r "$gentop"' 8670238106Sdes fi 8671238106Sdes 8672238106Sdes exit $EXIT_SUCCESS 8673238106Sdes ;; 8674238106Sdes 8675238106Sdes prog) 8676238106Sdes case $host in 8677238106Sdes *cygwin*) func_stripname '' '.exe' "$output" 8678238106Sdes output=$func_stripname_result.exe;; 8679238106Sdes esac 8680238106Sdes test -n "$vinfo" && \ 8681238106Sdes func_warning "\`-version-info' is ignored for programs" 8682238106Sdes 8683238106Sdes test -n "$release" && \ 8684238106Sdes func_warning "\`-release' is ignored for programs" 8685238106Sdes 8686238106Sdes test "$preload" = yes \ 8687238106Sdes && test "$dlopen_support" = unknown \ 8688238106Sdes && test "$dlopen_self" = unknown \ 8689238106Sdes && test "$dlopen_self_static" = unknown && \ 8690238106Sdes func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." 8691238106Sdes 8692238106Sdes case $host in 8693238106Sdes *-*-rhapsody* | *-*-darwin1.[012]) 8694238106Sdes # On Rhapsody replace the C library is the System framework 8695238106Sdes compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 8696238106Sdes finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 8697238106Sdes ;; 8698238106Sdes esac 8699238106Sdes 8700238106Sdes case $host in 8701238106Sdes *-*-darwin*) 8702238106Sdes # Don't allow lazy linking, it breaks C++ global constructors 8703238106Sdes # But is supposedly fixed on 10.4 or later (yay!). 8704238106Sdes if test "$tagname" = CXX ; then 8705238106Sdes case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 8706238106Sdes 10.[0123]) 8707238106Sdes func_append compile_command " ${wl}-bind_at_load" 8708238106Sdes func_append finalize_command " ${wl}-bind_at_load" 8709238106Sdes ;; 8710238106Sdes esac 8711238106Sdes fi 8712238106Sdes # Time to change all our "foo.ltframework" stuff back to "-framework foo" 8713238106Sdes compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8714238106Sdes finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8715238106Sdes ;; 8716238106Sdes esac 8717238106Sdes 8718238106Sdes 8719238106Sdes # move library search paths that coincide with paths to not yet 8720238106Sdes # installed libraries to the beginning of the library search list 8721238106Sdes new_libs= 8722238106Sdes for path in $notinst_path; do 8723238106Sdes case " $new_libs " in 8724238106Sdes *" -L$path/$objdir "*) ;; 8725238106Sdes *) 8726238106Sdes case " $compile_deplibs " in 8727238106Sdes *" -L$path/$objdir "*) 8728238106Sdes func_append new_libs " -L$path/$objdir" ;; 8729238106Sdes esac 8730238106Sdes ;; 8731238106Sdes esac 8732238106Sdes done 8733238106Sdes for deplib in $compile_deplibs; do 8734238106Sdes case $deplib in 8735238106Sdes -L*) 8736238106Sdes case " $new_libs " in 8737238106Sdes *" $deplib "*) ;; 8738238106Sdes *) func_append new_libs " $deplib" ;; 8739238106Sdes esac 8740238106Sdes ;; 8741238106Sdes *) func_append new_libs " $deplib" ;; 8742238106Sdes esac 8743238106Sdes done 8744238106Sdes compile_deplibs="$new_libs" 8745238106Sdes 8746238106Sdes 8747238106Sdes func_append compile_command " $compile_deplibs" 8748238106Sdes func_append finalize_command " $finalize_deplibs" 8749238106Sdes 8750238106Sdes if test -n "$rpath$xrpath"; then 8751238106Sdes # If the user specified any rpath flags, then add them. 8752238106Sdes for libdir in $rpath $xrpath; do 8753238106Sdes # This is the magic to use -rpath. 8754238106Sdes case "$finalize_rpath " in 8755238106Sdes *" $libdir "*) ;; 8756238106Sdes *) func_append finalize_rpath " $libdir" ;; 8757238106Sdes esac 8758238106Sdes done 8759238106Sdes fi 8760238106Sdes 8761238106Sdes # Now hardcode the library paths 8762238106Sdes rpath= 8763238106Sdes hardcode_libdirs= 8764238106Sdes for libdir in $compile_rpath $finalize_rpath; do 8765238106Sdes if test -n "$hardcode_libdir_flag_spec"; then 8766238106Sdes if test -n "$hardcode_libdir_separator"; then 8767238106Sdes if test -z "$hardcode_libdirs"; then 8768238106Sdes hardcode_libdirs="$libdir" 8769238106Sdes else 8770238106Sdes # Just accumulate the unique libdirs. 8771238106Sdes case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8772238106Sdes *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8773238106Sdes ;; 8774238106Sdes *) 8775238106Sdes func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8776238106Sdes ;; 8777238106Sdes esac 8778238106Sdes fi 8779238106Sdes else 8780238106Sdes eval flag=\"$hardcode_libdir_flag_spec\" 8781238106Sdes func_append rpath " $flag" 8782238106Sdes fi 8783238106Sdes elif test -n "$runpath_var"; then 8784238106Sdes case "$perm_rpath " in 8785238106Sdes *" $libdir "*) ;; 8786238106Sdes *) func_append perm_rpath " $libdir" ;; 8787238106Sdes esac 8788238106Sdes fi 8789238106Sdes case $host in 8790238106Sdes *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 8791238106Sdes testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` 8792238106Sdes case :$dllsearchpath: in 8793238106Sdes *":$libdir:"*) ;; 8794238106Sdes ::) dllsearchpath=$libdir;; 8795238106Sdes *) func_append dllsearchpath ":$libdir";; 8796238106Sdes esac 8797238106Sdes case :$dllsearchpath: in 8798238106Sdes *":$testbindir:"*) ;; 8799238106Sdes ::) dllsearchpath=$testbindir;; 8800238106Sdes *) func_append dllsearchpath ":$testbindir";; 8801238106Sdes esac 8802238106Sdes ;; 8803238106Sdes esac 8804238106Sdes done 8805238106Sdes # Substitute the hardcoded libdirs into the rpath. 8806238106Sdes if test -n "$hardcode_libdir_separator" && 8807238106Sdes test -n "$hardcode_libdirs"; then 8808238106Sdes libdir="$hardcode_libdirs" 8809238106Sdes eval rpath=\" $hardcode_libdir_flag_spec\" 8810238106Sdes fi 8811238106Sdes compile_rpath="$rpath" 8812238106Sdes 8813238106Sdes rpath= 8814238106Sdes hardcode_libdirs= 8815238106Sdes for libdir in $finalize_rpath; do 8816238106Sdes if test -n "$hardcode_libdir_flag_spec"; then 8817238106Sdes if test -n "$hardcode_libdir_separator"; then 8818238106Sdes if test -z "$hardcode_libdirs"; then 8819238106Sdes hardcode_libdirs="$libdir" 8820238106Sdes else 8821238106Sdes # Just accumulate the unique libdirs. 8822238106Sdes case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 8823238106Sdes *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 8824238106Sdes ;; 8825238106Sdes *) 8826238106Sdes func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 8827238106Sdes ;; 8828238106Sdes esac 8829238106Sdes fi 8830238106Sdes else 8831238106Sdes eval flag=\"$hardcode_libdir_flag_spec\" 8832238106Sdes func_append rpath " $flag" 8833238106Sdes fi 8834238106Sdes elif test -n "$runpath_var"; then 8835238106Sdes case "$finalize_perm_rpath " in 8836238106Sdes *" $libdir "*) ;; 8837238106Sdes *) func_append finalize_perm_rpath " $libdir" ;; 8838238106Sdes esac 8839238106Sdes fi 8840238106Sdes done 8841238106Sdes # Substitute the hardcoded libdirs into the rpath. 8842238106Sdes if test -n "$hardcode_libdir_separator" && 8843238106Sdes test -n "$hardcode_libdirs"; then 8844238106Sdes libdir="$hardcode_libdirs" 8845238106Sdes eval rpath=\" $hardcode_libdir_flag_spec\" 8846238106Sdes fi 8847238106Sdes finalize_rpath="$rpath" 8848238106Sdes 8849238106Sdes if test -n "$libobjs" && test "$build_old_libs" = yes; then 8850238106Sdes # Transform all the library objects into standard objects. 8851238106Sdes compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8852238106Sdes finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 8853238106Sdes fi 8854238106Sdes 8855238106Sdes func_generate_dlsyms "$outputname" "@PROGRAM@" "no" 8856238106Sdes 8857238106Sdes # template prelinking step 8858238106Sdes if test -n "$prelink_cmds"; then 8859238106Sdes func_execute_cmds "$prelink_cmds" 'exit $?' 8860238106Sdes fi 8861238106Sdes 8862238106Sdes wrappers_required=yes 8863238106Sdes case $host in 8864238106Sdes *cegcc* | *mingw32ce*) 8865238106Sdes # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 8866238106Sdes wrappers_required=no 8867238106Sdes ;; 8868238106Sdes *cygwin* | *mingw* ) 8869238106Sdes if test "$build_libtool_libs" != yes; then 8870238106Sdes wrappers_required=no 8871238106Sdes fi 8872238106Sdes ;; 8873238106Sdes *) 8874238106Sdes if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 8875238106Sdes wrappers_required=no 8876238106Sdes fi 8877238106Sdes ;; 8878238106Sdes esac 8879238106Sdes if test "$wrappers_required" = no; then 8880238106Sdes # Replace the output file specification. 8881238106Sdes compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8882238106Sdes link_command="$compile_command$compile_rpath" 8883238106Sdes 8884238106Sdes # We have no uninstalled library dependencies, so finalize right now. 8885238106Sdes exit_status=0 8886238106Sdes func_show_eval "$link_command" 'exit_status=$?' 8887238106Sdes 8888238106Sdes if test -n "$postlink_cmds"; then 8889238106Sdes func_to_tool_file "$output" 8890238106Sdes postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8891238106Sdes func_execute_cmds "$postlink_cmds" 'exit $?' 8892238106Sdes fi 8893238106Sdes 8894238106Sdes # Delete the generated files. 8895238106Sdes if test -f "$output_objdir/${outputname}S.${objext}"; then 8896238106Sdes func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' 8897238106Sdes fi 8898238106Sdes 8899238106Sdes exit $exit_status 8900238106Sdes fi 8901238106Sdes 8902238106Sdes if test -n "$compile_shlibpath$finalize_shlibpath"; then 8903238106Sdes compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 8904238106Sdes fi 8905238106Sdes if test -n "$finalize_shlibpath"; then 8906238106Sdes finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 8907238106Sdes fi 8908238106Sdes 8909238106Sdes compile_var= 8910238106Sdes finalize_var= 8911238106Sdes if test -n "$runpath_var"; then 8912238106Sdes if test -n "$perm_rpath"; then 8913238106Sdes # We should set the runpath_var. 8914238106Sdes rpath= 8915238106Sdes for dir in $perm_rpath; do 8916238106Sdes func_append rpath "$dir:" 8917238106Sdes done 8918238106Sdes compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 8919238106Sdes fi 8920238106Sdes if test -n "$finalize_perm_rpath"; then 8921238106Sdes # We should set the runpath_var. 8922238106Sdes rpath= 8923238106Sdes for dir in $finalize_perm_rpath; do 8924238106Sdes func_append rpath "$dir:" 8925238106Sdes done 8926238106Sdes finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 8927238106Sdes fi 8928238106Sdes fi 8929238106Sdes 8930238106Sdes if test "$no_install" = yes; then 8931238106Sdes # We don't need to create a wrapper script. 8932238106Sdes link_command="$compile_var$compile_command$compile_rpath" 8933238106Sdes # Replace the output file specification. 8934238106Sdes link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 8935238106Sdes # Delete the old output file. 8936238106Sdes $opt_dry_run || $RM $output 8937238106Sdes # Link the executable and exit 8938238106Sdes func_show_eval "$link_command" 'exit $?' 8939238106Sdes 8940238106Sdes if test -n "$postlink_cmds"; then 8941238106Sdes func_to_tool_file "$output" 8942238106Sdes postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8943238106Sdes func_execute_cmds "$postlink_cmds" 'exit $?' 8944238106Sdes fi 8945238106Sdes 8946238106Sdes exit $EXIT_SUCCESS 8947238106Sdes fi 8948238106Sdes 8949238106Sdes if test "$hardcode_action" = relink; then 8950238106Sdes # Fast installation is not supported 8951238106Sdes link_command="$compile_var$compile_command$compile_rpath" 8952238106Sdes relink_command="$finalize_var$finalize_command$finalize_rpath" 8953238106Sdes 8954238106Sdes func_warning "this platform does not like uninstalled shared libraries" 8955238106Sdes func_warning "\`$output' will be relinked during installation" 8956238106Sdes else 8957238106Sdes if test "$fast_install" != no; then 8958238106Sdes link_command="$finalize_var$compile_command$finalize_rpath" 8959238106Sdes if test "$fast_install" = yes; then 8960238106Sdes relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 8961238106Sdes else 8962238106Sdes # fast_install is set to needless 8963238106Sdes relink_command= 8964238106Sdes fi 8965238106Sdes else 8966238106Sdes link_command="$compile_var$compile_command$compile_rpath" 8967238106Sdes relink_command="$finalize_var$finalize_command$finalize_rpath" 8968238106Sdes fi 8969238106Sdes fi 8970238106Sdes 8971238106Sdes # Replace the output file specification. 8972238106Sdes link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 8973238106Sdes 8974238106Sdes # Delete the old output files. 8975238106Sdes $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 8976238106Sdes 8977238106Sdes func_show_eval "$link_command" 'exit $?' 8978238106Sdes 8979238106Sdes if test -n "$postlink_cmds"; then 8980238106Sdes func_to_tool_file "$output_objdir/$outputname" 8981238106Sdes postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 8982238106Sdes func_execute_cmds "$postlink_cmds" 'exit $?' 8983238106Sdes fi 8984238106Sdes 8985238106Sdes # Now create the wrapper script. 8986238106Sdes func_verbose "creating $output" 8987238106Sdes 8988238106Sdes # Quote the relink command for shipping. 8989238106Sdes if test -n "$relink_command"; then 8990238106Sdes # Preserve any variables that may affect compiler behavior 8991238106Sdes for var in $variables_saved_for_relink; do 8992238106Sdes if eval test -z \"\${$var+set}\"; then 8993238106Sdes relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 8994238106Sdes elif eval var_value=\$$var; test -z "$var_value"; then 8995238106Sdes relink_command="$var=; export $var; $relink_command" 8996238106Sdes else 8997238106Sdes func_quote_for_eval "$var_value" 8998238106Sdes relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 8999238106Sdes fi 9000238106Sdes done 9001238106Sdes relink_command="(cd `pwd`; $relink_command)" 9002238106Sdes relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9003238106Sdes fi 9004238106Sdes 9005238106Sdes # Only actually do things if not in dry run mode. 9006238106Sdes $opt_dry_run || { 9007238106Sdes # win32 will think the script is a binary if it has 9008238106Sdes # a .exe suffix, so we strip it off here. 9009238106Sdes case $output in 9010238106Sdes *.exe) func_stripname '' '.exe' "$output" 9011238106Sdes output=$func_stripname_result ;; 9012238106Sdes esac 9013238106Sdes # test for cygwin because mv fails w/o .exe extensions 9014238106Sdes case $host in 9015238106Sdes *cygwin*) 9016238106Sdes exeext=.exe 9017238106Sdes func_stripname '' '.exe' "$outputname" 9018238106Sdes outputname=$func_stripname_result ;; 9019238106Sdes *) exeext= ;; 9020238106Sdes esac 9021238106Sdes case $host in 9022238106Sdes *cygwin* | *mingw* ) 9023238106Sdes func_dirname_and_basename "$output" "" "." 9024238106Sdes output_name=$func_basename_result 9025238106Sdes output_path=$func_dirname_result 9026238106Sdes cwrappersource="$output_path/$objdir/lt-$output_name.c" 9027238106Sdes cwrapper="$output_path/$output_name.exe" 9028238106Sdes $RM $cwrappersource $cwrapper 9029238106Sdes trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 9030238106Sdes 9031238106Sdes func_emit_cwrapperexe_src > $cwrappersource 9032238106Sdes 9033238106Sdes # The wrapper executable is built using the $host compiler, 9034238106Sdes # because it contains $host paths and files. If cross- 9035238106Sdes # compiling, it, like the target executable, must be 9036238106Sdes # executed on the $host or under an emulation environment. 9037238106Sdes $opt_dry_run || { 9038238106Sdes $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 9039238106Sdes $STRIP $cwrapper 9040238106Sdes } 9041238106Sdes 9042238106Sdes # Now, create the wrapper script for func_source use: 9043238106Sdes func_ltwrapper_scriptname $cwrapper 9044238106Sdes $RM $func_ltwrapper_scriptname_result 9045238106Sdes trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 9046238106Sdes $opt_dry_run || { 9047238106Sdes # note: this script will not be executed, so do not chmod. 9048238106Sdes if test "x$build" = "x$host" ; then 9049238106Sdes $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 9050238106Sdes else 9051238106Sdes func_emit_wrapper no > $func_ltwrapper_scriptname_result 9052238106Sdes fi 9053238106Sdes } 9054238106Sdes ;; 9055238106Sdes * ) 9056238106Sdes $RM $output 9057238106Sdes trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 9058238106Sdes 9059238106Sdes func_emit_wrapper no > $output 9060238106Sdes chmod +x $output 9061238106Sdes ;; 9062238106Sdes esac 9063238106Sdes } 9064238106Sdes exit $EXIT_SUCCESS 9065238106Sdes ;; 9066238106Sdes esac 9067238106Sdes 9068238106Sdes # See if we need to build an old-fashioned archive. 9069238106Sdes for oldlib in $oldlibs; do 9070238106Sdes 9071238106Sdes if test "$build_libtool_libs" = convenience; then 9072238106Sdes oldobjs="$libobjs_save $symfileobj" 9073238106Sdes addlibs="$convenience" 9074238106Sdes build_libtool_libs=no 9075238106Sdes else 9076238106Sdes if test "$build_libtool_libs" = module; then 9077238106Sdes oldobjs="$libobjs_save" 9078238106Sdes build_libtool_libs=no 9079238106Sdes else 9080238106Sdes oldobjs="$old_deplibs $non_pic_objects" 9081238106Sdes if test "$preload" = yes && test -f "$symfileobj"; then 9082238106Sdes func_append oldobjs " $symfileobj" 9083238106Sdes fi 9084238106Sdes fi 9085238106Sdes addlibs="$old_convenience" 9086238106Sdes fi 9087238106Sdes 9088238106Sdes if test -n "$addlibs"; then 9089238106Sdes gentop="$output_objdir/${outputname}x" 9090238106Sdes func_append generated " $gentop" 9091238106Sdes 9092238106Sdes func_extract_archives $gentop $addlibs 9093238106Sdes func_append oldobjs " $func_extract_archives_result" 9094238106Sdes fi 9095238106Sdes 9096238106Sdes # Do each command in the archive commands. 9097238106Sdes if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 9098238106Sdes cmds=$old_archive_from_new_cmds 9099238106Sdes else 9100238106Sdes 9101238106Sdes # Add any objects from preloaded convenience libraries 9102238106Sdes if test -n "$dlprefiles"; then 9103238106Sdes gentop="$output_objdir/${outputname}x" 9104238106Sdes func_append generated " $gentop" 9105238106Sdes 9106238106Sdes func_extract_archives $gentop $dlprefiles 9107238106Sdes func_append oldobjs " $func_extract_archives_result" 9108238106Sdes fi 9109238106Sdes 9110238106Sdes # POSIX demands no paths to be encoded in archives. We have 9111238106Sdes # to avoid creating archives with duplicate basenames if we 9112238106Sdes # might have to extract them afterwards, e.g., when creating a 9113238106Sdes # static archive out of a convenience library, or when linking 9114238106Sdes # the entirety of a libtool archive into another (currently 9115238106Sdes # not supported by libtool). 9116238106Sdes if (for obj in $oldobjs 9117238106Sdes do 9118238106Sdes func_basename "$obj" 9119238106Sdes $ECHO "$func_basename_result" 9120238106Sdes done | sort | sort -uc >/dev/null 2>&1); then 9121238106Sdes : 9122238106Sdes else 9123238106Sdes echo "copying selected object files to avoid basename conflicts..." 9124238106Sdes gentop="$output_objdir/${outputname}x" 9125238106Sdes func_append generated " $gentop" 9126238106Sdes func_mkdir_p "$gentop" 9127238106Sdes save_oldobjs=$oldobjs 9128238106Sdes oldobjs= 9129238106Sdes counter=1 9130238106Sdes for obj in $save_oldobjs 9131238106Sdes do 9132238106Sdes func_basename "$obj" 9133238106Sdes objbase="$func_basename_result" 9134238106Sdes case " $oldobjs " in 9135238106Sdes " ") oldobjs=$obj ;; 9136238106Sdes *[\ /]"$objbase "*) 9137238106Sdes while :; do 9138238106Sdes # Make sure we don't pick an alternate name that also 9139238106Sdes # overlaps. 9140238106Sdes newobj=lt$counter-$objbase 9141238106Sdes func_arith $counter + 1 9142238106Sdes counter=$func_arith_result 9143238106Sdes case " $oldobjs " in 9144238106Sdes *[\ /]"$newobj "*) ;; 9145238106Sdes *) if test ! -f "$gentop/$newobj"; then break; fi ;; 9146238106Sdes esac 9147238106Sdes done 9148238106Sdes func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 9149238106Sdes func_append oldobjs " $gentop/$newobj" 9150238106Sdes ;; 9151238106Sdes *) func_append oldobjs " $obj" ;; 9152238106Sdes esac 9153238106Sdes done 9154238106Sdes fi 9155238106Sdes eval cmds=\"$old_archive_cmds\" 9156238106Sdes 9157238106Sdes func_len " $cmds" 9158238106Sdes len=$func_len_result 9159238106Sdes if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 9160238106Sdes cmds=$old_archive_cmds 9161238106Sdes elif test -n "$archiver_list_spec"; then 9162238106Sdes func_verbose "using command file archive linking..." 9163238106Sdes for obj in $oldobjs 9164238106Sdes do 9165238106Sdes func_to_tool_file "$obj" 9166238106Sdes $ECHO "$func_to_tool_file_result" 9167238106Sdes done > $output_objdir/$libname.libcmd 9168238106Sdes func_to_tool_file "$output_objdir/$libname.libcmd" 9169238106Sdes oldobjs=" $archiver_list_spec$func_to_tool_file_result" 9170238106Sdes cmds=$old_archive_cmds 9171238106Sdes else 9172238106Sdes # the command line is too long to link in one step, link in parts 9173238106Sdes func_verbose "using piecewise archive linking..." 9174238106Sdes save_RANLIB=$RANLIB 9175238106Sdes RANLIB=: 9176238106Sdes objlist= 9177238106Sdes concat_cmds= 9178238106Sdes save_oldobjs=$oldobjs 9179238106Sdes oldobjs= 9180238106Sdes # Is there a better way of finding the last object in the list? 9181238106Sdes for obj in $save_oldobjs 9182238106Sdes do 9183238106Sdes last_oldobj=$obj 9184238106Sdes done 9185238106Sdes eval test_cmds=\"$old_archive_cmds\" 9186238106Sdes func_len " $test_cmds" 9187238106Sdes len0=$func_len_result 9188238106Sdes len=$len0 9189238106Sdes for obj in $save_oldobjs 9190238106Sdes do 9191238106Sdes func_len " $obj" 9192238106Sdes func_arith $len + $func_len_result 9193238106Sdes len=$func_arith_result 9194238106Sdes func_append objlist " $obj" 9195238106Sdes if test "$len" -lt "$max_cmd_len"; then 9196238106Sdes : 9197238106Sdes else 9198238106Sdes # the above command should be used before it gets too long 9199238106Sdes oldobjs=$objlist 9200238106Sdes if test "$obj" = "$last_oldobj" ; then 9201238106Sdes RANLIB=$save_RANLIB 9202238106Sdes fi 9203238106Sdes test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 9204238106Sdes eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 9205238106Sdes objlist= 9206238106Sdes len=$len0 9207238106Sdes fi 9208238106Sdes done 9209238106Sdes RANLIB=$save_RANLIB 9210238106Sdes oldobjs=$objlist 9211238106Sdes if test "X$oldobjs" = "X" ; then 9212238106Sdes eval cmds=\"\$concat_cmds\" 9213238106Sdes else 9214238106Sdes eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 9215238106Sdes fi 9216238106Sdes fi 9217238106Sdes fi 9218238106Sdes func_execute_cmds "$cmds" 'exit $?' 9219238106Sdes done 9220238106Sdes 9221238106Sdes test -n "$generated" && \ 9222238106Sdes func_show_eval "${RM}r$generated" 9223238106Sdes 9224238106Sdes # Now create the libtool archive. 9225238106Sdes case $output in 9226238106Sdes *.la) 9227238106Sdes old_library= 9228238106Sdes test "$build_old_libs" = yes && old_library="$libname.$libext" 9229238106Sdes func_verbose "creating $output" 9230238106Sdes 9231238106Sdes # Preserve any variables that may affect compiler behavior 9232238106Sdes for var in $variables_saved_for_relink; do 9233238106Sdes if eval test -z \"\${$var+set}\"; then 9234238106Sdes relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 9235238106Sdes elif eval var_value=\$$var; test -z "$var_value"; then 9236238106Sdes relink_command="$var=; export $var; $relink_command" 9237238106Sdes else 9238238106Sdes func_quote_for_eval "$var_value" 9239238106Sdes relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 9240238106Sdes fi 9241238106Sdes done 9242238106Sdes # Quote the link command for shipping. 9243238106Sdes relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 9244238106Sdes relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 9245238106Sdes if test "$hardcode_automatic" = yes ; then 9246238106Sdes relink_command= 9247238106Sdes fi 9248238106Sdes 9249238106Sdes # Only create the output if not a dry run. 9250238106Sdes $opt_dry_run || { 9251238106Sdes for installed in no yes; do 9252238106Sdes if test "$installed" = yes; then 9253238106Sdes if test -z "$install_libdir"; then 9254238106Sdes break 9255238106Sdes fi 9256238106Sdes output="$output_objdir/$outputname"i 9257238106Sdes # Replace all uninstalled libtool libraries with the installed ones 9258238106Sdes newdependency_libs= 9259238106Sdes for deplib in $dependency_libs; do 9260238106Sdes case $deplib in 9261238106Sdes *.la) 9262238106Sdes func_basename "$deplib" 9263238106Sdes name="$func_basename_result" 9264238106Sdes eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 9265238106Sdes test -z "$libdir" && \ 9266238106Sdes func_fatal_error "\`$deplib' is not a valid libtool archive" 9267238106Sdes func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 9268238106Sdes ;; 9269238106Sdes -L*) 9270238106Sdes func_stripname -L '' "$deplib" 9271238106Sdes func_replace_sysroot "$func_stripname_result" 9272238106Sdes func_append newdependency_libs " -L$func_replace_sysroot_result" 9273238106Sdes ;; 9274238106Sdes -R*) 9275238106Sdes func_stripname -R '' "$deplib" 9276238106Sdes func_replace_sysroot "$func_stripname_result" 9277238106Sdes func_append newdependency_libs " -R$func_replace_sysroot_result" 9278238106Sdes ;; 9279238106Sdes *) func_append newdependency_libs " $deplib" ;; 9280238106Sdes esac 9281238106Sdes done 9282238106Sdes dependency_libs="$newdependency_libs" 9283238106Sdes newdlfiles= 9284238106Sdes 9285238106Sdes for lib in $dlfiles; do 9286238106Sdes case $lib in 9287238106Sdes *.la) 9288238106Sdes func_basename "$lib" 9289238106Sdes name="$func_basename_result" 9290238106Sdes eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9291238106Sdes test -z "$libdir" && \ 9292238106Sdes func_fatal_error "\`$lib' is not a valid libtool archive" 9293238106Sdes func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 9294238106Sdes ;; 9295238106Sdes *) func_append newdlfiles " $lib" ;; 9296238106Sdes esac 9297238106Sdes done 9298238106Sdes dlfiles="$newdlfiles" 9299238106Sdes newdlprefiles= 9300238106Sdes for lib in $dlprefiles; do 9301238106Sdes case $lib in 9302238106Sdes *.la) 9303238106Sdes # Only pass preopened files to the pseudo-archive (for 9304238106Sdes # eventual linking with the app. that links it) if we 9305238106Sdes # didn't already link the preopened objects directly into 9306238106Sdes # the library: 9307238106Sdes func_basename "$lib" 9308238106Sdes name="$func_basename_result" 9309238106Sdes eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 9310238106Sdes test -z "$libdir" && \ 9311238106Sdes func_fatal_error "\`$lib' is not a valid libtool archive" 9312238106Sdes func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 9313238106Sdes ;; 9314238106Sdes esac 9315238106Sdes done 9316238106Sdes dlprefiles="$newdlprefiles" 9317238106Sdes else 9318238106Sdes newdlfiles= 9319238106Sdes for lib in $dlfiles; do 9320238106Sdes case $lib in 9321238106Sdes [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9322238106Sdes *) abs=`pwd`"/$lib" ;; 9323238106Sdes esac 9324238106Sdes func_append newdlfiles " $abs" 9325238106Sdes done 9326238106Sdes dlfiles="$newdlfiles" 9327238106Sdes newdlprefiles= 9328238106Sdes for lib in $dlprefiles; do 9329238106Sdes case $lib in 9330238106Sdes [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 9331238106Sdes *) abs=`pwd`"/$lib" ;; 9332238106Sdes esac 9333238106Sdes func_append newdlprefiles " $abs" 9334238106Sdes done 9335238106Sdes dlprefiles="$newdlprefiles" 9336238106Sdes fi 9337238106Sdes $RM $output 9338238106Sdes # place dlname in correct position for cygwin 9339238106Sdes # In fact, it would be nice if we could use this code for all target 9340238106Sdes # systems that can't hard-code library paths into their executables 9341238106Sdes # and that have no shared library path variable independent of PATH, 9342238106Sdes # but it turns out we can't easily determine that from inspecting 9343238106Sdes # libtool variables, so we have to hard-code the OSs to which it 9344238106Sdes # applies here; at the moment, that means platforms that use the PE 9345238106Sdes # object format with DLL files. See the long comment at the top of 9346238106Sdes # tests/bindir.at for full details. 9347238106Sdes tdlname=$dlname 9348238106Sdes case $host,$output,$installed,$module,$dlname in 9349238106Sdes *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 9350238106Sdes # If a -bindir argument was supplied, place the dll there. 9351238106Sdes if test "x$bindir" != x ; 9352238106Sdes then 9353238106Sdes func_relative_path "$install_libdir" "$bindir" 9354238106Sdes tdlname=$func_relative_path_result$dlname 9355238106Sdes else 9356238106Sdes # Otherwise fall back on heuristic. 9357238106Sdes tdlname=../bin/$dlname 9358238106Sdes fi 9359238106Sdes ;; 9360238106Sdes esac 9361238106Sdes $ECHO > $output "\ 9362238106Sdes# $outputname - a libtool library file 9363238106Sdes# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION 9364238106Sdes# 9365238106Sdes# Please DO NOT delete this file! 9366238106Sdes# It is necessary for linking the library. 9367238106Sdes 9368238106Sdes# The name that we can dlopen(3). 9369238106Sdesdlname='$tdlname' 9370238106Sdes 9371238106Sdes# Names of this library. 9372238106Sdeslibrary_names='$library_names' 9373238106Sdes 9374238106Sdes# The name of the static archive. 9375238106Sdesold_library='$old_library' 9376238106Sdes 9377238106Sdes# Linker flags that can not go in dependency_libs. 9378238106Sdesinherited_linker_flags='$new_inherited_linker_flags' 9379238106Sdes 9380238106Sdes# Libraries that this one depends upon. 9381238106Sdesdependency_libs='$dependency_libs' 9382238106Sdes 9383238106Sdes# Names of additional weak libraries provided by this library 9384238106Sdesweak_library_names='$weak_libs' 9385238106Sdes 9386238106Sdes# Version information for $libname. 9387238106Sdescurrent=$current 9388238106Sdesage=$age 9389238106Sdesrevision=$revision 9390238106Sdes 9391238106Sdes# Is this an already installed library? 9392238106Sdesinstalled=$installed 9393238106Sdes 9394238106Sdes# Should we warn about portability when linking against -modules? 9395238106Sdesshouldnotlink=$module 9396238106Sdes 9397238106Sdes# Files to dlopen/dlpreopen 9398238106Sdesdlopen='$dlfiles' 9399238106Sdesdlpreopen='$dlprefiles' 9400238106Sdes 9401238106Sdes# Directory that this library needs to be installed in: 9402238106Sdeslibdir='$install_libdir'" 9403238106Sdes if test "$installed" = no && test "$need_relink" = yes; then 9404238106Sdes $ECHO >> $output "\ 9405238106Sdesrelink_command=\"$relink_command\"" 9406238106Sdes fi 9407238106Sdes done 9408238106Sdes } 9409238106Sdes 9410238106Sdes # Do a symbolic link so that the libtool archive can be found in 9411238106Sdes # LD_LIBRARY_PATH before the program is installed. 9412238106Sdes func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 9413238106Sdes ;; 9414238106Sdes esac 9415238106Sdes exit $EXIT_SUCCESS 9416238106Sdes} 9417238106Sdes 9418238106Sdes{ test "$opt_mode" = link || test "$opt_mode" = relink; } && 9419238106Sdes func_mode_link ${1+"$@"} 9420238106Sdes 9421238106Sdes 9422238106Sdes# func_mode_uninstall arg... 9423238106Sdesfunc_mode_uninstall () 9424238106Sdes{ 9425238106Sdes $opt_debug 9426238106Sdes RM="$nonopt" 9427238106Sdes files= 9428238106Sdes rmforce= 9429238106Sdes exit_status=0 9430238106Sdes 9431238106Sdes # This variable tells wrapper scripts just to set variables rather 9432238106Sdes # than running their programs. 9433238106Sdes libtool_install_magic="$magic" 9434238106Sdes 9435238106Sdes for arg 9436238106Sdes do 9437238106Sdes case $arg in 9438238106Sdes -f) func_append RM " $arg"; rmforce=yes ;; 9439238106Sdes -*) func_append RM " $arg" ;; 9440238106Sdes *) func_append files " $arg" ;; 9441238106Sdes esac 9442238106Sdes done 9443238106Sdes 9444238106Sdes test -z "$RM" && \ 9445238106Sdes func_fatal_help "you must specify an RM program" 9446238106Sdes 9447238106Sdes rmdirs= 9448238106Sdes 9449238106Sdes for file in $files; do 9450238106Sdes func_dirname "$file" "" "." 9451238106Sdes dir="$func_dirname_result" 9452238106Sdes if test "X$dir" = X.; then 9453238106Sdes odir="$objdir" 9454238106Sdes else 9455238106Sdes odir="$dir/$objdir" 9456238106Sdes fi 9457238106Sdes func_basename "$file" 9458238106Sdes name="$func_basename_result" 9459238106Sdes test "$opt_mode" = uninstall && odir="$dir" 9460238106Sdes 9461238106Sdes # Remember odir for removal later, being careful to avoid duplicates 9462238106Sdes if test "$opt_mode" = clean; then 9463238106Sdes case " $rmdirs " in 9464238106Sdes *" $odir "*) ;; 9465238106Sdes *) func_append rmdirs " $odir" ;; 9466238106Sdes esac 9467238106Sdes fi 9468238106Sdes 9469238106Sdes # Don't error if the file doesn't exist and rm -f was used. 9470238106Sdes if { test -L "$file"; } >/dev/null 2>&1 || 9471238106Sdes { test -h "$file"; } >/dev/null 2>&1 || 9472238106Sdes test -f "$file"; then 9473238106Sdes : 9474238106Sdes elif test -d "$file"; then 9475238106Sdes exit_status=1 9476238106Sdes continue 9477238106Sdes elif test "$rmforce" = yes; then 9478238106Sdes continue 9479238106Sdes fi 9480238106Sdes 9481238106Sdes rmfiles="$file" 9482238106Sdes 9483238106Sdes case $name in 9484238106Sdes *.la) 9485238106Sdes # Possibly a libtool archive, so verify it. 9486238106Sdes if func_lalib_p "$file"; then 9487238106Sdes func_source $dir/$name 9488238106Sdes 9489238106Sdes # Delete the libtool libraries and symlinks. 9490238106Sdes for n in $library_names; do 9491238106Sdes func_append rmfiles " $odir/$n" 9492238106Sdes done 9493238106Sdes test -n "$old_library" && func_append rmfiles " $odir/$old_library" 9494238106Sdes 9495238106Sdes case "$opt_mode" in 9496238106Sdes clean) 9497238106Sdes case " $library_names " in 9498238106Sdes *" $dlname "*) ;; 9499238106Sdes *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 9500238106Sdes esac 9501238106Sdes test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 9502238106Sdes ;; 9503238106Sdes uninstall) 9504238106Sdes if test -n "$library_names"; then 9505238106Sdes # Do each command in the postuninstall commands. 9506238106Sdes func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9507238106Sdes fi 9508238106Sdes 9509238106Sdes if test -n "$old_library"; then 9510238106Sdes # Do each command in the old_postuninstall commands. 9511238106Sdes func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' 9512238106Sdes fi 9513238106Sdes # FIXME: should reinstall the best remaining shared library. 9514238106Sdes ;; 9515238106Sdes esac 9516238106Sdes fi 9517238106Sdes ;; 9518238106Sdes 9519238106Sdes *.lo) 9520238106Sdes # Possibly a libtool object, so verify it. 9521238106Sdes if func_lalib_p "$file"; then 9522238106Sdes 9523238106Sdes # Read the .lo file 9524238106Sdes func_source $dir/$name 9525238106Sdes 9526238106Sdes # Add PIC object to the list of files to remove. 9527238106Sdes if test -n "$pic_object" && 9528238106Sdes test "$pic_object" != none; then 9529238106Sdes func_append rmfiles " $dir/$pic_object" 9530238106Sdes fi 9531238106Sdes 9532238106Sdes # Add non-PIC object to the list of files to remove. 9533238106Sdes if test -n "$non_pic_object" && 9534238106Sdes test "$non_pic_object" != none; then 9535238106Sdes func_append rmfiles " $dir/$non_pic_object" 9536238106Sdes fi 9537238106Sdes fi 9538238106Sdes ;; 9539238106Sdes 9540238106Sdes *) 9541238106Sdes if test "$opt_mode" = clean ; then 9542238106Sdes noexename=$name 9543238106Sdes case $file in 9544238106Sdes *.exe) 9545238106Sdes func_stripname '' '.exe' "$file" 9546238106Sdes file=$func_stripname_result 9547238106Sdes func_stripname '' '.exe' "$name" 9548238106Sdes noexename=$func_stripname_result 9549238106Sdes # $file with .exe has already been added to rmfiles, 9550238106Sdes # add $file without .exe 9551238106Sdes func_append rmfiles " $file" 9552238106Sdes ;; 9553238106Sdes esac 9554238106Sdes # Do a test to see if this is a libtool program. 9555238106Sdes if func_ltwrapper_p "$file"; then 9556238106Sdes if func_ltwrapper_executable_p "$file"; then 9557238106Sdes func_ltwrapper_scriptname "$file" 9558238106Sdes relink_command= 9559238106Sdes func_source $func_ltwrapper_scriptname_result 9560238106Sdes func_append rmfiles " $func_ltwrapper_scriptname_result" 9561238106Sdes else 9562238106Sdes relink_command= 9563238106Sdes func_source $dir/$noexename 9564238106Sdes fi 9565238106Sdes 9566238106Sdes # note $name still contains .exe if it was in $file originally 9567238106Sdes # as does the version of $file that was added into $rmfiles 9568238106Sdes func_append rmfiles " $odir/$name $odir/${name}S.${objext}" 9569238106Sdes if test "$fast_install" = yes && test -n "$relink_command"; then 9570238106Sdes func_append rmfiles " $odir/lt-$name" 9571238106Sdes fi 9572238106Sdes if test "X$noexename" != "X$name" ; then 9573238106Sdes func_append rmfiles " $odir/lt-${noexename}.c" 9574238106Sdes fi 9575238106Sdes fi 9576238106Sdes fi 9577238106Sdes ;; 9578238106Sdes esac 9579238106Sdes func_show_eval "$RM $rmfiles" 'exit_status=1' 9580238106Sdes done 9581238106Sdes 9582238106Sdes # Try to remove the ${objdir}s in the directories where we deleted files 9583238106Sdes for dir in $rmdirs; do 9584238106Sdes if test -d "$dir"; then 9585238106Sdes func_show_eval "rmdir $dir >/dev/null 2>&1" 9586238106Sdes fi 9587238106Sdes done 9588238106Sdes 9589238106Sdes exit $exit_status 9590238106Sdes} 9591238106Sdes 9592238106Sdes{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && 9593238106Sdes func_mode_uninstall ${1+"$@"} 9594238106Sdes 9595238106Sdestest -z "$opt_mode" && { 9596238106Sdes help="$generic_help" 9597238106Sdes func_fatal_help "you must specify a MODE" 9598238106Sdes} 9599238106Sdes 9600238106Sdestest -z "$exec_cmd" && \ 9601238106Sdes func_fatal_help "invalid operation mode \`$opt_mode'" 9602238106Sdes 9603238106Sdesif test -n "$exec_cmd"; then 9604238106Sdes eval exec "$exec_cmd" 9605238106Sdes exit $EXIT_FAILURE 9606238106Sdesfi 9607238106Sdes 9608238106Sdesexit $exit_status 9609238106Sdes 9610238106Sdes 9611238106Sdes# The TAGs below are defined such that we never get into a situation 9612238106Sdes# in which we disable both kinds of libraries. Given conflicting 9613238106Sdes# choices, we go for a static library, that is the most portable, 9614238106Sdes# since we can't tell whether shared libraries were disabled because 9615238106Sdes# the user asked for that or because the platform doesn't support 9616238106Sdes# them. This is particularly important on AIX, because we don't 9617238106Sdes# support having both static and shared libraries enabled at the same 9618238106Sdes# time on that platform, so we default to a shared-only configuration. 9619238106Sdes# If a disable-shared tag is given, we'll fallback to a static-only 9620238106Sdes# configuration. But we'll never go from static-only to shared-only. 9621238106Sdes 9622238106Sdes# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 9623238106Sdesbuild_libtool_libs=no 9624238106Sdesbuild_old_libs=yes 9625238106Sdes# ### END LIBTOOL TAG CONFIG: disable-shared 9626238106Sdes 9627238106Sdes# ### BEGIN LIBTOOL TAG CONFIG: disable-static 9628238106Sdesbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 9629238106Sdes# ### END LIBTOOL TAG CONFIG: disable-static 9630238106Sdes 9631238106Sdes# Local Variables: 9632238106Sdes# mode:shell-script 9633238106Sdes# sh-indentation:2 9634238106Sdes# End: 9635238106Sdes# vi:sw=2 9636238106Sdes 9637