115f2201421a23fbf95840adf524cfdb4db384b85Cristy#! /bin/sh
215f2201421a23fbf95840adf524cfdb4db384b85Cristy## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
315f2201421a23fbf95840adf524cfdb4db384b85Cristy##               by inline-source v2014-01-03.01
43ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
515f2201421a23fbf95840adf524cfdb4db384b85Cristy# libtool (GNU libtool) 2.4.6
615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Provide generalized library-building support services.
73ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
83ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Copyright (C) 1996-2015 Free Software Foundation, Inc.
103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# This is free software; see the source for copying conditions.  There is NO
113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# GNU Libtool is free software; you can redistribute it and/or modify
143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# it under the terms of the GNU General Public License as published by
153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# the Free Software Foundation; either version 2 of the License, or
163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# (at your option) any later version.
173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#
183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# As a special exception to the GNU General Public License,
193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# if you distribute this file as part of a program or library that
203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# is built using GNU Libtool, you may include this file under the
213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# same distribution terms that you use for the rest of that program.
223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#
233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# GNU Libtool is distributed in the hope that it will be useful, but
243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# WITHOUT ANY WARRANTY; without even the implied warranty of
253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# General Public License for more details.
273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#
283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# You should have received a copy of the GNU General Public License
2915f2201421a23fbf95840adf524cfdb4db384b85Cristy# along with this program.  If not, see <http://www.gnu.org/licenses/>.
303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyPROGRAM=libtool
333ed852eea50f9d4cd633efb8c2b054b8e33c253cristyPACKAGE=libtool
3415f2201421a23fbf95840adf524cfdb4db384b85CristyVERSION=2.4.6
3515f2201421a23fbf95840adf524cfdb4db384b85Cristypackage_revision=2.4.6
363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3715f2201421a23fbf95840adf524cfdb4db384b85Cristy
3815f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------ ##
3915f2201421a23fbf95840adf524cfdb4db384b85Cristy## Usage. ##
4015f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------ ##
4115f2201421a23fbf95840adf524cfdb4db384b85Cristy
4215f2201421a23fbf95840adf524cfdb4db384b85Cristy# Run './libtool --help' for help with using this script from the
4315f2201421a23fbf95840adf524cfdb4db384b85Cristy# command line.
4415f2201421a23fbf95840adf524cfdb4db384b85Cristy
4515f2201421a23fbf95840adf524cfdb4db384b85Cristy
4615f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------------------------------- ##
4715f2201421a23fbf95840adf524cfdb4db384b85Cristy## User overridable command paths. ##
4815f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------------------------------- ##
4915f2201421a23fbf95840adf524cfdb4db384b85Cristy
5015f2201421a23fbf95840adf524cfdb4db384b85Cristy# After configure completes, it has a better idea of some of the
5115f2201421a23fbf95840adf524cfdb4db384b85Cristy# shell tools we need than the defaults used by the functions shared
5215f2201421a23fbf95840adf524cfdb4db384b85Cristy# with bootstrap, so set those here where they can still be over-
5315f2201421a23fbf95840adf524cfdb4db384b85Cristy# ridden by the user, but otherwise take precedence.
5415f2201421a23fbf95840adf524cfdb4db384b85Cristy
5515f2201421a23fbf95840adf524cfdb4db384b85Cristy: ${AUTOCONF="autoconf"}
5615f2201421a23fbf95840adf524cfdb4db384b85Cristy: ${AUTOMAKE="automake"}
5715f2201421a23fbf95840adf524cfdb4db384b85Cristy
5815f2201421a23fbf95840adf524cfdb4db384b85Cristy
5915f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------------------- ##
6015f2201421a23fbf95840adf524cfdb4db384b85Cristy## Source external libraries. ##
6115f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------------------- ##
6215f2201421a23fbf95840adf524cfdb4db384b85Cristy
6315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Much of our low-level functionality needs to be sourced from external
6415f2201421a23fbf95840adf524cfdb4db384b85Cristy# libraries, which are installed to $pkgauxdir.
6515f2201421a23fbf95840adf524cfdb4db384b85Cristy
6615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Set a version string for this script.
6715f2201421a23fbf95840adf524cfdb4db384b85Cristyscriptversion=2015-01-20.17; # UTC
6815f2201421a23fbf95840adf524cfdb4db384b85Cristy
6915f2201421a23fbf95840adf524cfdb4db384b85Cristy# General shell script boiler plate, and helper functions.
7015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Written by Gary V. Vaughan, 2004
7115f2201421a23fbf95840adf524cfdb4db384b85Cristy
7215f2201421a23fbf95840adf524cfdb4db384b85Cristy# Copyright (C) 2004-2015 Free Software Foundation, Inc.
7315f2201421a23fbf95840adf524cfdb4db384b85Cristy# This is free software; see the source for copying conditions.  There is NO
7415f2201421a23fbf95840adf524cfdb4db384b85Cristy# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7515f2201421a23fbf95840adf524cfdb4db384b85Cristy
7615f2201421a23fbf95840adf524cfdb4db384b85Cristy# This program is free software; you can redistribute it and/or modify
7715f2201421a23fbf95840adf524cfdb4db384b85Cristy# it under the terms of the GNU General Public License as published by
7815f2201421a23fbf95840adf524cfdb4db384b85Cristy# the Free Software Foundation; either version 3 of the License, or
7915f2201421a23fbf95840adf524cfdb4db384b85Cristy# (at your option) any later version.
8015f2201421a23fbf95840adf524cfdb4db384b85Cristy
8115f2201421a23fbf95840adf524cfdb4db384b85Cristy# As a special exception to the GNU General Public License, if you distribute
8215f2201421a23fbf95840adf524cfdb4db384b85Cristy# this file as part of a program or library that is built using GNU Libtool,
8315f2201421a23fbf95840adf524cfdb4db384b85Cristy# you may include this file under the same distribution terms that you use
8415f2201421a23fbf95840adf524cfdb4db384b85Cristy# for the rest of that program.
8515f2201421a23fbf95840adf524cfdb4db384b85Cristy
8615f2201421a23fbf95840adf524cfdb4db384b85Cristy# This program is distributed in the hope that it will be useful,
8715f2201421a23fbf95840adf524cfdb4db384b85Cristy# but WITHOUT ANY WARRANTY; without even the implied warranty of
8815f2201421a23fbf95840adf524cfdb4db384b85Cristy# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
8915f2201421a23fbf95840adf524cfdb4db384b85Cristy# General Public License for more details.
9015f2201421a23fbf95840adf524cfdb4db384b85Cristy
9115f2201421a23fbf95840adf524cfdb4db384b85Cristy# You should have received a copy of the GNU General Public License
9215f2201421a23fbf95840adf524cfdb4db384b85Cristy# along with this program. If not, see <http://www.gnu.org/licenses/>.
9315f2201421a23fbf95840adf524cfdb4db384b85Cristy
9415f2201421a23fbf95840adf524cfdb4db384b85Cristy# Please report bugs or propose patches to gary@gnu.org.
9515f2201421a23fbf95840adf524cfdb4db384b85Cristy
9615f2201421a23fbf95840adf524cfdb4db384b85Cristy
9715f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------ ##
9815f2201421a23fbf95840adf524cfdb4db384b85Cristy## Usage. ##
9915f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------ ##
10015f2201421a23fbf95840adf524cfdb4db384b85Cristy
10115f2201421a23fbf95840adf524cfdb4db384b85Cristy# Evaluate this file near the top of your script to gain access to
10215f2201421a23fbf95840adf524cfdb4db384b85Cristy# the functions and variables defined here:
10315f2201421a23fbf95840adf524cfdb4db384b85Cristy#
10415f2201421a23fbf95840adf524cfdb4db384b85Cristy#   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
10515f2201421a23fbf95840adf524cfdb4db384b85Cristy#
10615f2201421a23fbf95840adf524cfdb4db384b85Cristy# If you need to override any of the default environment variable
10715f2201421a23fbf95840adf524cfdb4db384b85Cristy# settings, do that before evaluating this file.
10815f2201421a23fbf95840adf524cfdb4db384b85Cristy
10915f2201421a23fbf95840adf524cfdb4db384b85Cristy
11015f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------------- ##
11115f2201421a23fbf95840adf524cfdb4db384b85Cristy## Shell normalisation. ##
11215f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------------- ##
11315f2201421a23fbf95840adf524cfdb4db384b85Cristy
11415f2201421a23fbf95840adf524cfdb4db384b85Cristy# Some shells need a little help to be as Bourne compatible as possible.
11515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Before doing anything else, make sure all that help has been provided!
11615f2201421a23fbf95840adf524cfdb4db384b85Cristy
11715f2201421a23fbf95840adf524cfdb4db384b85CristyDUALCASE=1; export DUALCASE # for MKS sh
11815f2201421a23fbf95840adf524cfdb4db384b85Cristyif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
1193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  emulate sh
1203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  NULLCMD=:
12115f2201421a23fbf95840adf524cfdb4db384b85Cristy  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
1223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # is contrary to our usage.  Disable this feature.
1233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  alias -g '${1+"$@"}'='"$@"'
1243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  setopt NO_GLOB_SUBST
1253ed852eea50f9d4cd633efb8c2b054b8e33c253cristyelse
12615f2201421a23fbf95840adf524cfdb4db384b85Cristy  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
1273ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfi
12898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
12915f2201421a23fbf95840adf524cfdb4db384b85Cristy# NLS nuisances: We save the old values in case they are required later.
13015f2201421a23fbf95840adf524cfdb4db384b85Cristy_G_user_locale=
13115f2201421a23fbf95840adf524cfdb4db384b85Cristy_G_safe_locale=
13215f2201421a23fbf95840adf524cfdb4db384b85Cristyfor _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1333ed852eea50f9d4cd633efb8c2b054b8e33c253cristydo
13415f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval "if test set = \"\${$_G_var+set}\"; then
13515f2201421a23fbf95840adf524cfdb4db384b85Cristy          save_$_G_var=\$$_G_var
13615f2201421a23fbf95840adf524cfdb4db384b85Cristy          $_G_var=C
13715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  export $_G_var
13815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
13915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
1403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi"
1413ed852eea50f9d4cd633efb8c2b054b8e33c253cristydone
1423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
14315f2201421a23fbf95840adf524cfdb4db384b85Cristy# CDPATH.
14415f2201421a23fbf95840adf524cfdb4db384b85Cristy(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
1453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
14615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Make sure IFS has a sensible default
14715f2201421a23fbf95840adf524cfdb4db384b85Cristysp=' '
14815f2201421a23fbf95840adf524cfdb4db384b85Cristynl='
14915f2201421a23fbf95840adf524cfdb4db384b85Cristy'
15015f2201421a23fbf95840adf524cfdb4db384b85CristyIFS="$sp	$nl"
15115f2201421a23fbf95840adf524cfdb4db384b85Cristy
15215f2201421a23fbf95840adf524cfdb4db384b85Cristy# There are apparently some retarded systems that use ';' as a PATH separator!
15315f2201421a23fbf95840adf524cfdb4db384b85Cristyif test "${PATH_SEPARATOR+set}" != set; then
15415f2201421a23fbf95840adf524cfdb4db384b85Cristy  PATH_SEPARATOR=:
15515f2201421a23fbf95840adf524cfdb4db384b85Cristy  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
15615f2201421a23fbf95840adf524cfdb4db384b85Cristy    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
15715f2201421a23fbf95840adf524cfdb4db384b85Cristy      PATH_SEPARATOR=';'
15815f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
15915f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
1603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
16315f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------------------------- ##
16415f2201421a23fbf95840adf524cfdb4db384b85Cristy## Locate command utilities. ##
16515f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------------------------- ##
16615f2201421a23fbf95840adf524cfdb4db384b85Cristy
16715f2201421a23fbf95840adf524cfdb4db384b85Cristy
16815f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_executable_p FILE
16915f2201421a23fbf95840adf524cfdb4db384b85Cristy# ----------------------
17015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Check that FILE is an executable regular file.
17115f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_executable_p ()
17215f2201421a23fbf95840adf524cfdb4db384b85Cristy{
17315f2201421a23fbf95840adf524cfdb4db384b85Cristy    test -f "$1" && test -x "$1"
17415f2201421a23fbf95840adf524cfdb4db384b85Cristy}
17515f2201421a23fbf95840adf524cfdb4db384b85Cristy
17615f2201421a23fbf95840adf524cfdb4db384b85Cristy
17715f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
17815f2201421a23fbf95840adf524cfdb4db384b85Cristy# --------------------------------------------
17915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Search for either a program that responds to --version with output
18015f2201421a23fbf95840adf524cfdb4db384b85Cristy# containing "GNU", or else returned by CHECK_FUNC otherwise, by
18115f2201421a23fbf95840adf524cfdb4db384b85Cristy# trying all the directories in PATH with each of the elements of
18215f2201421a23fbf95840adf524cfdb4db384b85Cristy# PROGS_LIST.
18315f2201421a23fbf95840adf524cfdb4db384b85Cristy#
18415f2201421a23fbf95840adf524cfdb4db384b85Cristy# CHECK_FUNC should accept the path to a candidate program, and
18515f2201421a23fbf95840adf524cfdb4db384b85Cristy# set $func_check_prog_result if it truncates its output less than
18615f2201421a23fbf95840adf524cfdb4db384b85Cristy# $_G_path_prog_max characters.
18715f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_path_progs ()
18815f2201421a23fbf95840adf524cfdb4db384b85Cristy{
18915f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_progs_list=$1
19015f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_check_func=$2
19115f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_PATH=${3-"$PATH"}
19215f2201421a23fbf95840adf524cfdb4db384b85Cristy
19315f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_path_prog_max=0
19415f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_path_prog_found=false
19515f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
19615f2201421a23fbf95840adf524cfdb4db384b85Cristy    for _G_dir in $_G_PATH; do
19715f2201421a23fbf95840adf524cfdb4db384b85Cristy      IFS=$_G_save_IFS
19815f2201421a23fbf95840adf524cfdb4db384b85Cristy      test -z "$_G_dir" && _G_dir=.
19915f2201421a23fbf95840adf524cfdb4db384b85Cristy      for _G_prog_name in $_G_progs_list; do
20015f2201421a23fbf95840adf524cfdb4db384b85Cristy        for _exeext in '' .EXE; do
20115f2201421a23fbf95840adf524cfdb4db384b85Cristy          _G_path_prog=$_G_dir/$_G_prog_name$_exeext
20215f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_executable_p "$_G_path_prog" || continue
20315f2201421a23fbf95840adf524cfdb4db384b85Cristy          case `"$_G_path_prog" --version 2>&1` in
20415f2201421a23fbf95840adf524cfdb4db384b85Cristy            *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
20515f2201421a23fbf95840adf524cfdb4db384b85Cristy            *)     $_G_check_func $_G_path_prog
20615f2201421a23fbf95840adf524cfdb4db384b85Cristy		   func_path_progs_result=$func_check_prog_result
20715f2201421a23fbf95840adf524cfdb4db384b85Cristy		   ;;
20815f2201421a23fbf95840adf524cfdb4db384b85Cristy          esac
20915f2201421a23fbf95840adf524cfdb4db384b85Cristy          $_G_path_prog_found && break 3
21015f2201421a23fbf95840adf524cfdb4db384b85Cristy        done
21115f2201421a23fbf95840adf524cfdb4db384b85Cristy      done
21215f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
21315f2201421a23fbf95840adf524cfdb4db384b85Cristy    IFS=$_G_save_IFS
21415f2201421a23fbf95840adf524cfdb4db384b85Cristy    test -z "$func_path_progs_result" && {
21515f2201421a23fbf95840adf524cfdb4db384b85Cristy      echo "no acceptable sed could be found in \$PATH" >&2
21615f2201421a23fbf95840adf524cfdb4db384b85Cristy      exit 1
21715f2201421a23fbf95840adf524cfdb4db384b85Cristy    }
21815f2201421a23fbf95840adf524cfdb4db384b85Cristy}
21915f2201421a23fbf95840adf524cfdb4db384b85Cristy
22015f2201421a23fbf95840adf524cfdb4db384b85Cristy
22115f2201421a23fbf95840adf524cfdb4db384b85Cristy# We want to be able to use the functions in this file before configure
22215f2201421a23fbf95840adf524cfdb4db384b85Cristy# has figured out where the best binaries are kept, which means we have
22315f2201421a23fbf95840adf524cfdb4db384b85Cristy# to search for them ourselves - except when the results are already set
22415f2201421a23fbf95840adf524cfdb4db384b85Cristy# where we skip the searches.
22515f2201421a23fbf95840adf524cfdb4db384b85Cristy
22615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Unless the user overrides by setting SED, search the path for either GNU
22715f2201421a23fbf95840adf524cfdb4db384b85Cristy# sed, or the sed that truncates its output the least.
22815f2201421a23fbf95840adf524cfdb4db384b85Cristytest -z "$SED" && {
22915f2201421a23fbf95840adf524cfdb4db384b85Cristy  _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
23015f2201421a23fbf95840adf524cfdb4db384b85Cristy  for _G_i in 1 2 3 4 5 6 7; do
23115f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_sed_script=$_G_sed_script$nl$_G_sed_script
23215f2201421a23fbf95840adf524cfdb4db384b85Cristy  done
23315f2201421a23fbf95840adf524cfdb4db384b85Cristy  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
23415f2201421a23fbf95840adf524cfdb4db384b85Cristy  _G_sed_script=
23515f2201421a23fbf95840adf524cfdb4db384b85Cristy
23615f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_check_prog_sed ()
23715f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
23815f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_path_prog=$1
23915f2201421a23fbf95840adf524cfdb4db384b85Cristy
24015f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_count=0
24115f2201421a23fbf95840adf524cfdb4db384b85Cristy    printf 0123456789 >conftest.in
24215f2201421a23fbf95840adf524cfdb4db384b85Cristy    while :
24315f2201421a23fbf95840adf524cfdb4db384b85Cristy    do
24415f2201421a23fbf95840adf524cfdb4db384b85Cristy      cat conftest.in conftest.in >conftest.tmp
24515f2201421a23fbf95840adf524cfdb4db384b85Cristy      mv conftest.tmp conftest.in
24615f2201421a23fbf95840adf524cfdb4db384b85Cristy      cp conftest.in conftest.nl
24715f2201421a23fbf95840adf524cfdb4db384b85Cristy      echo '' >> conftest.nl
24815f2201421a23fbf95840adf524cfdb4db384b85Cristy      "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
24915f2201421a23fbf95840adf524cfdb4db384b85Cristy      diff conftest.out conftest.nl >/dev/null 2>&1 || break
25015f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_count=`expr $_G_count + 1`
25115f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test "$_G_count" -gt "$_G_path_prog_max"; then
25215f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Best one so far, save it but keep looking for a better one
25315f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_check_prog_result=$_G_path_prog
25415f2201421a23fbf95840adf524cfdb4db384b85Cristy        _G_path_prog_max=$_G_count
25515f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
25615f2201421a23fbf95840adf524cfdb4db384b85Cristy      # 10*(2^10) chars as input seems more than enough
25715f2201421a23fbf95840adf524cfdb4db384b85Cristy      test 10 -lt "$_G_count" && break
25815f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
25915f2201421a23fbf95840adf524cfdb4db384b85Cristy    rm -f conftest.in conftest.tmp conftest.nl conftest.out
26015f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
26115f2201421a23fbf95840adf524cfdb4db384b85Cristy
26215f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
26315f2201421a23fbf95840adf524cfdb4db384b85Cristy  rm -f conftest.sed
26415f2201421a23fbf95840adf524cfdb4db384b85Cristy  SED=$func_path_progs_result
26515f2201421a23fbf95840adf524cfdb4db384b85Cristy}
26615f2201421a23fbf95840adf524cfdb4db384b85Cristy
26715f2201421a23fbf95840adf524cfdb4db384b85Cristy
26815f2201421a23fbf95840adf524cfdb4db384b85Cristy# Unless the user overrides by setting GREP, search the path for either GNU
26915f2201421a23fbf95840adf524cfdb4db384b85Cristy# grep, or the grep that truncates its output the least.
27015f2201421a23fbf95840adf524cfdb4db384b85Cristytest -z "$GREP" && {
27115f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_check_prog_grep ()
27215f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
27315f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_path_prog=$1
27415f2201421a23fbf95840adf524cfdb4db384b85Cristy
27515f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_count=0
27615f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_path_prog_max=0
27715f2201421a23fbf95840adf524cfdb4db384b85Cristy    printf 0123456789 >conftest.in
27815f2201421a23fbf95840adf524cfdb4db384b85Cristy    while :
27915f2201421a23fbf95840adf524cfdb4db384b85Cristy    do
28015f2201421a23fbf95840adf524cfdb4db384b85Cristy      cat conftest.in conftest.in >conftest.tmp
28115f2201421a23fbf95840adf524cfdb4db384b85Cristy      mv conftest.tmp conftest.in
28215f2201421a23fbf95840adf524cfdb4db384b85Cristy      cp conftest.in conftest.nl
28315f2201421a23fbf95840adf524cfdb4db384b85Cristy      echo 'GREP' >> conftest.nl
28415f2201421a23fbf95840adf524cfdb4db384b85Cristy      "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
28515f2201421a23fbf95840adf524cfdb4db384b85Cristy      diff conftest.out conftest.nl >/dev/null 2>&1 || break
28615f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_count=`expr $_G_count + 1`
28715f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test "$_G_count" -gt "$_G_path_prog_max"; then
28815f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Best one so far, save it but keep looking for a better one
28915f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_check_prog_result=$_G_path_prog
29015f2201421a23fbf95840adf524cfdb4db384b85Cristy        _G_path_prog_max=$_G_count
29115f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
29215f2201421a23fbf95840adf524cfdb4db384b85Cristy      # 10*(2^10) chars as input seems more than enough
29315f2201421a23fbf95840adf524cfdb4db384b85Cristy      test 10 -lt "$_G_count" && break
29415f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
29515f2201421a23fbf95840adf524cfdb4db384b85Cristy    rm -f conftest.in conftest.tmp conftest.nl conftest.out
29615f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
29715f2201421a23fbf95840adf524cfdb4db384b85Cristy
29815f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
29915f2201421a23fbf95840adf524cfdb4db384b85Cristy  GREP=$func_path_progs_result
30015f2201421a23fbf95840adf524cfdb4db384b85Cristy}
30115f2201421a23fbf95840adf524cfdb4db384b85Cristy
30215f2201421a23fbf95840adf524cfdb4db384b85Cristy
30315f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------------------------------- ##
30415f2201421a23fbf95840adf524cfdb4db384b85Cristy## User overridable command paths. ##
30515f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------------------------------- ##
30615f2201421a23fbf95840adf524cfdb4db384b85Cristy
30715f2201421a23fbf95840adf524cfdb4db384b85Cristy# All uppercase variable names are used for environment variables.  These
30815f2201421a23fbf95840adf524cfdb4db384b85Cristy# variables can be overridden by the user before calling a script that
30915f2201421a23fbf95840adf524cfdb4db384b85Cristy# uses them if a suitable command of that name is not already available
31015f2201421a23fbf95840adf524cfdb4db384b85Cristy# in the command search PATH.
3113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy: ${CP="cp -f"}
31315f2201421a23fbf95840adf524cfdb4db384b85Cristy: ${ECHO="printf %s\n"}
31415f2201421a23fbf95840adf524cfdb4db384b85Cristy: ${EGREP="$GREP -E"}
31515f2201421a23fbf95840adf524cfdb4db384b85Cristy: ${FGREP="$GREP -F"}
31615f2201421a23fbf95840adf524cfdb4db384b85Cristy: ${LN_S="ln -s"}
3173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy: ${MAKE="make"}
3183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy: ${MKDIR="mkdir"}
3193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy: ${MV="mv -f"}
3203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy: ${RM="rm -f"}
3213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
3223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
32415f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------------- ##
32515f2201421a23fbf95840adf524cfdb4db384b85Cristy## Useful sed snippets. ##
32615f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------------- ##
327da16f16767eb31921af855f17bda465fffc4e000cristy
32815f2201421a23fbf95840adf524cfdb4db384b85Cristysed_dirname='s|/[^/]*$||'
32915f2201421a23fbf95840adf524cfdb4db384b85Cristysed_basename='s|^.*/||'
330da16f16767eb31921af855f17bda465fffc4e000cristy
33115f2201421a23fbf95840adf524cfdb4db384b85Cristy# Sed substitution that helps us do robust quoting.  It backslashifies
33215f2201421a23fbf95840adf524cfdb4db384b85Cristy# metacharacters that are still active within double-quoted strings.
33315f2201421a23fbf95840adf524cfdb4db384b85Cristysed_quote_subst='s|\([`"$\\]\)|\\\1|g'
334da16f16767eb31921af855f17bda465fffc4e000cristy
33515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Same as above, but do not quote variable references.
33615f2201421a23fbf95840adf524cfdb4db384b85Cristysed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
337da16f16767eb31921af855f17bda465fffc4e000cristy
33815f2201421a23fbf95840adf524cfdb4db384b85Cristy# Sed substitution that turns a string into a regex matching for the
33915f2201421a23fbf95840adf524cfdb4db384b85Cristy# string literally.
34015f2201421a23fbf95840adf524cfdb4db384b85Cristysed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
341da16f16767eb31921af855f17bda465fffc4e000cristy
34215f2201421a23fbf95840adf524cfdb4db384b85Cristy# Sed substitution that converts a w32 file name or path
34315f2201421a23fbf95840adf524cfdb4db384b85Cristy# that contains forward slashes, into one that contains
34415f2201421a23fbf95840adf524cfdb4db384b85Cristy# (escaped) backslashes.  A very naive implementation.
34515f2201421a23fbf95840adf524cfdb4db384b85Cristysed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
34615f2201421a23fbf95840adf524cfdb4db384b85Cristy
34715f2201421a23fbf95840adf524cfdb4db384b85Cristy# Re-'\' parameter expansions in output of sed_double_quote_subst that
34815f2201421a23fbf95840adf524cfdb4db384b85Cristy# were '\'-ed in input to the same.  If an odd number of '\' preceded a
34915f2201421a23fbf95840adf524cfdb4db384b85Cristy# '$' in input to sed_double_quote_subst, that '$' was protected from
35015f2201421a23fbf95840adf524cfdb4db384b85Cristy# expansion.  Since each input '\' is now two '\'s, look for any number
35115f2201421a23fbf95840adf524cfdb4db384b85Cristy# of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
35215f2201421a23fbf95840adf524cfdb4db384b85Cristy_G_bs='\\'
35315f2201421a23fbf95840adf524cfdb4db384b85Cristy_G_bs2='\\\\'
35415f2201421a23fbf95840adf524cfdb4db384b85Cristy_G_bs4='\\\\\\\\'
35515f2201421a23fbf95840adf524cfdb4db384b85Cristy_G_dollar='\$'
35615f2201421a23fbf95840adf524cfdb4db384b85Cristysed_double_backslash="\
35715f2201421a23fbf95840adf524cfdb4db384b85Cristy  s/$_G_bs4/&\\
35815f2201421a23fbf95840adf524cfdb4db384b85Cristy/g
35915f2201421a23fbf95840adf524cfdb4db384b85Cristy  s/^$_G_bs2$_G_dollar/$_G_bs&/
36015f2201421a23fbf95840adf524cfdb4db384b85Cristy  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
36115f2201421a23fbf95840adf524cfdb4db384b85Cristy  s/\n//g"
362da16f16767eb31921af855f17bda465fffc4e000cristy
3633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36415f2201421a23fbf95840adf524cfdb4db384b85Cristy## ----------------- ##
36515f2201421a23fbf95840adf524cfdb4db384b85Cristy## Global variables. ##
36615f2201421a23fbf95840adf524cfdb4db384b85Cristy## ----------------- ##
3673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36815f2201421a23fbf95840adf524cfdb4db384b85Cristy# Except for the global variables explicitly listed below, the following
36915f2201421a23fbf95840adf524cfdb4db384b85Cristy# functions in the '^func_' namespace, and the '^require_' namespace
37015f2201421a23fbf95840adf524cfdb4db384b85Cristy# variables initialised in the 'Resource management' section, sourcing
37115f2201421a23fbf95840adf524cfdb4db384b85Cristy# this file will not pollute your global namespace with anything
37215f2201421a23fbf95840adf524cfdb4db384b85Cristy# else. There's no portable way to scope variables in Bourne shell
37315f2201421a23fbf95840adf524cfdb4db384b85Cristy# though, so actually running these functions will sometimes place
37415f2201421a23fbf95840adf524cfdb4db384b85Cristy# results into a variable named after the function, and often use
37515f2201421a23fbf95840adf524cfdb4db384b85Cristy# temporary variables in the '^_G_' namespace. If you are careful to
37615f2201421a23fbf95840adf524cfdb4db384b85Cristy# avoid using those namespaces casually in your sourcing script, things
37715f2201421a23fbf95840adf524cfdb4db384b85Cristy# should continue to work as you expect. And, of course, you can freely
37815f2201421a23fbf95840adf524cfdb4db384b85Cristy# overwrite any of the functions or variables defined here before
37915f2201421a23fbf95840adf524cfdb4db384b85Cristy# calling anything to customize them.
38098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
38115f2201421a23fbf95840adf524cfdb4db384b85CristyEXIT_SUCCESS=0
38215f2201421a23fbf95840adf524cfdb4db384b85CristyEXIT_FAILURE=1
38315f2201421a23fbf95840adf524cfdb4db384b85CristyEXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
38415f2201421a23fbf95840adf524cfdb4db384b85CristyEXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
38598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
38615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Allow overriding, eg assuming that you follow the convention of
38715f2201421a23fbf95840adf524cfdb4db384b85Cristy# putting '$debug_cmd' at the start of all your functions, you can get
38815f2201421a23fbf95840adf524cfdb4db384b85Cristy# bash to show function call trace with:
38915f2201421a23fbf95840adf524cfdb4db384b85Cristy#
39015f2201421a23fbf95840adf524cfdb4db384b85Cristy#    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
39115f2201421a23fbf95840adf524cfdb4db384b85Cristydebug_cmd=${debug_cmd-":"}
39215f2201421a23fbf95840adf524cfdb4db384b85Cristyexit_cmd=:
39398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
39415f2201421a23fbf95840adf524cfdb4db384b85Cristy# By convention, finish your script with:
39515f2201421a23fbf95840adf524cfdb4db384b85Cristy#
39615f2201421a23fbf95840adf524cfdb4db384b85Cristy#    exit $exit_status
39715f2201421a23fbf95840adf524cfdb4db384b85Cristy#
39815f2201421a23fbf95840adf524cfdb4db384b85Cristy# so that you can set exit_status to non-zero if you want to indicate
39915f2201421a23fbf95840adf524cfdb4db384b85Cristy# something went wrong during execution without actually bailing out at
40015f2201421a23fbf95840adf524cfdb4db384b85Cristy# the point of failure.
40115f2201421a23fbf95840adf524cfdb4db384b85Cristyexit_status=$EXIT_SUCCESS
40298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
40315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
40415f2201421a23fbf95840adf524cfdb4db384b85Cristy# is ksh but when the shell is invoked as "sh" and the current value of
40515f2201421a23fbf95840adf524cfdb4db384b85Cristy# the _XPG environment variable is not equal to 1 (one), the special
40615f2201421a23fbf95840adf524cfdb4db384b85Cristy# positional parameter $0, within a function call, is the name of the
40715f2201421a23fbf95840adf524cfdb4db384b85Cristy# function.
40815f2201421a23fbf95840adf524cfdb4db384b85Cristyprogpath=$0
4093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
41015f2201421a23fbf95840adf524cfdb4db384b85Cristy# The name of this program.
41115f2201421a23fbf95840adf524cfdb4db384b85Cristyprogname=`$ECHO "$progpath" |$SED "$sed_basename"`
4123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
41315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Make sure we have an absolute progpath for reexecution:
4143ed852eea50f9d4cd633efb8c2b054b8e33c253cristycase $progpath in
4153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  [\\/]*|[A-Za-z]:\\*) ;;
4163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *[\\/]*)
41715f2201421a23fbf95840adf524cfdb4db384b85Cristy     progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
4183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy     progdir=`cd "$progdir" && pwd`
41915f2201421a23fbf95840adf524cfdb4db384b85Cristy     progpath=$progdir/$progname
4203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy     ;;
4213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *)
42215f2201421a23fbf95840adf524cfdb4db384b85Cristy     _G_IFS=$IFS
4232542fc61a973e588b23b3ddac880f01ae6c4c64dcristy     IFS=${PATH_SEPARATOR-:}
4243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy     for progdir in $PATH; do
42515f2201421a23fbf95840adf524cfdb4db384b85Cristy       IFS=$_G_IFS
4263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy       test -x "$progdir/$progname" && break
4273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy     done
42815f2201421a23fbf95840adf524cfdb4db384b85Cristy     IFS=$_G_IFS
4293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy     test -n "$progdir" || progdir=`pwd`
43015f2201421a23fbf95840adf524cfdb4db384b85Cristy     progpath=$progdir/$progname
4313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy     ;;
4323ed852eea50f9d4cd633efb8c2b054b8e33c253cristyesac
4333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43515f2201421a23fbf95840adf524cfdb4db384b85Cristy## ----------------- ##
43615f2201421a23fbf95840adf524cfdb4db384b85Cristy## Standard options. ##
43715f2201421a23fbf95840adf524cfdb4db384b85Cristy## ----------------- ##
438da16f16767eb31921af855f17bda465fffc4e000cristy
43915f2201421a23fbf95840adf524cfdb4db384b85Cristy# The following options affect the operation of the functions defined
44015f2201421a23fbf95840adf524cfdb4db384b85Cristy# below, and should be set appropriately depending on run-time para-
44115f2201421a23fbf95840adf524cfdb4db384b85Cristy# meters passed on the command line.
4423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4433ed852eea50f9d4cd633efb8c2b054b8e33c253cristyopt_dry_run=false
4443ed852eea50f9d4cd633efb8c2b054b8e33c253cristyopt_quiet=false
4453ed852eea50f9d4cd633efb8c2b054b8e33c253cristyopt_verbose=false
4463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
44715f2201421a23fbf95840adf524cfdb4db384b85Cristy# Categories 'all' and 'none' are always available.  Append any others
44815f2201421a23fbf95840adf524cfdb4db384b85Cristy# you will pass as the first argument to func_warning from your own
44915f2201421a23fbf95840adf524cfdb4db384b85Cristy# code.
45015f2201421a23fbf95840adf524cfdb4db384b85Cristywarning_categories=
4513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45215f2201421a23fbf95840adf524cfdb4db384b85Cristy# By default, display warnings according to 'opt_warning_types'.  Set
45315f2201421a23fbf95840adf524cfdb4db384b85Cristy# 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
45415f2201421a23fbf95840adf524cfdb4db384b85Cristy# treat the next displayed warning as a fatal error.
45515f2201421a23fbf95840adf524cfdb4db384b85Cristywarning_func=func_warn_and_continue
4563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45715f2201421a23fbf95840adf524cfdb4db384b85Cristy# Set to 'all' to display all warnings, 'none' to suppress all
45815f2201421a23fbf95840adf524cfdb4db384b85Cristy# warnings, or a space delimited list of some subset of
45915f2201421a23fbf95840adf524cfdb4db384b85Cristy# 'warning_categories' to display only the listed warnings.
46015f2201421a23fbf95840adf524cfdb4db384b85Cristyopt_warning_types=all
4613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
46298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
46315f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------------- ##
46415f2201421a23fbf95840adf524cfdb4db384b85Cristy## Resource management. ##
46515f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------------- ##
4663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
46715f2201421a23fbf95840adf524cfdb4db384b85Cristy# This section contains definitions for functions that each ensure a
46815f2201421a23fbf95840adf524cfdb4db384b85Cristy# particular resource (a file, or a non-empty configuration variable for
46915f2201421a23fbf95840adf524cfdb4db384b85Cristy# example) is available, and if appropriate to extract default values
47015f2201421a23fbf95840adf524cfdb4db384b85Cristy# from pertinent package files. Call them using their associated
47115f2201421a23fbf95840adf524cfdb4db384b85Cristy# 'require_*' variable to ensure that they are executed, at most, once.
47215f2201421a23fbf95840adf524cfdb4db384b85Cristy#
47315f2201421a23fbf95840adf524cfdb4db384b85Cristy# It's entirely deliberate that calling these functions can set
47415f2201421a23fbf95840adf524cfdb4db384b85Cristy# variables that don't obey the namespace limitations obeyed by the rest
47515f2201421a23fbf95840adf524cfdb4db384b85Cristy# of this file, in order that that they be as useful as possible to
47615f2201421a23fbf95840adf524cfdb4db384b85Cristy# callers.
4773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
47915f2201421a23fbf95840adf524cfdb4db384b85Cristy# require_term_colors
48015f2201421a23fbf95840adf524cfdb4db384b85Cristy# -------------------
48115f2201421a23fbf95840adf524cfdb4db384b85Cristy# Allow display of bold text on terminals that support it.
48215f2201421a23fbf95840adf524cfdb4db384b85Cristyrequire_term_colors=func_require_term_colors
48315f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_require_term_colors ()
4843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
48515f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
48615f2201421a23fbf95840adf524cfdb4db384b85Cristy
48715f2201421a23fbf95840adf524cfdb4db384b85Cristy    test -t 1 && {
48815f2201421a23fbf95840adf524cfdb4db384b85Cristy      # COLORTERM and USE_ANSI_COLORS environment variables take
48915f2201421a23fbf95840adf524cfdb4db384b85Cristy      # precedence, because most terminfo databases neglect to describe
49015f2201421a23fbf95840adf524cfdb4db384b85Cristy      # whether color sequences are supported.
49115f2201421a23fbf95840adf524cfdb4db384b85Cristy      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
49215f2201421a23fbf95840adf524cfdb4db384b85Cristy
49315f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test 1 = "$USE_ANSI_COLORS"; then
49415f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Standard ANSI escape sequences
49515f2201421a23fbf95840adf524cfdb4db384b85Cristy        tc_reset='[0m'
49615f2201421a23fbf95840adf524cfdb4db384b85Cristy        tc_bold='[1m';   tc_standout='[7m'
49715f2201421a23fbf95840adf524cfdb4db384b85Cristy        tc_red='[31m';   tc_green='[32m'
49815f2201421a23fbf95840adf524cfdb4db384b85Cristy        tc_blue='[34m';  tc_cyan='[36m'
49915f2201421a23fbf95840adf524cfdb4db384b85Cristy      else
50015f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Otherwise trust the terminfo database after all.
50115f2201421a23fbf95840adf524cfdb4db384b85Cristy        test -n "`tput sgr0 2>/dev/null`" && {
50215f2201421a23fbf95840adf524cfdb4db384b85Cristy          tc_reset=`tput sgr0`
50315f2201421a23fbf95840adf524cfdb4db384b85Cristy          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
50415f2201421a23fbf95840adf524cfdb4db384b85Cristy          tc_standout=$tc_bold
50515f2201421a23fbf95840adf524cfdb4db384b85Cristy          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
50615f2201421a23fbf95840adf524cfdb4db384b85Cristy          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
50715f2201421a23fbf95840adf524cfdb4db384b85Cristy          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
50815f2201421a23fbf95840adf524cfdb4db384b85Cristy          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
50915f2201421a23fbf95840adf524cfdb4db384b85Cristy          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
51015f2201421a23fbf95840adf524cfdb4db384b85Cristy        }
51115f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
51215f2201421a23fbf95840adf524cfdb4db384b85Cristy    }
5133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
51415f2201421a23fbf95840adf524cfdb4db384b85Cristy    require_term_colors=:
5153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
5163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
5173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
51815f2201421a23fbf95840adf524cfdb4db384b85Cristy## ----------------- ##
51915f2201421a23fbf95840adf524cfdb4db384b85Cristy## Function library. ##
52015f2201421a23fbf95840adf524cfdb4db384b85Cristy## ----------------- ##
52115f2201421a23fbf95840adf524cfdb4db384b85Cristy
52215f2201421a23fbf95840adf524cfdb4db384b85Cristy# This section contains a variety of useful functions to call in your
52315f2201421a23fbf95840adf524cfdb4db384b85Cristy# scripts. Take note of the portable wrappers for features provided by
52415f2201421a23fbf95840adf524cfdb4db384b85Cristy# some modern shells, which will fall back to slower equivalents on
52515f2201421a23fbf95840adf524cfdb4db384b85Cristy# less featureful shells.
52615f2201421a23fbf95840adf524cfdb4db384b85Cristy
52715f2201421a23fbf95840adf524cfdb4db384b85Cristy
52815f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_append VAR VALUE
52915f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------
53015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Append VALUE onto the existing contents of VAR.
53115f2201421a23fbf95840adf524cfdb4db384b85Cristy
53215f2201421a23fbf95840adf524cfdb4db384b85Cristy  # We should try to minimise forks, especially on Windows where they are
53315f2201421a23fbf95840adf524cfdb4db384b85Cristy  # unreasonably slow, so skip the feature probes when bash or zsh are
53415f2201421a23fbf95840adf524cfdb4db384b85Cristy  # being used:
53515f2201421a23fbf95840adf524cfdb4db384b85Cristy  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
53615f2201421a23fbf95840adf524cfdb4db384b85Cristy    : ${_G_HAVE_ARITH_OP="yes"}
53715f2201421a23fbf95840adf524cfdb4db384b85Cristy    : ${_G_HAVE_XSI_OPS="yes"}
53815f2201421a23fbf95840adf524cfdb4db384b85Cristy    # The += operator was introduced in bash 3.1
53915f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $BASH_VERSION in
54015f2201421a23fbf95840adf524cfdb4db384b85Cristy      [12].* | 3.0 | 3.0*) ;;
54115f2201421a23fbf95840adf524cfdb4db384b85Cristy      *)
54215f2201421a23fbf95840adf524cfdb4db384b85Cristy        : ${_G_HAVE_PLUSEQ_OP="yes"}
54315f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
54415f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
54515f2201421a23fbf95840adf524cfdb4db384b85Cristy  fi
54615f2201421a23fbf95840adf524cfdb4db384b85Cristy
54715f2201421a23fbf95840adf524cfdb4db384b85Cristy  # _G_HAVE_PLUSEQ_OP
54815f2201421a23fbf95840adf524cfdb4db384b85Cristy  # Can be empty, in which case the shell is probed, "yes" if += is
54915f2201421a23fbf95840adf524cfdb4db384b85Cristy  # useable or anything else if it does not work.
55015f2201421a23fbf95840adf524cfdb4db384b85Cristy  test -z "$_G_HAVE_PLUSEQ_OP" \
55115f2201421a23fbf95840adf524cfdb4db384b85Cristy    && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
55215f2201421a23fbf95840adf524cfdb4db384b85Cristy    && _G_HAVE_PLUSEQ_OP=yes
55315f2201421a23fbf95840adf524cfdb4db384b85Cristy
55415f2201421a23fbf95840adf524cfdb4db384b85Cristyif test yes = "$_G_HAVE_PLUSEQ_OP"
55515f2201421a23fbf95840adf524cfdb4db384b85Cristythen
55615f2201421a23fbf95840adf524cfdb4db384b85Cristy  # This is an XSI compatible shell, allowing a faster implementation...
55715f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'func_append ()
55815f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
55915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
56015f2201421a23fbf95840adf524cfdb4db384b85Cristy
56115f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval "$1+=\$2"
56215f2201421a23fbf95840adf524cfdb4db384b85Cristy  }'
56315f2201421a23fbf95840adf524cfdb4db384b85Cristyelse
56415f2201421a23fbf95840adf524cfdb4db384b85Cristy  # ...otherwise fall back to using expr, which is often a shell builtin.
56515f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_append ()
56615f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
56715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
56815f2201421a23fbf95840adf524cfdb4db384b85Cristy
56915f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval "$1=\$$1\$2"
57015f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
57115f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
57215f2201421a23fbf95840adf524cfdb4db384b85Cristy
57315f2201421a23fbf95840adf524cfdb4db384b85Cristy
57415f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_append_quoted VAR VALUE
57515f2201421a23fbf95840adf524cfdb4db384b85Cristy# ----------------------------
57615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Quote VALUE and append to the end of shell variable VAR, separated
57715f2201421a23fbf95840adf524cfdb4db384b85Cristy# by a space.
57815f2201421a23fbf95840adf524cfdb4db384b85Cristyif test yes = "$_G_HAVE_PLUSEQ_OP"; then
57915f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'func_append_quoted ()
58015f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
58115f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
58215f2201421a23fbf95840adf524cfdb4db384b85Cristy
58315f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_eval "$2"
58415f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval "$1+=\\ \$func_quote_for_eval_result"
58515f2201421a23fbf95840adf524cfdb4db384b85Cristy  }'
58615f2201421a23fbf95840adf524cfdb4db384b85Cristyelse
58715f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_append_quoted ()
58815f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
58915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
59015f2201421a23fbf95840adf524cfdb4db384b85Cristy
59115f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_eval "$2"
59215f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval "$1=\$$1\\ \$func_quote_for_eval_result"
59315f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
59415f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
59515f2201421a23fbf95840adf524cfdb4db384b85Cristy
59615f2201421a23fbf95840adf524cfdb4db384b85Cristy
59715f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_append_uniq VAR VALUE
59815f2201421a23fbf95840adf524cfdb4db384b85Cristy# --------------------------
59915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Append unique VALUE onto the existing contents of VAR, assuming
60015f2201421a23fbf95840adf524cfdb4db384b85Cristy# entries are delimited by the first character of VALUE.  For example:
60115f2201421a23fbf95840adf524cfdb4db384b85Cristy#
60215f2201421a23fbf95840adf524cfdb4db384b85Cristy#   func_append_uniq options " --another-option option-argument"
60315f2201421a23fbf95840adf524cfdb4db384b85Cristy#
60415f2201421a23fbf95840adf524cfdb4db384b85Cristy# will only append to $options if " --another-option option-argument "
60515f2201421a23fbf95840adf524cfdb4db384b85Cristy# is not already present somewhere in $options already (note spaces at
60615f2201421a23fbf95840adf524cfdb4db384b85Cristy# each end implied by leading space in second argument).
60715f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_append_uniq ()
60815f2201421a23fbf95840adf524cfdb4db384b85Cristy{
60915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
61015f2201421a23fbf95840adf524cfdb4db384b85Cristy
61115f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval _G_current_value='`$ECHO $'$1'`'
61215f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_delim=`expr "$2" : '\(.\)'`
61315f2201421a23fbf95840adf524cfdb4db384b85Cristy
61415f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $_G_delim$_G_current_value$_G_delim in
61515f2201421a23fbf95840adf524cfdb4db384b85Cristy      *"$2$_G_delim"*) ;;
61615f2201421a23fbf95840adf524cfdb4db384b85Cristy      *) func_append "$@" ;;
61715f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
61815f2201421a23fbf95840adf524cfdb4db384b85Cristy}
61915f2201421a23fbf95840adf524cfdb4db384b85Cristy
62015f2201421a23fbf95840adf524cfdb4db384b85Cristy
62115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_arith TERM...
62215f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------
62315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Set func_arith_result to the result of evaluating TERMs.
62415f2201421a23fbf95840adf524cfdb4db384b85Cristy  test -z "$_G_HAVE_ARITH_OP" \
62515f2201421a23fbf95840adf524cfdb4db384b85Cristy    && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
62615f2201421a23fbf95840adf524cfdb4db384b85Cristy    && _G_HAVE_ARITH_OP=yes
62715f2201421a23fbf95840adf524cfdb4db384b85Cristy
62815f2201421a23fbf95840adf524cfdb4db384b85Cristyif test yes = "$_G_HAVE_ARITH_OP"; then
62915f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'func_arith ()
63015f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
63115f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
63215f2201421a23fbf95840adf524cfdb4db384b85Cristy
63315f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_arith_result=$(( $* ))
63415f2201421a23fbf95840adf524cfdb4db384b85Cristy  }'
63515f2201421a23fbf95840adf524cfdb4db384b85Cristyelse
63615f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_arith ()
63715f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
63815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
63915f2201421a23fbf95840adf524cfdb4db384b85Cristy
64015f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_arith_result=`expr "$@"`
64115f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
64215f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
64315f2201421a23fbf95840adf524cfdb4db384b85Cristy
64415f2201421a23fbf95840adf524cfdb4db384b85Cristy
64515f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_basename FILE
64615f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------
64715f2201421a23fbf95840adf524cfdb4db384b85Cristy# Set func_basename_result to FILE with everything up to and including
64815f2201421a23fbf95840adf524cfdb4db384b85Cristy# the last / stripped.
64915f2201421a23fbf95840adf524cfdb4db384b85Cristyif test yes = "$_G_HAVE_XSI_OPS"; then
65015f2201421a23fbf95840adf524cfdb4db384b85Cristy  # If this shell supports suffix pattern removal, then use it to avoid
65115f2201421a23fbf95840adf524cfdb4db384b85Cristy  # forking. Hide the definitions single quotes in case the shell chokes
65215f2201421a23fbf95840adf524cfdb4db384b85Cristy  # on unsupported syntax...
65315f2201421a23fbf95840adf524cfdb4db384b85Cristy  _b='func_basename_result=${1##*/}'
65415f2201421a23fbf95840adf524cfdb4db384b85Cristy  _d='case $1 in
65515f2201421a23fbf95840adf524cfdb4db384b85Cristy        */*) func_dirname_result=${1%/*}$2 ;;
65615f2201421a23fbf95840adf524cfdb4db384b85Cristy        *  ) func_dirname_result=$3        ;;
65715f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac'
65815f2201421a23fbf95840adf524cfdb4db384b85Cristy
65915f2201421a23fbf95840adf524cfdb4db384b85Cristyelse
66015f2201421a23fbf95840adf524cfdb4db384b85Cristy  # ...otherwise fall back to using sed.
66115f2201421a23fbf95840adf524cfdb4db384b85Cristy  _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
66215f2201421a23fbf95840adf524cfdb4db384b85Cristy  _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
66315f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test "X$func_dirname_result" = "X$1"; then
66415f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_dirname_result=$3
66515f2201421a23fbf95840adf524cfdb4db384b85Cristy      else
66615f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_append func_dirname_result "$2"
66715f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi'
66815f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
66915f2201421a23fbf95840adf524cfdb4db384b85Cristy
67015f2201421a23fbf95840adf524cfdb4db384b85Cristyeval 'func_basename ()
67115f2201421a23fbf95840adf524cfdb4db384b85Cristy{
67215f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
67315f2201421a23fbf95840adf524cfdb4db384b85Cristy
67415f2201421a23fbf95840adf524cfdb4db384b85Cristy    '"$_b"'
67515f2201421a23fbf95840adf524cfdb4db384b85Cristy}'
67615f2201421a23fbf95840adf524cfdb4db384b85Cristy
67715f2201421a23fbf95840adf524cfdb4db384b85Cristy
67815f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_dirname FILE APPEND NONDIR_REPLACEMENT
67915f2201421a23fbf95840adf524cfdb4db384b85Cristy# -------------------------------------------
68015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
68115f2201421a23fbf95840adf524cfdb4db384b85Cristy# otherwise set result to NONDIR_REPLACEMENT.
68215f2201421a23fbf95840adf524cfdb4db384b85Cristyeval 'func_dirname ()
68315f2201421a23fbf95840adf524cfdb4db384b85Cristy{
68415f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
68515f2201421a23fbf95840adf524cfdb4db384b85Cristy
68615f2201421a23fbf95840adf524cfdb4db384b85Cristy    '"$_d"'
68715f2201421a23fbf95840adf524cfdb4db384b85Cristy}'
68815f2201421a23fbf95840adf524cfdb4db384b85Cristy
68915f2201421a23fbf95840adf524cfdb4db384b85Cristy
69015f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
69115f2201421a23fbf95840adf524cfdb4db384b85Cristy# --------------------------------------------------------
69215f2201421a23fbf95840adf524cfdb4db384b85Cristy# Perform func_basename and func_dirname in a single function
69315f2201421a23fbf95840adf524cfdb4db384b85Cristy# call:
69415f2201421a23fbf95840adf524cfdb4db384b85Cristy#   dirname:  Compute the dirname of FILE.  If nonempty,
69515f2201421a23fbf95840adf524cfdb4db384b85Cristy#             add APPEND to the result, otherwise set result
69615f2201421a23fbf95840adf524cfdb4db384b85Cristy#             to NONDIR_REPLACEMENT.
69715f2201421a23fbf95840adf524cfdb4db384b85Cristy#             value returned in "$func_dirname_result"
69815f2201421a23fbf95840adf524cfdb4db384b85Cristy#   basename: Compute filename of FILE.
69915f2201421a23fbf95840adf524cfdb4db384b85Cristy#             value retuned in "$func_basename_result"
70015f2201421a23fbf95840adf524cfdb4db384b85Cristy# For efficiency, we do not delegate to the functions above but instead
70115f2201421a23fbf95840adf524cfdb4db384b85Cristy# duplicate the functionality here.
70215f2201421a23fbf95840adf524cfdb4db384b85Cristyeval 'func_dirname_and_basename ()
70315f2201421a23fbf95840adf524cfdb4db384b85Cristy{
70415f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
70515f2201421a23fbf95840adf524cfdb4db384b85Cristy
70615f2201421a23fbf95840adf524cfdb4db384b85Cristy    '"$_b"'
70715f2201421a23fbf95840adf524cfdb4db384b85Cristy    '"$_d"'
70815f2201421a23fbf95840adf524cfdb4db384b85Cristy}'
70915f2201421a23fbf95840adf524cfdb4db384b85Cristy
71015f2201421a23fbf95840adf524cfdb4db384b85Cristy
71115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_echo ARG...
71215f2201421a23fbf95840adf524cfdb4db384b85Cristy# ----------------
71315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo program name prefixed message.
71415f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_echo ()
71515f2201421a23fbf95840adf524cfdb4db384b85Cristy{
71615f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
71715f2201421a23fbf95840adf524cfdb4db384b85Cristy
71815f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_message=$*
71915f2201421a23fbf95840adf524cfdb4db384b85Cristy
72015f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_echo_IFS=$IFS
72115f2201421a23fbf95840adf524cfdb4db384b85Cristy    IFS=$nl
72215f2201421a23fbf95840adf524cfdb4db384b85Cristy    for _G_line in $_G_message; do
72315f2201421a23fbf95840adf524cfdb4db384b85Cristy      IFS=$func_echo_IFS
72415f2201421a23fbf95840adf524cfdb4db384b85Cristy      $ECHO "$progname: $_G_line"
72515f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
72615f2201421a23fbf95840adf524cfdb4db384b85Cristy    IFS=$func_echo_IFS
72715f2201421a23fbf95840adf524cfdb4db384b85Cristy}
72815f2201421a23fbf95840adf524cfdb4db384b85Cristy
72915f2201421a23fbf95840adf524cfdb4db384b85Cristy
73015f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_echo_all ARG...
73115f2201421a23fbf95840adf524cfdb4db384b85Cristy# --------------------
73215f2201421a23fbf95840adf524cfdb4db384b85Cristy# Invoke $ECHO with all args, space-separated.
73315f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_echo_all ()
73415f2201421a23fbf95840adf524cfdb4db384b85Cristy{
73515f2201421a23fbf95840adf524cfdb4db384b85Cristy    $ECHO "$*"
73615f2201421a23fbf95840adf524cfdb4db384b85Cristy}
73715f2201421a23fbf95840adf524cfdb4db384b85Cristy
73815f2201421a23fbf95840adf524cfdb4db384b85Cristy
73915f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_echo_infix_1 INFIX ARG...
74015f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------------------
74115f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo program name, followed by INFIX on the first line, with any
74215f2201421a23fbf95840adf524cfdb4db384b85Cristy# additional lines not showing INFIX.
74315f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_echo_infix_1 ()
74415f2201421a23fbf95840adf524cfdb4db384b85Cristy{
74515f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
74615f2201421a23fbf95840adf524cfdb4db384b85Cristy
74715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $require_term_colors
74815f2201421a23fbf95840adf524cfdb4db384b85Cristy
74915f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_infix=$1; shift
75015f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_indent=$_G_infix
75115f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_prefix="$progname: $_G_infix: "
75215f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_message=$*
75315f2201421a23fbf95840adf524cfdb4db384b85Cristy
75415f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Strip color escape sequences before counting printable length
75515f2201421a23fbf95840adf524cfdb4db384b85Cristy    for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
75615f2201421a23fbf95840adf524cfdb4db384b85Cristy    do
75715f2201421a23fbf95840adf524cfdb4db384b85Cristy      test -n "$_G_tc" && {
75815f2201421a23fbf95840adf524cfdb4db384b85Cristy        _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
75915f2201421a23fbf95840adf524cfdb4db384b85Cristy        _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
76015f2201421a23fbf95840adf524cfdb4db384b85Cristy      }
76115f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
76215f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
76315f2201421a23fbf95840adf524cfdb4db384b85Cristy
76415f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_echo_infix_1_IFS=$IFS
76515f2201421a23fbf95840adf524cfdb4db384b85Cristy    IFS=$nl
76615f2201421a23fbf95840adf524cfdb4db384b85Cristy    for _G_line in $_G_message; do
76715f2201421a23fbf95840adf524cfdb4db384b85Cristy      IFS=$func_echo_infix_1_IFS
76815f2201421a23fbf95840adf524cfdb4db384b85Cristy      $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
76915f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_prefix=$_G_indent
77015f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
77115f2201421a23fbf95840adf524cfdb4db384b85Cristy    IFS=$func_echo_infix_1_IFS
77215f2201421a23fbf95840adf524cfdb4db384b85Cristy}
77315f2201421a23fbf95840adf524cfdb4db384b85Cristy
77415f2201421a23fbf95840adf524cfdb4db384b85Cristy
77515f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_error ARG...
77615f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------
77715f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo program name prefixed message to standard error.
77815f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_error ()
77915f2201421a23fbf95840adf524cfdb4db384b85Cristy{
78015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
78115f2201421a23fbf95840adf524cfdb4db384b85Cristy
78215f2201421a23fbf95840adf524cfdb4db384b85Cristy    $require_term_colors
78315f2201421a23fbf95840adf524cfdb4db384b85Cristy
78415f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
78515f2201421a23fbf95840adf524cfdb4db384b85Cristy}
78615f2201421a23fbf95840adf524cfdb4db384b85Cristy
78715f2201421a23fbf95840adf524cfdb4db384b85Cristy
78815f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_fatal_error ARG...
78915f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------------
79015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo program name prefixed message to standard error, and exit.
79115f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_fatal_error ()
79215f2201421a23fbf95840adf524cfdb4db384b85Cristy{
79315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
79415f2201421a23fbf95840adf524cfdb4db384b85Cristy
79515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_error "$*"
79615f2201421a23fbf95840adf524cfdb4db384b85Cristy    exit $EXIT_FAILURE
79715f2201421a23fbf95840adf524cfdb4db384b85Cristy}
79815f2201421a23fbf95840adf524cfdb4db384b85Cristy
79915f2201421a23fbf95840adf524cfdb4db384b85Cristy
80015f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_grep EXPRESSION FILENAME
80115f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------------------
8023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Check whether EXPRESSION matches any line of FILENAME, without output.
8033ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_grep ()
8043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
80515f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
80615f2201421a23fbf95840adf524cfdb4db384b85Cristy
8073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    $GREP "$1" "$2" >/dev/null 2>&1
8083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
8093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
81115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_len STRING
81215f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------
81315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Set func_len_result to the length of STRING. STRING may not
81415f2201421a23fbf95840adf524cfdb4db384b85Cristy# start with a hyphen.
81515f2201421a23fbf95840adf524cfdb4db384b85Cristy  test -z "$_G_HAVE_XSI_OPS" \
81615f2201421a23fbf95840adf524cfdb4db384b85Cristy    && (eval 'x=a/b/c;
81715f2201421a23fbf95840adf524cfdb4db384b85Cristy      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
81815f2201421a23fbf95840adf524cfdb4db384b85Cristy    && _G_HAVE_XSI_OPS=yes
81915f2201421a23fbf95840adf524cfdb4db384b85Cristy
82015f2201421a23fbf95840adf524cfdb4db384b85Cristyif test yes = "$_G_HAVE_XSI_OPS"; then
82115f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'func_len ()
82215f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
82315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
82415f2201421a23fbf95840adf524cfdb4db384b85Cristy
82515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_len_result=${#1}
82615f2201421a23fbf95840adf524cfdb4db384b85Cristy  }'
82715f2201421a23fbf95840adf524cfdb4db384b85Cristyelse
82815f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_len ()
82915f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
83015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
83115f2201421a23fbf95840adf524cfdb4db384b85Cristy
83215f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
83315f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
83415f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
83515f2201421a23fbf95840adf524cfdb4db384b85Cristy
83615f2201421a23fbf95840adf524cfdb4db384b85Cristy
83715f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_mkdir_p DIRECTORY-PATH
83815f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------------
8393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Make sure the entire path to DIRECTORY-PATH is available.
8403ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_mkdir_p ()
8413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
84215f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
8433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
84415f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_directory_path=$1
84515f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_dir_list=
8463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
84715f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
84815f2201421a23fbf95840adf524cfdb4db384b85Cristy
84915f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Protect directory names starting with '-'
85015f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $_G_directory_path in
85115f2201421a23fbf95840adf524cfdb4db384b85Cristy        -*) _G_directory_path=./$_G_directory_path ;;
8523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
8533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # While some portion of DIR does not yet exist...
85515f2201421a23fbf95840adf524cfdb4db384b85Cristy      while test ! -d "$_G_directory_path"; do
8563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        # ...make a list in topmost first order.  Use a colon delimited
8573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# list incase some portion of path contains whitespace.
85815f2201421a23fbf95840adf524cfdb4db384b85Cristy        _G_dir_list=$_G_directory_path:$_G_dir_list
8593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        # If the last portion added has no slash in it, the list is done
86115f2201421a23fbf95840adf524cfdb4db384b85Cristy        case $_G_directory_path in */*) ;; *) break ;; esac
8623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        # ...otherwise throw away the child directory and loop
86415f2201421a23fbf95840adf524cfdb4db384b85Cristy        _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
8653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
86615f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
8673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
86815f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_mkdir_p_IFS=$IFS; IFS=:
86915f2201421a23fbf95840adf524cfdb4db384b85Cristy      for _G_dir in $_G_dir_list; do
87015f2201421a23fbf95840adf524cfdb4db384b85Cristy	IFS=$func_mkdir_p_IFS
87115f2201421a23fbf95840adf524cfdb4db384b85Cristy        # mkdir can fail with a 'File exist' error if two processes
8723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        # try to create one of the directories concurrently.  Don't
8733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        # stop in that case!
87415f2201421a23fbf95840adf524cfdb4db384b85Cristy        $MKDIR "$_G_dir" 2>/dev/null || :
8753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
87615f2201421a23fbf95840adf524cfdb4db384b85Cristy      IFS=$func_mkdir_p_IFS
8773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Bail out if we (or some other process) failed to create a directory.
87915f2201421a23fbf95840adf524cfdb4db384b85Cristy      test -d "$_G_directory_path" || \
88015f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_fatal_error "Failed to create '$1'"
8813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
8823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
8833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
88515f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_mktempdir [BASENAME]
88615f2201421a23fbf95840adf524cfdb4db384b85Cristy# -------------------------
8873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Make a temporary directory that won't clash with other running
8883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# libtool processes, and avoids race conditions if possible.  If
88915f2201421a23fbf95840adf524cfdb4db384b85Cristy# given, BASENAME is the basename for that directory.
8903ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_mktempdir ()
8913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
89215f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
89315f2201421a23fbf95840adf524cfdb4db384b85Cristy
89415f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_template=${TMPDIR-/tmp}/${1-$progname}
8953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89615f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test : = "$opt_dry_run"; then
8973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Return a directory name, but don't create it in dry-run mode
89815f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_tmpdir=$_G_template-$$
8993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
9003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
9013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # If mktemp works, use that first and foremost
90215f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
9033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90415f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test ! -d "$_G_tmpdir"; then
9053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        # Failing that, at least try and use $RANDOM to avoid a race
90615f2201421a23fbf95840adf524cfdb4db384b85Cristy        _G_tmpdir=$_G_template-${RANDOM-0}$$
9073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90815f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_mktempdir_umask=`umask`
9093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        umask 0077
91015f2201421a23fbf95840adf524cfdb4db384b85Cristy        $MKDIR "$_G_tmpdir"
91115f2201421a23fbf95840adf524cfdb4db384b85Cristy        umask $func_mktempdir_umask
9123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
9133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
9143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # If we're not in dry-run mode, bomb out on failure
91515f2201421a23fbf95840adf524cfdb4db384b85Cristy      test -d "$_G_tmpdir" || \
91615f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
91715f2201421a23fbf95840adf524cfdb4db384b85Cristy    fi
91815f2201421a23fbf95840adf524cfdb4db384b85Cristy
91915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $ECHO "$_G_tmpdir"
92015f2201421a23fbf95840adf524cfdb4db384b85Cristy}
92115f2201421a23fbf95840adf524cfdb4db384b85Cristy
92215f2201421a23fbf95840adf524cfdb4db384b85Cristy
92315f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_normal_abspath PATH
92415f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------------
92515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Remove doubled-up and trailing slashes, "." path components,
92615f2201421a23fbf95840adf524cfdb4db384b85Cristy# and cancel out any ".." path components in PATH after making
92715f2201421a23fbf95840adf524cfdb4db384b85Cristy# it an absolute path.
92815f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_normal_abspath ()
92915f2201421a23fbf95840adf524cfdb4db384b85Cristy{
93015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
93115f2201421a23fbf95840adf524cfdb4db384b85Cristy
93215f2201421a23fbf95840adf524cfdb4db384b85Cristy    # These SED scripts presuppose an absolute path with a trailing slash.
93315f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_pathcar='s|^/\([^/]*\).*$|\1|'
93415f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_pathcdr='s|^/[^/]*||'
93515f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_removedotparts=':dotsl
93615f2201421a23fbf95840adf524cfdb4db384b85Cristy		s|/\./|/|g
93715f2201421a23fbf95840adf524cfdb4db384b85Cristy		t dotsl
93815f2201421a23fbf95840adf524cfdb4db384b85Cristy		s|/\.$|/|'
93915f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_collapseslashes='s|/\{1,\}|/|g'
94015f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_finalslash='s|/*$|/|'
94115f2201421a23fbf95840adf524cfdb4db384b85Cristy
94215f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Start from root dir and reassemble the path.
94315f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_normal_abspath_result=
94415f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_normal_abspath_tpath=$1
94515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_normal_abspath_altnamespace=
94615f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $func_normal_abspath_tpath in
94715f2201421a23fbf95840adf524cfdb4db384b85Cristy      "")
94815f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Empty path, that just means $cwd.
94915f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_stripname '' '/' "`pwd`"
95015f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_normal_abspath_result=$func_stripname_result
95115f2201421a23fbf95840adf524cfdb4db384b85Cristy        return
95215f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
95315f2201421a23fbf95840adf524cfdb4db384b85Cristy      # The next three entries are used to spot a run of precisely
95415f2201421a23fbf95840adf524cfdb4db384b85Cristy      # two leading slashes without using negated character classes;
95515f2201421a23fbf95840adf524cfdb4db384b85Cristy      # we take advantage of case's first-match behaviour.
95615f2201421a23fbf95840adf524cfdb4db384b85Cristy      ///*)
95715f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Unusual form of absolute path, do nothing.
95815f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
95915f2201421a23fbf95840adf524cfdb4db384b85Cristy      //*)
96015f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Not necessarily an ordinary path; POSIX reserves leading '//'
96115f2201421a23fbf95840adf524cfdb4db384b85Cristy        # and for example Cygwin uses it to access remote file shares
96215f2201421a23fbf95840adf524cfdb4db384b85Cristy        # over CIFS/SMB, so we conserve a leading double slash if found.
96315f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_normal_abspath_altnamespace=/
96415f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
96515f2201421a23fbf95840adf524cfdb4db384b85Cristy      /*)
96615f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Absolute path, do nothing.
96715f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
96815f2201421a23fbf95840adf524cfdb4db384b85Cristy      *)
96915f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Relative path, prepend $cwd.
97015f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
97115f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
97215f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
97315f2201421a23fbf95840adf524cfdb4db384b85Cristy
97415f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Cancel out all the simple stuff to save iterations.  We also want
97515f2201421a23fbf95840adf524cfdb4db384b85Cristy    # the path to end with a slash for ease of parsing, so make sure
97615f2201421a23fbf95840adf524cfdb4db384b85Cristy    # there is one (and only one) here.
97715f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
97815f2201421a23fbf95840adf524cfdb4db384b85Cristy          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
97915f2201421a23fbf95840adf524cfdb4db384b85Cristy    while :; do
98015f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Processed it all yet?
98115f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test / = "$func_normal_abspath_tpath"; then
98215f2201421a23fbf95840adf524cfdb4db384b85Cristy        # If we ascended to the root using ".." the result may be empty now.
98315f2201421a23fbf95840adf524cfdb4db384b85Cristy        if test -z "$func_normal_abspath_result"; then
98415f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_normal_abspath_result=/
98515f2201421a23fbf95840adf524cfdb4db384b85Cristy        fi
98615f2201421a23fbf95840adf524cfdb4db384b85Cristy        break
98715f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
98815f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
98915f2201421a23fbf95840adf524cfdb4db384b85Cristy          -e "$_G_pathcar"`
99015f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
99115f2201421a23fbf95840adf524cfdb4db384b85Cristy          -e "$_G_pathcdr"`
99215f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Figure out what to do with it
99315f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $func_normal_abspath_tcomponent in
99415f2201421a23fbf95840adf524cfdb4db384b85Cristy        "")
99515f2201421a23fbf95840adf524cfdb4db384b85Cristy          # Trailing empty path component, ignore it.
99615f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
99715f2201421a23fbf95840adf524cfdb4db384b85Cristy        ..)
99815f2201421a23fbf95840adf524cfdb4db384b85Cristy          # Parent dir; strip last assembled component from result.
99915f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_dirname "$func_normal_abspath_result"
100015f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_normal_abspath_result=$func_dirname_result
100115f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
100215f2201421a23fbf95840adf524cfdb4db384b85Cristy        *)
100315f2201421a23fbf95840adf524cfdb4db384b85Cristy          # Actual path component, append it.
100415f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
100515f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
100615f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
100715f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
100815f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Restore leading double-slash if one was found on entry.
100915f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
101015f2201421a23fbf95840adf524cfdb4db384b85Cristy}
101115f2201421a23fbf95840adf524cfdb4db384b85Cristy
101215f2201421a23fbf95840adf524cfdb4db384b85Cristy
101315f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_notquiet ARG...
101415f2201421a23fbf95840adf524cfdb4db384b85Cristy# --------------------
101515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo program name prefixed message only when not in quiet mode.
101615f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_notquiet ()
101715f2201421a23fbf95840adf524cfdb4db384b85Cristy{
101815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
101915f2201421a23fbf95840adf524cfdb4db384b85Cristy
102015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $opt_quiet || func_echo ${1+"$@"}
102115f2201421a23fbf95840adf524cfdb4db384b85Cristy
102215f2201421a23fbf95840adf524cfdb4db384b85Cristy    # A bug in bash halts the script if the last line of a function
102315f2201421a23fbf95840adf524cfdb4db384b85Cristy    # fails when set -e is in force, so we need another command to
102415f2201421a23fbf95840adf524cfdb4db384b85Cristy    # work around that:
102515f2201421a23fbf95840adf524cfdb4db384b85Cristy    :
102615f2201421a23fbf95840adf524cfdb4db384b85Cristy}
102715f2201421a23fbf95840adf524cfdb4db384b85Cristy
102815f2201421a23fbf95840adf524cfdb4db384b85Cristy
102915f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_relative_path SRCDIR DSTDIR
103015f2201421a23fbf95840adf524cfdb4db384b85Cristy# --------------------------------
103115f2201421a23fbf95840adf524cfdb4db384b85Cristy# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
103215f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_relative_path ()
103315f2201421a23fbf95840adf524cfdb4db384b85Cristy{
103415f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
103515f2201421a23fbf95840adf524cfdb4db384b85Cristy
103615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_relative_path_result=
103715f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_normal_abspath "$1"
103815f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_relative_path_tlibdir=$func_normal_abspath_result
103915f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_normal_abspath "$2"
104015f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_relative_path_tbindir=$func_normal_abspath_result
104115f2201421a23fbf95840adf524cfdb4db384b85Cristy
104215f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Ascend the tree starting from libdir
104315f2201421a23fbf95840adf524cfdb4db384b85Cristy    while :; do
104415f2201421a23fbf95840adf524cfdb4db384b85Cristy      # check if we have found a prefix of bindir
104515f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $func_relative_path_tbindir in
104615f2201421a23fbf95840adf524cfdb4db384b85Cristy        $func_relative_path_tlibdir)
104715f2201421a23fbf95840adf524cfdb4db384b85Cristy          # found an exact match
104815f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_relative_path_tcancelled=
104915f2201421a23fbf95840adf524cfdb4db384b85Cristy          break
105015f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
105115f2201421a23fbf95840adf524cfdb4db384b85Cristy        $func_relative_path_tlibdir*)
105215f2201421a23fbf95840adf524cfdb4db384b85Cristy          # found a matching prefix
105315f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
105415f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_relative_path_tcancelled=$func_stripname_result
105515f2201421a23fbf95840adf524cfdb4db384b85Cristy          if test -z "$func_relative_path_result"; then
105615f2201421a23fbf95840adf524cfdb4db384b85Cristy            func_relative_path_result=.
105715f2201421a23fbf95840adf524cfdb4db384b85Cristy          fi
105815f2201421a23fbf95840adf524cfdb4db384b85Cristy          break
105915f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
106015f2201421a23fbf95840adf524cfdb4db384b85Cristy        *)
106115f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_dirname $func_relative_path_tlibdir
106215f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_relative_path_tlibdir=$func_dirname_result
106315f2201421a23fbf95840adf524cfdb4db384b85Cristy          if test -z "$func_relative_path_tlibdir"; then
106415f2201421a23fbf95840adf524cfdb4db384b85Cristy            # Have to descend all the way to the root!
106515f2201421a23fbf95840adf524cfdb4db384b85Cristy            func_relative_path_result=../$func_relative_path_result
106615f2201421a23fbf95840adf524cfdb4db384b85Cristy            func_relative_path_tcancelled=$func_relative_path_tbindir
106715f2201421a23fbf95840adf524cfdb4db384b85Cristy            break
106815f2201421a23fbf95840adf524cfdb4db384b85Cristy          fi
106915f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_relative_path_result=../$func_relative_path_result
107015f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
107115f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
107215f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
107315f2201421a23fbf95840adf524cfdb4db384b85Cristy
107415f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Now calculate path; take care to avoid doubling-up slashes.
107515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_stripname '' '/' "$func_relative_path_result"
107615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_relative_path_result=$func_stripname_result
107715f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_stripname '/' '/' "$func_relative_path_tcancelled"
107815f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test -n "$func_stripname_result"; then
107915f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_append func_relative_path_result "/$func_stripname_result"
108015f2201421a23fbf95840adf524cfdb4db384b85Cristy    fi
108115f2201421a23fbf95840adf524cfdb4db384b85Cristy
108215f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Normalisation. If bindir is libdir, return '.' else relative path.
108315f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test -n "$func_relative_path_result"; then
108415f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_stripname './' '' "$func_relative_path_result"
108515f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_relative_path_result=$func_stripname_result
10863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
10873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
108815f2201421a23fbf95840adf524cfdb4db384b85Cristy    test -n "$func_relative_path_result" || func_relative_path_result=.
108915f2201421a23fbf95840adf524cfdb4db384b85Cristy
109015f2201421a23fbf95840adf524cfdb4db384b85Cristy    :
109115f2201421a23fbf95840adf524cfdb4db384b85Cristy}
109215f2201421a23fbf95840adf524cfdb4db384b85Cristy
109315f2201421a23fbf95840adf524cfdb4db384b85Cristy
109415f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_quote_for_eval ARG...
109515f2201421a23fbf95840adf524cfdb4db384b85Cristy# --------------------------
109615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Aesthetically quote ARGs to be evaled later.
109715f2201421a23fbf95840adf524cfdb4db384b85Cristy# This function returns two values:
109815f2201421a23fbf95840adf524cfdb4db384b85Cristy#   i) func_quote_for_eval_result
109915f2201421a23fbf95840adf524cfdb4db384b85Cristy#      double-quoted, suitable for a subsequent eval
110015f2201421a23fbf95840adf524cfdb4db384b85Cristy#  ii) func_quote_for_eval_unquoted_result
110115f2201421a23fbf95840adf524cfdb4db384b85Cristy#      has all characters that are still active within double
110215f2201421a23fbf95840adf524cfdb4db384b85Cristy#      quotes backslashified.
110315f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_quote_for_eval ()
110415f2201421a23fbf95840adf524cfdb4db384b85Cristy{
110515f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
110615f2201421a23fbf95840adf524cfdb4db384b85Cristy
110715f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_eval_unquoted_result=
110815f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_eval_result=
110915f2201421a23fbf95840adf524cfdb4db384b85Cristy    while test 0 -lt $#; do
111015f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $1 in
111115f2201421a23fbf95840adf524cfdb4db384b85Cristy        *[\\\`\"\$]*)
111215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
111315f2201421a23fbf95840adf524cfdb4db384b85Cristy        *)
111415f2201421a23fbf95840adf524cfdb4db384b85Cristy          _G_unquoted_arg=$1 ;;
111515f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
111615f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$func_quote_for_eval_unquoted_result"; then
111715f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
111815f2201421a23fbf95840adf524cfdb4db384b85Cristy      else
111915f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
112015f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
112115f2201421a23fbf95840adf524cfdb4db384b85Cristy
112215f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $_G_unquoted_arg in
112315f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Double-quote args containing shell metacharacters to delay
112415f2201421a23fbf95840adf524cfdb4db384b85Cristy        # word splitting, command substitution and variable expansion
112515f2201421a23fbf95840adf524cfdb4db384b85Cristy        # for a subsequent eval.
112615f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Many Bourne shells cannot handle close brackets correctly
112715f2201421a23fbf95840adf524cfdb4db384b85Cristy        # in scan sets, so we specify it separately.
112815f2201421a23fbf95840adf524cfdb4db384b85Cristy        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
112915f2201421a23fbf95840adf524cfdb4db384b85Cristy          _G_quoted_arg=\"$_G_unquoted_arg\"
113015f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
113115f2201421a23fbf95840adf524cfdb4db384b85Cristy        *)
113215f2201421a23fbf95840adf524cfdb4db384b85Cristy          _G_quoted_arg=$_G_unquoted_arg
113315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  ;;
113415f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
113515f2201421a23fbf95840adf524cfdb4db384b85Cristy
113615f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$func_quote_for_eval_result"; then
113715f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_append func_quote_for_eval_result " $_G_quoted_arg"
113815f2201421a23fbf95840adf524cfdb4db384b85Cristy      else
113915f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_append func_quote_for_eval_result "$_G_quoted_arg"
114015f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
114115f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift
114215f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
114315f2201421a23fbf95840adf524cfdb4db384b85Cristy}
114415f2201421a23fbf95840adf524cfdb4db384b85Cristy
114515f2201421a23fbf95840adf524cfdb4db384b85Cristy
114615f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_quote_for_expand ARG
114715f2201421a23fbf95840adf524cfdb4db384b85Cristy# -------------------------
114815f2201421a23fbf95840adf524cfdb4db384b85Cristy# Aesthetically quote ARG to be evaled later; same as above,
114915f2201421a23fbf95840adf524cfdb4db384b85Cristy# but do not quote variable references.
115015f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_quote_for_expand ()
115115f2201421a23fbf95840adf524cfdb4db384b85Cristy{
115215f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
115315f2201421a23fbf95840adf524cfdb4db384b85Cristy
115415f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $1 in
115515f2201421a23fbf95840adf524cfdb4db384b85Cristy      *[\\\`\"]*)
115615f2201421a23fbf95840adf524cfdb4db384b85Cristy	_G_arg=`$ECHO "$1" | $SED \
115715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
115815f2201421a23fbf95840adf524cfdb4db384b85Cristy      *)
115915f2201421a23fbf95840adf524cfdb4db384b85Cristy        _G_arg=$1 ;;
116015f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
116115f2201421a23fbf95840adf524cfdb4db384b85Cristy
116215f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $_G_arg in
116315f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Double-quote args containing shell metacharacters to delay
116415f2201421a23fbf95840adf524cfdb4db384b85Cristy      # word splitting and command substitution for a subsequent eval.
116515f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Many Bourne shells cannot handle close brackets correctly
116615f2201421a23fbf95840adf524cfdb4db384b85Cristy      # in scan sets, so we specify it separately.
116715f2201421a23fbf95840adf524cfdb4db384b85Cristy      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
116815f2201421a23fbf95840adf524cfdb4db384b85Cristy        _G_arg=\"$_G_arg\"
116915f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
117015f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
117115f2201421a23fbf95840adf524cfdb4db384b85Cristy
117215f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_expand_result=$_G_arg
117315f2201421a23fbf95840adf524cfdb4db384b85Cristy}
117415f2201421a23fbf95840adf524cfdb4db384b85Cristy
117515f2201421a23fbf95840adf524cfdb4db384b85Cristy
117615f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_stripname PREFIX SUFFIX NAME
117715f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------------------
117815f2201421a23fbf95840adf524cfdb4db384b85Cristy# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
117915f2201421a23fbf95840adf524cfdb4db384b85Cristy# PREFIX and SUFFIX must not contain globbing or regex special
118015f2201421a23fbf95840adf524cfdb4db384b85Cristy# characters, hashes, percent signs, but SUFFIX may contain a leading
118115f2201421a23fbf95840adf524cfdb4db384b85Cristy# dot (in which case that matches only a dot).
118215f2201421a23fbf95840adf524cfdb4db384b85Cristyif test yes = "$_G_HAVE_XSI_OPS"; then
118315f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'func_stripname ()
118415f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
118515f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
118615f2201421a23fbf95840adf524cfdb4db384b85Cristy
118715f2201421a23fbf95840adf524cfdb4db384b85Cristy    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
118815f2201421a23fbf95840adf524cfdb4db384b85Cristy    # positional parameters, so assign one to ordinary variable first.
118915f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_stripname_result=$3
119015f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_stripname_result=${func_stripname_result#"$1"}
119115f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_stripname_result=${func_stripname_result%"$2"}
119215f2201421a23fbf95840adf524cfdb4db384b85Cristy  }'
119315f2201421a23fbf95840adf524cfdb4db384b85Cristyelse
119415f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_stripname ()
119515f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
119615f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
119715f2201421a23fbf95840adf524cfdb4db384b85Cristy
119815f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $2 in
119915f2201421a23fbf95840adf524cfdb4db384b85Cristy      .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
120015f2201421a23fbf95840adf524cfdb4db384b85Cristy      *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
120115f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
120215f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
120315f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
120415f2201421a23fbf95840adf524cfdb4db384b85Cristy
120515f2201421a23fbf95840adf524cfdb4db384b85Cristy
120615f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_show_eval CMD [FAIL_EXP]
120715f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------------------
120815f2201421a23fbf95840adf524cfdb4db384b85Cristy# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
120915f2201421a23fbf95840adf524cfdb4db384b85Cristy# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
121015f2201421a23fbf95840adf524cfdb4db384b85Cristy# is given, then evaluate it.
121115f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_show_eval ()
121215f2201421a23fbf95840adf524cfdb4db384b85Cristy{
121315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
121415f2201421a23fbf95840adf524cfdb4db384b85Cristy
121515f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_cmd=$1
121615f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_fail_exp=${2-':'}
121715f2201421a23fbf95840adf524cfdb4db384b85Cristy
121815f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_expand "$_G_cmd"
121915f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval "func_notquiet $func_quote_for_expand_result"
122015f2201421a23fbf95840adf524cfdb4db384b85Cristy
122115f2201421a23fbf95840adf524cfdb4db384b85Cristy    $opt_dry_run || {
122215f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval "$_G_cmd"
122315f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_status=$?
122415f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test 0 -ne "$_G_status"; then
122515f2201421a23fbf95840adf524cfdb4db384b85Cristy	eval "(exit $_G_status); $_G_fail_exp"
122615f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
122715f2201421a23fbf95840adf524cfdb4db384b85Cristy    }
122815f2201421a23fbf95840adf524cfdb4db384b85Cristy}
122915f2201421a23fbf95840adf524cfdb4db384b85Cristy
123015f2201421a23fbf95840adf524cfdb4db384b85Cristy
123115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_show_eval_locale CMD [FAIL_EXP]
123215f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------------------------
123315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
123415f2201421a23fbf95840adf524cfdb4db384b85Cristy# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
123515f2201421a23fbf95840adf524cfdb4db384b85Cristy# is given, then evaluate it.  Use the saved locale for evaluation.
123615f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_show_eval_locale ()
123715f2201421a23fbf95840adf524cfdb4db384b85Cristy{
123815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
123915f2201421a23fbf95840adf524cfdb4db384b85Cristy
124015f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_cmd=$1
124115f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_fail_exp=${2-':'}
124215f2201421a23fbf95840adf524cfdb4db384b85Cristy
124315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $opt_quiet || {
124415f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_quote_for_expand "$_G_cmd"
124515f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval "func_echo $func_quote_for_expand_result"
124615f2201421a23fbf95840adf524cfdb4db384b85Cristy    }
124715f2201421a23fbf95840adf524cfdb4db384b85Cristy
124815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $opt_dry_run || {
124915f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval "$_G_user_locale
125015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    $_G_cmd"
125115f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_status=$?
125215f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval "$_G_safe_locale"
125315f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test 0 -ne "$_G_status"; then
125415f2201421a23fbf95840adf524cfdb4db384b85Cristy	eval "(exit $_G_status); $_G_fail_exp"
125515f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
125615f2201421a23fbf95840adf524cfdb4db384b85Cristy    }
125715f2201421a23fbf95840adf524cfdb4db384b85Cristy}
125815f2201421a23fbf95840adf524cfdb4db384b85Cristy
125915f2201421a23fbf95840adf524cfdb4db384b85Cristy
126015f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_tr_sh
126115f2201421a23fbf95840adf524cfdb4db384b85Cristy# ----------
126215f2201421a23fbf95840adf524cfdb4db384b85Cristy# Turn $1 into a string suitable for a shell variable name.
126315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Result is stored in $func_tr_sh_result.  All characters
126415f2201421a23fbf95840adf524cfdb4db384b85Cristy# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
126515f2201421a23fbf95840adf524cfdb4db384b85Cristy# if $1 begins with a digit, a '_' is prepended as well.
126615f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_tr_sh ()
126715f2201421a23fbf95840adf524cfdb4db384b85Cristy{
126815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
126915f2201421a23fbf95840adf524cfdb4db384b85Cristy
127015f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $1 in
127115f2201421a23fbf95840adf524cfdb4db384b85Cristy    [0-9]* | *[!a-zA-Z0-9_]*)
127215f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
127315f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
127415f2201421a23fbf95840adf524cfdb4db384b85Cristy    * )
127515f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_tr_sh_result=$1
127615f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
127715f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
127815f2201421a23fbf95840adf524cfdb4db384b85Cristy}
127915f2201421a23fbf95840adf524cfdb4db384b85Cristy
128015f2201421a23fbf95840adf524cfdb4db384b85Cristy
128115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_verbose ARG...
128215f2201421a23fbf95840adf524cfdb4db384b85Cristy# -------------------
128315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo program name prefixed message in verbose mode only.
128415f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_verbose ()
128515f2201421a23fbf95840adf524cfdb4db384b85Cristy{
128615f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
128715f2201421a23fbf95840adf524cfdb4db384b85Cristy
128815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $opt_verbose && func_echo "$*"
128915f2201421a23fbf95840adf524cfdb4db384b85Cristy
129015f2201421a23fbf95840adf524cfdb4db384b85Cristy    :
129115f2201421a23fbf95840adf524cfdb4db384b85Cristy}
129215f2201421a23fbf95840adf524cfdb4db384b85Cristy
129315f2201421a23fbf95840adf524cfdb4db384b85Cristy
129415f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_warn_and_continue ARG...
129515f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------------------
129615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo program name prefixed warning message to standard error.
129715f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_warn_and_continue ()
129815f2201421a23fbf95840adf524cfdb4db384b85Cristy{
129915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
130015f2201421a23fbf95840adf524cfdb4db384b85Cristy
130115f2201421a23fbf95840adf524cfdb4db384b85Cristy    $require_term_colors
130215f2201421a23fbf95840adf524cfdb4db384b85Cristy
130315f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
130415f2201421a23fbf95840adf524cfdb4db384b85Cristy}
130515f2201421a23fbf95840adf524cfdb4db384b85Cristy
130615f2201421a23fbf95840adf524cfdb4db384b85Cristy
130715f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_warning CATEGORY ARG...
130815f2201421a23fbf95840adf524cfdb4db384b85Cristy# ----------------------------
130915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo program name prefixed warning message to standard error. Warning
131015f2201421a23fbf95840adf524cfdb4db384b85Cristy# messages can be filtered according to CATEGORY, where this function
131115f2201421a23fbf95840adf524cfdb4db384b85Cristy# elides messages where CATEGORY is not listed in the global variable
131215f2201421a23fbf95840adf524cfdb4db384b85Cristy# 'opt_warning_types'.
131315f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_warning ()
131415f2201421a23fbf95840adf524cfdb4db384b85Cristy{
131515f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
131615f2201421a23fbf95840adf524cfdb4db384b85Cristy
131715f2201421a23fbf95840adf524cfdb4db384b85Cristy    # CATEGORY must be in the warning_categories list!
131815f2201421a23fbf95840adf524cfdb4db384b85Cristy    case " $warning_categories " in
131915f2201421a23fbf95840adf524cfdb4db384b85Cristy      *" $1 "*) ;;
132015f2201421a23fbf95840adf524cfdb4db384b85Cristy      *) func_internal_error "invalid warning category '$1'" ;;
132115f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
132215f2201421a23fbf95840adf524cfdb4db384b85Cristy
132315f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_category=$1
132415f2201421a23fbf95840adf524cfdb4db384b85Cristy    shift
132515f2201421a23fbf95840adf524cfdb4db384b85Cristy
132615f2201421a23fbf95840adf524cfdb4db384b85Cristy    case " $opt_warning_types " in
132715f2201421a23fbf95840adf524cfdb4db384b85Cristy      *" $_G_category "*) $warning_func ${1+"$@"} ;;
132815f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
132915f2201421a23fbf95840adf524cfdb4db384b85Cristy}
133015f2201421a23fbf95840adf524cfdb4db384b85Cristy
133115f2201421a23fbf95840adf524cfdb4db384b85Cristy
133215f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_sort_ver VER1 VER2
133315f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------------
133415f2201421a23fbf95840adf524cfdb4db384b85Cristy# 'sort -V' is not generally available.
133515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Note this deviates from the version comparison in automake
133615f2201421a23fbf95840adf524cfdb4db384b85Cristy# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
133715f2201421a23fbf95840adf524cfdb4db384b85Cristy# but this should suffice as we won't be specifying old
133815f2201421a23fbf95840adf524cfdb4db384b85Cristy# version formats or redundant trailing .0 in bootstrap.conf.
133915f2201421a23fbf95840adf524cfdb4db384b85Cristy# If we did want full compatibility then we should probably
134015f2201421a23fbf95840adf524cfdb4db384b85Cristy# use m4_version_compare from autoconf.
134115f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_sort_ver ()
134215f2201421a23fbf95840adf524cfdb4db384b85Cristy{
134315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
134415f2201421a23fbf95840adf524cfdb4db384b85Cristy
134515f2201421a23fbf95840adf524cfdb4db384b85Cristy    printf '%s\n%s\n' "$1" "$2" \
134615f2201421a23fbf95840adf524cfdb4db384b85Cristy      | 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
134715f2201421a23fbf95840adf524cfdb4db384b85Cristy}
134815f2201421a23fbf95840adf524cfdb4db384b85Cristy
134915f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_lt_ver PREV CURR
135015f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------
135115f2201421a23fbf95840adf524cfdb4db384b85Cristy# Return true if PREV and CURR are in the correct order according to
135215f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_sort_ver, otherwise false.  Use it like this:
135315f2201421a23fbf95840adf524cfdb4db384b85Cristy#
135415f2201421a23fbf95840adf524cfdb4db384b85Cristy#  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
135515f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_lt_ver ()
135615f2201421a23fbf95840adf524cfdb4db384b85Cristy{
135715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
135815f2201421a23fbf95840adf524cfdb4db384b85Cristy
135915f2201421a23fbf95840adf524cfdb4db384b85Cristy    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
136015f2201421a23fbf95840adf524cfdb4db384b85Cristy}
136115f2201421a23fbf95840adf524cfdb4db384b85Cristy
136215f2201421a23fbf95840adf524cfdb4db384b85Cristy
136315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Local variables:
136415f2201421a23fbf95840adf524cfdb4db384b85Cristy# mode: shell-script
136515f2201421a23fbf95840adf524cfdb4db384b85Cristy# sh-indentation: 2
136615f2201421a23fbf95840adf524cfdb4db384b85Cristy# eval: (add-hook 'before-save-hook 'time-stamp)
136715f2201421a23fbf95840adf524cfdb4db384b85Cristy# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
136815f2201421a23fbf95840adf524cfdb4db384b85Cristy# time-stamp-time-zone: "UTC"
136915f2201421a23fbf95840adf524cfdb4db384b85Cristy# End:
137015f2201421a23fbf95840adf524cfdb4db384b85Cristy#! /bin/sh
137115f2201421a23fbf95840adf524cfdb4db384b85Cristy
137215f2201421a23fbf95840adf524cfdb4db384b85Cristy# Set a version string for this script.
137315f2201421a23fbf95840adf524cfdb4db384b85Cristyscriptversion=2014-01-07.03; # UTC
137415f2201421a23fbf95840adf524cfdb4db384b85Cristy
137515f2201421a23fbf95840adf524cfdb4db384b85Cristy# A portable, pluggable option parser for Bourne shell.
137615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Written by Gary V. Vaughan, 2010
137715f2201421a23fbf95840adf524cfdb4db384b85Cristy
137815f2201421a23fbf95840adf524cfdb4db384b85Cristy# Copyright (C) 2010-2015 Free Software Foundation, Inc.
137915f2201421a23fbf95840adf524cfdb4db384b85Cristy# This is free software; see the source for copying conditions.  There is NO
138015f2201421a23fbf95840adf524cfdb4db384b85Cristy# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
138115f2201421a23fbf95840adf524cfdb4db384b85Cristy
138215f2201421a23fbf95840adf524cfdb4db384b85Cristy# This program is free software: you can redistribute it and/or modify
138315f2201421a23fbf95840adf524cfdb4db384b85Cristy# it under the terms of the GNU General Public License as published by
138415f2201421a23fbf95840adf524cfdb4db384b85Cristy# the Free Software Foundation, either version 3 of the License, or
138515f2201421a23fbf95840adf524cfdb4db384b85Cristy# (at your option) any later version.
138615f2201421a23fbf95840adf524cfdb4db384b85Cristy
138715f2201421a23fbf95840adf524cfdb4db384b85Cristy# This program is distributed in the hope that it will be useful,
138815f2201421a23fbf95840adf524cfdb4db384b85Cristy# but WITHOUT ANY WARRANTY; without even the implied warranty of
138915f2201421a23fbf95840adf524cfdb4db384b85Cristy# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
139015f2201421a23fbf95840adf524cfdb4db384b85Cristy# GNU General Public License for more details.
139115f2201421a23fbf95840adf524cfdb4db384b85Cristy
139215f2201421a23fbf95840adf524cfdb4db384b85Cristy# You should have received a copy of the GNU General Public License
139315f2201421a23fbf95840adf524cfdb4db384b85Cristy# along with this program.  If not, see <http://www.gnu.org/licenses/>.
139415f2201421a23fbf95840adf524cfdb4db384b85Cristy
139515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Please report bugs or propose patches to gary@gnu.org.
139615f2201421a23fbf95840adf524cfdb4db384b85Cristy
139715f2201421a23fbf95840adf524cfdb4db384b85Cristy
139815f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------ ##
139915f2201421a23fbf95840adf524cfdb4db384b85Cristy## Usage. ##
140015f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------ ##
140115f2201421a23fbf95840adf524cfdb4db384b85Cristy
140215f2201421a23fbf95840adf524cfdb4db384b85Cristy# This file is a library for parsing options in your shell scripts along
140315f2201421a23fbf95840adf524cfdb4db384b85Cristy# with assorted other useful supporting features that you can make use
140415f2201421a23fbf95840adf524cfdb4db384b85Cristy# of too.
140515f2201421a23fbf95840adf524cfdb4db384b85Cristy#
140615f2201421a23fbf95840adf524cfdb4db384b85Cristy# For the simplest scripts you might need only:
140715f2201421a23fbf95840adf524cfdb4db384b85Cristy#
140815f2201421a23fbf95840adf524cfdb4db384b85Cristy#   #!/bin/sh
140915f2201421a23fbf95840adf524cfdb4db384b85Cristy#   . relative/path/to/funclib.sh
141015f2201421a23fbf95840adf524cfdb4db384b85Cristy#   . relative/path/to/options-parser
141115f2201421a23fbf95840adf524cfdb4db384b85Cristy#   scriptversion=1.0
141215f2201421a23fbf95840adf524cfdb4db384b85Cristy#   func_options ${1+"$@"}
141315f2201421a23fbf95840adf524cfdb4db384b85Cristy#   eval set dummy "$func_options_result"; shift
141415f2201421a23fbf95840adf524cfdb4db384b85Cristy#   ...rest of your script...
141515f2201421a23fbf95840adf524cfdb4db384b85Cristy#
141615f2201421a23fbf95840adf524cfdb4db384b85Cristy# In order for the '--version' option to work, you will need to have a
141715f2201421a23fbf95840adf524cfdb4db384b85Cristy# suitably formatted comment like the one at the top of this file
141815f2201421a23fbf95840adf524cfdb4db384b85Cristy# starting with '# Written by ' and ending with '# warranty; '.
141915f2201421a23fbf95840adf524cfdb4db384b85Cristy#
142015f2201421a23fbf95840adf524cfdb4db384b85Cristy# For '-h' and '--help' to work, you will also need a one line
142115f2201421a23fbf95840adf524cfdb4db384b85Cristy# description of your script's purpose in a comment directly above the
142215f2201421a23fbf95840adf524cfdb4db384b85Cristy# '# Written by ' line, like the one at the top of this file.
142315f2201421a23fbf95840adf524cfdb4db384b85Cristy#
142415f2201421a23fbf95840adf524cfdb4db384b85Cristy# The default options also support '--debug', which will turn on shell
142515f2201421a23fbf95840adf524cfdb4db384b85Cristy# execution tracing (see the comment above debug_cmd below for another
142615f2201421a23fbf95840adf524cfdb4db384b85Cristy# use), and '--verbose' and the func_verbose function to allow your script
142715f2201421a23fbf95840adf524cfdb4db384b85Cristy# to display verbose messages only when your user has specified
142815f2201421a23fbf95840adf524cfdb4db384b85Cristy# '--verbose'.
142915f2201421a23fbf95840adf524cfdb4db384b85Cristy#
143015f2201421a23fbf95840adf524cfdb4db384b85Cristy# After sourcing this file, you can plug processing for additional
143115f2201421a23fbf95840adf524cfdb4db384b85Cristy# options by amending the variables from the 'Configuration' section
143215f2201421a23fbf95840adf524cfdb4db384b85Cristy# below, and following the instructions in the 'Option parsing'
143315f2201421a23fbf95840adf524cfdb4db384b85Cristy# section further down.
143415f2201421a23fbf95840adf524cfdb4db384b85Cristy
143515f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------- ##
143615f2201421a23fbf95840adf524cfdb4db384b85Cristy## Configuration. ##
143715f2201421a23fbf95840adf524cfdb4db384b85Cristy## -------------- ##
143815f2201421a23fbf95840adf524cfdb4db384b85Cristy
143915f2201421a23fbf95840adf524cfdb4db384b85Cristy# You should override these variables in your script after sourcing this
144015f2201421a23fbf95840adf524cfdb4db384b85Cristy# file so that they reflect the customisations you have added to the
144115f2201421a23fbf95840adf524cfdb4db384b85Cristy# option parser.
144215f2201421a23fbf95840adf524cfdb4db384b85Cristy
144315f2201421a23fbf95840adf524cfdb4db384b85Cristy# The usage line for option parsing errors and the start of '-h' and
144415f2201421a23fbf95840adf524cfdb4db384b85Cristy# '--help' output messages. You can embed shell variables for delayed
144515f2201421a23fbf95840adf524cfdb4db384b85Cristy# expansion at the time the message is displayed, but you will need to
144615f2201421a23fbf95840adf524cfdb4db384b85Cristy# quote other shell meta-characters carefully to prevent them being
144715f2201421a23fbf95840adf524cfdb4db384b85Cristy# expanded when the contents are evaled.
144815f2201421a23fbf95840adf524cfdb4db384b85Cristyusage='$progpath [OPTION]...'
144915f2201421a23fbf95840adf524cfdb4db384b85Cristy
145015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Short help message in response to '-h' and '--help'.  Add to this or
145115f2201421a23fbf95840adf524cfdb4db384b85Cristy# override it after sourcing this library to reflect the full set of
145215f2201421a23fbf95840adf524cfdb4db384b85Cristy# options your script accepts.
145315f2201421a23fbf95840adf524cfdb4db384b85Cristyusage_message="\
145415f2201421a23fbf95840adf524cfdb4db384b85Cristy       --debug        enable verbose shell tracing
145515f2201421a23fbf95840adf524cfdb4db384b85Cristy   -W, --warnings=CATEGORY
145615f2201421a23fbf95840adf524cfdb4db384b85Cristy                      report the warnings falling in CATEGORY [all]
145715f2201421a23fbf95840adf524cfdb4db384b85Cristy   -v, --verbose      verbosely report processing
145815f2201421a23fbf95840adf524cfdb4db384b85Cristy       --version      print version information and exit
145915f2201421a23fbf95840adf524cfdb4db384b85Cristy   -h, --help         print short or long help message and exit
146015f2201421a23fbf95840adf524cfdb4db384b85Cristy"
146115f2201421a23fbf95840adf524cfdb4db384b85Cristy
146215f2201421a23fbf95840adf524cfdb4db384b85Cristy# Additional text appended to 'usage_message' in response to '--help'.
146315f2201421a23fbf95840adf524cfdb4db384b85Cristylong_help_message="
146415f2201421a23fbf95840adf524cfdb4db384b85CristyWarning categories include:
146515f2201421a23fbf95840adf524cfdb4db384b85Cristy       'all'          show all warnings
146615f2201421a23fbf95840adf524cfdb4db384b85Cristy       'none'         turn off all the warnings
146715f2201421a23fbf95840adf524cfdb4db384b85Cristy       'error'        warnings are treated as fatal errors"
146815f2201421a23fbf95840adf524cfdb4db384b85Cristy
146915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Help message printed before fatal option parsing errors.
147015f2201421a23fbf95840adf524cfdb4db384b85Cristyfatal_help="Try '\$progname --help' for more information."
147115f2201421a23fbf95840adf524cfdb4db384b85Cristy
147215f2201421a23fbf95840adf524cfdb4db384b85Cristy
147315f2201421a23fbf95840adf524cfdb4db384b85Cristy
147415f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------------------------- ##
147515f2201421a23fbf95840adf524cfdb4db384b85Cristy## Hook function management. ##
147615f2201421a23fbf95840adf524cfdb4db384b85Cristy## ------------------------- ##
147715f2201421a23fbf95840adf524cfdb4db384b85Cristy
147815f2201421a23fbf95840adf524cfdb4db384b85Cristy# This section contains functions for adding, removing, and running hooks
147915f2201421a23fbf95840adf524cfdb4db384b85Cristy# to the main code.  A hook is just a named list of of function, that can
148015f2201421a23fbf95840adf524cfdb4db384b85Cristy# be run in order later on.
148115f2201421a23fbf95840adf524cfdb4db384b85Cristy
148215f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_hookable FUNC_NAME
148315f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------------
148415f2201421a23fbf95840adf524cfdb4db384b85Cristy# Declare that FUNC_NAME will run hooks added with
148515f2201421a23fbf95840adf524cfdb4db384b85Cristy# 'func_add_hook FUNC_NAME ...'.
148615f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_hookable ()
148715f2201421a23fbf95840adf524cfdb4db384b85Cristy{
148815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
148915f2201421a23fbf95840adf524cfdb4db384b85Cristy
149015f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_append hookable_fns " $1"
149115f2201421a23fbf95840adf524cfdb4db384b85Cristy}
149215f2201421a23fbf95840adf524cfdb4db384b85Cristy
149315f2201421a23fbf95840adf524cfdb4db384b85Cristy
149415f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_add_hook FUNC_NAME HOOK_FUNC
149515f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------------------
149615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
149715f2201421a23fbf95840adf524cfdb4db384b85Cristy# first have been declared "hookable" by a call to 'func_hookable'.
149815f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_add_hook ()
149915f2201421a23fbf95840adf524cfdb4db384b85Cristy{
150015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
150115f2201421a23fbf95840adf524cfdb4db384b85Cristy
150215f2201421a23fbf95840adf524cfdb4db384b85Cristy    case " $hookable_fns " in
150315f2201421a23fbf95840adf524cfdb4db384b85Cristy      *" $1 "*) ;;
150415f2201421a23fbf95840adf524cfdb4db384b85Cristy      *) func_fatal_error "'$1' does not accept hook functions." ;;
150515f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
150615f2201421a23fbf95840adf524cfdb4db384b85Cristy
150715f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval func_append ${1}_hooks '" $2"'
150815f2201421a23fbf95840adf524cfdb4db384b85Cristy}
150915f2201421a23fbf95840adf524cfdb4db384b85Cristy
151015f2201421a23fbf95840adf524cfdb4db384b85Cristy
151115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_remove_hook FUNC_NAME HOOK_FUNC
151215f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------------------------
151315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
151415f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_remove_hook ()
151515f2201421a23fbf95840adf524cfdb4db384b85Cristy{
151615f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
151715f2201421a23fbf95840adf524cfdb4db384b85Cristy
151815f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
151915f2201421a23fbf95840adf524cfdb4db384b85Cristy}
152015f2201421a23fbf95840adf524cfdb4db384b85Cristy
152115f2201421a23fbf95840adf524cfdb4db384b85Cristy
152215f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_run_hooks FUNC_NAME [ARG]...
152315f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------------------
152415f2201421a23fbf95840adf524cfdb4db384b85Cristy# Run all hook functions registered to FUNC_NAME.
152515f2201421a23fbf95840adf524cfdb4db384b85Cristy# It is assumed that the list of hook functions contains nothing more
152615f2201421a23fbf95840adf524cfdb4db384b85Cristy# than a whitespace-delimited list of legal shell function names, and
152715f2201421a23fbf95840adf524cfdb4db384b85Cristy# no effort is wasted trying to catch shell meta-characters or preserve
152815f2201421a23fbf95840adf524cfdb4db384b85Cristy# whitespace.
152915f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_run_hooks ()
153015f2201421a23fbf95840adf524cfdb4db384b85Cristy{
153115f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
153215f2201421a23fbf95840adf524cfdb4db384b85Cristy
153315f2201421a23fbf95840adf524cfdb4db384b85Cristy    case " $hookable_fns " in
153415f2201421a23fbf95840adf524cfdb4db384b85Cristy      *" $1 "*) ;;
153515f2201421a23fbf95840adf524cfdb4db384b85Cristy      *) func_fatal_error "'$1' does not support hook funcions.n" ;;
153615f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
153715f2201421a23fbf95840adf524cfdb4db384b85Cristy
153815f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval _G_hook_fns=\$$1_hooks; shift
153915f2201421a23fbf95840adf524cfdb4db384b85Cristy
154015f2201421a23fbf95840adf524cfdb4db384b85Cristy    for _G_hook in $_G_hook_fns; do
154115f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval $_G_hook '"$@"'
154215f2201421a23fbf95840adf524cfdb4db384b85Cristy
154315f2201421a23fbf95840adf524cfdb4db384b85Cristy      # store returned options list back into positional
154415f2201421a23fbf95840adf524cfdb4db384b85Cristy      # parameters for next 'cmd' execution.
154515f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval _G_hook_result=\$${_G_hook}_result
154615f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval set dummy "$_G_hook_result"; shift
154715f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
154815f2201421a23fbf95840adf524cfdb4db384b85Cristy
154915f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_eval ${1+"$@"}
155015f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_run_hooks_result=$func_quote_for_eval_result
155115f2201421a23fbf95840adf524cfdb4db384b85Cristy}
155215f2201421a23fbf95840adf524cfdb4db384b85Cristy
155315f2201421a23fbf95840adf524cfdb4db384b85Cristy
155415f2201421a23fbf95840adf524cfdb4db384b85Cristy
155515f2201421a23fbf95840adf524cfdb4db384b85Cristy## --------------- ##
155615f2201421a23fbf95840adf524cfdb4db384b85Cristy## Option parsing. ##
155715f2201421a23fbf95840adf524cfdb4db384b85Cristy## --------------- ##
155815f2201421a23fbf95840adf524cfdb4db384b85Cristy
155915f2201421a23fbf95840adf524cfdb4db384b85Cristy# In order to add your own option parsing hooks, you must accept the
156015f2201421a23fbf95840adf524cfdb4db384b85Cristy# full positional parameter list in your hook function, remove any
156115f2201421a23fbf95840adf524cfdb4db384b85Cristy# options that you action, and then pass back the remaining unprocessed
156215f2201421a23fbf95840adf524cfdb4db384b85Cristy# options in '<hooked_function_name>_result', escaped suitably for
156315f2201421a23fbf95840adf524cfdb4db384b85Cristy# 'eval'.  Like this:
156415f2201421a23fbf95840adf524cfdb4db384b85Cristy#
156515f2201421a23fbf95840adf524cfdb4db384b85Cristy#    my_options_prep ()
156615f2201421a23fbf95840adf524cfdb4db384b85Cristy#    {
156715f2201421a23fbf95840adf524cfdb4db384b85Cristy#        $debug_cmd
156815f2201421a23fbf95840adf524cfdb4db384b85Cristy#
156915f2201421a23fbf95840adf524cfdb4db384b85Cristy#        # Extend the existing usage message.
157015f2201421a23fbf95840adf524cfdb4db384b85Cristy#        usage_message=$usage_message'
157115f2201421a23fbf95840adf524cfdb4db384b85Cristy#      -s, --silent       don'\''t print informational messages
157215f2201421a23fbf95840adf524cfdb4db384b85Cristy#    '
157315f2201421a23fbf95840adf524cfdb4db384b85Cristy#
157415f2201421a23fbf95840adf524cfdb4db384b85Cristy#        func_quote_for_eval ${1+"$@"}
157515f2201421a23fbf95840adf524cfdb4db384b85Cristy#        my_options_prep_result=$func_quote_for_eval_result
157615f2201421a23fbf95840adf524cfdb4db384b85Cristy#    }
157715f2201421a23fbf95840adf524cfdb4db384b85Cristy#    func_add_hook func_options_prep my_options_prep
157815f2201421a23fbf95840adf524cfdb4db384b85Cristy#
157915f2201421a23fbf95840adf524cfdb4db384b85Cristy#
158015f2201421a23fbf95840adf524cfdb4db384b85Cristy#    my_silent_option ()
158115f2201421a23fbf95840adf524cfdb4db384b85Cristy#    {
158215f2201421a23fbf95840adf524cfdb4db384b85Cristy#        $debug_cmd
158315f2201421a23fbf95840adf524cfdb4db384b85Cristy#
158415f2201421a23fbf95840adf524cfdb4db384b85Cristy#        # Note that for efficiency, we parse as many options as we can
158515f2201421a23fbf95840adf524cfdb4db384b85Cristy#        # recognise in a loop before passing the remainder back to the
158615f2201421a23fbf95840adf524cfdb4db384b85Cristy#        # caller on the first unrecognised argument we encounter.
158715f2201421a23fbf95840adf524cfdb4db384b85Cristy#        while test $# -gt 0; do
158815f2201421a23fbf95840adf524cfdb4db384b85Cristy#          opt=$1; shift
158915f2201421a23fbf95840adf524cfdb4db384b85Cristy#          case $opt in
159015f2201421a23fbf95840adf524cfdb4db384b85Cristy#            --silent|-s) opt_silent=: ;;
159115f2201421a23fbf95840adf524cfdb4db384b85Cristy#            # Separate non-argument short options:
159215f2201421a23fbf95840adf524cfdb4db384b85Cristy#            -s*)         func_split_short_opt "$_G_opt"
159315f2201421a23fbf95840adf524cfdb4db384b85Cristy#                         set dummy "$func_split_short_opt_name" \
159415f2201421a23fbf95840adf524cfdb4db384b85Cristy#                             "-$func_split_short_opt_arg" ${1+"$@"}
159515f2201421a23fbf95840adf524cfdb4db384b85Cristy#                         shift
159615f2201421a23fbf95840adf524cfdb4db384b85Cristy#                         ;;
159715f2201421a23fbf95840adf524cfdb4db384b85Cristy#            *)            set dummy "$_G_opt" "$*"; shift; break ;;
159815f2201421a23fbf95840adf524cfdb4db384b85Cristy#          esac
159915f2201421a23fbf95840adf524cfdb4db384b85Cristy#        done
160015f2201421a23fbf95840adf524cfdb4db384b85Cristy#
160115f2201421a23fbf95840adf524cfdb4db384b85Cristy#        func_quote_for_eval ${1+"$@"}
160215f2201421a23fbf95840adf524cfdb4db384b85Cristy#        my_silent_option_result=$func_quote_for_eval_result
160315f2201421a23fbf95840adf524cfdb4db384b85Cristy#    }
160415f2201421a23fbf95840adf524cfdb4db384b85Cristy#    func_add_hook func_parse_options my_silent_option
160515f2201421a23fbf95840adf524cfdb4db384b85Cristy#
160615f2201421a23fbf95840adf524cfdb4db384b85Cristy#
160715f2201421a23fbf95840adf524cfdb4db384b85Cristy#    my_option_validation ()
160815f2201421a23fbf95840adf524cfdb4db384b85Cristy#    {
160915f2201421a23fbf95840adf524cfdb4db384b85Cristy#        $debug_cmd
161015f2201421a23fbf95840adf524cfdb4db384b85Cristy#
161115f2201421a23fbf95840adf524cfdb4db384b85Cristy#        $opt_silent && $opt_verbose && func_fatal_help "\
161215f2201421a23fbf95840adf524cfdb4db384b85Cristy#    '--silent' and '--verbose' options are mutually exclusive."
161315f2201421a23fbf95840adf524cfdb4db384b85Cristy#
161415f2201421a23fbf95840adf524cfdb4db384b85Cristy#        func_quote_for_eval ${1+"$@"}
161515f2201421a23fbf95840adf524cfdb4db384b85Cristy#        my_option_validation_result=$func_quote_for_eval_result
161615f2201421a23fbf95840adf524cfdb4db384b85Cristy#    }
161715f2201421a23fbf95840adf524cfdb4db384b85Cristy#    func_add_hook func_validate_options my_option_validation
161815f2201421a23fbf95840adf524cfdb4db384b85Cristy#
161915f2201421a23fbf95840adf524cfdb4db384b85Cristy# You'll alse need to manually amend $usage_message to reflect the extra
162015f2201421a23fbf95840adf524cfdb4db384b85Cristy# options you parse.  It's preferable to append if you can, so that
162115f2201421a23fbf95840adf524cfdb4db384b85Cristy# multiple option parsing hooks can be added safely.
162215f2201421a23fbf95840adf524cfdb4db384b85Cristy
162315f2201421a23fbf95840adf524cfdb4db384b85Cristy
162415f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_options [ARG]...
162515f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------
162615f2201421a23fbf95840adf524cfdb4db384b85Cristy# All the functions called inside func_options are hookable. See the
162715f2201421a23fbf95840adf524cfdb4db384b85Cristy# individual implementations for details.
162815f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_hookable func_options
162915f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_options ()
163015f2201421a23fbf95840adf524cfdb4db384b85Cristy{
163115f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
163215f2201421a23fbf95840adf524cfdb4db384b85Cristy
163315f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_options_prep ${1+"$@"}
163415f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval func_parse_options \
163515f2201421a23fbf95840adf524cfdb4db384b85Cristy        ${func_options_prep_result+"$func_options_prep_result"}
163615f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval func_validate_options \
163715f2201421a23fbf95840adf524cfdb4db384b85Cristy        ${func_parse_options_result+"$func_parse_options_result"}
163815f2201421a23fbf95840adf524cfdb4db384b85Cristy
163915f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval func_run_hooks func_options \
164015f2201421a23fbf95840adf524cfdb4db384b85Cristy        ${func_validate_options_result+"$func_validate_options_result"}
164115f2201421a23fbf95840adf524cfdb4db384b85Cristy
164215f2201421a23fbf95840adf524cfdb4db384b85Cristy    # save modified positional parameters for caller
164315f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_options_result=$func_run_hooks_result
16443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
16453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
16463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
164715f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_options_prep [ARG]...
164815f2201421a23fbf95840adf524cfdb4db384b85Cristy# --------------------------
164915f2201421a23fbf95840adf524cfdb4db384b85Cristy# All initialisations required before starting the option parse loop.
165015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Note that when calling hook functions, we pass through the list of
165115f2201421a23fbf95840adf524cfdb4db384b85Cristy# positional parameters.  If a hook function modifies that list, and
165215f2201421a23fbf95840adf524cfdb4db384b85Cristy# needs to propogate that back to rest of this script, then the complete
165315f2201421a23fbf95840adf524cfdb4db384b85Cristy# modified list must be put in 'func_run_hooks_result' before
165415f2201421a23fbf95840adf524cfdb4db384b85Cristy# returning.
165515f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_hookable func_options_prep
165615f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_options_prep ()
16573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
165815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
16593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
166015f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Option defaults:
166115f2201421a23fbf95840adf524cfdb4db384b85Cristy    opt_verbose=false
166215f2201421a23fbf95840adf524cfdb4db384b85Cristy    opt_warning_types=
166315f2201421a23fbf95840adf524cfdb4db384b85Cristy
166415f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_run_hooks func_options_prep ${1+"$@"}
166515f2201421a23fbf95840adf524cfdb4db384b85Cristy
166615f2201421a23fbf95840adf524cfdb4db384b85Cristy    # save modified positional parameters for caller
166715f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_options_prep_result=$func_run_hooks_result
16683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
16693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
16703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
167115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_parse_options [ARG]...
167215f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------------
167315f2201421a23fbf95840adf524cfdb4db384b85Cristy# The main option parsing loop.
167415f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_hookable func_parse_options
167515f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_parse_options ()
16763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
167715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
16783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
167915f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_parse_options_result=
16803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
168115f2201421a23fbf95840adf524cfdb4db384b85Cristy    # this just eases exit handling
168215f2201421a23fbf95840adf524cfdb4db384b85Cristy    while test $# -gt 0; do
168315f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Defer to hook functions for initial option parsing, so they
168415f2201421a23fbf95840adf524cfdb4db384b85Cristy      # get priority in the event of reusing an option name.
168515f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_run_hooks func_parse_options ${1+"$@"}
16863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
168715f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Adjust func_parse_options positional parameters to match
168815f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval set dummy "$func_run_hooks_result"; shift
16893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
169015f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Break out of the loop if we already parsed every option.
169115f2201421a23fbf95840adf524cfdb4db384b85Cristy      test $# -gt 0 || break
16923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
169315f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_opt=$1
169415f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift
169515f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $_G_opt in
169615f2201421a23fbf95840adf524cfdb4db384b85Cristy        --debug|-x)   debug_cmd='set -x'
169715f2201421a23fbf95840adf524cfdb4db384b85Cristy                      func_echo "enabling shell trace mode"
169815f2201421a23fbf95840adf524cfdb4db384b85Cristy                      $debug_cmd
169915f2201421a23fbf95840adf524cfdb4db384b85Cristy                      ;;
170015f2201421a23fbf95840adf524cfdb4db384b85Cristy
170115f2201421a23fbf95840adf524cfdb4db384b85Cristy        --no-warnings|--no-warning|--no-warn)
170215f2201421a23fbf95840adf524cfdb4db384b85Cristy                      set dummy --warnings none ${1+"$@"}
170315f2201421a23fbf95840adf524cfdb4db384b85Cristy                      shift
170415f2201421a23fbf95840adf524cfdb4db384b85Cristy		      ;;
17053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
170615f2201421a23fbf95840adf524cfdb4db384b85Cristy        --warnings|--warning|-W)
170715f2201421a23fbf95840adf524cfdb4db384b85Cristy                      test $# = 0 && func_missing_arg $_G_opt && break
170815f2201421a23fbf95840adf524cfdb4db384b85Cristy                      case " $warning_categories $1" in
170915f2201421a23fbf95840adf524cfdb4db384b85Cristy                        *" $1 "*)
171015f2201421a23fbf95840adf524cfdb4db384b85Cristy                          # trailing space prevents matching last $1 above
171115f2201421a23fbf95840adf524cfdb4db384b85Cristy                          func_append_uniq opt_warning_types " $1"
171215f2201421a23fbf95840adf524cfdb4db384b85Cristy                          ;;
171315f2201421a23fbf95840adf524cfdb4db384b85Cristy                        *all)
171415f2201421a23fbf95840adf524cfdb4db384b85Cristy                          opt_warning_types=$warning_categories
171515f2201421a23fbf95840adf524cfdb4db384b85Cristy                          ;;
171615f2201421a23fbf95840adf524cfdb4db384b85Cristy                        *none)
171715f2201421a23fbf95840adf524cfdb4db384b85Cristy                          opt_warning_types=none
171815f2201421a23fbf95840adf524cfdb4db384b85Cristy                          warning_func=:
171915f2201421a23fbf95840adf524cfdb4db384b85Cristy                          ;;
172015f2201421a23fbf95840adf524cfdb4db384b85Cristy                        *error)
172115f2201421a23fbf95840adf524cfdb4db384b85Cristy                          opt_warning_types=$warning_categories
172215f2201421a23fbf95840adf524cfdb4db384b85Cristy                          warning_func=func_fatal_error
172315f2201421a23fbf95840adf524cfdb4db384b85Cristy                          ;;
172415f2201421a23fbf95840adf524cfdb4db384b85Cristy                        *)
172515f2201421a23fbf95840adf524cfdb4db384b85Cristy                          func_fatal_error \
172615f2201421a23fbf95840adf524cfdb4db384b85Cristy                             "unsupported warning category: '$1'"
172715f2201421a23fbf95840adf524cfdb4db384b85Cristy                          ;;
172815f2201421a23fbf95840adf524cfdb4db384b85Cristy                      esac
172915f2201421a23fbf95840adf524cfdb4db384b85Cristy                      shift
173015f2201421a23fbf95840adf524cfdb4db384b85Cristy                      ;;
173115f2201421a23fbf95840adf524cfdb4db384b85Cristy
173215f2201421a23fbf95840adf524cfdb4db384b85Cristy        --verbose|-v) opt_verbose=: ;;
173315f2201421a23fbf95840adf524cfdb4db384b85Cristy        --version)    func_version ;;
173415f2201421a23fbf95840adf524cfdb4db384b85Cristy        -\?|-h)       func_usage ;;
173515f2201421a23fbf95840adf524cfdb4db384b85Cristy        --help)       func_help ;;
173615f2201421a23fbf95840adf524cfdb4db384b85Cristy
173715f2201421a23fbf95840adf524cfdb4db384b85Cristy	# Separate optargs to long options (plugins may need this):
173815f2201421a23fbf95840adf524cfdb4db384b85Cristy	--*=*)        func_split_equals "$_G_opt"
173915f2201421a23fbf95840adf524cfdb4db384b85Cristy	              set dummy "$func_split_equals_lhs" \
174015f2201421a23fbf95840adf524cfdb4db384b85Cristy                          "$func_split_equals_rhs" ${1+"$@"}
174115f2201421a23fbf95840adf524cfdb4db384b85Cristy                      shift
174215f2201421a23fbf95840adf524cfdb4db384b85Cristy                      ;;
174315f2201421a23fbf95840adf524cfdb4db384b85Cristy
174415f2201421a23fbf95840adf524cfdb4db384b85Cristy       # Separate optargs to short options:
174515f2201421a23fbf95840adf524cfdb4db384b85Cristy        -W*)
174615f2201421a23fbf95840adf524cfdb4db384b85Cristy                      func_split_short_opt "$_G_opt"
174715f2201421a23fbf95840adf524cfdb4db384b85Cristy                      set dummy "$func_split_short_opt_name" \
174815f2201421a23fbf95840adf524cfdb4db384b85Cristy                          "$func_split_short_opt_arg" ${1+"$@"}
174915f2201421a23fbf95840adf524cfdb4db384b85Cristy                      shift
175015f2201421a23fbf95840adf524cfdb4db384b85Cristy                      ;;
175115f2201421a23fbf95840adf524cfdb4db384b85Cristy
175215f2201421a23fbf95840adf524cfdb4db384b85Cristy        # Separate non-argument short options:
175315f2201421a23fbf95840adf524cfdb4db384b85Cristy        -\?*|-h*|-v*|-x*)
175415f2201421a23fbf95840adf524cfdb4db384b85Cristy                      func_split_short_opt "$_G_opt"
175515f2201421a23fbf95840adf524cfdb4db384b85Cristy                      set dummy "$func_split_short_opt_name" \
175615f2201421a23fbf95840adf524cfdb4db384b85Cristy                          "-$func_split_short_opt_arg" ${1+"$@"}
175715f2201421a23fbf95840adf524cfdb4db384b85Cristy                      shift
175815f2201421a23fbf95840adf524cfdb4db384b85Cristy                      ;;
175915f2201421a23fbf95840adf524cfdb4db384b85Cristy
176015f2201421a23fbf95840adf524cfdb4db384b85Cristy        --)           break ;;
176115f2201421a23fbf95840adf524cfdb4db384b85Cristy        -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
176215f2201421a23fbf95840adf524cfdb4db384b85Cristy        *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
176315f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
176415f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
176515f2201421a23fbf95840adf524cfdb4db384b85Cristy
176615f2201421a23fbf95840adf524cfdb4db384b85Cristy    # save modified positional parameters for caller
176715f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_eval ${1+"$@"}
176815f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_parse_options_result=$func_quote_for_eval_result
17693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
17703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
17713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
177215f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_validate_options [ARG]...
177315f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------------------
177415f2201421a23fbf95840adf524cfdb4db384b85Cristy# Perform any sanity checks on option settings and/or unconsumed
177515f2201421a23fbf95840adf524cfdb4db384b85Cristy# arguments.
177615f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_hookable func_validate_options
177715f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_validate_options ()
17783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
177915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
17803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
178115f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Display all warnings if -W was not given.
178215f2201421a23fbf95840adf524cfdb4db384b85Cristy    test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
17833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
178415f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_run_hooks func_validate_options ${1+"$@"}
17853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
178615f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Bail if the options were screwed!
178715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $exit_cmd $EXIT_FAILURE
178815f2201421a23fbf95840adf524cfdb4db384b85Cristy
178915f2201421a23fbf95840adf524cfdb4db384b85Cristy    # save modified positional parameters for caller
179015f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_validate_options_result=$func_run_hooks_result
1791da16f16767eb31921af855f17bda465fffc4e000cristy}
1792da16f16767eb31921af855f17bda465fffc4e000cristy
17933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1794da16f16767eb31921af855f17bda465fffc4e000cristy
179515f2201421a23fbf95840adf524cfdb4db384b85Cristy## ----------------- ##
179615f2201421a23fbf95840adf524cfdb4db384b85Cristy## Helper functions. ##
179715f2201421a23fbf95840adf524cfdb4db384b85Cristy## ----------------- ##
17983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
179915f2201421a23fbf95840adf524cfdb4db384b85Cristy# This section contains the helper functions used by the rest of the
180015f2201421a23fbf95840adf524cfdb4db384b85Cristy# hookable option parser framework in ascii-betical order.
180115f2201421a23fbf95840adf524cfdb4db384b85Cristy
180215f2201421a23fbf95840adf524cfdb4db384b85Cristy
180315f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_fatal_help ARG...
180415f2201421a23fbf95840adf524cfdb4db384b85Cristy# ----------------------
180515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo program name prefixed message to standard error, followed by
180615f2201421a23fbf95840adf524cfdb4db384b85Cristy# a help hint, and exit.
180715f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_fatal_help ()
18083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
180915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
1810da16f16767eb31921af855f17bda465fffc4e000cristy
181115f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval \$ECHO \""Usage: $usage"\"
181215f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval \$ECHO \""$fatal_help"\"
181315f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_error ${1+"$@"}
181415f2201421a23fbf95840adf524cfdb4db384b85Cristy    exit $EXIT_FAILURE
18153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
18163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
181715f2201421a23fbf95840adf524cfdb4db384b85Cristy
181815f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_help
181915f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------
182015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo long help message to standard output and exit.
18213ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_help ()
18223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
182315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
182415f2201421a23fbf95840adf524cfdb4db384b85Cristy
182515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_usage_message
182615f2201421a23fbf95840adf524cfdb4db384b85Cristy    $ECHO "$long_help_message"
182715f2201421a23fbf95840adf524cfdb4db384b85Cristy    exit 0
18283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
18293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
183015f2201421a23fbf95840adf524cfdb4db384b85Cristy
183115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_missing_arg ARGNAME
183215f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------------
18333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Echo program name prefixed message to standard error and set global
18343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# exit_cmd.
18353ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_missing_arg ()
18363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
183715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
1838da16f16767eb31921af855f17bda465fffc4e000cristy
183915f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_error "Missing argument for '$1'."
18403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit_cmd=exit
18413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
18423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
18433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
184415f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_split_equals STRING
184515f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------------
184615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
184715f2201421a23fbf95840adf524cfdb4db384b85Cristy# splitting STRING at the '=' sign.
184815f2201421a23fbf95840adf524cfdb4db384b85Cristytest -z "$_G_HAVE_XSI_OPS" \
184915f2201421a23fbf95840adf524cfdb4db384b85Cristy    && (eval 'x=a/b/c;
185015f2201421a23fbf95840adf524cfdb4db384b85Cristy      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
185115f2201421a23fbf95840adf524cfdb4db384b85Cristy    && _G_HAVE_XSI_OPS=yes
185215f2201421a23fbf95840adf524cfdb4db384b85Cristy
185315f2201421a23fbf95840adf524cfdb4db384b85Cristyif test yes = "$_G_HAVE_XSI_OPS"
185415f2201421a23fbf95840adf524cfdb4db384b85Cristythen
185515f2201421a23fbf95840adf524cfdb4db384b85Cristy  # This is an XSI compatible shell, allowing a faster implementation...
185615f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'func_split_equals ()
185715f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
185815f2201421a23fbf95840adf524cfdb4db384b85Cristy      $debug_cmd
185915f2201421a23fbf95840adf524cfdb4db384b85Cristy
186015f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_split_equals_lhs=${1%%=*}
186115f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_split_equals_rhs=${1#*=}
186215f2201421a23fbf95840adf524cfdb4db384b85Cristy      test "x$func_split_equals_lhs" = "x$1" \
186315f2201421a23fbf95840adf524cfdb4db384b85Cristy        && func_split_equals_rhs=
186415f2201421a23fbf95840adf524cfdb4db384b85Cristy  }'
186515f2201421a23fbf95840adf524cfdb4db384b85Cristyelse
186615f2201421a23fbf95840adf524cfdb4db384b85Cristy  # ...otherwise fall back to using expr, which is often a shell builtin.
186715f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_split_equals ()
186815f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
186915f2201421a23fbf95840adf524cfdb4db384b85Cristy      $debug_cmd
187015f2201421a23fbf95840adf524cfdb4db384b85Cristy
187115f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
187215f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_split_equals_rhs=
187315f2201421a23fbf95840adf524cfdb4db384b85Cristy      test "x$func_split_equals_lhs" = "x$1" \
187415f2201421a23fbf95840adf524cfdb4db384b85Cristy        || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
187515f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
187615f2201421a23fbf95840adf524cfdb4db384b85Cristyfi #func_split_equals
187715f2201421a23fbf95840adf524cfdb4db384b85Cristy
187815f2201421a23fbf95840adf524cfdb4db384b85Cristy
187915f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_split_short_opt SHORTOPT
188015f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------------------
1881da16f16767eb31921af855f17bda465fffc4e000cristy# Set func_split_short_opt_name and func_split_short_opt_arg shell
1882da16f16767eb31921af855f17bda465fffc4e000cristy# variables after splitting SHORTOPT after the 2nd character.
188315f2201421a23fbf95840adf524cfdb4db384b85Cristyif test yes = "$_G_HAVE_XSI_OPS"
188415f2201421a23fbf95840adf524cfdb4db384b85Cristythen
188515f2201421a23fbf95840adf524cfdb4db384b85Cristy  # This is an XSI compatible shell, allowing a faster implementation...
188615f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'func_split_short_opt ()
188715f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
188815f2201421a23fbf95840adf524cfdb4db384b85Cristy      $debug_cmd
188915f2201421a23fbf95840adf524cfdb4db384b85Cristy
189015f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_split_short_opt_arg=${1#??}
189115f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
189215f2201421a23fbf95840adf524cfdb4db384b85Cristy  }'
189315f2201421a23fbf95840adf524cfdb4db384b85Cristyelse
189415f2201421a23fbf95840adf524cfdb4db384b85Cristy  # ...otherwise fall back to using expr, which is often a shell builtin.
189515f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_split_short_opt ()
189615f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
189715f2201421a23fbf95840adf524cfdb4db384b85Cristy      $debug_cmd
189815f2201421a23fbf95840adf524cfdb4db384b85Cristy
189915f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
190015f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
190115f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
190215f2201421a23fbf95840adf524cfdb4db384b85Cristyfi #func_split_short_opt
190315f2201421a23fbf95840adf524cfdb4db384b85Cristy
190415f2201421a23fbf95840adf524cfdb4db384b85Cristy
190515f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_usage
190615f2201421a23fbf95840adf524cfdb4db384b85Cristy# ----------
190715f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo short help message to standard output and exit.
190815f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_usage ()
1909da16f16767eb31921af855f17bda465fffc4e000cristy{
191015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
1911da16f16767eb31921af855f17bda465fffc4e000cristy
191215f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_usage_message
191315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
191415f2201421a23fbf95840adf524cfdb4db384b85Cristy    exit 0
191515f2201421a23fbf95840adf524cfdb4db384b85Cristy}
1916da16f16767eb31921af855f17bda465fffc4e000cristy
1917da16f16767eb31921af855f17bda465fffc4e000cristy
191815f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_usage_message
191915f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------
192015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo short help message to standard output.
192115f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_usage_message ()
1922da16f16767eb31921af855f17bda465fffc4e000cristy{
192315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
1924da16f16767eb31921af855f17bda465fffc4e000cristy
192515f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval \$ECHO \""Usage: $usage"\"
192615f2201421a23fbf95840adf524cfdb4db384b85Cristy    echo
192715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $SED -n 's|^# ||
192815f2201421a23fbf95840adf524cfdb4db384b85Cristy        /^Written by/{
192915f2201421a23fbf95840adf524cfdb4db384b85Cristy          x;p;x
193015f2201421a23fbf95840adf524cfdb4db384b85Cristy        }
193115f2201421a23fbf95840adf524cfdb4db384b85Cristy	h
193215f2201421a23fbf95840adf524cfdb4db384b85Cristy	/^Written by/q' < "$progpath"
193315f2201421a23fbf95840adf524cfdb4db384b85Cristy    echo
193415f2201421a23fbf95840adf524cfdb4db384b85Cristy    eval \$ECHO \""$usage_message"\"
193515f2201421a23fbf95840adf524cfdb4db384b85Cristy}
1936da16f16767eb31921af855f17bda465fffc4e000cristy
19373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
193815f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_version
193915f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------
194015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Echo version message to standard output and exit.
194115f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_version ()
194215f2201421a23fbf95840adf524cfdb4db384b85Cristy{
194315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
19443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
194515f2201421a23fbf95840adf524cfdb4db384b85Cristy    printf '%s\n' "$progname $scriptversion"
194615f2201421a23fbf95840adf524cfdb4db384b85Cristy    $SED -n '
194715f2201421a23fbf95840adf524cfdb4db384b85Cristy        /(C)/!b go
194815f2201421a23fbf95840adf524cfdb4db384b85Cristy        :more
194915f2201421a23fbf95840adf524cfdb4db384b85Cristy        /\./!{
195015f2201421a23fbf95840adf524cfdb4db384b85Cristy          N
195115f2201421a23fbf95840adf524cfdb4db384b85Cristy          s|\n# | |
195215f2201421a23fbf95840adf524cfdb4db384b85Cristy          b more
195315f2201421a23fbf95840adf524cfdb4db384b85Cristy        }
195415f2201421a23fbf95840adf524cfdb4db384b85Cristy        :go
195515f2201421a23fbf95840adf524cfdb4db384b85Cristy        /^# Written by /,/# warranty; / {
195615f2201421a23fbf95840adf524cfdb4db384b85Cristy          s|^# ||
195715f2201421a23fbf95840adf524cfdb4db384b85Cristy          s|^# *$||
195815f2201421a23fbf95840adf524cfdb4db384b85Cristy          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
195915f2201421a23fbf95840adf524cfdb4db384b85Cristy          p
196015f2201421a23fbf95840adf524cfdb4db384b85Cristy        }
196115f2201421a23fbf95840adf524cfdb4db384b85Cristy        /^# Written by / {
196215f2201421a23fbf95840adf524cfdb4db384b85Cristy          s|^# ||
196315f2201421a23fbf95840adf524cfdb4db384b85Cristy          p
196415f2201421a23fbf95840adf524cfdb4db384b85Cristy        }
196515f2201421a23fbf95840adf524cfdb4db384b85Cristy        /^warranty; /q' < "$progpath"
19663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
196715f2201421a23fbf95840adf524cfdb4db384b85Cristy    exit $?
196815f2201421a23fbf95840adf524cfdb4db384b85Cristy}
19693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
19703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
197115f2201421a23fbf95840adf524cfdb4db384b85Cristy# Local variables:
197215f2201421a23fbf95840adf524cfdb4db384b85Cristy# mode: shell-script
197315f2201421a23fbf95840adf524cfdb4db384b85Cristy# sh-indentation: 2
197415f2201421a23fbf95840adf524cfdb4db384b85Cristy# eval: (add-hook 'before-save-hook 'time-stamp)
197515f2201421a23fbf95840adf524cfdb4db384b85Cristy# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
197615f2201421a23fbf95840adf524cfdb4db384b85Cristy# time-stamp-time-zone: "UTC"
197715f2201421a23fbf95840adf524cfdb4db384b85Cristy# End:
19783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
197915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Set a version string.
198015f2201421a23fbf95840adf524cfdb4db384b85Cristyscriptversion='(GNU libtool) 2.4.6'
19813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
19823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
198315f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_echo ARG...
198415f2201421a23fbf95840adf524cfdb4db384b85Cristy# ----------------
198515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Libtool also displays the current mode in messages, so override
198615f2201421a23fbf95840adf524cfdb4db384b85Cristy# funclib.sh func_echo with this custom definition.
198715f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_echo ()
1988da16f16767eb31921af855f17bda465fffc4e000cristy{
198915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
1990da16f16767eb31921af855f17bda465fffc4e000cristy
199115f2201421a23fbf95840adf524cfdb4db384b85Cristy    _G_message=$*
1992da16f16767eb31921af855f17bda465fffc4e000cristy
199315f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_echo_IFS=$IFS
199415f2201421a23fbf95840adf524cfdb4db384b85Cristy    IFS=$nl
199515f2201421a23fbf95840adf524cfdb4db384b85Cristy    for _G_line in $_G_message; do
199615f2201421a23fbf95840adf524cfdb4db384b85Cristy      IFS=$func_echo_IFS
199715f2201421a23fbf95840adf524cfdb4db384b85Cristy      $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
199815f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
199915f2201421a23fbf95840adf524cfdb4db384b85Cristy    IFS=$func_echo_IFS
200015f2201421a23fbf95840adf524cfdb4db384b85Cristy}
2001da16f16767eb31921af855f17bda465fffc4e000cristy
200215f2201421a23fbf95840adf524cfdb4db384b85Cristy
200315f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_warning ARG...
200415f2201421a23fbf95840adf524cfdb4db384b85Cristy# -------------------
200515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Libtool warnings are not categorized, so override funclib.sh
200615f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_warning with this simpler definition.
200715f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_warning ()
2008da16f16767eb31921af855f17bda465fffc4e000cristy{
200915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
2010da16f16767eb31921af855f17bda465fffc4e000cristy
201115f2201421a23fbf95840adf524cfdb4db384b85Cristy    $warning_func ${1+"$@"}
201215f2201421a23fbf95840adf524cfdb4db384b85Cristy}
2013da16f16767eb31921af855f17bda465fffc4e000cristy
2014da16f16767eb31921af855f17bda465fffc4e000cristy
201515f2201421a23fbf95840adf524cfdb4db384b85Cristy## ---------------- ##
201615f2201421a23fbf95840adf524cfdb4db384b85Cristy## Options parsing. ##
201715f2201421a23fbf95840adf524cfdb4db384b85Cristy## ---------------- ##
201815f2201421a23fbf95840adf524cfdb4db384b85Cristy
201915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Hook in the functions to make sure our own options are parsed during
202015f2201421a23fbf95840adf524cfdb4db384b85Cristy# the option parsing loop.
202115f2201421a23fbf95840adf524cfdb4db384b85Cristy
202215f2201421a23fbf95840adf524cfdb4db384b85Cristyusage='$progpath [OPTION]... [MODE-ARG]...'
202315f2201421a23fbf95840adf524cfdb4db384b85Cristy
202415f2201421a23fbf95840adf524cfdb4db384b85Cristy# Short help message in response to '-h'.
202515f2201421a23fbf95840adf524cfdb4db384b85Cristyusage_message="Options:
202615f2201421a23fbf95840adf524cfdb4db384b85Cristy       --config             show all configuration variables
202715f2201421a23fbf95840adf524cfdb4db384b85Cristy       --debug              enable verbose shell tracing
202815f2201421a23fbf95840adf524cfdb4db384b85Cristy   -n, --dry-run            display commands without modifying any files
202915f2201421a23fbf95840adf524cfdb4db384b85Cristy       --features           display basic configuration information and exit
203015f2201421a23fbf95840adf524cfdb4db384b85Cristy       --mode=MODE          use operation mode MODE
203115f2201421a23fbf95840adf524cfdb4db384b85Cristy       --no-warnings        equivalent to '-Wnone'
203215f2201421a23fbf95840adf524cfdb4db384b85Cristy       --preserve-dup-deps  don't remove duplicate dependency libraries
203315f2201421a23fbf95840adf524cfdb4db384b85Cristy       --quiet, --silent    don't print informational messages
203415f2201421a23fbf95840adf524cfdb4db384b85Cristy       --tag=TAG            use configuration variables from tag TAG
203515f2201421a23fbf95840adf524cfdb4db384b85Cristy   -v, --verbose            print more informational messages than default
203615f2201421a23fbf95840adf524cfdb4db384b85Cristy       --version            print version information
203715f2201421a23fbf95840adf524cfdb4db384b85Cristy   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
203815f2201421a23fbf95840adf524cfdb4db384b85Cristy   -h, --help, --help-all   print short, long, or detailed help message
203915f2201421a23fbf95840adf524cfdb4db384b85Cristy"
2040da16f16767eb31921af855f17bda465fffc4e000cristy
204115f2201421a23fbf95840adf524cfdb4db384b85Cristy# Additional text appended to 'usage_message' in response to '--help'.
204215f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_help ()
2043da16f16767eb31921af855f17bda465fffc4e000cristy{
204415f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
204515f2201421a23fbf95840adf524cfdb4db384b85Cristy
204615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_usage_message
204715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $ECHO "$long_help_message
204815f2201421a23fbf95840adf524cfdb4db384b85Cristy
204915f2201421a23fbf95840adf524cfdb4db384b85CristyMODE must be one of the following:
205015f2201421a23fbf95840adf524cfdb4db384b85Cristy
205115f2201421a23fbf95840adf524cfdb4db384b85Cristy       clean           remove files from the build directory
205215f2201421a23fbf95840adf524cfdb4db384b85Cristy       compile         compile a source file into a libtool object
205315f2201421a23fbf95840adf524cfdb4db384b85Cristy       execute         automatically set library path, then run a program
205415f2201421a23fbf95840adf524cfdb4db384b85Cristy       finish          complete the installation of libtool libraries
205515f2201421a23fbf95840adf524cfdb4db384b85Cristy       install         install libraries or executables
205615f2201421a23fbf95840adf524cfdb4db384b85Cristy       link            create a library or an executable
205715f2201421a23fbf95840adf524cfdb4db384b85Cristy       uninstall       remove libraries from an installed directory
205815f2201421a23fbf95840adf524cfdb4db384b85Cristy
205915f2201421a23fbf95840adf524cfdb4db384b85CristyMODE-ARGS vary depending on the MODE.  When passed as first option,
206015f2201421a23fbf95840adf524cfdb4db384b85Cristy'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
206115f2201421a23fbf95840adf524cfdb4db384b85CristyTry '$progname --help --mode=MODE' for a more detailed description of MODE.
206215f2201421a23fbf95840adf524cfdb4db384b85Cristy
206315f2201421a23fbf95840adf524cfdb4db384b85CristyWhen reporting a bug, please describe a test case to reproduce it and
206415f2201421a23fbf95840adf524cfdb4db384b85Cristyinclude the following information:
206515f2201421a23fbf95840adf524cfdb4db384b85Cristy
206615f2201421a23fbf95840adf524cfdb4db384b85Cristy       host-triplet:   $host
206715f2201421a23fbf95840adf524cfdb4db384b85Cristy       shell:          $SHELL
206815f2201421a23fbf95840adf524cfdb4db384b85Cristy       compiler:       $LTCC
206915f2201421a23fbf95840adf524cfdb4db384b85Cristy       compiler flags: $LTCFLAGS
207015f2201421a23fbf95840adf524cfdb4db384b85Cristy       linker:         $LD (gnu? $with_gnu_ld)
207115f2201421a23fbf95840adf524cfdb4db384b85Cristy       version:        $progname (GNU libtool) 2.4.6
207215f2201421a23fbf95840adf524cfdb4db384b85Cristy       automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
207315f2201421a23fbf95840adf524cfdb4db384b85Cristy       autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
207415f2201421a23fbf95840adf524cfdb4db384b85Cristy
207515f2201421a23fbf95840adf524cfdb4db384b85CristyReport bugs to <bug-libtool@gnu.org>.
207615f2201421a23fbf95840adf524cfdb4db384b85CristyGNU libtool home page: <http://www.gnu.org/software/libtool/>.
207715f2201421a23fbf95840adf524cfdb4db384b85CristyGeneral help using GNU software: <http://www.gnu.org/gethelp/>."
207815f2201421a23fbf95840adf524cfdb4db384b85Cristy    exit 0
207915f2201421a23fbf95840adf524cfdb4db384b85Cristy}
2080da16f16767eb31921af855f17bda465fffc4e000cristy
2081da16f16767eb31921af855f17bda465fffc4e000cristy
208215f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_lo2o OBJECT-NAME
208315f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------
208415f2201421a23fbf95840adf524cfdb4db384b85Cristy# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
208515f2201421a23fbf95840adf524cfdb4db384b85Cristy# object suffix.
208615f2201421a23fbf95840adf524cfdb4db384b85Cristy
208715f2201421a23fbf95840adf524cfdb4db384b85Cristylo2o=s/\\.lo\$/.$objext/
208815f2201421a23fbf95840adf524cfdb4db384b85Cristyo2lo=s/\\.$objext\$/.lo/
208915f2201421a23fbf95840adf524cfdb4db384b85Cristy
209015f2201421a23fbf95840adf524cfdb4db384b85Cristyif test yes = "$_G_HAVE_XSI_OPS"; then
209115f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'func_lo2o ()
209215f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
209315f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $1 in
209415f2201421a23fbf95840adf524cfdb4db384b85Cristy      *.lo) func_lo2o_result=${1%.lo}.$objext ;;
209515f2201421a23fbf95840adf524cfdb4db384b85Cristy      *   ) func_lo2o_result=$1               ;;
209615f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
209715f2201421a23fbf95840adf524cfdb4db384b85Cristy  }'
209815f2201421a23fbf95840adf524cfdb4db384b85Cristy
209915f2201421a23fbf95840adf524cfdb4db384b85Cristy  # func_xform LIBOBJ-OR-SOURCE
210015f2201421a23fbf95840adf524cfdb4db384b85Cristy  # ---------------------------
210115f2201421a23fbf95840adf524cfdb4db384b85Cristy  # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
210215f2201421a23fbf95840adf524cfdb4db384b85Cristy  # suffix to a '.lo' libtool-object suffix.
210315f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'func_xform ()
210415f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
210515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_xform_result=${1%.*}.lo
210615f2201421a23fbf95840adf524cfdb4db384b85Cristy  }'
210715f2201421a23fbf95840adf524cfdb4db384b85Cristyelse
210815f2201421a23fbf95840adf524cfdb4db384b85Cristy  # ...otherwise fall back to using sed.
210915f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_lo2o ()
211015f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
211115f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
211215f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
211315f2201421a23fbf95840adf524cfdb4db384b85Cristy
211415f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_xform ()
211515f2201421a23fbf95840adf524cfdb4db384b85Cristy  {
211615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
211715f2201421a23fbf95840adf524cfdb4db384b85Cristy  }
211815f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
2119da16f16767eb31921af855f17bda465fffc4e000cristy
2120da16f16767eb31921af855f17bda465fffc4e000cristy
212115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_fatal_configuration ARG...
212215f2201421a23fbf95840adf524cfdb4db384b85Cristy# -------------------------------
21233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Echo program name prefixed message to standard error, followed by
21243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# a configuration failure hint, and exit.
21253ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_fatal_configuration ()
21263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
212715f2201421a23fbf95840adf524cfdb4db384b85Cristy    func__fatal_error ${1+"$@"} \
212815f2201421a23fbf95840adf524cfdb4db384b85Cristy      "See the $PACKAGE documentation for more information." \
212915f2201421a23fbf95840adf524cfdb4db384b85Cristy      "Fatal configuration error."
21303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
21313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
21323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
21333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_config
213415f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------
21353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Display the configuration for all the tags in this script.
21363ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_config ()
21373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
21383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    re_begincf='^# ### BEGIN LIBTOOL'
21393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    re_endcf='^# ### END LIBTOOL'
21403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
21413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Default configuration.
21423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
21433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
21443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Now print the configurations for the tags.
21453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for tagname in $taglist; do
21463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
21473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
21483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
21493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit $?
21503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
21513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
215215f2201421a23fbf95840adf524cfdb4db384b85Cristy
21533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_features
215415f2201421a23fbf95840adf524cfdb4db384b85Cristy# -------------
21553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Display the features supported by this script.
21563ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_features ()
21573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
215898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    echo "host: $host"
215915f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$build_libtool_libs"; then
216098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      echo "enable shared libraries"
21613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
216298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      echo "disable shared libraries"
21633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
216415f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$build_old_libs"; then
216598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      echo "enable static libraries"
21663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
216798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      echo "disable static libraries"
21683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
21693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
21703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit $?
21713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
21723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
217315f2201421a23fbf95840adf524cfdb4db384b85Cristy
217415f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_enable_tag TAGNAME
217515f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------------
21763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Verify that TAGNAME is valid, and either flag an error and exit, or
21773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
21783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# variable here.
21793ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_enable_tag ()
21803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
218115f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Global variable:
218215f2201421a23fbf95840adf524cfdb4db384b85Cristy    tagname=$1
21833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
218415f2201421a23fbf95840adf524cfdb4db384b85Cristy    re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
218515f2201421a23fbf95840adf524cfdb4db384b85Cristy    re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
218615f2201421a23fbf95840adf524cfdb4db384b85Cristy    sed_extractcf=/$re_begincf/,/$re_endcf/p
21873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
218815f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Validate tagname.
218915f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $tagname in
219015f2201421a23fbf95840adf524cfdb4db384b85Cristy      *[!-_A-Za-z0-9,/]*)
219115f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_fatal_error "invalid tag name: $tagname"
219215f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
219315f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
21943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
219515f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Don't test for the "default" C tag, as we know it's
219615f2201421a23fbf95840adf524cfdb4db384b85Cristy    # there but not specially marked.
219715f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $tagname in
219815f2201421a23fbf95840adf524cfdb4db384b85Cristy        CC) ;;
21993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *)
220015f2201421a23fbf95840adf524cfdb4db384b85Cristy        if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
220115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  taglist="$taglist $tagname"
220215f2201421a23fbf95840adf524cfdb4db384b85Cristy
220315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # Evaluate the configuration.  Be careful to quote the path
220415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # and the sed script, to avoid splitting on whitespace, but
220515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # also don't use non-portable quotes within backquotes within
220615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # quotes we have to do it in 2 steps:
220715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
220815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  eval "$extractedcf"
220915f2201421a23fbf95840adf524cfdb4db384b85Cristy        else
221015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_error "ignoring unknown tag $tagname"
221115f2201421a23fbf95840adf524cfdb4db384b85Cristy        fi
221215f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
221315f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
22143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
22153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
221615f2201421a23fbf95840adf524cfdb4db384b85Cristy
2217da16f16767eb31921af855f17bda465fffc4e000cristy# func_check_version_match
221815f2201421a23fbf95840adf524cfdb4db384b85Cristy# ------------------------
2219da16f16767eb31921af855f17bda465fffc4e000cristy# Ensure that we are using m4 macros, and libtool script from the same
2220da16f16767eb31921af855f17bda465fffc4e000cristy# release of libtool.
2221da16f16767eb31921af855f17bda465fffc4e000cristyfunc_check_version_match ()
22223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
222315f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test "$package_revision" != "$macro_revision"; then
222415f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test "$VERSION" != "$macro_version"; then
222515f2201421a23fbf95840adf524cfdb4db384b85Cristy        if test -z "$macro_version"; then
222615f2201421a23fbf95840adf524cfdb4db384b85Cristy          cat >&2 <<_LT_EOF
2227da16f16767eb31921af855f17bda465fffc4e000cristy$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
2228da16f16767eb31921af855f17bda465fffc4e000cristy$progname: definition of this LT_INIT comes from an older release.
2229da16f16767eb31921af855f17bda465fffc4e000cristy$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2230da16f16767eb31921af855f17bda465fffc4e000cristy$progname: and run autoconf again.
2231da16f16767eb31921af855f17bda465fffc4e000cristy_LT_EOF
223215f2201421a23fbf95840adf524cfdb4db384b85Cristy        else
223315f2201421a23fbf95840adf524cfdb4db384b85Cristy          cat >&2 <<_LT_EOF
2234da16f16767eb31921af855f17bda465fffc4e000cristy$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
2235da16f16767eb31921af855f17bda465fffc4e000cristy$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2236da16f16767eb31921af855f17bda465fffc4e000cristy$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2237da16f16767eb31921af855f17bda465fffc4e000cristy$progname: and run autoconf again.
2238da16f16767eb31921af855f17bda465fffc4e000cristy_LT_EOF
223915f2201421a23fbf95840adf524cfdb4db384b85Cristy        fi
224015f2201421a23fbf95840adf524cfdb4db384b85Cristy      else
224115f2201421a23fbf95840adf524cfdb4db384b85Cristy        cat >&2 <<_LT_EOF
2242da16f16767eb31921af855f17bda465fffc4e000cristy$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
2243da16f16767eb31921af855f17bda465fffc4e000cristy$progname: but the definition of this LT_INIT comes from revision $macro_revision.
2244da16f16767eb31921af855f17bda465fffc4e000cristy$progname: You should recreate aclocal.m4 with macros from revision $package_revision
2245da16f16767eb31921af855f17bda465fffc4e000cristy$progname: of $PACKAGE $VERSION and run autoconf again.
2246da16f16767eb31921af855f17bda465fffc4e000cristy_LT_EOF
224715f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
22483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
224915f2201421a23fbf95840adf524cfdb4db384b85Cristy      exit $EXIT_MISMATCH
225015f2201421a23fbf95840adf524cfdb4db384b85Cristy    fi
2251da16f16767eb31921af855f17bda465fffc4e000cristy}
2252da16f16767eb31921af855f17bda465fffc4e000cristy
2253da16f16767eb31921af855f17bda465fffc4e000cristy
225415f2201421a23fbf95840adf524cfdb4db384b85Cristy# libtool_options_prep [ARG]...
225515f2201421a23fbf95840adf524cfdb4db384b85Cristy# -----------------------------
225615f2201421a23fbf95840adf524cfdb4db384b85Cristy# Preparation for options parsed by libtool.
225715f2201421a23fbf95840adf524cfdb4db384b85Cristylibtool_options_prep ()
225815f2201421a23fbf95840adf524cfdb4db384b85Cristy{
225915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_mode
22603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
226115f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Option defaults:
226215f2201421a23fbf95840adf524cfdb4db384b85Cristy    opt_config=false
226315f2201421a23fbf95840adf524cfdb4db384b85Cristy    opt_dlopen=
226415f2201421a23fbf95840adf524cfdb4db384b85Cristy    opt_dry_run=false
226515f2201421a23fbf95840adf524cfdb4db384b85Cristy    opt_help=false
226615f2201421a23fbf95840adf524cfdb4db384b85Cristy    opt_mode=
226715f2201421a23fbf95840adf524cfdb4db384b85Cristy    opt_preserve_dup_deps=false
226815f2201421a23fbf95840adf524cfdb4db384b85Cristy    opt_quiet=false
2269da16f16767eb31921af855f17bda465fffc4e000cristy
227015f2201421a23fbf95840adf524cfdb4db384b85Cristy    nonopt=
227115f2201421a23fbf95840adf524cfdb4db384b85Cristy    preserve_args=
2272da16f16767eb31921af855f17bda465fffc4e000cristy
227315f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Shorthand for --mode=foo, only valid as the first argument
227415f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $1 in
227515f2201421a23fbf95840adf524cfdb4db384b85Cristy    clean|clea|cle|cl)
227615f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift; set dummy --mode clean ${1+"$@"}; shift
227715f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
227815f2201421a23fbf95840adf524cfdb4db384b85Cristy    compile|compil|compi|comp|com|co|c)
227915f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift; set dummy --mode compile ${1+"$@"}; shift
228015f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
228115f2201421a23fbf95840adf524cfdb4db384b85Cristy    execute|execut|execu|exec|exe|ex|e)
228215f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift; set dummy --mode execute ${1+"$@"}; shift
228315f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
228415f2201421a23fbf95840adf524cfdb4db384b85Cristy    finish|finis|fini|fin|fi|f)
228515f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift; set dummy --mode finish ${1+"$@"}; shift
228615f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
228715f2201421a23fbf95840adf524cfdb4db384b85Cristy    install|instal|insta|inst|ins|in|i)
228815f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift; set dummy --mode install ${1+"$@"}; shift
228915f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
229015f2201421a23fbf95840adf524cfdb4db384b85Cristy    link|lin|li|l)
229115f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift; set dummy --mode link ${1+"$@"}; shift
229215f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
229315f2201421a23fbf95840adf524cfdb4db384b85Cristy    uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
229415f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift; set dummy --mode uninstall ${1+"$@"}; shift
229515f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
229615f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
229715f2201421a23fbf95840adf524cfdb4db384b85Cristy
229815f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Pass back the list of options.
229915f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_eval ${1+"$@"}
230015f2201421a23fbf95840adf524cfdb4db384b85Cristy    libtool_options_prep_result=$func_quote_for_eval_result
230115f2201421a23fbf95840adf524cfdb4db384b85Cristy}
230215f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_add_hook func_options_prep libtool_options_prep
2303da16f16767eb31921af855f17bda465fffc4e000cristy
2304da16f16767eb31921af855f17bda465fffc4e000cristy
230515f2201421a23fbf95840adf524cfdb4db384b85Cristy# libtool_parse_options [ARG]...
230615f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------------------
230715f2201421a23fbf95840adf524cfdb4db384b85Cristy# Provide handling for libtool specific options.
230815f2201421a23fbf95840adf524cfdb4db384b85Cristylibtool_parse_options ()
2309da16f16767eb31921af855f17bda465fffc4e000cristy{
231015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
23113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
231215f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Perform our own loop to consume as many options as possible in
231315f2201421a23fbf95840adf524cfdb4db384b85Cristy    # each iteration.
231415f2201421a23fbf95840adf524cfdb4db384b85Cristy    while test $# -gt 0; do
231515f2201421a23fbf95840adf524cfdb4db384b85Cristy      _G_opt=$1
231615f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift
231715f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $_G_opt in
231815f2201421a23fbf95840adf524cfdb4db384b85Cristy        --dry-run|--dryrun|-n)
231915f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_dry_run=:
232015f2201421a23fbf95840adf524cfdb4db384b85Cristy                        ;;
232115f2201421a23fbf95840adf524cfdb4db384b85Cristy
232215f2201421a23fbf95840adf524cfdb4db384b85Cristy        --config)       func_config ;;
232315f2201421a23fbf95840adf524cfdb4db384b85Cristy
232415f2201421a23fbf95840adf524cfdb4db384b85Cristy        --dlopen|-dlopen)
232515f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_dlopen="${opt_dlopen+$opt_dlopen
232615f2201421a23fbf95840adf524cfdb4db384b85Cristy}$1"
232715f2201421a23fbf95840adf524cfdb4db384b85Cristy                        shift
232815f2201421a23fbf95840adf524cfdb4db384b85Cristy                        ;;
232915f2201421a23fbf95840adf524cfdb4db384b85Cristy
233015f2201421a23fbf95840adf524cfdb4db384b85Cristy        --preserve-dup-deps)
233115f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_preserve_dup_deps=: ;;
233215f2201421a23fbf95840adf524cfdb4db384b85Cristy
233315f2201421a23fbf95840adf524cfdb4db384b85Cristy        --features)     func_features ;;
233415f2201421a23fbf95840adf524cfdb4db384b85Cristy
233515f2201421a23fbf95840adf524cfdb4db384b85Cristy        --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
233615f2201421a23fbf95840adf524cfdb4db384b85Cristy
233715f2201421a23fbf95840adf524cfdb4db384b85Cristy        --help)         opt_help=: ;;
233815f2201421a23fbf95840adf524cfdb4db384b85Cristy
233915f2201421a23fbf95840adf524cfdb4db384b85Cristy        --help-all)     opt_help=': help-all' ;;
234015f2201421a23fbf95840adf524cfdb4db384b85Cristy
234115f2201421a23fbf95840adf524cfdb4db384b85Cristy        --mode)         test $# = 0 && func_missing_arg $_G_opt && break
234215f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_mode=$1
234315f2201421a23fbf95840adf524cfdb4db384b85Cristy                        case $1 in
234415f2201421a23fbf95840adf524cfdb4db384b85Cristy                          # Valid mode arguments:
234515f2201421a23fbf95840adf524cfdb4db384b85Cristy                          clean|compile|execute|finish|install|link|relink|uninstall) ;;
234615f2201421a23fbf95840adf524cfdb4db384b85Cristy
234715f2201421a23fbf95840adf524cfdb4db384b85Cristy                          # Catch anything else as an error
234815f2201421a23fbf95840adf524cfdb4db384b85Cristy                          *) func_error "invalid argument for $_G_opt"
234915f2201421a23fbf95840adf524cfdb4db384b85Cristy                             exit_cmd=exit
235015f2201421a23fbf95840adf524cfdb4db384b85Cristy                             break
235115f2201421a23fbf95840adf524cfdb4db384b85Cristy                             ;;
235215f2201421a23fbf95840adf524cfdb4db384b85Cristy                        esac
235315f2201421a23fbf95840adf524cfdb4db384b85Cristy                        shift
235415f2201421a23fbf95840adf524cfdb4db384b85Cristy                        ;;
235515f2201421a23fbf95840adf524cfdb4db384b85Cristy
235615f2201421a23fbf95840adf524cfdb4db384b85Cristy        --no-silent|--no-quiet)
235715f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_quiet=false
235815f2201421a23fbf95840adf524cfdb4db384b85Cristy                        func_append preserve_args " $_G_opt"
235915f2201421a23fbf95840adf524cfdb4db384b85Cristy                        ;;
236015f2201421a23fbf95840adf524cfdb4db384b85Cristy
236115f2201421a23fbf95840adf524cfdb4db384b85Cristy        --no-warnings|--no-warning|--no-warn)
236215f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_warning=false
236315f2201421a23fbf95840adf524cfdb4db384b85Cristy                        func_append preserve_args " $_G_opt"
236415f2201421a23fbf95840adf524cfdb4db384b85Cristy                        ;;
236515f2201421a23fbf95840adf524cfdb4db384b85Cristy
236615f2201421a23fbf95840adf524cfdb4db384b85Cristy        --no-verbose)
236715f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_verbose=false
236815f2201421a23fbf95840adf524cfdb4db384b85Cristy                        func_append preserve_args " $_G_opt"
236915f2201421a23fbf95840adf524cfdb4db384b85Cristy                        ;;
237015f2201421a23fbf95840adf524cfdb4db384b85Cristy
237115f2201421a23fbf95840adf524cfdb4db384b85Cristy        --silent|--quiet)
237215f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_quiet=:
237315f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_verbose=false
237415f2201421a23fbf95840adf524cfdb4db384b85Cristy                        func_append preserve_args " $_G_opt"
237515f2201421a23fbf95840adf524cfdb4db384b85Cristy                        ;;
237615f2201421a23fbf95840adf524cfdb4db384b85Cristy
237715f2201421a23fbf95840adf524cfdb4db384b85Cristy        --tag)          test $# = 0 && func_missing_arg $_G_opt && break
237815f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_tag=$1
237915f2201421a23fbf95840adf524cfdb4db384b85Cristy                        func_append preserve_args " $_G_opt $1"
238015f2201421a23fbf95840adf524cfdb4db384b85Cristy                        func_enable_tag "$1"
238115f2201421a23fbf95840adf524cfdb4db384b85Cristy                        shift
238215f2201421a23fbf95840adf524cfdb4db384b85Cristy                        ;;
238315f2201421a23fbf95840adf524cfdb4db384b85Cristy
238415f2201421a23fbf95840adf524cfdb4db384b85Cristy        --verbose|-v)   opt_quiet=false
238515f2201421a23fbf95840adf524cfdb4db384b85Cristy                        opt_verbose=:
238615f2201421a23fbf95840adf524cfdb4db384b85Cristy                        func_append preserve_args " $_G_opt"
238715f2201421a23fbf95840adf524cfdb4db384b85Cristy                        ;;
238815f2201421a23fbf95840adf524cfdb4db384b85Cristy
238915f2201421a23fbf95840adf524cfdb4db384b85Cristy	# An option not handled by this hook function:
239015f2201421a23fbf95840adf524cfdb4db384b85Cristy        *)		set dummy "$_G_opt" ${1+"$@"};	shift; break  ;;
239115f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
239215f2201421a23fbf95840adf524cfdb4db384b85Cristy    done
2393da16f16767eb31921af855f17bda465fffc4e000cristy
2394da16f16767eb31921af855f17bda465fffc4e000cristy
239515f2201421a23fbf95840adf524cfdb4db384b85Cristy    # save modified positional parameters for caller
239615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_eval ${1+"$@"}
239715f2201421a23fbf95840adf524cfdb4db384b85Cristy    libtool_parse_options_result=$func_quote_for_eval_result
239815f2201421a23fbf95840adf524cfdb4db384b85Cristy}
239915f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_add_hook func_parse_options libtool_parse_options
24003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
24013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
24023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
240315f2201421a23fbf95840adf524cfdb4db384b85Cristy# libtool_validate_options [ARG]...
240415f2201421a23fbf95840adf524cfdb4db384b85Cristy# ---------------------------------
240515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Perform any sanity checks on option settings and/or unconsumed
240615f2201421a23fbf95840adf524cfdb4db384b85Cristy# arguments.
240715f2201421a23fbf95840adf524cfdb4db384b85Cristylibtool_validate_options ()
240815f2201421a23fbf95840adf524cfdb4db384b85Cristy{
240915f2201421a23fbf95840adf524cfdb4db384b85Cristy    # save first non-option argument
241015f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test 0 -lt $#; then
241115f2201421a23fbf95840adf524cfdb4db384b85Cristy      nonopt=$1
241215f2201421a23fbf95840adf524cfdb4db384b85Cristy      shift
24133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
24143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
241515f2201421a23fbf95840adf524cfdb4db384b85Cristy    # preserve --debug
241615f2201421a23fbf95840adf524cfdb4db384b85Cristy    test : = "$debug_cmd" || func_append preserve_args " --debug"
24173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
241815f2201421a23fbf95840adf524cfdb4db384b85Cristy    case $host in
241915f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
242015f2201421a23fbf95840adf524cfdb4db384b85Cristy      # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
242115f2201421a23fbf95840adf524cfdb4db384b85Cristy      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
242215f2201421a23fbf95840adf524cfdb4db384b85Cristy        # don't eliminate duplications in $postdeps and $predeps
242315f2201421a23fbf95840adf524cfdb4db384b85Cristy        opt_duplicate_compiler_generated_deps=:
242415f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
242515f2201421a23fbf95840adf524cfdb4db384b85Cristy      *)
242615f2201421a23fbf95840adf524cfdb4db384b85Cristy        opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
242715f2201421a23fbf95840adf524cfdb4db384b85Cristy        ;;
242815f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
24293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
243015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $opt_help || {
243115f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Sanity checks first:
243215f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_check_version_match
243315f2201421a23fbf95840adf524cfdb4db384b85Cristy
243415f2201421a23fbf95840adf524cfdb4db384b85Cristy      test yes != "$build_libtool_libs" \
243515f2201421a23fbf95840adf524cfdb4db384b85Cristy        && test yes != "$build_old_libs" \
243615f2201421a23fbf95840adf524cfdb4db384b85Cristy        && func_fatal_configuration "not configured to build any kind of library"
243715f2201421a23fbf95840adf524cfdb4db384b85Cristy
243815f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Darwin sucks
243915f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval std_shrext=\"$shrext_cmds\"
244015f2201421a23fbf95840adf524cfdb4db384b85Cristy
244115f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Only execute mode is allowed to have -dlopen flags.
244215f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
244315f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_error "unrecognized option '-dlopen'"
244415f2201421a23fbf95840adf524cfdb4db384b85Cristy        $ECHO "$help" 1>&2
244515f2201421a23fbf95840adf524cfdb4db384b85Cristy        exit $EXIT_FAILURE
244615f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
24473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
244815f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Change the help message to a mode-specific one.
244915f2201421a23fbf95840adf524cfdb4db384b85Cristy      generic_help=$help
245015f2201421a23fbf95840adf524cfdb4db384b85Cristy      help="Try '$progname --help --mode=$opt_mode' for more information."
245115f2201421a23fbf95840adf524cfdb4db384b85Cristy    }
24523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
245315f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Pass back the unparsed argument list
245415f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_quote_for_eval ${1+"$@"}
245515f2201421a23fbf95840adf524cfdb4db384b85Cristy    libtool_validate_options_result=$func_quote_for_eval_result
2456da16f16767eb31921af855f17bda465fffc4e000cristy}
245715f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_add_hook func_validate_options libtool_validate_options
24583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
24593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
246015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Process options as early as possible so that --help and --version
246115f2201421a23fbf95840adf524cfdb4db384b85Cristy# can return quickly.
246215f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_options ${1+"$@"}
246315f2201421a23fbf95840adf524cfdb4db384b85Cristyeval set dummy "$func_options_result"; shift
246415f2201421a23fbf95840adf524cfdb4db384b85Cristy
24653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
24663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
2467da16f16767eb31921af855f17bda465fffc4e000cristy## ----------- ##
2468da16f16767eb31921af855f17bda465fffc4e000cristy##    Main.    ##
2469da16f16767eb31921af855f17bda465fffc4e000cristy## ----------- ##
24703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
247115f2201421a23fbf95840adf524cfdb4db384b85Cristymagic='%%%MAGIC variable%%%'
247215f2201421a23fbf95840adf524cfdb4db384b85Cristymagic_exe='%%%MAGIC EXE variable%%%'
247315f2201421a23fbf95840adf524cfdb4db384b85Cristy
247415f2201421a23fbf95840adf524cfdb4db384b85Cristy# Global variables.
247515f2201421a23fbf95840adf524cfdb4db384b85Cristyextracted_archives=
247615f2201421a23fbf95840adf524cfdb4db384b85Cristyextracted_serial=0
247715f2201421a23fbf95840adf524cfdb4db384b85Cristy
247815f2201421a23fbf95840adf524cfdb4db384b85Cristy# If this variable is set in any of the actions, the command in it
247915f2201421a23fbf95840adf524cfdb4db384b85Cristy# will be execed at the end.  This prevents here-documents from being
248015f2201421a23fbf95840adf524cfdb4db384b85Cristy# left over by shells.
248115f2201421a23fbf95840adf524cfdb4db384b85Cristyexec_cmd=
248215f2201421a23fbf95840adf524cfdb4db384b85Cristy
248315f2201421a23fbf95840adf524cfdb4db384b85Cristy
248415f2201421a23fbf95840adf524cfdb4db384b85Cristy# A function that is used when there is no print builtin or printf.
248515f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_fallback_echo ()
248615f2201421a23fbf95840adf524cfdb4db384b85Cristy{
248715f2201421a23fbf95840adf524cfdb4db384b85Cristy  eval 'cat <<_LTECHO_EOF
248815f2201421a23fbf95840adf524cfdb4db384b85Cristy$1
248915f2201421a23fbf95840adf524cfdb4db384b85Cristy_LTECHO_EOF'
249015f2201421a23fbf95840adf524cfdb4db384b85Cristy}
249115f2201421a23fbf95840adf524cfdb4db384b85Cristy
249215f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_generated_by_libtool
249315f2201421a23fbf95840adf524cfdb4db384b85Cristy# True iff stdin has been generated by Libtool. This function is only
249415f2201421a23fbf95840adf524cfdb4db384b85Cristy# a basic sanity check; it will hardly flush out determined imposters.
249515f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_generated_by_libtool_p ()
249615f2201421a23fbf95840adf524cfdb4db384b85Cristy{
249715f2201421a23fbf95840adf524cfdb4db384b85Cristy  $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
249815f2201421a23fbf95840adf524cfdb4db384b85Cristy}
249915f2201421a23fbf95840adf524cfdb4db384b85Cristy
25003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_lalib_p file
250115f2201421a23fbf95840adf524cfdb4db384b85Cristy# True iff FILE is a libtool '.la' library or '.lo' object file.
25023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# This function is only a basic sanity check; it will hardly flush out
25033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# determined imposters.
25043ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_lalib_p ()
25053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
25063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -f "$1" &&
250715f2201421a23fbf95840adf524cfdb4db384b85Cristy      $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
25083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
25093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
25103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_lalib_unsafe_p file
251115f2201421a23fbf95840adf524cfdb4db384b85Cristy# True iff FILE is a libtool '.la' library or '.lo' object file.
25123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# This function implements the same check as func_lalib_p without
25133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# resorting to external programs.  To this end, it redirects stdin and
25143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# closes it afterwards, without saving the original file descriptor.
25153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# As a safety measure, use it only where a negative result would be
251615f2201421a23fbf95840adf524cfdb4db384b85Cristy# fatal anyway.  Works if 'file' does not exist.
25173ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_lalib_unsafe_p ()
25183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
25193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    lalib_p=no
25203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
25213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for lalib_p_l in 1 2 3 4
25223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	do
25233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    read lalib_p_line
252415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    case $lalib_p_line in
25253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
25263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
25273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
25283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exec 0<&5 5<&-
25293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
253015f2201421a23fbf95840adf524cfdb4db384b85Cristy    test yes = "$lalib_p"
25313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
25323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
25333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_ltwrapper_script_p file
25343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# True iff FILE is a libtool wrapper script
25353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# This function is only a basic sanity check; it will hardly flush out
25363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# determined imposters.
25373ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_ltwrapper_script_p ()
25383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
253915f2201421a23fbf95840adf524cfdb4db384b85Cristy    test -f "$1" &&
254015f2201421a23fbf95840adf524cfdb4db384b85Cristy      $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
25413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
25423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
25433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_ltwrapper_executable_p file
25443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# True iff FILE is a libtool wrapper executable
25453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# This function is only a basic sanity check; it will hardly flush out
25463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# determined imposters.
25473ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_ltwrapper_executable_p ()
25483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
25493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_ltwrapper_exec_suffix=
25503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $1 in
25513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *.exe) ;;
25523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *) func_ltwrapper_exec_suffix=.exe ;;
25533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
25543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
25553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
25563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
25573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_ltwrapper_scriptname file
25583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Assumes file is an ltwrapper_executable
25593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# uses $file to determine the appropriate filename for a
25603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# temporary ltwrapper_script.
25613ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_ltwrapper_scriptname ()
25623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
2563da16f16767eb31921af855f17bda465fffc4e000cristy    func_dirname_and_basename "$1" "" "."
2564da16f16767eb31921af855f17bda465fffc4e000cristy    func_stripname '' '.exe' "$func_basename_result"
256515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
25663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
25673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
25683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_ltwrapper_p file
25693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# True iff FILE is a libtool wrapper script or wrapper executable
25703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# This function is only a basic sanity check; it will hardly flush out
25713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# determined imposters.
25723ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_ltwrapper_p ()
25733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
25743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
25753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
25763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
25773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
25783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_execute_cmds commands fail_cmd
25793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Execute tilde-delimited COMMANDS.
25803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# If FAIL_CMD is given, eval that upon failure.
25813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# FAIL_CMD may read-access the current command in variable CMD!
25823ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_execute_cmds ()
25833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
258415f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
258515f2201421a23fbf95840adf524cfdb4db384b85Cristy
25863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    save_ifs=$IFS; IFS='~'
25873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for cmd in $1; do
258815f2201421a23fbf95840adf524cfdb4db384b85Cristy      IFS=$sp$nl
25893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      eval cmd=\"$cmd\"
259015f2201421a23fbf95840adf524cfdb4db384b85Cristy      IFS=$save_ifs
25913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_show_eval "$cmd" "${2-:}"
25923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
25933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    IFS=$save_ifs
25943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
25953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
25963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
25973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_source file
25983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Source FILE, adding directory component if necessary.
25993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Note that it is not necessary on cygwin/mingw to append a dot to
26003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
26013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# behavior happens only for exec(3), not for open(2)!  Also, sourcing
260215f2201421a23fbf95840adf524cfdb4db384b85Cristy# 'FILE.' does not work on cygwin managed mounts.
26033ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_source ()
26043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
260515f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
260615f2201421a23fbf95840adf524cfdb4db384b85Cristy
26073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $1 in
26083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    */* | *\\*)	. "$1" ;;
26093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *)		. "./$1" ;;
26103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
26113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
26123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
26133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
2614da16f16767eb31921af855f17bda465fffc4e000cristy# func_resolve_sysroot PATH
2615da16f16767eb31921af855f17bda465fffc4e000cristy# Replace a leading = in PATH with a sysroot.  Store the result into
2616da16f16767eb31921af855f17bda465fffc4e000cristy# func_resolve_sysroot_result
2617da16f16767eb31921af855f17bda465fffc4e000cristyfunc_resolve_sysroot ()
2618da16f16767eb31921af855f17bda465fffc4e000cristy{
2619da16f16767eb31921af855f17bda465fffc4e000cristy  func_resolve_sysroot_result=$1
2620da16f16767eb31921af855f17bda465fffc4e000cristy  case $func_resolve_sysroot_result in
2621da16f16767eb31921af855f17bda465fffc4e000cristy  =*)
2622da16f16767eb31921af855f17bda465fffc4e000cristy    func_stripname '=' '' "$func_resolve_sysroot_result"
2623da16f16767eb31921af855f17bda465fffc4e000cristy    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2624da16f16767eb31921af855f17bda465fffc4e000cristy    ;;
2625da16f16767eb31921af855f17bda465fffc4e000cristy  esac
2626da16f16767eb31921af855f17bda465fffc4e000cristy}
2627da16f16767eb31921af855f17bda465fffc4e000cristy
2628da16f16767eb31921af855f17bda465fffc4e000cristy# func_replace_sysroot PATH
2629da16f16767eb31921af855f17bda465fffc4e000cristy# If PATH begins with the sysroot, replace it with = and
2630da16f16767eb31921af855f17bda465fffc4e000cristy# store the result into func_replace_sysroot_result.
2631da16f16767eb31921af855f17bda465fffc4e000cristyfunc_replace_sysroot ()
2632da16f16767eb31921af855f17bda465fffc4e000cristy{
263315f2201421a23fbf95840adf524cfdb4db384b85Cristy  case $lt_sysroot:$1 in
2634da16f16767eb31921af855f17bda465fffc4e000cristy  ?*:"$lt_sysroot"*)
2635da16f16767eb31921af855f17bda465fffc4e000cristy    func_stripname "$lt_sysroot" '' "$1"
263615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_replace_sysroot_result='='$func_stripname_result
2637da16f16767eb31921af855f17bda465fffc4e000cristy    ;;
2638da16f16767eb31921af855f17bda465fffc4e000cristy  *)
2639da16f16767eb31921af855f17bda465fffc4e000cristy    # Including no sysroot.
2640da16f16767eb31921af855f17bda465fffc4e000cristy    func_replace_sysroot_result=$1
2641da16f16767eb31921af855f17bda465fffc4e000cristy    ;;
2642da16f16767eb31921af855f17bda465fffc4e000cristy  esac
2643da16f16767eb31921af855f17bda465fffc4e000cristy}
2644da16f16767eb31921af855f17bda465fffc4e000cristy
26453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_infer_tag arg
26463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Infer tagged configuration to use if any are available and
26473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# if one wasn't chosen via the "--tag" command line option.
26483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Only attempt this if the compiler in the base compile
26493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# command doesn't match the default compiler.
26503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# arg is usually of the form 'gcc ...'
26513ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_infer_tag ()
26523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
265315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
265415f2201421a23fbf95840adf524cfdb4db384b85Cristy
26553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test -n "$available_tags" && test -z "$tagname"; then
26563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      CC_quoted=
26573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for arg in $CC; do
2658da16f16767eb31921af855f17bda465fffc4e000cristy	func_append_quoted CC_quoted "$arg"
26593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
266098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      CC_expanded=`func_echo_all $CC`
266198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      CC_quoted_expanded=`func_echo_all $CC_quoted`
26623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $@ in
26633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Blanks in the command may have been stripped by the calling shell,
26643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # but not from the CC environment variable when configure was run.
266598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
266698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
26673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Blanks at the start of $base_compile will cause this to fail
26683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # if we don't check for them as well.
26693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
26703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for z in $available_tags; do
26713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
26723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Evaluate the configuration.
267315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
26743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    CC_quoted=
26753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for arg in $CC; do
26763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Double-quote args containing other shell metacharacters.
2677da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append_quoted CC_quoted "$arg"
26783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
267998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    CC_expanded=`func_echo_all $CC`
268098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    CC_quoted_expanded=`func_echo_all $CC_quoted`
26813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case "$@ " in
268298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
268398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
26843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # The compiler in the base compile command matches
26853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # the one in the tagged configuration.
26863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Assume this is the tagged configuration we want.
26873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      tagname=$z
26883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      break
26893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
26903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
26913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
26923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
26933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# If $tagname still isn't set, then no tagged configuration
26943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# was found and let the user know that the "--tag" command
26953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# line option must be used.
26963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -z "$tagname"; then
26973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_echo "unable to infer tagged configuration"
269815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_error "specify a tag with '--tag'"
26993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#	else
27003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#	  func_verbose "using $tagname tagged configuration"
27013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
27023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
27033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
27043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
27053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
27063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
27073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
27083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
2709da16f16767eb31921af855f17bda465fffc4e000cristy# func_write_libtool_object output_name pic_name nonpic_name
2710da16f16767eb31921af855f17bda465fffc4e000cristy# Create a libtool object file (analogous to a ".la" file),
2711da16f16767eb31921af855f17bda465fffc4e000cristy# but don't create it if we're doing a dry run.
2712da16f16767eb31921af855f17bda465fffc4e000cristyfunc_write_libtool_object ()
2713da16f16767eb31921af855f17bda465fffc4e000cristy{
271415f2201421a23fbf95840adf524cfdb4db384b85Cristy    write_libobj=$1
271515f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$build_libtool_libs"; then
271615f2201421a23fbf95840adf524cfdb4db384b85Cristy      write_lobj=\'$2\'
2717da16f16767eb31921af855f17bda465fffc4e000cristy    else
2718da16f16767eb31921af855f17bda465fffc4e000cristy      write_lobj=none
2719da16f16767eb31921af855f17bda465fffc4e000cristy    fi
2720da16f16767eb31921af855f17bda465fffc4e000cristy
272115f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$build_old_libs"; then
272215f2201421a23fbf95840adf524cfdb4db384b85Cristy      write_oldobj=\'$3\'
2723da16f16767eb31921af855f17bda465fffc4e000cristy    else
2724da16f16767eb31921af855f17bda465fffc4e000cristy      write_oldobj=none
2725da16f16767eb31921af855f17bda465fffc4e000cristy    fi
2726da16f16767eb31921af855f17bda465fffc4e000cristy
2727da16f16767eb31921af855f17bda465fffc4e000cristy    $opt_dry_run || {
2728da16f16767eb31921af855f17bda465fffc4e000cristy      cat >${write_libobj}T <<EOF
2729da16f16767eb31921af855f17bda465fffc4e000cristy# $write_libobj - a libtool object file
273015f2201421a23fbf95840adf524cfdb4db384b85Cristy# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
2731da16f16767eb31921af855f17bda465fffc4e000cristy#
2732da16f16767eb31921af855f17bda465fffc4e000cristy# Please DO NOT delete this file!
2733da16f16767eb31921af855f17bda465fffc4e000cristy# It is necessary for linking the library.
2734da16f16767eb31921af855f17bda465fffc4e000cristy
2735da16f16767eb31921af855f17bda465fffc4e000cristy# Name of the PIC object.
2736da16f16767eb31921af855f17bda465fffc4e000cristypic_object=$write_lobj
2737da16f16767eb31921af855f17bda465fffc4e000cristy
2738da16f16767eb31921af855f17bda465fffc4e000cristy# Name of the non-PIC object
2739da16f16767eb31921af855f17bda465fffc4e000cristynon_pic_object=$write_oldobj
2740da16f16767eb31921af855f17bda465fffc4e000cristy
2741da16f16767eb31921af855f17bda465fffc4e000cristyEOF
274215f2201421a23fbf95840adf524cfdb4db384b85Cristy      $MV "${write_libobj}T" "$write_libobj"
2743da16f16767eb31921af855f17bda465fffc4e000cristy    }
2744da16f16767eb31921af855f17bda465fffc4e000cristy}
2745da16f16767eb31921af855f17bda465fffc4e000cristy
2746da16f16767eb31921af855f17bda465fffc4e000cristy
2747da16f16767eb31921af855f17bda465fffc4e000cristy##################################################
2748da16f16767eb31921af855f17bda465fffc4e000cristy# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2749da16f16767eb31921af855f17bda465fffc4e000cristy##################################################
2750da16f16767eb31921af855f17bda465fffc4e000cristy
2751da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_core_file_wine_to_w32 ARG
2752da16f16767eb31921af855f17bda465fffc4e000cristy# Helper function used by file name conversion functions when $build is *nix,
2753da16f16767eb31921af855f17bda465fffc4e000cristy# and $host is mingw, cygwin, or some other w32 environment. Relies on a
2754da16f16767eb31921af855f17bda465fffc4e000cristy# correctly configured wine environment available, with the winepath program
2755da16f16767eb31921af855f17bda465fffc4e000cristy# in $build's $PATH.
2756da16f16767eb31921af855f17bda465fffc4e000cristy#
2757da16f16767eb31921af855f17bda465fffc4e000cristy# ARG is the $build file name to be converted to w32 format.
2758da16f16767eb31921af855f17bda465fffc4e000cristy# Result is available in $func_convert_core_file_wine_to_w32_result, and will
2759da16f16767eb31921af855f17bda465fffc4e000cristy# be empty on error (or when ARG is empty)
2760da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_core_file_wine_to_w32 ()
2761da16f16767eb31921af855f17bda465fffc4e000cristy{
276215f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
276315f2201421a23fbf95840adf524cfdb4db384b85Cristy
276415f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_convert_core_file_wine_to_w32_result=$1
2765da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
2766da16f16767eb31921af855f17bda465fffc4e000cristy    # Unfortunately, winepath does not exit with a non-zero error code, so we
2767da16f16767eb31921af855f17bda465fffc4e000cristy    # are forced to check the contents of stdout. On the other hand, if the
2768da16f16767eb31921af855f17bda465fffc4e000cristy    # command is not found, the shell will set an exit code of 127 and print
2769da16f16767eb31921af855f17bda465fffc4e000cristy    # *an error message* to stdout. So we must check for both error code of
2770da16f16767eb31921af855f17bda465fffc4e000cristy    # zero AND non-empty stdout, which explains the odd construction:
2771da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
277215f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
2773da16f16767eb31921af855f17bda465fffc4e000cristy      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
277415f2201421a23fbf95840adf524cfdb4db384b85Cristy        $SED -e "$sed_naive_backslashify"`
2775da16f16767eb31921af855f17bda465fffc4e000cristy    else
2776da16f16767eb31921af855f17bda465fffc4e000cristy      func_convert_core_file_wine_to_w32_result=
2777da16f16767eb31921af855f17bda465fffc4e000cristy    fi
2778da16f16767eb31921af855f17bda465fffc4e000cristy  fi
2779da16f16767eb31921af855f17bda465fffc4e000cristy}
2780da16f16767eb31921af855f17bda465fffc4e000cristy# end: func_convert_core_file_wine_to_w32
2781da16f16767eb31921af855f17bda465fffc4e000cristy
2782da16f16767eb31921af855f17bda465fffc4e000cristy
2783da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_core_path_wine_to_w32 ARG
2784da16f16767eb31921af855f17bda465fffc4e000cristy# Helper function used by path conversion functions when $build is *nix, and
2785da16f16767eb31921af855f17bda465fffc4e000cristy# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
2786da16f16767eb31921af855f17bda465fffc4e000cristy# configured wine environment available, with the winepath program in $build's
2787da16f16767eb31921af855f17bda465fffc4e000cristy# $PATH. Assumes ARG has no leading or trailing path separator characters.
2788da16f16767eb31921af855f17bda465fffc4e000cristy#
2789da16f16767eb31921af855f17bda465fffc4e000cristy# ARG is path to be converted from $build format to win32.
2790da16f16767eb31921af855f17bda465fffc4e000cristy# Result is available in $func_convert_core_path_wine_to_w32_result.
2791da16f16767eb31921af855f17bda465fffc4e000cristy# Unconvertible file (directory) names in ARG are skipped; if no directory names
2792da16f16767eb31921af855f17bda465fffc4e000cristy# are convertible, then the result may be empty.
2793da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_core_path_wine_to_w32 ()
2794da16f16767eb31921af855f17bda465fffc4e000cristy{
279515f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
279615f2201421a23fbf95840adf524cfdb4db384b85Cristy
2797da16f16767eb31921af855f17bda465fffc4e000cristy  # unfortunately, winepath doesn't convert paths, only file names
279815f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_convert_core_path_wine_to_w32_result=
2799da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
2800da16f16767eb31921af855f17bda465fffc4e000cristy    oldIFS=$IFS
2801da16f16767eb31921af855f17bda465fffc4e000cristy    IFS=:
2802da16f16767eb31921af855f17bda465fffc4e000cristy    for func_convert_core_path_wine_to_w32_f in $1; do
2803da16f16767eb31921af855f17bda465fffc4e000cristy      IFS=$oldIFS
2804da16f16767eb31921af855f17bda465fffc4e000cristy      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
280515f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$func_convert_core_file_wine_to_w32_result"; then
2806da16f16767eb31921af855f17bda465fffc4e000cristy        if test -z "$func_convert_core_path_wine_to_w32_result"; then
280715f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
2808da16f16767eb31921af855f17bda465fffc4e000cristy        else
2809da16f16767eb31921af855f17bda465fffc4e000cristy          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
2810da16f16767eb31921af855f17bda465fffc4e000cristy        fi
2811da16f16767eb31921af855f17bda465fffc4e000cristy      fi
2812da16f16767eb31921af855f17bda465fffc4e000cristy    done
2813da16f16767eb31921af855f17bda465fffc4e000cristy    IFS=$oldIFS
2814da16f16767eb31921af855f17bda465fffc4e000cristy  fi
2815da16f16767eb31921af855f17bda465fffc4e000cristy}
2816da16f16767eb31921af855f17bda465fffc4e000cristy# end: func_convert_core_path_wine_to_w32
2817da16f16767eb31921af855f17bda465fffc4e000cristy
2818da16f16767eb31921af855f17bda465fffc4e000cristy
2819da16f16767eb31921af855f17bda465fffc4e000cristy# func_cygpath ARGS...
2820da16f16767eb31921af855f17bda465fffc4e000cristy# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
2821da16f16767eb31921af855f17bda465fffc4e000cristy# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
2822da16f16767eb31921af855f17bda465fffc4e000cristy# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
2823da16f16767eb31921af855f17bda465fffc4e000cristy# (2), returns the Cygwin file name or path in func_cygpath_result (input
2824da16f16767eb31921af855f17bda465fffc4e000cristy# file name or path is assumed to be in w32 format, as previously converted
2825da16f16767eb31921af855f17bda465fffc4e000cristy# from $build's *nix or MSYS format). In case (3), returns the w32 file name
2826da16f16767eb31921af855f17bda465fffc4e000cristy# or path in func_cygpath_result (input file name or path is assumed to be in
2827da16f16767eb31921af855f17bda465fffc4e000cristy# Cygwin format). Returns an empty string on error.
2828da16f16767eb31921af855f17bda465fffc4e000cristy#
2829da16f16767eb31921af855f17bda465fffc4e000cristy# ARGS are passed to cygpath, with the last one being the file name or path to
2830da16f16767eb31921af855f17bda465fffc4e000cristy# be converted.
2831da16f16767eb31921af855f17bda465fffc4e000cristy#
2832da16f16767eb31921af855f17bda465fffc4e000cristy# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
2833da16f16767eb31921af855f17bda465fffc4e000cristy# environment variable; do not put it in $PATH.
2834da16f16767eb31921af855f17bda465fffc4e000cristyfunc_cygpath ()
2835da16f16767eb31921af855f17bda465fffc4e000cristy{
283615f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
283715f2201421a23fbf95840adf524cfdb4db384b85Cristy
2838da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
2839da16f16767eb31921af855f17bda465fffc4e000cristy    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
2840da16f16767eb31921af855f17bda465fffc4e000cristy    if test "$?" -ne 0; then
2841da16f16767eb31921af855f17bda465fffc4e000cristy      # on failure, ensure result is empty
2842da16f16767eb31921af855f17bda465fffc4e000cristy      func_cygpath_result=
2843da16f16767eb31921af855f17bda465fffc4e000cristy    fi
2844da16f16767eb31921af855f17bda465fffc4e000cristy  else
2845da16f16767eb31921af855f17bda465fffc4e000cristy    func_cygpath_result=
284615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
2847da16f16767eb31921af855f17bda465fffc4e000cristy  fi
2848da16f16767eb31921af855f17bda465fffc4e000cristy}
2849da16f16767eb31921af855f17bda465fffc4e000cristy#end: func_cygpath
2850da16f16767eb31921af855f17bda465fffc4e000cristy
2851da16f16767eb31921af855f17bda465fffc4e000cristy
2852da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_core_msys_to_w32 ARG
2853da16f16767eb31921af855f17bda465fffc4e000cristy# Convert file name or path ARG from MSYS format to w32 format.  Return
2854da16f16767eb31921af855f17bda465fffc4e000cristy# result in func_convert_core_msys_to_w32_result.
2855da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_core_msys_to_w32 ()
2856da16f16767eb31921af855f17bda465fffc4e000cristy{
285715f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
285815f2201421a23fbf95840adf524cfdb4db384b85Cristy
2859da16f16767eb31921af855f17bda465fffc4e000cristy  # awkward: cmd appends spaces to result
2860da16f16767eb31921af855f17bda465fffc4e000cristy  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
286115f2201421a23fbf95840adf524cfdb4db384b85Cristy    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
2862da16f16767eb31921af855f17bda465fffc4e000cristy}
2863da16f16767eb31921af855f17bda465fffc4e000cristy#end: func_convert_core_msys_to_w32
2864da16f16767eb31921af855f17bda465fffc4e000cristy
2865da16f16767eb31921af855f17bda465fffc4e000cristy
2866da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_file_check ARG1 ARG2
2867da16f16767eb31921af855f17bda465fffc4e000cristy# Verify that ARG1 (a file name in $build format) was converted to $host
2868da16f16767eb31921af855f17bda465fffc4e000cristy# format in ARG2. Otherwise, emit an error message, but continue (resetting
2869da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_host_file_result to ARG1).
2870da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_file_check ()
2871da16f16767eb31921af855f17bda465fffc4e000cristy{
287215f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
287315f2201421a23fbf95840adf524cfdb4db384b85Cristy
287415f2201421a23fbf95840adf524cfdb4db384b85Cristy  if test -z "$2" && test -n "$1"; then
2875da16f16767eb31921af855f17bda465fffc4e000cristy    func_error "Could not determine host file name corresponding to"
287615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_error "  '$1'"
2877da16f16767eb31921af855f17bda465fffc4e000cristy    func_error "Continuing, but uninstalled executables may not work."
2878da16f16767eb31921af855f17bda465fffc4e000cristy    # Fallback:
287915f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_to_host_file_result=$1
2880da16f16767eb31921af855f17bda465fffc4e000cristy  fi
2881da16f16767eb31921af855f17bda465fffc4e000cristy}
2882da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_file_check
2883da16f16767eb31921af855f17bda465fffc4e000cristy
2884da16f16767eb31921af855f17bda465fffc4e000cristy
2885da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2886da16f16767eb31921af855f17bda465fffc4e000cristy# Verify that FROM_PATH (a path in $build format) was converted to $host
2887da16f16767eb31921af855f17bda465fffc4e000cristy# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2888da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_host_file_result to a simplistic fallback value (see below).
2889da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_path_check ()
2890da16f16767eb31921af855f17bda465fffc4e000cristy{
289115f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
289215f2201421a23fbf95840adf524cfdb4db384b85Cristy
2893da16f16767eb31921af855f17bda465fffc4e000cristy  if test -z "$4" && test -n "$3"; then
2894da16f16767eb31921af855f17bda465fffc4e000cristy    func_error "Could not determine the host path corresponding to"
289515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_error "  '$3'"
2896da16f16767eb31921af855f17bda465fffc4e000cristy    func_error "Continuing, but uninstalled executables may not work."
2897da16f16767eb31921af855f17bda465fffc4e000cristy    # Fallback.  This is a deliberately simplistic "conversion" and
2898da16f16767eb31921af855f17bda465fffc4e000cristy    # should not be "improved".  See libtool.info.
2899da16f16767eb31921af855f17bda465fffc4e000cristy    if test "x$1" != "x$2"; then
2900da16f16767eb31921af855f17bda465fffc4e000cristy      lt_replace_pathsep_chars="s|$1|$2|g"
2901da16f16767eb31921af855f17bda465fffc4e000cristy      func_to_host_path_result=`echo "$3" |
2902da16f16767eb31921af855f17bda465fffc4e000cristy        $SED -e "$lt_replace_pathsep_chars"`
2903da16f16767eb31921af855f17bda465fffc4e000cristy    else
290415f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_to_host_path_result=$3
2905da16f16767eb31921af855f17bda465fffc4e000cristy    fi
2906da16f16767eb31921af855f17bda465fffc4e000cristy  fi
2907da16f16767eb31921af855f17bda465fffc4e000cristy}
2908da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_path_check
2909da16f16767eb31921af855f17bda465fffc4e000cristy
2910da16f16767eb31921af855f17bda465fffc4e000cristy
2911da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2912da16f16767eb31921af855f17bda465fffc4e000cristy# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2913da16f16767eb31921af855f17bda465fffc4e000cristy# and appending REPL if ORIG matches BACKPAT.
2914da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_path_front_back_pathsep ()
2915da16f16767eb31921af855f17bda465fffc4e000cristy{
291615f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
291715f2201421a23fbf95840adf524cfdb4db384b85Cristy
2918da16f16767eb31921af855f17bda465fffc4e000cristy  case $4 in
291915f2201421a23fbf95840adf524cfdb4db384b85Cristy  $1 ) func_to_host_path_result=$3$func_to_host_path_result
2920da16f16767eb31921af855f17bda465fffc4e000cristy    ;;
2921da16f16767eb31921af855f17bda465fffc4e000cristy  esac
2922da16f16767eb31921af855f17bda465fffc4e000cristy  case $4 in
2923da16f16767eb31921af855f17bda465fffc4e000cristy  $2 ) func_append func_to_host_path_result "$3"
2924da16f16767eb31921af855f17bda465fffc4e000cristy    ;;
2925da16f16767eb31921af855f17bda465fffc4e000cristy  esac
2926da16f16767eb31921af855f17bda465fffc4e000cristy}
2927da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_path_front_back_pathsep
2928da16f16767eb31921af855f17bda465fffc4e000cristy
2929da16f16767eb31921af855f17bda465fffc4e000cristy
2930da16f16767eb31921af855f17bda465fffc4e000cristy##################################################
2931da16f16767eb31921af855f17bda465fffc4e000cristy# $build to $host FILE NAME CONVERSION FUNCTIONS #
2932da16f16767eb31921af855f17bda465fffc4e000cristy##################################################
293315f2201421a23fbf95840adf524cfdb4db384b85Cristy# invoked via '$to_host_file_cmd ARG'
2934da16f16767eb31921af855f17bda465fffc4e000cristy#
2935da16f16767eb31921af855f17bda465fffc4e000cristy# In each case, ARG is the path to be converted from $build to $host format.
2936da16f16767eb31921af855f17bda465fffc4e000cristy# Result will be available in $func_to_host_file_result.
2937da16f16767eb31921af855f17bda465fffc4e000cristy
2938da16f16767eb31921af855f17bda465fffc4e000cristy
2939da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_host_file ARG
2940da16f16767eb31921af855f17bda465fffc4e000cristy# Converts the file name ARG from $build format to $host format. Return result
2941da16f16767eb31921af855f17bda465fffc4e000cristy# in func_to_host_file_result.
2942da16f16767eb31921af855f17bda465fffc4e000cristyfunc_to_host_file ()
2943da16f16767eb31921af855f17bda465fffc4e000cristy{
294415f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
294515f2201421a23fbf95840adf524cfdb4db384b85Cristy
2946da16f16767eb31921af855f17bda465fffc4e000cristy  $to_host_file_cmd "$1"
2947da16f16767eb31921af855f17bda465fffc4e000cristy}
2948da16f16767eb31921af855f17bda465fffc4e000cristy# end func_to_host_file
2949da16f16767eb31921af855f17bda465fffc4e000cristy
2950da16f16767eb31921af855f17bda465fffc4e000cristy
2951da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_tool_file ARG LAZY
2952da16f16767eb31921af855f17bda465fffc4e000cristy# converts the file name ARG from $build format to toolchain format. Return
2953da16f16767eb31921af855f17bda465fffc4e000cristy# result in func_to_tool_file_result.  If the conversion in use is listed
2954da16f16767eb31921af855f17bda465fffc4e000cristy# in (the comma separated) LAZY, no conversion takes place.
2955da16f16767eb31921af855f17bda465fffc4e000cristyfunc_to_tool_file ()
2956da16f16767eb31921af855f17bda465fffc4e000cristy{
295715f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
295815f2201421a23fbf95840adf524cfdb4db384b85Cristy
2959da16f16767eb31921af855f17bda465fffc4e000cristy  case ,$2, in
2960da16f16767eb31921af855f17bda465fffc4e000cristy    *,"$to_tool_file_cmd",*)
2961da16f16767eb31921af855f17bda465fffc4e000cristy      func_to_tool_file_result=$1
2962da16f16767eb31921af855f17bda465fffc4e000cristy      ;;
2963da16f16767eb31921af855f17bda465fffc4e000cristy    *)
2964da16f16767eb31921af855f17bda465fffc4e000cristy      $to_tool_file_cmd "$1"
2965da16f16767eb31921af855f17bda465fffc4e000cristy      func_to_tool_file_result=$func_to_host_file_result
2966da16f16767eb31921af855f17bda465fffc4e000cristy      ;;
2967da16f16767eb31921af855f17bda465fffc4e000cristy  esac
2968da16f16767eb31921af855f17bda465fffc4e000cristy}
2969da16f16767eb31921af855f17bda465fffc4e000cristy# end func_to_tool_file
2970da16f16767eb31921af855f17bda465fffc4e000cristy
2971da16f16767eb31921af855f17bda465fffc4e000cristy
2972da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_file_noop ARG
2973da16f16767eb31921af855f17bda465fffc4e000cristy# Copy ARG to func_to_host_file_result.
2974da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_file_noop ()
2975da16f16767eb31921af855f17bda465fffc4e000cristy{
297615f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_file_result=$1
2977da16f16767eb31921af855f17bda465fffc4e000cristy}
2978da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_file_noop
2979da16f16767eb31921af855f17bda465fffc4e000cristy
2980da16f16767eb31921af855f17bda465fffc4e000cristy
2981da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_file_msys_to_w32 ARG
2982da16f16767eb31921af855f17bda465fffc4e000cristy# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2983da16f16767eb31921af855f17bda465fffc4e000cristy# conversion to w32 is not available inside the cwrapper.  Returns result in
2984da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_host_file_result.
2985da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_file_msys_to_w32 ()
2986da16f16767eb31921af855f17bda465fffc4e000cristy{
298715f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
298815f2201421a23fbf95840adf524cfdb4db384b85Cristy
298915f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_file_result=$1
2990da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
2991da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_core_msys_to_w32 "$1"
299215f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_to_host_file_result=$func_convert_core_msys_to_w32_result
2993da16f16767eb31921af855f17bda465fffc4e000cristy  fi
2994da16f16767eb31921af855f17bda465fffc4e000cristy  func_convert_file_check "$1" "$func_to_host_file_result"
2995da16f16767eb31921af855f17bda465fffc4e000cristy}
2996da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_file_msys_to_w32
2997da16f16767eb31921af855f17bda465fffc4e000cristy
2998da16f16767eb31921af855f17bda465fffc4e000cristy
2999da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_file_cygwin_to_w32 ARG
3000da16f16767eb31921af855f17bda465fffc4e000cristy# Convert file name ARG from Cygwin to w32 format.  Returns result in
3001da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_host_file_result.
3002da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_file_cygwin_to_w32 ()
3003da16f16767eb31921af855f17bda465fffc4e000cristy{
300415f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
300515f2201421a23fbf95840adf524cfdb4db384b85Cristy
300615f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_file_result=$1
3007da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
3008da16f16767eb31921af855f17bda465fffc4e000cristy    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3009da16f16767eb31921af855f17bda465fffc4e000cristy    # LT_CYGPATH in this case.
3010da16f16767eb31921af855f17bda465fffc4e000cristy    func_to_host_file_result=`cygpath -m "$1"`
3011da16f16767eb31921af855f17bda465fffc4e000cristy  fi
3012da16f16767eb31921af855f17bda465fffc4e000cristy  func_convert_file_check "$1" "$func_to_host_file_result"
3013da16f16767eb31921af855f17bda465fffc4e000cristy}
3014da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_file_cygwin_to_w32
3015da16f16767eb31921af855f17bda465fffc4e000cristy
3016da16f16767eb31921af855f17bda465fffc4e000cristy
3017da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_file_nix_to_w32 ARG
3018da16f16767eb31921af855f17bda465fffc4e000cristy# Convert file name ARG from *nix to w32 format.  Requires a wine environment
3019da16f16767eb31921af855f17bda465fffc4e000cristy# and a working winepath. Returns result in func_to_host_file_result.
3020da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_file_nix_to_w32 ()
3021da16f16767eb31921af855f17bda465fffc4e000cristy{
302215f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
302315f2201421a23fbf95840adf524cfdb4db384b85Cristy
302415f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_file_result=$1
3025da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
3026da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_core_file_wine_to_w32 "$1"
302715f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3028da16f16767eb31921af855f17bda465fffc4e000cristy  fi
3029da16f16767eb31921af855f17bda465fffc4e000cristy  func_convert_file_check "$1" "$func_to_host_file_result"
3030da16f16767eb31921af855f17bda465fffc4e000cristy}
3031da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_file_nix_to_w32
3032da16f16767eb31921af855f17bda465fffc4e000cristy
3033da16f16767eb31921af855f17bda465fffc4e000cristy
3034da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_file_msys_to_cygwin ARG
3035da16f16767eb31921af855f17bda465fffc4e000cristy# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
3036da16f16767eb31921af855f17bda465fffc4e000cristy# Returns result in func_to_host_file_result.
3037da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_file_msys_to_cygwin ()
3038da16f16767eb31921af855f17bda465fffc4e000cristy{
303915f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
304015f2201421a23fbf95840adf524cfdb4db384b85Cristy
304115f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_file_result=$1
3042da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
3043da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_core_msys_to_w32 "$1"
3044da16f16767eb31921af855f17bda465fffc4e000cristy    func_cygpath -u "$func_convert_core_msys_to_w32_result"
304515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_to_host_file_result=$func_cygpath_result
3046da16f16767eb31921af855f17bda465fffc4e000cristy  fi
3047da16f16767eb31921af855f17bda465fffc4e000cristy  func_convert_file_check "$1" "$func_to_host_file_result"
3048da16f16767eb31921af855f17bda465fffc4e000cristy}
3049da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_file_msys_to_cygwin
3050da16f16767eb31921af855f17bda465fffc4e000cristy
3051da16f16767eb31921af855f17bda465fffc4e000cristy
3052da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_file_nix_to_cygwin ARG
3053da16f16767eb31921af855f17bda465fffc4e000cristy# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
3054da16f16767eb31921af855f17bda465fffc4e000cristy# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
3055da16f16767eb31921af855f17bda465fffc4e000cristy# in func_to_host_file_result.
3056da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_file_nix_to_cygwin ()
3057da16f16767eb31921af855f17bda465fffc4e000cristy{
305815f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
305915f2201421a23fbf95840adf524cfdb4db384b85Cristy
306015f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_file_result=$1
3061da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
3062da16f16767eb31921af855f17bda465fffc4e000cristy    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3063da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_core_file_wine_to_w32 "$1"
3064da16f16767eb31921af855f17bda465fffc4e000cristy    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
306515f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_to_host_file_result=$func_cygpath_result
3066da16f16767eb31921af855f17bda465fffc4e000cristy  fi
3067da16f16767eb31921af855f17bda465fffc4e000cristy  func_convert_file_check "$1" "$func_to_host_file_result"
3068da16f16767eb31921af855f17bda465fffc4e000cristy}
3069da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_file_nix_to_cygwin
3070da16f16767eb31921af855f17bda465fffc4e000cristy
3071da16f16767eb31921af855f17bda465fffc4e000cristy
3072da16f16767eb31921af855f17bda465fffc4e000cristy#############################################
3073da16f16767eb31921af855f17bda465fffc4e000cristy# $build to $host PATH CONVERSION FUNCTIONS #
3074da16f16767eb31921af855f17bda465fffc4e000cristy#############################################
307515f2201421a23fbf95840adf524cfdb4db384b85Cristy# invoked via '$to_host_path_cmd ARG'
3076da16f16767eb31921af855f17bda465fffc4e000cristy#
3077da16f16767eb31921af855f17bda465fffc4e000cristy# In each case, ARG is the path to be converted from $build to $host format.
3078da16f16767eb31921af855f17bda465fffc4e000cristy# The result will be available in $func_to_host_path_result.
3079da16f16767eb31921af855f17bda465fffc4e000cristy#
3080da16f16767eb31921af855f17bda465fffc4e000cristy# Path separators are also converted from $build format to $host format.  If
3081da16f16767eb31921af855f17bda465fffc4e000cristy# ARG begins or ends with a path separator character, it is preserved (but
3082da16f16767eb31921af855f17bda465fffc4e000cristy# converted to $host format) on output.
3083da16f16767eb31921af855f17bda465fffc4e000cristy#
3084da16f16767eb31921af855f17bda465fffc4e000cristy# All path conversion functions are named using the following convention:
3085da16f16767eb31921af855f17bda465fffc4e000cristy#   file name conversion function    : func_convert_file_X_to_Y ()
3086da16f16767eb31921af855f17bda465fffc4e000cristy#   path conversion function         : func_convert_path_X_to_Y ()
3087da16f16767eb31921af855f17bda465fffc4e000cristy# where, for any given $build/$host combination the 'X_to_Y' value is the
3088da16f16767eb31921af855f17bda465fffc4e000cristy# same.  If conversion functions are added for new $build/$host combinations,
3089da16f16767eb31921af855f17bda465fffc4e000cristy# the two new functions must follow this pattern, or func_init_to_host_path_cmd
3090da16f16767eb31921af855f17bda465fffc4e000cristy# will break.
3091da16f16767eb31921af855f17bda465fffc4e000cristy
3092da16f16767eb31921af855f17bda465fffc4e000cristy
3093da16f16767eb31921af855f17bda465fffc4e000cristy# func_init_to_host_path_cmd
3094da16f16767eb31921af855f17bda465fffc4e000cristy# Ensures that function "pointer" variable $to_host_path_cmd is set to the
3095da16f16767eb31921af855f17bda465fffc4e000cristy# appropriate value, based on the value of $to_host_file_cmd.
3096da16f16767eb31921af855f17bda465fffc4e000cristyto_host_path_cmd=
3097da16f16767eb31921af855f17bda465fffc4e000cristyfunc_init_to_host_path_cmd ()
3098da16f16767eb31921af855f17bda465fffc4e000cristy{
309915f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
310015f2201421a23fbf95840adf524cfdb4db384b85Cristy
3101da16f16767eb31921af855f17bda465fffc4e000cristy  if test -z "$to_host_path_cmd"; then
3102da16f16767eb31921af855f17bda465fffc4e000cristy    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
310315f2201421a23fbf95840adf524cfdb4db384b85Cristy    to_host_path_cmd=func_convert_path_$func_stripname_result
3104da16f16767eb31921af855f17bda465fffc4e000cristy  fi
3105da16f16767eb31921af855f17bda465fffc4e000cristy}
3106da16f16767eb31921af855f17bda465fffc4e000cristy
3107da16f16767eb31921af855f17bda465fffc4e000cristy
3108da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_host_path ARG
3109da16f16767eb31921af855f17bda465fffc4e000cristy# Converts the path ARG from $build format to $host format. Return result
3110da16f16767eb31921af855f17bda465fffc4e000cristy# in func_to_host_path_result.
3111da16f16767eb31921af855f17bda465fffc4e000cristyfunc_to_host_path ()
3112da16f16767eb31921af855f17bda465fffc4e000cristy{
311315f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
311415f2201421a23fbf95840adf524cfdb4db384b85Cristy
3115da16f16767eb31921af855f17bda465fffc4e000cristy  func_init_to_host_path_cmd
3116da16f16767eb31921af855f17bda465fffc4e000cristy  $to_host_path_cmd "$1"
3117da16f16767eb31921af855f17bda465fffc4e000cristy}
3118da16f16767eb31921af855f17bda465fffc4e000cristy# end func_to_host_path
3119da16f16767eb31921af855f17bda465fffc4e000cristy
3120da16f16767eb31921af855f17bda465fffc4e000cristy
3121da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_path_noop ARG
3122da16f16767eb31921af855f17bda465fffc4e000cristy# Copy ARG to func_to_host_path_result.
3123da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_path_noop ()
3124da16f16767eb31921af855f17bda465fffc4e000cristy{
312515f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_path_result=$1
3126da16f16767eb31921af855f17bda465fffc4e000cristy}
3127da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_path_noop
3128da16f16767eb31921af855f17bda465fffc4e000cristy
3129da16f16767eb31921af855f17bda465fffc4e000cristy
3130da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_path_msys_to_w32 ARG
3131da16f16767eb31921af855f17bda465fffc4e000cristy# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3132da16f16767eb31921af855f17bda465fffc4e000cristy# conversion to w32 is not available inside the cwrapper.  Returns result in
3133da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_host_path_result.
3134da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_path_msys_to_w32 ()
31353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
313615f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
313715f2201421a23fbf95840adf524cfdb4db384b85Cristy
313815f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_path_result=$1
3139da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
3140da16f16767eb31921af855f17bda465fffc4e000cristy    # Remove leading and trailing path separator characters from ARG.  MSYS
3141da16f16767eb31921af855f17bda465fffc4e000cristy    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3142da16f16767eb31921af855f17bda465fffc4e000cristy    # and winepath ignores them completely.
3143da16f16767eb31921af855f17bda465fffc4e000cristy    func_stripname : : "$1"
3144da16f16767eb31921af855f17bda465fffc4e000cristy    func_to_host_path_tmp1=$func_stripname_result
3145da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
314615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_to_host_path_result=$func_convert_core_msys_to_w32_result
3147da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_check : ";" \
3148da16f16767eb31921af855f17bda465fffc4e000cristy      "$func_to_host_path_tmp1" "$func_to_host_path_result"
3149da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3150da16f16767eb31921af855f17bda465fffc4e000cristy  fi
3151da16f16767eb31921af855f17bda465fffc4e000cristy}
3152da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_path_msys_to_w32
31533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
31543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3155da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_path_cygwin_to_w32 ARG
3156da16f16767eb31921af855f17bda465fffc4e000cristy# Convert path ARG from Cygwin to w32 format.  Returns result in
3157da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_host_file_result.
3158da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_path_cygwin_to_w32 ()
3159da16f16767eb31921af855f17bda465fffc4e000cristy{
316015f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
316115f2201421a23fbf95840adf524cfdb4db384b85Cristy
316215f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_path_result=$1
3163da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
3164da16f16767eb31921af855f17bda465fffc4e000cristy    # See func_convert_path_msys_to_w32:
3165da16f16767eb31921af855f17bda465fffc4e000cristy    func_stripname : : "$1"
3166da16f16767eb31921af855f17bda465fffc4e000cristy    func_to_host_path_tmp1=$func_stripname_result
3167da16f16767eb31921af855f17bda465fffc4e000cristy    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3168da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_check : ";" \
3169da16f16767eb31921af855f17bda465fffc4e000cristy      "$func_to_host_path_tmp1" "$func_to_host_path_result"
3170da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3171da16f16767eb31921af855f17bda465fffc4e000cristy  fi
3172da16f16767eb31921af855f17bda465fffc4e000cristy}
3173da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_path_cygwin_to_w32
31743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
31753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3176da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_path_nix_to_w32 ARG
3177da16f16767eb31921af855f17bda465fffc4e000cristy# Convert path ARG from *nix to w32 format.  Requires a wine environment and
3178da16f16767eb31921af855f17bda465fffc4e000cristy# a working winepath.  Returns result in func_to_host_file_result.
3179da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_path_nix_to_w32 ()
3180da16f16767eb31921af855f17bda465fffc4e000cristy{
318115f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
318215f2201421a23fbf95840adf524cfdb4db384b85Cristy
318315f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_path_result=$1
3184da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
3185da16f16767eb31921af855f17bda465fffc4e000cristy    # See func_convert_path_msys_to_w32:
3186da16f16767eb31921af855f17bda465fffc4e000cristy    func_stripname : : "$1"
3187da16f16767eb31921af855f17bda465fffc4e000cristy    func_to_host_path_tmp1=$func_stripname_result
3188da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
318915f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3190da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_check : ";" \
3191da16f16767eb31921af855f17bda465fffc4e000cristy      "$func_to_host_path_tmp1" "$func_to_host_path_result"
3192da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3193da16f16767eb31921af855f17bda465fffc4e000cristy  fi
3194da16f16767eb31921af855f17bda465fffc4e000cristy}
3195da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_path_nix_to_w32
31963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3197da16f16767eb31921af855f17bda465fffc4e000cristy
3198da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_path_msys_to_cygwin ARG
3199da16f16767eb31921af855f17bda465fffc4e000cristy# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
3200da16f16767eb31921af855f17bda465fffc4e000cristy# Returns result in func_to_host_file_result.
3201da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_path_msys_to_cygwin ()
3202da16f16767eb31921af855f17bda465fffc4e000cristy{
320315f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
320415f2201421a23fbf95840adf524cfdb4db384b85Cristy
320515f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_path_result=$1
3206da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
3207da16f16767eb31921af855f17bda465fffc4e000cristy    # See func_convert_path_msys_to_w32:
3208da16f16767eb31921af855f17bda465fffc4e000cristy    func_stripname : : "$1"
3209da16f16767eb31921af855f17bda465fffc4e000cristy    func_to_host_path_tmp1=$func_stripname_result
3210da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3211da16f16767eb31921af855f17bda465fffc4e000cristy    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
321215f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_to_host_path_result=$func_cygpath_result
3213da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_check : : \
3214da16f16767eb31921af855f17bda465fffc4e000cristy      "$func_to_host_path_tmp1" "$func_to_host_path_result"
3215da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3216da16f16767eb31921af855f17bda465fffc4e000cristy  fi
3217da16f16767eb31921af855f17bda465fffc4e000cristy}
3218da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_path_msys_to_cygwin
3219da16f16767eb31921af855f17bda465fffc4e000cristy
3220da16f16767eb31921af855f17bda465fffc4e000cristy
3221da16f16767eb31921af855f17bda465fffc4e000cristy# func_convert_path_nix_to_cygwin ARG
3222da16f16767eb31921af855f17bda465fffc4e000cristy# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
3223da16f16767eb31921af855f17bda465fffc4e000cristy# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
3224da16f16767eb31921af855f17bda465fffc4e000cristy# func_to_host_file_result.
3225da16f16767eb31921af855f17bda465fffc4e000cristyfunc_convert_path_nix_to_cygwin ()
3226da16f16767eb31921af855f17bda465fffc4e000cristy{
322715f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
322815f2201421a23fbf95840adf524cfdb4db384b85Cristy
322915f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_host_path_result=$1
3230da16f16767eb31921af855f17bda465fffc4e000cristy  if test -n "$1"; then
3231da16f16767eb31921af855f17bda465fffc4e000cristy    # Remove leading and trailing path separator characters from
3232da16f16767eb31921af855f17bda465fffc4e000cristy    # ARG. msys behavior is inconsistent here, cygpath turns them
3233da16f16767eb31921af855f17bda465fffc4e000cristy    # into '.;' and ';.', and winepath ignores them completely.
3234da16f16767eb31921af855f17bda465fffc4e000cristy    func_stripname : : "$1"
3235da16f16767eb31921af855f17bda465fffc4e000cristy    func_to_host_path_tmp1=$func_stripname_result
3236da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3237da16f16767eb31921af855f17bda465fffc4e000cristy    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
323815f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_to_host_path_result=$func_cygpath_result
3239da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_check : : \
3240da16f16767eb31921af855f17bda465fffc4e000cristy      "$func_to_host_path_tmp1" "$func_to_host_path_result"
3241da16f16767eb31921af855f17bda465fffc4e000cristy    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3242da16f16767eb31921af855f17bda465fffc4e000cristy  fi
32433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
3244da16f16767eb31921af855f17bda465fffc4e000cristy# end func_convert_path_nix_to_cygwin
3245da16f16767eb31921af855f17bda465fffc4e000cristy
32463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
324715f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_dll_def_p FILE
324815f2201421a23fbf95840adf524cfdb4db384b85Cristy# True iff FILE is a Windows DLL '.def' file.
324915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Keep in sync with _LT_DLL_DEF_P in libtool.m4
325015f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_dll_def_p ()
325115f2201421a23fbf95840adf524cfdb4db384b85Cristy{
325215f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
325315f2201421a23fbf95840adf524cfdb4db384b85Cristy
325415f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_dll_def_p_tmp=`$SED -n \
325515f2201421a23fbf95840adf524cfdb4db384b85Cristy    -e 's/^[	 ]*//' \
325615f2201421a23fbf95840adf524cfdb4db384b85Cristy    -e '/^\(;.*\)*$/d' \
325715f2201421a23fbf95840adf524cfdb4db384b85Cristy    -e 's/^\(EXPORTS\|LIBRARY\)\([	 ].*\)*$/DEF/p' \
325815f2201421a23fbf95840adf524cfdb4db384b85Cristy    -e q \
325915f2201421a23fbf95840adf524cfdb4db384b85Cristy    "$1"`
326015f2201421a23fbf95840adf524cfdb4db384b85Cristy  test DEF = "$func_dll_def_p_tmp"
326115f2201421a23fbf95840adf524cfdb4db384b85Cristy}
326215f2201421a23fbf95840adf524cfdb4db384b85Cristy
326315f2201421a23fbf95840adf524cfdb4db384b85Cristy
32643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_mode_compile arg...
32653ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_mode_compile ()
32663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
326715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
326815f2201421a23fbf95840adf524cfdb4db384b85Cristy
32693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Get the compilation command and the source file.
32703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    base_compile=
327115f2201421a23fbf95840adf524cfdb4db384b85Cristy    srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
32723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    suppress_opt=yes
32733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    suppress_output=
32743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    arg_mode=normal
32753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    libobj=
32763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    later=
32773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    pie_flag=
32783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
32793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for arg
32803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    do
32813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $arg_mode in
32823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      arg  )
32833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# do not "continue".  Instead, add this to base_compile
328415f2201421a23fbf95840adf524cfdb4db384b85Cristy	lastarg=$arg
32853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	arg_mode=normal
32863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
32873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
32883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      target )
328915f2201421a23fbf95840adf524cfdb4db384b85Cristy	libobj=$arg
32903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	arg_mode=normal
32913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
32923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
32933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
32943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      normal )
32953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Accept any command-line options.
32963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $arg in
32973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-o)
32983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test -n "$libobj" && \
329915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "you cannot specify '-o' more than once"
33003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  arg_mode=target
33013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
33023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
33033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-pie | -fpie | -fPIE)
3305da16f16767eb31921af855f17bda465fffc4e000cristy          func_append pie_flag " $arg"
33063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
33073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
33083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-shared | -static | -prefer-pic | -prefer-non-pic)
3310da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append later " $arg"
33113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
33123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
33133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-no-suppress)
33153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  suppress_opt=no
33163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
33173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
33183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-Xcompiler)
33203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
33213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue      #  The current "srcfile" will either be retained or
33223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;            #  replaced later.  I would guess that would be a bug.
33233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-Wc,*)
33253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_stripname '-Wc,' '' "$arg"
33263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  args=$func_stripname_result
33273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  lastarg=
332815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  save_ifs=$IFS; IFS=,
33293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for arg in $args; do
333015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    IFS=$save_ifs
3331da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append_quoted lastarg "$arg"
33323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
333315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  IFS=$save_ifs
33343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_stripname ' ' '' "$lastarg"
33353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  lastarg=$func_stripname_result
33363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Add the arguments to base_compile.
3338da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append base_compile " $lastarg"
33393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
33403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
33413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
33433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Accept the current argument as the source file.
33443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # The previous "srcfile" becomes the current argument.
33453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  #
334615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  lastarg=$srcfile
334715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  srcfile=$arg
33483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
33493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac  #  case $arg
33503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
33513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac    #  case $arg_mode
33523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Aesthetically quote the previous argument.
3354da16f16767eb31921af855f17bda465fffc4e000cristy      func_append_quoted base_compile "$lastarg"
33553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done # for arg
33563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $arg_mode in
33583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    arg)
33593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_fatal_error "you must specify an argument for -Xcompile"
33603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
33613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    target)
336215f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_fatal_error "you must specify a target with '-o'"
33633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
33643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *)
33653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Get the name of the library object.
33663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -z "$libobj" && {
33673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_basename "$srcfile"
336815f2201421a23fbf95840adf524cfdb4db384b85Cristy	libobj=$func_basename_result
33693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      }
33703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
33713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
33723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Recognize several different file suffixes.
33743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # If the user specifies -o file.o, it is replaced with file.lo
33753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $libobj in
33763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *.[cCFSifmso] | \
33773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *.ada | *.adb | *.ads | *.asm | \
33783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
33792542fc61a973e588b23b3ddac880f01ae6c4c64dcristy    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
33803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_xform "$libobj"
33813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      libobj=$func_xform_result
33823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
33833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
33843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $libobj in
33863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
33873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *)
338815f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_fatal_error "cannot determine name of library object from '$libobj'"
33893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
33903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
33913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_infer_tag $base_compile
33933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
33943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for arg in $later; do
33953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $arg in
33963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -shared)
339715f2201421a23fbf95840adf524cfdb4db384b85Cristy	test yes = "$build_libtool_libs" \
339815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  || func_fatal_configuration "cannot build a shared library"
33993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	build_old_libs=no
34003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
34013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
34023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -static)
34043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	build_libtool_libs=no
34053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	build_old_libs=yes
34063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
34073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
34083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -prefer-pic)
34103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	pic_mode=yes
34113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
34123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
34133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -prefer-non-pic)
34153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	pic_mode=no
34163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
34173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
34183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
34193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
34203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_quote_for_eval "$libobj"
34223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test "X$libobj" != "X$func_quote_for_eval_result" \
34233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
342415f2201421a23fbf95840adf524cfdb4db384b85Cristy      && func_warning "libobj name '$libobj' may not contain shell special characters."
34253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_dirname_and_basename "$obj" "/" ""
342615f2201421a23fbf95840adf524cfdb4db384b85Cristy    objname=$func_basename_result
342715f2201421a23fbf95840adf524cfdb4db384b85Cristy    xdir=$func_dirname_result
342815f2201421a23fbf95840adf524cfdb4db384b85Cristy    lobj=$xdir$objdir/$objname
34293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -z "$base_compile" && \
34313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_fatal_help "you must specify a compilation command"
34323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Delete any leftover library objects.
343415f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$build_old_libs"; then
34353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      removelist="$obj $lobj $libobj ${libobj}T"
34363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
34373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      removelist="$lobj $libobj ${libobj}T"
34383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
34393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # On Cygwin there's no "real" PIC flag so we must build both object types
34413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $host_os in
34423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    cygwin* | mingw* | pw32* | os2* | cegcc*)
34433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      pic_mode=default
34443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
34453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
344615f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
34473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # non-PIC code in shared libraries is not supported
34483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      pic_mode=default
34493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
34503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Calculate the filename of the output object if compiler does
34523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # not support -o with -c
345315f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test no = "$compiler_c_o"; then
345415f2201421a23fbf95840adf524cfdb4db384b85Cristy      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
345515f2201421a23fbf95840adf524cfdb4db384b85Cristy      lockfile=$output_obj.lock
34563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
34573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      output_obj=
34583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      need_locks=no
34593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      lockfile=
34603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
34613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Lock this critical section if it is needed
34633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # We use this script file to make the link, it avoids creating a new file
346415f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$need_locks"; then
34653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
34663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_echo "Waiting for $lockfile to be removed"
34673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	sleep 2
34683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
346915f2201421a23fbf95840adf524cfdb4db384b85Cristy    elif test warn = "$need_locks"; then
34703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -f "$lockfile"; then
34713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$ECHO "\
34723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*** ERROR, $lockfile exists and contains:
34733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy`cat $lockfile 2>/dev/null`
34743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34753ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThis indicates that another process is trying to use the same
34763ed852eea50f9d4cd633efb8c2b054b8e33c253cristytemporary object file, and libtool could not work around it because
347715f2201421a23fbf95840adf524cfdb4db384b85Cristyyour compiler does not support '-c' and '-o' together.  If you
34783ed852eea50f9d4cd633efb8c2b054b8e33c253cristyrepeat this compilation, it may succeed, by chance, but you had better
34793ed852eea50f9d4cd633efb8c2b054b8e33c253cristyavoid parallel builds (make -j) in this platform, or get a better
34803ed852eea50f9d4cd633efb8c2b054b8e33c253cristycompiler."
34813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$opt_dry_run || $RM $removelist
34833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit $EXIT_FAILURE
34843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
3485da16f16767eb31921af855f17bda465fffc4e000cristy      func_append removelist " $output_obj"
34863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $ECHO "$srcfile" > "$lockfile"
34873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
34883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    $opt_dry_run || $RM $removelist
3490da16f16767eb31921af855f17bda465fffc4e000cristy    func_append removelist " $lockfile"
34913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
34923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3493da16f16767eb31921af855f17bda465fffc4e000cristy    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3494da16f16767eb31921af855f17bda465fffc4e000cristy    srcfile=$func_to_tool_file_result
34953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_quote_for_eval "$srcfile"
34963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    qsrcfile=$func_quote_for_eval_result
34973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
34983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Only build a PIC object if we are building libtool libraries.
349915f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$build_libtool_libs"; then
35003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Without this assignment, base_compile gets emptied.
35013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fbsd_hideous_sh_bug=$base_compile
35023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
350315f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test no != "$pic_mode"; then
35043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	command="$base_compile $qsrcfile $pic_flag"
35053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
35063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Don't build PIC code
35073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	command="$base_compile $qsrcfile"
35083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
35093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_mkdir_p "$xdir$objdir"
35113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -z "$output_obj"; then
35133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Place PIC objects in $objdir
3514da16f16767eb31921af855f17bda465fffc4e000cristy	func_append command " -o $lobj"
35153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
35163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_show_eval_locale "$command"	\
35183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
35193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
352015f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test warn = "$need_locks" &&
35213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
35223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$ECHO "\
35233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*** ERROR, $lockfile contains:
35243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy`cat $lockfile 2>/dev/null`
35253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35263ed852eea50f9d4cd633efb8c2b054b8e33c253cristybut it should contain:
35273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy$srcfile
35283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35293ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThis indicates that another process is trying to use the same
35303ed852eea50f9d4cd633efb8c2b054b8e33c253cristytemporary object file, and libtool could not work around it because
353115f2201421a23fbf95840adf524cfdb4db384b85Cristyyour compiler does not support '-c' and '-o' together.  If you
35323ed852eea50f9d4cd633efb8c2b054b8e33c253cristyrepeat this compilation, it may succeed, by chance, but you had better
35333ed852eea50f9d4cd633efb8c2b054b8e33c253cristyavoid parallel builds (make -j) in this platform, or get a better
35343ed852eea50f9d4cd633efb8c2b054b8e33c253cristycompiler."
35353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$opt_dry_run || $RM $removelist
35373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit $EXIT_FAILURE
35383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
35393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Just move the object if needed, then go on to compile the next one
35413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
35423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval '$MV "$output_obj" "$lobj"' \
35433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
35443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
35453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Allow error messages only from the first compilation.
354715f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test yes = "$suppress_opt"; then
35483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	suppress_output=' >/dev/null 2>&1'
35493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
35503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
35513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Only build a position-dependent object if we build old libraries.
355315f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$build_old_libs"; then
355415f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test yes != "$pic_mode"; then
35553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Don't build PIC code
35563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	command="$base_compile $qsrcfile$pie_flag"
35573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
35583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	command="$base_compile $qsrcfile $pic_flag"
35593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
356015f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test yes = "$compiler_c_o"; then
3561da16f16767eb31921af855f17bda465fffc4e000cristy	func_append command " -o $obj"
35623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
35633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Suppress compiler output if we already did a PIC compilation.
3565da16f16767eb31921af855f17bda465fffc4e000cristy      func_append command "$suppress_output"
35663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_show_eval_locale "$command" \
35673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
35683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
356915f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test warn = "$need_locks" &&
35703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
35713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$ECHO "\
35723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*** ERROR, $lockfile contains:
35733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy`cat $lockfile 2>/dev/null`
35743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35753ed852eea50f9d4cd633efb8c2b054b8e33c253cristybut it should contain:
35763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy$srcfile
35773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35783ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThis indicates that another process is trying to use the same
35793ed852eea50f9d4cd633efb8c2b054b8e33c253cristytemporary object file, and libtool could not work around it because
358015f2201421a23fbf95840adf524cfdb4db384b85Cristyyour compiler does not support '-c' and '-o' together.  If you
35813ed852eea50f9d4cd633efb8c2b054b8e33c253cristyrepeat this compilation, it may succeed, by chance, but you had better
35823ed852eea50f9d4cd633efb8c2b054b8e33c253cristyavoid parallel builds (make -j) in this platform, or get a better
35833ed852eea50f9d4cd633efb8c2b054b8e33c253cristycompiler."
35843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$opt_dry_run || $RM $removelist
35863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit $EXIT_FAILURE
35873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
35883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Just move the object if needed
35903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
35913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval '$MV "$output_obj" "$obj"' \
35923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
35933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
35943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
35953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    $opt_dry_run || {
35973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
35983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
35993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Unlock the critical section if it was locked
360015f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test no != "$need_locks"; then
36013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	removelist=$lockfile
36023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        $RM "$lockfile"
36033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
36043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
36053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit $EXIT_SUCCESS
36073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
36083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy$opt_help || {
361015f2201421a23fbf95840adf524cfdb4db384b85Cristy  test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
36113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
36123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36133ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_mode_help ()
36143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
36153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # We need to display help for each of the modes.
3616da16f16767eb31921af855f17bda465fffc4e000cristy    case $opt_mode in
36173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      "")
36183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        # Generic help is extracted from the usage comments
36193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        # at the start of this file.
36203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        func_help
36213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
36223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      clean)
36243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        $ECHO \
36253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
36263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36273ed852eea50f9d4cd633efb8c2b054b8e33c253cristyRemove files from the build directory.
36283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36293ed852eea50f9d4cd633efb8c2b054b8e33c253cristyRM is the name of the program to use to delete files associated with each FILE
363015f2201421a23fbf95840adf524cfdb4db384b85Cristy(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
36313ed852eea50f9d4cd633efb8c2b054b8e33c253cristyto RM.
36323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36333ed852eea50f9d4cd633efb8c2b054b8e33c253cristyIf FILE is a libtool library, object or program, all the files associated
36343ed852eea50f9d4cd633efb8c2b054b8e33c253cristywith it are deleted. Otherwise, only FILE itself is deleted using RM."
36353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
36363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      compile)
36383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $ECHO \
36393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
36403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36413ed852eea50f9d4cd633efb8c2b054b8e33c253cristyCompile a source file into a libtool library object.
36423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36433ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThis mode accepts the following additional options:
36443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
36463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -no-suppress      do not suppress compiler output for multiple passes
364798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -prefer-pic       try to build PIC objects only
364898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -prefer-non-pic   try to build non-PIC objects only
364915f2201421a23fbf95840adf524cfdb4db384b85Cristy  -shared           do not build a '.o' file suitable for static linking
365015f2201421a23fbf95840adf524cfdb4db384b85Cristy  -static           only build a '.o' file suitable for static linking
365198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -Wc,FLAG          pass FLAG directly to the compiler
36523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
365315f2201421a23fbf95840adf524cfdb4db384b85CristyCOMPILE-COMMAND is a command to be used in creating a 'standard' object file
36543ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfrom the given SOURCEFILE.
36553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36563ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThe output file name is determined by removing the directory component from
365715f2201421a23fbf95840adf524cfdb4db384b85CristySOURCEFILE, then substituting the C source code suffix '.c' with the
365815f2201421a23fbf95840adf524cfdb4db384b85Cristylibrary object suffix, '.lo'."
36593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
36603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      execute)
36623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        $ECHO \
36633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
36643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36653ed852eea50f9d4cd633efb8c2b054b8e33c253cristyAutomatically set library path, then run a program.
36663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36673ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThis mode accepts the following additional options:
36683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -dlopen FILE      add the directory containing FILE to the library path
36703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
367115f2201421a23fbf95840adf524cfdb4db384b85CristyThis mode sets the library path environment variable according to '-dlopen'
36723ed852eea50f9d4cd633efb8c2b054b8e33c253cristyflags.
36733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36743ed852eea50f9d4cd633efb8c2b054b8e33c253cristyIf any of the ARGS are libtool executable wrappers, then they are translated
36753ed852eea50f9d4cd633efb8c2b054b8e33c253cristyinto their corresponding uninstalled binary, and any of their required library
36763ed852eea50f9d4cd633efb8c2b054b8e33c253cristydirectories are added to the library path.
36773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36783ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThen, COMMAND is executed, with ARGS as arguments."
36793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
36803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      finish)
36823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        $ECHO \
36833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
36843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36853ed852eea50f9d4cd633efb8c2b054b8e33c253cristyComplete the installation of libtool libraries.
36863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36873ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEach LIBDIR is a directory that contains libtool libraries.
36883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36893ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThe commands that this mode executes may require superuser privileges.  Use
369015f2201421a23fbf95840adf524cfdb4db384b85Cristythe '--dry-run' option if you just want to see what would be executed."
36913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
36923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      install)
36943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        $ECHO \
36953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
36963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36973ed852eea50f9d4cd633efb8c2b054b8e33c253cristyInstall executables or libraries.
36983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
36993ed852eea50f9d4cd633efb8c2b054b8e33c253cristyINSTALL-COMMAND is the installation command.  The first component should be
370015f2201421a23fbf95840adf524cfdb4db384b85Cristyeither the 'install' or 'cp' program.
37013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37023ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThe following components of INSTALL-COMMAND are treated specially:
37033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
370498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
37053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37063ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThe rest of the components are interpreted as arguments to that command (only
37073ed852eea50f9d4cd633efb8c2b054b8e33c253cristyBSD-compatible install options are recognized)."
37083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
37093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      link)
37113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        $ECHO \
37123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
37133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37143ed852eea50f9d4cd633efb8c2b054b8e33c253cristyLink object files or libraries together to form another library, or to
37153ed852eea50f9d4cd633efb8c2b054b8e33c253cristycreate an executable program.
37163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37173ed852eea50f9d4cd633efb8c2b054b8e33c253cristyLINK-COMMAND is a command using the C compiler that you would use to create
37183ed852eea50f9d4cd633efb8c2b054b8e33c253cristya program from several object files.
37193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37203ed852eea50f9d4cd633efb8c2b054b8e33c253cristyThe following components of LINK-COMMAND are treated specially:
37213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -all-static       do not do any dynamic linking at all
37233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -avoid-version    do not add a version suffix if possible
372498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -bindir BINDIR    specify path to binaries directory (for systems where
372598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                    libraries must be found in the PATH setting at runtime)
372615f2201421a23fbf95840adf524cfdb4db384b85Cristy  -dlopen FILE      '-dlpreopen' FILE if it cannot be dlopened at runtime
37273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
37283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
37293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -export-symbols SYMFILE
37303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                    try to export only the symbols listed in SYMFILE
37313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -export-symbols-regex REGEX
37323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                    try to export only the symbols matching REGEX
37333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -LLIBDIR          search LIBDIR for required installed libraries
37343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -lNAME            OUTPUT-FILE requires the installed library libNAME
37353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -module           build a library that can dlopened
37363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -no-fast-install  disable the fast-install mode
37373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -no-install       link a not-installable executable
37383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -no-undefined     declare that a library does not refer to external symbols
37393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
374015f2201421a23fbf95840adf524cfdb4db384b85Cristy  -objectlist FILE  use a list of object files found in FILE to specify objects
374115f2201421a23fbf95840adf524cfdb4db384b85Cristy  -os2dllname NAME  force a short DLL name on OS/2 (no effect on other OSes)
37423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -precious-files-regex REGEX
37433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                    don't remove output files matching REGEX
37443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -release RELEASE  specify package release information
37453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
37463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
37473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -shared           only do dynamic linking of libtool libraries
37483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -shrext SUFFIX    override the standard shared library file extension
37493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -static           do not do any dynamic linking of uninstalled libtool libraries
37503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -static-libtool-libs
37513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                    do not do any dynamic linking of libtool libraries
37523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -version-info CURRENT[:REVISION[:AGE]]
37533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                    specify library version info [each variable defaults to 0]
37543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  -weak LIBNAME     declare that the target provides the LIBNAME interface
375598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -Wc,FLAG
375698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
375798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -Wl,FLAG
375898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
375998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
37603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
376115f2201421a23fbf95840adf524cfdb4db384b85CristyAll other options (arguments beginning with '-') are ignored.
37623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
376315f2201421a23fbf95840adf524cfdb4db384b85CristyEvery other argument is treated as a filename.  Files ending in '.la' are
37643ed852eea50f9d4cd633efb8c2b054b8e33c253cristytreated as uninstalled libtool libraries, other files are standard or library
37653ed852eea50f9d4cd633efb8c2b054b8e33c253cristyobject files.
37663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
376715f2201421a23fbf95840adf524cfdb4db384b85CristyIf the OUTPUT-FILE ends in '.la', then a libtool library is created,
376815f2201421a23fbf95840adf524cfdb4db384b85Cristyonly library objects ('.lo' files) may be specified, and '-rpath' is
37693ed852eea50f9d4cd633efb8c2b054b8e33c253cristyrequired, except when creating a convenience library.
37703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
377115f2201421a23fbf95840adf524cfdb4db384b85CristyIf OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
377215f2201421a23fbf95840adf524cfdb4db384b85Cristyusing 'ar' and 'ranlib', or on Windows using 'lib'.
37733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
377415f2201421a23fbf95840adf524cfdb4db384b85CristyIf OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
37753ed852eea50f9d4cd633efb8c2b054b8e33c253cristyis created, otherwise an executable program is created."
37763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
37773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      uninstall)
37793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        $ECHO \
37803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
37813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37823ed852eea50f9d4cd633efb8c2b054b8e33c253cristyRemove libraries from an installation directory.
37833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37843ed852eea50f9d4cd633efb8c2b054b8e33c253cristyRM is the name of the program to use to delete files associated with each FILE
378515f2201421a23fbf95840adf524cfdb4db384b85Cristy(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
37863ed852eea50f9d4cd633efb8c2b054b8e33c253cristyto RM.
37873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37883ed852eea50f9d4cd633efb8c2b054b8e33c253cristyIf FILE is a libtool library, all the files associated with it are deleted.
37893ed852eea50f9d4cd633efb8c2b054b8e33c253cristyOtherwise, only FILE itself is deleted using RM."
37903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
37913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
37923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
379315f2201421a23fbf95840adf524cfdb4db384b85Cristy        func_fatal_help "invalid operation mode '$opt_mode'"
37943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
37953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
37963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
379798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    echo
379815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $ECHO "Try '$progname --help' for more information about other modes."
37993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
38003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
380198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# Now that we've collected a possible --mode arg, show help if necessary
380298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyif $opt_help; then
380315f2201421a23fbf95840adf524cfdb4db384b85Cristy  if test : = "$opt_help"; then
380498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    func_mode_help
380598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  else
380698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    {
380798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      func_help noexit
3808da16f16767eb31921af855f17bda465fffc4e000cristy      for opt_mode in compile link execute install finish uninstall clean; do
380998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	func_mode_help
381098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      done
381115f2201421a23fbf95840adf524cfdb4db384b85Cristy    } | $SED -n '1p; 2,$s/^Usage:/  or: /p'
381298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    {
381398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      func_help noexit
3814da16f16767eb31921af855f17bda465fffc4e000cristy      for opt_mode in compile link execute install finish uninstall clean; do
381598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	echo
381698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	func_mode_help
381798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      done
381898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    } |
381915f2201421a23fbf95840adf524cfdb4db384b85Cristy    $SED '1d
382098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      /^When reporting/,/^Report/{
382198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	H
382298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	d
382398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      }
382498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      $x
382598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      /information about other modes/d
382698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      /more detailed .*MODE/d
382798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
382898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  fi
382998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  exit $?
383098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyfi
38313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_mode_execute arg...
38343ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_mode_execute ()
38353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
383615f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
383715f2201421a23fbf95840adf524cfdb4db384b85Cristy
38383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # The first argument is the command name.
383915f2201421a23fbf95840adf524cfdb4db384b85Cristy    cmd=$nonopt
38403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -z "$cmd" && \
38413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_fatal_help "you must specify a COMMAND"
38423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Handle -dlopen flags immediately.
3844da16f16767eb31921af855f17bda465fffc4e000cristy    for file in $opt_dlopen; do
38453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -f "$file" \
384615f2201421a23fbf95840adf524cfdb4db384b85Cristy	|| func_fatal_help "'$file' is not a file"
38473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      dir=
38493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $file in
38503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.la)
3851da16f16767eb31921af855f17bda465fffc4e000cristy	func_resolve_sysroot "$file"
3852da16f16767eb31921af855f17bda465fffc4e000cristy	file=$func_resolve_sysroot_result
3853da16f16767eb31921af855f17bda465fffc4e000cristy
38543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Check to see that this really is a libtool archive.
38553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_lalib_unsafe_p "$file" \
385615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  || func_fatal_help "'$lib' is not a valid libtool archive"
38573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Read the libtool library.
38593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	dlname=
38603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	library_names=
38613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_source "$file"
38623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Skip this library if it cannot be dlopened.
38643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -z "$dlname"; then
38653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Warn if it was a shared library.
38663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test -n "$library_names" && \
386715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_warning "'$file' was not linked with '-export-dynamic'"
38683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
38693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
38703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_dirname "$file" "" "."
387215f2201421a23fbf95840adf524cfdb4db384b85Cristy	dir=$func_dirname_result
38733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -f "$dir/$objdir/$dlname"; then
3875da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append dir "/$objdir"
38763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
38773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test ! -f "$dir/$dlname"; then
387815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
38793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
38803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
38813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
38823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.lo)
38843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Just add the directory containing the .lo file.
38853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_dirname "$file" "" "."
388615f2201421a23fbf95840adf524cfdb4db384b85Cristy	dir=$func_dirname_result
38873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
38883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
389015f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
38913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
38923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
38933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
38943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Get the absolute pathname.
38963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      absdir=`cd "$dir" && pwd`
389715f2201421a23fbf95840adf524cfdb4db384b85Cristy      test -n "$absdir" && dir=$absdir
38983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
38993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Now add the directory to shlibpath_var.
39003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if eval "test -z \"\$$shlibpath_var\""; then
39013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval "$shlibpath_var=\"\$dir\""
39023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
39033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
39043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
39053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
39063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
39073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # This variable tells wrapper scripts just to set shlibpath_var
39083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # rather than running their programs.
390915f2201421a23fbf95840adf524cfdb4db384b85Cristy    libtool_execute_magic=$magic
39103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
39113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Check if any of the arguments is a wrapper script.
39123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    args=
39133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for file
39143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    do
39153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $file in
391698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      -* | *.la | *.lo ) ;;
39173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
39183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Do a test to see if this is really a libtool program.
39193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if func_ltwrapper_script_p "$file"; then
39203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_source "$file"
39213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Transform arg to wrapped name.
392215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  file=$progdir/$program
39233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	elif func_ltwrapper_executable_p "$file"; then
39243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_ltwrapper_scriptname "$file"
39253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_source "$func_ltwrapper_scriptname_result"
39263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Transform arg to wrapped name.
392715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  file=$progdir/$program
39283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
39293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
39303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
39313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Quote arguments (to preserve shell metacharacters).
3932da16f16767eb31921af855f17bda465fffc4e000cristy      func_append_quoted args "$file"
39333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
39343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
393515f2201421a23fbf95840adf524cfdb4db384b85Cristy    if $opt_dry_run; then
393615f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Display what would be done.
393715f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$shlibpath_var"; then
393815f2201421a23fbf95840adf524cfdb4db384b85Cristy	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
393915f2201421a23fbf95840adf524cfdb4db384b85Cristy	echo "export $shlibpath_var"
394015f2201421a23fbf95840adf524cfdb4db384b85Cristy      fi
394115f2201421a23fbf95840adf524cfdb4db384b85Cristy      $ECHO "$cmd$args"
394215f2201421a23fbf95840adf524cfdb4db384b85Cristy      exit $EXIT_SUCCESS
394315f2201421a23fbf95840adf524cfdb4db384b85Cristy    else
39443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$shlibpath_var"; then
39453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Export the shlibpath_var.
39463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval "export $shlibpath_var"
39473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
39483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
39493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Restore saved environment variables
39503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
39513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      do
39523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval "if test \"\${save_$lt_var+set}\" = set; then
39533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                $lt_var=\$save_$lt_var; export $lt_var
39543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
39553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		$lt_unset $lt_var
39563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi"
39573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
39583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
39593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Now prepare to actually exec the command.
396015f2201421a23fbf95840adf524cfdb4db384b85Cristy      exec_cmd=\$cmd$args
39613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
39623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
39633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
396415f2201421a23fbf95840adf524cfdb4db384b85Cristytest execute = "$opt_mode" && func_mode_execute ${1+"$@"}
39653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
39663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
39673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_mode_finish arg...
39683ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_mode_finish ()
39693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
397015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
397115f2201421a23fbf95840adf524cfdb4db384b85Cristy
3972da16f16767eb31921af855f17bda465fffc4e000cristy    libs=
3973da16f16767eb31921af855f17bda465fffc4e000cristy    libdirs=
39743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    admincmds=
39753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
3976da16f16767eb31921af855f17bda465fffc4e000cristy    for opt in "$nonopt" ${1+"$@"}
3977da16f16767eb31921af855f17bda465fffc4e000cristy    do
3978da16f16767eb31921af855f17bda465fffc4e000cristy      if test -d "$opt"; then
3979da16f16767eb31921af855f17bda465fffc4e000cristy	func_append libdirs " $opt"
3980da16f16767eb31921af855f17bda465fffc4e000cristy
3981da16f16767eb31921af855f17bda465fffc4e000cristy      elif test -f "$opt"; then
3982da16f16767eb31921af855f17bda465fffc4e000cristy	if func_lalib_unsafe_p "$opt"; then
3983da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append libs " $opt"
3984da16f16767eb31921af855f17bda465fffc4e000cristy	else
398515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_warning "'$opt' is not a valid libtool archive"
3986da16f16767eb31921af855f17bda465fffc4e000cristy	fi
3987da16f16767eb31921af855f17bda465fffc4e000cristy
3988da16f16767eb31921af855f17bda465fffc4e000cristy      else
398915f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_fatal_error "invalid argument '$opt'"
3990da16f16767eb31921af855f17bda465fffc4e000cristy      fi
3991da16f16767eb31921af855f17bda465fffc4e000cristy    done
3992da16f16767eb31921af855f17bda465fffc4e000cristy
3993da16f16767eb31921af855f17bda465fffc4e000cristy    if test -n "$libs"; then
3994da16f16767eb31921af855f17bda465fffc4e000cristy      if test -n "$lt_sysroot"; then
3995da16f16767eb31921af855f17bda465fffc4e000cristy        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3996da16f16767eb31921af855f17bda465fffc4e000cristy        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
3997da16f16767eb31921af855f17bda465fffc4e000cristy      else
3998da16f16767eb31921af855f17bda465fffc4e000cristy        sysroot_cmd=
3999da16f16767eb31921af855f17bda465fffc4e000cristy      fi
4000da16f16767eb31921af855f17bda465fffc4e000cristy
4001da16f16767eb31921af855f17bda465fffc4e000cristy      # Remove sysroot references
4002da16f16767eb31921af855f17bda465fffc4e000cristy      if $opt_dry_run; then
4003da16f16767eb31921af855f17bda465fffc4e000cristy        for lib in $libs; do
400415f2201421a23fbf95840adf524cfdb4db384b85Cristy          echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4005da16f16767eb31921af855f17bda465fffc4e000cristy        done
4006da16f16767eb31921af855f17bda465fffc4e000cristy      else
4007da16f16767eb31921af855f17bda465fffc4e000cristy        tmpdir=`func_mktempdir`
4008da16f16767eb31921af855f17bda465fffc4e000cristy        for lib in $libs; do
400915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4010da16f16767eb31921af855f17bda465fffc4e000cristy	    > $tmpdir/tmp-la
4011da16f16767eb31921af855f17bda465fffc4e000cristy	  mv -f $tmpdir/tmp-la $lib
4012da16f16767eb31921af855f17bda465fffc4e000cristy	done
4013da16f16767eb31921af855f17bda465fffc4e000cristy        ${RM}r "$tmpdir"
4014da16f16767eb31921af855f17bda465fffc4e000cristy      fi
4015da16f16767eb31921af855f17bda465fffc4e000cristy    fi
40163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4017da16f16767eb31921af855f17bda465fffc4e000cristy    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
40183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for libdir in $libdirs; do
40193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$finish_cmds"; then
40203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Do each command in the finish commands.
40213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
40223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy'"$cmd"'"'
40233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
40243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$finish_eval"; then
40253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Do the single finish_eval.
40263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval cmds=\"$finish_eval\"
4027da16f16767eb31921af855f17bda465fffc4e000cristy	  $opt_dry_run || eval "$cmds" || func_append admincmds "
40283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy       $cmds"
40293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
40303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
40313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
40323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
40333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Exit here if they wanted silent mode.
403415f2201421a23fbf95840adf524cfdb4db384b85Cristy    $opt_quiet && exit $EXIT_SUCCESS
40353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4036da16f16767eb31921af855f17bda465fffc4e000cristy    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4037da16f16767eb31921af855f17bda465fffc4e000cristy      echo "----------------------------------------------------------------------"
4038da16f16767eb31921af855f17bda465fffc4e000cristy      echo "Libraries have been installed in:"
4039da16f16767eb31921af855f17bda465fffc4e000cristy      for libdir in $libdirs; do
4040da16f16767eb31921af855f17bda465fffc4e000cristy	$ECHO "   $libdir"
4041da16f16767eb31921af855f17bda465fffc4e000cristy      done
4042da16f16767eb31921af855f17bda465fffc4e000cristy      echo
4043da16f16767eb31921af855f17bda465fffc4e000cristy      echo "If you ever happen to want to link against installed libraries"
4044da16f16767eb31921af855f17bda465fffc4e000cristy      echo "in a given directory, LIBDIR, you must either use libtool, and"
404515f2201421a23fbf95840adf524cfdb4db384b85Cristy      echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4046da16f16767eb31921af855f17bda465fffc4e000cristy      echo "flag during linking and do at least one of the following:"
4047da16f16767eb31921af855f17bda465fffc4e000cristy      if test -n "$shlibpath_var"; then
404815f2201421a23fbf95840adf524cfdb4db384b85Cristy	echo "   - add LIBDIR to the '$shlibpath_var' environment variable"
4049da16f16767eb31921af855f17bda465fffc4e000cristy	echo "     during execution"
4050da16f16767eb31921af855f17bda465fffc4e000cristy      fi
4051da16f16767eb31921af855f17bda465fffc4e000cristy      if test -n "$runpath_var"; then
405215f2201421a23fbf95840adf524cfdb4db384b85Cristy	echo "   - add LIBDIR to the '$runpath_var' environment variable"
4053da16f16767eb31921af855f17bda465fffc4e000cristy	echo "     during linking"
4054da16f16767eb31921af855f17bda465fffc4e000cristy      fi
4055da16f16767eb31921af855f17bda465fffc4e000cristy      if test -n "$hardcode_libdir_flag_spec"; then
4056da16f16767eb31921af855f17bda465fffc4e000cristy	libdir=LIBDIR
4057da16f16767eb31921af855f17bda465fffc4e000cristy	eval flag=\"$hardcode_libdir_flag_spec\"
40583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
405915f2201421a23fbf95840adf524cfdb4db384b85Cristy	$ECHO "   - use the '$flag' linker flag"
4060da16f16767eb31921af855f17bda465fffc4e000cristy      fi
4061da16f16767eb31921af855f17bda465fffc4e000cristy      if test -n "$admincmds"; then
4062da16f16767eb31921af855f17bda465fffc4e000cristy	$ECHO "   - have your system administrator run these commands:$admincmds"
4063da16f16767eb31921af855f17bda465fffc4e000cristy      fi
4064da16f16767eb31921af855f17bda465fffc4e000cristy      if test -f /etc/ld.so.conf; then
406515f2201421a23fbf95840adf524cfdb4db384b85Cristy	echo "   - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4066da16f16767eb31921af855f17bda465fffc4e000cristy      fi
4067da16f16767eb31921af855f17bda465fffc4e000cristy      echo
40683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4069da16f16767eb31921af855f17bda465fffc4e000cristy      echo "See any operating system documentation about shared libraries for"
4070da16f16767eb31921af855f17bda465fffc4e000cristy      case $host in
4071da16f16767eb31921af855f17bda465fffc4e000cristy	solaris2.[6789]|solaris2.1[0-9])
4072da16f16767eb31921af855f17bda465fffc4e000cristy	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4073da16f16767eb31921af855f17bda465fffc4e000cristy	  echo "pages."
4074da16f16767eb31921af855f17bda465fffc4e000cristy	  ;;
4075da16f16767eb31921af855f17bda465fffc4e000cristy	*)
4076da16f16767eb31921af855f17bda465fffc4e000cristy	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
4077da16f16767eb31921af855f17bda465fffc4e000cristy	  ;;
4078da16f16767eb31921af855f17bda465fffc4e000cristy      esac
4079da16f16767eb31921af855f17bda465fffc4e000cristy      echo "----------------------------------------------------------------------"
4080da16f16767eb31921af855f17bda465fffc4e000cristy    fi
40813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit $EXIT_SUCCESS
40823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
40833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
408415f2201421a23fbf95840adf524cfdb4db384b85Cristytest finish = "$opt_mode" && func_mode_finish ${1+"$@"}
40853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
40863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
40873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_mode_install arg...
40883ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_mode_install ()
40893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
409015f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
409115f2201421a23fbf95840adf524cfdb4db384b85Cristy
40923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # There may be an optional sh(1) argument at the beginning of
40933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # install_prog (especially on Windows NT).
409415f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
40953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy       # Allow the use of GNU shtool's install command.
409615f2201421a23fbf95840adf524cfdb4db384b85Cristy       case $nonopt in *shtool*) :;; *) false;; esac
409715f2201421a23fbf95840adf524cfdb4db384b85Cristy    then
40983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Aesthetically quote it.
40993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_quote_for_eval "$nonopt"
41003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      install_prog="$func_quote_for_eval_result "
41013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      arg=$1
41023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      shift
41033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
41043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      install_prog=
41053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      arg=$nonopt
41063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
41073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
41083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # The real first argument should be the name of the installation program.
41093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Aesthetically quote it.
41103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_quote_for_eval "$arg"
4111da16f16767eb31921af855f17bda465fffc4e000cristy    func_append install_prog "$func_quote_for_eval_result"
411298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    install_shared_prog=$install_prog
411398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    case " $install_prog " in
411498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      *[\\\ /]cp\ *) install_cp=: ;;
411598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      *) install_cp=false ;;
411698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    esac
41173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
41183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # We need to accept at least all the BSD install flags.
41193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    dest=
41203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    files=
41213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    opts=
41223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    prev=
41233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    install_type=
412415f2201421a23fbf95840adf524cfdb4db384b85Cristy    isdir=false
41253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    stripme=
412698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    no_mode=:
41273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for arg
41283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    do
412998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      arg2=
41303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$dest"; then
4131da16f16767eb31921af855f17bda465fffc4e000cristy	func_append files " $dest"
41323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	dest=$arg
41333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
41343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
41353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
41363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $arg in
413715f2201421a23fbf95840adf524cfdb4db384b85Cristy      -d) isdir=: ;;
41383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -f)
413998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	if $install_cp; then :; else
414098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  prev=$arg
414198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	fi
41423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
41433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -g | -m | -o)
41443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=$arg
41453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
41463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -s)
41473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	stripme=" -s"
41483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
41493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
41503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -*)
41513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
41523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
41533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# If the previous option needed an argument, then skip it.
41543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$prev"; then
415515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test X-m = "X$prev" && test -n "$install_override_mode"; then
415698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    arg2=$install_override_mode
415798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    no_mode=false
415898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  fi
41593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
41603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
41613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  dest=$arg
41623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
41633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
41643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
41653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
41663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
41673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Aesthetically quote the argument.
41683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_quote_for_eval "$arg"
4169da16f16767eb31921af855f17bda465fffc4e000cristy      func_append install_prog " $func_quote_for_eval_result"
417098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      if test -n "$arg2"; then
417198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	func_quote_for_eval "$arg2"
417298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      fi
4173da16f16767eb31921af855f17bda465fffc4e000cristy      func_append install_shared_prog " $func_quote_for_eval_result"
41743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
41753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
41763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -z "$install_prog" && \
41773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_fatal_help "you must specify an install program"
41783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
41793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -n "$prev" && \
418015f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_fatal_help "the '$prev' option requires an argument"
41813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
418298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    if test -n "$install_override_mode" && $no_mode; then
418398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      if $install_cp; then :; else
418498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	func_quote_for_eval "$install_override_mode"
4185da16f16767eb31921af855f17bda465fffc4e000cristy	func_append install_shared_prog " -m $func_quote_for_eval_result"
418698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      fi
418798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    fi
418898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
41893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test -z "$files"; then
41903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -z "$dest"; then
41913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_fatal_help "no file or destination specified"
41923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
41933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_fatal_help "you must specify a destination"
41943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
41953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
41963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
41973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Strip any trailing slash from the destination.
41983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_stripname '' '/' "$dest"
41993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    dest=$func_stripname_result
42003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Check to see that the destination is a directory.
420215f2201421a23fbf95840adf524cfdb4db384b85Cristy    test -d "$dest" && isdir=:
420315f2201421a23fbf95840adf524cfdb4db384b85Cristy    if $isdir; then
420415f2201421a23fbf95840adf524cfdb4db384b85Cristy      destdir=$dest
42053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      destname=
42063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
42073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_dirname_and_basename "$dest" "" "."
420815f2201421a23fbf95840adf524cfdb4db384b85Cristy      destdir=$func_dirname_result
420915f2201421a23fbf95840adf524cfdb4db384b85Cristy      destname=$func_basename_result
42103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Not a directory, so check to see that there is only one file specified.
42123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      set dummy $files; shift
42133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test "$#" -gt 1 && \
421415f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_fatal_help "'$dest' is not a directory"
42153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
42163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $destdir in
42173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    [\\/]* | [A-Za-z]:[\\/]*) ;;
42183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *)
42193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for file in $files; do
42203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $file in
42213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*.lo) ;;
42223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
422315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_help "'$destdir' must be an absolute directory name"
42243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
42253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
42263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
42273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
42283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
42293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # This variable tells wrapper scripts just to set variables rather
42313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # than running their programs.
423215f2201421a23fbf95840adf524cfdb4db384b85Cristy    libtool_install_magic=$magic
42333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    staticlibs=
42353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    future_libdirs=
42363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    current_libdirs=
42373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for file in $files; do
42383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Do each installation.
42403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $file in
42413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.$libext)
42423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Do the static libraries later.
4243da16f16767eb31921af855f17bda465fffc4e000cristy	func_append staticlibs " $file"
42443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
42453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.la)
4247da16f16767eb31921af855f17bda465fffc4e000cristy	func_resolve_sysroot "$file"
4248da16f16767eb31921af855f17bda465fffc4e000cristy	file=$func_resolve_sysroot_result
4249da16f16767eb31921af855f17bda465fffc4e000cristy
42503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Check to see that this really is a libtool archive.
42513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_lalib_unsafe_p "$file" \
425215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  || func_fatal_help "'$file' is not a valid libtool archive"
42533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	library_names=
42553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	old_library=
42563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	relink_command=
42573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_source "$file"
42583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Add the libdir to current_libdirs if it is the destination.
42603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test "X$destdir" = "X$libdir"; then
42613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case "$current_libdirs " in
42623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" $libdir "*) ;;
4263da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append current_libdirs " $libdir" ;;
42643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
42653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
42663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Note the libdir as a future libdir.
42673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case "$future_libdirs " in
42683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" $libdir "*) ;;
4269da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append future_libdirs " $libdir" ;;
42703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
42713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
42723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_dirname "$file" "/" ""
427415f2201421a23fbf95840adf524cfdb4db384b85Cristy	dir=$func_dirname_result
4275da16f16767eb31921af855f17bda465fffc4e000cristy	func_append dir "$objdir"
42763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$relink_command"; then
42783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Determine the prefix the user has applied to our future dir.
427998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
42803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Don't allow the user to place us outside of our expected
42823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # location b/c this prevents finding dependent libraries that
42833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # are installed to the same prefix.
42843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # At present, this check doesn't affect windows .dll's that
42853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # are installed into $libdir/../bin (currently, that works fine)
42863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # but it's something to keep an eye on.
42873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test "$inst_prefix_dir" = "$destdir" && \
428815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
42893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
42903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$inst_prefix_dir"; then
42913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Stick the inst_prefix_dir data into the link command.
429298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
42933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
429498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
42953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
42963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
429715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_warning "relinking '$file'"
42983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_show_eval "$relink_command" \
429915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
43003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
43013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# See the names of the shared library.
43033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	set dummy $library_names; shift
43043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$1"; then
430515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  realname=$1
43063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  shift
43073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
430815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  srcname=$realname
430915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  test -n "$relink_command" && srcname=${realname}T
43103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Install the shared library and build the symlinks.
431298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
43133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      'exit $?'
431415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  tstripme=$stripme
43153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $host_os in
43163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  cygwin* | mingw* | pw32* | cegcc*)
43173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case $realname in
43183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *.dll.a)
431915f2201421a23fbf95840adf524cfdb4db384b85Cristy	      tstripme=
432015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      ;;
432115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    esac
432215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    ;;
432315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  os2*)
432415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    case $realname in
432515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    *_dll.a)
432615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      tstripme=
43273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
43283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
43293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
43303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
43313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$tstripme" && test -n "$striplib"; then
43323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
43333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
43343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test "$#" -gt 0; then
43363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Delete the old symlinks, and create new ones.
433715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    # Try 'ln -sf' first, because the 'ln' binary might depend on
43383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
43393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # so we also need to try rm && ln -s.
43403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for linkname
43413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    do
43423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test "$linkname" != "$realname" \
43433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
43443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
43453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
43463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Do each command in the postinstall commands.
434815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  lib=$destdir/$realname
43493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_execute_cmds "$postinstall_cmds" 'exit $?'
43503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
43513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Install the pseudo-library for information purposes.
43533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_basename "$file"
435415f2201421a23fbf95840adf524cfdb4db384b85Cristy	name=$func_basename_result
435515f2201421a23fbf95840adf524cfdb4db384b85Cristy	instname=$dir/${name}i
43563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
43573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Maybe install the static library, too.
4359da16f16767eb31921af855f17bda465fffc4e000cristy	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
43603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
43613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.lo)
43633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Install (i.e. copy) a libtool object.
43643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Figure out destination file name, if it wasn't already specified.
43663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$destname"; then
436715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  destfile=$destdir/$destname
43683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
43693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_basename "$file"
437015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  destfile=$func_basename_result
437115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  destfile=$destdir/$destfile
43723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
43733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Deduce the name of the destination old-style object file.
43753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $destfile in
43763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*.lo)
43773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_lo2o "$destfile"
43783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  staticdest=$func_lo2o_result
43793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
43803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*.$objext)
438115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  staticdest=$destfile
43823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  destfile=
43833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
43843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
438515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_help "cannot copy a libtool object to '$destfile'"
43863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
43873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
43883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Install the libtool object if requested.
43903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	test -n "$destfile" && \
43913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_show_eval "$install_prog $file $destfile" 'exit $?'
43923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
43933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Install the old object if enabled.
439415f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$build_old_libs"; then
43953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Deduce the name of the old-style object file.
43963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_lo2o "$file"
43973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  staticobj=$func_lo2o_result
43983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
43993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
44003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit $EXIT_SUCCESS
44013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
44023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
44033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
44043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Figure out destination file name, if it wasn't already specified.
44053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$destname"; then
440615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  destfile=$destdir/$destname
44073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
44083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_basename "$file"
440915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  destfile=$func_basename_result
441015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  destfile=$destdir/$destfile
44113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
44123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
44133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# If the file is missing, and there is a .exe on the end, strip it
44143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# because it is most likely a libtool script we actually want to
44153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# install
441615f2201421a23fbf95840adf524cfdb4db384b85Cristy	stripped_ext=
44173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $file in
44183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *.exe)
44193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test ! -f "$file"; then
44203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_stripname '' '.exe' "$file"
44213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      file=$func_stripname_result
442215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      stripped_ext=.exe
44233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
44243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
44253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
44263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
44273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Do a test to see if this is really a libtool program.
44283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $host in
44293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*cygwin* | *mingw*)
44303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if func_ltwrapper_executable_p "$file"; then
44313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_ltwrapper_scriptname "$file"
44323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      wrapper=$func_ltwrapper_scriptname_result
44333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
44343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_stripname '' '.exe' "$file"
44353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      wrapper=$func_stripname_result
44363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
44373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
44383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
44393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    wrapper=$file
44403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
44413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
44423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if func_ltwrapper_script_p "$wrapper"; then
44433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  notinst_deplibs=
44443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  relink_command=
44453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
44463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_source "$wrapper"
44473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
44483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Check the variables that should have been set.
44493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test -z "$generated_by_libtool_version" && \
445015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "invalid libtool wrapper script '$wrapper'"
44513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
445215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  finalize=:
44533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for lib in $notinst_deplibs; do
44543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Check to see that each library is installed.
44553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    libdir=
44563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -f "$lib"; then
44573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_source "$lib"
44583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
445915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
44603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$libdir" && test ! -f "$libfile"; then
446115f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_warning "'$lib' has not been installed in '$libdir'"
446215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      finalize=false
44633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
44643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
44653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
44663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  relink_command=
44673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_source "$wrapper"
44683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
44693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  outputname=
447015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test no = "$fast_install" && test -n "$relink_command"; then
44713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $opt_dry_run || {
447215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if $finalize; then
44733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        tmpdir=`func_mktempdir`
44743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_basename "$file$stripped_ext"
447515f2201421a23fbf95840adf524cfdb4db384b85Cristy		file=$func_basename_result
447615f2201421a23fbf95840adf524cfdb4db384b85Cristy	        outputname=$tmpdir/$file
44773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        # Replace the output file specification.
447898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
44793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
448015f2201421a23fbf95840adf524cfdb4db384b85Cristy	        $opt_quiet || {
44813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	          func_quote_for_expand "$relink_command"
44823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  eval "func_echo $func_quote_for_expand_result"
44833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        }
44843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        if eval "$relink_command"; then :
44853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	          else
448615f2201421a23fbf95840adf524cfdb4db384b85Cristy		  func_error "error: relink '$file' with the above command before installing it"
44873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  $opt_dry_run || ${RM}r "$tmpdir"
44883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  continue
44893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        fi
449015f2201421a23fbf95840adf524cfdb4db384b85Cristy	        file=$outputname
44913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
449215f2201421a23fbf95840adf524cfdb4db384b85Cristy	        func_warning "cannot relink '$file'"
44933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
44943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
44953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
44963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Install the binary that we compiled earlier.
449798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
44983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
44993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
45003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# remove .exe since cygwin /usr/bin/install will append another
45023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# one anyway
45033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $install_prog,$host in
45043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*/usr/bin/install*,*cygwin*)
45053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $file:$destfile in
45063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *.exe:*.exe)
45073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # this is ok
45083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
45093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *.exe:*)
45103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    destfile=$destfile.exe
45113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
45123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *:*.exe)
45133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_stripname '' '.exe' "$destfile"
45143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    destfile=$func_stripname_result
45153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
45163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
45173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
45183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
45193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
45203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$opt_dry_run || if test -n "$outputname"; then
45213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ${RM}r "$tmpdir"
45223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
45233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
45243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
45253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
45263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for file in $staticlibs; do
45283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_basename "$file"
452915f2201421a23fbf95840adf524cfdb4db384b85Cristy      name=$func_basename_result
45303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Set up the ranlib parameters.
453215f2201421a23fbf95840adf524cfdb4db384b85Cristy      oldlib=$destdir/$name
45332542fc61a973e588b23b3ddac880f01ae6c4c64dcristy      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
45342542fc61a973e588b23b3ddac880f01ae6c4c64dcristy      tool_oldlib=$func_to_tool_file_result
45353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
45373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$stripme" && test -n "$old_striplib"; then
45392542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
45403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
45413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Do each command in the postinstall commands.
45433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
45443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
45453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -n "$future_libdirs" && \
454715f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_warning "remember to run '$progname --finish$future_libdirs'"
45483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test -n "$current_libdirs"; then
45503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Maybe just do a dry run.
45513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $opt_dry_run && current_libdirs=" -n$current_libdirs"
455215f2201421a23fbf95840adf524cfdb4db384b85Cristy      exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
45533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
45543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      exit $EXIT_SUCCESS
45553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
45563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
45573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
455815f2201421a23fbf95840adf524cfdb4db384b85Cristytest install = "$opt_mode" && func_mode_install ${1+"$@"}
45593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_generate_dlsyms outputname originator pic_p
45623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Extract symbols from dlprefiles and create ${outputname}S.o with
45633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# a dlpreopen symbol table.
45643ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_generate_dlsyms ()
45653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
456615f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
456715f2201421a23fbf95840adf524cfdb4db384b85Cristy
456815f2201421a23fbf95840adf524cfdb4db384b85Cristy    my_outputname=$1
456915f2201421a23fbf95840adf524cfdb4db384b85Cristy    my_originator=$2
457015f2201421a23fbf95840adf524cfdb4db384b85Cristy    my_pic_p=${3-false}
457115f2201421a23fbf95840adf524cfdb4db384b85Cristy    my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
45723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    my_dlsyms=
45733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
457415f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
45753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$NM" && test -n "$global_symbol_pipe"; then
457615f2201421a23fbf95840adf524cfdb4db384b85Cristy	my_dlsyms=${my_outputname}S.c
45773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
45783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_error "not configured to extract global symbols from dlpreopened files"
45793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
45803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
45813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test -n "$my_dlsyms"; then
45833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $my_dlsyms in
45843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      "") ;;
45853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.c)
45863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Discover the nlist of each of the dlfiles.
458715f2201421a23fbf95840adf524cfdb4db384b85Cristy	nlist=$output_objdir/$my_outputname.nm
45883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
45903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Parse the name list into a source file.
45923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_verbose "creating $output_objdir/$my_dlsyms"
45933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
459515f2201421a23fbf95840adf524cfdb4db384b85Cristy/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
459615f2201421a23fbf95840adf524cfdb4db384b85Cristy/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
45973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
45983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifdef __cplusplus
45993ed852eea50f9d4cd633efb8c2b054b8e33c253cristyextern \"C\" {
46003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
46013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
460215f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
460398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
460498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#endif
460598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
4606da16f16767eb31921af855f17bda465fffc4e000cristy/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
460715f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
460815f2201421a23fbf95840adf524cfdb4db384b85Cristy/* DATA imports from DLLs on WIN32 can't be const, because runtime
4609da16f16767eb31921af855f17bda465fffc4e000cristy   relocations are performed -- see ld's documentation on pseudo-relocs.  */
4610da16f16767eb31921af855f17bda465fffc4e000cristy# define LT_DLSYM_CONST
461115f2201421a23fbf95840adf524cfdb4db384b85Cristy#elif defined __osf__
4612da16f16767eb31921af855f17bda465fffc4e000cristy/* This system does not cope well with relocations in const data.  */
4613da16f16767eb31921af855f17bda465fffc4e000cristy# define LT_DLSYM_CONST
4614da16f16767eb31921af855f17bda465fffc4e000cristy#else
4615da16f16767eb31921af855f17bda465fffc4e000cristy# define LT_DLSYM_CONST const
4616da16f16767eb31921af855f17bda465fffc4e000cristy#endif
4617da16f16767eb31921af855f17bda465fffc4e000cristy
461815f2201421a23fbf95840adf524cfdb4db384b85Cristy#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
461915f2201421a23fbf95840adf524cfdb4db384b85Cristy
46203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* External symbol declarations for the compiler. */\
46213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"
46223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
462315f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$dlself"; then
462415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_verbose "generating symbol list for '$output'"
46253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
46263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
46273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
46283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Add our own program objects to the symbol list.
462998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
46303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for progfile in $progfiles; do
4631da16f16767eb31921af855f17bda465fffc4e000cristy	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
463215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
4633da16f16767eb31921af855f17bda465fffc4e000cristy	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
46343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
46353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
46363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$exclude_expsyms"; then
46373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $opt_dry_run || {
46383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
46393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      eval '$MV "$nlist"T "$nlist"'
46403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
46413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
46423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
46433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$export_symbols_regex"; then
46443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $opt_dry_run || {
46453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
46463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      eval '$MV "$nlist"T "$nlist"'
46473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
46483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
46493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
46503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Prepare the list of exported symbols
46513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -z "$export_symbols"; then
465215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    export_symbols=$output_objdir/$outputname.exp
46533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $opt_dry_run || {
46543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $RM $export_symbols
465515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
46563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $host in
46573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *cygwin* | *mingw* | *cegcc* )
46583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
46593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
46603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        ;;
46613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
46623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
46633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
46643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $opt_dry_run || {
466515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
46663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
46673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      eval '$MV "$nlist"T "$nlist"'
46683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $host in
466998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	        *cygwin* | *mingw* | *cegcc* )
46703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
46713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
46723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	          ;;
46733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
46743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
46753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
46763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
46773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
46783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for dlprefile in $dlprefiles; do
467915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_verbose "extracting global C symbols from '$dlprefile'"
46803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_basename "$dlprefile"
468115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  name=$func_basename_result
4682da16f16767eb31921af855f17bda465fffc4e000cristy          case $host in
4683da16f16767eb31921af855f17bda465fffc4e000cristy	    *cygwin* | *mingw* | *cegcc* )
4684da16f16767eb31921af855f17bda465fffc4e000cristy	      # if an import library, we need to obtain dlname
4685da16f16767eb31921af855f17bda465fffc4e000cristy	      if func_win32_import_lib_p "$dlprefile"; then
4686da16f16767eb31921af855f17bda465fffc4e000cristy	        func_tr_sh "$dlprefile"
4687da16f16767eb31921af855f17bda465fffc4e000cristy	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
468815f2201421a23fbf95840adf524cfdb4db384b85Cristy	        dlprefile_dlbasename=
4689da16f16767eb31921af855f17bda465fffc4e000cristy	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
4690da16f16767eb31921af855f17bda465fffc4e000cristy	          # Use subshell, to avoid clobbering current variable values
4691da16f16767eb31921af855f17bda465fffc4e000cristy	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
469215f2201421a23fbf95840adf524cfdb4db384b85Cristy	          if test -n "$dlprefile_dlname"; then
4693da16f16767eb31921af855f17bda465fffc4e000cristy	            func_basename "$dlprefile_dlname"
469415f2201421a23fbf95840adf524cfdb4db384b85Cristy	            dlprefile_dlbasename=$func_basename_result
4695da16f16767eb31921af855f17bda465fffc4e000cristy	          else
4696da16f16767eb31921af855f17bda465fffc4e000cristy	            # no lafile. user explicitly requested -dlpreopen <import library>.
4697da16f16767eb31921af855f17bda465fffc4e000cristy	            $sharedlib_from_linklib_cmd "$dlprefile"
4698da16f16767eb31921af855f17bda465fffc4e000cristy	            dlprefile_dlbasename=$sharedlib_from_linklib_result
4699da16f16767eb31921af855f17bda465fffc4e000cristy	          fi
4700da16f16767eb31921af855f17bda465fffc4e000cristy	        fi
4701da16f16767eb31921af855f17bda465fffc4e000cristy	        $opt_dry_run || {
470215f2201421a23fbf95840adf524cfdb4db384b85Cristy	          if test -n "$dlprefile_dlbasename"; then
4703da16f16767eb31921af855f17bda465fffc4e000cristy	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
4704da16f16767eb31921af855f17bda465fffc4e000cristy	          else
4705da16f16767eb31921af855f17bda465fffc4e000cristy	            func_warning "Could not compute DLL name from $name"
4706da16f16767eb31921af855f17bda465fffc4e000cristy	            eval '$ECHO ": $name " >> "$nlist"'
4707da16f16767eb31921af855f17bda465fffc4e000cristy	          fi
4708da16f16767eb31921af855f17bda465fffc4e000cristy	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4709da16f16767eb31921af855f17bda465fffc4e000cristy	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
4710da16f16767eb31921af855f17bda465fffc4e000cristy	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
4711da16f16767eb31921af855f17bda465fffc4e000cristy	        }
4712da16f16767eb31921af855f17bda465fffc4e000cristy	      else # not an import lib
4713da16f16767eb31921af855f17bda465fffc4e000cristy	        $opt_dry_run || {
4714da16f16767eb31921af855f17bda465fffc4e000cristy	          eval '$ECHO ": $name " >> "$nlist"'
4715da16f16767eb31921af855f17bda465fffc4e000cristy	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4716da16f16767eb31921af855f17bda465fffc4e000cristy	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4717da16f16767eb31921af855f17bda465fffc4e000cristy	        }
4718da16f16767eb31921af855f17bda465fffc4e000cristy	      fi
4719da16f16767eb31921af855f17bda465fffc4e000cristy	    ;;
4720da16f16767eb31921af855f17bda465fffc4e000cristy	    *)
4721da16f16767eb31921af855f17bda465fffc4e000cristy	      $opt_dry_run || {
4722da16f16767eb31921af855f17bda465fffc4e000cristy	        eval '$ECHO ": $name " >> "$nlist"'
4723da16f16767eb31921af855f17bda465fffc4e000cristy	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4724da16f16767eb31921af855f17bda465fffc4e000cristy	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4725da16f16767eb31921af855f17bda465fffc4e000cristy	      }
4726da16f16767eb31921af855f17bda465fffc4e000cristy	    ;;
4727da16f16767eb31921af855f17bda465fffc4e000cristy          esac
47283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
47293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
47303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$opt_dry_run || {
47313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Make sure we have at least an empty file.
47323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test -f "$nlist" || : > "$nlist"
47333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
47343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$exclude_expsyms"; then
47353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
47363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $MV "$nlist"T "$nlist"
47373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
47383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
47393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Try sorting and uniquifying the output.
47403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if $GREP -v "^: " < "$nlist" |
47413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if sort -k 3 </dev/null >/dev/null 2>&1; then
47423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		sort -k 3
47433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
47443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		sort +2
47453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi |
47463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      uniq > "$nlist"S; then
47473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    :
47483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
47493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $GREP -v "^: " < "$nlist" > "$nlist"S
47503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
47513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
47523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -f "$nlist"S; then
47533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
47543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
475598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
47563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
47573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
475815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_show_eval '$RM "${nlist}I"'
475915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test -n "$global_symbol_to_import"; then
476015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
476115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  fi
476215f2201421a23fbf95840adf524cfdb4db384b85Cristy
476398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  echo >> "$output_objdir/$my_dlsyms" "\
47643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
47653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* The mapping between symbol names and symbols.  */
47663ed852eea50f9d4cd633efb8c2b054b8e33c253cristytypedef struct {
47673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  const char *name;
47683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  void *address;
47693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} lt_dlsymlist;
4770da16f16767eb31921af855f17bda465fffc4e000cristyextern LT_DLSYM_CONST lt_dlsymlist
477115f2201421a23fbf95840adf524cfdb4db384b85Cristylt_${my_prefix}_LTX_preloaded_symbols[];\
477215f2201421a23fbf95840adf524cfdb4db384b85Cristy"
477315f2201421a23fbf95840adf524cfdb4db384b85Cristy
477415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test -s "$nlist"I; then
477515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    echo >> "$output_objdir/$my_dlsyms" "\
477615f2201421a23fbf95840adf524cfdb4db384b85Cristystatic void lt_syminit(void)
477715f2201421a23fbf95840adf524cfdb4db384b85Cristy{
477815f2201421a23fbf95840adf524cfdb4db384b85Cristy  LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
477915f2201421a23fbf95840adf524cfdb4db384b85Cristy  for (; symbol->name; ++symbol)
478015f2201421a23fbf95840adf524cfdb4db384b85Cristy    {"
478115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
478215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    echo >> "$output_objdir/$my_dlsyms" "\
478315f2201421a23fbf95840adf524cfdb4db384b85Cristy    }
478415f2201421a23fbf95840adf524cfdb4db384b85Cristy}"
478515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  fi
478615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  echo >> "$output_objdir/$my_dlsyms" "\
4787da16f16767eb31921af855f17bda465fffc4e000cristyLT_DLSYM_CONST lt_dlsymlist
47883ed852eea50f9d4cd633efb8c2b054b8e33c253cristylt_${my_prefix}_LTX_preloaded_symbols[] =
478915f2201421a23fbf95840adf524cfdb4db384b85Cristy{ {\"$my_originator\", (void *) 0},"
479015f2201421a23fbf95840adf524cfdb4db384b85Cristy
479115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test -s "$nlist"I; then
479215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    echo >> "$output_objdir/$my_dlsyms" "\
479315f2201421a23fbf95840adf524cfdb4db384b85Cristy  {\"@INIT@\", (void *) &lt_syminit},"
479415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  fi
47953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
47963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $need_lib_prefix in
47973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  no)
47983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
47993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
48003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
48013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
48023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
48033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
480498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  echo >> "$output_objdir/$my_dlsyms" "\
48053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  {0, (void *) 0}
48063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy};
48073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
48083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* This works around a problem in FreeBSD linker */
48093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifdef FREEBSD_WORKAROUND
48103ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic const void *lt_preloaded_setup() {
48113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return lt_${my_prefix}_LTX_preloaded_symbols;
48123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
48133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
48143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
48153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifdef __cplusplus
48163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
48173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif\
48183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"
48193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	} # !$opt_dry_run
48203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
48213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	pic_flag_for_symtable=
48223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case "$compile_command " in
48233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*" -static "*) ;;
48243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
48253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $host in
48263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # compiling the symbol table file with pic_flag works around
48273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # a FreeBSD bug that causes programs to crash when -lm is
48283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # linked before any other PIC object.  But we must not use
48293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # pic_flag when linking with -static.  The problem exists in
48303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
48312542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
48323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
48333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-hpux*)
48343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    pic_flag_for_symtable=" $pic_flag"  ;;
48353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
483615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    $my_pic_p && pic_flag_for_symtable=" $pic_flag"
48373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
48383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
48393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
48403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
48413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	symtab_cflags=
48423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for arg in $LTCFLAGS; do
48433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $arg in
48443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  -pie | -fpie | -fPIE) ;;
4845da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append symtab_cflags " $arg" ;;
48463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
48473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
48483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
48493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Now compile the dynamic symbol file.
48503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
48513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
48523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Clean up the generated files.
485315f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
48543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
48553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Transform the symbol file into the correct name.
485615f2201421a23fbf95840adf524cfdb4db384b85Cristy	symfileobj=$output_objdir/${my_outputname}S.$objext
48573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $host in
48583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*cygwin* | *mingw* | *cegcc* )
48593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -f "$output_objdir/$my_outputname.def"; then
486098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
486198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
48623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
486398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
486498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
48653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
48663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
48673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
486898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
486998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
48703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
48713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
48723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
48733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
487415f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_fatal_error "unknown suffix for '$my_dlsyms'"
48753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
48763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
48773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
48783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # We keep going just in case the user didn't refer to
48793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
48803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # really was required.
48813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
48823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Nullify the symbol file.
488398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
488498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
48853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
48863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
48873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
488815f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_cygming_gnu_implib_p ARG
488915f2201421a23fbf95840adf524cfdb4db384b85Cristy# This predicate returns with zero status (TRUE) if
489015f2201421a23fbf95840adf524cfdb4db384b85Cristy# ARG is a GNU/binutils-style import library. Returns
489115f2201421a23fbf95840adf524cfdb4db384b85Cristy# with nonzero status (FALSE) otherwise.
489215f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_cygming_gnu_implib_p ()
489315f2201421a23fbf95840adf524cfdb4db384b85Cristy{
489415f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
489515f2201421a23fbf95840adf524cfdb4db384b85Cristy
489615f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_tool_file "$1" func_convert_file_msys_to_w32
489715f2201421a23fbf95840adf524cfdb4db384b85Cristy  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)$'`
489815f2201421a23fbf95840adf524cfdb4db384b85Cristy  test -n "$func_cygming_gnu_implib_tmp"
489915f2201421a23fbf95840adf524cfdb4db384b85Cristy}
490015f2201421a23fbf95840adf524cfdb4db384b85Cristy
490115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_cygming_ms_implib_p ARG
490215f2201421a23fbf95840adf524cfdb4db384b85Cristy# This predicate returns with zero status (TRUE) if
490315f2201421a23fbf95840adf524cfdb4db384b85Cristy# ARG is an MS-style import library. Returns
490415f2201421a23fbf95840adf524cfdb4db384b85Cristy# with nonzero status (FALSE) otherwise.
490515f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_cygming_ms_implib_p ()
490615f2201421a23fbf95840adf524cfdb4db384b85Cristy{
490715f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
490815f2201421a23fbf95840adf524cfdb4db384b85Cristy
490915f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_to_tool_file "$1" func_convert_file_msys_to_w32
491015f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
491115f2201421a23fbf95840adf524cfdb4db384b85Cristy  test -n "$func_cygming_ms_implib_tmp"
491215f2201421a23fbf95840adf524cfdb4db384b85Cristy}
491315f2201421a23fbf95840adf524cfdb4db384b85Cristy
49143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_win32_libid arg
49153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# return the library type of file 'arg'
49163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#
49173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Need a lot of goo to handle *both* DLLs and import libs
49183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Has to be a shell function in order to 'eat' the argument
49193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# that is supplied when $file_magic_command is called.
492098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# Despite the name, also deal with 64 bit binaries.
49213ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_win32_libid ()
49223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
492315f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
492415f2201421a23fbf95840adf524cfdb4db384b85Cristy
492515f2201421a23fbf95840adf524cfdb4db384b85Cristy  win32_libid_type=unknown
49263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  win32_fileres=`file -L $1 2>/dev/null`
49273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  case $win32_fileres in
49283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *ar\ archive\ import\ library*) # definitely import
49293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    win32_libid_type="x86 archive import"
49303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ;;
49313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *ar\ archive*) # could be an import, or static
493298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
49333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
493498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
493515f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $nm_interface in
493615f2201421a23fbf95840adf524cfdb4db384b85Cristy      "MS dumpbin")
493715f2201421a23fbf95840adf524cfdb4db384b85Cristy	if func_cygming_ms_implib_p "$1" ||
493815f2201421a23fbf95840adf524cfdb4db384b85Cristy	   func_cygming_gnu_implib_p "$1"
493915f2201421a23fbf95840adf524cfdb4db384b85Cristy	then
494015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  win32_nmres=import
494115f2201421a23fbf95840adf524cfdb4db384b85Cristy	else
494215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  win32_nmres=
494315f2201421a23fbf95840adf524cfdb4db384b85Cristy	fi
494415f2201421a23fbf95840adf524cfdb4db384b85Cristy	;;
494515f2201421a23fbf95840adf524cfdb4db384b85Cristy      *)
494615f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_to_tool_file "$1" func_convert_file_msys_to_w32
494715f2201421a23fbf95840adf524cfdb4db384b85Cristy	win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
494815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  $SED -n -e '
49493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    1,100{
49503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		/ I /{
495115f2201421a23fbf95840adf524cfdb4db384b85Cristy		    s|.*|import|
49523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    p
49533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    q
49543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		}
49553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }'`
495615f2201421a23fbf95840adf524cfdb4db384b85Cristy	;;
495715f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
49583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $win32_nmres in
49593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      import*)  win32_libid_type="x86 archive import";;
49603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)        win32_libid_type="x86 archive static";;
49613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
49623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
49633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ;;
49643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *DLL*)
49653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    win32_libid_type="x86 DLL"
49663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ;;
49673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  *executable*) # but shell scripts are "executable" too...
49683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $win32_fileres in
49693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *MS\ Windows\ PE\ Intel*)
49703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      win32_libid_type="x86 DLL"
49713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
49723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
49733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ;;
49743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  esac
49753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  $ECHO "$win32_libid_type"
49763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
49773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
4978da16f16767eb31921af855f17bda465fffc4e000cristy# func_cygming_dll_for_implib ARG
4979da16f16767eb31921af855f17bda465fffc4e000cristy#
4980da16f16767eb31921af855f17bda465fffc4e000cristy# Platform-specific function to extract the
4981da16f16767eb31921af855f17bda465fffc4e000cristy# name of the DLL associated with the specified
4982da16f16767eb31921af855f17bda465fffc4e000cristy# import library ARG.
4983da16f16767eb31921af855f17bda465fffc4e000cristy# Invoked by eval'ing the libtool variable
4984da16f16767eb31921af855f17bda465fffc4e000cristy#    $sharedlib_from_linklib_cmd
4985da16f16767eb31921af855f17bda465fffc4e000cristy# Result is available in the variable
4986da16f16767eb31921af855f17bda465fffc4e000cristy#    $sharedlib_from_linklib_result
4987da16f16767eb31921af855f17bda465fffc4e000cristyfunc_cygming_dll_for_implib ()
4988da16f16767eb31921af855f17bda465fffc4e000cristy{
498915f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
499015f2201421a23fbf95840adf524cfdb4db384b85Cristy
4991da16f16767eb31921af855f17bda465fffc4e000cristy  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4992da16f16767eb31921af855f17bda465fffc4e000cristy}
4993da16f16767eb31921af855f17bda465fffc4e000cristy
4994da16f16767eb31921af855f17bda465fffc4e000cristy# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4995da16f16767eb31921af855f17bda465fffc4e000cristy#
4996da16f16767eb31921af855f17bda465fffc4e000cristy# The is the core of a fallback implementation of a
4997da16f16767eb31921af855f17bda465fffc4e000cristy# platform-specific function to extract the name of the
4998da16f16767eb31921af855f17bda465fffc4e000cristy# DLL associated with the specified import library LIBNAME.
4999da16f16767eb31921af855f17bda465fffc4e000cristy#
5000da16f16767eb31921af855f17bda465fffc4e000cristy# SECTION_NAME is either .idata$6 or .idata$7, depending
5001da16f16767eb31921af855f17bda465fffc4e000cristy# on the platform and compiler that created the implib.
5002da16f16767eb31921af855f17bda465fffc4e000cristy#
5003da16f16767eb31921af855f17bda465fffc4e000cristy# Echos the name of the DLL associated with the
5004da16f16767eb31921af855f17bda465fffc4e000cristy# specified import library.
5005da16f16767eb31921af855f17bda465fffc4e000cristyfunc_cygming_dll_for_implib_fallback_core ()
5006da16f16767eb31921af855f17bda465fffc4e000cristy{
500715f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
500815f2201421a23fbf95840adf524cfdb4db384b85Cristy
5009da16f16767eb31921af855f17bda465fffc4e000cristy  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5010da16f16767eb31921af855f17bda465fffc4e000cristy  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5011da16f16767eb31921af855f17bda465fffc4e000cristy    $SED '/^Contents of section '"$match_literal"':/{
5012da16f16767eb31921af855f17bda465fffc4e000cristy      # Place marker at beginning of archive member dllname section
5013da16f16767eb31921af855f17bda465fffc4e000cristy      s/.*/====MARK====/
5014da16f16767eb31921af855f17bda465fffc4e000cristy      p
5015da16f16767eb31921af855f17bda465fffc4e000cristy      d
5016da16f16767eb31921af855f17bda465fffc4e000cristy    }
5017da16f16767eb31921af855f17bda465fffc4e000cristy    # These lines can sometimes be longer than 43 characters, but
5018da16f16767eb31921af855f17bda465fffc4e000cristy    # are always uninteresting
5019da16f16767eb31921af855f17bda465fffc4e000cristy    /:[	 ]*file format pe[i]\{,1\}-/d
5020da16f16767eb31921af855f17bda465fffc4e000cristy    /^In archive [^:]*:/d
5021da16f16767eb31921af855f17bda465fffc4e000cristy    # Ensure marker is printed
5022da16f16767eb31921af855f17bda465fffc4e000cristy    /^====MARK====/p
5023da16f16767eb31921af855f17bda465fffc4e000cristy    # Remove all lines with less than 43 characters
5024da16f16767eb31921af855f17bda465fffc4e000cristy    /^.\{43\}/!d
5025da16f16767eb31921af855f17bda465fffc4e000cristy    # From remaining lines, remove first 43 characters
5026da16f16767eb31921af855f17bda465fffc4e000cristy    s/^.\{43\}//' |
5027da16f16767eb31921af855f17bda465fffc4e000cristy    $SED -n '
5028da16f16767eb31921af855f17bda465fffc4e000cristy      # Join marker and all lines until next marker into a single line
5029da16f16767eb31921af855f17bda465fffc4e000cristy      /^====MARK====/ b para
5030da16f16767eb31921af855f17bda465fffc4e000cristy      H
5031da16f16767eb31921af855f17bda465fffc4e000cristy      $ b para
5032da16f16767eb31921af855f17bda465fffc4e000cristy      b
5033da16f16767eb31921af855f17bda465fffc4e000cristy      :para
5034da16f16767eb31921af855f17bda465fffc4e000cristy      x
5035da16f16767eb31921af855f17bda465fffc4e000cristy      s/\n//g
5036da16f16767eb31921af855f17bda465fffc4e000cristy      # Remove the marker
5037da16f16767eb31921af855f17bda465fffc4e000cristy      s/^====MARK====//
5038da16f16767eb31921af855f17bda465fffc4e000cristy      # Remove trailing dots and whitespace
5039da16f16767eb31921af855f17bda465fffc4e000cristy      s/[\. \t]*$//
5040da16f16767eb31921af855f17bda465fffc4e000cristy      # Print
5041da16f16767eb31921af855f17bda465fffc4e000cristy      /./p' |
5042da16f16767eb31921af855f17bda465fffc4e000cristy    # we now have a list, one entry per line, of the stringified
5043da16f16767eb31921af855f17bda465fffc4e000cristy    # contents of the appropriate section of all members of the
504415f2201421a23fbf95840adf524cfdb4db384b85Cristy    # archive that possess that section. Heuristic: eliminate
504515f2201421a23fbf95840adf524cfdb4db384b85Cristy    # all those that have a first or second character that is
5046da16f16767eb31921af855f17bda465fffc4e000cristy    # a '.' (that is, objdump's representation of an unprintable
5047da16f16767eb31921af855f17bda465fffc4e000cristy    # character.) This should work for all archives with less than
5048da16f16767eb31921af855f17bda465fffc4e000cristy    # 0x302f exports -- but will fail for DLLs whose name actually
5049da16f16767eb31921af855f17bda465fffc4e000cristy    # begins with a literal '.' or a single character followed by
5050da16f16767eb31921af855f17bda465fffc4e000cristy    # a '.'.
5051da16f16767eb31921af855f17bda465fffc4e000cristy    #
5052da16f16767eb31921af855f17bda465fffc4e000cristy    # Of those that remain, print the first one.
5053da16f16767eb31921af855f17bda465fffc4e000cristy    $SED -e '/^\./d;/^.\./d;q'
5054da16f16767eb31921af855f17bda465fffc4e000cristy}
5055da16f16767eb31921af855f17bda465fffc4e000cristy
5056da16f16767eb31921af855f17bda465fffc4e000cristy# func_cygming_dll_for_implib_fallback ARG
5057da16f16767eb31921af855f17bda465fffc4e000cristy# Platform-specific function to extract the
5058da16f16767eb31921af855f17bda465fffc4e000cristy# name of the DLL associated with the specified
5059da16f16767eb31921af855f17bda465fffc4e000cristy# import library ARG.
5060da16f16767eb31921af855f17bda465fffc4e000cristy#
5061da16f16767eb31921af855f17bda465fffc4e000cristy# This fallback implementation is for use when $DLLTOOL
5062da16f16767eb31921af855f17bda465fffc4e000cristy# does not support the --identify-strict option.
5063da16f16767eb31921af855f17bda465fffc4e000cristy# Invoked by eval'ing the libtool variable
5064da16f16767eb31921af855f17bda465fffc4e000cristy#    $sharedlib_from_linklib_cmd
5065da16f16767eb31921af855f17bda465fffc4e000cristy# Result is available in the variable
5066da16f16767eb31921af855f17bda465fffc4e000cristy#    $sharedlib_from_linklib_result
5067da16f16767eb31921af855f17bda465fffc4e000cristyfunc_cygming_dll_for_implib_fallback ()
5068da16f16767eb31921af855f17bda465fffc4e000cristy{
506915f2201421a23fbf95840adf524cfdb4db384b85Cristy  $debug_cmd
507015f2201421a23fbf95840adf524cfdb4db384b85Cristy
507115f2201421a23fbf95840adf524cfdb4db384b85Cristy  if func_cygming_gnu_implib_p "$1"; then
5072da16f16767eb31921af855f17bda465fffc4e000cristy    # binutils import library
5073da16f16767eb31921af855f17bda465fffc4e000cristy    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
507415f2201421a23fbf95840adf524cfdb4db384b85Cristy  elif func_cygming_ms_implib_p "$1"; then
5075da16f16767eb31921af855f17bda465fffc4e000cristy    # ms-generated import library
5076da16f16767eb31921af855f17bda465fffc4e000cristy    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5077da16f16767eb31921af855f17bda465fffc4e000cristy  else
5078da16f16767eb31921af855f17bda465fffc4e000cristy    # unknown
507915f2201421a23fbf95840adf524cfdb4db384b85Cristy    sharedlib_from_linklib_result=
5080da16f16767eb31921af855f17bda465fffc4e000cristy  fi
5081da16f16767eb31921af855f17bda465fffc4e000cristy}
50823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
50833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
50843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_extract_an_archive dir oldlib
50853ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_extract_an_archive ()
50863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
508715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
508815f2201421a23fbf95840adf524cfdb4db384b85Cristy
508915f2201421a23fbf95840adf524cfdb4db384b85Cristy    f_ex_an_ar_dir=$1; shift
509015f2201421a23fbf95840adf524cfdb4db384b85Cristy    f_ex_an_ar_oldlib=$1
509115f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$lock_old_archive_extraction"; then
509298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      lockfile=$f_ex_an_ar_oldlib.lock
509398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
509498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	func_echo "Waiting for $lockfile to be removed"
509598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	sleep 2
509698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      done
509798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    fi
509898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
509998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		   'stat=$?; rm -f "$lockfile"; exit $stat'
510015f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$lock_old_archive_extraction"; then
510198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      $opt_dry_run || rm -f "$lockfile"
510298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    fi
51033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
51043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy     :
51053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
51063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
51073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
51083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
51093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
51103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
51113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_extract_archives gentop oldlib ...
51123ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_extract_archives ()
51133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
511415f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
511515f2201421a23fbf95840adf524cfdb4db384b85Cristy
511615f2201421a23fbf95840adf524cfdb4db384b85Cristy    my_gentop=$1; shift
51173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    my_oldlibs=${1+"$@"}
511815f2201421a23fbf95840adf524cfdb4db384b85Cristy    my_oldobjs=
511915f2201421a23fbf95840adf524cfdb4db384b85Cristy    my_xlib=
512015f2201421a23fbf95840adf524cfdb4db384b85Cristy    my_xabs=
512115f2201421a23fbf95840adf524cfdb4db384b85Cristy    my_xdir=
51223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
51233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for my_xlib in $my_oldlibs; do
51243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Extract the objects.
51253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $my_xlib in
512615f2201421a23fbf95840adf524cfdb4db384b85Cristy	[\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
51273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*) my_xabs=`pwd`"/$my_xlib" ;;
51283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
51293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_basename "$my_xlib"
513015f2201421a23fbf95840adf524cfdb4db384b85Cristy      my_xlib=$func_basename_result
51313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      my_xlib_u=$my_xlib
51323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      while :; do
51333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        case " $extracted_archives " in
51343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*" $my_xlib_u "*)
51353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_arith $extracted_serial + 1
51363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  extracted_serial=$func_arith_result
51373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
51383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*) break ;;
51393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
51403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
51413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      extracted_archives="$extracted_archives $my_xlib_u"
514215f2201421a23fbf95840adf524cfdb4db384b85Cristy      my_xdir=$my_gentop/$my_xlib_u
51433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
51443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_mkdir_p "$my_xdir"
51453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
51463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $host in
51473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *-darwin*)
51483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_verbose "Extracting $my_xabs"
51493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Do not bother doing anything if just a dry run
51503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$opt_dry_run || {
51513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  darwin_orig_dir=`pwd`
51523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  cd $my_xdir || exit $?
51533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  darwin_archive=$my_xabs
51543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  darwin_curdir=`pwd`
515515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_basename "$darwin_archive"
515615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  darwin_base_archive=$func_basename_result
51573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
51583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$darwin_arches"; then
51593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
51603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    darwin_arch=
51613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
516215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    for darwin_arch in  $darwin_arches; do
516315f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
516415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
516515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      cd "unfat-$$/$darwin_base_archive-$darwin_arch"
516615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_extract_an_archive "`pwd`" "$darwin_base_archive"
51673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cd "$darwin_curdir"
516815f2201421a23fbf95840adf524cfdb4db384b85Cristy	      $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
51693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done # $darwin_arches
51703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
517115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
51723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    darwin_file=
51733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    darwin_files=
51743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for darwin_file in $darwin_filelist; do
517598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
51763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $LIPO -create -output "$darwin_file" $darwin_files
51773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done # $darwin_filelist
51783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $RM -rf unfat-$$
51793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cd "$darwin_orig_dir"
51803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
51813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cd $darwin_orig_dir
51823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_extract_an_archive "$my_xdir" "$my_xabs"
51833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi # $darwin_arches
51843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	} # !$opt_dry_run
51853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
51863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
51873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        func_extract_an_archive "$my_xdir" "$my_xabs"
51883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
51893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
519098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
51913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
51923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
519315f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_extract_archives_result=$my_oldobjs
51943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
51953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
51963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
519798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# func_emit_wrapper [arg=no]
519898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#
519998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# Emit a libtool wrapper script on stdout.
520098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# Don't directly open a file because we may want to
520198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# incorporate the script contents within a cygwin/mingw
520298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# wrapper executable.  Must ONLY be called from within
520398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# func_mode_link because it depends on a number of variables
520498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# set therein.
5205292e435cdfacd6d32fbf30ff904f686a0a4e2b06cristy#
520698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
520798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# variable will take.  If 'yes', then the emitted script
520815f2201421a23fbf95840adf524cfdb4db384b85Cristy# will assume that the directory where it is stored is
520998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# the $objdir directory.  This is a cygwin/mingw-specific
521098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# behavior.
521198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyfunc_emit_wrapper ()
52123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
521398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	func_emit_wrapper_arg1=${1-no}
52143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
52153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$ECHO "\
52163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#! $SHELL
52173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
52183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# $output - temporary wrapper script for $objdir/$outputname
521915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
52203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#
52213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# The $output program cannot be directly executed until all the libtool
52223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# libraries that it depends on are installed.
52233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#
52243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# This wrapper script should never be moved out of the build directory.
52253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# If it is, it will not operate correctly.
52263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
52273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Sed substitution that helps us do robust quoting.  It backslashifies
52283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# metacharacters that are still active within double-quoted strings.
52293ed852eea50f9d4cd633efb8c2b054b8e33c253cristysed_quote_subst='$sed_quote_subst'
52303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
52313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Be Bourne compatible
52323ed852eea50f9d4cd633efb8c2b054b8e33c253cristyif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
52333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  emulate sh
52343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  NULLCMD=:
52353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
52363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # is contrary to our usage.  Disable this feature.
52373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  alias -g '\${1+\"\$@\"}'='\"\$@\"'
52383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  setopt NO_GLOB_SUBST
52393ed852eea50f9d4cd633efb8c2b054b8e33c253cristyelse
52403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
52413ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfi
52423ed852eea50f9d4cd633efb8c2b054b8e33c253cristyBIN_SH=xpg4; export BIN_SH # for Tru64
52433ed852eea50f9d4cd633efb8c2b054b8e33c253cristyDUALCASE=1; export DUALCASE # for MKS sh
52443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
52453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# The HP-UX ksh and POSIX shell print the target directory to stdout
52463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# if CDPATH is set.
52473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
52483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
52493ed852eea50f9d4cd633efb8c2b054b8e33c253cristyrelink_command=\"$relink_command\"
52503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
52513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# This environment variable determines our operation mode.
52523ed852eea50f9d4cd633efb8c2b054b8e33c253cristyif test \"\$libtool_install_magic\" = \"$magic\"; then
52533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # install mode needs the following variables:
52543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  generated_by_libtool_version='$macro_version'
52553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  notinst_deplibs='$notinst_deplibs'
52563ed852eea50f9d4cd633efb8c2b054b8e33c253cristyelse
52573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # When we are sourced in execute mode, \$file and \$ECHO are already set.
52583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if test \"\$libtool_execute_magic\" != \"$magic\"; then
525998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    file=\"\$0\""
526098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
526198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
526298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    $ECHO "\
526398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
526498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# A function that is used when there is no print builtin or printf.
526598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyfunc_fallback_echo ()
526698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
526798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  eval 'cat <<_LTECHO_EOF
526898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy\$1
526998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy_LTECHO_EOF'
527098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
527198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    ECHO=\"$qECHO\"
527298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  fi
527398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
527498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# Very basic option parsing. These options are (a) specific to
527598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# the libtool wrapper, (b) are identical between the wrapper
527615f2201421a23fbf95840adf524cfdb4db384b85Cristy# /script/ and the wrapper /executable/ that is used only on
527798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# windows platforms, and (c) all begin with the string "--lt-"
527815f2201421a23fbf95840adf524cfdb4db384b85Cristy# (application programs are unlikely to have options that match
527998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# this pattern).
528098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#
528198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# There are only two supported options: --lt-debug and
528298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# --lt-dump-script. There is, deliberately, no --lt-help.
528398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#
528498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# The first argument to this parsing function should be the
528598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# script's $0 value, followed by "$@".
528698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristylt_option_debug=
528798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyfunc_parse_lt_options ()
528898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
528998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_script_arg0=\$0
529098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  shift
529198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  for lt_opt
529298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  do
529398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    case \"\$lt_opt\" in
529498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    --lt-debug) lt_option_debug=1 ;;
529598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    --lt-dump-script)
529698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
529798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
529898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
529998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        cat \"\$lt_dump_D/\$lt_dump_F\"
530098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        exit 0
530198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      ;;
530298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    --lt-*)
530398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
530498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        exit 1
530598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      ;;
530698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    esac
530798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  done
530898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
530998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  # Print the debug banner immediately:
531098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  if test -n \"\$lt_option_debug\"; then
531115f2201421a23fbf95840adf524cfdb4db384b85Cristy    echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
531298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  fi
531398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
531498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
531598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# Used when --lt-debug. Prints its arguments to stdout
531698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# (redirection is the responsibility of the caller)
531798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyfunc_lt_dump_args ()
531898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
531998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_dump_args_N=1;
532098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  for lt_arg
532198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  do
532215f2201421a23fbf95840adf524cfdb4db384b85Cristy    \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
532398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
532498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  done
532598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
532698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
532798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# Core function for launching the target application
532898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyfunc_exec_program_core ()
532998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
5330fd9dcd4a312944c590a433c5d519146364fa6932cristy"
533198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  case $host in
533298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  # Backslashes separate directories on plain windows
533398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  *-*-mingw | *-*-os2* | *-cegcc*)
533498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    $ECHO "\
533598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      if test -n \"\$lt_option_debug\"; then
533615f2201421a23fbf95840adf524cfdb4db384b85Cristy        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
533798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        func_lt_dump_args \${1+\"\$@\"} 1>&2
533898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      fi
533998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
534098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy"
534198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    ;;
534298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
534398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  *)
534498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    $ECHO "\
534598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      if test -n \"\$lt_option_debug\"; then
534615f2201421a23fbf95840adf524cfdb4db384b85Cristy        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
534798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        func_lt_dump_args \${1+\"\$@\"} 1>&2
534898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      fi
534998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      exec \"\$progdir/\$program\" \${1+\"\$@\"}
535098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy"
535198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    ;;
535298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  esac
535398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  $ECHO "\
535498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
535598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      exit 1
535698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
535798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
535898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# A function to encapsulate launching the target application
535998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# Strips options in the --lt-* namespace from \$@ and
536098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# launches target application with the remaining arguments.
536198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyfunc_exec_program ()
536298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
53632542fc61a973e588b23b3ddac880f01ae6c4c64dcristy  case \" \$* \" in
53642542fc61a973e588b23b3ddac880f01ae6c4c64dcristy  *\\ --lt-*)
53652542fc61a973e588b23b3ddac880f01ae6c4c64dcristy    for lt_wr_arg
53662542fc61a973e588b23b3ddac880f01ae6c4c64dcristy    do
53672542fc61a973e588b23b3ddac880f01ae6c4c64dcristy      case \$lt_wr_arg in
53682542fc61a973e588b23b3ddac880f01ae6c4c64dcristy      --lt-*) ;;
53692542fc61a973e588b23b3ddac880f01ae6c4c64dcristy      *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
53702542fc61a973e588b23b3ddac880f01ae6c4c64dcristy      esac
53712542fc61a973e588b23b3ddac880f01ae6c4c64dcristy      shift
53722542fc61a973e588b23b3ddac880f01ae6c4c64dcristy    done ;;
53732542fc61a973e588b23b3ddac880f01ae6c4c64dcristy  esac
537498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  func_exec_program_core \${1+\"\$@\"}
537598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
537698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
537798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  # Parse options
537898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
53793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
53803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # Find the directory that this script lives in.
538198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
53823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
53833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
53843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # Follow symbolic links until we get to the real thisdir.
538598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
53863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  while test -n \"\$file\"; do
538798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
53883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
53893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # If there was a directory component, then change thisdir.
53903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test \"x\$destdir\" != \"x\$file\"; then
53913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case \"\$destdir\" in
53923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
53933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *) thisdir=\"\$thisdir/\$destdir\" ;;
53943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
53953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
53963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
539798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
539898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
53993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  done
54003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # Usually 'no', except on cygwin/mingw when embedded into
54023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # the cwrapper.
540398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
54043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
54053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # special case for '.'
54063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test \"\$thisdir\" = \".\"; then
54073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      thisdir=\`pwd\`
54083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
54093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # remove .libs from thisdir
54103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case \"\$thisdir\" in
541198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
54123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    $objdir )   thisdir=. ;;
54133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
54143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  fi
54153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  # Try to get the absolute directory name.
54173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  absdir=\`cd \"\$thisdir\" && pwd\`
54183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  test -n \"\$absdir\" && thisdir=\"\$absdir\"
54193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"
54203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
542115f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$fast_install"; then
54223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $ECHO "\
54233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  program=lt-'$outputname'$exeext
54243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  progdir=\"\$thisdir/$objdir\"
54253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if test ! -f \"\$progdir/\$program\" ||
542715f2201421a23fbf95840adf524cfdb4db384b85Cristy     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
54283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
54293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    file=\"\$\$-\$program\"
54313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test ! -d \"\$progdir\"; then
54333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $MKDIR \"\$progdir\"
54343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
54353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $RM \"\$progdir/\$file\"
54363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi"
54373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $ECHO "\
54393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # relink executable if necessary
54413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test -n \"\$relink_command\"; then
54423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
54433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
544415f2201421a23fbf95840adf524cfdb4db384b85Cristy	\$ECHO \"\$relink_command_output\" >&2
54453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$RM \"\$progdir/\$file\"
54463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit 1
54473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
54483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
54493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
54513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    { $RM \"\$progdir/\$program\";
54523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
54533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    $RM \"\$progdir/\$file\"
54543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  fi"
54553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
54563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $ECHO "\
54573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  program='$outputname'
54583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  progdir=\"\$thisdir/$objdir\"
54593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"
54603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
54613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$ECHO "\
54633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if test -f \"\$progdir/\$program\"; then"
54653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
5466da16f16767eb31921af855f17bda465fffc4e000cristy	# fixup the dll searchpath if we need to.
5467da16f16767eb31921af855f17bda465fffc4e000cristy	#
5468da16f16767eb31921af855f17bda465fffc4e000cristy	# Fix the DLL searchpath if we need to.  Do this before prepending
5469da16f16767eb31921af855f17bda465fffc4e000cristy	# to shlibpath, because on Windows, both are PATH and uninstalled
5470da16f16767eb31921af855f17bda465fffc4e000cristy	# libraries must come first.
5471da16f16767eb31921af855f17bda465fffc4e000cristy	if test -n "$dllsearchpath"; then
5472da16f16767eb31921af855f17bda465fffc4e000cristy	  $ECHO "\
5473da16f16767eb31921af855f17bda465fffc4e000cristy    # Add the dll search path components to the executable PATH
5474da16f16767eb31921af855f17bda465fffc4e000cristy    PATH=$dllsearchpath:\$PATH
5475da16f16767eb31921af855f17bda465fffc4e000cristy"
5476da16f16767eb31921af855f17bda465fffc4e000cristy	fi
5477da16f16767eb31921af855f17bda465fffc4e000cristy
54783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Export our shlibpath_var if we have one.
547915f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
54803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $ECHO "\
54813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Add our own library path to $shlibpath_var
54823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
54833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Some systems cannot cope with colon-terminated $shlibpath_var
54853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # The second colon is a workaround for a bug in BeOS R4 sed
548698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
54873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    export $shlibpath_var
54893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"
54903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
54913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
54923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$ECHO "\
54933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test \"\$libtool_execute_magic\" != \"$magic\"; then
54943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Run the actual program with our arguments.
549598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      func_exec_program \${1+\"\$@\"}
54963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
54973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  else
54983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # The program doesn't exist.
549915f2201421a23fbf95840adf524cfdb4db384b85Cristy    \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
55003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
550198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
55023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit 1
55033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  fi
55043ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfi\
55053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy"
55063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
55073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
55083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
55093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_emit_cwrapperexe_src
55103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# emit the source code for a wrapper executable on stdout
55113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Must ONLY be called from within func_mode_link because
55123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# it depends on a number of variable set therein.
55133ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_emit_cwrapperexe_src ()
55143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
55153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	cat <<EOF
55163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
55173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
551815f2201421a23fbf95840adf524cfdb4db384b85Cristy   Generated by $PROGRAM (GNU $PACKAGE) $VERSION
55193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
55203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   The $output program cannot be directly executed until all the libtool
55213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   libraries that it depends on are installed.
55223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
55233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   This wrapper executable should never be moved out of the build directory.
55243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   If it is, it will not operate correctly.
55253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
55263ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
55273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cat <<"EOF"
552898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#ifdef _MSC_VER
552998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define _CRT_SECURE_NO_DEPRECATE 1
553098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#endif
55313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <stdio.h>
55323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <stdlib.h>
55333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifdef _MSC_VER
55343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# include <direct.h>
55353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# include <process.h>
55363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# include <io.h>
55373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else
55383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# include <unistd.h>
55393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# include <stdint.h>
55403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# ifdef __CYGWIN__
55413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#  include <io.h>
55423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# endif
55433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
55443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <malloc.h>
55453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <stdarg.h>
55463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <assert.h>
55473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <string.h>
55483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <ctype.h>
55493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <errno.h>
55503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <fcntl.h>
55513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#include <sys/stat.h>
55523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
555315f2201421a23fbf95840adf524cfdb4db384b85Cristy#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
555415f2201421a23fbf95840adf524cfdb4db384b85Cristy
555598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy/* declarations of non-ANSI functions */
555615f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined __MINGW32__
555798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# ifdef __STRICT_ANSI__
555898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyint _putenv (const char *);
555998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# endif
556015f2201421a23fbf95840adf524cfdb4db384b85Cristy#elif defined __CYGWIN__
556198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# ifdef __STRICT_ANSI__
556298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristychar *realpath (const char *, char *);
556398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyint putenv (char *);
556498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyint setenv (const char *, const char *, int);
556598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# endif
556615f2201421a23fbf95840adf524cfdb4db384b85Cristy/* #elif defined other_platform || defined ... */
556798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#endif
556898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
556998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy/* portability defines, excluding path handling macros */
557015f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined _MSC_VER
557198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define setmode _setmode
557298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define stat    _stat
557398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define chmod   _chmod
557498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define getcwd  _getcwd
557598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define putenv  _putenv
557698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define S_IXUSR _S_IEXEC
557715f2201421a23fbf95840adf524cfdb4db384b85Cristy#elif defined __MINGW32__
557898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define setmode _setmode
557998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define stat    _stat
558098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define chmod   _chmod
558198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define getcwd  _getcwd
558298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define putenv  _putenv
558315f2201421a23fbf95840adf524cfdb4db384b85Cristy#elif defined __CYGWIN__
558498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define HAVE_SETENV
558598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# define FOPEN_WB "wb"
558615f2201421a23fbf95840adf524cfdb4db384b85Cristy/* #elif defined other platforms ... */
558798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#endif
558898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
558915f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined PATH_MAX
55903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define LT_PATHMAX PATH_MAX
559115f2201421a23fbf95840adf524cfdb4db384b85Cristy#elif defined MAXPATHLEN
55923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define LT_PATHMAX MAXPATHLEN
55933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else
55943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define LT_PATHMAX 1024
55953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
55963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
55973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifndef S_IXOTH
55983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define S_IXOTH 0
55993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
56003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifndef S_IXGRP
56013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define S_IXGRP 0
56023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
56033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
560498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy/* path handling portability macros */
56053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifndef DIR_SEPARATOR
56063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define DIR_SEPARATOR '/'
56073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define PATH_SEPARATOR ':'
56083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
56093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
561015f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
561115f2201421a23fbf95840adf524cfdb4db384b85Cristy  defined __OS2__
56123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define HAVE_DOS_BASED_FILE_SYSTEM
56133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define FOPEN_WB "wb"
56143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# ifndef DIR_SEPARATOR_2
56153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#  define DIR_SEPARATOR_2 '\\'
56163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# endif
56173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# ifndef PATH_SEPARATOR_2
56183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#  define PATH_SEPARATOR_2 ';'
56193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# endif
56203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
56213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
56223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifndef DIR_SEPARATOR_2
56233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
56243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else /* DIR_SEPARATOR_2 */
56253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define IS_DIR_SEPARATOR(ch) \
56263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
56273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif /* DIR_SEPARATOR_2 */
56283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
56293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifndef PATH_SEPARATOR_2
56303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
56313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else /* PATH_SEPARATOR_2 */
56323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
56333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif /* PATH_SEPARATOR_2 */
56343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
56353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifndef FOPEN_WB
56363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define FOPEN_WB "w"
56373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
56383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifndef _O_BINARY
56393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# define _O_BINARY 0
56403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
56413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
56423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
56433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define XFREE(stale) do { \
564415f2201421a23fbf95840adf524cfdb4db384b85Cristy  if (stale) { free (stale); stale = 0; } \
56453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy} while (0)
56463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
564715f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined LT_DEBUGWRAPPER
564898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristystatic int lt_debug = 1;
56493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else
565098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristystatic int lt_debug = 0;
56513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
56523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
565398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
56543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
56553ed852eea50f9d4cd633efb8c2b054b8e33c253cristyvoid *xmalloc (size_t num);
56563ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *xstrdup (const char *string);
56573ed852eea50f9d4cd633efb8c2b054b8e33c253cristyconst char *base_name (const char *name);
56583ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *find_executable (const char *wrapper);
56593ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *chase_symlinks (const char *pathspec);
56603ed852eea50f9d4cd633efb8c2b054b8e33c253cristyint make_executable (const char *path);
56613ed852eea50f9d4cd633efb8c2b054b8e33c253cristyint check_executable (const char *path);
56623ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *strendzap (char *str, const char *pat);
566398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyvoid lt_debugprintf (const char *file, int line, const char *fmt, ...);
566498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyvoid lt_fatal (const char *file, int line, const char *message, ...);
566598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristystatic const char *nonnull (const char *s);
566698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristystatic const char *nonempty (const char *s);
56673ed852eea50f9d4cd633efb8c2b054b8e33c253cristyvoid lt_setenv (const char *name, const char *value);
56683ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *lt_extend_str (const char *orig_value, const char *add, int to_end);
56693ed852eea50f9d4cd633efb8c2b054b8e33c253cristyvoid lt_update_exe_path (const char *name, const char *value);
56703ed852eea50f9d4cd633efb8c2b054b8e33c253cristyvoid lt_update_lib_path (const char *name, const char *value);
567198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristychar **prepare_spawn (char **argv);
567298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyvoid lt_dump_script (FILE *f);
56733ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
56743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
56753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cat <<EOF
567615f2201421a23fbf95840adf524cfdb4db384b85Cristy#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
567715f2201421a23fbf95840adf524cfdb4db384b85Cristy# define externally_visible volatile
567815f2201421a23fbf95840adf524cfdb4db384b85Cristy#else
567915f2201421a23fbf95840adf524cfdb4db384b85Cristy# define externally_visible __attribute__((externally_visible)) volatile
568015f2201421a23fbf95840adf524cfdb4db384b85Cristy#endif
568115f2201421a23fbf95840adf524cfdb4db384b85Cristyexternally_visible const char * MAGIC_EXE = "$magic_exe";
56823ed852eea50f9d4cd633efb8c2b054b8e33c253cristyconst char * LIB_PATH_VARNAME = "$shlibpath_var";
56833ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
56843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
568515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5686da16f16767eb31921af855f17bda465fffc4e000cristy              func_to_host_path "$temp_rpath"
56873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cat <<EOF
5688da16f16767eb31921af855f17bda465fffc4e000cristyconst char * LIB_PATH_VALUE   = "$func_to_host_path_result";
56893ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
56903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
56913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cat <<"EOF"
56923ed852eea50f9d4cd633efb8c2b054b8e33c253cristyconst char * LIB_PATH_VALUE   = "";
56933ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
56943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
56953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
56963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$dllsearchpath"; then
5697da16f16767eb31921af855f17bda465fffc4e000cristy              func_to_host_path "$dllsearchpath:"
56983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cat <<EOF
56993ed852eea50f9d4cd633efb8c2b054b8e33c253cristyconst char * EXE_PATH_VARNAME = "PATH";
5700da16f16767eb31921af855f17bda465fffc4e000cristyconst char * EXE_PATH_VALUE   = "$func_to_host_path_result";
57013ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
57023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
57033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cat <<"EOF"
57043ed852eea50f9d4cd633efb8c2b054b8e33c253cristyconst char * EXE_PATH_VARNAME = "";
57053ed852eea50f9d4cd633efb8c2b054b8e33c253cristyconst char * EXE_PATH_VALUE   = "";
57063ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
57073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
57083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
570915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes = "$fast_install"; then
57103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cat <<EOF
57113ed852eea50f9d4cd633efb8c2b054b8e33c253cristyconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
57123ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
57133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
57143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cat <<EOF
57153ed852eea50f9d4cd633efb8c2b054b8e33c253cristyconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
57163ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
57173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
57183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
57193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
57203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cat <<"EOF"
57213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
57223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#define LTWRAPPER_OPTION_PREFIX         "--lt-"
57233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
57243ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
57253ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
572698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristystatic const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
5727cd4c53124f1a4a7e37ba4bb83cfb3adca7d62627cristy
57283ed852eea50f9d4cd633efb8c2b054b8e33c253cristyint
57293ed852eea50f9d4cd633efb8c2b054b8e33c253cristymain (int argc, char *argv[])
57303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
57313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char **newargz;
57323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  int  newargc;
57333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char *tmp_pathspec;
57343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char *actual_cwrapper_path;
57353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char *actual_cwrapper_name;
57363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char *target_name;
57373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char *lt_argv_zero;
573815f2201421a23fbf95840adf524cfdb4db384b85Cristy  int rval = 127;
57393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
57403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  int i;
57413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
57423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  program_name = (char *) xstrdup (base_name (argv[0]));
574315f2201421a23fbf95840adf524cfdb4db384b85Cristy  newargz = XMALLOC (char *, (size_t) argc + 1);
57443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
574598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  /* very simple arg parsing; don't want to rely on getopt
574698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   * also, copy all non cwrapper options to newargz, except
574798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   * argz[0], which is handled differently
574898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   */
574998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  newargc=0;
57503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  for (i = 1; i < argc; i++)
57513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
575215f2201421a23fbf95840adf524cfdb4db384b85Cristy      if (STREQ (argv[i], dumpscript_opt))
57533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	{
57543ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
575515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    case $host in
57563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *mingw* | *cygwin* )
57573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# make stdout use "unix" line endings
57583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		echo "          setmode(1,_O_BINARY);"
57593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
57603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
57613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
57623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cat <<"EOF"
576398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  lt_dump_script (stdout);
57643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  return 0;
57653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	}
576615f2201421a23fbf95840adf524cfdb4db384b85Cristy      if (STREQ (argv[i], debug_opt))
576798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	{
576898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy          lt_debug = 1;
576998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy          continue;
577098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	}
577115f2201421a23fbf95840adf524cfdb4db384b85Cristy      if (STREQ (argv[i], ltwrapper_option_prefix))
577298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        {
577398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
577498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy             namespace, but it is not one of the ones we know about and
577598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy             have already dealt with, above (inluding dump-script), then
577698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy             report an error. Otherwise, targets might begin to believe
577798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
577898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy             namespace. The first time any user complains about this, we'll
577998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
578098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy             or a configure.ac-settable value.
578198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy           */
578298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy          lt_fatal (__FILE__, __LINE__,
578398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    "unrecognized %s option: '%s'",
578498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                    ltwrapper_option_prefix, argv[i]);
578598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        }
578698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      /* otherwise ... */
578798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      newargz[++newargc] = xstrdup (argv[i]);
57883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
578998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  newargz[++newargc] = NULL;
579098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
579198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyEOF
579298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    cat <<EOF
579398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  /* The GNU banner must be the first non-error debug message */
579415f2201421a23fbf95840adf524cfdb4db384b85Cristy  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
579598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyEOF
579698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    cat <<"EOF"
579798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
579898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
57993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  tmp_pathspec = find_executable (argv[0]);
58013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (tmp_pathspec == NULL)
580298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
580398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__,
580498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                  "(main) found exe (before symlink chase) at: %s\n",
580598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  tmp_pathspec);
58063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
580898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__,
580998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                  "(main) found exe (after symlink chase) at: %s\n",
581098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  actual_cwrapper_path);
58113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  XFREE (tmp_pathspec);
58123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
581398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
58143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  strendzap (actual_cwrapper_path, actual_cwrapper_name);
58153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* wrapper name transforms */
58173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  strendzap (actual_cwrapper_name, ".exe");
58183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
58193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  XFREE (actual_cwrapper_name);
58203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  actual_cwrapper_name = tmp_pathspec;
58213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  tmp_pathspec = 0;
58223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* target_name transforms -- use actual target program name; might have lt- prefix */
58243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
58253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  strendzap (target_name, ".exe");
58263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
58273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  XFREE (target_name);
58283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  target_name = tmp_pathspec;
58293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  tmp_pathspec = 0;
58303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
583198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__,
583298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  "(main) libtool target name: %s\n",
583398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  target_name);
58343ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
58353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cat <<EOF
58373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  newargz[0] =
58383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    XMALLOC (char, (strlen (actual_cwrapper_path) +
58393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
58403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  strcpy (newargz[0], actual_cwrapper_path);
58413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  strcat (newargz[0], "$objdir");
58423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  strcat (newargz[0], "/");
58433ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
58443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cat <<"EOF"
58463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* stop here, and copy so we don't have to do this twice */
58473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  tmp_pathspec = xstrdup (newargz[0]);
58483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
58503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  strcat (newargz[0], actual_cwrapper_name);
58513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* DO want the lt- prefix here if it exists, so use target_name */
58533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
58543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  XFREE (tmp_pathspec);
58553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  tmp_pathspec = NULL;
58563ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
58573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case $host_os in
58593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      mingw*)
58603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cat <<"EOF"
58613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  {
58623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    char* p;
58633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    while ((p = strchr (newargz[0], '\\')) != NULL)
58643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      {
58653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*p = '/';
58663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      }
58673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
58683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      {
58693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*p = '/';
58703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      }
58713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  }
58723ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
58733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
58743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
58753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cat <<"EOF"
58773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  XFREE (target_name);
58783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  XFREE (actual_cwrapper_path);
58793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  XFREE (actual_cwrapper_name);
58803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
58823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
5883da16f16767eb31921af855f17bda465fffc4e000cristy  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
5884da16f16767eb31921af855f17bda465fffc4e000cristy     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
5885da16f16767eb31921af855f17bda465fffc4e000cristy     because on Windows, both *_VARNAMEs are PATH but uninstalled
5886da16f16767eb31921af855f17bda465fffc4e000cristy     libraries must come first. */
58873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
5888da16f16767eb31921af855f17bda465fffc4e000cristy  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
58893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
589098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
589198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  nonnull (lt_argv_zero));
58923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  for (i = 0; i < newargc; i++)
58933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
589498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
589598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      i, nonnull (newargz[i]));
58963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
58973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
58983ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
58993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case $host_os in
59013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      mingw*)
59023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		cat <<"EOF"
59033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* execv doesn't actually work on mingw as expected on unix */
590498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  newargz = prepare_spawn (newargz);
590515f2201421a23fbf95840adf524cfdb4db384b85Cristy  rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
59063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (rval == -1)
59073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
59083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      /* failed to start process */
590998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      lt_debugprintf (__FILE__, __LINE__,
591098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      "(main) failed to launch target \"%s\": %s\n",
591198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      lt_argv_zero, nonnull (strerror (errno)));
59123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      return 127;
59133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
59143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return rval;
59153ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
59163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
59173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *)
59183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		cat <<"EOF"
59193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  execv (lt_argv_zero, newargz);
59203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return rval; /* =127, but avoids unused variable warning */
59213ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
59223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
59233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
59243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cat <<"EOF"
59263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
59273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59283ed852eea50f9d4cd633efb8c2b054b8e33c253cristyvoid *
59293ed852eea50f9d4cd633efb8c2b054b8e33c253cristyxmalloc (size_t num)
59303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
59313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  void *p = (void *) malloc (num);
59323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (!p)
593398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    lt_fatal (__FILE__, __LINE__, "memory exhausted");
59343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return p;
59363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
59373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59383ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *
59393ed852eea50f9d4cd633efb8c2b054b8e33c253cristyxstrdup (const char *string)
59403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
59413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
59423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			  string) : NULL;
59433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
59443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59453ed852eea50f9d4cd633efb8c2b054b8e33c253cristyconst char *
59463ed852eea50f9d4cd633efb8c2b054b8e33c253cristybase_name (const char *name)
59473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
59483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  const char *base;
59493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
595015f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined HAVE_DOS_BASED_FILE_SYSTEM
59513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* Skip over the disk name in MSDOS pathnames. */
59523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
59533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    name += 2;
59543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
59553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  for (base = name; *name; name++)
59573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if (IS_DIR_SEPARATOR (*name))
59583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      base = name + 1;
59593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return base;
59603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
59613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59623ed852eea50f9d4cd633efb8c2b054b8e33c253cristyint
59633ed852eea50f9d4cd633efb8c2b054b8e33c253cristycheck_executable (const char *path)
59643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
59653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  struct stat st;
59663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
596798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
596898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                  nonempty (path));
59693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if ((!path) || (!*path))
59703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return 0;
59713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if ((stat (path, &st) >= 0)
59733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
59743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return 1;
59753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  else
59763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return 0;
59773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
59783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59793ed852eea50f9d4cd633efb8c2b054b8e33c253cristyint
59803ed852eea50f9d4cd633efb8c2b054b8e33c253cristymake_executable (const char *path)
59813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
59823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  int rval = 0;
59833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  struct stat st;
59843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
598598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
598698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                  nonempty (path));
59873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if ((!path) || (!*path))
59883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return 0;
59893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (stat (path, &st) >= 0)
59913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
59923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
59933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
59943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return rval;
59953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
59963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
59973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy/* Searches for the full path of the wrapper.  Returns
59983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   newly allocated full path name if found, NULL otherwise
59993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy   Does not chase symlinks, even on platforms that support them.
60003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy*/
60013ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *
60023ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfind_executable (const char *wrapper)
60033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
60043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  int has_slash = 0;
60053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  const char *p;
60063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  const char *p_next;
60073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* static buffer for getcwd */
60083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char tmp[LT_PATHMAX + 1];
600915f2201421a23fbf95840adf524cfdb4db384b85Cristy  size_t tmp_len;
60103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char *concat_name;
60113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
601298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
601398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                  nonempty (wrapper));
60143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
60153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if ((wrapper == NULL) || (*wrapper == '\0'))
60163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return NULL;
60173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
60183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* Absolute path? */
601915f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined HAVE_DOS_BASED_FILE_SYSTEM
60203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
60213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
60223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      concat_name = xstrdup (wrapper);
60233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if (check_executable (concat_name))
60243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	return concat_name;
60253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      XFREE (concat_name);
60263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
60273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  else
60283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
60293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
60303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if (IS_DIR_SEPARATOR (wrapper[0]))
60313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	{
60323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  concat_name = xstrdup (wrapper);
60333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if (check_executable (concat_name))
60343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    return concat_name;
60353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  XFREE (concat_name);
60363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	}
603715f2201421a23fbf95840adf524cfdb4db384b85Cristy#if defined HAVE_DOS_BASED_FILE_SYSTEM
60383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
60393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
60403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
60413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  for (p = wrapper; *p; p++)
60423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if (*p == '/')
60433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      {
60443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	has_slash = 1;
60453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	break;
60463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      }
60473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (!has_slash)
60483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
60493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      /* no slashes; search PATH */
60503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      const char *path = getenv ("PATH");
60513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if (path != NULL)
60523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	{
60533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for (p = path; *p; p = p_next)
60543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    {
60553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      const char *q;
60563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      size_t p_len;
60573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      for (q = p; *q; q++)
60583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		if (IS_PATH_SEPARATOR (*q))
60593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  break;
606015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      p_len = (size_t) (q - p);
60613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      p_next = (*q == '\0' ? q : q + 1);
60623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if (p_len == 0)
60633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		{
60643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  /* empty path: current directory */
60653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  if (getcwd (tmp, LT_PATHMAX) == NULL)
606698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
606798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                              nonnull (strerror (errno)));
60683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  tmp_len = strlen (tmp);
60693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  concat_name =
60703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
60713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  memcpy (concat_name, tmp, tmp_len);
60723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  concat_name[tmp_len] = '/';
60733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  strcpy (concat_name + tmp_len + 1, wrapper);
60743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		}
60753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
60763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		{
60773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  concat_name =
60783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
60793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  memcpy (concat_name, p, p_len);
60803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  concat_name[p_len] = '/';
60813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  strcpy (concat_name + p_len + 1, wrapper);
60823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		}
60833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if (check_executable (concat_name))
60843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		return concat_name;
60853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      XFREE (concat_name);
60863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
60873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	}
60883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      /* not found in PATH; assume curdir */
60893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
60903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  /* Relative path | not found in path: prepend cwd */
60913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (getcwd (tmp, LT_PATHMAX) == NULL)
609298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
609398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy              nonnull (strerror (errno)));
60943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  tmp_len = strlen (tmp);
60953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
60963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  memcpy (concat_name, tmp, tmp_len);
60973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  concat_name[tmp_len] = '/';
60983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  strcpy (concat_name + tmp_len + 1, wrapper);
60993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
61003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (check_executable (concat_name))
61013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    return concat_name;
61023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  XFREE (concat_name);
61033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return NULL;
61043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
61053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
61063ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *
61073ed852eea50f9d4cd633efb8c2b054b8e33c253cristychase_symlinks (const char *pathspec)
61083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
61093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifndef S_ISLNK
61103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return xstrdup (pathspec);
61113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else
61123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char buf[LT_PATHMAX];
61133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  struct stat s;
61143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char *tmp_pathspec = xstrdup (pathspec);
61153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char *p;
61163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  int has_symlinks = 0;
61173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  while (strlen (tmp_pathspec) && !has_symlinks)
61183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
611998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      lt_debugprintf (__FILE__, __LINE__,
612098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      "checking path component for symlinks: %s\n",
612198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      tmp_pathspec);
61223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if (lstat (tmp_pathspec, &s) == 0)
61233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	{
61243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if (S_ISLNK (s.st_mode) != 0)
61253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    {
61263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      has_symlinks = 1;
61273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      break;
61283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
61293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
61303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  /* search backwards for last DIR_SEPARATOR */
61313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
61323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
61333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    p--;
61343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
61353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    {
61363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      /* no more DIR_SEPARATORS left */
61373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      break;
61383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
61393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *p = '\0';
61403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	}
61413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
61423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	{
614398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  lt_fatal (__FILE__, __LINE__,
614498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    "error accessing file \"%s\": %s",
614598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    tmp_pathspec, nonnull (strerror (errno)));
61463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	}
61473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
61483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  XFREE (tmp_pathspec);
61493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
61503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (!has_symlinks)
61513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
61523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      return xstrdup (pathspec);
61533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
61543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
61553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  tmp_pathspec = realpath (pathspec, buf);
61563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (tmp_pathspec == 0)
61573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
615898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      lt_fatal (__FILE__, __LINE__,
615998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		"could not follow symlinks for %s", pathspec);
61603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
61613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return xstrdup (tmp_pathspec);
61623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
61633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
61643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
61653ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *
61663ed852eea50f9d4cd633efb8c2b054b8e33c253cristystrendzap (char *str, const char *pat)
61673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
61683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  size_t len, patlen;
61693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
61703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert (str != NULL);
61713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  assert (pat != NULL);
61723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
61733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  len = strlen (str);
61743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  patlen = strlen (pat);
61753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
61763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (patlen <= len)
61773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
61783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      str += len - patlen;
617915f2201421a23fbf95840adf524cfdb4db384b85Cristy      if (STREQ (str, pat))
61803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*str = '\0';
61813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
61823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return str;
61833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
61843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
618598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyvoid
618698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristylt_debugprintf (const char *file, int line, const char *fmt, ...)
618798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
618898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  va_list args;
618998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  if (lt_debug)
619098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    {
619198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
619298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      va_start (args, fmt);
619398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      (void) vfprintf (stderr, fmt, args);
619498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      va_end (args);
619598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    }
619698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
619798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
61983ed852eea50f9d4cd633efb8c2b054b8e33c253cristystatic void
619998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristylt_error_core (int exit_status, const char *file,
620098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	       int line, const char *mode,
62013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	       const char *message, va_list ap)
62023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
620398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
62043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  vfprintf (stderr, message, ap);
62053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  fprintf (stderr, ".\n");
62063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
62073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (exit_status >= 0)
62083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit (exit_status);
62093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
62103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
62113ed852eea50f9d4cd633efb8c2b054b8e33c253cristyvoid
621298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristylt_fatal (const char *file, int line, const char *message, ...)
62133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
62143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  va_list ap;
62153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  va_start (ap, message);
621698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
62173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  va_end (ap);
62183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
62193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
622098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristystatic const char *
622198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristynonnull (const char *s)
622298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
622398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  return s ? s : "(null)";
622498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
622598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
622698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristystatic const char *
622798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristynonempty (const char *s)
622898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
622998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  return (s && !*s) ? "(empty)" : nonnull (s);
623098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
623198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
62323ed852eea50f9d4cd633efb8c2b054b8e33c253cristyvoid
62333ed852eea50f9d4cd633efb8c2b054b8e33c253cristylt_setenv (const char *name, const char *value)
62343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
623598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__,
623698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  "(lt_setenv) setting '%s' to '%s'\n",
623798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                  nonnull (name), nonnull (value));
62383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  {
62393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#ifdef HAVE_SETENV
62403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    /* always make a copy, for consistency with !HAVE_SETENV */
62413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    char *str = xstrdup (value);
62423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    setenv (name, str, 1);
62433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#else
624415f2201421a23fbf95840adf524cfdb4db384b85Cristy    size_t len = strlen (name) + 1 + strlen (value) + 1;
62453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    char *str = XMALLOC (char, len);
62463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    sprintf (str, "%s=%s", name, value);
62473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if (putenv (str) != EXIT_SUCCESS)
62483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      {
62493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        XFREE (str);
62503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      }
62513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#endif
62523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  }
62533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
62543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
62553ed852eea50f9d4cd633efb8c2b054b8e33c253cristychar *
62563ed852eea50f9d4cd633efb8c2b054b8e33c253cristylt_extend_str (const char *orig_value, const char *add, int to_end)
62573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
62583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  char *new_value;
62593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (orig_value && *orig_value)
62603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
626115f2201421a23fbf95840adf524cfdb4db384b85Cristy      size_t orig_value_len = strlen (orig_value);
626215f2201421a23fbf95840adf524cfdb4db384b85Cristy      size_t add_len = strlen (add);
62633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      new_value = XMALLOC (char, add_len + orig_value_len + 1);
62643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if (to_end)
62653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        {
62663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy          strcpy (new_value, orig_value);
62673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy          strcpy (new_value + orig_value_len, add);
62683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        }
62693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
62703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        {
62713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy          strcpy (new_value, add);
62723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy          strcpy (new_value + add_len, orig_value);
62733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        }
62743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
62753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  else
62763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
62773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      new_value = xstrdup (add);
62783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
62793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  return new_value;
62803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
62813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
62823ed852eea50f9d4cd633efb8c2b054b8e33c253cristyvoid
62833ed852eea50f9d4cd633efb8c2b054b8e33c253cristylt_update_exe_path (const char *name, const char *value)
62843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
628598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__,
628698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
628798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                  nonnull (name), nonnull (value));
62883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
62893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (name && *name && value && *value)
62903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
62913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      char *new_value = lt_extend_str (getenv (name), value, 0);
62923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      /* some systems can't cope with a ':'-terminated path #' */
629315f2201421a23fbf95840adf524cfdb4db384b85Cristy      size_t len = strlen (new_value);
629415f2201421a23fbf95840adf524cfdb4db384b85Cristy      while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
62953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        {
629615f2201421a23fbf95840adf524cfdb4db384b85Cristy          new_value[--len] = '\0';
62973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        }
62983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      lt_setenv (name, new_value);
62993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      XFREE (new_value);
63003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
63013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
63023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
63033ed852eea50f9d4cd633efb8c2b054b8e33c253cristyvoid
63043ed852eea50f9d4cd633efb8c2b054b8e33c253cristylt_update_lib_path (const char *name, const char *value)
63053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
630698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  lt_debugprintf (__FILE__, __LINE__,
630798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
630898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy                  nonnull (name), nonnull (value));
63093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
63103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  if (name && *name && value && *value)
63113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    {
63123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      char *new_value = lt_extend_str (getenv (name), value, 0);
63133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      lt_setenv (name, new_value);
63143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      XFREE (new_value);
63153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    }
63163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
63173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
631898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyEOF
631998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    case $host_os in
632098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      mingw*)
632198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		cat <<"EOF"
632298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
632398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy/* Prepares an argument vector before calling spawn().
632498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   Note that spawn() does not by itself call the command interpreter
632598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
632698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
632798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy         GetVersionEx(&v);
632898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
632998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      }) ? "cmd.exe" : "command.com").
633098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   Instead it simply concatenates the arguments, separated by ' ', and calls
633198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
633298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
633398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   special way:
633498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   - Space and tab are interpreted as delimiters. They are not treated as
633598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy     delimiters if they are surrounded by double quotes: "...".
633698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   - Unescaped double quotes are removed from the input. Their only effect is
633798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy     that within double quotes, space and tab are treated like normal
633898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy     characters.
633998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   - Backslashes not followed by double quotes are not special.
634098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy   - But 2*n+1 backslashes followed by a double quote become
634198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy     n backslashes followed by a double quote (n >= 0):
634298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy       \" -> "
634398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy       \\\" -> \"
634498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy       \\\\\" -> \\"
634598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy */
634698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#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"
634798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy#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"
634898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristychar **
634998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyprepare_spawn (char **argv)
635098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
635198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  size_t argc;
635298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  char **new_argv;
635398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  size_t i;
635498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
635598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  /* Count number of arguments.  */
635698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  for (argc = 0; argv[argc] != NULL; argc++)
635798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    ;
635898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
635998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  /* Allocate new argument vector.  */
636098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  new_argv = XMALLOC (char *, argc + 1);
636198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
636298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  /* Put quoted arguments into the new argument vector.  */
636398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  for (i = 0; i < argc; i++)
636498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    {
636598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      const char *string = argv[i];
636698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
636798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      if (string[0] == '\0')
636898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	new_argv[i] = xstrdup ("\"\"");
636998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
637098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	{
637198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
637298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  size_t length;
637398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  unsigned int backslashes;
637498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  const char *s;
637598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  char *quoted_string;
637698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  char *p;
637798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
637898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  length = 0;
637998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  backslashes = 0;
638098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  if (quote_around)
638198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    length++;
638298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  for (s = string; *s != '\0'; s++)
638398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    {
638498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      char c = *s;
638598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      if (c == '"')
638698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		length += backslashes + 1;
638798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      length++;
638898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      if (c == '\\')
638998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		backslashes++;
639098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      else
639198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		backslashes = 0;
639298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    }
639398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  if (quote_around)
639498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    length += backslashes + 1;
639598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
639698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  quoted_string = XMALLOC (char, length + 1);
639798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
639898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  p = quoted_string;
639998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  backslashes = 0;
640098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  if (quote_around)
640198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    *p++ = '"';
640298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  for (s = string; *s != '\0'; s++)
640398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    {
640498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      char c = *s;
640598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      if (c == '"')
640698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		{
640798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  unsigned int j;
640898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  for (j = backslashes + 1; j > 0; j--)
640998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    *p++ = '\\';
641098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		}
641198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      *p++ = c;
641298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      if (c == '\\')
641398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		backslashes++;
641498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      else
641598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		backslashes = 0;
641698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    }
641798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  if (quote_around)
641898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    {
641998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      unsigned int j;
642098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      for (j = backslashes; j > 0; j--)
642198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		*p++ = '\\';
642298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      *p++ = '"';
642398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    }
642498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  *p = '\0';
642598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
642698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  new_argv[i] = quoted_string;
642798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	}
642898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      else
642998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	new_argv[i] = (char *) string;
643098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    }
643198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  new_argv[argc] = NULL;
643298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
643398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy  return new_argv;
643498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
643598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyEOF
643698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		;;
643798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    esac
643898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
643998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy            cat <<"EOF"
644098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyvoid lt_dump_script (FILE* f)
644198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
644298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyEOF
644398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    func_emit_wrapper yes |
64442542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	      $SED -n -e '
64452542fc61a973e588b23b3ddac880f01ae6c4c64dcristys/^\(.\{79\}\)\(..*\)/\1\
64462542fc61a973e588b23b3ddac880f01ae6c4c64dcristy\2/
64472542fc61a973e588b23b3ddac880f01ae6c4c64dcristyh
64482542fc61a973e588b23b3ddac880f01ae6c4c64dcristys/\([\\"]\)/\\\1/g
64492542fc61a973e588b23b3ddac880f01ae6c4c64dcristys/$/\\n/
64502542fc61a973e588b23b3ddac880f01ae6c4c64dcristys/\([^\n]*\).*/  fputs ("\1", f);/p
64512542fc61a973e588b23b3ddac880f01ae6c4c64dcristyg
64522542fc61a973e588b23b3ddac880f01ae6c4c64dcristyD'
645398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy            cat <<"EOF"
645498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
64553ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
64563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
64573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# end: func_emit_cwrapperexe_src
64583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
645998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# func_win32_import_lib_p ARG
646098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy# True if ARG is an import lib, as indicated by $file_magic_cmd
646198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristyfunc_win32_import_lib_p ()
646298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy{
646315f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
646415f2201421a23fbf95840adf524cfdb4db384b85Cristy
646598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
646698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    *import*) : ;;
646798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    *) false ;;
646898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    esac
646998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy}
647098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
647115f2201421a23fbf95840adf524cfdb4db384b85Cristy# func_suncc_cstd_abi
647215f2201421a23fbf95840adf524cfdb4db384b85Cristy# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
647315f2201421a23fbf95840adf524cfdb4db384b85Cristy# Several compiler flags select an ABI that is incompatible with the
647415f2201421a23fbf95840adf524cfdb4db384b85Cristy# Cstd library. Avoid specifying it if any are in CXXFLAGS.
647515f2201421a23fbf95840adf524cfdb4db384b85Cristyfunc_suncc_cstd_abi ()
647615f2201421a23fbf95840adf524cfdb4db384b85Cristy{
647715f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
647815f2201421a23fbf95840adf524cfdb4db384b85Cristy
647915f2201421a23fbf95840adf524cfdb4db384b85Cristy    case " $compile_command " in
648015f2201421a23fbf95840adf524cfdb4db384b85Cristy    *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
648115f2201421a23fbf95840adf524cfdb4db384b85Cristy      suncc_use_cstd_abi=no
648215f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
648315f2201421a23fbf95840adf524cfdb4db384b85Cristy    *)
648415f2201421a23fbf95840adf524cfdb4db384b85Cristy      suncc_use_cstd_abi=yes
648515f2201421a23fbf95840adf524cfdb4db384b85Cristy      ;;
648615f2201421a23fbf95840adf524cfdb4db384b85Cristy    esac
648715f2201421a23fbf95840adf524cfdb4db384b85Cristy}
648815f2201421a23fbf95840adf524cfdb4db384b85Cristy
64893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_mode_link arg...
64903ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_mode_link ()
64913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
649215f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
649315f2201421a23fbf95840adf524cfdb4db384b85Cristy
64943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $host in
64953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
64963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # It is impossible to link a dll without this setting, and
64973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # we shouldn't force the makefile maintainer to figure out
649815f2201421a23fbf95840adf524cfdb4db384b85Cristy      # what system we are compiling for in order to pass an extra
64993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # flag for every libtool invocation.
65003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # allow_undefined=no
65013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
65023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # FIXME: Unfortunately, there are problems with the above when trying
650315f2201421a23fbf95840adf524cfdb4db384b85Cristy      # to make a dll that has undefined symbols, in which case not
65043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # even a static library is built.  For now, we need to specify
65053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # -no-undefined on the libtool link line when we can be certain
65063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # that all symbols are satisfied, otherwise we get a static library.
65073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      allow_undefined=yes
65083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
65093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *)
65103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      allow_undefined=yes
65113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
65123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
65133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    libtool_args=$nonopt
65143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    base_compile="$nonopt $@"
65153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    compile_command=$nonopt
65163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    finalize_command=$nonopt
65173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
65183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    compile_rpath=
65193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    finalize_rpath=
65203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    compile_shlibpath=
65213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    finalize_shlibpath=
65223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    convenience=
65233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    old_convenience=
65243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    deplibs=
65253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    old_deplibs=
65263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    compiler_flags=
65273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    linker_flags=
65283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    dllsearchpath=
65293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    lib_search_path=`pwd`
65303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    inst_prefix_dir=
65313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    new_inherited_linker_flags=
65323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
65333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    avoid_version=no
653498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy    bindir=
65353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    dlfiles=
65363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    dlprefiles=
65373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    dlself=no
65383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    export_dynamic=no
65393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    export_symbols=
65403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    export_symbols_regex=
65413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    generated=
65423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    libobjs=
65433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    ltlibs=
65443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    module=no
65453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    no_install=no
65463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    objs=
654715f2201421a23fbf95840adf524cfdb4db384b85Cristy    os2dllname=
65483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    non_pic_objects=
65493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    precious_files_regex=
65503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    prefer_static_libs=no
655115f2201421a23fbf95840adf524cfdb4db384b85Cristy    preload=false
65523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    prev=
65533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    prevarg=
65543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    release=
65553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    rpath=
65563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    xrpath=
65573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    perm_rpath=
65583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    temp_rpath=
65593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    thread_safe=no
65603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    vinfo=
65613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    vinfo_number=no
65623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    weak_libs=
656315f2201421a23fbf95840adf524cfdb4db384b85Cristy    single_module=$wl-single_module
65643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_infer_tag $base_compile
65653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
65663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # We need to know -static, to get the right output filenames.
65673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for arg
65683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    do
65693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $arg in
65703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -shared)
657115f2201421a23fbf95840adf524cfdb4db384b85Cristy	test yes != "$build_libtool_libs" \
657215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  && func_fatal_configuration "cannot build a shared library"
65733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	build_old_libs=no
65743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	break
65753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
65763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -all-static | -static | -static-libtool-libs)
65773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $arg in
65783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-all-static)
657915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
65803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_warning "complete static linking is impossible in this configuration"
65813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
65823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$link_static_flag"; then
65833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    dlopen_self=$dlopen_self_static
65843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
65853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prefer_static_libs=yes
65863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
65873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-static)
65883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
65893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    dlopen_self=$dlopen_self_static
65903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
65913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prefer_static_libs=built
65923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
65933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-static-libtool-libs)
65943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
65953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    dlopen_self=$dlopen_self_static
65963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
65973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prefer_static_libs=yes
65983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
65993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
66003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	build_libtool_libs=no
66013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	build_old_libs=yes
66023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	break
66033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
66043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
66053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
66063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
66073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # See if our shared archives depend on static archives.
66083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
66093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
66103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Go through the arguments, transforming them on the way.
66113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    while test "$#" -gt 0; do
661215f2201421a23fbf95840adf524cfdb4db384b85Cristy      arg=$1
66133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      shift
66143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_quote_for_eval "$arg"
66153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      qarg=$func_quote_for_eval_unquoted_result
66163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_append libtool_args " $func_quote_for_eval_result"
66173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
66183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # If the previous option needs an argument, assign it.
66193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$prev"; then
66203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $prev in
66213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	output)
66223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append compile_command " @OUTPUT@"
66233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append finalize_command " @OUTPUT@"
66243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
66253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
66263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
66273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $prev in
662898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	bindir)
662915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  bindir=$arg
663098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  prev=
663198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  continue
663298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  ;;
66333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	dlfiles|dlprefiles)
663415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  $preload || {
66353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Add the symbol object into the linking commands.
66363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_append compile_command " @SYMFILE@"
66373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_append finalize_command " @SYMFILE@"
663815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    preload=:
663915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  }
66403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $arg in
66413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *.la | *.lo) ;;  # We handle these cases below.
66423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  force)
664315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test no = "$dlself"; then
66443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      dlself=needless
66453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      export_dynamic=yes
66463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
66473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    prev=
66483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
66493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
66503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  self)
665115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test dlprefiles = "$prev"; then
66523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      dlself=yes
665315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
66543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      dlself=yes
66553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
66563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      dlself=needless
66573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      export_dynamic=yes
66583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
66593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    prev=
66603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
66613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
66623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
666315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test dlfiles = "$prev"; then
6664da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append dlfiles " $arg"
66653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
6666da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append dlprefiles " $arg"
66673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
66683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    prev=
66693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
66703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
66713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
66723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
66733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	expsyms)
667415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  export_symbols=$arg
66753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test -f "$arg" \
667615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    || func_fatal_error "symbol file '$arg' does not exist"
66773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
66783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
66793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
66803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	expsyms_regex)
668115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  export_symbols_regex=$arg
66823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
66833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
66843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
66853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	framework)
66863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $host in
66873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *-*-darwin*)
66883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case "$deplibs " in
66893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*" $qarg.ltframework "*) ;;
6690da16f16767eb31921af855f17bda465fffc4e000cristy		*) func_append deplibs " $qarg.ltframework" # this is fixed later
66913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		   ;;
66923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
66933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
66943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
66953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
66963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
66973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
66983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	inst_prefix)
669915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  inst_prefix_dir=$arg
670015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  prev=
670115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  continue
670215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  ;;
670315f2201421a23fbf95840adf524cfdb4db384b85Cristy	mllvm)
670415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # Clang does not use LLVM to link, so we can simply discard any
670515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # '-mllvm $arg' options when doing the link step.
67063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
67073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
67083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
67093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	objectlist)
67103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -f "$arg"; then
67113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    save_arg=$arg
67123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    moreargs=
67133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for fil in `cat "$save_arg"`
67143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    do
6715da16f16767eb31921af855f17bda465fffc4e000cristy#	      func_append moreargs " $fil"
67163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      arg=$fil
67173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # A libtool-controlled object.
67183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
67193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Check to see that this really is a libtool object.
67203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if func_lalib_unsafe_p "$arg"; then
67213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		pic_object=
67223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		non_pic_object=
67233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
67243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# Read the .lo file
67253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_source "$arg"
67263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
67273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		if test -z "$pic_object" ||
67283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		   test -z "$non_pic_object" ||
672915f2201421a23fbf95840adf524cfdb4db384b85Cristy		   test none = "$pic_object" &&
673015f2201421a23fbf95840adf524cfdb4db384b85Cristy		   test none = "$non_pic_object"; then
673115f2201421a23fbf95840adf524cfdb4db384b85Cristy		  func_fatal_error "cannot find name of object for '$arg'"
67323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
67333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
67343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# Extract subdirectory from the argument.
67353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_dirname "$arg" "/" ""
673615f2201421a23fbf95840adf524cfdb4db384b85Cristy		xdir=$func_dirname_result
67373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
673815f2201421a23fbf95840adf524cfdb4db384b85Cristy		if test none != "$pic_object"; then
67393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # Prepend the subdirectory the object is found in.
674015f2201421a23fbf95840adf524cfdb4db384b85Cristy		  pic_object=$xdir$pic_object
67413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
674215f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test dlfiles = "$prev"; then
674315f2201421a23fbf95840adf524cfdb4db384b85Cristy		    if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
6744da16f16767eb31921af855f17bda465fffc4e000cristy		      func_append dlfiles " $pic_object"
67453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      prev=
67463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      continue
67473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    else
67483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      # If libtool objects are unsupported, then we need to preload.
67493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      prev=dlprefiles
67503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    fi
67513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
67523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
67533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # CHECK ME:  I think I busted this.  -Ossama
675415f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test dlprefiles = "$prev"; then
67553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    # Preload the old-style object.
6756da16f16767eb31921af855f17bda465fffc4e000cristy		    func_append dlprefiles " $pic_object"
67573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    prev=
67583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
67593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
67603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # A PIC object.
67613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_append libobjs " $pic_object"
676215f2201421a23fbf95840adf524cfdb4db384b85Cristy		  arg=$pic_object
67633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
67643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
67653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# Non-PIC object.
676615f2201421a23fbf95840adf524cfdb4db384b85Cristy		if test none != "$non_pic_object"; then
67673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # Prepend the subdirectory the object is found in.
676815f2201421a23fbf95840adf524cfdb4db384b85Cristy		  non_pic_object=$xdir$non_pic_object
67693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
67703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # A standard non-PIC object
67713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_append non_pic_objects " $non_pic_object"
677215f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test -z "$pic_object" || test none = "$pic_object"; then
677315f2201421a23fbf95840adf524cfdb4db384b85Cristy		    arg=$non_pic_object
67743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
67753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		else
67763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # If the PIC object exists, use it instead.
67773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # $xdir was prepended to $pic_object above.
677815f2201421a23fbf95840adf524cfdb4db384b85Cristy		  non_pic_object=$pic_object
67793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_append non_pic_objects " $non_pic_object"
67803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
67813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
67823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# Only an error if not doing a dry-run.
67833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		if $opt_dry_run; then
67843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # Extract subdirectory from the argument.
67853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_dirname "$arg" "/" ""
678615f2201421a23fbf95840adf524cfdb4db384b85Cristy		  xdir=$func_dirname_result
67873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
67883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_lo2o "$arg"
67893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  pic_object=$xdir$objdir/$func_lo2o_result
67903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  non_pic_object=$xdir$func_lo2o_result
67913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_append libobjs " $pic_object"
67923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_append non_pic_objects " $non_pic_object"
67933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        else
679415f2201421a23fbf95840adf524cfdb4db384b85Cristy		  func_fatal_error "'$arg' is not a valid libtool object"
67953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
67963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
67973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
67983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
679915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "link input file '$arg' does not exist"
68003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
68013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  arg=$save_arg
68023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
680515f2201421a23fbf95840adf524cfdb4db384b85Cristy	os2dllname)
680615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  os2dllname=$arg
680715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  prev=
680815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  continue
680915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  ;;
68103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	precious_regex)
681115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  precious_files_regex=$arg
68123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
68153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	release)
681615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  release=-$arg
68173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
68203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	rpath | xrpath)
68213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # We need an absolute path.
68223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $arg in
68233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  [\\/]* | [A-Za-z]:[\\/]*) ;;
68243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
68253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_fatal_error "only absolute run-paths are allowed"
68263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
68273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
682815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test rpath = "$prev"; then
68293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case "$rpath " in
68303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $arg "*) ;;
6831da16f16767eb31921af855f17bda465fffc4e000cristy	    *) func_append rpath " $arg" ;;
68323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
68333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
68343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case "$xrpath " in
68353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $arg "*) ;;
6836da16f16767eb31921af855f17bda465fffc4e000cristy	    *) func_append xrpath " $arg" ;;
68373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
68383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
68393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
68423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	shrext)
684315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  shrext_cmds=$arg
68443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
68473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	weak)
6848da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append weak_libs " $arg"
68493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
68523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	xcclinker)
6853da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append linker_flags " $qarg"
6854da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append compiler_flags " $qarg"
68553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append compile_command " $qarg"
68573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append finalize_command " $qarg"
68583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
68603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	xcompiler)
6861da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append compiler_flags " $qarg"
68623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append compile_command " $qarg"
68643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append finalize_command " $qarg"
68653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
68673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	xlinker)
6868da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append linker_flags " $qarg"
6869da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append compiler_flags " $wl$qarg"
68703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append compile_command " $wl$qarg"
68723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append finalize_command " $wl$qarg"
68733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
68753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
68763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval "$prev=\"\$arg\""
68773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
68783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
68793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
68803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
68813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi # test -n "$prev"
68823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
688315f2201421a23fbf95840adf524cfdb4db384b85Cristy      prevarg=$arg
68843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
68853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $arg in
68863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -all-static)
68873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$link_static_flag"; then
68883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # See comment for -static flag below, for more details.
68893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append compile_command " $link_static_flag"
68903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append finalize_command " $link_static_flag"
68913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
68923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
68933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
68943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
68953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -allow-undefined)
68963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# FIXME: remove this flag sometime in the future.
689715f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_fatal_error "'-allow-undefined' must not be used because it is the default"
68983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
68993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
69003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -avoid-version)
69013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	avoid_version=yes
69023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
69033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
69043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
690598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      -bindir)
690698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	prev=bindir
690798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	continue
690898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	;;
690998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy
69103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -dlopen)
69113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=dlfiles
69123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
69133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
69143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
69153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -dlpreopen)
69163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=dlprefiles
69173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
69183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
69193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
69203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -export-dynamic)
69213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	export_dynamic=yes
69223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
69233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
69243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
69253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -export-symbols | -export-symbols-regex)
69263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
69273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_fatal_error "more than one -exported-symbols argument is not allowed"
69283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
692915f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test X-export-symbols = "X$arg"; then
69303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=expsyms
69313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
69323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=expsyms_regex
69333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
69343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
69353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
69363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
69373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -framework)
69383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=framework
69393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
69403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
69413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
69423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -inst-prefix-dir)
69433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=inst_prefix
69443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
69453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
69463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
69473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
69483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # so, if we see these flags be careful not to treat them like -L
69493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -L[A-Z][A-Z]*:*)
69503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $with_gcc/$host in
69513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	no/*-*-irix* | /*-*-irix*)
69523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append compile_command " $arg"
69533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_append finalize_command " $arg"
69543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
69553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
69563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
69573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
69583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
69593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -L*)
6960da16f16767eb31921af855f17bda465fffc4e000cristy	func_stripname "-L" '' "$arg"
6961da16f16767eb31921af855f17bda465fffc4e000cristy	if test -z "$func_stripname_result"; then
69623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test "$#" -gt 0; then
696315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "require no space between '-L' and '$1'"
69643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
696515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "need path for '-L' option"
69663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
69673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
6968da16f16767eb31921af855f17bda465fffc4e000cristy	func_resolve_sysroot "$func_stripname_result"
6969da16f16767eb31921af855f17bda465fffc4e000cristy	dir=$func_resolve_sysroot_result
69703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# We need an absolute path.
69713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $dir in
69723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	[\\/]* | [A-Za-z]:[\\/]*) ;;
69733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
69743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  absdir=`cd "$dir" && pwd`
69753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test -z "$absdir" && \
697615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "cannot determine absolute directory name of '$dir'"
697715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  dir=$absdir
69783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
69793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
69803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case "$deplibs " in
6981da16f16767eb31921af855f17bda465fffc4e000cristy	*" -L$dir "* | *" $arg "*)
6982da16f16767eb31921af855f17bda465fffc4e000cristy	  # Will only happen for absolute or sysroot arguments
6983da16f16767eb31921af855f17bda465fffc4e000cristy	  ;;
69843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
6985da16f16767eb31921af855f17bda465fffc4e000cristy	  # Preserve sysroot, but never include relative directories
6986da16f16767eb31921af855f17bda465fffc4e000cristy	  case $dir in
6987da16f16767eb31921af855f17bda465fffc4e000cristy	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
6988da16f16767eb31921af855f17bda465fffc4e000cristy	    *) func_append deplibs " -L$dir" ;;
6989da16f16767eb31921af855f17bda465fffc4e000cristy	  esac
6990da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append lib_search_path " $dir"
69913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
69923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
69933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $host in
69943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
699598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
69963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case :$dllsearchpath: in
69973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *":$dir:"*) ;;
69983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ::) dllsearchpath=$dir;;
6999da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append dllsearchpath ":$dir";;
70003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
70013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case :$dllsearchpath: in
70023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *":$testbindir:"*) ;;
70033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ::) dllsearchpath=$testbindir;;
7004da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append dllsearchpath ":$testbindir";;
70053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
70063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
70073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
70083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
70093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
70103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
70113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -l*)
701215f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test X-lc = "X$arg" || test X-lm = "X$arg"; then
70133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $host in
701498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
70153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # These systems don't actually have a C or math library (as such)
70163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
70173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
70183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-os2*)
70193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # These systems don't actually have a C library (as such)
702015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    test X-lc = "X$arg" && continue
70213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
702215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
70233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Do not include libc due to us having libc/libc_r.
702415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    test X-lc = "X$arg" && continue
70253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
70263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-rhapsody* | *-*-darwin1.[012])
70273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Rhapsody C and math libraries are in the System framework
7028da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append deplibs " System.ltframework"
70293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
70303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
70313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-sco3.2v5* | *-*-sco5v6*)
70323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Causes problems with __ctype
703315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    test X-lc = "X$arg" && continue
70343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
70353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
70363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Compiler inserts libc in the correct place for threads to work
703715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    test X-lc = "X$arg" && continue
70383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
70393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
704015f2201421a23fbf95840adf524cfdb4db384b85Cristy	elif test X-lc_r = "X$arg"; then
70413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	 case $host in
704215f2201421a23fbf95840adf524cfdb4db384b85Cristy	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
70433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	   # Do not include libc_r directly, use -pthread flag.
70443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	   continue
70453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	   ;;
70463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	 esac
70473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
7048da16f16767eb31921af855f17bda465fffc4e000cristy	func_append deplibs " $arg"
70493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
70503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
70513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
705215f2201421a23fbf95840adf524cfdb4db384b85Cristy      -mllvm)
705315f2201421a23fbf95840adf524cfdb4db384b85Cristy	prev=mllvm
705415f2201421a23fbf95840adf524cfdb4db384b85Cristy	continue
705515f2201421a23fbf95840adf524cfdb4db384b85Cristy	;;
705615f2201421a23fbf95840adf524cfdb4db384b85Cristy
70573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -module)
70583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	module=yes
70593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
70603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
70613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
70623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Tru64 UNIX uses -model [arg] to determine the layout of C++
70633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # classes, name mangling, and exception handling.
70643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Darwin uses the -arch flag to determine output architecture.
7065da16f16767eb31921af855f17bda465fffc4e000cristy      -model|-arch|-isysroot|--sysroot)
7066da16f16767eb31921af855f17bda465fffc4e000cristy	func_append compiler_flags " $arg"
70673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_append compile_command " $arg"
70683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_append finalize_command " $arg"
70693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=xcompiler
70703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
70713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
70723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
70732542fc61a973e588b23b3ddac880f01ae6c4c64dcristy      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
70742542fc61a973e588b23b3ddac880f01ae6c4c64dcristy      |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7075da16f16767eb31921af855f17bda465fffc4e000cristy	func_append compiler_flags " $arg"
70763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_append compile_command " $arg"
70773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_append finalize_command " $arg"
70783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case "$new_inherited_linker_flags " in
70793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $arg "*) ;;
7080da16f16767eb31921af855f17bda465fffc4e000cristy	    * ) func_append new_inherited_linker_flags " $arg" ;;
70813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
70823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
70833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
70843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
70853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -multi_module)
708615f2201421a23fbf95840adf524cfdb4db384b85Cristy	single_module=$wl-multi_module
70873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
70883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
70893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
70903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -no-fast-install)
70913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fast_install=no
70923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
70933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
70943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
70953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -no-install)
70963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $host in
70973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
70983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # The PATH hackery in wrapper scripts is required on Windows
70993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # and Darwin in order for the loader to find any dlls it needs.
710015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_warning "'-no-install' is ignored for $host"
710115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_warning "assuming '-no-fast-install' instead"
71023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fast_install=no
71033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
71043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*) no_install=yes ;;
71053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
71063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -no-undefined)
71103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	allow_undefined=no
71113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -objectlist)
71153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=objectlist
71163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
711915f2201421a23fbf95840adf524cfdb4db384b85Cristy      -os2dllname)
712015f2201421a23fbf95840adf524cfdb4db384b85Cristy	prev=os2dllname
712115f2201421a23fbf95840adf524cfdb4db384b85Cristy	continue
712215f2201421a23fbf95840adf524cfdb4db384b85Cristy	;;
712315f2201421a23fbf95840adf524cfdb4db384b85Cristy
71243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -o) prev=output ;;
71253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -precious-files-regex)
71273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=precious_regex
71283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -release)
71323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=release
71333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -rpath)
71373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=rpath
71383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -R)
71423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=xrpath
71433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -R*)
71473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_stripname '-R' '' "$arg"
71483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	dir=$func_stripname_result
71493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# We need an absolute path.
71503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $dir in
71513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	[\\/]* | [A-Za-z]:[\\/]*) ;;
7152da16f16767eb31921af855f17bda465fffc4e000cristy	=*)
7153da16f16767eb31921af855f17bda465fffc4e000cristy	  func_stripname '=' '' "$dir"
7154da16f16767eb31921af855f17bda465fffc4e000cristy	  dir=$lt_sysroot$func_stripname_result
7155da16f16767eb31921af855f17bda465fffc4e000cristy	  ;;
71563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
71573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_fatal_error "only absolute run-paths are allowed"
71583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
71593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
71603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case "$xrpath " in
71613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*" $dir "*) ;;
7162da16f16767eb31921af855f17bda465fffc4e000cristy	*) func_append xrpath " $dir" ;;
71633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
71643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -shared)
71683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# The effects of -shared are defined in a previous loop.
71693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -shrext)
71733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=shrext
71743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -static | -static-libtool-libs)
71783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# The effects of -static are defined in a previous loop.
71793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# We used to do the same as -all-static on platforms that
71803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# didn't have a PIC flag, but the assumption that the effects
71813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# would be equivalent was wrong.  It would break on at least
71823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Digital Unix and AIX.
71833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -thread-safe)
71873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	thread_safe=yes
71883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -version-info)
71923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=vinfo
71933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
71943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
71953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
71963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -version-number)
71973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=vinfo
71983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	vinfo_number=yes
71993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
72003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
72013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
72023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -weak)
72033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        prev=weak
72043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
72053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
72063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
72073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -Wc,*)
72083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_stripname '-Wc,' '' "$arg"
72093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	args=$func_stripname_result
72103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	arg=
721115f2201421a23fbf95840adf524cfdb4db384b85Cristy	save_ifs=$IFS; IFS=,
72123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for flag in $args; do
721315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  IFS=$save_ifs
72143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy          func_quote_for_eval "$flag"
7215da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append arg " $func_quote_for_eval_result"
7216da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append compiler_flags " $func_quote_for_eval_result"
72173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
721815f2201421a23fbf95840adf524cfdb4db384b85Cristy	IFS=$save_ifs
72193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_stripname ' ' '' "$arg"
72203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	arg=$func_stripname_result
72213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
72223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
72233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -Wl,*)
72243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_stripname '-Wl,' '' "$arg"
72253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	args=$func_stripname_result
72263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	arg=
722715f2201421a23fbf95840adf524cfdb4db384b85Cristy	save_ifs=$IFS; IFS=,
72283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for flag in $args; do
722915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  IFS=$save_ifs
72303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy          func_quote_for_eval "$flag"
7231da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append arg " $wl$func_quote_for_eval_result"
7232da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append compiler_flags " $wl$func_quote_for_eval_result"
7233da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append linker_flags " $func_quote_for_eval_result"
72343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
723515f2201421a23fbf95840adf524cfdb4db384b85Cristy	IFS=$save_ifs
72363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_stripname ' ' '' "$arg"
72373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	arg=$func_stripname_result
72383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
72393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
72403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -Xcompiler)
72413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=xcompiler
72423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
72433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
72443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
72453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -Xlinker)
72463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=xlinker
72473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
72483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
72493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
72503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -XCClinker)
72513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	prev=xcclinker
72523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
72533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
72543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
72553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # -msg_* for osf cc
72563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -msg_*)
72573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_quote_for_eval "$arg"
725815f2201421a23fbf95840adf524cfdb4db384b85Cristy	arg=$func_quote_for_eval_result
72593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
72603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
726198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # Flags to be passed through unchanged, with rationale:
726298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
726398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # -r[0-9][0-9]*        specify processor for the SGI compiler
726498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
726598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # +DA*, +DD*           enable 64-bit mode for the HP compiler
726698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # -q*                  compiler args for the IBM compiler
726798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
726898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # -F/path              path to uninstalled frameworks, gcc on darwin
726998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
727015f2201421a23fbf95840adf524cfdb4db384b85Cristy      # -fstack-protector*   stack protector flags for GCC
727198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # @file                GCC response files
727298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      # -tp=*                Portland pgcc target processor selection
7273da16f16767eb31921af855f17bda465fffc4e000cristy      # --sysroot=*          for sysroot support
727415f2201421a23fbf95840adf524cfdb4db384b85Cristy      # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
727515f2201421a23fbf95840adf524cfdb4db384b85Cristy      # -stdlib=*            select c++ std lib with clang
72763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7277da16f16767eb31921af855f17bda465fffc4e000cristy      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
727815f2201421a23fbf95840adf524cfdb4db384b85Cristy      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
72793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        func_quote_for_eval "$arg"
728015f2201421a23fbf95840adf524cfdb4db384b85Cristy	arg=$func_quote_for_eval_result
72813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        func_append compile_command " $arg"
72823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        func_append finalize_command " $arg"
7283da16f16767eb31921af855f17bda465fffc4e000cristy        func_append compiler_flags " $arg"
72843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        continue
72853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
72863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
728715f2201421a23fbf95840adf524cfdb4db384b85Cristy      -Z*)
728815f2201421a23fbf95840adf524cfdb4db384b85Cristy        if test os2 = "`expr $host : '.*\(os2\)'`"; then
728915f2201421a23fbf95840adf524cfdb4db384b85Cristy          # OS/2 uses -Zxxx to specify OS/2-specific options
729015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  compiler_flags="$compiler_flags $arg"
729115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_append compile_command " $arg"
729215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_append finalize_command " $arg"
729315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  case $arg in
729415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  -Zlinker | -Zstack)
729515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    prev=xcompiler
729615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    ;;
729715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  esac
729815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  continue
729915f2201421a23fbf95840adf524cfdb4db384b85Cristy        else
730015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # Otherwise treat like 'Some other compiler flag' below
730115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_quote_for_eval "$arg"
730215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  arg=$func_quote_for_eval_result
730315f2201421a23fbf95840adf524cfdb4db384b85Cristy        fi
730415f2201421a23fbf95840adf524cfdb4db384b85Cristy	;;
730515f2201421a23fbf95840adf524cfdb4db384b85Cristy
73063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Some other compiler flag.
73073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      -* | +*)
73083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        func_quote_for_eval "$arg"
730915f2201421a23fbf95840adf524cfdb4db384b85Cristy	arg=$func_quote_for_eval_result
73103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
73113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.$objext)
73133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# A standard object.
7314da16f16767eb31921af855f17bda465fffc4e000cristy	func_append objs " $arg"
73153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
73163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.lo)
73183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# A libtool-controlled object.
73193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Check to see that this really is a libtool object.
73213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if func_lalib_unsafe_p "$arg"; then
73223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  pic_object=
73233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  non_pic_object=
73243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Read the .lo file
73263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_source "$arg"
73273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -z "$pic_object" ||
73293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	     test -z "$non_pic_object" ||
733015f2201421a23fbf95840adf524cfdb4db384b85Cristy	     test none = "$pic_object" &&
733115f2201421a23fbf95840adf524cfdb4db384b85Cristy	     test none = "$non_pic_object"; then
733215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "cannot find name of object for '$arg'"
73333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
73343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Extract subdirectory from the argument.
73363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_dirname "$arg" "/" ""
733715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  xdir=$func_dirname_result
73383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
733915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  test none = "$pic_object" || {
73403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Prepend the subdirectory the object is found in.
734115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    pic_object=$xdir$pic_object
73423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
734315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test dlfiles = "$prev"; then
734415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7345da16f16767eb31921af855f17bda465fffc4e000cristy		func_append dlfiles " $pic_object"
73463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		prev=
73473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		continue
73483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
73493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# If libtool objects are unsupported, then we need to preload.
73503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		prev=dlprefiles
73513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
73523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
73533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # CHECK ME:  I think I busted this.  -Ossama
735515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test dlprefiles = "$prev"; then
73563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Preload the old-style object.
7357da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append dlprefiles " $pic_object"
73583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      prev=
73593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
73603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # A PIC object.
73623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_append libobjs " $pic_object"
736315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    arg=$pic_object
736415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  }
73653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Non-PIC object.
736715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test none != "$non_pic_object"; then
73683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Prepend the subdirectory the object is found in.
736915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    non_pic_object=$xdir$non_pic_object
73703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # A standard non-PIC object
73723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_append non_pic_objects " $non_pic_object"
737315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test -z "$pic_object" || test none = "$pic_object"; then
737415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      arg=$non_pic_object
73753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
73763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
73773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # If the PIC object exists, use it instead.
73783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # $xdir was prepended to $pic_object above.
737915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    non_pic_object=$pic_object
73803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_append non_pic_objects " $non_pic_object"
73813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
73823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
73833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Only an error if not doing a dry-run.
73843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if $opt_dry_run; then
73853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Extract subdirectory from the argument.
73863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_dirname "$arg" "/" ""
738715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    xdir=$func_dirname_result
73883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
73893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_lo2o "$arg"
73903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    pic_object=$xdir$objdir/$func_lo2o_result
73913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    non_pic_object=$xdir$func_lo2o_result
73923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_append libobjs " $pic_object"
73933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_append non_pic_objects " $non_pic_object"
73943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
739515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "'$arg' is not a valid libtool object"
73963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
73973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
73983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
73993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.$libext)
74013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# An archive.
7402da16f16767eb31921af855f17bda465fffc4e000cristy	func_append deplibs " $arg"
7403da16f16767eb31921af855f17bda465fffc4e000cristy	func_append old_deplibs " $arg"
74043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
74053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
74063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.la)
74083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# A libtool-controlled library.
74093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
7410da16f16767eb31921af855f17bda465fffc4e000cristy	func_resolve_sysroot "$arg"
741115f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test dlfiles = "$prev"; then
74123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # This library was specified with -dlopen.
7413da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append dlfiles " $func_resolve_sysroot_result"
74143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
741515f2201421a23fbf95840adf524cfdb4db384b85Cristy	elif test dlprefiles = "$prev"; then
74163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # The library was specified with -dlpreopen.
7417da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append dlprefiles " $func_resolve_sysroot_result"
74183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prev=
74193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
7420da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append deplibs " $func_resolve_sysroot_result"
74213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
74223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
74233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
74243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Some other compiler argument.
74263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
74273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Unknown arguments in both finalize_command and compile_command need
74283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# to be aesthetically quoted because they are evaled later.
74293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_quote_for_eval "$arg"
743015f2201421a23fbf95840adf524cfdb4db384b85Cristy	arg=$func_quote_for_eval_result
74313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
74323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac # arg
74333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Now actually substitute the argument into the commands.
74353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$arg"; then
74363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_append compile_command " $arg"
74373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_append finalize_command " $arg"
74383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
74393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done # argument parsing loop
74403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -n "$prev" && \
744215f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_fatal_help "the '$prevarg' option requires an argument"
74433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
744415f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
74453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      eval arg=\"$export_dynamic_flag_spec\"
74463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_append compile_command " $arg"
74473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_append finalize_command " $arg"
74483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
74493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    oldlibs=
74513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # calculate the name of the file, without its directory
74523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_basename "$output"
745315f2201421a23fbf95840adf524cfdb4db384b85Cristy    outputname=$func_basename_result
745415f2201421a23fbf95840adf524cfdb4db384b85Cristy    libobjs_save=$libobjs
74553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    if test -n "$shlibpath_var"; then
74573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # get the directories listed in $shlibpath_var
745815f2201421a23fbf95840adf524cfdb4db384b85Cristy      eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
74593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    else
74603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      shlib_search_path=
74613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
74623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
74633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
74643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
746515f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Definition is injected by LT_CONFIG during libtool generation.
746615f2201421a23fbf95840adf524cfdb4db384b85Cristy    func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
746715f2201421a23fbf95840adf524cfdb4db384b85Cristy
74683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_dirname "$output" "/" ""
746915f2201421a23fbf95840adf524cfdb4db384b85Cristy    output_objdir=$func_dirname_result$objdir
7470da16f16767eb31921af855f17bda465fffc4e000cristy    func_to_tool_file "$output_objdir/"
7471da16f16767eb31921af855f17bda465fffc4e000cristy    tool_output_objdir=$func_to_tool_file_result
74723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Create the object directory.
74733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    func_mkdir_p "$output_objdir"
74743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Determine the type of output
74763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $output in
74773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    "")
74783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_fatal_help "you must specify an output file"
74793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
74803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *.$libext) linkmode=oldlib ;;
74813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *.lo | *.$objext) linkmode=obj ;;
74823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *.la) linkmode=lib ;;
74833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *) linkmode=prog ;; # Anything else should be a program.
74843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
74853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    specialdeplibs=
74873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
74883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    libs=
74893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Find all interdependent deplibs by searching for libraries
74903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # that are linked more than once (e.g. -la -lb -la)
74913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for deplib in $deplibs; do
749215f2201421a23fbf95840adf524cfdb4db384b85Cristy      if $opt_preserve_dup_deps; then
74933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case "$libs " in
7494da16f16767eb31921af855f17bda465fffc4e000cristy	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
74953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
74963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
7497da16f16767eb31921af855f17bda465fffc4e000cristy      func_append libs " $deplib"
74983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
74993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
750015f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test lib = "$linkmode"; then
75013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      libs="$predeps $libs $compiler_lib_search_path $postdeps"
75023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
75033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Compute libraries that are listed more than once in $predeps
75043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # $postdeps and mark them as special (i.e., whose duplicates are
75053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # not to be eliminated).
75063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      pre_post_deps=
75073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if $opt_duplicate_compiler_generated_deps; then
75083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for pre_post_dep in $predeps $postdeps; do
75093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case "$pre_post_deps " in
7510da16f16767eb31921af855f17bda465fffc4e000cristy	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
75113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
7512da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append pre_post_deps " $pre_post_dep"
75133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
75143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
75153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      pre_post_deps=
75163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
75173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
75183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    deplibs=
75193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    newdependency_libs=
75203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    newlib_search_path=
75213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    need_relink=no # whether we're linking any uninstalled libtool libraries
75223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    notinst_deplibs= # not-installed libtool libraries
75233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    notinst_path= # paths that contain not-installed libtool libraries
75243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
75253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $linkmode in
75263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    lib)
75273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	passes="conv dlpreopen link"
75283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for file in $dlfiles $dlprefiles; do
75293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $file in
75303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *.la) ;;
75313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
753215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
75333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
75343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
75353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
75363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
75373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    prog)
75383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	compile_deplibs=
75393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	finalize_deplibs=
754015f2201421a23fbf95840adf524cfdb4db384b85Cristy	alldeplibs=false
75413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	newdlfiles=
75423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	newdlprefiles=
75433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	passes="conv scan dlopen dlpreopen link"
75443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
75453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *)  passes="conv"
75463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
75473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
75483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
75493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for pass in $passes; do
75503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # The preopen pass in lib mode reverses $deplibs; put it back here
75513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # so that -L comes before libs that need it for instance...
755215f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test lib,link = "$linkmode,$pass"; then
75533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	## FIXME: Find the place where the list is rebuilt in the wrong
75543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	##        order, and fix it there properly
75553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        tmp_deplibs=
75563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for deplib in $deplibs; do
75573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  tmp_deplibs="$deplib $tmp_deplibs"
75583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
755915f2201421a23fbf95840adf524cfdb4db384b85Cristy	deplibs=$tmp_deplibs
75603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
75613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
756215f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test lib,link = "$linkmode,$pass" ||
756315f2201421a23fbf95840adf524cfdb4db384b85Cristy	 test prog,scan = "$linkmode,$pass"; then
756415f2201421a23fbf95840adf524cfdb4db384b85Cristy	libs=$deplibs
75653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	deplibs=
75663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
756715f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test prog = "$linkmode"; then
75683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $pass in
756915f2201421a23fbf95840adf524cfdb4db384b85Cristy	dlopen) libs=$dlfiles ;;
757015f2201421a23fbf95840adf524cfdb4db384b85Cristy	dlpreopen) libs=$dlprefiles ;;
75713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
75723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
75733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
757415f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test lib,dlpreopen = "$linkmode,$pass"; then
75753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Collect and forward deplibs of preopened libtool libs
75763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for lib in $dlprefiles; do
75773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Ignore non-libtool-libs
75783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  dependency_libs=
7579da16f16767eb31921af855f17bda465fffc4e000cristy	  func_resolve_sysroot "$lib"
75803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $lib in
7581da16f16767eb31921af855f17bda465fffc4e000cristy	  *.la)	func_source "$func_resolve_sysroot_result" ;;
75823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
75833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
75843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Collect preopened libtool deplibs, except any this library
75853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # has declared as weak libs
75863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for deplib in $dependency_libs; do
758798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    func_basename "$deplib"
758898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy            deplib_base=$func_basename_result
75893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case " $weak_libs " in
75903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $deplib_base "*) ;;
7591da16f16767eb31921af855f17bda465fffc4e000cristy	    *) func_append deplibs " $deplib" ;;
75923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
75933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
75943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
759515f2201421a23fbf95840adf524cfdb4db384b85Cristy	libs=$dlprefiles
75963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
759715f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test dlopen = "$pass"; then
75983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Collect dlpreopened libraries
759915f2201421a23fbf95840adf524cfdb4db384b85Cristy	save_deplibs=$deplibs
76003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	deplibs=
76013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
76023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
76033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for deplib in $libs; do
76043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	lib=
760515f2201421a23fbf95840adf524cfdb4db384b85Cristy	found=false
76063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $deplib in
76072542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
76082542fc61a973e588b23b3ddac880f01ae6c4c64dcristy        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
760915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test prog,link = "$linkmode,$pass"; then
76103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    compile_deplibs="$deplib $compile_deplibs"
76113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    finalize_deplibs="$deplib $finalize_deplibs"
76123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
7613da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append compiler_flags " $deplib"
761415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test lib = "$linkmode"; then
76153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case "$new_inherited_linker_flags " in
76163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    *" $deplib "*) ;;
7617da16f16767eb31921af855f17bda465fffc4e000cristy		    * ) func_append new_inherited_linker_flags " $deplib" ;;
76183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
76193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
76203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
76213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
76223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
76233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-l*)
762415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test lib != "$linkmode" && test prog != "$linkmode"; then
762515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_warning "'-l' is ignored for archives/objects"
76263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
76273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
76283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_stripname '-l' '' "$deplib"
76293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  name=$func_stripname_result
763015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test lib = "$linkmode"; then
76313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
76323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
76333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
76343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
76353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for searchdir in $searchdirs; do
76363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for search_ext in .la $std_shrext .so .a; do
76373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Search the libtool library
763815f2201421a23fbf95840adf524cfdb4db384b85Cristy	      lib=$searchdir/lib$name$search_ext
76393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if test -f "$lib"; then
764015f2201421a23fbf95840adf524cfdb4db384b85Cristy		if test .la = "$search_ext"; then
764115f2201421a23fbf95840adf524cfdb4db384b85Cristy		  found=:
76423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		else
764315f2201421a23fbf95840adf524cfdb4db384b85Cristy		  found=false
76443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
76453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		break 2
76463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
76473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
76483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
764915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if $found; then
765015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    # deplib is a libtool library
76513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
76523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # We need to do some special things here, and not later.
765315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes = "$allow_libtool_libs_with_static_runtimes"; then
76543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case " $predeps $postdeps " in
76553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $deplib "*)
76563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		if func_lalib_p "$lib"; then
76573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  library_names=
76583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  old_library=
76593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_source "$lib"
76603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  for l in $old_library $library_names; do
766115f2201421a23fbf95840adf524cfdb4db384b85Cristy		    ll=$l
76623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  done
766315f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test "X$ll" = "X$old_library"; then # only static version available
766415f2201421a23fbf95840adf524cfdb4db384b85Cristy		    found=false
76653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    func_dirname "$lib" "" "."
766615f2201421a23fbf95840adf524cfdb4db384b85Cristy		    ladir=$func_dirname_result
76673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    lib=$ladir/$old_library
766815f2201421a23fbf95840adf524cfdb4db384b85Cristy		    if test prog,link = "$linkmode,$pass"; then
76693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      compile_deplibs="$deplib $compile_deplibs"
76703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      finalize_deplibs="$deplib $finalize_deplibs"
76713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    else
76723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      deplibs="$deplib $deplibs"
767315f2201421a23fbf95840adf524cfdb4db384b85Cristy		      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
76743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    fi
76753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    continue
76763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
76773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
76783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
76793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *) ;;
76803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
76813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
768215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  else
768315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    # deplib doesn't seem to be a libtool library
768415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test prog,link = "$linkmode,$pass"; then
768515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      compile_deplibs="$deplib $compile_deplibs"
768615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      finalize_deplibs="$deplib $finalize_deplibs"
768715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    else
768815f2201421a23fbf95840adf524cfdb4db384b85Cristy	      deplibs="$deplib $deplibs"
768915f2201421a23fbf95840adf524cfdb4db384b85Cristy	      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
769015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    fi
769115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    continue
76923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
76933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;; # -l
76943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*.ltframework)
769515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test prog,link = "$linkmode,$pass"; then
76963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    compile_deplibs="$deplib $compile_deplibs"
76973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    finalize_deplibs="$deplib $finalize_deplibs"
76983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
76993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    deplibs="$deplib $deplibs"
770015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test lib = "$linkmode"; then
77013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case "$new_inherited_linker_flags " in
77023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    *" $deplib "*) ;;
7703da16f16767eb31921af855f17bda465fffc4e000cristy		    * ) func_append new_inherited_linker_flags " $deplib" ;;
77043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
77053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
77063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
77073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
77083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
77093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-L*)
77103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $linkmode in
77113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  lib)
77123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    deplibs="$deplib $deplibs"
771315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    test conv = "$pass" && continue
77143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    newdependency_libs="$deplib $newdependency_libs"
77153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_stripname '-L' '' "$deplib"
7716da16f16767eb31921af855f17bda465fffc4e000cristy	    func_resolve_sysroot "$func_stripname_result"
7717da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append newlib_search_path " $func_resolve_sysroot_result"
77183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
77193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prog)
772015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test conv = "$pass"; then
77213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      deplibs="$deplib $deplibs"
77223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      continue
77233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
772415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test scan = "$pass"; then
77253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      deplibs="$deplib $deplibs"
77263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
77273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      compile_deplibs="$deplib $compile_deplibs"
77283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      finalize_deplibs="$deplib $finalize_deplibs"
77293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
77303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_stripname '-L' '' "$deplib"
7731da16f16767eb31921af855f17bda465fffc4e000cristy	    func_resolve_sysroot "$func_stripname_result"
7732da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append newlib_search_path " $func_resolve_sysroot_result"
77333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
77343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
773515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_warning "'-L' is ignored for archives/objects"
77363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
77373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac # linkmode
77383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
77393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;; # -L
77403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-R*)
774115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test link = "$pass"; then
77423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_stripname '-R' '' "$deplib"
7743da16f16767eb31921af855f17bda465fffc4e000cristy	    func_resolve_sysroot "$func_stripname_result"
7744da16f16767eb31921af855f17bda465fffc4e000cristy	    dir=$func_resolve_sysroot_result
77453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Make sure the xrpath contains only unique directories.
77463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case "$xrpath " in
77473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $dir "*) ;;
7748da16f16767eb31921af855f17bda465fffc4e000cristy	    *) func_append xrpath " $dir" ;;
77493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
77503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
77513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  deplibs="$deplib $deplibs"
77523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
77533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
7754da16f16767eb31921af855f17bda465fffc4e000cristy	*.la)
7755da16f16767eb31921af855f17bda465fffc4e000cristy	  func_resolve_sysroot "$deplib"
7756da16f16767eb31921af855f17bda465fffc4e000cristy	  lib=$func_resolve_sysroot_result
7757da16f16767eb31921af855f17bda465fffc4e000cristy	  ;;
77583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*.$libext)
775915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test conv = "$pass"; then
77603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    deplibs="$deplib $deplibs"
77613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
77623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
77633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $linkmode in
77643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  lib)
77653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Linking convenience modules into shared libraries is allowed,
77663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # but linking other static libraries is non-portable.
77673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case " $dlpreconveniencelibs " in
77683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $deplib "*) ;;
77693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *)
777015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      valid_a_lib=false
77713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $deplibs_check_method in
77723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		match_pattern*)
77733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  set dummy $deplibs_check_method; shift
77743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
777598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
77763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    | $EGREP "$match_pattern_regex" > /dev/null; then
777715f2201421a23fbf95840adf524cfdb4db384b85Cristy		    valid_a_lib=:
77783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
77793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
77803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		pass_all)
778115f2201421a23fbf95840adf524cfdb4db384b85Cristy		  valid_a_lib=:
77823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
77833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
778415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if $valid_a_lib; then
778515f2201421a23fbf95840adf524cfdb4db384b85Cristy		echo
778615f2201421a23fbf95840adf524cfdb4db384b85Cristy		$ECHO "*** Warning: Linking the shared library $output against the"
778715f2201421a23fbf95840adf524cfdb4db384b85Cristy		$ECHO "*** static library $deplib is not portable!"
778815f2201421a23fbf95840adf524cfdb4db384b85Cristy		deplibs="$deplib $deplibs"
778915f2201421a23fbf95840adf524cfdb4db384b85Cristy	      else
779098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo
77913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
779298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** I have the capability to make that library automatically link in when"
779398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** you link to this library.  But I can only do this if you have a"
779498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** shared version of the library, which you do not appear to have"
779598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** because the file extensions .$libext of this argument makes me believe"
779698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** that it is just a static archive that I should not use here."
77973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
77983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
77993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
78003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
78013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
78023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  prog)
780315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test link != "$pass"; then
78043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      deplibs="$deplib $deplibs"
78053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
78063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      compile_deplibs="$deplib $compile_deplibs"
78073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      finalize_deplibs="$deplib $finalize_deplibs"
78083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
78093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
78103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
78113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac # linkmode
78123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;; # *.$libext
78133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*.lo | *.$objext)
781415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test conv = "$pass"; then
78153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    deplibs="$deplib $deplibs"
781615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  elif test prog = "$linkmode"; then
781715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
78183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # If there is no dlopen support or we're linking statically,
78193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # we need to preload.
7820da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append newdlprefiles " $deplib"
78213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      compile_deplibs="$deplib $compile_deplibs"
78223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      finalize_deplibs="$deplib $finalize_deplibs"
78233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
7824da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append newdlfiles " $deplib"
78253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
78263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
78273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
78283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
78293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	%DEPLIBS%)
783015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  alldeplibs=:
78313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
78323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
78333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac # case $deplib
78343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
783515f2201421a23fbf95840adf524cfdb4db384b85Cristy	$found || test -f "$lib" \
783615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
78373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
78383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Check to see that this really is a libtool archive.
78393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_lalib_unsafe_p "$lib" \
784015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  || func_fatal_error "'$lib' is not a valid libtool archive"
78413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
78423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_dirname "$lib" "" "."
784315f2201421a23fbf95840adf524cfdb4db384b85Cristy	ladir=$func_dirname_result
78443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
78453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	dlname=
78463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	dlopen=
78473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	dlpreopen=
78483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	libdir=
78493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	library_names=
78503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	old_library=
78513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	inherited_linker_flags=
78523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# If the library was installed with an old release of libtool,
78533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# it will not redefine variables installed, or shouldnotlink
78543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	installed=yes
78553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	shouldnotlink=no
78563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	avoidtemprpath=
78573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
78583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
78593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Read the .la file
78603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_source "$lib"
78613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
78623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Convert "-framework foo" to "foo.ltframework"
78633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$inherited_linker_flags"; then
786498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
78653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
78663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case " $new_inherited_linker_flags " in
78673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $tmp_inherited_linker_flag "*) ;;
7868da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
78693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
78703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
78713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
787298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
787315f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test lib,link = "$linkmode,$pass" ||
787415f2201421a23fbf95840adf524cfdb4db384b85Cristy	   test prog,scan = "$linkmode,$pass" ||
787515f2201421a23fbf95840adf524cfdb4db384b85Cristy	   { test prog != "$linkmode" && test lib != "$linkmode"; }; then
7876da16f16767eb31921af855f17bda465fffc4e000cristy	  test -n "$dlopen" && func_append dlfiles " $dlopen"
7877da16f16767eb31921af855f17bda465fffc4e000cristy	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
78783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
78793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
788015f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test conv = "$pass"; then
78813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Only check for convenience libraries
78823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  deplibs="$lib $deplibs"
78833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -z "$libdir"; then
78843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -z "$old_library"; then
788515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_fatal_error "cannot find name of link library for '$lib'"
78863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
78873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # It is a libtool convenience library, so add in its objects.
7888da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append convenience " $ladir/$objdir/$old_library"
7889da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append old_convenience " $ladir/$objdir/$old_library"
789015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  elif test prog != "$linkmode" && test lib != "$linkmode"; then
789115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "'$lib' is not a convenience library"
78923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
78933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  tmp_libs=
78943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for deplib in $dependency_libs; do
78953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    deplibs="$deplib $deplibs"
789615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if $opt_preserve_dup_deps; then
78973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case "$tmp_libs " in
7898da16f16767eb31921af855f17bda465fffc4e000cristy	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
78993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
79003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
7901da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append tmp_libs " $deplib"
79023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
79033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
79043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi # $pass = conv
79053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
79063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
79073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Get the name of the library we link against.
79083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	linklib=
7909da16f16767eb31921af855f17bda465fffc4e000cristy	if test -n "$old_library" &&
791015f2201421a23fbf95840adf524cfdb4db384b85Cristy	   { test yes = "$prefer_static_libs" ||
791115f2201421a23fbf95840adf524cfdb4db384b85Cristy	     test built,no = "$prefer_static_libs,$installed"; }; then
7912da16f16767eb31921af855f17bda465fffc4e000cristy	  linklib=$old_library
7913da16f16767eb31921af855f17bda465fffc4e000cristy	else
7914da16f16767eb31921af855f17bda465fffc4e000cristy	  for l in $old_library $library_names; do
791515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    linklib=$l
7916da16f16767eb31921af855f17bda465fffc4e000cristy	  done
7917da16f16767eb31921af855f17bda465fffc4e000cristy	fi
79183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -z "$linklib"; then
791915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_error "cannot find name of link library for '$lib'"
79203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
79213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
79223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# This library was specified with -dlopen.
792315f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test dlopen = "$pass"; then
792415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  test -z "$libdir" \
792515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
79263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -z "$dlname" ||
792715f2201421a23fbf95840adf524cfdb4db384b85Cristy	     test yes != "$dlopen_support" ||
792815f2201421a23fbf95840adf524cfdb4db384b85Cristy	     test no = "$build_libtool_libs"
792915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  then
79303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # If there is no dlname, no dlopen support or we're linking
79313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # statically, we need to preload.  We also need to preload any
79323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # dependent libraries so libltdl's deplib preloader doesn't
79333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # bomb out in the load deplibs phase.
7934da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append dlprefiles " $lib $dependency_libs"
79353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
7936da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append newdlfiles " $lib"
79373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
79383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
79393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi # $pass = dlopen
79403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
79413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# We need an absolute path.
79423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $ladir in
794315f2201421a23fbf95840adf524cfdb4db384b85Cristy	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
79443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
79453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  abs_ladir=`cd "$ladir" && pwd`
79463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -z "$abs_ladir"; then
794715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_warning "cannot determine absolute directory name of '$ladir'"
79483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_warning "passing it literally to the linker, although it might fail"
794915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    abs_ladir=$ladir
79503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
79513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
79523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
79533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_basename "$lib"
795415f2201421a23fbf95840adf524cfdb4db384b85Cristy	laname=$func_basename_result
79553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
79563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Find the relevant object directory and library name.
795715f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$installed"; then
7958da16f16767eb31921af855f17bda465fffc4e000cristy	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
795915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_warning "library '$lib' was moved."
796015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dir=$ladir
796115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    absdir=$abs_ladir
796215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    libdir=$abs_ladir
79633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
796415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dir=$lt_sysroot$libdir
796515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    absdir=$lt_sysroot$libdir
79663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
796715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  test yes = "$hardcode_automatic" && avoidtemprpath=yes
79683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
79693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
797015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dir=$ladir
797115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    absdir=$abs_ladir
79723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Remove this search path later
7973da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append notinst_path " $abs_ladir"
79743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
797515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dir=$ladir/$objdir
797615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    absdir=$abs_ladir/$objdir
79773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Remove this search path later
7978da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append notinst_path " $abs_ladir"
79793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
79803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi # $installed = yes
79813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_stripname 'lib' '.la' "$laname"
79823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	name=$func_stripname_result
79833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
79843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# This library was specified with -dlpreopen.
798515f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test dlpreopen = "$pass"; then
798615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test -z "$libdir" && test prog = "$linkmode"; then
798715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
79883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
798915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  case $host in
7990da16f16767eb31921af855f17bda465fffc4e000cristy	    # special handling for platforms with PE-DLLs.
7991da16f16767eb31921af855f17bda465fffc4e000cristy	    *cygwin* | *mingw* | *cegcc* )
7992da16f16767eb31921af855f17bda465fffc4e000cristy	      # Linker will automatically link against shared library if both
7993da16f16767eb31921af855f17bda465fffc4e000cristy	      # static and shared are present.  Therefore, ensure we extract
7994da16f16767eb31921af855f17bda465fffc4e000cristy	      # symbols from the import library if a shared library is present
7995da16f16767eb31921af855f17bda465fffc4e000cristy	      # (otherwise, the dlopen module name will be incorrect).  We do
7996da16f16767eb31921af855f17bda465fffc4e000cristy	      # this by putting the import library name into $newdlprefiles.
7997da16f16767eb31921af855f17bda465fffc4e000cristy	      # We recover the dlopen module name by 'saving' the la file
7998da16f16767eb31921af855f17bda465fffc4e000cristy	      # name in a special purpose variable, and (later) extracting the
7999da16f16767eb31921af855f17bda465fffc4e000cristy	      # dlname from the la file.
8000da16f16767eb31921af855f17bda465fffc4e000cristy	      if test -n "$dlname"; then
8001da16f16767eb31921af855f17bda465fffc4e000cristy	        func_tr_sh "$dir/$linklib"
8002da16f16767eb31921af855f17bda465fffc4e000cristy	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8003da16f16767eb31921af855f17bda465fffc4e000cristy	        func_append newdlprefiles " $dir/$linklib"
8004da16f16767eb31921af855f17bda465fffc4e000cristy	      else
8005da16f16767eb31921af855f17bda465fffc4e000cristy	        func_append newdlprefiles " $dir/$old_library"
8006da16f16767eb31921af855f17bda465fffc4e000cristy	        # Keep a list of preopened convenience libraries to check
8007da16f16767eb31921af855f17bda465fffc4e000cristy	        # that they are being used correctly in the link pass.
8008da16f16767eb31921af855f17bda465fffc4e000cristy	        test -z "$libdir" && \
8009da16f16767eb31921af855f17bda465fffc4e000cristy	          func_append dlpreconveniencelibs " $dir/$old_library"
8010da16f16767eb31921af855f17bda465fffc4e000cristy	      fi
8011da16f16767eb31921af855f17bda465fffc4e000cristy	    ;;
8012da16f16767eb31921af855f17bda465fffc4e000cristy	    * )
8013da16f16767eb31921af855f17bda465fffc4e000cristy	      # Prefer using a static library (so that no silly _DYNAMIC symbols
8014da16f16767eb31921af855f17bda465fffc4e000cristy	      # are required to link).
8015da16f16767eb31921af855f17bda465fffc4e000cristy	      if test -n "$old_library"; then
8016da16f16767eb31921af855f17bda465fffc4e000cristy	        func_append newdlprefiles " $dir/$old_library"
8017da16f16767eb31921af855f17bda465fffc4e000cristy	        # Keep a list of preopened convenience libraries to check
8018da16f16767eb31921af855f17bda465fffc4e000cristy	        # that they are being used correctly in the link pass.
8019da16f16767eb31921af855f17bda465fffc4e000cristy	        test -z "$libdir" && \
8020da16f16767eb31921af855f17bda465fffc4e000cristy	          func_append dlpreconveniencelibs " $dir/$old_library"
8021da16f16767eb31921af855f17bda465fffc4e000cristy	      # Otherwise, use the dlname, so that lt_dlopen finds it.
8022da16f16767eb31921af855f17bda465fffc4e000cristy	      elif test -n "$dlname"; then
8023da16f16767eb31921af855f17bda465fffc4e000cristy	        func_append newdlprefiles " $dir/$dlname"
8024da16f16767eb31921af855f17bda465fffc4e000cristy	      else
8025da16f16767eb31921af855f17bda465fffc4e000cristy	        func_append newdlprefiles " $dir/$linklib"
8026da16f16767eb31921af855f17bda465fffc4e000cristy	      fi
8027da16f16767eb31921af855f17bda465fffc4e000cristy	    ;;
8028da16f16767eb31921af855f17bda465fffc4e000cristy	  esac
80293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi # $pass = dlpreopen
80303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
80313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -z "$libdir"; then
80323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Link the convenience library
803315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test lib = "$linkmode"; then
80343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    deplibs="$dir/$old_library $deplibs"
803515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  elif test prog,link = "$linkmode,$pass"; then
80363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    compile_deplibs="$dir/$old_library $compile_deplibs"
80373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
80383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
80393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    deplibs="$lib $deplibs" # used for prog,scan pass
80403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
80413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
80423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
80433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
80443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
804515f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test prog = "$linkmode" && test link != "$pass"; then
8046da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append newlib_search_path " $ladir"
80473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  deplibs="$lib $deplibs"
80483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
804915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  linkalldeplibs=false
805015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test no != "$link_all_deplibs" || test -z "$library_names" ||
805115f2201421a23fbf95840adf524cfdb4db384b85Cristy	     test no = "$build_libtool_libs"; then
805215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    linkalldeplibs=:
80533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
80543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
80553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  tmp_libs=
80563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for deplib in $dependency_libs; do
80573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case $deplib in
80583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    -L*) func_stripname '-L' '' "$deplib"
8059da16f16767eb31921af855f17bda465fffc4e000cristy	         func_resolve_sysroot "$func_stripname_result"
8060da16f16767eb31921af855f17bda465fffc4e000cristy	         func_append newlib_search_path " $func_resolve_sysroot_result"
80613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		 ;;
80623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
80633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Need to link against all dependency_libs?
806415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if $linkalldeplibs; then
80653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      deplibs="$deplib $deplibs"
80663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
80673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Need to hardcode shared library paths
80683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # or/and link against static libraries
80693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      newdependency_libs="$deplib $newdependency_libs"
80703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
807115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if $opt_preserve_dup_deps; then
80723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case "$tmp_libs " in
8073da16f16767eb31921af855f17bda465fffc4e000cristy	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
80743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
80753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
8076da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append tmp_libs " $deplib"
80773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done # for deplib
80783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  continue
80793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi # $linkmode = prog...
80803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
808115f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test prog,link = "$linkmode,$pass"; then
80823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$library_names" &&
808315f2201421a23fbf95840adf524cfdb4db384b85Cristy	     { { test no = "$prefer_static_libs" ||
808415f2201421a23fbf95840adf524cfdb4db384b85Cristy	         test built,yes = "$prefer_static_libs,$installed"; } ||
80853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	       test -z "$old_library"; }; then
80863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # We need to hardcode the library path
808715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
80883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Make sure the rpath contains only unique directories.
808915f2201421a23fbf95840adf524cfdb4db384b85Cristy	      case $temp_rpath: in
80903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *"$absdir:"*) ;;
8091da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append temp_rpath "$absdir:" ;;
80923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
80933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
80943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
80953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Hardcode the library path.
80963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Skip directories that are in the system default run-time
80973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # search path.
80983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case " $sys_lib_dlsearch_path " in
80993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $absdir "*) ;;
81003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *)
81013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case "$compile_rpath " in
81023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $absdir "*) ;;
8103da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append compile_rpath " $absdir" ;;
81043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
81053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
81063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
81073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case " $sys_lib_dlsearch_path " in
81083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $libdir "*) ;;
81093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *)
81103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case "$finalize_rpath " in
81113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $libdir "*) ;;
8112da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append finalize_rpath " $libdir" ;;
81133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
81143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
81153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
81163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi # $linkmode,$pass = prog,link...
81173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
811815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if $alldeplibs &&
811915f2201421a23fbf95840adf524cfdb4db384b85Cristy	     { test pass_all = "$deplibs_check_method" ||
812015f2201421a23fbf95840adf524cfdb4db384b85Cristy	       { test yes = "$build_libtool_libs" &&
81213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		 test -n "$library_names"; }; }; then
81223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # We only need to search for static libraries
81233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    continue
81243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
81253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
81263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
81273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	link_static=no # Whether the deplib will be linked statically
81283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	use_static_libs=$prefer_static_libs
812915f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test built = "$use_static_libs" && test yes = "$installed"; then
81303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  use_static_libs=no
81313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
81323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$library_names" &&
813315f2201421a23fbf95840adf524cfdb4db384b85Cristy	   { test no = "$use_static_libs" || test -z "$old_library"; }; then
81343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $host in
813515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  *cygwin* | *mingw* | *cegcc* | *os2*)
81363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # No point in relinking DLLs because paths are not encoded
8137da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append notinst_deplibs " $lib"
81383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      need_relink=no
81393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
81403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
814115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test no = "$installed"; then
8142da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append notinst_deplibs " $lib"
81433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      need_relink=yes
81443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
81453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
81463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
81473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # This is a shared library
81483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
81493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Warn about portability, can't link against -module's on some
81503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # systems (darwin).  Don't bleat about dlopened modules though!
815115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  dlopenmodule=
81523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for dlpremoduletest in $dlprefiles; do
81533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test "X$dlpremoduletest" = "X$lib"; then
815415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      dlopenmodule=$dlpremoduletest
81553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      break
81563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
81573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
815815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
815998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo
816015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test prog = "$linkmode"; then
81613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
81623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
81633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
81643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
81653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $ECHO "*** $linklib is not portable!"
81663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
816715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test lib = "$linkmode" &&
816815f2201421a23fbf95840adf524cfdb4db384b85Cristy	     test yes = "$hardcode_into_libs"; then
81693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Hardcode the library path.
81703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Skip directories that are in the system default run-time
81713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # search path.
81723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case " $sys_lib_dlsearch_path " in
81733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $absdir "*) ;;
81743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *)
81753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case "$compile_rpath " in
81763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $absdir "*) ;;
8177da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append compile_rpath " $absdir" ;;
81783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
81793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
81803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
81813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case " $sys_lib_dlsearch_path " in
81823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $libdir "*) ;;
81833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *)
81843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case "$finalize_rpath " in
81853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $libdir "*) ;;
8186da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append finalize_rpath " $libdir" ;;
81873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
81883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
81893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
81903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
81913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
81923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$old_archive_from_expsyms_cmds"; then
81933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # figure out the soname
81943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    set dummy $library_names
81953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    shift
819615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    realname=$1
81973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    shift
81983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    libname=`eval "\\$ECHO \"$libname_spec\""`
81993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # use dlname if we got it. it's perfectly good, no?
82003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$dlname"; then
820115f2201421a23fbf95840adf524cfdb4db384b85Cristy	      soname=$dlname
82023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    elif test -n "$soname_spec"; then
82033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # bleh windows
82043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $host in
820515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      *cygwin* | mingw* | *cegcc* | *os2*)
82063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        func_arith $current - $age
82073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		major=$func_arith_result
820815f2201421a23fbf95840adf524cfdb4db384b85Cristy		versuffix=-$major
82093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
82103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
82113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      eval soname=\"$soname_spec\"
82123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
821315f2201421a23fbf95840adf524cfdb4db384b85Cristy	      soname=$realname
82143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
82153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
82163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Make a new name for the extract_expsyms_cmds to use
821715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    soroot=$soname
82183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_basename "$soroot"
821915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    soname=$func_basename_result
82203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_stripname 'lib' '.dll' "$soname"
82213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    newlib=libimp-$func_stripname_result.a
82223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
82233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # If the library has no export list, then create one now
82243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -f "$output_objdir/$soname-def"; then :
82253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
822615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_verbose "extracting exported symbol list from '$soname'"
82273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
82283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
82293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
82303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Create $newlib
82313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -f "$output_objdir/$newlib"; then :; else
823215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_verbose "generating import library for '$soname'"
82333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
82343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
82353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # make sure the library variables are pointing to the new library
82363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    dir=$output_objdir
82373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    linklib=$newlib
82383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi # test -n "$old_archive_from_expsyms_cmds"
82393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
824015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test prog = "$linkmode" || test relink != "$opt_mode"; then
82413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    add_shlibpath=
82423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    add_dir=
82433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    add=
82443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    lib_linked=yes
82453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case $hardcode_action in
82463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    immediate | unsupported)
824715f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test no = "$hardcode_direct"; then
824815f2201421a23fbf95840adf524cfdb4db384b85Cristy		add=$dir/$linklib
82493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case $host in
825015f2201421a23fbf95840adf524cfdb4db384b85Cristy		  *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
825115f2201421a23fbf95840adf524cfdb4db384b85Cristy		  *-*-sysv4*uw2*) add_dir=-L$dir ;;
82523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
825315f2201421a23fbf95840adf524cfdb4db384b85Cristy		    *-*-unixware7*) add_dir=-L$dir ;;
82543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  *-*-darwin* )
825515f2201421a23fbf95840adf524cfdb4db384b85Cristy		    # if the lib is a (non-dlopened) module then we cannot
82563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    # link against it, someone is ignoring the earlier warnings
82573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    if /usr/bin/file -L $add 2> /dev/null |
825815f2201421a23fbf95840adf524cfdb4db384b85Cristy			 $GREP ": [^:]* bundle" >/dev/null; then
82593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      if test "X$dlopenmodule" != "X$lib"; then
82603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
826115f2201421a23fbf95840adf524cfdb4db384b85Cristy			if test -z "$old_library"; then
826298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy			  echo
826398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy			  echo "*** And there doesn't seem to be a static archive available"
826498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy			  echo "*** The link will probably fail, sorry"
82653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			else
826615f2201421a23fbf95840adf524cfdb4db384b85Cristy			  add=$dir/$old_library
82673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			fi
82683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      elif test -n "$old_library"; then
826915f2201421a23fbf95840adf524cfdb4db384b85Cristy			add=$dir/$old_library
82703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      fi
82713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    fi
82723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
827315f2201421a23fbf95840adf524cfdb4db384b85Cristy	      elif test no = "$hardcode_minus_L"; then
82743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case $host in
827515f2201421a23fbf95840adf524cfdb4db384b85Cristy		*-*-sunos*) add_shlibpath=$dir ;;
82763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
827715f2201421a23fbf95840adf524cfdb4db384b85Cristy		add_dir=-L$dir
827815f2201421a23fbf95840adf524cfdb4db384b85Cristy		add=-l$name
827915f2201421a23fbf95840adf524cfdb4db384b85Cristy	      elif test no = "$hardcode_shlibpath_var"; then
828015f2201421a23fbf95840adf524cfdb4db384b85Cristy		add_shlibpath=$dir
828115f2201421a23fbf95840adf524cfdb4db384b85Cristy		add=-l$name
82823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
82833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		lib_linked=no
82843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
82853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
82863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    relink)
828715f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test yes = "$hardcode_direct" &&
828815f2201421a23fbf95840adf524cfdb4db384b85Cristy	         test no = "$hardcode_direct_absolute"; then
828915f2201421a23fbf95840adf524cfdb4db384b85Cristy		add=$dir/$linklib
829015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      elif test yes = "$hardcode_minus_L"; then
829115f2201421a23fbf95840adf524cfdb4db384b85Cristy		add_dir=-L$absdir
82923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# Try looking first in the location we're being installed to.
82933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		if test -n "$inst_prefix_dir"; then
82943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  case $libdir in
82953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    [\\/]*)
8296da16f16767eb31921af855f17bda465fffc4e000cristy		      func_append add_dir " -L$inst_prefix_dir$libdir"
82973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      ;;
82983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  esac
82993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
830015f2201421a23fbf95840adf524cfdb4db384b85Cristy		add=-l$name
830115f2201421a23fbf95840adf524cfdb4db384b85Cristy	      elif test yes = "$hardcode_shlibpath_var"; then
830215f2201421a23fbf95840adf524cfdb4db384b85Cristy		add_shlibpath=$dir
830315f2201421a23fbf95840adf524cfdb4db384b85Cristy		add=-l$name
83043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
83053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		lib_linked=no
83063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
83073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
83083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *) lib_linked=no ;;
83093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
83103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
831115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes != "$lib_linked"; then
83123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_fatal_configuration "unsupported hardcode properties"
83133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
83143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
83153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$add_shlibpath"; then
83163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case :$compile_shlibpath: in
83173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *":$add_shlibpath:"*) ;;
8318da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
83193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
83203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
832115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test prog = "$linkmode"; then
83223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
83233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
83243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
83253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
83263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -n "$add" && deplibs="$add $deplibs"
832715f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test yes != "$hardcode_direct" &&
832815f2201421a23fbf95840adf524cfdb4db384b85Cristy		 test yes != "$hardcode_minus_L" &&
832915f2201421a23fbf95840adf524cfdb4db384b85Cristy		 test yes = "$hardcode_shlibpath_var"; then
83303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case :$finalize_shlibpath: in
83313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*":$libdir:"*) ;;
8332da16f16767eb31921af855f17bda465fffc4e000cristy		*) func_append finalize_shlibpath "$libdir:" ;;
83333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
83343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
83353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
83363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
83373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
833815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test prog = "$linkmode" || test relink = "$opt_mode"; then
83393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    add_shlibpath=
83403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    add_dir=
83413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    add=
83423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Finalize command for both is simple: just hardcode it.
834315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes = "$hardcode_direct" &&
834415f2201421a23fbf95840adf524cfdb4db384b85Cristy	       test no = "$hardcode_direct_absolute"; then
834515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      add=$libdir/$linklib
834615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    elif test yes = "$hardcode_minus_L"; then
834715f2201421a23fbf95840adf524cfdb4db384b85Cristy	      add_dir=-L$libdir
834815f2201421a23fbf95840adf524cfdb4db384b85Cristy	      add=-l$name
834915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    elif test yes = "$hardcode_shlibpath_var"; then
83503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case :$finalize_shlibpath: in
83513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *":$libdir:"*) ;;
8352da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append finalize_shlibpath "$libdir:" ;;
83533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
835415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      add=-l$name
835515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    elif test yes = "$hardcode_automatic"; then
83563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if test -n "$inst_prefix_dir" &&
835715f2201421a23fbf95840adf524cfdb4db384b85Cristy		 test -f "$inst_prefix_dir$libdir/$linklib"; then
835815f2201421a23fbf95840adf524cfdb4db384b85Cristy		add=$inst_prefix_dir$libdir/$linklib
83593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
836015f2201421a23fbf95840adf524cfdb4db384b85Cristy		add=$libdir/$linklib
83613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
83623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
83633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # We cannot seem to hardcode it, guess we'll fake it.
836415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      add_dir=-L$libdir
83653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Try looking first in the location we're being installed to.
83663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if test -n "$inst_prefix_dir"; then
83673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case $libdir in
83683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  [\\/]*)
8369da16f16767eb31921af855f17bda465fffc4e000cristy		    func_append add_dir " -L$inst_prefix_dir$libdir"
83703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    ;;
83713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
83723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
837315f2201421a23fbf95840adf524cfdb4db384b85Cristy	      add=-l$name
83743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
83753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
837615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test prog = "$linkmode"; then
83773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
83783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
83793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
83803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
83813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -n "$add" && deplibs="$add $deplibs"
83823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
83833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
838415f2201421a23fbf95840adf524cfdb4db384b85Cristy	elif test prog = "$linkmode"; then
83853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Here we assume that one of hardcode_direct or hardcode_minus_L
83863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # is not unsupported.  This is valid on all known static and
83873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # shared platforms.
838815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test unsupported != "$hardcode_direct"; then
838915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    test -n "$old_library" && linklib=$old_library
83903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    compile_deplibs="$dir/$linklib $compile_deplibs"
83913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
83923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
83933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    compile_deplibs="-l$name -L$dir $compile_deplibs"
83943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
83953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
839615f2201421a23fbf95840adf524cfdb4db384b85Cristy	elif test yes = "$build_libtool_libs"; then
83973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Not a shared library
839815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test pass_all != "$deplibs_check_method"; then
83993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # We're trying link a shared library against a static one
84003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # but the system doesn't support it.
84013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
84023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Just print a warning and add the library to dependency_libs so
84033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # that the program can be linked against the static library.
840498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo
840515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    $ECHO "*** Warning: This system cannot link to static lib archive $lib."
840698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** I have the capability to make that library automatically link in when"
840798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** you link to this library.  But I can only do this if you have a"
840898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** shared version of the library, which you do not appear to have."
840915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes = "$module"; then
841098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** But as you try to build a module library, libtool will still create "
841198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** a static module, that should work as long as the dlopening application"
841298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
84133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if test -z "$global_symbol_pipe"; then
841498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo
841598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** However, this would only work if libtool was able to extract symbol"
841615f2201421a23fbf95840adf524cfdb4db384b85Cristy		echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
841798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** not find such a program.  So, this module is probably useless."
841815f2201421a23fbf95840adf524cfdb4db384b85Cristy		echo "*** 'nm' from GNU binutils and a full rebuild may help."
84193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
842015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test no = "$build_old_libs"; then
84213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		build_libtool_libs=module
84223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		build_old_libs=yes
84233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
84243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		build_libtool_libs=no
84253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
84263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
84273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
84283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    deplibs="$dir/$old_library $deplibs"
84293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    link_static=yes
84303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
84313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi # link shared/static library?
84323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
843315f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test lib = "$linkmode"; then
84343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$dependency_libs" &&
843515f2201421a23fbf95840adf524cfdb4db384b85Cristy	     { test yes != "$hardcode_into_libs" ||
843615f2201421a23fbf95840adf524cfdb4db384b85Cristy	       test yes = "$build_old_libs" ||
843715f2201421a23fbf95840adf524cfdb4db384b85Cristy	       test yes = "$link_static"; }; then
84383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Extract -R from dependency_libs
84393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    temp_deplibs=
84403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for libdir in $dependency_libs; do
84413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $libdir in
84423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      -R*) func_stripname '-R' '' "$libdir"
84433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	           temp_xrpath=$func_stripname_result
84443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		   case " $xrpath " in
84453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		   *" $temp_xrpath "*) ;;
8446da16f16767eb31921af855f17bda465fffc4e000cristy		   *) func_append xrpath " $temp_xrpath";;
84473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		   esac;;
8448da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append temp_deplibs " $libdir";;
84493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
84503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
845115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dependency_libs=$temp_deplibs
84523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
84533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
8454da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append newlib_search_path " $absdir"
84553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Link against this library
845615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
84573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # ... and its dependency_libs
84583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  tmp_libs=
84593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for deplib in $dependency_libs; do
84603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    newdependency_libs="$deplib $newdependency_libs"
8461da16f16767eb31921af855f17bda465fffc4e000cristy	    case $deplib in
8462da16f16767eb31921af855f17bda465fffc4e000cristy              -L*) func_stripname '-L' '' "$deplib"
8463da16f16767eb31921af855f17bda465fffc4e000cristy                   func_resolve_sysroot "$func_stripname_result";;
8464da16f16767eb31921af855f17bda465fffc4e000cristy              *) func_resolve_sysroot "$deplib" ;;
8465da16f16767eb31921af855f17bda465fffc4e000cristy            esac
846615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if $opt_preserve_dup_deps; then
84673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case "$tmp_libs " in
8468da16f16767eb31921af855f17bda465fffc4e000cristy	      *" $func_resolve_sysroot_result "*)
8469da16f16767eb31921af855f17bda465fffc4e000cristy                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
84703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
84713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
8472da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append tmp_libs " $func_resolve_sysroot_result"
84733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
84743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
847515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test no != "$link_all_deplibs"; then
84763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Add the search paths of all dependency libraries
84773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for deplib in $dependency_libs; do
847898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      path=
84793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $deplib in
848015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      -L*) path=$deplib ;;
84813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *.la)
8482da16f16767eb31921af855f17bda465fffc4e000cristy	        func_resolve_sysroot "$deplib"
8483da16f16767eb31921af855f17bda465fffc4e000cristy	        deplib=$func_resolve_sysroot_result
84843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        func_dirname "$deplib" "" "."
8485da16f16767eb31921af855f17bda465fffc4e000cristy		dir=$func_dirname_result
84863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# We need an absolute path.
84873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case $dir in
848815f2201421a23fbf95840adf524cfdb4db384b85Cristy		[\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
84893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*)
84903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  absdir=`cd "$dir" && pwd`
84913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  if test -z "$absdir"; then
849215f2201421a23fbf95840adf524cfdb4db384b85Cristy		    func_warning "cannot determine absolute directory name of '$dir'"
849315f2201421a23fbf95840adf524cfdb4db384b85Cristy		    absdir=$dir
84943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
84953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  ;;
84963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
84973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		if $GREP "^installed=no" $deplib > /dev/null; then
84983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case $host in
84993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*-*-darwin*)
85003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  depdepl=
850115f2201421a23fbf95840adf524cfdb4db384b85Cristy		  eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
850215f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test -n "$deplibrary_names"; then
850315f2201421a23fbf95840adf524cfdb4db384b85Cristy		    for tmp in $deplibrary_names; do
85043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      depdepl=$tmp
85053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    done
850615f2201421a23fbf95840adf524cfdb4db384b85Cristy		    if test -f "$absdir/$objdir/$depdepl"; then
850715f2201421a23fbf95840adf524cfdb4db384b85Cristy		      depdepl=$absdir/$objdir/$depdepl
850815f2201421a23fbf95840adf524cfdb4db384b85Cristy		      darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
85093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                      if test -z "$darwin_install_name"; then
851015f2201421a23fbf95840adf524cfdb4db384b85Cristy                          darwin_install_name=`$OTOOL64 -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
85113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy                      fi
851215f2201421a23fbf95840adf524cfdb4db384b85Cristy		      func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
851315f2201421a23fbf95840adf524cfdb4db384b85Cristy		      func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
85143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      path=
85153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    fi
85163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
85173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  ;;
85183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*)
851915f2201421a23fbf95840adf524cfdb4db384b85Cristy		  path=-L$absdir/$objdir
85203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  ;;
85213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
85223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		else
852315f2201421a23fbf95840adf524cfdb4db384b85Cristy		  eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
85243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  test -z "$libdir" && \
852515f2201421a23fbf95840adf524cfdb4db384b85Cristy		    func_fatal_error "'$deplib' is not a valid libtool archive"
85263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  test "$absdir" != "$libdir" && \
852715f2201421a23fbf95840adf524cfdb4db384b85Cristy		    func_warning "'$deplib' seems to be moved"
85283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
852915f2201421a23fbf95840adf524cfdb4db384b85Cristy		  path=-L$absdir
85303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
85313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
85323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
85333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case " $deplibs " in
85343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $path "*) ;;
85353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *) deplibs="$path $deplibs" ;;
85363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
85373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
85383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi # link_all_deplibs != no
85393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi # linkmode = lib
85403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done # for deplib in $libs
854115f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test link = "$pass"; then
854215f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test prog = "$linkmode"; then
85433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
85443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
85453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
854698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
85473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
85483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
854915f2201421a23fbf95840adf524cfdb4db384b85Cristy      dependency_libs=$newdependency_libs
855015f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test dlpreopen = "$pass"; then
85513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Link the dlpreopened libraries before other libraries
85523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for deplib in $save_deplibs; do
85533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  deplibs="$deplib $deplibs"
85543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
85553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
855615f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test dlopen != "$pass"; then
855715f2201421a23fbf95840adf524cfdb4db384b85Cristy	test conv = "$pass" || {
85583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Make sure lib_search_path contains only unique directories.
85593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  lib_search_path=
85603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for dir in $newlib_search_path; do
85613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case "$lib_search_path " in
85623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $dir "*) ;;
8563da16f16767eb31921af855f17bda465fffc4e000cristy	    *) func_append lib_search_path " $dir" ;;
85643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
85653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
85663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  newlib_search_path=
856715f2201421a23fbf95840adf524cfdb4db384b85Cristy	}
85683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
856915f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test prog,link = "$linkmode,$pass"; then
85703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  vars="compile_deplibs finalize_deplibs"
857115f2201421a23fbf95840adf524cfdb4db384b85Cristy	else
857215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  vars=deplibs
85733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
85743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for var in $vars dependency_libs; do
85753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Add libraries to $var in reverse order
85763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval tmp_libs=\"\$$var\"
85773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  new_libs=
85783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for deplib in $tmp_libs; do
85793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # FIXME: Pedantically, this is the right thing to do, so
85803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    #        that some nasty dependency loop isn't accidentally
85813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    #        broken:
85823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    #new_libs="$deplib $new_libs"
85833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Pragmatically, this seems to cause very few problems in
85843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # practice:
85853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case $deplib in
85863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    -L*) new_libs="$deplib $new_libs" ;;
85873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    -R*) ;;
85883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *)
85893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # And here is the reason: when a library appears more
85903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # than once as an explicit dependence of a library, or
85913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # is implicitly linked in more than once by the
85923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # compiler, it is considered special, and multiple
85933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # occurrences thereof are not removed.  Compare this
85943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # with having the same library being listed as a
85953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # dependency of multiple other libraries: in this case,
85963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # we know (pedantically, we assume) the library does not
85973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # need to be listed more than once, so we keep only the
85983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # last copy.  This is not always right, but it is rare
85993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # enough that we require users that really mean to play
86003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # such unportable linking tricks to link the library
86013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # using -Wl,-lname, so that libtool does not consider it
86023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # for duplicate removal.
86033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case " $specialdeplibs " in
86043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
86053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *)
86063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case " $new_libs " in
86073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*" $deplib "*) ;;
86083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*) new_libs="$deplib $new_libs" ;;
86093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
86103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
86113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
86123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
86133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
86143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
86153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  tmp_libs=
86163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for deplib in $new_libs; do
86173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case $deplib in
86183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    -L*)
86193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case " $tmp_libs " in
86203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $deplib "*) ;;
8621da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append tmp_libs " $deplib" ;;
86223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
86233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
8624da16f16767eb31921af855f17bda465fffc4e000cristy	    *) func_append tmp_libs " $deplib" ;;
86253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
86263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
86273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval $var=\"$tmp_libs\"
86283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done # for var
86293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
863015f2201421a23fbf95840adf524cfdb4db384b85Cristy
863115f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Add Sun CC postdeps if required:
863215f2201421a23fbf95840adf524cfdb4db384b85Cristy      test CXX = "$tagname" && {
863315f2201421a23fbf95840adf524cfdb4db384b85Cristy        case $host_os in
863415f2201421a23fbf95840adf524cfdb4db384b85Cristy        linux*)
863515f2201421a23fbf95840adf524cfdb4db384b85Cristy          case `$CC -V 2>&1 | sed 5q` in
863615f2201421a23fbf95840adf524cfdb4db384b85Cristy          *Sun\ C*) # Sun C++ 5.9
863715f2201421a23fbf95840adf524cfdb4db384b85Cristy            func_suncc_cstd_abi
863815f2201421a23fbf95840adf524cfdb4db384b85Cristy
863915f2201421a23fbf95840adf524cfdb4db384b85Cristy            if test no != "$suncc_use_cstd_abi"; then
864015f2201421a23fbf95840adf524cfdb4db384b85Cristy              func_append postdeps ' -library=Cstd -library=Crun'
864115f2201421a23fbf95840adf524cfdb4db384b85Cristy            fi
864215f2201421a23fbf95840adf524cfdb4db384b85Cristy            ;;
864315f2201421a23fbf95840adf524cfdb4db384b85Cristy          esac
864415f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
864515f2201421a23fbf95840adf524cfdb4db384b85Cristy
864615f2201421a23fbf95840adf524cfdb4db384b85Cristy        solaris*)
864715f2201421a23fbf95840adf524cfdb4db384b85Cristy          func_cc_basename "$CC"
864815f2201421a23fbf95840adf524cfdb4db384b85Cristy          case $func_cc_basename_result in
864915f2201421a23fbf95840adf524cfdb4db384b85Cristy          CC* | sunCC*)
865015f2201421a23fbf95840adf524cfdb4db384b85Cristy            func_suncc_cstd_abi
865115f2201421a23fbf95840adf524cfdb4db384b85Cristy
865215f2201421a23fbf95840adf524cfdb4db384b85Cristy            if test no != "$suncc_use_cstd_abi"; then
865315f2201421a23fbf95840adf524cfdb4db384b85Cristy              func_append postdeps ' -library=Cstd -library=Crun'
865415f2201421a23fbf95840adf524cfdb4db384b85Cristy            fi
865515f2201421a23fbf95840adf524cfdb4db384b85Cristy            ;;
865615f2201421a23fbf95840adf524cfdb4db384b85Cristy          esac
865715f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
865815f2201421a23fbf95840adf524cfdb4db384b85Cristy        esac
865915f2201421a23fbf95840adf524cfdb4db384b85Cristy      }
866015f2201421a23fbf95840adf524cfdb4db384b85Cristy
86613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Last step: remove runtime libs from dependency_libs
86623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # (they stay in deplibs)
86633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      tmp_libs=
866415f2201421a23fbf95840adf524cfdb4db384b85Cristy      for i in $dependency_libs; do
86653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case " $predeps $postdeps $compiler_lib_search_path " in
86663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*" $i "*)
866715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  i=
86683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
86693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
867015f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test -n "$i"; then
8671da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append tmp_libs " $i"
86723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
86733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
86743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      dependency_libs=$tmp_libs
86753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done # for pass
867615f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test prog = "$linkmode"; then
867715f2201421a23fbf95840adf524cfdb4db384b85Cristy      dlfiles=$newdlfiles
86783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
867915f2201421a23fbf95840adf524cfdb4db384b85Cristy    if test prog = "$linkmode" || test lib = "$linkmode"; then
868015f2201421a23fbf95840adf524cfdb4db384b85Cristy      dlprefiles=$newdlprefiles
86813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    fi
86823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
86833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $linkmode in
86843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    oldlib)
868515f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
868615f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-dlopen' is ignored for archives"
86873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
86883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
86893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case " $deplibs" in
86903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *\ -l* | *\ -L*)
869115f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-l' and '-L' are ignored for archives" ;;
86923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
86933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
86943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$rpath" && \
869515f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-rpath' is ignored for archives"
86963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
86973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$xrpath" && \
869815f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-R' is ignored for archives"
86993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$vinfo" && \
870115f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-version-info/-version-number' is ignored for archives"
87023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$release" && \
870415f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-release' is ignored for archives"
87053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$export_symbols$export_symbols_regex" && \
870715f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-export-symbols' is ignored for archives"
87083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Now set the variables for building old libraries.
87103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      build_libtool_libs=no
871115f2201421a23fbf95840adf524cfdb4db384b85Cristy      oldlibs=$output
8712da16f16767eb31921af855f17bda465fffc4e000cristy      func_append objs "$old_deplibs"
87133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
87143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    lib)
871615f2201421a23fbf95840adf524cfdb4db384b85Cristy      # Make sure we only generate libraries of the form 'libNAME.la'.
87173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $outputname in
87183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      lib*)
87193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_stripname 'lib' '.la' "$outputname"
87203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	name=$func_stripname_result
87213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval shared_ext=\"$shrext_cmds\"
87223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval libname=\"$libname_spec\"
87233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
87243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
872515f2201421a23fbf95840adf524cfdb4db384b85Cristy	test no = "$module" \
872615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  && func_fatal_help "libtool library '$output' must begin with 'lib'"
87273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
872815f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test no != "$need_lib_prefix"; then
87293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Add the "lib" prefix for modules if required
87303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_stripname '' '.la' "$outputname"
87313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  name=$func_stripname_result
87323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval shared_ext=\"$shrext_cmds\"
87333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval libname=\"$libname_spec\"
87343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
87353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_stripname '' '.la' "$outputname"
87363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  libname=$func_stripname_result
87373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
87383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
87393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
87403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$objs"; then
874215f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test pass_all != "$deplibs_check_method"; then
874315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
87443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
874598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  echo
87463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
87473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $ECHO "*** objects $objs is not portable!"
8748da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append libobjs " $objs"
87493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
87503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
87513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
875215f2201421a23fbf95840adf524cfdb4db384b85Cristy      test no = "$dlself" \
875315f2201421a23fbf95840adf524cfdb4db384b85Cristy	|| func_warning "'-dlopen self' is ignored for libtool libraries"
87543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      set dummy $rpath
87563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      shift
875715f2201421a23fbf95840adf524cfdb4db384b85Cristy      test 1 -lt "$#" \
875815f2201421a23fbf95840adf524cfdb4db384b85Cristy	&& func_warning "ignoring multiple '-rpath's for a libtool library"
87593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
876015f2201421a23fbf95840adf524cfdb4db384b85Cristy      install_libdir=$1
87613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      oldlibs=
87633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -z "$rpath"; then
876415f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$build_libtool_libs"; then
87653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Building a libtool convenience library.
876615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # Some compilers have problems with a '.al' extension so
87673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # convenience libraries should have the same extension an
87683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # archive normally would.
87693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
87703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  build_libtool_libs=convenience
87713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  build_old_libs=yes
87723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
87733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	test -n "$vinfo" && \
877515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_warning "'-version-info/-version-number' is ignored for convenience libraries"
87763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	test -n "$release" && \
877815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_warning "'-release' is ignored for convenience libraries"
87793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
87803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Parse the version information argument.
878215f2201421a23fbf95840adf524cfdb4db384b85Cristy	save_ifs=$IFS; IFS=:
87833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	set dummy $vinfo 0 0 0
87843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	shift
878515f2201421a23fbf95840adf524cfdb4db384b85Cristy	IFS=$save_ifs
87863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	test -n "$7" && \
878815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_help "too many parameters to '-version-info'"
87893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# convert absolute version numbers to libtool ages
87913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# this retains compatibility with .la files and attempts
87923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# to make the code below a bit more comprehensible
87933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
87943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $vinfo_number in
87953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	yes)
879615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  number_major=$1
879715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  number_minor=$2
879815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  number_revision=$3
87993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  #
88003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # There are really only two kinds -- those that
88013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # use the current revision as the major version
88023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # and those that subtract age and use age as
88033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # a minor version.  But, then there is irix
880415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # that has an extra 1 added just for fun
88053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  #
88063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $version_type in
88072542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	  # correct linux to gnu/linux during the next big refactor
880815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  darwin|freebsd-elf|linux|osf|windows|none)
88093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_arith $number_major + $number_minor
88103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    current=$func_arith_result
881115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    age=$number_minor
881215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    revision=$number_revision
88133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
881415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  freebsd-aout|qnx|sunos)
881515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    current=$number_major
881615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    revision=$number_minor
881715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    age=0
88183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
88193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  irix|nonstopux)
88203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_arith $number_major + $number_minor
88213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    current=$func_arith_result
882215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    age=$number_minor
882315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    revision=$number_minor
88243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    lt_irix_increment=no
88253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
88263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
88273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
88283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	no)
882915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  current=$1
883015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  revision=$2
883115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  age=$3
88323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
88333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
88343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
88353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Check that each of the things are valid numbers.
88363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $current in
88373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	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]) ;;
88383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
883915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_error "CURRENT '$current' must be a nonnegative integer"
884015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_error "'$vinfo' is not valid version information"
88413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
88423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
88433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
88443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $revision in
88453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	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]) ;;
88463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
884715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_error "REVISION '$revision' must be a nonnegative integer"
884815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_error "'$vinfo' is not valid version information"
88493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
88503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
88513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
88523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $age in
88533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	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]) ;;
88543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
885515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_error "AGE '$age' must be a nonnegative integer"
885615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_error "'$vinfo' is not valid version information"
88573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
88583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
88593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
88603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test "$age" -gt "$current"; then
886115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_error "AGE '$age' is greater than the current interface number '$current'"
886215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_error "'$vinfo' is not valid version information"
88633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
88643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
88653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Calculate the version variables.
88663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	major=
88673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	versuffix=
88683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	verstring=
88693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $version_type in
88703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	none) ;;
88713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
88723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	darwin)
88733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Like Linux, but with the current version available in
88743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # verstring for coding it into the library header
88753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_arith $current - $age
88763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  major=.$func_arith_result
887715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=$major.$age.$revision
88783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Darwin ld doesn't like 0 for these options...
88793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_arith $current + 1
88803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  minor_current=$func_arith_result
888115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
88823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
888315f2201421a23fbf95840adf524cfdb4db384b85Cristy          # On Darwin other compilers
888415f2201421a23fbf95840adf524cfdb4db384b85Cristy          case $CC in
888515f2201421a23fbf95840adf524cfdb4db384b85Cristy              nagfor*)
888615f2201421a23fbf95840adf524cfdb4db384b85Cristy                  verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
888715f2201421a23fbf95840adf524cfdb4db384b85Cristy                  ;;
888815f2201421a23fbf95840adf524cfdb4db384b85Cristy              *)
888915f2201421a23fbf95840adf524cfdb4db384b85Cristy                  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
889015f2201421a23fbf95840adf524cfdb4db384b85Cristy                  ;;
889115f2201421a23fbf95840adf524cfdb4db384b85Cristy          esac
88923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
88933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
88943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	freebsd-aout)
889515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  major=.$current
889615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=.$current.$revision
88973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
88983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
88993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	freebsd-elf)
890015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_arith $current - $age
890115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  major=.$func_arith_result
890215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=$major.$age.$revision
89033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
89043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	irix | nonstopux)
890615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test no = "$lt_irix_increment"; then
89073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_arith $current - $age
89083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
89093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_arith $current - $age + 1
89103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
89113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  major=$func_arith_result
89123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $version_type in
89143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    nonstopux) verstring_prefix=nonstopux ;;
89153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *)         verstring_prefix=sgi ;;
89163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
891715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  verstring=$verstring_prefix$major.$revision
89183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Add in all the interfaces that we are compatible with.
89203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  loop=$revision
892115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  while test 0 -ne "$loop"; do
89223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_arith $revision - $loop
89233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    iface=$func_arith_result
89243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_arith $loop - 1
89253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    loop=$func_arith_result
892615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    verstring=$verstring_prefix$major.$iface:$verstring
89273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
89283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
892915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # Before this point, $major must not contain '.'.
89303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  major=.$major
893115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=$major.$revision
89323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
89333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89342542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	linux) # correct to gnu/linux during the next big refactor
89353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_arith $current - $age
89363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  major=.$func_arith_result
893715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=$major.$age.$revision
89383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
89393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	osf)
89413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_arith $current - $age
89423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  major=.$func_arith_result
894315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=.$current.$age.$revision
894415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  verstring=$current.$age.$revision
89453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Add in all the interfaces that we are compatible with.
89473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  loop=$age
894815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  while test 0 -ne "$loop"; do
89493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_arith $current - $loop
89503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    iface=$func_arith_result
89513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_arith $loop - 1
89523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    loop=$func_arith_result
895315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    verstring=$verstring:$iface.0
89543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
89553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Make executables depend on our current version.
895715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_append verstring ":$current.0"
89583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
89593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	qnx)
896115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  major=.$current
896215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=.$current
896315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  ;;
896415f2201421a23fbf95840adf524cfdb4db384b85Cristy
896515f2201421a23fbf95840adf524cfdb4db384b85Cristy	sco)
896615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  major=.$current
896715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=.$current
89683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
89693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	sunos)
897115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  major=.$current
897215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=.$current.$revision
89733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
89743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	windows)
89763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Use '-' rather than '.', since we only want one
897715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # extension on DOS 8.3 file systems.
89783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_arith $current - $age
89793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  major=$func_arith_result
898015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  versuffix=-$major
89813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
89823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
898415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_configuration "unknown library version type '$version_type'"
89853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
89863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
89873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
89883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Clear the version info if we defaulted, and they specified a release.
89893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -z "$vinfo" && test -n "$release"; then
89903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  major=
89913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $version_type in
89923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  darwin)
89933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # we can't check for "0.0" in archive_cmds due to quoting
89943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # problems, so we reset it completely
89953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    verstring=
89963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
89973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
899815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    verstring=0.0
89993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
90003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
900115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test no = "$need_version"; then
90023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    versuffix=
90033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
900415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    versuffix=.0.0
90053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
90063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
90073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Remove version info from name if versioning should be avoided
900915f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes,no = "$avoid_version,$need_version"; then
90103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  major=
90113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  versuffix=
901215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  verstring=
90133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
90143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Check to see if the archive will have undefined symbols.
901615f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$allow_undefined"; then
901715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test unsupported = "$allow_undefined_flag"; then
901815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes = "$build_old_libs"; then
901915f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_warning "undefined symbols not allowed in $host shared libraries; building static only"
902015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      build_libtool_libs=no
902115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    else
902215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_fatal_error "can't build $host shared library unless -no-undefined is specified"
902315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    fi
90243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
90253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
90263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Don't allow undefined symbols.
902715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  allow_undefined_flag=$no_undefined_flag
90283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
90293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
90313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
903215f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_generate_dlsyms "$libname" "$libname" :
9033da16f16767eb31921af855f17bda465fffc4e000cristy      func_append libobjs " $symfileobj"
903415f2201421a23fbf95840adf524cfdb4db384b85Cristy      test " " = "$libobjs" && libobjs=
90353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
903615f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test relink != "$opt_mode"; then
90373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Remove our outputs, but don't remove object files since they
90383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# may have been created when compiling PIC objects.
90393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	removelist=
90403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	tempremovelist=`$ECHO "$output_objdir/*"`
90413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for p in $tempremovelist; do
90423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $p in
90433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *.$objext | *.gcno)
90443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	       ;;
904515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
904615f2201421a23fbf95840adf524cfdb4db384b85Cristy	       if test -n "$precious_files_regex"; then
90473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
90483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		 then
90493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		   continue
90503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		 fi
90513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	       fi
9052da16f16767eb31921af855f17bda465fffc4e000cristy	       func_append removelist " $p"
90533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	       ;;
90543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *) ;;
90553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
90563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
90573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	test -n "$removelist" && \
90583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_show_eval "${RM}r \$removelist"
90593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
90603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Now set the variables for building old libraries.
906215f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9063da16f16767eb31921af855f17bda465fffc4e000cristy	func_append oldlibs " $output_objdir/$libname.$libext"
90643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Transform .lo files to .o files.
906615f2201421a23fbf95840adf524cfdb4db384b85Cristy	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
90673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
90683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Eliminate all temporary directories.
90703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      #for path in $notinst_path; do
907198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
907298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
907398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
90743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      #done
90753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$xrpath"; then
90773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# If the user specified any rpath flags, then add them.
90783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	temp_xrpath=
90793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for libdir in $xrpath; do
9080da16f16767eb31921af855f17bda465fffc4e000cristy	  func_replace_sysroot "$libdir"
9081da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append temp_xrpath " -R$func_replace_sysroot_result"
90823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case "$finalize_rpath " in
90833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" $libdir "*) ;;
9084da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append finalize_rpath " $libdir" ;;
90853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
90863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
908715f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
90883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  dependency_libs="$temp_xrpath $dependency_libs"
90893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
90903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
90913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
90923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Make sure dlfiles contains only unique files that won't be dlpreopened
909315f2201421a23fbf95840adf524cfdb4db384b85Cristy      old_dlfiles=$dlfiles
90943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      dlfiles=
90953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for lib in $old_dlfiles; do
90963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case " $dlprefiles $dlfiles " in
90973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*" $lib "*) ;;
9098da16f16767eb31921af855f17bda465fffc4e000cristy	*) func_append dlfiles " $lib" ;;
90993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
91003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
91013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
91023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Make sure dlprefiles contains only unique files
910315f2201421a23fbf95840adf524cfdb4db384b85Cristy      old_dlprefiles=$dlprefiles
91043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      dlprefiles=
91053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for lib in $old_dlprefiles; do
91063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case "$dlprefiles " in
91073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*" $lib "*) ;;
9108da16f16767eb31921af855f17bda465fffc4e000cristy	*) func_append dlprefiles " $lib" ;;
91093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
91103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
91113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
911215f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test yes = "$build_libtool_libs"; then
91133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$rpath"; then
91143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $host in
911598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
91163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # these systems don't actually have a c library (as such)!
91173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
91183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-rhapsody* | *-*-darwin1.[012])
91193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Rhapsody C library is in the System framework
9120da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append deplibs " System.ltframework"
91213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
91223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-netbsd*)
91233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Don't link with libc until the a.out ld.so is fixed.
91243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
91253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
91263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Do not include libc due to us having libc/libc_r.
91273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
91283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-sco3.2v5* | *-*-sco5v6*)
91293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Causes problems with __ctype
91303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
91313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
91323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Compiler inserts libc in the correct place for threads to work
91333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
91343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
91353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Add libc to deplibs on all other systems if necessary.
913615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes = "$build_libtool_need_lc"; then
9137da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append deplibs " -lc"
91383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
91393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
91403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
91413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
91423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
91433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Transform deplibs into only deplibs that can be linked in shared.
91443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	name_save=$name
91453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	libname_save=$libname
91463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	release_save=$release
91473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	versuffix_save=$versuffix
91483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	major_save=$major
91493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# I'm not sure if I'm treating the release correctly.  I think
91503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# release should show up in the -l (ie -lgmp5) so we don't want to
91513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# add it in twice.  Is that correct?
915215f2201421a23fbf95840adf524cfdb4db384b85Cristy	release=
915315f2201421a23fbf95840adf524cfdb4db384b85Cristy	versuffix=
915415f2201421a23fbf95840adf524cfdb4db384b85Cristy	major=
91553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	newdeplibs=
91563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	droppeddeps=no
91573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $deplibs_check_method in
91583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	pass_all)
91593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Don't check for shared/static.  Everything works.
91603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # This might be a little naive.  We might want to check
91613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # whether the library exists or not.  But this is on
91623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # osf3 & osf4 and I'm not really sure... Just
91633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # implementing what was already the behavior.
91643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  newdeplibs=$deplibs
91653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
91663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	test_compile)
91673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # This code stresses the "libraries are programs" paradigm to its
91683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # limits. Maybe even breaks it.  We compile a program, linking it
91693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # against the deplibs as a proxy for the library.  Then we can check
91703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # whether they linked in statically or dynamically with ldd.
91713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $opt_dry_run || $RM conftest.c
91723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  cat > conftest.c <<EOF
91733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  int main() { return 0; }
91743ed852eea50f9d4cd633efb8c2b054b8e33c253cristyEOF
91753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $opt_dry_run || $RM conftest
91763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
91773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ldd_output=`ldd conftest`
91783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for i in $deplibs; do
91793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $i in
91803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      -l*)
91813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_stripname -l '' "$i"
91823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		name=$func_stripname_result
918315f2201421a23fbf95840adf524cfdb4db384b85Cristy		if test yes = "$allow_libtool_libs_with_static_runtimes"; then
91843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  case " $predeps $postdeps " in
91853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  *" $i "*)
9186da16f16767eb31921af855f17bda465fffc4e000cristy		    func_append newdeplibs " $i"
918715f2201421a23fbf95840adf524cfdb4db384b85Cristy		    i=
91883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    ;;
91893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  esac
91903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
919115f2201421a23fbf95840adf524cfdb4db384b85Cristy		if test -n "$i"; then
91923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  libname=`eval "\\$ECHO \"$libname_spec\""`
91933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
91943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  set dummy $deplib_matches; shift
91953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  deplib_match=$1
919615f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9197da16f16767eb31921af855f17bda465fffc4e000cristy		    func_append newdeplibs " $i"
91983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  else
91993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    droppeddeps=yes
920098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    echo
92013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
920298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    echo "*** I have the capability to make that library automatically link in when"
920398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    echo "*** you link to this library.  But I can only do this if you have a"
920498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    echo "*** shared version of the library, which I believe you do not have"
920598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    echo "*** because a test_compile did reveal that the linker did not use it for"
920698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
92073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
92083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
92093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
92103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *)
9211da16f16767eb31921af855f17bda465fffc4e000cristy		func_append newdeplibs " $i"
92123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
92133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
92143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
92153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
92163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Error occurred in the first compile.  Let's try to salvage
92173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # the situation: Compile a separate program for each library.
92183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for i in $deplibs; do
92193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $i in
92203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      -l*)
92213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_stripname -l '' "$i"
92223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		name=$func_stripname_result
92233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		$opt_dry_run || $RM conftest
92243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
92253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  ldd_output=`ldd conftest`
922615f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
92273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    case " $predeps $postdeps " in
92283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    *" $i "*)
9229da16f16767eb31921af855f17bda465fffc4e000cristy		      func_append newdeplibs " $i"
923015f2201421a23fbf95840adf524cfdb4db384b85Cristy		      i=
92313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      ;;
92323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    esac
92333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
923415f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test -n "$i"; then
92353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    libname=`eval "\\$ECHO \"$libname_spec\""`
92363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
92373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    set dummy $deplib_matches; shift
92383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    deplib_match=$1
923915f2201421a23fbf95840adf524cfdb4db384b85Cristy		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9240da16f16767eb31921af855f17bda465fffc4e000cristy		      func_append newdeplibs " $i"
92413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    else
92423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      droppeddeps=yes
924398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      echo
92443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
924598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      echo "*** I have the capability to make that library automatically link in when"
924698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      echo "*** you link to this library.  But I can only do this if you have a"
924798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      echo "*** shared version of the library, which you do not appear to have"
924898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      echo "*** because a test_compile did reveal that the linker did not use this one"
924998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
92503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    fi
92513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
92523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		else
92533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  droppeddeps=yes
925498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  echo
92553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
925698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  echo "*** make it link in!  You will probably need to install it or some"
925798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  echo "*** library that it depends on before this library will be fully"
925898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  echo "*** functional.  Installing it before continuing would be even better."
92593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
92603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
92613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *)
9262da16f16767eb31921af855f17bda465fffc4e000cristy		func_append newdeplibs " $i"
92633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
92643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
92653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
92663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
92673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
92683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	file_magic*)
92693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  set dummy $deplibs_check_method; shift
92703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
92713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for a_deplib in $deplibs; do
92723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case $a_deplib in
92733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    -l*)
92743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_stripname -l '' "$a_deplib"
92753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      name=$func_stripname_result
927615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test yes = "$allow_libtool_libs_with_static_runtimes"; then
92773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case " $predeps $postdeps " in
92783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*" $a_deplib "*)
9279da16f16767eb31921af855f17bda465fffc4e000cristy		  func_append newdeplibs " $a_deplib"
928015f2201421a23fbf95840adf524cfdb4db384b85Cristy		  a_deplib=
92813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  ;;
92823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
92833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
928415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test -n "$a_deplib"; then
92853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		libname=`eval "\\$ECHO \"$libname_spec\""`
9286da16f16767eb31921af855f17bda465fffc4e000cristy		if test -n "$file_magic_glob"; then
9287da16f16767eb31921af855f17bda465fffc4e000cristy		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9288da16f16767eb31921af855f17bda465fffc4e000cristy		else
9289da16f16767eb31921af855f17bda465fffc4e000cristy		  libnameglob=$libname
9290da16f16767eb31921af855f17bda465fffc4e000cristy		fi
929115f2201421a23fbf95840adf524cfdb4db384b85Cristy		test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
92923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
929315f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test yes = "$want_nocaseglob"; then
9294da16f16767eb31921af855f17bda465fffc4e000cristy		    shopt -s nocaseglob
9295da16f16767eb31921af855f17bda465fffc4e000cristy		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9296da16f16767eb31921af855f17bda465fffc4e000cristy		    $nocaseglob
9297da16f16767eb31921af855f17bda465fffc4e000cristy		  else
9298da16f16767eb31921af855f17bda465fffc4e000cristy		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9299da16f16767eb31921af855f17bda465fffc4e000cristy		  fi
93003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  for potent_lib in $potential_libs; do
93013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      # Follow soft links.
93023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      if ls -lLd "$potent_lib" 2>/dev/null |
93033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			 $GREP " -> " >/dev/null; then
93043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			continue
93053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      fi
93063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      # The statement above tries to avoid entering an
93073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      # endless loop below, in case of cyclic links.
93083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      # We might still enter an endless loop, since a link
93093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      # loop can be closed while we follow links,
93103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      # but so what?
931115f2201421a23fbf95840adf524cfdb4db384b85Cristy		      potlib=$potent_lib
93123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      while test -h "$potlib" 2>/dev/null; do
931315f2201421a23fbf95840adf524cfdb4db384b85Cristy			potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
93143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			case $potliblink in
931515f2201421a23fbf95840adf524cfdb4db384b85Cristy			[\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
931615f2201421a23fbf95840adf524cfdb4db384b85Cristy			*) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
93173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			esac
93183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      done
93193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
93203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			 $SED -e 10q |
93213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			 $EGREP "$file_magic_regex" > /dev/null; then
9322da16f16767eb31921af855f17bda465fffc4e000cristy			func_append newdeplibs " $a_deplib"
932315f2201421a23fbf95840adf524cfdb4db384b85Cristy			a_deplib=
93243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy			break 2
93253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      fi
93263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  done
93273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		done
93283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
932915f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test -n "$a_deplib"; then
93303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		droppeddeps=yes
933198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo
93323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
933398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** I have the capability to make that library automatically link in when"
933498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** you link to this library.  But I can only do this if you have a"
933598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** shared version of the library, which you do not appear to have"
933698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** because I did check the linker path looking for a file starting"
933715f2201421a23fbf95840adf524cfdb4db384b85Cristy		if test -z "$potlib"; then
93383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
93393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		else
93403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  $ECHO "*** with $libname and none of the candidates passed a file format test"
93413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  $ECHO "*** using a file magic. Last file checked: $potlib"
93423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
93433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
93443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
93453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *)
93463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Add a -L argument.
9347da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append newdeplibs " $a_deplib"
93483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
93493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
93503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done # Gone through all deplibs.
93513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
93523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	match_pattern*)
93533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  set dummy $deplibs_check_method; shift
93543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
93553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for a_deplib in $deplibs; do
93563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case $a_deplib in
93573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    -l*)
93583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_stripname -l '' "$a_deplib"
93593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      name=$func_stripname_result
936015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test yes = "$allow_libtool_libs_with_static_runtimes"; then
93613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case " $predeps $postdeps " in
93623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*" $a_deplib "*)
9363da16f16767eb31921af855f17bda465fffc4e000cristy		  func_append newdeplibs " $a_deplib"
936415f2201421a23fbf95840adf524cfdb4db384b85Cristy		  a_deplib=
93653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  ;;
93663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
93673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
936815f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test -n "$a_deplib"; then
93693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		libname=`eval "\\$ECHO \"$libname_spec\""`
93703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
93713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
93723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  for potent_lib in $potential_libs; do
937315f2201421a23fbf95840adf524cfdb4db384b85Cristy		    potlib=$potent_lib # see symlink-check above in file_magic test
937498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
93753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		       $EGREP "$match_pattern_regex" > /dev/null; then
9376da16f16767eb31921af855f17bda465fffc4e000cristy		      func_append newdeplibs " $a_deplib"
937715f2201421a23fbf95840adf524cfdb4db384b85Cristy		      a_deplib=
93783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		      break 2
93793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    fi
93803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  done
93813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		done
93823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
938315f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test -n "$a_deplib"; then
93843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		droppeddeps=yes
938598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo
93863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
938798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** I have the capability to make that library automatically link in when"
938898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** you link to this library.  But I can only do this if you have a"
938998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** shared version of the library, which you do not appear to have"
939098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		echo "*** because I did check the linker path looking for a file starting"
939115f2201421a23fbf95840adf524cfdb4db384b85Cristy		if test -z "$potlib"; then
93923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
93933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		else
93943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  $ECHO "*** with $libname and none of the candidates passed a file format test"
93953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
93963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
93973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
93983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
93993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *)
94003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Add a -L argument.
9401da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append newdeplibs " $a_deplib"
94023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
94033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
94043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done # Gone through all deplibs.
94053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
94063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	none | unknown | *)
940715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  newdeplibs=
940898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
940915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
941015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    for i in $predeps $postdeps; do
94113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # can't use Xsed below, because $i might contain '/'
941215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
94133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
94143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
941598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  case $tmp_deplibs in
941698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  *[!\	\ ]*)
941798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo
941815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test none = "$deplibs_check_method"; then
941998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** Warning: inter-library dependencies are not supported in this platform."
94203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
942198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** Warning: inter-library dependencies are not known to be supported."
94223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
942398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** All declared inter-library dependencies are being dropped."
94243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    droppeddeps=yes
942598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    ;;
942698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  esac
94273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
94283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
94293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	versuffix=$versuffix_save
94303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	major=$major_save
94313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	release=$release_save
94323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	libname=$libname_save
94333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	name=$name_save
94343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
94353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $host in
94363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*-*-rhapsody* | *-*-darwin1.[012])
94373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # On Rhapsody replace the C library with the System framework
943898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
94393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
94403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
94413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
944215f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$droppeddeps"; then
944315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test yes = "$module"; then
944498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo
944598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** Warning: libtool could not satisfy all declared inter-library"
94463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
944798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** a static module, that should work as long as the dlopening"
944898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** application is linked with the -dlopen flag."
94493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -z "$global_symbol_pipe"; then
945098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo
945198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** However, this would only work if libtool was able to extract symbol"
945215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
945398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** not find such a program.  So, this module is probably useless."
945415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      echo "*** 'nm' from GNU binutils and a full rebuild may help."
94553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
945615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test no = "$build_old_libs"; then
945715f2201421a23fbf95840adf524cfdb4db384b85Cristy	      oldlibs=$output_objdir/$libname.$libext
94583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      build_libtool_libs=module
94593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      build_old_libs=yes
94603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
94613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      build_libtool_libs=no
94623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
94633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
946498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** The inter-library dependencies that have been dropped here will be"
946598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** automatically added whenever a program is linked with this library"
946698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo "*** or is declared to -dlopen it."
94673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
946815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test no = "$allow_undefined"; then
946998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo
947098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** Since this library must not contain undefined symbols,"
947198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** because either the platform does not support them or"
947298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** it was explicitly requested with -no-undefined,"
947398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      echo "*** libtool will only create a static version of it."
947415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test no = "$build_old_libs"; then
947515f2201421a23fbf95840adf524cfdb4db384b85Cristy		oldlibs=$output_objdir/$libname.$libext
94763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		build_libtool_libs=module
94773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		build_old_libs=yes
94783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
94793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		build_libtool_libs=no
94803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
94813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
94823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
94833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
94843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Done checking deplibs!
94853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	deplibs=$newdeplibs
94863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
94873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
94883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $host in
94893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*-*-darwin*)
949098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
949198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
949298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
94933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
94943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
94953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
94963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # move library search paths that coincide with paths to not yet
94973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # installed libraries to the beginning of the library search list
94983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      new_libs=
94993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for path in $notinst_path; do
95003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case " $new_libs " in
95013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*" -L$path/$objdir "*) ;;
95023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
95033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case " $deplibs " in
95043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" -L$path/$objdir "*)
9505da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append new_libs " -L$path/$objdir" ;;
95063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
95073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
95083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
95093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
95103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for deplib in $deplibs; do
95113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $deplib in
95123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-L*)
95133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case " $new_libs " in
95143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" $deplib "*) ;;
9515da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append new_libs " $deplib" ;;
95163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
95173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
9518da16f16767eb31921af855f17bda465fffc4e000cristy	*) func_append new_libs " $deplib" ;;
95193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
95203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
952115f2201421a23fbf95840adf524cfdb4db384b85Cristy      deplibs=$new_libs
95223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
95233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # All the library-specific variables (install_libdir is set above).
95243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      library_names=
95253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      old_library=
95263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      dlname=
95273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
95283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Test again, we may have decided not to build it any more
952915f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test yes = "$build_libtool_libs"; then
953015f2201421a23fbf95840adf524cfdb4db384b85Cristy	# Remove $wl instances when linking with ld.
95312542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	# FIXME: should test the right _cmds variable.
95322542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	case $archive_cmds in
95332542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	  *\$LD\ *) wl= ;;
95342542fc61a973e588b23b3ddac880f01ae6c4c64dcristy        esac
953515f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$hardcode_into_libs"; then
95363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Hardcode the library paths
95373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  hardcode_libdirs=
95383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  dep_rpath=
953915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  rpath=$finalize_rpath
954015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  test relink = "$opt_mode" || rpath=$compile_rpath$rpath
95413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for libdir in $rpath; do
95423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$hardcode_libdir_flag_spec"; then
95433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if test -n "$hardcode_libdir_separator"; then
9544da16f16767eb31921af855f17bda465fffc4e000cristy		func_replace_sysroot "$libdir"
9545da16f16767eb31921af855f17bda465fffc4e000cristy		libdir=$func_replace_sysroot_result
95463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		if test -z "$hardcode_libdirs"; then
954715f2201421a23fbf95840adf524cfdb4db384b85Cristy		  hardcode_libdirs=$libdir
95483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		else
95493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # Just accumulate the unique libdirs.
95503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
95513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
95523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    ;;
95533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  *)
9554da16f16767eb31921af855f17bda465fffc4e000cristy		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
95553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    ;;
95563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  esac
95573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
95583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
95593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		eval flag=\"$hardcode_libdir_flag_spec\"
9560da16f16767eb31921af855f17bda465fffc4e000cristy		func_append dep_rpath " $flag"
95613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
95623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    elif test -n "$runpath_var"; then
95633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case "$perm_rpath " in
95643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *" $libdir "*) ;;
956558606f36a9f2b21edab5871b57124222ec8605d0cristy	      *) func_append perm_rpath " $libdir" ;;
95663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
95673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
95683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
95693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Substitute the hardcoded libdirs into the rpath.
95703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$hardcode_libdir_separator" &&
95713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	     test -n "$hardcode_libdirs"; then
957215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    libdir=$hardcode_libdirs
95732542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
95743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
95753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
95763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # We should set the runpath_var.
95773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    rpath=
95783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for dir in $perm_rpath; do
9579da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append rpath "$dir:"
95803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
95813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
95823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
95833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
95843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
95853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
958615f2201421a23fbf95840adf524cfdb4db384b85Cristy	shlibpath=$finalize_shlibpath
958715f2201421a23fbf95840adf524cfdb4db384b85Cristy	test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
95883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$shlibpath"; then
95893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
95903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
95913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
95923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Get the real and link names of the library.
95933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval shared_ext=\"$shrext_cmds\"
95943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval library_names=\"$library_names_spec\"
95953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	set dummy $library_names
95963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	shift
959715f2201421a23fbf95840adf524cfdb4db384b85Cristy	realname=$1
95983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	shift
95993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
96003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$soname_spec"; then
96013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval soname=\"$soname_spec\"
96023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
960315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  soname=$realname
96043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
96053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -z "$dlname"; then
96063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  dlname=$soname
96073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
96083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
960915f2201421a23fbf95840adf524cfdb4db384b85Cristy	lib=$output_objdir/$realname
96103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	linknames=
96113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for link
96123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	do
9613da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append linknames " $link"
96143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
96153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
96163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Use standard objects if they are pic
961798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
96183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	test "X$libobjs" = "X " && libobjs=
96193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
96203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	delfiles=
96213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$export_symbols" && test -n "$include_expsyms"; then
96223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
962315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  export_symbols=$output_objdir/$libname.uexp
9624da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append delfiles " $export_symbols"
96253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
96263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
96273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	orig_export_symbols=
96283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $host_os in
96293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	cygwin* | mingw* | cegcc*)
96303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
96313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # exporting using user supplied symfile
963215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_dll_def_p "$export_symbols" || {
96333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # and it's NOT already a .def file. Must figure out
96343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # which of the given symbols are data symbols and tag
96353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # them as such. So, trigger use of export_symbols_cmds.
96363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # export_symbols gets reassigned inside the "prepare
96373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # the list of exported symbols" if statement, so the
96383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # include_expsyms logic still works.
963915f2201421a23fbf95840adf524cfdb4db384b85Cristy	      orig_export_symbols=$export_symbols
96403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      export_symbols=
96413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      always_export_symbols=yes
964215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    }
96433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
96443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
96453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
96463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
96473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Prepare the list of exported symbols
96483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -z "$export_symbols"; then
964915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
965015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_verbose "generating symbol list for '$libname.la'"
965115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    export_symbols=$output_objdir/$libname.exp
96523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $opt_dry_run || $RM $export_symbols
96533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cmds=$export_symbols_cmds
965415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    save_ifs=$IFS; IFS='~'
9655da16f16767eb31921af855f17bda465fffc4e000cristy	    for cmd1 in $cmds; do
965615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      IFS=$save_ifs
9657da16f16767eb31921af855f17bda465fffc4e000cristy	      # Take the normal branch if the nm_file_list_spec branch
9658da16f16767eb31921af855f17bda465fffc4e000cristy	      # doesn't work or if tool conversion is not needed.
9659da16f16767eb31921af855f17bda465fffc4e000cristy	      case $nm_file_list_spec~$to_tool_file_cmd in
9660da16f16767eb31921af855f17bda465fffc4e000cristy		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
9661da16f16767eb31921af855f17bda465fffc4e000cristy		  try_normal_branch=yes
9662da16f16767eb31921af855f17bda465fffc4e000cristy		  eval cmd=\"$cmd1\"
9663da16f16767eb31921af855f17bda465fffc4e000cristy		  func_len " $cmd"
9664da16f16767eb31921af855f17bda465fffc4e000cristy		  len=$func_len_result
9665da16f16767eb31921af855f17bda465fffc4e000cristy		  ;;
9666da16f16767eb31921af855f17bda465fffc4e000cristy		*)
9667da16f16767eb31921af855f17bda465fffc4e000cristy		  try_normal_branch=no
9668da16f16767eb31921af855f17bda465fffc4e000cristy		  ;;
9669da16f16767eb31921af855f17bda465fffc4e000cristy	      esac
967015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test yes = "$try_normal_branch" \
9671da16f16767eb31921af855f17bda465fffc4e000cristy		 && { test "$len" -lt "$max_cmd_len" \
9672da16f16767eb31921af855f17bda465fffc4e000cristy		      || test "$max_cmd_len" -le -1; }
9673da16f16767eb31921af855f17bda465fffc4e000cristy	      then
9674da16f16767eb31921af855f17bda465fffc4e000cristy		func_show_eval "$cmd" 'exit $?'
9675da16f16767eb31921af855f17bda465fffc4e000cristy		skipped_export=false
9676da16f16767eb31921af855f17bda465fffc4e000cristy	      elif test -n "$nm_file_list_spec"; then
9677da16f16767eb31921af855f17bda465fffc4e000cristy		func_basename "$output"
9678da16f16767eb31921af855f17bda465fffc4e000cristy		output_la=$func_basename_result
9679da16f16767eb31921af855f17bda465fffc4e000cristy		save_libobjs=$libobjs
9680da16f16767eb31921af855f17bda465fffc4e000cristy		save_output=$output
968115f2201421a23fbf95840adf524cfdb4db384b85Cristy		output=$output_objdir/$output_la.nm
9682da16f16767eb31921af855f17bda465fffc4e000cristy		func_to_tool_file "$output"
9683da16f16767eb31921af855f17bda465fffc4e000cristy		libobjs=$nm_file_list_spec$func_to_tool_file_result
9684da16f16767eb31921af855f17bda465fffc4e000cristy		func_append delfiles " $output"
9685da16f16767eb31921af855f17bda465fffc4e000cristy		func_verbose "creating $NM input file list: $output"
9686da16f16767eb31921af855f17bda465fffc4e000cristy		for obj in $save_libobjs; do
9687da16f16767eb31921af855f17bda465fffc4e000cristy		  func_to_tool_file "$obj"
9688da16f16767eb31921af855f17bda465fffc4e000cristy		  $ECHO "$func_to_tool_file_result"
9689da16f16767eb31921af855f17bda465fffc4e000cristy		done > "$output"
9690da16f16767eb31921af855f17bda465fffc4e000cristy		eval cmd=\"$cmd1\"
96913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_show_eval "$cmd" 'exit $?'
9692da16f16767eb31921af855f17bda465fffc4e000cristy		output=$save_output
9693da16f16767eb31921af855f17bda465fffc4e000cristy		libobjs=$save_libobjs
96943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		skipped_export=false
96953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
96963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# The command line is too long to execute in one step.
96973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_verbose "using reloadable object file for export list..."
96983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		skipped_export=:
96993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# Break out early, otherwise skipped_export may be
97003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# set to false by a later but shorter cmd.
97013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		break
97023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
97033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
970415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    IFS=$save_ifs
970515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
97063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
97073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
97083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
97093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
97103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
97113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
97123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$export_symbols" && test -n "$include_expsyms"; then
971315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  tmp_export_symbols=$export_symbols
971415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
971598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
97163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
97173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
971815f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
97193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # The given exports_symbols file has to be filtered, so filter it.
972015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
97213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
972215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # 's' commands, which not all seds can handle. GNU sed should be fine
97233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # though. Also, the filter scales superlinearly with the number of
97243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # global variables. join(1) would be nice here, but unfortunately
97253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # isn't a blessed tool.
97263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9727da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
97283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  export_symbols=$output_objdir/$libname.def
97293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
97303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
97313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
97323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	tmp_deplibs=
97333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for test_deplib in $deplibs; do
97343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case " $convenience " in
97353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" $test_deplib "*) ;;
97363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *)
9737da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append tmp_deplibs " $test_deplib"
97383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
97393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
97403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
974115f2201421a23fbf95840adf524cfdb4db384b85Cristy	deplibs=$tmp_deplibs
97423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
97433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$convenience"; then
97443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$whole_archive_flag_spec" &&
974515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    test yes = "$compiler_needs_object" &&
97463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    test -z "$libobjs"; then
97473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # extract the archives, so we have objects to list.
97483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # TODO: could optimize this to just extract one archive.
97493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    whole_archive_flag_spec=
97503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
97513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$whole_archive_flag_spec"; then
97523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    save_libobjs=$libobjs
97533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
97543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    test "X$libobjs" = "X " && libobjs=
97553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
975615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    gentop=$output_objdir/${outputname}x
9757da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append generated " $gentop"
97583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
97593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_extract_archives $gentop $convenience
9760da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append libobjs " $func_extract_archives_result"
97613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    test "X$libobjs" = "X " && libobjs=
97623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
97633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
97643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
976515f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
97663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval flag=\"$thread_safe_flag_spec\"
9767da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append linker_flags " $flag"
97683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
97693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
97703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Make a backup of the uninstalled library when relinking
977115f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test relink = "$opt_mode"; then
97723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
97733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
97743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
97753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Do each of the archive commands.
977615f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$module" && test -n "$module_cmds"; then
97773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
97783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval test_cmds=\"$module_expsym_cmds\"
97793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cmds=$module_expsym_cmds
97803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
97813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval test_cmds=\"$module_cmds\"
97823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cmds=$module_cmds
97833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
97843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
97853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
97863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval test_cmds=\"$archive_expsym_cmds\"
97873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cmds=$archive_expsym_cmds
97883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
97893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval test_cmds=\"$archive_cmds\"
97903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    cmds=$archive_cmds
97913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
97923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
97933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
979415f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test : != "$skipped_export" &&
97953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	   func_len " $test_cmds" &&
97963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	   len=$func_len_result &&
97973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
97983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  :
97993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
98003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # The command line is too long to link in one step, link piecewise
98013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # or, if using GNU ld and skipped_export is not :, use a linker
98023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # script.
98033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
98043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Save the value of $output and $libobjs because we want to
98053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # use them later.  If we have whole_archive_flag_spec, we
98063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # want to use save_libobjs as it was before
98073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # whole_archive_flag_spec was expanded, because we can't
98083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # assume the linker understands whole_archive_flag_spec.
98093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # This may have to be revisited, in case too many
98103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # convenience libraries get linked in and end up exceeding
98113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # the spec.
98123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
98133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    save_libobjs=$libobjs
98143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
98153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  save_output=$output
981698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  func_basename "$output"
981798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  output_la=$func_basename_result
98183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
98193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Clear the reloadable object creation command queue and
98203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # initialize k to one.
98213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test_cmds=
98223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  concat_cmds=
98233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  objlist=
98243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  last_robj=
98253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  k=1
98263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
982715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
982815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    output=$output_objdir/$output_la.lnkscript
98293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_verbose "creating GNU ld script: $output"
983098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo 'INPUT (' > $output
98313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for obj in $save_libobjs
98323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    do
9833da16f16767eb31921af855f17bda465fffc4e000cristy	      func_to_tool_file "$obj"
9834da16f16767eb31921af855f17bda465fffc4e000cristy	      $ECHO "$func_to_tool_file_result" >> $output
98353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
983698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    echo ')' >> $output
9837da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append delfiles " $output"
9838da16f16767eb31921af855f17bda465fffc4e000cristy	    func_to_tool_file "$output"
9839da16f16767eb31921af855f17bda465fffc4e000cristy	    output=$func_to_tool_file_result
984015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
984115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    output=$output_objdir/$output_la.lnk
98423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_verbose "creating linker input file list: $output"
98433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    : > $output
98443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    set x $save_libobjs
98453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    shift
98463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    firstobj=
984715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes = "$compiler_needs_object"; then
98483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      firstobj="$1 "
98493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      shift
98503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
98513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for obj
98523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    do
9853da16f16767eb31921af855f17bda465fffc4e000cristy	      func_to_tool_file "$obj"
9854da16f16767eb31921af855f17bda465fffc4e000cristy	      $ECHO "$func_to_tool_file_result" >> $output
98553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
9856da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append delfiles " $output"
9857da16f16767eb31921af855f17bda465fffc4e000cristy	    func_to_tool_file "$output"
9858da16f16767eb31921af855f17bda465fffc4e000cristy	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
98593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
98603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$save_libobjs"; then
98613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_verbose "creating reloadable object files..."
986215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      output=$output_objdir/$output_la-$k.$objext
98633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      eval test_cmds=\"$reload_cmds\"
98643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_len " $test_cmds"
98653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      len0=$func_len_result
98663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      len=$len0
98673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
98683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Loop over the list of objects to be linked.
98693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      for obj in $save_libobjs
98703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      do
98713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_len " $obj"
98723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_arith $len + $func_len_result
98733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		len=$func_arith_result
987415f2201421a23fbf95840adf524cfdb4db384b85Cristy		if test -z "$objlist" ||
98753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		   test "$len" -lt "$max_cmd_len"; then
98763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_append objlist " $obj"
98773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		else
98783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # The command $test_cmds is almost too long, add a
98793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  # command to the queue.
988015f2201421a23fbf95840adf524cfdb4db384b85Cristy		  if test 1 -eq "$k"; then
98813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    # The first file doesn't have a previous command to add.
988298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    reload_objs=$objlist
988398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    eval concat_cmds=\"$reload_cmds\"
98843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  else
98853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    # All subsequent reloadable object files will link in
98863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    # the last one created.
988798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    reload_objs="$objlist $last_robj"
988898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
98893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  fi
989015f2201421a23fbf95840adf524cfdb4db384b85Cristy		  last_robj=$output_objdir/$output_la-$k.$objext
98913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_arith $k + 1
98923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  k=$func_arith_result
989315f2201421a23fbf95840adf524cfdb4db384b85Cristy		  output=$output_objdir/$output_la-$k.$objext
989498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		  objlist=" $obj"
98953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_len " $last_robj"
98963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_arith $len0 + $func_len_result
98973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  len=$func_arith_result
98983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
98993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      done
99003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Handle the remaining objects by creating one last
99013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # reloadable object file.  All subsequent reloadable object
99023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # files will link in the last one created.
99033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
990498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      reload_objs="$objlist $last_robj"
990515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      eval concat_cmds=\"\$concat_cmds$reload_cmds\"
99063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if test -n "$last_robj"; then
990715f2201421a23fbf95840adf524cfdb4db384b85Cristy	        eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
99083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
9909da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append delfiles " $output"
99103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
99123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      output=
99133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
99143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
991515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    ${skipped_export-false} && {
991615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_verbose "generating symbol list for '$libname.la'"
991715f2201421a23fbf95840adf524cfdb4db384b85Cristy	      export_symbols=$output_objdir/$libname.exp
99183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $opt_dry_run || $RM $export_symbols
99193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      libobjs=$output
99203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Append the command to create the export file.
99213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
99223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
99233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      if test -n "$last_robj"; then
99243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
99253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
992615f2201421a23fbf95840adf524cfdb4db384b85Cristy	    }
99273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    test -n "$save_libobjs" &&
99293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_verbose "creating a temporary reloadable object file: $output"
99303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Loop through the commands generated above and execute them.
993215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    save_ifs=$IFS; IFS='~'
99333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for cmd in $concat_cmds; do
993415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      IFS=$save_ifs
993515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      $opt_quiet || {
99363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  func_quote_for_expand "$cmd"
99373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  eval "func_echo $func_quote_for_expand_result"
99383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      }
99393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $opt_dry_run || eval "$cmd" || {
99403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		lt_exit=$?
99413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# Restore the uninstalled library and exit
994315f2201421a23fbf95840adf524cfdb4db384b85Cristy		if test relink = "$opt_mode"; then
99443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		  ( cd "$output_objdir" && \
99453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    $RM "${realname}T" && \
99463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		    $MV "${realname}U" "$realname" )
99473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		fi
99483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		exit $lt_exit
99503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      }
99513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
995215f2201421a23fbf95840adf524cfdb4db384b85Cristy	    IFS=$save_ifs
99533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
99553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
99563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
99573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
99583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
99593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
996015f2201421a23fbf95840adf524cfdb4db384b85Cristy          ${skipped_export-false} && {
99613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
996215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      tmp_export_symbols=$export_symbols
996315f2201421a23fbf95840adf524cfdb4db384b85Cristy	      test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
996498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
99653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
99663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$orig_export_symbols"; then
99683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # The given exports_symbols file has to be filtered, so filter it.
996915f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
99703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
997115f2201421a23fbf95840adf524cfdb4db384b85Cristy	      # 's' commands, which not all seds can handle. GNU sed should be fine
99723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # though. Also, the filter scales superlinearly with the number of
99733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # global variables. join(1) would be nice here, but unfortunately
99743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # isn't a blessed tool.
99753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9976da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
99773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      export_symbols=$output_objdir/$libname.def
99783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
99793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
998015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  }
99813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  libobjs=$output
99833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Restore the value of output.
99843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  output=$save_output
99853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
99873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
99883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    test "X$libobjs" = "X " && libobjs=
99893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
99903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Expand the library linking commands again to reset the
99913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # value of $libobjs for piecewise linking.
99923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
99933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Do each of the archive commands.
999415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test yes = "$module" && test -n "$module_cmds"; then
99953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
99963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cmds=$module_expsym_cmds
99973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
99983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cmds=$module_cmds
99993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
100003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
100013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
100023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cmds=$archive_expsym_cmds
100033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
100043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      cmds=$archive_cmds
100053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
100063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
100073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
100083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$delfiles"; then
100103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Append the command to remove temporary files to $cmds.
100113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval cmds=\"\$cmds~\$RM $delfiles\"
100123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
100133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Add any objects from preloaded convenience libraries
100153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$dlprefiles"; then
1001615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  gentop=$output_objdir/${outputname}x
10017da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append generated " $gentop"
100183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_extract_archives $gentop $dlprefiles
10020da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append libobjs " $func_extract_archives_result"
100213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  test "X$libobjs" = "X " && libobjs=
100223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
100233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1002415f2201421a23fbf95840adf524cfdb4db384b85Cristy	save_ifs=$IFS; IFS='~'
100253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for cmd in $cmds; do
1002615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  IFS=$sp$nl
100273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval cmd=\"$cmd\"
1002815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  IFS=$save_ifs
1002915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  $opt_quiet || {
100303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_quote_for_expand "$cmd"
100313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval "func_echo $func_quote_for_expand_result"
100323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  }
100333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $opt_dry_run || eval "$cmd" || {
100343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    lt_exit=$?
100353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Restore the uninstalled library and exit
1003715f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test relink = "$opt_mode"; then
100383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ( cd "$output_objdir" && \
100393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        $RM "${realname}T" && \
100403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		$MV "${realname}U" "$realname" )
100413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
100423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    exit $lt_exit
100443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  }
100453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
1004615f2201421a23fbf95840adf524cfdb4db384b85Cristy	IFS=$save_ifs
100473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Restore the uninstalled library and exit
1004915f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test relink = "$opt_mode"; then
100503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
100513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$convenience"; then
100533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -z "$whole_archive_flag_spec"; then
100543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_show_eval '${RM}r "$gentop"'
100553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
100563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
100573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  exit $EXIT_SUCCESS
100593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
100603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Create links to the real library.
100623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for linkname in $linknames; do
100633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test "$realname" != "$linkname"; then
100643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
100653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
100663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
100673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# If -module or -export-dynamic was specified, set the dlname.
1006915f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test yes = "$module" || test yes = "$export_dynamic"; then
100703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # On all known operating systems, these are identical.
1007115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  dlname=$soname
100723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
100733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
100743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
100753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    obj)
1007715f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
1007815f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-dlopen' is ignored for objects"
100793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
100803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case " $deplibs" in
100823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *\ -l* | *\ -L*)
1008315f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-l' and '-L' are ignored for objects" ;;
100843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
100853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$rpath" && \
1008715f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-rpath' is ignored for objects"
100883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$xrpath" && \
1009015f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-R' is ignored for objects"
100913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$vinfo" && \
1009315f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-version-info' is ignored for objects"
100943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$release" && \
1009615f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-release' is ignored for objects"
100973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
100983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $output in
100993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.lo)
101003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	test -n "$objs$old_deplibs" && \
1010115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_fatal_error "cannot build library object '$output' from non-libtool objects"
101023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	libobj=$output
101043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_lo2o "$libobj"
101053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	obj=$func_lo2o_result
101063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
101073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
101083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	libobj=
1010915f2201421a23fbf95840adf524cfdb4db384b85Cristy	obj=$output
101103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
101113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
101123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Delete the old objects.
101143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $opt_dry_run || $RM $obj $libobj
101153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Objects from convenience libraries.  This assumes
101173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # single-version convenience libraries.  Whenever we create
101183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # different ones for PIC/non-PIC, this we'll have to duplicate
101193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # the extraction.
101203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      reload_conv_objs=
101213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      gentop=
1012215f2201421a23fbf95840adf524cfdb4db384b85Cristy      # if reload_cmds runs $LD directly, get rid of -Wl from
1012315f2201421a23fbf95840adf524cfdb4db384b85Cristy      # whole_archive_flag_spec and hope we can get by with turning comma
1012415f2201421a23fbf95840adf524cfdb4db384b85Cristy      # into space.
1012515f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $reload_cmds in
1012615f2201421a23fbf95840adf524cfdb4db384b85Cristy        *\$LD[\ \$]*) wl= ;;
1012715f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
101283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$convenience"; then
101293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$whole_archive_flag_spec"; then
101303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
1013115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
1013215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
101333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
1013415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  gentop=$output_objdir/${obj}x
10135da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append generated " $gentop"
101363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_extract_archives $gentop $convenience
101383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  reload_conv_objs="$reload_objs $func_extract_archives_result"
101393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
101403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
101413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
10142da16f16767eb31921af855f17bda465fffc4e000cristy      # If we're not building shared, we need to use non_pic_objs
1014315f2201421a23fbf95840adf524cfdb4db384b85Cristy      test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10144da16f16767eb31921af855f17bda465fffc4e000cristy
101453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Create the old-style object.
1014615f2201421a23fbf95840adf524cfdb4db384b85Cristy      reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
101473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1014815f2201421a23fbf95840adf524cfdb4db384b85Cristy      output=$obj
101493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_execute_cmds "$reload_cmds" 'exit $?'
101503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Exit if we aren't doing a library object file.
101523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -z "$libobj"; then
101533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$gentop"; then
101543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_show_eval '${RM}r "$gentop"'
101553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
101563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit $EXIT_SUCCESS
101583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
101593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1016015f2201421a23fbf95840adf524cfdb4db384b85Cristy      test yes = "$build_libtool_libs" || {
101613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$gentop"; then
101623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_show_eval '${RM}r "$gentop"'
101633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
101643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Create an invalid libtool object if no PIC, so that we don't
101663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# accidentally link it into a program.
101673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# $show "echo timestamp > $libobj"
101683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
101693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit $EXIT_SUCCESS
1017015f2201421a23fbf95840adf524cfdb4db384b85Cristy      }
101713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1017215f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$pic_flag" || test default != "$pic_mode"; then
101733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Only do commands if we really have different PIC objects.
101743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	reload_objs="$libobjs $reload_conv_objs"
1017515f2201421a23fbf95840adf524cfdb4db384b85Cristy	output=$libobj
101763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_execute_cmds "$reload_cmds" 'exit $?'
101773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
101783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$gentop"; then
101803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval '${RM}r "$gentop"'
101813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
101823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      exit $EXIT_SUCCESS
101843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
101853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    prog)
101873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $host in
101883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*cygwin*) func_stripname '' '.exe' "$output"
101893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	          output=$func_stripname_result.exe;;
101903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
101913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$vinfo" && \
1019215f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-version-info' is ignored for programs"
101933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
101943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      test -n "$release" && \
1019515f2201421a23fbf95840adf524cfdb4db384b85Cristy	func_warning "'-release' is ignored for programs"
101963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1019715f2201421a23fbf95840adf524cfdb4db384b85Cristy      $preload \
1019815f2201421a23fbf95840adf524cfdb4db384b85Cristy	&& test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
1019915f2201421a23fbf95840adf524cfdb4db384b85Cristy	&& func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
102003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
102013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $host in
102023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *-*-rhapsody* | *-*-darwin1.[012])
102033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# On Rhapsody replace the C library is the System framework
1020498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
1020598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
102063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
102073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
102083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
102093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $host in
102103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *-*-darwin*)
102113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Don't allow lazy linking, it breaks C++ global constructors
102123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# But is supposedly fixed on 10.4 or later (yay!).
1021315f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test CXX = "$tagname"; then
102143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
102153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    10.[0123])
1021615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_append compile_command " $wl-bind_at_load"
1021715f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_append finalize_command " $wl-bind_at_load"
102183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
102193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
102203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
102213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
1022298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
1022398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
102243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
102253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
102263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
102273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
102283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # move library search paths that coincide with paths to not yet
102293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # installed libraries to the beginning of the library search list
102303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      new_libs=
102313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for path in $notinst_path; do
102323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case " $new_libs " in
102333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*" -L$path/$objdir "*) ;;
102343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*)
102353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case " $compile_deplibs " in
102363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" -L$path/$objdir "*)
10237da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append new_libs " -L$path/$objdir" ;;
102383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
102393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
102403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
102413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
102423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for deplib in $compile_deplibs; do
102433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $deplib in
102443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	-L*)
102453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case " $new_libs " in
102463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" $deplib "*) ;;
10247da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append new_libs " $deplib" ;;
102483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
102493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
10250da16f16767eb31921af855f17bda465fffc4e000cristy	*) func_append new_libs " $deplib" ;;
102513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
102523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
1025315f2201421a23fbf95840adf524cfdb4db384b85Cristy      compile_deplibs=$new_libs
102543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
102553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
10256da16f16767eb31921af855f17bda465fffc4e000cristy      func_append compile_command " $compile_deplibs"
10257da16f16767eb31921af855f17bda465fffc4e000cristy      func_append finalize_command " $finalize_deplibs"
102583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
102593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$rpath$xrpath"; then
102603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# If the user specified any rpath flags, then add them.
102613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for libdir in $rpath $xrpath; do
102623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # This is the magic to use -rpath.
102633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case "$finalize_rpath " in
102643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" $libdir "*) ;;
10265da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append finalize_rpath " $libdir" ;;
102663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
102673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
102683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
102693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
102703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Now hardcode the library paths
102713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      rpath=
102723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      hardcode_libdirs=
102733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for libdir in $compile_rpath $finalize_rpath; do
102743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$hardcode_libdir_flag_spec"; then
102753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$hardcode_libdir_separator"; then
102763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -z "$hardcode_libdirs"; then
1027715f2201421a23fbf95840adf524cfdb4db384b85Cristy	      hardcode_libdirs=$libdir
102783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
102793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Just accumulate the unique libdirs.
102803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
102813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
102823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
102833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *)
10284da16f16767eb31921af855f17bda465fffc4e000cristy		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
102853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
102863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
102873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
102883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
102893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval flag=\"$hardcode_libdir_flag_spec\"
10290da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append rpath " $flag"
102913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
102923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	elif test -n "$runpath_var"; then
102933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case "$perm_rpath " in
102943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" $libdir "*) ;;
10295da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append perm_rpath " $libdir" ;;
102963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
102973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
102983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $host in
102993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
1030015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
103013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case :$dllsearchpath: in
103023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *":$libdir:"*) ;;
103033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ::) dllsearchpath=$libdir;;
10304da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append dllsearchpath ":$libdir";;
103053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
103063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case :$dllsearchpath: in
103073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *":$testbindir:"*) ;;
103083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ::) dllsearchpath=$testbindir;;
10309da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append dllsearchpath ":$testbindir";;
103103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
103113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
103123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
103133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
103143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Substitute the hardcoded libdirs into the rpath.
103153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$hardcode_libdir_separator" &&
103163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	 test -n "$hardcode_libdirs"; then
1031715f2201421a23fbf95840adf524cfdb4db384b85Cristy	libdir=$hardcode_libdirs
103183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval rpath=\" $hardcode_libdir_flag_spec\"
103193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
1032015f2201421a23fbf95840adf524cfdb4db384b85Cristy      compile_rpath=$rpath
103213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
103223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      rpath=
103233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      hardcode_libdirs=
103243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for libdir in $finalize_rpath; do
103253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$hardcode_libdir_flag_spec"; then
103263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if test -n "$hardcode_libdir_separator"; then
103273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -z "$hardcode_libdirs"; then
1032815f2201421a23fbf95840adf524cfdb4db384b85Cristy	      hardcode_libdirs=$libdir
103293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
103303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Just accumulate the unique libdirs.
103313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
103323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
103333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
103343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *)
10335da16f16767eb31921af855f17bda465fffc4e000cristy		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
103363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
103373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
103383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
103393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
103403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval flag=\"$hardcode_libdir_flag_spec\"
10341da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append rpath " $flag"
103423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
103433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	elif test -n "$runpath_var"; then
103443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case "$finalize_perm_rpath " in
103453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *" $libdir "*) ;;
10346da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append finalize_perm_rpath " $libdir" ;;
103473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
103483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
103493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
103503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Substitute the hardcoded libdirs into the rpath.
103513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$hardcode_libdir_separator" &&
103523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	 test -n "$hardcode_libdirs"; then
1035315f2201421a23fbf95840adf524cfdb4db384b85Cristy	libdir=$hardcode_libdirs
103543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval rpath=\" $hardcode_libdir_flag_spec\"
103553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
1035615f2201421a23fbf95840adf524cfdb4db384b85Cristy      finalize_rpath=$rpath
103573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1035815f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$libobjs" && test yes = "$build_old_libs"; then
103593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Transform all the library objects into standard objects.
1036098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
1036198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
103623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
103633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1036415f2201421a23fbf95840adf524cfdb4db384b85Cristy      func_generate_dlsyms "$outputname" "@PROGRAM@" false
103653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
103663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # template prelinking step
103673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$prelink_cmds"; then
103683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_execute_cmds "$prelink_cmds" 'exit $?'
103693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
103703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1037115f2201421a23fbf95840adf524cfdb4db384b85Cristy      wrappers_required=:
103723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $host in
1037398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      *cegcc* | *mingw32ce*)
1037498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
1037515f2201421a23fbf95840adf524cfdb4db384b85Cristy        wrappers_required=false
1037698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy        ;;
103773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *cygwin* | *mingw* )
1037815f2201421a23fbf95840adf524cfdb4db384b85Cristy        test yes = "$build_libtool_libs" || wrappers_required=false
103793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
103803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
1038115f2201421a23fbf95840adf524cfdb4db384b85Cristy        if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
1038215f2201421a23fbf95840adf524cfdb4db384b85Cristy          wrappers_required=false
103833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        fi
103843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy        ;;
103853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
1038615f2201421a23fbf95840adf524cfdb4db384b85Cristy      $wrappers_required || {
103873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Replace the output file specification.
1038898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
1038915f2201421a23fbf95840adf524cfdb4db384b85Cristy	link_command=$compile_command$compile_rpath
103903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
103913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# We have no uninstalled library dependencies, so finalize right now.
103923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit_status=0
103933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval "$link_command" 'exit_status=$?'
103943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
10395da16f16767eb31921af855f17bda465fffc4e000cristy	if test -n "$postlink_cmds"; then
10396da16f16767eb31921af855f17bda465fffc4e000cristy	  func_to_tool_file "$output"
10397da16f16767eb31921af855f17bda465fffc4e000cristy	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10398da16f16767eb31921af855f17bda465fffc4e000cristy	  func_execute_cmds "$postlink_cmds" 'exit $?'
10399da16f16767eb31921af855f17bda465fffc4e000cristy	fi
10400da16f16767eb31921af855f17bda465fffc4e000cristy
104013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Delete the generated files.
1040215f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test -f "$output_objdir/${outputname}S.$objext"; then
1040315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
104043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
104053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
104063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit $exit_status
1040715f2201421a23fbf95840adf524cfdb4db384b85Cristy      }
104083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
104093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$compile_shlibpath$finalize_shlibpath"; then
104103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
104113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
104123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$finalize_shlibpath"; then
104133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
104143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
104153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
104163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      compile_var=
104173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      finalize_var=
104183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$runpath_var"; then
104193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$perm_rpath"; then
104203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # We should set the runpath_var.
104213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  rpath=
104223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for dir in $perm_rpath; do
10423da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append rpath "$dir:"
104243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
104253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
104263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
104273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$finalize_perm_rpath"; then
104283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # We should set the runpath_var.
104293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  rpath=
104303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for dir in $finalize_perm_rpath; do
10431da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append rpath "$dir:"
104323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
104333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
104343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
104353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
104363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1043715f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test yes = "$no_install"; then
104383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# We don't need to create a wrapper script.
1043915f2201421a23fbf95840adf524cfdb4db384b85Cristy	link_command=$compile_var$compile_command$compile_rpath
104403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Replace the output file specification.
1044198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
104423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Delete the old output file.
104433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	$opt_dry_run || $RM $output
104443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Link the executable and exit
104453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval "$link_command" 'exit $?'
10446da16f16767eb31921af855f17bda465fffc4e000cristy
10447da16f16767eb31921af855f17bda465fffc4e000cristy	if test -n "$postlink_cmds"; then
10448da16f16767eb31921af855f17bda465fffc4e000cristy	  func_to_tool_file "$output"
10449da16f16767eb31921af855f17bda465fffc4e000cristy	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10450da16f16767eb31921af855f17bda465fffc4e000cristy	  func_execute_cmds "$postlink_cmds" 'exit $?'
10451da16f16767eb31921af855f17bda465fffc4e000cristy	fi
10452da16f16767eb31921af855f17bda465fffc4e000cristy
104533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit $EXIT_SUCCESS
104543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
104553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1045615f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $hardcode_action,$fast_install in
1045715f2201421a23fbf95840adf524cfdb4db384b85Cristy        relink,*)
1045815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  # Fast installation is not supported
1045915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  link_command=$compile_var$compile_command$compile_rpath
1046015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  relink_command=$finalize_var$finalize_command$finalize_rpath
104613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1046215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_warning "this platform does not like uninstalled shared libraries"
1046315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  func_warning "'$output' will be relinked during installation"
1046415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  ;;
1046515f2201421a23fbf95840adf524cfdb4db384b85Cristy        *,yes)
1046615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  link_command=$finalize_var$compile_command$finalize_rpath
1046715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
1046815f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
1046915f2201421a23fbf95840adf524cfdb4db384b85Cristy	*,no)
1047015f2201421a23fbf95840adf524cfdb4db384b85Cristy	  link_command=$compile_var$compile_command$compile_rpath
1047115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  relink_command=$finalize_var$finalize_command$finalize_rpath
1047215f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
1047315f2201421a23fbf95840adf524cfdb4db384b85Cristy	*,needless)
1047415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  link_command=$finalize_var$compile_command$finalize_rpath
1047515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  relink_command=
1047615f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
1047715f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
104783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
104793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Replace the output file specification.
1048098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
104813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
104823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Delete the old output files.
104833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
104843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
104853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_show_eval "$link_command" 'exit $?'
104863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
10487da16f16767eb31921af855f17bda465fffc4e000cristy      if test -n "$postlink_cmds"; then
10488da16f16767eb31921af855f17bda465fffc4e000cristy	func_to_tool_file "$output_objdir/$outputname"
10489da16f16767eb31921af855f17bda465fffc4e000cristy	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'`
10490da16f16767eb31921af855f17bda465fffc4e000cristy	func_execute_cmds "$postlink_cmds" 'exit $?'
10491da16f16767eb31921af855f17bda465fffc4e000cristy      fi
10492da16f16767eb31921af855f17bda465fffc4e000cristy
104933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Now create the wrapper script.
104943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_verbose "creating $output"
104953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
104963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Quote the relink command for shipping.
104973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$relink_command"; then
104983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Preserve any variables that may affect compiler behavior
104993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for var in $variables_saved_for_relink; do
105003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if eval test -z \"\${$var+set}\"; then
105013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
105023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  elif eval var_value=\$$var; test -z "$var_value"; then
105033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    relink_command="$var=; export $var; $relink_command"
105043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
105053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_quote_for_eval "$var_value"
105063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
105073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
105083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
105093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	relink_command="(cd `pwd`; $relink_command)"
1051098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
105113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
105123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
105133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Only actually do things if not in dry run mode.
105143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $opt_dry_run || {
105153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# win32 will think the script is a binary if it has
105163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# a .exe suffix, so we strip it off here.
105173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $output in
105183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *.exe) func_stripname '' '.exe' "$output"
105193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	         output=$func_stripname_result ;;
105203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
105213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# test for cygwin because mv fails w/o .exe extensions
105223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $host in
105233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *cygwin*)
105243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    exeext=.exe
105253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_stripname '' '.exe' "$outputname"
105263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    outputname=$func_stripname_result ;;
105273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *) exeext= ;;
105283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
105293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case $host in
105303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *cygwin* | *mingw* )
105313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_dirname_and_basename "$output" "" "."
105323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    output_name=$func_basename_result
105333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    output_path=$func_dirname_result
1053415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    cwrappersource=$output_path/$objdir/lt-$output_name.c
1053515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    cwrapper=$output_path/$output_name.exe
105363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $RM $cwrappersource $cwrapper
105373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
105383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
105393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_emit_cwrapperexe_src > $cwrappersource
105403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
105413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # The wrapper executable is built using the $host compiler,
105423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # because it contains $host paths and files. If cross-
105433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # compiling, it, like the target executable, must be
105443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # executed on the $host or under an emulation environment.
105453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $opt_dry_run || {
105463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
105473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $STRIP $cwrapper
105483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
105493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
105503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Now, create the wrapper script for func_source use:
105513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_ltwrapper_scriptname $cwrapper
105523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $RM $func_ltwrapper_scriptname_result
105533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
105543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $opt_dry_run || {
105553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # note: this script will not be executed, so do not chmod.
1055615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test "x$build" = "x$host"; then
105573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
105583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      else
105593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_emit_wrapper no > $func_ltwrapper_scriptname_result
105603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
105613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    }
105623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
105633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  * )
105643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $RM $output
105653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
105663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
105673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_emit_wrapper no > $output
105683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    chmod +x $output
105693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  ;;
105703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
105713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      }
105723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      exit $EXIT_SUCCESS
105733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
105743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
105753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
105763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # See if we need to build an old-fashioned archive.
105773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for oldlib in $oldlibs; do
105783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1057915f2201421a23fbf95840adf524cfdb4db384b85Cristy      case $build_libtool_libs in
1058015f2201421a23fbf95840adf524cfdb4db384b85Cristy        convenience)
1058115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  oldobjs="$libobjs_save $symfileobj"
1058215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  addlibs=$convenience
105833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  build_libtool_libs=no
1058415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  ;;
1058515f2201421a23fbf95840adf524cfdb4db384b85Cristy	module)
1058615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  oldobjs=$libobjs_save
1058715f2201421a23fbf95840adf524cfdb4db384b85Cristy	  addlibs=$old_convenience
1058815f2201421a23fbf95840adf524cfdb4db384b85Cristy	  build_libtool_libs=no
1058915f2201421a23fbf95840adf524cfdb4db384b85Cristy          ;;
1059015f2201421a23fbf95840adf524cfdb4db384b85Cristy	*)
105913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  oldobjs="$old_deplibs $non_pic_objects"
1059215f2201421a23fbf95840adf524cfdb4db384b85Cristy	  $preload && test -f "$symfileobj" \
1059315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    && func_append oldobjs " $symfileobj"
1059415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  addlibs=$old_convenience
1059515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  ;;
1059615f2201421a23fbf95840adf524cfdb4db384b85Cristy      esac
105973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
105983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -n "$addlibs"; then
1059915f2201421a23fbf95840adf524cfdb4db384b85Cristy	gentop=$output_objdir/${outputname}x
10600da16f16767eb31921af855f17bda465fffc4e000cristy	func_append generated " $gentop"
106013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
106023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_extract_archives $gentop $addlibs
10603da16f16767eb31921af855f17bda465fffc4e000cristy	func_append oldobjs " $func_extract_archives_result"
106043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
106053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
106063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Do each command in the archive commands.
1060715f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
106083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	cmds=$old_archive_from_new_cmds
106093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
106103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
106113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Add any objects from preloaded convenience libraries
106123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test -n "$dlprefiles"; then
1061315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  gentop=$output_objdir/${outputname}x
10614da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append generated " $gentop"
106153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
106163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_extract_archives $gentop $dlprefiles
10617da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append oldobjs " $func_extract_archives_result"
106183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
106193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
106203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# POSIX demands no paths to be encoded in archives.  We have
106213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# to avoid creating archives with duplicate basenames if we
106223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# might have to extract them afterwards, e.g., when creating a
106233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# static archive out of a convenience library, or when linking
106243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# the entirety of a libtool archive into another (currently
106253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# not supported by libtool).
106263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if (for obj in $oldobjs
106273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    do
106283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_basename "$obj"
106293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      $ECHO "$func_basename_result"
106303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done | sort | sort -uc >/dev/null 2>&1); then
106313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  :
106323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
1063398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  echo "copying selected object files to avoid basename conflicts..."
1063415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  gentop=$output_objdir/${outputname}x
10635da16f16767eb31921af855f17bda465fffc4e000cristy	  func_append generated " $gentop"
106363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_mkdir_p "$gentop"
106373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  save_oldobjs=$oldobjs
106383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  oldobjs=
106393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  counter=1
106403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for obj in $save_oldobjs
106413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  do
106423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_basename "$obj"
1064315f2201421a23fbf95840adf524cfdb4db384b85Cristy	    objbase=$func_basename_result
106443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    case " $oldobjs " in
106453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    " ") oldobjs=$obj ;;
106463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *[\ /]"$objbase "*)
106473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      while :; do
106483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# Make sure we don't pick an alternate name that also
106493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# overlaps.
106503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		newobj=lt$counter-$objbase
106513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_arith $counter + 1
106523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		counter=$func_arith_result
106533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		case " $oldobjs " in
106543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*[\ /]"$newobj "*) ;;
106553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
106563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		esac
106573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      done
106583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
10659da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append oldobjs " $gentop/$newobj"
106603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      ;;
10661da16f16767eb31921af855f17bda465fffc4e000cristy	    *) func_append oldobjs " $obj" ;;
106623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
106633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
106643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
106652542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
106662542fc61a973e588b23b3ddac880f01ae6c4c64dcristy	tool_oldlib=$func_to_tool_file_result
106673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	eval cmds=\"$old_archive_cmds\"
106683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
106693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_len " $cmds"
106703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	len=$func_len_result
106713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
106723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  cmds=$old_archive_cmds
10673da16f16767eb31921af855f17bda465fffc4e000cristy	elif test -n "$archiver_list_spec"; then
10674da16f16767eb31921af855f17bda465fffc4e000cristy	  func_verbose "using command file archive linking..."
10675da16f16767eb31921af855f17bda465fffc4e000cristy	  for obj in $oldobjs
10676da16f16767eb31921af855f17bda465fffc4e000cristy	  do
10677da16f16767eb31921af855f17bda465fffc4e000cristy	    func_to_tool_file "$obj"
10678da16f16767eb31921af855f17bda465fffc4e000cristy	    $ECHO "$func_to_tool_file_result"
10679da16f16767eb31921af855f17bda465fffc4e000cristy	  done > $output_objdir/$libname.libcmd
10680da16f16767eb31921af855f17bda465fffc4e000cristy	  func_to_tool_file "$output_objdir/$libname.libcmd"
10681da16f16767eb31921af855f17bda465fffc4e000cristy	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
10682da16f16767eb31921af855f17bda465fffc4e000cristy	  cmds=$old_archive_cmds
106833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
106843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # the command line is too long to link in one step, link in parts
106853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_verbose "using piecewise archive linking..."
106863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  save_RANLIB=$RANLIB
106873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  RANLIB=:
106883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  objlist=
106893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  concat_cmds=
106903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  save_oldobjs=$oldobjs
106913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  oldobjs=
106923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Is there a better way of finding the last object in the list?
106933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for obj in $save_oldobjs
106943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  do
106953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    last_oldobj=$obj
106963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
106973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  eval test_cmds=\"$old_archive_cmds\"
106983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_len " $test_cmds"
106993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  len0=$func_len_result
107003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  len=$len0
107013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for obj in $save_oldobjs
107023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  do
107033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_len " $obj"
107043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_arith $len + $func_len_result
107053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    len=$func_arith_result
107063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_append objlist " $obj"
107073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test "$len" -lt "$max_cmd_len"; then
107083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      :
107093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
107103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # the above command should be used before it gets too long
107113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      oldobjs=$objlist
1071215f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test "$obj" = "$last_oldobj"; then
107133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		RANLIB=$save_RANLIB
107143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      fi
107153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
1071615f2201421a23fbf95840adf524cfdb4db384b85Cristy	      eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
107173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      objlist=
107183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      len=$len0
107193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
107203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
107213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  RANLIB=$save_RANLIB
107223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  oldobjs=$objlist
1072315f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test -z "$oldobjs"; then
107243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval cmds=\"\$concat_cmds\"
107253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
107263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
107273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
107283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
107293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
107303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_execute_cmds "$cmds" 'exit $?'
107313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
107323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
107333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -n "$generated" && \
107343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_show_eval "${RM}r$generated"
107353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
107363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # Now create the libtool archive.
107373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    case $output in
107383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    *.la)
107393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      old_library=
1074015f2201421a23fbf95840adf524cfdb4db384b85Cristy      test yes = "$build_old_libs" && old_library=$libname.$libext
107413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_verbose "creating $output"
107423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
107433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Preserve any variables that may affect compiler behavior
107443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      for var in $variables_saved_for_relink; do
107453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if eval test -z \"\${$var+set}\"; then
107463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
107473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	elif eval var_value=\$$var; test -z "$var_value"; then
107483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  relink_command="$var=; export $var; $relink_command"
107493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	else
107503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_quote_for_eval "$var_value"
107513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
107523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
107533ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      done
107543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Quote the link command for shipping.
1075515f2201421a23fbf95840adf524cfdb4db384b85Cristy      relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
1075698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
1075715f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test yes = "$hardcode_automatic"; then
107583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	relink_command=
107593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
107603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
107613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Only create the output if not a dry run.
107623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      $opt_dry_run || {
107633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	for installed in no yes; do
1076415f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test yes = "$installed"; then
107653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -z "$install_libdir"; then
107663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      break
107673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
1076815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    output=$output_objdir/${outputname}i
107693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # Replace all uninstalled libtool libraries with the installed ones
107703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    newdependency_libs=
107713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for deplib in $dependency_libs; do
107723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $deplib in
107733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *.la)
107743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_basename "$deplib"
1077515f2201421a23fbf95840adf524cfdb4db384b85Cristy		name=$func_basename_result
107762542fc61a973e588b23b3ddac880f01ae6c4c64dcristy		func_resolve_sysroot "$deplib"
1077715f2201421a23fbf95840adf524cfdb4db384b85Cristy		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
107783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		test -z "$libdir" && \
1077915f2201421a23fbf95840adf524cfdb4db384b85Cristy		  func_fatal_error "'$deplib' is not a valid libtool archive"
10780da16f16767eb31921af855f17bda465fffc4e000cristy		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
10781da16f16767eb31921af855f17bda465fffc4e000cristy		;;
10782da16f16767eb31921af855f17bda465fffc4e000cristy	      -L*)
10783da16f16767eb31921af855f17bda465fffc4e000cristy		func_stripname -L '' "$deplib"
10784da16f16767eb31921af855f17bda465fffc4e000cristy		func_replace_sysroot "$func_stripname_result"
10785da16f16767eb31921af855f17bda465fffc4e000cristy		func_append newdependency_libs " -L$func_replace_sysroot_result"
10786da16f16767eb31921af855f17bda465fffc4e000cristy		;;
10787da16f16767eb31921af855f17bda465fffc4e000cristy	      -R*)
10788da16f16767eb31921af855f17bda465fffc4e000cristy		func_stripname -R '' "$deplib"
10789da16f16767eb31921af855f17bda465fffc4e000cristy		func_replace_sysroot "$func_stripname_result"
10790da16f16767eb31921af855f17bda465fffc4e000cristy		func_append newdependency_libs " -R$func_replace_sysroot_result"
107913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
10792da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append newdependency_libs " $deplib" ;;
107933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
107943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
1079515f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dependency_libs=$newdependency_libs
107963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    newdlfiles=
107973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
107983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for lib in $dlfiles; do
107993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $lib in
108003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *.la)
108013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	        func_basename "$lib"
1080215f2201421a23fbf95840adf524cfdb4db384b85Cristy		name=$func_basename_result
1080315f2201421a23fbf95840adf524cfdb4db384b85Cristy		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
108043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		test -z "$libdir" && \
1080515f2201421a23fbf95840adf524cfdb4db384b85Cristy		  func_fatal_error "'$lib' is not a valid libtool archive"
10806da16f16767eb31921af855f17bda465fffc4e000cristy		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
108073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
10808da16f16767eb31921af855f17bda465fffc4e000cristy	      *) func_append newdlfiles " $lib" ;;
108093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
108103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
1081115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dlfiles=$newdlfiles
108123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    newdlprefiles=
108133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for lib in $dlprefiles; do
108143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $lib in
108153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      *.la)
108163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# Only pass preopened files to the pseudo-archive (for
108173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# eventual linking with the app. that links it) if we
108183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# didn't already link the preopened objects directly into
108193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		# the library:
108203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		func_basename "$lib"
1082115f2201421a23fbf95840adf524cfdb4db384b85Cristy		name=$func_basename_result
1082215f2201421a23fbf95840adf524cfdb4db384b85Cristy		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
108233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		test -z "$libdir" && \
1082415f2201421a23fbf95840adf524cfdb4db384b85Cristy		  func_fatal_error "'$lib' is not a valid libtool archive"
10825da16f16767eb31921af855f17bda465fffc4e000cristy		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
108263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		;;
108273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
108283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
1082915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dlprefiles=$newdlprefiles
108303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  else
108313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    newdlfiles=
108323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for lib in $dlfiles; do
108333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $lib in
1083415f2201421a23fbf95840adf524cfdb4db384b85Cristy		[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
108353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*) abs=`pwd`"/$lib" ;;
108363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
10837da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append newdlfiles " $abs"
108383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
1083915f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dlfiles=$newdlfiles
108403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    newdlprefiles=
108413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    for lib in $dlprefiles; do
108423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      case $lib in
1084315f2201421a23fbf95840adf524cfdb4db384b85Cristy		[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
108443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy		*) abs=`pwd`"/$lib" ;;
108453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      esac
10846da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append newdlprefiles " $abs"
108473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    done
1084815f2201421a23fbf95840adf524cfdb4db384b85Cristy	    dlprefiles=$newdlprefiles
108493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
108503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $RM $output
108513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # place dlname in correct position for cygwin
1085298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  # In fact, it would be nice if we could use this code for all target
1085398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  # systems that can't hard-code library paths into their executables
1085498dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  # and that have no shared library path variable independent of PATH,
1085598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  # but it turns out we can't easily determine that from inspecting
1085698dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  # libtool variables, so we have to hard-code the OSs to which it
1085798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  # applies here; at the moment, that means platforms that use the PE
1085898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  # object format with DLL files.  See the long comment at the top of
1085998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	  # tests/bindir.at for full details.
108603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  tdlname=$dlname
108613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $host,$output,$installed,$module,$dlname in
1086298dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
1086398dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      # If a -bindir argument was supplied, place the dll there.
1086415f2201421a23fbf95840adf524cfdb4db384b85Cristy	      if test -n "$bindir"; then
1086598dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		func_relative_path "$install_libdir" "$bindir"
1086615f2201421a23fbf95840adf524cfdb4db384b85Cristy		tdlname=$func_relative_path_result/$dlname
1086798dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      else
1086898dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		# Otherwise fall back on heuristic.
1086998dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy		tdlname=../bin/$dlname
1087098dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      fi
1087198dddb59ad0cd2d16c6d85b451e56f19bfc32788cristy	      ;;
108723ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
108733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  $ECHO > $output "\
108743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# $outputname - a libtool library file
1087515f2201421a23fbf95840adf524cfdb4db384b85Cristy# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
108763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy#
108773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Please DO NOT delete this file!
108783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# It is necessary for linking the library.
108793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
108803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# The name that we can dlopen(3).
108813ed852eea50f9d4cd633efb8c2b054b8e33c253cristydlname='$tdlname'
108823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
108833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Names of this library.
108843ed852eea50f9d4cd633efb8c2b054b8e33c253cristylibrary_names='$library_names'
108853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
108863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# The name of the static archive.
108873ed852eea50f9d4cd633efb8c2b054b8e33c253cristyold_library='$old_library'
108883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1088915f2201421a23fbf95840adf524cfdb4db384b85Cristy# Linker flags that cannot go in dependency_libs.
108903ed852eea50f9d4cd633efb8c2b054b8e33c253cristyinherited_linker_flags='$new_inherited_linker_flags'
108913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
108923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Libraries that this one depends upon.
108933ed852eea50f9d4cd633efb8c2b054b8e33c253cristydependency_libs='$dependency_libs'
108943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
108953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Names of additional weak libraries provided by this library
108963ed852eea50f9d4cd633efb8c2b054b8e33c253cristyweak_library_names='$weak_libs'
108973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
108983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Version information for $libname.
108993ed852eea50f9d4cd633efb8c2b054b8e33c253cristycurrent=$current
109003ed852eea50f9d4cd633efb8c2b054b8e33c253cristyage=$age
109013ed852eea50f9d4cd633efb8c2b054b8e33c253cristyrevision=$revision
109023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Is this an already installed library?
109043ed852eea50f9d4cd633efb8c2b054b8e33c253cristyinstalled=$installed
109053ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Should we warn about portability when linking against -modules?
109073ed852eea50f9d4cd633efb8c2b054b8e33c253cristyshouldnotlink=$module
109083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109093ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Files to dlopen/dlpreopen
109103ed852eea50f9d4cd633efb8c2b054b8e33c253cristydlopen='$dlfiles'
109113ed852eea50f9d4cd633efb8c2b054b8e33c253cristydlpreopen='$dlprefiles'
109123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109133ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Directory that this library needs to be installed in:
109143ed852eea50f9d4cd633efb8c2b054b8e33c253cristylibdir='$install_libdir'"
1091515f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test no,yes = "$installed,$need_relink"; then
109163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    $ECHO >> $output "\
109173ed852eea50f9d4cd633efb8c2b054b8e33c253cristyrelink_command=\"$relink_command\""
109183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
109193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	done
109203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      }
109213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Do a symbolic link so that the libtool archive can be found in
109233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # LD_LIBRARY_PATH before the program is installed.
109243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
109253ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      ;;
109263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    esac
109273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit $EXIT_SUCCESS
109283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
109293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1093015f2201421a23fbf95840adf524cfdb4db384b85Cristyif test link = "$opt_mode" || test relink = "$opt_mode"; then
1093115f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_mode_link ${1+"$@"}
1093215f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
109333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# func_mode_uninstall arg...
109363ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfunc_mode_uninstall ()
109373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy{
1093815f2201421a23fbf95840adf524cfdb4db384b85Cristy    $debug_cmd
1093915f2201421a23fbf95840adf524cfdb4db384b85Cristy
1094015f2201421a23fbf95840adf524cfdb4db384b85Cristy    RM=$nonopt
109413ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    files=
1094215f2201421a23fbf95840adf524cfdb4db384b85Cristy    rmforce=false
109433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit_status=0
109443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # This variable tells wrapper scripts just to set variables rather
109463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    # than running their programs.
1094715f2201421a23fbf95840adf524cfdb4db384b85Cristy    libtool_install_magic=$magic
109483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for arg
109503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    do
109513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $arg in
1095215f2201421a23fbf95840adf524cfdb4db384b85Cristy      -f) func_append RM " $arg"; rmforce=: ;;
10953da16f16767eb31921af855f17bda465fffc4e000cristy      -*) func_append RM " $arg" ;;
10954da16f16767eb31921af855f17bda465fffc4e000cristy      *) func_append files " $arg" ;;
109553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
109563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
109573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    test -z "$RM" && \
109593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_fatal_help "you must specify an RM program"
109603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    rmdirs=
109623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109633ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for file in $files; do
109643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_dirname "$file" "" "."
1096515f2201421a23fbf95840adf524cfdb4db384b85Cristy      dir=$func_dirname_result
1096615f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test . = "$dir"; then
1096715f2201421a23fbf95840adf524cfdb4db384b85Cristy	odir=$objdir
109683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      else
1096915f2201421a23fbf95840adf524cfdb4db384b85Cristy	odir=$dir/$objdir
109703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
109713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_basename "$file"
1097215f2201421a23fbf95840adf524cfdb4db384b85Cristy      name=$func_basename_result
1097315f2201421a23fbf95840adf524cfdb4db384b85Cristy      test uninstall = "$opt_mode" && odir=$dir
109743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
10975da16f16767eb31921af855f17bda465fffc4e000cristy      # Remember odir for removal later, being careful to avoid duplicates
1097615f2201421a23fbf95840adf524cfdb4db384b85Cristy      if test clean = "$opt_mode"; then
109773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	case " $rmdirs " in
10978da16f16767eb31921af855f17bda465fffc4e000cristy	  *" $odir "*) ;;
10979da16f16767eb31921af855f17bda465fffc4e000cristy	  *) func_append rmdirs " $odir" ;;
109803ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	esac
109813ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
109823ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      # Don't error if the file doesn't exist and rm -f was used.
109843ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if { test -L "$file"; } >/dev/null 2>&1 ||
109853ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	 { test -h "$file"; } >/dev/null 2>&1 ||
109863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	 test -f "$file"; then
109873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	:
109883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      elif test -d "$file"; then
109893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	exit_status=1
109903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
1099115f2201421a23fbf95840adf524cfdb4db384b85Cristy      elif $rmforce; then
109923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	continue
109933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
109943ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1099515f2201421a23fbf95840adf524cfdb4db384b85Cristy      rmfiles=$file
109963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
109973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      case $name in
109983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.la)
109993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Possibly a libtool archive, so verify it.
110003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if func_lalib_p "$file"; then
110013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_source $dir/$name
110023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
110033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Delete the libtool libraries and symlinks.
110043ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  for n in $library_names; do
11005da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append rmfiles " $odir/$n"
110063ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  done
11007da16f16767eb31921af855f17bda465fffc4e000cristy	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
110083ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1100915f2201421a23fbf95840adf524cfdb4db384b85Cristy	  case $opt_mode in
110103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  clean)
11011da16f16767eb31921af855f17bda465fffc4e000cristy	    case " $library_names " in
110123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    *" $dlname "*) ;;
11013da16f16767eb31921af855f17bda465fffc4e000cristy	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
110143ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    esac
11015da16f16767eb31921af855f17bda465fffc4e000cristy	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
110163ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
110173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  uninstall)
110183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$library_names"; then
110193ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Do each command in the postuninstall commands.
1102015f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
110213ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
110223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
110233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if test -n "$old_library"; then
110243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      # Do each command in the old_postuninstall commands.
1102515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
110263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
110273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # FIXME: should reinstall the best remaining shared library.
110283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
110293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
110303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
110313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
110323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
110333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *.lo)
110343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	# Possibly a libtool object, so verify it.
110353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	if func_lalib_p "$file"; then
110363ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
110373ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Read the .lo file
110383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  func_source $dir/$name
110393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
110403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Add PIC object to the list of files to remove.
1104115f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test -n "$pic_object" && test none != "$pic_object"; then
11042da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append rmfiles " $dir/$pic_object"
110433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
110443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
110453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Add non-PIC object to the list of files to remove.
1104615f2201421a23fbf95840adf524cfdb4db384b85Cristy	  if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11047da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append rmfiles " $dir/$non_pic_object"
110483ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
110493ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
110503ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
110513ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
110523ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      *)
1105315f2201421a23fbf95840adf524cfdb4db384b85Cristy	if test clean = "$opt_mode"; then
110543ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  noexename=$name
110553ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  case $file in
110563ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  *.exe)
110573ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_stripname '' '.exe' "$file"
110583ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    file=$func_stripname_result
110593ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    func_stripname '' '.exe' "$name"
110603ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    noexename=$func_stripname_result
110613ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # $file with .exe has already been added to rmfiles,
110623ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # add $file without .exe
11063da16f16767eb31921af855f17bda465fffc4e000cristy	    func_append rmfiles " $file"
110643ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    ;;
110653ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  esac
110663ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  # Do a test to see if this is a libtool program.
110673ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  if func_ltwrapper_p "$file"; then
110683ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    if func_ltwrapper_executable_p "$file"; then
110693ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_ltwrapper_scriptname "$file"
110703ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      relink_command=
110713ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_source $func_ltwrapper_scriptname_result
11072da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append rmfiles " $func_ltwrapper_scriptname_result"
110733ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    else
110743ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      relink_command=
110753ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	      func_source $dir/$noexename
110763ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
110773ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
110783ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # note $name still contains .exe if it was in $file originally
110793ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    # as does the version of $file that was added into $rmfiles
1108015f2201421a23fbf95840adf524cfdb4db384b85Cristy	    func_append rmfiles " $odir/$name $odir/${name}S.$objext"
1108115f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test yes = "$fast_install" && test -n "$relink_command"; then
11082da16f16767eb31921af855f17bda465fffc4e000cristy	      func_append rmfiles " $odir/lt-$name"
110833ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
1108415f2201421a23fbf95840adf524cfdb4db384b85Cristy	    if test "X$noexename" != "X$name"; then
1108515f2201421a23fbf95840adf524cfdb4db384b85Cristy	      func_append rmfiles " $odir/lt-$noexename.c"
110863ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	    fi
110873ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	  fi
110883ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	fi
110893ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	;;
110903ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      esac
110913ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      func_show_eval "$RM $rmfiles" 'exit_status=1'
110923ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
110933ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1109415f2201421a23fbf95840adf524cfdb4db384b85Cristy    # Try to remove the $objdir's in the directories where we deleted files
110953ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    for dir in $rmdirs; do
110963ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      if test -d "$dir"; then
110973ed852eea50f9d4cd633efb8c2b054b8e33c253cristy	func_show_eval "rmdir $dir >/dev/null 2>&1"
110983ed852eea50f9d4cd633efb8c2b054b8e33c253cristy      fi
110993ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    done
111003ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
111013ed852eea50f9d4cd633efb8c2b054b8e33c253cristy    exit $exit_status
111023ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
111033ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
1110415f2201421a23fbf95840adf524cfdb4db384b85Cristyif test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
1110515f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_mode_uninstall ${1+"$@"}
1110615f2201421a23fbf95840adf524cfdb4db384b85Cristyfi
111073ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
11108da16f16767eb31921af855f17bda465fffc4e000cristytest -z "$opt_mode" && {
1110915f2201421a23fbf95840adf524cfdb4db384b85Cristy  help=$generic_help
111103ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  func_fatal_help "you must specify a MODE"
111113ed852eea50f9d4cd633efb8c2b054b8e33c253cristy}
111123ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
111133ed852eea50f9d4cd633efb8c2b054b8e33c253cristytest -z "$exec_cmd" && \
1111415f2201421a23fbf95840adf524cfdb4db384b85Cristy  func_fatal_help "invalid operation mode '$opt_mode'"
111153ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
111163ed852eea50f9d4cd633efb8c2b054b8e33c253cristyif test -n "$exec_cmd"; then
111173ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  eval exec "$exec_cmd"
111183ed852eea50f9d4cd633efb8c2b054b8e33c253cristy  exit $EXIT_FAILURE
111193ed852eea50f9d4cd633efb8c2b054b8e33c253cristyfi
111203ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
111213ed852eea50f9d4cd633efb8c2b054b8e33c253cristyexit $exit_status
111223ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
111233ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
111243ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# The TAGs below are defined such that we never get into a situation
1112515f2201421a23fbf95840adf524cfdb4db384b85Cristy# where we disable both kinds of libraries.  Given conflicting
111263ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# choices, we go for a static library, that is the most portable,
111273ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# since we can't tell whether shared libraries were disabled because
111283ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# the user asked for that or because the platform doesn't support
111293ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# them.  This is particularly important on AIX, because we don't
111303ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# support having both static and shared libraries enabled at the same
111313ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# time on that platform, so we default to a shared-only configuration.
111323ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# If a disable-shared tag is given, we'll fallback to a static-only
111333ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# configuration.  But we'll never go from static-only to shared-only.
111343ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
111353ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
111363ed852eea50f9d4cd633efb8c2b054b8e33c253cristybuild_libtool_libs=no
111373ed852eea50f9d4cd633efb8c2b054b8e33c253cristybuild_old_libs=yes
111383ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# ### END LIBTOOL TAG CONFIG: disable-shared
111393ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
111403ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# ### BEGIN LIBTOOL TAG CONFIG: disable-static
111413ed852eea50f9d4cd633efb8c2b054b8e33c253cristybuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
111423ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# ### END LIBTOOL TAG CONFIG: disable-static
111433ed852eea50f9d4cd633efb8c2b054b8e33c253cristy
111443ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# Local Variables:
111453ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# mode:shell-script
111463ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# sh-indentation:2
111473ed852eea50f9d4cd633efb8c2b054b8e33c253cristy# End:
11148