build-scripts/ltmain.sh
author Ryan C. Gordon <icculus@icculus.org>
Fri, 12 Aug 2016 19:59:00 -0400
changeset 10266 c09f06c4e8c8
parent 7235 80fefd4af771
permissions -rwxr-xr-x
emscripten: send fake mouse events for touches, like other targets do. (This really should be handled at the higher level and not in the individual targets, but this fixes the immediate bug.)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6446
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
     1
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
     2
# libtool (GNU libtool) 2.4.2
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
     3
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
     4
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
     5
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
     6
# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
     7
# This is free software; see the source for copying conditions.  There is NO
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
     8
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
     9
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    10
# GNU Libtool is free software; you can redistribute it and/or modify
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    11
# it under the terms of the GNU General Public License as published by
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    12
# the Free Software Foundation; either version 2 of the License, or
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    13
# (at your option) any later version.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    14
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    15
# As a special exception to the GNU General Public License,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    16
# if you distribute this file as part of a program or library that
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    17
# is built using GNU Libtool, you may include this file under the
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    18
# same distribution terms that you use for the rest of that program.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    19
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    20
# GNU Libtool is distributed in the hope that it will be useful, but
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    21
# WITHOUT ANY WARRANTY; without even the implied warranty of
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    22
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    23
# General Public License for more details.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    24
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    25
# You should have received a copy of the GNU General Public License
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    26
# along with GNU Libtool; see the file COPYING.  If not, a copy
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    27
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    28
# or obtained by writing to the Free Software Foundation, Inc.,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    29
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    30
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    31
# Usage: $progname [OPTION]... [MODE-ARG]...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    32
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    33
# Provide generalized library-building support services.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    34
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    35
#       --config             show all configuration variables
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    36
#       --debug              enable verbose shell tracing
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    37
#   -n, --dry-run            display commands without modifying any files
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    38
#       --features           display basic configuration information and exit
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    39
#       --mode=MODE          use operation mode MODE
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    40
#       --preserve-dup-deps  don't remove duplicate dependency libraries
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    41
#       --quiet, --silent    don't print informational messages
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    42
#       --no-quiet, --no-silent
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    43
#                            print informational messages (default)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    44
#       --no-warn            don't display warning messages
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    45
#       --tag=TAG            use configuration variables from tag TAG
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    46
#   -v, --verbose            print more informational messages than default
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    47
#       --no-verbose         don't print the extra informational messages
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    48
#       --version            print version information
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    49
#   -h, --help, --help-all   print short, long, or detailed help message
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    50
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    51
# MODE must be one of the following:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    52
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    53
#         clean              remove files from the build directory
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    54
#         compile            compile a source file into a libtool object
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    55
#         execute            automatically set library path, then run a program
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    56
#         finish             complete the installation of libtool libraries
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    57
#         install            install libraries or executables
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    58
#         link               create a library or an executable
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    59
#         uninstall          remove libraries from an installed directory
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    60
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    61
# MODE-ARGS vary depending on the MODE.  When passed as first option,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    62
# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    63
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    64
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    65
# When reporting a bug, please describe a test case to reproduce it and
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    66
# include the following information:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    67
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    68
#         host-triplet:	$host
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    69
#         shell:		$SHELL
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    70
#         compiler:		$LTCC
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    71
#         compiler flags:		$LTCFLAGS
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    72
#         linker:		$LD (gnu? $with_gnu_ld)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    73
#         $progname:	(GNU libtool) 2.4.2
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    74
#         automake:	$automake_version
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    75
#         autoconf:	$autoconf_version
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    76
#
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    77
# Report bugs to <bug-libtool@gnu.org>.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    78
# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    79
# General help using GNU software: <http://www.gnu.org/gethelp/>.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    80
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    81
PROGRAM=libtool
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    82
PACKAGE=libtool
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    83
VERSION=2.4.2
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    84
TIMESTAMP=""
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    85
package_revision=1.3337
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    86
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    87
# Be Bourne compatible
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    88
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    89
  emulate sh
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    90
  NULLCMD=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    91
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    92
  # is contrary to our usage.  Disable this feature.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    93
  alias -g '${1+"$@"}'='"$@"'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    94
  setopt NO_GLOB_SUBST
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    95
else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    96
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    97
fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    98
BIN_SH=xpg4; export BIN_SH # for Tru64
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
    99
