ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Tue, 24 Feb 2004 19:22:22 +0000
changeset 856 d3165b90ee42
parent 789 f9d0e03fc2ff
child 886 05c551e5bc64
permissions -rw-r--r--
Date: Mon, 23 Feb 2004 19:00:23 +0100 From: "Juergen \"George\" Sawinski" Subject: Problems compiling libsdl with gcc 3.3 I attached another patch (configure.in.patch) that might resolv issues for some ppl finding the correct place of libartsc.so.*. (here, the output of "artsc-config --libs" contains two "-L.*", therefore the respecting arts_lib_spec contains the wrong path).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     1
# ltmain.sh - Provide generalized library-building support services.
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
     2
# NOTE: Changing this file will not affect anything until you rerun configure.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     3
#
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
     4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
     5
# Free Software Foundation, Inc.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     7
#
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     8
# This program is free software; you can redistribute it and/or modify
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
     9
# it under the terms of the GNU General Public License as published by
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    10
# the Free Software Foundation; either version 2 of the License, or
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    11
# (at your option) any later version.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    12
#
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    13
# This program is distributed in the hope that it will be useful, but
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    14
# WITHOUT ANY WARRANTY; without even the implied warranty of
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    16
# General Public License for more details.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    17
#
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    18
# You should have received a copy of the GNU General Public License
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    19
# along with this program; if not, write to the Free Software
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    21
#
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    22
# As a special exception to the GNU General Public License, if you
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    23
# distribute this file as part of a program that contains a
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    24
# configuration script generated by Autoconf, you may include it under
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    25
# the same distribution terms that you use for the rest of that program.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    26
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    27
# Check that we have a working $echo.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    28
if test "X$1" = X--no-reexec; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    29
  # Discard the --no-reexec flag, and continue.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    30
  shift
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    31
elif test "X$1" = X--fallback-echo; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    32
  # Avoid inline document here, it may be left over
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    33
  :
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    34
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    35
  # Yippee, $echo works!
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    36
  :
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    37
else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    38
  # Restart under the correct shell, and then maybe $echo will work.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    39
  exec $SHELL "$0" --no-reexec ${1+"$@"}
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    40
fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    41
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    42
if test "X$1" = X--fallback-echo; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    43
  # used as fallback echo
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    44
  shift
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    45
  cat <<EOF
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    46
$*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    47
EOF
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    48
  exit 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    49
fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    50
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    51
# The name of this program.
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    52
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    53
modename="$progname"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    54
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    55
# Constants.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    56
PROGRAM=ltmain.sh
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    57
PACKAGE=libtool
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    58
VERSION=1.5
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    59
TIMESTAMP=" (1.1220.2.1 2003/04/14 22:48:00)"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    60
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    61
default_mode=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    62
help="Try \`$progname --help' for more information."
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    63
magic="%%%MAGIC variable%%%"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    64
mkdir="mkdir"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    65
mv="mv -f"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    66
rm="rm -f"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    67
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    68
# Sed substitution that helps us do robust quoting.  It backslashifies
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    69
# metacharacters that are still active within double-quoted strings.
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    70
Xsed="${SED}"' -e 1s/^X//'
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    71
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    72
# test EBCDIC or ASCII
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    73
case `echo A|od -x` in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    74
 *[Cc]1*) # EBCDIC based system
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    75
  SP2NL="tr '\100' '\n'"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    76
  NL2SP="tr '\r\n' '\100\100'"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    77
  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    78
 *) # Assume ASCII based system
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    79
  SP2NL="tr '\040' '\012'"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    80
  NL2SP="tr '\015\012' '\040\040'"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    81
  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    82
esac
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    83
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    84
# NLS nuisances.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    85
# Only set LANG and LC_ALL to C if already set.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    86
# These must not be set unconditionally because not all systems understand
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    87
# e.g. LANG=C (notably SCO).
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    88
# We save the old values to restore during execute mode.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    89
if test "${LC_ALL+set}" = set; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    90
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    91
fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    92
if test "${LANG+set}" = set; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    93
  save_LANG="$LANG"; LANG=C; export LANG
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    94
fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    95
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    96
# Make sure IFS has a sensible default
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
    97
: ${IFS=" 	"}
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    98
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
    99
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   100
  $echo "$modename: not configured to build any kind of library" 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   101
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   102
  exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   103
fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   104
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   105
# Global variables.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   106
mode=$default_mode
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   107
nonopt=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   108
prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   109
prevopt=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   110
run=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   111
show="$echo"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   112
show_help=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   113
execute_dlfiles=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   114
lo2o="s/\\.lo\$/.${objext}/"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   115
o2lo="s/\\.${objext}\$/.lo/"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   116
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   117
#####################################
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   118
# Shell function definitions:
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   119
# This seems to be the best place for them
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   120
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   121
# Need a lot of goo to handle *both* DLLs and import libs
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   122
# Has to be a shell function in order to 'eat' the argument
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   123
# that is supplied when $file_magic_command is called.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   124
win32_libid () {
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   125
  win32_libid_type="unknown"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   126
  win32_fileres=`file -L $1 2>/dev/null`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   127
  case $win32_fileres in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   128
  *ar\ archive\ import\ library*) # definitely import
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   129
    win32_libid_type="x86 archive import"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   130
    ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   131
  *ar\ archive*) # could be an import, or static
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   132
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   133
      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   134
      win32_nmres=`eval $NM -f posix -A $1 | \
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   135
	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   136
      if test "X$win32_nmres" = "Ximport" ; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   137
        win32_libid_type="x86 archive import"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   138
      else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   139
        win32_libid_type="x86 archive static"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   140
      fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   141
    fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   142
    ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   143
  *DLL*) 
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   144
    win32_libid_type="x86 DLL"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   145
    ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   146
  *executable*) # but shell scripts are "executable" too...
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   147
    case $win32_fileres in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   148
    *MS\ Windows\ PE\ Intel*)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   149
      win32_libid_type="x86 DLL"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   150
      ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   151
    esac
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   152
    ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   153
  esac
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   154
  $echo $win32_libid_type
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   155
}
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   156
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   157
# End of Shell function definitions
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   158
#####################################
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   159
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   160
# Parse our command line options once, thoroughly.
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   161
while test "$#" -gt 0
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   162
do
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   163
  arg="$1"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   164
  shift
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   165
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   166
  case $arg in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   167
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   168
  *) optarg= ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   169
  esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   170
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   171
  # If the previous option needs an argument, assign it.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   172
  if test -n "$prev"; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   173
    case $prev in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   174
    execute_dlfiles)
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   175
      execute_dlfiles="$execute_dlfiles $arg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   176
      ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   177
    tag)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   178
      tagname="$arg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   179
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   180
      # Check whether tagname contains only valid characters
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   181
      case $tagname in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   182
      *[!-_A-Za-z0-9,/]*)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   183
	$echo "$progname: invalid tag name: $tagname" 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   184
	exit 1
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   185
	;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   186
      esac
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   187
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   188
      case $tagname in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   189
      CC)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   190
	# Don't test for the "default" C tag, as we know, it's there, but
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   191
	# not specially marked.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   192
	;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   193
      *)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   194
	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   195
	  taglist="$taglist $tagname"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   196
	  # Evaluate the configuration.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   197
	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   198
	else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   199
	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   200
	fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   201
	;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   202
      esac
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   203
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   204
    *)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   205
      eval "$prev=\$arg"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   206
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   207
    esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   208
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   209
    prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   210
    prevopt=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   211
    continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   212
  fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   213
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   214
  # Have we seen a non-optional argument yet?
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   215
  case $arg in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   216
  --help)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   217
    show_help=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   218
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   219
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   220
  --version)
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   221
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   222
    $echo
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   223
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   224
    $echo "This is free software; see the source for copying conditions.  There is NO"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   225
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   226
    exit 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   227
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   228
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   229
  --config)
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   230
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   231
    # Now print the configurations for the tags.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   232
    for tagname in $taglist; do
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   233
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   234
    done
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   235
    exit 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   236
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   237
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   238
  --debug)
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   239
    $echo "$progname: enabling shell trace mode"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   240
    set -x
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   241
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   242
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   243
  --dry-run | -n)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   244
    run=:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   245
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   246
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   247
  --features)
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   248
    $echo "host: $host"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   249
    if test "$build_libtool_libs" = yes; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   250
      $echo "enable shared libraries"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   251
    else
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   252
      $echo "disable shared libraries"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   253
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   254
    if test "$build_old_libs" = yes; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   255
      $echo "enable static libraries"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   256
    else
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   257
      $echo "disable static libraries"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   258
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   259
    exit 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   260
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   261
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   262
  --finish) mode="finish" ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   263
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   264
  --mode) prevopt="--mode" prev=mode ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   265
  --mode=*) mode="$optarg" ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   266
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   267
  --preserve-dup-deps) duplicate_deps="yes" ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   268
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   269
  --quiet | --silent)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   270
    show=:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   271
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   272
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   273
  --tag) prevopt="--tag" prev=tag ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   274
  --tag=*)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   275
    set tag "$optarg" ${1+"$@"}
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   276
    shift
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   277
    prev=tag
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   278
    ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   279
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   280
  -dlopen)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   281
    prevopt="-dlopen"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   282
    prev=execute_dlfiles
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   283
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   284
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   285
  -*)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   286
    $echo "$modename: unrecognized option \`$arg'" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   287
    $echo "$help" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   288
    exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   289
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   290
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   291
  *)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   292
    nonopt="$arg"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   293
    break
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   294
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   295
  esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   296
done
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   297
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   298
if test -n "$prevopt"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   299
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   300
  $echo "$help" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   301
  exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   302
fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   303
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   304
# If this variable is set in any of the actions, the command in it
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   305
# will be execed at the end.  This prevents here-documents from being
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   306
# left over by shells.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   307
exec_cmd=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   308
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   309
if test -z "$show_help"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   310
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   311
  # Infer the operation mode.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   312
  if test -z "$mode"; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   313
    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   314
    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   315
    case $nonopt in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   316
    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   317
      mode=link
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   318
      for arg
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   319
      do
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   320
	case $arg in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   321
	-c)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   322
	   mode=compile
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   323
	   break
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   324
	   ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   325
	esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   326
      done
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   327
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   328
    *db | *dbx | *strace | *truss)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   329
      mode=execute
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   330
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   331
    *install*|cp|mv)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   332
      mode=install
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   333
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   334
    *rm)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   335
      mode=uninstall
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   336
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   337
    *)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   338
      # If we have no mode, but dlfiles were specified, then do execute mode.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   339
      test -n "$execute_dlfiles" && mode=execute
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   340
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   341
      # Just use the default operation mode.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   342
      if test -z "$mode"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   343
	if test -n "$nonopt"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   344
	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   345
	else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   346
	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   347
	fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   348
      fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   349
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   350
    esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   351
  fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   352
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   353
  # Only execute mode is allowed to have -dlopen flags.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   354
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   355
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   356
    $echo "$help" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   357
    exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   358
  fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   359
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   360
  # Change the help message to a mode-specific one.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   361
  generic_help="$help"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   362
  help="Try \`$modename --help --mode=$mode' for more information."
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   363
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   364
  # These modes are in order of execution frequency so that they run quickly.
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   365
  case $mode in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   366
  # libtool compile mode
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   367
  compile)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   368
    modename="$modename: compile"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   369
    # Get the compilation command and the source file.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   370
    base_compile=
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   371
    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   372
    suppress_output=
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   373
    arg_mode=normal
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   374
    libobj=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   375
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   376
    for arg
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   377
    do
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   378
      case "$arg_mode" in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   379
      arg  )
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   380
	# do not "continue".  Instead, add this to base_compile
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   381
	lastarg="$arg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   382
	arg_mode=normal
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   383
	;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   384
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   385
      target )
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   386
	libobj="$arg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   387
	arg_mode=normal
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   388
	continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   389
	;;
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   390
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   391
      normal )
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   392
	# Accept any command-line options.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   393
	case $arg in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   394
	-o)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   395
	  if test -n "$libobj" ; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   396
	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   397
	    exit 1
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   398
	  fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   399
	  arg_mode=target
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   400
	  continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   401
	  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   402
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   403
	-static)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   404
	  build_old_libs=yes
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   405
	  continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   406
	  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   407
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   408
	-prefer-pic)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   409
	  pic_mode=yes
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   410
	  continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   411
	  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   412
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   413
	-prefer-non-pic)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   414
	  pic_mode=no
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   415
	  continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   416
	  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   417
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   418
	-Xcompiler)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   419
	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   420
	  continue      #  The current "srcfile" will either be retained or
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   421
	  ;;            #  replaced later.  I would guess that would be a bug.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   422
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   423
	-Wc,*)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   424
	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   425
	  lastarg=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   426
	  save_ifs="$IFS"; IFS=','
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   427
	  for arg in $args; do
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   428
	    IFS="$save_ifs"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   429
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   430
	    # Double-quote args containing other shell metacharacters.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   431
	    # Many Bourne shells cannot handle close brackets correctly
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   432
	    # in scan sets, so we specify it separately.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   433
	    case $arg in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   434
	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   435
	      arg="\"$arg\""
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   436
	      ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   437
	    esac
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   438
	    lastarg="$lastarg $arg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   439
	  done
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   440
	  IFS="$save_ifs"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   441
	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   442
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   443
	  # Add the arguments to base_compile.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   444
	  base_compile="$base_compile $lastarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   445
	  continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   446
	  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   447
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   448
	* )
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   449
	  # Accept the current argument as the source file.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   450
	  # The previous "srcfile" becomes the current argument.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   451
	  #
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   452
	  lastarg="$srcfile"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   453
	  srcfile="$arg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   454
	  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   455
	esac  #  case $arg
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   456
	;;
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   457
      esac    #  case $arg_mode
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   458
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   459
      # Aesthetically quote the previous argument.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   460
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   461
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   462
      case $lastarg in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   463
      # Double-quote args containing other shell metacharacters.
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   464
      # Many Bourne shells cannot handle close brackets correctly
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   465
      # in scan sets, so we specify it separately.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   466
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   467
	lastarg="\"$lastarg\""
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   468
	;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   469
      esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   470
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   471
      base_compile="$base_compile $lastarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   472
    done # for arg
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   473
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   474
    case $arg_mode in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   475
    arg)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   476
      $echo "$modename: you must specify an argument for -Xcompile"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   477
      exit 1
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   478
      ;;
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   479
    target)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   480
      $echo "$modename: you must specify a target with \`-o'" 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   481
      exit 1
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   482
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   483
    *)
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   484
      # Get the name of the library object.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   485
      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   486
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   487
    esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   488
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   489
    # Recognize several different file suffixes.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   490
    # If the user specifies -o file.o, it is replaced with file.lo
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   491
    xform='[cCFSifmso]'
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   492
    case $libobj in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   493
    *.ada) xform=ada ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   494
    *.adb) xform=adb ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   495
    *.ads) xform=ads ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   496
    *.asm) xform=asm ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   497
    *.c++) xform=c++ ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   498
    *.cc) xform=cc ;;
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   499
    *.ii) xform=ii ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   500
    *.class) xform=class ;;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   501
    *.cpp) xform=cpp ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   502
    *.cxx) xform=cxx ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   503
    *.f90) xform=f90 ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   504
    *.for) xform=for ;;
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   505
    *.java) xform=java ;;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   506
    esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   507
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   508
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   509
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   510
    case $libobj in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   511
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   512
    *)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   513
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   514
      exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   515
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   516
    esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   517
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   518
    # Infer tagged configuration to use if any are available and
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   519
    # if one wasn't chosen via the "--tag" command line option.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   520
    # Only attempt this if the compiler in the base compile
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   521
    # command doesn't match the default compiler.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   522
    if test -n "$available_tags" && test -z "$tagname"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   523
      case $base_compile in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   524
      # Blanks in the command may have been stripped by the calling shell,
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   525
      # but not from the CC environment variable when configure was run.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   526
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   527
      # Blanks at the start of $base_compile will cause this to fail
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   528
      # if we don't check for them as well.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   529
      *)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   530
	for z in $available_tags; do
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   531
	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   532
	    # Evaluate the configuration.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   533
	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   534
	    case "$base_compile " in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   535
	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   536
	      # The compiler in the base compile command matches
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   537
	      # the one in the tagged configuration.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   538
	      # Assume this is the tagged configuration we want.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   539
	      tagname=$z
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   540
	      break
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   541
	      ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   542
	    esac
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   543
	  fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   544
	done
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   545
	# If $tagname still isn't set, then no tagged configuration
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   546
	# was found and let the user know that the "--tag" command
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   547
	# line option must be used.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   548
	if test -z "$tagname"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   549
	  $echo "$modename: unable to infer tagged configuration"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   550
	  $echo "$modename: specify a tag with \`--tag'" 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   551
	  exit 1
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   552
#        else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   553
#          $echo "$modename: using $tagname tagged configuration"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   554
	fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   555
	;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   556
      esac
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   557
    fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   558
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   559
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   560
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   561
    if test "X$xdir" = "X$obj"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   562
      xdir=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   563
    else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   564
      xdir=$xdir/
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   565
    fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   566
    lobj=${xdir}$objdir/$objname
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   567
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   568
    if test -z "$base_compile"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   569
      $echo "$modename: you must specify a compilation command" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   570
      $echo "$help" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   571
      exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   572
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   573
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   574
    # Delete any leftover library objects.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   575
    if test "$build_old_libs" = yes; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   576
      removelist="$obj $lobj $libobj ${libobj}T"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   577
    else
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   578
      removelist="$lobj $libobj ${libobj}T"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   579
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   580
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   581
    $run $rm $removelist
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   582
    trap "$run $rm $removelist; exit 1" 1 2 15
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   583
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   584
    # On Cygwin there's no "real" PIC flag so we must build both object types
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   585
    case $host_os in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   586
    cygwin* | mingw* | pw32* | os2*)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   587
      pic_mode=default
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   588
      ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   589
    esac
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   590
    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   591
      # non-PIC code in shared libraries is not supported
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   592
      pic_mode=default
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   593
    fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   594
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   595
    # Calculate the filename of the output object if compiler does
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   596
    # not support -o with -c
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   597
    if test "$compiler_c_o" = no; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   598
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   599
      lockfile="$output_obj.lock"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   600
      removelist="$removelist $output_obj $lockfile"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   601
      trap "$run $rm $removelist; exit 1" 1 2 15
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   602
    else
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   603
      output_obj=
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   604
      need_locks=no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   605
      lockfile=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   606
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   607
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   608
    # Lock this critical section if it is needed
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   609
    # We use this script file to make the link, it avoids creating a new file
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   610
    if test "$need_locks" = yes; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   611
      until $run ln "$0" "$lockfile" 2>/dev/null; do
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   612
	$show "Waiting for $lockfile to be removed"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   613
	sleep 2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   614
      done
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   615
    elif test "$need_locks" = warn; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   616
      if test -f "$lockfile"; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   617
	$echo "\
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   618
*** ERROR, $lockfile exists and contains:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   619
`cat $lockfile 2>/dev/null`
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   620
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   621
This indicates that another process is trying to use the same
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   622
temporary object file, and libtool could not work around it because
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   623
your compiler does not support \`-c' and \`-o' together.  If you
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   624
repeat this compilation, it may succeed, by chance, but you had better
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   625
avoid parallel builds (make -j) in this platform, or get a better
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   626
compiler."
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   627
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   628
	$run $rm $removelist
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   629
	exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   630
      fi
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   631
      $echo $srcfile > "$lockfile"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   632
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   633
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   634
    if test -n "$fix_srcfile_path"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   635
      eval srcfile=\"$fix_srcfile_path\"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   636
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   637
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   638
    $run $rm "$libobj" "${libobj}T"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   639
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   640
    # Create a libtool object file (analogous to a ".la" file),
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   641
    # but don't create it if we're doing a dry run.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   642
    test -z "$run" && cat > ${libobj}T <<EOF
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   643
# $libobj - a libtool object file
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   644
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   645
#
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   646
# Please DO NOT delete this file!
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   647
# It is necessary for linking the library.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   648
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   649
# Name of the PIC object.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   650
EOF
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   651
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   652
    # Only build a PIC object if we are building libtool libraries.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   653
    if test "$build_libtool_libs" = yes; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   654
      # Without this assignment, base_compile gets emptied.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   655
      fbsd_hideous_sh_bug=$base_compile
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   656
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   657
      if test "$pic_mode" != no; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   658
	command="$base_compile $srcfile $pic_flag"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   659
      else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   660
	# Don't build PIC code
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   661
	command="$base_compile $srcfile"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   662
      fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   663
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   664
      if test ! -d "${xdir}$objdir"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   665
	$show "$mkdir ${xdir}$objdir"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   666
	$run $mkdir ${xdir}$objdir
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   667
	status=$?
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   668
	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   669
	  exit $status
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   670
	fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   671
      fi
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   672
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   673
      if test -z "$output_obj"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   674
	# Place PIC objects in $objdir
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   675
	command="$command -o $lobj"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   676
      fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   677
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   678
      $run $rm "$lobj" "$output_obj"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   679
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   680
      $show "$command"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   681
      if $run eval "$command"; then :
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   682
      else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   683
	test -n "$output_obj" && $run $rm $removelist
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   684
	exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   685
      fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   686
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   687
      if test "$need_locks" = warn &&
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   688
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   689
	$echo "\
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   690
*** ERROR, $lockfile contains:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   691
`cat $lockfile 2>/dev/null`
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   692
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   693
but it should contain:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   694
$srcfile
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   695
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   696
This indicates that another process is trying to use the same
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   697
temporary object file, and libtool could not work around it because
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   698
your compiler does not support \`-c' and \`-o' together.  If you
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   699
repeat this compilation, it may succeed, by chance, but you had better
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   700
avoid parallel builds (make -j) in this platform, or get a better
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   701
compiler."
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   702
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   703
	$run $rm $removelist
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   704
	exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   705
      fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   706
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   707
      # Just move the object if needed, then go on to compile the next one
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   708
      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   709
	$show "$mv $output_obj $lobj"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   710
	if $run $mv $output_obj $lobj; then :
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   711
	else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   712
	  error=$?
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   713
	  $run $rm $removelist
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   714
	  exit $error
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   715
	fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   716
      fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   717
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   718
      # Append the name of the PIC object to the libtool object file.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   719
      test -z "$run" && cat >> ${libobj}T <<EOF
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   720
pic_object='$objdir/$objname'
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   721
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   722
EOF
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   723
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   724
      # Allow error messages only from the first compilation.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   725
      suppress_output=' >/dev/null 2>&1'
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   726
    else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   727
      # No PIC object so indicate it doesn't exist in the libtool
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   728
      # object file.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   729
      test -z "$run" && cat >> ${libobj}T <<EOF
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   730
pic_object=none
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   731
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   732
EOF
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   733
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   734
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   735
    # Only build a position-dependent object if we build old libraries.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   736
    if test "$build_old_libs" = yes; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   737
      if test "$pic_mode" != yes; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   738
	# Don't build PIC code
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   739
	command="$base_compile $srcfile"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   740
      else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   741
	command="$base_compile $srcfile $pic_flag"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   742
      fi
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   743
      if test "$compiler_c_o" = yes; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   744
	command="$command -o $obj"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   745
      fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   746
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   747
      # Suppress compiler output if we already did a PIC compilation.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   748
      command="$command$suppress_output"
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   749
      $run $rm "$obj" "$output_obj"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   750
      $show "$command"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   751
      if $run eval "$command"; then :
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   752
      else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   753
	$run $rm $removelist
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   754
	exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   755
      fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   756
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   757
      if test "$need_locks" = warn &&
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   758
	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   759
	$echo "\
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   760
*** ERROR, $lockfile contains:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   761
`cat $lockfile 2>/dev/null`
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   762
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   763
but it should contain:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   764
$srcfile
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   765
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   766
This indicates that another process is trying to use the same
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   767
temporary object file, and libtool could not work around it because
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   768
your compiler does not support \`-c' and \`-o' together.  If you
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   769
repeat this compilation, it may succeed, by chance, but you had better
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   770
avoid parallel builds (make -j) in this platform, or get a better
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   771
compiler."
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   772
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   773
	$run $rm $removelist
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   774
	exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   775
      fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   776
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   777
      # Just move the object if needed
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   778
      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   779
	$show "$mv $output_obj $obj"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   780
	if $run $mv $output_obj $obj; then :
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   781
	else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   782
	  error=$?
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   783
	  $run $rm $removelist
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   784
	  exit $error
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   785
	fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   786
      fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   787
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   788
      # Append the name of the non-PIC object the libtool object file.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   789
      # Only append if the libtool object file exists.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   790
      test -z "$run" && cat >> ${libobj}T <<EOF
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   791
# Name of the non-PIC object.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   792
non_pic_object='$objname'
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   793
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   794
EOF
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   795
    else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   796
      # Append the name of the non-PIC object the libtool object file.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   797
      # Only append if the libtool object file exists.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   798
      test -z "$run" && cat >> ${libobj}T <<EOF
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   799
# Name of the non-PIC object.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   800
non_pic_object=none
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   801
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   802
EOF
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   803
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   804
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   805
    $run $mv "${libobj}T" "${libobj}"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   806
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   807
    # Unlock the critical section if it was locked
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   808
    if test "$need_locks" != no; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   809
      $run $rm "$lockfile"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   810
    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   811
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   812
    exit 0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   813
    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   814
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   815
  # libtool link mode
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   816
  link | relink)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   817
    modename="$modename: link"
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   818
    case $host in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   819
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   820
      # It is impossible to link a dll without this setting, and
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   821
      # we shouldn't force the makefile maintainer to figure out
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   822
      # which system we are compiling for in order to pass an extra
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   823
      # flag for every libtool invocation.
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   824
      # allow_undefined=no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   825
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   826
      # FIXME: Unfortunately, there are problems with the above when trying
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   827
      # to make a dll which has undefined symbols, in which case not
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   828
      # even a static library is built.  For now, we need to specify
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   829
      # -no-undefined on the libtool link line when we can be certain
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   830
      # that all symbols are satisfied, otherwise we get a static library.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   831
      allow_undefined=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   832
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   833
    *)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   834
      allow_undefined=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   835
      ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   836
    esac
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   837
    libtool_args="$nonopt"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   838
    base_compile="$nonopt"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   839
    compile_command="$nonopt"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   840
    finalize_command="$nonopt"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   841
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   842
    compile_rpath=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   843
    finalize_rpath=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   844
    compile_shlibpath=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   845
    finalize_shlibpath=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   846
    convenience=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   847
    old_convenience=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   848
    deplibs=
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   849
    old_deplibs=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   850
    compiler_flags=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   851
    linker_flags=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   852
    dllsearchpath=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   853
    lib_search_path=`pwd`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   854
    inst_prefix_dir=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   855
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   856
    avoid_version=no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   857
    dlfiles=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   858
    dlprefiles=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   859
    dlself=no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   860
    export_dynamic=no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   861
    export_symbols=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   862
    export_symbols_regex=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   863
    generated=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   864
    libobjs=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   865
    ltlibs=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   866
    module=no
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   867
    no_install=no
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   868
    objs=
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   869
    non_pic_objects=
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   870
    prefer_static_libs=no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   871
    preload=no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   872
    prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   873
    prevarg=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   874
    release=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   875
    rpath=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   876
    xrpath=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   877
    perm_rpath=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   878
    temp_rpath=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   879
    thread_safe=no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   880
    vinfo=
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   881
    vinfo_number=no
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   882
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   883
    # We need to know -static, to get the right output filenames.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   884
    for arg
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   885
    do
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   886
      case $arg in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   887
      -all-static | -static)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   888
	if test "X$arg" = "X-all-static"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   889
	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   890
	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   891
	  fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   892
	  if test -n "$link_static_flag"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   893
	    dlopen_self=$dlopen_self_static
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   894
	  fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   895
	else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   896
	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   897
	    dlopen_self=$dlopen_self_static
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   898
	  fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   899
	fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   900
	build_libtool_libs=no
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   901
	build_old_libs=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   902
	prefer_static_libs=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   903
	break
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   904
	;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   905
      esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   906
    done
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   907
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   908
    # See if our shared archives depend on static archives.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   909
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   910
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   911
    # Go through the arguments, transforming them on the way.
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   912
    while test "$#" -gt 0; do
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   913
      arg="$1"
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   914
      base_compile="$base_compile $arg"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   915
      shift
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   916
      case $arg in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   917
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   918
	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   919
	;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   920
      *) qarg=$arg ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   921
      esac
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   922
      libtool_args="$libtool_args $qarg"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   923
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   924
      # If the previous option needs an argument, assign it.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   925
      if test -n "$prev"; then
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   926
	case $prev in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   927
	output)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   928
	  compile_command="$compile_command @OUTPUT@"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   929
	  finalize_command="$finalize_command @OUTPUT@"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   930
	  ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   931
	esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   932
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   933
	case $prev in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   934
	dlfiles|dlprefiles)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   935
	  if test "$preload" = no; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   936
	    # Add the symbol object into the linking commands.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   937
	    compile_command="$compile_command @SYMFILE@"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   938
	    finalize_command="$finalize_command @SYMFILE@"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   939
	    preload=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   940
	  fi
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   941
	  case $arg in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   942
	  *.la | *.lo) ;;  # We handle these cases below.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   943
	  force)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   944
	    if test "$dlself" = no; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   945
	      dlself=needless
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   946
	      export_dynamic=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   947
	    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   948
	    prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   949
	    continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   950
	    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   951
	  self)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   952
	    if test "$prev" = dlprefiles; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   953
	      dlself=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   954
	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   955
	      dlself=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   956
	    else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   957
	      dlself=needless
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   958
	      export_dynamic=yes
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   959
	    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   960
	    prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   961
	    continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   962
	    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   963
	  *)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   964
	    if test "$prev" = dlfiles; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   965
	      dlfiles="$dlfiles $arg"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   966
	    else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   967
	      dlprefiles="$dlprefiles $arg"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   968
	    fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   969
	    prev=
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   970
	    continue
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   971
	    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   972
	  esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   973
	  ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   974
	expsyms)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   975
	  export_symbols="$arg"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   976
	  if test ! -f "$arg"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   977
	    $echo "$modename: symbol file \`$arg' does not exist"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   978
	    exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   979
	  fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   980
	  prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   981
	  continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   982
	  ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   983
	expsyms_regex)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   984
	  export_symbols_regex="$arg"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   985
	  prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   986
	  continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   987
	  ;;
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   988
	inst_prefix)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   989
	  inst_prefix_dir="$arg"
387
469d5c0da01d Fixed shared library building on MacOS X (thanks Max!)
Sam Lantinga <slouken@libsdl.org>
parents: 1
diff changeset
   990
	  prev=
469d5c0da01d Fixed shared library building on MacOS X (thanks Max!)
Sam Lantinga <slouken@libsdl.org>
parents: 1
diff changeset
   991
	  continue
469d5c0da01d Fixed shared library building on MacOS X (thanks Max!)
Sam Lantinga <slouken@libsdl.org>
parents: 1
diff changeset
   992
	  ;;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   993
	release)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   994
	  release="-$arg"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   995
	  prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   996
	  continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
   997
	  ;;
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   998
	objectlist)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
   999
	  if test -f "$arg"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1000
	    save_arg=$arg
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1001
	    moreargs=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1002
	    for fil in `cat $save_arg`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1003
	    do
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1004
#	      moreargs="$moreargs $fil"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1005
	      arg=$fil
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1006
	      # A libtool-controlled object.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1007
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1008
	      # Check to see that this really is a libtool object.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1009
	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1010
		pic_object=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1011
		non_pic_object=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1012
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1013
		# Read the .lo file
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1014
		# If there is no directory component, then add one.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1015
		case $arg in
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1016
		*/* | *\\*) . $arg ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1017
		*) . ./$arg ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1018
		esac
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1019
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1020
		if test -z "$pic_object" || \
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1021
		   test -z "$non_pic_object" ||
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1022
		   test "$pic_object" = none && \
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1023
		   test "$non_pic_object" = none; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1024
		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1025
		  exit 1
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1026
		fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1027
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1028
		# Extract subdirectory from the argument.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1029
		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1030
		if test "X$xdir" = "X$arg"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1031
		  xdir=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1032
		else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1033
		  xdir="$xdir/"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1034
		fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1035
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1036
		if test "$pic_object" != none; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1037
		  # Prepend the subdirectory the object is found in.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1038
		  pic_object="$xdir$pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1039
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1040
		  if test "$prev" = dlfiles; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1041
		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1042
		      dlfiles="$dlfiles $pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1043
		      prev=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1044
		      continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1045
		    else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1046
		      # If libtool objects are unsupported, then we need to preload.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1047
		      prev=dlprefiles
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1048
		    fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1049
		  fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1050
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1051
		  # CHECK ME:  I think I busted this.  -Ossama
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1052
		  if test "$prev" = dlprefiles; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1053
		    # Preload the old-style object.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1054
		    dlprefiles="$dlprefiles $pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1055
		    prev=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1056
		  fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1057
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1058
		  # A PIC object.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1059
		  libobjs="$libobjs $pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1060
		  arg="$pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1061
		fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1062
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1063
		# Non-PIC object.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1064
		if test "$non_pic_object" != none; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1065
		  # Prepend the subdirectory the object is found in.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1066
		  non_pic_object="$xdir$non_pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1067
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1068
		  # A standard non-PIC object
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1069
		  non_pic_objects="$non_pic_objects $non_pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1070
		  if test -z "$pic_object" || test "$pic_object" = none ; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1071
		    arg="$non_pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1072
		  fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1073
		fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1074
	      else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1075
		# Only an error if not doing a dry-run.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1076
		if test -z "$run"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1077
		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1078
		  exit 1
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1079
		else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1080
		  # Dry-run case.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1081
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1082
		  # Extract subdirectory from the argument.
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1083
		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1084
		  if test "X$xdir" = "X$arg"; then
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1085
		    xdir=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1086
		  else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1087
		    xdir="$xdir/"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1088
		  fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1089
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1090
		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1091
		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1092
		  libobjs="$libobjs $pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1093
		  non_pic_objects="$non_pic_objects $non_pic_object"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1094
		fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1095
	      fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1096
	    done
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1097
	  else
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1098
	    $echo "$modename: link input file \`$save_arg' does not exist"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1099
	    exit 1
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1100
	  fi
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1101
	  arg=$save_arg
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1102
	  prev=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1103
	  continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1104
	  ;;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1105
	rpath | xrpath)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1106
	  # We need an absolute path.
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1107
	  case $arg in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1108
	  [\\/]* | [A-Za-z]:[\\/]*) ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1109
	  *)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1110
	    $echo "$modename: only absolute run-paths are allowed" 1>&2
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1111
	    exit 1
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1112
	    ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1113
	  esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1114
	  if test "$prev" = rpath; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1115
	    case "$rpath " in
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1116
	    *" $arg "*) ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1117
	    *) rpath="$rpath $arg" ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1118
	    esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1119
	  else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1120
	    case "$xrpath " in
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1121
	    *" $arg "*) ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1122
	    *) xrpath="$xrpath $arg" ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1123
	    esac
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1124
	  fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1125
	  prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1126
	  continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1127
	  ;;
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1128
	xcompiler)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1129
	  compiler_flags="$compiler_flags $qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1130
	  prev=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1131
	  compile_command="$compile_command $qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1132
	  finalize_command="$finalize_command $qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1133
	  continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1134
	  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1135
	xlinker)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1136
	  linker_flags="$linker_flags $qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1137
	  compiler_flags="$compiler_flags $wl$qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1138
	  prev=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1139
	  compile_command="$compile_command $wl$qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1140
	  finalize_command="$finalize_command $wl$qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1141
	  continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1142
	  ;;
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1143
	xcclinker)
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1144
	  linker_flags="$linker_flags $qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1145
	  compiler_flags="$compiler_flags $qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1146
	  prev=
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1147
	  compile_command="$compile_command $qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1148
	  finalize_command="$finalize_command $qarg"
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1149
	  continue
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1150
	  ;;
741
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1151
	framework)
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1152
	  case $host in
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1153
	    *-*-darwin*)
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1154
	      case "$deplibs " in
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1155
	        *" $qarg.framework "*) ;;
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1156
		*) deplibs="$deplibs $qarg.framework" # this is fixed later
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1157
		   ;;
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1158
              esac
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1159
              ;;
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1160
   	  esac
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1161
	  prev=
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1162
	  continue
97b9c301df94 Date: Mon, 17 Nov 2003 23:12:59 +0100
Sam Lantinga <slouken@libsdl.org>
parents: 730
diff changeset
  1163
	  ;;
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1164
	*)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1165
	  eval "$prev=\"\$arg\""
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1166
	  prev=
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1167
	  continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1168
	  ;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1169
	esac
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1170
      fi # test -n "$prev"
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1171
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1172
      prevarg="$arg"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1173
729
dac996d69abb Updated libtool support so Mingw32 builds work.
Sam Lantinga <slouken@libsdl.org>
parents: 608
diff changeset
  1174
      case $arg in
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1175
      -all-static)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1176
	if test -n "$link_static_flag"; then
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1177
	  compile_command="$compile_command $link_static_flag"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1178
	  finalize_command="$finalize_command $link_static_flag"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1179
	fi
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1180
	continue
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1181
	;;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1182
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1183
      -allow-undefined)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1184
	# FIXME: remove this flag sometime in the future.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
  1185
	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2