1*6a54128fSAndroid Build Coastguard Worker#! /bin/sh 2*6a54128fSAndroid Build Coastguard Worker## DO NOT EDIT - This file generated from ./build-aux/ltmain.in 3*6a54128fSAndroid Build Coastguard Worker## by inline-source v2014-01-03.01 4*6a54128fSAndroid Build Coastguard Worker 5*6a54128fSAndroid Build Coastguard Worker# libtool (GNU libtool) 2.4.6 6*6a54128fSAndroid Build Coastguard Worker# Provide generalized library-building support services. 7*6a54128fSAndroid Build Coastguard Worker# Written by Gordon Matzigkeit <[email protected]>, 1996 8*6a54128fSAndroid Build Coastguard Worker 9*6a54128fSAndroid Build Coastguard Worker# Copyright (C) 1996-2015 Free Software Foundation, Inc. 10*6a54128fSAndroid Build Coastguard Worker# This is free software; see the source for copying conditions. There is NO 11*6a54128fSAndroid Build Coastguard Worker# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12*6a54128fSAndroid Build Coastguard Worker 13*6a54128fSAndroid Build Coastguard Worker# GNU Libtool is free software; you can redistribute it and/or modify 14*6a54128fSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by 15*6a54128fSAndroid Build Coastguard Worker# the Free Software Foundation; either version 2 of the License, or 16*6a54128fSAndroid Build Coastguard Worker# (at your option) any later version. 17*6a54128fSAndroid Build Coastguard Worker# 18*6a54128fSAndroid Build Coastguard Worker# As a special exception to the GNU General Public License, 19*6a54128fSAndroid Build Coastguard Worker# if you distribute this file as part of a program or library that 20*6a54128fSAndroid Build Coastguard Worker# is built using GNU Libtool, you may include this file under the 21*6a54128fSAndroid Build Coastguard Worker# same distribution terms that you use for the rest of that program. 22*6a54128fSAndroid Build Coastguard Worker# 23*6a54128fSAndroid Build Coastguard Worker# GNU Libtool is distributed in the hope that it will be useful, but 24*6a54128fSAndroid Build Coastguard Worker# WITHOUT ANY WARRANTY; without even the implied warranty of 25*6a54128fSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 26*6a54128fSAndroid Build Coastguard Worker# General Public License for more details. 27*6a54128fSAndroid Build Coastguard Worker# 28*6a54128fSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License 29*6a54128fSAndroid Build Coastguard Worker# along with this program. If not, see <http://www.gnu.org/licenses/>. 30*6a54128fSAndroid Build Coastguard Worker 31*6a54128fSAndroid Build Coastguard Worker 32*6a54128fSAndroid Build Coastguard WorkerPROGRAM=libtool 33*6a54128fSAndroid Build Coastguard WorkerPACKAGE=libtool 34*6a54128fSAndroid Build Coastguard WorkerVERSION="2.4.6 Debian-2.4.6-9" 35*6a54128fSAndroid Build Coastguard Workerpackage_revision=2.4.6 36*6a54128fSAndroid Build Coastguard Worker 37*6a54128fSAndroid Build Coastguard Worker 38*6a54128fSAndroid Build Coastguard Worker## ------ ## 39*6a54128fSAndroid Build Coastguard Worker## Usage. ## 40*6a54128fSAndroid Build Coastguard Worker## ------ ## 41*6a54128fSAndroid Build Coastguard Worker 42*6a54128fSAndroid Build Coastguard Worker# Run './libtool --help' for help with using this script from the 43*6a54128fSAndroid Build Coastguard Worker# command line. 44*6a54128fSAndroid Build Coastguard Worker 45*6a54128fSAndroid Build Coastguard Worker 46*6a54128fSAndroid Build Coastguard Worker## ------------------------------- ## 47*6a54128fSAndroid Build Coastguard Worker## User overridable command paths. ## 48*6a54128fSAndroid Build Coastguard Worker## ------------------------------- ## 49*6a54128fSAndroid Build Coastguard Worker 50*6a54128fSAndroid Build Coastguard Worker# After configure completes, it has a better idea of some of the 51*6a54128fSAndroid Build Coastguard Worker# shell tools we need than the defaults used by the functions shared 52*6a54128fSAndroid Build Coastguard Worker# with bootstrap, so set those here where they can still be over- 53*6a54128fSAndroid Build Coastguard Worker# ridden by the user, but otherwise take precedence. 54*6a54128fSAndroid Build Coastguard Worker 55*6a54128fSAndroid Build Coastguard Worker: ${AUTOCONF="autoconf"} 56*6a54128fSAndroid Build Coastguard Worker: ${AUTOMAKE="automake"} 57*6a54128fSAndroid Build Coastguard Worker 58*6a54128fSAndroid Build Coastguard Worker 59*6a54128fSAndroid Build Coastguard Worker## -------------------------- ## 60*6a54128fSAndroid Build Coastguard Worker## Source external libraries. ## 61*6a54128fSAndroid Build Coastguard Worker## -------------------------- ## 62*6a54128fSAndroid Build Coastguard Worker 63*6a54128fSAndroid Build Coastguard Worker# Much of our low-level functionality needs to be sourced from external 64*6a54128fSAndroid Build Coastguard Worker# libraries, which are installed to $pkgauxdir. 65*6a54128fSAndroid Build Coastguard Worker 66*6a54128fSAndroid Build Coastguard Worker# Set a version string for this script. 67*6a54128fSAndroid Build Coastguard Workerscriptversion=2015-01-20.17; # UTC 68*6a54128fSAndroid Build Coastguard Worker 69*6a54128fSAndroid Build Coastguard Worker# General shell script boiler plate, and helper functions. 70*6a54128fSAndroid Build Coastguard Worker# Written by Gary V. Vaughan, 2004 71*6a54128fSAndroid Build Coastguard Worker 72*6a54128fSAndroid Build Coastguard Worker# Copyright (C) 2004-2015 Free Software Foundation, Inc. 73*6a54128fSAndroid Build Coastguard Worker# This is free software; see the source for copying conditions. There is NO 74*6a54128fSAndroid Build Coastguard Worker# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 75*6a54128fSAndroid Build Coastguard Worker 76*6a54128fSAndroid Build Coastguard Worker# This program is free software; you can redistribute it and/or modify 77*6a54128fSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by 78*6a54128fSAndroid Build Coastguard Worker# the Free Software Foundation; either version 3 of the License, or 79*6a54128fSAndroid Build Coastguard Worker# (at your option) any later version. 80*6a54128fSAndroid Build Coastguard Worker 81*6a54128fSAndroid Build Coastguard Worker# As a special exception to the GNU General Public License, if you distribute 82*6a54128fSAndroid Build Coastguard Worker# this file as part of a program or library that is built using GNU Libtool, 83*6a54128fSAndroid Build Coastguard Worker# you may include this file under the same distribution terms that you use 84*6a54128fSAndroid Build Coastguard Worker# for the rest of that program. 85*6a54128fSAndroid Build Coastguard Worker 86*6a54128fSAndroid Build Coastguard Worker# This program is distributed in the hope that it will be useful, 87*6a54128fSAndroid Build Coastguard Worker# but WITHOUT ANY WARRANTY; without even the implied warranty of 88*6a54128fSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU 89*6a54128fSAndroid Build Coastguard Worker# General Public License for more details. 90*6a54128fSAndroid Build Coastguard Worker 91*6a54128fSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License 92*6a54128fSAndroid Build Coastguard Worker# along with this program. If not, see <http://www.gnu.org/licenses/>. 93*6a54128fSAndroid Build Coastguard Worker 94*6a54128fSAndroid Build Coastguard Worker# Please report bugs or propose patches to [email protected]. 95*6a54128fSAndroid Build Coastguard Worker 96*6a54128fSAndroid Build Coastguard Worker 97*6a54128fSAndroid Build Coastguard Worker## ------ ## 98*6a54128fSAndroid Build Coastguard Worker## Usage. ## 99*6a54128fSAndroid Build Coastguard Worker## ------ ## 100*6a54128fSAndroid Build Coastguard Worker 101*6a54128fSAndroid Build Coastguard Worker# Evaluate this file near the top of your script to gain access to 102*6a54128fSAndroid Build Coastguard Worker# the functions and variables defined here: 103*6a54128fSAndroid Build Coastguard Worker# 104*6a54128fSAndroid Build Coastguard Worker# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh 105*6a54128fSAndroid Build Coastguard Worker# 106*6a54128fSAndroid Build Coastguard Worker# If you need to override any of the default environment variable 107*6a54128fSAndroid Build Coastguard Worker# settings, do that before evaluating this file. 108*6a54128fSAndroid Build Coastguard Worker 109*6a54128fSAndroid Build Coastguard Worker 110*6a54128fSAndroid Build Coastguard Worker## -------------------- ## 111*6a54128fSAndroid Build Coastguard Worker## Shell normalisation. ## 112*6a54128fSAndroid Build Coastguard Worker## -------------------- ## 113*6a54128fSAndroid Build Coastguard Worker 114*6a54128fSAndroid Build Coastguard Worker# Some shells need a little help to be as Bourne compatible as possible. 115*6a54128fSAndroid Build Coastguard Worker# Before doing anything else, make sure all that help has been provided! 116*6a54128fSAndroid Build Coastguard Worker 117*6a54128fSAndroid Build Coastguard WorkerDUALCASE=1; export DUALCASE # for MKS sh 118*6a54128fSAndroid Build Coastguard Workerif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : 119*6a54128fSAndroid Build Coastguard Worker emulate sh 120*6a54128fSAndroid Build Coastguard Worker NULLCMD=: 121*6a54128fSAndroid Build Coastguard Worker # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which 122*6a54128fSAndroid Build Coastguard Worker # is contrary to our usage. Disable this feature. 123*6a54128fSAndroid Build Coastguard Worker alias -g '${1+"$@"}'='"$@"' 124*6a54128fSAndroid Build Coastguard Worker setopt NO_GLOB_SUBST 125*6a54128fSAndroid Build Coastguard Workerelse 126*6a54128fSAndroid Build Coastguard Worker case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac 127*6a54128fSAndroid Build Coastguard Workerfi 128*6a54128fSAndroid Build Coastguard Worker 129*6a54128fSAndroid Build Coastguard Worker# NLS nuisances: We save the old values in case they are required later. 130*6a54128fSAndroid Build Coastguard Worker_G_user_locale= 131*6a54128fSAndroid Build Coastguard Worker_G_safe_locale= 132*6a54128fSAndroid Build Coastguard Workerfor _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 133*6a54128fSAndroid Build Coastguard Workerdo 134*6a54128fSAndroid Build Coastguard Worker eval "if test set = \"\${$_G_var+set}\"; then 135*6a54128fSAndroid Build Coastguard Worker save_$_G_var=\$$_G_var 136*6a54128fSAndroid Build Coastguard Worker $_G_var=C 137*6a54128fSAndroid Build Coastguard Worker export $_G_var 138*6a54128fSAndroid Build Coastguard Worker _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" 139*6a54128fSAndroid Build Coastguard Worker _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" 140*6a54128fSAndroid Build Coastguard Worker fi" 141*6a54128fSAndroid Build Coastguard Workerdone 142*6a54128fSAndroid Build Coastguard Worker 143*6a54128fSAndroid Build Coastguard Worker# CDPATH. 144*6a54128fSAndroid Build Coastguard Worker(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 145*6a54128fSAndroid Build Coastguard Worker 146*6a54128fSAndroid Build Coastguard Worker# Make sure IFS has a sensible default 147*6a54128fSAndroid Build Coastguard Workersp=' ' 148*6a54128fSAndroid Build Coastguard Workernl=' 149*6a54128fSAndroid Build Coastguard Worker' 150*6a54128fSAndroid Build Coastguard WorkerIFS="$sp $nl" 151*6a54128fSAndroid Build Coastguard Worker 152*6a54128fSAndroid Build Coastguard Worker# There are apparently some retarded systems that use ';' as a PATH separator! 153*6a54128fSAndroid Build Coastguard Workerif test "${PATH_SEPARATOR+set}" != set; then 154*6a54128fSAndroid Build Coastguard Worker PATH_SEPARATOR=: 155*6a54128fSAndroid Build Coastguard Worker (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { 156*6a54128fSAndroid Build Coastguard Worker (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || 157*6a54128fSAndroid Build Coastguard Worker PATH_SEPARATOR=';' 158*6a54128fSAndroid Build Coastguard Worker } 159*6a54128fSAndroid Build Coastguard Workerfi 160*6a54128fSAndroid Build Coastguard Worker 161*6a54128fSAndroid Build Coastguard Worker 162*6a54128fSAndroid Build Coastguard Worker 163*6a54128fSAndroid Build Coastguard Worker## ------------------------- ## 164*6a54128fSAndroid Build Coastguard Worker## Locate command utilities. ## 165*6a54128fSAndroid Build Coastguard Worker## ------------------------- ## 166*6a54128fSAndroid Build Coastguard Worker 167*6a54128fSAndroid Build Coastguard Worker 168*6a54128fSAndroid Build Coastguard Worker# func_executable_p FILE 169*6a54128fSAndroid Build Coastguard Worker# ---------------------- 170*6a54128fSAndroid Build Coastguard Worker# Check that FILE is an executable regular file. 171*6a54128fSAndroid Build Coastguard Workerfunc_executable_p () 172*6a54128fSAndroid Build Coastguard Worker{ 173*6a54128fSAndroid Build Coastguard Worker test -f "$1" && test -x "$1" 174*6a54128fSAndroid Build Coastguard Worker} 175*6a54128fSAndroid Build Coastguard Worker 176*6a54128fSAndroid Build Coastguard Worker 177*6a54128fSAndroid Build Coastguard Worker# func_path_progs PROGS_LIST CHECK_FUNC [PATH] 178*6a54128fSAndroid Build Coastguard Worker# -------------------------------------------- 179*6a54128fSAndroid Build Coastguard Worker# Search for either a program that responds to --version with output 180*6a54128fSAndroid Build Coastguard Worker# containing "GNU", or else returned by CHECK_FUNC otherwise, by 181*6a54128fSAndroid Build Coastguard Worker# trying all the directories in PATH with each of the elements of 182*6a54128fSAndroid Build Coastguard Worker# PROGS_LIST. 183*6a54128fSAndroid Build Coastguard Worker# 184*6a54128fSAndroid Build Coastguard Worker# CHECK_FUNC should accept the path to a candidate program, and 185*6a54128fSAndroid Build Coastguard Worker# set $func_check_prog_result if it truncates its output less than 186*6a54128fSAndroid Build Coastguard Worker# $_G_path_prog_max characters. 187*6a54128fSAndroid Build Coastguard Workerfunc_path_progs () 188*6a54128fSAndroid Build Coastguard Worker{ 189*6a54128fSAndroid Build Coastguard Worker _G_progs_list=$1 190*6a54128fSAndroid Build Coastguard Worker _G_check_func=$2 191*6a54128fSAndroid Build Coastguard Worker _G_PATH=${3-"$PATH"} 192*6a54128fSAndroid Build Coastguard Worker 193*6a54128fSAndroid Build Coastguard Worker _G_path_prog_max=0 194*6a54128fSAndroid Build Coastguard Worker _G_path_prog_found=false 195*6a54128fSAndroid Build Coastguard Worker _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} 196*6a54128fSAndroid Build Coastguard Worker for _G_dir in $_G_PATH; do 197*6a54128fSAndroid Build Coastguard Worker IFS=$_G_save_IFS 198*6a54128fSAndroid Build Coastguard Worker test -z "$_G_dir" && _G_dir=. 199*6a54128fSAndroid Build Coastguard Worker for _G_prog_name in $_G_progs_list; do 200*6a54128fSAndroid Build Coastguard Worker for _exeext in '' .EXE; do 201*6a54128fSAndroid Build Coastguard Worker _G_path_prog=$_G_dir/$_G_prog_name$_exeext 202*6a54128fSAndroid Build Coastguard Worker func_executable_p "$_G_path_prog" || continue 203*6a54128fSAndroid Build Coastguard Worker case `"$_G_path_prog" --version 2>&1` in 204*6a54128fSAndroid Build Coastguard Worker *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; 205*6a54128fSAndroid Build Coastguard Worker *) $_G_check_func $_G_path_prog 206*6a54128fSAndroid Build Coastguard Worker func_path_progs_result=$func_check_prog_result 207*6a54128fSAndroid Build Coastguard Worker ;; 208*6a54128fSAndroid Build Coastguard Worker esac 209*6a54128fSAndroid Build Coastguard Worker $_G_path_prog_found && break 3 210*6a54128fSAndroid Build Coastguard Worker done 211*6a54128fSAndroid Build Coastguard Worker done 212*6a54128fSAndroid Build Coastguard Worker done 213*6a54128fSAndroid Build Coastguard Worker IFS=$_G_save_IFS 214*6a54128fSAndroid Build Coastguard Worker test -z "$func_path_progs_result" && { 215*6a54128fSAndroid Build Coastguard Worker echo "no acceptable sed could be found in \$PATH" >&2 216*6a54128fSAndroid Build Coastguard Worker exit 1 217*6a54128fSAndroid Build Coastguard Worker } 218*6a54128fSAndroid Build Coastguard Worker} 219*6a54128fSAndroid Build Coastguard Worker 220*6a54128fSAndroid Build Coastguard Worker 221*6a54128fSAndroid Build Coastguard Worker# We want to be able to use the functions in this file before configure 222*6a54128fSAndroid Build Coastguard Worker# has figured out where the best binaries are kept, which means we have 223*6a54128fSAndroid Build Coastguard Worker# to search for them ourselves - except when the results are already set 224*6a54128fSAndroid Build Coastguard Worker# where we skip the searches. 225*6a54128fSAndroid Build Coastguard Worker 226*6a54128fSAndroid Build Coastguard Worker# Unless the user overrides by setting SED, search the path for either GNU 227*6a54128fSAndroid Build Coastguard Worker# sed, or the sed that truncates its output the least. 228*6a54128fSAndroid Build Coastguard Workertest -z "$SED" && { 229*6a54128fSAndroid Build Coastguard Worker _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ 230*6a54128fSAndroid Build Coastguard Worker for _G_i in 1 2 3 4 5 6 7; do 231*6a54128fSAndroid Build Coastguard Worker _G_sed_script=$_G_sed_script$nl$_G_sed_script 232*6a54128fSAndroid Build Coastguard Worker done 233*6a54128fSAndroid Build Coastguard Worker echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed 234*6a54128fSAndroid Build Coastguard Worker _G_sed_script= 235*6a54128fSAndroid Build Coastguard Worker 236*6a54128fSAndroid Build Coastguard Worker func_check_prog_sed () 237*6a54128fSAndroid Build Coastguard Worker { 238*6a54128fSAndroid Build Coastguard Worker _G_path_prog=$1 239*6a54128fSAndroid Build Coastguard Worker 240*6a54128fSAndroid Build Coastguard Worker _G_count=0 241*6a54128fSAndroid Build Coastguard Worker printf 0123456789 >conftest.in 242*6a54128fSAndroid Build Coastguard Worker while : 243*6a54128fSAndroid Build Coastguard Worker do 244*6a54128fSAndroid Build Coastguard Worker cat conftest.in conftest.in >conftest.tmp 245*6a54128fSAndroid Build Coastguard Worker mv conftest.tmp conftest.in 246*6a54128fSAndroid Build Coastguard Worker cp conftest.in conftest.nl 247*6a54128fSAndroid Build Coastguard Worker echo '' >> conftest.nl 248*6a54128fSAndroid Build Coastguard Worker "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break 249*6a54128fSAndroid Build Coastguard Worker diff conftest.out conftest.nl >/dev/null 2>&1 || break 250*6a54128fSAndroid Build Coastguard Worker _G_count=`expr $_G_count + 1` 251*6a54128fSAndroid Build Coastguard Worker if test "$_G_count" -gt "$_G_path_prog_max"; then 252*6a54128fSAndroid Build Coastguard Worker # Best one so far, save it but keep looking for a better one 253*6a54128fSAndroid Build Coastguard Worker func_check_prog_result=$_G_path_prog 254*6a54128fSAndroid Build Coastguard Worker _G_path_prog_max=$_G_count 255*6a54128fSAndroid Build Coastguard Worker fi 256*6a54128fSAndroid Build Coastguard Worker # 10*(2^10) chars as input seems more than enough 257*6a54128fSAndroid Build Coastguard Worker test 10 -lt "$_G_count" && break 258*6a54128fSAndroid Build Coastguard Worker done 259*6a54128fSAndroid Build Coastguard Worker rm -f conftest.in conftest.tmp conftest.nl conftest.out 260*6a54128fSAndroid Build Coastguard Worker } 261*6a54128fSAndroid Build Coastguard Worker 262*6a54128fSAndroid Build Coastguard Worker func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin 263*6a54128fSAndroid Build Coastguard Worker rm -f conftest.sed 264*6a54128fSAndroid Build Coastguard Worker SED=$func_path_progs_result 265*6a54128fSAndroid Build Coastguard Worker} 266*6a54128fSAndroid Build Coastguard Worker 267*6a54128fSAndroid Build Coastguard Worker 268*6a54128fSAndroid Build Coastguard Worker# Unless the user overrides by setting GREP, search the path for either GNU 269*6a54128fSAndroid Build Coastguard Worker# grep, or the grep that truncates its output the least. 270*6a54128fSAndroid Build Coastguard Workertest -z "$GREP" && { 271*6a54128fSAndroid Build Coastguard Worker func_check_prog_grep () 272*6a54128fSAndroid Build Coastguard Worker { 273*6a54128fSAndroid Build Coastguard Worker _G_path_prog=$1 274*6a54128fSAndroid Build Coastguard Worker 275*6a54128fSAndroid Build Coastguard Worker _G_count=0 276*6a54128fSAndroid Build Coastguard Worker _G_path_prog_max=0 277*6a54128fSAndroid Build Coastguard Worker printf 0123456789 >conftest.in 278*6a54128fSAndroid Build Coastguard Worker while : 279*6a54128fSAndroid Build Coastguard Worker do 280*6a54128fSAndroid Build Coastguard Worker cat conftest.in conftest.in >conftest.tmp 281*6a54128fSAndroid Build Coastguard Worker mv conftest.tmp conftest.in 282*6a54128fSAndroid Build Coastguard Worker cp conftest.in conftest.nl 283*6a54128fSAndroid Build Coastguard Worker echo 'GREP' >> conftest.nl 284*6a54128fSAndroid Build Coastguard Worker "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break 285*6a54128fSAndroid Build Coastguard Worker diff conftest.out conftest.nl >/dev/null 2>&1 || break 286*6a54128fSAndroid Build Coastguard Worker _G_count=`expr $_G_count + 1` 287*6a54128fSAndroid Build Coastguard Worker if test "$_G_count" -gt "$_G_path_prog_max"; then 288*6a54128fSAndroid Build Coastguard Worker # Best one so far, save it but keep looking for a better one 289*6a54128fSAndroid Build Coastguard Worker func_check_prog_result=$_G_path_prog 290*6a54128fSAndroid Build Coastguard Worker _G_path_prog_max=$_G_count 291*6a54128fSAndroid Build Coastguard Worker fi 292*6a54128fSAndroid Build Coastguard Worker # 10*(2^10) chars as input seems more than enough 293*6a54128fSAndroid Build Coastguard Worker test 10 -lt "$_G_count" && break 294*6a54128fSAndroid Build Coastguard Worker done 295*6a54128fSAndroid Build Coastguard Worker rm -f conftest.in conftest.tmp conftest.nl conftest.out 296*6a54128fSAndroid Build Coastguard Worker } 297*6a54128fSAndroid Build Coastguard Worker 298*6a54128fSAndroid Build Coastguard Worker func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin 299*6a54128fSAndroid Build Coastguard Worker GREP=$func_path_progs_result 300*6a54128fSAndroid Build Coastguard Worker} 301*6a54128fSAndroid Build Coastguard Worker 302*6a54128fSAndroid Build Coastguard Worker 303*6a54128fSAndroid Build Coastguard Worker## ------------------------------- ## 304*6a54128fSAndroid Build Coastguard Worker## User overridable command paths. ## 305*6a54128fSAndroid Build Coastguard Worker## ------------------------------- ## 306*6a54128fSAndroid Build Coastguard Worker 307*6a54128fSAndroid Build Coastguard Worker# All uppercase variable names are used for environment variables. These 308*6a54128fSAndroid Build Coastguard Worker# variables can be overridden by the user before calling a script that 309*6a54128fSAndroid Build Coastguard Worker# uses them if a suitable command of that name is not already available 310*6a54128fSAndroid Build Coastguard Worker# in the command search PATH. 311*6a54128fSAndroid Build Coastguard Worker 312*6a54128fSAndroid Build Coastguard Worker: ${CP="cp -f"} 313*6a54128fSAndroid Build Coastguard Worker: ${ECHO="printf %s\n"} 314*6a54128fSAndroid Build Coastguard Worker: ${EGREP="$GREP -E"} 315*6a54128fSAndroid Build Coastguard Worker: ${FGREP="$GREP -F"} 316*6a54128fSAndroid Build Coastguard Worker: ${LN_S="ln -s"} 317*6a54128fSAndroid Build Coastguard Worker: ${MAKE="make"} 318*6a54128fSAndroid Build Coastguard Worker: ${MKDIR="mkdir"} 319*6a54128fSAndroid Build Coastguard Worker: ${MV="mv -f"} 320*6a54128fSAndroid Build Coastguard Worker: ${RM="rm -f"} 321*6a54128fSAndroid Build Coastguard Worker: ${SHELL="${CONFIG_SHELL-/bin/sh}"} 322*6a54128fSAndroid Build Coastguard Worker 323*6a54128fSAndroid Build Coastguard Worker 324*6a54128fSAndroid Build Coastguard Worker## -------------------- ## 325*6a54128fSAndroid Build Coastguard Worker## Useful sed snippets. ## 326*6a54128fSAndroid Build Coastguard Worker## -------------------- ## 327*6a54128fSAndroid Build Coastguard Worker 328*6a54128fSAndroid Build Coastguard Workersed_dirname='s|/[^/]*$||' 329*6a54128fSAndroid Build Coastguard Workersed_basename='s|^.*/||' 330*6a54128fSAndroid Build Coastguard Worker 331*6a54128fSAndroid Build Coastguard Worker# Sed substitution that helps us do robust quoting. It backslashifies 332*6a54128fSAndroid Build Coastguard Worker# metacharacters that are still active within double-quoted strings. 333*6a54128fSAndroid Build Coastguard Workersed_quote_subst='s|\([`"$\\]\)|\\\1|g' 334*6a54128fSAndroid Build Coastguard Worker 335*6a54128fSAndroid Build Coastguard Worker# Same as above, but do not quote variable references. 336*6a54128fSAndroid Build Coastguard Workersed_double_quote_subst='s/\(["`\\]\)/\\\1/g' 337*6a54128fSAndroid Build Coastguard Worker 338*6a54128fSAndroid Build Coastguard Worker# Sed substitution that turns a string into a regex matching for the 339*6a54128fSAndroid Build Coastguard Worker# string literally. 340*6a54128fSAndroid Build Coastguard Workersed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' 341*6a54128fSAndroid Build Coastguard Worker 342*6a54128fSAndroid Build Coastguard Worker# Sed substitution that converts a w32 file name or path 343*6a54128fSAndroid Build Coastguard Worker# that contains forward slashes, into one that contains 344*6a54128fSAndroid Build Coastguard Worker# (escaped) backslashes. A very naive implementation. 345*6a54128fSAndroid Build Coastguard Workersed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' 346*6a54128fSAndroid Build Coastguard Worker 347*6a54128fSAndroid Build Coastguard Worker# Re-'\' parameter expansions in output of sed_double_quote_subst that 348*6a54128fSAndroid Build Coastguard Worker# were '\'-ed in input to the same. If an odd number of '\' preceded a 349*6a54128fSAndroid Build Coastguard Worker# '$' in input to sed_double_quote_subst, that '$' was protected from 350*6a54128fSAndroid Build Coastguard Worker# expansion. Since each input '\' is now two '\'s, look for any number 351*6a54128fSAndroid Build Coastguard Worker# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. 352*6a54128fSAndroid Build Coastguard Worker_G_bs='\\' 353*6a54128fSAndroid Build Coastguard Worker_G_bs2='\\\\' 354*6a54128fSAndroid Build Coastguard Worker_G_bs4='\\\\\\\\' 355*6a54128fSAndroid Build Coastguard Worker_G_dollar='\$' 356*6a54128fSAndroid Build Coastguard Workersed_double_backslash="\ 357*6a54128fSAndroid Build Coastguard Worker s/$_G_bs4/&\\ 358*6a54128fSAndroid Build Coastguard Worker/g 359*6a54128fSAndroid Build Coastguard Worker s/^$_G_bs2$_G_dollar/$_G_bs&/ 360*6a54128fSAndroid Build Coastguard Worker s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g 361*6a54128fSAndroid Build Coastguard Worker s/\n//g" 362*6a54128fSAndroid Build Coastguard Worker 363*6a54128fSAndroid Build Coastguard Worker 364*6a54128fSAndroid Build Coastguard Worker## ----------------- ## 365*6a54128fSAndroid Build Coastguard Worker## Global variables. ## 366*6a54128fSAndroid Build Coastguard Worker## ----------------- ## 367*6a54128fSAndroid Build Coastguard Worker 368*6a54128fSAndroid Build Coastguard Worker# Except for the global variables explicitly listed below, the following 369*6a54128fSAndroid Build Coastguard Worker# functions in the '^func_' namespace, and the '^require_' namespace 370*6a54128fSAndroid Build Coastguard Worker# variables initialised in the 'Resource management' section, sourcing 371*6a54128fSAndroid Build Coastguard Worker# this file will not pollute your global namespace with anything 372*6a54128fSAndroid Build Coastguard Worker# else. There's no portable way to scope variables in Bourne shell 373*6a54128fSAndroid Build Coastguard Worker# though, so actually running these functions will sometimes place 374*6a54128fSAndroid Build Coastguard Worker# results into a variable named after the function, and often use 375*6a54128fSAndroid Build Coastguard Worker# temporary variables in the '^_G_' namespace. If you are careful to 376*6a54128fSAndroid Build Coastguard Worker# avoid using those namespaces casually in your sourcing script, things 377*6a54128fSAndroid Build Coastguard Worker# should continue to work as you expect. And, of course, you can freely 378*6a54128fSAndroid Build Coastguard Worker# overwrite any of the functions or variables defined here before 379*6a54128fSAndroid Build Coastguard Worker# calling anything to customize them. 380*6a54128fSAndroid Build Coastguard Worker 381*6a54128fSAndroid Build Coastguard WorkerEXIT_SUCCESS=0 382*6a54128fSAndroid Build Coastguard WorkerEXIT_FAILURE=1 383*6a54128fSAndroid Build Coastguard WorkerEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. 384*6a54128fSAndroid Build Coastguard WorkerEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. 385*6a54128fSAndroid Build Coastguard Worker 386*6a54128fSAndroid Build Coastguard Worker# Allow overriding, eg assuming that you follow the convention of 387*6a54128fSAndroid Build Coastguard Worker# putting '$debug_cmd' at the start of all your functions, you can get 388*6a54128fSAndroid Build Coastguard Worker# bash to show function call trace with: 389*6a54128fSAndroid Build Coastguard Worker# 390*6a54128fSAndroid Build Coastguard Worker# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name 391*6a54128fSAndroid Build Coastguard Workerdebug_cmd=${debug_cmd-":"} 392*6a54128fSAndroid Build Coastguard Workerexit_cmd=: 393*6a54128fSAndroid Build Coastguard Worker 394*6a54128fSAndroid Build Coastguard Worker# By convention, finish your script with: 395*6a54128fSAndroid Build Coastguard Worker# 396*6a54128fSAndroid Build Coastguard Worker# exit $exit_status 397*6a54128fSAndroid Build Coastguard Worker# 398*6a54128fSAndroid Build Coastguard Worker# so that you can set exit_status to non-zero if you want to indicate 399*6a54128fSAndroid Build Coastguard Worker# something went wrong during execution without actually bailing out at 400*6a54128fSAndroid Build Coastguard Worker# the point of failure. 401*6a54128fSAndroid Build Coastguard Workerexit_status=$EXIT_SUCCESS 402*6a54128fSAndroid Build Coastguard Worker 403*6a54128fSAndroid Build Coastguard Worker# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh 404*6a54128fSAndroid Build Coastguard Worker# is ksh but when the shell is invoked as "sh" and the current value of 405*6a54128fSAndroid Build Coastguard Worker# the _XPG environment variable is not equal to 1 (one), the special 406*6a54128fSAndroid Build Coastguard Worker# positional parameter $0, within a function call, is the name of the 407*6a54128fSAndroid Build Coastguard Worker# function. 408*6a54128fSAndroid Build Coastguard Workerprogpath=$0 409*6a54128fSAndroid Build Coastguard Worker 410*6a54128fSAndroid Build Coastguard Worker# The name of this program. 411*6a54128fSAndroid Build Coastguard Workerprogname=`$ECHO "$progpath" |$SED "$sed_basename"` 412*6a54128fSAndroid Build Coastguard Worker 413*6a54128fSAndroid Build Coastguard Worker# Make sure we have an absolute progpath for reexecution: 414*6a54128fSAndroid Build Coastguard Workercase $progpath in 415*6a54128fSAndroid Build Coastguard Worker [\\/]*|[A-Za-z]:\\*) ;; 416*6a54128fSAndroid Build Coastguard Worker *[\\/]*) 417*6a54128fSAndroid Build Coastguard Worker progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` 418*6a54128fSAndroid Build Coastguard Worker progdir=`cd "$progdir" && pwd` 419*6a54128fSAndroid Build Coastguard Worker progpath=$progdir/$progname 420*6a54128fSAndroid Build Coastguard Worker ;; 421*6a54128fSAndroid Build Coastguard Worker *) 422*6a54128fSAndroid Build Coastguard Worker _G_IFS=$IFS 423*6a54128fSAndroid Build Coastguard Worker IFS=${PATH_SEPARATOR-:} 424*6a54128fSAndroid Build Coastguard Worker for progdir in $PATH; do 425*6a54128fSAndroid Build Coastguard Worker IFS=$_G_IFS 426*6a54128fSAndroid Build Coastguard Worker test -x "$progdir/$progname" && break 427*6a54128fSAndroid Build Coastguard Worker done 428*6a54128fSAndroid Build Coastguard Worker IFS=$_G_IFS 429*6a54128fSAndroid Build Coastguard Worker test -n "$progdir" || progdir=`pwd` 430*6a54128fSAndroid Build Coastguard Worker progpath=$progdir/$progname 431*6a54128fSAndroid Build Coastguard Worker ;; 432*6a54128fSAndroid Build Coastguard Workeresac 433*6a54128fSAndroid Build Coastguard Worker 434*6a54128fSAndroid Build Coastguard Worker 435*6a54128fSAndroid Build Coastguard Worker## ----------------- ## 436*6a54128fSAndroid Build Coastguard Worker## Standard options. ## 437*6a54128fSAndroid Build Coastguard Worker## ----------------- ## 438*6a54128fSAndroid Build Coastguard Worker 439*6a54128fSAndroid Build Coastguard Worker# The following options affect the operation of the functions defined 440*6a54128fSAndroid Build Coastguard Worker# below, and should be set appropriately depending on run-time para- 441*6a54128fSAndroid Build Coastguard Worker# meters passed on the command line. 442*6a54128fSAndroid Build Coastguard Worker 443*6a54128fSAndroid Build Coastguard Workeropt_dry_run=false 444*6a54128fSAndroid Build Coastguard Workeropt_quiet=false 445*6a54128fSAndroid Build Coastguard Workeropt_verbose=false 446*6a54128fSAndroid Build Coastguard Worker 447*6a54128fSAndroid Build Coastguard Worker# Categories 'all' and 'none' are always available. Append any others 448*6a54128fSAndroid Build Coastguard Worker# you will pass as the first argument to func_warning from your own 449*6a54128fSAndroid Build Coastguard Worker# code. 450*6a54128fSAndroid Build Coastguard Workerwarning_categories= 451*6a54128fSAndroid Build Coastguard Worker 452*6a54128fSAndroid Build Coastguard Worker# By default, display warnings according to 'opt_warning_types'. Set 453*6a54128fSAndroid Build Coastguard Worker# 'warning_func' to ':' to elide all warnings, or func_fatal_error to 454*6a54128fSAndroid Build Coastguard Worker# treat the next displayed warning as a fatal error. 455*6a54128fSAndroid Build Coastguard Workerwarning_func=func_warn_and_continue 456*6a54128fSAndroid Build Coastguard Worker 457*6a54128fSAndroid Build Coastguard Worker# Set to 'all' to display all warnings, 'none' to suppress all 458*6a54128fSAndroid Build Coastguard Worker# warnings, or a space delimited list of some subset of 459*6a54128fSAndroid Build Coastguard Worker# 'warning_categories' to display only the listed warnings. 460*6a54128fSAndroid Build Coastguard Workeropt_warning_types=all 461*6a54128fSAndroid Build Coastguard Worker 462*6a54128fSAndroid Build Coastguard Worker 463*6a54128fSAndroid Build Coastguard Worker## -------------------- ## 464*6a54128fSAndroid Build Coastguard Worker## Resource management. ## 465*6a54128fSAndroid Build Coastguard Worker## -------------------- ## 466*6a54128fSAndroid Build Coastguard Worker 467*6a54128fSAndroid Build Coastguard Worker# This section contains definitions for functions that each ensure a 468*6a54128fSAndroid Build Coastguard Worker# particular resource (a file, or a non-empty configuration variable for 469*6a54128fSAndroid Build Coastguard Worker# example) is available, and if appropriate to extract default values 470*6a54128fSAndroid Build Coastguard Worker# from pertinent package files. Call them using their associated 471*6a54128fSAndroid Build Coastguard Worker# 'require_*' variable to ensure that they are executed, at most, once. 472*6a54128fSAndroid Build Coastguard Worker# 473*6a54128fSAndroid Build Coastguard Worker# It's entirely deliberate that calling these functions can set 474*6a54128fSAndroid Build Coastguard Worker# variables that don't obey the namespace limitations obeyed by the rest 475*6a54128fSAndroid Build Coastguard Worker# of this file, in order that that they be as useful as possible to 476*6a54128fSAndroid Build Coastguard Worker# callers. 477*6a54128fSAndroid Build Coastguard Worker 478*6a54128fSAndroid Build Coastguard Worker 479*6a54128fSAndroid Build Coastguard Worker# require_term_colors 480*6a54128fSAndroid Build Coastguard Worker# ------------------- 481*6a54128fSAndroid Build Coastguard Worker# Allow display of bold text on terminals that support it. 482*6a54128fSAndroid Build Coastguard Workerrequire_term_colors=func_require_term_colors 483*6a54128fSAndroid Build Coastguard Workerfunc_require_term_colors () 484*6a54128fSAndroid Build Coastguard Worker{ 485*6a54128fSAndroid Build Coastguard Worker $debug_cmd 486*6a54128fSAndroid Build Coastguard Worker 487*6a54128fSAndroid Build Coastguard Worker test -t 1 && { 488*6a54128fSAndroid Build Coastguard Worker # COLORTERM and USE_ANSI_COLORS environment variables take 489*6a54128fSAndroid Build Coastguard Worker # precedence, because most terminfo databases neglect to describe 490*6a54128fSAndroid Build Coastguard Worker # whether color sequences are supported. 491*6a54128fSAndroid Build Coastguard Worker test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} 492*6a54128fSAndroid Build Coastguard Worker 493*6a54128fSAndroid Build Coastguard Worker if test 1 = "$USE_ANSI_COLORS"; then 494*6a54128fSAndroid Build Coastguard Worker # Standard ANSI escape sequences 495*6a54128fSAndroid Build Coastguard Worker tc_reset='[0m' 496*6a54128fSAndroid Build Coastguard Worker tc_bold='[1m'; tc_standout='[7m' 497*6a54128fSAndroid Build Coastguard Worker tc_red='[31m'; tc_green='[32m' 498*6a54128fSAndroid Build Coastguard Worker tc_blue='[34m'; tc_cyan='[36m' 499*6a54128fSAndroid Build Coastguard Worker else 500*6a54128fSAndroid Build Coastguard Worker # Otherwise trust the terminfo database after all. 501*6a54128fSAndroid Build Coastguard Worker test -n "`tput sgr0 2>/dev/null`" && { 502*6a54128fSAndroid Build Coastguard Worker tc_reset=`tput sgr0` 503*6a54128fSAndroid Build Coastguard Worker test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` 504*6a54128fSAndroid Build Coastguard Worker tc_standout=$tc_bold 505*6a54128fSAndroid Build Coastguard Worker test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` 506*6a54128fSAndroid Build Coastguard Worker test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` 507*6a54128fSAndroid Build Coastguard Worker test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` 508*6a54128fSAndroid Build Coastguard Worker test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` 509*6a54128fSAndroid Build Coastguard Worker test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` 510*6a54128fSAndroid Build Coastguard Worker } 511*6a54128fSAndroid Build Coastguard Worker fi 512*6a54128fSAndroid Build Coastguard Worker } 513*6a54128fSAndroid Build Coastguard Worker 514*6a54128fSAndroid Build Coastguard Worker require_term_colors=: 515*6a54128fSAndroid Build Coastguard Worker} 516*6a54128fSAndroid Build Coastguard Worker 517*6a54128fSAndroid Build Coastguard Worker 518*6a54128fSAndroid Build Coastguard Worker## ----------------- ## 519*6a54128fSAndroid Build Coastguard Worker## Function library. ## 520*6a54128fSAndroid Build Coastguard Worker## ----------------- ## 521*6a54128fSAndroid Build Coastguard Worker 522*6a54128fSAndroid Build Coastguard Worker# This section contains a variety of useful functions to call in your 523*6a54128fSAndroid Build Coastguard Worker# scripts. Take note of the portable wrappers for features provided by 524*6a54128fSAndroid Build Coastguard Worker# some modern shells, which will fall back to slower equivalents on 525*6a54128fSAndroid Build Coastguard Worker# less featureful shells. 526*6a54128fSAndroid Build Coastguard Worker 527*6a54128fSAndroid Build Coastguard Worker 528*6a54128fSAndroid Build Coastguard Worker# func_append VAR VALUE 529*6a54128fSAndroid Build Coastguard Worker# --------------------- 530*6a54128fSAndroid Build Coastguard Worker# Append VALUE onto the existing contents of VAR. 531*6a54128fSAndroid Build Coastguard Worker 532*6a54128fSAndroid Build Coastguard Worker # We should try to minimise forks, especially on Windows where they are 533*6a54128fSAndroid Build Coastguard Worker # unreasonably slow, so skip the feature probes when bash or zsh are 534*6a54128fSAndroid Build Coastguard Worker # being used: 535*6a54128fSAndroid Build Coastguard Worker if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then 536*6a54128fSAndroid Build Coastguard Worker : ${_G_HAVE_ARITH_OP="yes"} 537*6a54128fSAndroid Build Coastguard Worker : ${_G_HAVE_XSI_OPS="yes"} 538*6a54128fSAndroid Build Coastguard Worker # The += operator was introduced in bash 3.1 539*6a54128fSAndroid Build Coastguard Worker case $BASH_VERSION in 540*6a54128fSAndroid Build Coastguard Worker [12].* | 3.0 | 3.0*) ;; 541*6a54128fSAndroid Build Coastguard Worker *) 542*6a54128fSAndroid Build Coastguard Worker : ${_G_HAVE_PLUSEQ_OP="yes"} 543*6a54128fSAndroid Build Coastguard Worker ;; 544*6a54128fSAndroid Build Coastguard Worker esac 545*6a54128fSAndroid Build Coastguard Worker fi 546*6a54128fSAndroid Build Coastguard Worker 547*6a54128fSAndroid Build Coastguard Worker # _G_HAVE_PLUSEQ_OP 548*6a54128fSAndroid Build Coastguard Worker # Can be empty, in which case the shell is probed, "yes" if += is 549*6a54128fSAndroid Build Coastguard Worker # useable or anything else if it does not work. 550*6a54128fSAndroid Build Coastguard Worker test -z "$_G_HAVE_PLUSEQ_OP" \ 551*6a54128fSAndroid Build Coastguard Worker && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ 552*6a54128fSAndroid Build Coastguard Worker && _G_HAVE_PLUSEQ_OP=yes 553*6a54128fSAndroid Build Coastguard Worker 554*6a54128fSAndroid Build Coastguard Workerif test yes = "$_G_HAVE_PLUSEQ_OP" 555*6a54128fSAndroid Build Coastguard Workerthen 556*6a54128fSAndroid Build Coastguard Worker # This is an XSI compatible shell, allowing a faster implementation... 557*6a54128fSAndroid Build Coastguard Worker eval 'func_append () 558*6a54128fSAndroid Build Coastguard Worker { 559*6a54128fSAndroid Build Coastguard Worker $debug_cmd 560*6a54128fSAndroid Build Coastguard Worker 561*6a54128fSAndroid Build Coastguard Worker eval "$1+=\$2" 562*6a54128fSAndroid Build Coastguard Worker }' 563*6a54128fSAndroid Build Coastguard Workerelse 564*6a54128fSAndroid Build Coastguard Worker # ...otherwise fall back to using expr, which is often a shell builtin. 565*6a54128fSAndroid Build Coastguard Worker func_append () 566*6a54128fSAndroid Build Coastguard Worker { 567*6a54128fSAndroid Build Coastguard Worker $debug_cmd 568*6a54128fSAndroid Build Coastguard Worker 569*6a54128fSAndroid Build Coastguard Worker eval "$1=\$$1\$2" 570*6a54128fSAndroid Build Coastguard Worker } 571*6a54128fSAndroid Build Coastguard Workerfi 572*6a54128fSAndroid Build Coastguard Worker 573*6a54128fSAndroid Build Coastguard Worker 574*6a54128fSAndroid Build Coastguard Worker# func_append_quoted VAR VALUE 575*6a54128fSAndroid Build Coastguard Worker# ---------------------------- 576*6a54128fSAndroid Build Coastguard Worker# Quote VALUE and append to the end of shell variable VAR, separated 577*6a54128fSAndroid Build Coastguard Worker# by a space. 578*6a54128fSAndroid Build Coastguard Workerif test yes = "$_G_HAVE_PLUSEQ_OP"; then 579*6a54128fSAndroid Build Coastguard Worker eval 'func_append_quoted () 580*6a54128fSAndroid Build Coastguard Worker { 581*6a54128fSAndroid Build Coastguard Worker $debug_cmd 582*6a54128fSAndroid Build Coastguard Worker 583*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$2" 584*6a54128fSAndroid Build Coastguard Worker eval "$1+=\\ \$func_quote_for_eval_result" 585*6a54128fSAndroid Build Coastguard Worker }' 586*6a54128fSAndroid Build Coastguard Workerelse 587*6a54128fSAndroid Build Coastguard Worker func_append_quoted () 588*6a54128fSAndroid Build Coastguard Worker { 589*6a54128fSAndroid Build Coastguard Worker $debug_cmd 590*6a54128fSAndroid Build Coastguard Worker 591*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$2" 592*6a54128fSAndroid Build Coastguard Worker eval "$1=\$$1\\ \$func_quote_for_eval_result" 593*6a54128fSAndroid Build Coastguard Worker } 594*6a54128fSAndroid Build Coastguard Workerfi 595*6a54128fSAndroid Build Coastguard Worker 596*6a54128fSAndroid Build Coastguard Worker 597*6a54128fSAndroid Build Coastguard Worker# func_append_uniq VAR VALUE 598*6a54128fSAndroid Build Coastguard Worker# -------------------------- 599*6a54128fSAndroid Build Coastguard Worker# Append unique VALUE onto the existing contents of VAR, assuming 600*6a54128fSAndroid Build Coastguard Worker# entries are delimited by the first character of VALUE. For example: 601*6a54128fSAndroid Build Coastguard Worker# 602*6a54128fSAndroid Build Coastguard Worker# func_append_uniq options " --another-option option-argument" 603*6a54128fSAndroid Build Coastguard Worker# 604*6a54128fSAndroid Build Coastguard Worker# will only append to $options if " --another-option option-argument " 605*6a54128fSAndroid Build Coastguard Worker# is not already present somewhere in $options already (note spaces at 606*6a54128fSAndroid Build Coastguard Worker# each end implied by leading space in second argument). 607*6a54128fSAndroid Build Coastguard Workerfunc_append_uniq () 608*6a54128fSAndroid Build Coastguard Worker{ 609*6a54128fSAndroid Build Coastguard Worker $debug_cmd 610*6a54128fSAndroid Build Coastguard Worker 611*6a54128fSAndroid Build Coastguard Worker eval _G_current_value='`$ECHO $'$1'`' 612*6a54128fSAndroid Build Coastguard Worker _G_delim=`expr "$2" : '\(.\)'` 613*6a54128fSAndroid Build Coastguard Worker 614*6a54128fSAndroid Build Coastguard Worker case $_G_delim$_G_current_value$_G_delim in 615*6a54128fSAndroid Build Coastguard Worker *"$2$_G_delim"*) ;; 616*6a54128fSAndroid Build Coastguard Worker *) func_append "$@" ;; 617*6a54128fSAndroid Build Coastguard Worker esac 618*6a54128fSAndroid Build Coastguard Worker} 619*6a54128fSAndroid Build Coastguard Worker 620*6a54128fSAndroid Build Coastguard Worker 621*6a54128fSAndroid Build Coastguard Worker# func_arith TERM... 622*6a54128fSAndroid Build Coastguard Worker# ------------------ 623*6a54128fSAndroid Build Coastguard Worker# Set func_arith_result to the result of evaluating TERMs. 624*6a54128fSAndroid Build Coastguard Worker test -z "$_G_HAVE_ARITH_OP" \ 625*6a54128fSAndroid Build Coastguard Worker && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ 626*6a54128fSAndroid Build Coastguard Worker && _G_HAVE_ARITH_OP=yes 627*6a54128fSAndroid Build Coastguard Worker 628*6a54128fSAndroid Build Coastguard Workerif test yes = "$_G_HAVE_ARITH_OP"; then 629*6a54128fSAndroid Build Coastguard Worker eval 'func_arith () 630*6a54128fSAndroid Build Coastguard Worker { 631*6a54128fSAndroid Build Coastguard Worker $debug_cmd 632*6a54128fSAndroid Build Coastguard Worker 633*6a54128fSAndroid Build Coastguard Worker func_arith_result=$(( $* )) 634*6a54128fSAndroid Build Coastguard Worker }' 635*6a54128fSAndroid Build Coastguard Workerelse 636*6a54128fSAndroid Build Coastguard Worker func_arith () 637*6a54128fSAndroid Build Coastguard Worker { 638*6a54128fSAndroid Build Coastguard Worker $debug_cmd 639*6a54128fSAndroid Build Coastguard Worker 640*6a54128fSAndroid Build Coastguard Worker func_arith_result=`expr "$@"` 641*6a54128fSAndroid Build Coastguard Worker } 642*6a54128fSAndroid Build Coastguard Workerfi 643*6a54128fSAndroid Build Coastguard Worker 644*6a54128fSAndroid Build Coastguard Worker 645*6a54128fSAndroid Build Coastguard Worker# func_basename FILE 646*6a54128fSAndroid Build Coastguard Worker# ------------------ 647*6a54128fSAndroid Build Coastguard Worker# Set func_basename_result to FILE with everything up to and including 648*6a54128fSAndroid Build Coastguard Worker# the last / stripped. 649*6a54128fSAndroid Build Coastguard Workerif test yes = "$_G_HAVE_XSI_OPS"; then 650*6a54128fSAndroid Build Coastguard Worker # If this shell supports suffix pattern removal, then use it to avoid 651*6a54128fSAndroid Build Coastguard Worker # forking. Hide the definitions single quotes in case the shell chokes 652*6a54128fSAndroid Build Coastguard Worker # on unsupported syntax... 653*6a54128fSAndroid Build Coastguard Worker _b='func_basename_result=${1##*/}' 654*6a54128fSAndroid Build Coastguard Worker _d='case $1 in 655*6a54128fSAndroid Build Coastguard Worker */*) func_dirname_result=${1%/*}$2 ;; 656*6a54128fSAndroid Build Coastguard Worker * ) func_dirname_result=$3 ;; 657*6a54128fSAndroid Build Coastguard Worker esac' 658*6a54128fSAndroid Build Coastguard Worker 659*6a54128fSAndroid Build Coastguard Workerelse 660*6a54128fSAndroid Build Coastguard Worker # ...otherwise fall back to using sed. 661*6a54128fSAndroid Build Coastguard Worker _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' 662*6a54128fSAndroid Build Coastguard Worker _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` 663*6a54128fSAndroid Build Coastguard Worker if test "X$func_dirname_result" = "X$1"; then 664*6a54128fSAndroid Build Coastguard Worker func_dirname_result=$3 665*6a54128fSAndroid Build Coastguard Worker else 666*6a54128fSAndroid Build Coastguard Worker func_append func_dirname_result "$2" 667*6a54128fSAndroid Build Coastguard Worker fi' 668*6a54128fSAndroid Build Coastguard Workerfi 669*6a54128fSAndroid Build Coastguard Worker 670*6a54128fSAndroid Build Coastguard Workereval 'func_basename () 671*6a54128fSAndroid Build Coastguard Worker{ 672*6a54128fSAndroid Build Coastguard Worker $debug_cmd 673*6a54128fSAndroid Build Coastguard Worker 674*6a54128fSAndroid Build Coastguard Worker '"$_b"' 675*6a54128fSAndroid Build Coastguard Worker}' 676*6a54128fSAndroid Build Coastguard Worker 677*6a54128fSAndroid Build Coastguard Worker 678*6a54128fSAndroid Build Coastguard Worker# func_dirname FILE APPEND NONDIR_REPLACEMENT 679*6a54128fSAndroid Build Coastguard Worker# ------------------------------------------- 680*6a54128fSAndroid Build Coastguard Worker# Compute the dirname of FILE. If nonempty, add APPEND to the result, 681*6a54128fSAndroid Build Coastguard Worker# otherwise set result to NONDIR_REPLACEMENT. 682*6a54128fSAndroid Build Coastguard Workereval 'func_dirname () 683*6a54128fSAndroid Build Coastguard Worker{ 684*6a54128fSAndroid Build Coastguard Worker $debug_cmd 685*6a54128fSAndroid Build Coastguard Worker 686*6a54128fSAndroid Build Coastguard Worker '"$_d"' 687*6a54128fSAndroid Build Coastguard Worker}' 688*6a54128fSAndroid Build Coastguard Worker 689*6a54128fSAndroid Build Coastguard Worker 690*6a54128fSAndroid Build Coastguard Worker# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT 691*6a54128fSAndroid Build Coastguard Worker# -------------------------------------------------------- 692*6a54128fSAndroid Build Coastguard Worker# Perform func_basename and func_dirname in a single function 693*6a54128fSAndroid Build Coastguard Worker# call: 694*6a54128fSAndroid Build Coastguard Worker# dirname: Compute the dirname of FILE. If nonempty, 695*6a54128fSAndroid Build Coastguard Worker# add APPEND to the result, otherwise set result 696*6a54128fSAndroid Build Coastguard Worker# to NONDIR_REPLACEMENT. 697*6a54128fSAndroid Build Coastguard Worker# value returned in "$func_dirname_result" 698*6a54128fSAndroid Build Coastguard Worker# basename: Compute filename of FILE. 699*6a54128fSAndroid Build Coastguard Worker# value retuned in "$func_basename_result" 700*6a54128fSAndroid Build Coastguard Worker# For efficiency, we do not delegate to the functions above but instead 701*6a54128fSAndroid Build Coastguard Worker# duplicate the functionality here. 702*6a54128fSAndroid Build Coastguard Workereval 'func_dirname_and_basename () 703*6a54128fSAndroid Build Coastguard Worker{ 704*6a54128fSAndroid Build Coastguard Worker $debug_cmd 705*6a54128fSAndroid Build Coastguard Worker 706*6a54128fSAndroid Build Coastguard Worker '"$_b"' 707*6a54128fSAndroid Build Coastguard Worker '"$_d"' 708*6a54128fSAndroid Build Coastguard Worker}' 709*6a54128fSAndroid Build Coastguard Worker 710*6a54128fSAndroid Build Coastguard Worker 711*6a54128fSAndroid Build Coastguard Worker# func_echo ARG... 712*6a54128fSAndroid Build Coastguard Worker# ---------------- 713*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed message. 714*6a54128fSAndroid Build Coastguard Workerfunc_echo () 715*6a54128fSAndroid Build Coastguard Worker{ 716*6a54128fSAndroid Build Coastguard Worker $debug_cmd 717*6a54128fSAndroid Build Coastguard Worker 718*6a54128fSAndroid Build Coastguard Worker _G_message=$* 719*6a54128fSAndroid Build Coastguard Worker 720*6a54128fSAndroid Build Coastguard Worker func_echo_IFS=$IFS 721*6a54128fSAndroid Build Coastguard Worker IFS=$nl 722*6a54128fSAndroid Build Coastguard Worker for _G_line in $_G_message; do 723*6a54128fSAndroid Build Coastguard Worker IFS=$func_echo_IFS 724*6a54128fSAndroid Build Coastguard Worker $ECHO "$progname: $_G_line" 725*6a54128fSAndroid Build Coastguard Worker done 726*6a54128fSAndroid Build Coastguard Worker IFS=$func_echo_IFS 727*6a54128fSAndroid Build Coastguard Worker} 728*6a54128fSAndroid Build Coastguard Worker 729*6a54128fSAndroid Build Coastguard Worker 730*6a54128fSAndroid Build Coastguard Worker# func_echo_all ARG... 731*6a54128fSAndroid Build Coastguard Worker# -------------------- 732*6a54128fSAndroid Build Coastguard Worker# Invoke $ECHO with all args, space-separated. 733*6a54128fSAndroid Build Coastguard Workerfunc_echo_all () 734*6a54128fSAndroid Build Coastguard Worker{ 735*6a54128fSAndroid Build Coastguard Worker $ECHO "$*" 736*6a54128fSAndroid Build Coastguard Worker} 737*6a54128fSAndroid Build Coastguard Worker 738*6a54128fSAndroid Build Coastguard Worker 739*6a54128fSAndroid Build Coastguard Worker# func_echo_infix_1 INFIX ARG... 740*6a54128fSAndroid Build Coastguard Worker# ------------------------------ 741*6a54128fSAndroid Build Coastguard Worker# Echo program name, followed by INFIX on the first line, with any 742*6a54128fSAndroid Build Coastguard Worker# additional lines not showing INFIX. 743*6a54128fSAndroid Build Coastguard Workerfunc_echo_infix_1 () 744*6a54128fSAndroid Build Coastguard Worker{ 745*6a54128fSAndroid Build Coastguard Worker $debug_cmd 746*6a54128fSAndroid Build Coastguard Worker 747*6a54128fSAndroid Build Coastguard Worker $require_term_colors 748*6a54128fSAndroid Build Coastguard Worker 749*6a54128fSAndroid Build Coastguard Worker _G_infix=$1; shift 750*6a54128fSAndroid Build Coastguard Worker _G_indent=$_G_infix 751*6a54128fSAndroid Build Coastguard Worker _G_prefix="$progname: $_G_infix: " 752*6a54128fSAndroid Build Coastguard Worker _G_message=$* 753*6a54128fSAndroid Build Coastguard Worker 754*6a54128fSAndroid Build Coastguard Worker # Strip color escape sequences before counting printable length 755*6a54128fSAndroid Build Coastguard Worker for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" 756*6a54128fSAndroid Build Coastguard Worker do 757*6a54128fSAndroid Build Coastguard Worker test -n "$_G_tc" && { 758*6a54128fSAndroid Build Coastguard Worker _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` 759*6a54128fSAndroid Build Coastguard Worker _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` 760*6a54128fSAndroid Build Coastguard Worker } 761*6a54128fSAndroid Build Coastguard Worker done 762*6a54128fSAndroid Build Coastguard Worker _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes 763*6a54128fSAndroid Build Coastguard Worker 764*6a54128fSAndroid Build Coastguard Worker func_echo_infix_1_IFS=$IFS 765*6a54128fSAndroid Build Coastguard Worker IFS=$nl 766*6a54128fSAndroid Build Coastguard Worker for _G_line in $_G_message; do 767*6a54128fSAndroid Build Coastguard Worker IFS=$func_echo_infix_1_IFS 768*6a54128fSAndroid Build Coastguard Worker $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 769*6a54128fSAndroid Build Coastguard Worker _G_prefix=$_G_indent 770*6a54128fSAndroid Build Coastguard Worker done 771*6a54128fSAndroid Build Coastguard Worker IFS=$func_echo_infix_1_IFS 772*6a54128fSAndroid Build Coastguard Worker} 773*6a54128fSAndroid Build Coastguard Worker 774*6a54128fSAndroid Build Coastguard Worker 775*6a54128fSAndroid Build Coastguard Worker# func_error ARG... 776*6a54128fSAndroid Build Coastguard Worker# ----------------- 777*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed message to standard error. 778*6a54128fSAndroid Build Coastguard Workerfunc_error () 779*6a54128fSAndroid Build Coastguard Worker{ 780*6a54128fSAndroid Build Coastguard Worker $debug_cmd 781*6a54128fSAndroid Build Coastguard Worker 782*6a54128fSAndroid Build Coastguard Worker $require_term_colors 783*6a54128fSAndroid Build Coastguard Worker 784*6a54128fSAndroid Build Coastguard Worker func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 785*6a54128fSAndroid Build Coastguard Worker} 786*6a54128fSAndroid Build Coastguard Worker 787*6a54128fSAndroid Build Coastguard Worker 788*6a54128fSAndroid Build Coastguard Worker# func_fatal_error ARG... 789*6a54128fSAndroid Build Coastguard Worker# ----------------------- 790*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed message to standard error, and exit. 791*6a54128fSAndroid Build Coastguard Workerfunc_fatal_error () 792*6a54128fSAndroid Build Coastguard Worker{ 793*6a54128fSAndroid Build Coastguard Worker $debug_cmd 794*6a54128fSAndroid Build Coastguard Worker 795*6a54128fSAndroid Build Coastguard Worker func_error "$*" 796*6a54128fSAndroid Build Coastguard Worker exit $EXIT_FAILURE 797*6a54128fSAndroid Build Coastguard Worker} 798*6a54128fSAndroid Build Coastguard Worker 799*6a54128fSAndroid Build Coastguard Worker 800*6a54128fSAndroid Build Coastguard Worker# func_grep EXPRESSION FILENAME 801*6a54128fSAndroid Build Coastguard Worker# ----------------------------- 802*6a54128fSAndroid Build Coastguard Worker# Check whether EXPRESSION matches any line of FILENAME, without output. 803*6a54128fSAndroid Build Coastguard Workerfunc_grep () 804*6a54128fSAndroid Build Coastguard Worker{ 805*6a54128fSAndroid Build Coastguard Worker $debug_cmd 806*6a54128fSAndroid Build Coastguard Worker 807*6a54128fSAndroid Build Coastguard Worker $GREP "$1" "$2" >/dev/null 2>&1 808*6a54128fSAndroid Build Coastguard Worker} 809*6a54128fSAndroid Build Coastguard Worker 810*6a54128fSAndroid Build Coastguard Worker 811*6a54128fSAndroid Build Coastguard Worker# func_len STRING 812*6a54128fSAndroid Build Coastguard Worker# --------------- 813*6a54128fSAndroid Build Coastguard Worker# Set func_len_result to the length of STRING. STRING may not 814*6a54128fSAndroid Build Coastguard Worker# start with a hyphen. 815*6a54128fSAndroid Build Coastguard Worker test -z "$_G_HAVE_XSI_OPS" \ 816*6a54128fSAndroid Build Coastguard Worker && (eval 'x=a/b/c; 817*6a54128fSAndroid Build Coastguard Worker test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ 818*6a54128fSAndroid Build Coastguard Worker && _G_HAVE_XSI_OPS=yes 819*6a54128fSAndroid Build Coastguard Worker 820*6a54128fSAndroid Build Coastguard Workerif test yes = "$_G_HAVE_XSI_OPS"; then 821*6a54128fSAndroid Build Coastguard Worker eval 'func_len () 822*6a54128fSAndroid Build Coastguard Worker { 823*6a54128fSAndroid Build Coastguard Worker $debug_cmd 824*6a54128fSAndroid Build Coastguard Worker 825*6a54128fSAndroid Build Coastguard Worker func_len_result=${#1} 826*6a54128fSAndroid Build Coastguard Worker }' 827*6a54128fSAndroid Build Coastguard Workerelse 828*6a54128fSAndroid Build Coastguard Worker func_len () 829*6a54128fSAndroid Build Coastguard Worker { 830*6a54128fSAndroid Build Coastguard Worker $debug_cmd 831*6a54128fSAndroid Build Coastguard Worker 832*6a54128fSAndroid Build Coastguard Worker func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` 833*6a54128fSAndroid Build Coastguard Worker } 834*6a54128fSAndroid Build Coastguard Workerfi 835*6a54128fSAndroid Build Coastguard Worker 836*6a54128fSAndroid Build Coastguard Worker 837*6a54128fSAndroid Build Coastguard Worker# func_mkdir_p DIRECTORY-PATH 838*6a54128fSAndroid Build Coastguard Worker# --------------------------- 839*6a54128fSAndroid Build Coastguard Worker# Make sure the entire path to DIRECTORY-PATH is available. 840*6a54128fSAndroid Build Coastguard Workerfunc_mkdir_p () 841*6a54128fSAndroid Build Coastguard Worker{ 842*6a54128fSAndroid Build Coastguard Worker $debug_cmd 843*6a54128fSAndroid Build Coastguard Worker 844*6a54128fSAndroid Build Coastguard Worker _G_directory_path=$1 845*6a54128fSAndroid Build Coastguard Worker _G_dir_list= 846*6a54128fSAndroid Build Coastguard Worker 847*6a54128fSAndroid Build Coastguard Worker if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then 848*6a54128fSAndroid Build Coastguard Worker 849*6a54128fSAndroid Build Coastguard Worker # Protect directory names starting with '-' 850*6a54128fSAndroid Build Coastguard Worker case $_G_directory_path in 851*6a54128fSAndroid Build Coastguard Worker -*) _G_directory_path=./$_G_directory_path ;; 852*6a54128fSAndroid Build Coastguard Worker esac 853*6a54128fSAndroid Build Coastguard Worker 854*6a54128fSAndroid Build Coastguard Worker # While some portion of DIR does not yet exist... 855*6a54128fSAndroid Build Coastguard Worker while test ! -d "$_G_directory_path"; do 856*6a54128fSAndroid Build Coastguard Worker # ...make a list in topmost first order. Use a colon delimited 857*6a54128fSAndroid Build Coastguard Worker # list incase some portion of path contains whitespace. 858*6a54128fSAndroid Build Coastguard Worker _G_dir_list=$_G_directory_path:$_G_dir_list 859*6a54128fSAndroid Build Coastguard Worker 860*6a54128fSAndroid Build Coastguard Worker # If the last portion added has no slash in it, the list is done 861*6a54128fSAndroid Build Coastguard Worker case $_G_directory_path in */*) ;; *) break ;; esac 862*6a54128fSAndroid Build Coastguard Worker 863*6a54128fSAndroid Build Coastguard Worker # ...otherwise throw away the child directory and loop 864*6a54128fSAndroid Build Coastguard Worker _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` 865*6a54128fSAndroid Build Coastguard Worker done 866*6a54128fSAndroid Build Coastguard Worker _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` 867*6a54128fSAndroid Build Coastguard Worker 868*6a54128fSAndroid Build Coastguard Worker func_mkdir_p_IFS=$IFS; IFS=: 869*6a54128fSAndroid Build Coastguard Worker for _G_dir in $_G_dir_list; do 870*6a54128fSAndroid Build Coastguard Worker IFS=$func_mkdir_p_IFS 871*6a54128fSAndroid Build Coastguard Worker # mkdir can fail with a 'File exist' error if two processes 872*6a54128fSAndroid Build Coastguard Worker # try to create one of the directories concurrently. Don't 873*6a54128fSAndroid Build Coastguard Worker # stop in that case! 874*6a54128fSAndroid Build Coastguard Worker $MKDIR "$_G_dir" 2>/dev/null || : 875*6a54128fSAndroid Build Coastguard Worker done 876*6a54128fSAndroid Build Coastguard Worker IFS=$func_mkdir_p_IFS 877*6a54128fSAndroid Build Coastguard Worker 878*6a54128fSAndroid Build Coastguard Worker # Bail out if we (or some other process) failed to create a directory. 879*6a54128fSAndroid Build Coastguard Worker test -d "$_G_directory_path" || \ 880*6a54128fSAndroid Build Coastguard Worker func_fatal_error "Failed to create '$1'" 881*6a54128fSAndroid Build Coastguard Worker fi 882*6a54128fSAndroid Build Coastguard Worker} 883*6a54128fSAndroid Build Coastguard Worker 884*6a54128fSAndroid Build Coastguard Worker 885*6a54128fSAndroid Build Coastguard Worker# func_mktempdir [BASENAME] 886*6a54128fSAndroid Build Coastguard Worker# ------------------------- 887*6a54128fSAndroid Build Coastguard Worker# Make a temporary directory that won't clash with other running 888*6a54128fSAndroid Build Coastguard Worker# libtool processes, and avoids race conditions if possible. If 889*6a54128fSAndroid Build Coastguard Worker# given, BASENAME is the basename for that directory. 890*6a54128fSAndroid Build Coastguard Workerfunc_mktempdir () 891*6a54128fSAndroid Build Coastguard Worker{ 892*6a54128fSAndroid Build Coastguard Worker $debug_cmd 893*6a54128fSAndroid Build Coastguard Worker 894*6a54128fSAndroid Build Coastguard Worker _G_template=${TMPDIR-/tmp}/${1-$progname} 895*6a54128fSAndroid Build Coastguard Worker 896*6a54128fSAndroid Build Coastguard Worker if test : = "$opt_dry_run"; then 897*6a54128fSAndroid Build Coastguard Worker # Return a directory name, but don't create it in dry-run mode 898*6a54128fSAndroid Build Coastguard Worker _G_tmpdir=$_G_template-$$ 899*6a54128fSAndroid Build Coastguard Worker else 900*6a54128fSAndroid Build Coastguard Worker 901*6a54128fSAndroid Build Coastguard Worker # If mktemp works, use that first and foremost 902*6a54128fSAndroid Build Coastguard Worker _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` 903*6a54128fSAndroid Build Coastguard Worker 904*6a54128fSAndroid Build Coastguard Worker if test ! -d "$_G_tmpdir"; then 905*6a54128fSAndroid Build Coastguard Worker # Failing that, at least try and use $RANDOM to avoid a race 906*6a54128fSAndroid Build Coastguard Worker _G_tmpdir=$_G_template-${RANDOM-0}$$ 907*6a54128fSAndroid Build Coastguard Worker 908*6a54128fSAndroid Build Coastguard Worker func_mktempdir_umask=`umask` 909*6a54128fSAndroid Build Coastguard Worker umask 0077 910*6a54128fSAndroid Build Coastguard Worker $MKDIR "$_G_tmpdir" 911*6a54128fSAndroid Build Coastguard Worker umask $func_mktempdir_umask 912*6a54128fSAndroid Build Coastguard Worker fi 913*6a54128fSAndroid Build Coastguard Worker 914*6a54128fSAndroid Build Coastguard Worker # If we're not in dry-run mode, bomb out on failure 915*6a54128fSAndroid Build Coastguard Worker test -d "$_G_tmpdir" || \ 916*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot create temporary directory '$_G_tmpdir'" 917*6a54128fSAndroid Build Coastguard Worker fi 918*6a54128fSAndroid Build Coastguard Worker 919*6a54128fSAndroid Build Coastguard Worker $ECHO "$_G_tmpdir" 920*6a54128fSAndroid Build Coastguard Worker} 921*6a54128fSAndroid Build Coastguard Worker 922*6a54128fSAndroid Build Coastguard Worker 923*6a54128fSAndroid Build Coastguard Worker# func_normal_abspath PATH 924*6a54128fSAndroid Build Coastguard Worker# ------------------------ 925*6a54128fSAndroid Build Coastguard Worker# Remove doubled-up and trailing slashes, "." path components, 926*6a54128fSAndroid Build Coastguard Worker# and cancel out any ".." path components in PATH after making 927*6a54128fSAndroid Build Coastguard Worker# it an absolute path. 928*6a54128fSAndroid Build Coastguard Workerfunc_normal_abspath () 929*6a54128fSAndroid Build Coastguard Worker{ 930*6a54128fSAndroid Build Coastguard Worker $debug_cmd 931*6a54128fSAndroid Build Coastguard Worker 932*6a54128fSAndroid Build Coastguard Worker # These SED scripts presuppose an absolute path with a trailing slash. 933*6a54128fSAndroid Build Coastguard Worker _G_pathcar='s|^/\([^/]*\).*$|\1|' 934*6a54128fSAndroid Build Coastguard Worker _G_pathcdr='s|^/[^/]*||' 935*6a54128fSAndroid Build Coastguard Worker _G_removedotparts=':dotsl 936*6a54128fSAndroid Build Coastguard Worker s|/\./|/|g 937*6a54128fSAndroid Build Coastguard Worker t dotsl 938*6a54128fSAndroid Build Coastguard Worker s|/\.$|/|' 939*6a54128fSAndroid Build Coastguard Worker _G_collapseslashes='s|/\{1,\}|/|g' 940*6a54128fSAndroid Build Coastguard Worker _G_finalslash='s|/*$|/|' 941*6a54128fSAndroid Build Coastguard Worker 942*6a54128fSAndroid Build Coastguard Worker # Start from root dir and reassemble the path. 943*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_result= 944*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_tpath=$1 945*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_altnamespace= 946*6a54128fSAndroid Build Coastguard Worker case $func_normal_abspath_tpath in 947*6a54128fSAndroid Build Coastguard Worker "") 948*6a54128fSAndroid Build Coastguard Worker # Empty path, that just means $cwd. 949*6a54128fSAndroid Build Coastguard Worker func_stripname '' '/' "`pwd`" 950*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_result=$func_stripname_result 951*6a54128fSAndroid Build Coastguard Worker return 952*6a54128fSAndroid Build Coastguard Worker ;; 953*6a54128fSAndroid Build Coastguard Worker # The next three entries are used to spot a run of precisely 954*6a54128fSAndroid Build Coastguard Worker # two leading slashes without using negated character classes; 955*6a54128fSAndroid Build Coastguard Worker # we take advantage of case's first-match behaviour. 956*6a54128fSAndroid Build Coastguard Worker ///*) 957*6a54128fSAndroid Build Coastguard Worker # Unusual form of absolute path, do nothing. 958*6a54128fSAndroid Build Coastguard Worker ;; 959*6a54128fSAndroid Build Coastguard Worker //*) 960*6a54128fSAndroid Build Coastguard Worker # Not necessarily an ordinary path; POSIX reserves leading '//' 961*6a54128fSAndroid Build Coastguard Worker # and for example Cygwin uses it to access remote file shares 962*6a54128fSAndroid Build Coastguard Worker # over CIFS/SMB, so we conserve a leading double slash if found. 963*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_altnamespace=/ 964*6a54128fSAndroid Build Coastguard Worker ;; 965*6a54128fSAndroid Build Coastguard Worker /*) 966*6a54128fSAndroid Build Coastguard Worker # Absolute path, do nothing. 967*6a54128fSAndroid Build Coastguard Worker ;; 968*6a54128fSAndroid Build Coastguard Worker *) 969*6a54128fSAndroid Build Coastguard Worker # Relative path, prepend $cwd. 970*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath 971*6a54128fSAndroid Build Coastguard Worker ;; 972*6a54128fSAndroid Build Coastguard Worker esac 973*6a54128fSAndroid Build Coastguard Worker 974*6a54128fSAndroid Build Coastguard Worker # Cancel out all the simple stuff to save iterations. We also want 975*6a54128fSAndroid Build Coastguard Worker # the path to end with a slash for ease of parsing, so make sure 976*6a54128fSAndroid Build Coastguard Worker # there is one (and only one) here. 977*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 978*6a54128fSAndroid Build Coastguard Worker -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` 979*6a54128fSAndroid Build Coastguard Worker while :; do 980*6a54128fSAndroid Build Coastguard Worker # Processed it all yet? 981*6a54128fSAndroid Build Coastguard Worker if test / = "$func_normal_abspath_tpath"; then 982*6a54128fSAndroid Build Coastguard Worker # If we ascended to the root using ".." the result may be empty now. 983*6a54128fSAndroid Build Coastguard Worker if test -z "$func_normal_abspath_result"; then 984*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_result=/ 985*6a54128fSAndroid Build Coastguard Worker fi 986*6a54128fSAndroid Build Coastguard Worker break 987*6a54128fSAndroid Build Coastguard Worker fi 988*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ 989*6a54128fSAndroid Build Coastguard Worker -e "$_G_pathcar"` 990*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ 991*6a54128fSAndroid Build Coastguard Worker -e "$_G_pathcdr"` 992*6a54128fSAndroid Build Coastguard Worker # Figure out what to do with it 993*6a54128fSAndroid Build Coastguard Worker case $func_normal_abspath_tcomponent in 994*6a54128fSAndroid Build Coastguard Worker "") 995*6a54128fSAndroid Build Coastguard Worker # Trailing empty path component, ignore it. 996*6a54128fSAndroid Build Coastguard Worker ;; 997*6a54128fSAndroid Build Coastguard Worker ..) 998*6a54128fSAndroid Build Coastguard Worker # Parent dir; strip last assembled component from result. 999*6a54128fSAndroid Build Coastguard Worker func_dirname "$func_normal_abspath_result" 1000*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_result=$func_dirname_result 1001*6a54128fSAndroid Build Coastguard Worker ;; 1002*6a54128fSAndroid Build Coastguard Worker *) 1003*6a54128fSAndroid Build Coastguard Worker # Actual path component, append it. 1004*6a54128fSAndroid Build Coastguard Worker func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" 1005*6a54128fSAndroid Build Coastguard Worker ;; 1006*6a54128fSAndroid Build Coastguard Worker esac 1007*6a54128fSAndroid Build Coastguard Worker done 1008*6a54128fSAndroid Build Coastguard Worker # Restore leading double-slash if one was found on entry. 1009*6a54128fSAndroid Build Coastguard Worker func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result 1010*6a54128fSAndroid Build Coastguard Worker} 1011*6a54128fSAndroid Build Coastguard Worker 1012*6a54128fSAndroid Build Coastguard Worker 1013*6a54128fSAndroid Build Coastguard Worker# func_notquiet ARG... 1014*6a54128fSAndroid Build Coastguard Worker# -------------------- 1015*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed message only when not in quiet mode. 1016*6a54128fSAndroid Build Coastguard Workerfunc_notquiet () 1017*6a54128fSAndroid Build Coastguard Worker{ 1018*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1019*6a54128fSAndroid Build Coastguard Worker 1020*6a54128fSAndroid Build Coastguard Worker $opt_quiet || func_echo ${1+"$@"} 1021*6a54128fSAndroid Build Coastguard Worker 1022*6a54128fSAndroid Build Coastguard Worker # A bug in bash halts the script if the last line of a function 1023*6a54128fSAndroid Build Coastguard Worker # fails when set -e is in force, so we need another command to 1024*6a54128fSAndroid Build Coastguard Worker # work around that: 1025*6a54128fSAndroid Build Coastguard Worker : 1026*6a54128fSAndroid Build Coastguard Worker} 1027*6a54128fSAndroid Build Coastguard Worker 1028*6a54128fSAndroid Build Coastguard Worker 1029*6a54128fSAndroid Build Coastguard Worker# func_relative_path SRCDIR DSTDIR 1030*6a54128fSAndroid Build Coastguard Worker# -------------------------------- 1031*6a54128fSAndroid Build Coastguard Worker# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. 1032*6a54128fSAndroid Build Coastguard Workerfunc_relative_path () 1033*6a54128fSAndroid Build Coastguard Worker{ 1034*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1035*6a54128fSAndroid Build Coastguard Worker 1036*6a54128fSAndroid Build Coastguard Worker func_relative_path_result= 1037*6a54128fSAndroid Build Coastguard Worker func_normal_abspath "$1" 1038*6a54128fSAndroid Build Coastguard Worker func_relative_path_tlibdir=$func_normal_abspath_result 1039*6a54128fSAndroid Build Coastguard Worker func_normal_abspath "$2" 1040*6a54128fSAndroid Build Coastguard Worker func_relative_path_tbindir=$func_normal_abspath_result 1041*6a54128fSAndroid Build Coastguard Worker 1042*6a54128fSAndroid Build Coastguard Worker # Ascend the tree starting from libdir 1043*6a54128fSAndroid Build Coastguard Worker while :; do 1044*6a54128fSAndroid Build Coastguard Worker # check if we have found a prefix of bindir 1045*6a54128fSAndroid Build Coastguard Worker case $func_relative_path_tbindir in 1046*6a54128fSAndroid Build Coastguard Worker $func_relative_path_tlibdir) 1047*6a54128fSAndroid Build Coastguard Worker # found an exact match 1048*6a54128fSAndroid Build Coastguard Worker func_relative_path_tcancelled= 1049*6a54128fSAndroid Build Coastguard Worker break 1050*6a54128fSAndroid Build Coastguard Worker ;; 1051*6a54128fSAndroid Build Coastguard Worker $func_relative_path_tlibdir*) 1052*6a54128fSAndroid Build Coastguard Worker # found a matching prefix 1053*6a54128fSAndroid Build Coastguard Worker func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" 1054*6a54128fSAndroid Build Coastguard Worker func_relative_path_tcancelled=$func_stripname_result 1055*6a54128fSAndroid Build Coastguard Worker if test -z "$func_relative_path_result"; then 1056*6a54128fSAndroid Build Coastguard Worker func_relative_path_result=. 1057*6a54128fSAndroid Build Coastguard Worker fi 1058*6a54128fSAndroid Build Coastguard Worker break 1059*6a54128fSAndroid Build Coastguard Worker ;; 1060*6a54128fSAndroid Build Coastguard Worker *) 1061*6a54128fSAndroid Build Coastguard Worker func_dirname $func_relative_path_tlibdir 1062*6a54128fSAndroid Build Coastguard Worker func_relative_path_tlibdir=$func_dirname_result 1063*6a54128fSAndroid Build Coastguard Worker if test -z "$func_relative_path_tlibdir"; then 1064*6a54128fSAndroid Build Coastguard Worker # Have to descend all the way to the root! 1065*6a54128fSAndroid Build Coastguard Worker func_relative_path_result=../$func_relative_path_result 1066*6a54128fSAndroid Build Coastguard Worker func_relative_path_tcancelled=$func_relative_path_tbindir 1067*6a54128fSAndroid Build Coastguard Worker break 1068*6a54128fSAndroid Build Coastguard Worker fi 1069*6a54128fSAndroid Build Coastguard Worker func_relative_path_result=../$func_relative_path_result 1070*6a54128fSAndroid Build Coastguard Worker ;; 1071*6a54128fSAndroid Build Coastguard Worker esac 1072*6a54128fSAndroid Build Coastguard Worker done 1073*6a54128fSAndroid Build Coastguard Worker 1074*6a54128fSAndroid Build Coastguard Worker # Now calculate path; take care to avoid doubling-up slashes. 1075*6a54128fSAndroid Build Coastguard Worker func_stripname '' '/' "$func_relative_path_result" 1076*6a54128fSAndroid Build Coastguard Worker func_relative_path_result=$func_stripname_result 1077*6a54128fSAndroid Build Coastguard Worker func_stripname '/' '/' "$func_relative_path_tcancelled" 1078*6a54128fSAndroid Build Coastguard Worker if test -n "$func_stripname_result"; then 1079*6a54128fSAndroid Build Coastguard Worker func_append func_relative_path_result "/$func_stripname_result" 1080*6a54128fSAndroid Build Coastguard Worker fi 1081*6a54128fSAndroid Build Coastguard Worker 1082*6a54128fSAndroid Build Coastguard Worker # Normalisation. If bindir is libdir, return '.' else relative path. 1083*6a54128fSAndroid Build Coastguard Worker if test -n "$func_relative_path_result"; then 1084*6a54128fSAndroid Build Coastguard Worker func_stripname './' '' "$func_relative_path_result" 1085*6a54128fSAndroid Build Coastguard Worker func_relative_path_result=$func_stripname_result 1086*6a54128fSAndroid Build Coastguard Worker fi 1087*6a54128fSAndroid Build Coastguard Worker 1088*6a54128fSAndroid Build Coastguard Worker test -n "$func_relative_path_result" || func_relative_path_result=. 1089*6a54128fSAndroid Build Coastguard Worker 1090*6a54128fSAndroid Build Coastguard Worker : 1091*6a54128fSAndroid Build Coastguard Worker} 1092*6a54128fSAndroid Build Coastguard Worker 1093*6a54128fSAndroid Build Coastguard Worker 1094*6a54128fSAndroid Build Coastguard Worker# func_quote_for_eval ARG... 1095*6a54128fSAndroid Build Coastguard Worker# -------------------------- 1096*6a54128fSAndroid Build Coastguard Worker# Aesthetically quote ARGs to be evaled later. 1097*6a54128fSAndroid Build Coastguard Worker# This function returns two values: 1098*6a54128fSAndroid Build Coastguard Worker# i) func_quote_for_eval_result 1099*6a54128fSAndroid Build Coastguard Worker# double-quoted, suitable for a subsequent eval 1100*6a54128fSAndroid Build Coastguard Worker# ii) func_quote_for_eval_unquoted_result 1101*6a54128fSAndroid Build Coastguard Worker# has all characters that are still active within double 1102*6a54128fSAndroid Build Coastguard Worker# quotes backslashified. 1103*6a54128fSAndroid Build Coastguard Workerfunc_quote_for_eval () 1104*6a54128fSAndroid Build Coastguard Worker{ 1105*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1106*6a54128fSAndroid Build Coastguard Worker 1107*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval_unquoted_result= 1108*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval_result= 1109*6a54128fSAndroid Build Coastguard Worker while test 0 -lt $#; do 1110*6a54128fSAndroid Build Coastguard Worker case $1 in 1111*6a54128fSAndroid Build Coastguard Worker *[\\\`\"\$]*) 1112*6a54128fSAndroid Build Coastguard Worker _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; 1113*6a54128fSAndroid Build Coastguard Worker *) 1114*6a54128fSAndroid Build Coastguard Worker _G_unquoted_arg=$1 ;; 1115*6a54128fSAndroid Build Coastguard Worker esac 1116*6a54128fSAndroid Build Coastguard Worker if test -n "$func_quote_for_eval_unquoted_result"; then 1117*6a54128fSAndroid Build Coastguard Worker func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" 1118*6a54128fSAndroid Build Coastguard Worker else 1119*6a54128fSAndroid Build Coastguard Worker func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" 1120*6a54128fSAndroid Build Coastguard Worker fi 1121*6a54128fSAndroid Build Coastguard Worker 1122*6a54128fSAndroid Build Coastguard Worker case $_G_unquoted_arg in 1123*6a54128fSAndroid Build Coastguard Worker # Double-quote args containing shell metacharacters to delay 1124*6a54128fSAndroid Build Coastguard Worker # word splitting, command substitution and variable expansion 1125*6a54128fSAndroid Build Coastguard Worker # for a subsequent eval. 1126*6a54128fSAndroid Build Coastguard Worker # Many Bourne shells cannot handle close brackets correctly 1127*6a54128fSAndroid Build Coastguard Worker # in scan sets, so we specify it separately. 1128*6a54128fSAndroid Build Coastguard Worker *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1129*6a54128fSAndroid Build Coastguard Worker _G_quoted_arg=\"$_G_unquoted_arg\" 1130*6a54128fSAndroid Build Coastguard Worker ;; 1131*6a54128fSAndroid Build Coastguard Worker *) 1132*6a54128fSAndroid Build Coastguard Worker _G_quoted_arg=$_G_unquoted_arg 1133*6a54128fSAndroid Build Coastguard Worker ;; 1134*6a54128fSAndroid Build Coastguard Worker esac 1135*6a54128fSAndroid Build Coastguard Worker 1136*6a54128fSAndroid Build Coastguard Worker if test -n "$func_quote_for_eval_result"; then 1137*6a54128fSAndroid Build Coastguard Worker func_append func_quote_for_eval_result " $_G_quoted_arg" 1138*6a54128fSAndroid Build Coastguard Worker else 1139*6a54128fSAndroid Build Coastguard Worker func_append func_quote_for_eval_result "$_G_quoted_arg" 1140*6a54128fSAndroid Build Coastguard Worker fi 1141*6a54128fSAndroid Build Coastguard Worker shift 1142*6a54128fSAndroid Build Coastguard Worker done 1143*6a54128fSAndroid Build Coastguard Worker} 1144*6a54128fSAndroid Build Coastguard Worker 1145*6a54128fSAndroid Build Coastguard Worker 1146*6a54128fSAndroid Build Coastguard Worker# func_quote_for_expand ARG 1147*6a54128fSAndroid Build Coastguard Worker# ------------------------- 1148*6a54128fSAndroid Build Coastguard Worker# Aesthetically quote ARG to be evaled later; same as above, 1149*6a54128fSAndroid Build Coastguard Worker# but do not quote variable references. 1150*6a54128fSAndroid Build Coastguard Workerfunc_quote_for_expand () 1151*6a54128fSAndroid Build Coastguard Worker{ 1152*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1153*6a54128fSAndroid Build Coastguard Worker 1154*6a54128fSAndroid Build Coastguard Worker case $1 in 1155*6a54128fSAndroid Build Coastguard Worker *[\\\`\"]*) 1156*6a54128fSAndroid Build Coastguard Worker _G_arg=`$ECHO "$1" | $SED \ 1157*6a54128fSAndroid Build Coastguard Worker -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; 1158*6a54128fSAndroid Build Coastguard Worker *) 1159*6a54128fSAndroid Build Coastguard Worker _G_arg=$1 ;; 1160*6a54128fSAndroid Build Coastguard Worker esac 1161*6a54128fSAndroid Build Coastguard Worker 1162*6a54128fSAndroid Build Coastguard Worker case $_G_arg in 1163*6a54128fSAndroid Build Coastguard Worker # Double-quote args containing shell metacharacters to delay 1164*6a54128fSAndroid Build Coastguard Worker # word splitting and command substitution for a subsequent eval. 1165*6a54128fSAndroid Build Coastguard Worker # Many Bourne shells cannot handle close brackets correctly 1166*6a54128fSAndroid Build Coastguard Worker # in scan sets, so we specify it separately. 1167*6a54128fSAndroid Build Coastguard Worker *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1168*6a54128fSAndroid Build Coastguard Worker _G_arg=\"$_G_arg\" 1169*6a54128fSAndroid Build Coastguard Worker ;; 1170*6a54128fSAndroid Build Coastguard Worker esac 1171*6a54128fSAndroid Build Coastguard Worker 1172*6a54128fSAndroid Build Coastguard Worker func_quote_for_expand_result=$_G_arg 1173*6a54128fSAndroid Build Coastguard Worker} 1174*6a54128fSAndroid Build Coastguard Worker 1175*6a54128fSAndroid Build Coastguard Worker 1176*6a54128fSAndroid Build Coastguard Worker# func_stripname PREFIX SUFFIX NAME 1177*6a54128fSAndroid Build Coastguard Worker# --------------------------------- 1178*6a54128fSAndroid Build Coastguard Worker# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. 1179*6a54128fSAndroid Build Coastguard Worker# PREFIX and SUFFIX must not contain globbing or regex special 1180*6a54128fSAndroid Build Coastguard Worker# characters, hashes, percent signs, but SUFFIX may contain a leading 1181*6a54128fSAndroid Build Coastguard Worker# dot (in which case that matches only a dot). 1182*6a54128fSAndroid Build Coastguard Workerif test yes = "$_G_HAVE_XSI_OPS"; then 1183*6a54128fSAndroid Build Coastguard Worker eval 'func_stripname () 1184*6a54128fSAndroid Build Coastguard Worker { 1185*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1186*6a54128fSAndroid Build Coastguard Worker 1187*6a54128fSAndroid Build Coastguard Worker # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are 1188*6a54128fSAndroid Build Coastguard Worker # positional parameters, so assign one to ordinary variable first. 1189*6a54128fSAndroid Build Coastguard Worker func_stripname_result=$3 1190*6a54128fSAndroid Build Coastguard Worker func_stripname_result=${func_stripname_result#"$1"} 1191*6a54128fSAndroid Build Coastguard Worker func_stripname_result=${func_stripname_result%"$2"} 1192*6a54128fSAndroid Build Coastguard Worker }' 1193*6a54128fSAndroid Build Coastguard Workerelse 1194*6a54128fSAndroid Build Coastguard Worker func_stripname () 1195*6a54128fSAndroid Build Coastguard Worker { 1196*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1197*6a54128fSAndroid Build Coastguard Worker 1198*6a54128fSAndroid Build Coastguard Worker case $2 in 1199*6a54128fSAndroid Build Coastguard Worker .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; 1200*6a54128fSAndroid Build Coastguard Worker *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; 1201*6a54128fSAndroid Build Coastguard Worker esac 1202*6a54128fSAndroid Build Coastguard Worker } 1203*6a54128fSAndroid Build Coastguard Workerfi 1204*6a54128fSAndroid Build Coastguard Worker 1205*6a54128fSAndroid Build Coastguard Worker 1206*6a54128fSAndroid Build Coastguard Worker# func_show_eval CMD [FAIL_EXP] 1207*6a54128fSAndroid Build Coastguard Worker# ----------------------------- 1208*6a54128fSAndroid Build Coastguard Worker# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is 1209*6a54128fSAndroid Build Coastguard Worker# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 1210*6a54128fSAndroid Build Coastguard Worker# is given, then evaluate it. 1211*6a54128fSAndroid Build Coastguard Workerfunc_show_eval () 1212*6a54128fSAndroid Build Coastguard Worker{ 1213*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1214*6a54128fSAndroid Build Coastguard Worker 1215*6a54128fSAndroid Build Coastguard Worker _G_cmd=$1 1216*6a54128fSAndroid Build Coastguard Worker _G_fail_exp=${2-':'} 1217*6a54128fSAndroid Build Coastguard Worker 1218*6a54128fSAndroid Build Coastguard Worker func_quote_for_expand "$_G_cmd" 1219*6a54128fSAndroid Build Coastguard Worker eval "func_notquiet $func_quote_for_expand_result" 1220*6a54128fSAndroid Build Coastguard Worker 1221*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 1222*6a54128fSAndroid Build Coastguard Worker eval "$_G_cmd" 1223*6a54128fSAndroid Build Coastguard Worker _G_status=$? 1224*6a54128fSAndroid Build Coastguard Worker if test 0 -ne "$_G_status"; then 1225*6a54128fSAndroid Build Coastguard Worker eval "(exit $_G_status); $_G_fail_exp" 1226*6a54128fSAndroid Build Coastguard Worker fi 1227*6a54128fSAndroid Build Coastguard Worker } 1228*6a54128fSAndroid Build Coastguard Worker} 1229*6a54128fSAndroid Build Coastguard Worker 1230*6a54128fSAndroid Build Coastguard Worker 1231*6a54128fSAndroid Build Coastguard Worker# func_show_eval_locale CMD [FAIL_EXP] 1232*6a54128fSAndroid Build Coastguard Worker# ------------------------------------ 1233*6a54128fSAndroid Build Coastguard Worker# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is 1234*6a54128fSAndroid Build Coastguard Worker# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP 1235*6a54128fSAndroid Build Coastguard Worker# is given, then evaluate it. Use the saved locale for evaluation. 1236*6a54128fSAndroid Build Coastguard Workerfunc_show_eval_locale () 1237*6a54128fSAndroid Build Coastguard Worker{ 1238*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1239*6a54128fSAndroid Build Coastguard Worker 1240*6a54128fSAndroid Build Coastguard Worker _G_cmd=$1 1241*6a54128fSAndroid Build Coastguard Worker _G_fail_exp=${2-':'} 1242*6a54128fSAndroid Build Coastguard Worker 1243*6a54128fSAndroid Build Coastguard Worker $opt_quiet || { 1244*6a54128fSAndroid Build Coastguard Worker func_quote_for_expand "$_G_cmd" 1245*6a54128fSAndroid Build Coastguard Worker eval "func_echo $func_quote_for_expand_result" 1246*6a54128fSAndroid Build Coastguard Worker } 1247*6a54128fSAndroid Build Coastguard Worker 1248*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 1249*6a54128fSAndroid Build Coastguard Worker eval "$_G_user_locale 1250*6a54128fSAndroid Build Coastguard Worker $_G_cmd" 1251*6a54128fSAndroid Build Coastguard Worker _G_status=$? 1252*6a54128fSAndroid Build Coastguard Worker eval "$_G_safe_locale" 1253*6a54128fSAndroid Build Coastguard Worker if test 0 -ne "$_G_status"; then 1254*6a54128fSAndroid Build Coastguard Worker eval "(exit $_G_status); $_G_fail_exp" 1255*6a54128fSAndroid Build Coastguard Worker fi 1256*6a54128fSAndroid Build Coastguard Worker } 1257*6a54128fSAndroid Build Coastguard Worker} 1258*6a54128fSAndroid Build Coastguard Worker 1259*6a54128fSAndroid Build Coastguard Worker 1260*6a54128fSAndroid Build Coastguard Worker# func_tr_sh 1261*6a54128fSAndroid Build Coastguard Worker# ---------- 1262*6a54128fSAndroid Build Coastguard Worker# Turn $1 into a string suitable for a shell variable name. 1263*6a54128fSAndroid Build Coastguard Worker# Result is stored in $func_tr_sh_result. All characters 1264*6a54128fSAndroid Build Coastguard Worker# not in the set a-zA-Z0-9_ are replaced with '_'. Further, 1265*6a54128fSAndroid Build Coastguard Worker# if $1 begins with a digit, a '_' is prepended as well. 1266*6a54128fSAndroid Build Coastguard Workerfunc_tr_sh () 1267*6a54128fSAndroid Build Coastguard Worker{ 1268*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1269*6a54128fSAndroid Build Coastguard Worker 1270*6a54128fSAndroid Build Coastguard Worker case $1 in 1271*6a54128fSAndroid Build Coastguard Worker [0-9]* | *[!a-zA-Z0-9_]*) 1272*6a54128fSAndroid Build Coastguard Worker func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` 1273*6a54128fSAndroid Build Coastguard Worker ;; 1274*6a54128fSAndroid Build Coastguard Worker * ) 1275*6a54128fSAndroid Build Coastguard Worker func_tr_sh_result=$1 1276*6a54128fSAndroid Build Coastguard Worker ;; 1277*6a54128fSAndroid Build Coastguard Worker esac 1278*6a54128fSAndroid Build Coastguard Worker} 1279*6a54128fSAndroid Build Coastguard Worker 1280*6a54128fSAndroid Build Coastguard Worker 1281*6a54128fSAndroid Build Coastguard Worker# func_verbose ARG... 1282*6a54128fSAndroid Build Coastguard Worker# ------------------- 1283*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed message in verbose mode only. 1284*6a54128fSAndroid Build Coastguard Workerfunc_verbose () 1285*6a54128fSAndroid Build Coastguard Worker{ 1286*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1287*6a54128fSAndroid Build Coastguard Worker 1288*6a54128fSAndroid Build Coastguard Worker $opt_verbose && func_echo "$*" 1289*6a54128fSAndroid Build Coastguard Worker 1290*6a54128fSAndroid Build Coastguard Worker : 1291*6a54128fSAndroid Build Coastguard Worker} 1292*6a54128fSAndroid Build Coastguard Worker 1293*6a54128fSAndroid Build Coastguard Worker 1294*6a54128fSAndroid Build Coastguard Worker# func_warn_and_continue ARG... 1295*6a54128fSAndroid Build Coastguard Worker# ----------------------------- 1296*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed warning message to standard error. 1297*6a54128fSAndroid Build Coastguard Workerfunc_warn_and_continue () 1298*6a54128fSAndroid Build Coastguard Worker{ 1299*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1300*6a54128fSAndroid Build Coastguard Worker 1301*6a54128fSAndroid Build Coastguard Worker $require_term_colors 1302*6a54128fSAndroid Build Coastguard Worker 1303*6a54128fSAndroid Build Coastguard Worker func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 1304*6a54128fSAndroid Build Coastguard Worker} 1305*6a54128fSAndroid Build Coastguard Worker 1306*6a54128fSAndroid Build Coastguard Worker 1307*6a54128fSAndroid Build Coastguard Worker# func_warning CATEGORY ARG... 1308*6a54128fSAndroid Build Coastguard Worker# ---------------------------- 1309*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed warning message to standard error. Warning 1310*6a54128fSAndroid Build Coastguard Worker# messages can be filtered according to CATEGORY, where this function 1311*6a54128fSAndroid Build Coastguard Worker# elides messages where CATEGORY is not listed in the global variable 1312*6a54128fSAndroid Build Coastguard Worker# 'opt_warning_types'. 1313*6a54128fSAndroid Build Coastguard Workerfunc_warning () 1314*6a54128fSAndroid Build Coastguard Worker{ 1315*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1316*6a54128fSAndroid Build Coastguard Worker 1317*6a54128fSAndroid Build Coastguard Worker # CATEGORY must be in the warning_categories list! 1318*6a54128fSAndroid Build Coastguard Worker case " $warning_categories " in 1319*6a54128fSAndroid Build Coastguard Worker *" $1 "*) ;; 1320*6a54128fSAndroid Build Coastguard Worker *) func_internal_error "invalid warning category '$1'" ;; 1321*6a54128fSAndroid Build Coastguard Worker esac 1322*6a54128fSAndroid Build Coastguard Worker 1323*6a54128fSAndroid Build Coastguard Worker _G_category=$1 1324*6a54128fSAndroid Build Coastguard Worker shift 1325*6a54128fSAndroid Build Coastguard Worker 1326*6a54128fSAndroid Build Coastguard Worker case " $opt_warning_types " in 1327*6a54128fSAndroid Build Coastguard Worker *" $_G_category "*) $warning_func ${1+"$@"} ;; 1328*6a54128fSAndroid Build Coastguard Worker esac 1329*6a54128fSAndroid Build Coastguard Worker} 1330*6a54128fSAndroid Build Coastguard Worker 1331*6a54128fSAndroid Build Coastguard Worker 1332*6a54128fSAndroid Build Coastguard Worker# func_sort_ver VER1 VER2 1333*6a54128fSAndroid Build Coastguard Worker# ----------------------- 1334*6a54128fSAndroid Build Coastguard Worker# 'sort -V' is not generally available. 1335*6a54128fSAndroid Build Coastguard Worker# Note this deviates from the version comparison in automake 1336*6a54128fSAndroid Build Coastguard Worker# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a 1337*6a54128fSAndroid Build Coastguard Worker# but this should suffice as we won't be specifying old 1338*6a54128fSAndroid Build Coastguard Worker# version formats or redundant trailing .0 in bootstrap.conf. 1339*6a54128fSAndroid Build Coastguard Worker# If we did want full compatibility then we should probably 1340*6a54128fSAndroid Build Coastguard Worker# use m4_version_compare from autoconf. 1341*6a54128fSAndroid Build Coastguard Workerfunc_sort_ver () 1342*6a54128fSAndroid Build Coastguard Worker{ 1343*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1344*6a54128fSAndroid Build Coastguard Worker 1345*6a54128fSAndroid Build Coastguard Worker printf '%s\n%s\n' "$1" "$2" \ 1346*6a54128fSAndroid Build Coastguard Worker | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n 1347*6a54128fSAndroid Build Coastguard Worker} 1348*6a54128fSAndroid Build Coastguard Worker 1349*6a54128fSAndroid Build Coastguard Worker# func_lt_ver PREV CURR 1350*6a54128fSAndroid Build Coastguard Worker# --------------------- 1351*6a54128fSAndroid Build Coastguard Worker# Return true if PREV and CURR are in the correct order according to 1352*6a54128fSAndroid Build Coastguard Worker# func_sort_ver, otherwise false. Use it like this: 1353*6a54128fSAndroid Build Coastguard Worker# 1354*6a54128fSAndroid Build Coastguard Worker# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." 1355*6a54128fSAndroid Build Coastguard Workerfunc_lt_ver () 1356*6a54128fSAndroid Build Coastguard Worker{ 1357*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1358*6a54128fSAndroid Build Coastguard Worker 1359*6a54128fSAndroid Build Coastguard Worker test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` 1360*6a54128fSAndroid Build Coastguard Worker} 1361*6a54128fSAndroid Build Coastguard Worker 1362*6a54128fSAndroid Build Coastguard Worker 1363*6a54128fSAndroid Build Coastguard Worker# Local variables: 1364*6a54128fSAndroid Build Coastguard Worker# mode: shell-script 1365*6a54128fSAndroid Build Coastguard Worker# sh-indentation: 2 1366*6a54128fSAndroid Build Coastguard Worker# eval: (add-hook 'before-save-hook 'time-stamp) 1367*6a54128fSAndroid Build Coastguard Worker# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" 1368*6a54128fSAndroid Build Coastguard Worker# time-stamp-time-zone: "UTC" 1369*6a54128fSAndroid Build Coastguard Worker# End: 1370*6a54128fSAndroid Build Coastguard Worker#! /bin/sh 1371*6a54128fSAndroid Build Coastguard Worker 1372*6a54128fSAndroid Build Coastguard Worker# Set a version string for this script. 1373*6a54128fSAndroid Build Coastguard Workerscriptversion=2015-10-07.11; # UTC 1374*6a54128fSAndroid Build Coastguard Worker 1375*6a54128fSAndroid Build Coastguard Worker# A portable, pluggable option parser for Bourne shell. 1376*6a54128fSAndroid Build Coastguard Worker# Written by Gary V. Vaughan, 2010 1377*6a54128fSAndroid Build Coastguard Worker 1378*6a54128fSAndroid Build Coastguard Worker# Copyright (C) 2010-2015 Free Software Foundation, Inc. 1379*6a54128fSAndroid Build Coastguard Worker# This is free software; see the source for copying conditions. There is NO 1380*6a54128fSAndroid Build Coastguard Worker# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 1381*6a54128fSAndroid Build Coastguard Worker 1382*6a54128fSAndroid Build Coastguard Worker# This program is free software: you can redistribute it and/or modify 1383*6a54128fSAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by 1384*6a54128fSAndroid Build Coastguard Worker# the Free Software Foundation, either version 3 of the License, or 1385*6a54128fSAndroid Build Coastguard Worker# (at your option) any later version. 1386*6a54128fSAndroid Build Coastguard Worker 1387*6a54128fSAndroid Build Coastguard Worker# This program is distributed in the hope that it will be useful, 1388*6a54128fSAndroid Build Coastguard Worker# but WITHOUT ANY WARRANTY; without even the implied warranty of 1389*6a54128fSAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1390*6a54128fSAndroid Build Coastguard Worker# GNU General Public License for more details. 1391*6a54128fSAndroid Build Coastguard Worker 1392*6a54128fSAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License 1393*6a54128fSAndroid Build Coastguard Worker# along with this program. If not, see <http://www.gnu.org/licenses/>. 1394*6a54128fSAndroid Build Coastguard Worker 1395*6a54128fSAndroid Build Coastguard Worker# Please report bugs or propose patches to [email protected]. 1396*6a54128fSAndroid Build Coastguard Worker 1397*6a54128fSAndroid Build Coastguard Worker 1398*6a54128fSAndroid Build Coastguard Worker## ------ ## 1399*6a54128fSAndroid Build Coastguard Worker## Usage. ## 1400*6a54128fSAndroid Build Coastguard Worker## ------ ## 1401*6a54128fSAndroid Build Coastguard Worker 1402*6a54128fSAndroid Build Coastguard Worker# This file is a library for parsing options in your shell scripts along 1403*6a54128fSAndroid Build Coastguard Worker# with assorted other useful supporting features that you can make use 1404*6a54128fSAndroid Build Coastguard Worker# of too. 1405*6a54128fSAndroid Build Coastguard Worker# 1406*6a54128fSAndroid Build Coastguard Worker# For the simplest scripts you might need only: 1407*6a54128fSAndroid Build Coastguard Worker# 1408*6a54128fSAndroid Build Coastguard Worker# #!/bin/sh 1409*6a54128fSAndroid Build Coastguard Worker# . relative/path/to/funclib.sh 1410*6a54128fSAndroid Build Coastguard Worker# . relative/path/to/options-parser 1411*6a54128fSAndroid Build Coastguard Worker# scriptversion=1.0 1412*6a54128fSAndroid Build Coastguard Worker# func_options ${1+"$@"} 1413*6a54128fSAndroid Build Coastguard Worker# eval set dummy "$func_options_result"; shift 1414*6a54128fSAndroid Build Coastguard Worker# ...rest of your script... 1415*6a54128fSAndroid Build Coastguard Worker# 1416*6a54128fSAndroid Build Coastguard Worker# In order for the '--version' option to work, you will need to have a 1417*6a54128fSAndroid Build Coastguard Worker# suitably formatted comment like the one at the top of this file 1418*6a54128fSAndroid Build Coastguard Worker# starting with '# Written by ' and ending with '# warranty; '. 1419*6a54128fSAndroid Build Coastguard Worker# 1420*6a54128fSAndroid Build Coastguard Worker# For '-h' and '--help' to work, you will also need a one line 1421*6a54128fSAndroid Build Coastguard Worker# description of your script's purpose in a comment directly above the 1422*6a54128fSAndroid Build Coastguard Worker# '# Written by ' line, like the one at the top of this file. 1423*6a54128fSAndroid Build Coastguard Worker# 1424*6a54128fSAndroid Build Coastguard Worker# The default options also support '--debug', which will turn on shell 1425*6a54128fSAndroid Build Coastguard Worker# execution tracing (see the comment above debug_cmd below for another 1426*6a54128fSAndroid Build Coastguard Worker# use), and '--verbose' and the func_verbose function to allow your script 1427*6a54128fSAndroid Build Coastguard Worker# to display verbose messages only when your user has specified 1428*6a54128fSAndroid Build Coastguard Worker# '--verbose'. 1429*6a54128fSAndroid Build Coastguard Worker# 1430*6a54128fSAndroid Build Coastguard Worker# After sourcing this file, you can plug processing for additional 1431*6a54128fSAndroid Build Coastguard Worker# options by amending the variables from the 'Configuration' section 1432*6a54128fSAndroid Build Coastguard Worker# below, and following the instructions in the 'Option parsing' 1433*6a54128fSAndroid Build Coastguard Worker# section further down. 1434*6a54128fSAndroid Build Coastguard Worker 1435*6a54128fSAndroid Build Coastguard Worker## -------------- ## 1436*6a54128fSAndroid Build Coastguard Worker## Configuration. ## 1437*6a54128fSAndroid Build Coastguard Worker## -------------- ## 1438*6a54128fSAndroid Build Coastguard Worker 1439*6a54128fSAndroid Build Coastguard Worker# You should override these variables in your script after sourcing this 1440*6a54128fSAndroid Build Coastguard Worker# file so that they reflect the customisations you have added to the 1441*6a54128fSAndroid Build Coastguard Worker# option parser. 1442*6a54128fSAndroid Build Coastguard Worker 1443*6a54128fSAndroid Build Coastguard Worker# The usage line for option parsing errors and the start of '-h' and 1444*6a54128fSAndroid Build Coastguard Worker# '--help' output messages. You can embed shell variables for delayed 1445*6a54128fSAndroid Build Coastguard Worker# expansion at the time the message is displayed, but you will need to 1446*6a54128fSAndroid Build Coastguard Worker# quote other shell meta-characters carefully to prevent them being 1447*6a54128fSAndroid Build Coastguard Worker# expanded when the contents are evaled. 1448*6a54128fSAndroid Build Coastguard Workerusage='$progpath [OPTION]...' 1449*6a54128fSAndroid Build Coastguard Worker 1450*6a54128fSAndroid Build Coastguard Worker# Short help message in response to '-h' and '--help'. Add to this or 1451*6a54128fSAndroid Build Coastguard Worker# override it after sourcing this library to reflect the full set of 1452*6a54128fSAndroid Build Coastguard Worker# options your script accepts. 1453*6a54128fSAndroid Build Coastguard Workerusage_message="\ 1454*6a54128fSAndroid Build Coastguard Worker --debug enable verbose shell tracing 1455*6a54128fSAndroid Build Coastguard Worker -W, --warnings=CATEGORY 1456*6a54128fSAndroid Build Coastguard Worker report the warnings falling in CATEGORY [all] 1457*6a54128fSAndroid Build Coastguard Worker -v, --verbose verbosely report processing 1458*6a54128fSAndroid Build Coastguard Worker --version print version information and exit 1459*6a54128fSAndroid Build Coastguard Worker -h, --help print short or long help message and exit 1460*6a54128fSAndroid Build Coastguard Worker" 1461*6a54128fSAndroid Build Coastguard Worker 1462*6a54128fSAndroid Build Coastguard Worker# Additional text appended to 'usage_message' in response to '--help'. 1463*6a54128fSAndroid Build Coastguard Workerlong_help_message=" 1464*6a54128fSAndroid Build Coastguard WorkerWarning categories include: 1465*6a54128fSAndroid Build Coastguard Worker 'all' show all warnings 1466*6a54128fSAndroid Build Coastguard Worker 'none' turn off all the warnings 1467*6a54128fSAndroid Build Coastguard Worker 'error' warnings are treated as fatal errors" 1468*6a54128fSAndroid Build Coastguard Worker 1469*6a54128fSAndroid Build Coastguard Worker# Help message printed before fatal option parsing errors. 1470*6a54128fSAndroid Build Coastguard Workerfatal_help="Try '\$progname --help' for more information." 1471*6a54128fSAndroid Build Coastguard Worker 1472*6a54128fSAndroid Build Coastguard Worker 1473*6a54128fSAndroid Build Coastguard Worker 1474*6a54128fSAndroid Build Coastguard Worker## ------------------------- ## 1475*6a54128fSAndroid Build Coastguard Worker## Hook function management. ## 1476*6a54128fSAndroid Build Coastguard Worker## ------------------------- ## 1477*6a54128fSAndroid Build Coastguard Worker 1478*6a54128fSAndroid Build Coastguard Worker# This section contains functions for adding, removing, and running hooks 1479*6a54128fSAndroid Build Coastguard Worker# to the main code. A hook is just a named list of of function, that can 1480*6a54128fSAndroid Build Coastguard Worker# be run in order later on. 1481*6a54128fSAndroid Build Coastguard Worker 1482*6a54128fSAndroid Build Coastguard Worker# func_hookable FUNC_NAME 1483*6a54128fSAndroid Build Coastguard Worker# ----------------------- 1484*6a54128fSAndroid Build Coastguard Worker# Declare that FUNC_NAME will run hooks added with 1485*6a54128fSAndroid Build Coastguard Worker# 'func_add_hook FUNC_NAME ...'. 1486*6a54128fSAndroid Build Coastguard Workerfunc_hookable () 1487*6a54128fSAndroid Build Coastguard Worker{ 1488*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1489*6a54128fSAndroid Build Coastguard Worker 1490*6a54128fSAndroid Build Coastguard Worker func_append hookable_fns " $1" 1491*6a54128fSAndroid Build Coastguard Worker} 1492*6a54128fSAndroid Build Coastguard Worker 1493*6a54128fSAndroid Build Coastguard Worker 1494*6a54128fSAndroid Build Coastguard Worker# func_add_hook FUNC_NAME HOOK_FUNC 1495*6a54128fSAndroid Build Coastguard Worker# --------------------------------- 1496*6a54128fSAndroid Build Coastguard Worker# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must 1497*6a54128fSAndroid Build Coastguard Worker# first have been declared "hookable" by a call to 'func_hookable'. 1498*6a54128fSAndroid Build Coastguard Workerfunc_add_hook () 1499*6a54128fSAndroid Build Coastguard Worker{ 1500*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1501*6a54128fSAndroid Build Coastguard Worker 1502*6a54128fSAndroid Build Coastguard Worker case " $hookable_fns " in 1503*6a54128fSAndroid Build Coastguard Worker *" $1 "*) ;; 1504*6a54128fSAndroid Build Coastguard Worker *) func_fatal_error "'$1' does not accept hook functions." ;; 1505*6a54128fSAndroid Build Coastguard Worker esac 1506*6a54128fSAndroid Build Coastguard Worker 1507*6a54128fSAndroid Build Coastguard Worker eval func_append ${1}_hooks '" $2"' 1508*6a54128fSAndroid Build Coastguard Worker} 1509*6a54128fSAndroid Build Coastguard Worker 1510*6a54128fSAndroid Build Coastguard Worker 1511*6a54128fSAndroid Build Coastguard Worker# func_remove_hook FUNC_NAME HOOK_FUNC 1512*6a54128fSAndroid Build Coastguard Worker# ------------------------------------ 1513*6a54128fSAndroid Build Coastguard Worker# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. 1514*6a54128fSAndroid Build Coastguard Workerfunc_remove_hook () 1515*6a54128fSAndroid Build Coastguard Worker{ 1516*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1517*6a54128fSAndroid Build Coastguard Worker 1518*6a54128fSAndroid Build Coastguard Worker eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' 1519*6a54128fSAndroid Build Coastguard Worker} 1520*6a54128fSAndroid Build Coastguard Worker 1521*6a54128fSAndroid Build Coastguard Worker 1522*6a54128fSAndroid Build Coastguard Worker# func_run_hooks FUNC_NAME [ARG]... 1523*6a54128fSAndroid Build Coastguard Worker# --------------------------------- 1524*6a54128fSAndroid Build Coastguard Worker# Run all hook functions registered to FUNC_NAME. 1525*6a54128fSAndroid Build Coastguard Worker# It is assumed that the list of hook functions contains nothing more 1526*6a54128fSAndroid Build Coastguard Worker# than a whitespace-delimited list of legal shell function names, and 1527*6a54128fSAndroid Build Coastguard Worker# no effort is wasted trying to catch shell meta-characters or preserve 1528*6a54128fSAndroid Build Coastguard Worker# whitespace. 1529*6a54128fSAndroid Build Coastguard Workerfunc_run_hooks () 1530*6a54128fSAndroid Build Coastguard Worker{ 1531*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1532*6a54128fSAndroid Build Coastguard Worker 1533*6a54128fSAndroid Build Coastguard Worker _G_rc_run_hooks=false 1534*6a54128fSAndroid Build Coastguard Worker 1535*6a54128fSAndroid Build Coastguard Worker case " $hookable_fns " in 1536*6a54128fSAndroid Build Coastguard Worker *" $1 "*) ;; 1537*6a54128fSAndroid Build Coastguard Worker *) func_fatal_error "'$1' does not support hook funcions.n" ;; 1538*6a54128fSAndroid Build Coastguard Worker esac 1539*6a54128fSAndroid Build Coastguard Worker 1540*6a54128fSAndroid Build Coastguard Worker eval _G_hook_fns=\$$1_hooks; shift 1541*6a54128fSAndroid Build Coastguard Worker 1542*6a54128fSAndroid Build Coastguard Worker for _G_hook in $_G_hook_fns; do 1543*6a54128fSAndroid Build Coastguard Worker if eval $_G_hook '"$@"'; then 1544*6a54128fSAndroid Build Coastguard Worker # store returned options list back into positional 1545*6a54128fSAndroid Build Coastguard Worker # parameters for next 'cmd' execution. 1546*6a54128fSAndroid Build Coastguard Worker eval _G_hook_result=\$${_G_hook}_result 1547*6a54128fSAndroid Build Coastguard Worker eval set dummy "$_G_hook_result"; shift 1548*6a54128fSAndroid Build Coastguard Worker _G_rc_run_hooks=: 1549*6a54128fSAndroid Build Coastguard Worker fi 1550*6a54128fSAndroid Build Coastguard Worker done 1551*6a54128fSAndroid Build Coastguard Worker 1552*6a54128fSAndroid Build Coastguard Worker $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result 1553*6a54128fSAndroid Build Coastguard Worker} 1554*6a54128fSAndroid Build Coastguard Worker 1555*6a54128fSAndroid Build Coastguard Worker 1556*6a54128fSAndroid Build Coastguard Worker 1557*6a54128fSAndroid Build Coastguard Worker## --------------- ## 1558*6a54128fSAndroid Build Coastguard Worker## Option parsing. ## 1559*6a54128fSAndroid Build Coastguard Worker## --------------- ## 1560*6a54128fSAndroid Build Coastguard Worker 1561*6a54128fSAndroid Build Coastguard Worker# In order to add your own option parsing hooks, you must accept the 1562*6a54128fSAndroid Build Coastguard Worker# full positional parameter list in your hook function, you may remove/edit 1563*6a54128fSAndroid Build Coastguard Worker# any options that you action, and then pass back the remaining unprocessed 1564*6a54128fSAndroid Build Coastguard Worker# options in '<hooked_function_name>_result', escaped suitably for 1565*6a54128fSAndroid Build Coastguard Worker# 'eval'. In this case you also must return $EXIT_SUCCESS to let the 1566*6a54128fSAndroid Build Coastguard Worker# hook's caller know that it should pay attention to 1567*6a54128fSAndroid Build Coastguard Worker# '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that 1568*6a54128fSAndroid Build Coastguard Worker# arguments are left untouched by the hook and therefore caller will ignore the 1569*6a54128fSAndroid Build Coastguard Worker# result variable. 1570*6a54128fSAndroid Build Coastguard Worker# 1571*6a54128fSAndroid Build Coastguard Worker# Like this: 1572*6a54128fSAndroid Build Coastguard Worker# 1573*6a54128fSAndroid Build Coastguard Worker# my_options_prep () 1574*6a54128fSAndroid Build Coastguard Worker# { 1575*6a54128fSAndroid Build Coastguard Worker# $debug_cmd 1576*6a54128fSAndroid Build Coastguard Worker# 1577*6a54128fSAndroid Build Coastguard Worker# # Extend the existing usage message. 1578*6a54128fSAndroid Build Coastguard Worker# usage_message=$usage_message' 1579*6a54128fSAndroid Build Coastguard Worker# -s, --silent don'\''t print informational messages 1580*6a54128fSAndroid Build Coastguard Worker# ' 1581*6a54128fSAndroid Build Coastguard Worker# # No change in '$@' (ignored completely by this hook). There is 1582*6a54128fSAndroid Build Coastguard Worker# # no need to do the equivalent (but slower) action: 1583*6a54128fSAndroid Build Coastguard Worker# # func_quote_for_eval ${1+"$@"} 1584*6a54128fSAndroid Build Coastguard Worker# # my_options_prep_result=$func_quote_for_eval_result 1585*6a54128fSAndroid Build Coastguard Worker# false 1586*6a54128fSAndroid Build Coastguard Worker# } 1587*6a54128fSAndroid Build Coastguard Worker# func_add_hook func_options_prep my_options_prep 1588*6a54128fSAndroid Build Coastguard Worker# 1589*6a54128fSAndroid Build Coastguard Worker# 1590*6a54128fSAndroid Build Coastguard Worker# my_silent_option () 1591*6a54128fSAndroid Build Coastguard Worker# { 1592*6a54128fSAndroid Build Coastguard Worker# $debug_cmd 1593*6a54128fSAndroid Build Coastguard Worker# 1594*6a54128fSAndroid Build Coastguard Worker# args_changed=false 1595*6a54128fSAndroid Build Coastguard Worker# 1596*6a54128fSAndroid Build Coastguard Worker# # Note that for efficiency, we parse as many options as we can 1597*6a54128fSAndroid Build Coastguard Worker# # recognise in a loop before passing the remainder back to the 1598*6a54128fSAndroid Build Coastguard Worker# # caller on the first unrecognised argument we encounter. 1599*6a54128fSAndroid Build Coastguard Worker# while test $# -gt 0; do 1600*6a54128fSAndroid Build Coastguard Worker# opt=$1; shift 1601*6a54128fSAndroid Build Coastguard Worker# case $opt in 1602*6a54128fSAndroid Build Coastguard Worker# --silent|-s) opt_silent=: 1603*6a54128fSAndroid Build Coastguard Worker# args_changed=: 1604*6a54128fSAndroid Build Coastguard Worker# ;; 1605*6a54128fSAndroid Build Coastguard Worker# # Separate non-argument short options: 1606*6a54128fSAndroid Build Coastguard Worker# -s*) func_split_short_opt "$_G_opt" 1607*6a54128fSAndroid Build Coastguard Worker# set dummy "$func_split_short_opt_name" \ 1608*6a54128fSAndroid Build Coastguard Worker# "-$func_split_short_opt_arg" ${1+"$@"} 1609*6a54128fSAndroid Build Coastguard Worker# shift 1610*6a54128fSAndroid Build Coastguard Worker# args_changed=: 1611*6a54128fSAndroid Build Coastguard Worker# ;; 1612*6a54128fSAndroid Build Coastguard Worker# *) # Make sure the first unrecognised option "$_G_opt" 1613*6a54128fSAndroid Build Coastguard Worker# # is added back to "$@", we could need that later 1614*6a54128fSAndroid Build Coastguard Worker# # if $args_changed is true. 1615*6a54128fSAndroid Build Coastguard Worker# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; 1616*6a54128fSAndroid Build Coastguard Worker# esac 1617*6a54128fSAndroid Build Coastguard Worker# done 1618*6a54128fSAndroid Build Coastguard Worker# 1619*6a54128fSAndroid Build Coastguard Worker# if $args_changed; then 1620*6a54128fSAndroid Build Coastguard Worker# func_quote_for_eval ${1+"$@"} 1621*6a54128fSAndroid Build Coastguard Worker# my_silent_option_result=$func_quote_for_eval_result 1622*6a54128fSAndroid Build Coastguard Worker# fi 1623*6a54128fSAndroid Build Coastguard Worker# 1624*6a54128fSAndroid Build Coastguard Worker# $args_changed 1625*6a54128fSAndroid Build Coastguard Worker# } 1626*6a54128fSAndroid Build Coastguard Worker# func_add_hook func_parse_options my_silent_option 1627*6a54128fSAndroid Build Coastguard Worker# 1628*6a54128fSAndroid Build Coastguard Worker# 1629*6a54128fSAndroid Build Coastguard Worker# my_option_validation () 1630*6a54128fSAndroid Build Coastguard Worker# { 1631*6a54128fSAndroid Build Coastguard Worker# $debug_cmd 1632*6a54128fSAndroid Build Coastguard Worker# 1633*6a54128fSAndroid Build Coastguard Worker# $opt_silent && $opt_verbose && func_fatal_help "\ 1634*6a54128fSAndroid Build Coastguard Worker# '--silent' and '--verbose' options are mutually exclusive." 1635*6a54128fSAndroid Build Coastguard Worker# 1636*6a54128fSAndroid Build Coastguard Worker# false 1637*6a54128fSAndroid Build Coastguard Worker# } 1638*6a54128fSAndroid Build Coastguard Worker# func_add_hook func_validate_options my_option_validation 1639*6a54128fSAndroid Build Coastguard Worker# 1640*6a54128fSAndroid Build Coastguard Worker# You'll also need to manually amend $usage_message to reflect the extra 1641*6a54128fSAndroid Build Coastguard Worker# options you parse. It's preferable to append if you can, so that 1642*6a54128fSAndroid Build Coastguard Worker# multiple option parsing hooks can be added safely. 1643*6a54128fSAndroid Build Coastguard Worker 1644*6a54128fSAndroid Build Coastguard Worker 1645*6a54128fSAndroid Build Coastguard Worker# func_options_finish [ARG]... 1646*6a54128fSAndroid Build Coastguard Worker# ---------------------------- 1647*6a54128fSAndroid Build Coastguard Worker# Finishing the option parse loop (call 'func_options' hooks ATM). 1648*6a54128fSAndroid Build Coastguard Workerfunc_options_finish () 1649*6a54128fSAndroid Build Coastguard Worker{ 1650*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1651*6a54128fSAndroid Build Coastguard Worker 1652*6a54128fSAndroid Build Coastguard Worker _G_func_options_finish_exit=false 1653*6a54128fSAndroid Build Coastguard Worker if func_run_hooks func_options ${1+"$@"}; then 1654*6a54128fSAndroid Build Coastguard Worker func_options_finish_result=$func_run_hooks_result 1655*6a54128fSAndroid Build Coastguard Worker _G_func_options_finish_exit=: 1656*6a54128fSAndroid Build Coastguard Worker fi 1657*6a54128fSAndroid Build Coastguard Worker 1658*6a54128fSAndroid Build Coastguard Worker $_G_func_options_finish_exit 1659*6a54128fSAndroid Build Coastguard Worker} 1660*6a54128fSAndroid Build Coastguard Worker 1661*6a54128fSAndroid Build Coastguard Worker 1662*6a54128fSAndroid Build Coastguard Worker# func_options [ARG]... 1663*6a54128fSAndroid Build Coastguard Worker# --------------------- 1664*6a54128fSAndroid Build Coastguard Worker# All the functions called inside func_options are hookable. See the 1665*6a54128fSAndroid Build Coastguard Worker# individual implementations for details. 1666*6a54128fSAndroid Build Coastguard Workerfunc_hookable func_options 1667*6a54128fSAndroid Build Coastguard Workerfunc_options () 1668*6a54128fSAndroid Build Coastguard Worker{ 1669*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1670*6a54128fSAndroid Build Coastguard Worker 1671*6a54128fSAndroid Build Coastguard Worker _G_rc_options=false 1672*6a54128fSAndroid Build Coastguard Worker 1673*6a54128fSAndroid Build Coastguard Worker for my_func in options_prep parse_options validate_options options_finish 1674*6a54128fSAndroid Build Coastguard Worker do 1675*6a54128fSAndroid Build Coastguard Worker if eval func_$my_func '${1+"$@"}'; then 1676*6a54128fSAndroid Build Coastguard Worker eval _G_res_var='$'"func_${my_func}_result" 1677*6a54128fSAndroid Build Coastguard Worker eval set dummy "$_G_res_var" ; shift 1678*6a54128fSAndroid Build Coastguard Worker _G_rc_options=: 1679*6a54128fSAndroid Build Coastguard Worker fi 1680*6a54128fSAndroid Build Coastguard Worker done 1681*6a54128fSAndroid Build Coastguard Worker 1682*6a54128fSAndroid Build Coastguard Worker # Save modified positional parameters for caller. As a top-level 1683*6a54128fSAndroid Build Coastguard Worker # options-parser function we always need to set the 'func_options_result' 1684*6a54128fSAndroid Build Coastguard Worker # variable (regardless the $_G_rc_options value). 1685*6a54128fSAndroid Build Coastguard Worker if $_G_rc_options; then 1686*6a54128fSAndroid Build Coastguard Worker func_options_result=$_G_res_var 1687*6a54128fSAndroid Build Coastguard Worker else 1688*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval ${1+"$@"} 1689*6a54128fSAndroid Build Coastguard Worker func_options_result=$func_quote_for_eval_result 1690*6a54128fSAndroid Build Coastguard Worker fi 1691*6a54128fSAndroid Build Coastguard Worker 1692*6a54128fSAndroid Build Coastguard Worker $_G_rc_options 1693*6a54128fSAndroid Build Coastguard Worker} 1694*6a54128fSAndroid Build Coastguard Worker 1695*6a54128fSAndroid Build Coastguard Worker 1696*6a54128fSAndroid Build Coastguard Worker# func_options_prep [ARG]... 1697*6a54128fSAndroid Build Coastguard Worker# -------------------------- 1698*6a54128fSAndroid Build Coastguard Worker# All initialisations required before starting the option parse loop. 1699*6a54128fSAndroid Build Coastguard Worker# Note that when calling hook functions, we pass through the list of 1700*6a54128fSAndroid Build Coastguard Worker# positional parameters. If a hook function modifies that list, and 1701*6a54128fSAndroid Build Coastguard Worker# needs to propagate that back to rest of this script, then the complete 1702*6a54128fSAndroid Build Coastguard Worker# modified list must be put in 'func_run_hooks_result' before 1703*6a54128fSAndroid Build Coastguard Worker# returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned). 1704*6a54128fSAndroid Build Coastguard Workerfunc_hookable func_options_prep 1705*6a54128fSAndroid Build Coastguard Workerfunc_options_prep () 1706*6a54128fSAndroid Build Coastguard Worker{ 1707*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1708*6a54128fSAndroid Build Coastguard Worker 1709*6a54128fSAndroid Build Coastguard Worker # Option defaults: 1710*6a54128fSAndroid Build Coastguard Worker opt_verbose=false 1711*6a54128fSAndroid Build Coastguard Worker opt_warning_types= 1712*6a54128fSAndroid Build Coastguard Worker 1713*6a54128fSAndroid Build Coastguard Worker _G_rc_options_prep=false 1714*6a54128fSAndroid Build Coastguard Worker if func_run_hooks func_options_prep ${1+"$@"}; then 1715*6a54128fSAndroid Build Coastguard Worker _G_rc_options_prep=: 1716*6a54128fSAndroid Build Coastguard Worker # save modified positional parameters for caller 1717*6a54128fSAndroid Build Coastguard Worker func_options_prep_result=$func_run_hooks_result 1718*6a54128fSAndroid Build Coastguard Worker fi 1719*6a54128fSAndroid Build Coastguard Worker 1720*6a54128fSAndroid Build Coastguard Worker $_G_rc_options_prep 1721*6a54128fSAndroid Build Coastguard Worker} 1722*6a54128fSAndroid Build Coastguard Worker 1723*6a54128fSAndroid Build Coastguard Worker 1724*6a54128fSAndroid Build Coastguard Worker# func_parse_options [ARG]... 1725*6a54128fSAndroid Build Coastguard Worker# --------------------------- 1726*6a54128fSAndroid Build Coastguard Worker# The main option parsing loop. 1727*6a54128fSAndroid Build Coastguard Workerfunc_hookable func_parse_options 1728*6a54128fSAndroid Build Coastguard Workerfunc_parse_options () 1729*6a54128fSAndroid Build Coastguard Worker{ 1730*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1731*6a54128fSAndroid Build Coastguard Worker 1732*6a54128fSAndroid Build Coastguard Worker func_parse_options_result= 1733*6a54128fSAndroid Build Coastguard Worker 1734*6a54128fSAndroid Build Coastguard Worker _G_rc_parse_options=false 1735*6a54128fSAndroid Build Coastguard Worker # this just eases exit handling 1736*6a54128fSAndroid Build Coastguard Worker while test $# -gt 0; do 1737*6a54128fSAndroid Build Coastguard Worker # Defer to hook functions for initial option parsing, so they 1738*6a54128fSAndroid Build Coastguard Worker # get priority in the event of reusing an option name. 1739*6a54128fSAndroid Build Coastguard Worker if func_run_hooks func_parse_options ${1+"$@"}; then 1740*6a54128fSAndroid Build Coastguard Worker eval set dummy "$func_run_hooks_result"; shift 1741*6a54128fSAndroid Build Coastguard Worker _G_rc_parse_options=: 1742*6a54128fSAndroid Build Coastguard Worker fi 1743*6a54128fSAndroid Build Coastguard Worker 1744*6a54128fSAndroid Build Coastguard Worker # Break out of the loop if we already parsed every option. 1745*6a54128fSAndroid Build Coastguard Worker test $# -gt 0 || break 1746*6a54128fSAndroid Build Coastguard Worker 1747*6a54128fSAndroid Build Coastguard Worker _G_match_parse_options=: 1748*6a54128fSAndroid Build Coastguard Worker _G_opt=$1 1749*6a54128fSAndroid Build Coastguard Worker shift 1750*6a54128fSAndroid Build Coastguard Worker case $_G_opt in 1751*6a54128fSAndroid Build Coastguard Worker --debug|-x) debug_cmd='set -x' 1752*6a54128fSAndroid Build Coastguard Worker func_echo "enabling shell trace mode" 1753*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1754*6a54128fSAndroid Build Coastguard Worker ;; 1755*6a54128fSAndroid Build Coastguard Worker 1756*6a54128fSAndroid Build Coastguard Worker --no-warnings|--no-warning|--no-warn) 1757*6a54128fSAndroid Build Coastguard Worker set dummy --warnings none ${1+"$@"} 1758*6a54128fSAndroid Build Coastguard Worker shift 1759*6a54128fSAndroid Build Coastguard Worker ;; 1760*6a54128fSAndroid Build Coastguard Worker 1761*6a54128fSAndroid Build Coastguard Worker --warnings|--warning|-W) 1762*6a54128fSAndroid Build Coastguard Worker if test $# = 0 && func_missing_arg $_G_opt; then 1763*6a54128fSAndroid Build Coastguard Worker _G_rc_parse_options=: 1764*6a54128fSAndroid Build Coastguard Worker break 1765*6a54128fSAndroid Build Coastguard Worker fi 1766*6a54128fSAndroid Build Coastguard Worker case " $warning_categories $1" in 1767*6a54128fSAndroid Build Coastguard Worker *" $1 "*) 1768*6a54128fSAndroid Build Coastguard Worker # trailing space prevents matching last $1 above 1769*6a54128fSAndroid Build Coastguard Worker func_append_uniq opt_warning_types " $1" 1770*6a54128fSAndroid Build Coastguard Worker ;; 1771*6a54128fSAndroid Build Coastguard Worker *all) 1772*6a54128fSAndroid Build Coastguard Worker opt_warning_types=$warning_categories 1773*6a54128fSAndroid Build Coastguard Worker ;; 1774*6a54128fSAndroid Build Coastguard Worker *none) 1775*6a54128fSAndroid Build Coastguard Worker opt_warning_types=none 1776*6a54128fSAndroid Build Coastguard Worker warning_func=: 1777*6a54128fSAndroid Build Coastguard Worker ;; 1778*6a54128fSAndroid Build Coastguard Worker *error) 1779*6a54128fSAndroid Build Coastguard Worker opt_warning_types=$warning_categories 1780*6a54128fSAndroid Build Coastguard Worker warning_func=func_fatal_error 1781*6a54128fSAndroid Build Coastguard Worker ;; 1782*6a54128fSAndroid Build Coastguard Worker *) 1783*6a54128fSAndroid Build Coastguard Worker func_fatal_error \ 1784*6a54128fSAndroid Build Coastguard Worker "unsupported warning category: '$1'" 1785*6a54128fSAndroid Build Coastguard Worker ;; 1786*6a54128fSAndroid Build Coastguard Worker esac 1787*6a54128fSAndroid Build Coastguard Worker shift 1788*6a54128fSAndroid Build Coastguard Worker ;; 1789*6a54128fSAndroid Build Coastguard Worker 1790*6a54128fSAndroid Build Coastguard Worker --verbose|-v) opt_verbose=: ;; 1791*6a54128fSAndroid Build Coastguard Worker --version) func_version ;; 1792*6a54128fSAndroid Build Coastguard Worker -\?|-h) func_usage ;; 1793*6a54128fSAndroid Build Coastguard Worker --help) func_help ;; 1794*6a54128fSAndroid Build Coastguard Worker 1795*6a54128fSAndroid Build Coastguard Worker # Separate optargs to long options (plugins may need this): 1796*6a54128fSAndroid Build Coastguard Worker --*=*) func_split_equals "$_G_opt" 1797*6a54128fSAndroid Build Coastguard Worker set dummy "$func_split_equals_lhs" \ 1798*6a54128fSAndroid Build Coastguard Worker "$func_split_equals_rhs" ${1+"$@"} 1799*6a54128fSAndroid Build Coastguard Worker shift 1800*6a54128fSAndroid Build Coastguard Worker ;; 1801*6a54128fSAndroid Build Coastguard Worker 1802*6a54128fSAndroid Build Coastguard Worker # Separate optargs to short options: 1803*6a54128fSAndroid Build Coastguard Worker -W*) 1804*6a54128fSAndroid Build Coastguard Worker func_split_short_opt "$_G_opt" 1805*6a54128fSAndroid Build Coastguard Worker set dummy "$func_split_short_opt_name" \ 1806*6a54128fSAndroid Build Coastguard Worker "$func_split_short_opt_arg" ${1+"$@"} 1807*6a54128fSAndroid Build Coastguard Worker shift 1808*6a54128fSAndroid Build Coastguard Worker ;; 1809*6a54128fSAndroid Build Coastguard Worker 1810*6a54128fSAndroid Build Coastguard Worker # Separate non-argument short options: 1811*6a54128fSAndroid Build Coastguard Worker -\?*|-h*|-v*|-x*) 1812*6a54128fSAndroid Build Coastguard Worker func_split_short_opt "$_G_opt" 1813*6a54128fSAndroid Build Coastguard Worker set dummy "$func_split_short_opt_name" \ 1814*6a54128fSAndroid Build Coastguard Worker "-$func_split_short_opt_arg" ${1+"$@"} 1815*6a54128fSAndroid Build Coastguard Worker shift 1816*6a54128fSAndroid Build Coastguard Worker ;; 1817*6a54128fSAndroid Build Coastguard Worker 1818*6a54128fSAndroid Build Coastguard Worker --) _G_rc_parse_options=: ; break ;; 1819*6a54128fSAndroid Build Coastguard Worker -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; 1820*6a54128fSAndroid Build Coastguard Worker *) set dummy "$_G_opt" ${1+"$@"}; shift 1821*6a54128fSAndroid Build Coastguard Worker _G_match_parse_options=false 1822*6a54128fSAndroid Build Coastguard Worker break 1823*6a54128fSAndroid Build Coastguard Worker ;; 1824*6a54128fSAndroid Build Coastguard Worker esac 1825*6a54128fSAndroid Build Coastguard Worker 1826*6a54128fSAndroid Build Coastguard Worker $_G_match_parse_options && _G_rc_parse_options=: 1827*6a54128fSAndroid Build Coastguard Worker done 1828*6a54128fSAndroid Build Coastguard Worker 1829*6a54128fSAndroid Build Coastguard Worker 1830*6a54128fSAndroid Build Coastguard Worker if $_G_rc_parse_options; then 1831*6a54128fSAndroid Build Coastguard Worker # save modified positional parameters for caller 1832*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval ${1+"$@"} 1833*6a54128fSAndroid Build Coastguard Worker func_parse_options_result=$func_quote_for_eval_result 1834*6a54128fSAndroid Build Coastguard Worker fi 1835*6a54128fSAndroid Build Coastguard Worker 1836*6a54128fSAndroid Build Coastguard Worker $_G_rc_parse_options 1837*6a54128fSAndroid Build Coastguard Worker} 1838*6a54128fSAndroid Build Coastguard Worker 1839*6a54128fSAndroid Build Coastguard Worker 1840*6a54128fSAndroid Build Coastguard Worker# func_validate_options [ARG]... 1841*6a54128fSAndroid Build Coastguard Worker# ------------------------------ 1842*6a54128fSAndroid Build Coastguard Worker# Perform any sanity checks on option settings and/or unconsumed 1843*6a54128fSAndroid Build Coastguard Worker# arguments. 1844*6a54128fSAndroid Build Coastguard Workerfunc_hookable func_validate_options 1845*6a54128fSAndroid Build Coastguard Workerfunc_validate_options () 1846*6a54128fSAndroid Build Coastguard Worker{ 1847*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1848*6a54128fSAndroid Build Coastguard Worker 1849*6a54128fSAndroid Build Coastguard Worker _G_rc_validate_options=false 1850*6a54128fSAndroid Build Coastguard Worker 1851*6a54128fSAndroid Build Coastguard Worker # Display all warnings if -W was not given. 1852*6a54128fSAndroid Build Coastguard Worker test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" 1853*6a54128fSAndroid Build Coastguard Worker 1854*6a54128fSAndroid Build Coastguard Worker if func_run_hooks func_validate_options ${1+"$@"}; then 1855*6a54128fSAndroid Build Coastguard Worker # save modified positional parameters for caller 1856*6a54128fSAndroid Build Coastguard Worker func_validate_options_result=$func_run_hooks_result 1857*6a54128fSAndroid Build Coastguard Worker _G_rc_validate_options=: 1858*6a54128fSAndroid Build Coastguard Worker fi 1859*6a54128fSAndroid Build Coastguard Worker 1860*6a54128fSAndroid Build Coastguard Worker # Bail if the options were screwed! 1861*6a54128fSAndroid Build Coastguard Worker $exit_cmd $EXIT_FAILURE 1862*6a54128fSAndroid Build Coastguard Worker 1863*6a54128fSAndroid Build Coastguard Worker $_G_rc_validate_options 1864*6a54128fSAndroid Build Coastguard Worker} 1865*6a54128fSAndroid Build Coastguard Worker 1866*6a54128fSAndroid Build Coastguard Worker 1867*6a54128fSAndroid Build Coastguard Worker 1868*6a54128fSAndroid Build Coastguard Worker## ----------------- ## 1869*6a54128fSAndroid Build Coastguard Worker## Helper functions. ## 1870*6a54128fSAndroid Build Coastguard Worker## ----------------- ## 1871*6a54128fSAndroid Build Coastguard Worker 1872*6a54128fSAndroid Build Coastguard Worker# This section contains the helper functions used by the rest of the 1873*6a54128fSAndroid Build Coastguard Worker# hookable option parser framework in ascii-betical order. 1874*6a54128fSAndroid Build Coastguard Worker 1875*6a54128fSAndroid Build Coastguard Worker 1876*6a54128fSAndroid Build Coastguard Worker# func_fatal_help ARG... 1877*6a54128fSAndroid Build Coastguard Worker# ---------------------- 1878*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed message to standard error, followed by 1879*6a54128fSAndroid Build Coastguard Worker# a help hint, and exit. 1880*6a54128fSAndroid Build Coastguard Workerfunc_fatal_help () 1881*6a54128fSAndroid Build Coastguard Worker{ 1882*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1883*6a54128fSAndroid Build Coastguard Worker 1884*6a54128fSAndroid Build Coastguard Worker eval \$ECHO \""Usage: $usage"\" 1885*6a54128fSAndroid Build Coastguard Worker eval \$ECHO \""$fatal_help"\" 1886*6a54128fSAndroid Build Coastguard Worker func_error ${1+"$@"} 1887*6a54128fSAndroid Build Coastguard Worker exit $EXIT_FAILURE 1888*6a54128fSAndroid Build Coastguard Worker} 1889*6a54128fSAndroid Build Coastguard Worker 1890*6a54128fSAndroid Build Coastguard Worker 1891*6a54128fSAndroid Build Coastguard Worker# func_help 1892*6a54128fSAndroid Build Coastguard Worker# --------- 1893*6a54128fSAndroid Build Coastguard Worker# Echo long help message to standard output and exit. 1894*6a54128fSAndroid Build Coastguard Workerfunc_help () 1895*6a54128fSAndroid Build Coastguard Worker{ 1896*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1897*6a54128fSAndroid Build Coastguard Worker 1898*6a54128fSAndroid Build Coastguard Worker func_usage_message 1899*6a54128fSAndroid Build Coastguard Worker $ECHO "$long_help_message" 1900*6a54128fSAndroid Build Coastguard Worker exit 0 1901*6a54128fSAndroid Build Coastguard Worker} 1902*6a54128fSAndroid Build Coastguard Worker 1903*6a54128fSAndroid Build Coastguard Worker 1904*6a54128fSAndroid Build Coastguard Worker# func_missing_arg ARGNAME 1905*6a54128fSAndroid Build Coastguard Worker# ------------------------ 1906*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed message to standard error and set global 1907*6a54128fSAndroid Build Coastguard Worker# exit_cmd. 1908*6a54128fSAndroid Build Coastguard Workerfunc_missing_arg () 1909*6a54128fSAndroid Build Coastguard Worker{ 1910*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1911*6a54128fSAndroid Build Coastguard Worker 1912*6a54128fSAndroid Build Coastguard Worker func_error "Missing argument for '$1'." 1913*6a54128fSAndroid Build Coastguard Worker exit_cmd=exit 1914*6a54128fSAndroid Build Coastguard Worker} 1915*6a54128fSAndroid Build Coastguard Worker 1916*6a54128fSAndroid Build Coastguard Worker 1917*6a54128fSAndroid Build Coastguard Worker# func_split_equals STRING 1918*6a54128fSAndroid Build Coastguard Worker# ------------------------ 1919*6a54128fSAndroid Build Coastguard Worker# Set func_split_equals_lhs and func_split_equals_rhs shell variables after 1920*6a54128fSAndroid Build Coastguard Worker# splitting STRING at the '=' sign. 1921*6a54128fSAndroid Build Coastguard Workertest -z "$_G_HAVE_XSI_OPS" \ 1922*6a54128fSAndroid Build Coastguard Worker && (eval 'x=a/b/c; 1923*6a54128fSAndroid Build Coastguard Worker test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ 1924*6a54128fSAndroid Build Coastguard Worker && _G_HAVE_XSI_OPS=yes 1925*6a54128fSAndroid Build Coastguard Worker 1926*6a54128fSAndroid Build Coastguard Workerif test yes = "$_G_HAVE_XSI_OPS" 1927*6a54128fSAndroid Build Coastguard Workerthen 1928*6a54128fSAndroid Build Coastguard Worker # This is an XSI compatible shell, allowing a faster implementation... 1929*6a54128fSAndroid Build Coastguard Worker eval 'func_split_equals () 1930*6a54128fSAndroid Build Coastguard Worker { 1931*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1932*6a54128fSAndroid Build Coastguard Worker 1933*6a54128fSAndroid Build Coastguard Worker func_split_equals_lhs=${1%%=*} 1934*6a54128fSAndroid Build Coastguard Worker func_split_equals_rhs=${1#*=} 1935*6a54128fSAndroid Build Coastguard Worker test "x$func_split_equals_lhs" = "x$1" \ 1936*6a54128fSAndroid Build Coastguard Worker && func_split_equals_rhs= 1937*6a54128fSAndroid Build Coastguard Worker }' 1938*6a54128fSAndroid Build Coastguard Workerelse 1939*6a54128fSAndroid Build Coastguard Worker # ...otherwise fall back to using expr, which is often a shell builtin. 1940*6a54128fSAndroid Build Coastguard Worker func_split_equals () 1941*6a54128fSAndroid Build Coastguard Worker { 1942*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1943*6a54128fSAndroid Build Coastguard Worker 1944*6a54128fSAndroid Build Coastguard Worker func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` 1945*6a54128fSAndroid Build Coastguard Worker func_split_equals_rhs= 1946*6a54128fSAndroid Build Coastguard Worker test "x$func_split_equals_lhs" = "x$1" \ 1947*6a54128fSAndroid Build Coastguard Worker || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` 1948*6a54128fSAndroid Build Coastguard Worker } 1949*6a54128fSAndroid Build Coastguard Workerfi #func_split_equals 1950*6a54128fSAndroid Build Coastguard Worker 1951*6a54128fSAndroid Build Coastguard Worker 1952*6a54128fSAndroid Build Coastguard Worker# func_split_short_opt SHORTOPT 1953*6a54128fSAndroid Build Coastguard Worker# ----------------------------- 1954*6a54128fSAndroid Build Coastguard Worker# Set func_split_short_opt_name and func_split_short_opt_arg shell 1955*6a54128fSAndroid Build Coastguard Worker# variables after splitting SHORTOPT after the 2nd character. 1956*6a54128fSAndroid Build Coastguard Workerif test yes = "$_G_HAVE_XSI_OPS" 1957*6a54128fSAndroid Build Coastguard Workerthen 1958*6a54128fSAndroid Build Coastguard Worker # This is an XSI compatible shell, allowing a faster implementation... 1959*6a54128fSAndroid Build Coastguard Worker eval 'func_split_short_opt () 1960*6a54128fSAndroid Build Coastguard Worker { 1961*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1962*6a54128fSAndroid Build Coastguard Worker 1963*6a54128fSAndroid Build Coastguard Worker func_split_short_opt_arg=${1#??} 1964*6a54128fSAndroid Build Coastguard Worker func_split_short_opt_name=${1%"$func_split_short_opt_arg"} 1965*6a54128fSAndroid Build Coastguard Worker }' 1966*6a54128fSAndroid Build Coastguard Workerelse 1967*6a54128fSAndroid Build Coastguard Worker # ...otherwise fall back to using expr, which is often a shell builtin. 1968*6a54128fSAndroid Build Coastguard Worker func_split_short_opt () 1969*6a54128fSAndroid Build Coastguard Worker { 1970*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1971*6a54128fSAndroid Build Coastguard Worker 1972*6a54128fSAndroid Build Coastguard Worker func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` 1973*6a54128fSAndroid Build Coastguard Worker func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` 1974*6a54128fSAndroid Build Coastguard Worker } 1975*6a54128fSAndroid Build Coastguard Workerfi #func_split_short_opt 1976*6a54128fSAndroid Build Coastguard Worker 1977*6a54128fSAndroid Build Coastguard Worker 1978*6a54128fSAndroid Build Coastguard Worker# func_usage 1979*6a54128fSAndroid Build Coastguard Worker# ---------- 1980*6a54128fSAndroid Build Coastguard Worker# Echo short help message to standard output and exit. 1981*6a54128fSAndroid Build Coastguard Workerfunc_usage () 1982*6a54128fSAndroid Build Coastguard Worker{ 1983*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1984*6a54128fSAndroid Build Coastguard Worker 1985*6a54128fSAndroid Build Coastguard Worker func_usage_message 1986*6a54128fSAndroid Build Coastguard Worker $ECHO "Run '$progname --help |${PAGER-more}' for full usage" 1987*6a54128fSAndroid Build Coastguard Worker exit 0 1988*6a54128fSAndroid Build Coastguard Worker} 1989*6a54128fSAndroid Build Coastguard Worker 1990*6a54128fSAndroid Build Coastguard Worker 1991*6a54128fSAndroid Build Coastguard Worker# func_usage_message 1992*6a54128fSAndroid Build Coastguard Worker# ------------------ 1993*6a54128fSAndroid Build Coastguard Worker# Echo short help message to standard output. 1994*6a54128fSAndroid Build Coastguard Workerfunc_usage_message () 1995*6a54128fSAndroid Build Coastguard Worker{ 1996*6a54128fSAndroid Build Coastguard Worker $debug_cmd 1997*6a54128fSAndroid Build Coastguard Worker 1998*6a54128fSAndroid Build Coastguard Worker eval \$ECHO \""Usage: $usage"\" 1999*6a54128fSAndroid Build Coastguard Worker echo 2000*6a54128fSAndroid Build Coastguard Worker $SED -n 's|^# || 2001*6a54128fSAndroid Build Coastguard Worker /^Written by/{ 2002*6a54128fSAndroid Build Coastguard Worker x;p;x 2003*6a54128fSAndroid Build Coastguard Worker } 2004*6a54128fSAndroid Build Coastguard Worker h 2005*6a54128fSAndroid Build Coastguard Worker /^Written by/q' < "$progpath" 2006*6a54128fSAndroid Build Coastguard Worker echo 2007*6a54128fSAndroid Build Coastguard Worker eval \$ECHO \""$usage_message"\" 2008*6a54128fSAndroid Build Coastguard Worker} 2009*6a54128fSAndroid Build Coastguard Worker 2010*6a54128fSAndroid Build Coastguard Worker 2011*6a54128fSAndroid Build Coastguard Worker# func_version 2012*6a54128fSAndroid Build Coastguard Worker# ------------ 2013*6a54128fSAndroid Build Coastguard Worker# Echo version message to standard output and exit. 2014*6a54128fSAndroid Build Coastguard Workerfunc_version () 2015*6a54128fSAndroid Build Coastguard Worker{ 2016*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2017*6a54128fSAndroid Build Coastguard Worker 2018*6a54128fSAndroid Build Coastguard Worker printf '%s\n' "$progname $scriptversion" 2019*6a54128fSAndroid Build Coastguard Worker $SED -n ' 2020*6a54128fSAndroid Build Coastguard Worker /(C)/!b go 2021*6a54128fSAndroid Build Coastguard Worker :more 2022*6a54128fSAndroid Build Coastguard Worker /\./!{ 2023*6a54128fSAndroid Build Coastguard Worker N 2024*6a54128fSAndroid Build Coastguard Worker s|\n# | | 2025*6a54128fSAndroid Build Coastguard Worker b more 2026*6a54128fSAndroid Build Coastguard Worker } 2027*6a54128fSAndroid Build Coastguard Worker :go 2028*6a54128fSAndroid Build Coastguard Worker /^# Written by /,/# warranty; / { 2029*6a54128fSAndroid Build Coastguard Worker s|^# || 2030*6a54128fSAndroid Build Coastguard Worker s|^# *$|| 2031*6a54128fSAndroid Build Coastguard Worker s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| 2032*6a54128fSAndroid Build Coastguard Worker p 2033*6a54128fSAndroid Build Coastguard Worker } 2034*6a54128fSAndroid Build Coastguard Worker /^# Written by / { 2035*6a54128fSAndroid Build Coastguard Worker s|^# || 2036*6a54128fSAndroid Build Coastguard Worker p 2037*6a54128fSAndroid Build Coastguard Worker } 2038*6a54128fSAndroid Build Coastguard Worker /^warranty; /q' < "$progpath" 2039*6a54128fSAndroid Build Coastguard Worker 2040*6a54128fSAndroid Build Coastguard Worker exit $? 2041*6a54128fSAndroid Build Coastguard Worker} 2042*6a54128fSAndroid Build Coastguard Worker 2043*6a54128fSAndroid Build Coastguard Worker 2044*6a54128fSAndroid Build Coastguard Worker# Local variables: 2045*6a54128fSAndroid Build Coastguard Worker# mode: shell-script 2046*6a54128fSAndroid Build Coastguard Worker# sh-indentation: 2 2047*6a54128fSAndroid Build Coastguard Worker# eval: (add-hook 'before-save-hook 'time-stamp) 2048*6a54128fSAndroid Build Coastguard Worker# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" 2049*6a54128fSAndroid Build Coastguard Worker# time-stamp-time-zone: "UTC" 2050*6a54128fSAndroid Build Coastguard Worker# End: 2051*6a54128fSAndroid Build Coastguard Worker 2052*6a54128fSAndroid Build Coastguard Worker# Set a version string. 2053*6a54128fSAndroid Build Coastguard Workerscriptversion='(GNU libtool) 2.4.6' 2054*6a54128fSAndroid Build Coastguard Worker 2055*6a54128fSAndroid Build Coastguard Worker 2056*6a54128fSAndroid Build Coastguard Worker# func_echo ARG... 2057*6a54128fSAndroid Build Coastguard Worker# ---------------- 2058*6a54128fSAndroid Build Coastguard Worker# Libtool also displays the current mode in messages, so override 2059*6a54128fSAndroid Build Coastguard Worker# funclib.sh func_echo with this custom definition. 2060*6a54128fSAndroid Build Coastguard Workerfunc_echo () 2061*6a54128fSAndroid Build Coastguard Worker{ 2062*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2063*6a54128fSAndroid Build Coastguard Worker 2064*6a54128fSAndroid Build Coastguard Worker _G_message=$* 2065*6a54128fSAndroid Build Coastguard Worker 2066*6a54128fSAndroid Build Coastguard Worker func_echo_IFS=$IFS 2067*6a54128fSAndroid Build Coastguard Worker IFS=$nl 2068*6a54128fSAndroid Build Coastguard Worker for _G_line in $_G_message; do 2069*6a54128fSAndroid Build Coastguard Worker IFS=$func_echo_IFS 2070*6a54128fSAndroid Build Coastguard Worker $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" 2071*6a54128fSAndroid Build Coastguard Worker done 2072*6a54128fSAndroid Build Coastguard Worker IFS=$func_echo_IFS 2073*6a54128fSAndroid Build Coastguard Worker} 2074*6a54128fSAndroid Build Coastguard Worker 2075*6a54128fSAndroid Build Coastguard Worker 2076*6a54128fSAndroid Build Coastguard Worker# func_warning ARG... 2077*6a54128fSAndroid Build Coastguard Worker# ------------------- 2078*6a54128fSAndroid Build Coastguard Worker# Libtool warnings are not categorized, so override funclib.sh 2079*6a54128fSAndroid Build Coastguard Worker# func_warning with this simpler definition. 2080*6a54128fSAndroid Build Coastguard Workerfunc_warning () 2081*6a54128fSAndroid Build Coastguard Worker{ 2082*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2083*6a54128fSAndroid Build Coastguard Worker 2084*6a54128fSAndroid Build Coastguard Worker $warning_func ${1+"$@"} 2085*6a54128fSAndroid Build Coastguard Worker} 2086*6a54128fSAndroid Build Coastguard Worker 2087*6a54128fSAndroid Build Coastguard Worker 2088*6a54128fSAndroid Build Coastguard Worker## ---------------- ## 2089*6a54128fSAndroid Build Coastguard Worker## Options parsing. ## 2090*6a54128fSAndroid Build Coastguard Worker## ---------------- ## 2091*6a54128fSAndroid Build Coastguard Worker 2092*6a54128fSAndroid Build Coastguard Worker# Hook in the functions to make sure our own options are parsed during 2093*6a54128fSAndroid Build Coastguard Worker# the option parsing loop. 2094*6a54128fSAndroid Build Coastguard Worker 2095*6a54128fSAndroid Build Coastguard Workerusage='$progpath [OPTION]... [MODE-ARG]...' 2096*6a54128fSAndroid Build Coastguard Worker 2097*6a54128fSAndroid Build Coastguard Worker# Short help message in response to '-h'. 2098*6a54128fSAndroid Build Coastguard Workerusage_message="Options: 2099*6a54128fSAndroid Build Coastguard Worker --config show all configuration variables 2100*6a54128fSAndroid Build Coastguard Worker --debug enable verbose shell tracing 2101*6a54128fSAndroid Build Coastguard Worker -n, --dry-run display commands without modifying any files 2102*6a54128fSAndroid Build Coastguard Worker --features display basic configuration information and exit 2103*6a54128fSAndroid Build Coastguard Worker --mode=MODE use operation mode MODE 2104*6a54128fSAndroid Build Coastguard Worker --no-warnings equivalent to '-Wnone' 2105*6a54128fSAndroid Build Coastguard Worker --preserve-dup-deps don't remove duplicate dependency libraries 2106*6a54128fSAndroid Build Coastguard Worker --quiet, --silent don't print informational messages 2107*6a54128fSAndroid Build Coastguard Worker --tag=TAG use configuration variables from tag TAG 2108*6a54128fSAndroid Build Coastguard Worker -v, --verbose print more informational messages than default 2109*6a54128fSAndroid Build Coastguard Worker --version print version information 2110*6a54128fSAndroid Build Coastguard Worker -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] 2111*6a54128fSAndroid Build Coastguard Worker -h, --help, --help-all print short, long, or detailed help message 2112*6a54128fSAndroid Build Coastguard Worker" 2113*6a54128fSAndroid Build Coastguard Worker 2114*6a54128fSAndroid Build Coastguard Worker# Additional text appended to 'usage_message' in response to '--help'. 2115*6a54128fSAndroid Build Coastguard Workerfunc_help () 2116*6a54128fSAndroid Build Coastguard Worker{ 2117*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2118*6a54128fSAndroid Build Coastguard Worker 2119*6a54128fSAndroid Build Coastguard Worker func_usage_message 2120*6a54128fSAndroid Build Coastguard Worker $ECHO "$long_help_message 2121*6a54128fSAndroid Build Coastguard Worker 2122*6a54128fSAndroid Build Coastguard WorkerMODE must be one of the following: 2123*6a54128fSAndroid Build Coastguard Worker 2124*6a54128fSAndroid Build Coastguard Worker clean remove files from the build directory 2125*6a54128fSAndroid Build Coastguard Worker compile compile a source file into a libtool object 2126*6a54128fSAndroid Build Coastguard Worker execute automatically set library path, then run a program 2127*6a54128fSAndroid Build Coastguard Worker finish complete the installation of libtool libraries 2128*6a54128fSAndroid Build Coastguard Worker install install libraries or executables 2129*6a54128fSAndroid Build Coastguard Worker link create a library or an executable 2130*6a54128fSAndroid Build Coastguard Worker uninstall remove libraries from an installed directory 2131*6a54128fSAndroid Build Coastguard Worker 2132*6a54128fSAndroid Build Coastguard WorkerMODE-ARGS vary depending on the MODE. When passed as first option, 2133*6a54128fSAndroid Build Coastguard Worker'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. 2134*6a54128fSAndroid Build Coastguard WorkerTry '$progname --help --mode=MODE' for a more detailed description of MODE. 2135*6a54128fSAndroid Build Coastguard Worker 2136*6a54128fSAndroid Build Coastguard WorkerWhen reporting a bug, please describe a test case to reproduce it and 2137*6a54128fSAndroid Build Coastguard Workerinclude the following information: 2138*6a54128fSAndroid Build Coastguard Worker 2139*6a54128fSAndroid Build Coastguard Worker host-triplet: $host 2140*6a54128fSAndroid Build Coastguard Worker shell: $SHELL 2141*6a54128fSAndroid Build Coastguard Worker compiler: $LTCC 2142*6a54128fSAndroid Build Coastguard Worker compiler flags: $LTCFLAGS 2143*6a54128fSAndroid Build Coastguard Worker linker: $LD (gnu? $with_gnu_ld) 2144*6a54128fSAndroid Build Coastguard Worker version: $progname $scriptversion Debian-2.4.6-9 2145*6a54128fSAndroid Build Coastguard Worker automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` 2146*6a54128fSAndroid Build Coastguard Worker autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` 2147*6a54128fSAndroid Build Coastguard Worker 2148*6a54128fSAndroid Build Coastguard WorkerReport bugs to <[email protected]>. 2149*6a54128fSAndroid Build Coastguard WorkerGNU libtool home page: <http://www.gnu.org/s/libtool/>. 2150*6a54128fSAndroid Build Coastguard WorkerGeneral help using GNU software: <http://www.gnu.org/gethelp/>." 2151*6a54128fSAndroid Build Coastguard Worker exit 0 2152*6a54128fSAndroid Build Coastguard Worker} 2153*6a54128fSAndroid Build Coastguard Worker 2154*6a54128fSAndroid Build Coastguard Worker 2155*6a54128fSAndroid Build Coastguard Worker# func_lo2o OBJECT-NAME 2156*6a54128fSAndroid Build Coastguard Worker# --------------------- 2157*6a54128fSAndroid Build Coastguard Worker# Transform OBJECT-NAME from a '.lo' suffix to the platform specific 2158*6a54128fSAndroid Build Coastguard Worker# object suffix. 2159*6a54128fSAndroid Build Coastguard Worker 2160*6a54128fSAndroid Build Coastguard Workerlo2o=s/\\.lo\$/.$objext/ 2161*6a54128fSAndroid Build Coastguard Workero2lo=s/\\.$objext\$/.lo/ 2162*6a54128fSAndroid Build Coastguard Worker 2163*6a54128fSAndroid Build Coastguard Workerif test yes = "$_G_HAVE_XSI_OPS"; then 2164*6a54128fSAndroid Build Coastguard Worker eval 'func_lo2o () 2165*6a54128fSAndroid Build Coastguard Worker { 2166*6a54128fSAndroid Build Coastguard Worker case $1 in 2167*6a54128fSAndroid Build Coastguard Worker *.lo) func_lo2o_result=${1%.lo}.$objext ;; 2168*6a54128fSAndroid Build Coastguard Worker * ) func_lo2o_result=$1 ;; 2169*6a54128fSAndroid Build Coastguard Worker esac 2170*6a54128fSAndroid Build Coastguard Worker }' 2171*6a54128fSAndroid Build Coastguard Worker 2172*6a54128fSAndroid Build Coastguard Worker # func_xform LIBOBJ-OR-SOURCE 2173*6a54128fSAndroid Build Coastguard Worker # --------------------------- 2174*6a54128fSAndroid Build Coastguard Worker # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) 2175*6a54128fSAndroid Build Coastguard Worker # suffix to a '.lo' libtool-object suffix. 2176*6a54128fSAndroid Build Coastguard Worker eval 'func_xform () 2177*6a54128fSAndroid Build Coastguard Worker { 2178*6a54128fSAndroid Build Coastguard Worker func_xform_result=${1%.*}.lo 2179*6a54128fSAndroid Build Coastguard Worker }' 2180*6a54128fSAndroid Build Coastguard Workerelse 2181*6a54128fSAndroid Build Coastguard Worker # ...otherwise fall back to using sed. 2182*6a54128fSAndroid Build Coastguard Worker func_lo2o () 2183*6a54128fSAndroid Build Coastguard Worker { 2184*6a54128fSAndroid Build Coastguard Worker func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` 2185*6a54128fSAndroid Build Coastguard Worker } 2186*6a54128fSAndroid Build Coastguard Worker 2187*6a54128fSAndroid Build Coastguard Worker func_xform () 2188*6a54128fSAndroid Build Coastguard Worker { 2189*6a54128fSAndroid Build Coastguard Worker func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` 2190*6a54128fSAndroid Build Coastguard Worker } 2191*6a54128fSAndroid Build Coastguard Workerfi 2192*6a54128fSAndroid Build Coastguard Worker 2193*6a54128fSAndroid Build Coastguard Worker 2194*6a54128fSAndroid Build Coastguard Worker# func_fatal_configuration ARG... 2195*6a54128fSAndroid Build Coastguard Worker# ------------------------------- 2196*6a54128fSAndroid Build Coastguard Worker# Echo program name prefixed message to standard error, followed by 2197*6a54128fSAndroid Build Coastguard Worker# a configuration failure hint, and exit. 2198*6a54128fSAndroid Build Coastguard Workerfunc_fatal_configuration () 2199*6a54128fSAndroid Build Coastguard Worker{ 2200*6a54128fSAndroid Build Coastguard Worker func__fatal_error ${1+"$@"} \ 2201*6a54128fSAndroid Build Coastguard Worker "See the $PACKAGE documentation for more information." \ 2202*6a54128fSAndroid Build Coastguard Worker "Fatal configuration error." 2203*6a54128fSAndroid Build Coastguard Worker} 2204*6a54128fSAndroid Build Coastguard Worker 2205*6a54128fSAndroid Build Coastguard Worker 2206*6a54128fSAndroid Build Coastguard Worker# func_config 2207*6a54128fSAndroid Build Coastguard Worker# ----------- 2208*6a54128fSAndroid Build Coastguard Worker# Display the configuration for all the tags in this script. 2209*6a54128fSAndroid Build Coastguard Workerfunc_config () 2210*6a54128fSAndroid Build Coastguard Worker{ 2211*6a54128fSAndroid Build Coastguard Worker re_begincf='^# ### BEGIN LIBTOOL' 2212*6a54128fSAndroid Build Coastguard Worker re_endcf='^# ### END LIBTOOL' 2213*6a54128fSAndroid Build Coastguard Worker 2214*6a54128fSAndroid Build Coastguard Worker # Default configuration. 2215*6a54128fSAndroid Build Coastguard Worker $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" 2216*6a54128fSAndroid Build Coastguard Worker 2217*6a54128fSAndroid Build Coastguard Worker # Now print the configurations for the tags. 2218*6a54128fSAndroid Build Coastguard Worker for tagname in $taglist; do 2219*6a54128fSAndroid Build Coastguard Worker $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" 2220*6a54128fSAndroid Build Coastguard Worker done 2221*6a54128fSAndroid Build Coastguard Worker 2222*6a54128fSAndroid Build Coastguard Worker exit $? 2223*6a54128fSAndroid Build Coastguard Worker} 2224*6a54128fSAndroid Build Coastguard Worker 2225*6a54128fSAndroid Build Coastguard Worker 2226*6a54128fSAndroid Build Coastguard Worker# func_features 2227*6a54128fSAndroid Build Coastguard Worker# ------------- 2228*6a54128fSAndroid Build Coastguard Worker# Display the features supported by this script. 2229*6a54128fSAndroid Build Coastguard Workerfunc_features () 2230*6a54128fSAndroid Build Coastguard Worker{ 2231*6a54128fSAndroid Build Coastguard Worker echo "host: $host" 2232*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_libs"; then 2233*6a54128fSAndroid Build Coastguard Worker echo "enable shared libraries" 2234*6a54128fSAndroid Build Coastguard Worker else 2235*6a54128fSAndroid Build Coastguard Worker echo "disable shared libraries" 2236*6a54128fSAndroid Build Coastguard Worker fi 2237*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_old_libs"; then 2238*6a54128fSAndroid Build Coastguard Worker echo "enable static libraries" 2239*6a54128fSAndroid Build Coastguard Worker else 2240*6a54128fSAndroid Build Coastguard Worker echo "disable static libraries" 2241*6a54128fSAndroid Build Coastguard Worker fi 2242*6a54128fSAndroid Build Coastguard Worker 2243*6a54128fSAndroid Build Coastguard Worker exit $? 2244*6a54128fSAndroid Build Coastguard Worker} 2245*6a54128fSAndroid Build Coastguard Worker 2246*6a54128fSAndroid Build Coastguard Worker 2247*6a54128fSAndroid Build Coastguard Worker# func_enable_tag TAGNAME 2248*6a54128fSAndroid Build Coastguard Worker# ----------------------- 2249*6a54128fSAndroid Build Coastguard Worker# Verify that TAGNAME is valid, and either flag an error and exit, or 2250*6a54128fSAndroid Build Coastguard Worker# enable the TAGNAME tag. We also add TAGNAME to the global $taglist 2251*6a54128fSAndroid Build Coastguard Worker# variable here. 2252*6a54128fSAndroid Build Coastguard Workerfunc_enable_tag () 2253*6a54128fSAndroid Build Coastguard Worker{ 2254*6a54128fSAndroid Build Coastguard Worker # Global variable: 2255*6a54128fSAndroid Build Coastguard Worker tagname=$1 2256*6a54128fSAndroid Build Coastguard Worker 2257*6a54128fSAndroid Build Coastguard Worker re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" 2258*6a54128fSAndroid Build Coastguard Worker re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" 2259*6a54128fSAndroid Build Coastguard Worker sed_extractcf=/$re_begincf/,/$re_endcf/p 2260*6a54128fSAndroid Build Coastguard Worker 2261*6a54128fSAndroid Build Coastguard Worker # Validate tagname. 2262*6a54128fSAndroid Build Coastguard Worker case $tagname in 2263*6a54128fSAndroid Build Coastguard Worker *[!-_A-Za-z0-9,/]*) 2264*6a54128fSAndroid Build Coastguard Worker func_fatal_error "invalid tag name: $tagname" 2265*6a54128fSAndroid Build Coastguard Worker ;; 2266*6a54128fSAndroid Build Coastguard Worker esac 2267*6a54128fSAndroid Build Coastguard Worker 2268*6a54128fSAndroid Build Coastguard Worker # Don't test for the "default" C tag, as we know it's 2269*6a54128fSAndroid Build Coastguard Worker # there but not specially marked. 2270*6a54128fSAndroid Build Coastguard Worker case $tagname in 2271*6a54128fSAndroid Build Coastguard Worker CC) ;; 2272*6a54128fSAndroid Build Coastguard Worker *) 2273*6a54128fSAndroid Build Coastguard Worker if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then 2274*6a54128fSAndroid Build Coastguard Worker taglist="$taglist $tagname" 2275*6a54128fSAndroid Build Coastguard Worker 2276*6a54128fSAndroid Build Coastguard Worker # Evaluate the configuration. Be careful to quote the path 2277*6a54128fSAndroid Build Coastguard Worker # and the sed script, to avoid splitting on whitespace, but 2278*6a54128fSAndroid Build Coastguard Worker # also don't use non-portable quotes within backquotes within 2279*6a54128fSAndroid Build Coastguard Worker # quotes we have to do it in 2 steps: 2280*6a54128fSAndroid Build Coastguard Worker extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` 2281*6a54128fSAndroid Build Coastguard Worker eval "$extractedcf" 2282*6a54128fSAndroid Build Coastguard Worker else 2283*6a54128fSAndroid Build Coastguard Worker func_error "ignoring unknown tag $tagname" 2284*6a54128fSAndroid Build Coastguard Worker fi 2285*6a54128fSAndroid Build Coastguard Worker ;; 2286*6a54128fSAndroid Build Coastguard Worker esac 2287*6a54128fSAndroid Build Coastguard Worker} 2288*6a54128fSAndroid Build Coastguard Worker 2289*6a54128fSAndroid Build Coastguard Worker 2290*6a54128fSAndroid Build Coastguard Worker# func_check_version_match 2291*6a54128fSAndroid Build Coastguard Worker# ------------------------ 2292*6a54128fSAndroid Build Coastguard Worker# Ensure that we are using m4 macros, and libtool script from the same 2293*6a54128fSAndroid Build Coastguard Worker# release of libtool. 2294*6a54128fSAndroid Build Coastguard Workerfunc_check_version_match () 2295*6a54128fSAndroid Build Coastguard Worker{ 2296*6a54128fSAndroid Build Coastguard Worker if test "$package_revision" != "$macro_revision"; then 2297*6a54128fSAndroid Build Coastguard Worker if test "$VERSION" != "$macro_version"; then 2298*6a54128fSAndroid Build Coastguard Worker if test -z "$macro_version"; then 2299*6a54128fSAndroid Build Coastguard Worker cat >&2 <<_LT_EOF 2300*6a54128fSAndroid Build Coastguard Worker$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 2301*6a54128fSAndroid Build Coastguard Worker$progname: definition of this LT_INIT comes from an older release. 2302*6a54128fSAndroid Build Coastguard Worker$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 2303*6a54128fSAndroid Build Coastguard Worker$progname: and run autoconf again. 2304*6a54128fSAndroid Build Coastguard Worker_LT_EOF 2305*6a54128fSAndroid Build Coastguard Worker else 2306*6a54128fSAndroid Build Coastguard Worker cat >&2 <<_LT_EOF 2307*6a54128fSAndroid Build Coastguard Worker$progname: Version mismatch error. This is $PACKAGE $VERSION, but the 2308*6a54128fSAndroid Build Coastguard Worker$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. 2309*6a54128fSAndroid Build Coastguard Worker$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION 2310*6a54128fSAndroid Build Coastguard Worker$progname: and run autoconf again. 2311*6a54128fSAndroid Build Coastguard Worker_LT_EOF 2312*6a54128fSAndroid Build Coastguard Worker fi 2313*6a54128fSAndroid Build Coastguard Worker else 2314*6a54128fSAndroid Build Coastguard Worker cat >&2 <<_LT_EOF 2315*6a54128fSAndroid Build Coastguard Worker$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, 2316*6a54128fSAndroid Build Coastguard Worker$progname: but the definition of this LT_INIT comes from revision $macro_revision. 2317*6a54128fSAndroid Build Coastguard Worker$progname: You should recreate aclocal.m4 with macros from revision $package_revision 2318*6a54128fSAndroid Build Coastguard Worker$progname: of $PACKAGE $VERSION and run autoconf again. 2319*6a54128fSAndroid Build Coastguard Worker_LT_EOF 2320*6a54128fSAndroid Build Coastguard Worker fi 2321*6a54128fSAndroid Build Coastguard Worker 2322*6a54128fSAndroid Build Coastguard Worker exit $EXIT_MISMATCH 2323*6a54128fSAndroid Build Coastguard Worker fi 2324*6a54128fSAndroid Build Coastguard Worker} 2325*6a54128fSAndroid Build Coastguard Worker 2326*6a54128fSAndroid Build Coastguard Worker 2327*6a54128fSAndroid Build Coastguard Worker# libtool_options_prep [ARG]... 2328*6a54128fSAndroid Build Coastguard Worker# ----------------------------- 2329*6a54128fSAndroid Build Coastguard Worker# Preparation for options parsed by libtool. 2330*6a54128fSAndroid Build Coastguard Workerlibtool_options_prep () 2331*6a54128fSAndroid Build Coastguard Worker{ 2332*6a54128fSAndroid Build Coastguard Worker $debug_mode 2333*6a54128fSAndroid Build Coastguard Worker 2334*6a54128fSAndroid Build Coastguard Worker # Option defaults: 2335*6a54128fSAndroid Build Coastguard Worker opt_config=false 2336*6a54128fSAndroid Build Coastguard Worker opt_dlopen= 2337*6a54128fSAndroid Build Coastguard Worker opt_dry_run=false 2338*6a54128fSAndroid Build Coastguard Worker opt_help=false 2339*6a54128fSAndroid Build Coastguard Worker opt_mode= 2340*6a54128fSAndroid Build Coastguard Worker opt_preserve_dup_deps=false 2341*6a54128fSAndroid Build Coastguard Worker opt_quiet=false 2342*6a54128fSAndroid Build Coastguard Worker 2343*6a54128fSAndroid Build Coastguard Worker nonopt= 2344*6a54128fSAndroid Build Coastguard Worker preserve_args= 2345*6a54128fSAndroid Build Coastguard Worker 2346*6a54128fSAndroid Build Coastguard Worker _G_rc_lt_options_prep=: 2347*6a54128fSAndroid Build Coastguard Worker 2348*6a54128fSAndroid Build Coastguard Worker # Shorthand for --mode=foo, only valid as the first argument 2349*6a54128fSAndroid Build Coastguard Worker case $1 in 2350*6a54128fSAndroid Build Coastguard Worker clean|clea|cle|cl) 2351*6a54128fSAndroid Build Coastguard Worker shift; set dummy --mode clean ${1+"$@"}; shift 2352*6a54128fSAndroid Build Coastguard Worker ;; 2353*6a54128fSAndroid Build Coastguard Worker compile|compil|compi|comp|com|co|c) 2354*6a54128fSAndroid Build Coastguard Worker shift; set dummy --mode compile ${1+"$@"}; shift 2355*6a54128fSAndroid Build Coastguard Worker ;; 2356*6a54128fSAndroid Build Coastguard Worker execute|execut|execu|exec|exe|ex|e) 2357*6a54128fSAndroid Build Coastguard Worker shift; set dummy --mode execute ${1+"$@"}; shift 2358*6a54128fSAndroid Build Coastguard Worker ;; 2359*6a54128fSAndroid Build Coastguard Worker finish|finis|fini|fin|fi|f) 2360*6a54128fSAndroid Build Coastguard Worker shift; set dummy --mode finish ${1+"$@"}; shift 2361*6a54128fSAndroid Build Coastguard Worker ;; 2362*6a54128fSAndroid Build Coastguard Worker install|instal|insta|inst|ins|in|i) 2363*6a54128fSAndroid Build Coastguard Worker shift; set dummy --mode install ${1+"$@"}; shift 2364*6a54128fSAndroid Build Coastguard Worker ;; 2365*6a54128fSAndroid Build Coastguard Worker link|lin|li|l) 2366*6a54128fSAndroid Build Coastguard Worker shift; set dummy --mode link ${1+"$@"}; shift 2367*6a54128fSAndroid Build Coastguard Worker ;; 2368*6a54128fSAndroid Build Coastguard Worker uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) 2369*6a54128fSAndroid Build Coastguard Worker shift; set dummy --mode uninstall ${1+"$@"}; shift 2370*6a54128fSAndroid Build Coastguard Worker ;; 2371*6a54128fSAndroid Build Coastguard Worker *) 2372*6a54128fSAndroid Build Coastguard Worker _G_rc_lt_options_prep=false 2373*6a54128fSAndroid Build Coastguard Worker ;; 2374*6a54128fSAndroid Build Coastguard Worker esac 2375*6a54128fSAndroid Build Coastguard Worker 2376*6a54128fSAndroid Build Coastguard Worker if $_G_rc_lt_options_prep; then 2377*6a54128fSAndroid Build Coastguard Worker # Pass back the list of options. 2378*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval ${1+"$@"} 2379*6a54128fSAndroid Build Coastguard Worker libtool_options_prep_result=$func_quote_for_eval_result 2380*6a54128fSAndroid Build Coastguard Worker fi 2381*6a54128fSAndroid Build Coastguard Worker 2382*6a54128fSAndroid Build Coastguard Worker $_G_rc_lt_options_prep 2383*6a54128fSAndroid Build Coastguard Worker} 2384*6a54128fSAndroid Build Coastguard Workerfunc_add_hook func_options_prep libtool_options_prep 2385*6a54128fSAndroid Build Coastguard Worker 2386*6a54128fSAndroid Build Coastguard Worker 2387*6a54128fSAndroid Build Coastguard Worker# libtool_parse_options [ARG]... 2388*6a54128fSAndroid Build Coastguard Worker# --------------------------------- 2389*6a54128fSAndroid Build Coastguard Worker# Provide handling for libtool specific options. 2390*6a54128fSAndroid Build Coastguard Workerlibtool_parse_options () 2391*6a54128fSAndroid Build Coastguard Worker{ 2392*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2393*6a54128fSAndroid Build Coastguard Worker 2394*6a54128fSAndroid Build Coastguard Worker _G_rc_lt_parse_options=false 2395*6a54128fSAndroid Build Coastguard Worker 2396*6a54128fSAndroid Build Coastguard Worker # Perform our own loop to consume as many options as possible in 2397*6a54128fSAndroid Build Coastguard Worker # each iteration. 2398*6a54128fSAndroid Build Coastguard Worker while test $# -gt 0; do 2399*6a54128fSAndroid Build Coastguard Worker _G_match_lt_parse_options=: 2400*6a54128fSAndroid Build Coastguard Worker _G_opt=$1 2401*6a54128fSAndroid Build Coastguard Worker shift 2402*6a54128fSAndroid Build Coastguard Worker case $_G_opt in 2403*6a54128fSAndroid Build Coastguard Worker --dry-run|--dryrun|-n) 2404*6a54128fSAndroid Build Coastguard Worker opt_dry_run=: 2405*6a54128fSAndroid Build Coastguard Worker ;; 2406*6a54128fSAndroid Build Coastguard Worker 2407*6a54128fSAndroid Build Coastguard Worker --config) func_config ;; 2408*6a54128fSAndroid Build Coastguard Worker 2409*6a54128fSAndroid Build Coastguard Worker --dlopen|-dlopen) 2410*6a54128fSAndroid Build Coastguard Worker opt_dlopen="${opt_dlopen+$opt_dlopen 2411*6a54128fSAndroid Build Coastguard Worker}$1" 2412*6a54128fSAndroid Build Coastguard Worker shift 2413*6a54128fSAndroid Build Coastguard Worker ;; 2414*6a54128fSAndroid Build Coastguard Worker 2415*6a54128fSAndroid Build Coastguard Worker --preserve-dup-deps) 2416*6a54128fSAndroid Build Coastguard Worker opt_preserve_dup_deps=: ;; 2417*6a54128fSAndroid Build Coastguard Worker 2418*6a54128fSAndroid Build Coastguard Worker --features) func_features ;; 2419*6a54128fSAndroid Build Coastguard Worker 2420*6a54128fSAndroid Build Coastguard Worker --finish) set dummy --mode finish ${1+"$@"}; shift ;; 2421*6a54128fSAndroid Build Coastguard Worker 2422*6a54128fSAndroid Build Coastguard Worker --help) opt_help=: ;; 2423*6a54128fSAndroid Build Coastguard Worker 2424*6a54128fSAndroid Build Coastguard Worker --help-all) opt_help=': help-all' ;; 2425*6a54128fSAndroid Build Coastguard Worker 2426*6a54128fSAndroid Build Coastguard Worker --mode) test $# = 0 && func_missing_arg $_G_opt && break 2427*6a54128fSAndroid Build Coastguard Worker opt_mode=$1 2428*6a54128fSAndroid Build Coastguard Worker case $1 in 2429*6a54128fSAndroid Build Coastguard Worker # Valid mode arguments: 2430*6a54128fSAndroid Build Coastguard Worker clean|compile|execute|finish|install|link|relink|uninstall) ;; 2431*6a54128fSAndroid Build Coastguard Worker 2432*6a54128fSAndroid Build Coastguard Worker # Catch anything else as an error 2433*6a54128fSAndroid Build Coastguard Worker *) func_error "invalid argument for $_G_opt" 2434*6a54128fSAndroid Build Coastguard Worker exit_cmd=exit 2435*6a54128fSAndroid Build Coastguard Worker break 2436*6a54128fSAndroid Build Coastguard Worker ;; 2437*6a54128fSAndroid Build Coastguard Worker esac 2438*6a54128fSAndroid Build Coastguard Worker shift 2439*6a54128fSAndroid Build Coastguard Worker ;; 2440*6a54128fSAndroid Build Coastguard Worker 2441*6a54128fSAndroid Build Coastguard Worker --no-silent|--no-quiet) 2442*6a54128fSAndroid Build Coastguard Worker opt_quiet=false 2443*6a54128fSAndroid Build Coastguard Worker func_append preserve_args " $_G_opt" 2444*6a54128fSAndroid Build Coastguard Worker ;; 2445*6a54128fSAndroid Build Coastguard Worker 2446*6a54128fSAndroid Build Coastguard Worker --no-warnings|--no-warning|--no-warn) 2447*6a54128fSAndroid Build Coastguard Worker opt_warning=false 2448*6a54128fSAndroid Build Coastguard Worker func_append preserve_args " $_G_opt" 2449*6a54128fSAndroid Build Coastguard Worker ;; 2450*6a54128fSAndroid Build Coastguard Worker 2451*6a54128fSAndroid Build Coastguard Worker --no-verbose) 2452*6a54128fSAndroid Build Coastguard Worker opt_verbose=false 2453*6a54128fSAndroid Build Coastguard Worker func_append preserve_args " $_G_opt" 2454*6a54128fSAndroid Build Coastguard Worker ;; 2455*6a54128fSAndroid Build Coastguard Worker 2456*6a54128fSAndroid Build Coastguard Worker --silent|--quiet) 2457*6a54128fSAndroid Build Coastguard Worker opt_quiet=: 2458*6a54128fSAndroid Build Coastguard Worker opt_verbose=false 2459*6a54128fSAndroid Build Coastguard Worker func_append preserve_args " $_G_opt" 2460*6a54128fSAndroid Build Coastguard Worker ;; 2461*6a54128fSAndroid Build Coastguard Worker 2462*6a54128fSAndroid Build Coastguard Worker --tag) test $# = 0 && func_missing_arg $_G_opt && break 2463*6a54128fSAndroid Build Coastguard Worker opt_tag=$1 2464*6a54128fSAndroid Build Coastguard Worker func_append preserve_args " $_G_opt $1" 2465*6a54128fSAndroid Build Coastguard Worker func_enable_tag "$1" 2466*6a54128fSAndroid Build Coastguard Worker shift 2467*6a54128fSAndroid Build Coastguard Worker ;; 2468*6a54128fSAndroid Build Coastguard Worker 2469*6a54128fSAndroid Build Coastguard Worker --verbose|-v) opt_quiet=false 2470*6a54128fSAndroid Build Coastguard Worker opt_verbose=: 2471*6a54128fSAndroid Build Coastguard Worker func_append preserve_args " $_G_opt" 2472*6a54128fSAndroid Build Coastguard Worker ;; 2473*6a54128fSAndroid Build Coastguard Worker 2474*6a54128fSAndroid Build Coastguard Worker # An option not handled by this hook function: 2475*6a54128fSAndroid Build Coastguard Worker *) set dummy "$_G_opt" ${1+"$@"} ; shift 2476*6a54128fSAndroid Build Coastguard Worker _G_match_lt_parse_options=false 2477*6a54128fSAndroid Build Coastguard Worker break 2478*6a54128fSAndroid Build Coastguard Worker ;; 2479*6a54128fSAndroid Build Coastguard Worker esac 2480*6a54128fSAndroid Build Coastguard Worker $_G_match_lt_parse_options && _G_rc_lt_parse_options=: 2481*6a54128fSAndroid Build Coastguard Worker done 2482*6a54128fSAndroid Build Coastguard Worker 2483*6a54128fSAndroid Build Coastguard Worker if $_G_rc_lt_parse_options; then 2484*6a54128fSAndroid Build Coastguard Worker # save modified positional parameters for caller 2485*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval ${1+"$@"} 2486*6a54128fSAndroid Build Coastguard Worker libtool_parse_options_result=$func_quote_for_eval_result 2487*6a54128fSAndroid Build Coastguard Worker fi 2488*6a54128fSAndroid Build Coastguard Worker 2489*6a54128fSAndroid Build Coastguard Worker $_G_rc_lt_parse_options 2490*6a54128fSAndroid Build Coastguard Worker} 2491*6a54128fSAndroid Build Coastguard Workerfunc_add_hook func_parse_options libtool_parse_options 2492*6a54128fSAndroid Build Coastguard Worker 2493*6a54128fSAndroid Build Coastguard Worker 2494*6a54128fSAndroid Build Coastguard Worker 2495*6a54128fSAndroid Build Coastguard Worker# libtool_validate_options [ARG]... 2496*6a54128fSAndroid Build Coastguard Worker# --------------------------------- 2497*6a54128fSAndroid Build Coastguard Worker# Perform any sanity checks on option settings and/or unconsumed 2498*6a54128fSAndroid Build Coastguard Worker# arguments. 2499*6a54128fSAndroid Build Coastguard Workerlibtool_validate_options () 2500*6a54128fSAndroid Build Coastguard Worker{ 2501*6a54128fSAndroid Build Coastguard Worker # save first non-option argument 2502*6a54128fSAndroid Build Coastguard Worker if test 0 -lt $#; then 2503*6a54128fSAndroid Build Coastguard Worker nonopt=$1 2504*6a54128fSAndroid Build Coastguard Worker shift 2505*6a54128fSAndroid Build Coastguard Worker fi 2506*6a54128fSAndroid Build Coastguard Worker 2507*6a54128fSAndroid Build Coastguard Worker # preserve --debug 2508*6a54128fSAndroid Build Coastguard Worker test : = "$debug_cmd" || func_append preserve_args " --debug" 2509*6a54128fSAndroid Build Coastguard Worker 2510*6a54128fSAndroid Build Coastguard Worker case $host in 2511*6a54128fSAndroid Build Coastguard Worker # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 2512*6a54128fSAndroid Build Coastguard Worker # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 2513*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) 2514*6a54128fSAndroid Build Coastguard Worker # don't eliminate duplications in $postdeps and $predeps 2515*6a54128fSAndroid Build Coastguard Worker opt_duplicate_compiler_generated_deps=: 2516*6a54128fSAndroid Build Coastguard Worker ;; 2517*6a54128fSAndroid Build Coastguard Worker *) 2518*6a54128fSAndroid Build Coastguard Worker opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps 2519*6a54128fSAndroid Build Coastguard Worker ;; 2520*6a54128fSAndroid Build Coastguard Worker esac 2521*6a54128fSAndroid Build Coastguard Worker 2522*6a54128fSAndroid Build Coastguard Worker $opt_help || { 2523*6a54128fSAndroid Build Coastguard Worker # Sanity checks first: 2524*6a54128fSAndroid Build Coastguard Worker func_check_version_match 2525*6a54128fSAndroid Build Coastguard Worker 2526*6a54128fSAndroid Build Coastguard Worker test yes != "$build_libtool_libs" \ 2527*6a54128fSAndroid Build Coastguard Worker && test yes != "$build_old_libs" \ 2528*6a54128fSAndroid Build Coastguard Worker && func_fatal_configuration "not configured to build any kind of library" 2529*6a54128fSAndroid Build Coastguard Worker 2530*6a54128fSAndroid Build Coastguard Worker # Darwin sucks 2531*6a54128fSAndroid Build Coastguard Worker eval std_shrext=\"$shrext_cmds\" 2532*6a54128fSAndroid Build Coastguard Worker 2533*6a54128fSAndroid Build Coastguard Worker # Only execute mode is allowed to have -dlopen flags. 2534*6a54128fSAndroid Build Coastguard Worker if test -n "$opt_dlopen" && test execute != "$opt_mode"; then 2535*6a54128fSAndroid Build Coastguard Worker func_error "unrecognized option '-dlopen'" 2536*6a54128fSAndroid Build Coastguard Worker $ECHO "$help" 1>&2 2537*6a54128fSAndroid Build Coastguard Worker exit $EXIT_FAILURE 2538*6a54128fSAndroid Build Coastguard Worker fi 2539*6a54128fSAndroid Build Coastguard Worker 2540*6a54128fSAndroid Build Coastguard Worker # Change the help message to a mode-specific one. 2541*6a54128fSAndroid Build Coastguard Worker generic_help=$help 2542*6a54128fSAndroid Build Coastguard Worker help="Try '$progname --help --mode=$opt_mode' for more information." 2543*6a54128fSAndroid Build Coastguard Worker } 2544*6a54128fSAndroid Build Coastguard Worker 2545*6a54128fSAndroid Build Coastguard Worker # Pass back the unparsed argument list 2546*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval ${1+"$@"} 2547*6a54128fSAndroid Build Coastguard Worker libtool_validate_options_result=$func_quote_for_eval_result 2548*6a54128fSAndroid Build Coastguard Worker} 2549*6a54128fSAndroid Build Coastguard Workerfunc_add_hook func_validate_options libtool_validate_options 2550*6a54128fSAndroid Build Coastguard Worker 2551*6a54128fSAndroid Build Coastguard Worker 2552*6a54128fSAndroid Build Coastguard Worker# Process options as early as possible so that --help and --version 2553*6a54128fSAndroid Build Coastguard Worker# can return quickly. 2554*6a54128fSAndroid Build Coastguard Workerfunc_options ${1+"$@"} 2555*6a54128fSAndroid Build Coastguard Workereval set dummy "$func_options_result"; shift 2556*6a54128fSAndroid Build Coastguard Worker 2557*6a54128fSAndroid Build Coastguard Worker 2558*6a54128fSAndroid Build Coastguard Worker 2559*6a54128fSAndroid Build Coastguard Worker## ----------- ## 2560*6a54128fSAndroid Build Coastguard Worker## Main. ## 2561*6a54128fSAndroid Build Coastguard Worker## ----------- ## 2562*6a54128fSAndroid Build Coastguard Worker 2563*6a54128fSAndroid Build Coastguard Workermagic='%%%MAGIC variable%%%' 2564*6a54128fSAndroid Build Coastguard Workermagic_exe='%%%MAGIC EXE variable%%%' 2565*6a54128fSAndroid Build Coastguard Worker 2566*6a54128fSAndroid Build Coastguard Worker# Global variables. 2567*6a54128fSAndroid Build Coastguard Workerextracted_archives= 2568*6a54128fSAndroid Build Coastguard Workerextracted_serial=0 2569*6a54128fSAndroid Build Coastguard Worker 2570*6a54128fSAndroid Build Coastguard Worker# If this variable is set in any of the actions, the command in it 2571*6a54128fSAndroid Build Coastguard Worker# will be execed at the end. This prevents here-documents from being 2572*6a54128fSAndroid Build Coastguard Worker# left over by shells. 2573*6a54128fSAndroid Build Coastguard Workerexec_cmd= 2574*6a54128fSAndroid Build Coastguard Worker 2575*6a54128fSAndroid Build Coastguard Worker 2576*6a54128fSAndroid Build Coastguard Worker# A function that is used when there is no print builtin or printf. 2577*6a54128fSAndroid Build Coastguard Workerfunc_fallback_echo () 2578*6a54128fSAndroid Build Coastguard Worker{ 2579*6a54128fSAndroid Build Coastguard Worker eval 'cat <<_LTECHO_EOF 2580*6a54128fSAndroid Build Coastguard Worker$1 2581*6a54128fSAndroid Build Coastguard Worker_LTECHO_EOF' 2582*6a54128fSAndroid Build Coastguard Worker} 2583*6a54128fSAndroid Build Coastguard Worker 2584*6a54128fSAndroid Build Coastguard Worker# func_generated_by_libtool 2585*6a54128fSAndroid Build Coastguard Worker# True iff stdin has been generated by Libtool. This function is only 2586*6a54128fSAndroid Build Coastguard Worker# a basic sanity check; it will hardly flush out determined imposters. 2587*6a54128fSAndroid Build Coastguard Workerfunc_generated_by_libtool_p () 2588*6a54128fSAndroid Build Coastguard Worker{ 2589*6a54128fSAndroid Build Coastguard Worker $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 2590*6a54128fSAndroid Build Coastguard Worker} 2591*6a54128fSAndroid Build Coastguard Worker 2592*6a54128fSAndroid Build Coastguard Worker# func_lalib_p file 2593*6a54128fSAndroid Build Coastguard Worker# True iff FILE is a libtool '.la' library or '.lo' object file. 2594*6a54128fSAndroid Build Coastguard Worker# This function is only a basic sanity check; it will hardly flush out 2595*6a54128fSAndroid Build Coastguard Worker# determined imposters. 2596*6a54128fSAndroid Build Coastguard Workerfunc_lalib_p () 2597*6a54128fSAndroid Build Coastguard Worker{ 2598*6a54128fSAndroid Build Coastguard Worker test -f "$1" && 2599*6a54128fSAndroid Build Coastguard Worker $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p 2600*6a54128fSAndroid Build Coastguard Worker} 2601*6a54128fSAndroid Build Coastguard Worker 2602*6a54128fSAndroid Build Coastguard Worker# func_lalib_unsafe_p file 2603*6a54128fSAndroid Build Coastguard Worker# True iff FILE is a libtool '.la' library or '.lo' object file. 2604*6a54128fSAndroid Build Coastguard Worker# This function implements the same check as func_lalib_p without 2605*6a54128fSAndroid Build Coastguard Worker# resorting to external programs. To this end, it redirects stdin and 2606*6a54128fSAndroid Build Coastguard Worker# closes it afterwards, without saving the original file descriptor. 2607*6a54128fSAndroid Build Coastguard Worker# As a safety measure, use it only where a negative result would be 2608*6a54128fSAndroid Build Coastguard Worker# fatal anyway. Works if 'file' does not exist. 2609*6a54128fSAndroid Build Coastguard Workerfunc_lalib_unsafe_p () 2610*6a54128fSAndroid Build Coastguard Worker{ 2611*6a54128fSAndroid Build Coastguard Worker lalib_p=no 2612*6a54128fSAndroid Build Coastguard Worker if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then 2613*6a54128fSAndroid Build Coastguard Worker for lalib_p_l in 1 2 3 4 2614*6a54128fSAndroid Build Coastguard Worker do 2615*6a54128fSAndroid Build Coastguard Worker read lalib_p_line 2616*6a54128fSAndroid Build Coastguard Worker case $lalib_p_line in 2617*6a54128fSAndroid Build Coastguard Worker \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; 2618*6a54128fSAndroid Build Coastguard Worker esac 2619*6a54128fSAndroid Build Coastguard Worker done 2620*6a54128fSAndroid Build Coastguard Worker exec 0<&5 5<&- 2621*6a54128fSAndroid Build Coastguard Worker fi 2622*6a54128fSAndroid Build Coastguard Worker test yes = "$lalib_p" 2623*6a54128fSAndroid Build Coastguard Worker} 2624*6a54128fSAndroid Build Coastguard Worker 2625*6a54128fSAndroid Build Coastguard Worker# func_ltwrapper_script_p file 2626*6a54128fSAndroid Build Coastguard Worker# True iff FILE is a libtool wrapper script 2627*6a54128fSAndroid Build Coastguard Worker# This function is only a basic sanity check; it will hardly flush out 2628*6a54128fSAndroid Build Coastguard Worker# determined imposters. 2629*6a54128fSAndroid Build Coastguard Workerfunc_ltwrapper_script_p () 2630*6a54128fSAndroid Build Coastguard Worker{ 2631*6a54128fSAndroid Build Coastguard Worker test -f "$1" && 2632*6a54128fSAndroid Build Coastguard Worker $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p 2633*6a54128fSAndroid Build Coastguard Worker} 2634*6a54128fSAndroid Build Coastguard Worker 2635*6a54128fSAndroid Build Coastguard Worker# func_ltwrapper_executable_p file 2636*6a54128fSAndroid Build Coastguard Worker# True iff FILE is a libtool wrapper executable 2637*6a54128fSAndroid Build Coastguard Worker# This function is only a basic sanity check; it will hardly flush out 2638*6a54128fSAndroid Build Coastguard Worker# determined imposters. 2639*6a54128fSAndroid Build Coastguard Workerfunc_ltwrapper_executable_p () 2640*6a54128fSAndroid Build Coastguard Worker{ 2641*6a54128fSAndroid Build Coastguard Worker func_ltwrapper_exec_suffix= 2642*6a54128fSAndroid Build Coastguard Worker case $1 in 2643*6a54128fSAndroid Build Coastguard Worker *.exe) ;; 2644*6a54128fSAndroid Build Coastguard Worker *) func_ltwrapper_exec_suffix=.exe ;; 2645*6a54128fSAndroid Build Coastguard Worker esac 2646*6a54128fSAndroid Build Coastguard Worker $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 2647*6a54128fSAndroid Build Coastguard Worker} 2648*6a54128fSAndroid Build Coastguard Worker 2649*6a54128fSAndroid Build Coastguard Worker# func_ltwrapper_scriptname file 2650*6a54128fSAndroid Build Coastguard Worker# Assumes file is an ltwrapper_executable 2651*6a54128fSAndroid Build Coastguard Worker# uses $file to determine the appropriate filename for a 2652*6a54128fSAndroid Build Coastguard Worker# temporary ltwrapper_script. 2653*6a54128fSAndroid Build Coastguard Workerfunc_ltwrapper_scriptname () 2654*6a54128fSAndroid Build Coastguard Worker{ 2655*6a54128fSAndroid Build Coastguard Worker func_dirname_and_basename "$1" "" "." 2656*6a54128fSAndroid Build Coastguard Worker func_stripname '' '.exe' "$func_basename_result" 2657*6a54128fSAndroid Build Coastguard Worker func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper 2658*6a54128fSAndroid Build Coastguard Worker} 2659*6a54128fSAndroid Build Coastguard Worker 2660*6a54128fSAndroid Build Coastguard Worker# func_ltwrapper_p file 2661*6a54128fSAndroid Build Coastguard Worker# True iff FILE is a libtool wrapper script or wrapper executable 2662*6a54128fSAndroid Build Coastguard Worker# This function is only a basic sanity check; it will hardly flush out 2663*6a54128fSAndroid Build Coastguard Worker# determined imposters. 2664*6a54128fSAndroid Build Coastguard Workerfunc_ltwrapper_p () 2665*6a54128fSAndroid Build Coastguard Worker{ 2666*6a54128fSAndroid Build Coastguard Worker func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" 2667*6a54128fSAndroid Build Coastguard Worker} 2668*6a54128fSAndroid Build Coastguard Worker 2669*6a54128fSAndroid Build Coastguard Worker 2670*6a54128fSAndroid Build Coastguard Worker# func_execute_cmds commands fail_cmd 2671*6a54128fSAndroid Build Coastguard Worker# Execute tilde-delimited COMMANDS. 2672*6a54128fSAndroid Build Coastguard Worker# If FAIL_CMD is given, eval that upon failure. 2673*6a54128fSAndroid Build Coastguard Worker# FAIL_CMD may read-access the current command in variable CMD! 2674*6a54128fSAndroid Build Coastguard Workerfunc_execute_cmds () 2675*6a54128fSAndroid Build Coastguard Worker{ 2676*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2677*6a54128fSAndroid Build Coastguard Worker 2678*6a54128fSAndroid Build Coastguard Worker save_ifs=$IFS; IFS='~' 2679*6a54128fSAndroid Build Coastguard Worker for cmd in $1; do 2680*6a54128fSAndroid Build Coastguard Worker IFS=$sp$nl 2681*6a54128fSAndroid Build Coastguard Worker eval cmd=\"$cmd\" 2682*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 2683*6a54128fSAndroid Build Coastguard Worker func_show_eval "$cmd" "${2-:}" 2684*6a54128fSAndroid Build Coastguard Worker done 2685*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 2686*6a54128fSAndroid Build Coastguard Worker} 2687*6a54128fSAndroid Build Coastguard Worker 2688*6a54128fSAndroid Build Coastguard Worker 2689*6a54128fSAndroid Build Coastguard Worker# func_source file 2690*6a54128fSAndroid Build Coastguard Worker# Source FILE, adding directory component if necessary. 2691*6a54128fSAndroid Build Coastguard Worker# Note that it is not necessary on cygwin/mingw to append a dot to 2692*6a54128fSAndroid Build Coastguard Worker# FILE even if both FILE and FILE.exe exist: automatic-append-.exe 2693*6a54128fSAndroid Build Coastguard Worker# behavior happens only for exec(3), not for open(2)! Also, sourcing 2694*6a54128fSAndroid Build Coastguard Worker# 'FILE.' does not work on cygwin managed mounts. 2695*6a54128fSAndroid Build Coastguard Workerfunc_source () 2696*6a54128fSAndroid Build Coastguard Worker{ 2697*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2698*6a54128fSAndroid Build Coastguard Worker 2699*6a54128fSAndroid Build Coastguard Worker case $1 in 2700*6a54128fSAndroid Build Coastguard Worker */* | *\\*) . "$1" ;; 2701*6a54128fSAndroid Build Coastguard Worker *) . "./$1" ;; 2702*6a54128fSAndroid Build Coastguard Worker esac 2703*6a54128fSAndroid Build Coastguard Worker} 2704*6a54128fSAndroid Build Coastguard Worker 2705*6a54128fSAndroid Build Coastguard Worker 2706*6a54128fSAndroid Build Coastguard Worker# func_resolve_sysroot PATH 2707*6a54128fSAndroid Build Coastguard Worker# Replace a leading = in PATH with a sysroot. Store the result into 2708*6a54128fSAndroid Build Coastguard Worker# func_resolve_sysroot_result 2709*6a54128fSAndroid Build Coastguard Workerfunc_resolve_sysroot () 2710*6a54128fSAndroid Build Coastguard Worker{ 2711*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot_result=$1 2712*6a54128fSAndroid Build Coastguard Worker case $func_resolve_sysroot_result in 2713*6a54128fSAndroid Build Coastguard Worker =*) 2714*6a54128fSAndroid Build Coastguard Worker func_stripname '=' '' "$func_resolve_sysroot_result" 2715*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot_result=$lt_sysroot$func_stripname_result 2716*6a54128fSAndroid Build Coastguard Worker ;; 2717*6a54128fSAndroid Build Coastguard Worker esac 2718*6a54128fSAndroid Build Coastguard Worker} 2719*6a54128fSAndroid Build Coastguard Worker 2720*6a54128fSAndroid Build Coastguard Worker# func_replace_sysroot PATH 2721*6a54128fSAndroid Build Coastguard Worker# If PATH begins with the sysroot, replace it with = and 2722*6a54128fSAndroid Build Coastguard Worker# store the result into func_replace_sysroot_result. 2723*6a54128fSAndroid Build Coastguard Workerfunc_replace_sysroot () 2724*6a54128fSAndroid Build Coastguard Worker{ 2725*6a54128fSAndroid Build Coastguard Worker case $lt_sysroot:$1 in 2726*6a54128fSAndroid Build Coastguard Worker ?*:"$lt_sysroot"*) 2727*6a54128fSAndroid Build Coastguard Worker func_stripname "$lt_sysroot" '' "$1" 2728*6a54128fSAndroid Build Coastguard Worker func_replace_sysroot_result='='$func_stripname_result 2729*6a54128fSAndroid Build Coastguard Worker ;; 2730*6a54128fSAndroid Build Coastguard Worker *) 2731*6a54128fSAndroid Build Coastguard Worker # Including no sysroot. 2732*6a54128fSAndroid Build Coastguard Worker func_replace_sysroot_result=$1 2733*6a54128fSAndroid Build Coastguard Worker ;; 2734*6a54128fSAndroid Build Coastguard Worker esac 2735*6a54128fSAndroid Build Coastguard Worker} 2736*6a54128fSAndroid Build Coastguard Worker 2737*6a54128fSAndroid Build Coastguard Worker# func_infer_tag arg 2738*6a54128fSAndroid Build Coastguard Worker# Infer tagged configuration to use if any are available and 2739*6a54128fSAndroid Build Coastguard Worker# if one wasn't chosen via the "--tag" command line option. 2740*6a54128fSAndroid Build Coastguard Worker# Only attempt this if the compiler in the base compile 2741*6a54128fSAndroid Build Coastguard Worker# command doesn't match the default compiler. 2742*6a54128fSAndroid Build Coastguard Worker# arg is usually of the form 'gcc ...' 2743*6a54128fSAndroid Build Coastguard Workerfunc_infer_tag () 2744*6a54128fSAndroid Build Coastguard Worker{ 2745*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2746*6a54128fSAndroid Build Coastguard Worker 2747*6a54128fSAndroid Build Coastguard Worker if test -n "$available_tags" && test -z "$tagname"; then 2748*6a54128fSAndroid Build Coastguard Worker CC_quoted= 2749*6a54128fSAndroid Build Coastguard Worker for arg in $CC; do 2750*6a54128fSAndroid Build Coastguard Worker func_append_quoted CC_quoted "$arg" 2751*6a54128fSAndroid Build Coastguard Worker done 2752*6a54128fSAndroid Build Coastguard Worker CC_expanded=`func_echo_all $CC` 2753*6a54128fSAndroid Build Coastguard Worker CC_quoted_expanded=`func_echo_all $CC_quoted` 2754*6a54128fSAndroid Build Coastguard Worker case $@ in 2755*6a54128fSAndroid Build Coastguard Worker # Blanks in the command may have been stripped by the calling shell, 2756*6a54128fSAndroid Build Coastguard Worker # but not from the CC environment variable when configure was run. 2757*6a54128fSAndroid Build Coastguard Worker " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 2758*6a54128fSAndroid Build Coastguard Worker " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; 2759*6a54128fSAndroid Build Coastguard Worker # Blanks at the start of $base_compile will cause this to fail 2760*6a54128fSAndroid Build Coastguard Worker # if we don't check for them as well. 2761*6a54128fSAndroid Build Coastguard Worker *) 2762*6a54128fSAndroid Build Coastguard Worker for z in $available_tags; do 2763*6a54128fSAndroid Build Coastguard Worker if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 2764*6a54128fSAndroid Build Coastguard Worker # Evaluate the configuration. 2765*6a54128fSAndroid Build Coastguard Worker eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 2766*6a54128fSAndroid Build Coastguard Worker CC_quoted= 2767*6a54128fSAndroid Build Coastguard Worker for arg in $CC; do 2768*6a54128fSAndroid Build Coastguard Worker # Double-quote args containing other shell metacharacters. 2769*6a54128fSAndroid Build Coastguard Worker func_append_quoted CC_quoted "$arg" 2770*6a54128fSAndroid Build Coastguard Worker done 2771*6a54128fSAndroid Build Coastguard Worker CC_expanded=`func_echo_all $CC` 2772*6a54128fSAndroid Build Coastguard Worker CC_quoted_expanded=`func_echo_all $CC_quoted` 2773*6a54128fSAndroid Build Coastguard Worker case "$@ " in 2774*6a54128fSAndroid Build Coastguard Worker " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ 2775*6a54128fSAndroid Build Coastguard Worker " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) 2776*6a54128fSAndroid Build Coastguard Worker # The compiler in the base compile command matches 2777*6a54128fSAndroid Build Coastguard Worker # the one in the tagged configuration. 2778*6a54128fSAndroid Build Coastguard Worker # Assume this is the tagged configuration we want. 2779*6a54128fSAndroid Build Coastguard Worker tagname=$z 2780*6a54128fSAndroid Build Coastguard Worker break 2781*6a54128fSAndroid Build Coastguard Worker ;; 2782*6a54128fSAndroid Build Coastguard Worker esac 2783*6a54128fSAndroid Build Coastguard Worker fi 2784*6a54128fSAndroid Build Coastguard Worker done 2785*6a54128fSAndroid Build Coastguard Worker # If $tagname still isn't set, then no tagged configuration 2786*6a54128fSAndroid Build Coastguard Worker # was found and let the user know that the "--tag" command 2787*6a54128fSAndroid Build Coastguard Worker # line option must be used. 2788*6a54128fSAndroid Build Coastguard Worker if test -z "$tagname"; then 2789*6a54128fSAndroid Build Coastguard Worker func_echo "unable to infer tagged configuration" 2790*6a54128fSAndroid Build Coastguard Worker func_fatal_error "specify a tag with '--tag'" 2791*6a54128fSAndroid Build Coastguard Worker# else 2792*6a54128fSAndroid Build Coastguard Worker# func_verbose "using $tagname tagged configuration" 2793*6a54128fSAndroid Build Coastguard Worker fi 2794*6a54128fSAndroid Build Coastguard Worker ;; 2795*6a54128fSAndroid Build Coastguard Worker esac 2796*6a54128fSAndroid Build Coastguard Worker fi 2797*6a54128fSAndroid Build Coastguard Worker} 2798*6a54128fSAndroid Build Coastguard Worker 2799*6a54128fSAndroid Build Coastguard Worker 2800*6a54128fSAndroid Build Coastguard Worker 2801*6a54128fSAndroid Build Coastguard Worker# func_write_libtool_object output_name pic_name nonpic_name 2802*6a54128fSAndroid Build Coastguard Worker# Create a libtool object file (analogous to a ".la" file), 2803*6a54128fSAndroid Build Coastguard Worker# but don't create it if we're doing a dry run. 2804*6a54128fSAndroid Build Coastguard Workerfunc_write_libtool_object () 2805*6a54128fSAndroid Build Coastguard Worker{ 2806*6a54128fSAndroid Build Coastguard Worker write_libobj=$1 2807*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_libs"; then 2808*6a54128fSAndroid Build Coastguard Worker write_lobj=\'$2\' 2809*6a54128fSAndroid Build Coastguard Worker else 2810*6a54128fSAndroid Build Coastguard Worker write_lobj=none 2811*6a54128fSAndroid Build Coastguard Worker fi 2812*6a54128fSAndroid Build Coastguard Worker 2813*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_old_libs"; then 2814*6a54128fSAndroid Build Coastguard Worker write_oldobj=\'$3\' 2815*6a54128fSAndroid Build Coastguard Worker else 2816*6a54128fSAndroid Build Coastguard Worker write_oldobj=none 2817*6a54128fSAndroid Build Coastguard Worker fi 2818*6a54128fSAndroid Build Coastguard Worker 2819*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 2820*6a54128fSAndroid Build Coastguard Worker cat >${write_libobj}T <<EOF 2821*6a54128fSAndroid Build Coastguard Worker# $write_libobj - a libtool object file 2822*6a54128fSAndroid Build Coastguard Worker# Generated by $PROGRAM (GNU $PACKAGE) $VERSION 2823*6a54128fSAndroid Build Coastguard Worker# 2824*6a54128fSAndroid Build Coastguard Worker# Please DO NOT delete this file! 2825*6a54128fSAndroid Build Coastguard Worker# It is necessary for linking the library. 2826*6a54128fSAndroid Build Coastguard Worker 2827*6a54128fSAndroid Build Coastguard Worker# Name of the PIC object. 2828*6a54128fSAndroid Build Coastguard Workerpic_object=$write_lobj 2829*6a54128fSAndroid Build Coastguard Worker 2830*6a54128fSAndroid Build Coastguard Worker# Name of the non-PIC object 2831*6a54128fSAndroid Build Coastguard Workernon_pic_object=$write_oldobj 2832*6a54128fSAndroid Build Coastguard Worker 2833*6a54128fSAndroid Build Coastguard WorkerEOF 2834*6a54128fSAndroid Build Coastguard Worker $MV "${write_libobj}T" "$write_libobj" 2835*6a54128fSAndroid Build Coastguard Worker } 2836*6a54128fSAndroid Build Coastguard Worker} 2837*6a54128fSAndroid Build Coastguard Worker 2838*6a54128fSAndroid Build Coastguard Worker 2839*6a54128fSAndroid Build Coastguard Worker################################################## 2840*6a54128fSAndroid Build Coastguard Worker# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS # 2841*6a54128fSAndroid Build Coastguard Worker################################################## 2842*6a54128fSAndroid Build Coastguard Worker 2843*6a54128fSAndroid Build Coastguard Worker# func_convert_core_file_wine_to_w32 ARG 2844*6a54128fSAndroid Build Coastguard Worker# Helper function used by file name conversion functions when $build is *nix, 2845*6a54128fSAndroid Build Coastguard Worker# and $host is mingw, cygwin, or some other w32 environment. Relies on a 2846*6a54128fSAndroid Build Coastguard Worker# correctly configured wine environment available, with the winepath program 2847*6a54128fSAndroid Build Coastguard Worker# in $build's $PATH. 2848*6a54128fSAndroid Build Coastguard Worker# 2849*6a54128fSAndroid Build Coastguard Worker# ARG is the $build file name to be converted to w32 format. 2850*6a54128fSAndroid Build Coastguard Worker# Result is available in $func_convert_core_file_wine_to_w32_result, and will 2851*6a54128fSAndroid Build Coastguard Worker# be empty on error (or when ARG is empty) 2852*6a54128fSAndroid Build Coastguard Workerfunc_convert_core_file_wine_to_w32 () 2853*6a54128fSAndroid Build Coastguard Worker{ 2854*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2855*6a54128fSAndroid Build Coastguard Worker 2856*6a54128fSAndroid Build Coastguard Worker func_convert_core_file_wine_to_w32_result=$1 2857*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 2858*6a54128fSAndroid Build Coastguard Worker # Unfortunately, winepath does not exit with a non-zero error code, so we 2859*6a54128fSAndroid Build Coastguard Worker # are forced to check the contents of stdout. On the other hand, if the 2860*6a54128fSAndroid Build Coastguard Worker # command is not found, the shell will set an exit code of 127 and print 2861*6a54128fSAndroid Build Coastguard Worker # *an error message* to stdout. So we must check for both error code of 2862*6a54128fSAndroid Build Coastguard Worker # zero AND non-empty stdout, which explains the odd construction: 2863*6a54128fSAndroid Build Coastguard Worker func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null` 2864*6a54128fSAndroid Build Coastguard Worker if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then 2865*6a54128fSAndroid Build Coastguard Worker func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | 2866*6a54128fSAndroid Build Coastguard Worker $SED -e "$sed_naive_backslashify"` 2867*6a54128fSAndroid Build Coastguard Worker else 2868*6a54128fSAndroid Build Coastguard Worker func_convert_core_file_wine_to_w32_result= 2869*6a54128fSAndroid Build Coastguard Worker fi 2870*6a54128fSAndroid Build Coastguard Worker fi 2871*6a54128fSAndroid Build Coastguard Worker} 2872*6a54128fSAndroid Build Coastguard Worker# end: func_convert_core_file_wine_to_w32 2873*6a54128fSAndroid Build Coastguard Worker 2874*6a54128fSAndroid Build Coastguard Worker 2875*6a54128fSAndroid Build Coastguard Worker# func_convert_core_path_wine_to_w32 ARG 2876*6a54128fSAndroid Build Coastguard Worker# Helper function used by path conversion functions when $build is *nix, and 2877*6a54128fSAndroid Build Coastguard Worker# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly 2878*6a54128fSAndroid Build Coastguard Worker# configured wine environment available, with the winepath program in $build's 2879*6a54128fSAndroid Build Coastguard Worker# $PATH. Assumes ARG has no leading or trailing path separator characters. 2880*6a54128fSAndroid Build Coastguard Worker# 2881*6a54128fSAndroid Build Coastguard Worker# ARG is path to be converted from $build format to win32. 2882*6a54128fSAndroid Build Coastguard Worker# Result is available in $func_convert_core_path_wine_to_w32_result. 2883*6a54128fSAndroid Build Coastguard Worker# Unconvertible file (directory) names in ARG are skipped; if no directory names 2884*6a54128fSAndroid Build Coastguard Worker# are convertible, then the result may be empty. 2885*6a54128fSAndroid Build Coastguard Workerfunc_convert_core_path_wine_to_w32 () 2886*6a54128fSAndroid Build Coastguard Worker{ 2887*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2888*6a54128fSAndroid Build Coastguard Worker 2889*6a54128fSAndroid Build Coastguard Worker # unfortunately, winepath doesn't convert paths, only file names 2890*6a54128fSAndroid Build Coastguard Worker func_convert_core_path_wine_to_w32_result= 2891*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 2892*6a54128fSAndroid Build Coastguard Worker oldIFS=$IFS 2893*6a54128fSAndroid Build Coastguard Worker IFS=: 2894*6a54128fSAndroid Build Coastguard Worker for func_convert_core_path_wine_to_w32_f in $1; do 2895*6a54128fSAndroid Build Coastguard Worker IFS=$oldIFS 2896*6a54128fSAndroid Build Coastguard Worker func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" 2897*6a54128fSAndroid Build Coastguard Worker if test -n "$func_convert_core_file_wine_to_w32_result"; then 2898*6a54128fSAndroid Build Coastguard Worker if test -z "$func_convert_core_path_wine_to_w32_result"; then 2899*6a54128fSAndroid Build Coastguard Worker func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result 2900*6a54128fSAndroid Build Coastguard Worker else 2901*6a54128fSAndroid Build Coastguard Worker func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" 2902*6a54128fSAndroid Build Coastguard Worker fi 2903*6a54128fSAndroid Build Coastguard Worker fi 2904*6a54128fSAndroid Build Coastguard Worker done 2905*6a54128fSAndroid Build Coastguard Worker IFS=$oldIFS 2906*6a54128fSAndroid Build Coastguard Worker fi 2907*6a54128fSAndroid Build Coastguard Worker} 2908*6a54128fSAndroid Build Coastguard Worker# end: func_convert_core_path_wine_to_w32 2909*6a54128fSAndroid Build Coastguard Worker 2910*6a54128fSAndroid Build Coastguard Worker 2911*6a54128fSAndroid Build Coastguard Worker# func_cygpath ARGS... 2912*6a54128fSAndroid Build Coastguard Worker# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when 2913*6a54128fSAndroid Build Coastguard Worker# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) 2914*6a54128fSAndroid Build Coastguard Worker# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or 2915*6a54128fSAndroid Build Coastguard Worker# (2), returns the Cygwin file name or path in func_cygpath_result (input 2916*6a54128fSAndroid Build Coastguard Worker# file name or path is assumed to be in w32 format, as previously converted 2917*6a54128fSAndroid Build Coastguard Worker# from $build's *nix or MSYS format). In case (3), returns the w32 file name 2918*6a54128fSAndroid Build Coastguard Worker# or path in func_cygpath_result (input file name or path is assumed to be in 2919*6a54128fSAndroid Build Coastguard Worker# Cygwin format). Returns an empty string on error. 2920*6a54128fSAndroid Build Coastguard Worker# 2921*6a54128fSAndroid Build Coastguard Worker# ARGS are passed to cygpath, with the last one being the file name or path to 2922*6a54128fSAndroid Build Coastguard Worker# be converted. 2923*6a54128fSAndroid Build Coastguard Worker# 2924*6a54128fSAndroid Build Coastguard Worker# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH 2925*6a54128fSAndroid Build Coastguard Worker# environment variable; do not put it in $PATH. 2926*6a54128fSAndroid Build Coastguard Workerfunc_cygpath () 2927*6a54128fSAndroid Build Coastguard Worker{ 2928*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2929*6a54128fSAndroid Build Coastguard Worker 2930*6a54128fSAndroid Build Coastguard Worker if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then 2931*6a54128fSAndroid Build Coastguard Worker func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` 2932*6a54128fSAndroid Build Coastguard Worker if test "$?" -ne 0; then 2933*6a54128fSAndroid Build Coastguard Worker # on failure, ensure result is empty 2934*6a54128fSAndroid Build Coastguard Worker func_cygpath_result= 2935*6a54128fSAndroid Build Coastguard Worker fi 2936*6a54128fSAndroid Build Coastguard Worker else 2937*6a54128fSAndroid Build Coastguard Worker func_cygpath_result= 2938*6a54128fSAndroid Build Coastguard Worker func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" 2939*6a54128fSAndroid Build Coastguard Worker fi 2940*6a54128fSAndroid Build Coastguard Worker} 2941*6a54128fSAndroid Build Coastguard Worker#end: func_cygpath 2942*6a54128fSAndroid Build Coastguard Worker 2943*6a54128fSAndroid Build Coastguard Worker 2944*6a54128fSAndroid Build Coastguard Worker# func_convert_core_msys_to_w32 ARG 2945*6a54128fSAndroid Build Coastguard Worker# Convert file name or path ARG from MSYS format to w32 format. Return 2946*6a54128fSAndroid Build Coastguard Worker# result in func_convert_core_msys_to_w32_result. 2947*6a54128fSAndroid Build Coastguard Workerfunc_convert_core_msys_to_w32 () 2948*6a54128fSAndroid Build Coastguard Worker{ 2949*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2950*6a54128fSAndroid Build Coastguard Worker 2951*6a54128fSAndroid Build Coastguard Worker # awkward: cmd appends spaces to result 2952*6a54128fSAndroid Build Coastguard Worker func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | 2953*6a54128fSAndroid Build Coastguard Worker $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` 2954*6a54128fSAndroid Build Coastguard Worker} 2955*6a54128fSAndroid Build Coastguard Worker#end: func_convert_core_msys_to_w32 2956*6a54128fSAndroid Build Coastguard Worker 2957*6a54128fSAndroid Build Coastguard Worker 2958*6a54128fSAndroid Build Coastguard Worker# func_convert_file_check ARG1 ARG2 2959*6a54128fSAndroid Build Coastguard Worker# Verify that ARG1 (a file name in $build format) was converted to $host 2960*6a54128fSAndroid Build Coastguard Worker# format in ARG2. Otherwise, emit an error message, but continue (resetting 2961*6a54128fSAndroid Build Coastguard Worker# func_to_host_file_result to ARG1). 2962*6a54128fSAndroid Build Coastguard Workerfunc_convert_file_check () 2963*6a54128fSAndroid Build Coastguard Worker{ 2964*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2965*6a54128fSAndroid Build Coastguard Worker 2966*6a54128fSAndroid Build Coastguard Worker if test -z "$2" && test -n "$1"; then 2967*6a54128fSAndroid Build Coastguard Worker func_error "Could not determine host file name corresponding to" 2968*6a54128fSAndroid Build Coastguard Worker func_error " '$1'" 2969*6a54128fSAndroid Build Coastguard Worker func_error "Continuing, but uninstalled executables may not work." 2970*6a54128fSAndroid Build Coastguard Worker # Fallback: 2971*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$1 2972*6a54128fSAndroid Build Coastguard Worker fi 2973*6a54128fSAndroid Build Coastguard Worker} 2974*6a54128fSAndroid Build Coastguard Worker# end func_convert_file_check 2975*6a54128fSAndroid Build Coastguard Worker 2976*6a54128fSAndroid Build Coastguard Worker 2977*6a54128fSAndroid Build Coastguard Worker# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH 2978*6a54128fSAndroid Build Coastguard Worker# Verify that FROM_PATH (a path in $build format) was converted to $host 2979*6a54128fSAndroid Build Coastguard Worker# format in TO_PATH. Otherwise, emit an error message, but continue, resetting 2980*6a54128fSAndroid Build Coastguard Worker# func_to_host_file_result to a simplistic fallback value (see below). 2981*6a54128fSAndroid Build Coastguard Workerfunc_convert_path_check () 2982*6a54128fSAndroid Build Coastguard Worker{ 2983*6a54128fSAndroid Build Coastguard Worker $debug_cmd 2984*6a54128fSAndroid Build Coastguard Worker 2985*6a54128fSAndroid Build Coastguard Worker if test -z "$4" && test -n "$3"; then 2986*6a54128fSAndroid Build Coastguard Worker func_error "Could not determine the host path corresponding to" 2987*6a54128fSAndroid Build Coastguard Worker func_error " '$3'" 2988*6a54128fSAndroid Build Coastguard Worker func_error "Continuing, but uninstalled executables may not work." 2989*6a54128fSAndroid Build Coastguard Worker # Fallback. This is a deliberately simplistic "conversion" and 2990*6a54128fSAndroid Build Coastguard Worker # should not be "improved". See libtool.info. 2991*6a54128fSAndroid Build Coastguard Worker if test "x$1" != "x$2"; then 2992*6a54128fSAndroid Build Coastguard Worker lt_replace_pathsep_chars="s|$1|$2|g" 2993*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=`echo "$3" | 2994*6a54128fSAndroid Build Coastguard Worker $SED -e "$lt_replace_pathsep_chars"` 2995*6a54128fSAndroid Build Coastguard Worker else 2996*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$3 2997*6a54128fSAndroid Build Coastguard Worker fi 2998*6a54128fSAndroid Build Coastguard Worker fi 2999*6a54128fSAndroid Build Coastguard Worker} 3000*6a54128fSAndroid Build Coastguard Worker# end func_convert_path_check 3001*6a54128fSAndroid Build Coastguard Worker 3002*6a54128fSAndroid Build Coastguard Worker 3003*6a54128fSAndroid Build Coastguard Worker# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG 3004*6a54128fSAndroid Build Coastguard Worker# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT 3005*6a54128fSAndroid Build Coastguard Worker# and appending REPL if ORIG matches BACKPAT. 3006*6a54128fSAndroid Build Coastguard Workerfunc_convert_path_front_back_pathsep () 3007*6a54128fSAndroid Build Coastguard Worker{ 3008*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3009*6a54128fSAndroid Build Coastguard Worker 3010*6a54128fSAndroid Build Coastguard Worker case $4 in 3011*6a54128fSAndroid Build Coastguard Worker $1 ) func_to_host_path_result=$3$func_to_host_path_result 3012*6a54128fSAndroid Build Coastguard Worker ;; 3013*6a54128fSAndroid Build Coastguard Worker esac 3014*6a54128fSAndroid Build Coastguard Worker case $4 in 3015*6a54128fSAndroid Build Coastguard Worker $2 ) func_append func_to_host_path_result "$3" 3016*6a54128fSAndroid Build Coastguard Worker ;; 3017*6a54128fSAndroid Build Coastguard Worker esac 3018*6a54128fSAndroid Build Coastguard Worker} 3019*6a54128fSAndroid Build Coastguard Worker# end func_convert_path_front_back_pathsep 3020*6a54128fSAndroid Build Coastguard Worker 3021*6a54128fSAndroid Build Coastguard Worker 3022*6a54128fSAndroid Build Coastguard Worker################################################## 3023*6a54128fSAndroid Build Coastguard Worker# $build to $host FILE NAME CONVERSION FUNCTIONS # 3024*6a54128fSAndroid Build Coastguard Worker################################################## 3025*6a54128fSAndroid Build Coastguard Worker# invoked via '$to_host_file_cmd ARG' 3026*6a54128fSAndroid Build Coastguard Worker# 3027*6a54128fSAndroid Build Coastguard Worker# In each case, ARG is the path to be converted from $build to $host format. 3028*6a54128fSAndroid Build Coastguard Worker# Result will be available in $func_to_host_file_result. 3029*6a54128fSAndroid Build Coastguard Worker 3030*6a54128fSAndroid Build Coastguard Worker 3031*6a54128fSAndroid Build Coastguard Worker# func_to_host_file ARG 3032*6a54128fSAndroid Build Coastguard Worker# Converts the file name ARG from $build format to $host format. Return result 3033*6a54128fSAndroid Build Coastguard Worker# in func_to_host_file_result. 3034*6a54128fSAndroid Build Coastguard Workerfunc_to_host_file () 3035*6a54128fSAndroid Build Coastguard Worker{ 3036*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3037*6a54128fSAndroid Build Coastguard Worker 3038*6a54128fSAndroid Build Coastguard Worker $to_host_file_cmd "$1" 3039*6a54128fSAndroid Build Coastguard Worker} 3040*6a54128fSAndroid Build Coastguard Worker# end func_to_host_file 3041*6a54128fSAndroid Build Coastguard Worker 3042*6a54128fSAndroid Build Coastguard Worker 3043*6a54128fSAndroid Build Coastguard Worker# func_to_tool_file ARG LAZY 3044*6a54128fSAndroid Build Coastguard Worker# converts the file name ARG from $build format to toolchain format. Return 3045*6a54128fSAndroid Build Coastguard Worker# result in func_to_tool_file_result. If the conversion in use is listed 3046*6a54128fSAndroid Build Coastguard Worker# in (the comma separated) LAZY, no conversion takes place. 3047*6a54128fSAndroid Build Coastguard Workerfunc_to_tool_file () 3048*6a54128fSAndroid Build Coastguard Worker{ 3049*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3050*6a54128fSAndroid Build Coastguard Worker 3051*6a54128fSAndroid Build Coastguard Worker case ,$2, in 3052*6a54128fSAndroid Build Coastguard Worker *,"$to_tool_file_cmd",*) 3053*6a54128fSAndroid Build Coastguard Worker func_to_tool_file_result=$1 3054*6a54128fSAndroid Build Coastguard Worker ;; 3055*6a54128fSAndroid Build Coastguard Worker *) 3056*6a54128fSAndroid Build Coastguard Worker $to_tool_file_cmd "$1" 3057*6a54128fSAndroid Build Coastguard Worker func_to_tool_file_result=$func_to_host_file_result 3058*6a54128fSAndroid Build Coastguard Worker ;; 3059*6a54128fSAndroid Build Coastguard Worker esac 3060*6a54128fSAndroid Build Coastguard Worker} 3061*6a54128fSAndroid Build Coastguard Worker# end func_to_tool_file 3062*6a54128fSAndroid Build Coastguard Worker 3063*6a54128fSAndroid Build Coastguard Worker 3064*6a54128fSAndroid Build Coastguard Worker# func_convert_file_noop ARG 3065*6a54128fSAndroid Build Coastguard Worker# Copy ARG to func_to_host_file_result. 3066*6a54128fSAndroid Build Coastguard Workerfunc_convert_file_noop () 3067*6a54128fSAndroid Build Coastguard Worker{ 3068*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$1 3069*6a54128fSAndroid Build Coastguard Worker} 3070*6a54128fSAndroid Build Coastguard Worker# end func_convert_file_noop 3071*6a54128fSAndroid Build Coastguard Worker 3072*6a54128fSAndroid Build Coastguard Worker 3073*6a54128fSAndroid Build Coastguard Worker# func_convert_file_msys_to_w32 ARG 3074*6a54128fSAndroid Build Coastguard Worker# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic 3075*6a54128fSAndroid Build Coastguard Worker# conversion to w32 is not available inside the cwrapper. Returns result in 3076*6a54128fSAndroid Build Coastguard Worker# func_to_host_file_result. 3077*6a54128fSAndroid Build Coastguard Workerfunc_convert_file_msys_to_w32 () 3078*6a54128fSAndroid Build Coastguard Worker{ 3079*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3080*6a54128fSAndroid Build Coastguard Worker 3081*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$1 3082*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3083*6a54128fSAndroid Build Coastguard Worker func_convert_core_msys_to_w32 "$1" 3084*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$func_convert_core_msys_to_w32_result 3085*6a54128fSAndroid Build Coastguard Worker fi 3086*6a54128fSAndroid Build Coastguard Worker func_convert_file_check "$1" "$func_to_host_file_result" 3087*6a54128fSAndroid Build Coastguard Worker} 3088*6a54128fSAndroid Build Coastguard Worker# end func_convert_file_msys_to_w32 3089*6a54128fSAndroid Build Coastguard Worker 3090*6a54128fSAndroid Build Coastguard Worker 3091*6a54128fSAndroid Build Coastguard Worker# func_convert_file_cygwin_to_w32 ARG 3092*6a54128fSAndroid Build Coastguard Worker# Convert file name ARG from Cygwin to w32 format. Returns result in 3093*6a54128fSAndroid Build Coastguard Worker# func_to_host_file_result. 3094*6a54128fSAndroid Build Coastguard Workerfunc_convert_file_cygwin_to_w32 () 3095*6a54128fSAndroid Build Coastguard Worker{ 3096*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3097*6a54128fSAndroid Build Coastguard Worker 3098*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$1 3099*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3100*6a54128fSAndroid Build Coastguard Worker # because $build is cygwin, we call "the" cygpath in $PATH; no need to use 3101*6a54128fSAndroid Build Coastguard Worker # LT_CYGPATH in this case. 3102*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=`cygpath -m "$1"` 3103*6a54128fSAndroid Build Coastguard Worker fi 3104*6a54128fSAndroid Build Coastguard Worker func_convert_file_check "$1" "$func_to_host_file_result" 3105*6a54128fSAndroid Build Coastguard Worker} 3106*6a54128fSAndroid Build Coastguard Worker# end func_convert_file_cygwin_to_w32 3107*6a54128fSAndroid Build Coastguard Worker 3108*6a54128fSAndroid Build Coastguard Worker 3109*6a54128fSAndroid Build Coastguard Worker# func_convert_file_nix_to_w32 ARG 3110*6a54128fSAndroid Build Coastguard Worker# Convert file name ARG from *nix to w32 format. Requires a wine environment 3111*6a54128fSAndroid Build Coastguard Worker# and a working winepath. Returns result in func_to_host_file_result. 3112*6a54128fSAndroid Build Coastguard Workerfunc_convert_file_nix_to_w32 () 3113*6a54128fSAndroid Build Coastguard Worker{ 3114*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3115*6a54128fSAndroid Build Coastguard Worker 3116*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$1 3117*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3118*6a54128fSAndroid Build Coastguard Worker func_convert_core_file_wine_to_w32 "$1" 3119*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$func_convert_core_file_wine_to_w32_result 3120*6a54128fSAndroid Build Coastguard Worker fi 3121*6a54128fSAndroid Build Coastguard Worker func_convert_file_check "$1" "$func_to_host_file_result" 3122*6a54128fSAndroid Build Coastguard Worker} 3123*6a54128fSAndroid Build Coastguard Worker# end func_convert_file_nix_to_w32 3124*6a54128fSAndroid Build Coastguard Worker 3125*6a54128fSAndroid Build Coastguard Worker 3126*6a54128fSAndroid Build Coastguard Worker# func_convert_file_msys_to_cygwin ARG 3127*6a54128fSAndroid Build Coastguard Worker# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 3128*6a54128fSAndroid Build Coastguard Worker# Returns result in func_to_host_file_result. 3129*6a54128fSAndroid Build Coastguard Workerfunc_convert_file_msys_to_cygwin () 3130*6a54128fSAndroid Build Coastguard Worker{ 3131*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3132*6a54128fSAndroid Build Coastguard Worker 3133*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$1 3134*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3135*6a54128fSAndroid Build Coastguard Worker func_convert_core_msys_to_w32 "$1" 3136*6a54128fSAndroid Build Coastguard Worker func_cygpath -u "$func_convert_core_msys_to_w32_result" 3137*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$func_cygpath_result 3138*6a54128fSAndroid Build Coastguard Worker fi 3139*6a54128fSAndroid Build Coastguard Worker func_convert_file_check "$1" "$func_to_host_file_result" 3140*6a54128fSAndroid Build Coastguard Worker} 3141*6a54128fSAndroid Build Coastguard Worker# end func_convert_file_msys_to_cygwin 3142*6a54128fSAndroid Build Coastguard Worker 3143*6a54128fSAndroid Build Coastguard Worker 3144*6a54128fSAndroid Build Coastguard Worker# func_convert_file_nix_to_cygwin ARG 3145*6a54128fSAndroid Build Coastguard Worker# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed 3146*6a54128fSAndroid Build Coastguard Worker# in a wine environment, working winepath, and LT_CYGPATH set. Returns result 3147*6a54128fSAndroid Build Coastguard Worker# in func_to_host_file_result. 3148*6a54128fSAndroid Build Coastguard Workerfunc_convert_file_nix_to_cygwin () 3149*6a54128fSAndroid Build Coastguard Worker{ 3150*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3151*6a54128fSAndroid Build Coastguard Worker 3152*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$1 3153*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3154*6a54128fSAndroid Build Coastguard Worker # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. 3155*6a54128fSAndroid Build Coastguard Worker func_convert_core_file_wine_to_w32 "$1" 3156*6a54128fSAndroid Build Coastguard Worker func_cygpath -u "$func_convert_core_file_wine_to_w32_result" 3157*6a54128fSAndroid Build Coastguard Worker func_to_host_file_result=$func_cygpath_result 3158*6a54128fSAndroid Build Coastguard Worker fi 3159*6a54128fSAndroid Build Coastguard Worker func_convert_file_check "$1" "$func_to_host_file_result" 3160*6a54128fSAndroid Build Coastguard Worker} 3161*6a54128fSAndroid Build Coastguard Worker# end func_convert_file_nix_to_cygwin 3162*6a54128fSAndroid Build Coastguard Worker 3163*6a54128fSAndroid Build Coastguard Worker 3164*6a54128fSAndroid Build Coastguard Worker############################################# 3165*6a54128fSAndroid Build Coastguard Worker# $build to $host PATH CONVERSION FUNCTIONS # 3166*6a54128fSAndroid Build Coastguard Worker############################################# 3167*6a54128fSAndroid Build Coastguard Worker# invoked via '$to_host_path_cmd ARG' 3168*6a54128fSAndroid Build Coastguard Worker# 3169*6a54128fSAndroid Build Coastguard Worker# In each case, ARG is the path to be converted from $build to $host format. 3170*6a54128fSAndroid Build Coastguard Worker# The result will be available in $func_to_host_path_result. 3171*6a54128fSAndroid Build Coastguard Worker# 3172*6a54128fSAndroid Build Coastguard Worker# Path separators are also converted from $build format to $host format. If 3173*6a54128fSAndroid Build Coastguard Worker# ARG begins or ends with a path separator character, it is preserved (but 3174*6a54128fSAndroid Build Coastguard Worker# converted to $host format) on output. 3175*6a54128fSAndroid Build Coastguard Worker# 3176*6a54128fSAndroid Build Coastguard Worker# All path conversion functions are named using the following convention: 3177*6a54128fSAndroid Build Coastguard Worker# file name conversion function : func_convert_file_X_to_Y () 3178*6a54128fSAndroid Build Coastguard Worker# path conversion function : func_convert_path_X_to_Y () 3179*6a54128fSAndroid Build Coastguard Worker# where, for any given $build/$host combination the 'X_to_Y' value is the 3180*6a54128fSAndroid Build Coastguard Worker# same. If conversion functions are added for new $build/$host combinations, 3181*6a54128fSAndroid Build Coastguard Worker# the two new functions must follow this pattern, or func_init_to_host_path_cmd 3182*6a54128fSAndroid Build Coastguard Worker# will break. 3183*6a54128fSAndroid Build Coastguard Worker 3184*6a54128fSAndroid Build Coastguard Worker 3185*6a54128fSAndroid Build Coastguard Worker# func_init_to_host_path_cmd 3186*6a54128fSAndroid Build Coastguard Worker# Ensures that function "pointer" variable $to_host_path_cmd is set to the 3187*6a54128fSAndroid Build Coastguard Worker# appropriate value, based on the value of $to_host_file_cmd. 3188*6a54128fSAndroid Build Coastguard Workerto_host_path_cmd= 3189*6a54128fSAndroid Build Coastguard Workerfunc_init_to_host_path_cmd () 3190*6a54128fSAndroid Build Coastguard Worker{ 3191*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3192*6a54128fSAndroid Build Coastguard Worker 3193*6a54128fSAndroid Build Coastguard Worker if test -z "$to_host_path_cmd"; then 3194*6a54128fSAndroid Build Coastguard Worker func_stripname 'func_convert_file_' '' "$to_host_file_cmd" 3195*6a54128fSAndroid Build Coastguard Worker to_host_path_cmd=func_convert_path_$func_stripname_result 3196*6a54128fSAndroid Build Coastguard Worker fi 3197*6a54128fSAndroid Build Coastguard Worker} 3198*6a54128fSAndroid Build Coastguard Worker 3199*6a54128fSAndroid Build Coastguard Worker 3200*6a54128fSAndroid Build Coastguard Worker# func_to_host_path ARG 3201*6a54128fSAndroid Build Coastguard Worker# Converts the path ARG from $build format to $host format. Return result 3202*6a54128fSAndroid Build Coastguard Worker# in func_to_host_path_result. 3203*6a54128fSAndroid Build Coastguard Workerfunc_to_host_path () 3204*6a54128fSAndroid Build Coastguard Worker{ 3205*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3206*6a54128fSAndroid Build Coastguard Worker 3207*6a54128fSAndroid Build Coastguard Worker func_init_to_host_path_cmd 3208*6a54128fSAndroid Build Coastguard Worker $to_host_path_cmd "$1" 3209*6a54128fSAndroid Build Coastguard Worker} 3210*6a54128fSAndroid Build Coastguard Worker# end func_to_host_path 3211*6a54128fSAndroid Build Coastguard Worker 3212*6a54128fSAndroid Build Coastguard Worker 3213*6a54128fSAndroid Build Coastguard Worker# func_convert_path_noop ARG 3214*6a54128fSAndroid Build Coastguard Worker# Copy ARG to func_to_host_path_result. 3215*6a54128fSAndroid Build Coastguard Workerfunc_convert_path_noop () 3216*6a54128fSAndroid Build Coastguard Worker{ 3217*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$1 3218*6a54128fSAndroid Build Coastguard Worker} 3219*6a54128fSAndroid Build Coastguard Worker# end func_convert_path_noop 3220*6a54128fSAndroid Build Coastguard Worker 3221*6a54128fSAndroid Build Coastguard Worker 3222*6a54128fSAndroid Build Coastguard Worker# func_convert_path_msys_to_w32 ARG 3223*6a54128fSAndroid Build Coastguard Worker# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic 3224*6a54128fSAndroid Build Coastguard Worker# conversion to w32 is not available inside the cwrapper. Returns result in 3225*6a54128fSAndroid Build Coastguard Worker# func_to_host_path_result. 3226*6a54128fSAndroid Build Coastguard Workerfunc_convert_path_msys_to_w32 () 3227*6a54128fSAndroid Build Coastguard Worker{ 3228*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3229*6a54128fSAndroid Build Coastguard Worker 3230*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$1 3231*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3232*6a54128fSAndroid Build Coastguard Worker # Remove leading and trailing path separator characters from ARG. MSYS 3233*6a54128fSAndroid Build Coastguard Worker # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; 3234*6a54128fSAndroid Build Coastguard Worker # and winepath ignores them completely. 3235*6a54128fSAndroid Build Coastguard Worker func_stripname : : "$1" 3236*6a54128fSAndroid Build Coastguard Worker func_to_host_path_tmp1=$func_stripname_result 3237*6a54128fSAndroid Build Coastguard Worker func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 3238*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$func_convert_core_msys_to_w32_result 3239*6a54128fSAndroid Build Coastguard Worker func_convert_path_check : ";" \ 3240*6a54128fSAndroid Build Coastguard Worker "$func_to_host_path_tmp1" "$func_to_host_path_result" 3241*6a54128fSAndroid Build Coastguard Worker func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 3242*6a54128fSAndroid Build Coastguard Worker fi 3243*6a54128fSAndroid Build Coastguard Worker} 3244*6a54128fSAndroid Build Coastguard Worker# end func_convert_path_msys_to_w32 3245*6a54128fSAndroid Build Coastguard Worker 3246*6a54128fSAndroid Build Coastguard Worker 3247*6a54128fSAndroid Build Coastguard Worker# func_convert_path_cygwin_to_w32 ARG 3248*6a54128fSAndroid Build Coastguard Worker# Convert path ARG from Cygwin to w32 format. Returns result in 3249*6a54128fSAndroid Build Coastguard Worker# func_to_host_file_result. 3250*6a54128fSAndroid Build Coastguard Workerfunc_convert_path_cygwin_to_w32 () 3251*6a54128fSAndroid Build Coastguard Worker{ 3252*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3253*6a54128fSAndroid Build Coastguard Worker 3254*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$1 3255*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3256*6a54128fSAndroid Build Coastguard Worker # See func_convert_path_msys_to_w32: 3257*6a54128fSAndroid Build Coastguard Worker func_stripname : : "$1" 3258*6a54128fSAndroid Build Coastguard Worker func_to_host_path_tmp1=$func_stripname_result 3259*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` 3260*6a54128fSAndroid Build Coastguard Worker func_convert_path_check : ";" \ 3261*6a54128fSAndroid Build Coastguard Worker "$func_to_host_path_tmp1" "$func_to_host_path_result" 3262*6a54128fSAndroid Build Coastguard Worker func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 3263*6a54128fSAndroid Build Coastguard Worker fi 3264*6a54128fSAndroid Build Coastguard Worker} 3265*6a54128fSAndroid Build Coastguard Worker# end func_convert_path_cygwin_to_w32 3266*6a54128fSAndroid Build Coastguard Worker 3267*6a54128fSAndroid Build Coastguard Worker 3268*6a54128fSAndroid Build Coastguard Worker# func_convert_path_nix_to_w32 ARG 3269*6a54128fSAndroid Build Coastguard Worker# Convert path ARG from *nix to w32 format. Requires a wine environment and 3270*6a54128fSAndroid Build Coastguard Worker# a working winepath. Returns result in func_to_host_file_result. 3271*6a54128fSAndroid Build Coastguard Workerfunc_convert_path_nix_to_w32 () 3272*6a54128fSAndroid Build Coastguard Worker{ 3273*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3274*6a54128fSAndroid Build Coastguard Worker 3275*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$1 3276*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3277*6a54128fSAndroid Build Coastguard Worker # See func_convert_path_msys_to_w32: 3278*6a54128fSAndroid Build Coastguard Worker func_stripname : : "$1" 3279*6a54128fSAndroid Build Coastguard Worker func_to_host_path_tmp1=$func_stripname_result 3280*6a54128fSAndroid Build Coastguard Worker func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 3281*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$func_convert_core_path_wine_to_w32_result 3282*6a54128fSAndroid Build Coastguard Worker func_convert_path_check : ";" \ 3283*6a54128fSAndroid Build Coastguard Worker "$func_to_host_path_tmp1" "$func_to_host_path_result" 3284*6a54128fSAndroid Build Coastguard Worker func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" 3285*6a54128fSAndroid Build Coastguard Worker fi 3286*6a54128fSAndroid Build Coastguard Worker} 3287*6a54128fSAndroid Build Coastguard Worker# end func_convert_path_nix_to_w32 3288*6a54128fSAndroid Build Coastguard Worker 3289*6a54128fSAndroid Build Coastguard Worker 3290*6a54128fSAndroid Build Coastguard Worker# func_convert_path_msys_to_cygwin ARG 3291*6a54128fSAndroid Build Coastguard Worker# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. 3292*6a54128fSAndroid Build Coastguard Worker# Returns result in func_to_host_file_result. 3293*6a54128fSAndroid Build Coastguard Workerfunc_convert_path_msys_to_cygwin () 3294*6a54128fSAndroid Build Coastguard Worker{ 3295*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3296*6a54128fSAndroid Build Coastguard Worker 3297*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$1 3298*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3299*6a54128fSAndroid Build Coastguard Worker # See func_convert_path_msys_to_w32: 3300*6a54128fSAndroid Build Coastguard Worker func_stripname : : "$1" 3301*6a54128fSAndroid Build Coastguard Worker func_to_host_path_tmp1=$func_stripname_result 3302*6a54128fSAndroid Build Coastguard Worker func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" 3303*6a54128fSAndroid Build Coastguard Worker func_cygpath -u -p "$func_convert_core_msys_to_w32_result" 3304*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$func_cygpath_result 3305*6a54128fSAndroid Build Coastguard Worker func_convert_path_check : : \ 3306*6a54128fSAndroid Build Coastguard Worker "$func_to_host_path_tmp1" "$func_to_host_path_result" 3307*6a54128fSAndroid Build Coastguard Worker func_convert_path_front_back_pathsep ":*" "*:" : "$1" 3308*6a54128fSAndroid Build Coastguard Worker fi 3309*6a54128fSAndroid Build Coastguard Worker} 3310*6a54128fSAndroid Build Coastguard Worker# end func_convert_path_msys_to_cygwin 3311*6a54128fSAndroid Build Coastguard Worker 3312*6a54128fSAndroid Build Coastguard Worker 3313*6a54128fSAndroid Build Coastguard Worker# func_convert_path_nix_to_cygwin ARG 3314*6a54128fSAndroid Build Coastguard Worker# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a 3315*6a54128fSAndroid Build Coastguard Worker# a wine environment, working winepath, and LT_CYGPATH set. Returns result in 3316*6a54128fSAndroid Build Coastguard Worker# func_to_host_file_result. 3317*6a54128fSAndroid Build Coastguard Workerfunc_convert_path_nix_to_cygwin () 3318*6a54128fSAndroid Build Coastguard Worker{ 3319*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3320*6a54128fSAndroid Build Coastguard Worker 3321*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$1 3322*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 3323*6a54128fSAndroid Build Coastguard Worker # Remove leading and trailing path separator characters from 3324*6a54128fSAndroid Build Coastguard Worker # ARG. msys behavior is inconsistent here, cygpath turns them 3325*6a54128fSAndroid Build Coastguard Worker # into '.;' and ';.', and winepath ignores them completely. 3326*6a54128fSAndroid Build Coastguard Worker func_stripname : : "$1" 3327*6a54128fSAndroid Build Coastguard Worker func_to_host_path_tmp1=$func_stripname_result 3328*6a54128fSAndroid Build Coastguard Worker func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" 3329*6a54128fSAndroid Build Coastguard Worker func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" 3330*6a54128fSAndroid Build Coastguard Worker func_to_host_path_result=$func_cygpath_result 3331*6a54128fSAndroid Build Coastguard Worker func_convert_path_check : : \ 3332*6a54128fSAndroid Build Coastguard Worker "$func_to_host_path_tmp1" "$func_to_host_path_result" 3333*6a54128fSAndroid Build Coastguard Worker func_convert_path_front_back_pathsep ":*" "*:" : "$1" 3334*6a54128fSAndroid Build Coastguard Worker fi 3335*6a54128fSAndroid Build Coastguard Worker} 3336*6a54128fSAndroid Build Coastguard Worker# end func_convert_path_nix_to_cygwin 3337*6a54128fSAndroid Build Coastguard Worker 3338*6a54128fSAndroid Build Coastguard Worker 3339*6a54128fSAndroid Build Coastguard Worker# func_dll_def_p FILE 3340*6a54128fSAndroid Build Coastguard Worker# True iff FILE is a Windows DLL '.def' file. 3341*6a54128fSAndroid Build Coastguard Worker# Keep in sync with _LT_DLL_DEF_P in libtool.m4 3342*6a54128fSAndroid Build Coastguard Workerfunc_dll_def_p () 3343*6a54128fSAndroid Build Coastguard Worker{ 3344*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3345*6a54128fSAndroid Build Coastguard Worker 3346*6a54128fSAndroid Build Coastguard Worker func_dll_def_p_tmp=`$SED -n \ 3347*6a54128fSAndroid Build Coastguard Worker -e 's/^[ ]*//' \ 3348*6a54128fSAndroid Build Coastguard Worker -e '/^\(;.*\)*$/d' \ 3349*6a54128fSAndroid Build Coastguard Worker -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ 3350*6a54128fSAndroid Build Coastguard Worker -e q \ 3351*6a54128fSAndroid Build Coastguard Worker "$1"` 3352*6a54128fSAndroid Build Coastguard Worker test DEF = "$func_dll_def_p_tmp" 3353*6a54128fSAndroid Build Coastguard Worker} 3354*6a54128fSAndroid Build Coastguard Worker 3355*6a54128fSAndroid Build Coastguard Worker 3356*6a54128fSAndroid Build Coastguard Worker# func_mode_compile arg... 3357*6a54128fSAndroid Build Coastguard Workerfunc_mode_compile () 3358*6a54128fSAndroid Build Coastguard Worker{ 3359*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3360*6a54128fSAndroid Build Coastguard Worker 3361*6a54128fSAndroid Build Coastguard Worker # Get the compilation command and the source file. 3362*6a54128fSAndroid Build Coastguard Worker base_compile= 3363*6a54128fSAndroid Build Coastguard Worker srcfile=$nonopt # always keep a non-empty value in "srcfile" 3364*6a54128fSAndroid Build Coastguard Worker suppress_opt=yes 3365*6a54128fSAndroid Build Coastguard Worker suppress_output= 3366*6a54128fSAndroid Build Coastguard Worker arg_mode=normal 3367*6a54128fSAndroid Build Coastguard Worker libobj= 3368*6a54128fSAndroid Build Coastguard Worker later= 3369*6a54128fSAndroid Build Coastguard Worker pie_flag= 3370*6a54128fSAndroid Build Coastguard Worker 3371*6a54128fSAndroid Build Coastguard Worker for arg 3372*6a54128fSAndroid Build Coastguard Worker do 3373*6a54128fSAndroid Build Coastguard Worker case $arg_mode in 3374*6a54128fSAndroid Build Coastguard Worker arg ) 3375*6a54128fSAndroid Build Coastguard Worker # do not "continue". Instead, add this to base_compile 3376*6a54128fSAndroid Build Coastguard Worker lastarg=$arg 3377*6a54128fSAndroid Build Coastguard Worker arg_mode=normal 3378*6a54128fSAndroid Build Coastguard Worker ;; 3379*6a54128fSAndroid Build Coastguard Worker 3380*6a54128fSAndroid Build Coastguard Worker target ) 3381*6a54128fSAndroid Build Coastguard Worker libobj=$arg 3382*6a54128fSAndroid Build Coastguard Worker arg_mode=normal 3383*6a54128fSAndroid Build Coastguard Worker continue 3384*6a54128fSAndroid Build Coastguard Worker ;; 3385*6a54128fSAndroid Build Coastguard Worker 3386*6a54128fSAndroid Build Coastguard Worker normal ) 3387*6a54128fSAndroid Build Coastguard Worker # Accept any command-line options. 3388*6a54128fSAndroid Build Coastguard Worker case $arg in 3389*6a54128fSAndroid Build Coastguard Worker -o) 3390*6a54128fSAndroid Build Coastguard Worker test -n "$libobj" && \ 3391*6a54128fSAndroid Build Coastguard Worker func_fatal_error "you cannot specify '-o' more than once" 3392*6a54128fSAndroid Build Coastguard Worker arg_mode=target 3393*6a54128fSAndroid Build Coastguard Worker continue 3394*6a54128fSAndroid Build Coastguard Worker ;; 3395*6a54128fSAndroid Build Coastguard Worker 3396*6a54128fSAndroid Build Coastguard Worker -pie | -fpie | -fPIE) 3397*6a54128fSAndroid Build Coastguard Worker func_append pie_flag " $arg" 3398*6a54128fSAndroid Build Coastguard Worker continue 3399*6a54128fSAndroid Build Coastguard Worker ;; 3400*6a54128fSAndroid Build Coastguard Worker 3401*6a54128fSAndroid Build Coastguard Worker -shared | -static | -prefer-pic | -prefer-non-pic) 3402*6a54128fSAndroid Build Coastguard Worker func_append later " $arg" 3403*6a54128fSAndroid Build Coastguard Worker continue 3404*6a54128fSAndroid Build Coastguard Worker ;; 3405*6a54128fSAndroid Build Coastguard Worker 3406*6a54128fSAndroid Build Coastguard Worker -no-suppress) 3407*6a54128fSAndroid Build Coastguard Worker suppress_opt=no 3408*6a54128fSAndroid Build Coastguard Worker continue 3409*6a54128fSAndroid Build Coastguard Worker ;; 3410*6a54128fSAndroid Build Coastguard Worker 3411*6a54128fSAndroid Build Coastguard Worker -Xcompiler) 3412*6a54128fSAndroid Build Coastguard Worker arg_mode=arg # the next one goes into the "base_compile" arg list 3413*6a54128fSAndroid Build Coastguard Worker continue # The current "srcfile" will either be retained or 3414*6a54128fSAndroid Build Coastguard Worker ;; # replaced later. I would guess that would be a bug. 3415*6a54128fSAndroid Build Coastguard Worker 3416*6a54128fSAndroid Build Coastguard Worker -Wc,*) 3417*6a54128fSAndroid Build Coastguard Worker func_stripname '-Wc,' '' "$arg" 3418*6a54128fSAndroid Build Coastguard Worker args=$func_stripname_result 3419*6a54128fSAndroid Build Coastguard Worker lastarg= 3420*6a54128fSAndroid Build Coastguard Worker save_ifs=$IFS; IFS=, 3421*6a54128fSAndroid Build Coastguard Worker for arg in $args; do 3422*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 3423*6a54128fSAndroid Build Coastguard Worker func_append_quoted lastarg "$arg" 3424*6a54128fSAndroid Build Coastguard Worker done 3425*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 3426*6a54128fSAndroid Build Coastguard Worker func_stripname ' ' '' "$lastarg" 3427*6a54128fSAndroid Build Coastguard Worker lastarg=$func_stripname_result 3428*6a54128fSAndroid Build Coastguard Worker 3429*6a54128fSAndroid Build Coastguard Worker # Add the arguments to base_compile. 3430*6a54128fSAndroid Build Coastguard Worker func_append base_compile " $lastarg" 3431*6a54128fSAndroid Build Coastguard Worker continue 3432*6a54128fSAndroid Build Coastguard Worker ;; 3433*6a54128fSAndroid Build Coastguard Worker 3434*6a54128fSAndroid Build Coastguard Worker *) 3435*6a54128fSAndroid Build Coastguard Worker # Accept the current argument as the source file. 3436*6a54128fSAndroid Build Coastguard Worker # The previous "srcfile" becomes the current argument. 3437*6a54128fSAndroid Build Coastguard Worker # 3438*6a54128fSAndroid Build Coastguard Worker lastarg=$srcfile 3439*6a54128fSAndroid Build Coastguard Worker srcfile=$arg 3440*6a54128fSAndroid Build Coastguard Worker ;; 3441*6a54128fSAndroid Build Coastguard Worker esac # case $arg 3442*6a54128fSAndroid Build Coastguard Worker ;; 3443*6a54128fSAndroid Build Coastguard Worker esac # case $arg_mode 3444*6a54128fSAndroid Build Coastguard Worker 3445*6a54128fSAndroid Build Coastguard Worker # Aesthetically quote the previous argument. 3446*6a54128fSAndroid Build Coastguard Worker func_append_quoted base_compile "$lastarg" 3447*6a54128fSAndroid Build Coastguard Worker done # for arg 3448*6a54128fSAndroid Build Coastguard Worker 3449*6a54128fSAndroid Build Coastguard Worker case $arg_mode in 3450*6a54128fSAndroid Build Coastguard Worker arg) 3451*6a54128fSAndroid Build Coastguard Worker func_fatal_error "you must specify an argument for -Xcompile" 3452*6a54128fSAndroid Build Coastguard Worker ;; 3453*6a54128fSAndroid Build Coastguard Worker target) 3454*6a54128fSAndroid Build Coastguard Worker func_fatal_error "you must specify a target with '-o'" 3455*6a54128fSAndroid Build Coastguard Worker ;; 3456*6a54128fSAndroid Build Coastguard Worker *) 3457*6a54128fSAndroid Build Coastguard Worker # Get the name of the library object. 3458*6a54128fSAndroid Build Coastguard Worker test -z "$libobj" && { 3459*6a54128fSAndroid Build Coastguard Worker func_basename "$srcfile" 3460*6a54128fSAndroid Build Coastguard Worker libobj=$func_basename_result 3461*6a54128fSAndroid Build Coastguard Worker } 3462*6a54128fSAndroid Build Coastguard Worker ;; 3463*6a54128fSAndroid Build Coastguard Worker esac 3464*6a54128fSAndroid Build Coastguard Worker 3465*6a54128fSAndroid Build Coastguard Worker # Recognize several different file suffixes. 3466*6a54128fSAndroid Build Coastguard Worker # If the user specifies -o file.o, it is replaced with file.lo 3467*6a54128fSAndroid Build Coastguard Worker case $libobj in 3468*6a54128fSAndroid Build Coastguard Worker *.[cCFSifmso] | \ 3469*6a54128fSAndroid Build Coastguard Worker *.ada | *.adb | *.ads | *.asm | \ 3470*6a54128fSAndroid Build Coastguard Worker *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ 3471*6a54128fSAndroid Build Coastguard Worker *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) 3472*6a54128fSAndroid Build Coastguard Worker func_xform "$libobj" 3473*6a54128fSAndroid Build Coastguard Worker libobj=$func_xform_result 3474*6a54128fSAndroid Build Coastguard Worker ;; 3475*6a54128fSAndroid Build Coastguard Worker esac 3476*6a54128fSAndroid Build Coastguard Worker 3477*6a54128fSAndroid Build Coastguard Worker case $libobj in 3478*6a54128fSAndroid Build Coastguard Worker *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; 3479*6a54128fSAndroid Build Coastguard Worker *) 3480*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot determine name of library object from '$libobj'" 3481*6a54128fSAndroid Build Coastguard Worker ;; 3482*6a54128fSAndroid Build Coastguard Worker esac 3483*6a54128fSAndroid Build Coastguard Worker 3484*6a54128fSAndroid Build Coastguard Worker func_infer_tag $base_compile 3485*6a54128fSAndroid Build Coastguard Worker 3486*6a54128fSAndroid Build Coastguard Worker for arg in $later; do 3487*6a54128fSAndroid Build Coastguard Worker case $arg in 3488*6a54128fSAndroid Build Coastguard Worker -shared) 3489*6a54128fSAndroid Build Coastguard Worker test yes = "$build_libtool_libs" \ 3490*6a54128fSAndroid Build Coastguard Worker || func_fatal_configuration "cannot build a shared library" 3491*6a54128fSAndroid Build Coastguard Worker build_old_libs=no 3492*6a54128fSAndroid Build Coastguard Worker continue 3493*6a54128fSAndroid Build Coastguard Worker ;; 3494*6a54128fSAndroid Build Coastguard Worker 3495*6a54128fSAndroid Build Coastguard Worker -static) 3496*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=no 3497*6a54128fSAndroid Build Coastguard Worker build_old_libs=yes 3498*6a54128fSAndroid Build Coastguard Worker continue 3499*6a54128fSAndroid Build Coastguard Worker ;; 3500*6a54128fSAndroid Build Coastguard Worker 3501*6a54128fSAndroid Build Coastguard Worker -prefer-pic) 3502*6a54128fSAndroid Build Coastguard Worker pic_mode=yes 3503*6a54128fSAndroid Build Coastguard Worker continue 3504*6a54128fSAndroid Build Coastguard Worker ;; 3505*6a54128fSAndroid Build Coastguard Worker 3506*6a54128fSAndroid Build Coastguard Worker -prefer-non-pic) 3507*6a54128fSAndroid Build Coastguard Worker pic_mode=no 3508*6a54128fSAndroid Build Coastguard Worker continue 3509*6a54128fSAndroid Build Coastguard Worker ;; 3510*6a54128fSAndroid Build Coastguard Worker esac 3511*6a54128fSAndroid Build Coastguard Worker done 3512*6a54128fSAndroid Build Coastguard Worker 3513*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$libobj" 3514*6a54128fSAndroid Build Coastguard Worker test "X$libobj" != "X$func_quote_for_eval_result" \ 3515*6a54128fSAndroid Build Coastguard Worker && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ 3516*6a54128fSAndroid Build Coastguard Worker && func_warning "libobj name '$libobj' may not contain shell special characters." 3517*6a54128fSAndroid Build Coastguard Worker func_dirname_and_basename "$obj" "/" "" 3518*6a54128fSAndroid Build Coastguard Worker objname=$func_basename_result 3519*6a54128fSAndroid Build Coastguard Worker xdir=$func_dirname_result 3520*6a54128fSAndroid Build Coastguard Worker lobj=$xdir$objdir/$objname 3521*6a54128fSAndroid Build Coastguard Worker 3522*6a54128fSAndroid Build Coastguard Worker test -z "$base_compile" && \ 3523*6a54128fSAndroid Build Coastguard Worker func_fatal_help "you must specify a compilation command" 3524*6a54128fSAndroid Build Coastguard Worker 3525*6a54128fSAndroid Build Coastguard Worker # Delete any leftover library objects. 3526*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_old_libs"; then 3527*6a54128fSAndroid Build Coastguard Worker removelist="$obj $lobj $libobj ${libobj}T" 3528*6a54128fSAndroid Build Coastguard Worker else 3529*6a54128fSAndroid Build Coastguard Worker removelist="$lobj $libobj ${libobj}T" 3530*6a54128fSAndroid Build Coastguard Worker fi 3531*6a54128fSAndroid Build Coastguard Worker 3532*6a54128fSAndroid Build Coastguard Worker # On Cygwin there's no "real" PIC flag so we must build both object types 3533*6a54128fSAndroid Build Coastguard Worker case $host_os in 3534*6a54128fSAndroid Build Coastguard Worker cygwin* | mingw* | pw32* | os2* | cegcc*) 3535*6a54128fSAndroid Build Coastguard Worker pic_mode=default 3536*6a54128fSAndroid Build Coastguard Worker ;; 3537*6a54128fSAndroid Build Coastguard Worker esac 3538*6a54128fSAndroid Build Coastguard Worker if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then 3539*6a54128fSAndroid Build Coastguard Worker # non-PIC code in shared libraries is not supported 3540*6a54128fSAndroid Build Coastguard Worker pic_mode=default 3541*6a54128fSAndroid Build Coastguard Worker fi 3542*6a54128fSAndroid Build Coastguard Worker 3543*6a54128fSAndroid Build Coastguard Worker # Calculate the filename of the output object if compiler does 3544*6a54128fSAndroid Build Coastguard Worker # not support -o with -c 3545*6a54128fSAndroid Build Coastguard Worker if test no = "$compiler_c_o"; then 3546*6a54128fSAndroid Build Coastguard Worker output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext 3547*6a54128fSAndroid Build Coastguard Worker lockfile=$output_obj.lock 3548*6a54128fSAndroid Build Coastguard Worker else 3549*6a54128fSAndroid Build Coastguard Worker output_obj= 3550*6a54128fSAndroid Build Coastguard Worker need_locks=no 3551*6a54128fSAndroid Build Coastguard Worker lockfile= 3552*6a54128fSAndroid Build Coastguard Worker fi 3553*6a54128fSAndroid Build Coastguard Worker 3554*6a54128fSAndroid Build Coastguard Worker # Lock this critical section if it is needed 3555*6a54128fSAndroid Build Coastguard Worker # We use this script file to make the link, it avoids creating a new file 3556*6a54128fSAndroid Build Coastguard Worker if test yes = "$need_locks"; then 3557*6a54128fSAndroid Build Coastguard Worker until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 3558*6a54128fSAndroid Build Coastguard Worker func_echo "Waiting for $lockfile to be removed" 3559*6a54128fSAndroid Build Coastguard Worker sleep 2 3560*6a54128fSAndroid Build Coastguard Worker done 3561*6a54128fSAndroid Build Coastguard Worker elif test warn = "$need_locks"; then 3562*6a54128fSAndroid Build Coastguard Worker if test -f "$lockfile"; then 3563*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 3564*6a54128fSAndroid Build Coastguard Worker*** ERROR, $lockfile exists and contains: 3565*6a54128fSAndroid Build Coastguard Worker`cat $lockfile 2>/dev/null` 3566*6a54128fSAndroid Build Coastguard Worker 3567*6a54128fSAndroid Build Coastguard WorkerThis indicates that another process is trying to use the same 3568*6a54128fSAndroid Build Coastguard Workertemporary object file, and libtool could not work around it because 3569*6a54128fSAndroid Build Coastguard Workeryour compiler does not support '-c' and '-o' together. If you 3570*6a54128fSAndroid Build Coastguard Workerrepeat this compilation, it may succeed, by chance, but you had better 3571*6a54128fSAndroid Build Coastguard Workeravoid parallel builds (make -j) in this platform, or get a better 3572*6a54128fSAndroid Build Coastguard Workercompiler." 3573*6a54128fSAndroid Build Coastguard Worker 3574*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM $removelist 3575*6a54128fSAndroid Build Coastguard Worker exit $EXIT_FAILURE 3576*6a54128fSAndroid Build Coastguard Worker fi 3577*6a54128fSAndroid Build Coastguard Worker func_append removelist " $output_obj" 3578*6a54128fSAndroid Build Coastguard Worker $ECHO "$srcfile" > "$lockfile" 3579*6a54128fSAndroid Build Coastguard Worker fi 3580*6a54128fSAndroid Build Coastguard Worker 3581*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM $removelist 3582*6a54128fSAndroid Build Coastguard Worker func_append removelist " $lockfile" 3583*6a54128fSAndroid Build Coastguard Worker trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 3584*6a54128fSAndroid Build Coastguard Worker 3585*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 3586*6a54128fSAndroid Build Coastguard Worker srcfile=$func_to_tool_file_result 3587*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$srcfile" 3588*6a54128fSAndroid Build Coastguard Worker qsrcfile=$func_quote_for_eval_result 3589*6a54128fSAndroid Build Coastguard Worker 3590*6a54128fSAndroid Build Coastguard Worker # Only build a PIC object if we are building libtool libraries. 3591*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_libs"; then 3592*6a54128fSAndroid Build Coastguard Worker # Without this assignment, base_compile gets emptied. 3593*6a54128fSAndroid Build Coastguard Worker fbsd_hideous_sh_bug=$base_compile 3594*6a54128fSAndroid Build Coastguard Worker 3595*6a54128fSAndroid Build Coastguard Worker if test no != "$pic_mode"; then 3596*6a54128fSAndroid Build Coastguard Worker command="$base_compile $qsrcfile $pic_flag" 3597*6a54128fSAndroid Build Coastguard Worker else 3598*6a54128fSAndroid Build Coastguard Worker # Don't build PIC code 3599*6a54128fSAndroid Build Coastguard Worker command="$base_compile $qsrcfile" 3600*6a54128fSAndroid Build Coastguard Worker fi 3601*6a54128fSAndroid Build Coastguard Worker 3602*6a54128fSAndroid Build Coastguard Worker func_mkdir_p "$xdir$objdir" 3603*6a54128fSAndroid Build Coastguard Worker 3604*6a54128fSAndroid Build Coastguard Worker if test -z "$output_obj"; then 3605*6a54128fSAndroid Build Coastguard Worker # Place PIC objects in $objdir 3606*6a54128fSAndroid Build Coastguard Worker func_append command " -o $lobj" 3607*6a54128fSAndroid Build Coastguard Worker fi 3608*6a54128fSAndroid Build Coastguard Worker 3609*6a54128fSAndroid Build Coastguard Worker func_show_eval_locale "$command" \ 3610*6a54128fSAndroid Build Coastguard Worker 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 3611*6a54128fSAndroid Build Coastguard Worker 3612*6a54128fSAndroid Build Coastguard Worker if test warn = "$need_locks" && 3613*6a54128fSAndroid Build Coastguard Worker test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 3614*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 3615*6a54128fSAndroid Build Coastguard Worker*** ERROR, $lockfile contains: 3616*6a54128fSAndroid Build Coastguard Worker`cat $lockfile 2>/dev/null` 3617*6a54128fSAndroid Build Coastguard Worker 3618*6a54128fSAndroid Build Coastguard Workerbut it should contain: 3619*6a54128fSAndroid Build Coastguard Worker$srcfile 3620*6a54128fSAndroid Build Coastguard Worker 3621*6a54128fSAndroid Build Coastguard WorkerThis indicates that another process is trying to use the same 3622*6a54128fSAndroid Build Coastguard Workertemporary object file, and libtool could not work around it because 3623*6a54128fSAndroid Build Coastguard Workeryour compiler does not support '-c' and '-o' together. If you 3624*6a54128fSAndroid Build Coastguard Workerrepeat this compilation, it may succeed, by chance, but you had better 3625*6a54128fSAndroid Build Coastguard Workeravoid parallel builds (make -j) in this platform, or get a better 3626*6a54128fSAndroid Build Coastguard Workercompiler." 3627*6a54128fSAndroid Build Coastguard Worker 3628*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM $removelist 3629*6a54128fSAndroid Build Coastguard Worker exit $EXIT_FAILURE 3630*6a54128fSAndroid Build Coastguard Worker fi 3631*6a54128fSAndroid Build Coastguard Worker 3632*6a54128fSAndroid Build Coastguard Worker # Just move the object if needed, then go on to compile the next one 3633*6a54128fSAndroid Build Coastguard Worker if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 3634*6a54128fSAndroid Build Coastguard Worker func_show_eval '$MV "$output_obj" "$lobj"' \ 3635*6a54128fSAndroid Build Coastguard Worker 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 3636*6a54128fSAndroid Build Coastguard Worker fi 3637*6a54128fSAndroid Build Coastguard Worker 3638*6a54128fSAndroid Build Coastguard Worker # Allow error messages only from the first compilation. 3639*6a54128fSAndroid Build Coastguard Worker if test yes = "$suppress_opt"; then 3640*6a54128fSAndroid Build Coastguard Worker suppress_output=' >/dev/null 2>&1' 3641*6a54128fSAndroid Build Coastguard Worker fi 3642*6a54128fSAndroid Build Coastguard Worker fi 3643*6a54128fSAndroid Build Coastguard Worker 3644*6a54128fSAndroid Build Coastguard Worker # Only build a position-dependent object if we build old libraries. 3645*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_old_libs"; then 3646*6a54128fSAndroid Build Coastguard Worker if test yes != "$pic_mode"; then 3647*6a54128fSAndroid Build Coastguard Worker # Don't build PIC code 3648*6a54128fSAndroid Build Coastguard Worker command="$base_compile $qsrcfile$pie_flag" 3649*6a54128fSAndroid Build Coastguard Worker else 3650*6a54128fSAndroid Build Coastguard Worker command="$base_compile $qsrcfile $pic_flag" 3651*6a54128fSAndroid Build Coastguard Worker fi 3652*6a54128fSAndroid Build Coastguard Worker if test yes = "$compiler_c_o"; then 3653*6a54128fSAndroid Build Coastguard Worker func_append command " -o $obj" 3654*6a54128fSAndroid Build Coastguard Worker fi 3655*6a54128fSAndroid Build Coastguard Worker 3656*6a54128fSAndroid Build Coastguard Worker # Suppress compiler output if we already did a PIC compilation. 3657*6a54128fSAndroid Build Coastguard Worker func_append command "$suppress_output" 3658*6a54128fSAndroid Build Coastguard Worker func_show_eval_locale "$command" \ 3659*6a54128fSAndroid Build Coastguard Worker '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 3660*6a54128fSAndroid Build Coastguard Worker 3661*6a54128fSAndroid Build Coastguard Worker if test warn = "$need_locks" && 3662*6a54128fSAndroid Build Coastguard Worker test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 3663*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 3664*6a54128fSAndroid Build Coastguard Worker*** ERROR, $lockfile contains: 3665*6a54128fSAndroid Build Coastguard Worker`cat $lockfile 2>/dev/null` 3666*6a54128fSAndroid Build Coastguard Worker 3667*6a54128fSAndroid Build Coastguard Workerbut it should contain: 3668*6a54128fSAndroid Build Coastguard Worker$srcfile 3669*6a54128fSAndroid Build Coastguard Worker 3670*6a54128fSAndroid Build Coastguard WorkerThis indicates that another process is trying to use the same 3671*6a54128fSAndroid Build Coastguard Workertemporary object file, and libtool could not work around it because 3672*6a54128fSAndroid Build Coastguard Workeryour compiler does not support '-c' and '-o' together. If you 3673*6a54128fSAndroid Build Coastguard Workerrepeat this compilation, it may succeed, by chance, but you had better 3674*6a54128fSAndroid Build Coastguard Workeravoid parallel builds (make -j) in this platform, or get a better 3675*6a54128fSAndroid Build Coastguard Workercompiler." 3676*6a54128fSAndroid Build Coastguard Worker 3677*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM $removelist 3678*6a54128fSAndroid Build Coastguard Worker exit $EXIT_FAILURE 3679*6a54128fSAndroid Build Coastguard Worker fi 3680*6a54128fSAndroid Build Coastguard Worker 3681*6a54128fSAndroid Build Coastguard Worker # Just move the object if needed 3682*6a54128fSAndroid Build Coastguard Worker if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 3683*6a54128fSAndroid Build Coastguard Worker func_show_eval '$MV "$output_obj" "$obj"' \ 3684*6a54128fSAndroid Build Coastguard Worker 'error=$?; $opt_dry_run || $RM $removelist; exit $error' 3685*6a54128fSAndroid Build Coastguard Worker fi 3686*6a54128fSAndroid Build Coastguard Worker fi 3687*6a54128fSAndroid Build Coastguard Worker 3688*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 3689*6a54128fSAndroid Build Coastguard Worker func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" 3690*6a54128fSAndroid Build Coastguard Worker 3691*6a54128fSAndroid Build Coastguard Worker # Unlock the critical section if it was locked 3692*6a54128fSAndroid Build Coastguard Worker if test no != "$need_locks"; then 3693*6a54128fSAndroid Build Coastguard Worker removelist=$lockfile 3694*6a54128fSAndroid Build Coastguard Worker $RM "$lockfile" 3695*6a54128fSAndroid Build Coastguard Worker fi 3696*6a54128fSAndroid Build Coastguard Worker } 3697*6a54128fSAndroid Build Coastguard Worker 3698*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 3699*6a54128fSAndroid Build Coastguard Worker} 3700*6a54128fSAndroid Build Coastguard Worker 3701*6a54128fSAndroid Build Coastguard Worker$opt_help || { 3702*6a54128fSAndroid Build Coastguard Worker test compile = "$opt_mode" && func_mode_compile ${1+"$@"} 3703*6a54128fSAndroid Build Coastguard Worker} 3704*6a54128fSAndroid Build Coastguard Worker 3705*6a54128fSAndroid Build Coastguard Workerfunc_mode_help () 3706*6a54128fSAndroid Build Coastguard Worker{ 3707*6a54128fSAndroid Build Coastguard Worker # We need to display help for each of the modes. 3708*6a54128fSAndroid Build Coastguard Worker case $opt_mode in 3709*6a54128fSAndroid Build Coastguard Worker "") 3710*6a54128fSAndroid Build Coastguard Worker # Generic help is extracted from the usage comments 3711*6a54128fSAndroid Build Coastguard Worker # at the start of this file. 3712*6a54128fSAndroid Build Coastguard Worker func_help 3713*6a54128fSAndroid Build Coastguard Worker ;; 3714*6a54128fSAndroid Build Coastguard Worker 3715*6a54128fSAndroid Build Coastguard Worker clean) 3716*6a54128fSAndroid Build Coastguard Worker $ECHO \ 3717*6a54128fSAndroid Build Coastguard Worker"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 3718*6a54128fSAndroid Build Coastguard Worker 3719*6a54128fSAndroid Build Coastguard WorkerRemove files from the build directory. 3720*6a54128fSAndroid Build Coastguard Worker 3721*6a54128fSAndroid Build Coastguard WorkerRM is the name of the program to use to delete files associated with each FILE 3722*6a54128fSAndroid Build Coastguard Worker(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed 3723*6a54128fSAndroid Build Coastguard Workerto RM. 3724*6a54128fSAndroid Build Coastguard Worker 3725*6a54128fSAndroid Build Coastguard WorkerIf FILE is a libtool library, object or program, all the files associated 3726*6a54128fSAndroid Build Coastguard Workerwith it are deleted. Otherwise, only FILE itself is deleted using RM." 3727*6a54128fSAndroid Build Coastguard Worker ;; 3728*6a54128fSAndroid Build Coastguard Worker 3729*6a54128fSAndroid Build Coastguard Worker compile) 3730*6a54128fSAndroid Build Coastguard Worker $ECHO \ 3731*6a54128fSAndroid Build Coastguard Worker"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 3732*6a54128fSAndroid Build Coastguard Worker 3733*6a54128fSAndroid Build Coastguard WorkerCompile a source file into a libtool library object. 3734*6a54128fSAndroid Build Coastguard Worker 3735*6a54128fSAndroid Build Coastguard WorkerThis mode accepts the following additional options: 3736*6a54128fSAndroid Build Coastguard Worker 3737*6a54128fSAndroid Build Coastguard Worker -o OUTPUT-FILE set the output file name to OUTPUT-FILE 3738*6a54128fSAndroid Build Coastguard Worker -no-suppress do not suppress compiler output for multiple passes 3739*6a54128fSAndroid Build Coastguard Worker -prefer-pic try to build PIC objects only 3740*6a54128fSAndroid Build Coastguard Worker -prefer-non-pic try to build non-PIC objects only 3741*6a54128fSAndroid Build Coastguard Worker -shared do not build a '.o' file suitable for static linking 3742*6a54128fSAndroid Build Coastguard Worker -static only build a '.o' file suitable for static linking 3743*6a54128fSAndroid Build Coastguard Worker -Wc,FLAG pass FLAG directly to the compiler 3744*6a54128fSAndroid Build Coastguard Worker 3745*6a54128fSAndroid Build Coastguard WorkerCOMPILE-COMMAND is a command to be used in creating a 'standard' object file 3746*6a54128fSAndroid Build Coastguard Workerfrom the given SOURCEFILE. 3747*6a54128fSAndroid Build Coastguard Worker 3748*6a54128fSAndroid Build Coastguard WorkerThe output file name is determined by removing the directory component from 3749*6a54128fSAndroid Build Coastguard WorkerSOURCEFILE, then substituting the C source code suffix '.c' with the 3750*6a54128fSAndroid Build Coastguard Workerlibrary object suffix, '.lo'." 3751*6a54128fSAndroid Build Coastguard Worker ;; 3752*6a54128fSAndroid Build Coastguard Worker 3753*6a54128fSAndroid Build Coastguard Worker execute) 3754*6a54128fSAndroid Build Coastguard Worker $ECHO \ 3755*6a54128fSAndroid Build Coastguard Worker"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... 3756*6a54128fSAndroid Build Coastguard Worker 3757*6a54128fSAndroid Build Coastguard WorkerAutomatically set library path, then run a program. 3758*6a54128fSAndroid Build Coastguard Worker 3759*6a54128fSAndroid Build Coastguard WorkerThis mode accepts the following additional options: 3760*6a54128fSAndroid Build Coastguard Worker 3761*6a54128fSAndroid Build Coastguard Worker -dlopen FILE add the directory containing FILE to the library path 3762*6a54128fSAndroid Build Coastguard Worker 3763*6a54128fSAndroid Build Coastguard WorkerThis mode sets the library path environment variable according to '-dlopen' 3764*6a54128fSAndroid Build Coastguard Workerflags. 3765*6a54128fSAndroid Build Coastguard Worker 3766*6a54128fSAndroid Build Coastguard WorkerIf any of the ARGS are libtool executable wrappers, then they are translated 3767*6a54128fSAndroid Build Coastguard Workerinto their corresponding uninstalled binary, and any of their required library 3768*6a54128fSAndroid Build Coastguard Workerdirectories are added to the library path. 3769*6a54128fSAndroid Build Coastguard Worker 3770*6a54128fSAndroid Build Coastguard WorkerThen, COMMAND is executed, with ARGS as arguments." 3771*6a54128fSAndroid Build Coastguard Worker ;; 3772*6a54128fSAndroid Build Coastguard Worker 3773*6a54128fSAndroid Build Coastguard Worker finish) 3774*6a54128fSAndroid Build Coastguard Worker $ECHO \ 3775*6a54128fSAndroid Build Coastguard Worker"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... 3776*6a54128fSAndroid Build Coastguard Worker 3777*6a54128fSAndroid Build Coastguard WorkerComplete the installation of libtool libraries. 3778*6a54128fSAndroid Build Coastguard Worker 3779*6a54128fSAndroid Build Coastguard WorkerEach LIBDIR is a directory that contains libtool libraries. 3780*6a54128fSAndroid Build Coastguard Worker 3781*6a54128fSAndroid Build Coastguard WorkerThe commands that this mode executes may require superuser privileges. Use 3782*6a54128fSAndroid Build Coastguard Workerthe '--dry-run' option if you just want to see what would be executed." 3783*6a54128fSAndroid Build Coastguard Worker ;; 3784*6a54128fSAndroid Build Coastguard Worker 3785*6a54128fSAndroid Build Coastguard Worker install) 3786*6a54128fSAndroid Build Coastguard Worker $ECHO \ 3787*6a54128fSAndroid Build Coastguard Worker"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... 3788*6a54128fSAndroid Build Coastguard Worker 3789*6a54128fSAndroid Build Coastguard WorkerInstall executables or libraries. 3790*6a54128fSAndroid Build Coastguard Worker 3791*6a54128fSAndroid Build Coastguard WorkerINSTALL-COMMAND is the installation command. The first component should be 3792*6a54128fSAndroid Build Coastguard Workereither the 'install' or 'cp' program. 3793*6a54128fSAndroid Build Coastguard Worker 3794*6a54128fSAndroid Build Coastguard WorkerThe following components of INSTALL-COMMAND are treated specially: 3795*6a54128fSAndroid Build Coastguard Worker 3796*6a54128fSAndroid Build Coastguard Worker -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation 3797*6a54128fSAndroid Build Coastguard Worker 3798*6a54128fSAndroid Build Coastguard WorkerThe rest of the components are interpreted as arguments to that command (only 3799*6a54128fSAndroid Build Coastguard WorkerBSD-compatible install options are recognized)." 3800*6a54128fSAndroid Build Coastguard Worker ;; 3801*6a54128fSAndroid Build Coastguard Worker 3802*6a54128fSAndroid Build Coastguard Worker link) 3803*6a54128fSAndroid Build Coastguard Worker $ECHO \ 3804*6a54128fSAndroid Build Coastguard Worker"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... 3805*6a54128fSAndroid Build Coastguard Worker 3806*6a54128fSAndroid Build Coastguard WorkerLink object files or libraries together to form another library, or to 3807*6a54128fSAndroid Build Coastguard Workercreate an executable program. 3808*6a54128fSAndroid Build Coastguard Worker 3809*6a54128fSAndroid Build Coastguard WorkerLINK-COMMAND is a command using the C compiler that you would use to create 3810*6a54128fSAndroid Build Coastguard Workera program from several object files. 3811*6a54128fSAndroid Build Coastguard Worker 3812*6a54128fSAndroid Build Coastguard WorkerThe following components of LINK-COMMAND are treated specially: 3813*6a54128fSAndroid Build Coastguard Worker 3814*6a54128fSAndroid Build Coastguard Worker -all-static do not do any dynamic linking at all 3815*6a54128fSAndroid Build Coastguard Worker -avoid-version do not add a version suffix if possible 3816*6a54128fSAndroid Build Coastguard Worker -bindir BINDIR specify path to binaries directory (for systems where 3817*6a54128fSAndroid Build Coastguard Worker libraries must be found in the PATH setting at runtime) 3818*6a54128fSAndroid Build Coastguard Worker -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime 3819*6a54128fSAndroid Build Coastguard Worker -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 3820*6a54128fSAndroid Build Coastguard Worker -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 3821*6a54128fSAndroid Build Coastguard Worker -export-symbols SYMFILE 3822*6a54128fSAndroid Build Coastguard Worker try to export only the symbols listed in SYMFILE 3823*6a54128fSAndroid Build Coastguard Worker -export-symbols-regex REGEX 3824*6a54128fSAndroid Build Coastguard Worker try to export only the symbols matching REGEX 3825*6a54128fSAndroid Build Coastguard Worker -LLIBDIR search LIBDIR for required installed libraries 3826*6a54128fSAndroid Build Coastguard Worker -lNAME OUTPUT-FILE requires the installed library libNAME 3827*6a54128fSAndroid Build Coastguard Worker -module build a library that can dlopened 3828*6a54128fSAndroid Build Coastguard Worker -no-fast-install disable the fast-install mode 3829*6a54128fSAndroid Build Coastguard Worker -no-install link a not-installable executable 3830*6a54128fSAndroid Build Coastguard Worker -no-undefined declare that a library does not refer to external symbols 3831*6a54128fSAndroid Build Coastguard Worker -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 3832*6a54128fSAndroid Build Coastguard Worker -objectlist FILE use a list of object files found in FILE to specify objects 3833*6a54128fSAndroid Build Coastguard Worker -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) 3834*6a54128fSAndroid Build Coastguard Worker -precious-files-regex REGEX 3835*6a54128fSAndroid Build Coastguard Worker don't remove output files matching REGEX 3836*6a54128fSAndroid Build Coastguard Worker -release RELEASE specify package release information 3837*6a54128fSAndroid Build Coastguard Worker -rpath LIBDIR the created library will eventually be installed in LIBDIR 3838*6a54128fSAndroid Build Coastguard Worker -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 3839*6a54128fSAndroid Build Coastguard Worker -shared only do dynamic linking of libtool libraries 3840*6a54128fSAndroid Build Coastguard Worker -shrext SUFFIX override the standard shared library file extension 3841*6a54128fSAndroid Build Coastguard Worker -static do not do any dynamic linking of uninstalled libtool libraries 3842*6a54128fSAndroid Build Coastguard Worker -static-libtool-libs 3843*6a54128fSAndroid Build Coastguard Worker do not do any dynamic linking of libtool libraries 3844*6a54128fSAndroid Build Coastguard Worker -version-info CURRENT[:REVISION[:AGE]] 3845*6a54128fSAndroid Build Coastguard Worker specify library version info [each variable defaults to 0] 3846*6a54128fSAndroid Build Coastguard Worker -weak LIBNAME declare that the target provides the LIBNAME interface 3847*6a54128fSAndroid Build Coastguard Worker -Wc,FLAG 3848*6a54128fSAndroid Build Coastguard Worker -Xcompiler FLAG pass linker-specific FLAG directly to the compiler 3849*6a54128fSAndroid Build Coastguard Worker -Wl,FLAG 3850*6a54128fSAndroid Build Coastguard Worker -Xlinker FLAG pass linker-specific FLAG directly to the linker 3851*6a54128fSAndroid Build Coastguard Worker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 3852*6a54128fSAndroid Build Coastguard Worker 3853*6a54128fSAndroid Build Coastguard WorkerAll other options (arguments beginning with '-') are ignored. 3854*6a54128fSAndroid Build Coastguard Worker 3855*6a54128fSAndroid Build Coastguard WorkerEvery other argument is treated as a filename. Files ending in '.la' are 3856*6a54128fSAndroid Build Coastguard Workertreated as uninstalled libtool libraries, other files are standard or library 3857*6a54128fSAndroid Build Coastguard Workerobject files. 3858*6a54128fSAndroid Build Coastguard Worker 3859*6a54128fSAndroid Build Coastguard WorkerIf the OUTPUT-FILE ends in '.la', then a libtool library is created, 3860*6a54128fSAndroid Build Coastguard Workeronly library objects ('.lo' files) may be specified, and '-rpath' is 3861*6a54128fSAndroid Build Coastguard Workerrequired, except when creating a convenience library. 3862*6a54128fSAndroid Build Coastguard Worker 3863*6a54128fSAndroid Build Coastguard WorkerIf OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created 3864*6a54128fSAndroid Build Coastguard Workerusing 'ar' and 'ranlib', or on Windows using 'lib'. 3865*6a54128fSAndroid Build Coastguard Worker 3866*6a54128fSAndroid Build Coastguard WorkerIf OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file 3867*6a54128fSAndroid Build Coastguard Workeris created, otherwise an executable program is created." 3868*6a54128fSAndroid Build Coastguard Worker ;; 3869*6a54128fSAndroid Build Coastguard Worker 3870*6a54128fSAndroid Build Coastguard Worker uninstall) 3871*6a54128fSAndroid Build Coastguard Worker $ECHO \ 3872*6a54128fSAndroid Build Coastguard Worker"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 3873*6a54128fSAndroid Build Coastguard Worker 3874*6a54128fSAndroid Build Coastguard WorkerRemove libraries from an installation directory. 3875*6a54128fSAndroid Build Coastguard Worker 3876*6a54128fSAndroid Build Coastguard WorkerRM is the name of the program to use to delete files associated with each FILE 3877*6a54128fSAndroid Build Coastguard Worker(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed 3878*6a54128fSAndroid Build Coastguard Workerto RM. 3879*6a54128fSAndroid Build Coastguard Worker 3880*6a54128fSAndroid Build Coastguard WorkerIf FILE is a libtool library, all the files associated with it are deleted. 3881*6a54128fSAndroid Build Coastguard WorkerOtherwise, only FILE itself is deleted using RM." 3882*6a54128fSAndroid Build Coastguard Worker ;; 3883*6a54128fSAndroid Build Coastguard Worker 3884*6a54128fSAndroid Build Coastguard Worker *) 3885*6a54128fSAndroid Build Coastguard Worker func_fatal_help "invalid operation mode '$opt_mode'" 3886*6a54128fSAndroid Build Coastguard Worker ;; 3887*6a54128fSAndroid Build Coastguard Worker esac 3888*6a54128fSAndroid Build Coastguard Worker 3889*6a54128fSAndroid Build Coastguard Worker echo 3890*6a54128fSAndroid Build Coastguard Worker $ECHO "Try '$progname --help' for more information about other modes." 3891*6a54128fSAndroid Build Coastguard Worker} 3892*6a54128fSAndroid Build Coastguard Worker 3893*6a54128fSAndroid Build Coastguard Worker# Now that we've collected a possible --mode arg, show help if necessary 3894*6a54128fSAndroid Build Coastguard Workerif $opt_help; then 3895*6a54128fSAndroid Build Coastguard Worker if test : = "$opt_help"; then 3896*6a54128fSAndroid Build Coastguard Worker func_mode_help 3897*6a54128fSAndroid Build Coastguard Worker else 3898*6a54128fSAndroid Build Coastguard Worker { 3899*6a54128fSAndroid Build Coastguard Worker func_help noexit 3900*6a54128fSAndroid Build Coastguard Worker for opt_mode in compile link execute install finish uninstall clean; do 3901*6a54128fSAndroid Build Coastguard Worker func_mode_help 3902*6a54128fSAndroid Build Coastguard Worker done 3903*6a54128fSAndroid Build Coastguard Worker } | $SED -n '1p; 2,$s/^Usage:/ or: /p' 3904*6a54128fSAndroid Build Coastguard Worker { 3905*6a54128fSAndroid Build Coastguard Worker func_help noexit 3906*6a54128fSAndroid Build Coastguard Worker for opt_mode in compile link execute install finish uninstall clean; do 3907*6a54128fSAndroid Build Coastguard Worker echo 3908*6a54128fSAndroid Build Coastguard Worker func_mode_help 3909*6a54128fSAndroid Build Coastguard Worker done 3910*6a54128fSAndroid Build Coastguard Worker } | 3911*6a54128fSAndroid Build Coastguard Worker $SED '1d 3912*6a54128fSAndroid Build Coastguard Worker /^When reporting/,/^Report/{ 3913*6a54128fSAndroid Build Coastguard Worker H 3914*6a54128fSAndroid Build Coastguard Worker d 3915*6a54128fSAndroid Build Coastguard Worker } 3916*6a54128fSAndroid Build Coastguard Worker $x 3917*6a54128fSAndroid Build Coastguard Worker /information about other modes/d 3918*6a54128fSAndroid Build Coastguard Worker /more detailed .*MODE/d 3919*6a54128fSAndroid Build Coastguard Worker s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' 3920*6a54128fSAndroid Build Coastguard Worker fi 3921*6a54128fSAndroid Build Coastguard Worker exit $? 3922*6a54128fSAndroid Build Coastguard Workerfi 3923*6a54128fSAndroid Build Coastguard Worker 3924*6a54128fSAndroid Build Coastguard Worker 3925*6a54128fSAndroid Build Coastguard Worker# func_mode_execute arg... 3926*6a54128fSAndroid Build Coastguard Workerfunc_mode_execute () 3927*6a54128fSAndroid Build Coastguard Worker{ 3928*6a54128fSAndroid Build Coastguard Worker $debug_cmd 3929*6a54128fSAndroid Build Coastguard Worker 3930*6a54128fSAndroid Build Coastguard Worker # The first argument is the command name. 3931*6a54128fSAndroid Build Coastguard Worker cmd=$nonopt 3932*6a54128fSAndroid Build Coastguard Worker test -z "$cmd" && \ 3933*6a54128fSAndroid Build Coastguard Worker func_fatal_help "you must specify a COMMAND" 3934*6a54128fSAndroid Build Coastguard Worker 3935*6a54128fSAndroid Build Coastguard Worker # Handle -dlopen flags immediately. 3936*6a54128fSAndroid Build Coastguard Worker for file in $opt_dlopen; do 3937*6a54128fSAndroid Build Coastguard Worker test -f "$file" \ 3938*6a54128fSAndroid Build Coastguard Worker || func_fatal_help "'$file' is not a file" 3939*6a54128fSAndroid Build Coastguard Worker 3940*6a54128fSAndroid Build Coastguard Worker dir= 3941*6a54128fSAndroid Build Coastguard Worker case $file in 3942*6a54128fSAndroid Build Coastguard Worker *.la) 3943*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$file" 3944*6a54128fSAndroid Build Coastguard Worker file=$func_resolve_sysroot_result 3945*6a54128fSAndroid Build Coastguard Worker 3946*6a54128fSAndroid Build Coastguard Worker # Check to see that this really is a libtool archive. 3947*6a54128fSAndroid Build Coastguard Worker func_lalib_unsafe_p "$file" \ 3948*6a54128fSAndroid Build Coastguard Worker || func_fatal_help "'$lib' is not a valid libtool archive" 3949*6a54128fSAndroid Build Coastguard Worker 3950*6a54128fSAndroid Build Coastguard Worker # Read the libtool library. 3951*6a54128fSAndroid Build Coastguard Worker dlname= 3952*6a54128fSAndroid Build Coastguard Worker library_names= 3953*6a54128fSAndroid Build Coastguard Worker func_source "$file" 3954*6a54128fSAndroid Build Coastguard Worker 3955*6a54128fSAndroid Build Coastguard Worker # Skip this library if it cannot be dlopened. 3956*6a54128fSAndroid Build Coastguard Worker if test -z "$dlname"; then 3957*6a54128fSAndroid Build Coastguard Worker # Warn if it was a shared library. 3958*6a54128fSAndroid Build Coastguard Worker test -n "$library_names" && \ 3959*6a54128fSAndroid Build Coastguard Worker func_warning "'$file' was not linked with '-export-dynamic'" 3960*6a54128fSAndroid Build Coastguard Worker continue 3961*6a54128fSAndroid Build Coastguard Worker fi 3962*6a54128fSAndroid Build Coastguard Worker 3963*6a54128fSAndroid Build Coastguard Worker func_dirname "$file" "" "." 3964*6a54128fSAndroid Build Coastguard Worker dir=$func_dirname_result 3965*6a54128fSAndroid Build Coastguard Worker 3966*6a54128fSAndroid Build Coastguard Worker if test -f "$dir/$objdir/$dlname"; then 3967*6a54128fSAndroid Build Coastguard Worker func_append dir "/$objdir" 3968*6a54128fSAndroid Build Coastguard Worker else 3969*6a54128fSAndroid Build Coastguard Worker if test ! -f "$dir/$dlname"; then 3970*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" 3971*6a54128fSAndroid Build Coastguard Worker fi 3972*6a54128fSAndroid Build Coastguard Worker fi 3973*6a54128fSAndroid Build Coastguard Worker ;; 3974*6a54128fSAndroid Build Coastguard Worker 3975*6a54128fSAndroid Build Coastguard Worker *.lo) 3976*6a54128fSAndroid Build Coastguard Worker # Just add the directory containing the .lo file. 3977*6a54128fSAndroid Build Coastguard Worker func_dirname "$file" "" "." 3978*6a54128fSAndroid Build Coastguard Worker dir=$func_dirname_result 3979*6a54128fSAndroid Build Coastguard Worker ;; 3980*6a54128fSAndroid Build Coastguard Worker 3981*6a54128fSAndroid Build Coastguard Worker *) 3982*6a54128fSAndroid Build Coastguard Worker func_warning "'-dlopen' is ignored for non-libtool libraries and objects" 3983*6a54128fSAndroid Build Coastguard Worker continue 3984*6a54128fSAndroid Build Coastguard Worker ;; 3985*6a54128fSAndroid Build Coastguard Worker esac 3986*6a54128fSAndroid Build Coastguard Worker 3987*6a54128fSAndroid Build Coastguard Worker # Get the absolute pathname. 3988*6a54128fSAndroid Build Coastguard Worker absdir=`cd "$dir" && pwd` 3989*6a54128fSAndroid Build Coastguard Worker test -n "$absdir" && dir=$absdir 3990*6a54128fSAndroid Build Coastguard Worker 3991*6a54128fSAndroid Build Coastguard Worker # Now add the directory to shlibpath_var. 3992*6a54128fSAndroid Build Coastguard Worker if eval "test -z \"\$$shlibpath_var\""; then 3993*6a54128fSAndroid Build Coastguard Worker eval "$shlibpath_var=\"\$dir\"" 3994*6a54128fSAndroid Build Coastguard Worker else 3995*6a54128fSAndroid Build Coastguard Worker eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 3996*6a54128fSAndroid Build Coastguard Worker fi 3997*6a54128fSAndroid Build Coastguard Worker done 3998*6a54128fSAndroid Build Coastguard Worker 3999*6a54128fSAndroid Build Coastguard Worker # This variable tells wrapper scripts just to set shlibpath_var 4000*6a54128fSAndroid Build Coastguard Worker # rather than running their programs. 4001*6a54128fSAndroid Build Coastguard Worker libtool_execute_magic=$magic 4002*6a54128fSAndroid Build Coastguard Worker 4003*6a54128fSAndroid Build Coastguard Worker # Check if any of the arguments is a wrapper script. 4004*6a54128fSAndroid Build Coastguard Worker args= 4005*6a54128fSAndroid Build Coastguard Worker for file 4006*6a54128fSAndroid Build Coastguard Worker do 4007*6a54128fSAndroid Build Coastguard Worker case $file in 4008*6a54128fSAndroid Build Coastguard Worker -* | *.la | *.lo ) ;; 4009*6a54128fSAndroid Build Coastguard Worker *) 4010*6a54128fSAndroid Build Coastguard Worker # Do a test to see if this is really a libtool program. 4011*6a54128fSAndroid Build Coastguard Worker if func_ltwrapper_script_p "$file"; then 4012*6a54128fSAndroid Build Coastguard Worker func_source "$file" 4013*6a54128fSAndroid Build Coastguard Worker # Transform arg to wrapped name. 4014*6a54128fSAndroid Build Coastguard Worker file=$progdir/$program 4015*6a54128fSAndroid Build Coastguard Worker elif func_ltwrapper_executable_p "$file"; then 4016*6a54128fSAndroid Build Coastguard Worker func_ltwrapper_scriptname "$file" 4017*6a54128fSAndroid Build Coastguard Worker func_source "$func_ltwrapper_scriptname_result" 4018*6a54128fSAndroid Build Coastguard Worker # Transform arg to wrapped name. 4019*6a54128fSAndroid Build Coastguard Worker file=$progdir/$program 4020*6a54128fSAndroid Build Coastguard Worker fi 4021*6a54128fSAndroid Build Coastguard Worker ;; 4022*6a54128fSAndroid Build Coastguard Worker esac 4023*6a54128fSAndroid Build Coastguard Worker # Quote arguments (to preserve shell metacharacters). 4024*6a54128fSAndroid Build Coastguard Worker func_append_quoted args "$file" 4025*6a54128fSAndroid Build Coastguard Worker done 4026*6a54128fSAndroid Build Coastguard Worker 4027*6a54128fSAndroid Build Coastguard Worker if $opt_dry_run; then 4028*6a54128fSAndroid Build Coastguard Worker # Display what would be done. 4029*6a54128fSAndroid Build Coastguard Worker if test -n "$shlibpath_var"; then 4030*6a54128fSAndroid Build Coastguard Worker eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" 4031*6a54128fSAndroid Build Coastguard Worker echo "export $shlibpath_var" 4032*6a54128fSAndroid Build Coastguard Worker fi 4033*6a54128fSAndroid Build Coastguard Worker $ECHO "$cmd$args" 4034*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 4035*6a54128fSAndroid Build Coastguard Worker else 4036*6a54128fSAndroid Build Coastguard Worker if test -n "$shlibpath_var"; then 4037*6a54128fSAndroid Build Coastguard Worker # Export the shlibpath_var. 4038*6a54128fSAndroid Build Coastguard Worker eval "export $shlibpath_var" 4039*6a54128fSAndroid Build Coastguard Worker fi 4040*6a54128fSAndroid Build Coastguard Worker 4041*6a54128fSAndroid Build Coastguard Worker # Restore saved environment variables 4042*6a54128fSAndroid Build Coastguard Worker for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 4043*6a54128fSAndroid Build Coastguard Worker do 4044*6a54128fSAndroid Build Coastguard Worker eval "if test \"\${save_$lt_var+set}\" = set; then 4045*6a54128fSAndroid Build Coastguard Worker $lt_var=\$save_$lt_var; export $lt_var 4046*6a54128fSAndroid Build Coastguard Worker else 4047*6a54128fSAndroid Build Coastguard Worker $lt_unset $lt_var 4048*6a54128fSAndroid Build Coastguard Worker fi" 4049*6a54128fSAndroid Build Coastguard Worker done 4050*6a54128fSAndroid Build Coastguard Worker 4051*6a54128fSAndroid Build Coastguard Worker # Now prepare to actually exec the command. 4052*6a54128fSAndroid Build Coastguard Worker exec_cmd=\$cmd$args 4053*6a54128fSAndroid Build Coastguard Worker fi 4054*6a54128fSAndroid Build Coastguard Worker} 4055*6a54128fSAndroid Build Coastguard Worker 4056*6a54128fSAndroid Build Coastguard Workertest execute = "$opt_mode" && func_mode_execute ${1+"$@"} 4057*6a54128fSAndroid Build Coastguard Worker 4058*6a54128fSAndroid Build Coastguard Worker 4059*6a54128fSAndroid Build Coastguard Worker# func_mode_finish arg... 4060*6a54128fSAndroid Build Coastguard Workerfunc_mode_finish () 4061*6a54128fSAndroid Build Coastguard Worker{ 4062*6a54128fSAndroid Build Coastguard Worker $debug_cmd 4063*6a54128fSAndroid Build Coastguard Worker 4064*6a54128fSAndroid Build Coastguard Worker libs= 4065*6a54128fSAndroid Build Coastguard Worker libdirs= 4066*6a54128fSAndroid Build Coastguard Worker admincmds= 4067*6a54128fSAndroid Build Coastguard Worker 4068*6a54128fSAndroid Build Coastguard Worker for opt in "$nonopt" ${1+"$@"} 4069*6a54128fSAndroid Build Coastguard Worker do 4070*6a54128fSAndroid Build Coastguard Worker if test -d "$opt"; then 4071*6a54128fSAndroid Build Coastguard Worker func_append libdirs " $opt" 4072*6a54128fSAndroid Build Coastguard Worker 4073*6a54128fSAndroid Build Coastguard Worker elif test -f "$opt"; then 4074*6a54128fSAndroid Build Coastguard Worker if func_lalib_unsafe_p "$opt"; then 4075*6a54128fSAndroid Build Coastguard Worker func_append libs " $opt" 4076*6a54128fSAndroid Build Coastguard Worker else 4077*6a54128fSAndroid Build Coastguard Worker func_warning "'$opt' is not a valid libtool archive" 4078*6a54128fSAndroid Build Coastguard Worker fi 4079*6a54128fSAndroid Build Coastguard Worker 4080*6a54128fSAndroid Build Coastguard Worker else 4081*6a54128fSAndroid Build Coastguard Worker func_fatal_error "invalid argument '$opt'" 4082*6a54128fSAndroid Build Coastguard Worker fi 4083*6a54128fSAndroid Build Coastguard Worker done 4084*6a54128fSAndroid Build Coastguard Worker 4085*6a54128fSAndroid Build Coastguard Worker if test -n "$libs"; then 4086*6a54128fSAndroid Build Coastguard Worker if test -n "$lt_sysroot"; then 4087*6a54128fSAndroid Build Coastguard Worker sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` 4088*6a54128fSAndroid Build Coastguard Worker sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" 4089*6a54128fSAndroid Build Coastguard Worker else 4090*6a54128fSAndroid Build Coastguard Worker sysroot_cmd= 4091*6a54128fSAndroid Build Coastguard Worker fi 4092*6a54128fSAndroid Build Coastguard Worker 4093*6a54128fSAndroid Build Coastguard Worker # Remove sysroot references 4094*6a54128fSAndroid Build Coastguard Worker if $opt_dry_run; then 4095*6a54128fSAndroid Build Coastguard Worker for lib in $libs; do 4096*6a54128fSAndroid Build Coastguard Worker echo "removing references to $lt_sysroot and '=' prefixes from $lib" 4097*6a54128fSAndroid Build Coastguard Worker done 4098*6a54128fSAndroid Build Coastguard Worker else 4099*6a54128fSAndroid Build Coastguard Worker tmpdir=`func_mktempdir` 4100*6a54128fSAndroid Build Coastguard Worker for lib in $libs; do 4101*6a54128fSAndroid Build Coastguard Worker $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ 4102*6a54128fSAndroid Build Coastguard Worker > $tmpdir/tmp-la 4103*6a54128fSAndroid Build Coastguard Worker mv -f $tmpdir/tmp-la $lib 4104*6a54128fSAndroid Build Coastguard Worker done 4105*6a54128fSAndroid Build Coastguard Worker ${RM}r "$tmpdir" 4106*6a54128fSAndroid Build Coastguard Worker fi 4107*6a54128fSAndroid Build Coastguard Worker fi 4108*6a54128fSAndroid Build Coastguard Worker 4109*6a54128fSAndroid Build Coastguard Worker if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 4110*6a54128fSAndroid Build Coastguard Worker for libdir in $libdirs; do 4111*6a54128fSAndroid Build Coastguard Worker if test -n "$finish_cmds"; then 4112*6a54128fSAndroid Build Coastguard Worker # Do each command in the finish commands. 4113*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$finish_cmds" 'admincmds="$admincmds 4114*6a54128fSAndroid Build Coastguard Worker'"$cmd"'"' 4115*6a54128fSAndroid Build Coastguard Worker fi 4116*6a54128fSAndroid Build Coastguard Worker if test -n "$finish_eval"; then 4117*6a54128fSAndroid Build Coastguard Worker # Do the single finish_eval. 4118*6a54128fSAndroid Build Coastguard Worker eval cmds=\"$finish_eval\" 4119*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || eval "$cmds" || func_append admincmds " 4120*6a54128fSAndroid Build Coastguard Worker $cmds" 4121*6a54128fSAndroid Build Coastguard Worker fi 4122*6a54128fSAndroid Build Coastguard Worker done 4123*6a54128fSAndroid Build Coastguard Worker fi 4124*6a54128fSAndroid Build Coastguard Worker 4125*6a54128fSAndroid Build Coastguard Worker # Exit here if they wanted silent mode. 4126*6a54128fSAndroid Build Coastguard Worker $opt_quiet && exit $EXIT_SUCCESS 4127*6a54128fSAndroid Build Coastguard Worker 4128*6a54128fSAndroid Build Coastguard Worker if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 4129*6a54128fSAndroid Build Coastguard Worker echo "----------------------------------------------------------------------" 4130*6a54128fSAndroid Build Coastguard Worker echo "Libraries have been installed in:" 4131*6a54128fSAndroid Build Coastguard Worker for libdir in $libdirs; do 4132*6a54128fSAndroid Build Coastguard Worker $ECHO " $libdir" 4133*6a54128fSAndroid Build Coastguard Worker done 4134*6a54128fSAndroid Build Coastguard Worker echo 4135*6a54128fSAndroid Build Coastguard Worker echo "If you ever happen to want to link against installed libraries" 4136*6a54128fSAndroid Build Coastguard Worker echo "in a given directory, LIBDIR, you must either use libtool, and" 4137*6a54128fSAndroid Build Coastguard Worker echo "specify the full pathname of the library, or use the '-LLIBDIR'" 4138*6a54128fSAndroid Build Coastguard Worker echo "flag during linking and do at least one of the following:" 4139*6a54128fSAndroid Build Coastguard Worker if test -n "$shlibpath_var"; then 4140*6a54128fSAndroid Build Coastguard Worker echo " - add LIBDIR to the '$shlibpath_var' environment variable" 4141*6a54128fSAndroid Build Coastguard Worker echo " during execution" 4142*6a54128fSAndroid Build Coastguard Worker fi 4143*6a54128fSAndroid Build Coastguard Worker if test -n "$runpath_var"; then 4144*6a54128fSAndroid Build Coastguard Worker echo " - add LIBDIR to the '$runpath_var' environment variable" 4145*6a54128fSAndroid Build Coastguard Worker echo " during linking" 4146*6a54128fSAndroid Build Coastguard Worker fi 4147*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_flag_spec"; then 4148*6a54128fSAndroid Build Coastguard Worker libdir=LIBDIR 4149*6a54128fSAndroid Build Coastguard Worker eval flag=\"$hardcode_libdir_flag_spec\" 4150*6a54128fSAndroid Build Coastguard Worker 4151*6a54128fSAndroid Build Coastguard Worker $ECHO " - use the '$flag' linker flag" 4152*6a54128fSAndroid Build Coastguard Worker fi 4153*6a54128fSAndroid Build Coastguard Worker if test -n "$admincmds"; then 4154*6a54128fSAndroid Build Coastguard Worker $ECHO " - have your system administrator run these commands:$admincmds" 4155*6a54128fSAndroid Build Coastguard Worker fi 4156*6a54128fSAndroid Build Coastguard Worker if test -f /etc/ld.so.conf; then 4157*6a54128fSAndroid Build Coastguard Worker echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" 4158*6a54128fSAndroid Build Coastguard Worker fi 4159*6a54128fSAndroid Build Coastguard Worker echo 4160*6a54128fSAndroid Build Coastguard Worker 4161*6a54128fSAndroid Build Coastguard Worker echo "See any operating system documentation about shared libraries for" 4162*6a54128fSAndroid Build Coastguard Worker case $host in 4163*6a54128fSAndroid Build Coastguard Worker solaris2.[6789]|solaris2.1[0-9]) 4164*6a54128fSAndroid Build Coastguard Worker echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" 4165*6a54128fSAndroid Build Coastguard Worker echo "pages." 4166*6a54128fSAndroid Build Coastguard Worker ;; 4167*6a54128fSAndroid Build Coastguard Worker *) 4168*6a54128fSAndroid Build Coastguard Worker echo "more information, such as the ld(1) and ld.so(8) manual pages." 4169*6a54128fSAndroid Build Coastguard Worker ;; 4170*6a54128fSAndroid Build Coastguard Worker esac 4171*6a54128fSAndroid Build Coastguard Worker echo "----------------------------------------------------------------------" 4172*6a54128fSAndroid Build Coastguard Worker fi 4173*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 4174*6a54128fSAndroid Build Coastguard Worker} 4175*6a54128fSAndroid Build Coastguard Worker 4176*6a54128fSAndroid Build Coastguard Workertest finish = "$opt_mode" && func_mode_finish ${1+"$@"} 4177*6a54128fSAndroid Build Coastguard Worker 4178*6a54128fSAndroid Build Coastguard Worker 4179*6a54128fSAndroid Build Coastguard Worker# func_mode_install arg... 4180*6a54128fSAndroid Build Coastguard Workerfunc_mode_install () 4181*6a54128fSAndroid Build Coastguard Worker{ 4182*6a54128fSAndroid Build Coastguard Worker $debug_cmd 4183*6a54128fSAndroid Build Coastguard Worker 4184*6a54128fSAndroid Build Coastguard Worker # There may be an optional sh(1) argument at the beginning of 4185*6a54128fSAndroid Build Coastguard Worker # install_prog (especially on Windows NT). 4186*6a54128fSAndroid Build Coastguard Worker if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || 4187*6a54128fSAndroid Build Coastguard Worker # Allow the use of GNU shtool's install command. 4188*6a54128fSAndroid Build Coastguard Worker case $nonopt in *shtool*) :;; *) false;; esac 4189*6a54128fSAndroid Build Coastguard Worker then 4190*6a54128fSAndroid Build Coastguard Worker # Aesthetically quote it. 4191*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$nonopt" 4192*6a54128fSAndroid Build Coastguard Worker install_prog="$func_quote_for_eval_result " 4193*6a54128fSAndroid Build Coastguard Worker arg=$1 4194*6a54128fSAndroid Build Coastguard Worker shift 4195*6a54128fSAndroid Build Coastguard Worker else 4196*6a54128fSAndroid Build Coastguard Worker install_prog= 4197*6a54128fSAndroid Build Coastguard Worker arg=$nonopt 4198*6a54128fSAndroid Build Coastguard Worker fi 4199*6a54128fSAndroid Build Coastguard Worker 4200*6a54128fSAndroid Build Coastguard Worker # The real first argument should be the name of the installation program. 4201*6a54128fSAndroid Build Coastguard Worker # Aesthetically quote it. 4202*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$arg" 4203*6a54128fSAndroid Build Coastguard Worker func_append install_prog "$func_quote_for_eval_result" 4204*6a54128fSAndroid Build Coastguard Worker install_shared_prog=$install_prog 4205*6a54128fSAndroid Build Coastguard Worker case " $install_prog " in 4206*6a54128fSAndroid Build Coastguard Worker *[\\\ /]cp\ *) install_cp=: ;; 4207*6a54128fSAndroid Build Coastguard Worker *) install_cp=false ;; 4208*6a54128fSAndroid Build Coastguard Worker esac 4209*6a54128fSAndroid Build Coastguard Worker 4210*6a54128fSAndroid Build Coastguard Worker # We need to accept at least all the BSD install flags. 4211*6a54128fSAndroid Build Coastguard Worker dest= 4212*6a54128fSAndroid Build Coastguard Worker files= 4213*6a54128fSAndroid Build Coastguard Worker opts= 4214*6a54128fSAndroid Build Coastguard Worker prev= 4215*6a54128fSAndroid Build Coastguard Worker install_type= 4216*6a54128fSAndroid Build Coastguard Worker isdir=false 4217*6a54128fSAndroid Build Coastguard Worker stripme= 4218*6a54128fSAndroid Build Coastguard Worker no_mode=: 4219*6a54128fSAndroid Build Coastguard Worker for arg 4220*6a54128fSAndroid Build Coastguard Worker do 4221*6a54128fSAndroid Build Coastguard Worker arg2= 4222*6a54128fSAndroid Build Coastguard Worker if test -n "$dest"; then 4223*6a54128fSAndroid Build Coastguard Worker func_append files " $dest" 4224*6a54128fSAndroid Build Coastguard Worker dest=$arg 4225*6a54128fSAndroid Build Coastguard Worker continue 4226*6a54128fSAndroid Build Coastguard Worker fi 4227*6a54128fSAndroid Build Coastguard Worker 4228*6a54128fSAndroid Build Coastguard Worker case $arg in 4229*6a54128fSAndroid Build Coastguard Worker -d) isdir=: ;; 4230*6a54128fSAndroid Build Coastguard Worker -f) 4231*6a54128fSAndroid Build Coastguard Worker if $install_cp; then :; else 4232*6a54128fSAndroid Build Coastguard Worker prev=$arg 4233*6a54128fSAndroid Build Coastguard Worker fi 4234*6a54128fSAndroid Build Coastguard Worker ;; 4235*6a54128fSAndroid Build Coastguard Worker -g | -m | -o) 4236*6a54128fSAndroid Build Coastguard Worker prev=$arg 4237*6a54128fSAndroid Build Coastguard Worker ;; 4238*6a54128fSAndroid Build Coastguard Worker -s) 4239*6a54128fSAndroid Build Coastguard Worker stripme=" -s" 4240*6a54128fSAndroid Build Coastguard Worker continue 4241*6a54128fSAndroid Build Coastguard Worker ;; 4242*6a54128fSAndroid Build Coastguard Worker -*) 4243*6a54128fSAndroid Build Coastguard Worker ;; 4244*6a54128fSAndroid Build Coastguard Worker *) 4245*6a54128fSAndroid Build Coastguard Worker # If the previous option needed an argument, then skip it. 4246*6a54128fSAndroid Build Coastguard Worker if test -n "$prev"; then 4247*6a54128fSAndroid Build Coastguard Worker if test X-m = "X$prev" && test -n "$install_override_mode"; then 4248*6a54128fSAndroid Build Coastguard Worker arg2=$install_override_mode 4249*6a54128fSAndroid Build Coastguard Worker no_mode=false 4250*6a54128fSAndroid Build Coastguard Worker fi 4251*6a54128fSAndroid Build Coastguard Worker prev= 4252*6a54128fSAndroid Build Coastguard Worker else 4253*6a54128fSAndroid Build Coastguard Worker dest=$arg 4254*6a54128fSAndroid Build Coastguard Worker continue 4255*6a54128fSAndroid Build Coastguard Worker fi 4256*6a54128fSAndroid Build Coastguard Worker ;; 4257*6a54128fSAndroid Build Coastguard Worker esac 4258*6a54128fSAndroid Build Coastguard Worker 4259*6a54128fSAndroid Build Coastguard Worker # Aesthetically quote the argument. 4260*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$arg" 4261*6a54128fSAndroid Build Coastguard Worker func_append install_prog " $func_quote_for_eval_result" 4262*6a54128fSAndroid Build Coastguard Worker if test -n "$arg2"; then 4263*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$arg2" 4264*6a54128fSAndroid Build Coastguard Worker fi 4265*6a54128fSAndroid Build Coastguard Worker func_append install_shared_prog " $func_quote_for_eval_result" 4266*6a54128fSAndroid Build Coastguard Worker done 4267*6a54128fSAndroid Build Coastguard Worker 4268*6a54128fSAndroid Build Coastguard Worker test -z "$install_prog" && \ 4269*6a54128fSAndroid Build Coastguard Worker func_fatal_help "you must specify an install program" 4270*6a54128fSAndroid Build Coastguard Worker 4271*6a54128fSAndroid Build Coastguard Worker test -n "$prev" && \ 4272*6a54128fSAndroid Build Coastguard Worker func_fatal_help "the '$prev' option requires an argument" 4273*6a54128fSAndroid Build Coastguard Worker 4274*6a54128fSAndroid Build Coastguard Worker if test -n "$install_override_mode" && $no_mode; then 4275*6a54128fSAndroid Build Coastguard Worker if $install_cp; then :; else 4276*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$install_override_mode" 4277*6a54128fSAndroid Build Coastguard Worker func_append install_shared_prog " -m $func_quote_for_eval_result" 4278*6a54128fSAndroid Build Coastguard Worker fi 4279*6a54128fSAndroid Build Coastguard Worker fi 4280*6a54128fSAndroid Build Coastguard Worker 4281*6a54128fSAndroid Build Coastguard Worker if test -z "$files"; then 4282*6a54128fSAndroid Build Coastguard Worker if test -z "$dest"; then 4283*6a54128fSAndroid Build Coastguard Worker func_fatal_help "no file or destination specified" 4284*6a54128fSAndroid Build Coastguard Worker else 4285*6a54128fSAndroid Build Coastguard Worker func_fatal_help "you must specify a destination" 4286*6a54128fSAndroid Build Coastguard Worker fi 4287*6a54128fSAndroid Build Coastguard Worker fi 4288*6a54128fSAndroid Build Coastguard Worker 4289*6a54128fSAndroid Build Coastguard Worker # Strip any trailing slash from the destination. 4290*6a54128fSAndroid Build Coastguard Worker func_stripname '' '/' "$dest" 4291*6a54128fSAndroid Build Coastguard Worker dest=$func_stripname_result 4292*6a54128fSAndroid Build Coastguard Worker 4293*6a54128fSAndroid Build Coastguard Worker # Check to see that the destination is a directory. 4294*6a54128fSAndroid Build Coastguard Worker test -d "$dest" && isdir=: 4295*6a54128fSAndroid Build Coastguard Worker if $isdir; then 4296*6a54128fSAndroid Build Coastguard Worker destdir=$dest 4297*6a54128fSAndroid Build Coastguard Worker destname= 4298*6a54128fSAndroid Build Coastguard Worker else 4299*6a54128fSAndroid Build Coastguard Worker func_dirname_and_basename "$dest" "" "." 4300*6a54128fSAndroid Build Coastguard Worker destdir=$func_dirname_result 4301*6a54128fSAndroid Build Coastguard Worker destname=$func_basename_result 4302*6a54128fSAndroid Build Coastguard Worker 4303*6a54128fSAndroid Build Coastguard Worker # Not a directory, so check to see that there is only one file specified. 4304*6a54128fSAndroid Build Coastguard Worker set dummy $files; shift 4305*6a54128fSAndroid Build Coastguard Worker test "$#" -gt 1 && \ 4306*6a54128fSAndroid Build Coastguard Worker func_fatal_help "'$dest' is not a directory" 4307*6a54128fSAndroid Build Coastguard Worker fi 4308*6a54128fSAndroid Build Coastguard Worker case $destdir in 4309*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) ;; 4310*6a54128fSAndroid Build Coastguard Worker *) 4311*6a54128fSAndroid Build Coastguard Worker for file in $files; do 4312*6a54128fSAndroid Build Coastguard Worker case $file in 4313*6a54128fSAndroid Build Coastguard Worker *.lo) ;; 4314*6a54128fSAndroid Build Coastguard Worker *) 4315*6a54128fSAndroid Build Coastguard Worker func_fatal_help "'$destdir' must be an absolute directory name" 4316*6a54128fSAndroid Build Coastguard Worker ;; 4317*6a54128fSAndroid Build Coastguard Worker esac 4318*6a54128fSAndroid Build Coastguard Worker done 4319*6a54128fSAndroid Build Coastguard Worker ;; 4320*6a54128fSAndroid Build Coastguard Worker esac 4321*6a54128fSAndroid Build Coastguard Worker 4322*6a54128fSAndroid Build Coastguard Worker # This variable tells wrapper scripts just to set variables rather 4323*6a54128fSAndroid Build Coastguard Worker # than running their programs. 4324*6a54128fSAndroid Build Coastguard Worker libtool_install_magic=$magic 4325*6a54128fSAndroid Build Coastguard Worker 4326*6a54128fSAndroid Build Coastguard Worker staticlibs= 4327*6a54128fSAndroid Build Coastguard Worker future_libdirs= 4328*6a54128fSAndroid Build Coastguard Worker current_libdirs= 4329*6a54128fSAndroid Build Coastguard Worker for file in $files; do 4330*6a54128fSAndroid Build Coastguard Worker 4331*6a54128fSAndroid Build Coastguard Worker # Do each installation. 4332*6a54128fSAndroid Build Coastguard Worker case $file in 4333*6a54128fSAndroid Build Coastguard Worker *.$libext) 4334*6a54128fSAndroid Build Coastguard Worker # Do the static libraries later. 4335*6a54128fSAndroid Build Coastguard Worker func_append staticlibs " $file" 4336*6a54128fSAndroid Build Coastguard Worker ;; 4337*6a54128fSAndroid Build Coastguard Worker 4338*6a54128fSAndroid Build Coastguard Worker *.la) 4339*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$file" 4340*6a54128fSAndroid Build Coastguard Worker file=$func_resolve_sysroot_result 4341*6a54128fSAndroid Build Coastguard Worker 4342*6a54128fSAndroid Build Coastguard Worker # Check to see that this really is a libtool archive. 4343*6a54128fSAndroid Build Coastguard Worker func_lalib_unsafe_p "$file" \ 4344*6a54128fSAndroid Build Coastguard Worker || func_fatal_help "'$file' is not a valid libtool archive" 4345*6a54128fSAndroid Build Coastguard Worker 4346*6a54128fSAndroid Build Coastguard Worker library_names= 4347*6a54128fSAndroid Build Coastguard Worker old_library= 4348*6a54128fSAndroid Build Coastguard Worker relink_command= 4349*6a54128fSAndroid Build Coastguard Worker func_source "$file" 4350*6a54128fSAndroid Build Coastguard Worker 4351*6a54128fSAndroid Build Coastguard Worker # Add the libdir to current_libdirs if it is the destination. 4352*6a54128fSAndroid Build Coastguard Worker if test "X$destdir" = "X$libdir"; then 4353*6a54128fSAndroid Build Coastguard Worker case "$current_libdirs " in 4354*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 4355*6a54128fSAndroid Build Coastguard Worker *) func_append current_libdirs " $libdir" ;; 4356*6a54128fSAndroid Build Coastguard Worker esac 4357*6a54128fSAndroid Build Coastguard Worker else 4358*6a54128fSAndroid Build Coastguard Worker # Note the libdir as a future libdir. 4359*6a54128fSAndroid Build Coastguard Worker case "$future_libdirs " in 4360*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 4361*6a54128fSAndroid Build Coastguard Worker *) func_append future_libdirs " $libdir" ;; 4362*6a54128fSAndroid Build Coastguard Worker esac 4363*6a54128fSAndroid Build Coastguard Worker fi 4364*6a54128fSAndroid Build Coastguard Worker 4365*6a54128fSAndroid Build Coastguard Worker func_dirname "$file" "/" "" 4366*6a54128fSAndroid Build Coastguard Worker dir=$func_dirname_result 4367*6a54128fSAndroid Build Coastguard Worker func_append dir "$objdir" 4368*6a54128fSAndroid Build Coastguard Worker 4369*6a54128fSAndroid Build Coastguard Worker if test -n "$relink_command"; then 4370*6a54128fSAndroid Build Coastguard Worker # Determine the prefix the user has applied to our future dir. 4371*6a54128fSAndroid Build Coastguard Worker inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` 4372*6a54128fSAndroid Build Coastguard Worker 4373*6a54128fSAndroid Build Coastguard Worker # Don't allow the user to place us outside of our expected 4374*6a54128fSAndroid Build Coastguard Worker # location b/c this prevents finding dependent libraries that 4375*6a54128fSAndroid Build Coastguard Worker # are installed to the same prefix. 4376*6a54128fSAndroid Build Coastguard Worker # At present, this check doesn't affect windows .dll's that 4377*6a54128fSAndroid Build Coastguard Worker # are installed into $libdir/../bin (currently, that works fine) 4378*6a54128fSAndroid Build Coastguard Worker # but it's something to keep an eye on. 4379*6a54128fSAndroid Build Coastguard Worker test "$inst_prefix_dir" = "$destdir" && \ 4380*6a54128fSAndroid Build Coastguard Worker func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" 4381*6a54128fSAndroid Build Coastguard Worker 4382*6a54128fSAndroid Build Coastguard Worker if test -n "$inst_prefix_dir"; then 4383*6a54128fSAndroid Build Coastguard Worker # Stick the inst_prefix_dir data into the link command. 4384*6a54128fSAndroid Build Coastguard Worker relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` 4385*6a54128fSAndroid Build Coastguard Worker else 4386*6a54128fSAndroid Build Coastguard Worker relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` 4387*6a54128fSAndroid Build Coastguard Worker fi 4388*6a54128fSAndroid Build Coastguard Worker 4389*6a54128fSAndroid Build Coastguard Worker func_warning "relinking '$file'" 4390*6a54128fSAndroid Build Coastguard Worker func_show_eval "$relink_command" \ 4391*6a54128fSAndroid Build Coastguard Worker 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' 4392*6a54128fSAndroid Build Coastguard Worker fi 4393*6a54128fSAndroid Build Coastguard Worker 4394*6a54128fSAndroid Build Coastguard Worker # See the names of the shared library. 4395*6a54128fSAndroid Build Coastguard Worker set dummy $library_names; shift 4396*6a54128fSAndroid Build Coastguard Worker if test -n "$1"; then 4397*6a54128fSAndroid Build Coastguard Worker realname=$1 4398*6a54128fSAndroid Build Coastguard Worker shift 4399*6a54128fSAndroid Build Coastguard Worker 4400*6a54128fSAndroid Build Coastguard Worker srcname=$realname 4401*6a54128fSAndroid Build Coastguard Worker test -n "$relink_command" && srcname=${realname}T 4402*6a54128fSAndroid Build Coastguard Worker 4403*6a54128fSAndroid Build Coastguard Worker # Install the shared library and build the symlinks. 4404*6a54128fSAndroid Build Coastguard Worker func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 4405*6a54128fSAndroid Build Coastguard Worker 'exit $?' 4406*6a54128fSAndroid Build Coastguard Worker tstripme=$stripme 4407*6a54128fSAndroid Build Coastguard Worker case $host_os in 4408*6a54128fSAndroid Build Coastguard Worker cygwin* | mingw* | pw32* | cegcc*) 4409*6a54128fSAndroid Build Coastguard Worker case $realname in 4410*6a54128fSAndroid Build Coastguard Worker *.dll.a) 4411*6a54128fSAndroid Build Coastguard Worker tstripme= 4412*6a54128fSAndroid Build Coastguard Worker ;; 4413*6a54128fSAndroid Build Coastguard Worker esac 4414*6a54128fSAndroid Build Coastguard Worker ;; 4415*6a54128fSAndroid Build Coastguard Worker os2*) 4416*6a54128fSAndroid Build Coastguard Worker case $realname in 4417*6a54128fSAndroid Build Coastguard Worker *_dll.a) 4418*6a54128fSAndroid Build Coastguard Worker tstripme= 4419*6a54128fSAndroid Build Coastguard Worker ;; 4420*6a54128fSAndroid Build Coastguard Worker esac 4421*6a54128fSAndroid Build Coastguard Worker ;; 4422*6a54128fSAndroid Build Coastguard Worker esac 4423*6a54128fSAndroid Build Coastguard Worker if test -n "$tstripme" && test -n "$striplib"; then 4424*6a54128fSAndroid Build Coastguard Worker func_show_eval "$striplib $destdir/$realname" 'exit $?' 4425*6a54128fSAndroid Build Coastguard Worker fi 4426*6a54128fSAndroid Build Coastguard Worker 4427*6a54128fSAndroid Build Coastguard Worker if test "$#" -gt 0; then 4428*6a54128fSAndroid Build Coastguard Worker # Delete the old symlinks, and create new ones. 4429*6a54128fSAndroid Build Coastguard Worker # Try 'ln -sf' first, because the 'ln' binary might depend on 4430*6a54128fSAndroid Build Coastguard Worker # the symlink we replace! Solaris /bin/ln does not understand -f, 4431*6a54128fSAndroid Build Coastguard Worker # so we also need to try rm && ln -s. 4432*6a54128fSAndroid Build Coastguard Worker for linkname 4433*6a54128fSAndroid Build Coastguard Worker do 4434*6a54128fSAndroid Build Coastguard Worker test "$linkname" != "$realname" \ 4435*6a54128fSAndroid Build Coastguard Worker && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" 4436*6a54128fSAndroid Build Coastguard Worker done 4437*6a54128fSAndroid Build Coastguard Worker fi 4438*6a54128fSAndroid Build Coastguard Worker 4439*6a54128fSAndroid Build Coastguard Worker # Do each command in the postinstall commands. 4440*6a54128fSAndroid Build Coastguard Worker lib=$destdir/$realname 4441*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$postinstall_cmds" 'exit $?' 4442*6a54128fSAndroid Build Coastguard Worker fi 4443*6a54128fSAndroid Build Coastguard Worker 4444*6a54128fSAndroid Build Coastguard Worker # Install the pseudo-library for information purposes. 4445*6a54128fSAndroid Build Coastguard Worker func_basename "$file" 4446*6a54128fSAndroid Build Coastguard Worker name=$func_basename_result 4447*6a54128fSAndroid Build Coastguard Worker instname=$dir/${name}i 4448*6a54128fSAndroid Build Coastguard Worker func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' 4449*6a54128fSAndroid Build Coastguard Worker 4450*6a54128fSAndroid Build Coastguard Worker # Maybe install the static library, too. 4451*6a54128fSAndroid Build Coastguard Worker test -n "$old_library" && func_append staticlibs " $dir/$old_library" 4452*6a54128fSAndroid Build Coastguard Worker ;; 4453*6a54128fSAndroid Build Coastguard Worker 4454*6a54128fSAndroid Build Coastguard Worker *.lo) 4455*6a54128fSAndroid Build Coastguard Worker # Install (i.e. copy) a libtool object. 4456*6a54128fSAndroid Build Coastguard Worker 4457*6a54128fSAndroid Build Coastguard Worker # Figure out destination file name, if it wasn't already specified. 4458*6a54128fSAndroid Build Coastguard Worker if test -n "$destname"; then 4459*6a54128fSAndroid Build Coastguard Worker destfile=$destdir/$destname 4460*6a54128fSAndroid Build Coastguard Worker else 4461*6a54128fSAndroid Build Coastguard Worker func_basename "$file" 4462*6a54128fSAndroid Build Coastguard Worker destfile=$func_basename_result 4463*6a54128fSAndroid Build Coastguard Worker destfile=$destdir/$destfile 4464*6a54128fSAndroid Build Coastguard Worker fi 4465*6a54128fSAndroid Build Coastguard Worker 4466*6a54128fSAndroid Build Coastguard Worker # Deduce the name of the destination old-style object file. 4467*6a54128fSAndroid Build Coastguard Worker case $destfile in 4468*6a54128fSAndroid Build Coastguard Worker *.lo) 4469*6a54128fSAndroid Build Coastguard Worker func_lo2o "$destfile" 4470*6a54128fSAndroid Build Coastguard Worker staticdest=$func_lo2o_result 4471*6a54128fSAndroid Build Coastguard Worker ;; 4472*6a54128fSAndroid Build Coastguard Worker *.$objext) 4473*6a54128fSAndroid Build Coastguard Worker staticdest=$destfile 4474*6a54128fSAndroid Build Coastguard Worker destfile= 4475*6a54128fSAndroid Build Coastguard Worker ;; 4476*6a54128fSAndroid Build Coastguard Worker *) 4477*6a54128fSAndroid Build Coastguard Worker func_fatal_help "cannot copy a libtool object to '$destfile'" 4478*6a54128fSAndroid Build Coastguard Worker ;; 4479*6a54128fSAndroid Build Coastguard Worker esac 4480*6a54128fSAndroid Build Coastguard Worker 4481*6a54128fSAndroid Build Coastguard Worker # Install the libtool object if requested. 4482*6a54128fSAndroid Build Coastguard Worker test -n "$destfile" && \ 4483*6a54128fSAndroid Build Coastguard Worker func_show_eval "$install_prog $file $destfile" 'exit $?' 4484*6a54128fSAndroid Build Coastguard Worker 4485*6a54128fSAndroid Build Coastguard Worker # Install the old object if enabled. 4486*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_old_libs"; then 4487*6a54128fSAndroid Build Coastguard Worker # Deduce the name of the old-style object file. 4488*6a54128fSAndroid Build Coastguard Worker func_lo2o "$file" 4489*6a54128fSAndroid Build Coastguard Worker staticobj=$func_lo2o_result 4490*6a54128fSAndroid Build Coastguard Worker func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' 4491*6a54128fSAndroid Build Coastguard Worker fi 4492*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 4493*6a54128fSAndroid Build Coastguard Worker ;; 4494*6a54128fSAndroid Build Coastguard Worker 4495*6a54128fSAndroid Build Coastguard Worker *) 4496*6a54128fSAndroid Build Coastguard Worker # Figure out destination file name, if it wasn't already specified. 4497*6a54128fSAndroid Build Coastguard Worker if test -n "$destname"; then 4498*6a54128fSAndroid Build Coastguard Worker destfile=$destdir/$destname 4499*6a54128fSAndroid Build Coastguard Worker else 4500*6a54128fSAndroid Build Coastguard Worker func_basename "$file" 4501*6a54128fSAndroid Build Coastguard Worker destfile=$func_basename_result 4502*6a54128fSAndroid Build Coastguard Worker destfile=$destdir/$destfile 4503*6a54128fSAndroid Build Coastguard Worker fi 4504*6a54128fSAndroid Build Coastguard Worker 4505*6a54128fSAndroid Build Coastguard Worker # If the file is missing, and there is a .exe on the end, strip it 4506*6a54128fSAndroid Build Coastguard Worker # because it is most likely a libtool script we actually want to 4507*6a54128fSAndroid Build Coastguard Worker # install 4508*6a54128fSAndroid Build Coastguard Worker stripped_ext= 4509*6a54128fSAndroid Build Coastguard Worker case $file in 4510*6a54128fSAndroid Build Coastguard Worker *.exe) 4511*6a54128fSAndroid Build Coastguard Worker if test ! -f "$file"; then 4512*6a54128fSAndroid Build Coastguard Worker func_stripname '' '.exe' "$file" 4513*6a54128fSAndroid Build Coastguard Worker file=$func_stripname_result 4514*6a54128fSAndroid Build Coastguard Worker stripped_ext=.exe 4515*6a54128fSAndroid Build Coastguard Worker fi 4516*6a54128fSAndroid Build Coastguard Worker ;; 4517*6a54128fSAndroid Build Coastguard Worker esac 4518*6a54128fSAndroid Build Coastguard Worker 4519*6a54128fSAndroid Build Coastguard Worker # Do a test to see if this is really a libtool program. 4520*6a54128fSAndroid Build Coastguard Worker case $host in 4521*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw*) 4522*6a54128fSAndroid Build Coastguard Worker if func_ltwrapper_executable_p "$file"; then 4523*6a54128fSAndroid Build Coastguard Worker func_ltwrapper_scriptname "$file" 4524*6a54128fSAndroid Build Coastguard Worker wrapper=$func_ltwrapper_scriptname_result 4525*6a54128fSAndroid Build Coastguard Worker else 4526*6a54128fSAndroid Build Coastguard Worker func_stripname '' '.exe' "$file" 4527*6a54128fSAndroid Build Coastguard Worker wrapper=$func_stripname_result 4528*6a54128fSAndroid Build Coastguard Worker fi 4529*6a54128fSAndroid Build Coastguard Worker ;; 4530*6a54128fSAndroid Build Coastguard Worker *) 4531*6a54128fSAndroid Build Coastguard Worker wrapper=$file 4532*6a54128fSAndroid Build Coastguard Worker ;; 4533*6a54128fSAndroid Build Coastguard Worker esac 4534*6a54128fSAndroid Build Coastguard Worker if func_ltwrapper_script_p "$wrapper"; then 4535*6a54128fSAndroid Build Coastguard Worker notinst_deplibs= 4536*6a54128fSAndroid Build Coastguard Worker relink_command= 4537*6a54128fSAndroid Build Coastguard Worker 4538*6a54128fSAndroid Build Coastguard Worker func_source "$wrapper" 4539*6a54128fSAndroid Build Coastguard Worker 4540*6a54128fSAndroid Build Coastguard Worker # Check the variables that should have been set. 4541*6a54128fSAndroid Build Coastguard Worker test -z "$generated_by_libtool_version" && \ 4542*6a54128fSAndroid Build Coastguard Worker func_fatal_error "invalid libtool wrapper script '$wrapper'" 4543*6a54128fSAndroid Build Coastguard Worker 4544*6a54128fSAndroid Build Coastguard Worker finalize=: 4545*6a54128fSAndroid Build Coastguard Worker for lib in $notinst_deplibs; do 4546*6a54128fSAndroid Build Coastguard Worker # Check to see that each library is installed. 4547*6a54128fSAndroid Build Coastguard Worker libdir= 4548*6a54128fSAndroid Build Coastguard Worker if test -f "$lib"; then 4549*6a54128fSAndroid Build Coastguard Worker func_source "$lib" 4550*6a54128fSAndroid Build Coastguard Worker fi 4551*6a54128fSAndroid Build Coastguard Worker libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` 4552*6a54128fSAndroid Build Coastguard Worker if test -n "$libdir" && test ! -f "$libfile"; then 4553*6a54128fSAndroid Build Coastguard Worker func_warning "'$lib' has not been installed in '$libdir'" 4554*6a54128fSAndroid Build Coastguard Worker finalize=false 4555*6a54128fSAndroid Build Coastguard Worker fi 4556*6a54128fSAndroid Build Coastguard Worker done 4557*6a54128fSAndroid Build Coastguard Worker 4558*6a54128fSAndroid Build Coastguard Worker relink_command= 4559*6a54128fSAndroid Build Coastguard Worker func_source "$wrapper" 4560*6a54128fSAndroid Build Coastguard Worker 4561*6a54128fSAndroid Build Coastguard Worker outputname= 4562*6a54128fSAndroid Build Coastguard Worker if test no = "$fast_install" && test -n "$relink_command"; then 4563*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 4564*6a54128fSAndroid Build Coastguard Worker if $finalize; then 4565*6a54128fSAndroid Build Coastguard Worker tmpdir=`func_mktempdir` 4566*6a54128fSAndroid Build Coastguard Worker func_basename "$file$stripped_ext" 4567*6a54128fSAndroid Build Coastguard Worker file=$func_basename_result 4568*6a54128fSAndroid Build Coastguard Worker outputname=$tmpdir/$file 4569*6a54128fSAndroid Build Coastguard Worker # Replace the output file specification. 4570*6a54128fSAndroid Build Coastguard Worker relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` 4571*6a54128fSAndroid Build Coastguard Worker 4572*6a54128fSAndroid Build Coastguard Worker $opt_quiet || { 4573*6a54128fSAndroid Build Coastguard Worker func_quote_for_expand "$relink_command" 4574*6a54128fSAndroid Build Coastguard Worker eval "func_echo $func_quote_for_expand_result" 4575*6a54128fSAndroid Build Coastguard Worker } 4576*6a54128fSAndroid Build Coastguard Worker if eval "$relink_command"; then : 4577*6a54128fSAndroid Build Coastguard Worker else 4578*6a54128fSAndroid Build Coastguard Worker func_error "error: relink '$file' with the above command before installing it" 4579*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || ${RM}r "$tmpdir" 4580*6a54128fSAndroid Build Coastguard Worker continue 4581*6a54128fSAndroid Build Coastguard Worker fi 4582*6a54128fSAndroid Build Coastguard Worker file=$outputname 4583*6a54128fSAndroid Build Coastguard Worker else 4584*6a54128fSAndroid Build Coastguard Worker func_warning "cannot relink '$file'" 4585*6a54128fSAndroid Build Coastguard Worker fi 4586*6a54128fSAndroid Build Coastguard Worker } 4587*6a54128fSAndroid Build Coastguard Worker else 4588*6a54128fSAndroid Build Coastguard Worker # Install the binary that we compiled earlier. 4589*6a54128fSAndroid Build Coastguard Worker file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` 4590*6a54128fSAndroid Build Coastguard Worker fi 4591*6a54128fSAndroid Build Coastguard Worker fi 4592*6a54128fSAndroid Build Coastguard Worker 4593*6a54128fSAndroid Build Coastguard Worker # remove .exe since cygwin /usr/bin/install will append another 4594*6a54128fSAndroid Build Coastguard Worker # one anyway 4595*6a54128fSAndroid Build Coastguard Worker case $install_prog,$host in 4596*6a54128fSAndroid Build Coastguard Worker */usr/bin/install*,*cygwin*) 4597*6a54128fSAndroid Build Coastguard Worker case $file:$destfile in 4598*6a54128fSAndroid Build Coastguard Worker *.exe:*.exe) 4599*6a54128fSAndroid Build Coastguard Worker # this is ok 4600*6a54128fSAndroid Build Coastguard Worker ;; 4601*6a54128fSAndroid Build Coastguard Worker *.exe:*) 4602*6a54128fSAndroid Build Coastguard Worker destfile=$destfile.exe 4603*6a54128fSAndroid Build Coastguard Worker ;; 4604*6a54128fSAndroid Build Coastguard Worker *:*.exe) 4605*6a54128fSAndroid Build Coastguard Worker func_stripname '' '.exe' "$destfile" 4606*6a54128fSAndroid Build Coastguard Worker destfile=$func_stripname_result 4607*6a54128fSAndroid Build Coastguard Worker ;; 4608*6a54128fSAndroid Build Coastguard Worker esac 4609*6a54128fSAndroid Build Coastguard Worker ;; 4610*6a54128fSAndroid Build Coastguard Worker esac 4611*6a54128fSAndroid Build Coastguard Worker func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' 4612*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || if test -n "$outputname"; then 4613*6a54128fSAndroid Build Coastguard Worker ${RM}r "$tmpdir" 4614*6a54128fSAndroid Build Coastguard Worker fi 4615*6a54128fSAndroid Build Coastguard Worker ;; 4616*6a54128fSAndroid Build Coastguard Worker esac 4617*6a54128fSAndroid Build Coastguard Worker done 4618*6a54128fSAndroid Build Coastguard Worker 4619*6a54128fSAndroid Build Coastguard Worker for file in $staticlibs; do 4620*6a54128fSAndroid Build Coastguard Worker func_basename "$file" 4621*6a54128fSAndroid Build Coastguard Worker name=$func_basename_result 4622*6a54128fSAndroid Build Coastguard Worker 4623*6a54128fSAndroid Build Coastguard Worker # Set up the ranlib parameters. 4624*6a54128fSAndroid Build Coastguard Worker oldlib=$destdir/$name 4625*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 4626*6a54128fSAndroid Build Coastguard Worker tool_oldlib=$func_to_tool_file_result 4627*6a54128fSAndroid Build Coastguard Worker 4628*6a54128fSAndroid Build Coastguard Worker func_show_eval "$install_prog \$file \$oldlib" 'exit $?' 4629*6a54128fSAndroid Build Coastguard Worker 4630*6a54128fSAndroid Build Coastguard Worker if test -n "$stripme" && test -n "$old_striplib"; then 4631*6a54128fSAndroid Build Coastguard Worker func_show_eval "$old_striplib $tool_oldlib" 'exit $?' 4632*6a54128fSAndroid Build Coastguard Worker fi 4633*6a54128fSAndroid Build Coastguard Worker 4634*6a54128fSAndroid Build Coastguard Worker # Do each command in the postinstall commands. 4635*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$old_postinstall_cmds" 'exit $?' 4636*6a54128fSAndroid Build Coastguard Worker done 4637*6a54128fSAndroid Build Coastguard Worker 4638*6a54128fSAndroid Build Coastguard Worker test -n "$future_libdirs" && \ 4639*6a54128fSAndroid Build Coastguard Worker func_warning "remember to run '$progname --finish$future_libdirs'" 4640*6a54128fSAndroid Build Coastguard Worker 4641*6a54128fSAndroid Build Coastguard Worker if test -n "$current_libdirs"; then 4642*6a54128fSAndroid Build Coastguard Worker # Maybe just do a dry run. 4643*6a54128fSAndroid Build Coastguard Worker $opt_dry_run && current_libdirs=" -n$current_libdirs" 4644*6a54128fSAndroid Build Coastguard Worker exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' 4645*6a54128fSAndroid Build Coastguard Worker else 4646*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 4647*6a54128fSAndroid Build Coastguard Worker fi 4648*6a54128fSAndroid Build Coastguard Worker} 4649*6a54128fSAndroid Build Coastguard Worker 4650*6a54128fSAndroid Build Coastguard Workertest install = "$opt_mode" && func_mode_install ${1+"$@"} 4651*6a54128fSAndroid Build Coastguard Worker 4652*6a54128fSAndroid Build Coastguard Worker 4653*6a54128fSAndroid Build Coastguard Worker# func_generate_dlsyms outputname originator pic_p 4654*6a54128fSAndroid Build Coastguard Worker# Extract symbols from dlprefiles and create ${outputname}S.o with 4655*6a54128fSAndroid Build Coastguard Worker# a dlpreopen symbol table. 4656*6a54128fSAndroid Build Coastguard Workerfunc_generate_dlsyms () 4657*6a54128fSAndroid Build Coastguard Worker{ 4658*6a54128fSAndroid Build Coastguard Worker $debug_cmd 4659*6a54128fSAndroid Build Coastguard Worker 4660*6a54128fSAndroid Build Coastguard Worker my_outputname=$1 4661*6a54128fSAndroid Build Coastguard Worker my_originator=$2 4662*6a54128fSAndroid Build Coastguard Worker my_pic_p=${3-false} 4663*6a54128fSAndroid Build Coastguard Worker my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` 4664*6a54128fSAndroid Build Coastguard Worker my_dlsyms= 4665*6a54128fSAndroid Build Coastguard Worker 4666*6a54128fSAndroid Build Coastguard Worker if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then 4667*6a54128fSAndroid Build Coastguard Worker if test -n "$NM" && test -n "$global_symbol_pipe"; then 4668*6a54128fSAndroid Build Coastguard Worker my_dlsyms=${my_outputname}S.c 4669*6a54128fSAndroid Build Coastguard Worker else 4670*6a54128fSAndroid Build Coastguard Worker func_error "not configured to extract global symbols from dlpreopened files" 4671*6a54128fSAndroid Build Coastguard Worker fi 4672*6a54128fSAndroid Build Coastguard Worker fi 4673*6a54128fSAndroid Build Coastguard Worker 4674*6a54128fSAndroid Build Coastguard Worker if test -n "$my_dlsyms"; then 4675*6a54128fSAndroid Build Coastguard Worker case $my_dlsyms in 4676*6a54128fSAndroid Build Coastguard Worker "") ;; 4677*6a54128fSAndroid Build Coastguard Worker *.c) 4678*6a54128fSAndroid Build Coastguard Worker # Discover the nlist of each of the dlfiles. 4679*6a54128fSAndroid Build Coastguard Worker nlist=$output_objdir/$my_outputname.nm 4680*6a54128fSAndroid Build Coastguard Worker 4681*6a54128fSAndroid Build Coastguard Worker func_show_eval "$RM $nlist ${nlist}S ${nlist}T" 4682*6a54128fSAndroid Build Coastguard Worker 4683*6a54128fSAndroid Build Coastguard Worker # Parse the name list into a source file. 4684*6a54128fSAndroid Build Coastguard Worker func_verbose "creating $output_objdir/$my_dlsyms" 4685*6a54128fSAndroid Build Coastguard Worker 4686*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ 4687*6a54128fSAndroid Build Coastguard Worker/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ 4688*6a54128fSAndroid Build Coastguard Worker/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ 4689*6a54128fSAndroid Build Coastguard Worker 4690*6a54128fSAndroid Build Coastguard Worker#ifdef __cplusplus 4691*6a54128fSAndroid Build Coastguard Workerextern \"C\" { 4692*6a54128fSAndroid Build Coastguard Worker#endif 4693*6a54128fSAndroid Build Coastguard Worker 4694*6a54128fSAndroid Build Coastguard Worker#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) 4695*6a54128fSAndroid Build Coastguard Worker#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" 4696*6a54128fSAndroid Build Coastguard Worker#endif 4697*6a54128fSAndroid Build Coastguard Worker 4698*6a54128fSAndroid Build Coastguard Worker/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ 4699*6a54128fSAndroid Build Coastguard Worker#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE 4700*6a54128fSAndroid Build Coastguard Worker/* DATA imports from DLLs on WIN32 can't be const, because runtime 4701*6a54128fSAndroid Build Coastguard Worker relocations are performed -- see ld's documentation on pseudo-relocs. */ 4702*6a54128fSAndroid Build Coastguard Worker# define LT_DLSYM_CONST 4703*6a54128fSAndroid Build Coastguard Worker#elif defined __osf__ 4704*6a54128fSAndroid Build Coastguard Worker/* This system does not cope well with relocations in const data. */ 4705*6a54128fSAndroid Build Coastguard Worker# define LT_DLSYM_CONST 4706*6a54128fSAndroid Build Coastguard Worker#else 4707*6a54128fSAndroid Build Coastguard Worker# define LT_DLSYM_CONST const 4708*6a54128fSAndroid Build Coastguard Worker#endif 4709*6a54128fSAndroid Build Coastguard Worker 4710*6a54128fSAndroid Build Coastguard Worker#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) 4711*6a54128fSAndroid Build Coastguard Worker 4712*6a54128fSAndroid Build Coastguard Worker/* External symbol declarations for the compiler. */\ 4713*6a54128fSAndroid Build Coastguard Worker" 4714*6a54128fSAndroid Build Coastguard Worker 4715*6a54128fSAndroid Build Coastguard Worker if test yes = "$dlself"; then 4716*6a54128fSAndroid Build Coastguard Worker func_verbose "generating symbol list for '$output'" 4717*6a54128fSAndroid Build Coastguard Worker 4718*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" 4719*6a54128fSAndroid Build Coastguard Worker 4720*6a54128fSAndroid Build Coastguard Worker # Add our own program objects to the symbol list. 4721*6a54128fSAndroid Build Coastguard Worker progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` 4722*6a54128fSAndroid Build Coastguard Worker for progfile in $progfiles; do 4723*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$progfile" func_convert_file_msys_to_w32 4724*6a54128fSAndroid Build Coastguard Worker func_verbose "extracting global C symbols from '$func_to_tool_file_result'" 4725*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" 4726*6a54128fSAndroid Build Coastguard Worker done 4727*6a54128fSAndroid Build Coastguard Worker 4728*6a54128fSAndroid Build Coastguard Worker if test -n "$exclude_expsyms"; then 4729*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 4730*6a54128fSAndroid Build Coastguard Worker eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4731*6a54128fSAndroid Build Coastguard Worker eval '$MV "$nlist"T "$nlist"' 4732*6a54128fSAndroid Build Coastguard Worker } 4733*6a54128fSAndroid Build Coastguard Worker fi 4734*6a54128fSAndroid Build Coastguard Worker 4735*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols_regex"; then 4736*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 4737*6a54128fSAndroid Build Coastguard Worker eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4738*6a54128fSAndroid Build Coastguard Worker eval '$MV "$nlist"T "$nlist"' 4739*6a54128fSAndroid Build Coastguard Worker } 4740*6a54128fSAndroid Build Coastguard Worker fi 4741*6a54128fSAndroid Build Coastguard Worker 4742*6a54128fSAndroid Build Coastguard Worker # Prepare the list of exported symbols 4743*6a54128fSAndroid Build Coastguard Worker if test -z "$export_symbols"; then 4744*6a54128fSAndroid Build Coastguard Worker export_symbols=$output_objdir/$outputname.exp 4745*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 4746*6a54128fSAndroid Build Coastguard Worker $RM $export_symbols 4747*6a54128fSAndroid Build Coastguard Worker eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4748*6a54128fSAndroid Build Coastguard Worker case $host in 4749*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw* | *cegcc* ) 4750*6a54128fSAndroid Build Coastguard Worker eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4751*6a54128fSAndroid Build Coastguard Worker eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4752*6a54128fSAndroid Build Coastguard Worker ;; 4753*6a54128fSAndroid Build Coastguard Worker esac 4754*6a54128fSAndroid Build Coastguard Worker } 4755*6a54128fSAndroid Build Coastguard Worker else 4756*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 4757*6a54128fSAndroid Build Coastguard Worker eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4758*6a54128fSAndroid Build Coastguard Worker eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4759*6a54128fSAndroid Build Coastguard Worker eval '$MV "$nlist"T "$nlist"' 4760*6a54128fSAndroid Build Coastguard Worker case $host in 4761*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw* | *cegcc* ) 4762*6a54128fSAndroid Build Coastguard Worker eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4763*6a54128fSAndroid Build Coastguard Worker eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4764*6a54128fSAndroid Build Coastguard Worker ;; 4765*6a54128fSAndroid Build Coastguard Worker esac 4766*6a54128fSAndroid Build Coastguard Worker } 4767*6a54128fSAndroid Build Coastguard Worker fi 4768*6a54128fSAndroid Build Coastguard Worker fi 4769*6a54128fSAndroid Build Coastguard Worker 4770*6a54128fSAndroid Build Coastguard Worker for dlprefile in $dlprefiles; do 4771*6a54128fSAndroid Build Coastguard Worker func_verbose "extracting global C symbols from '$dlprefile'" 4772*6a54128fSAndroid Build Coastguard Worker func_basename "$dlprefile" 4773*6a54128fSAndroid Build Coastguard Worker name=$func_basename_result 4774*6a54128fSAndroid Build Coastguard Worker case $host in 4775*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw* | *cegcc* ) 4776*6a54128fSAndroid Build Coastguard Worker # if an import library, we need to obtain dlname 4777*6a54128fSAndroid Build Coastguard Worker if func_win32_import_lib_p "$dlprefile"; then 4778*6a54128fSAndroid Build Coastguard Worker func_tr_sh "$dlprefile" 4779*6a54128fSAndroid Build Coastguard Worker eval "curr_lafile=\$libfile_$func_tr_sh_result" 4780*6a54128fSAndroid Build Coastguard Worker dlprefile_dlbasename= 4781*6a54128fSAndroid Build Coastguard Worker if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then 4782*6a54128fSAndroid Build Coastguard Worker # Use subshell, to avoid clobbering current variable values 4783*6a54128fSAndroid Build Coastguard Worker dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` 4784*6a54128fSAndroid Build Coastguard Worker if test -n "$dlprefile_dlname"; then 4785*6a54128fSAndroid Build Coastguard Worker func_basename "$dlprefile_dlname" 4786*6a54128fSAndroid Build Coastguard Worker dlprefile_dlbasename=$func_basename_result 4787*6a54128fSAndroid Build Coastguard Worker else 4788*6a54128fSAndroid Build Coastguard Worker # no lafile. user explicitly requested -dlpreopen <import library>. 4789*6a54128fSAndroid Build Coastguard Worker $sharedlib_from_linklib_cmd "$dlprefile" 4790*6a54128fSAndroid Build Coastguard Worker dlprefile_dlbasename=$sharedlib_from_linklib_result 4791*6a54128fSAndroid Build Coastguard Worker fi 4792*6a54128fSAndroid Build Coastguard Worker fi 4793*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 4794*6a54128fSAndroid Build Coastguard Worker if test -n "$dlprefile_dlbasename"; then 4795*6a54128fSAndroid Build Coastguard Worker eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' 4796*6a54128fSAndroid Build Coastguard Worker else 4797*6a54128fSAndroid Build Coastguard Worker func_warning "Could not compute DLL name from $name" 4798*6a54128fSAndroid Build Coastguard Worker eval '$ECHO ": $name " >> "$nlist"' 4799*6a54128fSAndroid Build Coastguard Worker fi 4800*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 4801*6a54128fSAndroid Build Coastguard Worker eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | 4802*6a54128fSAndroid Build Coastguard Worker $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" 4803*6a54128fSAndroid Build Coastguard Worker } 4804*6a54128fSAndroid Build Coastguard Worker else # not an import lib 4805*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 4806*6a54128fSAndroid Build Coastguard Worker eval '$ECHO ": $name " >> "$nlist"' 4807*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 4808*6a54128fSAndroid Build Coastguard Worker eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 4809*6a54128fSAndroid Build Coastguard Worker } 4810*6a54128fSAndroid Build Coastguard Worker fi 4811*6a54128fSAndroid Build Coastguard Worker ;; 4812*6a54128fSAndroid Build Coastguard Worker *) 4813*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 4814*6a54128fSAndroid Build Coastguard Worker eval '$ECHO ": $name " >> "$nlist"' 4815*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 4816*6a54128fSAndroid Build Coastguard Worker eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" 4817*6a54128fSAndroid Build Coastguard Worker } 4818*6a54128fSAndroid Build Coastguard Worker ;; 4819*6a54128fSAndroid Build Coastguard Worker esac 4820*6a54128fSAndroid Build Coastguard Worker done 4821*6a54128fSAndroid Build Coastguard Worker 4822*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 4823*6a54128fSAndroid Build Coastguard Worker # Make sure we have at least an empty file. 4824*6a54128fSAndroid Build Coastguard Worker test -f "$nlist" || : > "$nlist" 4825*6a54128fSAndroid Build Coastguard Worker 4826*6a54128fSAndroid Build Coastguard Worker if test -n "$exclude_expsyms"; then 4827*6a54128fSAndroid Build Coastguard Worker $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4828*6a54128fSAndroid Build Coastguard Worker $MV "$nlist"T "$nlist" 4829*6a54128fSAndroid Build Coastguard Worker fi 4830*6a54128fSAndroid Build Coastguard Worker 4831*6a54128fSAndroid Build Coastguard Worker # Try sorting and uniquifying the output. 4832*6a54128fSAndroid Build Coastguard Worker if $GREP -v "^: " < "$nlist" | 4833*6a54128fSAndroid Build Coastguard Worker if sort -k 3 </dev/null >/dev/null 2>&1; then 4834*6a54128fSAndroid Build Coastguard Worker sort -k 3 4835*6a54128fSAndroid Build Coastguard Worker else 4836*6a54128fSAndroid Build Coastguard Worker sort +2 4837*6a54128fSAndroid Build Coastguard Worker fi | 4838*6a54128fSAndroid Build Coastguard Worker uniq > "$nlist"S; then 4839*6a54128fSAndroid Build Coastguard Worker : 4840*6a54128fSAndroid Build Coastguard Worker else 4841*6a54128fSAndroid Build Coastguard Worker $GREP -v "^: " < "$nlist" > "$nlist"S 4842*6a54128fSAndroid Build Coastguard Worker fi 4843*6a54128fSAndroid Build Coastguard Worker 4844*6a54128fSAndroid Build Coastguard Worker if test -f "$nlist"S; then 4845*6a54128fSAndroid Build Coastguard Worker eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' 4846*6a54128fSAndroid Build Coastguard Worker else 4847*6a54128fSAndroid Build Coastguard Worker echo '/* NONE */' >> "$output_objdir/$my_dlsyms" 4848*6a54128fSAndroid Build Coastguard Worker fi 4849*6a54128fSAndroid Build Coastguard Worker 4850*6a54128fSAndroid Build Coastguard Worker func_show_eval '$RM "${nlist}I"' 4851*6a54128fSAndroid Build Coastguard Worker if test -n "$global_symbol_to_import"; then 4852*6a54128fSAndroid Build Coastguard Worker eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' 4853*6a54128fSAndroid Build Coastguard Worker fi 4854*6a54128fSAndroid Build Coastguard Worker 4855*6a54128fSAndroid Build Coastguard Worker echo >> "$output_objdir/$my_dlsyms" "\ 4856*6a54128fSAndroid Build Coastguard Worker 4857*6a54128fSAndroid Build Coastguard Worker/* The mapping between symbol names and symbols. */ 4858*6a54128fSAndroid Build Coastguard Workertypedef struct { 4859*6a54128fSAndroid Build Coastguard Worker const char *name; 4860*6a54128fSAndroid Build Coastguard Worker void *address; 4861*6a54128fSAndroid Build Coastguard Worker} lt_dlsymlist; 4862*6a54128fSAndroid Build Coastguard Workerextern LT_DLSYM_CONST lt_dlsymlist 4863*6a54128fSAndroid Build Coastguard Workerlt_${my_prefix}_LTX_preloaded_symbols[];\ 4864*6a54128fSAndroid Build Coastguard Worker" 4865*6a54128fSAndroid Build Coastguard Worker 4866*6a54128fSAndroid Build Coastguard Worker if test -s "$nlist"I; then 4867*6a54128fSAndroid Build Coastguard Worker echo >> "$output_objdir/$my_dlsyms" "\ 4868*6a54128fSAndroid Build Coastguard Workerstatic void lt_syminit(void) 4869*6a54128fSAndroid Build Coastguard Worker{ 4870*6a54128fSAndroid Build Coastguard Worker LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; 4871*6a54128fSAndroid Build Coastguard Worker for (; symbol->name; ++symbol) 4872*6a54128fSAndroid Build Coastguard Worker {" 4873*6a54128fSAndroid Build Coastguard Worker $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" 4874*6a54128fSAndroid Build Coastguard Worker echo >> "$output_objdir/$my_dlsyms" "\ 4875*6a54128fSAndroid Build Coastguard Worker } 4876*6a54128fSAndroid Build Coastguard Worker}" 4877*6a54128fSAndroid Build Coastguard Worker fi 4878*6a54128fSAndroid Build Coastguard Worker echo >> "$output_objdir/$my_dlsyms" "\ 4879*6a54128fSAndroid Build Coastguard WorkerLT_DLSYM_CONST lt_dlsymlist 4880*6a54128fSAndroid Build Coastguard Workerlt_${my_prefix}_LTX_preloaded_symbols[] = 4881*6a54128fSAndroid Build Coastguard Worker{ {\"$my_originator\", (void *) 0}," 4882*6a54128fSAndroid Build Coastguard Worker 4883*6a54128fSAndroid Build Coastguard Worker if test -s "$nlist"I; then 4884*6a54128fSAndroid Build Coastguard Worker echo >> "$output_objdir/$my_dlsyms" "\ 4885*6a54128fSAndroid Build Coastguard Worker {\"@INIT@\", (void *) <_syminit}," 4886*6a54128fSAndroid Build Coastguard Worker fi 4887*6a54128fSAndroid Build Coastguard Worker 4888*6a54128fSAndroid Build Coastguard Worker case $need_lib_prefix in 4889*6a54128fSAndroid Build Coastguard Worker no) 4890*6a54128fSAndroid Build Coastguard Worker eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" 4891*6a54128fSAndroid Build Coastguard Worker ;; 4892*6a54128fSAndroid Build Coastguard Worker *) 4893*6a54128fSAndroid Build Coastguard Worker eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" 4894*6a54128fSAndroid Build Coastguard Worker ;; 4895*6a54128fSAndroid Build Coastguard Worker esac 4896*6a54128fSAndroid Build Coastguard Worker echo >> "$output_objdir/$my_dlsyms" "\ 4897*6a54128fSAndroid Build Coastguard Worker {0, (void *) 0} 4898*6a54128fSAndroid Build Coastguard Worker}; 4899*6a54128fSAndroid Build Coastguard Worker 4900*6a54128fSAndroid Build Coastguard Worker/* This works around a problem in FreeBSD linker */ 4901*6a54128fSAndroid Build Coastguard Worker#ifdef FREEBSD_WORKAROUND 4902*6a54128fSAndroid Build Coastguard Workerstatic const void *lt_preloaded_setup() { 4903*6a54128fSAndroid Build Coastguard Worker return lt_${my_prefix}_LTX_preloaded_symbols; 4904*6a54128fSAndroid Build Coastguard Worker} 4905*6a54128fSAndroid Build Coastguard Worker#endif 4906*6a54128fSAndroid Build Coastguard Worker 4907*6a54128fSAndroid Build Coastguard Worker#ifdef __cplusplus 4908*6a54128fSAndroid Build Coastguard Worker} 4909*6a54128fSAndroid Build Coastguard Worker#endif\ 4910*6a54128fSAndroid Build Coastguard Worker" 4911*6a54128fSAndroid Build Coastguard Worker } # !$opt_dry_run 4912*6a54128fSAndroid Build Coastguard Worker 4913*6a54128fSAndroid Build Coastguard Worker pic_flag_for_symtable= 4914*6a54128fSAndroid Build Coastguard Worker case "$compile_command " in 4915*6a54128fSAndroid Build Coastguard Worker *" -static "*) ;; 4916*6a54128fSAndroid Build Coastguard Worker *) 4917*6a54128fSAndroid Build Coastguard Worker case $host in 4918*6a54128fSAndroid Build Coastguard Worker # compiling the symbol table file with pic_flag works around 4919*6a54128fSAndroid Build Coastguard Worker # a FreeBSD bug that causes programs to crash when -lm is 4920*6a54128fSAndroid Build Coastguard Worker # linked before any other PIC object. But we must not use 4921*6a54128fSAndroid Build Coastguard Worker # pic_flag when linking with -static. The problem exists in 4922*6a54128fSAndroid Build Coastguard Worker # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 4923*6a54128fSAndroid Build Coastguard Worker *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 4924*6a54128fSAndroid Build Coastguard Worker pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; 4925*6a54128fSAndroid Build Coastguard Worker *-*-hpux*) 4926*6a54128fSAndroid Build Coastguard Worker pic_flag_for_symtable=" $pic_flag" ;; 4927*6a54128fSAndroid Build Coastguard Worker *) 4928*6a54128fSAndroid Build Coastguard Worker $my_pic_p && pic_flag_for_symtable=" $pic_flag" 4929*6a54128fSAndroid Build Coastguard Worker ;; 4930*6a54128fSAndroid Build Coastguard Worker esac 4931*6a54128fSAndroid Build Coastguard Worker ;; 4932*6a54128fSAndroid Build Coastguard Worker esac 4933*6a54128fSAndroid Build Coastguard Worker symtab_cflags= 4934*6a54128fSAndroid Build Coastguard Worker for arg in $LTCFLAGS; do 4935*6a54128fSAndroid Build Coastguard Worker case $arg in 4936*6a54128fSAndroid Build Coastguard Worker -pie | -fpie | -fPIE) ;; 4937*6a54128fSAndroid Build Coastguard Worker *) func_append symtab_cflags " $arg" ;; 4938*6a54128fSAndroid Build Coastguard Worker esac 4939*6a54128fSAndroid Build Coastguard Worker done 4940*6a54128fSAndroid Build Coastguard Worker 4941*6a54128fSAndroid Build Coastguard Worker # Now compile the dynamic symbol file. 4942*6a54128fSAndroid Build Coastguard Worker func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' 4943*6a54128fSAndroid Build Coastguard Worker 4944*6a54128fSAndroid Build Coastguard Worker # Clean up the generated files. 4945*6a54128fSAndroid Build Coastguard Worker func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' 4946*6a54128fSAndroid Build Coastguard Worker 4947*6a54128fSAndroid Build Coastguard Worker # Transform the symbol file into the correct name. 4948*6a54128fSAndroid Build Coastguard Worker symfileobj=$output_objdir/${my_outputname}S.$objext 4949*6a54128fSAndroid Build Coastguard Worker case $host in 4950*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw* | *cegcc* ) 4951*6a54128fSAndroid Build Coastguard Worker if test -f "$output_objdir/$my_outputname.def"; then 4952*6a54128fSAndroid Build Coastguard Worker compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 4953*6a54128fSAndroid Build Coastguard Worker finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` 4954*6a54128fSAndroid Build Coastguard Worker else 4955*6a54128fSAndroid Build Coastguard Worker compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 4956*6a54128fSAndroid Build Coastguard Worker finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 4957*6a54128fSAndroid Build Coastguard Worker fi 4958*6a54128fSAndroid Build Coastguard Worker ;; 4959*6a54128fSAndroid Build Coastguard Worker *) 4960*6a54128fSAndroid Build Coastguard Worker compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` 4961*6a54128fSAndroid Build Coastguard Worker finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` 4962*6a54128fSAndroid Build Coastguard Worker ;; 4963*6a54128fSAndroid Build Coastguard Worker esac 4964*6a54128fSAndroid Build Coastguard Worker ;; 4965*6a54128fSAndroid Build Coastguard Worker *) 4966*6a54128fSAndroid Build Coastguard Worker func_fatal_error "unknown suffix for '$my_dlsyms'" 4967*6a54128fSAndroid Build Coastguard Worker ;; 4968*6a54128fSAndroid Build Coastguard Worker esac 4969*6a54128fSAndroid Build Coastguard Worker else 4970*6a54128fSAndroid Build Coastguard Worker # We keep going just in case the user didn't refer to 4971*6a54128fSAndroid Build Coastguard Worker # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 4972*6a54128fSAndroid Build Coastguard Worker # really was required. 4973*6a54128fSAndroid Build Coastguard Worker 4974*6a54128fSAndroid Build Coastguard Worker # Nullify the symbol file. 4975*6a54128fSAndroid Build Coastguard Worker compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` 4976*6a54128fSAndroid Build Coastguard Worker finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` 4977*6a54128fSAndroid Build Coastguard Worker fi 4978*6a54128fSAndroid Build Coastguard Worker} 4979*6a54128fSAndroid Build Coastguard Worker 4980*6a54128fSAndroid Build Coastguard Worker# func_cygming_gnu_implib_p ARG 4981*6a54128fSAndroid Build Coastguard Worker# This predicate returns with zero status (TRUE) if 4982*6a54128fSAndroid Build Coastguard Worker# ARG is a GNU/binutils-style import library. Returns 4983*6a54128fSAndroid Build Coastguard Worker# with nonzero status (FALSE) otherwise. 4984*6a54128fSAndroid Build Coastguard Workerfunc_cygming_gnu_implib_p () 4985*6a54128fSAndroid Build Coastguard Worker{ 4986*6a54128fSAndroid Build Coastguard Worker $debug_cmd 4987*6a54128fSAndroid Build Coastguard Worker 4988*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$1" func_convert_file_msys_to_w32 4989*6a54128fSAndroid Build Coastguard Worker 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)$'` 4990*6a54128fSAndroid Build Coastguard Worker test -n "$func_cygming_gnu_implib_tmp" 4991*6a54128fSAndroid Build Coastguard Worker} 4992*6a54128fSAndroid Build Coastguard Worker 4993*6a54128fSAndroid Build Coastguard Worker# func_cygming_ms_implib_p ARG 4994*6a54128fSAndroid Build Coastguard Worker# This predicate returns with zero status (TRUE) if 4995*6a54128fSAndroid Build Coastguard Worker# ARG is an MS-style import library. Returns 4996*6a54128fSAndroid Build Coastguard Worker# with nonzero status (FALSE) otherwise. 4997*6a54128fSAndroid Build Coastguard Workerfunc_cygming_ms_implib_p () 4998*6a54128fSAndroid Build Coastguard Worker{ 4999*6a54128fSAndroid Build Coastguard Worker $debug_cmd 5000*6a54128fSAndroid Build Coastguard Worker 5001*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$1" func_convert_file_msys_to_w32 5002*6a54128fSAndroid Build Coastguard Worker func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` 5003*6a54128fSAndroid Build Coastguard Worker test -n "$func_cygming_ms_implib_tmp" 5004*6a54128fSAndroid Build Coastguard Worker} 5005*6a54128fSAndroid Build Coastguard Worker 5006*6a54128fSAndroid Build Coastguard Worker# func_win32_libid arg 5007*6a54128fSAndroid Build Coastguard Worker# return the library type of file 'arg' 5008*6a54128fSAndroid Build Coastguard Worker# 5009*6a54128fSAndroid Build Coastguard Worker# Need a lot of goo to handle *both* DLLs and import libs 5010*6a54128fSAndroid Build Coastguard Worker# Has to be a shell function in order to 'eat' the argument 5011*6a54128fSAndroid Build Coastguard Worker# that is supplied when $file_magic_command is called. 5012*6a54128fSAndroid Build Coastguard Worker# Despite the name, also deal with 64 bit binaries. 5013*6a54128fSAndroid Build Coastguard Workerfunc_win32_libid () 5014*6a54128fSAndroid Build Coastguard Worker{ 5015*6a54128fSAndroid Build Coastguard Worker $debug_cmd 5016*6a54128fSAndroid Build Coastguard Worker 5017*6a54128fSAndroid Build Coastguard Worker win32_libid_type=unknown 5018*6a54128fSAndroid Build Coastguard Worker win32_fileres=`file -L $1 2>/dev/null` 5019*6a54128fSAndroid Build Coastguard Worker case $win32_fileres in 5020*6a54128fSAndroid Build Coastguard Worker *ar\ archive\ import\ library*) # definitely import 5021*6a54128fSAndroid Build Coastguard Worker win32_libid_type="x86 archive import" 5022*6a54128fSAndroid Build Coastguard Worker ;; 5023*6a54128fSAndroid Build Coastguard Worker *ar\ archive*) # could be an import, or static 5024*6a54128fSAndroid Build Coastguard Worker # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. 5025*6a54128fSAndroid Build Coastguard Worker if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 5026*6a54128fSAndroid Build Coastguard Worker $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then 5027*6a54128fSAndroid Build Coastguard Worker case $nm_interface in 5028*6a54128fSAndroid Build Coastguard Worker "MS dumpbin") 5029*6a54128fSAndroid Build Coastguard Worker if func_cygming_ms_implib_p "$1" || 5030*6a54128fSAndroid Build Coastguard Worker func_cygming_gnu_implib_p "$1" 5031*6a54128fSAndroid Build Coastguard Worker then 5032*6a54128fSAndroid Build Coastguard Worker win32_nmres=import 5033*6a54128fSAndroid Build Coastguard Worker else 5034*6a54128fSAndroid Build Coastguard Worker win32_nmres= 5035*6a54128fSAndroid Build Coastguard Worker fi 5036*6a54128fSAndroid Build Coastguard Worker ;; 5037*6a54128fSAndroid Build Coastguard Worker *) 5038*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$1" func_convert_file_msys_to_w32 5039*6a54128fSAndroid Build Coastguard Worker win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | 5040*6a54128fSAndroid Build Coastguard Worker $SED -n -e ' 5041*6a54128fSAndroid Build Coastguard Worker 1,100{ 5042*6a54128fSAndroid Build Coastguard Worker / I /{ 5043*6a54128fSAndroid Build Coastguard Worker s|.*|import| 5044*6a54128fSAndroid Build Coastguard Worker p 5045*6a54128fSAndroid Build Coastguard Worker q 5046*6a54128fSAndroid Build Coastguard Worker } 5047*6a54128fSAndroid Build Coastguard Worker }'` 5048*6a54128fSAndroid Build Coastguard Worker ;; 5049*6a54128fSAndroid Build Coastguard Worker esac 5050*6a54128fSAndroid Build Coastguard Worker case $win32_nmres in 5051*6a54128fSAndroid Build Coastguard Worker import*) win32_libid_type="x86 archive import";; 5052*6a54128fSAndroid Build Coastguard Worker *) win32_libid_type="x86 archive static";; 5053*6a54128fSAndroid Build Coastguard Worker esac 5054*6a54128fSAndroid Build Coastguard Worker fi 5055*6a54128fSAndroid Build Coastguard Worker ;; 5056*6a54128fSAndroid Build Coastguard Worker *DLL*) 5057*6a54128fSAndroid Build Coastguard Worker win32_libid_type="x86 DLL" 5058*6a54128fSAndroid Build Coastguard Worker ;; 5059*6a54128fSAndroid Build Coastguard Worker *executable*) # but shell scripts are "executable" too... 5060*6a54128fSAndroid Build Coastguard Worker case $win32_fileres in 5061*6a54128fSAndroid Build Coastguard Worker *MS\ Windows\ PE\ Intel*) 5062*6a54128fSAndroid Build Coastguard Worker win32_libid_type="x86 DLL" 5063*6a54128fSAndroid Build Coastguard Worker ;; 5064*6a54128fSAndroid Build Coastguard Worker esac 5065*6a54128fSAndroid Build Coastguard Worker ;; 5066*6a54128fSAndroid Build Coastguard Worker esac 5067*6a54128fSAndroid Build Coastguard Worker $ECHO "$win32_libid_type" 5068*6a54128fSAndroid Build Coastguard Worker} 5069*6a54128fSAndroid Build Coastguard Worker 5070*6a54128fSAndroid Build Coastguard Worker# func_cygming_dll_for_implib ARG 5071*6a54128fSAndroid Build Coastguard Worker# 5072*6a54128fSAndroid Build Coastguard Worker# Platform-specific function to extract the 5073*6a54128fSAndroid Build Coastguard Worker# name of the DLL associated with the specified 5074*6a54128fSAndroid Build Coastguard Worker# import library ARG. 5075*6a54128fSAndroid Build Coastguard Worker# Invoked by eval'ing the libtool variable 5076*6a54128fSAndroid Build Coastguard Worker# $sharedlib_from_linklib_cmd 5077*6a54128fSAndroid Build Coastguard Worker# Result is available in the variable 5078*6a54128fSAndroid Build Coastguard Worker# $sharedlib_from_linklib_result 5079*6a54128fSAndroid Build Coastguard Workerfunc_cygming_dll_for_implib () 5080*6a54128fSAndroid Build Coastguard Worker{ 5081*6a54128fSAndroid Build Coastguard Worker $debug_cmd 5082*6a54128fSAndroid Build Coastguard Worker 5083*6a54128fSAndroid Build Coastguard Worker sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` 5084*6a54128fSAndroid Build Coastguard Worker} 5085*6a54128fSAndroid Build Coastguard Worker 5086*6a54128fSAndroid Build Coastguard Worker# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs 5087*6a54128fSAndroid Build Coastguard Worker# 5088*6a54128fSAndroid Build Coastguard Worker# The is the core of a fallback implementation of a 5089*6a54128fSAndroid Build Coastguard Worker# platform-specific function to extract the name of the 5090*6a54128fSAndroid Build Coastguard Worker# DLL associated with the specified import library LIBNAME. 5091*6a54128fSAndroid Build Coastguard Worker# 5092*6a54128fSAndroid Build Coastguard Worker# SECTION_NAME is either .idata$6 or .idata$7, depending 5093*6a54128fSAndroid Build Coastguard Worker# on the platform and compiler that created the implib. 5094*6a54128fSAndroid Build Coastguard Worker# 5095*6a54128fSAndroid Build Coastguard Worker# Echos the name of the DLL associated with the 5096*6a54128fSAndroid Build Coastguard Worker# specified import library. 5097*6a54128fSAndroid Build Coastguard Workerfunc_cygming_dll_for_implib_fallback_core () 5098*6a54128fSAndroid Build Coastguard Worker{ 5099*6a54128fSAndroid Build Coastguard Worker $debug_cmd 5100*6a54128fSAndroid Build Coastguard Worker 5101*6a54128fSAndroid Build Coastguard Worker match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` 5102*6a54128fSAndroid Build Coastguard Worker $OBJDUMP -s --section "$1" "$2" 2>/dev/null | 5103*6a54128fSAndroid Build Coastguard Worker $SED '/^Contents of section '"$match_literal"':/{ 5104*6a54128fSAndroid Build Coastguard Worker # Place marker at beginning of archive member dllname section 5105*6a54128fSAndroid Build Coastguard Worker s/.*/====MARK====/ 5106*6a54128fSAndroid Build Coastguard Worker p 5107*6a54128fSAndroid Build Coastguard Worker d 5108*6a54128fSAndroid Build Coastguard Worker } 5109*6a54128fSAndroid Build Coastguard Worker # These lines can sometimes be longer than 43 characters, but 5110*6a54128fSAndroid Build Coastguard Worker # are always uninteresting 5111*6a54128fSAndroid Build Coastguard Worker /:[ ]*file format pe[i]\{,1\}-/d 5112*6a54128fSAndroid Build Coastguard Worker /^In archive [^:]*:/d 5113*6a54128fSAndroid Build Coastguard Worker # Ensure marker is printed 5114*6a54128fSAndroid Build Coastguard Worker /^====MARK====/p 5115*6a54128fSAndroid Build Coastguard Worker # Remove all lines with less than 43 characters 5116*6a54128fSAndroid Build Coastguard Worker /^.\{43\}/!d 5117*6a54128fSAndroid Build Coastguard Worker # From remaining lines, remove first 43 characters 5118*6a54128fSAndroid Build Coastguard Worker s/^.\{43\}//' | 5119*6a54128fSAndroid Build Coastguard Worker $SED -n ' 5120*6a54128fSAndroid Build Coastguard Worker # Join marker and all lines until next marker into a single line 5121*6a54128fSAndroid Build Coastguard Worker /^====MARK====/ b para 5122*6a54128fSAndroid Build Coastguard Worker H 5123*6a54128fSAndroid Build Coastguard Worker $ b para 5124*6a54128fSAndroid Build Coastguard Worker b 5125*6a54128fSAndroid Build Coastguard Worker :para 5126*6a54128fSAndroid Build Coastguard Worker x 5127*6a54128fSAndroid Build Coastguard Worker s/\n//g 5128*6a54128fSAndroid Build Coastguard Worker # Remove the marker 5129*6a54128fSAndroid Build Coastguard Worker s/^====MARK====// 5130*6a54128fSAndroid Build Coastguard Worker # Remove trailing dots and whitespace 5131*6a54128fSAndroid Build Coastguard Worker s/[\. \t]*$// 5132*6a54128fSAndroid Build Coastguard Worker # Print 5133*6a54128fSAndroid Build Coastguard Worker /./p' | 5134*6a54128fSAndroid Build Coastguard Worker # we now have a list, one entry per line, of the stringified 5135*6a54128fSAndroid Build Coastguard Worker # contents of the appropriate section of all members of the 5136*6a54128fSAndroid Build Coastguard Worker # archive that possess that section. Heuristic: eliminate 5137*6a54128fSAndroid Build Coastguard Worker # all those that have a first or second character that is 5138*6a54128fSAndroid Build Coastguard Worker # a '.' (that is, objdump's representation of an unprintable 5139*6a54128fSAndroid Build Coastguard Worker # character.) This should work for all archives with less than 5140*6a54128fSAndroid Build Coastguard Worker # 0x302f exports -- but will fail for DLLs whose name actually 5141*6a54128fSAndroid Build Coastguard Worker # begins with a literal '.' or a single character followed by 5142*6a54128fSAndroid Build Coastguard Worker # a '.'. 5143*6a54128fSAndroid Build Coastguard Worker # 5144*6a54128fSAndroid Build Coastguard Worker # Of those that remain, print the first one. 5145*6a54128fSAndroid Build Coastguard Worker $SED -e '/^\./d;/^.\./d;q' 5146*6a54128fSAndroid Build Coastguard Worker} 5147*6a54128fSAndroid Build Coastguard Worker 5148*6a54128fSAndroid Build Coastguard Worker# func_cygming_dll_for_implib_fallback ARG 5149*6a54128fSAndroid Build Coastguard Worker# Platform-specific function to extract the 5150*6a54128fSAndroid Build Coastguard Worker# name of the DLL associated with the specified 5151*6a54128fSAndroid Build Coastguard Worker# import library ARG. 5152*6a54128fSAndroid Build Coastguard Worker# 5153*6a54128fSAndroid Build Coastguard Worker# This fallback implementation is for use when $DLLTOOL 5154*6a54128fSAndroid Build Coastguard Worker# does not support the --identify-strict option. 5155*6a54128fSAndroid Build Coastguard Worker# Invoked by eval'ing the libtool variable 5156*6a54128fSAndroid Build Coastguard Worker# $sharedlib_from_linklib_cmd 5157*6a54128fSAndroid Build Coastguard Worker# Result is available in the variable 5158*6a54128fSAndroid Build Coastguard Worker# $sharedlib_from_linklib_result 5159*6a54128fSAndroid Build Coastguard Workerfunc_cygming_dll_for_implib_fallback () 5160*6a54128fSAndroid Build Coastguard Worker{ 5161*6a54128fSAndroid Build Coastguard Worker $debug_cmd 5162*6a54128fSAndroid Build Coastguard Worker 5163*6a54128fSAndroid Build Coastguard Worker if func_cygming_gnu_implib_p "$1"; then 5164*6a54128fSAndroid Build Coastguard Worker # binutils import library 5165*6a54128fSAndroid Build Coastguard Worker sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` 5166*6a54128fSAndroid Build Coastguard Worker elif func_cygming_ms_implib_p "$1"; then 5167*6a54128fSAndroid Build Coastguard Worker # ms-generated import library 5168*6a54128fSAndroid Build Coastguard Worker sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` 5169*6a54128fSAndroid Build Coastguard Worker else 5170*6a54128fSAndroid Build Coastguard Worker # unknown 5171*6a54128fSAndroid Build Coastguard Worker sharedlib_from_linklib_result= 5172*6a54128fSAndroid Build Coastguard Worker fi 5173*6a54128fSAndroid Build Coastguard Worker} 5174*6a54128fSAndroid Build Coastguard Worker 5175*6a54128fSAndroid Build Coastguard Worker 5176*6a54128fSAndroid Build Coastguard Worker# func_extract_an_archive dir oldlib 5177*6a54128fSAndroid Build Coastguard Workerfunc_extract_an_archive () 5178*6a54128fSAndroid Build Coastguard Worker{ 5179*6a54128fSAndroid Build Coastguard Worker $debug_cmd 5180*6a54128fSAndroid Build Coastguard Worker 5181*6a54128fSAndroid Build Coastguard Worker f_ex_an_ar_dir=$1; shift 5182*6a54128fSAndroid Build Coastguard Worker f_ex_an_ar_oldlib=$1 5183*6a54128fSAndroid Build Coastguard Worker if test yes = "$lock_old_archive_extraction"; then 5184*6a54128fSAndroid Build Coastguard Worker lockfile=$f_ex_an_ar_oldlib.lock 5185*6a54128fSAndroid Build Coastguard Worker until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do 5186*6a54128fSAndroid Build Coastguard Worker func_echo "Waiting for $lockfile to be removed" 5187*6a54128fSAndroid Build Coastguard Worker sleep 2 5188*6a54128fSAndroid Build Coastguard Worker done 5189*6a54128fSAndroid Build Coastguard Worker fi 5190*6a54128fSAndroid Build Coastguard Worker func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 5191*6a54128fSAndroid Build Coastguard Worker 'stat=$?; rm -f "$lockfile"; exit $stat' 5192*6a54128fSAndroid Build Coastguard Worker if test yes = "$lock_old_archive_extraction"; then 5193*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || rm -f "$lockfile" 5194*6a54128fSAndroid Build Coastguard Worker fi 5195*6a54128fSAndroid Build Coastguard Worker if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 5196*6a54128fSAndroid Build Coastguard Worker : 5197*6a54128fSAndroid Build Coastguard Worker else 5198*6a54128fSAndroid Build Coastguard Worker func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 5199*6a54128fSAndroid Build Coastguard Worker fi 5200*6a54128fSAndroid Build Coastguard Worker} 5201*6a54128fSAndroid Build Coastguard Worker 5202*6a54128fSAndroid Build Coastguard Worker 5203*6a54128fSAndroid Build Coastguard Worker# func_extract_archives gentop oldlib ... 5204*6a54128fSAndroid Build Coastguard Workerfunc_extract_archives () 5205*6a54128fSAndroid Build Coastguard Worker{ 5206*6a54128fSAndroid Build Coastguard Worker $debug_cmd 5207*6a54128fSAndroid Build Coastguard Worker 5208*6a54128fSAndroid Build Coastguard Worker my_gentop=$1; shift 5209*6a54128fSAndroid Build Coastguard Worker my_oldlibs=${1+"$@"} 5210*6a54128fSAndroid Build Coastguard Worker my_oldobjs= 5211*6a54128fSAndroid Build Coastguard Worker my_xlib= 5212*6a54128fSAndroid Build Coastguard Worker my_xabs= 5213*6a54128fSAndroid Build Coastguard Worker my_xdir= 5214*6a54128fSAndroid Build Coastguard Worker 5215*6a54128fSAndroid Build Coastguard Worker for my_xlib in $my_oldlibs; do 5216*6a54128fSAndroid Build Coastguard Worker # Extract the objects. 5217*6a54128fSAndroid Build Coastguard Worker case $my_xlib in 5218*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; 5219*6a54128fSAndroid Build Coastguard Worker *) my_xabs=`pwd`"/$my_xlib" ;; 5220*6a54128fSAndroid Build Coastguard Worker esac 5221*6a54128fSAndroid Build Coastguard Worker func_basename "$my_xlib" 5222*6a54128fSAndroid Build Coastguard Worker my_xlib=$func_basename_result 5223*6a54128fSAndroid Build Coastguard Worker my_xlib_u=$my_xlib 5224*6a54128fSAndroid Build Coastguard Worker while :; do 5225*6a54128fSAndroid Build Coastguard Worker case " $extracted_archives " in 5226*6a54128fSAndroid Build Coastguard Worker *" $my_xlib_u "*) 5227*6a54128fSAndroid Build Coastguard Worker func_arith $extracted_serial + 1 5228*6a54128fSAndroid Build Coastguard Worker extracted_serial=$func_arith_result 5229*6a54128fSAndroid Build Coastguard Worker my_xlib_u=lt$extracted_serial-$my_xlib ;; 5230*6a54128fSAndroid Build Coastguard Worker *) break ;; 5231*6a54128fSAndroid Build Coastguard Worker esac 5232*6a54128fSAndroid Build Coastguard Worker done 5233*6a54128fSAndroid Build Coastguard Worker extracted_archives="$extracted_archives $my_xlib_u" 5234*6a54128fSAndroid Build Coastguard Worker my_xdir=$my_gentop/$my_xlib_u 5235*6a54128fSAndroid Build Coastguard Worker 5236*6a54128fSAndroid Build Coastguard Worker func_mkdir_p "$my_xdir" 5237*6a54128fSAndroid Build Coastguard Worker 5238*6a54128fSAndroid Build Coastguard Worker case $host in 5239*6a54128fSAndroid Build Coastguard Worker *-darwin*) 5240*6a54128fSAndroid Build Coastguard Worker func_verbose "Extracting $my_xabs" 5241*6a54128fSAndroid Build Coastguard Worker # Do not bother doing anything if just a dry run 5242*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 5243*6a54128fSAndroid Build Coastguard Worker darwin_orig_dir=`pwd` 5244*6a54128fSAndroid Build Coastguard Worker cd $my_xdir || exit $? 5245*6a54128fSAndroid Build Coastguard Worker darwin_archive=$my_xabs 5246*6a54128fSAndroid Build Coastguard Worker darwin_curdir=`pwd` 5247*6a54128fSAndroid Build Coastguard Worker func_basename "$darwin_archive" 5248*6a54128fSAndroid Build Coastguard Worker darwin_base_archive=$func_basename_result 5249*6a54128fSAndroid Build Coastguard Worker darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` 5250*6a54128fSAndroid Build Coastguard Worker if test -n "$darwin_arches"; then 5251*6a54128fSAndroid Build Coastguard Worker darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` 5252*6a54128fSAndroid Build Coastguard Worker darwin_arch= 5253*6a54128fSAndroid Build Coastguard Worker func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" 5254*6a54128fSAndroid Build Coastguard Worker for darwin_arch in $darwin_arches; do 5255*6a54128fSAndroid Build Coastguard Worker func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" 5256*6a54128fSAndroid Build Coastguard Worker $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" 5257*6a54128fSAndroid Build Coastguard Worker cd "unfat-$$/$darwin_base_archive-$darwin_arch" 5258*6a54128fSAndroid Build Coastguard Worker func_extract_an_archive "`pwd`" "$darwin_base_archive" 5259*6a54128fSAndroid Build Coastguard Worker cd "$darwin_curdir" 5260*6a54128fSAndroid Build Coastguard Worker $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" 5261*6a54128fSAndroid Build Coastguard Worker done # $darwin_arches 5262*6a54128fSAndroid Build Coastguard Worker ## Okay now we've a bunch of thin objects, gotta fatten them up :) 5263*6a54128fSAndroid Build Coastguard Worker darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` 5264*6a54128fSAndroid Build Coastguard Worker darwin_file= 5265*6a54128fSAndroid Build Coastguard Worker darwin_files= 5266*6a54128fSAndroid Build Coastguard Worker for darwin_file in $darwin_filelist; do 5267*6a54128fSAndroid Build Coastguard Worker darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` 5268*6a54128fSAndroid Build Coastguard Worker $LIPO -create -output "$darwin_file" $darwin_files 5269*6a54128fSAndroid Build Coastguard Worker done # $darwin_filelist 5270*6a54128fSAndroid Build Coastguard Worker $RM -rf unfat-$$ 5271*6a54128fSAndroid Build Coastguard Worker cd "$darwin_orig_dir" 5272*6a54128fSAndroid Build Coastguard Worker else 5273*6a54128fSAndroid Build Coastguard Worker cd $darwin_orig_dir 5274*6a54128fSAndroid Build Coastguard Worker func_extract_an_archive "$my_xdir" "$my_xabs" 5275*6a54128fSAndroid Build Coastguard Worker fi # $darwin_arches 5276*6a54128fSAndroid Build Coastguard Worker } # !$opt_dry_run 5277*6a54128fSAndroid Build Coastguard Worker ;; 5278*6a54128fSAndroid Build Coastguard Worker *) 5279*6a54128fSAndroid Build Coastguard Worker func_extract_an_archive "$my_xdir" "$my_xabs" 5280*6a54128fSAndroid Build Coastguard Worker ;; 5281*6a54128fSAndroid Build Coastguard Worker esac 5282*6a54128fSAndroid Build Coastguard Worker my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` 5283*6a54128fSAndroid Build Coastguard Worker done 5284*6a54128fSAndroid Build Coastguard Worker 5285*6a54128fSAndroid Build Coastguard Worker func_extract_archives_result=$my_oldobjs 5286*6a54128fSAndroid Build Coastguard Worker} 5287*6a54128fSAndroid Build Coastguard Worker 5288*6a54128fSAndroid Build Coastguard Worker 5289*6a54128fSAndroid Build Coastguard Worker# func_emit_wrapper [arg=no] 5290*6a54128fSAndroid Build Coastguard Worker# 5291*6a54128fSAndroid Build Coastguard Worker# Emit a libtool wrapper script on stdout. 5292*6a54128fSAndroid Build Coastguard Worker# Don't directly open a file because we may want to 5293*6a54128fSAndroid Build Coastguard Worker# incorporate the script contents within a cygwin/mingw 5294*6a54128fSAndroid Build Coastguard Worker# wrapper executable. Must ONLY be called from within 5295*6a54128fSAndroid Build Coastguard Worker# func_mode_link because it depends on a number of variables 5296*6a54128fSAndroid Build Coastguard Worker# set therein. 5297*6a54128fSAndroid Build Coastguard Worker# 5298*6a54128fSAndroid Build Coastguard Worker# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR 5299*6a54128fSAndroid Build Coastguard Worker# variable will take. If 'yes', then the emitted script 5300*6a54128fSAndroid Build Coastguard Worker# will assume that the directory where it is stored is 5301*6a54128fSAndroid Build Coastguard Worker# the $objdir directory. This is a cygwin/mingw-specific 5302*6a54128fSAndroid Build Coastguard Worker# behavior. 5303*6a54128fSAndroid Build Coastguard Workerfunc_emit_wrapper () 5304*6a54128fSAndroid Build Coastguard Worker{ 5305*6a54128fSAndroid Build Coastguard Worker func_emit_wrapper_arg1=${1-no} 5306*6a54128fSAndroid Build Coastguard Worker 5307*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5308*6a54128fSAndroid Build Coastguard Worker#! $SHELL 5309*6a54128fSAndroid Build Coastguard Worker 5310*6a54128fSAndroid Build Coastguard Worker# $output - temporary wrapper script for $objdir/$outputname 5311*6a54128fSAndroid Build Coastguard Worker# Generated by $PROGRAM (GNU $PACKAGE) $VERSION 5312*6a54128fSAndroid Build Coastguard Worker# 5313*6a54128fSAndroid Build Coastguard Worker# The $output program cannot be directly executed until all the libtool 5314*6a54128fSAndroid Build Coastguard Worker# libraries that it depends on are installed. 5315*6a54128fSAndroid Build Coastguard Worker# 5316*6a54128fSAndroid Build Coastguard Worker# This wrapper script should never be moved out of the build directory. 5317*6a54128fSAndroid Build Coastguard Worker# If it is, it will not operate correctly. 5318*6a54128fSAndroid Build Coastguard Worker 5319*6a54128fSAndroid Build Coastguard Worker# Sed substitution that helps us do robust quoting. It backslashifies 5320*6a54128fSAndroid Build Coastguard Worker# metacharacters that are still active within double-quoted strings. 5321*6a54128fSAndroid Build Coastguard Workersed_quote_subst='$sed_quote_subst' 5322*6a54128fSAndroid Build Coastguard Worker 5323*6a54128fSAndroid Build Coastguard Worker# Be Bourne compatible 5324*6a54128fSAndroid Build Coastguard Workerif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 5325*6a54128fSAndroid Build Coastguard Worker emulate sh 5326*6a54128fSAndroid Build Coastguard Worker NULLCMD=: 5327*6a54128fSAndroid Build Coastguard Worker # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 5328*6a54128fSAndroid Build Coastguard Worker # is contrary to our usage. Disable this feature. 5329*6a54128fSAndroid Build Coastguard Worker alias -g '\${1+\"\$@\"}'='\"\$@\"' 5330*6a54128fSAndroid Build Coastguard Worker setopt NO_GLOB_SUBST 5331*6a54128fSAndroid Build Coastguard Workerelse 5332*6a54128fSAndroid Build Coastguard Worker case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 5333*6a54128fSAndroid Build Coastguard Workerfi 5334*6a54128fSAndroid Build Coastguard WorkerBIN_SH=xpg4; export BIN_SH # for Tru64 5335*6a54128fSAndroid Build Coastguard WorkerDUALCASE=1; export DUALCASE # for MKS sh 5336*6a54128fSAndroid Build Coastguard Worker 5337*6a54128fSAndroid Build Coastguard Worker# The HP-UX ksh and POSIX shell print the target directory to stdout 5338*6a54128fSAndroid Build Coastguard Worker# if CDPATH is set. 5339*6a54128fSAndroid Build Coastguard Worker(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5340*6a54128fSAndroid Build Coastguard Worker 5341*6a54128fSAndroid Build Coastguard Workerrelink_command=\"$relink_command\" 5342*6a54128fSAndroid Build Coastguard Worker 5343*6a54128fSAndroid Build Coastguard Worker# This environment variable determines our operation mode. 5344*6a54128fSAndroid Build Coastguard Workerif test \"\$libtool_install_magic\" = \"$magic\"; then 5345*6a54128fSAndroid Build Coastguard Worker # install mode needs the following variables: 5346*6a54128fSAndroid Build Coastguard Worker generated_by_libtool_version='$macro_version' 5347*6a54128fSAndroid Build Coastguard Worker notinst_deplibs='$notinst_deplibs' 5348*6a54128fSAndroid Build Coastguard Workerelse 5349*6a54128fSAndroid Build Coastguard Worker # When we are sourced in execute mode, \$file and \$ECHO are already set. 5350*6a54128fSAndroid Build Coastguard Worker if test \"\$libtool_execute_magic\" != \"$magic\"; then 5351*6a54128fSAndroid Build Coastguard Worker file=\"\$0\"" 5352*6a54128fSAndroid Build Coastguard Worker 5353*6a54128fSAndroid Build Coastguard Worker qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` 5354*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5355*6a54128fSAndroid Build Coastguard Worker 5356*6a54128fSAndroid Build Coastguard Worker# A function that is used when there is no print builtin or printf. 5357*6a54128fSAndroid Build Coastguard Workerfunc_fallback_echo () 5358*6a54128fSAndroid Build Coastguard Worker{ 5359*6a54128fSAndroid Build Coastguard Worker eval 'cat <<_LTECHO_EOF 5360*6a54128fSAndroid Build Coastguard Worker\$1 5361*6a54128fSAndroid Build Coastguard Worker_LTECHO_EOF' 5362*6a54128fSAndroid Build Coastguard Worker} 5363*6a54128fSAndroid Build Coastguard Worker ECHO=\"$qECHO\" 5364*6a54128fSAndroid Build Coastguard Worker fi 5365*6a54128fSAndroid Build Coastguard Worker 5366*6a54128fSAndroid Build Coastguard Worker# Very basic option parsing. These options are (a) specific to 5367*6a54128fSAndroid Build Coastguard Worker# the libtool wrapper, (b) are identical between the wrapper 5368*6a54128fSAndroid Build Coastguard Worker# /script/ and the wrapper /executable/ that is used only on 5369*6a54128fSAndroid Build Coastguard Worker# windows platforms, and (c) all begin with the string "--lt-" 5370*6a54128fSAndroid Build Coastguard Worker# (application programs are unlikely to have options that match 5371*6a54128fSAndroid Build Coastguard Worker# this pattern). 5372*6a54128fSAndroid Build Coastguard Worker# 5373*6a54128fSAndroid Build Coastguard Worker# There are only two supported options: --lt-debug and 5374*6a54128fSAndroid Build Coastguard Worker# --lt-dump-script. There is, deliberately, no --lt-help. 5375*6a54128fSAndroid Build Coastguard Worker# 5376*6a54128fSAndroid Build Coastguard Worker# The first argument to this parsing function should be the 5377*6a54128fSAndroid Build Coastguard Worker# script's $0 value, followed by "$@". 5378*6a54128fSAndroid Build Coastguard Workerlt_option_debug= 5379*6a54128fSAndroid Build Coastguard Workerfunc_parse_lt_options () 5380*6a54128fSAndroid Build Coastguard Worker{ 5381*6a54128fSAndroid Build Coastguard Worker lt_script_arg0=\$0 5382*6a54128fSAndroid Build Coastguard Worker shift 5383*6a54128fSAndroid Build Coastguard Worker for lt_opt 5384*6a54128fSAndroid Build Coastguard Worker do 5385*6a54128fSAndroid Build Coastguard Worker case \"\$lt_opt\" in 5386*6a54128fSAndroid Build Coastguard Worker --lt-debug) lt_option_debug=1 ;; 5387*6a54128fSAndroid Build Coastguard Worker --lt-dump-script) 5388*6a54128fSAndroid Build Coastguard Worker lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` 5389*6a54128fSAndroid Build Coastguard Worker test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. 5390*6a54128fSAndroid Build Coastguard Worker lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` 5391*6a54128fSAndroid Build Coastguard Worker cat \"\$lt_dump_D/\$lt_dump_F\" 5392*6a54128fSAndroid Build Coastguard Worker exit 0 5393*6a54128fSAndroid Build Coastguard Worker ;; 5394*6a54128fSAndroid Build Coastguard Worker --lt-*) 5395*6a54128fSAndroid Build Coastguard Worker \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 5396*6a54128fSAndroid Build Coastguard Worker exit 1 5397*6a54128fSAndroid Build Coastguard Worker ;; 5398*6a54128fSAndroid Build Coastguard Worker esac 5399*6a54128fSAndroid Build Coastguard Worker done 5400*6a54128fSAndroid Build Coastguard Worker 5401*6a54128fSAndroid Build Coastguard Worker # Print the debug banner immediately: 5402*6a54128fSAndroid Build Coastguard Worker if test -n \"\$lt_option_debug\"; then 5403*6a54128fSAndroid Build Coastguard Worker echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 5404*6a54128fSAndroid Build Coastguard Worker fi 5405*6a54128fSAndroid Build Coastguard Worker} 5406*6a54128fSAndroid Build Coastguard Worker 5407*6a54128fSAndroid Build Coastguard Worker# Used when --lt-debug. Prints its arguments to stdout 5408*6a54128fSAndroid Build Coastguard Worker# (redirection is the responsibility of the caller) 5409*6a54128fSAndroid Build Coastguard Workerfunc_lt_dump_args () 5410*6a54128fSAndroid Build Coastguard Worker{ 5411*6a54128fSAndroid Build Coastguard Worker lt_dump_args_N=1; 5412*6a54128fSAndroid Build Coastguard Worker for lt_arg 5413*6a54128fSAndroid Build Coastguard Worker do 5414*6a54128fSAndroid Build Coastguard Worker \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" 5415*6a54128fSAndroid Build Coastguard Worker lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` 5416*6a54128fSAndroid Build Coastguard Worker done 5417*6a54128fSAndroid Build Coastguard Worker} 5418*6a54128fSAndroid Build Coastguard Worker 5419*6a54128fSAndroid Build Coastguard Worker# Core function for launching the target application 5420*6a54128fSAndroid Build Coastguard Workerfunc_exec_program_core () 5421*6a54128fSAndroid Build Coastguard Worker{ 5422*6a54128fSAndroid Build Coastguard Worker" 5423*6a54128fSAndroid Build Coastguard Worker case $host in 5424*6a54128fSAndroid Build Coastguard Worker # Backslashes separate directories on plain windows 5425*6a54128fSAndroid Build Coastguard Worker *-*-mingw | *-*-os2* | *-cegcc*) 5426*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5427*6a54128fSAndroid Build Coastguard Worker if test -n \"\$lt_option_debug\"; then 5428*6a54128fSAndroid Build Coastguard Worker \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 5429*6a54128fSAndroid Build Coastguard Worker func_lt_dump_args \${1+\"\$@\"} 1>&2 5430*6a54128fSAndroid Build Coastguard Worker fi 5431*6a54128fSAndroid Build Coastguard Worker exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5432*6a54128fSAndroid Build Coastguard Worker" 5433*6a54128fSAndroid Build Coastguard Worker ;; 5434*6a54128fSAndroid Build Coastguard Worker 5435*6a54128fSAndroid Build Coastguard Worker *) 5436*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5437*6a54128fSAndroid Build Coastguard Worker if test -n \"\$lt_option_debug\"; then 5438*6a54128fSAndroid Build Coastguard Worker \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 5439*6a54128fSAndroid Build Coastguard Worker func_lt_dump_args \${1+\"\$@\"} 1>&2 5440*6a54128fSAndroid Build Coastguard Worker fi 5441*6a54128fSAndroid Build Coastguard Worker exec \"\$progdir/\$program\" \${1+\"\$@\"} 5442*6a54128fSAndroid Build Coastguard Worker" 5443*6a54128fSAndroid Build Coastguard Worker ;; 5444*6a54128fSAndroid Build Coastguard Worker esac 5445*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5446*6a54128fSAndroid Build Coastguard Worker \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 5447*6a54128fSAndroid Build Coastguard Worker exit 1 5448*6a54128fSAndroid Build Coastguard Worker} 5449*6a54128fSAndroid Build Coastguard Worker 5450*6a54128fSAndroid Build Coastguard Worker# A function to encapsulate launching the target application 5451*6a54128fSAndroid Build Coastguard Worker# Strips options in the --lt-* namespace from \$@ and 5452*6a54128fSAndroid Build Coastguard Worker# launches target application with the remaining arguments. 5453*6a54128fSAndroid Build Coastguard Workerfunc_exec_program () 5454*6a54128fSAndroid Build Coastguard Worker{ 5455*6a54128fSAndroid Build Coastguard Worker case \" \$* \" in 5456*6a54128fSAndroid Build Coastguard Worker *\\ --lt-*) 5457*6a54128fSAndroid Build Coastguard Worker for lt_wr_arg 5458*6a54128fSAndroid Build Coastguard Worker do 5459*6a54128fSAndroid Build Coastguard Worker case \$lt_wr_arg in 5460*6a54128fSAndroid Build Coastguard Worker --lt-*) ;; 5461*6a54128fSAndroid Build Coastguard Worker *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; 5462*6a54128fSAndroid Build Coastguard Worker esac 5463*6a54128fSAndroid Build Coastguard Worker shift 5464*6a54128fSAndroid Build Coastguard Worker done ;; 5465*6a54128fSAndroid Build Coastguard Worker esac 5466*6a54128fSAndroid Build Coastguard Worker func_exec_program_core \${1+\"\$@\"} 5467*6a54128fSAndroid Build Coastguard Worker} 5468*6a54128fSAndroid Build Coastguard Worker 5469*6a54128fSAndroid Build Coastguard Worker # Parse options 5470*6a54128fSAndroid Build Coastguard Worker func_parse_lt_options \"\$0\" \${1+\"\$@\"} 5471*6a54128fSAndroid Build Coastguard Worker 5472*6a54128fSAndroid Build Coastguard Worker # Find the directory that this script lives in. 5473*6a54128fSAndroid Build Coastguard Worker thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` 5474*6a54128fSAndroid Build Coastguard Worker test \"x\$thisdir\" = \"x\$file\" && thisdir=. 5475*6a54128fSAndroid Build Coastguard Worker 5476*6a54128fSAndroid Build Coastguard Worker # Follow symbolic links until we get to the real thisdir. 5477*6a54128fSAndroid Build Coastguard Worker file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` 5478*6a54128fSAndroid Build Coastguard Worker while test -n \"\$file\"; do 5479*6a54128fSAndroid Build Coastguard Worker destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` 5480*6a54128fSAndroid Build Coastguard Worker 5481*6a54128fSAndroid Build Coastguard Worker # If there was a directory component, then change thisdir. 5482*6a54128fSAndroid Build Coastguard Worker if test \"x\$destdir\" != \"x\$file\"; then 5483*6a54128fSAndroid Build Coastguard Worker case \"\$destdir\" in 5484*6a54128fSAndroid Build Coastguard Worker [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5485*6a54128fSAndroid Build Coastguard Worker *) thisdir=\"\$thisdir/\$destdir\" ;; 5486*6a54128fSAndroid Build Coastguard Worker esac 5487*6a54128fSAndroid Build Coastguard Worker fi 5488*6a54128fSAndroid Build Coastguard Worker 5489*6a54128fSAndroid Build Coastguard Worker file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` 5490*6a54128fSAndroid Build Coastguard Worker file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` 5491*6a54128fSAndroid Build Coastguard Worker done 5492*6a54128fSAndroid Build Coastguard Worker 5493*6a54128fSAndroid Build Coastguard Worker # Usually 'no', except on cygwin/mingw when embedded into 5494*6a54128fSAndroid Build Coastguard Worker # the cwrapper. 5495*6a54128fSAndroid Build Coastguard Worker WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 5496*6a54128fSAndroid Build Coastguard Worker if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then 5497*6a54128fSAndroid Build Coastguard Worker # special case for '.' 5498*6a54128fSAndroid Build Coastguard Worker if test \"\$thisdir\" = \".\"; then 5499*6a54128fSAndroid Build Coastguard Worker thisdir=\`pwd\` 5500*6a54128fSAndroid Build Coastguard Worker fi 5501*6a54128fSAndroid Build Coastguard Worker # remove .libs from thisdir 5502*6a54128fSAndroid Build Coastguard Worker case \"\$thisdir\" in 5503*6a54128fSAndroid Build Coastguard Worker *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; 5504*6a54128fSAndroid Build Coastguard Worker $objdir ) thisdir=. ;; 5505*6a54128fSAndroid Build Coastguard Worker esac 5506*6a54128fSAndroid Build Coastguard Worker fi 5507*6a54128fSAndroid Build Coastguard Worker 5508*6a54128fSAndroid Build Coastguard Worker # Try to get the absolute directory name. 5509*6a54128fSAndroid Build Coastguard Worker absdir=\`cd \"\$thisdir\" && pwd\` 5510*6a54128fSAndroid Build Coastguard Worker test -n \"\$absdir\" && thisdir=\"\$absdir\" 5511*6a54128fSAndroid Build Coastguard Worker" 5512*6a54128fSAndroid Build Coastguard Worker 5513*6a54128fSAndroid Build Coastguard Worker if test yes = "$fast_install"; then 5514*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5515*6a54128fSAndroid Build Coastguard Worker program=lt-'$outputname'$exeext 5516*6a54128fSAndroid Build Coastguard Worker progdir=\"\$thisdir/$objdir\" 5517*6a54128fSAndroid Build Coastguard Worker 5518*6a54128fSAndroid Build Coastguard Worker if test ! -f \"\$progdir/\$program\" || 5519*6a54128fSAndroid Build Coastguard Worker { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ 5520*6a54128fSAndroid Build Coastguard Worker test \"X\$file\" != \"X\$progdir/\$program\"; }; then 5521*6a54128fSAndroid Build Coastguard Worker 5522*6a54128fSAndroid Build Coastguard Worker file=\"\$\$-\$program\" 5523*6a54128fSAndroid Build Coastguard Worker 5524*6a54128fSAndroid Build Coastguard Worker if test ! -d \"\$progdir\"; then 5525*6a54128fSAndroid Build Coastguard Worker $MKDIR \"\$progdir\" 5526*6a54128fSAndroid Build Coastguard Worker else 5527*6a54128fSAndroid Build Coastguard Worker $RM \"\$progdir/\$file\" 5528*6a54128fSAndroid Build Coastguard Worker fi" 5529*6a54128fSAndroid Build Coastguard Worker 5530*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5531*6a54128fSAndroid Build Coastguard Worker 5532*6a54128fSAndroid Build Coastguard Worker # relink executable if necessary 5533*6a54128fSAndroid Build Coastguard Worker if test -n \"\$relink_command\"; then 5534*6a54128fSAndroid Build Coastguard Worker if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5535*6a54128fSAndroid Build Coastguard Worker else 5536*6a54128fSAndroid Build Coastguard Worker \$ECHO \"\$relink_command_output\" >&2 5537*6a54128fSAndroid Build Coastguard Worker $RM \"\$progdir/\$file\" 5538*6a54128fSAndroid Build Coastguard Worker exit 1 5539*6a54128fSAndroid Build Coastguard Worker fi 5540*6a54128fSAndroid Build Coastguard Worker fi 5541*6a54128fSAndroid Build Coastguard Worker 5542*6a54128fSAndroid Build Coastguard Worker $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5543*6a54128fSAndroid Build Coastguard Worker { $RM \"\$progdir/\$program\"; 5544*6a54128fSAndroid Build Coastguard Worker $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5545*6a54128fSAndroid Build Coastguard Worker $RM \"\$progdir/\$file\" 5546*6a54128fSAndroid Build Coastguard Worker fi" 5547*6a54128fSAndroid Build Coastguard Worker else 5548*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5549*6a54128fSAndroid Build Coastguard Worker program='$outputname' 5550*6a54128fSAndroid Build Coastguard Worker progdir=\"\$thisdir/$objdir\" 5551*6a54128fSAndroid Build Coastguard Worker" 5552*6a54128fSAndroid Build Coastguard Worker fi 5553*6a54128fSAndroid Build Coastguard Worker 5554*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5555*6a54128fSAndroid Build Coastguard Worker 5556*6a54128fSAndroid Build Coastguard Worker if test -f \"\$progdir/\$program\"; then" 5557*6a54128fSAndroid Build Coastguard Worker 5558*6a54128fSAndroid Build Coastguard Worker # fixup the dll searchpath if we need to. 5559*6a54128fSAndroid Build Coastguard Worker # 5560*6a54128fSAndroid Build Coastguard Worker # Fix the DLL searchpath if we need to. Do this before prepending 5561*6a54128fSAndroid Build Coastguard Worker # to shlibpath, because on Windows, both are PATH and uninstalled 5562*6a54128fSAndroid Build Coastguard Worker # libraries must come first. 5563*6a54128fSAndroid Build Coastguard Worker if test -n "$dllsearchpath"; then 5564*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5565*6a54128fSAndroid Build Coastguard Worker # Add the dll search path components to the executable PATH 5566*6a54128fSAndroid Build Coastguard Worker PATH=$dllsearchpath:\$PATH 5567*6a54128fSAndroid Build Coastguard Worker" 5568*6a54128fSAndroid Build Coastguard Worker fi 5569*6a54128fSAndroid Build Coastguard Worker 5570*6a54128fSAndroid Build Coastguard Worker # Export our shlibpath_var if we have one. 5571*6a54128fSAndroid Build Coastguard Worker if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5572*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5573*6a54128fSAndroid Build Coastguard Worker # Add our own library path to $shlibpath_var 5574*6a54128fSAndroid Build Coastguard Worker $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 5575*6a54128fSAndroid Build Coastguard Worker 5576*6a54128fSAndroid Build Coastguard Worker # Some systems cannot cope with colon-terminated $shlibpath_var 5577*6a54128fSAndroid Build Coastguard Worker # The second colon is a workaround for a bug in BeOS R4 sed 5578*6a54128fSAndroid Build Coastguard Worker $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` 5579*6a54128fSAndroid Build Coastguard Worker 5580*6a54128fSAndroid Build Coastguard Worker export $shlibpath_var 5581*6a54128fSAndroid Build Coastguard Worker" 5582*6a54128fSAndroid Build Coastguard Worker fi 5583*6a54128fSAndroid Build Coastguard Worker 5584*6a54128fSAndroid Build Coastguard Worker $ECHO "\ 5585*6a54128fSAndroid Build Coastguard Worker if test \"\$libtool_execute_magic\" != \"$magic\"; then 5586*6a54128fSAndroid Build Coastguard Worker # Run the actual program with our arguments. 5587*6a54128fSAndroid Build Coastguard Worker func_exec_program \${1+\"\$@\"} 5588*6a54128fSAndroid Build Coastguard Worker fi 5589*6a54128fSAndroid Build Coastguard Worker else 5590*6a54128fSAndroid Build Coastguard Worker # The program doesn't exist. 5591*6a54128fSAndroid Build Coastguard Worker \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 5592*6a54128fSAndroid Build Coastguard Worker \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 5593*6a54128fSAndroid Build Coastguard Worker \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 5594*6a54128fSAndroid Build Coastguard Worker exit 1 5595*6a54128fSAndroid Build Coastguard Worker fi 5596*6a54128fSAndroid Build Coastguard Workerfi\ 5597*6a54128fSAndroid Build Coastguard Worker" 5598*6a54128fSAndroid Build Coastguard Worker} 5599*6a54128fSAndroid Build Coastguard Worker 5600*6a54128fSAndroid Build Coastguard Worker 5601*6a54128fSAndroid Build Coastguard Worker# func_emit_cwrapperexe_src 5602*6a54128fSAndroid Build Coastguard Worker# emit the source code for a wrapper executable on stdout 5603*6a54128fSAndroid Build Coastguard Worker# Must ONLY be called from within func_mode_link because 5604*6a54128fSAndroid Build Coastguard Worker# it depends on a number of variable set therein. 5605*6a54128fSAndroid Build Coastguard Workerfunc_emit_cwrapperexe_src () 5606*6a54128fSAndroid Build Coastguard Worker{ 5607*6a54128fSAndroid Build Coastguard Worker cat <<EOF 5608*6a54128fSAndroid Build Coastguard Worker 5609*6a54128fSAndroid Build Coastguard Worker/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 5610*6a54128fSAndroid Build Coastguard Worker Generated by $PROGRAM (GNU $PACKAGE) $VERSION 5611*6a54128fSAndroid Build Coastguard Worker 5612*6a54128fSAndroid Build Coastguard Worker The $output program cannot be directly executed until all the libtool 5613*6a54128fSAndroid Build Coastguard Worker libraries that it depends on are installed. 5614*6a54128fSAndroid Build Coastguard Worker 5615*6a54128fSAndroid Build Coastguard Worker This wrapper executable should never be moved out of the build directory. 5616*6a54128fSAndroid Build Coastguard Worker If it is, it will not operate correctly. 5617*6a54128fSAndroid Build Coastguard Worker*/ 5618*6a54128fSAndroid Build Coastguard WorkerEOF 5619*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5620*6a54128fSAndroid Build Coastguard Worker#ifdef _MSC_VER 5621*6a54128fSAndroid Build Coastguard Worker# define _CRT_SECURE_NO_DEPRECATE 1 5622*6a54128fSAndroid Build Coastguard Worker#endif 5623*6a54128fSAndroid Build Coastguard Worker#include <stdio.h> 5624*6a54128fSAndroid Build Coastguard Worker#include <stdlib.h> 5625*6a54128fSAndroid Build Coastguard Worker#ifdef _MSC_VER 5626*6a54128fSAndroid Build Coastguard Worker# include <direct.h> 5627*6a54128fSAndroid Build Coastguard Worker# include <process.h> 5628*6a54128fSAndroid Build Coastguard Worker# include <io.h> 5629*6a54128fSAndroid Build Coastguard Worker#else 5630*6a54128fSAndroid Build Coastguard Worker# include <unistd.h> 5631*6a54128fSAndroid Build Coastguard Worker# include <stdint.h> 5632*6a54128fSAndroid Build Coastguard Worker# ifdef __CYGWIN__ 5633*6a54128fSAndroid Build Coastguard Worker# include <io.h> 5634*6a54128fSAndroid Build Coastguard Worker# endif 5635*6a54128fSAndroid Build Coastguard Worker#endif 5636*6a54128fSAndroid Build Coastguard Worker#include <malloc.h> 5637*6a54128fSAndroid Build Coastguard Worker#include <stdarg.h> 5638*6a54128fSAndroid Build Coastguard Worker#include <assert.h> 5639*6a54128fSAndroid Build Coastguard Worker#include <string.h> 5640*6a54128fSAndroid Build Coastguard Worker#include <ctype.h> 5641*6a54128fSAndroid Build Coastguard Worker#include <errno.h> 5642*6a54128fSAndroid Build Coastguard Worker#include <fcntl.h> 5643*6a54128fSAndroid Build Coastguard Worker#include <sys/stat.h> 5644*6a54128fSAndroid Build Coastguard Worker 5645*6a54128fSAndroid Build Coastguard Worker#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) 5646*6a54128fSAndroid Build Coastguard Worker 5647*6a54128fSAndroid Build Coastguard Worker/* declarations of non-ANSI functions */ 5648*6a54128fSAndroid Build Coastguard Worker#if defined __MINGW32__ 5649*6a54128fSAndroid Build Coastguard Worker# ifdef __STRICT_ANSI__ 5650*6a54128fSAndroid Build Coastguard Workerint _putenv (const char *); 5651*6a54128fSAndroid Build Coastguard Worker# endif 5652*6a54128fSAndroid Build Coastguard Worker#elif defined __CYGWIN__ 5653*6a54128fSAndroid Build Coastguard Worker# ifdef __STRICT_ANSI__ 5654*6a54128fSAndroid Build Coastguard Workerchar *realpath (const char *, char *); 5655*6a54128fSAndroid Build Coastguard Workerint putenv (char *); 5656*6a54128fSAndroid Build Coastguard Workerint setenv (const char *, const char *, int); 5657*6a54128fSAndroid Build Coastguard Worker# endif 5658*6a54128fSAndroid Build Coastguard Worker/* #elif defined other_platform || defined ... */ 5659*6a54128fSAndroid Build Coastguard Worker#endif 5660*6a54128fSAndroid Build Coastguard Worker 5661*6a54128fSAndroid Build Coastguard Worker/* portability defines, excluding path handling macros */ 5662*6a54128fSAndroid Build Coastguard Worker#if defined _MSC_VER 5663*6a54128fSAndroid Build Coastguard Worker# define setmode _setmode 5664*6a54128fSAndroid Build Coastguard Worker# define stat _stat 5665*6a54128fSAndroid Build Coastguard Worker# define chmod _chmod 5666*6a54128fSAndroid Build Coastguard Worker# define getcwd _getcwd 5667*6a54128fSAndroid Build Coastguard Worker# define putenv _putenv 5668*6a54128fSAndroid Build Coastguard Worker# define S_IXUSR _S_IEXEC 5669*6a54128fSAndroid Build Coastguard Worker#elif defined __MINGW32__ 5670*6a54128fSAndroid Build Coastguard Worker# define setmode _setmode 5671*6a54128fSAndroid Build Coastguard Worker# define stat _stat 5672*6a54128fSAndroid Build Coastguard Worker# define chmod _chmod 5673*6a54128fSAndroid Build Coastguard Worker# define getcwd _getcwd 5674*6a54128fSAndroid Build Coastguard Worker# define putenv _putenv 5675*6a54128fSAndroid Build Coastguard Worker#elif defined __CYGWIN__ 5676*6a54128fSAndroid Build Coastguard Worker# define HAVE_SETENV 5677*6a54128fSAndroid Build Coastguard Worker# define FOPEN_WB "wb" 5678*6a54128fSAndroid Build Coastguard Worker/* #elif defined other platforms ... */ 5679*6a54128fSAndroid Build Coastguard Worker#endif 5680*6a54128fSAndroid Build Coastguard Worker 5681*6a54128fSAndroid Build Coastguard Worker#if defined PATH_MAX 5682*6a54128fSAndroid Build Coastguard Worker# define LT_PATHMAX PATH_MAX 5683*6a54128fSAndroid Build Coastguard Worker#elif defined MAXPATHLEN 5684*6a54128fSAndroid Build Coastguard Worker# define LT_PATHMAX MAXPATHLEN 5685*6a54128fSAndroid Build Coastguard Worker#else 5686*6a54128fSAndroid Build Coastguard Worker# define LT_PATHMAX 1024 5687*6a54128fSAndroid Build Coastguard Worker#endif 5688*6a54128fSAndroid Build Coastguard Worker 5689*6a54128fSAndroid Build Coastguard Worker#ifndef S_IXOTH 5690*6a54128fSAndroid Build Coastguard Worker# define S_IXOTH 0 5691*6a54128fSAndroid Build Coastguard Worker#endif 5692*6a54128fSAndroid Build Coastguard Worker#ifndef S_IXGRP 5693*6a54128fSAndroid Build Coastguard Worker# define S_IXGRP 0 5694*6a54128fSAndroid Build Coastguard Worker#endif 5695*6a54128fSAndroid Build Coastguard Worker 5696*6a54128fSAndroid Build Coastguard Worker/* path handling portability macros */ 5697*6a54128fSAndroid Build Coastguard Worker#ifndef DIR_SEPARATOR 5698*6a54128fSAndroid Build Coastguard Worker# define DIR_SEPARATOR '/' 5699*6a54128fSAndroid Build Coastguard Worker# define PATH_SEPARATOR ':' 5700*6a54128fSAndroid Build Coastguard Worker#endif 5701*6a54128fSAndroid Build Coastguard Worker 5702*6a54128fSAndroid Build Coastguard Worker#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ 5703*6a54128fSAndroid Build Coastguard Worker defined __OS2__ 5704*6a54128fSAndroid Build Coastguard Worker# define HAVE_DOS_BASED_FILE_SYSTEM 5705*6a54128fSAndroid Build Coastguard Worker# define FOPEN_WB "wb" 5706*6a54128fSAndroid Build Coastguard Worker# ifndef DIR_SEPARATOR_2 5707*6a54128fSAndroid Build Coastguard Worker# define DIR_SEPARATOR_2 '\\' 5708*6a54128fSAndroid Build Coastguard Worker# endif 5709*6a54128fSAndroid Build Coastguard Worker# ifndef PATH_SEPARATOR_2 5710*6a54128fSAndroid Build Coastguard Worker# define PATH_SEPARATOR_2 ';' 5711*6a54128fSAndroid Build Coastguard Worker# endif 5712*6a54128fSAndroid Build Coastguard Worker#endif 5713*6a54128fSAndroid Build Coastguard Worker 5714*6a54128fSAndroid Build Coastguard Worker#ifndef DIR_SEPARATOR_2 5715*6a54128fSAndroid Build Coastguard Worker# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 5716*6a54128fSAndroid Build Coastguard Worker#else /* DIR_SEPARATOR_2 */ 5717*6a54128fSAndroid Build Coastguard Worker# define IS_DIR_SEPARATOR(ch) \ 5718*6a54128fSAndroid Build Coastguard Worker (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 5719*6a54128fSAndroid Build Coastguard Worker#endif /* DIR_SEPARATOR_2 */ 5720*6a54128fSAndroid Build Coastguard Worker 5721*6a54128fSAndroid Build Coastguard Worker#ifndef PATH_SEPARATOR_2 5722*6a54128fSAndroid Build Coastguard Worker# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 5723*6a54128fSAndroid Build Coastguard Worker#else /* PATH_SEPARATOR_2 */ 5724*6a54128fSAndroid Build Coastguard Worker# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 5725*6a54128fSAndroid Build Coastguard Worker#endif /* PATH_SEPARATOR_2 */ 5726*6a54128fSAndroid Build Coastguard Worker 5727*6a54128fSAndroid Build Coastguard Worker#ifndef FOPEN_WB 5728*6a54128fSAndroid Build Coastguard Worker# define FOPEN_WB "w" 5729*6a54128fSAndroid Build Coastguard Worker#endif 5730*6a54128fSAndroid Build Coastguard Worker#ifndef _O_BINARY 5731*6a54128fSAndroid Build Coastguard Worker# define _O_BINARY 0 5732*6a54128fSAndroid Build Coastguard Worker#endif 5733*6a54128fSAndroid Build Coastguard Worker 5734*6a54128fSAndroid Build Coastguard Worker#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 5735*6a54128fSAndroid Build Coastguard Worker#define XFREE(stale) do { \ 5736*6a54128fSAndroid Build Coastguard Worker if (stale) { free (stale); stale = 0; } \ 5737*6a54128fSAndroid Build Coastguard Worker} while (0) 5738*6a54128fSAndroid Build Coastguard Worker 5739*6a54128fSAndroid Build Coastguard Worker#if defined LT_DEBUGWRAPPER 5740*6a54128fSAndroid Build Coastguard Workerstatic int lt_debug = 1; 5741*6a54128fSAndroid Build Coastguard Worker#else 5742*6a54128fSAndroid Build Coastguard Workerstatic int lt_debug = 0; 5743*6a54128fSAndroid Build Coastguard Worker#endif 5744*6a54128fSAndroid Build Coastguard Worker 5745*6a54128fSAndroid Build Coastguard Workerconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ 5746*6a54128fSAndroid Build Coastguard Worker 5747*6a54128fSAndroid Build Coastguard Workervoid *xmalloc (size_t num); 5748*6a54128fSAndroid Build Coastguard Workerchar *xstrdup (const char *string); 5749*6a54128fSAndroid Build Coastguard Workerconst char *base_name (const char *name); 5750*6a54128fSAndroid Build Coastguard Workerchar *find_executable (const char *wrapper); 5751*6a54128fSAndroid Build Coastguard Workerchar *chase_symlinks (const char *pathspec); 5752*6a54128fSAndroid Build Coastguard Workerint make_executable (const char *path); 5753*6a54128fSAndroid Build Coastguard Workerint check_executable (const char *path); 5754*6a54128fSAndroid Build Coastguard Workerchar *strendzap (char *str, const char *pat); 5755*6a54128fSAndroid Build Coastguard Workervoid lt_debugprintf (const char *file, int line, const char *fmt, ...); 5756*6a54128fSAndroid Build Coastguard Workervoid lt_fatal (const char *file, int line, const char *message, ...); 5757*6a54128fSAndroid Build Coastguard Workerstatic const char *nonnull (const char *s); 5758*6a54128fSAndroid Build Coastguard Workerstatic const char *nonempty (const char *s); 5759*6a54128fSAndroid Build Coastguard Workervoid lt_setenv (const char *name, const char *value); 5760*6a54128fSAndroid Build Coastguard Workerchar *lt_extend_str (const char *orig_value, const char *add, int to_end); 5761*6a54128fSAndroid Build Coastguard Workervoid lt_update_exe_path (const char *name, const char *value); 5762*6a54128fSAndroid Build Coastguard Workervoid lt_update_lib_path (const char *name, const char *value); 5763*6a54128fSAndroid Build Coastguard Workerchar **prepare_spawn (char **argv); 5764*6a54128fSAndroid Build Coastguard Workervoid lt_dump_script (FILE *f); 5765*6a54128fSAndroid Build Coastguard WorkerEOF 5766*6a54128fSAndroid Build Coastguard Worker 5767*6a54128fSAndroid Build Coastguard Worker cat <<EOF 5768*6a54128fSAndroid Build Coastguard Worker#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) 5769*6a54128fSAndroid Build Coastguard Worker# define externally_visible volatile 5770*6a54128fSAndroid Build Coastguard Worker#else 5771*6a54128fSAndroid Build Coastguard Worker# define externally_visible __attribute__((externally_visible)) volatile 5772*6a54128fSAndroid Build Coastguard Worker#endif 5773*6a54128fSAndroid Build Coastguard Workerexternally_visible const char * MAGIC_EXE = "$magic_exe"; 5774*6a54128fSAndroid Build Coastguard Workerconst char * LIB_PATH_VARNAME = "$shlibpath_var"; 5775*6a54128fSAndroid Build Coastguard WorkerEOF 5776*6a54128fSAndroid Build Coastguard Worker 5777*6a54128fSAndroid Build Coastguard Worker if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5778*6a54128fSAndroid Build Coastguard Worker func_to_host_path "$temp_rpath" 5779*6a54128fSAndroid Build Coastguard Worker cat <<EOF 5780*6a54128fSAndroid Build Coastguard Workerconst char * LIB_PATH_VALUE = "$func_to_host_path_result"; 5781*6a54128fSAndroid Build Coastguard WorkerEOF 5782*6a54128fSAndroid Build Coastguard Worker else 5783*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5784*6a54128fSAndroid Build Coastguard Workerconst char * LIB_PATH_VALUE = ""; 5785*6a54128fSAndroid Build Coastguard WorkerEOF 5786*6a54128fSAndroid Build Coastguard Worker fi 5787*6a54128fSAndroid Build Coastguard Worker 5788*6a54128fSAndroid Build Coastguard Worker if test -n "$dllsearchpath"; then 5789*6a54128fSAndroid Build Coastguard Worker func_to_host_path "$dllsearchpath:" 5790*6a54128fSAndroid Build Coastguard Worker cat <<EOF 5791*6a54128fSAndroid Build Coastguard Workerconst char * EXE_PATH_VARNAME = "PATH"; 5792*6a54128fSAndroid Build Coastguard Workerconst char * EXE_PATH_VALUE = "$func_to_host_path_result"; 5793*6a54128fSAndroid Build Coastguard WorkerEOF 5794*6a54128fSAndroid Build Coastguard Worker else 5795*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5796*6a54128fSAndroid Build Coastguard Workerconst char * EXE_PATH_VARNAME = ""; 5797*6a54128fSAndroid Build Coastguard Workerconst char * EXE_PATH_VALUE = ""; 5798*6a54128fSAndroid Build Coastguard WorkerEOF 5799*6a54128fSAndroid Build Coastguard Worker fi 5800*6a54128fSAndroid Build Coastguard Worker 5801*6a54128fSAndroid Build Coastguard Worker if test yes = "$fast_install"; then 5802*6a54128fSAndroid Build Coastguard Worker cat <<EOF 5803*6a54128fSAndroid Build Coastguard Workerconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */ 5804*6a54128fSAndroid Build Coastguard WorkerEOF 5805*6a54128fSAndroid Build Coastguard Worker else 5806*6a54128fSAndroid Build Coastguard Worker cat <<EOF 5807*6a54128fSAndroid Build Coastguard Workerconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */ 5808*6a54128fSAndroid Build Coastguard WorkerEOF 5809*6a54128fSAndroid Build Coastguard Worker fi 5810*6a54128fSAndroid Build Coastguard Worker 5811*6a54128fSAndroid Build Coastguard Worker 5812*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5813*6a54128fSAndroid Build Coastguard Worker 5814*6a54128fSAndroid Build Coastguard Worker#define LTWRAPPER_OPTION_PREFIX "--lt-" 5815*6a54128fSAndroid Build Coastguard Worker 5816*6a54128fSAndroid Build Coastguard Workerstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX; 5817*6a54128fSAndroid Build Coastguard Workerstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script"; 5818*6a54128fSAndroid Build Coastguard Workerstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug"; 5819*6a54128fSAndroid Build Coastguard Worker 5820*6a54128fSAndroid Build Coastguard Workerint 5821*6a54128fSAndroid Build Coastguard Workermain (int argc, char *argv[]) 5822*6a54128fSAndroid Build Coastguard Worker{ 5823*6a54128fSAndroid Build Coastguard Worker char **newargz; 5824*6a54128fSAndroid Build Coastguard Worker int newargc; 5825*6a54128fSAndroid Build Coastguard Worker char *tmp_pathspec; 5826*6a54128fSAndroid Build Coastguard Worker char *actual_cwrapper_path; 5827*6a54128fSAndroid Build Coastguard Worker char *actual_cwrapper_name; 5828*6a54128fSAndroid Build Coastguard Worker char *target_name; 5829*6a54128fSAndroid Build Coastguard Worker char *lt_argv_zero; 5830*6a54128fSAndroid Build Coastguard Worker int rval = 127; 5831*6a54128fSAndroid Build Coastguard Worker 5832*6a54128fSAndroid Build Coastguard Worker int i; 5833*6a54128fSAndroid Build Coastguard Worker 5834*6a54128fSAndroid Build Coastguard Worker program_name = (char *) xstrdup (base_name (argv[0])); 5835*6a54128fSAndroid Build Coastguard Worker newargz = XMALLOC (char *, (size_t) argc + 1); 5836*6a54128fSAndroid Build Coastguard Worker 5837*6a54128fSAndroid Build Coastguard Worker /* very simple arg parsing; don't want to rely on getopt 5838*6a54128fSAndroid Build Coastguard Worker * also, copy all non cwrapper options to newargz, except 5839*6a54128fSAndroid Build Coastguard Worker * argz[0], which is handled differently 5840*6a54128fSAndroid Build Coastguard Worker */ 5841*6a54128fSAndroid Build Coastguard Worker newargc=0; 5842*6a54128fSAndroid Build Coastguard Worker for (i = 1; i < argc; i++) 5843*6a54128fSAndroid Build Coastguard Worker { 5844*6a54128fSAndroid Build Coastguard Worker if (STREQ (argv[i], dumpscript_opt)) 5845*6a54128fSAndroid Build Coastguard Worker { 5846*6a54128fSAndroid Build Coastguard WorkerEOF 5847*6a54128fSAndroid Build Coastguard Worker case $host in 5848*6a54128fSAndroid Build Coastguard Worker *mingw* | *cygwin* ) 5849*6a54128fSAndroid Build Coastguard Worker # make stdout use "unix" line endings 5850*6a54128fSAndroid Build Coastguard Worker echo " setmode(1,_O_BINARY);" 5851*6a54128fSAndroid Build Coastguard Worker ;; 5852*6a54128fSAndroid Build Coastguard Worker esac 5853*6a54128fSAndroid Build Coastguard Worker 5854*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5855*6a54128fSAndroid Build Coastguard Worker lt_dump_script (stdout); 5856*6a54128fSAndroid Build Coastguard Worker return 0; 5857*6a54128fSAndroid Build Coastguard Worker } 5858*6a54128fSAndroid Build Coastguard Worker if (STREQ (argv[i], debug_opt)) 5859*6a54128fSAndroid Build Coastguard Worker { 5860*6a54128fSAndroid Build Coastguard Worker lt_debug = 1; 5861*6a54128fSAndroid Build Coastguard Worker continue; 5862*6a54128fSAndroid Build Coastguard Worker } 5863*6a54128fSAndroid Build Coastguard Worker if (STREQ (argv[i], ltwrapper_option_prefix)) 5864*6a54128fSAndroid Build Coastguard Worker { 5865*6a54128fSAndroid Build Coastguard Worker /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX 5866*6a54128fSAndroid Build Coastguard Worker namespace, but it is not one of the ones we know about and 5867*6a54128fSAndroid Build Coastguard Worker have already dealt with, above (inluding dump-script), then 5868*6a54128fSAndroid Build Coastguard Worker report an error. Otherwise, targets might begin to believe 5869*6a54128fSAndroid Build Coastguard Worker they are allowed to use options in the LTWRAPPER_OPTION_PREFIX 5870*6a54128fSAndroid Build Coastguard Worker namespace. The first time any user complains about this, we'll 5871*6a54128fSAndroid Build Coastguard Worker need to make LTWRAPPER_OPTION_PREFIX a configure-time option 5872*6a54128fSAndroid Build Coastguard Worker or a configure.ac-settable value. 5873*6a54128fSAndroid Build Coastguard Worker */ 5874*6a54128fSAndroid Build Coastguard Worker lt_fatal (__FILE__, __LINE__, 5875*6a54128fSAndroid Build Coastguard Worker "unrecognized %s option: '%s'", 5876*6a54128fSAndroid Build Coastguard Worker ltwrapper_option_prefix, argv[i]); 5877*6a54128fSAndroid Build Coastguard Worker } 5878*6a54128fSAndroid Build Coastguard Worker /* otherwise ... */ 5879*6a54128fSAndroid Build Coastguard Worker newargz[++newargc] = xstrdup (argv[i]); 5880*6a54128fSAndroid Build Coastguard Worker } 5881*6a54128fSAndroid Build Coastguard Worker newargz[++newargc] = NULL; 5882*6a54128fSAndroid Build Coastguard Worker 5883*6a54128fSAndroid Build Coastguard WorkerEOF 5884*6a54128fSAndroid Build Coastguard Worker cat <<EOF 5885*6a54128fSAndroid Build Coastguard Worker /* The GNU banner must be the first non-error debug message */ 5886*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n"); 5887*6a54128fSAndroid Build Coastguard WorkerEOF 5888*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5889*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]); 5890*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name); 5891*6a54128fSAndroid Build Coastguard Worker 5892*6a54128fSAndroid Build Coastguard Worker tmp_pathspec = find_executable (argv[0]); 5893*6a54128fSAndroid Build Coastguard Worker if (tmp_pathspec == NULL) 5894*6a54128fSAndroid Build Coastguard Worker lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]); 5895*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, 5896*6a54128fSAndroid Build Coastguard Worker "(main) found exe (before symlink chase) at: %s\n", 5897*6a54128fSAndroid Build Coastguard Worker tmp_pathspec); 5898*6a54128fSAndroid Build Coastguard Worker 5899*6a54128fSAndroid Build Coastguard Worker actual_cwrapper_path = chase_symlinks (tmp_pathspec); 5900*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, 5901*6a54128fSAndroid Build Coastguard Worker "(main) found exe (after symlink chase) at: %s\n", 5902*6a54128fSAndroid Build Coastguard Worker actual_cwrapper_path); 5903*6a54128fSAndroid Build Coastguard Worker XFREE (tmp_pathspec); 5904*6a54128fSAndroid Build Coastguard Worker 5905*6a54128fSAndroid Build Coastguard Worker actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path)); 5906*6a54128fSAndroid Build Coastguard Worker strendzap (actual_cwrapper_path, actual_cwrapper_name); 5907*6a54128fSAndroid Build Coastguard Worker 5908*6a54128fSAndroid Build Coastguard Worker /* wrapper name transforms */ 5909*6a54128fSAndroid Build Coastguard Worker strendzap (actual_cwrapper_name, ".exe"); 5910*6a54128fSAndroid Build Coastguard Worker tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1); 5911*6a54128fSAndroid Build Coastguard Worker XFREE (actual_cwrapper_name); 5912*6a54128fSAndroid Build Coastguard Worker actual_cwrapper_name = tmp_pathspec; 5913*6a54128fSAndroid Build Coastguard Worker tmp_pathspec = 0; 5914*6a54128fSAndroid Build Coastguard Worker 5915*6a54128fSAndroid Build Coastguard Worker /* target_name transforms -- use actual target program name; might have lt- prefix */ 5916*6a54128fSAndroid Build Coastguard Worker target_name = xstrdup (base_name (TARGET_PROGRAM_NAME)); 5917*6a54128fSAndroid Build Coastguard Worker strendzap (target_name, ".exe"); 5918*6a54128fSAndroid Build Coastguard Worker tmp_pathspec = lt_extend_str (target_name, ".exe", 1); 5919*6a54128fSAndroid Build Coastguard Worker XFREE (target_name); 5920*6a54128fSAndroid Build Coastguard Worker target_name = tmp_pathspec; 5921*6a54128fSAndroid Build Coastguard Worker tmp_pathspec = 0; 5922*6a54128fSAndroid Build Coastguard Worker 5923*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, 5924*6a54128fSAndroid Build Coastguard Worker "(main) libtool target name: %s\n", 5925*6a54128fSAndroid Build Coastguard Worker target_name); 5926*6a54128fSAndroid Build Coastguard WorkerEOF 5927*6a54128fSAndroid Build Coastguard Worker 5928*6a54128fSAndroid Build Coastguard Worker cat <<EOF 5929*6a54128fSAndroid Build Coastguard Worker newargz[0] = 5930*6a54128fSAndroid Build Coastguard Worker XMALLOC (char, (strlen (actual_cwrapper_path) + 5931*6a54128fSAndroid Build Coastguard Worker strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1)); 5932*6a54128fSAndroid Build Coastguard Worker strcpy (newargz[0], actual_cwrapper_path); 5933*6a54128fSAndroid Build Coastguard Worker strcat (newargz[0], "$objdir"); 5934*6a54128fSAndroid Build Coastguard Worker strcat (newargz[0], "/"); 5935*6a54128fSAndroid Build Coastguard WorkerEOF 5936*6a54128fSAndroid Build Coastguard Worker 5937*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5938*6a54128fSAndroid Build Coastguard Worker /* stop here, and copy so we don't have to do this twice */ 5939*6a54128fSAndroid Build Coastguard Worker tmp_pathspec = xstrdup (newargz[0]); 5940*6a54128fSAndroid Build Coastguard Worker 5941*6a54128fSAndroid Build Coastguard Worker /* do NOT want the lt- prefix here, so use actual_cwrapper_name */ 5942*6a54128fSAndroid Build Coastguard Worker strcat (newargz[0], actual_cwrapper_name); 5943*6a54128fSAndroid Build Coastguard Worker 5944*6a54128fSAndroid Build Coastguard Worker /* DO want the lt- prefix here if it exists, so use target_name */ 5945*6a54128fSAndroid Build Coastguard Worker lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1); 5946*6a54128fSAndroid Build Coastguard Worker XFREE (tmp_pathspec); 5947*6a54128fSAndroid Build Coastguard Worker tmp_pathspec = NULL; 5948*6a54128fSAndroid Build Coastguard WorkerEOF 5949*6a54128fSAndroid Build Coastguard Worker 5950*6a54128fSAndroid Build Coastguard Worker case $host_os in 5951*6a54128fSAndroid Build Coastguard Worker mingw*) 5952*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5953*6a54128fSAndroid Build Coastguard Worker { 5954*6a54128fSAndroid Build Coastguard Worker char* p; 5955*6a54128fSAndroid Build Coastguard Worker while ((p = strchr (newargz[0], '\\')) != NULL) 5956*6a54128fSAndroid Build Coastguard Worker { 5957*6a54128fSAndroid Build Coastguard Worker *p = '/'; 5958*6a54128fSAndroid Build Coastguard Worker } 5959*6a54128fSAndroid Build Coastguard Worker while ((p = strchr (lt_argv_zero, '\\')) != NULL) 5960*6a54128fSAndroid Build Coastguard Worker { 5961*6a54128fSAndroid Build Coastguard Worker *p = '/'; 5962*6a54128fSAndroid Build Coastguard Worker } 5963*6a54128fSAndroid Build Coastguard Worker } 5964*6a54128fSAndroid Build Coastguard WorkerEOF 5965*6a54128fSAndroid Build Coastguard Worker ;; 5966*6a54128fSAndroid Build Coastguard Worker esac 5967*6a54128fSAndroid Build Coastguard Worker 5968*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5969*6a54128fSAndroid Build Coastguard Worker XFREE (target_name); 5970*6a54128fSAndroid Build Coastguard Worker XFREE (actual_cwrapper_path); 5971*6a54128fSAndroid Build Coastguard Worker XFREE (actual_cwrapper_name); 5972*6a54128fSAndroid Build Coastguard Worker 5973*6a54128fSAndroid Build Coastguard Worker lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */ 5974*6a54128fSAndroid Build Coastguard Worker lt_setenv ("DUALCASE", "1"); /* for MSK sh */ 5975*6a54128fSAndroid Build Coastguard Worker /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must 5976*6a54128fSAndroid Build Coastguard Worker be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath) 5977*6a54128fSAndroid Build Coastguard Worker because on Windows, both *_VARNAMEs are PATH but uninstalled 5978*6a54128fSAndroid Build Coastguard Worker libraries must come first. */ 5979*6a54128fSAndroid Build Coastguard Worker lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE); 5980*6a54128fSAndroid Build Coastguard Worker lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE); 5981*6a54128fSAndroid Build Coastguard Worker 5982*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n", 5983*6a54128fSAndroid Build Coastguard Worker nonnull (lt_argv_zero)); 5984*6a54128fSAndroid Build Coastguard Worker for (i = 0; i < newargc; i++) 5985*6a54128fSAndroid Build Coastguard Worker { 5986*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n", 5987*6a54128fSAndroid Build Coastguard Worker i, nonnull (newargz[i])); 5988*6a54128fSAndroid Build Coastguard Worker } 5989*6a54128fSAndroid Build Coastguard Worker 5990*6a54128fSAndroid Build Coastguard WorkerEOF 5991*6a54128fSAndroid Build Coastguard Worker 5992*6a54128fSAndroid Build Coastguard Worker case $host_os in 5993*6a54128fSAndroid Build Coastguard Worker mingw*) 5994*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 5995*6a54128fSAndroid Build Coastguard Worker /* execv doesn't actually work on mingw as expected on unix */ 5996*6a54128fSAndroid Build Coastguard Worker newargz = prepare_spawn (newargz); 5997*6a54128fSAndroid Build Coastguard Worker rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); 5998*6a54128fSAndroid Build Coastguard Worker if (rval == -1) 5999*6a54128fSAndroid Build Coastguard Worker { 6000*6a54128fSAndroid Build Coastguard Worker /* failed to start process */ 6001*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, 6002*6a54128fSAndroid Build Coastguard Worker "(main) failed to launch target \"%s\": %s\n", 6003*6a54128fSAndroid Build Coastguard Worker lt_argv_zero, nonnull (strerror (errno))); 6004*6a54128fSAndroid Build Coastguard Worker return 127; 6005*6a54128fSAndroid Build Coastguard Worker } 6006*6a54128fSAndroid Build Coastguard Worker return rval; 6007*6a54128fSAndroid Build Coastguard WorkerEOF 6008*6a54128fSAndroid Build Coastguard Worker ;; 6009*6a54128fSAndroid Build Coastguard Worker *) 6010*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 6011*6a54128fSAndroid Build Coastguard Worker execv (lt_argv_zero, newargz); 6012*6a54128fSAndroid Build Coastguard Worker return rval; /* =127, but avoids unused variable warning */ 6013*6a54128fSAndroid Build Coastguard WorkerEOF 6014*6a54128fSAndroid Build Coastguard Worker ;; 6015*6a54128fSAndroid Build Coastguard Worker esac 6016*6a54128fSAndroid Build Coastguard Worker 6017*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 6018*6a54128fSAndroid Build Coastguard Worker} 6019*6a54128fSAndroid Build Coastguard Worker 6020*6a54128fSAndroid Build Coastguard Workervoid * 6021*6a54128fSAndroid Build Coastguard Workerxmalloc (size_t num) 6022*6a54128fSAndroid Build Coastguard Worker{ 6023*6a54128fSAndroid Build Coastguard Worker void *p = (void *) malloc (num); 6024*6a54128fSAndroid Build Coastguard Worker if (!p) 6025*6a54128fSAndroid Build Coastguard Worker lt_fatal (__FILE__, __LINE__, "memory exhausted"); 6026*6a54128fSAndroid Build Coastguard Worker 6027*6a54128fSAndroid Build Coastguard Worker return p; 6028*6a54128fSAndroid Build Coastguard Worker} 6029*6a54128fSAndroid Build Coastguard Worker 6030*6a54128fSAndroid Build Coastguard Workerchar * 6031*6a54128fSAndroid Build Coastguard Workerxstrdup (const char *string) 6032*6a54128fSAndroid Build Coastguard Worker{ 6033*6a54128fSAndroid Build Coastguard Worker return string ? strcpy ((char *) xmalloc (strlen (string) + 1), 6034*6a54128fSAndroid Build Coastguard Worker string) : NULL; 6035*6a54128fSAndroid Build Coastguard Worker} 6036*6a54128fSAndroid Build Coastguard Worker 6037*6a54128fSAndroid Build Coastguard Workerconst char * 6038*6a54128fSAndroid Build Coastguard Workerbase_name (const char *name) 6039*6a54128fSAndroid Build Coastguard Worker{ 6040*6a54128fSAndroid Build Coastguard Worker const char *base; 6041*6a54128fSAndroid Build Coastguard Worker 6042*6a54128fSAndroid Build Coastguard Worker#if defined HAVE_DOS_BASED_FILE_SYSTEM 6043*6a54128fSAndroid Build Coastguard Worker /* Skip over the disk name in MSDOS pathnames. */ 6044*6a54128fSAndroid Build Coastguard Worker if (isalpha ((unsigned char) name[0]) && name[1] == ':') 6045*6a54128fSAndroid Build Coastguard Worker name += 2; 6046*6a54128fSAndroid Build Coastguard Worker#endif 6047*6a54128fSAndroid Build Coastguard Worker 6048*6a54128fSAndroid Build Coastguard Worker for (base = name; *name; name++) 6049*6a54128fSAndroid Build Coastguard Worker if (IS_DIR_SEPARATOR (*name)) 6050*6a54128fSAndroid Build Coastguard Worker base = name + 1; 6051*6a54128fSAndroid Build Coastguard Worker return base; 6052*6a54128fSAndroid Build Coastguard Worker} 6053*6a54128fSAndroid Build Coastguard Worker 6054*6a54128fSAndroid Build Coastguard Workerint 6055*6a54128fSAndroid Build Coastguard Workercheck_executable (const char *path) 6056*6a54128fSAndroid Build Coastguard Worker{ 6057*6a54128fSAndroid Build Coastguard Worker struct stat st; 6058*6a54128fSAndroid Build Coastguard Worker 6059*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n", 6060*6a54128fSAndroid Build Coastguard Worker nonempty (path)); 6061*6a54128fSAndroid Build Coastguard Worker if ((!path) || (!*path)) 6062*6a54128fSAndroid Build Coastguard Worker return 0; 6063*6a54128fSAndroid Build Coastguard Worker 6064*6a54128fSAndroid Build Coastguard Worker if ((stat (path, &st) >= 0) 6065*6a54128fSAndroid Build Coastguard Worker && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) 6066*6a54128fSAndroid Build Coastguard Worker return 1; 6067*6a54128fSAndroid Build Coastguard Worker else 6068*6a54128fSAndroid Build Coastguard Worker return 0; 6069*6a54128fSAndroid Build Coastguard Worker} 6070*6a54128fSAndroid Build Coastguard Worker 6071*6a54128fSAndroid Build Coastguard Workerint 6072*6a54128fSAndroid Build Coastguard Workermake_executable (const char *path) 6073*6a54128fSAndroid Build Coastguard Worker{ 6074*6a54128fSAndroid Build Coastguard Worker int rval = 0; 6075*6a54128fSAndroid Build Coastguard Worker struct stat st; 6076*6a54128fSAndroid Build Coastguard Worker 6077*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", 6078*6a54128fSAndroid Build Coastguard Worker nonempty (path)); 6079*6a54128fSAndroid Build Coastguard Worker if ((!path) || (!*path)) 6080*6a54128fSAndroid Build Coastguard Worker return 0; 6081*6a54128fSAndroid Build Coastguard Worker 6082*6a54128fSAndroid Build Coastguard Worker if (stat (path, &st) >= 0) 6083*6a54128fSAndroid Build Coastguard Worker { 6084*6a54128fSAndroid Build Coastguard Worker rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); 6085*6a54128fSAndroid Build Coastguard Worker } 6086*6a54128fSAndroid Build Coastguard Worker return rval; 6087*6a54128fSAndroid Build Coastguard Worker} 6088*6a54128fSAndroid Build Coastguard Worker 6089*6a54128fSAndroid Build Coastguard Worker/* Searches for the full path of the wrapper. Returns 6090*6a54128fSAndroid Build Coastguard Worker newly allocated full path name if found, NULL otherwise 6091*6a54128fSAndroid Build Coastguard Worker Does not chase symlinks, even on platforms that support them. 6092*6a54128fSAndroid Build Coastguard Worker*/ 6093*6a54128fSAndroid Build Coastguard Workerchar * 6094*6a54128fSAndroid Build Coastguard Workerfind_executable (const char *wrapper) 6095*6a54128fSAndroid Build Coastguard Worker{ 6096*6a54128fSAndroid Build Coastguard Worker int has_slash = 0; 6097*6a54128fSAndroid Build Coastguard Worker const char *p; 6098*6a54128fSAndroid Build Coastguard Worker const char *p_next; 6099*6a54128fSAndroid Build Coastguard Worker /* static buffer for getcwd */ 6100*6a54128fSAndroid Build Coastguard Worker char tmp[LT_PATHMAX + 1]; 6101*6a54128fSAndroid Build Coastguard Worker size_t tmp_len; 6102*6a54128fSAndroid Build Coastguard Worker char *concat_name; 6103*6a54128fSAndroid Build Coastguard Worker 6104*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", 6105*6a54128fSAndroid Build Coastguard Worker nonempty (wrapper)); 6106*6a54128fSAndroid Build Coastguard Worker 6107*6a54128fSAndroid Build Coastguard Worker if ((wrapper == NULL) || (*wrapper == '\0')) 6108*6a54128fSAndroid Build Coastguard Worker return NULL; 6109*6a54128fSAndroid Build Coastguard Worker 6110*6a54128fSAndroid Build Coastguard Worker /* Absolute path? */ 6111*6a54128fSAndroid Build Coastguard Worker#if defined HAVE_DOS_BASED_FILE_SYSTEM 6112*6a54128fSAndroid Build Coastguard Worker if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') 6113*6a54128fSAndroid Build Coastguard Worker { 6114*6a54128fSAndroid Build Coastguard Worker concat_name = xstrdup (wrapper); 6115*6a54128fSAndroid Build Coastguard Worker if (check_executable (concat_name)) 6116*6a54128fSAndroid Build Coastguard Worker return concat_name; 6117*6a54128fSAndroid Build Coastguard Worker XFREE (concat_name); 6118*6a54128fSAndroid Build Coastguard Worker } 6119*6a54128fSAndroid Build Coastguard Worker else 6120*6a54128fSAndroid Build Coastguard Worker { 6121*6a54128fSAndroid Build Coastguard Worker#endif 6122*6a54128fSAndroid Build Coastguard Worker if (IS_DIR_SEPARATOR (wrapper[0])) 6123*6a54128fSAndroid Build Coastguard Worker { 6124*6a54128fSAndroid Build Coastguard Worker concat_name = xstrdup (wrapper); 6125*6a54128fSAndroid Build Coastguard Worker if (check_executable (concat_name)) 6126*6a54128fSAndroid Build Coastguard Worker return concat_name; 6127*6a54128fSAndroid Build Coastguard Worker XFREE (concat_name); 6128*6a54128fSAndroid Build Coastguard Worker } 6129*6a54128fSAndroid Build Coastguard Worker#if defined HAVE_DOS_BASED_FILE_SYSTEM 6130*6a54128fSAndroid Build Coastguard Worker } 6131*6a54128fSAndroid Build Coastguard Worker#endif 6132*6a54128fSAndroid Build Coastguard Worker 6133*6a54128fSAndroid Build Coastguard Worker for (p = wrapper; *p; p++) 6134*6a54128fSAndroid Build Coastguard Worker if (*p == '/') 6135*6a54128fSAndroid Build Coastguard Worker { 6136*6a54128fSAndroid Build Coastguard Worker has_slash = 1; 6137*6a54128fSAndroid Build Coastguard Worker break; 6138*6a54128fSAndroid Build Coastguard Worker } 6139*6a54128fSAndroid Build Coastguard Worker if (!has_slash) 6140*6a54128fSAndroid Build Coastguard Worker { 6141*6a54128fSAndroid Build Coastguard Worker /* no slashes; search PATH */ 6142*6a54128fSAndroid Build Coastguard Worker const char *path = getenv ("PATH"); 6143*6a54128fSAndroid Build Coastguard Worker if (path != NULL) 6144*6a54128fSAndroid Build Coastguard Worker { 6145*6a54128fSAndroid Build Coastguard Worker for (p = path; *p; p = p_next) 6146*6a54128fSAndroid Build Coastguard Worker { 6147*6a54128fSAndroid Build Coastguard Worker const char *q; 6148*6a54128fSAndroid Build Coastguard Worker size_t p_len; 6149*6a54128fSAndroid Build Coastguard Worker for (q = p; *q; q++) 6150*6a54128fSAndroid Build Coastguard Worker if (IS_PATH_SEPARATOR (*q)) 6151*6a54128fSAndroid Build Coastguard Worker break; 6152*6a54128fSAndroid Build Coastguard Worker p_len = (size_t) (q - p); 6153*6a54128fSAndroid Build Coastguard Worker p_next = (*q == '\0' ? q : q + 1); 6154*6a54128fSAndroid Build Coastguard Worker if (p_len == 0) 6155*6a54128fSAndroid Build Coastguard Worker { 6156*6a54128fSAndroid Build Coastguard Worker /* empty path: current directory */ 6157*6a54128fSAndroid Build Coastguard Worker if (getcwd (tmp, LT_PATHMAX) == NULL) 6158*6a54128fSAndroid Build Coastguard Worker lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 6159*6a54128fSAndroid Build Coastguard Worker nonnull (strerror (errno))); 6160*6a54128fSAndroid Build Coastguard Worker tmp_len = strlen (tmp); 6161*6a54128fSAndroid Build Coastguard Worker concat_name = 6162*6a54128fSAndroid Build Coastguard Worker XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 6163*6a54128fSAndroid Build Coastguard Worker memcpy (concat_name, tmp, tmp_len); 6164*6a54128fSAndroid Build Coastguard Worker concat_name[tmp_len] = '/'; 6165*6a54128fSAndroid Build Coastguard Worker strcpy (concat_name + tmp_len + 1, wrapper); 6166*6a54128fSAndroid Build Coastguard Worker } 6167*6a54128fSAndroid Build Coastguard Worker else 6168*6a54128fSAndroid Build Coastguard Worker { 6169*6a54128fSAndroid Build Coastguard Worker concat_name = 6170*6a54128fSAndroid Build Coastguard Worker XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); 6171*6a54128fSAndroid Build Coastguard Worker memcpy (concat_name, p, p_len); 6172*6a54128fSAndroid Build Coastguard Worker concat_name[p_len] = '/'; 6173*6a54128fSAndroid Build Coastguard Worker strcpy (concat_name + p_len + 1, wrapper); 6174*6a54128fSAndroid Build Coastguard Worker } 6175*6a54128fSAndroid Build Coastguard Worker if (check_executable (concat_name)) 6176*6a54128fSAndroid Build Coastguard Worker return concat_name; 6177*6a54128fSAndroid Build Coastguard Worker XFREE (concat_name); 6178*6a54128fSAndroid Build Coastguard Worker } 6179*6a54128fSAndroid Build Coastguard Worker } 6180*6a54128fSAndroid Build Coastguard Worker /* not found in PATH; assume curdir */ 6181*6a54128fSAndroid Build Coastguard Worker } 6182*6a54128fSAndroid Build Coastguard Worker /* Relative path | not found in path: prepend cwd */ 6183*6a54128fSAndroid Build Coastguard Worker if (getcwd (tmp, LT_PATHMAX) == NULL) 6184*6a54128fSAndroid Build Coastguard Worker lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", 6185*6a54128fSAndroid Build Coastguard Worker nonnull (strerror (errno))); 6186*6a54128fSAndroid Build Coastguard Worker tmp_len = strlen (tmp); 6187*6a54128fSAndroid Build Coastguard Worker concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); 6188*6a54128fSAndroid Build Coastguard Worker memcpy (concat_name, tmp, tmp_len); 6189*6a54128fSAndroid Build Coastguard Worker concat_name[tmp_len] = '/'; 6190*6a54128fSAndroid Build Coastguard Worker strcpy (concat_name + tmp_len + 1, wrapper); 6191*6a54128fSAndroid Build Coastguard Worker 6192*6a54128fSAndroid Build Coastguard Worker if (check_executable (concat_name)) 6193*6a54128fSAndroid Build Coastguard Worker return concat_name; 6194*6a54128fSAndroid Build Coastguard Worker XFREE (concat_name); 6195*6a54128fSAndroid Build Coastguard Worker return NULL; 6196*6a54128fSAndroid Build Coastguard Worker} 6197*6a54128fSAndroid Build Coastguard Worker 6198*6a54128fSAndroid Build Coastguard Workerchar * 6199*6a54128fSAndroid Build Coastguard Workerchase_symlinks (const char *pathspec) 6200*6a54128fSAndroid Build Coastguard Worker{ 6201*6a54128fSAndroid Build Coastguard Worker#ifndef S_ISLNK 6202*6a54128fSAndroid Build Coastguard Worker return xstrdup (pathspec); 6203*6a54128fSAndroid Build Coastguard Worker#else 6204*6a54128fSAndroid Build Coastguard Worker char buf[LT_PATHMAX]; 6205*6a54128fSAndroid Build Coastguard Worker struct stat s; 6206*6a54128fSAndroid Build Coastguard Worker char *tmp_pathspec = xstrdup (pathspec); 6207*6a54128fSAndroid Build Coastguard Worker char *p; 6208*6a54128fSAndroid Build Coastguard Worker int has_symlinks = 0; 6209*6a54128fSAndroid Build Coastguard Worker while (strlen (tmp_pathspec) && !has_symlinks) 6210*6a54128fSAndroid Build Coastguard Worker { 6211*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, 6212*6a54128fSAndroid Build Coastguard Worker "checking path component for symlinks: %s\n", 6213*6a54128fSAndroid Build Coastguard Worker tmp_pathspec); 6214*6a54128fSAndroid Build Coastguard Worker if (lstat (tmp_pathspec, &s) == 0) 6215*6a54128fSAndroid Build Coastguard Worker { 6216*6a54128fSAndroid Build Coastguard Worker if (S_ISLNK (s.st_mode) != 0) 6217*6a54128fSAndroid Build Coastguard Worker { 6218*6a54128fSAndroid Build Coastguard Worker has_symlinks = 1; 6219*6a54128fSAndroid Build Coastguard Worker break; 6220*6a54128fSAndroid Build Coastguard Worker } 6221*6a54128fSAndroid Build Coastguard Worker 6222*6a54128fSAndroid Build Coastguard Worker /* search backwards for last DIR_SEPARATOR */ 6223*6a54128fSAndroid Build Coastguard Worker p = tmp_pathspec + strlen (tmp_pathspec) - 1; 6224*6a54128fSAndroid Build Coastguard Worker while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 6225*6a54128fSAndroid Build Coastguard Worker p--; 6226*6a54128fSAndroid Build Coastguard Worker if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) 6227*6a54128fSAndroid Build Coastguard Worker { 6228*6a54128fSAndroid Build Coastguard Worker /* no more DIR_SEPARATORS left */ 6229*6a54128fSAndroid Build Coastguard Worker break; 6230*6a54128fSAndroid Build Coastguard Worker } 6231*6a54128fSAndroid Build Coastguard Worker *p = '\0'; 6232*6a54128fSAndroid Build Coastguard Worker } 6233*6a54128fSAndroid Build Coastguard Worker else 6234*6a54128fSAndroid Build Coastguard Worker { 6235*6a54128fSAndroid Build Coastguard Worker lt_fatal (__FILE__, __LINE__, 6236*6a54128fSAndroid Build Coastguard Worker "error accessing file \"%s\": %s", 6237*6a54128fSAndroid Build Coastguard Worker tmp_pathspec, nonnull (strerror (errno))); 6238*6a54128fSAndroid Build Coastguard Worker } 6239*6a54128fSAndroid Build Coastguard Worker } 6240*6a54128fSAndroid Build Coastguard Worker XFREE (tmp_pathspec); 6241*6a54128fSAndroid Build Coastguard Worker 6242*6a54128fSAndroid Build Coastguard Worker if (!has_symlinks) 6243*6a54128fSAndroid Build Coastguard Worker { 6244*6a54128fSAndroid Build Coastguard Worker return xstrdup (pathspec); 6245*6a54128fSAndroid Build Coastguard Worker } 6246*6a54128fSAndroid Build Coastguard Worker 6247*6a54128fSAndroid Build Coastguard Worker tmp_pathspec = realpath (pathspec, buf); 6248*6a54128fSAndroid Build Coastguard Worker if (tmp_pathspec == 0) 6249*6a54128fSAndroid Build Coastguard Worker { 6250*6a54128fSAndroid Build Coastguard Worker lt_fatal (__FILE__, __LINE__, 6251*6a54128fSAndroid Build Coastguard Worker "could not follow symlinks for %s", pathspec); 6252*6a54128fSAndroid Build Coastguard Worker } 6253*6a54128fSAndroid Build Coastguard Worker return xstrdup (tmp_pathspec); 6254*6a54128fSAndroid Build Coastguard Worker#endif 6255*6a54128fSAndroid Build Coastguard Worker} 6256*6a54128fSAndroid Build Coastguard Worker 6257*6a54128fSAndroid Build Coastguard Workerchar * 6258*6a54128fSAndroid Build Coastguard Workerstrendzap (char *str, const char *pat) 6259*6a54128fSAndroid Build Coastguard Worker{ 6260*6a54128fSAndroid Build Coastguard Worker size_t len, patlen; 6261*6a54128fSAndroid Build Coastguard Worker 6262*6a54128fSAndroid Build Coastguard Worker assert (str != NULL); 6263*6a54128fSAndroid Build Coastguard Worker assert (pat != NULL); 6264*6a54128fSAndroid Build Coastguard Worker 6265*6a54128fSAndroid Build Coastguard Worker len = strlen (str); 6266*6a54128fSAndroid Build Coastguard Worker patlen = strlen (pat); 6267*6a54128fSAndroid Build Coastguard Worker 6268*6a54128fSAndroid Build Coastguard Worker if (patlen <= len) 6269*6a54128fSAndroid Build Coastguard Worker { 6270*6a54128fSAndroid Build Coastguard Worker str += len - patlen; 6271*6a54128fSAndroid Build Coastguard Worker if (STREQ (str, pat)) 6272*6a54128fSAndroid Build Coastguard Worker *str = '\0'; 6273*6a54128fSAndroid Build Coastguard Worker } 6274*6a54128fSAndroid Build Coastguard Worker return str; 6275*6a54128fSAndroid Build Coastguard Worker} 6276*6a54128fSAndroid Build Coastguard Worker 6277*6a54128fSAndroid Build Coastguard Workervoid 6278*6a54128fSAndroid Build Coastguard Workerlt_debugprintf (const char *file, int line, const char *fmt, ...) 6279*6a54128fSAndroid Build Coastguard Worker{ 6280*6a54128fSAndroid Build Coastguard Worker va_list args; 6281*6a54128fSAndroid Build Coastguard Worker if (lt_debug) 6282*6a54128fSAndroid Build Coastguard Worker { 6283*6a54128fSAndroid Build Coastguard Worker (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); 6284*6a54128fSAndroid Build Coastguard Worker va_start (args, fmt); 6285*6a54128fSAndroid Build Coastguard Worker (void) vfprintf (stderr, fmt, args); 6286*6a54128fSAndroid Build Coastguard Worker va_end (args); 6287*6a54128fSAndroid Build Coastguard Worker } 6288*6a54128fSAndroid Build Coastguard Worker} 6289*6a54128fSAndroid Build Coastguard Worker 6290*6a54128fSAndroid Build Coastguard Workerstatic void 6291*6a54128fSAndroid Build Coastguard Workerlt_error_core (int exit_status, const char *file, 6292*6a54128fSAndroid Build Coastguard Worker int line, const char *mode, 6293*6a54128fSAndroid Build Coastguard Worker const char *message, va_list ap) 6294*6a54128fSAndroid Build Coastguard Worker{ 6295*6a54128fSAndroid Build Coastguard Worker fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); 6296*6a54128fSAndroid Build Coastguard Worker vfprintf (stderr, message, ap); 6297*6a54128fSAndroid Build Coastguard Worker fprintf (stderr, ".\n"); 6298*6a54128fSAndroid Build Coastguard Worker 6299*6a54128fSAndroid Build Coastguard Worker if (exit_status >= 0) 6300*6a54128fSAndroid Build Coastguard Worker exit (exit_status); 6301*6a54128fSAndroid Build Coastguard Worker} 6302*6a54128fSAndroid Build Coastguard Worker 6303*6a54128fSAndroid Build Coastguard Workervoid 6304*6a54128fSAndroid Build Coastguard Workerlt_fatal (const char *file, int line, const char *message, ...) 6305*6a54128fSAndroid Build Coastguard Worker{ 6306*6a54128fSAndroid Build Coastguard Worker va_list ap; 6307*6a54128fSAndroid Build Coastguard Worker va_start (ap, message); 6308*6a54128fSAndroid Build Coastguard Worker lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); 6309*6a54128fSAndroid Build Coastguard Worker va_end (ap); 6310*6a54128fSAndroid Build Coastguard Worker} 6311*6a54128fSAndroid Build Coastguard Worker 6312*6a54128fSAndroid Build Coastguard Workerstatic const char * 6313*6a54128fSAndroid Build Coastguard Workernonnull (const char *s) 6314*6a54128fSAndroid Build Coastguard Worker{ 6315*6a54128fSAndroid Build Coastguard Worker return s ? s : "(null)"; 6316*6a54128fSAndroid Build Coastguard Worker} 6317*6a54128fSAndroid Build Coastguard Worker 6318*6a54128fSAndroid Build Coastguard Workerstatic const char * 6319*6a54128fSAndroid Build Coastguard Workernonempty (const char *s) 6320*6a54128fSAndroid Build Coastguard Worker{ 6321*6a54128fSAndroid Build Coastguard Worker return (s && !*s) ? "(empty)" : nonnull (s); 6322*6a54128fSAndroid Build Coastguard Worker} 6323*6a54128fSAndroid Build Coastguard Worker 6324*6a54128fSAndroid Build Coastguard Workervoid 6325*6a54128fSAndroid Build Coastguard Workerlt_setenv (const char *name, const char *value) 6326*6a54128fSAndroid Build Coastguard Worker{ 6327*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, 6328*6a54128fSAndroid Build Coastguard Worker "(lt_setenv) setting '%s' to '%s'\n", 6329*6a54128fSAndroid Build Coastguard Worker nonnull (name), nonnull (value)); 6330*6a54128fSAndroid Build Coastguard Worker { 6331*6a54128fSAndroid Build Coastguard Worker#ifdef HAVE_SETENV 6332*6a54128fSAndroid Build Coastguard Worker /* always make a copy, for consistency with !HAVE_SETENV */ 6333*6a54128fSAndroid Build Coastguard Worker char *str = xstrdup (value); 6334*6a54128fSAndroid Build Coastguard Worker setenv (name, str, 1); 6335*6a54128fSAndroid Build Coastguard Worker#else 6336*6a54128fSAndroid Build Coastguard Worker size_t len = strlen (name) + 1 + strlen (value) + 1; 6337*6a54128fSAndroid Build Coastguard Worker char *str = XMALLOC (char, len); 6338*6a54128fSAndroid Build Coastguard Worker sprintf (str, "%s=%s", name, value); 6339*6a54128fSAndroid Build Coastguard Worker if (putenv (str) != EXIT_SUCCESS) 6340*6a54128fSAndroid Build Coastguard Worker { 6341*6a54128fSAndroid Build Coastguard Worker XFREE (str); 6342*6a54128fSAndroid Build Coastguard Worker } 6343*6a54128fSAndroid Build Coastguard Worker#endif 6344*6a54128fSAndroid Build Coastguard Worker } 6345*6a54128fSAndroid Build Coastguard Worker} 6346*6a54128fSAndroid Build Coastguard Worker 6347*6a54128fSAndroid Build Coastguard Workerchar * 6348*6a54128fSAndroid Build Coastguard Workerlt_extend_str (const char *orig_value, const char *add, int to_end) 6349*6a54128fSAndroid Build Coastguard Worker{ 6350*6a54128fSAndroid Build Coastguard Worker char *new_value; 6351*6a54128fSAndroid Build Coastguard Worker if (orig_value && *orig_value) 6352*6a54128fSAndroid Build Coastguard Worker { 6353*6a54128fSAndroid Build Coastguard Worker size_t orig_value_len = strlen (orig_value); 6354*6a54128fSAndroid Build Coastguard Worker size_t add_len = strlen (add); 6355*6a54128fSAndroid Build Coastguard Worker new_value = XMALLOC (char, add_len + orig_value_len + 1); 6356*6a54128fSAndroid Build Coastguard Worker if (to_end) 6357*6a54128fSAndroid Build Coastguard Worker { 6358*6a54128fSAndroid Build Coastguard Worker strcpy (new_value, orig_value); 6359*6a54128fSAndroid Build Coastguard Worker strcpy (new_value + orig_value_len, add); 6360*6a54128fSAndroid Build Coastguard Worker } 6361*6a54128fSAndroid Build Coastguard Worker else 6362*6a54128fSAndroid Build Coastguard Worker { 6363*6a54128fSAndroid Build Coastguard Worker strcpy (new_value, add); 6364*6a54128fSAndroid Build Coastguard Worker strcpy (new_value + add_len, orig_value); 6365*6a54128fSAndroid Build Coastguard Worker } 6366*6a54128fSAndroid Build Coastguard Worker } 6367*6a54128fSAndroid Build Coastguard Worker else 6368*6a54128fSAndroid Build Coastguard Worker { 6369*6a54128fSAndroid Build Coastguard Worker new_value = xstrdup (add); 6370*6a54128fSAndroid Build Coastguard Worker } 6371*6a54128fSAndroid Build Coastguard Worker return new_value; 6372*6a54128fSAndroid Build Coastguard Worker} 6373*6a54128fSAndroid Build Coastguard Worker 6374*6a54128fSAndroid Build Coastguard Workervoid 6375*6a54128fSAndroid Build Coastguard Workerlt_update_exe_path (const char *name, const char *value) 6376*6a54128fSAndroid Build Coastguard Worker{ 6377*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, 6378*6a54128fSAndroid Build Coastguard Worker "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", 6379*6a54128fSAndroid Build Coastguard Worker nonnull (name), nonnull (value)); 6380*6a54128fSAndroid Build Coastguard Worker 6381*6a54128fSAndroid Build Coastguard Worker if (name && *name && value && *value) 6382*6a54128fSAndroid Build Coastguard Worker { 6383*6a54128fSAndroid Build Coastguard Worker char *new_value = lt_extend_str (getenv (name), value, 0); 6384*6a54128fSAndroid Build Coastguard Worker /* some systems can't cope with a ':'-terminated path #' */ 6385*6a54128fSAndroid Build Coastguard Worker size_t len = strlen (new_value); 6386*6a54128fSAndroid Build Coastguard Worker while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) 6387*6a54128fSAndroid Build Coastguard Worker { 6388*6a54128fSAndroid Build Coastguard Worker new_value[--len] = '\0'; 6389*6a54128fSAndroid Build Coastguard Worker } 6390*6a54128fSAndroid Build Coastguard Worker lt_setenv (name, new_value); 6391*6a54128fSAndroid Build Coastguard Worker XFREE (new_value); 6392*6a54128fSAndroid Build Coastguard Worker } 6393*6a54128fSAndroid Build Coastguard Worker} 6394*6a54128fSAndroid Build Coastguard Worker 6395*6a54128fSAndroid Build Coastguard Workervoid 6396*6a54128fSAndroid Build Coastguard Workerlt_update_lib_path (const char *name, const char *value) 6397*6a54128fSAndroid Build Coastguard Worker{ 6398*6a54128fSAndroid Build Coastguard Worker lt_debugprintf (__FILE__, __LINE__, 6399*6a54128fSAndroid Build Coastguard Worker "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", 6400*6a54128fSAndroid Build Coastguard Worker nonnull (name), nonnull (value)); 6401*6a54128fSAndroid Build Coastguard Worker 6402*6a54128fSAndroid Build Coastguard Worker if (name && *name && value && *value) 6403*6a54128fSAndroid Build Coastguard Worker { 6404*6a54128fSAndroid Build Coastguard Worker char *new_value = lt_extend_str (getenv (name), value, 0); 6405*6a54128fSAndroid Build Coastguard Worker lt_setenv (name, new_value); 6406*6a54128fSAndroid Build Coastguard Worker XFREE (new_value); 6407*6a54128fSAndroid Build Coastguard Worker } 6408*6a54128fSAndroid Build Coastguard Worker} 6409*6a54128fSAndroid Build Coastguard Worker 6410*6a54128fSAndroid Build Coastguard WorkerEOF 6411*6a54128fSAndroid Build Coastguard Worker case $host_os in 6412*6a54128fSAndroid Build Coastguard Worker mingw*) 6413*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 6414*6a54128fSAndroid Build Coastguard Worker 6415*6a54128fSAndroid Build Coastguard Worker/* Prepares an argument vector before calling spawn(). 6416*6a54128fSAndroid Build Coastguard Worker Note that spawn() does not by itself call the command interpreter 6417*6a54128fSAndroid Build Coastguard Worker (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : 6418*6a54128fSAndroid Build Coastguard Worker ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 6419*6a54128fSAndroid Build Coastguard Worker GetVersionEx(&v); 6420*6a54128fSAndroid Build Coastguard Worker v.dwPlatformId == VER_PLATFORM_WIN32_NT; 6421*6a54128fSAndroid Build Coastguard Worker }) ? "cmd.exe" : "command.com"). 6422*6a54128fSAndroid Build Coastguard Worker Instead it simply concatenates the arguments, separated by ' ', and calls 6423*6a54128fSAndroid Build Coastguard Worker CreateProcess(). We must quote the arguments since Win32 CreateProcess() 6424*6a54128fSAndroid Build Coastguard Worker interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a 6425*6a54128fSAndroid Build Coastguard Worker special way: 6426*6a54128fSAndroid Build Coastguard Worker - Space and tab are interpreted as delimiters. They are not treated as 6427*6a54128fSAndroid Build Coastguard Worker delimiters if they are surrounded by double quotes: "...". 6428*6a54128fSAndroid Build Coastguard Worker - Unescaped double quotes are removed from the input. Their only effect is 6429*6a54128fSAndroid Build Coastguard Worker that within double quotes, space and tab are treated like normal 6430*6a54128fSAndroid Build Coastguard Worker characters. 6431*6a54128fSAndroid Build Coastguard Worker - Backslashes not followed by double quotes are not special. 6432*6a54128fSAndroid Build Coastguard Worker - But 2*n+1 backslashes followed by a double quote become 6433*6a54128fSAndroid Build Coastguard Worker n backslashes followed by a double quote (n >= 0): 6434*6a54128fSAndroid Build Coastguard Worker \" -> " 6435*6a54128fSAndroid Build Coastguard Worker \\\" -> \" 6436*6a54128fSAndroid Build Coastguard Worker \\\\\" -> \\" 6437*6a54128fSAndroid Build Coastguard Worker */ 6438*6a54128fSAndroid Build Coastguard Worker#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" 6439*6a54128fSAndroid Build Coastguard Worker#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" 6440*6a54128fSAndroid Build Coastguard Workerchar ** 6441*6a54128fSAndroid Build Coastguard Workerprepare_spawn (char **argv) 6442*6a54128fSAndroid Build Coastguard Worker{ 6443*6a54128fSAndroid Build Coastguard Worker size_t argc; 6444*6a54128fSAndroid Build Coastguard Worker char **new_argv; 6445*6a54128fSAndroid Build Coastguard Worker size_t i; 6446*6a54128fSAndroid Build Coastguard Worker 6447*6a54128fSAndroid Build Coastguard Worker /* Count number of arguments. */ 6448*6a54128fSAndroid Build Coastguard Worker for (argc = 0; argv[argc] != NULL; argc++) 6449*6a54128fSAndroid Build Coastguard Worker ; 6450*6a54128fSAndroid Build Coastguard Worker 6451*6a54128fSAndroid Build Coastguard Worker /* Allocate new argument vector. */ 6452*6a54128fSAndroid Build Coastguard Worker new_argv = XMALLOC (char *, argc + 1); 6453*6a54128fSAndroid Build Coastguard Worker 6454*6a54128fSAndroid Build Coastguard Worker /* Put quoted arguments into the new argument vector. */ 6455*6a54128fSAndroid Build Coastguard Worker for (i = 0; i < argc; i++) 6456*6a54128fSAndroid Build Coastguard Worker { 6457*6a54128fSAndroid Build Coastguard Worker const char *string = argv[i]; 6458*6a54128fSAndroid Build Coastguard Worker 6459*6a54128fSAndroid Build Coastguard Worker if (string[0] == '\0') 6460*6a54128fSAndroid Build Coastguard Worker new_argv[i] = xstrdup ("\"\""); 6461*6a54128fSAndroid Build Coastguard Worker else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) 6462*6a54128fSAndroid Build Coastguard Worker { 6463*6a54128fSAndroid Build Coastguard Worker int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); 6464*6a54128fSAndroid Build Coastguard Worker size_t length; 6465*6a54128fSAndroid Build Coastguard Worker unsigned int backslashes; 6466*6a54128fSAndroid Build Coastguard Worker const char *s; 6467*6a54128fSAndroid Build Coastguard Worker char *quoted_string; 6468*6a54128fSAndroid Build Coastguard Worker char *p; 6469*6a54128fSAndroid Build Coastguard Worker 6470*6a54128fSAndroid Build Coastguard Worker length = 0; 6471*6a54128fSAndroid Build Coastguard Worker backslashes = 0; 6472*6a54128fSAndroid Build Coastguard Worker if (quote_around) 6473*6a54128fSAndroid Build Coastguard Worker length++; 6474*6a54128fSAndroid Build Coastguard Worker for (s = string; *s != '\0'; s++) 6475*6a54128fSAndroid Build Coastguard Worker { 6476*6a54128fSAndroid Build Coastguard Worker char c = *s; 6477*6a54128fSAndroid Build Coastguard Worker if (c == '"') 6478*6a54128fSAndroid Build Coastguard Worker length += backslashes + 1; 6479*6a54128fSAndroid Build Coastguard Worker length++; 6480*6a54128fSAndroid Build Coastguard Worker if (c == '\\') 6481*6a54128fSAndroid Build Coastguard Worker backslashes++; 6482*6a54128fSAndroid Build Coastguard Worker else 6483*6a54128fSAndroid Build Coastguard Worker backslashes = 0; 6484*6a54128fSAndroid Build Coastguard Worker } 6485*6a54128fSAndroid Build Coastguard Worker if (quote_around) 6486*6a54128fSAndroid Build Coastguard Worker length += backslashes + 1; 6487*6a54128fSAndroid Build Coastguard Worker 6488*6a54128fSAndroid Build Coastguard Worker quoted_string = XMALLOC (char, length + 1); 6489*6a54128fSAndroid Build Coastguard Worker 6490*6a54128fSAndroid Build Coastguard Worker p = quoted_string; 6491*6a54128fSAndroid Build Coastguard Worker backslashes = 0; 6492*6a54128fSAndroid Build Coastguard Worker if (quote_around) 6493*6a54128fSAndroid Build Coastguard Worker *p++ = '"'; 6494*6a54128fSAndroid Build Coastguard Worker for (s = string; *s != '\0'; s++) 6495*6a54128fSAndroid Build Coastguard Worker { 6496*6a54128fSAndroid Build Coastguard Worker char c = *s; 6497*6a54128fSAndroid Build Coastguard Worker if (c == '"') 6498*6a54128fSAndroid Build Coastguard Worker { 6499*6a54128fSAndroid Build Coastguard Worker unsigned int j; 6500*6a54128fSAndroid Build Coastguard Worker for (j = backslashes + 1; j > 0; j--) 6501*6a54128fSAndroid Build Coastguard Worker *p++ = '\\'; 6502*6a54128fSAndroid Build Coastguard Worker } 6503*6a54128fSAndroid Build Coastguard Worker *p++ = c; 6504*6a54128fSAndroid Build Coastguard Worker if (c == '\\') 6505*6a54128fSAndroid Build Coastguard Worker backslashes++; 6506*6a54128fSAndroid Build Coastguard Worker else 6507*6a54128fSAndroid Build Coastguard Worker backslashes = 0; 6508*6a54128fSAndroid Build Coastguard Worker } 6509*6a54128fSAndroid Build Coastguard Worker if (quote_around) 6510*6a54128fSAndroid Build Coastguard Worker { 6511*6a54128fSAndroid Build Coastguard Worker unsigned int j; 6512*6a54128fSAndroid Build Coastguard Worker for (j = backslashes; j > 0; j--) 6513*6a54128fSAndroid Build Coastguard Worker *p++ = '\\'; 6514*6a54128fSAndroid Build Coastguard Worker *p++ = '"'; 6515*6a54128fSAndroid Build Coastguard Worker } 6516*6a54128fSAndroid Build Coastguard Worker *p = '\0'; 6517*6a54128fSAndroid Build Coastguard Worker 6518*6a54128fSAndroid Build Coastguard Worker new_argv[i] = quoted_string; 6519*6a54128fSAndroid Build Coastguard Worker } 6520*6a54128fSAndroid Build Coastguard Worker else 6521*6a54128fSAndroid Build Coastguard Worker new_argv[i] = (char *) string; 6522*6a54128fSAndroid Build Coastguard Worker } 6523*6a54128fSAndroid Build Coastguard Worker new_argv[argc] = NULL; 6524*6a54128fSAndroid Build Coastguard Worker 6525*6a54128fSAndroid Build Coastguard Worker return new_argv; 6526*6a54128fSAndroid Build Coastguard Worker} 6527*6a54128fSAndroid Build Coastguard WorkerEOF 6528*6a54128fSAndroid Build Coastguard Worker ;; 6529*6a54128fSAndroid Build Coastguard Worker esac 6530*6a54128fSAndroid Build Coastguard Worker 6531*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 6532*6a54128fSAndroid Build Coastguard Workervoid lt_dump_script (FILE* f) 6533*6a54128fSAndroid Build Coastguard Worker{ 6534*6a54128fSAndroid Build Coastguard WorkerEOF 6535*6a54128fSAndroid Build Coastguard Worker func_emit_wrapper yes | 6536*6a54128fSAndroid Build Coastguard Worker $SED -n -e ' 6537*6a54128fSAndroid Build Coastguard Workers/^\(.\{79\}\)\(..*\)/\1\ 6538*6a54128fSAndroid Build Coastguard Worker\2/ 6539*6a54128fSAndroid Build Coastguard Workerh 6540*6a54128fSAndroid Build Coastguard Workers/\([\\"]\)/\\\1/g 6541*6a54128fSAndroid Build Coastguard Workers/$/\\n/ 6542*6a54128fSAndroid Build Coastguard Workers/\([^\n]*\).*/ fputs ("\1", f);/p 6543*6a54128fSAndroid Build Coastguard Workerg 6544*6a54128fSAndroid Build Coastguard WorkerD' 6545*6a54128fSAndroid Build Coastguard Worker cat <<"EOF" 6546*6a54128fSAndroid Build Coastguard Worker} 6547*6a54128fSAndroid Build Coastguard WorkerEOF 6548*6a54128fSAndroid Build Coastguard Worker} 6549*6a54128fSAndroid Build Coastguard Worker# end: func_emit_cwrapperexe_src 6550*6a54128fSAndroid Build Coastguard Worker 6551*6a54128fSAndroid Build Coastguard Worker# func_win32_import_lib_p ARG 6552*6a54128fSAndroid Build Coastguard Worker# True if ARG is an import lib, as indicated by $file_magic_cmd 6553*6a54128fSAndroid Build Coastguard Workerfunc_win32_import_lib_p () 6554*6a54128fSAndroid Build Coastguard Worker{ 6555*6a54128fSAndroid Build Coastguard Worker $debug_cmd 6556*6a54128fSAndroid Build Coastguard Worker 6557*6a54128fSAndroid Build Coastguard Worker case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in 6558*6a54128fSAndroid Build Coastguard Worker *import*) : ;; 6559*6a54128fSAndroid Build Coastguard Worker *) false ;; 6560*6a54128fSAndroid Build Coastguard Worker esac 6561*6a54128fSAndroid Build Coastguard Worker} 6562*6a54128fSAndroid Build Coastguard Worker 6563*6a54128fSAndroid Build Coastguard Worker# func_suncc_cstd_abi 6564*6a54128fSAndroid Build Coastguard Worker# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! 6565*6a54128fSAndroid Build Coastguard Worker# Several compiler flags select an ABI that is incompatible with the 6566*6a54128fSAndroid Build Coastguard Worker# Cstd library. Avoid specifying it if any are in CXXFLAGS. 6567*6a54128fSAndroid Build Coastguard Workerfunc_suncc_cstd_abi () 6568*6a54128fSAndroid Build Coastguard Worker{ 6569*6a54128fSAndroid Build Coastguard Worker $debug_cmd 6570*6a54128fSAndroid Build Coastguard Worker 6571*6a54128fSAndroid Build Coastguard Worker case " $compile_command " in 6572*6a54128fSAndroid Build Coastguard Worker *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) 6573*6a54128fSAndroid Build Coastguard Worker suncc_use_cstd_abi=no 6574*6a54128fSAndroid Build Coastguard Worker ;; 6575*6a54128fSAndroid Build Coastguard Worker *) 6576*6a54128fSAndroid Build Coastguard Worker suncc_use_cstd_abi=yes 6577*6a54128fSAndroid Build Coastguard Worker ;; 6578*6a54128fSAndroid Build Coastguard Worker esac 6579*6a54128fSAndroid Build Coastguard Worker} 6580*6a54128fSAndroid Build Coastguard Worker 6581*6a54128fSAndroid Build Coastguard Worker# func_mode_link arg... 6582*6a54128fSAndroid Build Coastguard Workerfunc_mode_link () 6583*6a54128fSAndroid Build Coastguard Worker{ 6584*6a54128fSAndroid Build Coastguard Worker $debug_cmd 6585*6a54128fSAndroid Build Coastguard Worker 6586*6a54128fSAndroid Build Coastguard Worker case $host in 6587*6a54128fSAndroid Build Coastguard Worker *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 6588*6a54128fSAndroid Build Coastguard Worker # It is impossible to link a dll without this setting, and 6589*6a54128fSAndroid Build Coastguard Worker # we shouldn't force the makefile maintainer to figure out 6590*6a54128fSAndroid Build Coastguard Worker # what system we are compiling for in order to pass an extra 6591*6a54128fSAndroid Build Coastguard Worker # flag for every libtool invocation. 6592*6a54128fSAndroid Build Coastguard Worker # allow_undefined=no 6593*6a54128fSAndroid Build Coastguard Worker 6594*6a54128fSAndroid Build Coastguard Worker # FIXME: Unfortunately, there are problems with the above when trying 6595*6a54128fSAndroid Build Coastguard Worker # to make a dll that has undefined symbols, in which case not 6596*6a54128fSAndroid Build Coastguard Worker # even a static library is built. For now, we need to specify 6597*6a54128fSAndroid Build Coastguard Worker # -no-undefined on the libtool link line when we can be certain 6598*6a54128fSAndroid Build Coastguard Worker # that all symbols are satisfied, otherwise we get a static library. 6599*6a54128fSAndroid Build Coastguard Worker allow_undefined=yes 6600*6a54128fSAndroid Build Coastguard Worker ;; 6601*6a54128fSAndroid Build Coastguard Worker *) 6602*6a54128fSAndroid Build Coastguard Worker allow_undefined=yes 6603*6a54128fSAndroid Build Coastguard Worker ;; 6604*6a54128fSAndroid Build Coastguard Worker esac 6605*6a54128fSAndroid Build Coastguard Worker libtool_args=$nonopt 6606*6a54128fSAndroid Build Coastguard Worker base_compile="$nonopt $@" 6607*6a54128fSAndroid Build Coastguard Worker compile_command=$nonopt 6608*6a54128fSAndroid Build Coastguard Worker finalize_command=$nonopt 6609*6a54128fSAndroid Build Coastguard Worker 6610*6a54128fSAndroid Build Coastguard Worker compile_rpath= 6611*6a54128fSAndroid Build Coastguard Worker finalize_rpath= 6612*6a54128fSAndroid Build Coastguard Worker compile_shlibpath= 6613*6a54128fSAndroid Build Coastguard Worker finalize_shlibpath= 6614*6a54128fSAndroid Build Coastguard Worker convenience= 6615*6a54128fSAndroid Build Coastguard Worker old_convenience= 6616*6a54128fSAndroid Build Coastguard Worker deplibs= 6617*6a54128fSAndroid Build Coastguard Worker old_deplibs= 6618*6a54128fSAndroid Build Coastguard Worker compiler_flags= 6619*6a54128fSAndroid Build Coastguard Worker linker_flags= 6620*6a54128fSAndroid Build Coastguard Worker dllsearchpath= 6621*6a54128fSAndroid Build Coastguard Worker lib_search_path=`pwd` 6622*6a54128fSAndroid Build Coastguard Worker inst_prefix_dir= 6623*6a54128fSAndroid Build Coastguard Worker new_inherited_linker_flags= 6624*6a54128fSAndroid Build Coastguard Worker 6625*6a54128fSAndroid Build Coastguard Worker avoid_version=no 6626*6a54128fSAndroid Build Coastguard Worker bindir= 6627*6a54128fSAndroid Build Coastguard Worker dlfiles= 6628*6a54128fSAndroid Build Coastguard Worker dlprefiles= 6629*6a54128fSAndroid Build Coastguard Worker dlself=no 6630*6a54128fSAndroid Build Coastguard Worker export_dynamic=no 6631*6a54128fSAndroid Build Coastguard Worker export_symbols= 6632*6a54128fSAndroid Build Coastguard Worker export_symbols_regex= 6633*6a54128fSAndroid Build Coastguard Worker generated= 6634*6a54128fSAndroid Build Coastguard Worker libobjs= 6635*6a54128fSAndroid Build Coastguard Worker ltlibs= 6636*6a54128fSAndroid Build Coastguard Worker module=no 6637*6a54128fSAndroid Build Coastguard Worker no_install=no 6638*6a54128fSAndroid Build Coastguard Worker objs= 6639*6a54128fSAndroid Build Coastguard Worker os2dllname= 6640*6a54128fSAndroid Build Coastguard Worker non_pic_objects= 6641*6a54128fSAndroid Build Coastguard Worker precious_files_regex= 6642*6a54128fSAndroid Build Coastguard Worker prefer_static_libs=no 6643*6a54128fSAndroid Build Coastguard Worker preload=false 6644*6a54128fSAndroid Build Coastguard Worker prev= 6645*6a54128fSAndroid Build Coastguard Worker prevarg= 6646*6a54128fSAndroid Build Coastguard Worker release= 6647*6a54128fSAndroid Build Coastguard Worker rpath= 6648*6a54128fSAndroid Build Coastguard Worker xrpath= 6649*6a54128fSAndroid Build Coastguard Worker perm_rpath= 6650*6a54128fSAndroid Build Coastguard Worker temp_rpath= 6651*6a54128fSAndroid Build Coastguard Worker thread_safe=no 6652*6a54128fSAndroid Build Coastguard Worker vinfo= 6653*6a54128fSAndroid Build Coastguard Worker vinfo_number=no 6654*6a54128fSAndroid Build Coastguard Worker weak_libs= 6655*6a54128fSAndroid Build Coastguard Worker single_module=$wl-single_module 6656*6a54128fSAndroid Build Coastguard Worker func_infer_tag $base_compile 6657*6a54128fSAndroid Build Coastguard Worker 6658*6a54128fSAndroid Build Coastguard Worker # We need to know -static, to get the right output filenames. 6659*6a54128fSAndroid Build Coastguard Worker for arg 6660*6a54128fSAndroid Build Coastguard Worker do 6661*6a54128fSAndroid Build Coastguard Worker case $arg in 6662*6a54128fSAndroid Build Coastguard Worker -shared) 6663*6a54128fSAndroid Build Coastguard Worker test yes != "$build_libtool_libs" \ 6664*6a54128fSAndroid Build Coastguard Worker && func_fatal_configuration "cannot build a shared library" 6665*6a54128fSAndroid Build Coastguard Worker build_old_libs=no 6666*6a54128fSAndroid Build Coastguard Worker break 6667*6a54128fSAndroid Build Coastguard Worker ;; 6668*6a54128fSAndroid Build Coastguard Worker -all-static | -static | -static-libtool-libs) 6669*6a54128fSAndroid Build Coastguard Worker case $arg in 6670*6a54128fSAndroid Build Coastguard Worker -all-static) 6671*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then 6672*6a54128fSAndroid Build Coastguard Worker func_warning "complete static linking is impossible in this configuration" 6673*6a54128fSAndroid Build Coastguard Worker fi 6674*6a54128fSAndroid Build Coastguard Worker if test -n "$link_static_flag"; then 6675*6a54128fSAndroid Build Coastguard Worker dlopen_self=$dlopen_self_static 6676*6a54128fSAndroid Build Coastguard Worker fi 6677*6a54128fSAndroid Build Coastguard Worker prefer_static_libs=yes 6678*6a54128fSAndroid Build Coastguard Worker ;; 6679*6a54128fSAndroid Build Coastguard Worker -static) 6680*6a54128fSAndroid Build Coastguard Worker if test -z "$pic_flag" && test -n "$link_static_flag"; then 6681*6a54128fSAndroid Build Coastguard Worker dlopen_self=$dlopen_self_static 6682*6a54128fSAndroid Build Coastguard Worker fi 6683*6a54128fSAndroid Build Coastguard Worker prefer_static_libs=built 6684*6a54128fSAndroid Build Coastguard Worker ;; 6685*6a54128fSAndroid Build Coastguard Worker -static-libtool-libs) 6686*6a54128fSAndroid Build Coastguard Worker if test -z "$pic_flag" && test -n "$link_static_flag"; then 6687*6a54128fSAndroid Build Coastguard Worker dlopen_self=$dlopen_self_static 6688*6a54128fSAndroid Build Coastguard Worker fi 6689*6a54128fSAndroid Build Coastguard Worker prefer_static_libs=yes 6690*6a54128fSAndroid Build Coastguard Worker ;; 6691*6a54128fSAndroid Build Coastguard Worker esac 6692*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=no 6693*6a54128fSAndroid Build Coastguard Worker build_old_libs=yes 6694*6a54128fSAndroid Build Coastguard Worker break 6695*6a54128fSAndroid Build Coastguard Worker ;; 6696*6a54128fSAndroid Build Coastguard Worker esac 6697*6a54128fSAndroid Build Coastguard Worker done 6698*6a54128fSAndroid Build Coastguard Worker 6699*6a54128fSAndroid Build Coastguard Worker # See if our shared archives depend on static archives. 6700*6a54128fSAndroid Build Coastguard Worker test -n "$old_archive_from_new_cmds" && build_old_libs=yes 6701*6a54128fSAndroid Build Coastguard Worker 6702*6a54128fSAndroid Build Coastguard Worker # Go through the arguments, transforming them on the way. 6703*6a54128fSAndroid Build Coastguard Worker while test "$#" -gt 0; do 6704*6a54128fSAndroid Build Coastguard Worker arg=$1 6705*6a54128fSAndroid Build Coastguard Worker shift 6706*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$arg" 6707*6a54128fSAndroid Build Coastguard Worker qarg=$func_quote_for_eval_unquoted_result 6708*6a54128fSAndroid Build Coastguard Worker func_append libtool_args " $func_quote_for_eval_result" 6709*6a54128fSAndroid Build Coastguard Worker 6710*6a54128fSAndroid Build Coastguard Worker # If the previous option needs an argument, assign it. 6711*6a54128fSAndroid Build Coastguard Worker if test -n "$prev"; then 6712*6a54128fSAndroid Build Coastguard Worker case $prev in 6713*6a54128fSAndroid Build Coastguard Worker output) 6714*6a54128fSAndroid Build Coastguard Worker func_append compile_command " @OUTPUT@" 6715*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " @OUTPUT@" 6716*6a54128fSAndroid Build Coastguard Worker ;; 6717*6a54128fSAndroid Build Coastguard Worker esac 6718*6a54128fSAndroid Build Coastguard Worker 6719*6a54128fSAndroid Build Coastguard Worker case $prev in 6720*6a54128fSAndroid Build Coastguard Worker bindir) 6721*6a54128fSAndroid Build Coastguard Worker bindir=$arg 6722*6a54128fSAndroid Build Coastguard Worker prev= 6723*6a54128fSAndroid Build Coastguard Worker continue 6724*6a54128fSAndroid Build Coastguard Worker ;; 6725*6a54128fSAndroid Build Coastguard Worker dlfiles|dlprefiles) 6726*6a54128fSAndroid Build Coastguard Worker $preload || { 6727*6a54128fSAndroid Build Coastguard Worker # Add the symbol object into the linking commands. 6728*6a54128fSAndroid Build Coastguard Worker func_append compile_command " @SYMFILE@" 6729*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " @SYMFILE@" 6730*6a54128fSAndroid Build Coastguard Worker preload=: 6731*6a54128fSAndroid Build Coastguard Worker } 6732*6a54128fSAndroid Build Coastguard Worker case $arg in 6733*6a54128fSAndroid Build Coastguard Worker *.la | *.lo) ;; # We handle these cases below. 6734*6a54128fSAndroid Build Coastguard Worker force) 6735*6a54128fSAndroid Build Coastguard Worker if test no = "$dlself"; then 6736*6a54128fSAndroid Build Coastguard Worker dlself=needless 6737*6a54128fSAndroid Build Coastguard Worker export_dynamic=yes 6738*6a54128fSAndroid Build Coastguard Worker fi 6739*6a54128fSAndroid Build Coastguard Worker prev= 6740*6a54128fSAndroid Build Coastguard Worker continue 6741*6a54128fSAndroid Build Coastguard Worker ;; 6742*6a54128fSAndroid Build Coastguard Worker self) 6743*6a54128fSAndroid Build Coastguard Worker if test dlprefiles = "$prev"; then 6744*6a54128fSAndroid Build Coastguard Worker dlself=yes 6745*6a54128fSAndroid Build Coastguard Worker elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then 6746*6a54128fSAndroid Build Coastguard Worker dlself=yes 6747*6a54128fSAndroid Build Coastguard Worker else 6748*6a54128fSAndroid Build Coastguard Worker dlself=needless 6749*6a54128fSAndroid Build Coastguard Worker export_dynamic=yes 6750*6a54128fSAndroid Build Coastguard Worker fi 6751*6a54128fSAndroid Build Coastguard Worker prev= 6752*6a54128fSAndroid Build Coastguard Worker continue 6753*6a54128fSAndroid Build Coastguard Worker ;; 6754*6a54128fSAndroid Build Coastguard Worker *) 6755*6a54128fSAndroid Build Coastguard Worker if test dlfiles = "$prev"; then 6756*6a54128fSAndroid Build Coastguard Worker func_append dlfiles " $arg" 6757*6a54128fSAndroid Build Coastguard Worker else 6758*6a54128fSAndroid Build Coastguard Worker func_append dlprefiles " $arg" 6759*6a54128fSAndroid Build Coastguard Worker fi 6760*6a54128fSAndroid Build Coastguard Worker prev= 6761*6a54128fSAndroid Build Coastguard Worker continue 6762*6a54128fSAndroid Build Coastguard Worker ;; 6763*6a54128fSAndroid Build Coastguard Worker esac 6764*6a54128fSAndroid Build Coastguard Worker ;; 6765*6a54128fSAndroid Build Coastguard Worker expsyms) 6766*6a54128fSAndroid Build Coastguard Worker export_symbols=$arg 6767*6a54128fSAndroid Build Coastguard Worker test -f "$arg" \ 6768*6a54128fSAndroid Build Coastguard Worker || func_fatal_error "symbol file '$arg' does not exist" 6769*6a54128fSAndroid Build Coastguard Worker prev= 6770*6a54128fSAndroid Build Coastguard Worker continue 6771*6a54128fSAndroid Build Coastguard Worker ;; 6772*6a54128fSAndroid Build Coastguard Worker expsyms_regex) 6773*6a54128fSAndroid Build Coastguard Worker export_symbols_regex=$arg 6774*6a54128fSAndroid Build Coastguard Worker prev= 6775*6a54128fSAndroid Build Coastguard Worker continue 6776*6a54128fSAndroid Build Coastguard Worker ;; 6777*6a54128fSAndroid Build Coastguard Worker framework) 6778*6a54128fSAndroid Build Coastguard Worker case $host in 6779*6a54128fSAndroid Build Coastguard Worker *-*-darwin*) 6780*6a54128fSAndroid Build Coastguard Worker case "$deplibs " in 6781*6a54128fSAndroid Build Coastguard Worker *" $qarg.ltframework "*) ;; 6782*6a54128fSAndroid Build Coastguard Worker *) func_append deplibs " $qarg.ltframework" # this is fixed later 6783*6a54128fSAndroid Build Coastguard Worker ;; 6784*6a54128fSAndroid Build Coastguard Worker esac 6785*6a54128fSAndroid Build Coastguard Worker ;; 6786*6a54128fSAndroid Build Coastguard Worker esac 6787*6a54128fSAndroid Build Coastguard Worker prev= 6788*6a54128fSAndroid Build Coastguard Worker continue 6789*6a54128fSAndroid Build Coastguard Worker ;; 6790*6a54128fSAndroid Build Coastguard Worker inst_prefix) 6791*6a54128fSAndroid Build Coastguard Worker inst_prefix_dir=$arg 6792*6a54128fSAndroid Build Coastguard Worker prev= 6793*6a54128fSAndroid Build Coastguard Worker continue 6794*6a54128fSAndroid Build Coastguard Worker ;; 6795*6a54128fSAndroid Build Coastguard Worker mllvm) 6796*6a54128fSAndroid Build Coastguard Worker # Clang does not use LLVM to link, so we can simply discard any 6797*6a54128fSAndroid Build Coastguard Worker # '-mllvm $arg' options when doing the link step. 6798*6a54128fSAndroid Build Coastguard Worker prev= 6799*6a54128fSAndroid Build Coastguard Worker continue 6800*6a54128fSAndroid Build Coastguard Worker ;; 6801*6a54128fSAndroid Build Coastguard Worker objectlist) 6802*6a54128fSAndroid Build Coastguard Worker if test -f "$arg"; then 6803*6a54128fSAndroid Build Coastguard Worker save_arg=$arg 6804*6a54128fSAndroid Build Coastguard Worker moreargs= 6805*6a54128fSAndroid Build Coastguard Worker for fil in `cat "$save_arg"` 6806*6a54128fSAndroid Build Coastguard Worker do 6807*6a54128fSAndroid Build Coastguard Worker# func_append moreargs " $fil" 6808*6a54128fSAndroid Build Coastguard Worker arg=$fil 6809*6a54128fSAndroid Build Coastguard Worker # A libtool-controlled object. 6810*6a54128fSAndroid Build Coastguard Worker 6811*6a54128fSAndroid Build Coastguard Worker # Check to see that this really is a libtool object. 6812*6a54128fSAndroid Build Coastguard Worker if func_lalib_unsafe_p "$arg"; then 6813*6a54128fSAndroid Build Coastguard Worker pic_object= 6814*6a54128fSAndroid Build Coastguard Worker non_pic_object= 6815*6a54128fSAndroid Build Coastguard Worker 6816*6a54128fSAndroid Build Coastguard Worker # Read the .lo file 6817*6a54128fSAndroid Build Coastguard Worker func_source "$arg" 6818*6a54128fSAndroid Build Coastguard Worker 6819*6a54128fSAndroid Build Coastguard Worker if test -z "$pic_object" || 6820*6a54128fSAndroid Build Coastguard Worker test -z "$non_pic_object" || 6821*6a54128fSAndroid Build Coastguard Worker test none = "$pic_object" && 6822*6a54128fSAndroid Build Coastguard Worker test none = "$non_pic_object"; then 6823*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot find name of object for '$arg'" 6824*6a54128fSAndroid Build Coastguard Worker fi 6825*6a54128fSAndroid Build Coastguard Worker 6826*6a54128fSAndroid Build Coastguard Worker # Extract subdirectory from the argument. 6827*6a54128fSAndroid Build Coastguard Worker func_dirname "$arg" "/" "" 6828*6a54128fSAndroid Build Coastguard Worker xdir=$func_dirname_result 6829*6a54128fSAndroid Build Coastguard Worker 6830*6a54128fSAndroid Build Coastguard Worker if test none != "$pic_object"; then 6831*6a54128fSAndroid Build Coastguard Worker # Prepend the subdirectory the object is found in. 6832*6a54128fSAndroid Build Coastguard Worker pic_object=$xdir$pic_object 6833*6a54128fSAndroid Build Coastguard Worker 6834*6a54128fSAndroid Build Coastguard Worker if test dlfiles = "$prev"; then 6835*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then 6836*6a54128fSAndroid Build Coastguard Worker func_append dlfiles " $pic_object" 6837*6a54128fSAndroid Build Coastguard Worker prev= 6838*6a54128fSAndroid Build Coastguard Worker continue 6839*6a54128fSAndroid Build Coastguard Worker else 6840*6a54128fSAndroid Build Coastguard Worker # If libtool objects are unsupported, then we need to preload. 6841*6a54128fSAndroid Build Coastguard Worker prev=dlprefiles 6842*6a54128fSAndroid Build Coastguard Worker fi 6843*6a54128fSAndroid Build Coastguard Worker fi 6844*6a54128fSAndroid Build Coastguard Worker 6845*6a54128fSAndroid Build Coastguard Worker # CHECK ME: I think I busted this. -Ossama 6846*6a54128fSAndroid Build Coastguard Worker if test dlprefiles = "$prev"; then 6847*6a54128fSAndroid Build Coastguard Worker # Preload the old-style object. 6848*6a54128fSAndroid Build Coastguard Worker func_append dlprefiles " $pic_object" 6849*6a54128fSAndroid Build Coastguard Worker prev= 6850*6a54128fSAndroid Build Coastguard Worker fi 6851*6a54128fSAndroid Build Coastguard Worker 6852*6a54128fSAndroid Build Coastguard Worker # A PIC object. 6853*6a54128fSAndroid Build Coastguard Worker func_append libobjs " $pic_object" 6854*6a54128fSAndroid Build Coastguard Worker arg=$pic_object 6855*6a54128fSAndroid Build Coastguard Worker fi 6856*6a54128fSAndroid Build Coastguard Worker 6857*6a54128fSAndroid Build Coastguard Worker # Non-PIC object. 6858*6a54128fSAndroid Build Coastguard Worker if test none != "$non_pic_object"; then 6859*6a54128fSAndroid Build Coastguard Worker # Prepend the subdirectory the object is found in. 6860*6a54128fSAndroid Build Coastguard Worker non_pic_object=$xdir$non_pic_object 6861*6a54128fSAndroid Build Coastguard Worker 6862*6a54128fSAndroid Build Coastguard Worker # A standard non-PIC object 6863*6a54128fSAndroid Build Coastguard Worker func_append non_pic_objects " $non_pic_object" 6864*6a54128fSAndroid Build Coastguard Worker if test -z "$pic_object" || test none = "$pic_object"; then 6865*6a54128fSAndroid Build Coastguard Worker arg=$non_pic_object 6866*6a54128fSAndroid Build Coastguard Worker fi 6867*6a54128fSAndroid Build Coastguard Worker else 6868*6a54128fSAndroid Build Coastguard Worker # If the PIC object exists, use it instead. 6869*6a54128fSAndroid Build Coastguard Worker # $xdir was prepended to $pic_object above. 6870*6a54128fSAndroid Build Coastguard Worker non_pic_object=$pic_object 6871*6a54128fSAndroid Build Coastguard Worker func_append non_pic_objects " $non_pic_object" 6872*6a54128fSAndroid Build Coastguard Worker fi 6873*6a54128fSAndroid Build Coastguard Worker else 6874*6a54128fSAndroid Build Coastguard Worker # Only an error if not doing a dry-run. 6875*6a54128fSAndroid Build Coastguard Worker if $opt_dry_run; then 6876*6a54128fSAndroid Build Coastguard Worker # Extract subdirectory from the argument. 6877*6a54128fSAndroid Build Coastguard Worker func_dirname "$arg" "/" "" 6878*6a54128fSAndroid Build Coastguard Worker xdir=$func_dirname_result 6879*6a54128fSAndroid Build Coastguard Worker 6880*6a54128fSAndroid Build Coastguard Worker func_lo2o "$arg" 6881*6a54128fSAndroid Build Coastguard Worker pic_object=$xdir$objdir/$func_lo2o_result 6882*6a54128fSAndroid Build Coastguard Worker non_pic_object=$xdir$func_lo2o_result 6883*6a54128fSAndroid Build Coastguard Worker func_append libobjs " $pic_object" 6884*6a54128fSAndroid Build Coastguard Worker func_append non_pic_objects " $non_pic_object" 6885*6a54128fSAndroid Build Coastguard Worker else 6886*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$arg' is not a valid libtool object" 6887*6a54128fSAndroid Build Coastguard Worker fi 6888*6a54128fSAndroid Build Coastguard Worker fi 6889*6a54128fSAndroid Build Coastguard Worker done 6890*6a54128fSAndroid Build Coastguard Worker else 6891*6a54128fSAndroid Build Coastguard Worker func_fatal_error "link input file '$arg' does not exist" 6892*6a54128fSAndroid Build Coastguard Worker fi 6893*6a54128fSAndroid Build Coastguard Worker arg=$save_arg 6894*6a54128fSAndroid Build Coastguard Worker prev= 6895*6a54128fSAndroid Build Coastguard Worker continue 6896*6a54128fSAndroid Build Coastguard Worker ;; 6897*6a54128fSAndroid Build Coastguard Worker os2dllname) 6898*6a54128fSAndroid Build Coastguard Worker os2dllname=$arg 6899*6a54128fSAndroid Build Coastguard Worker prev= 6900*6a54128fSAndroid Build Coastguard Worker continue 6901*6a54128fSAndroid Build Coastguard Worker ;; 6902*6a54128fSAndroid Build Coastguard Worker precious_regex) 6903*6a54128fSAndroid Build Coastguard Worker precious_files_regex=$arg 6904*6a54128fSAndroid Build Coastguard Worker prev= 6905*6a54128fSAndroid Build Coastguard Worker continue 6906*6a54128fSAndroid Build Coastguard Worker ;; 6907*6a54128fSAndroid Build Coastguard Worker release) 6908*6a54128fSAndroid Build Coastguard Worker release=-$arg 6909*6a54128fSAndroid Build Coastguard Worker prev= 6910*6a54128fSAndroid Build Coastguard Worker continue 6911*6a54128fSAndroid Build Coastguard Worker ;; 6912*6a54128fSAndroid Build Coastguard Worker rpath | xrpath) 6913*6a54128fSAndroid Build Coastguard Worker # We need an absolute path. 6914*6a54128fSAndroid Build Coastguard Worker case $arg in 6915*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) ;; 6916*6a54128fSAndroid Build Coastguard Worker *) 6917*6a54128fSAndroid Build Coastguard Worker func_fatal_error "only absolute run-paths are allowed" 6918*6a54128fSAndroid Build Coastguard Worker ;; 6919*6a54128fSAndroid Build Coastguard Worker esac 6920*6a54128fSAndroid Build Coastguard Worker if test rpath = "$prev"; then 6921*6a54128fSAndroid Build Coastguard Worker case "$rpath " in 6922*6a54128fSAndroid Build Coastguard Worker *" $arg "*) ;; 6923*6a54128fSAndroid Build Coastguard Worker *) func_append rpath " $arg" ;; 6924*6a54128fSAndroid Build Coastguard Worker esac 6925*6a54128fSAndroid Build Coastguard Worker else 6926*6a54128fSAndroid Build Coastguard Worker case "$xrpath " in 6927*6a54128fSAndroid Build Coastguard Worker *" $arg "*) ;; 6928*6a54128fSAndroid Build Coastguard Worker *) func_append xrpath " $arg" ;; 6929*6a54128fSAndroid Build Coastguard Worker esac 6930*6a54128fSAndroid Build Coastguard Worker fi 6931*6a54128fSAndroid Build Coastguard Worker prev= 6932*6a54128fSAndroid Build Coastguard Worker continue 6933*6a54128fSAndroid Build Coastguard Worker ;; 6934*6a54128fSAndroid Build Coastguard Worker shrext) 6935*6a54128fSAndroid Build Coastguard Worker shrext_cmds=$arg 6936*6a54128fSAndroid Build Coastguard Worker prev= 6937*6a54128fSAndroid Build Coastguard Worker continue 6938*6a54128fSAndroid Build Coastguard Worker ;; 6939*6a54128fSAndroid Build Coastguard Worker weak) 6940*6a54128fSAndroid Build Coastguard Worker func_append weak_libs " $arg" 6941*6a54128fSAndroid Build Coastguard Worker prev= 6942*6a54128fSAndroid Build Coastguard Worker continue 6943*6a54128fSAndroid Build Coastguard Worker ;; 6944*6a54128fSAndroid Build Coastguard Worker xcclinker) 6945*6a54128fSAndroid Build Coastguard Worker func_append linker_flags " $qarg" 6946*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $qarg" 6947*6a54128fSAndroid Build Coastguard Worker prev= 6948*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $qarg" 6949*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $qarg" 6950*6a54128fSAndroid Build Coastguard Worker continue 6951*6a54128fSAndroid Build Coastguard Worker ;; 6952*6a54128fSAndroid Build Coastguard Worker xcompiler) 6953*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $qarg" 6954*6a54128fSAndroid Build Coastguard Worker prev= 6955*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $qarg" 6956*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $qarg" 6957*6a54128fSAndroid Build Coastguard Worker continue 6958*6a54128fSAndroid Build Coastguard Worker ;; 6959*6a54128fSAndroid Build Coastguard Worker xlinker) 6960*6a54128fSAndroid Build Coastguard Worker func_append linker_flags " $qarg" 6961*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $wl$qarg" 6962*6a54128fSAndroid Build Coastguard Worker prev= 6963*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $wl$qarg" 6964*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $wl$qarg" 6965*6a54128fSAndroid Build Coastguard Worker continue 6966*6a54128fSAndroid Build Coastguard Worker ;; 6967*6a54128fSAndroid Build Coastguard Worker *) 6968*6a54128fSAndroid Build Coastguard Worker eval "$prev=\"\$arg\"" 6969*6a54128fSAndroid Build Coastguard Worker prev= 6970*6a54128fSAndroid Build Coastguard Worker continue 6971*6a54128fSAndroid Build Coastguard Worker ;; 6972*6a54128fSAndroid Build Coastguard Worker esac 6973*6a54128fSAndroid Build Coastguard Worker fi # test -n "$prev" 6974*6a54128fSAndroid Build Coastguard Worker 6975*6a54128fSAndroid Build Coastguard Worker prevarg=$arg 6976*6a54128fSAndroid Build Coastguard Worker 6977*6a54128fSAndroid Build Coastguard Worker case $arg in 6978*6a54128fSAndroid Build Coastguard Worker -all-static) 6979*6a54128fSAndroid Build Coastguard Worker if test -n "$link_static_flag"; then 6980*6a54128fSAndroid Build Coastguard Worker # See comment for -static flag below, for more details. 6981*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $link_static_flag" 6982*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $link_static_flag" 6983*6a54128fSAndroid Build Coastguard Worker fi 6984*6a54128fSAndroid Build Coastguard Worker continue 6985*6a54128fSAndroid Build Coastguard Worker ;; 6986*6a54128fSAndroid Build Coastguard Worker 6987*6a54128fSAndroid Build Coastguard Worker -allow-undefined) 6988*6a54128fSAndroid Build Coastguard Worker # FIXME: remove this flag sometime in the future. 6989*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'-allow-undefined' must not be used because it is the default" 6990*6a54128fSAndroid Build Coastguard Worker ;; 6991*6a54128fSAndroid Build Coastguard Worker 6992*6a54128fSAndroid Build Coastguard Worker -avoid-version) 6993*6a54128fSAndroid Build Coastguard Worker avoid_version=yes 6994*6a54128fSAndroid Build Coastguard Worker continue 6995*6a54128fSAndroid Build Coastguard Worker ;; 6996*6a54128fSAndroid Build Coastguard Worker 6997*6a54128fSAndroid Build Coastguard Worker -bindir) 6998*6a54128fSAndroid Build Coastguard Worker prev=bindir 6999*6a54128fSAndroid Build Coastguard Worker continue 7000*6a54128fSAndroid Build Coastguard Worker ;; 7001*6a54128fSAndroid Build Coastguard Worker 7002*6a54128fSAndroid Build Coastguard Worker -dlopen) 7003*6a54128fSAndroid Build Coastguard Worker prev=dlfiles 7004*6a54128fSAndroid Build Coastguard Worker continue 7005*6a54128fSAndroid Build Coastguard Worker ;; 7006*6a54128fSAndroid Build Coastguard Worker 7007*6a54128fSAndroid Build Coastguard Worker -dlpreopen) 7008*6a54128fSAndroid Build Coastguard Worker prev=dlprefiles 7009*6a54128fSAndroid Build Coastguard Worker continue 7010*6a54128fSAndroid Build Coastguard Worker ;; 7011*6a54128fSAndroid Build Coastguard Worker 7012*6a54128fSAndroid Build Coastguard Worker -export-dynamic) 7013*6a54128fSAndroid Build Coastguard Worker export_dynamic=yes 7014*6a54128fSAndroid Build Coastguard Worker continue 7015*6a54128fSAndroid Build Coastguard Worker ;; 7016*6a54128fSAndroid Build Coastguard Worker 7017*6a54128fSAndroid Build Coastguard Worker -export-symbols | -export-symbols-regex) 7018*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 7019*6a54128fSAndroid Build Coastguard Worker func_fatal_error "more than one -exported-symbols argument is not allowed" 7020*6a54128fSAndroid Build Coastguard Worker fi 7021*6a54128fSAndroid Build Coastguard Worker if test X-export-symbols = "X$arg"; then 7022*6a54128fSAndroid Build Coastguard Worker prev=expsyms 7023*6a54128fSAndroid Build Coastguard Worker else 7024*6a54128fSAndroid Build Coastguard Worker prev=expsyms_regex 7025*6a54128fSAndroid Build Coastguard Worker fi 7026*6a54128fSAndroid Build Coastguard Worker continue 7027*6a54128fSAndroid Build Coastguard Worker ;; 7028*6a54128fSAndroid Build Coastguard Worker 7029*6a54128fSAndroid Build Coastguard Worker -framework) 7030*6a54128fSAndroid Build Coastguard Worker prev=framework 7031*6a54128fSAndroid Build Coastguard Worker continue 7032*6a54128fSAndroid Build Coastguard Worker ;; 7033*6a54128fSAndroid Build Coastguard Worker 7034*6a54128fSAndroid Build Coastguard Worker -inst-prefix-dir) 7035*6a54128fSAndroid Build Coastguard Worker prev=inst_prefix 7036*6a54128fSAndroid Build Coastguard Worker continue 7037*6a54128fSAndroid Build Coastguard Worker ;; 7038*6a54128fSAndroid Build Coastguard Worker 7039*6a54128fSAndroid Build Coastguard Worker # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 7040*6a54128fSAndroid Build Coastguard Worker # so, if we see these flags be careful not to treat them like -L 7041*6a54128fSAndroid Build Coastguard Worker -L[A-Z][A-Z]*:*) 7042*6a54128fSAndroid Build Coastguard Worker case $with_gcc/$host in 7043*6a54128fSAndroid Build Coastguard Worker no/*-*-irix* | /*-*-irix*) 7044*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $arg" 7045*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $arg" 7046*6a54128fSAndroid Build Coastguard Worker ;; 7047*6a54128fSAndroid Build Coastguard Worker esac 7048*6a54128fSAndroid Build Coastguard Worker continue 7049*6a54128fSAndroid Build Coastguard Worker ;; 7050*6a54128fSAndroid Build Coastguard Worker 7051*6a54128fSAndroid Build Coastguard Worker -L*) 7052*6a54128fSAndroid Build Coastguard Worker func_stripname "-L" '' "$arg" 7053*6a54128fSAndroid Build Coastguard Worker if test -z "$func_stripname_result"; then 7054*6a54128fSAndroid Build Coastguard Worker if test "$#" -gt 0; then 7055*6a54128fSAndroid Build Coastguard Worker func_fatal_error "require no space between '-L' and '$1'" 7056*6a54128fSAndroid Build Coastguard Worker else 7057*6a54128fSAndroid Build Coastguard Worker func_fatal_error "need path for '-L' option" 7058*6a54128fSAndroid Build Coastguard Worker fi 7059*6a54128fSAndroid Build Coastguard Worker fi 7060*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$func_stripname_result" 7061*6a54128fSAndroid Build Coastguard Worker dir=$func_resolve_sysroot_result 7062*6a54128fSAndroid Build Coastguard Worker # We need an absolute path. 7063*6a54128fSAndroid Build Coastguard Worker case $dir in 7064*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) ;; 7065*6a54128fSAndroid Build Coastguard Worker *) 7066*6a54128fSAndroid Build Coastguard Worker absdir=`cd "$dir" && pwd` 7067*6a54128fSAndroid Build Coastguard Worker test -z "$absdir" && \ 7068*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot determine absolute directory name of '$dir'" 7069*6a54128fSAndroid Build Coastguard Worker dir=$absdir 7070*6a54128fSAndroid Build Coastguard Worker ;; 7071*6a54128fSAndroid Build Coastguard Worker esac 7072*6a54128fSAndroid Build Coastguard Worker case "$deplibs " in 7073*6a54128fSAndroid Build Coastguard Worker *" -L$dir "* | *" $arg "*) 7074*6a54128fSAndroid Build Coastguard Worker # Will only happen for absolute or sysroot arguments 7075*6a54128fSAndroid Build Coastguard Worker ;; 7076*6a54128fSAndroid Build Coastguard Worker *) 7077*6a54128fSAndroid Build Coastguard Worker # Preserve sysroot, but never include relative directories 7078*6a54128fSAndroid Build Coastguard Worker case $dir in 7079*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; 7080*6a54128fSAndroid Build Coastguard Worker *) func_append deplibs " -L$dir" ;; 7081*6a54128fSAndroid Build Coastguard Worker esac 7082*6a54128fSAndroid Build Coastguard Worker func_append lib_search_path " $dir" 7083*6a54128fSAndroid Build Coastguard Worker ;; 7084*6a54128fSAndroid Build Coastguard Worker esac 7085*6a54128fSAndroid Build Coastguard Worker case $host in 7086*6a54128fSAndroid Build Coastguard Worker *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 7087*6a54128fSAndroid Build Coastguard Worker testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` 7088*6a54128fSAndroid Build Coastguard Worker case :$dllsearchpath: in 7089*6a54128fSAndroid Build Coastguard Worker *":$dir:"*) ;; 7090*6a54128fSAndroid Build Coastguard Worker ::) dllsearchpath=$dir;; 7091*6a54128fSAndroid Build Coastguard Worker *) func_append dllsearchpath ":$dir";; 7092*6a54128fSAndroid Build Coastguard Worker esac 7093*6a54128fSAndroid Build Coastguard Worker case :$dllsearchpath: in 7094*6a54128fSAndroid Build Coastguard Worker *":$testbindir:"*) ;; 7095*6a54128fSAndroid Build Coastguard Worker ::) dllsearchpath=$testbindir;; 7096*6a54128fSAndroid Build Coastguard Worker *) func_append dllsearchpath ":$testbindir";; 7097*6a54128fSAndroid Build Coastguard Worker esac 7098*6a54128fSAndroid Build Coastguard Worker ;; 7099*6a54128fSAndroid Build Coastguard Worker esac 7100*6a54128fSAndroid Build Coastguard Worker continue 7101*6a54128fSAndroid Build Coastguard Worker ;; 7102*6a54128fSAndroid Build Coastguard Worker 7103*6a54128fSAndroid Build Coastguard Worker -l*) 7104*6a54128fSAndroid Build Coastguard Worker if test X-lc = "X$arg" || test X-lm = "X$arg"; then 7105*6a54128fSAndroid Build Coastguard Worker case $host in 7106*6a54128fSAndroid Build Coastguard Worker *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) 7107*6a54128fSAndroid Build Coastguard Worker # These systems don't actually have a C or math library (as such) 7108*6a54128fSAndroid Build Coastguard Worker continue 7109*6a54128fSAndroid Build Coastguard Worker ;; 7110*6a54128fSAndroid Build Coastguard Worker *-*-os2*) 7111*6a54128fSAndroid Build Coastguard Worker # These systems don't actually have a C library (as such) 7112*6a54128fSAndroid Build Coastguard Worker test X-lc = "X$arg" && continue 7113*6a54128fSAndroid Build Coastguard Worker ;; 7114*6a54128fSAndroid Build Coastguard Worker *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) 7115*6a54128fSAndroid Build Coastguard Worker # Do not include libc due to us having libc/libc_r. 7116*6a54128fSAndroid Build Coastguard Worker test X-lc = "X$arg" && continue 7117*6a54128fSAndroid Build Coastguard Worker ;; 7118*6a54128fSAndroid Build Coastguard Worker *-*-rhapsody* | *-*-darwin1.[012]) 7119*6a54128fSAndroid Build Coastguard Worker # Rhapsody C and math libraries are in the System framework 7120*6a54128fSAndroid Build Coastguard Worker func_append deplibs " System.ltframework" 7121*6a54128fSAndroid Build Coastguard Worker continue 7122*6a54128fSAndroid Build Coastguard Worker ;; 7123*6a54128fSAndroid Build Coastguard Worker *-*-sco3.2v5* | *-*-sco5v6*) 7124*6a54128fSAndroid Build Coastguard Worker # Causes problems with __ctype 7125*6a54128fSAndroid Build Coastguard Worker test X-lc = "X$arg" && continue 7126*6a54128fSAndroid Build Coastguard Worker ;; 7127*6a54128fSAndroid Build Coastguard Worker *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 7128*6a54128fSAndroid Build Coastguard Worker # Compiler inserts libc in the correct place for threads to work 7129*6a54128fSAndroid Build Coastguard Worker test X-lc = "X$arg" && continue 7130*6a54128fSAndroid Build Coastguard Worker ;; 7131*6a54128fSAndroid Build Coastguard Worker esac 7132*6a54128fSAndroid Build Coastguard Worker elif test X-lc_r = "X$arg"; then 7133*6a54128fSAndroid Build Coastguard Worker case $host in 7134*6a54128fSAndroid Build Coastguard Worker *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) 7135*6a54128fSAndroid Build Coastguard Worker # Do not include libc_r directly, use -pthread flag. 7136*6a54128fSAndroid Build Coastguard Worker continue 7137*6a54128fSAndroid Build Coastguard Worker ;; 7138*6a54128fSAndroid Build Coastguard Worker esac 7139*6a54128fSAndroid Build Coastguard Worker fi 7140*6a54128fSAndroid Build Coastguard Worker func_append deplibs " $arg" 7141*6a54128fSAndroid Build Coastguard Worker continue 7142*6a54128fSAndroid Build Coastguard Worker ;; 7143*6a54128fSAndroid Build Coastguard Worker 7144*6a54128fSAndroid Build Coastguard Worker -mllvm) 7145*6a54128fSAndroid Build Coastguard Worker prev=mllvm 7146*6a54128fSAndroid Build Coastguard Worker continue 7147*6a54128fSAndroid Build Coastguard Worker ;; 7148*6a54128fSAndroid Build Coastguard Worker 7149*6a54128fSAndroid Build Coastguard Worker -module) 7150*6a54128fSAndroid Build Coastguard Worker module=yes 7151*6a54128fSAndroid Build Coastguard Worker continue 7152*6a54128fSAndroid Build Coastguard Worker ;; 7153*6a54128fSAndroid Build Coastguard Worker 7154*6a54128fSAndroid Build Coastguard Worker # Tru64 UNIX uses -model [arg] to determine the layout of C++ 7155*6a54128fSAndroid Build Coastguard Worker # classes, name mangling, and exception handling. 7156*6a54128fSAndroid Build Coastguard Worker # Darwin uses the -arch flag to determine output architecture. 7157*6a54128fSAndroid Build Coastguard Worker -model|-arch|-isysroot|--sysroot) 7158*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $arg" 7159*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $arg" 7160*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $arg" 7161*6a54128fSAndroid Build Coastguard Worker prev=xcompiler 7162*6a54128fSAndroid Build Coastguard Worker continue 7163*6a54128fSAndroid Build Coastguard Worker ;; 7164*6a54128fSAndroid Build Coastguard Worker 7165*6a54128fSAndroid Build Coastguard Worker -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ 7166*6a54128fSAndroid Build Coastguard Worker |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 7167*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $arg" 7168*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $arg" 7169*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $arg" 7170*6a54128fSAndroid Build Coastguard Worker case "$new_inherited_linker_flags " in 7171*6a54128fSAndroid Build Coastguard Worker *" $arg "*) ;; 7172*6a54128fSAndroid Build Coastguard Worker * ) func_append new_inherited_linker_flags " $arg" ;; 7173*6a54128fSAndroid Build Coastguard Worker esac 7174*6a54128fSAndroid Build Coastguard Worker continue 7175*6a54128fSAndroid Build Coastguard Worker ;; 7176*6a54128fSAndroid Build Coastguard Worker 7177*6a54128fSAndroid Build Coastguard Worker -multi_module) 7178*6a54128fSAndroid Build Coastguard Worker single_module=$wl-multi_module 7179*6a54128fSAndroid Build Coastguard Worker continue 7180*6a54128fSAndroid Build Coastguard Worker ;; 7181*6a54128fSAndroid Build Coastguard Worker 7182*6a54128fSAndroid Build Coastguard Worker -no-fast-install) 7183*6a54128fSAndroid Build Coastguard Worker fast_install=no 7184*6a54128fSAndroid Build Coastguard Worker continue 7185*6a54128fSAndroid Build Coastguard Worker ;; 7186*6a54128fSAndroid Build Coastguard Worker 7187*6a54128fSAndroid Build Coastguard Worker -no-install) 7188*6a54128fSAndroid Build Coastguard Worker case $host in 7189*6a54128fSAndroid Build Coastguard Worker *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) 7190*6a54128fSAndroid Build Coastguard Worker # The PATH hackery in wrapper scripts is required on Windows 7191*6a54128fSAndroid Build Coastguard Worker # and Darwin in order for the loader to find any dlls it needs. 7192*6a54128fSAndroid Build Coastguard Worker func_warning "'-no-install' is ignored for $host" 7193*6a54128fSAndroid Build Coastguard Worker func_warning "assuming '-no-fast-install' instead" 7194*6a54128fSAndroid Build Coastguard Worker fast_install=no 7195*6a54128fSAndroid Build Coastguard Worker ;; 7196*6a54128fSAndroid Build Coastguard Worker *) no_install=yes ;; 7197*6a54128fSAndroid Build Coastguard Worker esac 7198*6a54128fSAndroid Build Coastguard Worker continue 7199*6a54128fSAndroid Build Coastguard Worker ;; 7200*6a54128fSAndroid Build Coastguard Worker 7201*6a54128fSAndroid Build Coastguard Worker -no-undefined) 7202*6a54128fSAndroid Build Coastguard Worker allow_undefined=no 7203*6a54128fSAndroid Build Coastguard Worker continue 7204*6a54128fSAndroid Build Coastguard Worker ;; 7205*6a54128fSAndroid Build Coastguard Worker 7206*6a54128fSAndroid Build Coastguard Worker -objectlist) 7207*6a54128fSAndroid Build Coastguard Worker prev=objectlist 7208*6a54128fSAndroid Build Coastguard Worker continue 7209*6a54128fSAndroid Build Coastguard Worker ;; 7210*6a54128fSAndroid Build Coastguard Worker 7211*6a54128fSAndroid Build Coastguard Worker -os2dllname) 7212*6a54128fSAndroid Build Coastguard Worker prev=os2dllname 7213*6a54128fSAndroid Build Coastguard Worker continue 7214*6a54128fSAndroid Build Coastguard Worker ;; 7215*6a54128fSAndroid Build Coastguard Worker 7216*6a54128fSAndroid Build Coastguard Worker -o) prev=output ;; 7217*6a54128fSAndroid Build Coastguard Worker 7218*6a54128fSAndroid Build Coastguard Worker -precious-files-regex) 7219*6a54128fSAndroid Build Coastguard Worker prev=precious_regex 7220*6a54128fSAndroid Build Coastguard Worker continue 7221*6a54128fSAndroid Build Coastguard Worker ;; 7222*6a54128fSAndroid Build Coastguard Worker 7223*6a54128fSAndroid Build Coastguard Worker -release) 7224*6a54128fSAndroid Build Coastguard Worker prev=release 7225*6a54128fSAndroid Build Coastguard Worker continue 7226*6a54128fSAndroid Build Coastguard Worker ;; 7227*6a54128fSAndroid Build Coastguard Worker 7228*6a54128fSAndroid Build Coastguard Worker -rpath) 7229*6a54128fSAndroid Build Coastguard Worker prev=rpath 7230*6a54128fSAndroid Build Coastguard Worker continue 7231*6a54128fSAndroid Build Coastguard Worker ;; 7232*6a54128fSAndroid Build Coastguard Worker 7233*6a54128fSAndroid Build Coastguard Worker -R) 7234*6a54128fSAndroid Build Coastguard Worker prev=xrpath 7235*6a54128fSAndroid Build Coastguard Worker continue 7236*6a54128fSAndroid Build Coastguard Worker ;; 7237*6a54128fSAndroid Build Coastguard Worker 7238*6a54128fSAndroid Build Coastguard Worker -R*) 7239*6a54128fSAndroid Build Coastguard Worker func_stripname '-R' '' "$arg" 7240*6a54128fSAndroid Build Coastguard Worker dir=$func_stripname_result 7241*6a54128fSAndroid Build Coastguard Worker # We need an absolute path. 7242*6a54128fSAndroid Build Coastguard Worker case $dir in 7243*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) ;; 7244*6a54128fSAndroid Build Coastguard Worker =*) 7245*6a54128fSAndroid Build Coastguard Worker func_stripname '=' '' "$dir" 7246*6a54128fSAndroid Build Coastguard Worker dir=$lt_sysroot$func_stripname_result 7247*6a54128fSAndroid Build Coastguard Worker ;; 7248*6a54128fSAndroid Build Coastguard Worker *) 7249*6a54128fSAndroid Build Coastguard Worker func_fatal_error "only absolute run-paths are allowed" 7250*6a54128fSAndroid Build Coastguard Worker ;; 7251*6a54128fSAndroid Build Coastguard Worker esac 7252*6a54128fSAndroid Build Coastguard Worker case "$xrpath " in 7253*6a54128fSAndroid Build Coastguard Worker *" $dir "*) ;; 7254*6a54128fSAndroid Build Coastguard Worker *) func_append xrpath " $dir" ;; 7255*6a54128fSAndroid Build Coastguard Worker esac 7256*6a54128fSAndroid Build Coastguard Worker continue 7257*6a54128fSAndroid Build Coastguard Worker ;; 7258*6a54128fSAndroid Build Coastguard Worker 7259*6a54128fSAndroid Build Coastguard Worker -shared) 7260*6a54128fSAndroid Build Coastguard Worker # The effects of -shared are defined in a previous loop. 7261*6a54128fSAndroid Build Coastguard Worker continue 7262*6a54128fSAndroid Build Coastguard Worker ;; 7263*6a54128fSAndroid Build Coastguard Worker 7264*6a54128fSAndroid Build Coastguard Worker -shrext) 7265*6a54128fSAndroid Build Coastguard Worker prev=shrext 7266*6a54128fSAndroid Build Coastguard Worker continue 7267*6a54128fSAndroid Build Coastguard Worker ;; 7268*6a54128fSAndroid Build Coastguard Worker 7269*6a54128fSAndroid Build Coastguard Worker -static | -static-libtool-libs) 7270*6a54128fSAndroid Build Coastguard Worker # The effects of -static are defined in a previous loop. 7271*6a54128fSAndroid Build Coastguard Worker # We used to do the same as -all-static on platforms that 7272*6a54128fSAndroid Build Coastguard Worker # didn't have a PIC flag, but the assumption that the effects 7273*6a54128fSAndroid Build Coastguard Worker # would be equivalent was wrong. It would break on at least 7274*6a54128fSAndroid Build Coastguard Worker # Digital Unix and AIX. 7275*6a54128fSAndroid Build Coastguard Worker continue 7276*6a54128fSAndroid Build Coastguard Worker ;; 7277*6a54128fSAndroid Build Coastguard Worker 7278*6a54128fSAndroid Build Coastguard Worker -thread-safe) 7279*6a54128fSAndroid Build Coastguard Worker thread_safe=yes 7280*6a54128fSAndroid Build Coastguard Worker continue 7281*6a54128fSAndroid Build Coastguard Worker ;; 7282*6a54128fSAndroid Build Coastguard Worker 7283*6a54128fSAndroid Build Coastguard Worker -version-info) 7284*6a54128fSAndroid Build Coastguard Worker prev=vinfo 7285*6a54128fSAndroid Build Coastguard Worker continue 7286*6a54128fSAndroid Build Coastguard Worker ;; 7287*6a54128fSAndroid Build Coastguard Worker 7288*6a54128fSAndroid Build Coastguard Worker -version-number) 7289*6a54128fSAndroid Build Coastguard Worker prev=vinfo 7290*6a54128fSAndroid Build Coastguard Worker vinfo_number=yes 7291*6a54128fSAndroid Build Coastguard Worker continue 7292*6a54128fSAndroid Build Coastguard Worker ;; 7293*6a54128fSAndroid Build Coastguard Worker 7294*6a54128fSAndroid Build Coastguard Worker -weak) 7295*6a54128fSAndroid Build Coastguard Worker prev=weak 7296*6a54128fSAndroid Build Coastguard Worker continue 7297*6a54128fSAndroid Build Coastguard Worker ;; 7298*6a54128fSAndroid Build Coastguard Worker 7299*6a54128fSAndroid Build Coastguard Worker -Wc,*) 7300*6a54128fSAndroid Build Coastguard Worker func_stripname '-Wc,' '' "$arg" 7301*6a54128fSAndroid Build Coastguard Worker args=$func_stripname_result 7302*6a54128fSAndroid Build Coastguard Worker arg= 7303*6a54128fSAndroid Build Coastguard Worker save_ifs=$IFS; IFS=, 7304*6a54128fSAndroid Build Coastguard Worker for flag in $args; do 7305*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 7306*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$flag" 7307*6a54128fSAndroid Build Coastguard Worker func_append arg " $func_quote_for_eval_result" 7308*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $func_quote_for_eval_result" 7309*6a54128fSAndroid Build Coastguard Worker done 7310*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 7311*6a54128fSAndroid Build Coastguard Worker func_stripname ' ' '' "$arg" 7312*6a54128fSAndroid Build Coastguard Worker arg=$func_stripname_result 7313*6a54128fSAndroid Build Coastguard Worker ;; 7314*6a54128fSAndroid Build Coastguard Worker 7315*6a54128fSAndroid Build Coastguard Worker -Wl,*) 7316*6a54128fSAndroid Build Coastguard Worker func_stripname '-Wl,' '' "$arg" 7317*6a54128fSAndroid Build Coastguard Worker args=$func_stripname_result 7318*6a54128fSAndroid Build Coastguard Worker arg= 7319*6a54128fSAndroid Build Coastguard Worker save_ifs=$IFS; IFS=, 7320*6a54128fSAndroid Build Coastguard Worker for flag in $args; do 7321*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 7322*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$flag" 7323*6a54128fSAndroid Build Coastguard Worker func_append arg " $wl$func_quote_for_eval_result" 7324*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $wl$func_quote_for_eval_result" 7325*6a54128fSAndroid Build Coastguard Worker func_append linker_flags " $func_quote_for_eval_result" 7326*6a54128fSAndroid Build Coastguard Worker done 7327*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 7328*6a54128fSAndroid Build Coastguard Worker func_stripname ' ' '' "$arg" 7329*6a54128fSAndroid Build Coastguard Worker arg=$func_stripname_result 7330*6a54128fSAndroid Build Coastguard Worker ;; 7331*6a54128fSAndroid Build Coastguard Worker 7332*6a54128fSAndroid Build Coastguard Worker -Xcompiler) 7333*6a54128fSAndroid Build Coastguard Worker prev=xcompiler 7334*6a54128fSAndroid Build Coastguard Worker continue 7335*6a54128fSAndroid Build Coastguard Worker ;; 7336*6a54128fSAndroid Build Coastguard Worker 7337*6a54128fSAndroid Build Coastguard Worker -Xlinker) 7338*6a54128fSAndroid Build Coastguard Worker prev=xlinker 7339*6a54128fSAndroid Build Coastguard Worker continue 7340*6a54128fSAndroid Build Coastguard Worker ;; 7341*6a54128fSAndroid Build Coastguard Worker 7342*6a54128fSAndroid Build Coastguard Worker -XCClinker) 7343*6a54128fSAndroid Build Coastguard Worker prev=xcclinker 7344*6a54128fSAndroid Build Coastguard Worker continue 7345*6a54128fSAndroid Build Coastguard Worker ;; 7346*6a54128fSAndroid Build Coastguard Worker 7347*6a54128fSAndroid Build Coastguard Worker # -msg_* for osf cc 7348*6a54128fSAndroid Build Coastguard Worker -msg_*) 7349*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$arg" 7350*6a54128fSAndroid Build Coastguard Worker arg=$func_quote_for_eval_result 7351*6a54128fSAndroid Build Coastguard Worker ;; 7352*6a54128fSAndroid Build Coastguard Worker 7353*6a54128fSAndroid Build Coastguard Worker # Flags to be passed through unchanged, with rationale: 7354*6a54128fSAndroid Build Coastguard Worker # -64, -mips[0-9] enable 64-bit mode for the SGI compiler 7355*6a54128fSAndroid Build Coastguard Worker # -r[0-9][0-9]* specify processor for the SGI compiler 7356*6a54128fSAndroid Build Coastguard Worker # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler 7357*6a54128fSAndroid Build Coastguard Worker # +DA*, +DD* enable 64-bit mode for the HP compiler 7358*6a54128fSAndroid Build Coastguard Worker # -q* compiler args for the IBM compiler 7359*6a54128fSAndroid Build Coastguard Worker # -m*, -t[45]*, -txscale* architecture-specific flags for GCC 7360*6a54128fSAndroid Build Coastguard Worker # -F/path path to uninstalled frameworks, gcc on darwin 7361*6a54128fSAndroid Build Coastguard Worker # -p, -pg, --coverage, -fprofile-* profiling flags for GCC 7362*6a54128fSAndroid Build Coastguard Worker # -fstack-protector* stack protector flags for GCC 7363*6a54128fSAndroid Build Coastguard Worker # @file GCC response files 7364*6a54128fSAndroid Build Coastguard Worker # -tp=* Portland pgcc target processor selection 7365*6a54128fSAndroid Build Coastguard Worker # --sysroot=* for sysroot support 7366*6a54128fSAndroid Build Coastguard Worker # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization 7367*6a54128fSAndroid Build Coastguard Worker # -specs=* GCC specs files 7368*6a54128fSAndroid Build Coastguard Worker # -stdlib=* select c++ std lib with clang 7369*6a54128fSAndroid Build Coastguard Worker # -fsanitize=* Clang/GCC memory and address sanitizer 7370*6a54128fSAndroid Build Coastguard Worker # -fuse-ld=* Linker select flags for GCC 7371*6a54128fSAndroid Build Coastguard Worker -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 7372*6a54128fSAndroid Build Coastguard Worker -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ 7373*6a54128fSAndroid Build Coastguard Worker -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ 7374*6a54128fSAndroid Build Coastguard Worker -specs=*|-fsanitize=*|-fuse-ld=*) 7375*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$arg" 7376*6a54128fSAndroid Build Coastguard Worker arg=$func_quote_for_eval_result 7377*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $arg" 7378*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $arg" 7379*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $arg" 7380*6a54128fSAndroid Build Coastguard Worker continue 7381*6a54128fSAndroid Build Coastguard Worker ;; 7382*6a54128fSAndroid Build Coastguard Worker 7383*6a54128fSAndroid Build Coastguard Worker -Z*) 7384*6a54128fSAndroid Build Coastguard Worker if test os2 = "`expr $host : '.*\(os2\)'`"; then 7385*6a54128fSAndroid Build Coastguard Worker # OS/2 uses -Zxxx to specify OS/2-specific options 7386*6a54128fSAndroid Build Coastguard Worker compiler_flags="$compiler_flags $arg" 7387*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $arg" 7388*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $arg" 7389*6a54128fSAndroid Build Coastguard Worker case $arg in 7390*6a54128fSAndroid Build Coastguard Worker -Zlinker | -Zstack) 7391*6a54128fSAndroid Build Coastguard Worker prev=xcompiler 7392*6a54128fSAndroid Build Coastguard Worker ;; 7393*6a54128fSAndroid Build Coastguard Worker esac 7394*6a54128fSAndroid Build Coastguard Worker continue 7395*6a54128fSAndroid Build Coastguard Worker else 7396*6a54128fSAndroid Build Coastguard Worker # Otherwise treat like 'Some other compiler flag' below 7397*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$arg" 7398*6a54128fSAndroid Build Coastguard Worker arg=$func_quote_for_eval_result 7399*6a54128fSAndroid Build Coastguard Worker fi 7400*6a54128fSAndroid Build Coastguard Worker ;; 7401*6a54128fSAndroid Build Coastguard Worker 7402*6a54128fSAndroid Build Coastguard Worker # Some other compiler flag. 7403*6a54128fSAndroid Build Coastguard Worker -* | +*) 7404*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$arg" 7405*6a54128fSAndroid Build Coastguard Worker arg=$func_quote_for_eval_result 7406*6a54128fSAndroid Build Coastguard Worker ;; 7407*6a54128fSAndroid Build Coastguard Worker 7408*6a54128fSAndroid Build Coastguard Worker *.$objext) 7409*6a54128fSAndroid Build Coastguard Worker # A standard object. 7410*6a54128fSAndroid Build Coastguard Worker func_append objs " $arg" 7411*6a54128fSAndroid Build Coastguard Worker ;; 7412*6a54128fSAndroid Build Coastguard Worker 7413*6a54128fSAndroid Build Coastguard Worker *.lo) 7414*6a54128fSAndroid Build Coastguard Worker # A libtool-controlled object. 7415*6a54128fSAndroid Build Coastguard Worker 7416*6a54128fSAndroid Build Coastguard Worker # Check to see that this really is a libtool object. 7417*6a54128fSAndroid Build Coastguard Worker if func_lalib_unsafe_p "$arg"; then 7418*6a54128fSAndroid Build Coastguard Worker pic_object= 7419*6a54128fSAndroid Build Coastguard Worker non_pic_object= 7420*6a54128fSAndroid Build Coastguard Worker 7421*6a54128fSAndroid Build Coastguard Worker # Read the .lo file 7422*6a54128fSAndroid Build Coastguard Worker func_source "$arg" 7423*6a54128fSAndroid Build Coastguard Worker 7424*6a54128fSAndroid Build Coastguard Worker if test -z "$pic_object" || 7425*6a54128fSAndroid Build Coastguard Worker test -z "$non_pic_object" || 7426*6a54128fSAndroid Build Coastguard Worker test none = "$pic_object" && 7427*6a54128fSAndroid Build Coastguard Worker test none = "$non_pic_object"; then 7428*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot find name of object for '$arg'" 7429*6a54128fSAndroid Build Coastguard Worker fi 7430*6a54128fSAndroid Build Coastguard Worker 7431*6a54128fSAndroid Build Coastguard Worker # Extract subdirectory from the argument. 7432*6a54128fSAndroid Build Coastguard Worker func_dirname "$arg" "/" "" 7433*6a54128fSAndroid Build Coastguard Worker xdir=$func_dirname_result 7434*6a54128fSAndroid Build Coastguard Worker 7435*6a54128fSAndroid Build Coastguard Worker test none = "$pic_object" || { 7436*6a54128fSAndroid Build Coastguard Worker # Prepend the subdirectory the object is found in. 7437*6a54128fSAndroid Build Coastguard Worker pic_object=$xdir$pic_object 7438*6a54128fSAndroid Build Coastguard Worker 7439*6a54128fSAndroid Build Coastguard Worker if test dlfiles = "$prev"; then 7440*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then 7441*6a54128fSAndroid Build Coastguard Worker func_append dlfiles " $pic_object" 7442*6a54128fSAndroid Build Coastguard Worker prev= 7443*6a54128fSAndroid Build Coastguard Worker continue 7444*6a54128fSAndroid Build Coastguard Worker else 7445*6a54128fSAndroid Build Coastguard Worker # If libtool objects are unsupported, then we need to preload. 7446*6a54128fSAndroid Build Coastguard Worker prev=dlprefiles 7447*6a54128fSAndroid Build Coastguard Worker fi 7448*6a54128fSAndroid Build Coastguard Worker fi 7449*6a54128fSAndroid Build Coastguard Worker 7450*6a54128fSAndroid Build Coastguard Worker # CHECK ME: I think I busted this. -Ossama 7451*6a54128fSAndroid Build Coastguard Worker if test dlprefiles = "$prev"; then 7452*6a54128fSAndroid Build Coastguard Worker # Preload the old-style object. 7453*6a54128fSAndroid Build Coastguard Worker func_append dlprefiles " $pic_object" 7454*6a54128fSAndroid Build Coastguard Worker prev= 7455*6a54128fSAndroid Build Coastguard Worker fi 7456*6a54128fSAndroid Build Coastguard Worker 7457*6a54128fSAndroid Build Coastguard Worker # A PIC object. 7458*6a54128fSAndroid Build Coastguard Worker func_append libobjs " $pic_object" 7459*6a54128fSAndroid Build Coastguard Worker arg=$pic_object 7460*6a54128fSAndroid Build Coastguard Worker } 7461*6a54128fSAndroid Build Coastguard Worker 7462*6a54128fSAndroid Build Coastguard Worker # Non-PIC object. 7463*6a54128fSAndroid Build Coastguard Worker if test none != "$non_pic_object"; then 7464*6a54128fSAndroid Build Coastguard Worker # Prepend the subdirectory the object is found in. 7465*6a54128fSAndroid Build Coastguard Worker non_pic_object=$xdir$non_pic_object 7466*6a54128fSAndroid Build Coastguard Worker 7467*6a54128fSAndroid Build Coastguard Worker # A standard non-PIC object 7468*6a54128fSAndroid Build Coastguard Worker func_append non_pic_objects " $non_pic_object" 7469*6a54128fSAndroid Build Coastguard Worker if test -z "$pic_object" || test none = "$pic_object"; then 7470*6a54128fSAndroid Build Coastguard Worker arg=$non_pic_object 7471*6a54128fSAndroid Build Coastguard Worker fi 7472*6a54128fSAndroid Build Coastguard Worker else 7473*6a54128fSAndroid Build Coastguard Worker # If the PIC object exists, use it instead. 7474*6a54128fSAndroid Build Coastguard Worker # $xdir was prepended to $pic_object above. 7475*6a54128fSAndroid Build Coastguard Worker non_pic_object=$pic_object 7476*6a54128fSAndroid Build Coastguard Worker func_append non_pic_objects " $non_pic_object" 7477*6a54128fSAndroid Build Coastguard Worker fi 7478*6a54128fSAndroid Build Coastguard Worker else 7479*6a54128fSAndroid Build Coastguard Worker # Only an error if not doing a dry-run. 7480*6a54128fSAndroid Build Coastguard Worker if $opt_dry_run; then 7481*6a54128fSAndroid Build Coastguard Worker # Extract subdirectory from the argument. 7482*6a54128fSAndroid Build Coastguard Worker func_dirname "$arg" "/" "" 7483*6a54128fSAndroid Build Coastguard Worker xdir=$func_dirname_result 7484*6a54128fSAndroid Build Coastguard Worker 7485*6a54128fSAndroid Build Coastguard Worker func_lo2o "$arg" 7486*6a54128fSAndroid Build Coastguard Worker pic_object=$xdir$objdir/$func_lo2o_result 7487*6a54128fSAndroid Build Coastguard Worker non_pic_object=$xdir$func_lo2o_result 7488*6a54128fSAndroid Build Coastguard Worker func_append libobjs " $pic_object" 7489*6a54128fSAndroid Build Coastguard Worker func_append non_pic_objects " $non_pic_object" 7490*6a54128fSAndroid Build Coastguard Worker else 7491*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$arg' is not a valid libtool object" 7492*6a54128fSAndroid Build Coastguard Worker fi 7493*6a54128fSAndroid Build Coastguard Worker fi 7494*6a54128fSAndroid Build Coastguard Worker ;; 7495*6a54128fSAndroid Build Coastguard Worker 7496*6a54128fSAndroid Build Coastguard Worker *.$libext) 7497*6a54128fSAndroid Build Coastguard Worker # An archive. 7498*6a54128fSAndroid Build Coastguard Worker func_append deplibs " $arg" 7499*6a54128fSAndroid Build Coastguard Worker func_append old_deplibs " $arg" 7500*6a54128fSAndroid Build Coastguard Worker continue 7501*6a54128fSAndroid Build Coastguard Worker ;; 7502*6a54128fSAndroid Build Coastguard Worker 7503*6a54128fSAndroid Build Coastguard Worker *.la) 7504*6a54128fSAndroid Build Coastguard Worker # A libtool-controlled library. 7505*6a54128fSAndroid Build Coastguard Worker 7506*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$arg" 7507*6a54128fSAndroid Build Coastguard Worker if test dlfiles = "$prev"; then 7508*6a54128fSAndroid Build Coastguard Worker # This library was specified with -dlopen. 7509*6a54128fSAndroid Build Coastguard Worker func_append dlfiles " $func_resolve_sysroot_result" 7510*6a54128fSAndroid Build Coastguard Worker prev= 7511*6a54128fSAndroid Build Coastguard Worker elif test dlprefiles = "$prev"; then 7512*6a54128fSAndroid Build Coastguard Worker # The library was specified with -dlpreopen. 7513*6a54128fSAndroid Build Coastguard Worker func_append dlprefiles " $func_resolve_sysroot_result" 7514*6a54128fSAndroid Build Coastguard Worker prev= 7515*6a54128fSAndroid Build Coastguard Worker else 7516*6a54128fSAndroid Build Coastguard Worker func_append deplibs " $func_resolve_sysroot_result" 7517*6a54128fSAndroid Build Coastguard Worker fi 7518*6a54128fSAndroid Build Coastguard Worker continue 7519*6a54128fSAndroid Build Coastguard Worker ;; 7520*6a54128fSAndroid Build Coastguard Worker 7521*6a54128fSAndroid Build Coastguard Worker # Some other compiler argument. 7522*6a54128fSAndroid Build Coastguard Worker *) 7523*6a54128fSAndroid Build Coastguard Worker # Unknown arguments in both finalize_command and compile_command need 7524*6a54128fSAndroid Build Coastguard Worker # to be aesthetically quoted because they are evaled later. 7525*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$arg" 7526*6a54128fSAndroid Build Coastguard Worker arg=$func_quote_for_eval_result 7527*6a54128fSAndroid Build Coastguard Worker ;; 7528*6a54128fSAndroid Build Coastguard Worker esac # arg 7529*6a54128fSAndroid Build Coastguard Worker 7530*6a54128fSAndroid Build Coastguard Worker # Now actually substitute the argument into the commands. 7531*6a54128fSAndroid Build Coastguard Worker if test -n "$arg"; then 7532*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $arg" 7533*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $arg" 7534*6a54128fSAndroid Build Coastguard Worker fi 7535*6a54128fSAndroid Build Coastguard Worker done # argument parsing loop 7536*6a54128fSAndroid Build Coastguard Worker 7537*6a54128fSAndroid Build Coastguard Worker test -n "$prev" && \ 7538*6a54128fSAndroid Build Coastguard Worker func_fatal_help "the '$prevarg' option requires an argument" 7539*6a54128fSAndroid Build Coastguard Worker 7540*6a54128fSAndroid Build Coastguard Worker if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then 7541*6a54128fSAndroid Build Coastguard Worker eval arg=\"$export_dynamic_flag_spec\" 7542*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $arg" 7543*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $arg" 7544*6a54128fSAndroid Build Coastguard Worker fi 7545*6a54128fSAndroid Build Coastguard Worker 7546*6a54128fSAndroid Build Coastguard Worker oldlibs= 7547*6a54128fSAndroid Build Coastguard Worker # calculate the name of the file, without its directory 7548*6a54128fSAndroid Build Coastguard Worker func_basename "$output" 7549*6a54128fSAndroid Build Coastguard Worker outputname=$func_basename_result 7550*6a54128fSAndroid Build Coastguard Worker libobjs_save=$libobjs 7551*6a54128fSAndroid Build Coastguard Worker 7552*6a54128fSAndroid Build Coastguard Worker if test -n "$shlibpath_var"; then 7553*6a54128fSAndroid Build Coastguard Worker # get the directories listed in $shlibpath_var 7554*6a54128fSAndroid Build Coastguard Worker eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` 7555*6a54128fSAndroid Build Coastguard Worker else 7556*6a54128fSAndroid Build Coastguard Worker shlib_search_path= 7557*6a54128fSAndroid Build Coastguard Worker fi 7558*6a54128fSAndroid Build Coastguard Worker eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 7559*6a54128fSAndroid Build Coastguard Worker eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 7560*6a54128fSAndroid Build Coastguard Worker 7561*6a54128fSAndroid Build Coastguard Worker # Definition is injected by LT_CONFIG during libtool generation. 7562*6a54128fSAndroid Build Coastguard Worker func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" 7563*6a54128fSAndroid Build Coastguard Worker 7564*6a54128fSAndroid Build Coastguard Worker func_dirname "$output" "/" "" 7565*6a54128fSAndroid Build Coastguard Worker output_objdir=$func_dirname_result$objdir 7566*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$output_objdir/" 7567*6a54128fSAndroid Build Coastguard Worker tool_output_objdir=$func_to_tool_file_result 7568*6a54128fSAndroid Build Coastguard Worker # Create the object directory. 7569*6a54128fSAndroid Build Coastguard Worker func_mkdir_p "$output_objdir" 7570*6a54128fSAndroid Build Coastguard Worker 7571*6a54128fSAndroid Build Coastguard Worker # Determine the type of output 7572*6a54128fSAndroid Build Coastguard Worker case $output in 7573*6a54128fSAndroid Build Coastguard Worker "") 7574*6a54128fSAndroid Build Coastguard Worker func_fatal_help "you must specify an output file" 7575*6a54128fSAndroid Build Coastguard Worker ;; 7576*6a54128fSAndroid Build Coastguard Worker *.$libext) linkmode=oldlib ;; 7577*6a54128fSAndroid Build Coastguard Worker *.lo | *.$objext) linkmode=obj ;; 7578*6a54128fSAndroid Build Coastguard Worker *.la) linkmode=lib ;; 7579*6a54128fSAndroid Build Coastguard Worker *) linkmode=prog ;; # Anything else should be a program. 7580*6a54128fSAndroid Build Coastguard Worker esac 7581*6a54128fSAndroid Build Coastguard Worker 7582*6a54128fSAndroid Build Coastguard Worker specialdeplibs= 7583*6a54128fSAndroid Build Coastguard Worker 7584*6a54128fSAndroid Build Coastguard Worker libs= 7585*6a54128fSAndroid Build Coastguard Worker # Find all interdependent deplibs by searching for libraries 7586*6a54128fSAndroid Build Coastguard Worker # that are linked more than once (e.g. -la -lb -la) 7587*6a54128fSAndroid Build Coastguard Worker for deplib in $deplibs; do 7588*6a54128fSAndroid Build Coastguard Worker if $opt_preserve_dup_deps; then 7589*6a54128fSAndroid Build Coastguard Worker case "$libs " in 7590*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) func_append specialdeplibs " $deplib" ;; 7591*6a54128fSAndroid Build Coastguard Worker esac 7592*6a54128fSAndroid Build Coastguard Worker fi 7593*6a54128fSAndroid Build Coastguard Worker func_append libs " $deplib" 7594*6a54128fSAndroid Build Coastguard Worker done 7595*6a54128fSAndroid Build Coastguard Worker 7596*6a54128fSAndroid Build Coastguard Worker if test lib = "$linkmode"; then 7597*6a54128fSAndroid Build Coastguard Worker libs="$predeps $libs $compiler_lib_search_path $postdeps" 7598*6a54128fSAndroid Build Coastguard Worker 7599*6a54128fSAndroid Build Coastguard Worker # Compute libraries that are listed more than once in $predeps 7600*6a54128fSAndroid Build Coastguard Worker # $postdeps and mark them as special (i.e., whose duplicates are 7601*6a54128fSAndroid Build Coastguard Worker # not to be eliminated). 7602*6a54128fSAndroid Build Coastguard Worker pre_post_deps= 7603*6a54128fSAndroid Build Coastguard Worker if $opt_duplicate_compiler_generated_deps; then 7604*6a54128fSAndroid Build Coastguard Worker for pre_post_dep in $predeps $postdeps; do 7605*6a54128fSAndroid Build Coastguard Worker case "$pre_post_deps " in 7606*6a54128fSAndroid Build Coastguard Worker *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; 7607*6a54128fSAndroid Build Coastguard Worker esac 7608*6a54128fSAndroid Build Coastguard Worker func_append pre_post_deps " $pre_post_dep" 7609*6a54128fSAndroid Build Coastguard Worker done 7610*6a54128fSAndroid Build Coastguard Worker fi 7611*6a54128fSAndroid Build Coastguard Worker pre_post_deps= 7612*6a54128fSAndroid Build Coastguard Worker fi 7613*6a54128fSAndroid Build Coastguard Worker 7614*6a54128fSAndroid Build Coastguard Worker deplibs= 7615*6a54128fSAndroid Build Coastguard Worker newdependency_libs= 7616*6a54128fSAndroid Build Coastguard Worker newlib_search_path= 7617*6a54128fSAndroid Build Coastguard Worker need_relink=no # whether we're linking any uninstalled libtool libraries 7618*6a54128fSAndroid Build Coastguard Worker notinst_deplibs= # not-installed libtool libraries 7619*6a54128fSAndroid Build Coastguard Worker notinst_path= # paths that contain not-installed libtool libraries 7620*6a54128fSAndroid Build Coastguard Worker 7621*6a54128fSAndroid Build Coastguard Worker case $linkmode in 7622*6a54128fSAndroid Build Coastguard Worker lib) 7623*6a54128fSAndroid Build Coastguard Worker passes="conv dlpreopen link" 7624*6a54128fSAndroid Build Coastguard Worker for file in $dlfiles $dlprefiles; do 7625*6a54128fSAndroid Build Coastguard Worker case $file in 7626*6a54128fSAndroid Build Coastguard Worker *.la) ;; 7627*6a54128fSAndroid Build Coastguard Worker *) 7628*6a54128fSAndroid Build Coastguard Worker func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" 7629*6a54128fSAndroid Build Coastguard Worker ;; 7630*6a54128fSAndroid Build Coastguard Worker esac 7631*6a54128fSAndroid Build Coastguard Worker done 7632*6a54128fSAndroid Build Coastguard Worker ;; 7633*6a54128fSAndroid Build Coastguard Worker prog) 7634*6a54128fSAndroid Build Coastguard Worker compile_deplibs= 7635*6a54128fSAndroid Build Coastguard Worker finalize_deplibs= 7636*6a54128fSAndroid Build Coastguard Worker alldeplibs=false 7637*6a54128fSAndroid Build Coastguard Worker newdlfiles= 7638*6a54128fSAndroid Build Coastguard Worker newdlprefiles= 7639*6a54128fSAndroid Build Coastguard Worker passes="conv scan dlopen dlpreopen link" 7640*6a54128fSAndroid Build Coastguard Worker ;; 7641*6a54128fSAndroid Build Coastguard Worker *) passes="conv" 7642*6a54128fSAndroid Build Coastguard Worker ;; 7643*6a54128fSAndroid Build Coastguard Worker esac 7644*6a54128fSAndroid Build Coastguard Worker 7645*6a54128fSAndroid Build Coastguard Worker for pass in $passes; do 7646*6a54128fSAndroid Build Coastguard Worker # The preopen pass in lib mode reverses $deplibs; put it back here 7647*6a54128fSAndroid Build Coastguard Worker # so that -L comes before libs that need it for instance... 7648*6a54128fSAndroid Build Coastguard Worker if test lib,link = "$linkmode,$pass"; then 7649*6a54128fSAndroid Build Coastguard Worker ## FIXME: Find the place where the list is rebuilt in the wrong 7650*6a54128fSAndroid Build Coastguard Worker ## order, and fix it there properly 7651*6a54128fSAndroid Build Coastguard Worker tmp_deplibs= 7652*6a54128fSAndroid Build Coastguard Worker for deplib in $deplibs; do 7653*6a54128fSAndroid Build Coastguard Worker tmp_deplibs="$deplib $tmp_deplibs" 7654*6a54128fSAndroid Build Coastguard Worker done 7655*6a54128fSAndroid Build Coastguard Worker deplibs=$tmp_deplibs 7656*6a54128fSAndroid Build Coastguard Worker fi 7657*6a54128fSAndroid Build Coastguard Worker 7658*6a54128fSAndroid Build Coastguard Worker if test lib,link = "$linkmode,$pass" || 7659*6a54128fSAndroid Build Coastguard Worker test prog,scan = "$linkmode,$pass"; then 7660*6a54128fSAndroid Build Coastguard Worker libs=$deplibs 7661*6a54128fSAndroid Build Coastguard Worker deplibs= 7662*6a54128fSAndroid Build Coastguard Worker fi 7663*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode"; then 7664*6a54128fSAndroid Build Coastguard Worker case $pass in 7665*6a54128fSAndroid Build Coastguard Worker dlopen) libs=$dlfiles ;; 7666*6a54128fSAndroid Build Coastguard Worker dlpreopen) libs=$dlprefiles ;; 7667*6a54128fSAndroid Build Coastguard Worker link) 7668*6a54128fSAndroid Build Coastguard Worker libs="$deplibs %DEPLIBS%" 7669*6a54128fSAndroid Build Coastguard Worker test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" 7670*6a54128fSAndroid Build Coastguard Worker ;; 7671*6a54128fSAndroid Build Coastguard Worker esac 7672*6a54128fSAndroid Build Coastguard Worker fi 7673*6a54128fSAndroid Build Coastguard Worker if test lib,dlpreopen = "$linkmode,$pass"; then 7674*6a54128fSAndroid Build Coastguard Worker # Collect and forward deplibs of preopened libtool libs 7675*6a54128fSAndroid Build Coastguard Worker for lib in $dlprefiles; do 7676*6a54128fSAndroid Build Coastguard Worker # Ignore non-libtool-libs 7677*6a54128fSAndroid Build Coastguard Worker dependency_libs= 7678*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$lib" 7679*6a54128fSAndroid Build Coastguard Worker case $lib in 7680*6a54128fSAndroid Build Coastguard Worker *.la) func_source "$func_resolve_sysroot_result" ;; 7681*6a54128fSAndroid Build Coastguard Worker esac 7682*6a54128fSAndroid Build Coastguard Worker 7683*6a54128fSAndroid Build Coastguard Worker # Collect preopened libtool deplibs, except any this library 7684*6a54128fSAndroid Build Coastguard Worker # has declared as weak libs 7685*6a54128fSAndroid Build Coastguard Worker for deplib in $dependency_libs; do 7686*6a54128fSAndroid Build Coastguard Worker func_basename "$deplib" 7687*6a54128fSAndroid Build Coastguard Worker deplib_base=$func_basename_result 7688*6a54128fSAndroid Build Coastguard Worker case " $weak_libs " in 7689*6a54128fSAndroid Build Coastguard Worker *" $deplib_base "*) ;; 7690*6a54128fSAndroid Build Coastguard Worker *) func_append deplibs " $deplib" ;; 7691*6a54128fSAndroid Build Coastguard Worker esac 7692*6a54128fSAndroid Build Coastguard Worker done 7693*6a54128fSAndroid Build Coastguard Worker done 7694*6a54128fSAndroid Build Coastguard Worker libs=$dlprefiles 7695*6a54128fSAndroid Build Coastguard Worker fi 7696*6a54128fSAndroid Build Coastguard Worker if test dlopen = "$pass"; then 7697*6a54128fSAndroid Build Coastguard Worker # Collect dlpreopened libraries 7698*6a54128fSAndroid Build Coastguard Worker save_deplibs=$deplibs 7699*6a54128fSAndroid Build Coastguard Worker deplibs= 7700*6a54128fSAndroid Build Coastguard Worker fi 7701*6a54128fSAndroid Build Coastguard Worker 7702*6a54128fSAndroid Build Coastguard Worker for deplib in $libs; do 7703*6a54128fSAndroid Build Coastguard Worker lib= 7704*6a54128fSAndroid Build Coastguard Worker found=false 7705*6a54128fSAndroid Build Coastguard Worker case $deplib in 7706*6a54128fSAndroid Build Coastguard Worker -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ 7707*6a54128fSAndroid Build Coastguard Worker |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) 7708*6a54128fSAndroid Build Coastguard Worker if test prog,link = "$linkmode,$pass"; then 7709*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$deplib $compile_deplibs" 7710*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$deplib $finalize_deplibs" 7711*6a54128fSAndroid Build Coastguard Worker else 7712*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $deplib" 7713*6a54128fSAndroid Build Coastguard Worker if test lib = "$linkmode"; then 7714*6a54128fSAndroid Build Coastguard Worker case "$new_inherited_linker_flags " in 7715*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) ;; 7716*6a54128fSAndroid Build Coastguard Worker * ) func_append new_inherited_linker_flags " $deplib" ;; 7717*6a54128fSAndroid Build Coastguard Worker esac 7718*6a54128fSAndroid Build Coastguard Worker fi 7719*6a54128fSAndroid Build Coastguard Worker fi 7720*6a54128fSAndroid Build Coastguard Worker continue 7721*6a54128fSAndroid Build Coastguard Worker ;; 7722*6a54128fSAndroid Build Coastguard Worker -l*) 7723*6a54128fSAndroid Build Coastguard Worker if test lib != "$linkmode" && test prog != "$linkmode"; then 7724*6a54128fSAndroid Build Coastguard Worker func_warning "'-l' is ignored for archives/objects" 7725*6a54128fSAndroid Build Coastguard Worker continue 7726*6a54128fSAndroid Build Coastguard Worker fi 7727*6a54128fSAndroid Build Coastguard Worker func_stripname '-l' '' "$deplib" 7728*6a54128fSAndroid Build Coastguard Worker name=$func_stripname_result 7729*6a54128fSAndroid Build Coastguard Worker if test lib = "$linkmode"; then 7730*6a54128fSAndroid Build Coastguard Worker searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 7731*6a54128fSAndroid Build Coastguard Worker else 7732*6a54128fSAndroid Build Coastguard Worker searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 7733*6a54128fSAndroid Build Coastguard Worker fi 7734*6a54128fSAndroid Build Coastguard Worker for searchdir in $searchdirs; do 7735*6a54128fSAndroid Build Coastguard Worker for search_ext in .la $std_shrext .so .a; do 7736*6a54128fSAndroid Build Coastguard Worker # Search the libtool library 7737*6a54128fSAndroid Build Coastguard Worker lib=$searchdir/lib$name$search_ext 7738*6a54128fSAndroid Build Coastguard Worker if test -f "$lib"; then 7739*6a54128fSAndroid Build Coastguard Worker if test .la = "$search_ext"; then 7740*6a54128fSAndroid Build Coastguard Worker found=: 7741*6a54128fSAndroid Build Coastguard Worker else 7742*6a54128fSAndroid Build Coastguard Worker found=false 7743*6a54128fSAndroid Build Coastguard Worker fi 7744*6a54128fSAndroid Build Coastguard Worker break 2 7745*6a54128fSAndroid Build Coastguard Worker fi 7746*6a54128fSAndroid Build Coastguard Worker done 7747*6a54128fSAndroid Build Coastguard Worker done 7748*6a54128fSAndroid Build Coastguard Worker if $found; then 7749*6a54128fSAndroid Build Coastguard Worker # deplib is a libtool library 7750*6a54128fSAndroid Build Coastguard Worker # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 7751*6a54128fSAndroid Build Coastguard Worker # We need to do some special things here, and not later. 7752*6a54128fSAndroid Build Coastguard Worker if test yes = "$allow_libtool_libs_with_static_runtimes"; then 7753*6a54128fSAndroid Build Coastguard Worker case " $predeps $postdeps " in 7754*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) 7755*6a54128fSAndroid Build Coastguard Worker if func_lalib_p "$lib"; then 7756*6a54128fSAndroid Build Coastguard Worker library_names= 7757*6a54128fSAndroid Build Coastguard Worker old_library= 7758*6a54128fSAndroid Build Coastguard Worker func_source "$lib" 7759*6a54128fSAndroid Build Coastguard Worker for l in $old_library $library_names; do 7760*6a54128fSAndroid Build Coastguard Worker ll=$l 7761*6a54128fSAndroid Build Coastguard Worker done 7762*6a54128fSAndroid Build Coastguard Worker if test "X$ll" = "X$old_library"; then # only static version available 7763*6a54128fSAndroid Build Coastguard Worker found=false 7764*6a54128fSAndroid Build Coastguard Worker func_dirname "$lib" "" "." 7765*6a54128fSAndroid Build Coastguard Worker ladir=$func_dirname_result 7766*6a54128fSAndroid Build Coastguard Worker lib=$ladir/$old_library 7767*6a54128fSAndroid Build Coastguard Worker if test prog,link = "$linkmode,$pass"; then 7768*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$deplib $compile_deplibs" 7769*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$deplib $finalize_deplibs" 7770*6a54128fSAndroid Build Coastguard Worker else 7771*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7772*6a54128fSAndroid Build Coastguard Worker test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" 7773*6a54128fSAndroid Build Coastguard Worker fi 7774*6a54128fSAndroid Build Coastguard Worker continue 7775*6a54128fSAndroid Build Coastguard Worker fi 7776*6a54128fSAndroid Build Coastguard Worker fi 7777*6a54128fSAndroid Build Coastguard Worker ;; 7778*6a54128fSAndroid Build Coastguard Worker *) ;; 7779*6a54128fSAndroid Build Coastguard Worker esac 7780*6a54128fSAndroid Build Coastguard Worker fi 7781*6a54128fSAndroid Build Coastguard Worker else 7782*6a54128fSAndroid Build Coastguard Worker # deplib doesn't seem to be a libtool library 7783*6a54128fSAndroid Build Coastguard Worker if test prog,link = "$linkmode,$pass"; then 7784*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$deplib $compile_deplibs" 7785*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$deplib $finalize_deplibs" 7786*6a54128fSAndroid Build Coastguard Worker else 7787*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7788*6a54128fSAndroid Build Coastguard Worker test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" 7789*6a54128fSAndroid Build Coastguard Worker fi 7790*6a54128fSAndroid Build Coastguard Worker continue 7791*6a54128fSAndroid Build Coastguard Worker fi 7792*6a54128fSAndroid Build Coastguard Worker ;; # -l 7793*6a54128fSAndroid Build Coastguard Worker *.ltframework) 7794*6a54128fSAndroid Build Coastguard Worker if test prog,link = "$linkmode,$pass"; then 7795*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$deplib $compile_deplibs" 7796*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$deplib $finalize_deplibs" 7797*6a54128fSAndroid Build Coastguard Worker else 7798*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7799*6a54128fSAndroid Build Coastguard Worker if test lib = "$linkmode"; then 7800*6a54128fSAndroid Build Coastguard Worker case "$new_inherited_linker_flags " in 7801*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) ;; 7802*6a54128fSAndroid Build Coastguard Worker * ) func_append new_inherited_linker_flags " $deplib" ;; 7803*6a54128fSAndroid Build Coastguard Worker esac 7804*6a54128fSAndroid Build Coastguard Worker fi 7805*6a54128fSAndroid Build Coastguard Worker fi 7806*6a54128fSAndroid Build Coastguard Worker continue 7807*6a54128fSAndroid Build Coastguard Worker ;; 7808*6a54128fSAndroid Build Coastguard Worker -L*) 7809*6a54128fSAndroid Build Coastguard Worker case $linkmode in 7810*6a54128fSAndroid Build Coastguard Worker lib) 7811*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7812*6a54128fSAndroid Build Coastguard Worker test conv = "$pass" && continue 7813*6a54128fSAndroid Build Coastguard Worker newdependency_libs="$deplib $newdependency_libs" 7814*6a54128fSAndroid Build Coastguard Worker func_stripname '-L' '' "$deplib" 7815*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$func_stripname_result" 7816*6a54128fSAndroid Build Coastguard Worker func_append newlib_search_path " $func_resolve_sysroot_result" 7817*6a54128fSAndroid Build Coastguard Worker ;; 7818*6a54128fSAndroid Build Coastguard Worker prog) 7819*6a54128fSAndroid Build Coastguard Worker if test conv = "$pass"; then 7820*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7821*6a54128fSAndroid Build Coastguard Worker continue 7822*6a54128fSAndroid Build Coastguard Worker fi 7823*6a54128fSAndroid Build Coastguard Worker if test scan = "$pass"; then 7824*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7825*6a54128fSAndroid Build Coastguard Worker else 7826*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$deplib $compile_deplibs" 7827*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$deplib $finalize_deplibs" 7828*6a54128fSAndroid Build Coastguard Worker fi 7829*6a54128fSAndroid Build Coastguard Worker func_stripname '-L' '' "$deplib" 7830*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$func_stripname_result" 7831*6a54128fSAndroid Build Coastguard Worker func_append newlib_search_path " $func_resolve_sysroot_result" 7832*6a54128fSAndroid Build Coastguard Worker ;; 7833*6a54128fSAndroid Build Coastguard Worker *) 7834*6a54128fSAndroid Build Coastguard Worker func_warning "'-L' is ignored for archives/objects" 7835*6a54128fSAndroid Build Coastguard Worker ;; 7836*6a54128fSAndroid Build Coastguard Worker esac # linkmode 7837*6a54128fSAndroid Build Coastguard Worker continue 7838*6a54128fSAndroid Build Coastguard Worker ;; # -L 7839*6a54128fSAndroid Build Coastguard Worker -R*) 7840*6a54128fSAndroid Build Coastguard Worker if test link = "$pass"; then 7841*6a54128fSAndroid Build Coastguard Worker func_stripname '-R' '' "$deplib" 7842*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$func_stripname_result" 7843*6a54128fSAndroid Build Coastguard Worker dir=$func_resolve_sysroot_result 7844*6a54128fSAndroid Build Coastguard Worker # Make sure the xrpath contains only unique directories. 7845*6a54128fSAndroid Build Coastguard Worker case "$xrpath " in 7846*6a54128fSAndroid Build Coastguard Worker *" $dir "*) ;; 7847*6a54128fSAndroid Build Coastguard Worker *) func_append xrpath " $dir" ;; 7848*6a54128fSAndroid Build Coastguard Worker esac 7849*6a54128fSAndroid Build Coastguard Worker fi 7850*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7851*6a54128fSAndroid Build Coastguard Worker continue 7852*6a54128fSAndroid Build Coastguard Worker ;; 7853*6a54128fSAndroid Build Coastguard Worker *.la) 7854*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$deplib" 7855*6a54128fSAndroid Build Coastguard Worker lib=$func_resolve_sysroot_result 7856*6a54128fSAndroid Build Coastguard Worker ;; 7857*6a54128fSAndroid Build Coastguard Worker *.$libext) 7858*6a54128fSAndroid Build Coastguard Worker if test conv = "$pass"; then 7859*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7860*6a54128fSAndroid Build Coastguard Worker continue 7861*6a54128fSAndroid Build Coastguard Worker fi 7862*6a54128fSAndroid Build Coastguard Worker case $linkmode in 7863*6a54128fSAndroid Build Coastguard Worker lib) 7864*6a54128fSAndroid Build Coastguard Worker # Linking convenience modules into shared libraries is allowed, 7865*6a54128fSAndroid Build Coastguard Worker # but linking other static libraries is non-portable. 7866*6a54128fSAndroid Build Coastguard Worker case " $dlpreconveniencelibs " in 7867*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) ;; 7868*6a54128fSAndroid Build Coastguard Worker *) 7869*6a54128fSAndroid Build Coastguard Worker valid_a_lib=false 7870*6a54128fSAndroid Build Coastguard Worker case $deplibs_check_method in 7871*6a54128fSAndroid Build Coastguard Worker match_pattern*) 7872*6a54128fSAndroid Build Coastguard Worker set dummy $deplibs_check_method; shift 7873*6a54128fSAndroid Build Coastguard Worker match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 7874*6a54128fSAndroid Build Coastguard Worker if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ 7875*6a54128fSAndroid Build Coastguard Worker | $EGREP "$match_pattern_regex" > /dev/null; then 7876*6a54128fSAndroid Build Coastguard Worker valid_a_lib=: 7877*6a54128fSAndroid Build Coastguard Worker fi 7878*6a54128fSAndroid Build Coastguard Worker ;; 7879*6a54128fSAndroid Build Coastguard Worker pass_all) 7880*6a54128fSAndroid Build Coastguard Worker valid_a_lib=: 7881*6a54128fSAndroid Build Coastguard Worker ;; 7882*6a54128fSAndroid Build Coastguard Worker esac 7883*6a54128fSAndroid Build Coastguard Worker if $valid_a_lib; then 7884*6a54128fSAndroid Build Coastguard Worker echo 7885*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: Linking the shared library $output against the" 7886*6a54128fSAndroid Build Coastguard Worker $ECHO "*** static library $deplib is not portable!" 7887*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7888*6a54128fSAndroid Build Coastguard Worker else 7889*6a54128fSAndroid Build Coastguard Worker echo 7890*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: Trying to link with static lib archive $deplib." 7891*6a54128fSAndroid Build Coastguard Worker echo "*** I have the capability to make that library automatically link in when" 7892*6a54128fSAndroid Build Coastguard Worker echo "*** you link to this library. But I can only do this if you have a" 7893*6a54128fSAndroid Build Coastguard Worker echo "*** shared version of the library, which you do not appear to have" 7894*6a54128fSAndroid Build Coastguard Worker echo "*** because the file extensions .$libext of this argument makes me believe" 7895*6a54128fSAndroid Build Coastguard Worker echo "*** that it is just a static archive that I should not use here." 7896*6a54128fSAndroid Build Coastguard Worker fi 7897*6a54128fSAndroid Build Coastguard Worker ;; 7898*6a54128fSAndroid Build Coastguard Worker esac 7899*6a54128fSAndroid Build Coastguard Worker continue 7900*6a54128fSAndroid Build Coastguard Worker ;; 7901*6a54128fSAndroid Build Coastguard Worker prog) 7902*6a54128fSAndroid Build Coastguard Worker if test link != "$pass"; then 7903*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7904*6a54128fSAndroid Build Coastguard Worker else 7905*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$deplib $compile_deplibs" 7906*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$deplib $finalize_deplibs" 7907*6a54128fSAndroid Build Coastguard Worker fi 7908*6a54128fSAndroid Build Coastguard Worker continue 7909*6a54128fSAndroid Build Coastguard Worker ;; 7910*6a54128fSAndroid Build Coastguard Worker esac # linkmode 7911*6a54128fSAndroid Build Coastguard Worker ;; # *.$libext 7912*6a54128fSAndroid Build Coastguard Worker *.lo | *.$objext) 7913*6a54128fSAndroid Build Coastguard Worker if test conv = "$pass"; then 7914*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7915*6a54128fSAndroid Build Coastguard Worker elif test prog = "$linkmode"; then 7916*6a54128fSAndroid Build Coastguard Worker if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then 7917*6a54128fSAndroid Build Coastguard Worker # If there is no dlopen support or we're linking statically, 7918*6a54128fSAndroid Build Coastguard Worker # we need to preload. 7919*6a54128fSAndroid Build Coastguard Worker func_append newdlprefiles " $deplib" 7920*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$deplib $compile_deplibs" 7921*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$deplib $finalize_deplibs" 7922*6a54128fSAndroid Build Coastguard Worker else 7923*6a54128fSAndroid Build Coastguard Worker func_append newdlfiles " $deplib" 7924*6a54128fSAndroid Build Coastguard Worker fi 7925*6a54128fSAndroid Build Coastguard Worker fi 7926*6a54128fSAndroid Build Coastguard Worker continue 7927*6a54128fSAndroid Build Coastguard Worker ;; 7928*6a54128fSAndroid Build Coastguard Worker %DEPLIBS%) 7929*6a54128fSAndroid Build Coastguard Worker alldeplibs=: 7930*6a54128fSAndroid Build Coastguard Worker continue 7931*6a54128fSAndroid Build Coastguard Worker ;; 7932*6a54128fSAndroid Build Coastguard Worker esac # case $deplib 7933*6a54128fSAndroid Build Coastguard Worker 7934*6a54128fSAndroid Build Coastguard Worker $found || test -f "$lib" \ 7935*6a54128fSAndroid Build Coastguard Worker || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" 7936*6a54128fSAndroid Build Coastguard Worker 7937*6a54128fSAndroid Build Coastguard Worker # Check to see that this really is a libtool archive. 7938*6a54128fSAndroid Build Coastguard Worker func_lalib_unsafe_p "$lib" \ 7939*6a54128fSAndroid Build Coastguard Worker || func_fatal_error "'$lib' is not a valid libtool archive" 7940*6a54128fSAndroid Build Coastguard Worker 7941*6a54128fSAndroid Build Coastguard Worker func_dirname "$lib" "" "." 7942*6a54128fSAndroid Build Coastguard Worker ladir=$func_dirname_result 7943*6a54128fSAndroid Build Coastguard Worker 7944*6a54128fSAndroid Build Coastguard Worker dlname= 7945*6a54128fSAndroid Build Coastguard Worker dlopen= 7946*6a54128fSAndroid Build Coastguard Worker dlpreopen= 7947*6a54128fSAndroid Build Coastguard Worker libdir= 7948*6a54128fSAndroid Build Coastguard Worker library_names= 7949*6a54128fSAndroid Build Coastguard Worker old_library= 7950*6a54128fSAndroid Build Coastguard Worker inherited_linker_flags= 7951*6a54128fSAndroid Build Coastguard Worker # If the library was installed with an old release of libtool, 7952*6a54128fSAndroid Build Coastguard Worker # it will not redefine variables installed, or shouldnotlink 7953*6a54128fSAndroid Build Coastguard Worker installed=yes 7954*6a54128fSAndroid Build Coastguard Worker shouldnotlink=no 7955*6a54128fSAndroid Build Coastguard Worker avoidtemprpath= 7956*6a54128fSAndroid Build Coastguard Worker 7957*6a54128fSAndroid Build Coastguard Worker 7958*6a54128fSAndroid Build Coastguard Worker # Read the .la file 7959*6a54128fSAndroid Build Coastguard Worker func_source "$lib" 7960*6a54128fSAndroid Build Coastguard Worker 7961*6a54128fSAndroid Build Coastguard Worker # Convert "-framework foo" to "foo.ltframework" 7962*6a54128fSAndroid Build Coastguard Worker if test -n "$inherited_linker_flags"; then 7963*6a54128fSAndroid Build Coastguard Worker tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` 7964*6a54128fSAndroid Build Coastguard Worker for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do 7965*6a54128fSAndroid Build Coastguard Worker case " $new_inherited_linker_flags " in 7966*6a54128fSAndroid Build Coastguard Worker *" $tmp_inherited_linker_flag "*) ;; 7967*6a54128fSAndroid Build Coastguard Worker *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; 7968*6a54128fSAndroid Build Coastguard Worker esac 7969*6a54128fSAndroid Build Coastguard Worker done 7970*6a54128fSAndroid Build Coastguard Worker fi 7971*6a54128fSAndroid Build Coastguard Worker dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 7972*6a54128fSAndroid Build Coastguard Worker if test lib,link = "$linkmode,$pass" || 7973*6a54128fSAndroid Build Coastguard Worker test prog,scan = "$linkmode,$pass" || 7974*6a54128fSAndroid Build Coastguard Worker { test prog != "$linkmode" && test lib != "$linkmode"; }; then 7975*6a54128fSAndroid Build Coastguard Worker test -n "$dlopen" && func_append dlfiles " $dlopen" 7976*6a54128fSAndroid Build Coastguard Worker test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" 7977*6a54128fSAndroid Build Coastguard Worker fi 7978*6a54128fSAndroid Build Coastguard Worker 7979*6a54128fSAndroid Build Coastguard Worker if test conv = "$pass"; then 7980*6a54128fSAndroid Build Coastguard Worker # Only check for convenience libraries 7981*6a54128fSAndroid Build Coastguard Worker deplibs="$lib $deplibs" 7982*6a54128fSAndroid Build Coastguard Worker if test -z "$libdir"; then 7983*6a54128fSAndroid Build Coastguard Worker if test -z "$old_library"; then 7984*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot find name of link library for '$lib'" 7985*6a54128fSAndroid Build Coastguard Worker fi 7986*6a54128fSAndroid Build Coastguard Worker # It is a libtool convenience library, so add in its objects. 7987*6a54128fSAndroid Build Coastguard Worker func_append convenience " $ladir/$objdir/$old_library" 7988*6a54128fSAndroid Build Coastguard Worker func_append old_convenience " $ladir/$objdir/$old_library" 7989*6a54128fSAndroid Build Coastguard Worker tmp_libs= 7990*6a54128fSAndroid Build Coastguard Worker for deplib in $dependency_libs; do 7991*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 7992*6a54128fSAndroid Build Coastguard Worker if $opt_preserve_dup_deps; then 7993*6a54128fSAndroid Build Coastguard Worker case "$tmp_libs " in 7994*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) func_append specialdeplibs " $deplib" ;; 7995*6a54128fSAndroid Build Coastguard Worker esac 7996*6a54128fSAndroid Build Coastguard Worker fi 7997*6a54128fSAndroid Build Coastguard Worker func_append tmp_libs " $deplib" 7998*6a54128fSAndroid Build Coastguard Worker done 7999*6a54128fSAndroid Build Coastguard Worker elif test prog != "$linkmode" && test lib != "$linkmode"; then 8000*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$lib' is not a convenience library" 8001*6a54128fSAndroid Build Coastguard Worker fi 8002*6a54128fSAndroid Build Coastguard Worker continue 8003*6a54128fSAndroid Build Coastguard Worker fi # $pass = conv 8004*6a54128fSAndroid Build Coastguard Worker 8005*6a54128fSAndroid Build Coastguard Worker 8006*6a54128fSAndroid Build Coastguard Worker # Get the name of the library we link against. 8007*6a54128fSAndroid Build Coastguard Worker linklib= 8008*6a54128fSAndroid Build Coastguard Worker if test -n "$old_library" && 8009*6a54128fSAndroid Build Coastguard Worker { test yes = "$prefer_static_libs" || 8010*6a54128fSAndroid Build Coastguard Worker test built,no = "$prefer_static_libs,$installed"; }; then 8011*6a54128fSAndroid Build Coastguard Worker linklib=$old_library 8012*6a54128fSAndroid Build Coastguard Worker else 8013*6a54128fSAndroid Build Coastguard Worker for l in $old_library $library_names; do 8014*6a54128fSAndroid Build Coastguard Worker linklib=$l 8015*6a54128fSAndroid Build Coastguard Worker done 8016*6a54128fSAndroid Build Coastguard Worker fi 8017*6a54128fSAndroid Build Coastguard Worker if test -z "$linklib"; then 8018*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot find name of link library for '$lib'" 8019*6a54128fSAndroid Build Coastguard Worker fi 8020*6a54128fSAndroid Build Coastguard Worker 8021*6a54128fSAndroid Build Coastguard Worker # This library was specified with -dlopen. 8022*6a54128fSAndroid Build Coastguard Worker if test dlopen = "$pass"; then 8023*6a54128fSAndroid Build Coastguard Worker test -z "$libdir" \ 8024*6a54128fSAndroid Build Coastguard Worker && func_fatal_error "cannot -dlopen a convenience library: '$lib'" 8025*6a54128fSAndroid Build Coastguard Worker if test -z "$dlname" || 8026*6a54128fSAndroid Build Coastguard Worker test yes != "$dlopen_support" || 8027*6a54128fSAndroid Build Coastguard Worker test no = "$build_libtool_libs" 8028*6a54128fSAndroid Build Coastguard Worker then 8029*6a54128fSAndroid Build Coastguard Worker # If there is no dlname, no dlopen support or we're linking 8030*6a54128fSAndroid Build Coastguard Worker # statically, we need to preload. We also need to preload any 8031*6a54128fSAndroid Build Coastguard Worker # dependent libraries so libltdl's deplib preloader doesn't 8032*6a54128fSAndroid Build Coastguard Worker # bomb out in the load deplibs phase. 8033*6a54128fSAndroid Build Coastguard Worker func_append dlprefiles " $lib $dependency_libs" 8034*6a54128fSAndroid Build Coastguard Worker else 8035*6a54128fSAndroid Build Coastguard Worker func_append newdlfiles " $lib" 8036*6a54128fSAndroid Build Coastguard Worker fi 8037*6a54128fSAndroid Build Coastguard Worker continue 8038*6a54128fSAndroid Build Coastguard Worker fi # $pass = dlopen 8039*6a54128fSAndroid Build Coastguard Worker 8040*6a54128fSAndroid Build Coastguard Worker # We need an absolute path. 8041*6a54128fSAndroid Build Coastguard Worker case $ladir in 8042*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; 8043*6a54128fSAndroid Build Coastguard Worker *) 8044*6a54128fSAndroid Build Coastguard Worker abs_ladir=`cd "$ladir" && pwd` 8045*6a54128fSAndroid Build Coastguard Worker if test -z "$abs_ladir"; then 8046*6a54128fSAndroid Build Coastguard Worker func_warning "cannot determine absolute directory name of '$ladir'" 8047*6a54128fSAndroid Build Coastguard Worker func_warning "passing it literally to the linker, although it might fail" 8048*6a54128fSAndroid Build Coastguard Worker abs_ladir=$ladir 8049*6a54128fSAndroid Build Coastguard Worker fi 8050*6a54128fSAndroid Build Coastguard Worker ;; 8051*6a54128fSAndroid Build Coastguard Worker esac 8052*6a54128fSAndroid Build Coastguard Worker func_basename "$lib" 8053*6a54128fSAndroid Build Coastguard Worker laname=$func_basename_result 8054*6a54128fSAndroid Build Coastguard Worker 8055*6a54128fSAndroid Build Coastguard Worker # Find the relevant object directory and library name. 8056*6a54128fSAndroid Build Coastguard Worker if test yes = "$installed"; then 8057*6a54128fSAndroid Build Coastguard Worker if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 8058*6a54128fSAndroid Build Coastguard Worker func_warning "library '$lib' was moved." 8059*6a54128fSAndroid Build Coastguard Worker dir=$ladir 8060*6a54128fSAndroid Build Coastguard Worker absdir=$abs_ladir 8061*6a54128fSAndroid Build Coastguard Worker libdir=$abs_ladir 8062*6a54128fSAndroid Build Coastguard Worker else 8063*6a54128fSAndroid Build Coastguard Worker dir=$lt_sysroot$libdir 8064*6a54128fSAndroid Build Coastguard Worker absdir=$lt_sysroot$libdir 8065*6a54128fSAndroid Build Coastguard Worker fi 8066*6a54128fSAndroid Build Coastguard Worker test yes = "$hardcode_automatic" && avoidtemprpath=yes 8067*6a54128fSAndroid Build Coastguard Worker else 8068*6a54128fSAndroid Build Coastguard Worker if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 8069*6a54128fSAndroid Build Coastguard Worker dir=$ladir 8070*6a54128fSAndroid Build Coastguard Worker absdir=$abs_ladir 8071*6a54128fSAndroid Build Coastguard Worker # Remove this search path later 8072*6a54128fSAndroid Build Coastguard Worker func_append notinst_path " $abs_ladir" 8073*6a54128fSAndroid Build Coastguard Worker else 8074*6a54128fSAndroid Build Coastguard Worker dir=$ladir/$objdir 8075*6a54128fSAndroid Build Coastguard Worker absdir=$abs_ladir/$objdir 8076*6a54128fSAndroid Build Coastguard Worker # Remove this search path later 8077*6a54128fSAndroid Build Coastguard Worker func_append notinst_path " $abs_ladir" 8078*6a54128fSAndroid Build Coastguard Worker fi 8079*6a54128fSAndroid Build Coastguard Worker fi # $installed = yes 8080*6a54128fSAndroid Build Coastguard Worker func_stripname 'lib' '.la' "$laname" 8081*6a54128fSAndroid Build Coastguard Worker name=$func_stripname_result 8082*6a54128fSAndroid Build Coastguard Worker 8083*6a54128fSAndroid Build Coastguard Worker # This library was specified with -dlpreopen. 8084*6a54128fSAndroid Build Coastguard Worker if test dlpreopen = "$pass"; then 8085*6a54128fSAndroid Build Coastguard Worker if test -z "$libdir" && test prog = "$linkmode"; then 8086*6a54128fSAndroid Build Coastguard Worker func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" 8087*6a54128fSAndroid Build Coastguard Worker fi 8088*6a54128fSAndroid Build Coastguard Worker case $host in 8089*6a54128fSAndroid Build Coastguard Worker # special handling for platforms with PE-DLLs. 8090*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw* | *cegcc* ) 8091*6a54128fSAndroid Build Coastguard Worker # Linker will automatically link against shared library if both 8092*6a54128fSAndroid Build Coastguard Worker # static and shared are present. Therefore, ensure we extract 8093*6a54128fSAndroid Build Coastguard Worker # symbols from the import library if a shared library is present 8094*6a54128fSAndroid Build Coastguard Worker # (otherwise, the dlopen module name will be incorrect). We do 8095*6a54128fSAndroid Build Coastguard Worker # this by putting the import library name into $newdlprefiles. 8096*6a54128fSAndroid Build Coastguard Worker # We recover the dlopen module name by 'saving' the la file 8097*6a54128fSAndroid Build Coastguard Worker # name in a special purpose variable, and (later) extracting the 8098*6a54128fSAndroid Build Coastguard Worker # dlname from the la file. 8099*6a54128fSAndroid Build Coastguard Worker if test -n "$dlname"; then 8100*6a54128fSAndroid Build Coastguard Worker func_tr_sh "$dir/$linklib" 8101*6a54128fSAndroid Build Coastguard Worker eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" 8102*6a54128fSAndroid Build Coastguard Worker func_append newdlprefiles " $dir/$linklib" 8103*6a54128fSAndroid Build Coastguard Worker else 8104*6a54128fSAndroid Build Coastguard Worker func_append newdlprefiles " $dir/$old_library" 8105*6a54128fSAndroid Build Coastguard Worker # Keep a list of preopened convenience libraries to check 8106*6a54128fSAndroid Build Coastguard Worker # that they are being used correctly in the link pass. 8107*6a54128fSAndroid Build Coastguard Worker test -z "$libdir" && \ 8108*6a54128fSAndroid Build Coastguard Worker func_append dlpreconveniencelibs " $dir/$old_library" 8109*6a54128fSAndroid Build Coastguard Worker fi 8110*6a54128fSAndroid Build Coastguard Worker ;; 8111*6a54128fSAndroid Build Coastguard Worker * ) 8112*6a54128fSAndroid Build Coastguard Worker # Prefer using a static library (so that no silly _DYNAMIC symbols 8113*6a54128fSAndroid Build Coastguard Worker # are required to link). 8114*6a54128fSAndroid Build Coastguard Worker if test -n "$old_library"; then 8115*6a54128fSAndroid Build Coastguard Worker func_append newdlprefiles " $dir/$old_library" 8116*6a54128fSAndroid Build Coastguard Worker # Keep a list of preopened convenience libraries to check 8117*6a54128fSAndroid Build Coastguard Worker # that they are being used correctly in the link pass. 8118*6a54128fSAndroid Build Coastguard Worker test -z "$libdir" && \ 8119*6a54128fSAndroid Build Coastguard Worker func_append dlpreconveniencelibs " $dir/$old_library" 8120*6a54128fSAndroid Build Coastguard Worker # Otherwise, use the dlname, so that lt_dlopen finds it. 8121*6a54128fSAndroid Build Coastguard Worker elif test -n "$dlname"; then 8122*6a54128fSAndroid Build Coastguard Worker func_append newdlprefiles " $dir/$dlname" 8123*6a54128fSAndroid Build Coastguard Worker else 8124*6a54128fSAndroid Build Coastguard Worker func_append newdlprefiles " $dir/$linklib" 8125*6a54128fSAndroid Build Coastguard Worker fi 8126*6a54128fSAndroid Build Coastguard Worker ;; 8127*6a54128fSAndroid Build Coastguard Worker esac 8128*6a54128fSAndroid Build Coastguard Worker fi # $pass = dlpreopen 8129*6a54128fSAndroid Build Coastguard Worker 8130*6a54128fSAndroid Build Coastguard Worker if test -z "$libdir"; then 8131*6a54128fSAndroid Build Coastguard Worker # Link the convenience library 8132*6a54128fSAndroid Build Coastguard Worker if test lib = "$linkmode"; then 8133*6a54128fSAndroid Build Coastguard Worker deplibs="$dir/$old_library $deplibs" 8134*6a54128fSAndroid Build Coastguard Worker elif test prog,link = "$linkmode,$pass"; then 8135*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$dir/$old_library $compile_deplibs" 8136*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$dir/$old_library $finalize_deplibs" 8137*6a54128fSAndroid Build Coastguard Worker else 8138*6a54128fSAndroid Build Coastguard Worker deplibs="$lib $deplibs" # used for prog,scan pass 8139*6a54128fSAndroid Build Coastguard Worker fi 8140*6a54128fSAndroid Build Coastguard Worker continue 8141*6a54128fSAndroid Build Coastguard Worker fi 8142*6a54128fSAndroid Build Coastguard Worker 8143*6a54128fSAndroid Build Coastguard Worker 8144*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode" && test link != "$pass"; then 8145*6a54128fSAndroid Build Coastguard Worker func_append newlib_search_path " $ladir" 8146*6a54128fSAndroid Build Coastguard Worker deplibs="$lib $deplibs" 8147*6a54128fSAndroid Build Coastguard Worker 8148*6a54128fSAndroid Build Coastguard Worker linkalldeplibs=false 8149*6a54128fSAndroid Build Coastguard Worker if test no != "$link_all_deplibs" || test -z "$library_names" || 8150*6a54128fSAndroid Build Coastguard Worker test no = "$build_libtool_libs"; then 8151*6a54128fSAndroid Build Coastguard Worker linkalldeplibs=: 8152*6a54128fSAndroid Build Coastguard Worker fi 8153*6a54128fSAndroid Build Coastguard Worker 8154*6a54128fSAndroid Build Coastguard Worker tmp_libs= 8155*6a54128fSAndroid Build Coastguard Worker for deplib in $dependency_libs; do 8156*6a54128fSAndroid Build Coastguard Worker case $deplib in 8157*6a54128fSAndroid Build Coastguard Worker -L*) func_stripname '-L' '' "$deplib" 8158*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$func_stripname_result" 8159*6a54128fSAndroid Build Coastguard Worker func_append newlib_search_path " $func_resolve_sysroot_result" 8160*6a54128fSAndroid Build Coastguard Worker ;; 8161*6a54128fSAndroid Build Coastguard Worker esac 8162*6a54128fSAndroid Build Coastguard Worker # Need to link against all dependency_libs? 8163*6a54128fSAndroid Build Coastguard Worker if $linkalldeplibs; then 8164*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 8165*6a54128fSAndroid Build Coastguard Worker else 8166*6a54128fSAndroid Build Coastguard Worker # Need to hardcode shared library paths 8167*6a54128fSAndroid Build Coastguard Worker # or/and link against static libraries 8168*6a54128fSAndroid Build Coastguard Worker newdependency_libs="$deplib $newdependency_libs" 8169*6a54128fSAndroid Build Coastguard Worker fi 8170*6a54128fSAndroid Build Coastguard Worker if $opt_preserve_dup_deps; then 8171*6a54128fSAndroid Build Coastguard Worker case "$tmp_libs " in 8172*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) func_append specialdeplibs " $deplib" ;; 8173*6a54128fSAndroid Build Coastguard Worker esac 8174*6a54128fSAndroid Build Coastguard Worker fi 8175*6a54128fSAndroid Build Coastguard Worker func_append tmp_libs " $deplib" 8176*6a54128fSAndroid Build Coastguard Worker done # for deplib 8177*6a54128fSAndroid Build Coastguard Worker continue 8178*6a54128fSAndroid Build Coastguard Worker fi # $linkmode = prog... 8179*6a54128fSAndroid Build Coastguard Worker 8180*6a54128fSAndroid Build Coastguard Worker if test prog,link = "$linkmode,$pass"; then 8181*6a54128fSAndroid Build Coastguard Worker if test -n "$library_names" && 8182*6a54128fSAndroid Build Coastguard Worker { { test no = "$prefer_static_libs" || 8183*6a54128fSAndroid Build Coastguard Worker test built,yes = "$prefer_static_libs,$installed"; } || 8184*6a54128fSAndroid Build Coastguard Worker test -z "$old_library"; }; then 8185*6a54128fSAndroid Build Coastguard Worker # We need to hardcode the library path 8186*6a54128fSAndroid Build Coastguard Worker if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then 8187*6a54128fSAndroid Build Coastguard Worker # Make sure the rpath contains only unique directories. 8188*6a54128fSAndroid Build Coastguard Worker case $temp_rpath: in 8189*6a54128fSAndroid Build Coastguard Worker *"$absdir:"*) ;; 8190*6a54128fSAndroid Build Coastguard Worker *) func_append temp_rpath "$absdir:" ;; 8191*6a54128fSAndroid Build Coastguard Worker esac 8192*6a54128fSAndroid Build Coastguard Worker fi 8193*6a54128fSAndroid Build Coastguard Worker 8194*6a54128fSAndroid Build Coastguard Worker # Hardcode the library path. 8195*6a54128fSAndroid Build Coastguard Worker # Skip directories that are in the system default run-time 8196*6a54128fSAndroid Build Coastguard Worker # search path. 8197*6a54128fSAndroid Build Coastguard Worker case " $sys_lib_dlsearch_path " in 8198*6a54128fSAndroid Build Coastguard Worker *" $absdir "*) ;; 8199*6a54128fSAndroid Build Coastguard Worker *) 8200*6a54128fSAndroid Build Coastguard Worker case "$compile_rpath " in 8201*6a54128fSAndroid Build Coastguard Worker *" $absdir "*) ;; 8202*6a54128fSAndroid Build Coastguard Worker *) func_append compile_rpath " $absdir" ;; 8203*6a54128fSAndroid Build Coastguard Worker esac 8204*6a54128fSAndroid Build Coastguard Worker ;; 8205*6a54128fSAndroid Build Coastguard Worker esac 8206*6a54128fSAndroid Build Coastguard Worker case " $sys_lib_dlsearch_path " in 8207*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 8208*6a54128fSAndroid Build Coastguard Worker *) 8209*6a54128fSAndroid Build Coastguard Worker case "$finalize_rpath " in 8210*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 8211*6a54128fSAndroid Build Coastguard Worker *) func_append finalize_rpath " $libdir" ;; 8212*6a54128fSAndroid Build Coastguard Worker esac 8213*6a54128fSAndroid Build Coastguard Worker ;; 8214*6a54128fSAndroid Build Coastguard Worker esac 8215*6a54128fSAndroid Build Coastguard Worker fi # $linkmode,$pass = prog,link... 8216*6a54128fSAndroid Build Coastguard Worker 8217*6a54128fSAndroid Build Coastguard Worker if $alldeplibs && 8218*6a54128fSAndroid Build Coastguard Worker { test pass_all = "$deplibs_check_method" || 8219*6a54128fSAndroid Build Coastguard Worker { test yes = "$build_libtool_libs" && 8220*6a54128fSAndroid Build Coastguard Worker test -n "$library_names"; }; }; then 8221*6a54128fSAndroid Build Coastguard Worker # We only need to search for static libraries 8222*6a54128fSAndroid Build Coastguard Worker continue 8223*6a54128fSAndroid Build Coastguard Worker fi 8224*6a54128fSAndroid Build Coastguard Worker fi 8225*6a54128fSAndroid Build Coastguard Worker 8226*6a54128fSAndroid Build Coastguard Worker link_static=no # Whether the deplib will be linked statically 8227*6a54128fSAndroid Build Coastguard Worker use_static_libs=$prefer_static_libs 8228*6a54128fSAndroid Build Coastguard Worker if test built = "$use_static_libs" && test yes = "$installed"; then 8229*6a54128fSAndroid Build Coastguard Worker use_static_libs=no 8230*6a54128fSAndroid Build Coastguard Worker fi 8231*6a54128fSAndroid Build Coastguard Worker if test -n "$library_names" && 8232*6a54128fSAndroid Build Coastguard Worker { test no = "$use_static_libs" || test -z "$old_library"; }; then 8233*6a54128fSAndroid Build Coastguard Worker case $host in 8234*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw* | *cegcc* | *os2*) 8235*6a54128fSAndroid Build Coastguard Worker # No point in relinking DLLs because paths are not encoded 8236*6a54128fSAndroid Build Coastguard Worker func_append notinst_deplibs " $lib" 8237*6a54128fSAndroid Build Coastguard Worker need_relink=no 8238*6a54128fSAndroid Build Coastguard Worker ;; 8239*6a54128fSAndroid Build Coastguard Worker *) 8240*6a54128fSAndroid Build Coastguard Worker if test no = "$installed"; then 8241*6a54128fSAndroid Build Coastguard Worker func_append notinst_deplibs " $lib" 8242*6a54128fSAndroid Build Coastguard Worker need_relink=yes 8243*6a54128fSAndroid Build Coastguard Worker fi 8244*6a54128fSAndroid Build Coastguard Worker ;; 8245*6a54128fSAndroid Build Coastguard Worker esac 8246*6a54128fSAndroid Build Coastguard Worker # This is a shared library 8247*6a54128fSAndroid Build Coastguard Worker 8248*6a54128fSAndroid Build Coastguard Worker # Warn about portability, can't link against -module's on some 8249*6a54128fSAndroid Build Coastguard Worker # systems (darwin). Don't bleat about dlopened modules though! 8250*6a54128fSAndroid Build Coastguard Worker dlopenmodule= 8251*6a54128fSAndroid Build Coastguard Worker for dlpremoduletest in $dlprefiles; do 8252*6a54128fSAndroid Build Coastguard Worker if test "X$dlpremoduletest" = "X$lib"; then 8253*6a54128fSAndroid Build Coastguard Worker dlopenmodule=$dlpremoduletest 8254*6a54128fSAndroid Build Coastguard Worker break 8255*6a54128fSAndroid Build Coastguard Worker fi 8256*6a54128fSAndroid Build Coastguard Worker done 8257*6a54128fSAndroid Build Coastguard Worker if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then 8258*6a54128fSAndroid Build Coastguard Worker echo 8259*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode"; then 8260*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: Linking the executable $output against the loadable module" 8261*6a54128fSAndroid Build Coastguard Worker else 8262*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: Linking the shared library $output against the loadable module" 8263*6a54128fSAndroid Build Coastguard Worker fi 8264*6a54128fSAndroid Build Coastguard Worker $ECHO "*** $linklib is not portable!" 8265*6a54128fSAndroid Build Coastguard Worker fi 8266*6a54128fSAndroid Build Coastguard Worker if test lib = "$linkmode" && 8267*6a54128fSAndroid Build Coastguard Worker test yes = "$hardcode_into_libs"; then 8268*6a54128fSAndroid Build Coastguard Worker # Hardcode the library path. 8269*6a54128fSAndroid Build Coastguard Worker # Skip directories that are in the system default run-time 8270*6a54128fSAndroid Build Coastguard Worker # search path. 8271*6a54128fSAndroid Build Coastguard Worker case " $sys_lib_dlsearch_path " in 8272*6a54128fSAndroid Build Coastguard Worker *" $absdir "*) ;; 8273*6a54128fSAndroid Build Coastguard Worker *) 8274*6a54128fSAndroid Build Coastguard Worker case "$compile_rpath " in 8275*6a54128fSAndroid Build Coastguard Worker *" $absdir "*) ;; 8276*6a54128fSAndroid Build Coastguard Worker *) func_append compile_rpath " $absdir" ;; 8277*6a54128fSAndroid Build Coastguard Worker esac 8278*6a54128fSAndroid Build Coastguard Worker ;; 8279*6a54128fSAndroid Build Coastguard Worker esac 8280*6a54128fSAndroid Build Coastguard Worker case " $sys_lib_dlsearch_path " in 8281*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 8282*6a54128fSAndroid Build Coastguard Worker *) 8283*6a54128fSAndroid Build Coastguard Worker case "$finalize_rpath " in 8284*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 8285*6a54128fSAndroid Build Coastguard Worker *) func_append finalize_rpath " $libdir" ;; 8286*6a54128fSAndroid Build Coastguard Worker esac 8287*6a54128fSAndroid Build Coastguard Worker ;; 8288*6a54128fSAndroid Build Coastguard Worker esac 8289*6a54128fSAndroid Build Coastguard Worker fi 8290*6a54128fSAndroid Build Coastguard Worker 8291*6a54128fSAndroid Build Coastguard Worker if test -n "$old_archive_from_expsyms_cmds"; then 8292*6a54128fSAndroid Build Coastguard Worker # figure out the soname 8293*6a54128fSAndroid Build Coastguard Worker set dummy $library_names 8294*6a54128fSAndroid Build Coastguard Worker shift 8295*6a54128fSAndroid Build Coastguard Worker realname=$1 8296*6a54128fSAndroid Build Coastguard Worker shift 8297*6a54128fSAndroid Build Coastguard Worker libname=`eval "\\$ECHO \"$libname_spec\""` 8298*6a54128fSAndroid Build Coastguard Worker # use dlname if we got it. it's perfectly good, no? 8299*6a54128fSAndroid Build Coastguard Worker if test -n "$dlname"; then 8300*6a54128fSAndroid Build Coastguard Worker soname=$dlname 8301*6a54128fSAndroid Build Coastguard Worker elif test -n "$soname_spec"; then 8302*6a54128fSAndroid Build Coastguard Worker # bleh windows 8303*6a54128fSAndroid Build Coastguard Worker case $host in 8304*6a54128fSAndroid Build Coastguard Worker *cygwin* | mingw* | *cegcc* | *os2*) 8305*6a54128fSAndroid Build Coastguard Worker func_arith $current - $age 8306*6a54128fSAndroid Build Coastguard Worker major=$func_arith_result 8307*6a54128fSAndroid Build Coastguard Worker versuffix=-$major 8308*6a54128fSAndroid Build Coastguard Worker ;; 8309*6a54128fSAndroid Build Coastguard Worker esac 8310*6a54128fSAndroid Build Coastguard Worker eval soname=\"$soname_spec\" 8311*6a54128fSAndroid Build Coastguard Worker else 8312*6a54128fSAndroid Build Coastguard Worker soname=$realname 8313*6a54128fSAndroid Build Coastguard Worker fi 8314*6a54128fSAndroid Build Coastguard Worker 8315*6a54128fSAndroid Build Coastguard Worker # Make a new name for the extract_expsyms_cmds to use 8316*6a54128fSAndroid Build Coastguard Worker soroot=$soname 8317*6a54128fSAndroid Build Coastguard Worker func_basename "$soroot" 8318*6a54128fSAndroid Build Coastguard Worker soname=$func_basename_result 8319*6a54128fSAndroid Build Coastguard Worker func_stripname 'lib' '.dll' "$soname" 8320*6a54128fSAndroid Build Coastguard Worker newlib=libimp-$func_stripname_result.a 8321*6a54128fSAndroid Build Coastguard Worker 8322*6a54128fSAndroid Build Coastguard Worker # If the library has no export list, then create one now 8323*6a54128fSAndroid Build Coastguard Worker if test -f "$output_objdir/$soname-def"; then : 8324*6a54128fSAndroid Build Coastguard Worker else 8325*6a54128fSAndroid Build Coastguard Worker func_verbose "extracting exported symbol list from '$soname'" 8326*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$extract_expsyms_cmds" 'exit $?' 8327*6a54128fSAndroid Build Coastguard Worker fi 8328*6a54128fSAndroid Build Coastguard Worker 8329*6a54128fSAndroid Build Coastguard Worker # Create $newlib 8330*6a54128fSAndroid Build Coastguard Worker if test -f "$output_objdir/$newlib"; then :; else 8331*6a54128fSAndroid Build Coastguard Worker func_verbose "generating import library for '$soname'" 8332*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 8333*6a54128fSAndroid Build Coastguard Worker fi 8334*6a54128fSAndroid Build Coastguard Worker # make sure the library variables are pointing to the new library 8335*6a54128fSAndroid Build Coastguard Worker dir=$output_objdir 8336*6a54128fSAndroid Build Coastguard Worker linklib=$newlib 8337*6a54128fSAndroid Build Coastguard Worker fi # test -n "$old_archive_from_expsyms_cmds" 8338*6a54128fSAndroid Build Coastguard Worker 8339*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode" || test relink != "$opt_mode"; then 8340*6a54128fSAndroid Build Coastguard Worker add_shlibpath= 8341*6a54128fSAndroid Build Coastguard Worker add_dir= 8342*6a54128fSAndroid Build Coastguard Worker add= 8343*6a54128fSAndroid Build Coastguard Worker lib_linked=yes 8344*6a54128fSAndroid Build Coastguard Worker case $hardcode_action in 8345*6a54128fSAndroid Build Coastguard Worker immediate | unsupported) 8346*6a54128fSAndroid Build Coastguard Worker if test no = "$hardcode_direct"; then 8347*6a54128fSAndroid Build Coastguard Worker add=$dir/$linklib 8348*6a54128fSAndroid Build Coastguard Worker case $host in 8349*6a54128fSAndroid Build Coastguard Worker *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; 8350*6a54128fSAndroid Build Coastguard Worker *-*-sysv4*uw2*) add_dir=-L$dir ;; 8351*6a54128fSAndroid Build Coastguard Worker *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 8352*6a54128fSAndroid Build Coastguard Worker *-*-unixware7*) add_dir=-L$dir ;; 8353*6a54128fSAndroid Build Coastguard Worker *-*-darwin* ) 8354*6a54128fSAndroid Build Coastguard Worker # if the lib is a (non-dlopened) module then we cannot 8355*6a54128fSAndroid Build Coastguard Worker # link against it, someone is ignoring the earlier warnings 8356*6a54128fSAndroid Build Coastguard Worker if /usr/bin/file -L $add 2> /dev/null | 8357*6a54128fSAndroid Build Coastguard Worker $GREP ": [^:]* bundle" >/dev/null; then 8358*6a54128fSAndroid Build Coastguard Worker if test "X$dlopenmodule" != "X$lib"; then 8359*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: lib $linklib is a module, not a shared library" 8360*6a54128fSAndroid Build Coastguard Worker if test -z "$old_library"; then 8361*6a54128fSAndroid Build Coastguard Worker echo 8362*6a54128fSAndroid Build Coastguard Worker echo "*** And there doesn't seem to be a static archive available" 8363*6a54128fSAndroid Build Coastguard Worker echo "*** The link will probably fail, sorry" 8364*6a54128fSAndroid Build Coastguard Worker else 8365*6a54128fSAndroid Build Coastguard Worker add=$dir/$old_library 8366*6a54128fSAndroid Build Coastguard Worker fi 8367*6a54128fSAndroid Build Coastguard Worker elif test -n "$old_library"; then 8368*6a54128fSAndroid Build Coastguard Worker add=$dir/$old_library 8369*6a54128fSAndroid Build Coastguard Worker fi 8370*6a54128fSAndroid Build Coastguard Worker fi 8371*6a54128fSAndroid Build Coastguard Worker esac 8372*6a54128fSAndroid Build Coastguard Worker elif test no = "$hardcode_minus_L"; then 8373*6a54128fSAndroid Build Coastguard Worker case $host in 8374*6a54128fSAndroid Build Coastguard Worker *-*-sunos*) add_shlibpath=$dir ;; 8375*6a54128fSAndroid Build Coastguard Worker esac 8376*6a54128fSAndroid Build Coastguard Worker add_dir=-L$dir 8377*6a54128fSAndroid Build Coastguard Worker add=-l$name 8378*6a54128fSAndroid Build Coastguard Worker elif test no = "$hardcode_shlibpath_var"; then 8379*6a54128fSAndroid Build Coastguard Worker add_shlibpath=$dir 8380*6a54128fSAndroid Build Coastguard Worker add=-l$name 8381*6a54128fSAndroid Build Coastguard Worker else 8382*6a54128fSAndroid Build Coastguard Worker lib_linked=no 8383*6a54128fSAndroid Build Coastguard Worker fi 8384*6a54128fSAndroid Build Coastguard Worker ;; 8385*6a54128fSAndroid Build Coastguard Worker relink) 8386*6a54128fSAndroid Build Coastguard Worker if test yes = "$hardcode_direct" && 8387*6a54128fSAndroid Build Coastguard Worker test no = "$hardcode_direct_absolute"; then 8388*6a54128fSAndroid Build Coastguard Worker add=$dir/$linklib 8389*6a54128fSAndroid Build Coastguard Worker elif test yes = "$hardcode_minus_L"; then 8390*6a54128fSAndroid Build Coastguard Worker add_dir=-L$absdir 8391*6a54128fSAndroid Build Coastguard Worker # Try looking first in the location we're being installed to. 8392*6a54128fSAndroid Build Coastguard Worker if test -n "$inst_prefix_dir"; then 8393*6a54128fSAndroid Build Coastguard Worker case $libdir in 8394*6a54128fSAndroid Build Coastguard Worker [\\/]*) 8395*6a54128fSAndroid Build Coastguard Worker func_append add_dir " -L$inst_prefix_dir$libdir" 8396*6a54128fSAndroid Build Coastguard Worker ;; 8397*6a54128fSAndroid Build Coastguard Worker esac 8398*6a54128fSAndroid Build Coastguard Worker fi 8399*6a54128fSAndroid Build Coastguard Worker add=-l$name 8400*6a54128fSAndroid Build Coastguard Worker elif test yes = "$hardcode_shlibpath_var"; then 8401*6a54128fSAndroid Build Coastguard Worker add_shlibpath=$dir 8402*6a54128fSAndroid Build Coastguard Worker add=-l$name 8403*6a54128fSAndroid Build Coastguard Worker else 8404*6a54128fSAndroid Build Coastguard Worker lib_linked=no 8405*6a54128fSAndroid Build Coastguard Worker fi 8406*6a54128fSAndroid Build Coastguard Worker ;; 8407*6a54128fSAndroid Build Coastguard Worker *) lib_linked=no ;; 8408*6a54128fSAndroid Build Coastguard Worker esac 8409*6a54128fSAndroid Build Coastguard Worker 8410*6a54128fSAndroid Build Coastguard Worker if test yes != "$lib_linked"; then 8411*6a54128fSAndroid Build Coastguard Worker func_fatal_configuration "unsupported hardcode properties" 8412*6a54128fSAndroid Build Coastguard Worker fi 8413*6a54128fSAndroid Build Coastguard Worker 8414*6a54128fSAndroid Build Coastguard Worker if test -n "$add_shlibpath"; then 8415*6a54128fSAndroid Build Coastguard Worker case :$compile_shlibpath: in 8416*6a54128fSAndroid Build Coastguard Worker *":$add_shlibpath:"*) ;; 8417*6a54128fSAndroid Build Coastguard Worker *) func_append compile_shlibpath "$add_shlibpath:" ;; 8418*6a54128fSAndroid Build Coastguard Worker esac 8419*6a54128fSAndroid Build Coastguard Worker fi 8420*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode"; then 8421*6a54128fSAndroid Build Coastguard Worker test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 8422*6a54128fSAndroid Build Coastguard Worker test -n "$add" && compile_deplibs="$add $compile_deplibs" 8423*6a54128fSAndroid Build Coastguard Worker else 8424*6a54128fSAndroid Build Coastguard Worker test -n "$add_dir" && deplibs="$add_dir $deplibs" 8425*6a54128fSAndroid Build Coastguard Worker test -n "$add" && deplibs="$add $deplibs" 8426*6a54128fSAndroid Build Coastguard Worker if test yes != "$hardcode_direct" && 8427*6a54128fSAndroid Build Coastguard Worker test yes != "$hardcode_minus_L" && 8428*6a54128fSAndroid Build Coastguard Worker test yes = "$hardcode_shlibpath_var"; then 8429*6a54128fSAndroid Build Coastguard Worker case :$finalize_shlibpath: in 8430*6a54128fSAndroid Build Coastguard Worker *":$libdir:"*) ;; 8431*6a54128fSAndroid Build Coastguard Worker *) func_append finalize_shlibpath "$libdir:" ;; 8432*6a54128fSAndroid Build Coastguard Worker esac 8433*6a54128fSAndroid Build Coastguard Worker fi 8434*6a54128fSAndroid Build Coastguard Worker fi 8435*6a54128fSAndroid Build Coastguard Worker fi 8436*6a54128fSAndroid Build Coastguard Worker 8437*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode" || test relink = "$opt_mode"; then 8438*6a54128fSAndroid Build Coastguard Worker add_shlibpath= 8439*6a54128fSAndroid Build Coastguard Worker add_dir= 8440*6a54128fSAndroid Build Coastguard Worker add= 8441*6a54128fSAndroid Build Coastguard Worker # Finalize command for both is simple: just hardcode it. 8442*6a54128fSAndroid Build Coastguard Worker if test yes = "$hardcode_direct" && 8443*6a54128fSAndroid Build Coastguard Worker test no = "$hardcode_direct_absolute"; then 8444*6a54128fSAndroid Build Coastguard Worker add=$libdir/$linklib 8445*6a54128fSAndroid Build Coastguard Worker elif test yes = "$hardcode_minus_L"; then 8446*6a54128fSAndroid Build Coastguard Worker add_dir=-L$libdir 8447*6a54128fSAndroid Build Coastguard Worker add=-l$name 8448*6a54128fSAndroid Build Coastguard Worker elif test yes = "$hardcode_shlibpath_var"; then 8449*6a54128fSAndroid Build Coastguard Worker case :$finalize_shlibpath: in 8450*6a54128fSAndroid Build Coastguard Worker *":$libdir:"*) ;; 8451*6a54128fSAndroid Build Coastguard Worker *) func_append finalize_shlibpath "$libdir:" ;; 8452*6a54128fSAndroid Build Coastguard Worker esac 8453*6a54128fSAndroid Build Coastguard Worker add=-l$name 8454*6a54128fSAndroid Build Coastguard Worker elif test yes = "$hardcode_automatic"; then 8455*6a54128fSAndroid Build Coastguard Worker if test -n "$inst_prefix_dir" && 8456*6a54128fSAndroid Build Coastguard Worker test -f "$inst_prefix_dir$libdir/$linklib"; then 8457*6a54128fSAndroid Build Coastguard Worker add=$inst_prefix_dir$libdir/$linklib 8458*6a54128fSAndroid Build Coastguard Worker else 8459*6a54128fSAndroid Build Coastguard Worker add=$libdir/$linklib 8460*6a54128fSAndroid Build Coastguard Worker fi 8461*6a54128fSAndroid Build Coastguard Worker else 8462*6a54128fSAndroid Build Coastguard Worker # We cannot seem to hardcode it, guess we'll fake it. 8463*6a54128fSAndroid Build Coastguard Worker add_dir=-L$libdir 8464*6a54128fSAndroid Build Coastguard Worker # Try looking first in the location we're being installed to. 8465*6a54128fSAndroid Build Coastguard Worker if test -n "$inst_prefix_dir"; then 8466*6a54128fSAndroid Build Coastguard Worker case $libdir in 8467*6a54128fSAndroid Build Coastguard Worker [\\/]*) 8468*6a54128fSAndroid Build Coastguard Worker func_append add_dir " -L$inst_prefix_dir$libdir" 8469*6a54128fSAndroid Build Coastguard Worker ;; 8470*6a54128fSAndroid Build Coastguard Worker esac 8471*6a54128fSAndroid Build Coastguard Worker fi 8472*6a54128fSAndroid Build Coastguard Worker add=-l$name 8473*6a54128fSAndroid Build Coastguard Worker fi 8474*6a54128fSAndroid Build Coastguard Worker 8475*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode"; then 8476*6a54128fSAndroid Build Coastguard Worker test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 8477*6a54128fSAndroid Build Coastguard Worker test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 8478*6a54128fSAndroid Build Coastguard Worker else 8479*6a54128fSAndroid Build Coastguard Worker test -n "$add_dir" && deplibs="$add_dir $deplibs" 8480*6a54128fSAndroid Build Coastguard Worker test -n "$add" && deplibs="$add $deplibs" 8481*6a54128fSAndroid Build Coastguard Worker fi 8482*6a54128fSAndroid Build Coastguard Worker fi 8483*6a54128fSAndroid Build Coastguard Worker elif test prog = "$linkmode"; then 8484*6a54128fSAndroid Build Coastguard Worker # Here we assume that one of hardcode_direct or hardcode_minus_L 8485*6a54128fSAndroid Build Coastguard Worker # is not unsupported. This is valid on all known static and 8486*6a54128fSAndroid Build Coastguard Worker # shared platforms. 8487*6a54128fSAndroid Build Coastguard Worker if test unsupported != "$hardcode_direct"; then 8488*6a54128fSAndroid Build Coastguard Worker test -n "$old_library" && linklib=$old_library 8489*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$dir/$linklib $compile_deplibs" 8490*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$dir/$linklib $finalize_deplibs" 8491*6a54128fSAndroid Build Coastguard Worker else 8492*6a54128fSAndroid Build Coastguard Worker compile_deplibs="-l$name -L$dir $compile_deplibs" 8493*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="-l$name -L$dir $finalize_deplibs" 8494*6a54128fSAndroid Build Coastguard Worker fi 8495*6a54128fSAndroid Build Coastguard Worker elif test yes = "$build_libtool_libs"; then 8496*6a54128fSAndroid Build Coastguard Worker # Not a shared library 8497*6a54128fSAndroid Build Coastguard Worker if test pass_all != "$deplibs_check_method"; then 8498*6a54128fSAndroid Build Coastguard Worker # We're trying link a shared library against a static one 8499*6a54128fSAndroid Build Coastguard Worker # but the system doesn't support it. 8500*6a54128fSAndroid Build Coastguard Worker 8501*6a54128fSAndroid Build Coastguard Worker # Just print a warning and add the library to dependency_libs so 8502*6a54128fSAndroid Build Coastguard Worker # that the program can be linked against the static library. 8503*6a54128fSAndroid Build Coastguard Worker echo 8504*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: This system cannot link to static lib archive $lib." 8505*6a54128fSAndroid Build Coastguard Worker echo "*** I have the capability to make that library automatically link in when" 8506*6a54128fSAndroid Build Coastguard Worker echo "*** you link to this library. But I can only do this if you have a" 8507*6a54128fSAndroid Build Coastguard Worker echo "*** shared version of the library, which you do not appear to have." 8508*6a54128fSAndroid Build Coastguard Worker if test yes = "$module"; then 8509*6a54128fSAndroid Build Coastguard Worker echo "*** But as you try to build a module library, libtool will still create " 8510*6a54128fSAndroid Build Coastguard Worker echo "*** a static module, that should work as long as the dlopening application" 8511*6a54128fSAndroid Build Coastguard Worker echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 8512*6a54128fSAndroid Build Coastguard Worker if test -z "$global_symbol_pipe"; then 8513*6a54128fSAndroid Build Coastguard Worker echo 8514*6a54128fSAndroid Build Coastguard Worker echo "*** However, this would only work if libtool was able to extract symbol" 8515*6a54128fSAndroid Build Coastguard Worker echo "*** lists from a program, using 'nm' or equivalent, but libtool could" 8516*6a54128fSAndroid Build Coastguard Worker echo "*** not find such a program. So, this module is probably useless." 8517*6a54128fSAndroid Build Coastguard Worker echo "*** 'nm' from GNU binutils and a full rebuild may help." 8518*6a54128fSAndroid Build Coastguard Worker fi 8519*6a54128fSAndroid Build Coastguard Worker if test no = "$build_old_libs"; then 8520*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=module 8521*6a54128fSAndroid Build Coastguard Worker build_old_libs=yes 8522*6a54128fSAndroid Build Coastguard Worker else 8523*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=no 8524*6a54128fSAndroid Build Coastguard Worker fi 8525*6a54128fSAndroid Build Coastguard Worker fi 8526*6a54128fSAndroid Build Coastguard Worker else 8527*6a54128fSAndroid Build Coastguard Worker deplibs="$dir/$old_library $deplibs" 8528*6a54128fSAndroid Build Coastguard Worker link_static=yes 8529*6a54128fSAndroid Build Coastguard Worker fi 8530*6a54128fSAndroid Build Coastguard Worker fi # link shared/static library? 8531*6a54128fSAndroid Build Coastguard Worker 8532*6a54128fSAndroid Build Coastguard Worker if test lib = "$linkmode"; then 8533*6a54128fSAndroid Build Coastguard Worker if test -n "$dependency_libs" && 8534*6a54128fSAndroid Build Coastguard Worker { test yes != "$hardcode_into_libs" || 8535*6a54128fSAndroid Build Coastguard Worker test yes = "$build_old_libs" || 8536*6a54128fSAndroid Build Coastguard Worker test yes = "$link_static"; }; then 8537*6a54128fSAndroid Build Coastguard Worker # Extract -R from dependency_libs 8538*6a54128fSAndroid Build Coastguard Worker temp_deplibs= 8539*6a54128fSAndroid Build Coastguard Worker for libdir in $dependency_libs; do 8540*6a54128fSAndroid Build Coastguard Worker case $libdir in 8541*6a54128fSAndroid Build Coastguard Worker -R*) func_stripname '-R' '' "$libdir" 8542*6a54128fSAndroid Build Coastguard Worker temp_xrpath=$func_stripname_result 8543*6a54128fSAndroid Build Coastguard Worker case " $xrpath " in 8544*6a54128fSAndroid Build Coastguard Worker *" $temp_xrpath "*) ;; 8545*6a54128fSAndroid Build Coastguard Worker *) func_append xrpath " $temp_xrpath";; 8546*6a54128fSAndroid Build Coastguard Worker esac;; 8547*6a54128fSAndroid Build Coastguard Worker *) func_append temp_deplibs " $libdir";; 8548*6a54128fSAndroid Build Coastguard Worker esac 8549*6a54128fSAndroid Build Coastguard Worker done 8550*6a54128fSAndroid Build Coastguard Worker dependency_libs=$temp_deplibs 8551*6a54128fSAndroid Build Coastguard Worker fi 8552*6a54128fSAndroid Build Coastguard Worker 8553*6a54128fSAndroid Build Coastguard Worker func_append newlib_search_path " $absdir" 8554*6a54128fSAndroid Build Coastguard Worker # Link against this library 8555*6a54128fSAndroid Build Coastguard Worker test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 8556*6a54128fSAndroid Build Coastguard Worker # ... and its dependency_libs 8557*6a54128fSAndroid Build Coastguard Worker tmp_libs= 8558*6a54128fSAndroid Build Coastguard Worker for deplib in $dependency_libs; do 8559*6a54128fSAndroid Build Coastguard Worker newdependency_libs="$deplib $newdependency_libs" 8560*6a54128fSAndroid Build Coastguard Worker case $deplib in 8561*6a54128fSAndroid Build Coastguard Worker -L*) func_stripname '-L' '' "$deplib" 8562*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$func_stripname_result";; 8563*6a54128fSAndroid Build Coastguard Worker *) func_resolve_sysroot "$deplib" ;; 8564*6a54128fSAndroid Build Coastguard Worker esac 8565*6a54128fSAndroid Build Coastguard Worker if $opt_preserve_dup_deps; then 8566*6a54128fSAndroid Build Coastguard Worker case "$tmp_libs " in 8567*6a54128fSAndroid Build Coastguard Worker *" $func_resolve_sysroot_result "*) 8568*6a54128fSAndroid Build Coastguard Worker func_append specialdeplibs " $func_resolve_sysroot_result" ;; 8569*6a54128fSAndroid Build Coastguard Worker esac 8570*6a54128fSAndroid Build Coastguard Worker fi 8571*6a54128fSAndroid Build Coastguard Worker func_append tmp_libs " $func_resolve_sysroot_result" 8572*6a54128fSAndroid Build Coastguard Worker done 8573*6a54128fSAndroid Build Coastguard Worker 8574*6a54128fSAndroid Build Coastguard Worker if test no != "$link_all_deplibs"; then 8575*6a54128fSAndroid Build Coastguard Worker # Add the search paths of all dependency libraries 8576*6a54128fSAndroid Build Coastguard Worker for deplib in $dependency_libs; do 8577*6a54128fSAndroid Build Coastguard Worker path= 8578*6a54128fSAndroid Build Coastguard Worker case $deplib in 8579*6a54128fSAndroid Build Coastguard Worker -L*) path=$deplib ;; 8580*6a54128fSAndroid Build Coastguard Worker *.la) 8581*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$deplib" 8582*6a54128fSAndroid Build Coastguard Worker deplib=$func_resolve_sysroot_result 8583*6a54128fSAndroid Build Coastguard Worker func_dirname "$deplib" "" "." 8584*6a54128fSAndroid Build Coastguard Worker dir=$func_dirname_result 8585*6a54128fSAndroid Build Coastguard Worker # We need an absolute path. 8586*6a54128fSAndroid Build Coastguard Worker case $dir in 8587*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; 8588*6a54128fSAndroid Build Coastguard Worker *) 8589*6a54128fSAndroid Build Coastguard Worker absdir=`cd "$dir" && pwd` 8590*6a54128fSAndroid Build Coastguard Worker if test -z "$absdir"; then 8591*6a54128fSAndroid Build Coastguard Worker func_warning "cannot determine absolute directory name of '$dir'" 8592*6a54128fSAndroid Build Coastguard Worker absdir=$dir 8593*6a54128fSAndroid Build Coastguard Worker fi 8594*6a54128fSAndroid Build Coastguard Worker ;; 8595*6a54128fSAndroid Build Coastguard Worker esac 8596*6a54128fSAndroid Build Coastguard Worker if $GREP "^installed=no" $deplib > /dev/null; then 8597*6a54128fSAndroid Build Coastguard Worker case $host in 8598*6a54128fSAndroid Build Coastguard Worker *-*-darwin*) 8599*6a54128fSAndroid Build Coastguard Worker depdepl= 8600*6a54128fSAndroid Build Coastguard Worker eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 8601*6a54128fSAndroid Build Coastguard Worker if test -n "$deplibrary_names"; then 8602*6a54128fSAndroid Build Coastguard Worker for tmp in $deplibrary_names; do 8603*6a54128fSAndroid Build Coastguard Worker depdepl=$tmp 8604*6a54128fSAndroid Build Coastguard Worker done 8605*6a54128fSAndroid Build Coastguard Worker if test -f "$absdir/$objdir/$depdepl"; then 8606*6a54128fSAndroid Build Coastguard Worker depdepl=$absdir/$objdir/$depdepl 8607*6a54128fSAndroid Build Coastguard Worker darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 8608*6a54128fSAndroid Build Coastguard Worker if test -z "$darwin_install_name"; then 8609*6a54128fSAndroid Build Coastguard Worker darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` 8610*6a54128fSAndroid Build Coastguard Worker fi 8611*6a54128fSAndroid Build Coastguard Worker func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" 8612*6a54128fSAndroid Build Coastguard Worker func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" 8613*6a54128fSAndroid Build Coastguard Worker path= 8614*6a54128fSAndroid Build Coastguard Worker fi 8615*6a54128fSAndroid Build Coastguard Worker fi 8616*6a54128fSAndroid Build Coastguard Worker ;; 8617*6a54128fSAndroid Build Coastguard Worker *) 8618*6a54128fSAndroid Build Coastguard Worker path=-L$absdir/$objdir 8619*6a54128fSAndroid Build Coastguard Worker ;; 8620*6a54128fSAndroid Build Coastguard Worker esac 8621*6a54128fSAndroid Build Coastguard Worker else 8622*6a54128fSAndroid Build Coastguard Worker eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 8623*6a54128fSAndroid Build Coastguard Worker test -z "$libdir" && \ 8624*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$deplib' is not a valid libtool archive" 8625*6a54128fSAndroid Build Coastguard Worker test "$absdir" != "$libdir" && \ 8626*6a54128fSAndroid Build Coastguard Worker func_warning "'$deplib' seems to be moved" 8627*6a54128fSAndroid Build Coastguard Worker 8628*6a54128fSAndroid Build Coastguard Worker path=-L$absdir 8629*6a54128fSAndroid Build Coastguard Worker fi 8630*6a54128fSAndroid Build Coastguard Worker ;; 8631*6a54128fSAndroid Build Coastguard Worker esac 8632*6a54128fSAndroid Build Coastguard Worker case " $deplibs " in 8633*6a54128fSAndroid Build Coastguard Worker *" $path "*) ;; 8634*6a54128fSAndroid Build Coastguard Worker *) deplibs="$path $deplibs" ;; 8635*6a54128fSAndroid Build Coastguard Worker esac 8636*6a54128fSAndroid Build Coastguard Worker done 8637*6a54128fSAndroid Build Coastguard Worker fi # link_all_deplibs != no 8638*6a54128fSAndroid Build Coastguard Worker fi # linkmode = lib 8639*6a54128fSAndroid Build Coastguard Worker done # for deplib in $libs 8640*6a54128fSAndroid Build Coastguard Worker if test link = "$pass"; then 8641*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode"; then 8642*6a54128fSAndroid Build Coastguard Worker compile_deplibs="$new_inherited_linker_flags $compile_deplibs" 8643*6a54128fSAndroid Build Coastguard Worker finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" 8644*6a54128fSAndroid Build Coastguard Worker else 8645*6a54128fSAndroid Build Coastguard Worker compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 8646*6a54128fSAndroid Build Coastguard Worker fi 8647*6a54128fSAndroid Build Coastguard Worker fi 8648*6a54128fSAndroid Build Coastguard Worker dependency_libs=$newdependency_libs 8649*6a54128fSAndroid Build Coastguard Worker if test dlpreopen = "$pass"; then 8650*6a54128fSAndroid Build Coastguard Worker # Link the dlpreopened libraries before other libraries 8651*6a54128fSAndroid Build Coastguard Worker for deplib in $save_deplibs; do 8652*6a54128fSAndroid Build Coastguard Worker deplibs="$deplib $deplibs" 8653*6a54128fSAndroid Build Coastguard Worker done 8654*6a54128fSAndroid Build Coastguard Worker fi 8655*6a54128fSAndroid Build Coastguard Worker if test dlopen != "$pass"; then 8656*6a54128fSAndroid Build Coastguard Worker test conv = "$pass" || { 8657*6a54128fSAndroid Build Coastguard Worker # Make sure lib_search_path contains only unique directories. 8658*6a54128fSAndroid Build Coastguard Worker lib_search_path= 8659*6a54128fSAndroid Build Coastguard Worker for dir in $newlib_search_path; do 8660*6a54128fSAndroid Build Coastguard Worker case "$lib_search_path " in 8661*6a54128fSAndroid Build Coastguard Worker *" $dir "*) ;; 8662*6a54128fSAndroid Build Coastguard Worker *) func_append lib_search_path " $dir" ;; 8663*6a54128fSAndroid Build Coastguard Worker esac 8664*6a54128fSAndroid Build Coastguard Worker done 8665*6a54128fSAndroid Build Coastguard Worker newlib_search_path= 8666*6a54128fSAndroid Build Coastguard Worker } 8667*6a54128fSAndroid Build Coastguard Worker 8668*6a54128fSAndroid Build Coastguard Worker if test prog,link = "$linkmode,$pass"; then 8669*6a54128fSAndroid Build Coastguard Worker vars="compile_deplibs finalize_deplibs" 8670*6a54128fSAndroid Build Coastguard Worker else 8671*6a54128fSAndroid Build Coastguard Worker vars=deplibs 8672*6a54128fSAndroid Build Coastguard Worker fi 8673*6a54128fSAndroid Build Coastguard Worker for var in $vars dependency_libs; do 8674*6a54128fSAndroid Build Coastguard Worker # Add libraries to $var in reverse order 8675*6a54128fSAndroid Build Coastguard Worker eval tmp_libs=\"\$$var\" 8676*6a54128fSAndroid Build Coastguard Worker new_libs= 8677*6a54128fSAndroid Build Coastguard Worker for deplib in $tmp_libs; do 8678*6a54128fSAndroid Build Coastguard Worker # FIXME: Pedantically, this is the right thing to do, so 8679*6a54128fSAndroid Build Coastguard Worker # that some nasty dependency loop isn't accidentally 8680*6a54128fSAndroid Build Coastguard Worker # broken: 8681*6a54128fSAndroid Build Coastguard Worker #new_libs="$deplib $new_libs" 8682*6a54128fSAndroid Build Coastguard Worker # Pragmatically, this seems to cause very few problems in 8683*6a54128fSAndroid Build Coastguard Worker # practice: 8684*6a54128fSAndroid Build Coastguard Worker case $deplib in 8685*6a54128fSAndroid Build Coastguard Worker -L*) new_libs="$deplib $new_libs" ;; 8686*6a54128fSAndroid Build Coastguard Worker -R*) ;; 8687*6a54128fSAndroid Build Coastguard Worker *) 8688*6a54128fSAndroid Build Coastguard Worker # And here is the reason: when a library appears more 8689*6a54128fSAndroid Build Coastguard Worker # than once as an explicit dependence of a library, or 8690*6a54128fSAndroid Build Coastguard Worker # is implicitly linked in more than once by the 8691*6a54128fSAndroid Build Coastguard Worker # compiler, it is considered special, and multiple 8692*6a54128fSAndroid Build Coastguard Worker # occurrences thereof are not removed. Compare this 8693*6a54128fSAndroid Build Coastguard Worker # with having the same library being listed as a 8694*6a54128fSAndroid Build Coastguard Worker # dependency of multiple other libraries: in this case, 8695*6a54128fSAndroid Build Coastguard Worker # we know (pedantically, we assume) the library does not 8696*6a54128fSAndroid Build Coastguard Worker # need to be listed more than once, so we keep only the 8697*6a54128fSAndroid Build Coastguard Worker # last copy. This is not always right, but it is rare 8698*6a54128fSAndroid Build Coastguard Worker # enough that we require users that really mean to play 8699*6a54128fSAndroid Build Coastguard Worker # such unportable linking tricks to link the library 8700*6a54128fSAndroid Build Coastguard Worker # using -Wl,-lname, so that libtool does not consider it 8701*6a54128fSAndroid Build Coastguard Worker # for duplicate removal. 8702*6a54128fSAndroid Build Coastguard Worker case " $specialdeplibs " in 8703*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) new_libs="$deplib $new_libs" ;; 8704*6a54128fSAndroid Build Coastguard Worker *) 8705*6a54128fSAndroid Build Coastguard Worker case " $new_libs " in 8706*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) ;; 8707*6a54128fSAndroid Build Coastguard Worker *) new_libs="$deplib $new_libs" ;; 8708*6a54128fSAndroid Build Coastguard Worker esac 8709*6a54128fSAndroid Build Coastguard Worker ;; 8710*6a54128fSAndroid Build Coastguard Worker esac 8711*6a54128fSAndroid Build Coastguard Worker ;; 8712*6a54128fSAndroid Build Coastguard Worker esac 8713*6a54128fSAndroid Build Coastguard Worker done 8714*6a54128fSAndroid Build Coastguard Worker tmp_libs= 8715*6a54128fSAndroid Build Coastguard Worker for deplib in $new_libs; do 8716*6a54128fSAndroid Build Coastguard Worker case $deplib in 8717*6a54128fSAndroid Build Coastguard Worker -L*) 8718*6a54128fSAndroid Build Coastguard Worker case " $tmp_libs " in 8719*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) ;; 8720*6a54128fSAndroid Build Coastguard Worker *) func_append tmp_libs " $deplib" ;; 8721*6a54128fSAndroid Build Coastguard Worker esac 8722*6a54128fSAndroid Build Coastguard Worker ;; 8723*6a54128fSAndroid Build Coastguard Worker *) func_append tmp_libs " $deplib" ;; 8724*6a54128fSAndroid Build Coastguard Worker esac 8725*6a54128fSAndroid Build Coastguard Worker done 8726*6a54128fSAndroid Build Coastguard Worker eval $var=\"$tmp_libs\" 8727*6a54128fSAndroid Build Coastguard Worker done # for var 8728*6a54128fSAndroid Build Coastguard Worker fi 8729*6a54128fSAndroid Build Coastguard Worker 8730*6a54128fSAndroid Build Coastguard Worker # Add Sun CC postdeps if required: 8731*6a54128fSAndroid Build Coastguard Worker test CXX = "$tagname" && { 8732*6a54128fSAndroid Build Coastguard Worker case $host_os in 8733*6a54128fSAndroid Build Coastguard Worker linux*) 8734*6a54128fSAndroid Build Coastguard Worker case `$CC -V 2>&1 | sed 5q` in 8735*6a54128fSAndroid Build Coastguard Worker *Sun\ C*) # Sun C++ 5.9 8736*6a54128fSAndroid Build Coastguard Worker func_suncc_cstd_abi 8737*6a54128fSAndroid Build Coastguard Worker 8738*6a54128fSAndroid Build Coastguard Worker if test no != "$suncc_use_cstd_abi"; then 8739*6a54128fSAndroid Build Coastguard Worker func_append postdeps ' -library=Cstd -library=Crun' 8740*6a54128fSAndroid Build Coastguard Worker fi 8741*6a54128fSAndroid Build Coastguard Worker ;; 8742*6a54128fSAndroid Build Coastguard Worker esac 8743*6a54128fSAndroid Build Coastguard Worker ;; 8744*6a54128fSAndroid Build Coastguard Worker 8745*6a54128fSAndroid Build Coastguard Worker solaris*) 8746*6a54128fSAndroid Build Coastguard Worker func_cc_basename "$CC" 8747*6a54128fSAndroid Build Coastguard Worker case $func_cc_basename_result in 8748*6a54128fSAndroid Build Coastguard Worker CC* | sunCC*) 8749*6a54128fSAndroid Build Coastguard Worker func_suncc_cstd_abi 8750*6a54128fSAndroid Build Coastguard Worker 8751*6a54128fSAndroid Build Coastguard Worker if test no != "$suncc_use_cstd_abi"; then 8752*6a54128fSAndroid Build Coastguard Worker func_append postdeps ' -library=Cstd -library=Crun' 8753*6a54128fSAndroid Build Coastguard Worker fi 8754*6a54128fSAndroid Build Coastguard Worker ;; 8755*6a54128fSAndroid Build Coastguard Worker esac 8756*6a54128fSAndroid Build Coastguard Worker ;; 8757*6a54128fSAndroid Build Coastguard Worker esac 8758*6a54128fSAndroid Build Coastguard Worker } 8759*6a54128fSAndroid Build Coastguard Worker 8760*6a54128fSAndroid Build Coastguard Worker # Last step: remove runtime libs from dependency_libs 8761*6a54128fSAndroid Build Coastguard Worker # (they stay in deplibs) 8762*6a54128fSAndroid Build Coastguard Worker tmp_libs= 8763*6a54128fSAndroid Build Coastguard Worker for i in $dependency_libs; do 8764*6a54128fSAndroid Build Coastguard Worker case " $predeps $postdeps $compiler_lib_search_path " in 8765*6a54128fSAndroid Build Coastguard Worker *" $i "*) 8766*6a54128fSAndroid Build Coastguard Worker i= 8767*6a54128fSAndroid Build Coastguard Worker ;; 8768*6a54128fSAndroid Build Coastguard Worker esac 8769*6a54128fSAndroid Build Coastguard Worker if test -n "$i"; then 8770*6a54128fSAndroid Build Coastguard Worker func_append tmp_libs " $i" 8771*6a54128fSAndroid Build Coastguard Worker fi 8772*6a54128fSAndroid Build Coastguard Worker done 8773*6a54128fSAndroid Build Coastguard Worker dependency_libs=$tmp_libs 8774*6a54128fSAndroid Build Coastguard Worker done # for pass 8775*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode"; then 8776*6a54128fSAndroid Build Coastguard Worker dlfiles=$newdlfiles 8777*6a54128fSAndroid Build Coastguard Worker fi 8778*6a54128fSAndroid Build Coastguard Worker if test prog = "$linkmode" || test lib = "$linkmode"; then 8779*6a54128fSAndroid Build Coastguard Worker dlprefiles=$newdlprefiles 8780*6a54128fSAndroid Build Coastguard Worker fi 8781*6a54128fSAndroid Build Coastguard Worker 8782*6a54128fSAndroid Build Coastguard Worker case $linkmode in 8783*6a54128fSAndroid Build Coastguard Worker oldlib) 8784*6a54128fSAndroid Build Coastguard Worker if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then 8785*6a54128fSAndroid Build Coastguard Worker func_warning "'-dlopen' is ignored for archives" 8786*6a54128fSAndroid Build Coastguard Worker fi 8787*6a54128fSAndroid Build Coastguard Worker 8788*6a54128fSAndroid Build Coastguard Worker case " $deplibs" in 8789*6a54128fSAndroid Build Coastguard Worker *\ -l* | *\ -L*) 8790*6a54128fSAndroid Build Coastguard Worker func_warning "'-l' and '-L' are ignored for archives" ;; 8791*6a54128fSAndroid Build Coastguard Worker esac 8792*6a54128fSAndroid Build Coastguard Worker 8793*6a54128fSAndroid Build Coastguard Worker test -n "$rpath" && \ 8794*6a54128fSAndroid Build Coastguard Worker func_warning "'-rpath' is ignored for archives" 8795*6a54128fSAndroid Build Coastguard Worker 8796*6a54128fSAndroid Build Coastguard Worker test -n "$xrpath" && \ 8797*6a54128fSAndroid Build Coastguard Worker func_warning "'-R' is ignored for archives" 8798*6a54128fSAndroid Build Coastguard Worker 8799*6a54128fSAndroid Build Coastguard Worker test -n "$vinfo" && \ 8800*6a54128fSAndroid Build Coastguard Worker func_warning "'-version-info/-version-number' is ignored for archives" 8801*6a54128fSAndroid Build Coastguard Worker 8802*6a54128fSAndroid Build Coastguard Worker test -n "$release" && \ 8803*6a54128fSAndroid Build Coastguard Worker func_warning "'-release' is ignored for archives" 8804*6a54128fSAndroid Build Coastguard Worker 8805*6a54128fSAndroid Build Coastguard Worker test -n "$export_symbols$export_symbols_regex" && \ 8806*6a54128fSAndroid Build Coastguard Worker func_warning "'-export-symbols' is ignored for archives" 8807*6a54128fSAndroid Build Coastguard Worker 8808*6a54128fSAndroid Build Coastguard Worker # Now set the variables for building old libraries. 8809*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=no 8810*6a54128fSAndroid Build Coastguard Worker oldlibs=$output 8811*6a54128fSAndroid Build Coastguard Worker func_append objs "$old_deplibs" 8812*6a54128fSAndroid Build Coastguard Worker ;; 8813*6a54128fSAndroid Build Coastguard Worker 8814*6a54128fSAndroid Build Coastguard Worker lib) 8815*6a54128fSAndroid Build Coastguard Worker # Make sure we only generate libraries of the form 'libNAME.la'. 8816*6a54128fSAndroid Build Coastguard Worker case $outputname in 8817*6a54128fSAndroid Build Coastguard Worker lib*) 8818*6a54128fSAndroid Build Coastguard Worker func_stripname 'lib' '.la' "$outputname" 8819*6a54128fSAndroid Build Coastguard Worker name=$func_stripname_result 8820*6a54128fSAndroid Build Coastguard Worker eval shared_ext=\"$shrext_cmds\" 8821*6a54128fSAndroid Build Coastguard Worker eval libname=\"$libname_spec\" 8822*6a54128fSAndroid Build Coastguard Worker ;; 8823*6a54128fSAndroid Build Coastguard Worker *) 8824*6a54128fSAndroid Build Coastguard Worker test no = "$module" \ 8825*6a54128fSAndroid Build Coastguard Worker && func_fatal_help "libtool library '$output' must begin with 'lib'" 8826*6a54128fSAndroid Build Coastguard Worker 8827*6a54128fSAndroid Build Coastguard Worker if test no != "$need_lib_prefix"; then 8828*6a54128fSAndroid Build Coastguard Worker # Add the "lib" prefix for modules if required 8829*6a54128fSAndroid Build Coastguard Worker func_stripname '' '.la' "$outputname" 8830*6a54128fSAndroid Build Coastguard Worker name=$func_stripname_result 8831*6a54128fSAndroid Build Coastguard Worker eval shared_ext=\"$shrext_cmds\" 8832*6a54128fSAndroid Build Coastguard Worker eval libname=\"$libname_spec\" 8833*6a54128fSAndroid Build Coastguard Worker else 8834*6a54128fSAndroid Build Coastguard Worker func_stripname '' '.la' "$outputname" 8835*6a54128fSAndroid Build Coastguard Worker libname=$func_stripname_result 8836*6a54128fSAndroid Build Coastguard Worker fi 8837*6a54128fSAndroid Build Coastguard Worker ;; 8838*6a54128fSAndroid Build Coastguard Worker esac 8839*6a54128fSAndroid Build Coastguard Worker 8840*6a54128fSAndroid Build Coastguard Worker if test -n "$objs"; then 8841*6a54128fSAndroid Build Coastguard Worker if test pass_all != "$deplibs_check_method"; then 8842*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" 8843*6a54128fSAndroid Build Coastguard Worker else 8844*6a54128fSAndroid Build Coastguard Worker echo 8845*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: Linking the shared library $output against the non-libtool" 8846*6a54128fSAndroid Build Coastguard Worker $ECHO "*** objects $objs is not portable!" 8847*6a54128fSAndroid Build Coastguard Worker func_append libobjs " $objs" 8848*6a54128fSAndroid Build Coastguard Worker fi 8849*6a54128fSAndroid Build Coastguard Worker fi 8850*6a54128fSAndroid Build Coastguard Worker 8851*6a54128fSAndroid Build Coastguard Worker test no = "$dlself" \ 8852*6a54128fSAndroid Build Coastguard Worker || func_warning "'-dlopen self' is ignored for libtool libraries" 8853*6a54128fSAndroid Build Coastguard Worker 8854*6a54128fSAndroid Build Coastguard Worker set dummy $rpath 8855*6a54128fSAndroid Build Coastguard Worker shift 8856*6a54128fSAndroid Build Coastguard Worker test 1 -lt "$#" \ 8857*6a54128fSAndroid Build Coastguard Worker && func_warning "ignoring multiple '-rpath's for a libtool library" 8858*6a54128fSAndroid Build Coastguard Worker 8859*6a54128fSAndroid Build Coastguard Worker install_libdir=$1 8860*6a54128fSAndroid Build Coastguard Worker 8861*6a54128fSAndroid Build Coastguard Worker oldlibs= 8862*6a54128fSAndroid Build Coastguard Worker if test -z "$rpath"; then 8863*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_libs"; then 8864*6a54128fSAndroid Build Coastguard Worker # Building a libtool convenience library. 8865*6a54128fSAndroid Build Coastguard Worker # Some compilers have problems with a '.al' extension so 8866*6a54128fSAndroid Build Coastguard Worker # convenience libraries should have the same extension an 8867*6a54128fSAndroid Build Coastguard Worker # archive normally would. 8868*6a54128fSAndroid Build Coastguard Worker oldlibs="$output_objdir/$libname.$libext $oldlibs" 8869*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=convenience 8870*6a54128fSAndroid Build Coastguard Worker build_old_libs=yes 8871*6a54128fSAndroid Build Coastguard Worker fi 8872*6a54128fSAndroid Build Coastguard Worker 8873*6a54128fSAndroid Build Coastguard Worker test -n "$vinfo" && \ 8874*6a54128fSAndroid Build Coastguard Worker func_warning "'-version-info/-version-number' is ignored for convenience libraries" 8875*6a54128fSAndroid Build Coastguard Worker 8876*6a54128fSAndroid Build Coastguard Worker test -n "$release" && \ 8877*6a54128fSAndroid Build Coastguard Worker func_warning "'-release' is ignored for convenience libraries" 8878*6a54128fSAndroid Build Coastguard Worker else 8879*6a54128fSAndroid Build Coastguard Worker 8880*6a54128fSAndroid Build Coastguard Worker # Parse the version information argument. 8881*6a54128fSAndroid Build Coastguard Worker save_ifs=$IFS; IFS=: 8882*6a54128fSAndroid Build Coastguard Worker set dummy $vinfo 0 0 0 8883*6a54128fSAndroid Build Coastguard Worker shift 8884*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 8885*6a54128fSAndroid Build Coastguard Worker 8886*6a54128fSAndroid Build Coastguard Worker test -n "$7" && \ 8887*6a54128fSAndroid Build Coastguard Worker func_fatal_help "too many parameters to '-version-info'" 8888*6a54128fSAndroid Build Coastguard Worker 8889*6a54128fSAndroid Build Coastguard Worker # convert absolute version numbers to libtool ages 8890*6a54128fSAndroid Build Coastguard Worker # this retains compatibility with .la files and attempts 8891*6a54128fSAndroid Build Coastguard Worker # to make the code below a bit more comprehensible 8892*6a54128fSAndroid Build Coastguard Worker 8893*6a54128fSAndroid Build Coastguard Worker case $vinfo_number in 8894*6a54128fSAndroid Build Coastguard Worker yes) 8895*6a54128fSAndroid Build Coastguard Worker number_major=$1 8896*6a54128fSAndroid Build Coastguard Worker number_minor=$2 8897*6a54128fSAndroid Build Coastguard Worker number_revision=$3 8898*6a54128fSAndroid Build Coastguard Worker # 8899*6a54128fSAndroid Build Coastguard Worker # There are really only two kinds -- those that 8900*6a54128fSAndroid Build Coastguard Worker # use the current revision as the major version 8901*6a54128fSAndroid Build Coastguard Worker # and those that subtract age and use age as 8902*6a54128fSAndroid Build Coastguard Worker # a minor version. But, then there is irix 8903*6a54128fSAndroid Build Coastguard Worker # that has an extra 1 added just for fun 8904*6a54128fSAndroid Build Coastguard Worker # 8905*6a54128fSAndroid Build Coastguard Worker case $version_type in 8906*6a54128fSAndroid Build Coastguard Worker # correct linux to gnu/linux during the next big refactor 8907*6a54128fSAndroid Build Coastguard Worker darwin|freebsd-elf|linux|osf|windows|none) 8908*6a54128fSAndroid Build Coastguard Worker func_arith $number_major + $number_minor 8909*6a54128fSAndroid Build Coastguard Worker current=$func_arith_result 8910*6a54128fSAndroid Build Coastguard Worker age=$number_minor 8911*6a54128fSAndroid Build Coastguard Worker revision=$number_revision 8912*6a54128fSAndroid Build Coastguard Worker ;; 8913*6a54128fSAndroid Build Coastguard Worker freebsd-aout|qnx|sunos) 8914*6a54128fSAndroid Build Coastguard Worker current=$number_major 8915*6a54128fSAndroid Build Coastguard Worker revision=$number_minor 8916*6a54128fSAndroid Build Coastguard Worker age=0 8917*6a54128fSAndroid Build Coastguard Worker ;; 8918*6a54128fSAndroid Build Coastguard Worker irix|nonstopux) 8919*6a54128fSAndroid Build Coastguard Worker func_arith $number_major + $number_minor 8920*6a54128fSAndroid Build Coastguard Worker current=$func_arith_result 8921*6a54128fSAndroid Build Coastguard Worker age=$number_minor 8922*6a54128fSAndroid Build Coastguard Worker revision=$number_minor 8923*6a54128fSAndroid Build Coastguard Worker lt_irix_increment=no 8924*6a54128fSAndroid Build Coastguard Worker ;; 8925*6a54128fSAndroid Build Coastguard Worker *) 8926*6a54128fSAndroid Build Coastguard Worker func_fatal_configuration "$modename: unknown library version type '$version_type'" 8927*6a54128fSAndroid Build Coastguard Worker ;; 8928*6a54128fSAndroid Build Coastguard Worker esac 8929*6a54128fSAndroid Build Coastguard Worker ;; 8930*6a54128fSAndroid Build Coastguard Worker no) 8931*6a54128fSAndroid Build Coastguard Worker current=$1 8932*6a54128fSAndroid Build Coastguard Worker revision=$2 8933*6a54128fSAndroid Build Coastguard Worker age=$3 8934*6a54128fSAndroid Build Coastguard Worker ;; 8935*6a54128fSAndroid Build Coastguard Worker esac 8936*6a54128fSAndroid Build Coastguard Worker 8937*6a54128fSAndroid Build Coastguard Worker # Check that each of the things are valid numbers. 8938*6a54128fSAndroid Build Coastguard Worker case $current in 8939*6a54128fSAndroid Build Coastguard Worker 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]) ;; 8940*6a54128fSAndroid Build Coastguard Worker *) 8941*6a54128fSAndroid Build Coastguard Worker func_error "CURRENT '$current' must be a nonnegative integer" 8942*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$vinfo' is not valid version information" 8943*6a54128fSAndroid Build Coastguard Worker ;; 8944*6a54128fSAndroid Build Coastguard Worker esac 8945*6a54128fSAndroid Build Coastguard Worker 8946*6a54128fSAndroid Build Coastguard Worker case $revision in 8947*6a54128fSAndroid Build Coastguard Worker 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]) ;; 8948*6a54128fSAndroid Build Coastguard Worker *) 8949*6a54128fSAndroid Build Coastguard Worker func_error "REVISION '$revision' must be a nonnegative integer" 8950*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$vinfo' is not valid version information" 8951*6a54128fSAndroid Build Coastguard Worker ;; 8952*6a54128fSAndroid Build Coastguard Worker esac 8953*6a54128fSAndroid Build Coastguard Worker 8954*6a54128fSAndroid Build Coastguard Worker case $age in 8955*6a54128fSAndroid Build Coastguard Worker 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]) ;; 8956*6a54128fSAndroid Build Coastguard Worker *) 8957*6a54128fSAndroid Build Coastguard Worker func_error "AGE '$age' must be a nonnegative integer" 8958*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$vinfo' is not valid version information" 8959*6a54128fSAndroid Build Coastguard Worker ;; 8960*6a54128fSAndroid Build Coastguard Worker esac 8961*6a54128fSAndroid Build Coastguard Worker 8962*6a54128fSAndroid Build Coastguard Worker if test "$age" -gt "$current"; then 8963*6a54128fSAndroid Build Coastguard Worker func_error "AGE '$age' is greater than the current interface number '$current'" 8964*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$vinfo' is not valid version information" 8965*6a54128fSAndroid Build Coastguard Worker fi 8966*6a54128fSAndroid Build Coastguard Worker 8967*6a54128fSAndroid Build Coastguard Worker # Calculate the version variables. 8968*6a54128fSAndroid Build Coastguard Worker major= 8969*6a54128fSAndroid Build Coastguard Worker versuffix= 8970*6a54128fSAndroid Build Coastguard Worker verstring= 8971*6a54128fSAndroid Build Coastguard Worker case $version_type in 8972*6a54128fSAndroid Build Coastguard Worker none) ;; 8973*6a54128fSAndroid Build Coastguard Worker 8974*6a54128fSAndroid Build Coastguard Worker darwin) 8975*6a54128fSAndroid Build Coastguard Worker # Like Linux, but with the current version available in 8976*6a54128fSAndroid Build Coastguard Worker # verstring for coding it into the library header 8977*6a54128fSAndroid Build Coastguard Worker func_arith $current - $age 8978*6a54128fSAndroid Build Coastguard Worker major=.$func_arith_result 8979*6a54128fSAndroid Build Coastguard Worker versuffix=$major.$age.$revision 8980*6a54128fSAndroid Build Coastguard Worker # Darwin ld doesn't like 0 for these options... 8981*6a54128fSAndroid Build Coastguard Worker func_arith $current + 1 8982*6a54128fSAndroid Build Coastguard Worker minor_current=$func_arith_result 8983*6a54128fSAndroid Build Coastguard Worker xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" 8984*6a54128fSAndroid Build Coastguard Worker verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 8985*6a54128fSAndroid Build Coastguard Worker # On Darwin other compilers 8986*6a54128fSAndroid Build Coastguard Worker case $CC in 8987*6a54128fSAndroid Build Coastguard Worker nagfor*) 8988*6a54128fSAndroid Build Coastguard Worker verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" 8989*6a54128fSAndroid Build Coastguard Worker ;; 8990*6a54128fSAndroid Build Coastguard Worker *) 8991*6a54128fSAndroid Build Coastguard Worker verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 8992*6a54128fSAndroid Build Coastguard Worker ;; 8993*6a54128fSAndroid Build Coastguard Worker esac 8994*6a54128fSAndroid Build Coastguard Worker ;; 8995*6a54128fSAndroid Build Coastguard Worker 8996*6a54128fSAndroid Build Coastguard Worker freebsd-aout) 8997*6a54128fSAndroid Build Coastguard Worker major=.$current 8998*6a54128fSAndroid Build Coastguard Worker versuffix=.$current.$revision 8999*6a54128fSAndroid Build Coastguard Worker ;; 9000*6a54128fSAndroid Build Coastguard Worker 9001*6a54128fSAndroid Build Coastguard Worker freebsd-elf) 9002*6a54128fSAndroid Build Coastguard Worker func_arith $current - $age 9003*6a54128fSAndroid Build Coastguard Worker major=.$func_arith_result 9004*6a54128fSAndroid Build Coastguard Worker versuffix=$major.$age.$revision 9005*6a54128fSAndroid Build Coastguard Worker ;; 9006*6a54128fSAndroid Build Coastguard Worker 9007*6a54128fSAndroid Build Coastguard Worker irix | nonstopux) 9008*6a54128fSAndroid Build Coastguard Worker if test no = "$lt_irix_increment"; then 9009*6a54128fSAndroid Build Coastguard Worker func_arith $current - $age 9010*6a54128fSAndroid Build Coastguard Worker else 9011*6a54128fSAndroid Build Coastguard Worker func_arith $current - $age + 1 9012*6a54128fSAndroid Build Coastguard Worker fi 9013*6a54128fSAndroid Build Coastguard Worker major=$func_arith_result 9014*6a54128fSAndroid Build Coastguard Worker 9015*6a54128fSAndroid Build Coastguard Worker case $version_type in 9016*6a54128fSAndroid Build Coastguard Worker nonstopux) verstring_prefix=nonstopux ;; 9017*6a54128fSAndroid Build Coastguard Worker *) verstring_prefix=sgi ;; 9018*6a54128fSAndroid Build Coastguard Worker esac 9019*6a54128fSAndroid Build Coastguard Worker verstring=$verstring_prefix$major.$revision 9020*6a54128fSAndroid Build Coastguard Worker 9021*6a54128fSAndroid Build Coastguard Worker # Add in all the interfaces that we are compatible with. 9022*6a54128fSAndroid Build Coastguard Worker loop=$revision 9023*6a54128fSAndroid Build Coastguard Worker while test 0 -ne "$loop"; do 9024*6a54128fSAndroid Build Coastguard Worker func_arith $revision - $loop 9025*6a54128fSAndroid Build Coastguard Worker iface=$func_arith_result 9026*6a54128fSAndroid Build Coastguard Worker func_arith $loop - 1 9027*6a54128fSAndroid Build Coastguard Worker loop=$func_arith_result 9028*6a54128fSAndroid Build Coastguard Worker verstring=$verstring_prefix$major.$iface:$verstring 9029*6a54128fSAndroid Build Coastguard Worker done 9030*6a54128fSAndroid Build Coastguard Worker 9031*6a54128fSAndroid Build Coastguard Worker # Before this point, $major must not contain '.'. 9032*6a54128fSAndroid Build Coastguard Worker major=.$major 9033*6a54128fSAndroid Build Coastguard Worker versuffix=$major.$revision 9034*6a54128fSAndroid Build Coastguard Worker ;; 9035*6a54128fSAndroid Build Coastguard Worker 9036*6a54128fSAndroid Build Coastguard Worker linux) # correct to gnu/linux during the next big refactor 9037*6a54128fSAndroid Build Coastguard Worker func_arith $current - $age 9038*6a54128fSAndroid Build Coastguard Worker major=.$func_arith_result 9039*6a54128fSAndroid Build Coastguard Worker versuffix=$major.$age.$revision 9040*6a54128fSAndroid Build Coastguard Worker ;; 9041*6a54128fSAndroid Build Coastguard Worker 9042*6a54128fSAndroid Build Coastguard Worker osf) 9043*6a54128fSAndroid Build Coastguard Worker func_arith $current - $age 9044*6a54128fSAndroid Build Coastguard Worker major=.$func_arith_result 9045*6a54128fSAndroid Build Coastguard Worker versuffix=.$current.$age.$revision 9046*6a54128fSAndroid Build Coastguard Worker verstring=$current.$age.$revision 9047*6a54128fSAndroid Build Coastguard Worker 9048*6a54128fSAndroid Build Coastguard Worker # Add in all the interfaces that we are compatible with. 9049*6a54128fSAndroid Build Coastguard Worker loop=$age 9050*6a54128fSAndroid Build Coastguard Worker while test 0 -ne "$loop"; do 9051*6a54128fSAndroid Build Coastguard Worker func_arith $current - $loop 9052*6a54128fSAndroid Build Coastguard Worker iface=$func_arith_result 9053*6a54128fSAndroid Build Coastguard Worker func_arith $loop - 1 9054*6a54128fSAndroid Build Coastguard Worker loop=$func_arith_result 9055*6a54128fSAndroid Build Coastguard Worker verstring=$verstring:$iface.0 9056*6a54128fSAndroid Build Coastguard Worker done 9057*6a54128fSAndroid Build Coastguard Worker 9058*6a54128fSAndroid Build Coastguard Worker # Make executables depend on our current version. 9059*6a54128fSAndroid Build Coastguard Worker func_append verstring ":$current.0" 9060*6a54128fSAndroid Build Coastguard Worker ;; 9061*6a54128fSAndroid Build Coastguard Worker 9062*6a54128fSAndroid Build Coastguard Worker qnx) 9063*6a54128fSAndroid Build Coastguard Worker major=.$current 9064*6a54128fSAndroid Build Coastguard Worker versuffix=.$current 9065*6a54128fSAndroid Build Coastguard Worker ;; 9066*6a54128fSAndroid Build Coastguard Worker 9067*6a54128fSAndroid Build Coastguard Worker sco) 9068*6a54128fSAndroid Build Coastguard Worker major=.$current 9069*6a54128fSAndroid Build Coastguard Worker versuffix=.$current 9070*6a54128fSAndroid Build Coastguard Worker ;; 9071*6a54128fSAndroid Build Coastguard Worker 9072*6a54128fSAndroid Build Coastguard Worker sunos) 9073*6a54128fSAndroid Build Coastguard Worker major=.$current 9074*6a54128fSAndroid Build Coastguard Worker versuffix=.$current.$revision 9075*6a54128fSAndroid Build Coastguard Worker ;; 9076*6a54128fSAndroid Build Coastguard Worker 9077*6a54128fSAndroid Build Coastguard Worker windows) 9078*6a54128fSAndroid Build Coastguard Worker # Use '-' rather than '.', since we only want one 9079*6a54128fSAndroid Build Coastguard Worker # extension on DOS 8.3 file systems. 9080*6a54128fSAndroid Build Coastguard Worker func_arith $current - $age 9081*6a54128fSAndroid Build Coastguard Worker major=$func_arith_result 9082*6a54128fSAndroid Build Coastguard Worker versuffix=-$major 9083*6a54128fSAndroid Build Coastguard Worker ;; 9084*6a54128fSAndroid Build Coastguard Worker 9085*6a54128fSAndroid Build Coastguard Worker *) 9086*6a54128fSAndroid Build Coastguard Worker func_fatal_configuration "unknown library version type '$version_type'" 9087*6a54128fSAndroid Build Coastguard Worker ;; 9088*6a54128fSAndroid Build Coastguard Worker esac 9089*6a54128fSAndroid Build Coastguard Worker 9090*6a54128fSAndroid Build Coastguard Worker # Clear the version info if we defaulted, and they specified a release. 9091*6a54128fSAndroid Build Coastguard Worker if test -z "$vinfo" && test -n "$release"; then 9092*6a54128fSAndroid Build Coastguard Worker major= 9093*6a54128fSAndroid Build Coastguard Worker case $version_type in 9094*6a54128fSAndroid Build Coastguard Worker darwin) 9095*6a54128fSAndroid Build Coastguard Worker # we can't check for "0.0" in archive_cmds due to quoting 9096*6a54128fSAndroid Build Coastguard Worker # problems, so we reset it completely 9097*6a54128fSAndroid Build Coastguard Worker verstring= 9098*6a54128fSAndroid Build Coastguard Worker ;; 9099*6a54128fSAndroid Build Coastguard Worker *) 9100*6a54128fSAndroid Build Coastguard Worker verstring=0.0 9101*6a54128fSAndroid Build Coastguard Worker ;; 9102*6a54128fSAndroid Build Coastguard Worker esac 9103*6a54128fSAndroid Build Coastguard Worker if test no = "$need_version"; then 9104*6a54128fSAndroid Build Coastguard Worker versuffix= 9105*6a54128fSAndroid Build Coastguard Worker else 9106*6a54128fSAndroid Build Coastguard Worker versuffix=.0.0 9107*6a54128fSAndroid Build Coastguard Worker fi 9108*6a54128fSAndroid Build Coastguard Worker fi 9109*6a54128fSAndroid Build Coastguard Worker 9110*6a54128fSAndroid Build Coastguard Worker # Remove version info from name if versioning should be avoided 9111*6a54128fSAndroid Build Coastguard Worker if test yes,no = "$avoid_version,$need_version"; then 9112*6a54128fSAndroid Build Coastguard Worker major= 9113*6a54128fSAndroid Build Coastguard Worker versuffix= 9114*6a54128fSAndroid Build Coastguard Worker verstring= 9115*6a54128fSAndroid Build Coastguard Worker fi 9116*6a54128fSAndroid Build Coastguard Worker 9117*6a54128fSAndroid Build Coastguard Worker # Check to see if the archive will have undefined symbols. 9118*6a54128fSAndroid Build Coastguard Worker if test yes = "$allow_undefined"; then 9119*6a54128fSAndroid Build Coastguard Worker if test unsupported = "$allow_undefined_flag"; then 9120*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_old_libs"; then 9121*6a54128fSAndroid Build Coastguard Worker func_warning "undefined symbols not allowed in $host shared libraries; building static only" 9122*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=no 9123*6a54128fSAndroid Build Coastguard Worker else 9124*6a54128fSAndroid Build Coastguard Worker func_fatal_error "can't build $host shared library unless -no-undefined is specified" 9125*6a54128fSAndroid Build Coastguard Worker fi 9126*6a54128fSAndroid Build Coastguard Worker fi 9127*6a54128fSAndroid Build Coastguard Worker else 9128*6a54128fSAndroid Build Coastguard Worker # Don't allow undefined symbols. 9129*6a54128fSAndroid Build Coastguard Worker allow_undefined_flag=$no_undefined_flag 9130*6a54128fSAndroid Build Coastguard Worker fi 9131*6a54128fSAndroid Build Coastguard Worker 9132*6a54128fSAndroid Build Coastguard Worker fi 9133*6a54128fSAndroid Build Coastguard Worker 9134*6a54128fSAndroid Build Coastguard Worker func_generate_dlsyms "$libname" "$libname" : 9135*6a54128fSAndroid Build Coastguard Worker func_append libobjs " $symfileobj" 9136*6a54128fSAndroid Build Coastguard Worker test " " = "$libobjs" && libobjs= 9137*6a54128fSAndroid Build Coastguard Worker 9138*6a54128fSAndroid Build Coastguard Worker if test relink != "$opt_mode"; then 9139*6a54128fSAndroid Build Coastguard Worker # Remove our outputs, but don't remove object files since they 9140*6a54128fSAndroid Build Coastguard Worker # may have been created when compiling PIC objects. 9141*6a54128fSAndroid Build Coastguard Worker removelist= 9142*6a54128fSAndroid Build Coastguard Worker tempremovelist=`$ECHO "$output_objdir/*"` 9143*6a54128fSAndroid Build Coastguard Worker for p in $tempremovelist; do 9144*6a54128fSAndroid Build Coastguard Worker case $p in 9145*6a54128fSAndroid Build Coastguard Worker *.$objext | *.gcno) 9146*6a54128fSAndroid Build Coastguard Worker ;; 9147*6a54128fSAndroid Build Coastguard Worker $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) 9148*6a54128fSAndroid Build Coastguard Worker if test -n "$precious_files_regex"; then 9149*6a54128fSAndroid Build Coastguard Worker if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 9150*6a54128fSAndroid Build Coastguard Worker then 9151*6a54128fSAndroid Build Coastguard Worker continue 9152*6a54128fSAndroid Build Coastguard Worker fi 9153*6a54128fSAndroid Build Coastguard Worker fi 9154*6a54128fSAndroid Build Coastguard Worker func_append removelist " $p" 9155*6a54128fSAndroid Build Coastguard Worker ;; 9156*6a54128fSAndroid Build Coastguard Worker *) ;; 9157*6a54128fSAndroid Build Coastguard Worker esac 9158*6a54128fSAndroid Build Coastguard Worker done 9159*6a54128fSAndroid Build Coastguard Worker test -n "$removelist" && \ 9160*6a54128fSAndroid Build Coastguard Worker func_show_eval "${RM}r \$removelist" 9161*6a54128fSAndroid Build Coastguard Worker fi 9162*6a54128fSAndroid Build Coastguard Worker 9163*6a54128fSAndroid Build Coastguard Worker # Now set the variables for building old libraries. 9164*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then 9165*6a54128fSAndroid Build Coastguard Worker func_append oldlibs " $output_objdir/$libname.$libext" 9166*6a54128fSAndroid Build Coastguard Worker 9167*6a54128fSAndroid Build Coastguard Worker # Transform .lo files to .o files. 9168*6a54128fSAndroid Build Coastguard Worker oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` 9169*6a54128fSAndroid Build Coastguard Worker fi 9170*6a54128fSAndroid Build Coastguard Worker 9171*6a54128fSAndroid Build Coastguard Worker # Eliminate all temporary directories. 9172*6a54128fSAndroid Build Coastguard Worker #for path in $notinst_path; do 9173*6a54128fSAndroid Build Coastguard Worker # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` 9174*6a54128fSAndroid Build Coastguard Worker # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` 9175*6a54128fSAndroid Build Coastguard Worker # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` 9176*6a54128fSAndroid Build Coastguard Worker #done 9177*6a54128fSAndroid Build Coastguard Worker 9178*6a54128fSAndroid Build Coastguard Worker if test -n "$xrpath"; then 9179*6a54128fSAndroid Build Coastguard Worker # If the user specified any rpath flags, then add them. 9180*6a54128fSAndroid Build Coastguard Worker temp_xrpath= 9181*6a54128fSAndroid Build Coastguard Worker for libdir in $xrpath; do 9182*6a54128fSAndroid Build Coastguard Worker func_replace_sysroot "$libdir" 9183*6a54128fSAndroid Build Coastguard Worker func_append temp_xrpath " -R$func_replace_sysroot_result" 9184*6a54128fSAndroid Build Coastguard Worker case "$finalize_rpath " in 9185*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 9186*6a54128fSAndroid Build Coastguard Worker *) func_append finalize_rpath " $libdir" ;; 9187*6a54128fSAndroid Build Coastguard Worker esac 9188*6a54128fSAndroid Build Coastguard Worker done 9189*6a54128fSAndroid Build Coastguard Worker if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then 9190*6a54128fSAndroid Build Coastguard Worker dependency_libs="$temp_xrpath $dependency_libs" 9191*6a54128fSAndroid Build Coastguard Worker fi 9192*6a54128fSAndroid Build Coastguard Worker fi 9193*6a54128fSAndroid Build Coastguard Worker 9194*6a54128fSAndroid Build Coastguard Worker # Make sure dlfiles contains only unique files that won't be dlpreopened 9195*6a54128fSAndroid Build Coastguard Worker old_dlfiles=$dlfiles 9196*6a54128fSAndroid Build Coastguard Worker dlfiles= 9197*6a54128fSAndroid Build Coastguard Worker for lib in $old_dlfiles; do 9198*6a54128fSAndroid Build Coastguard Worker case " $dlprefiles $dlfiles " in 9199*6a54128fSAndroid Build Coastguard Worker *" $lib "*) ;; 9200*6a54128fSAndroid Build Coastguard Worker *) func_append dlfiles " $lib" ;; 9201*6a54128fSAndroid Build Coastguard Worker esac 9202*6a54128fSAndroid Build Coastguard Worker done 9203*6a54128fSAndroid Build Coastguard Worker 9204*6a54128fSAndroid Build Coastguard Worker # Make sure dlprefiles contains only unique files 9205*6a54128fSAndroid Build Coastguard Worker old_dlprefiles=$dlprefiles 9206*6a54128fSAndroid Build Coastguard Worker dlprefiles= 9207*6a54128fSAndroid Build Coastguard Worker for lib in $old_dlprefiles; do 9208*6a54128fSAndroid Build Coastguard Worker case "$dlprefiles " in 9209*6a54128fSAndroid Build Coastguard Worker *" $lib "*) ;; 9210*6a54128fSAndroid Build Coastguard Worker *) func_append dlprefiles " $lib" ;; 9211*6a54128fSAndroid Build Coastguard Worker esac 9212*6a54128fSAndroid Build Coastguard Worker done 9213*6a54128fSAndroid Build Coastguard Worker 9214*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_libs"; then 9215*6a54128fSAndroid Build Coastguard Worker if test -n "$rpath"; then 9216*6a54128fSAndroid Build Coastguard Worker case $host in 9217*6a54128fSAndroid Build Coastguard Worker *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) 9218*6a54128fSAndroid Build Coastguard Worker # these systems don't actually have a c library (as such)! 9219*6a54128fSAndroid Build Coastguard Worker ;; 9220*6a54128fSAndroid Build Coastguard Worker *-*-rhapsody* | *-*-darwin1.[012]) 9221*6a54128fSAndroid Build Coastguard Worker # Rhapsody C library is in the System framework 9222*6a54128fSAndroid Build Coastguard Worker func_append deplibs " System.ltframework" 9223*6a54128fSAndroid Build Coastguard Worker ;; 9224*6a54128fSAndroid Build Coastguard Worker *-*-netbsd*) 9225*6a54128fSAndroid Build Coastguard Worker # Don't link with libc until the a.out ld.so is fixed. 9226*6a54128fSAndroid Build Coastguard Worker ;; 9227*6a54128fSAndroid Build Coastguard Worker *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 9228*6a54128fSAndroid Build Coastguard Worker # Do not include libc due to us having libc/libc_r. 9229*6a54128fSAndroid Build Coastguard Worker ;; 9230*6a54128fSAndroid Build Coastguard Worker *-*-sco3.2v5* | *-*-sco5v6*) 9231*6a54128fSAndroid Build Coastguard Worker # Causes problems with __ctype 9232*6a54128fSAndroid Build Coastguard Worker ;; 9233*6a54128fSAndroid Build Coastguard Worker *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 9234*6a54128fSAndroid Build Coastguard Worker # Compiler inserts libc in the correct place for threads to work 9235*6a54128fSAndroid Build Coastguard Worker ;; 9236*6a54128fSAndroid Build Coastguard Worker *) 9237*6a54128fSAndroid Build Coastguard Worker # Add libc to deplibs on all other systems if necessary. 9238*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_need_lc"; then 9239*6a54128fSAndroid Build Coastguard Worker func_append deplibs " -lc" 9240*6a54128fSAndroid Build Coastguard Worker fi 9241*6a54128fSAndroid Build Coastguard Worker ;; 9242*6a54128fSAndroid Build Coastguard Worker esac 9243*6a54128fSAndroid Build Coastguard Worker fi 9244*6a54128fSAndroid Build Coastguard Worker 9245*6a54128fSAndroid Build Coastguard Worker # Transform deplibs into only deplibs that can be linked in shared. 9246*6a54128fSAndroid Build Coastguard Worker name_save=$name 9247*6a54128fSAndroid Build Coastguard Worker libname_save=$libname 9248*6a54128fSAndroid Build Coastguard Worker release_save=$release 9249*6a54128fSAndroid Build Coastguard Worker versuffix_save=$versuffix 9250*6a54128fSAndroid Build Coastguard Worker major_save=$major 9251*6a54128fSAndroid Build Coastguard Worker # I'm not sure if I'm treating the release correctly. I think 9252*6a54128fSAndroid Build Coastguard Worker # release should show up in the -l (ie -lgmp5) so we don't want to 9253*6a54128fSAndroid Build Coastguard Worker # add it in twice. Is that correct? 9254*6a54128fSAndroid Build Coastguard Worker release= 9255*6a54128fSAndroid Build Coastguard Worker versuffix= 9256*6a54128fSAndroid Build Coastguard Worker major= 9257*6a54128fSAndroid Build Coastguard Worker newdeplibs= 9258*6a54128fSAndroid Build Coastguard Worker droppeddeps=no 9259*6a54128fSAndroid Build Coastguard Worker case $deplibs_check_method in 9260*6a54128fSAndroid Build Coastguard Worker pass_all) 9261*6a54128fSAndroid Build Coastguard Worker # Don't check for shared/static. Everything works. 9262*6a54128fSAndroid Build Coastguard Worker # This might be a little naive. We might want to check 9263*6a54128fSAndroid Build Coastguard Worker # whether the library exists or not. But this is on 9264*6a54128fSAndroid Build Coastguard Worker # osf3 & osf4 and I'm not really sure... Just 9265*6a54128fSAndroid Build Coastguard Worker # implementing what was already the behavior. 9266*6a54128fSAndroid Build Coastguard Worker newdeplibs=$deplibs 9267*6a54128fSAndroid Build Coastguard Worker ;; 9268*6a54128fSAndroid Build Coastguard Worker test_compile) 9269*6a54128fSAndroid Build Coastguard Worker # This code stresses the "libraries are programs" paradigm to its 9270*6a54128fSAndroid Build Coastguard Worker # limits. Maybe even breaks it. We compile a program, linking it 9271*6a54128fSAndroid Build Coastguard Worker # against the deplibs as a proxy for the library. Then we can check 9272*6a54128fSAndroid Build Coastguard Worker # whether they linked in statically or dynamically with ldd. 9273*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM conftest.c 9274*6a54128fSAndroid Build Coastguard Worker cat > conftest.c <<EOF 9275*6a54128fSAndroid Build Coastguard Worker int main() { return 0; } 9276*6a54128fSAndroid Build Coastguard WorkerEOF 9277*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM conftest 9278*6a54128fSAndroid Build Coastguard Worker if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 9279*6a54128fSAndroid Build Coastguard Worker ldd_output=`ldd conftest` 9280*6a54128fSAndroid Build Coastguard Worker for i in $deplibs; do 9281*6a54128fSAndroid Build Coastguard Worker case $i in 9282*6a54128fSAndroid Build Coastguard Worker -l*) 9283*6a54128fSAndroid Build Coastguard Worker func_stripname -l '' "$i" 9284*6a54128fSAndroid Build Coastguard Worker name=$func_stripname_result 9285*6a54128fSAndroid Build Coastguard Worker if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9286*6a54128fSAndroid Build Coastguard Worker case " $predeps $postdeps " in 9287*6a54128fSAndroid Build Coastguard Worker *" $i "*) 9288*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $i" 9289*6a54128fSAndroid Build Coastguard Worker i= 9290*6a54128fSAndroid Build Coastguard Worker ;; 9291*6a54128fSAndroid Build Coastguard Worker esac 9292*6a54128fSAndroid Build Coastguard Worker fi 9293*6a54128fSAndroid Build Coastguard Worker if test -n "$i"; then 9294*6a54128fSAndroid Build Coastguard Worker libname=`eval "\\$ECHO \"$libname_spec\""` 9295*6a54128fSAndroid Build Coastguard Worker deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 9296*6a54128fSAndroid Build Coastguard Worker set dummy $deplib_matches; shift 9297*6a54128fSAndroid Build Coastguard Worker deplib_match=$1 9298*6a54128fSAndroid Build Coastguard Worker if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then 9299*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $i" 9300*6a54128fSAndroid Build Coastguard Worker else 9301*6a54128fSAndroid Build Coastguard Worker droppeddeps=yes 9302*6a54128fSAndroid Build Coastguard Worker echo 9303*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: dynamic linker does not accept needed library $i." 9304*6a54128fSAndroid Build Coastguard Worker echo "*** I have the capability to make that library automatically link in when" 9305*6a54128fSAndroid Build Coastguard Worker echo "*** you link to this library. But I can only do this if you have a" 9306*6a54128fSAndroid Build Coastguard Worker echo "*** shared version of the library, which I believe you do not have" 9307*6a54128fSAndroid Build Coastguard Worker echo "*** because a test_compile did reveal that the linker did not use it for" 9308*6a54128fSAndroid Build Coastguard Worker echo "*** its dynamic dependency list that programs get resolved with at runtime." 9309*6a54128fSAndroid Build Coastguard Worker fi 9310*6a54128fSAndroid Build Coastguard Worker fi 9311*6a54128fSAndroid Build Coastguard Worker ;; 9312*6a54128fSAndroid Build Coastguard Worker *) 9313*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $i" 9314*6a54128fSAndroid Build Coastguard Worker ;; 9315*6a54128fSAndroid Build Coastguard Worker esac 9316*6a54128fSAndroid Build Coastguard Worker done 9317*6a54128fSAndroid Build Coastguard Worker else 9318*6a54128fSAndroid Build Coastguard Worker # Error occurred in the first compile. Let's try to salvage 9319*6a54128fSAndroid Build Coastguard Worker # the situation: Compile a separate program for each library. 9320*6a54128fSAndroid Build Coastguard Worker for i in $deplibs; do 9321*6a54128fSAndroid Build Coastguard Worker case $i in 9322*6a54128fSAndroid Build Coastguard Worker -l*) 9323*6a54128fSAndroid Build Coastguard Worker func_stripname -l '' "$i" 9324*6a54128fSAndroid Build Coastguard Worker name=$func_stripname_result 9325*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM conftest 9326*6a54128fSAndroid Build Coastguard Worker if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 9327*6a54128fSAndroid Build Coastguard Worker ldd_output=`ldd conftest` 9328*6a54128fSAndroid Build Coastguard Worker if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9329*6a54128fSAndroid Build Coastguard Worker case " $predeps $postdeps " in 9330*6a54128fSAndroid Build Coastguard Worker *" $i "*) 9331*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $i" 9332*6a54128fSAndroid Build Coastguard Worker i= 9333*6a54128fSAndroid Build Coastguard Worker ;; 9334*6a54128fSAndroid Build Coastguard Worker esac 9335*6a54128fSAndroid Build Coastguard Worker fi 9336*6a54128fSAndroid Build Coastguard Worker if test -n "$i"; then 9337*6a54128fSAndroid Build Coastguard Worker libname=`eval "\\$ECHO \"$libname_spec\""` 9338*6a54128fSAndroid Build Coastguard Worker deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` 9339*6a54128fSAndroid Build Coastguard Worker set dummy $deplib_matches; shift 9340*6a54128fSAndroid Build Coastguard Worker deplib_match=$1 9341*6a54128fSAndroid Build Coastguard Worker if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then 9342*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $i" 9343*6a54128fSAndroid Build Coastguard Worker else 9344*6a54128fSAndroid Build Coastguard Worker droppeddeps=yes 9345*6a54128fSAndroid Build Coastguard Worker echo 9346*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: dynamic linker does not accept needed library $i." 9347*6a54128fSAndroid Build Coastguard Worker echo "*** I have the capability to make that library automatically link in when" 9348*6a54128fSAndroid Build Coastguard Worker echo "*** you link to this library. But I can only do this if you have a" 9349*6a54128fSAndroid Build Coastguard Worker echo "*** shared version of the library, which you do not appear to have" 9350*6a54128fSAndroid Build Coastguard Worker echo "*** because a test_compile did reveal that the linker did not use this one" 9351*6a54128fSAndroid Build Coastguard Worker echo "*** as a dynamic dependency that programs can get resolved with at runtime." 9352*6a54128fSAndroid Build Coastguard Worker fi 9353*6a54128fSAndroid Build Coastguard Worker fi 9354*6a54128fSAndroid Build Coastguard Worker else 9355*6a54128fSAndroid Build Coastguard Worker droppeddeps=yes 9356*6a54128fSAndroid Build Coastguard Worker echo 9357*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning! Library $i is needed by this library but I was not able to" 9358*6a54128fSAndroid Build Coastguard Worker echo "*** make it link in! You will probably need to install it or some" 9359*6a54128fSAndroid Build Coastguard Worker echo "*** library that it depends on before this library will be fully" 9360*6a54128fSAndroid Build Coastguard Worker echo "*** functional. Installing it before continuing would be even better." 9361*6a54128fSAndroid Build Coastguard Worker fi 9362*6a54128fSAndroid Build Coastguard Worker ;; 9363*6a54128fSAndroid Build Coastguard Worker *) 9364*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $i" 9365*6a54128fSAndroid Build Coastguard Worker ;; 9366*6a54128fSAndroid Build Coastguard Worker esac 9367*6a54128fSAndroid Build Coastguard Worker done 9368*6a54128fSAndroid Build Coastguard Worker fi 9369*6a54128fSAndroid Build Coastguard Worker ;; 9370*6a54128fSAndroid Build Coastguard Worker file_magic*) 9371*6a54128fSAndroid Build Coastguard Worker set dummy $deplibs_check_method; shift 9372*6a54128fSAndroid Build Coastguard Worker file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 9373*6a54128fSAndroid Build Coastguard Worker for a_deplib in $deplibs; do 9374*6a54128fSAndroid Build Coastguard Worker case $a_deplib in 9375*6a54128fSAndroid Build Coastguard Worker -l*) 9376*6a54128fSAndroid Build Coastguard Worker func_stripname -l '' "$a_deplib" 9377*6a54128fSAndroid Build Coastguard Worker name=$func_stripname_result 9378*6a54128fSAndroid Build Coastguard Worker if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9379*6a54128fSAndroid Build Coastguard Worker case " $predeps $postdeps " in 9380*6a54128fSAndroid Build Coastguard Worker *" $a_deplib "*) 9381*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $a_deplib" 9382*6a54128fSAndroid Build Coastguard Worker a_deplib= 9383*6a54128fSAndroid Build Coastguard Worker ;; 9384*6a54128fSAndroid Build Coastguard Worker esac 9385*6a54128fSAndroid Build Coastguard Worker fi 9386*6a54128fSAndroid Build Coastguard Worker if test -n "$a_deplib"; then 9387*6a54128fSAndroid Build Coastguard Worker libname=`eval "\\$ECHO \"$libname_spec\""` 9388*6a54128fSAndroid Build Coastguard Worker if test -n "$file_magic_glob"; then 9389*6a54128fSAndroid Build Coastguard Worker libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` 9390*6a54128fSAndroid Build Coastguard Worker else 9391*6a54128fSAndroid Build Coastguard Worker libnameglob=$libname 9392*6a54128fSAndroid Build Coastguard Worker fi 9393*6a54128fSAndroid Build Coastguard Worker test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob` 9394*6a54128fSAndroid Build Coastguard Worker for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 9395*6a54128fSAndroid Build Coastguard Worker if test yes = "$want_nocaseglob"; then 9396*6a54128fSAndroid Build Coastguard Worker shopt -s nocaseglob 9397*6a54128fSAndroid Build Coastguard Worker potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 9398*6a54128fSAndroid Build Coastguard Worker $nocaseglob 9399*6a54128fSAndroid Build Coastguard Worker else 9400*6a54128fSAndroid Build Coastguard Worker potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` 9401*6a54128fSAndroid Build Coastguard Worker fi 9402*6a54128fSAndroid Build Coastguard Worker for potent_lib in $potential_libs; do 9403*6a54128fSAndroid Build Coastguard Worker # Follow soft links. 9404*6a54128fSAndroid Build Coastguard Worker if ls -lLd "$potent_lib" 2>/dev/null | 9405*6a54128fSAndroid Build Coastguard Worker $GREP " -> " >/dev/null; then 9406*6a54128fSAndroid Build Coastguard Worker continue 9407*6a54128fSAndroid Build Coastguard Worker fi 9408*6a54128fSAndroid Build Coastguard Worker # The statement above tries to avoid entering an 9409*6a54128fSAndroid Build Coastguard Worker # endless loop below, in case of cyclic links. 9410*6a54128fSAndroid Build Coastguard Worker # We might still enter an endless loop, since a link 9411*6a54128fSAndroid Build Coastguard Worker # loop can be closed while we follow links, 9412*6a54128fSAndroid Build Coastguard Worker # but so what? 9413*6a54128fSAndroid Build Coastguard Worker potlib=$potent_lib 9414*6a54128fSAndroid Build Coastguard Worker while test -h "$potlib" 2>/dev/null; do 9415*6a54128fSAndroid Build Coastguard Worker potliblink=`ls -ld $potlib | $SED 's/.* -> //'` 9416*6a54128fSAndroid Build Coastguard Worker case $potliblink in 9417*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; 9418*6a54128fSAndroid Build Coastguard Worker *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; 9419*6a54128fSAndroid Build Coastguard Worker esac 9420*6a54128fSAndroid Build Coastguard Worker done 9421*6a54128fSAndroid Build Coastguard Worker if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | 9422*6a54128fSAndroid Build Coastguard Worker $SED -e 10q | 9423*6a54128fSAndroid Build Coastguard Worker $EGREP "$file_magic_regex" > /dev/null; then 9424*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $a_deplib" 9425*6a54128fSAndroid Build Coastguard Worker a_deplib= 9426*6a54128fSAndroid Build Coastguard Worker break 2 9427*6a54128fSAndroid Build Coastguard Worker fi 9428*6a54128fSAndroid Build Coastguard Worker done 9429*6a54128fSAndroid Build Coastguard Worker done 9430*6a54128fSAndroid Build Coastguard Worker fi 9431*6a54128fSAndroid Build Coastguard Worker if test -n "$a_deplib"; then 9432*6a54128fSAndroid Build Coastguard Worker droppeddeps=yes 9433*6a54128fSAndroid Build Coastguard Worker echo 9434*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 9435*6a54128fSAndroid Build Coastguard Worker echo "*** I have the capability to make that library automatically link in when" 9436*6a54128fSAndroid Build Coastguard Worker echo "*** you link to this library. But I can only do this if you have a" 9437*6a54128fSAndroid Build Coastguard Worker echo "*** shared version of the library, which you do not appear to have" 9438*6a54128fSAndroid Build Coastguard Worker echo "*** because I did check the linker path looking for a file starting" 9439*6a54128fSAndroid Build Coastguard Worker if test -z "$potlib"; then 9440*6a54128fSAndroid Build Coastguard Worker $ECHO "*** with $libname but no candidates were found. (...for file magic test)" 9441*6a54128fSAndroid Build Coastguard Worker else 9442*6a54128fSAndroid Build Coastguard Worker $ECHO "*** with $libname and none of the candidates passed a file format test" 9443*6a54128fSAndroid Build Coastguard Worker $ECHO "*** using a file magic. Last file checked: $potlib" 9444*6a54128fSAndroid Build Coastguard Worker fi 9445*6a54128fSAndroid Build Coastguard Worker fi 9446*6a54128fSAndroid Build Coastguard Worker ;; 9447*6a54128fSAndroid Build Coastguard Worker *) 9448*6a54128fSAndroid Build Coastguard Worker # Add a -L argument. 9449*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $a_deplib" 9450*6a54128fSAndroid Build Coastguard Worker ;; 9451*6a54128fSAndroid Build Coastguard Worker esac 9452*6a54128fSAndroid Build Coastguard Worker done # Gone through all deplibs. 9453*6a54128fSAndroid Build Coastguard Worker ;; 9454*6a54128fSAndroid Build Coastguard Worker match_pattern*) 9455*6a54128fSAndroid Build Coastguard Worker set dummy $deplibs_check_method; shift 9456*6a54128fSAndroid Build Coastguard Worker match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` 9457*6a54128fSAndroid Build Coastguard Worker for a_deplib in $deplibs; do 9458*6a54128fSAndroid Build Coastguard Worker case $a_deplib in 9459*6a54128fSAndroid Build Coastguard Worker -l*) 9460*6a54128fSAndroid Build Coastguard Worker func_stripname -l '' "$a_deplib" 9461*6a54128fSAndroid Build Coastguard Worker name=$func_stripname_result 9462*6a54128fSAndroid Build Coastguard Worker if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9463*6a54128fSAndroid Build Coastguard Worker case " $predeps $postdeps " in 9464*6a54128fSAndroid Build Coastguard Worker *" $a_deplib "*) 9465*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $a_deplib" 9466*6a54128fSAndroid Build Coastguard Worker a_deplib= 9467*6a54128fSAndroid Build Coastguard Worker ;; 9468*6a54128fSAndroid Build Coastguard Worker esac 9469*6a54128fSAndroid Build Coastguard Worker fi 9470*6a54128fSAndroid Build Coastguard Worker if test -n "$a_deplib"; then 9471*6a54128fSAndroid Build Coastguard Worker libname=`eval "\\$ECHO \"$libname_spec\""` 9472*6a54128fSAndroid Build Coastguard Worker for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 9473*6a54128fSAndroid Build Coastguard Worker potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 9474*6a54128fSAndroid Build Coastguard Worker for potent_lib in $potential_libs; do 9475*6a54128fSAndroid Build Coastguard Worker potlib=$potent_lib # see symlink-check above in file_magic test 9476*6a54128fSAndroid Build Coastguard Worker if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ 9477*6a54128fSAndroid Build Coastguard Worker $EGREP "$match_pattern_regex" > /dev/null; then 9478*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $a_deplib" 9479*6a54128fSAndroid Build Coastguard Worker a_deplib= 9480*6a54128fSAndroid Build Coastguard Worker break 2 9481*6a54128fSAndroid Build Coastguard Worker fi 9482*6a54128fSAndroid Build Coastguard Worker done 9483*6a54128fSAndroid Build Coastguard Worker done 9484*6a54128fSAndroid Build Coastguard Worker fi 9485*6a54128fSAndroid Build Coastguard Worker if test -n "$a_deplib"; then 9486*6a54128fSAndroid Build Coastguard Worker droppeddeps=yes 9487*6a54128fSAndroid Build Coastguard Worker echo 9488*6a54128fSAndroid Build Coastguard Worker $ECHO "*** Warning: linker path does not have real file for library $a_deplib." 9489*6a54128fSAndroid Build Coastguard Worker echo "*** I have the capability to make that library automatically link in when" 9490*6a54128fSAndroid Build Coastguard Worker echo "*** you link to this library. But I can only do this if you have a" 9491*6a54128fSAndroid Build Coastguard Worker echo "*** shared version of the library, which you do not appear to have" 9492*6a54128fSAndroid Build Coastguard Worker echo "*** because I did check the linker path looking for a file starting" 9493*6a54128fSAndroid Build Coastguard Worker if test -z "$potlib"; then 9494*6a54128fSAndroid Build Coastguard Worker $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" 9495*6a54128fSAndroid Build Coastguard Worker else 9496*6a54128fSAndroid Build Coastguard Worker $ECHO "*** with $libname and none of the candidates passed a file format test" 9497*6a54128fSAndroid Build Coastguard Worker $ECHO "*** using a regex pattern. Last file checked: $potlib" 9498*6a54128fSAndroid Build Coastguard Worker fi 9499*6a54128fSAndroid Build Coastguard Worker fi 9500*6a54128fSAndroid Build Coastguard Worker ;; 9501*6a54128fSAndroid Build Coastguard Worker *) 9502*6a54128fSAndroid Build Coastguard Worker # Add a -L argument. 9503*6a54128fSAndroid Build Coastguard Worker func_append newdeplibs " $a_deplib" 9504*6a54128fSAndroid Build Coastguard Worker ;; 9505*6a54128fSAndroid Build Coastguard Worker esac 9506*6a54128fSAndroid Build Coastguard Worker done # Gone through all deplibs. 9507*6a54128fSAndroid Build Coastguard Worker ;; 9508*6a54128fSAndroid Build Coastguard Worker none | unknown | *) 9509*6a54128fSAndroid Build Coastguard Worker newdeplibs= 9510*6a54128fSAndroid Build Coastguard Worker tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` 9511*6a54128fSAndroid Build Coastguard Worker if test yes = "$allow_libtool_libs_with_static_runtimes"; then 9512*6a54128fSAndroid Build Coastguard Worker for i in $predeps $postdeps; do 9513*6a54128fSAndroid Build Coastguard Worker # can't use Xsed below, because $i might contain '/' 9514*6a54128fSAndroid Build Coastguard Worker tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` 9515*6a54128fSAndroid Build Coastguard Worker done 9516*6a54128fSAndroid Build Coastguard Worker fi 9517*6a54128fSAndroid Build Coastguard Worker case $tmp_deplibs in 9518*6a54128fSAndroid Build Coastguard Worker *[!\ \ ]*) 9519*6a54128fSAndroid Build Coastguard Worker echo 9520*6a54128fSAndroid Build Coastguard Worker if test none = "$deplibs_check_method"; then 9521*6a54128fSAndroid Build Coastguard Worker echo "*** Warning: inter-library dependencies are not supported in this platform." 9522*6a54128fSAndroid Build Coastguard Worker else 9523*6a54128fSAndroid Build Coastguard Worker echo "*** Warning: inter-library dependencies are not known to be supported." 9524*6a54128fSAndroid Build Coastguard Worker fi 9525*6a54128fSAndroid Build Coastguard Worker echo "*** All declared inter-library dependencies are being dropped." 9526*6a54128fSAndroid Build Coastguard Worker droppeddeps=yes 9527*6a54128fSAndroid Build Coastguard Worker ;; 9528*6a54128fSAndroid Build Coastguard Worker esac 9529*6a54128fSAndroid Build Coastguard Worker ;; 9530*6a54128fSAndroid Build Coastguard Worker esac 9531*6a54128fSAndroid Build Coastguard Worker versuffix=$versuffix_save 9532*6a54128fSAndroid Build Coastguard Worker major=$major_save 9533*6a54128fSAndroid Build Coastguard Worker release=$release_save 9534*6a54128fSAndroid Build Coastguard Worker libname=$libname_save 9535*6a54128fSAndroid Build Coastguard Worker name=$name_save 9536*6a54128fSAndroid Build Coastguard Worker 9537*6a54128fSAndroid Build Coastguard Worker case $host in 9538*6a54128fSAndroid Build Coastguard Worker *-*-rhapsody* | *-*-darwin1.[012]) 9539*6a54128fSAndroid Build Coastguard Worker # On Rhapsody replace the C library with the System framework 9540*6a54128fSAndroid Build Coastguard Worker newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` 9541*6a54128fSAndroid Build Coastguard Worker ;; 9542*6a54128fSAndroid Build Coastguard Worker esac 9543*6a54128fSAndroid Build Coastguard Worker 9544*6a54128fSAndroid Build Coastguard Worker if test yes = "$droppeddeps"; then 9545*6a54128fSAndroid Build Coastguard Worker if test yes = "$module"; then 9546*6a54128fSAndroid Build Coastguard Worker echo 9547*6a54128fSAndroid Build Coastguard Worker echo "*** Warning: libtool could not satisfy all declared inter-library" 9548*6a54128fSAndroid Build Coastguard Worker $ECHO "*** dependencies of module $libname. Therefore, libtool will create" 9549*6a54128fSAndroid Build Coastguard Worker echo "*** a static module, that should work as long as the dlopening" 9550*6a54128fSAndroid Build Coastguard Worker echo "*** application is linked with the -dlopen flag." 9551*6a54128fSAndroid Build Coastguard Worker if test -z "$global_symbol_pipe"; then 9552*6a54128fSAndroid Build Coastguard Worker echo 9553*6a54128fSAndroid Build Coastguard Worker echo "*** However, this would only work if libtool was able to extract symbol" 9554*6a54128fSAndroid Build Coastguard Worker echo "*** lists from a program, using 'nm' or equivalent, but libtool could" 9555*6a54128fSAndroid Build Coastguard Worker echo "*** not find such a program. So, this module is probably useless." 9556*6a54128fSAndroid Build Coastguard Worker echo "*** 'nm' from GNU binutils and a full rebuild may help." 9557*6a54128fSAndroid Build Coastguard Worker fi 9558*6a54128fSAndroid Build Coastguard Worker if test no = "$build_old_libs"; then 9559*6a54128fSAndroid Build Coastguard Worker oldlibs=$output_objdir/$libname.$libext 9560*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=module 9561*6a54128fSAndroid Build Coastguard Worker build_old_libs=yes 9562*6a54128fSAndroid Build Coastguard Worker else 9563*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=no 9564*6a54128fSAndroid Build Coastguard Worker fi 9565*6a54128fSAndroid Build Coastguard Worker else 9566*6a54128fSAndroid Build Coastguard Worker echo "*** The inter-library dependencies that have been dropped here will be" 9567*6a54128fSAndroid Build Coastguard Worker echo "*** automatically added whenever a program is linked with this library" 9568*6a54128fSAndroid Build Coastguard Worker echo "*** or is declared to -dlopen it." 9569*6a54128fSAndroid Build Coastguard Worker 9570*6a54128fSAndroid Build Coastguard Worker if test no = "$allow_undefined"; then 9571*6a54128fSAndroid Build Coastguard Worker echo 9572*6a54128fSAndroid Build Coastguard Worker echo "*** Since this library must not contain undefined symbols," 9573*6a54128fSAndroid Build Coastguard Worker echo "*** because either the platform does not support them or" 9574*6a54128fSAndroid Build Coastguard Worker echo "*** it was explicitly requested with -no-undefined," 9575*6a54128fSAndroid Build Coastguard Worker echo "*** libtool will only create a static version of it." 9576*6a54128fSAndroid Build Coastguard Worker if test no = "$build_old_libs"; then 9577*6a54128fSAndroid Build Coastguard Worker oldlibs=$output_objdir/$libname.$libext 9578*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=module 9579*6a54128fSAndroid Build Coastguard Worker build_old_libs=yes 9580*6a54128fSAndroid Build Coastguard Worker else 9581*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=no 9582*6a54128fSAndroid Build Coastguard Worker fi 9583*6a54128fSAndroid Build Coastguard Worker fi 9584*6a54128fSAndroid Build Coastguard Worker fi 9585*6a54128fSAndroid Build Coastguard Worker fi 9586*6a54128fSAndroid Build Coastguard Worker # Done checking deplibs! 9587*6a54128fSAndroid Build Coastguard Worker deplibs=$newdeplibs 9588*6a54128fSAndroid Build Coastguard Worker fi 9589*6a54128fSAndroid Build Coastguard Worker # Time to change all our "foo.ltframework" stuff back to "-framework foo" 9590*6a54128fSAndroid Build Coastguard Worker case $host in 9591*6a54128fSAndroid Build Coastguard Worker *-*-darwin*) 9592*6a54128fSAndroid Build Coastguard Worker newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 9593*6a54128fSAndroid Build Coastguard Worker new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 9594*6a54128fSAndroid Build Coastguard Worker deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 9595*6a54128fSAndroid Build Coastguard Worker ;; 9596*6a54128fSAndroid Build Coastguard Worker esac 9597*6a54128fSAndroid Build Coastguard Worker 9598*6a54128fSAndroid Build Coastguard Worker # move library search paths that coincide with paths to not yet 9599*6a54128fSAndroid Build Coastguard Worker # installed libraries to the beginning of the library search list 9600*6a54128fSAndroid Build Coastguard Worker new_libs= 9601*6a54128fSAndroid Build Coastguard Worker for path in $notinst_path; do 9602*6a54128fSAndroid Build Coastguard Worker case " $new_libs " in 9603*6a54128fSAndroid Build Coastguard Worker *" -L$path/$objdir "*) ;; 9604*6a54128fSAndroid Build Coastguard Worker *) 9605*6a54128fSAndroid Build Coastguard Worker case " $deplibs " in 9606*6a54128fSAndroid Build Coastguard Worker *" -L$path/$objdir "*) 9607*6a54128fSAndroid Build Coastguard Worker func_append new_libs " -L$path/$objdir" ;; 9608*6a54128fSAndroid Build Coastguard Worker esac 9609*6a54128fSAndroid Build Coastguard Worker ;; 9610*6a54128fSAndroid Build Coastguard Worker esac 9611*6a54128fSAndroid Build Coastguard Worker done 9612*6a54128fSAndroid Build Coastguard Worker for deplib in $deplibs; do 9613*6a54128fSAndroid Build Coastguard Worker case $deplib in 9614*6a54128fSAndroid Build Coastguard Worker -L*) 9615*6a54128fSAndroid Build Coastguard Worker case " $new_libs " in 9616*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) ;; 9617*6a54128fSAndroid Build Coastguard Worker *) func_append new_libs " $deplib" ;; 9618*6a54128fSAndroid Build Coastguard Worker esac 9619*6a54128fSAndroid Build Coastguard Worker ;; 9620*6a54128fSAndroid Build Coastguard Worker *) func_append new_libs " $deplib" ;; 9621*6a54128fSAndroid Build Coastguard Worker esac 9622*6a54128fSAndroid Build Coastguard Worker done 9623*6a54128fSAndroid Build Coastguard Worker deplibs=$new_libs 9624*6a54128fSAndroid Build Coastguard Worker 9625*6a54128fSAndroid Build Coastguard Worker # All the library-specific variables (install_libdir is set above). 9626*6a54128fSAndroid Build Coastguard Worker library_names= 9627*6a54128fSAndroid Build Coastguard Worker old_library= 9628*6a54128fSAndroid Build Coastguard Worker dlname= 9629*6a54128fSAndroid Build Coastguard Worker 9630*6a54128fSAndroid Build Coastguard Worker # Test again, we may have decided not to build it any more 9631*6a54128fSAndroid Build Coastguard Worker if test yes = "$build_libtool_libs"; then 9632*6a54128fSAndroid Build Coastguard Worker # Remove $wl instances when linking with ld. 9633*6a54128fSAndroid Build Coastguard Worker # FIXME: should test the right _cmds variable. 9634*6a54128fSAndroid Build Coastguard Worker case $archive_cmds in 9635*6a54128fSAndroid Build Coastguard Worker *\$LD\ *) wl= ;; 9636*6a54128fSAndroid Build Coastguard Worker esac 9637*6a54128fSAndroid Build Coastguard Worker if test yes = "$hardcode_into_libs"; then 9638*6a54128fSAndroid Build Coastguard Worker # Hardcode the library paths 9639*6a54128fSAndroid Build Coastguard Worker hardcode_libdirs= 9640*6a54128fSAndroid Build Coastguard Worker dep_rpath= 9641*6a54128fSAndroid Build Coastguard Worker rpath=$finalize_rpath 9642*6a54128fSAndroid Build Coastguard Worker test relink = "$opt_mode" || rpath=$compile_rpath$rpath 9643*6a54128fSAndroid Build Coastguard Worker for libdir in $rpath; do 9644*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_flag_spec"; then 9645*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_separator"; then 9646*6a54128fSAndroid Build Coastguard Worker func_replace_sysroot "$libdir" 9647*6a54128fSAndroid Build Coastguard Worker libdir=$func_replace_sysroot_result 9648*6a54128fSAndroid Build Coastguard Worker if test -z "$hardcode_libdirs"; then 9649*6a54128fSAndroid Build Coastguard Worker hardcode_libdirs=$libdir 9650*6a54128fSAndroid Build Coastguard Worker else 9651*6a54128fSAndroid Build Coastguard Worker # Just accumulate the unique libdirs. 9652*6a54128fSAndroid Build Coastguard Worker case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 9653*6a54128fSAndroid Build Coastguard Worker *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 9654*6a54128fSAndroid Build Coastguard Worker ;; 9655*6a54128fSAndroid Build Coastguard Worker *) 9656*6a54128fSAndroid Build Coastguard Worker func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 9657*6a54128fSAndroid Build Coastguard Worker ;; 9658*6a54128fSAndroid Build Coastguard Worker esac 9659*6a54128fSAndroid Build Coastguard Worker fi 9660*6a54128fSAndroid Build Coastguard Worker else 9661*6a54128fSAndroid Build Coastguard Worker eval flag=\"$hardcode_libdir_flag_spec\" 9662*6a54128fSAndroid Build Coastguard Worker func_append dep_rpath " $flag" 9663*6a54128fSAndroid Build Coastguard Worker fi 9664*6a54128fSAndroid Build Coastguard Worker elif test -n "$runpath_var"; then 9665*6a54128fSAndroid Build Coastguard Worker case "$perm_rpath " in 9666*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 9667*6a54128fSAndroid Build Coastguard Worker *) func_append perm_rpath " $libdir" ;; 9668*6a54128fSAndroid Build Coastguard Worker esac 9669*6a54128fSAndroid Build Coastguard Worker fi 9670*6a54128fSAndroid Build Coastguard Worker done 9671*6a54128fSAndroid Build Coastguard Worker # Substitute the hardcoded libdirs into the rpath. 9672*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_separator" && 9673*6a54128fSAndroid Build Coastguard Worker test -n "$hardcode_libdirs"; then 9674*6a54128fSAndroid Build Coastguard Worker libdir=$hardcode_libdirs 9675*6a54128fSAndroid Build Coastguard Worker eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" 9676*6a54128fSAndroid Build Coastguard Worker fi 9677*6a54128fSAndroid Build Coastguard Worker if test -n "$runpath_var" && test -n "$perm_rpath"; then 9678*6a54128fSAndroid Build Coastguard Worker # We should set the runpath_var. 9679*6a54128fSAndroid Build Coastguard Worker rpath= 9680*6a54128fSAndroid Build Coastguard Worker for dir in $perm_rpath; do 9681*6a54128fSAndroid Build Coastguard Worker func_append rpath "$dir:" 9682*6a54128fSAndroid Build Coastguard Worker done 9683*6a54128fSAndroid Build Coastguard Worker eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 9684*6a54128fSAndroid Build Coastguard Worker fi 9685*6a54128fSAndroid Build Coastguard Worker test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 9686*6a54128fSAndroid Build Coastguard Worker fi 9687*6a54128fSAndroid Build Coastguard Worker 9688*6a54128fSAndroid Build Coastguard Worker shlibpath=$finalize_shlibpath 9689*6a54128fSAndroid Build Coastguard Worker test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath 9690*6a54128fSAndroid Build Coastguard Worker if test -n "$shlibpath"; then 9691*6a54128fSAndroid Build Coastguard Worker eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 9692*6a54128fSAndroid Build Coastguard Worker fi 9693*6a54128fSAndroid Build Coastguard Worker 9694*6a54128fSAndroid Build Coastguard Worker # Get the real and link names of the library. 9695*6a54128fSAndroid Build Coastguard Worker eval shared_ext=\"$shrext_cmds\" 9696*6a54128fSAndroid Build Coastguard Worker eval library_names=\"$library_names_spec\" 9697*6a54128fSAndroid Build Coastguard Worker set dummy $library_names 9698*6a54128fSAndroid Build Coastguard Worker shift 9699*6a54128fSAndroid Build Coastguard Worker realname=$1 9700*6a54128fSAndroid Build Coastguard Worker shift 9701*6a54128fSAndroid Build Coastguard Worker 9702*6a54128fSAndroid Build Coastguard Worker if test -n "$soname_spec"; then 9703*6a54128fSAndroid Build Coastguard Worker eval soname=\"$soname_spec\" 9704*6a54128fSAndroid Build Coastguard Worker else 9705*6a54128fSAndroid Build Coastguard Worker soname=$realname 9706*6a54128fSAndroid Build Coastguard Worker fi 9707*6a54128fSAndroid Build Coastguard Worker if test -z "$dlname"; then 9708*6a54128fSAndroid Build Coastguard Worker dlname=$soname 9709*6a54128fSAndroid Build Coastguard Worker fi 9710*6a54128fSAndroid Build Coastguard Worker 9711*6a54128fSAndroid Build Coastguard Worker lib=$output_objdir/$realname 9712*6a54128fSAndroid Build Coastguard Worker linknames= 9713*6a54128fSAndroid Build Coastguard Worker for link 9714*6a54128fSAndroid Build Coastguard Worker do 9715*6a54128fSAndroid Build Coastguard Worker func_append linknames " $link" 9716*6a54128fSAndroid Build Coastguard Worker done 9717*6a54128fSAndroid Build Coastguard Worker 9718*6a54128fSAndroid Build Coastguard Worker # Use standard objects if they are pic 9719*6a54128fSAndroid Build Coastguard Worker test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` 9720*6a54128fSAndroid Build Coastguard Worker test "X$libobjs" = "X " && libobjs= 9721*6a54128fSAndroid Build Coastguard Worker 9722*6a54128fSAndroid Build Coastguard Worker delfiles= 9723*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols" && test -n "$include_expsyms"; then 9724*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" 9725*6a54128fSAndroid Build Coastguard Worker export_symbols=$output_objdir/$libname.uexp 9726*6a54128fSAndroid Build Coastguard Worker func_append delfiles " $export_symbols" 9727*6a54128fSAndroid Build Coastguard Worker fi 9728*6a54128fSAndroid Build Coastguard Worker 9729*6a54128fSAndroid Build Coastguard Worker orig_export_symbols= 9730*6a54128fSAndroid Build Coastguard Worker case $host_os in 9731*6a54128fSAndroid Build Coastguard Worker cygwin* | mingw* | cegcc*) 9732*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols" && test -z "$export_symbols_regex"; then 9733*6a54128fSAndroid Build Coastguard Worker # exporting using user supplied symfile 9734*6a54128fSAndroid Build Coastguard Worker func_dll_def_p "$export_symbols" || { 9735*6a54128fSAndroid Build Coastguard Worker # and it's NOT already a .def file. Must figure out 9736*6a54128fSAndroid Build Coastguard Worker # which of the given symbols are data symbols and tag 9737*6a54128fSAndroid Build Coastguard Worker # them as such. So, trigger use of export_symbols_cmds. 9738*6a54128fSAndroid Build Coastguard Worker # export_symbols gets reassigned inside the "prepare 9739*6a54128fSAndroid Build Coastguard Worker # the list of exported symbols" if statement, so the 9740*6a54128fSAndroid Build Coastguard Worker # include_expsyms logic still works. 9741*6a54128fSAndroid Build Coastguard Worker orig_export_symbols=$export_symbols 9742*6a54128fSAndroid Build Coastguard Worker export_symbols= 9743*6a54128fSAndroid Build Coastguard Worker always_export_symbols=yes 9744*6a54128fSAndroid Build Coastguard Worker } 9745*6a54128fSAndroid Build Coastguard Worker fi 9746*6a54128fSAndroid Build Coastguard Worker ;; 9747*6a54128fSAndroid Build Coastguard Worker esac 9748*6a54128fSAndroid Build Coastguard Worker 9749*6a54128fSAndroid Build Coastguard Worker # Prepare the list of exported symbols 9750*6a54128fSAndroid Build Coastguard Worker if test -z "$export_symbols"; then 9751*6a54128fSAndroid Build Coastguard Worker if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then 9752*6a54128fSAndroid Build Coastguard Worker func_verbose "generating symbol list for '$libname.la'" 9753*6a54128fSAndroid Build Coastguard Worker export_symbols=$output_objdir/$libname.exp 9754*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM $export_symbols 9755*6a54128fSAndroid Build Coastguard Worker cmds=$export_symbols_cmds 9756*6a54128fSAndroid Build Coastguard Worker save_ifs=$IFS; IFS='~' 9757*6a54128fSAndroid Build Coastguard Worker for cmd1 in $cmds; do 9758*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 9759*6a54128fSAndroid Build Coastguard Worker # Take the normal branch if the nm_file_list_spec branch 9760*6a54128fSAndroid Build Coastguard Worker # doesn't work or if tool conversion is not needed. 9761*6a54128fSAndroid Build Coastguard Worker case $nm_file_list_spec~$to_tool_file_cmd in 9762*6a54128fSAndroid Build Coastguard Worker *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) 9763*6a54128fSAndroid Build Coastguard Worker try_normal_branch=yes 9764*6a54128fSAndroid Build Coastguard Worker eval cmd=\"$cmd1\" 9765*6a54128fSAndroid Build Coastguard Worker func_len " $cmd" 9766*6a54128fSAndroid Build Coastguard Worker len=$func_len_result 9767*6a54128fSAndroid Build Coastguard Worker ;; 9768*6a54128fSAndroid Build Coastguard Worker *) 9769*6a54128fSAndroid Build Coastguard Worker try_normal_branch=no 9770*6a54128fSAndroid Build Coastguard Worker ;; 9771*6a54128fSAndroid Build Coastguard Worker esac 9772*6a54128fSAndroid Build Coastguard Worker if test yes = "$try_normal_branch" \ 9773*6a54128fSAndroid Build Coastguard Worker && { test "$len" -lt "$max_cmd_len" \ 9774*6a54128fSAndroid Build Coastguard Worker || test "$max_cmd_len" -le -1; } 9775*6a54128fSAndroid Build Coastguard Worker then 9776*6a54128fSAndroid Build Coastguard Worker func_show_eval "$cmd" 'exit $?' 9777*6a54128fSAndroid Build Coastguard Worker skipped_export=false 9778*6a54128fSAndroid Build Coastguard Worker elif test -n "$nm_file_list_spec"; then 9779*6a54128fSAndroid Build Coastguard Worker func_basename "$output" 9780*6a54128fSAndroid Build Coastguard Worker output_la=$func_basename_result 9781*6a54128fSAndroid Build Coastguard Worker save_libobjs=$libobjs 9782*6a54128fSAndroid Build Coastguard Worker save_output=$output 9783*6a54128fSAndroid Build Coastguard Worker output=$output_objdir/$output_la.nm 9784*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$output" 9785*6a54128fSAndroid Build Coastguard Worker libobjs=$nm_file_list_spec$func_to_tool_file_result 9786*6a54128fSAndroid Build Coastguard Worker func_append delfiles " $output" 9787*6a54128fSAndroid Build Coastguard Worker func_verbose "creating $NM input file list: $output" 9788*6a54128fSAndroid Build Coastguard Worker for obj in $save_libobjs; do 9789*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$obj" 9790*6a54128fSAndroid Build Coastguard Worker $ECHO "$func_to_tool_file_result" 9791*6a54128fSAndroid Build Coastguard Worker done > "$output" 9792*6a54128fSAndroid Build Coastguard Worker eval cmd=\"$cmd1\" 9793*6a54128fSAndroid Build Coastguard Worker func_show_eval "$cmd" 'exit $?' 9794*6a54128fSAndroid Build Coastguard Worker output=$save_output 9795*6a54128fSAndroid Build Coastguard Worker libobjs=$save_libobjs 9796*6a54128fSAndroid Build Coastguard Worker skipped_export=false 9797*6a54128fSAndroid Build Coastguard Worker else 9798*6a54128fSAndroid Build Coastguard Worker # The command line is too long to execute in one step. 9799*6a54128fSAndroid Build Coastguard Worker func_verbose "using reloadable object file for export list..." 9800*6a54128fSAndroid Build Coastguard Worker skipped_export=: 9801*6a54128fSAndroid Build Coastguard Worker # Break out early, otherwise skipped_export may be 9802*6a54128fSAndroid Build Coastguard Worker # set to false by a later but shorter cmd. 9803*6a54128fSAndroid Build Coastguard Worker break 9804*6a54128fSAndroid Build Coastguard Worker fi 9805*6a54128fSAndroid Build Coastguard Worker done 9806*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 9807*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols_regex" && test : != "$skipped_export"; then 9808*6a54128fSAndroid Build Coastguard Worker func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 9809*6a54128fSAndroid Build Coastguard Worker func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 9810*6a54128fSAndroid Build Coastguard Worker fi 9811*6a54128fSAndroid Build Coastguard Worker fi 9812*6a54128fSAndroid Build Coastguard Worker fi 9813*6a54128fSAndroid Build Coastguard Worker 9814*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols" && test -n "$include_expsyms"; then 9815*6a54128fSAndroid Build Coastguard Worker tmp_export_symbols=$export_symbols 9816*6a54128fSAndroid Build Coastguard Worker test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols 9817*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 9818*6a54128fSAndroid Build Coastguard Worker fi 9819*6a54128fSAndroid Build Coastguard Worker 9820*6a54128fSAndroid Build Coastguard Worker if test : != "$skipped_export" && test -n "$orig_export_symbols"; then 9821*6a54128fSAndroid Build Coastguard Worker # The given exports_symbols file has to be filtered, so filter it. 9822*6a54128fSAndroid Build Coastguard Worker func_verbose "filter symbol list for '$libname.la' to tag DATA exports" 9823*6a54128fSAndroid Build Coastguard Worker # FIXME: $output_objdir/$libname.filter potentially contains lots of 9824*6a54128fSAndroid Build Coastguard Worker # 's' commands, which not all seds can handle. GNU sed should be fine 9825*6a54128fSAndroid Build Coastguard Worker # though. Also, the filter scales superlinearly with the number of 9826*6a54128fSAndroid Build Coastguard Worker # global variables. join(1) would be nice here, but unfortunately 9827*6a54128fSAndroid Build Coastguard Worker # isn't a blessed tool. 9828*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 9829*6a54128fSAndroid Build Coastguard Worker func_append delfiles " $export_symbols $output_objdir/$libname.filter" 9830*6a54128fSAndroid Build Coastguard Worker export_symbols=$output_objdir/$libname.def 9831*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 9832*6a54128fSAndroid Build Coastguard Worker fi 9833*6a54128fSAndroid Build Coastguard Worker 9834*6a54128fSAndroid Build Coastguard Worker tmp_deplibs= 9835*6a54128fSAndroid Build Coastguard Worker for test_deplib in $deplibs; do 9836*6a54128fSAndroid Build Coastguard Worker case " $convenience " in 9837*6a54128fSAndroid Build Coastguard Worker *" $test_deplib "*) ;; 9838*6a54128fSAndroid Build Coastguard Worker *) 9839*6a54128fSAndroid Build Coastguard Worker func_append tmp_deplibs " $test_deplib" 9840*6a54128fSAndroid Build Coastguard Worker ;; 9841*6a54128fSAndroid Build Coastguard Worker esac 9842*6a54128fSAndroid Build Coastguard Worker done 9843*6a54128fSAndroid Build Coastguard Worker deplibs=$tmp_deplibs 9844*6a54128fSAndroid Build Coastguard Worker 9845*6a54128fSAndroid Build Coastguard Worker if test -n "$convenience"; then 9846*6a54128fSAndroid Build Coastguard Worker if test -n "$whole_archive_flag_spec" && 9847*6a54128fSAndroid Build Coastguard Worker test yes = "$compiler_needs_object" && 9848*6a54128fSAndroid Build Coastguard Worker test -z "$libobjs"; then 9849*6a54128fSAndroid Build Coastguard Worker # extract the archives, so we have objects to list. 9850*6a54128fSAndroid Build Coastguard Worker # TODO: could optimize this to just extract one archive. 9851*6a54128fSAndroid Build Coastguard Worker whole_archive_flag_spec= 9852*6a54128fSAndroid Build Coastguard Worker fi 9853*6a54128fSAndroid Build Coastguard Worker if test -n "$whole_archive_flag_spec"; then 9854*6a54128fSAndroid Build Coastguard Worker save_libobjs=$libobjs 9855*6a54128fSAndroid Build Coastguard Worker eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 9856*6a54128fSAndroid Build Coastguard Worker test "X$libobjs" = "X " && libobjs= 9857*6a54128fSAndroid Build Coastguard Worker else 9858*6a54128fSAndroid Build Coastguard Worker gentop=$output_objdir/${outputname}x 9859*6a54128fSAndroid Build Coastguard Worker func_append generated " $gentop" 9860*6a54128fSAndroid Build Coastguard Worker 9861*6a54128fSAndroid Build Coastguard Worker func_extract_archives $gentop $convenience 9862*6a54128fSAndroid Build Coastguard Worker func_append libobjs " $func_extract_archives_result" 9863*6a54128fSAndroid Build Coastguard Worker test "X$libobjs" = "X " && libobjs= 9864*6a54128fSAndroid Build Coastguard Worker fi 9865*6a54128fSAndroid Build Coastguard Worker fi 9866*6a54128fSAndroid Build Coastguard Worker 9867*6a54128fSAndroid Build Coastguard Worker if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then 9868*6a54128fSAndroid Build Coastguard Worker eval flag=\"$thread_safe_flag_spec\" 9869*6a54128fSAndroid Build Coastguard Worker func_append linker_flags " $flag" 9870*6a54128fSAndroid Build Coastguard Worker fi 9871*6a54128fSAndroid Build Coastguard Worker 9872*6a54128fSAndroid Build Coastguard Worker # Make a backup of the uninstalled library when relinking 9873*6a54128fSAndroid Build Coastguard Worker if test relink = "$opt_mode"; then 9874*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? 9875*6a54128fSAndroid Build Coastguard Worker fi 9876*6a54128fSAndroid Build Coastguard Worker 9877*6a54128fSAndroid Build Coastguard Worker # Do each of the archive commands. 9878*6a54128fSAndroid Build Coastguard Worker if test yes = "$module" && test -n "$module_cmds"; then 9879*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 9880*6a54128fSAndroid Build Coastguard Worker eval test_cmds=\"$module_expsym_cmds\" 9881*6a54128fSAndroid Build Coastguard Worker cmds=$module_expsym_cmds 9882*6a54128fSAndroid Build Coastguard Worker else 9883*6a54128fSAndroid Build Coastguard Worker eval test_cmds=\"$module_cmds\" 9884*6a54128fSAndroid Build Coastguard Worker cmds=$module_cmds 9885*6a54128fSAndroid Build Coastguard Worker fi 9886*6a54128fSAndroid Build Coastguard Worker else 9887*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 9888*6a54128fSAndroid Build Coastguard Worker eval test_cmds=\"$archive_expsym_cmds\" 9889*6a54128fSAndroid Build Coastguard Worker cmds=$archive_expsym_cmds 9890*6a54128fSAndroid Build Coastguard Worker else 9891*6a54128fSAndroid Build Coastguard Worker eval test_cmds=\"$archive_cmds\" 9892*6a54128fSAndroid Build Coastguard Worker cmds=$archive_cmds 9893*6a54128fSAndroid Build Coastguard Worker fi 9894*6a54128fSAndroid Build Coastguard Worker fi 9895*6a54128fSAndroid Build Coastguard Worker 9896*6a54128fSAndroid Build Coastguard Worker if test : != "$skipped_export" && 9897*6a54128fSAndroid Build Coastguard Worker func_len " $test_cmds" && 9898*6a54128fSAndroid Build Coastguard Worker len=$func_len_result && 9899*6a54128fSAndroid Build Coastguard Worker test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 9900*6a54128fSAndroid Build Coastguard Worker : 9901*6a54128fSAndroid Build Coastguard Worker else 9902*6a54128fSAndroid Build Coastguard Worker # The command line is too long to link in one step, link piecewise 9903*6a54128fSAndroid Build Coastguard Worker # or, if using GNU ld and skipped_export is not :, use a linker 9904*6a54128fSAndroid Build Coastguard Worker # script. 9905*6a54128fSAndroid Build Coastguard Worker 9906*6a54128fSAndroid Build Coastguard Worker # Save the value of $output and $libobjs because we want to 9907*6a54128fSAndroid Build Coastguard Worker # use them later. If we have whole_archive_flag_spec, we 9908*6a54128fSAndroid Build Coastguard Worker # want to use save_libobjs as it was before 9909*6a54128fSAndroid Build Coastguard Worker # whole_archive_flag_spec was expanded, because we can't 9910*6a54128fSAndroid Build Coastguard Worker # assume the linker understands whole_archive_flag_spec. 9911*6a54128fSAndroid Build Coastguard Worker # This may have to be revisited, in case too many 9912*6a54128fSAndroid Build Coastguard Worker # convenience libraries get linked in and end up exceeding 9913*6a54128fSAndroid Build Coastguard Worker # the spec. 9914*6a54128fSAndroid Build Coastguard Worker if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 9915*6a54128fSAndroid Build Coastguard Worker save_libobjs=$libobjs 9916*6a54128fSAndroid Build Coastguard Worker fi 9917*6a54128fSAndroid Build Coastguard Worker save_output=$output 9918*6a54128fSAndroid Build Coastguard Worker func_basename "$output" 9919*6a54128fSAndroid Build Coastguard Worker output_la=$func_basename_result 9920*6a54128fSAndroid Build Coastguard Worker 9921*6a54128fSAndroid Build Coastguard Worker # Clear the reloadable object creation command queue and 9922*6a54128fSAndroid Build Coastguard Worker # initialize k to one. 9923*6a54128fSAndroid Build Coastguard Worker test_cmds= 9924*6a54128fSAndroid Build Coastguard Worker concat_cmds= 9925*6a54128fSAndroid Build Coastguard Worker objlist= 9926*6a54128fSAndroid Build Coastguard Worker last_robj= 9927*6a54128fSAndroid Build Coastguard Worker k=1 9928*6a54128fSAndroid Build Coastguard Worker 9929*6a54128fSAndroid Build Coastguard Worker if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then 9930*6a54128fSAndroid Build Coastguard Worker output=$output_objdir/$output_la.lnkscript 9931*6a54128fSAndroid Build Coastguard Worker func_verbose "creating GNU ld script: $output" 9932*6a54128fSAndroid Build Coastguard Worker echo 'INPUT (' > $output 9933*6a54128fSAndroid Build Coastguard Worker for obj in $save_libobjs 9934*6a54128fSAndroid Build Coastguard Worker do 9935*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$obj" 9936*6a54128fSAndroid Build Coastguard Worker $ECHO "$func_to_tool_file_result" >> $output 9937*6a54128fSAndroid Build Coastguard Worker done 9938*6a54128fSAndroid Build Coastguard Worker echo ')' >> $output 9939*6a54128fSAndroid Build Coastguard Worker func_append delfiles " $output" 9940*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$output" 9941*6a54128fSAndroid Build Coastguard Worker output=$func_to_tool_file_result 9942*6a54128fSAndroid Build Coastguard Worker elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then 9943*6a54128fSAndroid Build Coastguard Worker output=$output_objdir/$output_la.lnk 9944*6a54128fSAndroid Build Coastguard Worker func_verbose "creating linker input file list: $output" 9945*6a54128fSAndroid Build Coastguard Worker : > $output 9946*6a54128fSAndroid Build Coastguard Worker set x $save_libobjs 9947*6a54128fSAndroid Build Coastguard Worker shift 9948*6a54128fSAndroid Build Coastguard Worker firstobj= 9949*6a54128fSAndroid Build Coastguard Worker if test yes = "$compiler_needs_object"; then 9950*6a54128fSAndroid Build Coastguard Worker firstobj="$1 " 9951*6a54128fSAndroid Build Coastguard Worker shift 9952*6a54128fSAndroid Build Coastguard Worker fi 9953*6a54128fSAndroid Build Coastguard Worker for obj 9954*6a54128fSAndroid Build Coastguard Worker do 9955*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$obj" 9956*6a54128fSAndroid Build Coastguard Worker $ECHO "$func_to_tool_file_result" >> $output 9957*6a54128fSAndroid Build Coastguard Worker done 9958*6a54128fSAndroid Build Coastguard Worker func_append delfiles " $output" 9959*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$output" 9960*6a54128fSAndroid Build Coastguard Worker output=$firstobj\"$file_list_spec$func_to_tool_file_result\" 9961*6a54128fSAndroid Build Coastguard Worker else 9962*6a54128fSAndroid Build Coastguard Worker if test -n "$save_libobjs"; then 9963*6a54128fSAndroid Build Coastguard Worker func_verbose "creating reloadable object files..." 9964*6a54128fSAndroid Build Coastguard Worker output=$output_objdir/$output_la-$k.$objext 9965*6a54128fSAndroid Build Coastguard Worker eval test_cmds=\"$reload_cmds\" 9966*6a54128fSAndroid Build Coastguard Worker func_len " $test_cmds" 9967*6a54128fSAndroid Build Coastguard Worker len0=$func_len_result 9968*6a54128fSAndroid Build Coastguard Worker len=$len0 9969*6a54128fSAndroid Build Coastguard Worker 9970*6a54128fSAndroid Build Coastguard Worker # Loop over the list of objects to be linked. 9971*6a54128fSAndroid Build Coastguard Worker for obj in $save_libobjs 9972*6a54128fSAndroid Build Coastguard Worker do 9973*6a54128fSAndroid Build Coastguard Worker func_len " $obj" 9974*6a54128fSAndroid Build Coastguard Worker func_arith $len + $func_len_result 9975*6a54128fSAndroid Build Coastguard Worker len=$func_arith_result 9976*6a54128fSAndroid Build Coastguard Worker if test -z "$objlist" || 9977*6a54128fSAndroid Build Coastguard Worker test "$len" -lt "$max_cmd_len"; then 9978*6a54128fSAndroid Build Coastguard Worker func_append objlist " $obj" 9979*6a54128fSAndroid Build Coastguard Worker else 9980*6a54128fSAndroid Build Coastguard Worker # The command $test_cmds is almost too long, add a 9981*6a54128fSAndroid Build Coastguard Worker # command to the queue. 9982*6a54128fSAndroid Build Coastguard Worker if test 1 -eq "$k"; then 9983*6a54128fSAndroid Build Coastguard Worker # The first file doesn't have a previous command to add. 9984*6a54128fSAndroid Build Coastguard Worker reload_objs=$objlist 9985*6a54128fSAndroid Build Coastguard Worker eval concat_cmds=\"$reload_cmds\" 9986*6a54128fSAndroid Build Coastguard Worker else 9987*6a54128fSAndroid Build Coastguard Worker # All subsequent reloadable object files will link in 9988*6a54128fSAndroid Build Coastguard Worker # the last one created. 9989*6a54128fSAndroid Build Coastguard Worker reload_objs="$objlist $last_robj" 9990*6a54128fSAndroid Build Coastguard Worker eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" 9991*6a54128fSAndroid Build Coastguard Worker fi 9992*6a54128fSAndroid Build Coastguard Worker last_robj=$output_objdir/$output_la-$k.$objext 9993*6a54128fSAndroid Build Coastguard Worker func_arith $k + 1 9994*6a54128fSAndroid Build Coastguard Worker k=$func_arith_result 9995*6a54128fSAndroid Build Coastguard Worker output=$output_objdir/$output_la-$k.$objext 9996*6a54128fSAndroid Build Coastguard Worker objlist=" $obj" 9997*6a54128fSAndroid Build Coastguard Worker func_len " $last_robj" 9998*6a54128fSAndroid Build Coastguard Worker func_arith $len0 + $func_len_result 9999*6a54128fSAndroid Build Coastguard Worker len=$func_arith_result 10000*6a54128fSAndroid Build Coastguard Worker fi 10001*6a54128fSAndroid Build Coastguard Worker done 10002*6a54128fSAndroid Build Coastguard Worker # Handle the remaining objects by creating one last 10003*6a54128fSAndroid Build Coastguard Worker # reloadable object file. All subsequent reloadable object 10004*6a54128fSAndroid Build Coastguard Worker # files will link in the last one created. 10005*6a54128fSAndroid Build Coastguard Worker test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 10006*6a54128fSAndroid Build Coastguard Worker reload_objs="$objlist $last_robj" 10007*6a54128fSAndroid Build Coastguard Worker eval concat_cmds=\"\$concat_cmds$reload_cmds\" 10008*6a54128fSAndroid Build Coastguard Worker if test -n "$last_robj"; then 10009*6a54128fSAndroid Build Coastguard Worker eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 10010*6a54128fSAndroid Build Coastguard Worker fi 10011*6a54128fSAndroid Build Coastguard Worker func_append delfiles " $output" 10012*6a54128fSAndroid Build Coastguard Worker 10013*6a54128fSAndroid Build Coastguard Worker else 10014*6a54128fSAndroid Build Coastguard Worker output= 10015*6a54128fSAndroid Build Coastguard Worker fi 10016*6a54128fSAndroid Build Coastguard Worker 10017*6a54128fSAndroid Build Coastguard Worker ${skipped_export-false} && { 10018*6a54128fSAndroid Build Coastguard Worker func_verbose "generating symbol list for '$libname.la'" 10019*6a54128fSAndroid Build Coastguard Worker export_symbols=$output_objdir/$libname.exp 10020*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM $export_symbols 10021*6a54128fSAndroid Build Coastguard Worker libobjs=$output 10022*6a54128fSAndroid Build Coastguard Worker # Append the command to create the export file. 10023*6a54128fSAndroid Build Coastguard Worker test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 10024*6a54128fSAndroid Build Coastguard Worker eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" 10025*6a54128fSAndroid Build Coastguard Worker if test -n "$last_robj"; then 10026*6a54128fSAndroid Build Coastguard Worker eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" 10027*6a54128fSAndroid Build Coastguard Worker fi 10028*6a54128fSAndroid Build Coastguard Worker } 10029*6a54128fSAndroid Build Coastguard Worker 10030*6a54128fSAndroid Build Coastguard Worker test -n "$save_libobjs" && 10031*6a54128fSAndroid Build Coastguard Worker func_verbose "creating a temporary reloadable object file: $output" 10032*6a54128fSAndroid Build Coastguard Worker 10033*6a54128fSAndroid Build Coastguard Worker # Loop through the commands generated above and execute them. 10034*6a54128fSAndroid Build Coastguard Worker save_ifs=$IFS; IFS='~' 10035*6a54128fSAndroid Build Coastguard Worker for cmd in $concat_cmds; do 10036*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 10037*6a54128fSAndroid Build Coastguard Worker $opt_quiet || { 10038*6a54128fSAndroid Build Coastguard Worker func_quote_for_expand "$cmd" 10039*6a54128fSAndroid Build Coastguard Worker eval "func_echo $func_quote_for_expand_result" 10040*6a54128fSAndroid Build Coastguard Worker } 10041*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || eval "$cmd" || { 10042*6a54128fSAndroid Build Coastguard Worker lt_exit=$? 10043*6a54128fSAndroid Build Coastguard Worker 10044*6a54128fSAndroid Build Coastguard Worker # Restore the uninstalled library and exit 10045*6a54128fSAndroid Build Coastguard Worker if test relink = "$opt_mode"; then 10046*6a54128fSAndroid Build Coastguard Worker ( cd "$output_objdir" && \ 10047*6a54128fSAndroid Build Coastguard Worker $RM "${realname}T" && \ 10048*6a54128fSAndroid Build Coastguard Worker $MV "${realname}U" "$realname" ) 10049*6a54128fSAndroid Build Coastguard Worker fi 10050*6a54128fSAndroid Build Coastguard Worker 10051*6a54128fSAndroid Build Coastguard Worker exit $lt_exit 10052*6a54128fSAndroid Build Coastguard Worker } 10053*6a54128fSAndroid Build Coastguard Worker done 10054*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 10055*6a54128fSAndroid Build Coastguard Worker 10056*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols_regex" && ${skipped_export-false}; then 10057*6a54128fSAndroid Build Coastguard Worker func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 10058*6a54128fSAndroid Build Coastguard Worker func_show_eval '$MV "${export_symbols}T" "$export_symbols"' 10059*6a54128fSAndroid Build Coastguard Worker fi 10060*6a54128fSAndroid Build Coastguard Worker fi 10061*6a54128fSAndroid Build Coastguard Worker 10062*6a54128fSAndroid Build Coastguard Worker ${skipped_export-false} && { 10063*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols" && test -n "$include_expsyms"; then 10064*6a54128fSAndroid Build Coastguard Worker tmp_export_symbols=$export_symbols 10065*6a54128fSAndroid Build Coastguard Worker test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols 10066*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' 10067*6a54128fSAndroid Build Coastguard Worker fi 10068*6a54128fSAndroid Build Coastguard Worker 10069*6a54128fSAndroid Build Coastguard Worker if test -n "$orig_export_symbols"; then 10070*6a54128fSAndroid Build Coastguard Worker # The given exports_symbols file has to be filtered, so filter it. 10071*6a54128fSAndroid Build Coastguard Worker func_verbose "filter symbol list for '$libname.la' to tag DATA exports" 10072*6a54128fSAndroid Build Coastguard Worker # FIXME: $output_objdir/$libname.filter potentially contains lots of 10073*6a54128fSAndroid Build Coastguard Worker # 's' commands, which not all seds can handle. GNU sed should be fine 10074*6a54128fSAndroid Build Coastguard Worker # though. Also, the filter scales superlinearly with the number of 10075*6a54128fSAndroid Build Coastguard Worker # global variables. join(1) would be nice here, but unfortunately 10076*6a54128fSAndroid Build Coastguard Worker # isn't a blessed tool. 10077*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 10078*6a54128fSAndroid Build Coastguard Worker func_append delfiles " $export_symbols $output_objdir/$libname.filter" 10079*6a54128fSAndroid Build Coastguard Worker export_symbols=$output_objdir/$libname.def 10080*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols 10081*6a54128fSAndroid Build Coastguard Worker fi 10082*6a54128fSAndroid Build Coastguard Worker } 10083*6a54128fSAndroid Build Coastguard Worker 10084*6a54128fSAndroid Build Coastguard Worker libobjs=$output 10085*6a54128fSAndroid Build Coastguard Worker # Restore the value of output. 10086*6a54128fSAndroid Build Coastguard Worker output=$save_output 10087*6a54128fSAndroid Build Coastguard Worker 10088*6a54128fSAndroid Build Coastguard Worker if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 10089*6a54128fSAndroid Build Coastguard Worker eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 10090*6a54128fSAndroid Build Coastguard Worker test "X$libobjs" = "X " && libobjs= 10091*6a54128fSAndroid Build Coastguard Worker fi 10092*6a54128fSAndroid Build Coastguard Worker # Expand the library linking commands again to reset the 10093*6a54128fSAndroid Build Coastguard Worker # value of $libobjs for piecewise linking. 10094*6a54128fSAndroid Build Coastguard Worker 10095*6a54128fSAndroid Build Coastguard Worker # Do each of the archive commands. 10096*6a54128fSAndroid Build Coastguard Worker if test yes = "$module" && test -n "$module_cmds"; then 10097*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 10098*6a54128fSAndroid Build Coastguard Worker cmds=$module_expsym_cmds 10099*6a54128fSAndroid Build Coastguard Worker else 10100*6a54128fSAndroid Build Coastguard Worker cmds=$module_cmds 10101*6a54128fSAndroid Build Coastguard Worker fi 10102*6a54128fSAndroid Build Coastguard Worker else 10103*6a54128fSAndroid Build Coastguard Worker if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 10104*6a54128fSAndroid Build Coastguard Worker cmds=$archive_expsym_cmds 10105*6a54128fSAndroid Build Coastguard Worker else 10106*6a54128fSAndroid Build Coastguard Worker cmds=$archive_cmds 10107*6a54128fSAndroid Build Coastguard Worker fi 10108*6a54128fSAndroid Build Coastguard Worker fi 10109*6a54128fSAndroid Build Coastguard Worker fi 10110*6a54128fSAndroid Build Coastguard Worker 10111*6a54128fSAndroid Build Coastguard Worker if test -n "$delfiles"; then 10112*6a54128fSAndroid Build Coastguard Worker # Append the command to remove temporary files to $cmds. 10113*6a54128fSAndroid Build Coastguard Worker eval cmds=\"\$cmds~\$RM $delfiles\" 10114*6a54128fSAndroid Build Coastguard Worker fi 10115*6a54128fSAndroid Build Coastguard Worker 10116*6a54128fSAndroid Build Coastguard Worker # Add any objects from preloaded convenience libraries 10117*6a54128fSAndroid Build Coastguard Worker if test -n "$dlprefiles"; then 10118*6a54128fSAndroid Build Coastguard Worker gentop=$output_objdir/${outputname}x 10119*6a54128fSAndroid Build Coastguard Worker func_append generated " $gentop" 10120*6a54128fSAndroid Build Coastguard Worker 10121*6a54128fSAndroid Build Coastguard Worker func_extract_archives $gentop $dlprefiles 10122*6a54128fSAndroid Build Coastguard Worker func_append libobjs " $func_extract_archives_result" 10123*6a54128fSAndroid Build Coastguard Worker test "X$libobjs" = "X " && libobjs= 10124*6a54128fSAndroid Build Coastguard Worker fi 10125*6a54128fSAndroid Build Coastguard Worker 10126*6a54128fSAndroid Build Coastguard Worker save_ifs=$IFS; IFS='~' 10127*6a54128fSAndroid Build Coastguard Worker for cmd in $cmds; do 10128*6a54128fSAndroid Build Coastguard Worker IFS=$sp$nl 10129*6a54128fSAndroid Build Coastguard Worker eval cmd=\"$cmd\" 10130*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 10131*6a54128fSAndroid Build Coastguard Worker $opt_quiet || { 10132*6a54128fSAndroid Build Coastguard Worker func_quote_for_expand "$cmd" 10133*6a54128fSAndroid Build Coastguard Worker eval "func_echo $func_quote_for_expand_result" 10134*6a54128fSAndroid Build Coastguard Worker } 10135*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || eval "$cmd" || { 10136*6a54128fSAndroid Build Coastguard Worker lt_exit=$? 10137*6a54128fSAndroid Build Coastguard Worker 10138*6a54128fSAndroid Build Coastguard Worker # Restore the uninstalled library and exit 10139*6a54128fSAndroid Build Coastguard Worker if test relink = "$opt_mode"; then 10140*6a54128fSAndroid Build Coastguard Worker ( cd "$output_objdir" && \ 10141*6a54128fSAndroid Build Coastguard Worker $RM "${realname}T" && \ 10142*6a54128fSAndroid Build Coastguard Worker $MV "${realname}U" "$realname" ) 10143*6a54128fSAndroid Build Coastguard Worker fi 10144*6a54128fSAndroid Build Coastguard Worker 10145*6a54128fSAndroid Build Coastguard Worker exit $lt_exit 10146*6a54128fSAndroid Build Coastguard Worker } 10147*6a54128fSAndroid Build Coastguard Worker done 10148*6a54128fSAndroid Build Coastguard Worker IFS=$save_ifs 10149*6a54128fSAndroid Build Coastguard Worker 10150*6a54128fSAndroid Build Coastguard Worker # Restore the uninstalled library and exit 10151*6a54128fSAndroid Build Coastguard Worker if test relink = "$opt_mode"; then 10152*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? 10153*6a54128fSAndroid Build Coastguard Worker 10154*6a54128fSAndroid Build Coastguard Worker if test -n "$convenience"; then 10155*6a54128fSAndroid Build Coastguard Worker if test -z "$whole_archive_flag_spec"; then 10156*6a54128fSAndroid Build Coastguard Worker func_show_eval '${RM}r "$gentop"' 10157*6a54128fSAndroid Build Coastguard Worker fi 10158*6a54128fSAndroid Build Coastguard Worker fi 10159*6a54128fSAndroid Build Coastguard Worker 10160*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 10161*6a54128fSAndroid Build Coastguard Worker fi 10162*6a54128fSAndroid Build Coastguard Worker 10163*6a54128fSAndroid Build Coastguard Worker # Create links to the real library. 10164*6a54128fSAndroid Build Coastguard Worker for linkname in $linknames; do 10165*6a54128fSAndroid Build Coastguard Worker if test "$realname" != "$linkname"; then 10166*6a54128fSAndroid Build Coastguard Worker func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' 10167*6a54128fSAndroid Build Coastguard Worker fi 10168*6a54128fSAndroid Build Coastguard Worker done 10169*6a54128fSAndroid Build Coastguard Worker 10170*6a54128fSAndroid Build Coastguard Worker # If -module or -export-dynamic was specified, set the dlname. 10171*6a54128fSAndroid Build Coastguard Worker if test yes = "$module" || test yes = "$export_dynamic"; then 10172*6a54128fSAndroid Build Coastguard Worker # On all known operating systems, these are identical. 10173*6a54128fSAndroid Build Coastguard Worker dlname=$soname 10174*6a54128fSAndroid Build Coastguard Worker fi 10175*6a54128fSAndroid Build Coastguard Worker fi 10176*6a54128fSAndroid Build Coastguard Worker ;; 10177*6a54128fSAndroid Build Coastguard Worker 10178*6a54128fSAndroid Build Coastguard Worker obj) 10179*6a54128fSAndroid Build Coastguard Worker if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then 10180*6a54128fSAndroid Build Coastguard Worker func_warning "'-dlopen' is ignored for objects" 10181*6a54128fSAndroid Build Coastguard Worker fi 10182*6a54128fSAndroid Build Coastguard Worker 10183*6a54128fSAndroid Build Coastguard Worker case " $deplibs" in 10184*6a54128fSAndroid Build Coastguard Worker *\ -l* | *\ -L*) 10185*6a54128fSAndroid Build Coastguard Worker func_warning "'-l' and '-L' are ignored for objects" ;; 10186*6a54128fSAndroid Build Coastguard Worker esac 10187*6a54128fSAndroid Build Coastguard Worker 10188*6a54128fSAndroid Build Coastguard Worker test -n "$rpath" && \ 10189*6a54128fSAndroid Build Coastguard Worker func_warning "'-rpath' is ignored for objects" 10190*6a54128fSAndroid Build Coastguard Worker 10191*6a54128fSAndroid Build Coastguard Worker test -n "$xrpath" && \ 10192*6a54128fSAndroid Build Coastguard Worker func_warning "'-R' is ignored for objects" 10193*6a54128fSAndroid Build Coastguard Worker 10194*6a54128fSAndroid Build Coastguard Worker test -n "$vinfo" && \ 10195*6a54128fSAndroid Build Coastguard Worker func_warning "'-version-info' is ignored for objects" 10196*6a54128fSAndroid Build Coastguard Worker 10197*6a54128fSAndroid Build Coastguard Worker test -n "$release" && \ 10198*6a54128fSAndroid Build Coastguard Worker func_warning "'-release' is ignored for objects" 10199*6a54128fSAndroid Build Coastguard Worker 10200*6a54128fSAndroid Build Coastguard Worker case $output in 10201*6a54128fSAndroid Build Coastguard Worker *.lo) 10202*6a54128fSAndroid Build Coastguard Worker test -n "$objs$old_deplibs" && \ 10203*6a54128fSAndroid Build Coastguard Worker func_fatal_error "cannot build library object '$output' from non-libtool objects" 10204*6a54128fSAndroid Build Coastguard Worker 10205*6a54128fSAndroid Build Coastguard Worker libobj=$output 10206*6a54128fSAndroid Build Coastguard Worker func_lo2o "$libobj" 10207*6a54128fSAndroid Build Coastguard Worker obj=$func_lo2o_result 10208*6a54128fSAndroid Build Coastguard Worker ;; 10209*6a54128fSAndroid Build Coastguard Worker *) 10210*6a54128fSAndroid Build Coastguard Worker libobj= 10211*6a54128fSAndroid Build Coastguard Worker obj=$output 10212*6a54128fSAndroid Build Coastguard Worker ;; 10213*6a54128fSAndroid Build Coastguard Worker esac 10214*6a54128fSAndroid Build Coastguard Worker 10215*6a54128fSAndroid Build Coastguard Worker # Delete the old objects. 10216*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM $obj $libobj 10217*6a54128fSAndroid Build Coastguard Worker 10218*6a54128fSAndroid Build Coastguard Worker # Objects from convenience libraries. This assumes 10219*6a54128fSAndroid Build Coastguard Worker # single-version convenience libraries. Whenever we create 10220*6a54128fSAndroid Build Coastguard Worker # different ones for PIC/non-PIC, this we'll have to duplicate 10221*6a54128fSAndroid Build Coastguard Worker # the extraction. 10222*6a54128fSAndroid Build Coastguard Worker reload_conv_objs= 10223*6a54128fSAndroid Build Coastguard Worker gentop= 10224*6a54128fSAndroid Build Coastguard Worker # if reload_cmds runs $LD directly, get rid of -Wl from 10225*6a54128fSAndroid Build Coastguard Worker # whole_archive_flag_spec and hope we can get by with turning comma 10226*6a54128fSAndroid Build Coastguard Worker # into space. 10227*6a54128fSAndroid Build Coastguard Worker case $reload_cmds in 10228*6a54128fSAndroid Build Coastguard Worker *\$LD[\ \$]*) wl= ;; 10229*6a54128fSAndroid Build Coastguard Worker esac 10230*6a54128fSAndroid Build Coastguard Worker if test -n "$convenience"; then 10231*6a54128fSAndroid Build Coastguard Worker if test -n "$whole_archive_flag_spec"; then 10232*6a54128fSAndroid Build Coastguard Worker eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 10233*6a54128fSAndroid Build Coastguard Worker test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 10234*6a54128fSAndroid Build Coastguard Worker reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags 10235*6a54128fSAndroid Build Coastguard Worker else 10236*6a54128fSAndroid Build Coastguard Worker gentop=$output_objdir/${obj}x 10237*6a54128fSAndroid Build Coastguard Worker func_append generated " $gentop" 10238*6a54128fSAndroid Build Coastguard Worker 10239*6a54128fSAndroid Build Coastguard Worker func_extract_archives $gentop $convenience 10240*6a54128fSAndroid Build Coastguard Worker reload_conv_objs="$reload_objs $func_extract_archives_result" 10241*6a54128fSAndroid Build Coastguard Worker fi 10242*6a54128fSAndroid Build Coastguard Worker fi 10243*6a54128fSAndroid Build Coastguard Worker 10244*6a54128fSAndroid Build Coastguard Worker # If we're not building shared, we need to use non_pic_objs 10245*6a54128fSAndroid Build Coastguard Worker test yes = "$build_libtool_libs" || libobjs=$non_pic_objects 10246*6a54128fSAndroid Build Coastguard Worker 10247*6a54128fSAndroid Build Coastguard Worker # Create the old-style object. 10248*6a54128fSAndroid Build Coastguard Worker reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs 10249*6a54128fSAndroid Build Coastguard Worker 10250*6a54128fSAndroid Build Coastguard Worker output=$obj 10251*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$reload_cmds" 'exit $?' 10252*6a54128fSAndroid Build Coastguard Worker 10253*6a54128fSAndroid Build Coastguard Worker # Exit if we aren't doing a library object file. 10254*6a54128fSAndroid Build Coastguard Worker if test -z "$libobj"; then 10255*6a54128fSAndroid Build Coastguard Worker if test -n "$gentop"; then 10256*6a54128fSAndroid Build Coastguard Worker func_show_eval '${RM}r "$gentop"' 10257*6a54128fSAndroid Build Coastguard Worker fi 10258*6a54128fSAndroid Build Coastguard Worker 10259*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 10260*6a54128fSAndroid Build Coastguard Worker fi 10261*6a54128fSAndroid Build Coastguard Worker 10262*6a54128fSAndroid Build Coastguard Worker test yes = "$build_libtool_libs" || { 10263*6a54128fSAndroid Build Coastguard Worker if test -n "$gentop"; then 10264*6a54128fSAndroid Build Coastguard Worker func_show_eval '${RM}r "$gentop"' 10265*6a54128fSAndroid Build Coastguard Worker fi 10266*6a54128fSAndroid Build Coastguard Worker 10267*6a54128fSAndroid Build Coastguard Worker # Create an invalid libtool object if no PIC, so that we don't 10268*6a54128fSAndroid Build Coastguard Worker # accidentally link it into a program. 10269*6a54128fSAndroid Build Coastguard Worker # $show "echo timestamp > $libobj" 10270*6a54128fSAndroid Build Coastguard Worker # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? 10271*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 10272*6a54128fSAndroid Build Coastguard Worker } 10273*6a54128fSAndroid Build Coastguard Worker 10274*6a54128fSAndroid Build Coastguard Worker if test -n "$pic_flag" || test default != "$pic_mode"; then 10275*6a54128fSAndroid Build Coastguard Worker # Only do commands if we really have different PIC objects. 10276*6a54128fSAndroid Build Coastguard Worker reload_objs="$libobjs $reload_conv_objs" 10277*6a54128fSAndroid Build Coastguard Worker output=$libobj 10278*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$reload_cmds" 'exit $?' 10279*6a54128fSAndroid Build Coastguard Worker fi 10280*6a54128fSAndroid Build Coastguard Worker 10281*6a54128fSAndroid Build Coastguard Worker if test -n "$gentop"; then 10282*6a54128fSAndroid Build Coastguard Worker func_show_eval '${RM}r "$gentop"' 10283*6a54128fSAndroid Build Coastguard Worker fi 10284*6a54128fSAndroid Build Coastguard Worker 10285*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 10286*6a54128fSAndroid Build Coastguard Worker ;; 10287*6a54128fSAndroid Build Coastguard Worker 10288*6a54128fSAndroid Build Coastguard Worker prog) 10289*6a54128fSAndroid Build Coastguard Worker case $host in 10290*6a54128fSAndroid Build Coastguard Worker *cygwin*) func_stripname '' '.exe' "$output" 10291*6a54128fSAndroid Build Coastguard Worker output=$func_stripname_result.exe;; 10292*6a54128fSAndroid Build Coastguard Worker esac 10293*6a54128fSAndroid Build Coastguard Worker test -n "$vinfo" && \ 10294*6a54128fSAndroid Build Coastguard Worker func_warning "'-version-info' is ignored for programs" 10295*6a54128fSAndroid Build Coastguard Worker 10296*6a54128fSAndroid Build Coastguard Worker test -n "$release" && \ 10297*6a54128fSAndroid Build Coastguard Worker func_warning "'-release' is ignored for programs" 10298*6a54128fSAndroid Build Coastguard Worker 10299*6a54128fSAndroid Build Coastguard Worker $preload \ 10300*6a54128fSAndroid Build Coastguard Worker && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ 10301*6a54128fSAndroid Build Coastguard Worker && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." 10302*6a54128fSAndroid Build Coastguard Worker 10303*6a54128fSAndroid Build Coastguard Worker case $host in 10304*6a54128fSAndroid Build Coastguard Worker *-*-rhapsody* | *-*-darwin1.[012]) 10305*6a54128fSAndroid Build Coastguard Worker # On Rhapsody replace the C library is the System framework 10306*6a54128fSAndroid Build Coastguard Worker compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` 10307*6a54128fSAndroid Build Coastguard Worker finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` 10308*6a54128fSAndroid Build Coastguard Worker ;; 10309*6a54128fSAndroid Build Coastguard Worker esac 10310*6a54128fSAndroid Build Coastguard Worker 10311*6a54128fSAndroid Build Coastguard Worker case $host in 10312*6a54128fSAndroid Build Coastguard Worker *-*-darwin*) 10313*6a54128fSAndroid Build Coastguard Worker # Don't allow lazy linking, it breaks C++ global constructors 10314*6a54128fSAndroid Build Coastguard Worker # But is supposedly fixed on 10.4 or later (yay!). 10315*6a54128fSAndroid Build Coastguard Worker if test CXX = "$tagname"; then 10316*6a54128fSAndroid Build Coastguard Worker case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10317*6a54128fSAndroid Build Coastguard Worker 10.[0123]) 10318*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $wl-bind_at_load" 10319*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $wl-bind_at_load" 10320*6a54128fSAndroid Build Coastguard Worker ;; 10321*6a54128fSAndroid Build Coastguard Worker esac 10322*6a54128fSAndroid Build Coastguard Worker fi 10323*6a54128fSAndroid Build Coastguard Worker # Time to change all our "foo.ltframework" stuff back to "-framework foo" 10324*6a54128fSAndroid Build Coastguard Worker compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 10325*6a54128fSAndroid Build Coastguard Worker finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` 10326*6a54128fSAndroid Build Coastguard Worker ;; 10327*6a54128fSAndroid Build Coastguard Worker esac 10328*6a54128fSAndroid Build Coastguard Worker 10329*6a54128fSAndroid Build Coastguard Worker 10330*6a54128fSAndroid Build Coastguard Worker # move library search paths that coincide with paths to not yet 10331*6a54128fSAndroid Build Coastguard Worker # installed libraries to the beginning of the library search list 10332*6a54128fSAndroid Build Coastguard Worker new_libs= 10333*6a54128fSAndroid Build Coastguard Worker for path in $notinst_path; do 10334*6a54128fSAndroid Build Coastguard Worker case " $new_libs " in 10335*6a54128fSAndroid Build Coastguard Worker *" -L$path/$objdir "*) ;; 10336*6a54128fSAndroid Build Coastguard Worker *) 10337*6a54128fSAndroid Build Coastguard Worker case " $compile_deplibs " in 10338*6a54128fSAndroid Build Coastguard Worker *" -L$path/$objdir "*) 10339*6a54128fSAndroid Build Coastguard Worker func_append new_libs " -L$path/$objdir" ;; 10340*6a54128fSAndroid Build Coastguard Worker esac 10341*6a54128fSAndroid Build Coastguard Worker ;; 10342*6a54128fSAndroid Build Coastguard Worker esac 10343*6a54128fSAndroid Build Coastguard Worker done 10344*6a54128fSAndroid Build Coastguard Worker for deplib in $compile_deplibs; do 10345*6a54128fSAndroid Build Coastguard Worker case $deplib in 10346*6a54128fSAndroid Build Coastguard Worker -L*) 10347*6a54128fSAndroid Build Coastguard Worker case " $new_libs " in 10348*6a54128fSAndroid Build Coastguard Worker *" $deplib "*) ;; 10349*6a54128fSAndroid Build Coastguard Worker *) func_append new_libs " $deplib" ;; 10350*6a54128fSAndroid Build Coastguard Worker esac 10351*6a54128fSAndroid Build Coastguard Worker ;; 10352*6a54128fSAndroid Build Coastguard Worker *) func_append new_libs " $deplib" ;; 10353*6a54128fSAndroid Build Coastguard Worker esac 10354*6a54128fSAndroid Build Coastguard Worker done 10355*6a54128fSAndroid Build Coastguard Worker compile_deplibs=$new_libs 10356*6a54128fSAndroid Build Coastguard Worker 10357*6a54128fSAndroid Build Coastguard Worker 10358*6a54128fSAndroid Build Coastguard Worker func_append compile_command " $compile_deplibs" 10359*6a54128fSAndroid Build Coastguard Worker func_append finalize_command " $finalize_deplibs" 10360*6a54128fSAndroid Build Coastguard Worker 10361*6a54128fSAndroid Build Coastguard Worker if test -n "$rpath$xrpath"; then 10362*6a54128fSAndroid Build Coastguard Worker # If the user specified any rpath flags, then add them. 10363*6a54128fSAndroid Build Coastguard Worker for libdir in $rpath $xrpath; do 10364*6a54128fSAndroid Build Coastguard Worker # This is the magic to use -rpath. 10365*6a54128fSAndroid Build Coastguard Worker case "$finalize_rpath " in 10366*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 10367*6a54128fSAndroid Build Coastguard Worker *) func_append finalize_rpath " $libdir" ;; 10368*6a54128fSAndroid Build Coastguard Worker esac 10369*6a54128fSAndroid Build Coastguard Worker done 10370*6a54128fSAndroid Build Coastguard Worker fi 10371*6a54128fSAndroid Build Coastguard Worker 10372*6a54128fSAndroid Build Coastguard Worker # Now hardcode the library paths 10373*6a54128fSAndroid Build Coastguard Worker rpath= 10374*6a54128fSAndroid Build Coastguard Worker hardcode_libdirs= 10375*6a54128fSAndroid Build Coastguard Worker for libdir in $compile_rpath $finalize_rpath; do 10376*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_flag_spec"; then 10377*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_separator"; then 10378*6a54128fSAndroid Build Coastguard Worker if test -z "$hardcode_libdirs"; then 10379*6a54128fSAndroid Build Coastguard Worker hardcode_libdirs=$libdir 10380*6a54128fSAndroid Build Coastguard Worker else 10381*6a54128fSAndroid Build Coastguard Worker # Just accumulate the unique libdirs. 10382*6a54128fSAndroid Build Coastguard Worker case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 10383*6a54128fSAndroid Build Coastguard Worker *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 10384*6a54128fSAndroid Build Coastguard Worker ;; 10385*6a54128fSAndroid Build Coastguard Worker *) 10386*6a54128fSAndroid Build Coastguard Worker func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 10387*6a54128fSAndroid Build Coastguard Worker ;; 10388*6a54128fSAndroid Build Coastguard Worker esac 10389*6a54128fSAndroid Build Coastguard Worker fi 10390*6a54128fSAndroid Build Coastguard Worker else 10391*6a54128fSAndroid Build Coastguard Worker eval flag=\"$hardcode_libdir_flag_spec\" 10392*6a54128fSAndroid Build Coastguard Worker func_append rpath " $flag" 10393*6a54128fSAndroid Build Coastguard Worker fi 10394*6a54128fSAndroid Build Coastguard Worker elif test -n "$runpath_var"; then 10395*6a54128fSAndroid Build Coastguard Worker case "$perm_rpath " in 10396*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 10397*6a54128fSAndroid Build Coastguard Worker *) func_append perm_rpath " $libdir" ;; 10398*6a54128fSAndroid Build Coastguard Worker esac 10399*6a54128fSAndroid Build Coastguard Worker fi 10400*6a54128fSAndroid Build Coastguard Worker case $host in 10401*6a54128fSAndroid Build Coastguard Worker *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) 10402*6a54128fSAndroid Build Coastguard Worker testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` 10403*6a54128fSAndroid Build Coastguard Worker case :$dllsearchpath: in 10404*6a54128fSAndroid Build Coastguard Worker *":$libdir:"*) ;; 10405*6a54128fSAndroid Build Coastguard Worker ::) dllsearchpath=$libdir;; 10406*6a54128fSAndroid Build Coastguard Worker *) func_append dllsearchpath ":$libdir";; 10407*6a54128fSAndroid Build Coastguard Worker esac 10408*6a54128fSAndroid Build Coastguard Worker case :$dllsearchpath: in 10409*6a54128fSAndroid Build Coastguard Worker *":$testbindir:"*) ;; 10410*6a54128fSAndroid Build Coastguard Worker ::) dllsearchpath=$testbindir;; 10411*6a54128fSAndroid Build Coastguard Worker *) func_append dllsearchpath ":$testbindir";; 10412*6a54128fSAndroid Build Coastguard Worker esac 10413*6a54128fSAndroid Build Coastguard Worker ;; 10414*6a54128fSAndroid Build Coastguard Worker esac 10415*6a54128fSAndroid Build Coastguard Worker done 10416*6a54128fSAndroid Build Coastguard Worker # Substitute the hardcoded libdirs into the rpath. 10417*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_separator" && 10418*6a54128fSAndroid Build Coastguard Worker test -n "$hardcode_libdirs"; then 10419*6a54128fSAndroid Build Coastguard Worker libdir=$hardcode_libdirs 10420*6a54128fSAndroid Build Coastguard Worker eval rpath=\" $hardcode_libdir_flag_spec\" 10421*6a54128fSAndroid Build Coastguard Worker fi 10422*6a54128fSAndroid Build Coastguard Worker compile_rpath=$rpath 10423*6a54128fSAndroid Build Coastguard Worker 10424*6a54128fSAndroid Build Coastguard Worker rpath= 10425*6a54128fSAndroid Build Coastguard Worker hardcode_libdirs= 10426*6a54128fSAndroid Build Coastguard Worker for libdir in $finalize_rpath; do 10427*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_flag_spec"; then 10428*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_separator"; then 10429*6a54128fSAndroid Build Coastguard Worker if test -z "$hardcode_libdirs"; then 10430*6a54128fSAndroid Build Coastguard Worker hardcode_libdirs=$libdir 10431*6a54128fSAndroid Build Coastguard Worker else 10432*6a54128fSAndroid Build Coastguard Worker # Just accumulate the unique libdirs. 10433*6a54128fSAndroid Build Coastguard Worker case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 10434*6a54128fSAndroid Build Coastguard Worker *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 10435*6a54128fSAndroid Build Coastguard Worker ;; 10436*6a54128fSAndroid Build Coastguard Worker *) 10437*6a54128fSAndroid Build Coastguard Worker func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" 10438*6a54128fSAndroid Build Coastguard Worker ;; 10439*6a54128fSAndroid Build Coastguard Worker esac 10440*6a54128fSAndroid Build Coastguard Worker fi 10441*6a54128fSAndroid Build Coastguard Worker else 10442*6a54128fSAndroid Build Coastguard Worker eval flag=\"$hardcode_libdir_flag_spec\" 10443*6a54128fSAndroid Build Coastguard Worker func_append rpath " $flag" 10444*6a54128fSAndroid Build Coastguard Worker fi 10445*6a54128fSAndroid Build Coastguard Worker elif test -n "$runpath_var"; then 10446*6a54128fSAndroid Build Coastguard Worker case "$finalize_perm_rpath " in 10447*6a54128fSAndroid Build Coastguard Worker *" $libdir "*) ;; 10448*6a54128fSAndroid Build Coastguard Worker *) func_append finalize_perm_rpath " $libdir" ;; 10449*6a54128fSAndroid Build Coastguard Worker esac 10450*6a54128fSAndroid Build Coastguard Worker fi 10451*6a54128fSAndroid Build Coastguard Worker done 10452*6a54128fSAndroid Build Coastguard Worker # Substitute the hardcoded libdirs into the rpath. 10453*6a54128fSAndroid Build Coastguard Worker if test -n "$hardcode_libdir_separator" && 10454*6a54128fSAndroid Build Coastguard Worker test -n "$hardcode_libdirs"; then 10455*6a54128fSAndroid Build Coastguard Worker libdir=$hardcode_libdirs 10456*6a54128fSAndroid Build Coastguard Worker eval rpath=\" $hardcode_libdir_flag_spec\" 10457*6a54128fSAndroid Build Coastguard Worker fi 10458*6a54128fSAndroid Build Coastguard Worker finalize_rpath=$rpath 10459*6a54128fSAndroid Build Coastguard Worker 10460*6a54128fSAndroid Build Coastguard Worker if test -n "$libobjs" && test yes = "$build_old_libs"; then 10461*6a54128fSAndroid Build Coastguard Worker # Transform all the library objects into standard objects. 10462*6a54128fSAndroid Build Coastguard Worker compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 10463*6a54128fSAndroid Build Coastguard Worker finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` 10464*6a54128fSAndroid Build Coastguard Worker fi 10465*6a54128fSAndroid Build Coastguard Worker 10466*6a54128fSAndroid Build Coastguard Worker func_generate_dlsyms "$outputname" "@PROGRAM@" false 10467*6a54128fSAndroid Build Coastguard Worker 10468*6a54128fSAndroid Build Coastguard Worker # template prelinking step 10469*6a54128fSAndroid Build Coastguard Worker if test -n "$prelink_cmds"; then 10470*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$prelink_cmds" 'exit $?' 10471*6a54128fSAndroid Build Coastguard Worker fi 10472*6a54128fSAndroid Build Coastguard Worker 10473*6a54128fSAndroid Build Coastguard Worker wrappers_required=: 10474*6a54128fSAndroid Build Coastguard Worker case $host in 10475*6a54128fSAndroid Build Coastguard Worker *cegcc* | *mingw32ce*) 10476*6a54128fSAndroid Build Coastguard Worker # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. 10477*6a54128fSAndroid Build Coastguard Worker wrappers_required=false 10478*6a54128fSAndroid Build Coastguard Worker ;; 10479*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw* ) 10480*6a54128fSAndroid Build Coastguard Worker test yes = "$build_libtool_libs" || wrappers_required=false 10481*6a54128fSAndroid Build Coastguard Worker ;; 10482*6a54128fSAndroid Build Coastguard Worker *) 10483*6a54128fSAndroid Build Coastguard Worker if test no = "$need_relink" || test yes != "$build_libtool_libs"; then 10484*6a54128fSAndroid Build Coastguard Worker wrappers_required=false 10485*6a54128fSAndroid Build Coastguard Worker fi 10486*6a54128fSAndroid Build Coastguard Worker ;; 10487*6a54128fSAndroid Build Coastguard Worker esac 10488*6a54128fSAndroid Build Coastguard Worker $wrappers_required || { 10489*6a54128fSAndroid Build Coastguard Worker # Replace the output file specification. 10490*6a54128fSAndroid Build Coastguard Worker compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 10491*6a54128fSAndroid Build Coastguard Worker link_command=$compile_command$compile_rpath 10492*6a54128fSAndroid Build Coastguard Worker 10493*6a54128fSAndroid Build Coastguard Worker # We have no uninstalled library dependencies, so finalize right now. 10494*6a54128fSAndroid Build Coastguard Worker exit_status=0 10495*6a54128fSAndroid Build Coastguard Worker func_show_eval "$link_command" 'exit_status=$?' 10496*6a54128fSAndroid Build Coastguard Worker 10497*6a54128fSAndroid Build Coastguard Worker if test -n "$postlink_cmds"; then 10498*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$output" 10499*6a54128fSAndroid Build Coastguard Worker postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 10500*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$postlink_cmds" 'exit $?' 10501*6a54128fSAndroid Build Coastguard Worker fi 10502*6a54128fSAndroid Build Coastguard Worker 10503*6a54128fSAndroid Build Coastguard Worker # Delete the generated files. 10504*6a54128fSAndroid Build Coastguard Worker if test -f "$output_objdir/${outputname}S.$objext"; then 10505*6a54128fSAndroid Build Coastguard Worker func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' 10506*6a54128fSAndroid Build Coastguard Worker fi 10507*6a54128fSAndroid Build Coastguard Worker 10508*6a54128fSAndroid Build Coastguard Worker exit $exit_status 10509*6a54128fSAndroid Build Coastguard Worker } 10510*6a54128fSAndroid Build Coastguard Worker 10511*6a54128fSAndroid Build Coastguard Worker if test -n "$compile_shlibpath$finalize_shlibpath"; then 10512*6a54128fSAndroid Build Coastguard Worker compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 10513*6a54128fSAndroid Build Coastguard Worker fi 10514*6a54128fSAndroid Build Coastguard Worker if test -n "$finalize_shlibpath"; then 10515*6a54128fSAndroid Build Coastguard Worker finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 10516*6a54128fSAndroid Build Coastguard Worker fi 10517*6a54128fSAndroid Build Coastguard Worker 10518*6a54128fSAndroid Build Coastguard Worker compile_var= 10519*6a54128fSAndroid Build Coastguard Worker finalize_var= 10520*6a54128fSAndroid Build Coastguard Worker if test -n "$runpath_var"; then 10521*6a54128fSAndroid Build Coastguard Worker if test -n "$perm_rpath"; then 10522*6a54128fSAndroid Build Coastguard Worker # We should set the runpath_var. 10523*6a54128fSAndroid Build Coastguard Worker rpath= 10524*6a54128fSAndroid Build Coastguard Worker for dir in $perm_rpath; do 10525*6a54128fSAndroid Build Coastguard Worker func_append rpath "$dir:" 10526*6a54128fSAndroid Build Coastguard Worker done 10527*6a54128fSAndroid Build Coastguard Worker compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 10528*6a54128fSAndroid Build Coastguard Worker fi 10529*6a54128fSAndroid Build Coastguard Worker if test -n "$finalize_perm_rpath"; then 10530*6a54128fSAndroid Build Coastguard Worker # We should set the runpath_var. 10531*6a54128fSAndroid Build Coastguard Worker rpath= 10532*6a54128fSAndroid Build Coastguard Worker for dir in $finalize_perm_rpath; do 10533*6a54128fSAndroid Build Coastguard Worker func_append rpath "$dir:" 10534*6a54128fSAndroid Build Coastguard Worker done 10535*6a54128fSAndroid Build Coastguard Worker finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 10536*6a54128fSAndroid Build Coastguard Worker fi 10537*6a54128fSAndroid Build Coastguard Worker fi 10538*6a54128fSAndroid Build Coastguard Worker 10539*6a54128fSAndroid Build Coastguard Worker if test yes = "$no_install"; then 10540*6a54128fSAndroid Build Coastguard Worker # We don't need to create a wrapper script. 10541*6a54128fSAndroid Build Coastguard Worker link_command=$compile_var$compile_command$compile_rpath 10542*6a54128fSAndroid Build Coastguard Worker # Replace the output file specification. 10543*6a54128fSAndroid Build Coastguard Worker link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` 10544*6a54128fSAndroid Build Coastguard Worker # Delete the old output file. 10545*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM $output 10546*6a54128fSAndroid Build Coastguard Worker # Link the executable and exit 10547*6a54128fSAndroid Build Coastguard Worker func_show_eval "$link_command" 'exit $?' 10548*6a54128fSAndroid Build Coastguard Worker 10549*6a54128fSAndroid Build Coastguard Worker if test -n "$postlink_cmds"; then 10550*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$output" 10551*6a54128fSAndroid Build Coastguard Worker postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` 10552*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$postlink_cmds" 'exit $?' 10553*6a54128fSAndroid Build Coastguard Worker fi 10554*6a54128fSAndroid Build Coastguard Worker 10555*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 10556*6a54128fSAndroid Build Coastguard Worker fi 10557*6a54128fSAndroid Build Coastguard Worker 10558*6a54128fSAndroid Build Coastguard Worker case $hardcode_action,$fast_install in 10559*6a54128fSAndroid Build Coastguard Worker relink,*) 10560*6a54128fSAndroid Build Coastguard Worker # Fast installation is not supported 10561*6a54128fSAndroid Build Coastguard Worker link_command=$compile_var$compile_command$compile_rpath 10562*6a54128fSAndroid Build Coastguard Worker relink_command=$finalize_var$finalize_command$finalize_rpath 10563*6a54128fSAndroid Build Coastguard Worker 10564*6a54128fSAndroid Build Coastguard Worker func_warning "this platform does not like uninstalled shared libraries" 10565*6a54128fSAndroid Build Coastguard Worker func_warning "'$output' will be relinked during installation" 10566*6a54128fSAndroid Build Coastguard Worker ;; 10567*6a54128fSAndroid Build Coastguard Worker *,yes) 10568*6a54128fSAndroid Build Coastguard Worker link_command=$finalize_var$compile_command$finalize_rpath 10569*6a54128fSAndroid Build Coastguard Worker relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` 10570*6a54128fSAndroid Build Coastguard Worker ;; 10571*6a54128fSAndroid Build Coastguard Worker *,no) 10572*6a54128fSAndroid Build Coastguard Worker link_command=$compile_var$compile_command$compile_rpath 10573*6a54128fSAndroid Build Coastguard Worker relink_command=$finalize_var$finalize_command$finalize_rpath 10574*6a54128fSAndroid Build Coastguard Worker ;; 10575*6a54128fSAndroid Build Coastguard Worker *,needless) 10576*6a54128fSAndroid Build Coastguard Worker link_command=$finalize_var$compile_command$finalize_rpath 10577*6a54128fSAndroid Build Coastguard Worker relink_command= 10578*6a54128fSAndroid Build Coastguard Worker ;; 10579*6a54128fSAndroid Build Coastguard Worker esac 10580*6a54128fSAndroid Build Coastguard Worker 10581*6a54128fSAndroid Build Coastguard Worker # Replace the output file specification. 10582*6a54128fSAndroid Build Coastguard Worker link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 10583*6a54128fSAndroid Build Coastguard Worker 10584*6a54128fSAndroid Build Coastguard Worker # Delete the old output files. 10585*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname 10586*6a54128fSAndroid Build Coastguard Worker 10587*6a54128fSAndroid Build Coastguard Worker func_show_eval "$link_command" 'exit $?' 10588*6a54128fSAndroid Build Coastguard Worker 10589*6a54128fSAndroid Build Coastguard Worker if test -n "$postlink_cmds"; then 10590*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$output_objdir/$outputname" 10591*6a54128fSAndroid Build Coastguard Worker 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'` 10592*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$postlink_cmds" 'exit $?' 10593*6a54128fSAndroid Build Coastguard Worker fi 10594*6a54128fSAndroid Build Coastguard Worker 10595*6a54128fSAndroid Build Coastguard Worker # Now create the wrapper script. 10596*6a54128fSAndroid Build Coastguard Worker func_verbose "creating $output" 10597*6a54128fSAndroid Build Coastguard Worker 10598*6a54128fSAndroid Build Coastguard Worker # Quote the relink command for shipping. 10599*6a54128fSAndroid Build Coastguard Worker if test -n "$relink_command"; then 10600*6a54128fSAndroid Build Coastguard Worker # Preserve any variables that may affect compiler behavior 10601*6a54128fSAndroid Build Coastguard Worker for var in $variables_saved_for_relink; do 10602*6a54128fSAndroid Build Coastguard Worker if eval test -z \"\${$var+set}\"; then 10603*6a54128fSAndroid Build Coastguard Worker relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 10604*6a54128fSAndroid Build Coastguard Worker elif eval var_value=\$$var; test -z "$var_value"; then 10605*6a54128fSAndroid Build Coastguard Worker relink_command="$var=; export $var; $relink_command" 10606*6a54128fSAndroid Build Coastguard Worker else 10607*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$var_value" 10608*6a54128fSAndroid Build Coastguard Worker relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 10609*6a54128fSAndroid Build Coastguard Worker fi 10610*6a54128fSAndroid Build Coastguard Worker done 10611*6a54128fSAndroid Build Coastguard Worker relink_command="(cd `pwd`; $relink_command)" 10612*6a54128fSAndroid Build Coastguard Worker relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 10613*6a54128fSAndroid Build Coastguard Worker fi 10614*6a54128fSAndroid Build Coastguard Worker 10615*6a54128fSAndroid Build Coastguard Worker # Only actually do things if not in dry run mode. 10616*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 10617*6a54128fSAndroid Build Coastguard Worker # win32 will think the script is a binary if it has 10618*6a54128fSAndroid Build Coastguard Worker # a .exe suffix, so we strip it off here. 10619*6a54128fSAndroid Build Coastguard Worker case $output in 10620*6a54128fSAndroid Build Coastguard Worker *.exe) func_stripname '' '.exe' "$output" 10621*6a54128fSAndroid Build Coastguard Worker output=$func_stripname_result ;; 10622*6a54128fSAndroid Build Coastguard Worker esac 10623*6a54128fSAndroid Build Coastguard Worker # test for cygwin because mv fails w/o .exe extensions 10624*6a54128fSAndroid Build Coastguard Worker case $host in 10625*6a54128fSAndroid Build Coastguard Worker *cygwin*) 10626*6a54128fSAndroid Build Coastguard Worker exeext=.exe 10627*6a54128fSAndroid Build Coastguard Worker func_stripname '' '.exe' "$outputname" 10628*6a54128fSAndroid Build Coastguard Worker outputname=$func_stripname_result ;; 10629*6a54128fSAndroid Build Coastguard Worker *) exeext= ;; 10630*6a54128fSAndroid Build Coastguard Worker esac 10631*6a54128fSAndroid Build Coastguard Worker case $host in 10632*6a54128fSAndroid Build Coastguard Worker *cygwin* | *mingw* ) 10633*6a54128fSAndroid Build Coastguard Worker func_dirname_and_basename "$output" "" "." 10634*6a54128fSAndroid Build Coastguard Worker output_name=$func_basename_result 10635*6a54128fSAndroid Build Coastguard Worker output_path=$func_dirname_result 10636*6a54128fSAndroid Build Coastguard Worker cwrappersource=$output_path/$objdir/lt-$output_name.c 10637*6a54128fSAndroid Build Coastguard Worker cwrapper=$output_path/$output_name.exe 10638*6a54128fSAndroid Build Coastguard Worker $RM $cwrappersource $cwrapper 10639*6a54128fSAndroid Build Coastguard Worker trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 10640*6a54128fSAndroid Build Coastguard Worker 10641*6a54128fSAndroid Build Coastguard Worker func_emit_cwrapperexe_src > $cwrappersource 10642*6a54128fSAndroid Build Coastguard Worker 10643*6a54128fSAndroid Build Coastguard Worker # The wrapper executable is built using the $host compiler, 10644*6a54128fSAndroid Build Coastguard Worker # because it contains $host paths and files. If cross- 10645*6a54128fSAndroid Build Coastguard Worker # compiling, it, like the target executable, must be 10646*6a54128fSAndroid Build Coastguard Worker # executed on the $host or under an emulation environment. 10647*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 10648*6a54128fSAndroid Build Coastguard Worker $LTCC $LTCFLAGS -o $cwrapper $cwrappersource 10649*6a54128fSAndroid Build Coastguard Worker $STRIP $cwrapper 10650*6a54128fSAndroid Build Coastguard Worker } 10651*6a54128fSAndroid Build Coastguard Worker 10652*6a54128fSAndroid Build Coastguard Worker # Now, create the wrapper script for func_source use: 10653*6a54128fSAndroid Build Coastguard Worker func_ltwrapper_scriptname $cwrapper 10654*6a54128fSAndroid Build Coastguard Worker $RM $func_ltwrapper_scriptname_result 10655*6a54128fSAndroid Build Coastguard Worker trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 10656*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 10657*6a54128fSAndroid Build Coastguard Worker # note: this script will not be executed, so do not chmod. 10658*6a54128fSAndroid Build Coastguard Worker if test "x$build" = "x$host"; then 10659*6a54128fSAndroid Build Coastguard Worker $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result 10660*6a54128fSAndroid Build Coastguard Worker else 10661*6a54128fSAndroid Build Coastguard Worker func_emit_wrapper no > $func_ltwrapper_scriptname_result 10662*6a54128fSAndroid Build Coastguard Worker fi 10663*6a54128fSAndroid Build Coastguard Worker } 10664*6a54128fSAndroid Build Coastguard Worker ;; 10665*6a54128fSAndroid Build Coastguard Worker * ) 10666*6a54128fSAndroid Build Coastguard Worker $RM $output 10667*6a54128fSAndroid Build Coastguard Worker trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 10668*6a54128fSAndroid Build Coastguard Worker 10669*6a54128fSAndroid Build Coastguard Worker func_emit_wrapper no > $output 10670*6a54128fSAndroid Build Coastguard Worker chmod +x $output 10671*6a54128fSAndroid Build Coastguard Worker ;; 10672*6a54128fSAndroid Build Coastguard Worker esac 10673*6a54128fSAndroid Build Coastguard Worker } 10674*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 10675*6a54128fSAndroid Build Coastguard Worker ;; 10676*6a54128fSAndroid Build Coastguard Worker esac 10677*6a54128fSAndroid Build Coastguard Worker 10678*6a54128fSAndroid Build Coastguard Worker # See if we need to build an old-fashioned archive. 10679*6a54128fSAndroid Build Coastguard Worker for oldlib in $oldlibs; do 10680*6a54128fSAndroid Build Coastguard Worker 10681*6a54128fSAndroid Build Coastguard Worker case $build_libtool_libs in 10682*6a54128fSAndroid Build Coastguard Worker convenience) 10683*6a54128fSAndroid Build Coastguard Worker oldobjs="$libobjs_save $symfileobj" 10684*6a54128fSAndroid Build Coastguard Worker addlibs=$convenience 10685*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=no 10686*6a54128fSAndroid Build Coastguard Worker ;; 10687*6a54128fSAndroid Build Coastguard Worker module) 10688*6a54128fSAndroid Build Coastguard Worker oldobjs=$libobjs_save 10689*6a54128fSAndroid Build Coastguard Worker addlibs=$old_convenience 10690*6a54128fSAndroid Build Coastguard Worker build_libtool_libs=no 10691*6a54128fSAndroid Build Coastguard Worker ;; 10692*6a54128fSAndroid Build Coastguard Worker *) 10693*6a54128fSAndroid Build Coastguard Worker oldobjs="$old_deplibs $non_pic_objects" 10694*6a54128fSAndroid Build Coastguard Worker $preload && test -f "$symfileobj" \ 10695*6a54128fSAndroid Build Coastguard Worker && func_append oldobjs " $symfileobj" 10696*6a54128fSAndroid Build Coastguard Worker addlibs=$old_convenience 10697*6a54128fSAndroid Build Coastguard Worker ;; 10698*6a54128fSAndroid Build Coastguard Worker esac 10699*6a54128fSAndroid Build Coastguard Worker 10700*6a54128fSAndroid Build Coastguard Worker if test -n "$addlibs"; then 10701*6a54128fSAndroid Build Coastguard Worker gentop=$output_objdir/${outputname}x 10702*6a54128fSAndroid Build Coastguard Worker func_append generated " $gentop" 10703*6a54128fSAndroid Build Coastguard Worker 10704*6a54128fSAndroid Build Coastguard Worker func_extract_archives $gentop $addlibs 10705*6a54128fSAndroid Build Coastguard Worker func_append oldobjs " $func_extract_archives_result" 10706*6a54128fSAndroid Build Coastguard Worker fi 10707*6a54128fSAndroid Build Coastguard Worker 10708*6a54128fSAndroid Build Coastguard Worker # Do each command in the archive commands. 10709*6a54128fSAndroid Build Coastguard Worker if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then 10710*6a54128fSAndroid Build Coastguard Worker cmds=$old_archive_from_new_cmds 10711*6a54128fSAndroid Build Coastguard Worker else 10712*6a54128fSAndroid Build Coastguard Worker 10713*6a54128fSAndroid Build Coastguard Worker # Add any objects from preloaded convenience libraries 10714*6a54128fSAndroid Build Coastguard Worker if test -n "$dlprefiles"; then 10715*6a54128fSAndroid Build Coastguard Worker gentop=$output_objdir/${outputname}x 10716*6a54128fSAndroid Build Coastguard Worker func_append generated " $gentop" 10717*6a54128fSAndroid Build Coastguard Worker 10718*6a54128fSAndroid Build Coastguard Worker func_extract_archives $gentop $dlprefiles 10719*6a54128fSAndroid Build Coastguard Worker func_append oldobjs " $func_extract_archives_result" 10720*6a54128fSAndroid Build Coastguard Worker fi 10721*6a54128fSAndroid Build Coastguard Worker 10722*6a54128fSAndroid Build Coastguard Worker # POSIX demands no paths to be encoded in archives. We have 10723*6a54128fSAndroid Build Coastguard Worker # to avoid creating archives with duplicate basenames if we 10724*6a54128fSAndroid Build Coastguard Worker # might have to extract them afterwards, e.g., when creating a 10725*6a54128fSAndroid Build Coastguard Worker # static archive out of a convenience library, or when linking 10726*6a54128fSAndroid Build Coastguard Worker # the entirety of a libtool archive into another (currently 10727*6a54128fSAndroid Build Coastguard Worker # not supported by libtool). 10728*6a54128fSAndroid Build Coastguard Worker if (for obj in $oldobjs 10729*6a54128fSAndroid Build Coastguard Worker do 10730*6a54128fSAndroid Build Coastguard Worker func_basename "$obj" 10731*6a54128fSAndroid Build Coastguard Worker $ECHO "$func_basename_result" 10732*6a54128fSAndroid Build Coastguard Worker done | sort | sort -uc >/dev/null 2>&1); then 10733*6a54128fSAndroid Build Coastguard Worker : 10734*6a54128fSAndroid Build Coastguard Worker else 10735*6a54128fSAndroid Build Coastguard Worker echo "copying selected object files to avoid basename conflicts..." 10736*6a54128fSAndroid Build Coastguard Worker gentop=$output_objdir/${outputname}x 10737*6a54128fSAndroid Build Coastguard Worker func_append generated " $gentop" 10738*6a54128fSAndroid Build Coastguard Worker func_mkdir_p "$gentop" 10739*6a54128fSAndroid Build Coastguard Worker save_oldobjs=$oldobjs 10740*6a54128fSAndroid Build Coastguard Worker oldobjs= 10741*6a54128fSAndroid Build Coastguard Worker counter=1 10742*6a54128fSAndroid Build Coastguard Worker for obj in $save_oldobjs 10743*6a54128fSAndroid Build Coastguard Worker do 10744*6a54128fSAndroid Build Coastguard Worker func_basename "$obj" 10745*6a54128fSAndroid Build Coastguard Worker objbase=$func_basename_result 10746*6a54128fSAndroid Build Coastguard Worker case " $oldobjs " in 10747*6a54128fSAndroid Build Coastguard Worker " ") oldobjs=$obj ;; 10748*6a54128fSAndroid Build Coastguard Worker *[\ /]"$objbase "*) 10749*6a54128fSAndroid Build Coastguard Worker while :; do 10750*6a54128fSAndroid Build Coastguard Worker # Make sure we don't pick an alternate name that also 10751*6a54128fSAndroid Build Coastguard Worker # overlaps. 10752*6a54128fSAndroid Build Coastguard Worker newobj=lt$counter-$objbase 10753*6a54128fSAndroid Build Coastguard Worker func_arith $counter + 1 10754*6a54128fSAndroid Build Coastguard Worker counter=$func_arith_result 10755*6a54128fSAndroid Build Coastguard Worker case " $oldobjs " in 10756*6a54128fSAndroid Build Coastguard Worker *[\ /]"$newobj "*) ;; 10757*6a54128fSAndroid Build Coastguard Worker *) if test ! -f "$gentop/$newobj"; then break; fi ;; 10758*6a54128fSAndroid Build Coastguard Worker esac 10759*6a54128fSAndroid Build Coastguard Worker done 10760*6a54128fSAndroid Build Coastguard Worker func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 10761*6a54128fSAndroid Build Coastguard Worker func_append oldobjs " $gentop/$newobj" 10762*6a54128fSAndroid Build Coastguard Worker ;; 10763*6a54128fSAndroid Build Coastguard Worker *) func_append oldobjs " $obj" ;; 10764*6a54128fSAndroid Build Coastguard Worker esac 10765*6a54128fSAndroid Build Coastguard Worker done 10766*6a54128fSAndroid Build Coastguard Worker fi 10767*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 10768*6a54128fSAndroid Build Coastguard Worker tool_oldlib=$func_to_tool_file_result 10769*6a54128fSAndroid Build Coastguard Worker eval cmds=\"$old_archive_cmds\" 10770*6a54128fSAndroid Build Coastguard Worker 10771*6a54128fSAndroid Build Coastguard Worker func_len " $cmds" 10772*6a54128fSAndroid Build Coastguard Worker len=$func_len_result 10773*6a54128fSAndroid Build Coastguard Worker if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then 10774*6a54128fSAndroid Build Coastguard Worker cmds=$old_archive_cmds 10775*6a54128fSAndroid Build Coastguard Worker elif test -n "$archiver_list_spec"; then 10776*6a54128fSAndroid Build Coastguard Worker func_verbose "using command file archive linking..." 10777*6a54128fSAndroid Build Coastguard Worker for obj in $oldobjs 10778*6a54128fSAndroid Build Coastguard Worker do 10779*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$obj" 10780*6a54128fSAndroid Build Coastguard Worker $ECHO "$func_to_tool_file_result" 10781*6a54128fSAndroid Build Coastguard Worker done > $output_objdir/$libname.libcmd 10782*6a54128fSAndroid Build Coastguard Worker func_to_tool_file "$output_objdir/$libname.libcmd" 10783*6a54128fSAndroid Build Coastguard Worker oldobjs=" $archiver_list_spec$func_to_tool_file_result" 10784*6a54128fSAndroid Build Coastguard Worker cmds=$old_archive_cmds 10785*6a54128fSAndroid Build Coastguard Worker else 10786*6a54128fSAndroid Build Coastguard Worker # the command line is too long to link in one step, link in parts 10787*6a54128fSAndroid Build Coastguard Worker func_verbose "using piecewise archive linking..." 10788*6a54128fSAndroid Build Coastguard Worker save_RANLIB=$RANLIB 10789*6a54128fSAndroid Build Coastguard Worker RANLIB=: 10790*6a54128fSAndroid Build Coastguard Worker objlist= 10791*6a54128fSAndroid Build Coastguard Worker concat_cmds= 10792*6a54128fSAndroid Build Coastguard Worker save_oldobjs=$oldobjs 10793*6a54128fSAndroid Build Coastguard Worker oldobjs= 10794*6a54128fSAndroid Build Coastguard Worker # Is there a better way of finding the last object in the list? 10795*6a54128fSAndroid Build Coastguard Worker for obj in $save_oldobjs 10796*6a54128fSAndroid Build Coastguard Worker do 10797*6a54128fSAndroid Build Coastguard Worker last_oldobj=$obj 10798*6a54128fSAndroid Build Coastguard Worker done 10799*6a54128fSAndroid Build Coastguard Worker eval test_cmds=\"$old_archive_cmds\" 10800*6a54128fSAndroid Build Coastguard Worker func_len " $test_cmds" 10801*6a54128fSAndroid Build Coastguard Worker len0=$func_len_result 10802*6a54128fSAndroid Build Coastguard Worker len=$len0 10803*6a54128fSAndroid Build Coastguard Worker for obj in $save_oldobjs 10804*6a54128fSAndroid Build Coastguard Worker do 10805*6a54128fSAndroid Build Coastguard Worker func_len " $obj" 10806*6a54128fSAndroid Build Coastguard Worker func_arith $len + $func_len_result 10807*6a54128fSAndroid Build Coastguard Worker len=$func_arith_result 10808*6a54128fSAndroid Build Coastguard Worker func_append objlist " $obj" 10809*6a54128fSAndroid Build Coastguard Worker if test "$len" -lt "$max_cmd_len"; then 10810*6a54128fSAndroid Build Coastguard Worker : 10811*6a54128fSAndroid Build Coastguard Worker else 10812*6a54128fSAndroid Build Coastguard Worker # the above command should be used before it gets too long 10813*6a54128fSAndroid Build Coastguard Worker oldobjs=$objlist 10814*6a54128fSAndroid Build Coastguard Worker if test "$obj" = "$last_oldobj"; then 10815*6a54128fSAndroid Build Coastguard Worker RANLIB=$save_RANLIB 10816*6a54128fSAndroid Build Coastguard Worker fi 10817*6a54128fSAndroid Build Coastguard Worker test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 10818*6a54128fSAndroid Build Coastguard Worker eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" 10819*6a54128fSAndroid Build Coastguard Worker objlist= 10820*6a54128fSAndroid Build Coastguard Worker len=$len0 10821*6a54128fSAndroid Build Coastguard Worker fi 10822*6a54128fSAndroid Build Coastguard Worker done 10823*6a54128fSAndroid Build Coastguard Worker RANLIB=$save_RANLIB 10824*6a54128fSAndroid Build Coastguard Worker oldobjs=$objlist 10825*6a54128fSAndroid Build Coastguard Worker if test -z "$oldobjs"; then 10826*6a54128fSAndroid Build Coastguard Worker eval cmds=\"\$concat_cmds\" 10827*6a54128fSAndroid Build Coastguard Worker else 10828*6a54128fSAndroid Build Coastguard Worker eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 10829*6a54128fSAndroid Build Coastguard Worker fi 10830*6a54128fSAndroid Build Coastguard Worker fi 10831*6a54128fSAndroid Build Coastguard Worker fi 10832*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$cmds" 'exit $?' 10833*6a54128fSAndroid Build Coastguard Worker done 10834*6a54128fSAndroid Build Coastguard Worker 10835*6a54128fSAndroid Build Coastguard Worker test -n "$generated" && \ 10836*6a54128fSAndroid Build Coastguard Worker func_show_eval "${RM}r$generated" 10837*6a54128fSAndroid Build Coastguard Worker 10838*6a54128fSAndroid Build Coastguard Worker # Now create the libtool archive. 10839*6a54128fSAndroid Build Coastguard Worker case $output in 10840*6a54128fSAndroid Build Coastguard Worker *.la) 10841*6a54128fSAndroid Build Coastguard Worker old_library= 10842*6a54128fSAndroid Build Coastguard Worker test yes = "$build_old_libs" && old_library=$libname.$libext 10843*6a54128fSAndroid Build Coastguard Worker func_verbose "creating $output" 10844*6a54128fSAndroid Build Coastguard Worker 10845*6a54128fSAndroid Build Coastguard Worker # Preserve any variables that may affect compiler behavior 10846*6a54128fSAndroid Build Coastguard Worker for var in $variables_saved_for_relink; do 10847*6a54128fSAndroid Build Coastguard Worker if eval test -z \"\${$var+set}\"; then 10848*6a54128fSAndroid Build Coastguard Worker relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" 10849*6a54128fSAndroid Build Coastguard Worker elif eval var_value=\$$var; test -z "$var_value"; then 10850*6a54128fSAndroid Build Coastguard Worker relink_command="$var=; export $var; $relink_command" 10851*6a54128fSAndroid Build Coastguard Worker else 10852*6a54128fSAndroid Build Coastguard Worker func_quote_for_eval "$var_value" 10853*6a54128fSAndroid Build Coastguard Worker relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" 10854*6a54128fSAndroid Build Coastguard Worker fi 10855*6a54128fSAndroid Build Coastguard Worker done 10856*6a54128fSAndroid Build Coastguard Worker # Quote the link command for shipping. 10857*6a54128fSAndroid Build Coastguard Worker relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 10858*6a54128fSAndroid Build Coastguard Worker relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` 10859*6a54128fSAndroid Build Coastguard Worker if test yes = "$hardcode_automatic"; then 10860*6a54128fSAndroid Build Coastguard Worker relink_command= 10861*6a54128fSAndroid Build Coastguard Worker fi 10862*6a54128fSAndroid Build Coastguard Worker 10863*6a54128fSAndroid Build Coastguard Worker # Only create the output if not a dry run. 10864*6a54128fSAndroid Build Coastguard Worker $opt_dry_run || { 10865*6a54128fSAndroid Build Coastguard Worker for installed in no yes; do 10866*6a54128fSAndroid Build Coastguard Worker if test yes = "$installed"; then 10867*6a54128fSAndroid Build Coastguard Worker if test -z "$install_libdir"; then 10868*6a54128fSAndroid Build Coastguard Worker break 10869*6a54128fSAndroid Build Coastguard Worker fi 10870*6a54128fSAndroid Build Coastguard Worker output=$output_objdir/${outputname}i 10871*6a54128fSAndroid Build Coastguard Worker # Replace all uninstalled libtool libraries with the installed ones 10872*6a54128fSAndroid Build Coastguard Worker newdependency_libs= 10873*6a54128fSAndroid Build Coastguard Worker for deplib in $dependency_libs; do 10874*6a54128fSAndroid Build Coastguard Worker case $deplib in 10875*6a54128fSAndroid Build Coastguard Worker *.la) 10876*6a54128fSAndroid Build Coastguard Worker func_basename "$deplib" 10877*6a54128fSAndroid Build Coastguard Worker name=$func_basename_result 10878*6a54128fSAndroid Build Coastguard Worker func_resolve_sysroot "$deplib" 10879*6a54128fSAndroid Build Coastguard Worker eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` 10880*6a54128fSAndroid Build Coastguard Worker test -z "$libdir" && \ 10881*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$deplib' is not a valid libtool archive" 10882*6a54128fSAndroid Build Coastguard Worker func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" 10883*6a54128fSAndroid Build Coastguard Worker ;; 10884*6a54128fSAndroid Build Coastguard Worker -L*) 10885*6a54128fSAndroid Build Coastguard Worker func_stripname -L '' "$deplib" 10886*6a54128fSAndroid Build Coastguard Worker func_replace_sysroot "$func_stripname_result" 10887*6a54128fSAndroid Build Coastguard Worker func_append newdependency_libs " -L$func_replace_sysroot_result" 10888*6a54128fSAndroid Build Coastguard Worker ;; 10889*6a54128fSAndroid Build Coastguard Worker -R*) 10890*6a54128fSAndroid Build Coastguard Worker func_stripname -R '' "$deplib" 10891*6a54128fSAndroid Build Coastguard Worker func_replace_sysroot "$func_stripname_result" 10892*6a54128fSAndroid Build Coastguard Worker func_append newdependency_libs " -R$func_replace_sysroot_result" 10893*6a54128fSAndroid Build Coastguard Worker ;; 10894*6a54128fSAndroid Build Coastguard Worker *) func_append newdependency_libs " $deplib" ;; 10895*6a54128fSAndroid Build Coastguard Worker esac 10896*6a54128fSAndroid Build Coastguard Worker done 10897*6a54128fSAndroid Build Coastguard Worker dependency_libs=$newdependency_libs 10898*6a54128fSAndroid Build Coastguard Worker newdlfiles= 10899*6a54128fSAndroid Build Coastguard Worker 10900*6a54128fSAndroid Build Coastguard Worker for lib in $dlfiles; do 10901*6a54128fSAndroid Build Coastguard Worker case $lib in 10902*6a54128fSAndroid Build Coastguard Worker *.la) 10903*6a54128fSAndroid Build Coastguard Worker func_basename "$lib" 10904*6a54128fSAndroid Build Coastguard Worker name=$func_basename_result 10905*6a54128fSAndroid Build Coastguard Worker eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 10906*6a54128fSAndroid Build Coastguard Worker test -z "$libdir" && \ 10907*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$lib' is not a valid libtool archive" 10908*6a54128fSAndroid Build Coastguard Worker func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" 10909*6a54128fSAndroid Build Coastguard Worker ;; 10910*6a54128fSAndroid Build Coastguard Worker *) func_append newdlfiles " $lib" ;; 10911*6a54128fSAndroid Build Coastguard Worker esac 10912*6a54128fSAndroid Build Coastguard Worker done 10913*6a54128fSAndroid Build Coastguard Worker dlfiles=$newdlfiles 10914*6a54128fSAndroid Build Coastguard Worker newdlprefiles= 10915*6a54128fSAndroid Build Coastguard Worker for lib in $dlprefiles; do 10916*6a54128fSAndroid Build Coastguard Worker case $lib in 10917*6a54128fSAndroid Build Coastguard Worker *.la) 10918*6a54128fSAndroid Build Coastguard Worker # Only pass preopened files to the pseudo-archive (for 10919*6a54128fSAndroid Build Coastguard Worker # eventual linking with the app. that links it) if we 10920*6a54128fSAndroid Build Coastguard Worker # didn't already link the preopened objects directly into 10921*6a54128fSAndroid Build Coastguard Worker # the library: 10922*6a54128fSAndroid Build Coastguard Worker func_basename "$lib" 10923*6a54128fSAndroid Build Coastguard Worker name=$func_basename_result 10924*6a54128fSAndroid Build Coastguard Worker eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 10925*6a54128fSAndroid Build Coastguard Worker test -z "$libdir" && \ 10926*6a54128fSAndroid Build Coastguard Worker func_fatal_error "'$lib' is not a valid libtool archive" 10927*6a54128fSAndroid Build Coastguard Worker func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" 10928*6a54128fSAndroid Build Coastguard Worker ;; 10929*6a54128fSAndroid Build Coastguard Worker esac 10930*6a54128fSAndroid Build Coastguard Worker done 10931*6a54128fSAndroid Build Coastguard Worker dlprefiles=$newdlprefiles 10932*6a54128fSAndroid Build Coastguard Worker else 10933*6a54128fSAndroid Build Coastguard Worker newdlfiles= 10934*6a54128fSAndroid Build Coastguard Worker for lib in $dlfiles; do 10935*6a54128fSAndroid Build Coastguard Worker case $lib in 10936*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; 10937*6a54128fSAndroid Build Coastguard Worker *) abs=`pwd`"/$lib" ;; 10938*6a54128fSAndroid Build Coastguard Worker esac 10939*6a54128fSAndroid Build Coastguard Worker func_append newdlfiles " $abs" 10940*6a54128fSAndroid Build Coastguard Worker done 10941*6a54128fSAndroid Build Coastguard Worker dlfiles=$newdlfiles 10942*6a54128fSAndroid Build Coastguard Worker newdlprefiles= 10943*6a54128fSAndroid Build Coastguard Worker for lib in $dlprefiles; do 10944*6a54128fSAndroid Build Coastguard Worker case $lib in 10945*6a54128fSAndroid Build Coastguard Worker [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; 10946*6a54128fSAndroid Build Coastguard Worker *) abs=`pwd`"/$lib" ;; 10947*6a54128fSAndroid Build Coastguard Worker esac 10948*6a54128fSAndroid Build Coastguard Worker func_append newdlprefiles " $abs" 10949*6a54128fSAndroid Build Coastguard Worker done 10950*6a54128fSAndroid Build Coastguard Worker dlprefiles=$newdlprefiles 10951*6a54128fSAndroid Build Coastguard Worker fi 10952*6a54128fSAndroid Build Coastguard Worker $RM $output 10953*6a54128fSAndroid Build Coastguard Worker # place dlname in correct position for cygwin 10954*6a54128fSAndroid Build Coastguard Worker # In fact, it would be nice if we could use this code for all target 10955*6a54128fSAndroid Build Coastguard Worker # systems that can't hard-code library paths into their executables 10956*6a54128fSAndroid Build Coastguard Worker # and that have no shared library path variable independent of PATH, 10957*6a54128fSAndroid Build Coastguard Worker # but it turns out we can't easily determine that from inspecting 10958*6a54128fSAndroid Build Coastguard Worker # libtool variables, so we have to hard-code the OSs to which it 10959*6a54128fSAndroid Build Coastguard Worker # applies here; at the moment, that means platforms that use the PE 10960*6a54128fSAndroid Build Coastguard Worker # object format with DLL files. See the long comment at the top of 10961*6a54128fSAndroid Build Coastguard Worker # tests/bindir.at for full details. 10962*6a54128fSAndroid Build Coastguard Worker tdlname=$dlname 10963*6a54128fSAndroid Build Coastguard Worker case $host,$output,$installed,$module,$dlname in 10964*6a54128fSAndroid Build Coastguard Worker *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) 10965*6a54128fSAndroid Build Coastguard Worker # If a -bindir argument was supplied, place the dll there. 10966*6a54128fSAndroid Build Coastguard Worker if test -n "$bindir"; then 10967*6a54128fSAndroid Build Coastguard Worker func_relative_path "$install_libdir" "$bindir" 10968*6a54128fSAndroid Build Coastguard Worker tdlname=$func_relative_path_result/$dlname 10969*6a54128fSAndroid Build Coastguard Worker else 10970*6a54128fSAndroid Build Coastguard Worker # Otherwise fall back on heuristic. 10971*6a54128fSAndroid Build Coastguard Worker tdlname=../bin/$dlname 10972*6a54128fSAndroid Build Coastguard Worker fi 10973*6a54128fSAndroid Build Coastguard Worker ;; 10974*6a54128fSAndroid Build Coastguard Worker esac 10975*6a54128fSAndroid Build Coastguard Worker $ECHO > $output "\ 10976*6a54128fSAndroid Build Coastguard Worker# $outputname - a libtool library file 10977*6a54128fSAndroid Build Coastguard Worker# Generated by $PROGRAM (GNU $PACKAGE) $VERSION 10978*6a54128fSAndroid Build Coastguard Worker# 10979*6a54128fSAndroid Build Coastguard Worker# Please DO NOT delete this file! 10980*6a54128fSAndroid Build Coastguard Worker# It is necessary for linking the library. 10981*6a54128fSAndroid Build Coastguard Worker 10982*6a54128fSAndroid Build Coastguard Worker# The name that we can dlopen(3). 10983*6a54128fSAndroid Build Coastguard Workerdlname='$tdlname' 10984*6a54128fSAndroid Build Coastguard Worker 10985*6a54128fSAndroid Build Coastguard Worker# Names of this library. 10986*6a54128fSAndroid Build Coastguard Workerlibrary_names='$library_names' 10987*6a54128fSAndroid Build Coastguard Worker 10988*6a54128fSAndroid Build Coastguard Worker# The name of the static archive. 10989*6a54128fSAndroid Build Coastguard Workerold_library='$old_library' 10990*6a54128fSAndroid Build Coastguard Worker 10991*6a54128fSAndroid Build Coastguard Worker# Linker flags that cannot go in dependency_libs. 10992*6a54128fSAndroid Build Coastguard Workerinherited_linker_flags='$new_inherited_linker_flags' 10993*6a54128fSAndroid Build Coastguard Worker 10994*6a54128fSAndroid Build Coastguard Worker# Libraries that this one depends upon. 10995*6a54128fSAndroid Build Coastguard Workerdependency_libs='$dependency_libs' 10996*6a54128fSAndroid Build Coastguard Worker 10997*6a54128fSAndroid Build Coastguard Worker# Names of additional weak libraries provided by this library 10998*6a54128fSAndroid Build Coastguard Workerweak_library_names='$weak_libs' 10999*6a54128fSAndroid Build Coastguard Worker 11000*6a54128fSAndroid Build Coastguard Worker# Version information for $libname. 11001*6a54128fSAndroid Build Coastguard Workercurrent=$current 11002*6a54128fSAndroid Build Coastguard Workerage=$age 11003*6a54128fSAndroid Build Coastguard Workerrevision=$revision 11004*6a54128fSAndroid Build Coastguard Worker 11005*6a54128fSAndroid Build Coastguard Worker# Is this an already installed library? 11006*6a54128fSAndroid Build Coastguard Workerinstalled=$installed 11007*6a54128fSAndroid Build Coastguard Worker 11008*6a54128fSAndroid Build Coastguard Worker# Should we warn about portability when linking against -modules? 11009*6a54128fSAndroid Build Coastguard Workershouldnotlink=$module 11010*6a54128fSAndroid Build Coastguard Worker 11011*6a54128fSAndroid Build Coastguard Worker# Files to dlopen/dlpreopen 11012*6a54128fSAndroid Build Coastguard Workerdlopen='$dlfiles' 11013*6a54128fSAndroid Build Coastguard Workerdlpreopen='$dlprefiles' 11014*6a54128fSAndroid Build Coastguard Worker 11015*6a54128fSAndroid Build Coastguard Worker# Directory that this library needs to be installed in: 11016*6a54128fSAndroid Build Coastguard Workerlibdir='$install_libdir'" 11017*6a54128fSAndroid Build Coastguard Worker if test no,yes = "$installed,$need_relink"; then 11018*6a54128fSAndroid Build Coastguard Worker $ECHO >> $output "\ 11019*6a54128fSAndroid Build Coastguard Workerrelink_command=\"$relink_command\"" 11020*6a54128fSAndroid Build Coastguard Worker fi 11021*6a54128fSAndroid Build Coastguard Worker done 11022*6a54128fSAndroid Build Coastguard Worker } 11023*6a54128fSAndroid Build Coastguard Worker 11024*6a54128fSAndroid Build Coastguard Worker # Do a symbolic link so that the libtool archive can be found in 11025*6a54128fSAndroid Build Coastguard Worker # LD_LIBRARY_PATH before the program is installed. 11026*6a54128fSAndroid Build Coastguard Worker func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' 11027*6a54128fSAndroid Build Coastguard Worker ;; 11028*6a54128fSAndroid Build Coastguard Worker esac 11029*6a54128fSAndroid Build Coastguard Worker exit $EXIT_SUCCESS 11030*6a54128fSAndroid Build Coastguard Worker} 11031*6a54128fSAndroid Build Coastguard Worker 11032*6a54128fSAndroid Build Coastguard Workerif test link = "$opt_mode" || test relink = "$opt_mode"; then 11033*6a54128fSAndroid Build Coastguard Worker func_mode_link ${1+"$@"} 11034*6a54128fSAndroid Build Coastguard Workerfi 11035*6a54128fSAndroid Build Coastguard Worker 11036*6a54128fSAndroid Build Coastguard Worker 11037*6a54128fSAndroid Build Coastguard Worker# func_mode_uninstall arg... 11038*6a54128fSAndroid Build Coastguard Workerfunc_mode_uninstall () 11039*6a54128fSAndroid Build Coastguard Worker{ 11040*6a54128fSAndroid Build Coastguard Worker $debug_cmd 11041*6a54128fSAndroid Build Coastguard Worker 11042*6a54128fSAndroid Build Coastguard Worker RM=$nonopt 11043*6a54128fSAndroid Build Coastguard Worker files= 11044*6a54128fSAndroid Build Coastguard Worker rmforce=false 11045*6a54128fSAndroid Build Coastguard Worker exit_status=0 11046*6a54128fSAndroid Build Coastguard Worker 11047*6a54128fSAndroid Build Coastguard Worker # This variable tells wrapper scripts just to set variables rather 11048*6a54128fSAndroid Build Coastguard Worker # than running their programs. 11049*6a54128fSAndroid Build Coastguard Worker libtool_install_magic=$magic 11050*6a54128fSAndroid Build Coastguard Worker 11051*6a54128fSAndroid Build Coastguard Worker for arg 11052*6a54128fSAndroid Build Coastguard Worker do 11053*6a54128fSAndroid Build Coastguard Worker case $arg in 11054*6a54128fSAndroid Build Coastguard Worker -f) func_append RM " $arg"; rmforce=: ;; 11055*6a54128fSAndroid Build Coastguard Worker -*) func_append RM " $arg" ;; 11056*6a54128fSAndroid Build Coastguard Worker *) func_append files " $arg" ;; 11057*6a54128fSAndroid Build Coastguard Worker esac 11058*6a54128fSAndroid Build Coastguard Worker done 11059*6a54128fSAndroid Build Coastguard Worker 11060*6a54128fSAndroid Build Coastguard Worker test -z "$RM" && \ 11061*6a54128fSAndroid Build Coastguard Worker func_fatal_help "you must specify an RM program" 11062*6a54128fSAndroid Build Coastguard Worker 11063*6a54128fSAndroid Build Coastguard Worker rmdirs= 11064*6a54128fSAndroid Build Coastguard Worker 11065*6a54128fSAndroid Build Coastguard Worker for file in $files; do 11066*6a54128fSAndroid Build Coastguard Worker func_dirname "$file" "" "." 11067*6a54128fSAndroid Build Coastguard Worker dir=$func_dirname_result 11068*6a54128fSAndroid Build Coastguard Worker if test . = "$dir"; then 11069*6a54128fSAndroid Build Coastguard Worker odir=$objdir 11070*6a54128fSAndroid Build Coastguard Worker else 11071*6a54128fSAndroid Build Coastguard Worker odir=$dir/$objdir 11072*6a54128fSAndroid Build Coastguard Worker fi 11073*6a54128fSAndroid Build Coastguard Worker func_basename "$file" 11074*6a54128fSAndroid Build Coastguard Worker name=$func_basename_result 11075*6a54128fSAndroid Build Coastguard Worker test uninstall = "$opt_mode" && odir=$dir 11076*6a54128fSAndroid Build Coastguard Worker 11077*6a54128fSAndroid Build Coastguard Worker # Remember odir for removal later, being careful to avoid duplicates 11078*6a54128fSAndroid Build Coastguard Worker if test clean = "$opt_mode"; then 11079*6a54128fSAndroid Build Coastguard Worker case " $rmdirs " in 11080*6a54128fSAndroid Build Coastguard Worker *" $odir "*) ;; 11081*6a54128fSAndroid Build Coastguard Worker *) func_append rmdirs " $odir" ;; 11082*6a54128fSAndroid Build Coastguard Worker esac 11083*6a54128fSAndroid Build Coastguard Worker fi 11084*6a54128fSAndroid Build Coastguard Worker 11085*6a54128fSAndroid Build Coastguard Worker # Don't error if the file doesn't exist and rm -f was used. 11086*6a54128fSAndroid Build Coastguard Worker if { test -L "$file"; } >/dev/null 2>&1 || 11087*6a54128fSAndroid Build Coastguard Worker { test -h "$file"; } >/dev/null 2>&1 || 11088*6a54128fSAndroid Build Coastguard Worker test -f "$file"; then 11089*6a54128fSAndroid Build Coastguard Worker : 11090*6a54128fSAndroid Build Coastguard Worker elif test -d "$file"; then 11091*6a54128fSAndroid Build Coastguard Worker exit_status=1 11092*6a54128fSAndroid Build Coastguard Worker continue 11093*6a54128fSAndroid Build Coastguard Worker elif $rmforce; then 11094*6a54128fSAndroid Build Coastguard Worker continue 11095*6a54128fSAndroid Build Coastguard Worker fi 11096*6a54128fSAndroid Build Coastguard Worker 11097*6a54128fSAndroid Build Coastguard Worker rmfiles=$file 11098*6a54128fSAndroid Build Coastguard Worker 11099*6a54128fSAndroid Build Coastguard Worker case $name in 11100*6a54128fSAndroid Build Coastguard Worker *.la) 11101*6a54128fSAndroid Build Coastguard Worker # Possibly a libtool archive, so verify it. 11102*6a54128fSAndroid Build Coastguard Worker if func_lalib_p "$file"; then 11103*6a54128fSAndroid Build Coastguard Worker func_source $dir/$name 11104*6a54128fSAndroid Build Coastguard Worker 11105*6a54128fSAndroid Build Coastguard Worker # Delete the libtool libraries and symlinks. 11106*6a54128fSAndroid Build Coastguard Worker for n in $library_names; do 11107*6a54128fSAndroid Build Coastguard Worker func_append rmfiles " $odir/$n" 11108*6a54128fSAndroid Build Coastguard Worker done 11109*6a54128fSAndroid Build Coastguard Worker test -n "$old_library" && func_append rmfiles " $odir/$old_library" 11110*6a54128fSAndroid Build Coastguard Worker 11111*6a54128fSAndroid Build Coastguard Worker case $opt_mode in 11112*6a54128fSAndroid Build Coastguard Worker clean) 11113*6a54128fSAndroid Build Coastguard Worker case " $library_names " in 11114*6a54128fSAndroid Build Coastguard Worker *" $dlname "*) ;; 11115*6a54128fSAndroid Build Coastguard Worker *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; 11116*6a54128fSAndroid Build Coastguard Worker esac 11117*6a54128fSAndroid Build Coastguard Worker test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" 11118*6a54128fSAndroid Build Coastguard Worker ;; 11119*6a54128fSAndroid Build Coastguard Worker uninstall) 11120*6a54128fSAndroid Build Coastguard Worker if test -n "$library_names"; then 11121*6a54128fSAndroid Build Coastguard Worker # Do each command in the postuninstall commands. 11122*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' 11123*6a54128fSAndroid Build Coastguard Worker fi 11124*6a54128fSAndroid Build Coastguard Worker 11125*6a54128fSAndroid Build Coastguard Worker if test -n "$old_library"; then 11126*6a54128fSAndroid Build Coastguard Worker # Do each command in the old_postuninstall commands. 11127*6a54128fSAndroid Build Coastguard Worker func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' 11128*6a54128fSAndroid Build Coastguard Worker fi 11129*6a54128fSAndroid Build Coastguard Worker # FIXME: should reinstall the best remaining shared library. 11130*6a54128fSAndroid Build Coastguard Worker ;; 11131*6a54128fSAndroid Build Coastguard Worker esac 11132*6a54128fSAndroid Build Coastguard Worker fi 11133*6a54128fSAndroid Build Coastguard Worker ;; 11134*6a54128fSAndroid Build Coastguard Worker 11135*6a54128fSAndroid Build Coastguard Worker *.lo) 11136*6a54128fSAndroid Build Coastguard Worker # Possibly a libtool object, so verify it. 11137*6a54128fSAndroid Build Coastguard Worker if func_lalib_p "$file"; then 11138*6a54128fSAndroid Build Coastguard Worker 11139*6a54128fSAndroid Build Coastguard Worker # Read the .lo file 11140*6a54128fSAndroid Build Coastguard Worker func_source $dir/$name 11141*6a54128fSAndroid Build Coastguard Worker 11142*6a54128fSAndroid Build Coastguard Worker # Add PIC object to the list of files to remove. 11143*6a54128fSAndroid Build Coastguard Worker if test -n "$pic_object" && test none != "$pic_object"; then 11144*6a54128fSAndroid Build Coastguard Worker func_append rmfiles " $dir/$pic_object" 11145*6a54128fSAndroid Build Coastguard Worker fi 11146*6a54128fSAndroid Build Coastguard Worker 11147*6a54128fSAndroid Build Coastguard Worker # Add non-PIC object to the list of files to remove. 11148*6a54128fSAndroid Build Coastguard Worker if test -n "$non_pic_object" && test none != "$non_pic_object"; then 11149*6a54128fSAndroid Build Coastguard Worker func_append rmfiles " $dir/$non_pic_object" 11150*6a54128fSAndroid Build Coastguard Worker fi 11151*6a54128fSAndroid Build Coastguard Worker fi 11152*6a54128fSAndroid Build Coastguard Worker ;; 11153*6a54128fSAndroid Build Coastguard Worker 11154*6a54128fSAndroid Build Coastguard Worker *) 11155*6a54128fSAndroid Build Coastguard Worker if test clean = "$opt_mode"; then 11156*6a54128fSAndroid Build Coastguard Worker noexename=$name 11157*6a54128fSAndroid Build Coastguard Worker case $file in 11158*6a54128fSAndroid Build Coastguard Worker *.exe) 11159*6a54128fSAndroid Build Coastguard Worker func_stripname '' '.exe' "$file" 11160*6a54128fSAndroid Build Coastguard Worker file=$func_stripname_result 11161*6a54128fSAndroid Build Coastguard Worker func_stripname '' '.exe' "$name" 11162*6a54128fSAndroid Build Coastguard Worker noexename=$func_stripname_result 11163*6a54128fSAndroid Build Coastguard Worker # $file with .exe has already been added to rmfiles, 11164*6a54128fSAndroid Build Coastguard Worker # add $file without .exe 11165*6a54128fSAndroid Build Coastguard Worker func_append rmfiles " $file" 11166*6a54128fSAndroid Build Coastguard Worker ;; 11167*6a54128fSAndroid Build Coastguard Worker esac 11168*6a54128fSAndroid Build Coastguard Worker # Do a test to see if this is a libtool program. 11169*6a54128fSAndroid Build Coastguard Worker if func_ltwrapper_p "$file"; then 11170*6a54128fSAndroid Build Coastguard Worker if func_ltwrapper_executable_p "$file"; then 11171*6a54128fSAndroid Build Coastguard Worker func_ltwrapper_scriptname "$file" 11172*6a54128fSAndroid Build Coastguard Worker relink_command= 11173*6a54128fSAndroid Build Coastguard Worker func_source $func_ltwrapper_scriptname_result 11174*6a54128fSAndroid Build Coastguard Worker func_append rmfiles " $func_ltwrapper_scriptname_result" 11175*6a54128fSAndroid Build Coastguard Worker else 11176*6a54128fSAndroid Build Coastguard Worker relink_command= 11177*6a54128fSAndroid Build Coastguard Worker func_source $dir/$noexename 11178*6a54128fSAndroid Build Coastguard Worker fi 11179*6a54128fSAndroid Build Coastguard Worker 11180*6a54128fSAndroid Build Coastguard Worker # note $name still contains .exe if it was in $file originally 11181*6a54128fSAndroid Build Coastguard Worker # as does the version of $file that was added into $rmfiles 11182*6a54128fSAndroid Build Coastguard Worker func_append rmfiles " $odir/$name $odir/${name}S.$objext" 11183*6a54128fSAndroid Build Coastguard Worker if test yes = "$fast_install" && test -n "$relink_command"; then 11184*6a54128fSAndroid Build Coastguard Worker func_append rmfiles " $odir/lt-$name" 11185*6a54128fSAndroid Build Coastguard Worker fi 11186*6a54128fSAndroid Build Coastguard Worker if test "X$noexename" != "X$name"; then 11187*6a54128fSAndroid Build Coastguard Worker func_append rmfiles " $odir/lt-$noexename.c" 11188*6a54128fSAndroid Build Coastguard Worker fi 11189*6a54128fSAndroid Build Coastguard Worker fi 11190*6a54128fSAndroid Build Coastguard Worker fi 11191*6a54128fSAndroid Build Coastguard Worker ;; 11192*6a54128fSAndroid Build Coastguard Worker esac 11193*6a54128fSAndroid Build Coastguard Worker func_show_eval "$RM $rmfiles" 'exit_status=1' 11194*6a54128fSAndroid Build Coastguard Worker done 11195*6a54128fSAndroid Build Coastguard Worker 11196*6a54128fSAndroid Build Coastguard Worker # Try to remove the $objdir's in the directories where we deleted files 11197*6a54128fSAndroid Build Coastguard Worker for dir in $rmdirs; do 11198*6a54128fSAndroid Build Coastguard Worker if test -d "$dir"; then 11199*6a54128fSAndroid Build Coastguard Worker func_show_eval "rmdir $dir >/dev/null 2>&1" 11200*6a54128fSAndroid Build Coastguard Worker fi 11201*6a54128fSAndroid Build Coastguard Worker done 11202*6a54128fSAndroid Build Coastguard Worker 11203*6a54128fSAndroid Build Coastguard Worker exit $exit_status 11204*6a54128fSAndroid Build Coastguard Worker} 11205*6a54128fSAndroid Build Coastguard Worker 11206*6a54128fSAndroid Build Coastguard Workerif test uninstall = "$opt_mode" || test clean = "$opt_mode"; then 11207*6a54128fSAndroid Build Coastguard Worker func_mode_uninstall ${1+"$@"} 11208*6a54128fSAndroid Build Coastguard Workerfi 11209*6a54128fSAndroid Build Coastguard Worker 11210*6a54128fSAndroid Build Coastguard Workertest -z "$opt_mode" && { 11211*6a54128fSAndroid Build Coastguard Worker help=$generic_help 11212*6a54128fSAndroid Build Coastguard Worker func_fatal_help "you must specify a MODE" 11213*6a54128fSAndroid Build Coastguard Worker} 11214*6a54128fSAndroid Build Coastguard Worker 11215*6a54128fSAndroid Build Coastguard Workertest -z "$exec_cmd" && \ 11216*6a54128fSAndroid Build Coastguard Worker func_fatal_help "invalid operation mode '$opt_mode'" 11217*6a54128fSAndroid Build Coastguard Worker 11218*6a54128fSAndroid Build Coastguard Workerif test -n "$exec_cmd"; then 11219*6a54128fSAndroid Build Coastguard Worker eval exec "$exec_cmd" 11220*6a54128fSAndroid Build Coastguard Worker exit $EXIT_FAILURE 11221*6a54128fSAndroid Build Coastguard Workerfi 11222*6a54128fSAndroid Build Coastguard Worker 11223*6a54128fSAndroid Build Coastguard Workerexit $exit_status 11224*6a54128fSAndroid Build Coastguard Worker 11225*6a54128fSAndroid Build Coastguard Worker 11226*6a54128fSAndroid Build Coastguard Worker# The TAGs below are defined such that we never get into a situation 11227*6a54128fSAndroid Build Coastguard Worker# where we disable both kinds of libraries. Given conflicting 11228*6a54128fSAndroid Build Coastguard Worker# choices, we go for a static library, that is the most portable, 11229*6a54128fSAndroid Build Coastguard Worker# since we can't tell whether shared libraries were disabled because 11230*6a54128fSAndroid Build Coastguard Worker# the user asked for that or because the platform doesn't support 11231*6a54128fSAndroid Build Coastguard Worker# them. This is particularly important on AIX, because we don't 11232*6a54128fSAndroid Build Coastguard Worker# support having both static and shared libraries enabled at the same 11233*6a54128fSAndroid Build Coastguard Worker# time on that platform, so we default to a shared-only configuration. 11234*6a54128fSAndroid Build Coastguard Worker# If a disable-shared tag is given, we'll fallback to a static-only 11235*6a54128fSAndroid Build Coastguard Worker# configuration. But we'll never go from static-only to shared-only. 11236*6a54128fSAndroid Build Coastguard Worker 11237*6a54128fSAndroid Build Coastguard Worker# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 11238*6a54128fSAndroid Build Coastguard Workerbuild_libtool_libs=no 11239*6a54128fSAndroid Build Coastguard Workerbuild_old_libs=yes 11240*6a54128fSAndroid Build Coastguard Worker# ### END LIBTOOL TAG CONFIG: disable-shared 11241*6a54128fSAndroid Build Coastguard Worker 11242*6a54128fSAndroid Build Coastguard Worker# ### BEGIN LIBTOOL TAG CONFIG: disable-static 11243*6a54128fSAndroid Build Coastguard Workerbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 11244*6a54128fSAndroid Build Coastguard Worker# ### END LIBTOOL TAG CONFIG: disable-static 11245*6a54128fSAndroid Build Coastguard Worker 11246*6a54128fSAndroid Build Coastguard Worker# Local Variables: 11247*6a54128fSAndroid Build Coastguard Worker# mode:shell-script 11248*6a54128fSAndroid Build Coastguard Worker# sh-indentation:2 11249*6a54128fSAndroid Build Coastguard Worker# End: 11250