DUALCASE=1; export DUALCASE # for MKS sh
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   100
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   101
# A function that is used when there is no print builtin or printf.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   102
func_fallback_echo ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   103
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   104
  eval 'cat <<_LTECHO_EOF
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   105
$1
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   106
_LTECHO_EOF'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   107
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   108
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   109
# NLS nuisances: We save the old values to restore during execute mode.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   110
lt_user_locale=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   111
lt_safe_locale=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   112
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   113
do
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   114
  eval "if test \"\${$lt_var+set}\" = set; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   115
          save_$lt_var=\$$lt_var
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   116
          $lt_var=C
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   117
	  export $lt_var
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   118
	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   119
	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   120
	fi"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   121
done
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   122
LC_ALL=C
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   123
LANGUAGE=C
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   124
export LANGUAGE LC_ALL
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   125
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   126
$lt_unset CDPATH
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   127
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   128
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   129
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   130
# is ksh but when the shell is invoked as "sh" and the current value of
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   131
# the _XPG environment variable is not equal to 1 (one), the special
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   132
# positional parameter $0, within a function call, is the name of the
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   133
# function.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   134
progpath="$0"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   135
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   136
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   137
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   138
: ${CP="cp -f"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   139
test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   140
: ${MAKE="make"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   141
: ${MKDIR="mkdir"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   142
: ${MV="mv -f"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   143
: ${RM="rm -f"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   144
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   145
: ${Xsed="$SED -e 1s/^X//"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   146
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   147
# Global variables:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   148
EXIT_SUCCESS=0
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   149
EXIT_FAILURE=1
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   150
EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   151
EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   152
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   153
exit_status=$EXIT_SUCCESS
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   154
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   155
# Make sure IFS has a sensible default
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   156
lt_nl='
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   157
'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   158
IFS=" 	$lt_nl"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   159
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   160
dirname="s,/[^/]*$,,"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   161
basename="s,^.*/,,"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   162
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   163
# func_dirname file append nondir_replacement
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   164
# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   165
# otherwise set result to NONDIR_REPLACEMENT.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   166
func_dirname ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   167
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   168
    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   169
    if test "X$func_dirname_result" = "X${1}"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   170
      func_dirname_result="${3}"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   171
    else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   172
      func_dirname_result="$func_dirname_result${2}"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   173
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   174
} # func_dirname may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   175
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   176
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   177
# func_basename file
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   178
func_basename ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   179
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   180
    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   181
} # func_basename may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   182
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   183
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   184
# func_dirname_and_basename file append nondir_replacement
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   185
# perform func_basename and func_dirname in a single function
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   186
# call:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   187
#   dirname:  Compute the dirname of FILE.  If nonempty,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   188
#             add APPEND to the result, otherwise set result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   189
#             to NONDIR_REPLACEMENT.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   190
#             value returned in "$func_dirname_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   191
#   basename: Compute filename of FILE.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   192
#             value retuned in "$func_basename_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   193
# Implementation must be kept synchronized with func_dirname
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   194
# and func_basename. For efficiency, we do not delegate to
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   195
# those functions but instead duplicate the functionality here.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   196
func_dirname_and_basename ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   197
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   198
    # Extract subdirectory from the argument.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   199
    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   200
    if test "X$func_dirname_result" = "X${1}"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   201
      func_dirname_result="${3}"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   202
    else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   203
      func_dirname_result="$func_dirname_result${2}"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   204
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   205
    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   206
} # func_dirname_and_basename may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   207
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   208
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   209
# func_stripname prefix suffix name
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   210
# strip PREFIX and SUFFIX off of NAME.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   211
# PREFIX and SUFFIX must not contain globbing or regex special
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   212
# characters, hashes, percent signs, but SUFFIX may contain a leading
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   213
# dot (in which case that matches only a dot).
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   214
# func_strip_suffix prefix name
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   215
func_stripname ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   216
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   217
    case ${2} in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   218
      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   219
      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   220
    esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   221
} # func_stripname may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   222
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   223
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   224
# These SED scripts presuppose an absolute path with a trailing slash.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   225
pathcar='s,^/\([^/]*\).*$,\1,'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   226
pathcdr='s,^/[^/]*,,'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   227
removedotparts=':dotsl
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   228
		s@/\./@/@g
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   229
		t dotsl
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   230
		s,/\.$,/,'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   231
collapseslashes='s@/\{1,\}@/@g'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   232
finalslash='s,/*$,/,'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   233
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   234
# func_normal_abspath PATH
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   235
# Remove doubled-up and trailing slashes, "." path components,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   236
# and cancel out any ".." path components in PATH after making
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   237
# it an absolute path.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   238
#             value returned in "$func_normal_abspath_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   239
func_normal_abspath ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   240
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   241
  # Start from root dir and reassemble the path.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   242
  func_normal_abspath_result=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   243
  func_normal_abspath_tpath=$1
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   244
  func_normal_abspath_altnamespace=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   245
  case $func_normal_abspath_tpath in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   246
    "")
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   247
      # Empty path, that just means $cwd.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   248
      func_stripname '' '/' "`pwd`"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   249
      func_normal_abspath_result=$func_stripname_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   250
      return
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   251
    ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   252
    # The next three entries are used to spot a run of precisely
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   253
    # two leading slashes without using negated character classes;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   254
    # we take advantage of case's first-match behaviour.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   255
    ///*)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   256
      # Unusual form of absolute path, do nothing.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   257
    ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   258
    //*)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   259
      # Not necessarily an ordinary path; POSIX reserves leading '//'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   260
      # and for example Cygwin uses it to access remote file shares
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   261
      # over CIFS/SMB, so we conserve a leading double slash if found.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   262
      func_normal_abspath_altnamespace=/
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   263
    ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   264
    /*)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   265
      # Absolute path, do nothing.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   266
    ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   267
    *)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   268
      # Relative path, prepend $cwd.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   269
      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   270
    ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   271
  esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   272
  # Cancel out all the simple stuff to save iterations.  We also want
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   273
  # the path to end with a slash for ease of parsing, so make sure
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   274
  # there is one (and only one) here.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   275
  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   276
        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   277
  while :; do
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   278
    # Processed it all yet?
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   279
    if test "$func_normal_abspath_tpath" = / ; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   280
      # If we ascended to the root using ".." the result may be empty now.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   281
      if test -z "$func_normal_abspath_result" ; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   282
        func_normal_abspath_result=/
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   283
      fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   284
      break
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   285
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   286
    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   287
        -e "$pathcar"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   288
    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   289
        -e "$pathcdr"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   290
    # Figure out what to do with it
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   291
    case $func_normal_abspath_tcomponent in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   292
      "")
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   293
        # Trailing empty path component, ignore it.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   294
      ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   295
      ..)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   296
        # Parent dir; strip last assembled component from result.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   297
        func_dirname "$func_normal_abspath_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   298
        func_normal_abspath_result=$func_dirname_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   299
      ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   300
      *)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   301
        # Actual path component, append it.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   302
        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   303
      ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   304
    esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   305
  done
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   306
  # Restore leading double-slash if one was found on entry.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   307
  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   308
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   309
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   310
# func_relative_path SRCDIR DSTDIR
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   311
# generates a relative path from SRCDIR to DSTDIR, with a trailing
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   312
# slash if non-empty, suitable for immediately appending a filename
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   313
# without needing to append a separator.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   314
#             value returned in "$func_relative_path_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   315
func_relative_path ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   316
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   317
  func_relative_path_result=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   318
  func_normal_abspath "$1"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   319
  func_relative_path_tlibdir=$func_normal_abspath_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   320
  func_normal_abspath "$2"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   321
  func_relative_path_tbindir=$func_normal_abspath_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   322
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   323
  # Ascend the tree starting from libdir
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   324
  while :; do
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   325
    # check if we have found a prefix of bindir
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   326
    case $func_relative_path_tbindir in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   327
      $func_relative_path_tlibdir)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   328
        # found an exact match
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   329
        func_relative_path_tcancelled=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   330
        break
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   331
        ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   332
      $func_relative_path_tlibdir*)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   333
        # found a matching prefix
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   334
        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   335
        func_relative_path_tcancelled=$func_stripname_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   336
        if test -z "$func_relative_path_result"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   337
          func_relative_path_result=.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   338
        fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   339
        break
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   340
        ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   341
      *)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   342
        func_dirname $func_relative_path_tlibdir
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   343
        func_relative_path_tlibdir=${func_dirname_result}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   344
        if test "x$func_relative_path_tlibdir" = x ; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   345
          # Have to descend all the way to the root!
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   346
          func_relative_path_result=../$func_relative_path_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   347
          func_relative_path_tcancelled=$func_relative_path_tbindir
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   348
          break
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   349
        fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   350
        func_relative_path_result=../$func_relative_path_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   351
        ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   352
    esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   353
  done
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   354
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   355
  # Now calculate path; take care to avoid doubling-up slashes.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   356
  func_stripname '' '/' "$func_relative_path_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   357
  func_relative_path_result=$func_stripname_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   358
  func_stripname '/' '/' "$func_relative_path_tcancelled"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   359
  if test "x$func_stripname_result" != x ; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   360
    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   361
  fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   362
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   363
  # Normalisation. If bindir is libdir, return empty string,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   364
  # else relative path ending with a slash; either way, target
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   365
  # file name can be directly appended.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   366
  if test ! -z "$func_relative_path_result"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   367
    func_stripname './' '' "$func_relative_path_result/"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   368
    func_relative_path_result=$func_stripname_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   369
  fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   370
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   371
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   372
# The name of this program:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   373
func_dirname_and_basename "$progpath"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   374
progname=$func_basename_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   375
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   376
# Make sure we have an absolute path for reexecution:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   377
case $progpath in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   378
  [\\/]*|[A-Za-z]:\\*) ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   379
  *[\\/]*)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   380
     progdir=$func_dirname_result
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   381
     progdir=`cd "$progdir" && pwd`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   382
     progpath="$progdir/$progname"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   383
     ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   384
  *)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   385
     save_IFS="$IFS"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   386
     IFS=${PATH_SEPARATOR-:}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   387
     for progdir in $PATH; do
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   388
       IFS="$save_IFS"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   389
       test -x "$progdir/$progname" && break
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   390
     done
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   391
     IFS="$save_IFS"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   392
     test -n "$progdir" || progdir=`pwd`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   393
     progpath="$progdir/$progname"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   394
     ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   395
esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   396
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   397
# Sed substitution that helps us do robust quoting.  It backslashifies
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   398
# metacharacters that are still active within double-quoted strings.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   399
Xsed="${SED}"' -e 1s/^X//'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   400
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   401
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   402
# Same as above, but do not quote variable references.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   403
double_quote_subst='s/\(["`\\]\)/\\\1/g'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   404
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   405
# Sed substitution that turns a string into a regex matching for the
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   406
# string literally.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   407
sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   408
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   409
# Sed substitution that converts a w32 file name or path
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   410
# which contains forward slashes, into one that contains
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   411
# (escaped) backslashes.  A very naive implementation.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   412
lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   413
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   414
# Re-`\' parameter expansions in output of double_quote_subst that were
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   415
# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   416
# in input to double_quote_subst, that '$' was protected from expansion.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   417
# Since each input `\' is now two `\'s, look for any number of runs of
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   418
# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   419
bs='\\'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   420
bs2='\\\\'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   421
bs4='\\\\\\\\'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   422
dollar='\$'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   423
sed_double_backslash="\
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   424
  s/$bs4/&\\
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   425
/g
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   426
  s/^$bs2$dollar/$bs&/
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   427
  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   428
  s/\n//g"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   429
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   430
# Standard options:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   431
opt_dry_run=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   432
opt_help=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   433
opt_quiet=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   434
opt_verbose=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   435
opt_warning=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   436
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   437
# func_echo arg...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   438
# Echo program name prefixed message, along with the current mode
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   439
# name if it has been set yet.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   440
func_echo ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   441
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   442
    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   443
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   444
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   445
# func_verbose arg...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   446
# Echo program name prefixed message in verbose mode only.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   447
func_verbose ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   448
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   449
    $opt_verbose && func_echo ${1+"$@"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   450
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   451
    # A bug in bash halts the script if the last line of a function
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   452
    # fails when set -e is in force, so we need another command to
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   453
    # work around that:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   454
    :
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   455
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   456
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   457
# func_echo_all arg...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   458
# Invoke $ECHO with all args, space-separated.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   459
func_echo_all ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   460
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   461
    $ECHO "$*"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   462
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   463
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   464
# func_error arg...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   465
# Echo program name prefixed message to standard error.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   466
func_error ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   467
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   468
    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   469
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   470
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   471
# func_warning arg...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   472
# Echo program name prefixed warning message to standard error.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   473
func_warning ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   474
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   475
    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   476
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   477
    # bash bug again:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   478
    :
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   479
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   480
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   481
# func_fatal_error arg...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   482
# Echo program name prefixed message to standard error, and exit.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   483
func_fatal_error ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   484
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   485
    func_error ${1+"$@"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   486
    exit $EXIT_FAILURE
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   487
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   488
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   489
# func_fatal_help arg...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   490
# Echo program name prefixed message to standard error, followed by
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   491
# a help hint, and exit.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   492
func_fatal_help ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   493
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   494
    func_error ${1+"$@"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   495
    func_fatal_error "$help"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   496
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   497
help="Try \`$progname --help' for more information."  ## default
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   498
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   499
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   500
# func_grep expression filename
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   501
# Check whether EXPRESSION matches any line of FILENAME, without output.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   502
func_grep ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   503
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   504
    $GREP "$1" "$2" >/dev/null 2>&1
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   505
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   506
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   507
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   508
# func_mkdir_p directory-path
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   509
# Make sure the entire path to DIRECTORY-PATH is available.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   510
func_mkdir_p ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   511
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   512
    my_directory_path="$1"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   513
    my_dir_list=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   514
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   515
    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   516
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   517
      # Protect directory names starting with `-'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   518
      case $my_directory_path in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   519
        -*) my_directory_path="./$my_directory_path" ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   520
      esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   521
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   522
      # While some portion of DIR does not yet exist...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   523
      while test ! -d "$my_directory_path"; do
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   524
        # ...make a list in topmost first order.  Use a colon delimited
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   525
	# list incase some portion of path contains whitespace.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   526
        my_dir_list="$my_directory_path:$my_dir_list"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   527
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   528
        # If the last portion added has no slash in it, the list is done
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   529
        case $my_directory_path in */*) ;; *) break ;; esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   530
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   531
        # ...otherwise throw away the child directory and loop
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   532
        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   533
      done
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   534
      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   535
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   536
      save_mkdir_p_IFS="$IFS"; IFS=':'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   537
      for my_dir in $my_dir_list; do
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   538
	IFS="$save_mkdir_p_IFS"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   539
        # mkdir can fail with a `File exist' error if two processes
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   540
        # try to create one of the directories concurrently.  Don't
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   541
        # stop in that case!
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   542
        $MKDIR "$my_dir" 2>/dev/null || :
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   543
      done
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   544
      IFS="$save_mkdir_p_IFS"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   545
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   546
      # Bail out if we (or some other process) failed to create a directory.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   547
      test -d "$my_directory_path" || \
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   548
        func_fatal_error "Failed to create \`$1'"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   549
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   550
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   551
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   552
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   553
# func_mktempdir [string]
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   554
# Make a temporary directory that won't clash with other running
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   555
# libtool processes, and avoids race conditions if possible.  If
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   556
# given, STRING is the basename for that directory.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   557
func_mktempdir ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   558
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   559
    my_template="${TMPDIR-/tmp}/${1-$progname}"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   560
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   561
    if test "$opt_dry_run" = ":"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   562
      # Return a directory name, but don't create it in dry-run mode
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   563
      my_tmpdir="${my_template}-$$"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   564
    else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   565
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   566
      # If mktemp works, use that first and foremost
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   567
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   568
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   569
      if test ! -d "$my_tmpdir"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   570
        # Failing that, at least try and use $RANDOM to avoid a race
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   571
        my_tmpdir="${my_template}-${RANDOM-0}$$"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   572
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   573
        save_mktempdir_umask=`umask`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   574
        umask 0077
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   575
        $MKDIR "$my_tmpdir"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   576
        umask $save_mktempdir_umask
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   577
      fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   578
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   579
      # If we're not in dry-run mode, bomb out on failure
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   580
      test -d "$my_tmpdir" || \
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   581
        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   582
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   583
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   584
    $ECHO "$my_tmpdir"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   585
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   586
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   587
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   588
# func_quote_for_eval arg
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   589
# Aesthetically quote ARG to be evaled later.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   590
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   591
# is double-quoted, suitable for a subsequent eval, whereas
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   592
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   593
# which are still active within double quotes backslashified.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   594
func_quote_for_eval ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   595
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   596
    case $1 in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   597
      *[\\\`\"\$]*)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   598
	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   599
      *)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   600
        func_quote_for_eval_unquoted_result="$1" ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   601
    esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   602
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   603
    case $func_quote_for_eval_unquoted_result in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   604
      # Double-quote args containing shell metacharacters to delay
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   605
      # word splitting, command substitution and and variable
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   606
      # expansion for a subsequent eval.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   607
      # Many Bourne shells cannot handle close brackets correctly
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   608
      # in scan sets, so we specify it separately.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   609
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   610
        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   611
        ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   612
      *)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   613
        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   614
    esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   615
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   616
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   617
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   618
# func_quote_for_expand arg
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   619
# Aesthetically quote ARG to be evaled later; same as above,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   620
# but do not quote variable references.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   621
func_quote_for_expand ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   622
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   623
    case $1 in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   624
      *[\\\`\"]*)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   625
	my_arg=`$ECHO "$1" | $SED \
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   626
	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   627
      *)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   628
        my_arg="$1" ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   629
    esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   630
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   631
    case $my_arg in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   632
      # Double-quote args containing shell metacharacters to delay
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   633
      # word splitting and command substitution for a subsequent eval.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   634
      # Many Bourne shells cannot handle close brackets correctly
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   635
      # in scan sets, so we specify it separately.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   636
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   637
        my_arg="\"$my_arg\""
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   638
        ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   639
    esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   640
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   641
    func_quote_for_expand_result="$my_arg"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   642
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   643
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   644
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   645
# func_show_eval cmd [fail_exp]
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   646
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   647
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   648
# is given, then evaluate it.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   649
func_show_eval ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   650
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   651
    my_cmd="$1"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   652
    my_fail_exp="${2-:}"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   653
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   654
    ${opt_silent-false} || {
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   655
      func_quote_for_expand "$my_cmd"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   656
      eval "func_echo $func_quote_for_expand_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   657
    }
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   658
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   659
    if ${opt_dry_run-false}; then :; else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   660
      eval "$my_cmd"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   661
      my_status=$?
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   662
      if test "$my_status" -eq 0; then :; else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   663
	eval "(exit $my_status); $my_fail_exp"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   664
      fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   665
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   666
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   667
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   668
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   669
# func_show_eval_locale cmd [fail_exp]
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   670
# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   671
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   672
# is given, then evaluate it.  Use the saved locale for evaluation.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   673
func_show_eval_locale ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   674
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   675
    my_cmd="$1"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   676
    my_fail_exp="${2-:}"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   677
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   678
    ${opt_silent-false} || {
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   679
      func_quote_for_expand "$my_cmd"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   680
      eval "func_echo $func_quote_for_expand_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   681
    }
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   682
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   683
    if ${opt_dry_run-false}; then :; else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   684
      eval "$lt_user_locale
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   685
	    $my_cmd"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   686
      my_status=$?
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   687
      eval "$lt_safe_locale"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   688
      if test "$my_status" -eq 0; then :; else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   689
	eval "(exit $my_status); $my_fail_exp"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   690
      fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   691
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   692
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   693
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   694
# func_tr_sh
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   695
# Turn $1 into a string suitable for a shell variable name.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   696
# Result is stored in $func_tr_sh_result.  All characters
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   697
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   698
# if $1 begins with a digit, a '_' is prepended as well.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   699
func_tr_sh ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   700
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   701
  case $1 in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   702
  [0-9]* | *[!a-zA-Z0-9_]*)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   703
    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   704
    ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   705
  * )
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   706
    func_tr_sh_result=$1
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   707
    ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   708
  esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   709
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   710
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   711
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   712
# func_version
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   713
# Echo version message to standard output and exit.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   714
func_version ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   715
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   716
    $opt_debug
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   717
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   718
    $SED -n '/(C)/!b go
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   719
	:more
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   720
	/\./!{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   721
	  N
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   722
	  s/\n# / /
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   723
	  b more
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   724
	}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   725
	:go
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   726
	/^# '$PROGRAM' (GNU /,/# warranty; / {
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   727
        s/^# //
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   728
	s/^# *$//
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   729
        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   730
        p
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   731
     }' < "$progpath"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   732
     exit $?
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   733
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   734
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   735
# func_usage
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   736
# Echo short help message to standard output and exit.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   737
func_usage ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   738
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   739
    $opt_debug
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   740
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   741
    $SED -n '/^# Usage:/,/^#  *.*--help/ {
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   742
        s/^# //
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   743
	s/^# *$//
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   744
	s/\$progname/'$progname'/
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   745
	p
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   746
    }' < "$progpath"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   747
    echo
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   748
    $ECHO "run \`$progname --help | more' for full usage"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   749
    exit $?
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   750
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   751
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   752
# func_help [NOEXIT]
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   753
# Echo long help message to standard output and exit,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   754
# unless 'noexit' is passed as argument.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   755
func_help ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   756
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   757
    $opt_debug
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   758
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   759
    $SED -n '/^# Usage:/,/# Report bugs to/ {
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   760
	:print
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   761
        s/^# //
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   762
	s/^# *$//
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   763
	s*\$progname*'$progname'*
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   764
	s*\$host*'"$host"'*
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   765
	s*\$SHELL*'"$SHELL"'*
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   766
	s*\$LTCC*'"$LTCC"'*
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   767
	s*\$LTCFLAGS*'"$LTCFLAGS"'*
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   768
	s*\$LD*'"$LD"'*
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   769
	s/\$with_gnu_ld/'"$with_gnu_ld"'/
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   770
	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   771
	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   772
	p
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   773
	d
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   774
     }
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   775
     /^# .* home page:/b print
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   776
     /^# General help using/b print
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   777
     ' < "$progpath"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   778
    ret=$?
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   779
    if test -z "$1"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   780
      exit $ret
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   781
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   782
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   783
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   784
# func_missing_arg argname
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   785
# Echo program name prefixed message to standard error and set global
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   786
# exit_cmd.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   787
func_missing_arg ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   788
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   789
    $opt_debug
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   790
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   791
    func_error "missing argument for $1."
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   792
    exit_cmd=exit
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   793
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   794
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   795
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   796
# func_split_short_opt shortopt
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   797
# Set func_split_short_opt_name and func_split_short_opt_arg shell
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   798
# variables after splitting SHORTOPT after the 2nd character.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   799
func_split_short_opt ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   800
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   801
    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   802
    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   803
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   804
    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   805
    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   806
} # func_split_short_opt may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   807
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   808
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   809
# func_split_long_opt longopt
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   810
# Set func_split_long_opt_name and func_split_long_opt_arg shell
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   811
# variables after splitting LONGOPT at the `=' sign.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   812
func_split_long_opt ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   813
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   814
    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   815
    my_sed_long_arg='1s/^--[^=]*=//'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   816
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   817
    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   818
    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   819
} # func_split_long_opt may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   820
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   821
exit_cmd=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   822
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   823
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   824
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   825
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   826
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   827
magic="%%%MAGIC variable%%%"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   828
magic_exe="%%%MAGIC EXE variable%%%"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   829
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   830
# Global variables.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   831
nonopt=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   832
preserve_args=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   833
lo2o="s/\\.lo\$/.${objext}/"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   834
o2lo="s/\\.${objext}\$/.lo/"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   835
extracted_archives=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   836
extracted_serial=0
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   837
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   838
# If this variable is set in any of the actions, the command in it
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   839
# will be execed at the end.  This prevents here-documents from being
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   840
# left over by shells.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   841
exec_cmd=
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   842
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   843
# func_append var value
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   844
# Append VALUE to the end of shell variable VAR.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   845
func_append ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   846
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   847
    eval "${1}=\$${1}\${2}"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   848
} # func_append may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   849
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   850
# func_append_quoted var value
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   851
# Quote VALUE and append to the end of shell variable VAR, separated
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   852
# by a space.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   853
func_append_quoted ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   854
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   855
    func_quote_for_eval "${2}"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   856
    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   857
} # func_append_quoted may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   858
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   859
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   860
# func_arith arithmetic-term...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   861
func_arith ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   862
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   863
    func_arith_result=`expr "${@}"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   864
} # func_arith may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   865
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   866
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   867
# func_len string
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   868
# STRING may not start with a hyphen.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   869
func_len ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   870
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   871
    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   872
} # func_len may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   873
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   874
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   875
# func_lo2o object
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   876
func_lo2o ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   877
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   878
    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   879
} # func_lo2o may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   880
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   881
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   882
# func_xform libobj-or-source
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   883
func_xform ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   884
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   885
    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   886
} # func_xform may be replaced by extended shell implementation
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   887
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   888
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   889
# func_fatal_configuration arg...
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   890
# Echo program name prefixed message to standard error, followed by
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   891
# a configuration failure hint, and exit.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   892
func_fatal_configuration ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   893
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   894
    func_error ${1+"$@"}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   895
    func_error "See the $PACKAGE documentation for more information."
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   896
    func_fatal_error "Fatal configuration error."
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   897
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   898
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   899
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   900
# func_config
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   901
# Display the configuration for all the tags in this script.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   902
func_config ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   903
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   904
    re_begincf='^# ### BEGIN LIBTOOL'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   905
    re_endcf='^# ### END LIBTOOL'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   906
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   907
    # Default configuration.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   908
    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   909
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   910
    # Now print the configurations for the tags.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   911
    for tagname in $taglist; do
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   912
      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   913
    done
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   914
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   915
    exit $?
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   916
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   917
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   918
# func_features
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   919
# Display the features supported by this script.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   920
func_features ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   921
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   922
    echo "host: $host"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   923
    if test "$build_libtool_libs" = yes; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   924
      echo "enable shared libraries"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   925
    else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   926
      echo "disable shared libraries"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   927
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   928
    if test "$build_old_libs" = yes; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   929
      echo "enable static libraries"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   930
    else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   931
      echo "disable static libraries"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   932
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   933
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   934
    exit $?
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   935
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   936
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   937
# func_enable_tag tagname
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   938
# Verify that TAGNAME is valid, and either flag an error and exit, or
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   939
# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   940
# variable here.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   941
func_enable_tag ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   942
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   943
  # Global variable:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   944
  tagname="$1"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   945
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   946
  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   947
  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   948
  sed_extractcf="/$re_begincf/,/$re_endcf/p"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   949
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   950
  # Validate tagname.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   951
  case $tagname in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   952
    *[!-_A-Za-z0-9,/]*)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   953
      func_fatal_error "invalid tag name: $tagname"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   954
      ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   955
  esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   956
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   957
  # Don't test for the "default" C tag, as we know it's
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   958
  # there but not specially marked.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   959
  case $tagname in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   960
    CC) ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   961
    *)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   962
      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   963
	taglist="$taglist $tagname"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   964
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   965
	# Evaluate the configuration.  Be careful to quote the path
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   966
	# and the sed script, to avoid splitting on whitespace, but
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   967
	# also don't use non-portable quotes within backquotes within
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   968
	# quotes we have to do it in 2 steps:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   969
	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   970
	eval "$extractedcf"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   971
      else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   972
	func_error "ignoring unknown tag $tagname"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   973
      fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   974
      ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   975
  esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   976
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   977
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   978
# func_check_version_match
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   979
# Ensure that we are using m4 macros, and libtool script from the same
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   980
# release of libtool.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   981
func_check_version_match ()
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   982
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   983
  if test "$package_revision" != "$macro_revision"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   984
    if test "$VERSION" != "$macro_version"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   985
      if test -z "$macro_version"; then
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   986
        cat >&2 <<_LT_EOF
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   987
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   988
$progname: definition of this LT_INIT comes from an older release.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   989
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   990
$progname: and run autoconf again.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   991
_LT_EOF
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   992
      else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   993
        cat >&2 <<_LT_EOF
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   994
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   995
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   996
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   997
$progname: and run autoconf again.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   998
_LT_EOF
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
   999
      fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1000
    else
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1001
      cat >&2 <<_LT_EOF
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1002
$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1003
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1004
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1005
$progname: of $PACKAGE $VERSION and run autoconf again.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1006
_LT_EOF
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1007
    fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1008
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1009
    exit $EXIT_MISMATCH
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1010
  fi
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1011
}
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1012
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1013
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1014
# Shorthand for --mode=foo, only valid as the first argument
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1015
case $1 in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1016
clean|clea|cle|cl)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1017
  shift; set dummy --mode clean ${1+"$@"}; shift
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1018
  ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1019
compile|compil|compi|comp|com|co|c)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1020
  shift; set dummy --mode compile ${1+"$@"}; shift
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1021
  ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1022
execute|execut|execu|exec|exe|ex|e)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1023
  shift; set dummy --mode execute ${1+"$@"}; shift
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1024
  ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1025
finish|finis|fini|fin|fi|f)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1026
  shift; set dummy --mode finish ${1+"$@"}; shift
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1027
  ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1028
install|instal|insta|inst|ins|in|i)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1029
  shift; set dummy --mode install ${1+"$@"}; shift
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1030
  ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1031
link|lin|li|l)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1032
  shift; set dummy --mode link ${1+"$@"}; shift
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1033
  ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1034
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1035
  shift; set dummy --mode uninstall ${1+"$@"}; shift
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1036
  ;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1037
esac
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1038
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1039
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1040
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1041
# Option defaults:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1042
opt_debug=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1043
opt_dry_run=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1044
opt_config=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1045
opt_preserve_dup_deps=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1046
opt_features=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1047
opt_finish=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1048
opt_help=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1049
opt_help_all=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1050
opt_silent=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1051
opt_warning=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1052
opt_verbose=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1053
opt_silent=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1054
opt_verbose=false
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1055
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1056
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1057
# Parse options once, thoroughly.  This comes as soon as possible in the
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1058
# script to make things like `--version' happen as quickly as we can.
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1059
{
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1060
  # this just eases exit handling
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1061
  while test $# -gt 0; do
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1062
    opt="$1"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1063
    shift
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1064
    case $opt in
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1065
      --debug|-x)	opt_debug='set -x'
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1066
			func_echo "enabling shell trace mode"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1067
			$opt_debug
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1068
			;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1069
      --dry-run|--dryrun|-n)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1070
			opt_dry_run=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1071
			;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1072
      --config)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1073
			opt_config=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1074
func_config
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1075
			;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1076
      --dlopen|-dlopen)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1077
			optarg="$1"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1078
			opt_dlopen="${opt_dlopen+$opt_dlopen
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1079
}$optarg"
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1080
			shift
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1081
			;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1082
      --preserve-dup-deps)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1083
			opt_preserve_dup_deps=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1084
			;;
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1085
      --features)
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1086
			opt_features=:
80c98458312e Whoops, that wasn't supposed to be a symlink.
Sam Lantinga <slouken@libsdl.org>
parents: 6442
diff changeset
  1087
func_features
80c98458312e Whoops, that wasn't supposed to be a symlink.