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