Develop and Download Open Source Software

Browse CVS Repository

Diff of /freewnn/FreeWnn/ltmain.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.5 by aono, Wed Jun 4 08:35:02 2003 UTC revision 1.6 by aonoto, Sat Sep 5 19:35:51 2009 UTC
# Line 1  Line 1 
1  # ltmain.sh - Provide generalized library-building support services.  # ltmain.sh - Provide generalized library-building support services.
2  # NOTE: Changing this file will not affect anything until you rerun configure.  # NOTE: Changing this file will not affect anything until you rerun configure.
3  #  #
4  # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003  # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5  # Free Software Foundation, Inc.  # 2007, 2008  Free Software Foundation, Inc.
6  # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996  # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7  #  #
8  # This program is free software; you can redistribute it and/or modify  # This program is free software; you can redistribute it and/or modify
# Line 17  Line 17 
17  #  #
18  # You should have received a copy of the GNU General Public License  # You should have received a copy of the GNU General Public License
19  # along with this program; if not, write to the Free Software  # along with this program; if not, write to the Free Software
20  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  #  #
22  # As a special exception to the GNU General Public License, if you  # As a special exception to the GNU General Public License, if you
23  # distribute this file as part of a program that contains a  # distribute this file as part of a program that contains a
24  # configuration script generated by Autoconf, you may include it under  # configuration script generated by Autoconf, you may include it under
25  # the same distribution terms that you use for the rest of that program.  # the same distribution terms that you use for the rest of that program.
26    
27    basename="s,^.*/,,g"
28    
29    # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30    # is ksh but when the shell is invoked as "sh" and the current value of
31    # the _XPG environment variable is not equal to 1 (one), the special
32    # positional parameter $0, within a function call, is the name of the
33    # function.
34    progpath="$0"
35    
36    # The name of this program:
37    progname=`echo "$progpath" | $SED $basename`
38    modename="$progname"
39    
40    # Global variables:
41    EXIT_SUCCESS=0
42    EXIT_FAILURE=1
43    
44    PROGRAM=ltmain.sh
45    PACKAGE=libtool
46    VERSION=1.5.26
47    TIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
48    
49    # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50    if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
51      emulate sh
52      NULLCMD=:
53      # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54      # is contrary to our usage.  Disable this feature.
55      alias -g '${1+"$@"}'='"$@"'
56      setopt NO_GLOB_SUBST
57    else
58      case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59    fi
60    BIN_SH=xpg4; export BIN_SH # for Tru64
61    DUALCASE=1; export DUALCASE # for MKS sh
62    
63  # Check that we have a working $echo.  # Check that we have a working $echo.
64  if test "X$1" = X--no-reexec; then  if test "X$1" = X--no-reexec; then
65    # Discard the --no-reexec flag, and continue.    # Discard the --no-reexec flag, and continue.
# Line 36  elif test "X`($echo '\t') 2>/dev/null`" Line 72  elif test "X`($echo '\t') 2>/dev/null`"
72    :    :
73  else  else
74    # Restart under the correct shell, and then maybe $echo will work.    # Restart under the correct shell, and then maybe $echo will work.
75    exec $SHELL "$0" --no-reexec ${1+"$@"}    exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76  fi  fi
77    
78  if test "X$1" = X--fallback-echo; then  if test "X$1" = X--fallback-echo; then
# Line 45  if test "X$1" = X--fallback-echo; then Line 81  if test "X$1" = X--fallback-echo; then
81    cat <<EOF    cat <<EOF
82  $*  $*
83  EOF  EOF
84    exit 0    exit $EXIT_SUCCESS
85  fi  fi
86    
 # The name of this program.  
 progname=`$echo "$0" | ${SED} 's%^.*/%%'`  
 modename="$progname"  
   
 # Constants.  
 PROGRAM=ltmain.sh  
 PACKAGE=libtool  
 VERSION=1.5  
 TIMESTAMP=" (1.1220 2003/04/05 19:32:58)"  
   
87  default_mode=  default_mode=
88  help="Try \`$progname --help' for more information."  help="Try \`$progname --help' for more information."
89  magic="%%%MAGIC variable%%%"  magic="%%%MAGIC variable%%%"
# Line 70  rm="rm -f" Line 96  rm="rm -f"
96  Xsed="${SED}"' -e 1s/^X//'  Xsed="${SED}"' -e 1s/^X//'
97  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98  # test EBCDIC or ASCII  # test EBCDIC or ASCII
99  case `echo A|od -x` in  case `echo X|tr X '\101'` in
100   *[Cc]1*) # EBCDIC based system   A) # ASCII based system
101    SP2NL="tr '\100' '\n'"      # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
102    NL2SP="tr '\r\n' '\100\100'"    SP2NL='tr \040 \012'
103      NL2SP='tr \015\012 \040\040'
104    ;;    ;;
105   *) # Assume ASCII based system   *) # EBCDIC based system
106    SP2NL="tr '\040' '\012'"    SP2NL='tr \100 \n'
107    NL2SP="tr '\015\012' '\040\040'"    NL2SP='tr \r\n \100\100'
108    ;;    ;;
109  esac  esac
110    
# Line 86  esac Line 113  esac
113  # These must not be set unconditionally because not all systems understand  # These must not be set unconditionally because not all systems understand
114  # e.g. LANG=C (notably SCO).  # e.g. LANG=C (notably SCO).
115  # We save the old values to restore during execute mode.  # We save the old values to restore during execute mode.
116  if test "${LC_ALL+set}" = set; then  lt_env=
117    save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL  for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118  fi  do
119  if test "${LANG+set}" = set; then    eval "if test \"\${$lt_var+set}\" = set; then
120    save_LANG="$LANG"; LANG=C; export LANG            save_$lt_var=\$$lt_var
121              lt_env=\"$lt_var=\$$lt_var \$lt_env\"
122              $lt_var=C
123              export $lt_var
124            fi"
125    done
126    
127    if test -n "$lt_env"; then
128      lt_env="env $lt_env"
129  fi  fi
130    
131  # Make sure IFS has a sensible default  # Make sure IFS has a sensible default
132  : ${IFS="       "}  lt_nl='
133    '
134    IFS="   $lt_nl"
135    
136  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137    $echo "$modename: not configured to build any kind of library" 1>&2    $echo "$modename: not configured to build any kind of library" 1>&2
138    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
139    exit 1    exit $EXIT_FAILURE
140  fi  fi
141    
142  # Global variables.  # Global variables.
# Line 111  run= Line 148  run=
148  show="$echo"  show="$echo"
149  show_help=  show_help=
150  execute_dlfiles=  execute_dlfiles=
151    duplicate_deps=no
152    preserve_args=
153  lo2o="s/\\.lo\$/.${objext}/"  lo2o="s/\\.lo\$/.${objext}/"
154  o2lo="s/\\.${objext}\$/.lo/"  o2lo="s/\\.${objext}\$/.lo/"
155    extracted_archives=
156    extracted_serial=0
157    
158  #####################################  #####################################
159  # Shell function definitions:  # Shell function definitions:
160  # This seems to be the best place for them  # This seems to be the best place for them
161    
162    # func_mktempdir [string]
163    # Make a temporary directory that won't clash with other running
164    # libtool processes, and avoids race conditions if possible.  If
165    # given, STRING is the basename for that directory.
166    func_mktempdir ()
167    {
168        my_template="${TMPDIR-/tmp}/${1-$progname}"
169    
170        if test "$run" = ":"; then
171          # Return a directory name, but don't create it in dry-run mode
172          my_tmpdir="${my_template}-$$"
173        else
174    
175          # If mktemp works, use that first and foremost
176          my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
177    
178          if test ! -d "$my_tmpdir"; then
179            # Failing that, at least try and use $RANDOM to avoid a race
180            my_tmpdir="${my_template}-${RANDOM-0}$$"
181    
182            save_mktempdir_umask=`umask`
183            umask 0077
184            $mkdir "$my_tmpdir"
185            umask $save_mktempdir_umask
186          fi
187    
188          # If we're not in dry-run mode, bomb out on failure
189          test -d "$my_tmpdir" || {
190            $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
191            exit $EXIT_FAILURE
192          }
193        fi
194    
195        $echo "X$my_tmpdir" | $Xsed
196    }
197    
198    
199    # func_win32_libid arg
200    # return the library type of file 'arg'
201    #
202  # Need a lot of goo to handle *both* DLLs and import libs  # Need a lot of goo to handle *both* DLLs and import libs
203  # Has to be a shell function in order to 'eat' the argument  # Has to be a shell function in order to 'eat' the argument
204  # that is supplied when $file_magic_command is called.  # that is supplied when $file_magic_command is called.
205  win32_libid () {  func_win32_libid ()
206    {
207    win32_libid_type="unknown"    win32_libid_type="unknown"
208    win32_fileres=`file -L $1 2>/dev/null`    win32_fileres=`file -L $1 2>/dev/null`
209    case $win32_fileres in    case $win32_fileres in
# Line 130  win32_libid () { Line 212  win32_libid () {
212      ;;      ;;
213    *ar\ archive*) # could be an import, or static    *ar\ archive*) # could be an import, or static
214      if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \      if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215        grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then        $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216        win32_nmres=`eval $NM -f posix -A $1 | \        win32_nmres=`eval $NM -f posix -A $1 | \
217          sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`          $SED -n -e '1,100{
218        if test "X$win32_nmres" = "Ximport" ; then                  / I /{
219          win32_libid_type="x86 archive import"                          s,.*,import,
220        else                          p
221          win32_libid_type="x86 archive static"                          q
222        fi                          }
223                    }'`
224          case $win32_nmres in
225          import*)  win32_libid_type="x86 archive import";;
226          *)        win32_libid_type="x86 archive static";;
227          esac
228      fi      fi
229      ;;      ;;
230    *DLL*)    *DLL*)
231      win32_libid_type="x86 DLL"      win32_libid_type="x86 DLL"
232      ;;      ;;
233    *executable*) # but shell scripts are "executable" too...    *executable*) # but shell scripts are "executable" too...
# Line 154  win32_libid () { Line 241  win32_libid () {
241    $echo $win32_libid_type    $echo $win32_libid_type
242  }  }
243    
244    
245    # func_infer_tag arg
246    # Infer tagged configuration to use if any are available and
247    # if one wasn't chosen via the "--tag" command line option.
248    # Only attempt this if the compiler in the base compile
249    # command doesn't match the default compiler.
250    # arg is usually of the form 'gcc ...'
251    func_infer_tag ()
252    {
253        if test -n "$available_tags" && test -z "$tagname"; then
254          CC_quoted=
255          for arg in $CC; do
256            case $arg in
257              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
258              arg="\"$arg\""
259              ;;
260            esac
261            CC_quoted="$CC_quoted $arg"
262          done
263          case $@ in
264          # Blanks in the command may have been stripped by the calling shell,
265          # but not from the CC environment variable when configure was run.
266          " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267          # Blanks at the start of $base_compile will cause this to fail
268          # if we don't check for them as well.
269          *)
270            for z in $available_tags; do
271              if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272                # Evaluate the configuration.
273                eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
274                CC_quoted=
275                for arg in $CC; do
276                # Double-quote args containing other shell metacharacters.
277                case $arg in
278                  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
279                  arg="\"$arg\""
280                  ;;
281                esac
282                CC_quoted="$CC_quoted $arg"
283              done
284                case "$@ " in
285                  " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286                  # The compiler in the base compile command matches
287                  # the one in the tagged configuration.
288                  # Assume this is the tagged configuration we want.
289                  tagname=$z
290                  break
291                  ;;
292                esac
293              fi
294            done
295            # If $tagname still isn't set, then no tagged configuration
296            # was found and let the user know that the "--tag" command
297            # line option must be used.
298            if test -z "$tagname"; then
299              $echo "$modename: unable to infer tagged configuration"
300              $echo "$modename: specify a tag with \`--tag'" 1>&2
301              exit $EXIT_FAILURE
302    #        else
303    #          $echo "$modename: using $tagname tagged configuration"
304            fi
305            ;;
306          esac
307        fi
308    }
309    
310    
311    # func_extract_an_archive dir oldlib
312    func_extract_an_archive ()
313    {
314        f_ex_an_ar_dir="$1"; shift
315        f_ex_an_ar_oldlib="$1"
316    
317        $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318        $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319        if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
320         :
321        else
322          $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
323          exit $EXIT_FAILURE
324        fi
325    }
326    
327    # func_extract_archives gentop oldlib ...
328    func_extract_archives ()
329    {
330        my_gentop="$1"; shift
331        my_oldlibs=${1+"$@"}
332        my_oldobjs=""
333        my_xlib=""
334        my_xabs=""
335        my_xdir=""
336        my_status=""
337    
338        $show "${rm}r $my_gentop"
339        $run ${rm}r "$my_gentop"
340        $show "$mkdir $my_gentop"
341        $run $mkdir "$my_gentop"
342        my_status=$?
343        if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
344          exit $my_status
345        fi
346    
347        for my_xlib in $my_oldlibs; do
348          # Extract the objects.
349          case $my_xlib in
350            [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351            *) my_xabs=`pwd`"/$my_xlib" ;;
352          esac
353          my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
354          my_xlib_u=$my_xlib
355          while :; do
356            case " $extracted_archives " in
357            *" $my_xlib_u "*)
358              extracted_serial=`expr $extracted_serial + 1`
359              my_xlib_u=lt$extracted_serial-$my_xlib ;;
360            *) break ;;
361            esac
362          done
363          extracted_archives="$extracted_archives $my_xlib_u"
364          my_xdir="$my_gentop/$my_xlib_u"
365    
366          $show "${rm}r $my_xdir"
367          $run ${rm}r "$my_xdir"
368          $show "$mkdir $my_xdir"
369          $run $mkdir "$my_xdir"
370          exit_status=$?
371          if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
372            exit $exit_status
373          fi
374          case $host in
375          *-darwin*)
376            $show "Extracting $my_xabs"
377            # Do not bother doing anything if just a dry run
378            if test -z "$run"; then
379              darwin_orig_dir=`pwd`
380              cd $my_xdir || exit $?
381              darwin_archive=$my_xabs
382              darwin_curdir=`pwd`
383              darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384              darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385              if test -n "$darwin_arches"; then
386                darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
387                darwin_arch=
388                $show "$darwin_base_archive has multiple architectures $darwin_arches"
389                for darwin_arch in  $darwin_arches ; do
390                  mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391                  lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392                  cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393                  func_extract_an_archive "`pwd`" "${darwin_base_archive}"
394                  cd "$darwin_curdir"
395                  $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396                done # $darwin_arches
397          ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398                darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
399                darwin_file=
400                darwin_files=
401                for darwin_file in $darwin_filelist; do
402                  darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403                  lipo -create -output "$darwin_file" $darwin_files
404                done # $darwin_filelist
405                ${rm}r unfat-$$
406                cd "$darwin_orig_dir"
407              else
408                cd "$darwin_orig_dir"
409                func_extract_an_archive "$my_xdir" "$my_xabs"
410              fi # $darwin_arches
411            fi # $run
412            ;;
413          *)
414            func_extract_an_archive "$my_xdir" "$my_xabs"
415            ;;
416          esac
417          my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
418        done
419        func_extract_archives_result="$my_oldobjs"
420    }
421  # End of Shell function definitions  # End of Shell function definitions
422  #####################################  #####################################
423    
424    # Darwin sucks
425    eval std_shrext=\"$shrext_cmds\"
426    
427    disable_libs=no
428    
429  # Parse our command line options once, thoroughly.  # Parse our command line options once, thoroughly.
430  while test "$#" -gt 0  while test "$#" -gt 0
431  do  do
# Line 176  do Line 445  do
445        ;;        ;;
446      tag)      tag)
447        tagname="$arg"        tagname="$arg"
448          preserve_args="${preserve_args}=$arg"
449    
450        # Check whether tagname contains only valid characters        # Check whether tagname contains only valid characters
451        case $tagname in        case $tagname in
452        *[!-_A-Za-z0-9,/]*)        *[!-_A-Za-z0-9,/]*)
453          $echo "$progname: invalid tag name: $tagname" 1>&2          $echo "$progname: invalid tag name: $tagname" 1>&2
454          exit 1          exit $EXIT_FAILURE
455          ;;          ;;
456        esac        esac
457    
# Line 191  do Line 461  do
461          # not specially marked.          # not specially marked.
462          ;;          ;;
463        *)        *)
464          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
465            taglist="$taglist $tagname"            taglist="$taglist $tagname"
466            # Evaluate the configuration.            # Evaluate the configuration.
467            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
468          else          else
469            $echo "$progname: ignoring unknown tag $tagname" 1>&2            $echo "$progname: ignoring unknown tag $tagname" 1>&2
470          fi          fi
# Line 218  do Line 488  do
488      ;;      ;;
489    
490    --version)    --version)
491      $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"      echo "\
492      $echo  $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
493      $echo "Copyright (C) 2003  Free Software Foundation, Inc."  
494      $echo "This is free software; see the source for copying conditions.  There is NO"  Copyright (C) 2008  Free Software Foundation, Inc.
495      $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."  This is free software; see the source for copying conditions.  There is NO
496      exit 0  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
497        exit $?
498      ;;      ;;
499    
500    --config)    --config)
501      ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0      ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
502      # Now print the configurations for the tags.      # Now print the configurations for the tags.
503      for tagname in $taglist; do      for tagname in $taglist; do
504        ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"        ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
505      done      done
506      exit 0      exit $?
507      ;;      ;;
508    
509    --debug)    --debug)
510      $echo "$progname: enabling shell trace mode"      $echo "$progname: enabling shell trace mode"
511      set -x      set -x
512        preserve_args="$preserve_args $arg"
513      ;;      ;;
514    
515    --dry-run | -n)    --dry-run | -n)
# Line 256  do Line 528  do
528      else      else
529        $echo "disable static libraries"        $echo "disable static libraries"
530      fi      fi
531      exit 0      exit $?
532      ;;      ;;
533    
534    --finish) mode="finish" ;;    --finish) mode="finish" ;;
# Line 268  do Line 540  do
540    
541    --quiet | --silent)    --quiet | --silent)
542      show=:      show=:
543        preserve_args="$preserve_args $arg"
544      ;;      ;;
545    
546    --tag) prevopt="--tag" prev=tag ;;    --tag)
547        prevopt="--tag"
548        prev=tag
549        preserve_args="$preserve_args --tag"
550        ;;
551    --tag=*)    --tag=*)
552      set tag "$optarg" ${1+"$@"}      set tag "$optarg" ${1+"$@"}
553      shift      shift
554      prev=tag      prev=tag
555        preserve_args="$preserve_args --tag"
556      ;;      ;;
557    
558    -dlopen)    -dlopen)
# Line 285  do Line 563  do
563    -*)    -*)
564      $echo "$modename: unrecognized option \`$arg'" 1>&2      $echo "$modename: unrecognized option \`$arg'" 1>&2
565      $echo "$help" 1>&2      $echo "$help" 1>&2
566      exit 1      exit $EXIT_FAILURE
567      ;;      ;;
568    
569    *)    *)
# Line 298  done Line 576  done
576  if test -n "$prevopt"; then  if test -n "$prevopt"; then
577    $echo "$modename: option \`$prevopt' requires an argument" 1>&2    $echo "$modename: option \`$prevopt' requires an argument" 1>&2
578    $echo "$help" 1>&2    $echo "$help" 1>&2
579    exit 1    exit $EXIT_FAILURE
580  fi  fi
581    
582    case $disable_libs in
583    no)
584      ;;
585    shared)
586      build_libtool_libs=no
587      build_old_libs=yes
588      ;;
589    static)
590      build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
591      ;;
592    esac
593    
594  # If this variable is set in any of the actions, the command in it  # If this variable is set in any of the actions, the command in it
595  # will be execed at the end.  This prevents here-documents from being  # will be execed at the end.  This prevents here-documents from being
596  # left over by shells.  # left over by shells.
# Line 311  if test -z "$show_help"; then Line 601  if test -z "$show_help"; then
601    # Infer the operation mode.    # Infer the operation mode.
602    if test -z "$mode"; then    if test -z "$mode"; then
603      $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2      $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604      $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2      $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
605      case $nonopt in      case $nonopt in
606      *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)      *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
607        mode=link        mode=link
# Line 354  if test -z "$show_help"; then Line 644  if test -z "$show_help"; then
644    if test -n "$execute_dlfiles" && test "$mode" != execute; then    if test -n "$execute_dlfiles" && test "$mode" != execute; then
645      $echo "$modename: unrecognized option \`-dlopen'" 1>&2      $echo "$modename: unrecognized option \`-dlopen'" 1>&2
646      $echo "$help" 1>&2      $echo "$help" 1>&2
647      exit 1      exit $EXIT_FAILURE
648    fi    fi
649    
650    # Change the help message to a mode-specific one.    # Change the help message to a mode-specific one.
# Line 369  if test -z "$show_help"; then Line 659  if test -z "$show_help"; then
659      # Get the compilation command and the source file.      # Get the compilation command and the source file.
660      base_compile=      base_compile=
661      srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"      srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
662        suppress_opt=yes
663      suppress_output=      suppress_output=
664      arg_mode=normal      arg_mode=normal
665      libobj=      libobj=
666        later=
667    
668      for arg      for arg
669      do      do
670        case "$arg_mode" in        case $arg_mode in
671        arg  )        arg  )
672          # do not "continue".  Instead, add this to base_compile          # do not "continue".  Instead, add this to base_compile
673          lastarg="$arg"          lastarg="$arg"
# Line 394  if test -z "$show_help"; then Line 686  if test -z "$show_help"; then
686          -o)          -o)
687            if test -n "$libobj" ; then            if test -n "$libobj" ; then
688              $echo "$modename: you cannot specify \`-o' more than once" 1>&2              $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689              exit 1              exit $EXIT_FAILURE
690            fi            fi
691            arg_mode=target            arg_mode=target
692            continue            continue
693            ;;            ;;
694    
695          -static)          -static | -prefer-pic | -prefer-non-pic)
696            build_old_libs=yes            later="$later $arg"
697            continue            continue
698            ;;            ;;
699    
700          -prefer-pic)          -no-suppress)
701            pic_mode=yes            suppress_opt=no
           continue  
           ;;  
   
         -prefer-non-pic)  
           pic_mode=no  
702            continue            continue
703            ;;            ;;
704    
# Line 424  if test -z "$show_help"; then Line 711  if test -z "$show_help"; then
711            args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`            args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
712            lastarg=            lastarg=
713            save_ifs="$IFS"; IFS=','            save_ifs="$IFS"; IFS=','
714            for arg in $args; do            for arg in $args; do
715              IFS="$save_ifs"              IFS="$save_ifs"
716    
717              # Double-quote args containing other shell metacharacters.              # Double-quote args containing other shell metacharacters.
# Line 462  if test -z "$show_help"; then Line 749  if test -z "$show_help"; then
749        case $lastarg in        case $lastarg in
750        # Double-quote args containing other shell metacharacters.        # Double-quote args containing other shell metacharacters.
751        # Many Bourne shells cannot handle close brackets correctly        # Many Bourne shells cannot handle close brackets correctly
752        # in scan sets, so we specify it separately.        # in scan sets, and some SunOS ksh mistreat backslash-escaping
753          # in scan sets (worked around with variable expansion),
754          # and furthermore cannot handle '|' '&' '(' ')' in scan sets
755          # at all, so we specify them separately.
756        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
757          lastarg="\"$lastarg\""          lastarg="\"$lastarg\""
758          ;;          ;;
# Line 474  if test -z "$show_help"; then Line 764  if test -z "$show_help"; then
764      case $arg_mode in      case $arg_mode in
765      arg)      arg)
766        $echo "$modename: you must specify an argument for -Xcompile"        $echo "$modename: you must specify an argument for -Xcompile"
767        exit 1        exit $EXIT_FAILURE
768        ;;        ;;
769      target)      target)
770        $echo "$modename: you must specify a target with \`-o'" 1>&2        $echo "$modename: you must specify a target with \`-o'" 1>&2
771        exit 1        exit $EXIT_FAILURE
772        ;;        ;;
773      *)      *)
774        # Get the name of the library object.        # Get the name of the library object.
# Line 500  if test -z "$show_help"; then Line 790  if test -z "$show_help"; then
790      *.class) xform=class ;;      *.class) xform=class ;;
791      *.cpp) xform=cpp ;;      *.cpp) xform=cpp ;;
792      *.cxx) xform=cxx ;;      *.cxx) xform=cxx ;;
793      *.f90) xform=f90 ;;      *.[fF][09]?) xform=[fF][09]. ;;
794      *.for) xform=for ;;      *.for) xform=for ;;
795      *.java) xform=java ;;      *.java) xform=java ;;
796        *.obj) xform=obj ;;
797        *.sx) xform=sx ;;
798      esac      esac
799    
800      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
# Line 511  if test -z "$show_help"; then Line 803  if test -z "$show_help"; then
803      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
804      *)      *)
805        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
806        exit 1        exit $EXIT_FAILURE
807        ;;        ;;
808      esac      esac
809    
810      # Infer tagged configuration to use if any are available and      func_infer_tag $base_compile
811      # if one wasn't chosen via the "--tag" command line option.  
812      # Only attempt this if the compiler in the base compile      for arg in $later; do
813      # command doesn't match the default compiler.        case $arg in
814      if test -n "$available_tags" && test -z "$tagname"; then        -static)
815        case $base_compile in          build_old_libs=yes
816        # Blanks in the command may have been stripped by the calling shell,          continue
817        # but not from the CC environment variable when configure was run.          ;;
818        " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;  
819        # Blanks at the start of $base_compile will cause this to fail        -prefer-pic)
820        # if we don't check for them as well.          pic_mode=yes
821        *)          continue
822          for z in $available_tags; do          ;;
823            if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then  
824              # Evaluate the configuration.        -prefer-non-pic)
825              eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"          pic_mode=no
826              case "$base_compile " in          continue
             "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)  
               # The compiler in the base compile command matches  
               # the one in the tagged configuration.  
               # Assume this is the tagged configuration we want.  
               tagname=$z  
               break  
               ;;  
             esac  
           fi  
         done  
         # If $tagname still isn't set, then no tagged configuration  
         # was found and let the user know that the "--tag" command  
         # line option must be used.  
         if test -z "$tagname"; then  
           $echo "$modename: unable to infer tagged configuration"  
           $echo "$modename: specify a tag with \`--tag'" 1>&2  
           exit 1  
 #        else  
 #          $echo "$modename: using $tagname tagged configuration"  
         fi  
827          ;;          ;;
828        esac        esac
829      fi      done
830    
831        qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
832        case $qlibobj in
833          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
834            qlibobj="\"$qlibobj\"" ;;
835        esac
836        test "X$libobj" != "X$qlibobj" \
837            && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
838            && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
839      objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`      objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
840      xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`      xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
841      if test "X$xdir" = "X$obj"; then      if test "X$xdir" = "X$obj"; then
# Line 568  if test -z "$show_help"; then Line 848  if test -z "$show_help"; then
848      if test -z "$base_compile"; then      if test -z "$base_compile"; then
849        $echo "$modename: you must specify a compilation command" 1>&2        $echo "$modename: you must specify a compilation command" 1>&2
850        $echo "$help" 1>&2        $echo "$help" 1>&2
851        exit 1        exit $EXIT_FAILURE
852      fi      fi
853    
854      # Delete any leftover library objects.      # Delete any leftover library objects.
# Line 579  if test -z "$show_help"; then Line 859  if test -z "$show_help"; then
859      fi      fi
860    
861      $run $rm $removelist      $run $rm $removelist
862      trap "$run $rm $removelist; exit 1" 1 2 15      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
863    
864      # On Cygwin there's no "real" PIC flag so we must build both object types      # On Cygwin there's no "real" PIC flag so we must build both object types
865      case $host_os in      case $host_os in
# Line 598  if test -z "$show_help"; then Line 878  if test -z "$show_help"; then
878        output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}        output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
879        lockfile="$output_obj.lock"        lockfile="$output_obj.lock"
880        removelist="$removelist $output_obj $lockfile"        removelist="$removelist $output_obj $lockfile"
881        trap "$run $rm $removelist; exit 1" 1 2 15        trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
882      else      else
883        output_obj=        output_obj=
884        need_locks=no        need_locks=no
# Line 608  if test -z "$show_help"; then Line 888  if test -z "$show_help"; then
888      # Lock this critical section if it is needed      # Lock this critical section if it is needed
889      # We use this script file to make the link, it avoids creating a new file      # We use this script file to make the link, it avoids creating a new file
890      if test "$need_locks" = yes; then      if test "$need_locks" = yes; then
891        until $run ln "$0" "$lockfile" 2>/dev/null; do        until $run ln "$progpath" "$lockfile" 2>/dev/null; do
892          $show "Waiting for $lockfile to be removed"          $show "Waiting for $lockfile to be removed"
893          sleep 2          sleep 2
894        done        done
# Line 626  avoid parallel builds (make -j) in this Line 906  avoid parallel builds (make -j) in this
906  compiler."  compiler."
907    
908          $run $rm $removelist          $run $rm $removelist
909          exit 1          exit $EXIT_FAILURE
910        fi        fi
911        $echo $srcfile > "$lockfile"        $echo "$srcfile" > "$lockfile"
912      fi      fi
913    
914      if test -n "$fix_srcfile_path"; then      if test -n "$fix_srcfile_path"; then
915        eval srcfile=\"$fix_srcfile_path\"        eval srcfile=\"$fix_srcfile_path\"
916      fi      fi
917        qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
918        case $qsrcfile in
919          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
920          qsrcfile="\"$qsrcfile\"" ;;
921        esac
922    
923      $run $rm "$libobj" "${libobj}T"      $run $rm "$libobj" "${libobj}T"
924    
# Line 655  EOF Line 940  EOF
940        fbsd_hideous_sh_bug=$base_compile        fbsd_hideous_sh_bug=$base_compile
941    
942        if test "$pic_mode" != no; then        if test "$pic_mode" != no; then
943          command="$base_compile $srcfile $pic_flag"          command="$base_compile $qsrcfile $pic_flag"
944        else        else
945          # Don't build PIC code          # Don't build PIC code
946          command="$base_compile $srcfile"          command="$base_compile $qsrcfile"
947        fi        fi
948    
949        if test ! -d "${xdir}$objdir"; then        if test ! -d "${xdir}$objdir"; then
950          $show "$mkdir ${xdir}$objdir"          $show "$mkdir ${xdir}$objdir"
951          $run $mkdir ${xdir}$objdir          $run $mkdir ${xdir}$objdir
952          status=$?          exit_status=$?
953          if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then          if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
954            exit $status            exit $exit_status
955          fi          fi
956        fi        fi
957    
# Line 678  EOF Line 963  EOF
963        $run $rm "$lobj" "$output_obj"        $run $rm "$lobj" "$output_obj"
964    
965        $show "$command"        $show "$command"
966        if $run eval "$command"; then :        if $run eval $lt_env "$command"; then :
967        else        else
968          test -n "$output_obj" && $run $rm $removelist          test -n "$output_obj" && $run $rm $removelist
969          exit 1          exit $EXIT_FAILURE
970        fi        fi
971    
972        if test "$need_locks" = warn &&        if test "$need_locks" = warn &&
# Line 701  avoid parallel builds (make -j) in this Line 986  avoid parallel builds (make -j) in this
986  compiler."  compiler."
987    
988          $run $rm $removelist          $run $rm $removelist
989          exit 1          exit $EXIT_FAILURE
990        fi        fi
991    
992        # Just move the object if needed, then go on to compile the next one        # Just move the object if needed, then go on to compile the next one
# Line 722  pic_object='$objdir/$objname' Line 1007  pic_object='$objdir/$objname'
1007  EOF  EOF
1008    
1009        # Allow error messages only from the first compilation.        # Allow error messages only from the first compilation.
1010        suppress_output=' >/dev/null 2>&1'        if test "$suppress_opt" = yes; then
1011            suppress_output=' >/dev/null 2>&1'
1012          fi
1013      else      else
1014        # No PIC object so indicate it doesn't exist in the libtool        # No PIC object so indicate it doesn't exist in the libtool
1015        # object file.        # object file.
# Line 736  EOF Line 1023  EOF
1023      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
1024        if test "$pic_mode" != yes; then        if test "$pic_mode" != yes; then
1025          # Don't build PIC code          # Don't build PIC code
1026          command="$base_compile $srcfile"          command="$base_compile $qsrcfile"
1027        else        else
1028          command="$base_compile $srcfile $pic_flag"          command="$base_compile $qsrcfile $pic_flag"
1029        fi        fi
1030        if test "$compiler_c_o" = yes; then        if test "$compiler_c_o" = yes; then
1031          command="$command -o $obj"          command="$command -o $obj"
# Line 748  EOF Line 1035  EOF
1035        command="$command$suppress_output"        command="$command$suppress_output"
1036        $run $rm "$obj" "$output_obj"        $run $rm "$obj" "$output_obj"
1037        $show "$command"        $show "$command"
1038        if $run eval "$command"; then :        if $run eval $lt_env "$command"; then :
1039        else        else
1040          $run $rm $removelist          $run $rm $removelist
1041          exit 1          exit $EXIT_FAILURE
1042        fi        fi
1043    
1044        if test "$need_locks" = warn &&        if test "$need_locks" = warn &&
# Line 771  avoid parallel builds (make -j) in this Line 1058  avoid parallel builds (make -j) in this
1058  compiler."  compiler."
1059    
1060          $run $rm $removelist          $run $rm $removelist
1061          exit 1          exit $EXIT_FAILURE
1062        fi        fi
1063    
1064        # Just move the object if needed        # Just move the object if needed
# Line 809  EOF Line 1096  EOF
1096        $run $rm "$lockfile"        $run $rm "$lockfile"
1097      fi      fi
1098    
1099      exit 0      exit $EXIT_SUCCESS
1100      ;;      ;;
1101    
1102    # libtool link mode    # libtool link mode
# Line 835  EOF Line 1122  EOF
1122        ;;        ;;
1123      esac      esac
1124      libtool_args="$nonopt"      libtool_args="$nonopt"
1125      base_compile="$nonopt"      base_compile="$nonopt $@"
1126      compile_command="$nonopt"      compile_command="$nonopt"
1127      finalize_command="$nonopt"      finalize_command="$nonopt"
1128    
# Line 867  EOF Line 1154  EOF
1154      no_install=no      no_install=no
1155      objs=      objs=
1156      non_pic_objects=      non_pic_objects=
1157        notinst_path= # paths that contain not-installed libtool libraries
1158        precious_files_regex=
1159      prefer_static_libs=no      prefer_static_libs=no
1160      preload=no      preload=no
1161      prev=      prev=
# Line 879  EOF Line 1168  EOF
1168      thread_safe=no      thread_safe=no
1169      vinfo=      vinfo=
1170      vinfo_number=no      vinfo_number=no
1171        single_module="${wl}-single_module"
1172    
1173        func_infer_tag $base_compile
1174    
1175      # We need to know -static, to get the right output filenames.      # We need to know -static, to get the right output filenames.
1176      for arg      for arg
1177      do      do
1178        case $arg in        case $arg in
1179        -all-static | -static)        -all-static | -static | -static-libtool-libs)
1180          if test "X$arg" = "X-all-static"; then          case $arg in
1181            -all-static)
1182            if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then            if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1183              $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2              $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1184            fi            fi
1185            if test -n "$link_static_flag"; then            if test -n "$link_static_flag"; then
1186              dlopen_self=$dlopen_self_static              dlopen_self=$dlopen_self_static
1187            fi            fi
1188          else            prefer_static_libs=yes
1189              ;;
1190            -static)
1191            if test -z "$pic_flag" && test -n "$link_static_flag"; then            if test -z "$pic_flag" && test -n "$link_static_flag"; then
1192              dlopen_self=$dlopen_self_static              dlopen_self=$dlopen_self_static
1193            fi            fi
1194          fi            prefer_static_libs=built
1195              ;;
1196            -static-libtool-libs)
1197              if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198                dlopen_self=$dlopen_self_static
1199              fi
1200              prefer_static_libs=yes
1201              ;;
1202            esac
1203          build_libtool_libs=no          build_libtool_libs=no
1204          build_old_libs=yes          build_old_libs=yes
         prefer_static_libs=yes  
1205          break          break
1206          ;;          ;;
1207        esac        esac
# Line 911  EOF Line 1213  EOF
1213      # Go through the arguments, transforming them on the way.      # Go through the arguments, transforming them on the way.
1214      while test "$#" -gt 0; do      while test "$#" -gt 0; do
1215        arg="$1"        arg="$1"
       base_compile="$base_compile $arg"  
1216        shift        shift
1217        case $arg in        case $arg in
1218        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
# Line 975  EOF Line 1276  EOF
1276            export_symbols="$arg"            export_symbols="$arg"
1277            if test ! -f "$arg"; then            if test ! -f "$arg"; then
1278              $echo "$modename: symbol file \`$arg' does not exist"              $echo "$modename: symbol file \`$arg' does not exist"
1279              exit 1              exit $EXIT_FAILURE
1280            fi            fi
1281            prev=            prev=
1282            continue            continue
# Line 990  EOF Line 1291  EOF
1291            prev=            prev=
1292            continue            continue
1293            ;;            ;;
1294            precious_regex)
1295              precious_files_regex="$arg"
1296              prev=
1297              continue
1298              ;;
1299          release)          release)
1300            release="-$arg"            release="-$arg"
1301            prev=            prev=
# Line 1022  EOF Line 1328  EOF
1328                     test "$pic_object" = none && \                     test "$pic_object" = none && \
1329                     test "$non_pic_object" = none; then                     test "$non_pic_object" = none; then
1330                    $echo "$modename: cannot find name of object for \`$arg'" 1>&2                    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1331                    exit 1                    exit $EXIT_FAILURE
1332                  fi                  fi
1333    
1334                  # Extract subdirectory from the argument.                  # Extract subdirectory from the argument.
# Line 1070  EOF Line 1376  EOF
1376                    if test -z "$pic_object" || test "$pic_object" = none ; then                    if test -z "$pic_object" || test "$pic_object" = none ; then
1377                      arg="$non_pic_object"                      arg="$non_pic_object"
1378                    fi                    fi
1379                    else
1380                      # If the PIC object exists, use it instead.
1381                      # $xdir was prepended to $pic_object above.
1382                      non_pic_object="$pic_object"
1383                      non_pic_objects="$non_pic_objects $non_pic_object"
1384                  fi                  fi
1385                else                else
1386                  # Only an error if not doing a dry-run.                  # Only an error if not doing a dry-run.
1387                  if test -z "$run"; then                  if test -z "$run"; then
1388                    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2                    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1389                    exit 1                    exit $EXIT_FAILURE
1390                  else                  else
1391                    # Dry-run case.                    # Dry-run case.
1392    
# Line 1096  EOF Line 1407  EOF
1407              done              done
1408            else            else
1409              $echo "$modename: link input file \`$save_arg' does not exist"              $echo "$modename: link input file \`$save_arg' does not exist"
1410              exit 1              exit $EXIT_FAILURE
1411            fi            fi
1412            arg=$save_arg            arg=$save_arg
1413            prev=            prev=
# Line 1108  EOF Line 1419  EOF
1419            [\\/]* | [A-Za-z]:[\\/]*) ;;            [\\/]* | [A-Za-z]:[\\/]*) ;;
1420            *)            *)
1421              $echo "$modename: only absolute run-paths are allowed" 1>&2              $echo "$modename: only absolute run-paths are allowed" 1>&2
1422              exit 1              exit $EXIT_FAILURE
1423              ;;              ;;
1424            esac            esac
1425            if test "$prev" = rpath; then            if test "$prev" = rpath; then
# Line 1148  EOF Line 1459  EOF
1459            finalize_command="$finalize_command $qarg"            finalize_command="$finalize_command $qarg"
1460            continue            continue
1461            ;;            ;;
1462            shrext)
1463              shrext_cmds="$arg"
1464              prev=
1465              continue
1466              ;;
1467            darwin_framework|darwin_framework_skip)
1468              test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1469              compile_command="$compile_command $arg"
1470              finalize_command="$finalize_command $arg"
1471              prev=
1472              continue
1473              ;;
1474          *)          *)
1475            eval "$prev=\"\$arg\""            eval "$prev=\"\$arg\""
1476            prev=            prev=
# Line 1196  EOF Line 1519  EOF
1519        -export-symbols | -export-symbols-regex)        -export-symbols | -export-symbols-regex)
1520          if test -n "$export_symbols" || test -n "$export_symbols_regex"; then          if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1521            $echo "$modename: more than one -exported-symbols argument is not allowed"            $echo "$modename: more than one -exported-symbols argument is not allowed"
1522            exit 1            exit $EXIT_FAILURE
1523          fi          fi
1524          if test "X$arg" = "X-export-symbols"; then          if test "X$arg" = "X-export-symbols"; then
1525            prev=expsyms            prev=expsyms
# Line 1206  EOF Line 1529  EOF
1529          continue          continue
1530          ;;          ;;
1531    
1532          -framework|-arch|-isysroot)
1533            case " $CC " in
1534              *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1535                    prev=darwin_framework_skip ;;
1536              *) compiler_flags="$compiler_flags $arg"
1537                 prev=darwin_framework ;;
1538            esac
1539            compile_command="$compile_command $arg"
1540            finalize_command="$finalize_command $arg"
1541            continue
1542            ;;
1543    
1544        -inst-prefix-dir)        -inst-prefix-dir)
1545          prev=inst_prefix          prev=inst_prefix
1546          continue          continue
# Line 1232  EOF Line 1567  EOF
1567            absdir=`cd "$dir" && pwd`            absdir=`cd "$dir" && pwd`
1568            if test -z "$absdir"; then            if test -z "$absdir"; then
1569              $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2              $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1570              exit 1              absdir="$dir"
1571                notinst_path="$notinst_path $dir"
1572            fi            fi
1573            dir="$absdir"            dir="$absdir"
1574            ;;            ;;
# Line 1246  EOF Line 1582  EOF
1582          esac          esac
1583          case $host in          case $host in
1584          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1585              testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1586            case :$dllsearchpath: in            case :$dllsearchpath: in
1587            *":$dir:"*) ;;            *":$dir:"*) ;;
1588            *) dllsearchpath="$dllsearchpath:$dir";;            *) dllsearchpath="$dllsearchpath:$dir";;
1589            esac            esac
1590              case :$dllsearchpath: in
1591              *":$testbindir:"*) ;;
1592              *) dllsearchpath="$dllsearchpath:$testbindir";;
1593              esac
1594            ;;            ;;
1595          esac          esac
1596          continue          continue
# Line 1258  EOF Line 1599  EOF
1599        -l*)        -l*)
1600          if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then          if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1601            case $host in            case $host in
1602            *-*-cygwin* | *-*-pw32* | *-*-beos*)            *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1603              # These systems don't actually have a C or math library (as such)              # These systems don't actually have a C or math library (as such)
1604              continue              continue
1605              ;;              ;;
1606            *-*-mingw* | *-*-os2*)            *-*-os2*)
1607              # These systems don't actually have a C library (as such)              # These systems don't actually have a C library (as such)
1608              test "X$arg" = "X-lc" && continue              test "X$arg" = "X-lc" && continue
1609              ;;              ;;
1610            *-*-openbsd* | *-*-freebsd*)            *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1611              # Do not include libc due to us having libc/libc_r.              # Do not include libc due to us having libc/libc_r.
1612              test "X$arg" = "X-lc" && continue              test "X$arg" = "X-lc" && continue
1613              ;;              ;;
# Line 1274  EOF Line 1615  EOF
1615              # Rhapsody C and math libraries are in the System framework              # Rhapsody C and math libraries are in the System framework
1616              deplibs="$deplibs -framework System"              deplibs="$deplibs -framework System"
1617              continue              continue
1618                ;;
1619              *-*-sco3.2v5* | *-*-sco5v6*)
1620                # Causes problems with __ctype
1621                test "X$arg" = "X-lc" && continue
1622                ;;
1623              *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1624                # Compiler inserts libc in the correct place for threads to work
1625                test "X$arg" = "X-lc" && continue
1626                ;;
1627            esac            esac
1628          elif test "X$arg" = "X-lc_r"; then          elif test "X$arg" = "X-lc_r"; then
1629           case $host in           case $host in
1630           *-*-openbsd* | *-*-freebsd*)           *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1631             # Do not include libc_r directly, use -pthread flag.             # Do not include libc_r directly, use -pthread flag.
1632             continue             continue
1633             ;;             ;;
# Line 1287  EOF Line 1637  EOF
1637          continue          continue
1638          ;;          ;;
1639    
1640          # Tru64 UNIX uses -model [arg] to determine the layout of C++
1641          # classes, name mangling, and exception handling.
1642          -model)
1643            compile_command="$compile_command $arg"
1644            compiler_flags="$compiler_flags $arg"
1645            finalize_command="$finalize_command $arg"
1646            prev=xcompiler
1647            continue
1648            ;;
1649    
1650         -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1651            compiler_flags="$compiler_flags $arg"
1652            compile_command="$compile_command $arg"
1653            finalize_command="$finalize_command $arg"
1654            continue
1655            ;;
1656    
1657          -multi_module)
1658            single_module="${wl}-multi_module"
1659            continue
1660            ;;
1661    
1662        -module)        -module)
1663          module=yes          module=yes
1664          continue          continue
1665          ;;          ;;
1666    
1667        # gcc -m* arguments should be passed to the linker via $compiler_flags        # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1668        # in order to pass architecture information to the linker        # -r[0-9][0-9]* specifies the processor on the SGI compiler
1669        # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo        # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1670        # but this is not reliable with gcc because gcc may use -mfoo to        # +DA*, +DD* enable 64-bit mode on the HP compiler
1671        # select a different linker, different libraries, etc, while        # -q* pass through compiler args for the IBM compiler
1672        # -Wl,-mfoo simply passes -mfoo to the linker.        # -m* pass through architecture-specific compiler args for GCC
1673        -m*)        # -m*, -t[45]*, -txscale* pass through architecture-specific
1674          # compiler args for GCC
1675          # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1676          # -F/path gives path to uninstalled frameworks, gcc on darwin
1677          # @file GCC response files
1678          -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1679          -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1680    
1681          # Unknown arguments in both finalize_command and compile_command need          # Unknown arguments in both finalize_command and compile_command need
1682          # to be aesthetically quoted because they are evaled later.          # to be aesthetically quoted because they are evaled later.
1683          arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`          arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
# Line 1309  EOF Line 1688  EOF
1688          esac          esac
1689          compile_command="$compile_command $arg"          compile_command="$compile_command $arg"
1690          finalize_command="$finalize_command $arg"          finalize_command="$finalize_command $arg"
1691          if test "$with_gcc" = "yes" ; then          compiler_flags="$compiler_flags $arg"
           compiler_flags="$compiler_flags $arg"  
         fi  
1692          continue          continue
1693          ;;          ;;
1694    
# Line 1327  EOF Line 1704  EOF
1704    
1705        -no-install)        -no-install)
1706          case $host in          case $host in
1707          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1708            # The PATH hackery in wrapper scripts is required on Windows            # The PATH hackery in wrapper scripts is required on Windows
1709            # in order for the loader to find any dlls it needs.            # and Darwin in order for the loader to find any dlls it needs.
1710            $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2            $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1711            $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2            $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1712            fast_install=no            fast_install=no
# Line 1351  EOF Line 1728  EOF
1728    
1729        -o) prev=output ;;        -o) prev=output ;;
1730    
1731          -precious-files-regex)
1732            prev=precious_regex
1733            continue
1734            ;;
1735    
1736        -release)        -release)
1737          prev=release          prev=release
1738          continue          continue
# Line 1373  EOF Line 1755  EOF
1755          [\\/]* | [A-Za-z]:[\\/]*) ;;          [\\/]* | [A-Za-z]:[\\/]*) ;;
1756          *)          *)
1757            $echo "$modename: only absolute run-paths are allowed" 1>&2            $echo "$modename: only absolute run-paths are allowed" 1>&2
1758            exit 1            exit $EXIT_FAILURE
1759            ;;            ;;
1760          esac          esac
1761          case "$xrpath " in          case "$xrpath " in
# Line 1383  EOF Line 1765  EOF
1765          continue          continue
1766          ;;          ;;
1767    
1768        -static)        -static | -static-libtool-libs)
1769          # The effects of -static are defined in a previous loop.          # The effects of -static are defined in a previous loop.
1770          # We used to do the same as -all-static on platforms that          # We used to do the same as -all-static on platforms that
1771          # didn't have a PIC flag, but the assumption that the effects          # didn't have a PIC flag, but the assumption that the effects
# Line 1496  EOF Line 1878  EOF
1878               test "$pic_object" = none && \               test "$pic_object" = none && \
1879               test "$non_pic_object" = none; then               test "$non_pic_object" = none; then
1880              $echo "$modename: cannot find name of object for \`$arg'" 1>&2              $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1881              exit 1              exit $EXIT_FAILURE
1882            fi            fi
1883    
1884            # Extract subdirectory from the argument.            # Extract subdirectory from the argument.
# Line 1544  EOF Line 1926  EOF
1926              if test -z "$pic_object" || test "$pic_object" = none ; then              if test -z "$pic_object" || test "$pic_object" = none ; then
1927                arg="$non_pic_object"                arg="$non_pic_object"
1928              fi              fi
1929              else
1930                # If the PIC object exists, use it instead.
1931                # $xdir was prepended to $pic_object above.
1932                non_pic_object="$pic_object"
1933                non_pic_objects="$non_pic_objects $non_pic_object"
1934            fi            fi
1935          else          else
1936            # Only an error if not doing a dry-run.            # Only an error if not doing a dry-run.
1937            if test -z "$run"; then            if test -z "$run"; then
1938              $echo "$modename: \`$arg' is not a valid libtool object" 1>&2              $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1939              exit 1              exit $EXIT_FAILURE
1940            else            else
1941              # Dry-run case.              # Dry-run case.
1942    
# Line 1616  EOF Line 2003  EOF
2003      if test -n "$prev"; then      if test -n "$prev"; then
2004        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2005        $echo "$help" 1>&2        $echo "$help" 1>&2
2006        exit 1        exit $EXIT_FAILURE
     fi  
   
     # Infer tagged configuration to use if any are available and  
     # if one wasn't chosen via the "--tag" command line option.  
     # Only attempt this if the compiler in the base link  
     # command doesn't match the default compiler.  
     if test -n "$available_tags" && test -z "$tagname"; then  
       case $base_compile in  
       # Blanks in the command may have been stripped by the calling shell,  
       # but not from the CC environment variable when configure was run.  
       "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;  
       # Blanks at the start of $base_compile will cause this to fail  
       # if we don't check for them as well.  
       *)  
         for z in $available_tags; do  
           if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then  
             # Evaluate the configuration.  
             eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"  
             case $base_compile in  
             "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)  
               # The compiler in $compile_command matches  
               # the one in the tagged configuration.  
               # Assume this is the tagged configuration we want.  
               tagname=$z  
               break  
               ;;  
             esac  
           fi  
         done  
         # If $tagname still isn't set, then no tagged configuration  
         # was found and let the user know that the "--tag" command  
         # line option must be used.  
         if test -z "$tagname"; then  
           $echo "$modename: unable to infer tagged configuration"  
           $echo "$modename: specify a tag with \`--tag'" 1>&2  
           exit 1  
 #       else  
 #         $echo "$modename: using $tagname tagged configuration"  
         fi  
         ;;  
       esac  
2007      fi      fi
2008    
2009      if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then      if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
# Line 1690  EOF Line 2036  EOF
2036      if test ! -d "$output_objdir"; then      if test ! -d "$output_objdir"; then
2037        $show "$mkdir $output_objdir"        $show "$mkdir $output_objdir"
2038        $run $mkdir $output_objdir        $run $mkdir $output_objdir
2039        status=$?        exit_status=$?
2040        if test "$status" -ne 0 && test ! -d "$output_objdir"; then        if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2041          exit $status          exit $exit_status
2042        fi        fi
2043      fi      fi
2044    
# Line 1701  EOF Line 2047  EOF
2047      "")      "")
2048        $echo "$modename: you must specify an output file" 1>&2        $echo "$modename: you must specify an output file" 1>&2
2049        $echo "$help" 1>&2        $echo "$help" 1>&2
2050        exit 1        exit $EXIT_FAILURE
2051        ;;        ;;
2052      *.$libext) linkmode=oldlib ;;      *.$libext) linkmode=oldlib ;;
2053      *.lo | *.$objext) linkmode=obj ;;      *.lo | *.$objext) linkmode=obj ;;
# Line 1711  EOF Line 2057  EOF
2057    
2058      case $host in      case $host in
2059      *cygwin* | *mingw* | *pw32*)      *cygwin* | *mingw* | *pw32*)
2060        # don't eliminate duplcations in $postdeps and $predeps        # don't eliminate duplications in $postdeps and $predeps
2061        duplicate_compiler_generated_deps=yes        duplicate_compiler_generated_deps=yes
2062        ;;        ;;
2063      *)      *)
# Line 1755  EOF Line 2101  EOF
2101      newlib_search_path=      newlib_search_path=
2102      need_relink=no # whether we're linking any uninstalled libtool libraries      need_relink=no # whether we're linking any uninstalled libtool libraries
2103      notinst_deplibs= # not-installed libtool libraries      notinst_deplibs= # not-installed libtool libraries
     notinst_path= # paths that contain not-installed libtool libraries  
2104      case $linkmode in      case $linkmode in
2105      lib)      lib)
2106          passes="conv link"          passes="conv link"
# Line 1764  EOF Line 2109  EOF
2109            *.la) ;;            *.la) ;;
2110            *)            *)
2111              $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2              $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2112              exit 1              exit $EXIT_FAILURE
2113              ;;              ;;
2114            esac            esac
2115          done          done
# Line 1802  EOF Line 2147  EOF
2147          lib=          lib=
2148          found=no          found=no
2149          case $deplib in          case $deplib in
2150            -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2151              if test "$linkmode,$pass" = "prog,link"; then
2152                compile_deplibs="$deplib $compile_deplibs"
2153                finalize_deplibs="$deplib $finalize_deplibs"
2154              else
2155                compiler_flags="$compiler_flags $deplib"
2156              fi
2157              continue
2158              ;;
2159          -l*)          -l*)
2160            if test "$linkmode" != lib && test "$linkmode" != prog; then            if test "$linkmode" != lib && test "$linkmode" != prog; then
2161              $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2              $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2162              continue              continue
2163            fi            fi
           if test "$pass" = conv; then  
             deplibs="$deplib $deplibs"  
             continue  
           fi  
2164            name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`            name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2165            for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do            if test "$linkmode" = lib; then
2166              # Search the libtool library              searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2167              lib="$searchdir/lib${name}.la"            else
2168              if test -f "$lib"; then              searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2169                found=yes            fi
2170                break            for searchdir in $searchdirs; do
2171              fi              for search_ext in .la $std_shrext .so .a; do
2172                  # Search the libtool library
2173                  lib="$searchdir/lib${name}${search_ext}"
2174                  if test -f "$lib"; then
2175                    if test "$search_ext" = ".la"; then
2176                      found=yes
2177                    else
2178                      found=no
2179                    fi
2180                    break 2
2181                  fi
2182                done
2183            done            done
2184            if test "$found" != yes; then            if test "$found" != yes; then
2185              # deplib doesn't seem to be a libtool library              # deplib doesn't seem to be a libtool library
# Line 1883  EOF Line 2244  EOF
2244              fi              fi
2245              if test "$pass" = scan; then              if test "$pass" = scan; then
2246                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
               newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`  
2247              else              else
2248                compile_deplibs="$deplib $compile_deplibs"                compile_deplibs="$deplib $compile_deplibs"
2249                finalize_deplibs="$deplib $finalize_deplibs"                finalize_deplibs="$deplib $finalize_deplibs"
2250              fi              fi
2251                newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2252              ;;              ;;
2253            *)            *)
2254              $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2              $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
# Line 1915  EOF Line 2276  EOF
2276            fi            fi
2277            case $linkmode in            case $linkmode in
2278            lib)            lib)
2279              if test "$deplibs_check_method" != pass_all; then              valid_a_lib=no
2280                case $deplibs_check_method in
2281                  match_pattern*)
2282                    set dummy $deplibs_check_method
2283                    match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2284                    if eval $echo \"$deplib\" 2>/dev/null \
2285                        | $SED 10q \
2286                        | $EGREP "$match_pattern_regex" > /dev/null; then
2287                      valid_a_lib=yes
2288                    fi
2289                    ;;
2290                  pass_all)
2291                    valid_a_lib=yes
2292                    ;;
2293                esac
2294                if test "$valid_a_lib" != yes; then
2295                $echo                $echo
2296                $echo "*** Warning: Trying to link with static lib archive $deplib."                $echo "*** Warning: Trying to link with static lib archive $deplib."
2297                $echo "*** I have the capability to make that library automatically link in when"                $echo "*** I have the capability to make that library automatically link in when"
# Line 1965  EOF Line 2341  EOF
2341          esac # case $deplib          esac # case $deplib
2342          if test "$found" = yes || test -f "$lib"; then :          if test "$found" = yes || test -f "$lib"; then :
2343          else          else
2344            $echo "$modename: cannot find the library \`$lib'" 1>&2            $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2345            exit 1            exit $EXIT_FAILURE
2346          fi          fi
2347    
2348          # Check to see that this really is a libtool archive.          # Check to see that this really is a libtool archive.
2349          if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :          if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2350          else          else
2351            $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2            $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2352            exit 1            exit $EXIT_FAILURE
2353          fi          fi
2354    
2355          ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`          ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
# Line 1989  EOF Line 2365  EOF
2365          # it will not redefine variables installed, or shouldnotlink          # it will not redefine variables installed, or shouldnotlink
2366          installed=yes          installed=yes
2367          shouldnotlink=no          shouldnotlink=no
2368            avoidtemprpath=
2369    
2370    
2371          # Read the .la file          # Read the .la file
2372          case $lib in          case $lib in
# Line 2009  EOF Line 2387  EOF
2387            if test -z "$libdir"; then            if test -z "$libdir"; then
2388              if test -z "$old_library"; then              if test -z "$old_library"; then
2389                $echo "$modename: cannot find name of link library for \`$lib'" 1>&2                $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2390                exit 1                exit $EXIT_FAILURE
2391              fi              fi
2392              # It is a libtool convenience library, so add in its objects.              # It is a libtool convenience library, so add in its objects.
2393              convenience="$convenience $ladir/$objdir/$old_library"              convenience="$convenience $ladir/$objdir/$old_library"
# Line 2026  EOF Line 2404  EOF
2404              done              done
2405            elif test "$linkmode" != prog && test "$linkmode" != lib; then            elif test "$linkmode" != prog && test "$linkmode" != lib; then
2406              $echo "$modename: \`$lib' is not a convenience library" 1>&2              $echo "$modename: \`$lib' is not a convenience library" 1>&2
2407              exit 1              exit $EXIT_FAILURE
2408            fi            fi
2409            continue            continue
2410          fi # $pass = conv          fi # $pass = conv
2411    
2412        
2413          # Get the name of the library we link against.          # Get the name of the library we link against.
2414          linklib=          linklib=
2415          for l in $old_library $library_names; do          for l in $old_library $library_names; do
# Line 2039  EOF Line 2417  EOF
2417          done          done
2418          if test -z "$linklib"; then          if test -z "$linklib"; then
2419            $echo "$modename: cannot find name of link library for \`$lib'" 1>&2            $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2420            exit 1            exit $EXIT_FAILURE
2421          fi          fi
2422    
2423          # This library was specified with -dlopen.          # This library was specified with -dlopen.
2424          if test "$pass" = dlopen; then          if test "$pass" = dlopen; then
2425            if test -z "$libdir"; then            if test -z "$libdir"; then
2426              $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2              $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2427              exit 1              exit $EXIT_FAILURE
2428            fi            fi
2429            if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then            if test -z "$dlname" ||
2430                 test "$dlopen_support" != yes ||
2431                 test "$build_libtool_libs" = no; then
2432              # If there is no dlname, no dlopen support or we're linking              # If there is no dlname, no dlopen support or we're linking
2433              # statically, we need to preload.  We also need to preload any              # statically, we need to preload.  We also need to preload any
2434              # dependent libraries so libltdl's deplib preloader doesn't              # dependent libraries so libltdl's deplib preloader doesn't
# Line 2085  EOF Line 2465  EOF
2465              dir="$libdir"              dir="$libdir"
2466              absdir="$libdir"              absdir="$libdir"
2467            fi            fi
2468              test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2469          else          else
2470            dir="$ladir/$objdir"            if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2471            absdir="$abs_ladir/$objdir"              dir="$ladir"
2472            # Remove this search path later              absdir="$abs_ladir"
2473            notinst_path="$notinst_path $abs_ladir"              # Remove this search path later
2474                notinst_path="$notinst_path $abs_ladir"
2475              else
2476                dir="$ladir/$objdir"
2477                absdir="$abs_ladir/$objdir"
2478                # Remove this search path later
2479                notinst_path="$notinst_path $abs_ladir"
2480              fi
2481          fi # $installed = yes          fi # $installed = yes
2482          name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`          name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2483    
# Line 2097  EOF Line 2485  EOF
2485          if test "$pass" = dlpreopen; then          if test "$pass" = dlpreopen; then
2486            if test -z "$libdir"; then            if test -z "$libdir"; then
2487              $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2              $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2488              exit 1              exit $EXIT_FAILURE
2489            fi            fi
2490            # Prefer using a static library (so that no silly _DYNAMIC symbols            # Prefer using a static library (so that no silly _DYNAMIC symbols
2491            # are required to link).            # are required to link).
# Line 2124  EOF Line 2512  EOF
2512            continue            continue
2513          fi          fi
2514    
2515        
2516          if test "$linkmode" = prog && test "$pass" != link; then          if test "$linkmode" = prog && test "$pass" != link; then
2517            newlib_search_path="$newlib_search_path $ladir"            newlib_search_path="$newlib_search_path $ladir"
2518            deplibs="$lib $deplibs"            deplibs="$lib $deplibs"
# Line 2160  EOF Line 2548  EOF
2548    
2549          if test "$linkmode,$pass" = "prog,link"; then          if test "$linkmode,$pass" = "prog,link"; then
2550            if test -n "$library_names" &&            if test -n "$library_names" &&
2551               { test "$prefer_static_libs" = no || test -z "$old_library"; }; then               { { test "$prefer_static_libs" = no ||
2552                     test "$prefer_static_libs,$installed" = "built,yes"; } ||
2553                   test -z "$old_library"; }; then
2554              # We need to hardcode the library path              # We need to hardcode the library path
2555              if test -n "$shlibpath_var"; then              if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2556                # Make sure the rpath contains only unique directories.                # Make sure the rpath contains only unique directories.
2557                case "$temp_rpath " in                case "$temp_rpath " in
2558                *" $dir "*) ;;                *" $dir "*) ;;
2559                *" $absdir "*) ;;                *" $absdir "*) ;;
2560                *) temp_rpath="$temp_rpath $dir" ;;                *) temp_rpath="$temp_rpath $absdir" ;;
2561                esac                esac
2562              fi              fi
2563    
# Line 2204  EOF Line 2594  EOF
2594          fi          fi
2595    
2596          link_static=no # Whether the deplib will be linked statically          link_static=no # Whether the deplib will be linked statically
2597            use_static_libs=$prefer_static_libs
2598            if test "$use_static_libs" = built && test "$installed" = yes ; then
2599              use_static_libs=no
2600            fi
2601          if test -n "$library_names" &&          if test -n "$library_names" &&
2602             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then             { test "$use_static_libs" = no || test -z "$old_library"; }; then
2603            if test "$installed" = no; then            if test "$installed" = no; then
2604              notinst_deplibs="$notinst_deplibs $lib"              notinst_deplibs="$notinst_deplibs $lib"
2605              need_relink=yes              need_relink=yes
2606            fi            fi
2607            # This is a shared library            # This is a shared library
2608            
2609        # Warn about portability, can't link against -module's on some systems (darwin)            # Warn about portability, can't link against -module's on
2610        if test "$shouldnotlink" = yes && test "$pass" = link ; then            # some systems (darwin)
2611              if test "$shouldnotlink" = yes && test "$pass" = link ; then
2612              $echo              $echo
2613              if test "$linkmode" = prog; then              if test "$linkmode" = prog; then
2614                $echo "*** Warning: Linking the executable $output against the loadable module"                $echo "*** Warning: Linking the executable $output against the loadable module"
2615              else              else
2616                $echo "*** Warning: Linking the shared library $output against the loadable module"                $echo "*** Warning: Linking the shared library $output against the loadable module"
2617              fi              fi
2618              $echo "*** $linklib is not portable!"                  $echo "*** $linklib is not portable!"
2619        fi                      fi
2620            if test "$linkmode" = lib &&            if test "$linkmode" = lib &&
2621               test "$hardcode_into_libs" = yes; then               test "$hardcode_into_libs" = yes; then
2622              # Hardcode the library path.              # Hardcode the library path.
# Line 2279  EOF Line 2674  EOF
2674              else              else
2675                $show "extracting exported symbol list from \`$soname'"                $show "extracting exported symbol list from \`$soname'"
2676                save_ifs="$IFS"; IFS='~'                save_ifs="$IFS"; IFS='~'
2677                eval cmds=\"$extract_expsyms_cmds\"                cmds=$extract_expsyms_cmds
2678                for cmd in $cmds; do                for cmd in $cmds; do
2679                  IFS="$save_ifs"                  IFS="$save_ifs"
2680                    eval cmd=\"$cmd\"
2681                  $show "$cmd"                  $show "$cmd"
2682                  $run eval "$cmd" || exit $?                  $run eval "$cmd" || exit $?
2683                done                done
# Line 2292  EOF Line 2688  EOF
2688              if test -f "$output_objdir/$newlib"; then :; else              if test -f "$output_objdir/$newlib"; then :; else
2689                $show "generating import library for \`$soname'"                $show "generating import library for \`$soname'"
2690                save_ifs="$IFS"; IFS='~'                save_ifs="$IFS"; IFS='~'
2691                eval cmds=\"$old_archive_from_expsyms_cmds\"                cmds=$old_archive_from_expsyms_cmds
2692                for cmd in $cmds; do                for cmd in $cmds; do
2693                  IFS="$save_ifs"                  IFS="$save_ifs"
2694                    eval cmd=\"$cmd\"
2695                  $show "$cmd"                  $show "$cmd"
2696                  $run eval "$cmd" || exit $?                  $run eval "$cmd" || exit $?
2697                done                done
# Line 2315  EOF Line 2712  EOF
2712                if test "$hardcode_direct" = no; then                if test "$hardcode_direct" = no; then
2713                  add="$dir/$linklib"                  add="$dir/$linklib"
2714                  case $host in                  case $host in
2715                    *-*-sco3.2v5* ) add_dir="-L$dir" ;;                    *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2716                      *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2717                      *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2718                        *-*-unixware7*) add_dir="-L$dir" ;;
2719                    *-*-darwin* )                    *-*-darwin* )
2720                      # if the lib is a module then we can not link against it, someone                      # if the lib is a module then we can not link against
2721                      # is ignoring the new warnings I added                      # it, someone is ignoring the new warnings I added
2722                      if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then                      if /usr/bin/file -L $add 2> /dev/null |
2723                          $EGREP ": [^:]* bundle" >/dev/null ; then
2724                        $echo "** Warning, lib $linklib is a module, not a shared library"                        $echo "** Warning, lib $linklib is a module, not a shared library"
2725                        if test -z "$old_library" ; then                        if test -z "$old_library" ; then
2726                          $echo                          $echo
# Line 2327  EOF Line 2728  EOF
2728                          $echo "** The link will probably fail, sorry"                          $echo "** The link will probably fail, sorry"
2729                        else                        else
2730                          add="$dir/$old_library"                          add="$dir/$old_library"
2731                        fi                        fi
2732                      fi                      fi
2733                  esac                  esac
2734                elif test "$hardcode_minus_L" = no; then                elif test "$hardcode_minus_L" = no; then
# Line 2350  EOF Line 2751  EOF
2751                  add_dir="-L$dir"                  add_dir="-L$dir"
2752                  # Try looking first in the location we're being installed to.                  # Try looking first in the location we're being installed to.
2753                  if test -n "$inst_prefix_dir"; then                  if test -n "$inst_prefix_dir"; then
2754                    case "$libdir" in                    case $libdir in
2755                      [\\/]*)                      [\\/]*)
2756                        add_dir="-L$inst_prefix_dir$libdir $add_dir"                        add_dir="$add_dir -L$inst_prefix_dir$libdir"
2757                        ;;                        ;;
2758                    esac                    esac
2759                  fi                  fi
# Line 2369  EOF Line 2770  EOF
2770    
2771              if test "$lib_linked" != yes; then              if test "$lib_linked" != yes; then
2772                $echo "$modename: configuration error: unsupported hardcode properties"                $echo "$modename: configuration error: unsupported hardcode properties"
2773                exit 1                exit $EXIT_FAILURE
2774              fi              fi
2775    
2776              if test -n "$add_shlibpath"; then              if test -n "$add_shlibpath"; then
# Line 2412  EOF Line 2813  EOF
2813                esac                esac
2814                add="-l$name"                add="-l$name"
2815              elif test "$hardcode_automatic" = yes; then              elif test "$hardcode_automatic" = yes; then
2816                if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then                if test -n "$inst_prefix_dir" &&
2817                     test -f "$inst_prefix_dir$libdir/$linklib" ; then
2818                  add="$inst_prefix_dir$libdir/$linklib"                  add="$inst_prefix_dir$libdir/$linklib"
2819                else                else
2820                  add="$libdir/$linklib"                  add="$libdir/$linklib"
# Line 2422  EOF Line 2824  EOF
2824                add_dir="-L$libdir"                add_dir="-L$libdir"
2825                # Try looking first in the location we're being installed to.                # Try looking first in the location we're being installed to.
2826                if test -n "$inst_prefix_dir"; then                if test -n "$inst_prefix_dir"; then
2827                  case "$libdir" in                  case $libdir in
2828                    [\\/]*)                    [\\/]*)
2829                      add_dir="-L$inst_prefix_dir$libdir $add_dir"                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2830                      ;;                      ;;
2831                  esac                  esac
2832                fi                fi
# Line 2483  EOF Line 2885  EOF
2885                fi                fi
2886              fi              fi
2887            else            else
             convenience="$convenience $dir/$old_library"  
             old_convenience="$old_convenience $dir/$old_library"  
2888              deplibs="$dir/$old_library $deplibs"              deplibs="$dir/$old_library $deplibs"
2889              link_static=yes              link_static=yes
2890            fi            fi
# Line 2492  EOF Line 2892  EOF
2892    
2893          if test "$linkmode" = lib; then          if test "$linkmode" = lib; then
2894            if test -n "$dependency_libs" &&            if test -n "$dependency_libs" &&
2895               { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||               { test "$hardcode_into_libs" != yes ||
2896                   test "$build_old_libs" = yes ||
2897                 test "$link_static" = yes; }; then                 test "$link_static" = yes; }; then
2898              # Extract -R from dependency_libs              # Extract -R from dependency_libs
2899              temp_deplibs=              temp_deplibs=
# Line 2549  EOF Line 2950  EOF
2950                    eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`                    eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2951                    if test -z "$libdir"; then                    if test -z "$libdir"; then
2952                      $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2                      $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2953                      exit 1                      exit $EXIT_FAILURE
2954                    fi                    fi
2955                    if test "$absdir" != "$libdir"; then                    if test "$absdir" != "$libdir"; then
2956                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
# Line 2559  EOF Line 2960  EOF
2960                  depdepl=                  depdepl=
2961                  case $host in                  case $host in
2962                  *-*-darwin*)                  *-*-darwin*)
2963                    # we do not want to link against static libs, but need to link against shared                    # we do not want to link against static libs,
2964                      # but need to link against shared
2965                    eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`                    eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2966                      eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2967                    if test -n "$deplibrary_names" ; then                    if test -n "$deplibrary_names" ; then
2968                      for tmp in $deplibrary_names ; do                      for tmp in $deplibrary_names ; do
2969                        depdepl=$tmp                        depdepl=$tmp
2970                      done                      done
2971                      if test -f "$path/$depdepl" ; then                      if test -f "$deplibdir/$depdepl" ; then
2972                          depdepl="$deplibdir/$depdepl"
2973                        elif test -f "$path/$depdepl" ; then
2974                        depdepl="$path/$depdepl"                        depdepl="$path/$depdepl"
2975                     fi                      else
2976                      newlib_search_path="$newlib_search_path $path"                        # Can't find it, oh well...
2977                      path=""                        depdepl=
2978                        fi
2979                        # do not add paths which are already there
2980                        case " $newlib_search_path " in
2981                        *" $path "*) ;;
2982                        *) newlib_search_path="$newlib_search_path $path";;
2983                        esac
2984                    fi                    fi
2985                      path=""
2986                    ;;                    ;;
2987                  *)                  *)
2988                  path="-L$path"                    path="-L$path"
2989                  ;;                    ;;
2990                  esac                  esac
                   
2991                  ;;                  ;;
2992                    -l*)                -l*)
2993                  case $host in                  case $host in
2994                  *-*-darwin*)                  *-*-darwin*)
2995                   # Again, we only want to link against shared libraries                    # Again, we only want to link against shared libraries
2996                   eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`                    eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2997                   for tmp in $newlib_search_path ; do                    for tmp in $newlib_search_path ; do
2998                       if test -f "$tmp/lib$tmp_libs.dylib" ; then                      if test -f "$tmp/lib$tmp_libs.dylib" ; then
2999                         eval depdepl="$tmp/lib$tmp_libs.dylib"                        eval depdepl="$tmp/lib$tmp_libs.dylib"
3000                         break                        break
3001                       fi                        fi
3002           done                    done
3003           path=""                    path=""
3004                    ;;                    ;;
3005                  *) continue ;;                  *) continue ;;
3006                  esac                                esac
3007                  ;;                  ;;
3008                *) continue ;;                *) continue ;;
3009                esac                esac
3010                case " $deplibs " in                case " $deplibs " in
               *" $depdepl "*) ;;  
               *) deplibs="$deplibs $depdepl" ;;  
               esac              
               case " $deplibs " in  
3011                *" $path "*) ;;                *" $path "*) ;;
3012                *) deplibs="$deplibs $path" ;;                *) deplibs="$path $deplibs" ;;
3013                  esac
3014                  case " $deplibs " in
3015                  *" $depdepl "*) ;;
3016                  *) deplibs="$depdepl $deplibs" ;;
3017                esac                esac
3018              done              done
3019            fi # link_all_deplibs != no            fi # link_all_deplibs != no
# Line 2689  EOF Line 3100  EOF
3100            eval $var=\"$tmp_libs\"            eval $var=\"$tmp_libs\"
3101          done # for var          done # for var
3102        fi        fi
3103        # Last step: remove runtime libs from dependency_libs (they stay in deplibs)        # Last step: remove runtime libs from dependency_libs
3104          # (they stay in deplibs)
3105        tmp_libs=        tmp_libs=
3106        for i in $dependency_libs ; do        for i in $dependency_libs ; do
3107          case " $predeps $postdeps $compiler_lib_search_path " in          case " $predeps $postdeps $compiler_lib_search_path " in
# Line 2710  EOF Line 3122  EOF
3122    
3123      case $linkmode in      case $linkmode in
3124      oldlib)      oldlib)
3125        if test -n "$deplibs"; then        case " $deplibs" in
3126          $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2        *\ -l* | *\ -L*)
3127        fi          $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3128          esac
3129    
3130        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3131          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
# Line 2749  EOF Line 3162  EOF
3162        case $outputname in        case $outputname in
3163        lib*)        lib*)
3164          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3165          eval shared_ext=\"$shrext\"          eval shared_ext=\"$shrext_cmds\"
3166          eval libname=\"$libname_spec\"          eval libname=\"$libname_spec\"
3167          ;;          ;;
3168        *)        *)
3169          if test "$module" = no; then          if test "$module" = no; then
3170            $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2            $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3171            $echo "$help" 1>&2            $echo "$help" 1>&2
3172            exit 1            exit $EXIT_FAILURE
3173          fi          fi
3174          if test "$need_lib_prefix" != no; then          if test "$need_lib_prefix" != no; then
3175            # Add the "lib" prefix for modules if required            # Add the "lib" prefix for modules if required
3176            name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`            name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3177            eval shared_ext=\"$shrext\"            eval shared_ext=\"$shrext_cmds\"
3178            eval libname=\"$libname_spec\"            eval libname=\"$libname_spec\"
3179          else          else
3180            libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`            libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
# Line 2772  EOF Line 3185  EOF
3185        if test -n "$objs"; then        if test -n "$objs"; then
3186          if test "$deplibs_check_method" != pass_all; then          if test "$deplibs_check_method" != pass_all; then
3187            $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1            $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3188            exit 1            exit $EXIT_FAILURE
3189          else          else
3190            $echo            $echo
3191            $echo "*** Warning: Linking the shared library $output against the non-libtool"            $echo "*** Warning: Linking the shared library $output against the non-libtool"
# Line 2820  EOF Line 3233  EOF
3233          if test -n "$8"; then          if test -n "$8"; then
3234            $echo "$modename: too many parameters to \`-version-info'" 1>&2            $echo "$modename: too many parameters to \`-version-info'" 1>&2
3235            $echo "$help" 1>&2            $echo "$help" 1>&2
3236            exit 1            exit $EXIT_FAILURE
3237          fi          fi
3238    
3239          # convert absolute version numbers to libtool ages          # convert absolute version numbers to libtool ages
3240          # this retains compatibility with .la files and attempts          # this retains compatibility with .la files and attempts
3241          # to make the code below a bit more comprehensible          # to make the code below a bit more comprehensible
3242            
3243          case $vinfo_number in          case $vinfo_number in
3244          yes)          yes)
3245            number_major="$2"            number_major="$2"
# Line 2840  EOF Line 3253  EOF
3253            # which has an extra 1 added just for fun            # which has an extra 1 added just for fun
3254            #            #
3255            case $version_type in            case $version_type in
3256            darwin|linux|osf|windows)            darwin|linux|osf|windows|none)
3257              current=`expr $number_major + $number_minor`              current=`expr $number_major + $number_minor`
3258              age="$number_minor"              age="$number_minor"
3259              revision="$number_revision"              revision="$number_revision"
# Line 2851  EOF Line 3264  EOF
3264              age="0"              age="0"
3265              ;;              ;;
3266            irix|nonstopux)            irix|nonstopux)
3267              current=`expr $number_major + $number_minor - 1`              current=`expr $number_major + $number_minor`
3268              age="$number_minor"              age="$number_minor"
3269              revision="$number_minor"              revision="$number_minor"
3270                lt_irix_increment=no
3271              ;;              ;;
3272            esac            esac
3273            ;;            ;;
# Line 2866  EOF Line 3280  EOF
3280    
3281          # Check that each of the things are valid numbers.          # Check that each of the things are valid numbers.
3282          case $current in          case $current in
3283          0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;          0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3284          *)          *)
3285            $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2            $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3286            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3287            exit 1            exit $EXIT_FAILURE
3288            ;;            ;;
3289          esac          esac
3290    
3291          case $revision in          case $revision in
3292          0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;          0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3293          *)          *)
3294            $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2            $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3295            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3296            exit 1            exit $EXIT_FAILURE
3297            ;;            ;;
3298          esac          esac
3299    
3300          case $age in          case $age in
3301          0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;          0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3302          *)          *)
3303            $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2            $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3304            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3305            exit 1            exit $EXIT_FAILURE
3306            ;;            ;;
3307          esac          esac
3308    
3309          if test "$age" -gt "$current"; then          if test "$age" -gt "$current"; then
3310            $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2            $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3311            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3312            exit 1            exit $EXIT_FAILURE
3313          fi          fi
3314    
3315          # Calculate the version variables.          # Calculate the version variables.
# Line 2912  EOF Line 3326  EOF
3326            versuffix="$major.$age.$revision"            versuffix="$major.$age.$revision"
3327            # Darwin ld doesn't like 0 for these options...            # Darwin ld doesn't like 0 for these options...
3328            minor_current=`expr $current + 1`            minor_current=`expr $current + 1`
3329              xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3330            verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"            verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3331            ;;            ;;
3332    
# Line 2926  EOF Line 3341  EOF
3341            ;;            ;;
3342    
3343          irix | nonstopux)          irix | nonstopux)
3344            major=`expr $current - $age + 1`            if test "X$lt_irix_increment" = "Xno"; then
3345                major=`expr $current - $age`
3346              else
3347                major=`expr $current - $age + 1`
3348              fi
3349            case $version_type in            case $version_type in
3350              nonstopux) verstring_prefix=nonstopux ;;              nonstopux) verstring_prefix=nonstopux ;;
3351              *)         verstring_prefix=sgi ;;              *)         verstring_prefix=sgi ;;
# Line 2984  EOF Line 3402  EOF
3402          *)          *)
3403            $echo "$modename: unknown library version type \`$version_type'" 1>&2            $echo "$modename: unknown library version type \`$version_type'" 1>&2
3404            $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2            $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3405            exit 1            exit $EXIT_FAILURE
3406            ;;            ;;
3407          esac          esac
3408    
# Line 3038  EOF Line 3456  EOF
3456              *.$objext)              *.$objext)
3457                 ;;                 ;;
3458              $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)              $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3459                   if test "X$precious_files_regex" != "X"; then
3460                     if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3461                     then
3462                       continue
3463                     fi
3464                   fi
3465                 removelist="$removelist $p"                 removelist="$removelist $p"
3466                 ;;                 ;;
3467              *) ;;              *) ;;
# Line 3058  EOF Line 3482  EOF
3482        fi        fi
3483    
3484        # Eliminate all temporary directories.        # Eliminate all temporary directories.
3485        for path in $notinst_path; do        #for path in $notinst_path; do
3486          lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`        # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3487          deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`        # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3488          dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`        # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3489        done        #done
3490    
3491        if test -n "$xrpath"; then        if test -n "$xrpath"; then
3492          # If the user specified any rpath flags, then add them.          # If the user specified any rpath flags, then add them.
# Line 3112  EOF Line 3536  EOF
3536            *-*-netbsd*)            *-*-netbsd*)
3537              # Don't link with libc until the a.out ld.so is fixed.              # Don't link with libc until the a.out ld.so is fixed.
3538              ;;              ;;
3539            *-*-openbsd* | *-*-freebsd*)            *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3540              # Do not include libc due to us having libc/libc_r.              # Do not include libc due to us having libc/libc_r.
3541              test "X$arg" = "X-lc" && continue              ;;
3542              *-*-sco3.2v5* | *-*-sco5v6*)
3543                # Causes problems with __ctype
3544                ;;
3545              *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3546                # Compiler inserts libc in the correct place for threads to work
3547              ;;              ;;
3548            *)            *)
3549              # Add libc to deplibs on all other systems if necessary.              # Add libc to deplibs on all other systems if necessary.
# Line 3158  EOF Line 3587  EOF
3587            int main() { return 0; }            int main() { return 0; }
3588  EOF  EOF
3589            $rm conftest            $rm conftest
3590            $LTCC -o conftest conftest.c $deplibs            if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
           if test "$?" -eq 0 ; then  
3591              ldd_output=`ldd conftest`              ldd_output=`ldd conftest`
3592              for i in $deplibs; do              for i in $deplibs; do
3593                name="`expr $i : '-l\(.*\)'`"                name=`expr $i : '-l\(.*\)'`
3594                # If $name is empty we are operating on a -L argument.                # If $name is empty we are operating on a -L argument.
3595                if test "$name" != "" && test "$name" -ne "0"; then                if test "$name" != "" && test "$name" != "0"; then
3596                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3597                    case " $predeps $postdeps " in                    case " $predeps $postdeps " in
3598                    *" $i "*)                    *" $i "*)
# Line 3199  EOF Line 3627  EOF
3627              # Error occurred in the first compile.  Let's try to salvage              # Error occurred in the first compile.  Let's try to salvage
3628              # the situation: Compile a separate program for each library.              # the situation: Compile a separate program for each library.
3629              for i in $deplibs; do              for i in $deplibs; do
3630                name="`expr $i : '-l\(.*\)'`"                name=`expr $i : '-l\(.*\)'`
3631                # If $name is empty we are operating on a -L argument.                # If $name is empty we are operating on a -L argument.
3632                if test "$name" != "" && test "$name" != "0"; then                if test "$name" != "" && test "$name" != "0"; then
3633                  $rm conftest                  $rm conftest
3634                  $LTCC -o conftest conftest.c $i                  if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
                 # Did it work?  
                 if test "$?" -eq 0 ; then  
3635                    ldd_output=`ldd conftest`                    ldd_output=`ldd conftest`
3636                    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then                    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3637                      case " $predeps $postdeps " in                      case " $predeps $postdeps " in
# Line 3237  EOF Line 3663  EOF
3663                    droppeddeps=yes                    droppeddeps=yes
3664                    $echo                    $echo
3665                    $echo "*** Warning!  Library $i is needed by this library but I was not able to"                    $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3666                    $echo "***  make it link in!  You will probably need to install it or some"                    $echo "*** make it link in!  You will probably need to install it or some"
3667                    $echo "*** library that it depends on before this library will be fully"                    $echo "*** library that it depends on before this library will be fully"
3668                    $echo "*** functional.  Installing it before continuing would be even better."                    $echo "*** functional.  Installing it before continuing would be even better."
3669                  fi                  fi
# Line 3251  EOF Line 3677  EOF
3677            set dummy $deplibs_check_method            set dummy $deplibs_check_method
3678            file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`            file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3679            for a_deplib in $deplibs; do            for a_deplib in $deplibs; do
3680              name="`expr $a_deplib : '-l\(.*\)'`"              name=`expr $a_deplib : '-l\(.*\)'`
3681              # If $name is empty we are operating on a -L argument.              # If $name is empty we are operating on a -L argument.
3682              if test "$name" != "" && test  "$name" != "0"; then              if test "$name" != "" && test  "$name" != "0"; then
3683                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
# Line 3320  EOF Line 3746  EOF
3746            set dummy $deplibs_check_method            set dummy $deplibs_check_method
3747            match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`            match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3748            for a_deplib in $deplibs; do            for a_deplib in $deplibs; do
3749              name="`expr $a_deplib : '-l\(.*\)'`"              name=`expr $a_deplib : '-l\(.*\)'`
3750              # If $name is empty we are operating on a -L argument.              # If $name is empty we are operating on a -L argument.
3751              if test -n "$name" && test "$name" != "0"; then              if test -n "$name" && test "$name" != "0"; then
3752                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
# Line 3450  EOF Line 3876  EOF
3876          deplibs=$newdeplibs          deplibs=$newdeplibs
3877        fi        fi
3878    
3879    
3880          # move library search paths that coincide with paths to not yet
3881          # installed libraries to the beginning of the library search list
3882          new_libs=
3883          for path in $notinst_path; do
3884            case " $new_libs " in
3885            *" -L$path/$objdir "*) ;;
3886            *)
3887              case " $deplibs " in
3888              *" -L$path/$objdir "*)
3889                new_libs="$new_libs -L$path/$objdir" ;;
3890              esac
3891              ;;
3892            esac
3893          done
3894          for deplib in $deplibs; do
3895            case $deplib in
3896            -L*)
3897              case " $new_libs " in
3898              *" $deplib "*) ;;
3899              *) new_libs="$new_libs $deplib" ;;
3900              esac
3901              ;;
3902            *) new_libs="$new_libs $deplib" ;;
3903            esac
3904          done
3905          deplibs="$new_libs"
3906    
3907    
3908        # All the library-specific variables (install_libdir is set above).        # All the library-specific variables (install_libdir is set above).
3909        library_names=        library_names=
3910        old_library=        old_library=
# Line 3494  EOF Line 3949  EOF
3949               test -n "$hardcode_libdirs"; then               test -n "$hardcode_libdirs"; then
3950              libdir="$hardcode_libdirs"              libdir="$hardcode_libdirs"
3951              if test -n "$hardcode_libdir_flag_spec_ld"; then              if test -n "$hardcode_libdir_flag_spec_ld"; then
3952                eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"                case $archive_cmds in
3953                  *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3954                  *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3955                  esac
3956              else              else
3957                eval dep_rpath=\"$hardcode_libdir_flag_spec\"                eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3958              fi              fi
# Line 3517  EOF Line 3975  EOF
3975          fi          fi
3976    
3977          # Get the real and link names of the library.          # Get the real and link names of the library.
3978          eval shared_ext=\"$shrext\"          eval shared_ext=\"$shrext_cmds\"
3979          eval library_names=\"$library_names_spec\"          eval library_names=\"$library_names_spec\"
3980          set dummy $library_names          set dummy $library_names
3981          realname="$2"          realname="$2"
# Line 3533  EOF Line 3991  EOF
3991          fi          fi
3992    
3993          lib="$output_objdir/$realname"          lib="$output_objdir/$realname"
3994            linknames=
3995          for link          for link
3996          do          do
3997            linknames="$linknames $link"            linknames="$linknames $link"
# Line 3547  EOF Line 4006  EOF
4006              $show "generating symbol list for \`$libname.la'"              $show "generating symbol list for \`$libname.la'"
4007              export_symbols="$output_objdir/$libname.exp"              export_symbols="$output_objdir/$libname.exp"
4008              $run $rm $export_symbols              $run $rm $export_symbols
4009              eval cmds=\"$export_symbols_cmds\"              cmds=$export_symbols_cmds
4010              save_ifs="$IFS"; IFS='~'              save_ifs="$IFS"; IFS='~'
4011              for cmd in $cmds; do              for cmd in $cmds; do
4012                IFS="$save_ifs"                IFS="$save_ifs"
4013                  eval cmd=\"$cmd\"
4014                if len=`expr "X$cmd" : ".*"` &&                if len=`expr "X$cmd" : ".*"` &&
4015                 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then                 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4016                  $show "$cmd"                  $show "$cmd"
# Line 3560  EOF Line 4020  EOF
4020                  # The command line is too long to execute in one step.                  # The command line is too long to execute in one step.
4021                  $show "using reloadable object file for export list..."                  $show "using reloadable object file for export list..."
4022                  skipped_export=:                  skipped_export=:
4023                    # Break out early, otherwise skipped_export may be
4024                    # set to false by a later but shorter cmd.
4025                    break
4026                fi                fi
4027              done              done
4028              IFS="$save_ifs"              IFS="$save_ifs"
# Line 3580  EOF Line 4043  EOF
4043          for test_deplib in $deplibs; do          for test_deplib in $deplibs; do
4044                  case " $convenience " in                  case " $convenience " in
4045                  *" $test_deplib "*) ;;                  *" $test_deplib "*) ;;
4046                  *)                  *)
4047                          tmp_deplibs="$tmp_deplibs $test_deplib"                          tmp_deplibs="$tmp_deplibs $test_deplib"
4048                          ;;                          ;;
4049                  esac                  esac
4050          done          done
4051          deplibs="$tmp_deplibs"          deplibs="$tmp_deplibs"
4052    
4053          if test -n "$convenience"; then          if test -n "$convenience"; then
4054            if test -n "$whole_archive_flag_spec"; then            if test -n "$whole_archive_flag_spec"; then
# Line 3593  EOF Line 4056  EOF
4056              eval libobjs=\"\$libobjs $whole_archive_flag_spec\"              eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4057            else            else
4058              gentop="$output_objdir/${outputname}x"              gentop="$output_objdir/${outputname}x"
             $show "${rm}r $gentop"  
             $run ${rm}r "$gentop"  
             $show "$mkdir $gentop"  
             $run $mkdir "$gentop"  
             status=$?  
             if test "$status" -ne 0 && test ! -d "$gentop"; then  
               exit $status  
             fi  
4059              generated="$generated $gentop"              generated="$generated $gentop"
4060    
4061              for xlib in $convenience; do              func_extract_archives $gentop $convenience
4062                # Extract the objects.              libobjs="$libobjs $func_extract_archives_result"
               case $xlib in  
               [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;  
               *) xabs=`pwd`"/$xlib" ;;  
               esac  
               xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`  
               xdir="$gentop/$xlib"  
   
               $show "${rm}r $xdir"  
               $run ${rm}r "$xdir"  
               $show "$mkdir $xdir"  
               $run $mkdir "$xdir"  
               status=$?  
               if test "$status" -ne 0 && test ! -d "$xdir"; then  
                 exit $status  
               fi  
               # We will extract separately just the conflicting names and we will no  
               # longer touch any unique names. It is faster to leave these extract  
               # automatically by $AR in one run.  
               $show "(cd $xdir && $AR x $xabs)"  
               $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?  
               if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then  
                 :  
               else  
                 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2  
                 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2  
                 $AR t "$xabs" | sort | uniq -cd | while read -r count name  
                 do  
                   i=1  
                   while test "$i" -le "$count"  
                   do  
                    # Put our $i before any first dot (extension)  
                    # Never overwrite any file  
                    name_to="$name"  
                    while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"  
                    do  
                      name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`  
                    done  
                    $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"  
                    $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?  
                    i=`expr $i + 1`  
                   done  
                 done  
               fi  
   
               libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`  
             done  
4063            fi            fi
4064          fi          fi
4065            
4066          if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then          if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4067            eval flag=\"$thread_safe_flag_spec\"            eval flag=\"$thread_safe_flag_spec\"
4068            linker_flags="$linker_flags $flag"            linker_flags="$linker_flags $flag"
# Line 3667  EOF Line 4076  EOF
4076          # Do each of the archive commands.          # Do each of the archive commands.
4077          if test "$module" = yes && test -n "$module_cmds" ; then          if test "$module" = yes && test -n "$module_cmds" ; then
4078            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4079              eval cmds=\"$module_expsym_cmds\"              eval test_cmds=\"$module_expsym_cmds\"
4080                cmds=$module_expsym_cmds
4081            else            else
4082              eval cmds=\"$module_cmds\"              eval test_cmds=\"$module_cmds\"
4083                cmds=$module_cmds
4084            fi            fi
4085          else          else
4086          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4087            eval cmds=\"$archive_expsym_cmds\"            eval test_cmds=\"$archive_expsym_cmds\"
4088              cmds=$archive_expsym_cmds
4089          else          else
4090            eval cmds=\"$archive_cmds\"            eval test_cmds=\"$archive_cmds\"
4091              cmds=$archive_cmds
4092            fi            fi
4093          fi          fi
4094    
4095          if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&          if test "X$skipped_export" != "X:" &&
4096               len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4097             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4098            :            :
4099          else          else
# Line 3698  EOF Line 4112  EOF
4112              save_libobjs=$libobjs              save_libobjs=$libobjs
4113            fi            fi
4114            save_output=$output            save_output=$output
4115              output_la=`$echo "X$output" | $Xsed -e "$basename"`
4116    
4117            # Clear the reloadable object creation command queue and            # Clear the reloadable object creation command queue and
4118            # initialize k to one.            # initialize k to one.
# Line 3707  EOF Line 4122  EOF
4122            delfiles=            delfiles=
4123            last_robj=            last_robj=
4124            k=1            k=1
4125            output=$output_objdir/$save_output-${k}.$objext            output=$output_objdir/$output_la-${k}.$objext
4126            # Loop over the list of objects to be linked.            # Loop over the list of objects to be linked.
4127            for obj in $save_libobjs            for obj in $save_libobjs
4128            do            do
4129              eval test_cmds=\"$reload_cmds $objlist $last_robj\"              eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4130              if test "X$objlist" = X ||              if test "X$objlist" = X ||
4131                 { len=`expr "X$test_cmds" : ".*"` &&                 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4132                   test "$len" -le "$max_cmd_len"; }; then                   test "$len" -le "$max_cmd_len"; }; then
4133                objlist="$objlist $obj"                objlist="$objlist $obj"
4134              else              else
# Line 3727  EOF Line 4142  EOF
4142                  # the last one created.                  # the last one created.
4143                  eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"                  eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4144                fi                fi
4145                last_robj=$output_objdir/$save_output-${k}.$objext                last_robj=$output_objdir/$output_la-${k}.$objext
4146                k=`expr $k + 1`                k=`expr $k + 1`
4147                output=$output_objdir/$save_output-${k}.$objext                output=$output_objdir/$output_la-${k}.$objext
4148                objlist=$obj                objlist=$obj
4149                len=1                len=1
4150              fi              fi
# Line 3749  EOF Line 4164  EOF
4164              eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"              eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4165            fi            fi
4166    
4167            # Set up a command to remove the reloadale object files            # Set up a command to remove the reloadable object files
4168            # after they are used.            # after they are used.
4169            i=0            i=0
4170            while test "$i" -lt "$k"            while test "$i" -lt "$k"
4171            do            do
4172              i=`expr $i + 1`              i=`expr $i + 1`
4173              delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"              delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4174            done            done
4175    
4176            $echo "creating a temporary reloadable object file: $output"            $echo "creating a temporary reloadable object file: $output"
# Line 3780  EOF Line 4195  EOF
4195            # value of $libobjs for piecewise linking.            # value of $libobjs for piecewise linking.
4196    
4197            # Do each of the archive commands.            # Do each of the archive commands.
4198              if test "$module" = yes && test -n "$module_cmds" ; then
4199                if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4200                  cmds=$module_expsym_cmds
4201                else
4202                  cmds=$module_cmds
4203                fi
4204              else
4205            if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then            if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4206              eval cmds=\"$archive_expsym_cmds\"              cmds=$archive_expsym_cmds
4207            else            else
4208              eval cmds=\"$archive_cmds\"              cmds=$archive_cmds
4209                fi
4210            fi            fi
4211    
4212            # Append the command to remove the reloadable object files            # Append the command to remove the reloadable object files
4213            # to the just-reset $cmds.            # to the just-reset $cmds.
4214            eval cmds=\"\$cmds~$rm $delfiles\"            eval cmds=\"\$cmds~\$rm $delfiles\"
4215          fi          fi
4216          save_ifs="$IFS"; IFS='~'          save_ifs="$IFS"; IFS='~'
4217          for cmd in $cmds; do          for cmd in $cmds; do
4218            IFS="$save_ifs"            IFS="$save_ifs"
4219              eval cmd=\"$cmd\"
4220            $show "$cmd"            $show "$cmd"
4221            $run eval "$cmd" || exit $?            $run eval "$cmd" || {
4222                lt_exit=$?
4223    
4224                # Restore the uninstalled library and exit
4225                if test "$mode" = relink; then
4226                  $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4227                fi
4228    
4229                exit $lt_exit
4230              }
4231          done          done
4232          IFS="$save_ifs"          IFS="$save_ifs"
4233    
4234          # Restore the uninstalled library and exit          # Restore the uninstalled library and exit
4235          if test "$mode" = relink; then          if test "$mode" = relink; then
4236            $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?            $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4237            exit 0  
4238              if test -n "$convenience"; then
4239                if test -z "$whole_archive_flag_spec"; then
4240                  $show "${rm}r $gentop"
4241                  $run ${rm}r "$gentop"
4242                fi
4243              fi
4244    
4245              exit $EXIT_SUCCESS
4246          fi          fi
4247    
4248          # Create links to the real library.          # Create links to the real library.
# Line 3821  EOF Line 4262  EOF
4262        ;;        ;;
4263    
4264      obj)      obj)
4265        if test -n "$deplibs"; then        case " $deplibs" in
4266          $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2        *\ -l* | *\ -L*)
4267        fi          $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
4268          esac
4269    
4270        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4271          $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2          $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
# Line 3849  EOF Line 4291  EOF
4291        *.lo)        *.lo)
4292          if test -n "$objs$old_deplibs"; then          if test -n "$objs$old_deplibs"; then
4293            $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2            $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4294            exit 1            exit $EXIT_FAILURE
4295          fi          fi
4296          libobj="$output"          libobj="$output"
4297          obj=`$echo "X$output" | $Xsed -e "$lo2o"`          obj=`$echo "X$output" | $Xsed -e "$lo2o"`
# Line 3870  EOF Line 4312  EOF
4312        reload_conv_objs=        reload_conv_objs=
4313        gentop=        gentop=
4314        # reload_cmds runs $LD directly, so let us get rid of        # reload_cmds runs $LD directly, so let us get rid of
4315        # -Wl from whole_archive_flag_spec        # -Wl from whole_archive_flag_spec and hope we can get by with
4316          # turning comma into space..
4317        wl=        wl=
4318    
4319        if test -n "$convenience"; then        if test -n "$convenience"; then
4320          if test -n "$whole_archive_flag_spec"; then          if test -n "$whole_archive_flag_spec"; then
4321            eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"            eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4322              reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4323          else          else
4324            gentop="$output_objdir/${obj}x"            gentop="$output_objdir/${obj}x"
           $show "${rm}r $gentop"  
           $run ${rm}r "$gentop"  
           $show "$mkdir $gentop"  
           $run $mkdir "$gentop"  
           status=$?  
           if test "$status" -ne 0 && test ! -d "$gentop"; then  
             exit $status  
           fi  
4325            generated="$generated $gentop"            generated="$generated $gentop"
4326    
4327            for xlib in $convenience; do            func_extract_archives $gentop $convenience
4328              # Extract the objects.            reload_conv_objs="$reload_objs $func_extract_archives_result"
             case $xlib in  
             [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;  
             *) xabs=`pwd`"/$xlib" ;;  
             esac  
             xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`  
             xdir="$gentop/$xlib"  
   
             $show "${rm}r $xdir"  
             $run ${rm}r "$xdir"  
             $show "$mkdir $xdir"  
             $run $mkdir "$xdir"  
             status=$?  
             if test "$status" -ne 0 && test ! -d "$xdir"; then  
               exit $status  
             fi  
             # We will extract separately just the conflicting names and we will no  
             # longer touch any unique names. It is faster to leave these extract  
             # automatically by $AR in one run.  
             $show "(cd $xdir && $AR x $xabs)"  
             $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?  
             if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then  
               :  
             else  
               $echo "$modename: warning: object name conflicts; renaming object files" 1>&2  
               $echo "$modename: warning: to ensure that they will not overwrite" 1>&2  
               $AR t "$xabs" | sort | uniq -cd | while read -r count name  
               do  
                 i=1  
                 while test "$i" -le "$count"  
                 do  
                  # Put our $i before any first dot (extension)  
                  # Never overwrite any file  
                  name_to="$name"  
                  while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"  
                  do  
                    name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`  
                  done  
                  $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"  
                  $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?  
                  i=`expr $i + 1`  
                 done  
               done  
             fi  
   
             reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`  
           done  
4329          fi          fi
4330        fi        fi
4331    
# Line 3943  EOF Line 4333  EOF
4333        reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test        reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4334    
4335        output="$obj"        output="$obj"
4336        eval cmds=\"$reload_cmds\"        cmds=$reload_cmds
4337        save_ifs="$IFS"; IFS='~'        save_ifs="$IFS"; IFS='~'
4338        for cmd in $cmds; do        for cmd in $cmds; do
4339          IFS="$save_ifs"          IFS="$save_ifs"
4340            eval cmd=\"$cmd\"
4341          $show "$cmd"          $show "$cmd"
4342          $run eval "$cmd" || exit $?          $run eval "$cmd" || exit $?
4343        done        done
# Line 3959  EOF Line 4350  EOF
4350            $run ${rm}r $gentop            $run ${rm}r $gentop
4351          fi          fi
4352    
4353          exit 0          exit $EXIT_SUCCESS
4354        fi        fi
4355    
4356        if test "$build_libtool_libs" != yes; then        if test "$build_libtool_libs" != yes; then
# Line 3972  EOF Line 4363  EOF
4363          # accidentally link it into a program.          # accidentally link it into a program.
4364          # $show "echo timestamp > $libobj"          # $show "echo timestamp > $libobj"
4365          # $run eval "echo timestamp > $libobj" || exit $?          # $run eval "echo timestamp > $libobj" || exit $?
4366          exit 0          exit $EXIT_SUCCESS
4367        fi        fi
4368    
4369        if test -n "$pic_flag" || test "$pic_mode" != default; then        if test -n "$pic_flag" || test "$pic_mode" != default; then
4370          # Only do commands if we really have different PIC objects.          # Only do commands if we really have different PIC objects.
4371          reload_objs="$libobjs $reload_conv_objs"          reload_objs="$libobjs $reload_conv_objs"
4372          output="$libobj"          output="$libobj"
4373          eval cmds=\"$reload_cmds\"          cmds=$reload_cmds
4374          save_ifs="$IFS"; IFS='~'          save_ifs="$IFS"; IFS='~'
4375          for cmd in $cmds; do          for cmd in $cmds; do
4376            IFS="$save_ifs"            IFS="$save_ifs"
4377              eval cmd=\"$cmd\"
4378            $show "$cmd"            $show "$cmd"
4379            $run eval "$cmd" || exit $?            $run eval "$cmd" || exit $?
4380          done          done
# Line 3994  EOF Line 4386  EOF
4386          $run ${rm}r $gentop          $run ${rm}r $gentop
4387        fi        fi
4388    
4389        exit 0        exit $EXIT_SUCCESS
4390        ;;        ;;
4391    
4392      prog)      prog)
# Line 4034  EOF Line 4426  EOF
4426          ;;          ;;
4427        esac        esac
4428    
4429    
4430          # move library search paths that coincide with paths to not yet
4431          # installed libraries to the beginning of the library search list
4432          new_libs=
4433          for path in $notinst_path; do
4434            case " $new_libs " in
4435            *" -L$path/$objdir "*) ;;
4436            *)
4437              case " $compile_deplibs " in
4438              *" -L$path/$objdir "*)
4439                new_libs="$new_libs -L$path/$objdir" ;;
4440              esac
4441              ;;
4442            esac
4443          done
4444          for deplib in $compile_deplibs; do
4445            case $deplib in
4446            -L*)
4447              case " $new_libs " in
4448              *" $deplib "*) ;;
4449              *) new_libs="$new_libs $deplib" ;;
4450              esac
4451              ;;
4452            *) new_libs="$new_libs $deplib" ;;
4453            esac
4454          done
4455          compile_deplibs="$new_libs"
4456    
4457    
4458        compile_command="$compile_command $compile_deplibs"        compile_command="$compile_command $compile_deplibs"
4459        finalize_command="$finalize_command $finalize_deplibs"        finalize_command="$finalize_command $finalize_deplibs"
4460    
# Line 4078  EOF Line 4499  EOF
4499          fi          fi
4500          case $host in          case $host in
4501          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4502              testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4503            case :$dllsearchpath: in            case :$dllsearchpath: in
4504            *":$libdir:"*) ;;            *":$libdir:"*) ;;
4505            *) dllsearchpath="$dllsearchpath:$libdir";;            *) dllsearchpath="$dllsearchpath:$libdir";;
4506            esac            esac
4507              case :$dllsearchpath: in
4508              *":$testbindir:"*) ;;
4509              *) dllsearchpath="$dllsearchpath:$testbindir";;
4510              esac
4511            ;;            ;;
4512          esac          esac
4513        done        done
# Line 4195  extern \"C\" { Line 4621  extern \"C\" {
4621    
4622              # Prepare the list of exported symbols              # Prepare the list of exported symbols
4623              if test -z "$export_symbols"; then              if test -z "$export_symbols"; then
4624                export_symbols="$output_objdir/$output.exp"                export_symbols="$output_objdir/$outputname.exp"
4625                $run $rm $export_symbols                $run $rm $export_symbols
4626                $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'                $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4627                  case $host in
4628                  *cygwin* | *mingw* )
4629                    $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4630                    $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4631                    ;;
4632                  esac
4633              else              else
4634                $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'                $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4635                $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'                $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4636                $run eval 'mv "$nlist"T "$nlist"'                $run eval 'mv "$nlist"T "$nlist"'
4637                  case $host in
4638                  *cygwin* | *mingw* )
4639                    $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4640                    $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4641                    ;;
4642                  esac
4643              fi              fi
4644            fi            fi
4645    
# Line 4252  extern \"C\" { Line 4690  extern \"C\" {
4690  #endif  #endif
4691    
4692  /* The mapping between symbol names and symbols. */  /* The mapping between symbol names and symbols. */
4693    "
4694    
4695                case $host in
4696                *cygwin* | *mingw* )
4697              $echo >> "$output_objdir/$dlsyms" "\
4698    /* DATA imports from DLLs on WIN32 can't be const, because
4699       runtime relocations are performed -- see ld's documentation
4700       on pseudo-relocs */
4701    struct {
4702    "
4703                  ;;
4704                * )
4705              $echo >> "$output_objdir/$dlsyms" "\
4706  const struct {  const struct {
4707    "
4708                  ;;
4709                esac
4710    
4711    
4712              $echo >> "$output_objdir/$dlsyms" "\
4713    const char *name;    const char *name;
4714    lt_ptr address;    lt_ptr address;
4715  }  }
# Line 4299  static const void *lt_preloaded_setup() Line 4756  static const void *lt_preloaded_setup()
4756            esac            esac
4757    
4758            # Now compile the dynamic symbol file.            # Now compile the dynamic symbol file.
4759            $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"            $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4760            $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?            $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4761    
4762            # Clean up the generated files.            # Clean up the generated files.
4763            $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"            $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4764            $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"            $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4765    
4766            # Transform the symbol file into the correct name.            # Transform the symbol file into the correct name.
4767            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`            case $host in
4768            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`            *cygwin* | *mingw* )
4769                if test -f "$output_objdir/${outputname}.def" ; then
4770                  compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4771                  finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4772                else
4773                  compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4774                  finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4775                 fi
4776                ;;
4777              * )
4778                compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4779                finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4780                ;;
4781              esac
4782            ;;            ;;
4783          *)          *)
4784            $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2            $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4785            exit 1            exit $EXIT_FAILURE
4786            ;;            ;;
4787          esac          esac
4788        else        else
# Line 4321  static const void *lt_preloaded_setup() Line 4791  static const void *lt_preloaded_setup()
4791          # really was required.          # really was required.
4792    
4793          # Nullify the symbol file.          # Nullify the symbol file.
4794          compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`          compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4795          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`          finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4796        fi        fi
4797    
4798        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4799          # Replace the output file specification.          # Replace the output file specification.
4800          compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`          compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4801          link_command="$compile_command$compile_rpath"          link_command="$compile_command$compile_rpath"
4802    
4803          # We have no uninstalled library dependencies, so finalize right now.          # We have no uninstalled library dependencies, so finalize right now.
4804          $show "$link_command"          $show "$link_command"
4805          $run eval "$link_command"          $run eval "$link_command"
4806          status=$?          exit_status=$?
4807    
4808          # Delete the generated files.          # Delete the generated files.
4809          if test -n "$dlsyms"; then          if test -n "$dlsyms"; then
# Line 4341  static const void *lt_preloaded_setup() Line 4811  static const void *lt_preloaded_setup()
4811            $run $rm "$output_objdir/${outputname}S.${objext}"            $run $rm "$output_objdir/${outputname}S.${objext}"
4812          fi          fi
4813    
4814          exit $status          exit $exit_status
4815        fi        fi
4816    
4817        if test -n "$shlibpath_var"; then        if test -n "$shlibpath_var"; then
# Line 4400  static const void *lt_preloaded_setup() Line 4870  static const void *lt_preloaded_setup()
4870          # Link the executable and exit          # Link the executable and exit
4871          $show "$link_command"          $show "$link_command"
4872          $run eval "$link_command" || exit $?          $run eval "$link_command" || exit $?
4873          exit 0          exit $EXIT_SUCCESS
4874        fi        fi
4875    
4876        if test "$hardcode_action" = relink; then        if test "$hardcode_action" = relink; then
# Line 4414  static const void *lt_preloaded_setup() Line 4884  static const void *lt_preloaded_setup()
4884          if test "$fast_install" != no; then          if test "$fast_install" != no; then
4885            link_command="$finalize_var$compile_command$finalize_rpath"            link_command="$finalize_var$compile_command$finalize_rpath"
4886            if test "$fast_install" = yes; then            if test "$fast_install" = yes; then
4887              relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`              relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4888            else            else
4889              # fast_install is set to needless              # fast_install is set to needless
4890              relink_command=              relink_command=
# Line 4451  static const void *lt_preloaded_setup() Line 4921  static const void *lt_preloaded_setup()
4921            fi            fi
4922          done          done
4923          relink_command="(cd `pwd`; $relink_command)"          relink_command="(cd `pwd`; $relink_command)"
4924          relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`          relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4925        fi        fi
4926    
4927        # Quote $echo for shipping.        # Quote $echo for shipping.
4928        if test "X$echo" = "X$SHELL $0 --fallback-echo"; then        if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4929          case $0 in          case $progpath in
4930          [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;          [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4931          *) qecho="$SHELL `pwd`/$0 --fallback-echo";;          *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4932          esac          esac
4933          qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`          qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4934        else        else
# Line 4481  static const void *lt_preloaded_setup() Line 4951  static const void *lt_preloaded_setup()
4951          esac          esac
4952          case $host in          case $host in
4953            *cygwin* | *mingw* )            *cygwin* | *mingw* )
4954              cwrappersource=`$echo ${objdir}/lt-${output}.c`              output_name=`basename $output`
4955              cwrapper=`$echo ${output}.exe`              output_path=`dirname $output`
4956              $rm $cwrappersource $cwrapper              cwrappersource="$output_path/$objdir/lt-$output_name.c"
4957              trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15              cwrapper="$output_path/$output_name.exe"
4958                $rm $cwrappersource $cwrapper
4959                trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4960    
4961              cat > $cwrappersource <<EOF              cat > $cwrappersource <<EOF
4962    
# Line 4493  static const void *lt_preloaded_setup() Line 4965  static const void *lt_preloaded_setup()
4965    
4966     The $output program cannot be directly executed until all the libtool     The $output program cannot be directly executed until all the libtool
4967     libraries that it depends on are installed.     libraries that it depends on are installed.
4968      
4969     This wrapper executable should never be moved out of the build directory.     This wrapper executable should never be moved out of the build directory.
4970     If it is, it will not operate correctly.     If it is, it will not operate correctly.
4971    
# Line 4509  EOF Line 4981  EOF
4981  #include <malloc.h>  #include <malloc.h>
4982  #include <stdarg.h>  #include <stdarg.h>
4983  #include <assert.h>  #include <assert.h>
4984    #include <string.h>
4985    #include <ctype.h>
4986    #include <sys/stat.h>
4987    
4988  #if defined(PATH_MAX)  #if defined(PATH_MAX)
4989  # define LT_PATHMAX PATH_MAX  # define LT_PATHMAX PATH_MAX
# Line 4519  EOF Line 4994  EOF
4994  #endif  #endif
4995    
4996  #ifndef DIR_SEPARATOR  #ifndef DIR_SEPARATOR
4997  #define DIR_SEPARATOR '/'  # define DIR_SEPARATOR '/'
4998    # define PATH_SEPARATOR ':'
4999  #endif  #endif
5000    
5001  #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \  #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5002    defined (__OS2__)    defined (__OS2__)
5003  #define HAVE_DOS_BASED_FILE_SYSTEM  # define HAVE_DOS_BASED_FILE_SYSTEM
5004  #ifndef DIR_SEPARATOR_2  # ifndef DIR_SEPARATOR_2
5005  #define DIR_SEPARATOR_2 '\\'  #  define DIR_SEPARATOR_2 '\\'
5006  #endif  # endif
5007    # ifndef PATH_SEPARATOR_2
5008    #  define PATH_SEPARATOR_2 ';'
5009    # endif
5010  #endif  #endif
5011    
5012  #ifndef DIR_SEPARATOR_2  #ifndef DIR_SEPARATOR_2
# Line 4537  EOF Line 5016  EOF
5016          (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))          (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5017  #endif /* DIR_SEPARATOR_2 */  #endif /* DIR_SEPARATOR_2 */
5018    
5019    #ifndef PATH_SEPARATOR_2
5020    # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5021    #else /* PATH_SEPARATOR_2 */
5022    # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5023    #endif /* PATH_SEPARATOR_2 */
5024    
5025  #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))  #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
5026  #define XFREE(stale) do { \  #define XFREE(stale) do { \
5027    if (stale) { free ((void *) stale); stale = 0; } \    if (stale) { free ((void *) stale); stale = 0; } \
5028  } while (0)  } while (0)
5029    
5030    /* -DDEBUG is fairly common in CFLAGS.  */
5031    #undef DEBUG
5032    #if defined DEBUGWRAPPER
5033    # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5034    #else
5035    # define DEBUG(format, ...)
5036    #endif
5037    
5038  const char *program_name = NULL;  const char *program_name = NULL;
5039    
5040  void * xmalloc (size_t num);  void * xmalloc (size_t num);
5041  char * xstrdup (const char *string);  char * xstrdup (const char *string);
5042  char * basename (const char *name);  const char * base_name (const char *name);
5043  char * fnqualify(const char *path);  char * find_executable(const char *wrapper);
5044    int    check_executable(const char *path);
5045  char * strendzap(char *str, const char *pat);  char * strendzap(char *str, const char *pat);
5046  void lt_fatal (const char *message, ...);  void lt_fatal (const char *message, ...);
5047    
# Line 4556  main (int argc, char *argv[]) Line 5050  main (int argc, char *argv[])
5050  {  {
5051    char **newargz;    char **newargz;
5052    int i;    int i;
5053      
5054    program_name = (char *) xstrdup ((char *) basename (argv[0]));    program_name = (char *) xstrdup (base_name (argv[0]));
5055      DEBUG("(main) argv[0]      : %s\n",argv[0]);
5056      DEBUG("(main) program_name : %s\n",program_name);
5057    newargz = XMALLOC(char *, argc+2);    newargz = XMALLOC(char *, argc+2);
5058  EOF  EOF
5059    
5060              cat >> $cwrappersource <<EOF              cat >> $cwrappersource <<EOF
5061    newargz[0] = "$SHELL";    newargz[0] = (char *) xstrdup("$SHELL");
5062  EOF  EOF
5063    
5064              cat >> $cwrappersource <<"EOF"              cat >> $cwrappersource <<"EOF"
5065    newargz[1] = fnqualify(argv[0]);    newargz[1] = find_executable(argv[0]);
5066      if (newargz[1] == NULL)
5067        lt_fatal("Couldn't find %s", argv[0]);
5068      DEBUG("(main) found exe at : %s\n",newargz[1]);
5069    /* we know the script has the same name, without the .exe */    /* we know the script has the same name, without the .exe */
5070    /* so make sure newargz[1] doesn't end in .exe */    /* so make sure newargz[1] doesn't end in .exe */
5071    strendzap(newargz[1],".exe");    strendzap(newargz[1],".exe");
5072    for (i = 1; i < argc; i++)    for (i = 1; i < argc; i++)
5073      newargz[i+1] = xstrdup(argv[i]);      newargz[i+1] = xstrdup(argv[i]);
5074    newargz[argc+1] = NULL;    newargz[argc+1] = NULL;
5075    
5076      for (i=0; i<argc+1; i++)
5077      {
5078        DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
5079        ;
5080      }
5081    
5082  EOF  EOF
5083    
5084              cat >> $cwrappersource <<EOF              case $host_os in
5085                  mingw*)
5086                    cat >> $cwrappersource <<EOF
5087      execv("$SHELL",(char const **)newargz);
5088    EOF
5089                  ;;
5090                  *)
5091                    cat >> $cwrappersource <<EOF
5092    execv("$SHELL",newargz);    execv("$SHELL",newargz);
5093  EOF  EOF
5094                  ;;
5095                esac
5096    
5097              cat >> $cwrappersource <<"EOF"              cat >> $cwrappersource <<"EOF"
5098      return 127;
5099  }  }
5100    
5101  void *  void *
# Line 4592  xmalloc (size_t num) Line 5108  xmalloc (size_t num)
5108    return p;    return p;
5109  }  }
5110    
5111  char *  char *
5112  xstrdup (const char *string)  xstrdup (const char *string)
5113  {  {
5114    return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL    return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5115  ;  ;
5116  }  }
5117    
5118  char *  const char *
5119  basename (const char *name)  base_name (const char *name)
5120  {  {
5121    const char *base;    const char *base;
5122    
5123  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5124    /* Skip over the disk name in MSDOS pathnames. */    /* Skip over the disk name in MSDOS pathnames. */
5125    if (isalpha (name[0]) && name[1] == ':')    if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5126      name += 2;      name += 2;
5127  #endif  #endif
5128    
5129    for (base = name; *name; name++)    for (base = name; *name; name++)
5130      if (IS_DIR_SEPARATOR (*name))      if (IS_DIR_SEPARATOR (*name))
5131        base = name + 1;        base = name + 1;
5132    return (char *) base;    return base;
5133    }
5134    
5135    int
5136    check_executable(const char * path)
5137    {
5138      struct stat st;
5139    
5140      DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5141      if ((!path) || (!*path))
5142        return 0;
5143    
5144      if ((stat (path, &st) >= 0) &&
5145          (
5146            /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5147    #if defined (S_IXOTH)
5148           ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5149    #endif
5150    #if defined (S_IXGRP)
5151           ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5152    #endif
5153           ((st.st_mode & S_IXUSR) == S_IXUSR))
5154          )
5155        return 1;
5156      else
5157        return 0;
5158  }  }
5159    
5160  char *  /* Searches for the full path of the wrapper.  Returns
5161  fnqualify(const char *path)     newly allocated full path name if found, NULL otherwise */
5162    char *
5163    find_executable (const char* wrapper)
5164  {  {
5165    size_t size;    int has_slash = 0;
5166    char *p;    const char* p;
5167      const char* p_next;
5168      /* static buffer for getcwd */
5169    char tmp[LT_PATHMAX + 1];    char tmp[LT_PATHMAX + 1];
5170      int tmp_len;
5171      char* concat_name;
5172    
5173    assert(path != NULL);    DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5174    
5175    /* Is it qualified already? */    if ((wrapper == NULL) || (*wrapper == '\0'))
5176        return NULL;
5177    
5178      /* Absolute path? */
5179  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)  #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5180    if (isalpha (path[0]) && path[1] == ':')    if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5181      return xstrdup (path);    {
5182        concat_name = xstrdup (wrapper);
5183        if (check_executable(concat_name))
5184          return concat_name;
5185        XFREE(concat_name);
5186      }
5187      else
5188      {
5189    #endif
5190        if (IS_DIR_SEPARATOR (wrapper[0]))
5191        {
5192          concat_name = xstrdup (wrapper);
5193          if (check_executable(concat_name))
5194            return concat_name;
5195          XFREE(concat_name);
5196        }
5197    #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5198      }
5199  #endif  #endif
   if (IS_DIR_SEPARATOR (path[0]))  
     return xstrdup (path);  
5200    
5201    /* prepend the current directory */    for (p = wrapper; *p; p++)
5202    /* doesn't handle '~' */      if (*p == '/')
5203        {
5204          has_slash = 1;
5205          break;
5206        }
5207      if (!has_slash)
5208      {
5209        /* no slashes; search PATH */
5210        const char* path = getenv ("PATH");
5211        if (path != NULL)
5212        {
5213          for (p = path; *p; p = p_next)
5214          {
5215            const char* q;
5216            size_t p_len;
5217            for (q = p; *q; q++)
5218              if (IS_PATH_SEPARATOR(*q))
5219                break;
5220            p_len = q - p;
5221            p_next = (*q == '\0' ? q : q + 1);
5222            if (p_len == 0)
5223            {
5224              /* empty path: current directory */
5225              if (getcwd (tmp, LT_PATHMAX) == NULL)
5226                lt_fatal ("getcwd failed");
5227              tmp_len = strlen(tmp);
5228              concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5229              memcpy (concat_name, tmp, tmp_len);
5230              concat_name[tmp_len] = '/';
5231              strcpy (concat_name + tmp_len + 1, wrapper);
5232            }
5233            else
5234            {
5235              concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5236              memcpy (concat_name, p, p_len);
5237              concat_name[p_len] = '/';
5238              strcpy (concat_name + p_len + 1, wrapper);
5239            }
5240            if (check_executable(concat_name))
5241              return concat_name;
5242            XFREE(concat_name);
5243          }
5244        }
5245        /* not found in PATH; assume curdir */
5246      }
5247      /* Relative path | not found in path: prepend cwd */
5248    if (getcwd (tmp, LT_PATHMAX) == NULL)    if (getcwd (tmp, LT_PATHMAX) == NULL)
5249      lt_fatal ("getcwd failed");      lt_fatal ("getcwd failed");
5250    size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */    tmp_len = strlen(tmp);
5251    p = XMALLOC(char, size);    concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5252    sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);    memcpy (concat_name, tmp, tmp_len);
5253    return p;    concat_name[tmp_len] = '/';
5254      strcpy (concat_name + tmp_len + 1, wrapper);
5255    
5256      if (check_executable(concat_name))
5257        return concat_name;
5258      XFREE(concat_name);
5259      return NULL;
5260  }  }
5261    
5262  char *  char *
5263  strendzap(char *str, const char *pat)  strendzap(char *str, const char *pat)
5264  {  {
5265    size_t len, patlen;    size_t len, patlen;
5266    
# Line 4664  strendzap(char *str, const char *pat) Line 5280  strendzap(char *str, const char *pat)
5280  }  }
5281    
5282  static void  static void
5283  lt_error_core (int exit_status, const char * mode,  lt_error_core (int exit_status, const char * mode,
5284            const char * message, va_list ap)            const char * message, va_list ap)
5285  {  {
5286    fprintf (stderr, "%s: %s: ", program_name, mode);    fprintf (stderr, "%s: %s: ", program_name, mode);
# Line 4684  lt_fatal (const char *message, ...) Line 5300  lt_fatal (const char *message, ...)
5300    va_end (ap);    va_end (ap);
5301  }  }
5302  EOF  EOF
5303            # we should really use a build-platform specific compiler            # we should really use a build-platform specific compiler
5304            # here, but OTOH, the wrappers (shell script and this C one)            # here, but OTOH, the wrappers (shell script and this C one)
5305            # are only useful if you want to execute the "real" binary.            # are only useful if you want to execute the "real" binary.
5306            # Since the "real" binary is built for $host, then this            # Since the "real" binary is built for $host, then this
5307            # wrapper might as well be built for $host, too.            # wrapper might as well be built for $host, too.
5308            $run $LTCC -s -o $cwrapper $cwrappersource            $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5309            ;;            ;;
5310          esac          esac
5311          $rm $output          $rm $output
5312          trap "$rm $output; exit 1" 1 2 15          trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5313    
5314          $echo > $output "\          $echo > $output "\
5315  #! $SHELL  #! $SHELL
# Line 4712  EOF Line 5328  EOF
5328  Xsed='${SED} -e 1s/^X//'  Xsed='${SED} -e 1s/^X//'
5329  sed_quote_subst='$sed_quote_subst'  sed_quote_subst='$sed_quote_subst'
5330    
5331    # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5332    if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5333      emulate sh
5334      NULLCMD=:
5335      # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5336      # is contrary to our usage.  Disable this feature.
5337      alias -g '\${1+\"\$@\"}'='\"\$@\"'
5338      setopt NO_GLOB_SUBST
5339    else
5340      case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5341    fi
5342    BIN_SH=xpg4; export BIN_SH # for Tru64
5343    DUALCASE=1; export DUALCASE # for MKS sh
5344    
5345  # The HP-UX ksh and POSIX shell print the target directory to stdout  # The HP-UX ksh and POSIX shell print the target directory to stdout
5346  # if CDPATH is set.  # if CDPATH is set.
5347  if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi  (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5348    
5349  relink_command=\"$relink_command\"  relink_command=\"$relink_command\"
5350    
# Line 4793  else Line 5423  else
5423        else        else
5424          $echo \"\$relink_command_output\" >&2          $echo \"\$relink_command_output\" >&2
5425          $rm \"\$progdir/\$file\"          $rm \"\$progdir/\$file\"
5426          exit 1          exit $EXIT_FAILURE
5427        fi        fi
5428      fi      fi
5429    
# Line 4843  else Line 5473  else
5473          # Backslashes separate directories on plain windows          # Backslashes separate directories on plain windows
5474          *-*-mingw | *-*-os2*)          *-*-mingw | *-*-os2*)
5475            $echo >> $output "\            $echo >> $output "\
5476        exec \$progdir\\\\\$program \${1+\"\$@\"}        exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5477  "  "
5478            ;;            ;;
5479    
5480          *)          *)
5481            $echo >> $output "\            $echo >> $output "\
5482        exec \$progdir/\$program \${1+\"\$@\"}        exec \"\$progdir/\$program\" \${1+\"\$@\"}
5483  "  "
5484            ;;            ;;
5485          esac          esac
5486          $echo >> $output "\          $echo >> $output "\
5487        \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"        \$echo \"\$0: cannot exec \$program \$*\"
5488        exit 1        exit $EXIT_FAILURE
5489      fi      fi
5490    else    else
5491      # The program doesn't exist.      # The program doesn't exist.
5492      \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2      \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5493      \$echo \"This script is just a wrapper for \$program.\" 1>&2      \$echo \"This script is just a wrapper for \$program.\" 1>&2
5494      $echo \"See the $PACKAGE documentation for more information.\" 1>&2      $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5495      exit 1      exit $EXIT_FAILURE
5496    fi    fi
5497  fi\  fi\
5498  "  "
5499          chmod +x $output          chmod +x $output
5500        fi        fi
5501        exit 0        exit $EXIT_SUCCESS
5502        ;;        ;;
5503      esac      esac
5504    
# Line 4891  fi\ Line 5521  fi\
5521    
5522        if test -n "$addlibs"; then        if test -n "$addlibs"; then
5523          gentop="$output_objdir/${outputname}x"          gentop="$output_objdir/${outputname}x"
         $show "${rm}r $gentop"  
         $run ${rm}r "$gentop"  
         $show "$mkdir $gentop"  
         $run $mkdir "$gentop"  
         status=$?  
         if test "$status" -ne 0 && test ! -d "$gentop"; then  
           exit $status  
         fi  
5524          generated="$generated $gentop"          generated="$generated $gentop"
5525    
5526          # Add in members from convenience archives.          func_extract_archives $gentop $addlibs
5527          for xlib in $addlibs; do          oldobjs="$oldobjs $func_extract_archives_result"
           # Extract the objects.  
           case $xlib in  
           [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;  
           *) xabs=`pwd`"/$xlib" ;;  
           esac  
           xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`  
           xdir="$gentop/$xlib"  
   
           $show "${rm}r $xdir"  
           $run ${rm}r "$xdir"  
           $show "$mkdir $xdir"  
           $run $mkdir "$xdir"  
           status=$?  
           if test "$status" -ne 0 && test ! -d "$xdir"; then  
             exit $status  
           fi  
           # We will extract separately just the conflicting names and we will no  
           # longer touch any unique names. It is faster to leave these extract  
           # automatically by $AR in one run.  
           $show "(cd $xdir && $AR x $xabs)"  
           $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?  
           if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then  
             :  
           else  
             $echo "$modename: warning: object name conflicts; renaming object files" 1>&2  
             $echo "$modename: warning: to ensure that they will not overwrite" 1>&2  
             $AR t "$xabs" | sort | uniq -cd | while read -r count name  
             do  
               i=1  
               while test "$i" -le "$count"  
               do  
                # Put our $i before any first dot (extension)  
                # Never overwrite any file  
                name_to="$name"  
                while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"  
                do  
                  name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`  
                done  
                $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"  
                $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?  
                i=`expr $i + 1`  
               done  
             done  
           fi  
   
           oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`  
         done  
5528        fi        fi
5529    
5530        # Do each command in the archive commands.        # Do each command in the archive commands.
5531        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then        if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5532          eval cmds=\"$old_archive_from_new_cmds\"         cmds=$old_archive_from_new_cmds
5533        else        else
5534            # POSIX demands no paths to be encoded in archives.  We have
5535            # to avoid creating archives with duplicate basenames if we
5536            # might have to extract them afterwards, e.g., when creating a
5537            # static archive out of a convenience library, or when linking
5538            # the entirety of a libtool archive into another (currently
5539            # not supported by libtool).
5540            if (for obj in $oldobjs
5541                do
5542                  $echo "X$obj" | $Xsed -e 's%^.*/%%'
5543                done | sort | sort -uc >/dev/null 2>&1); then
5544              :
5545            else
5546              $echo "copying selected object files to avoid basename conflicts..."
5547    
5548              if test -z "$gentop"; then
5549                gentop="$output_objdir/${outputname}x"
5550                generated="$generated $gentop"
5551    
5552                $show "${rm}r $gentop"
5553                $run ${rm}r "$gentop"
5554                $show "$mkdir $gentop"
5555                $run $mkdir "$gentop"
5556                exit_status=$?
5557                if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5558                  exit $exit_status
5559                fi
5560              fi
5561    
5562              save_oldobjs=$oldobjs
5563              oldobjs=
5564              counter=1
5565              for obj in $save_oldobjs
5566              do
5567                objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5568                case " $oldobjs " in
5569                " ") oldobjs=$obj ;;
5570                *[\ /]"$objbase "*)
5571                  while :; do
5572                    # Make sure we don't pick an alternate name that also
5573                    # overlaps.
5574                    newobj=lt$counter-$objbase
5575                    counter=`expr $counter + 1`
5576                    case " $oldobjs " in
5577                    *[\ /]"$newobj "*) ;;
5578                    *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5579                    esac
5580                  done
5581                  $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5582                  $run ln "$obj" "$gentop/$newobj" ||
5583                  $run cp "$obj" "$gentop/$newobj"
5584                  oldobjs="$oldobjs $gentop/$newobj"
5585                  ;;
5586                *) oldobjs="$oldobjs $obj" ;;
5587                esac
5588              done
5589            fi
5590    
5591          eval cmds=\"$old_archive_cmds\"          eval cmds=\"$old_archive_cmds\"
5592    
5593          if len=`expr "X$cmds" : ".*"` &&          if len=`expr "X$cmds" : ".*"` &&
5594               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5595            :            cmds=$old_archive_cmds
5596          else          else
5597            # the command line is too long to link in one step, link in parts            # the command line is too long to link in one step, link in parts
5598            $echo "using piecewise archive linking..."            $echo "using piecewise archive linking..."
# Line 4969  fi\ Line 5601  fi\
5601            objlist=            objlist=
5602            concat_cmds=            concat_cmds=
5603            save_oldobjs=$oldobjs            save_oldobjs=$oldobjs
5604            # GNU ar 2.10+ was changed to match POSIX; thus no paths are  
           # encoded into archives.  This makes 'ar r' malfunction in  
           # this piecewise linking case whenever conflicting object  
           # names appear in distinct ar calls; check, warn and compensate.  
             if (for obj in $save_oldobjs  
             do  
               $echo "X$obj" | $Xsed -e 's%^.*/%%'  
             done | sort | sort -uc >/dev/null 2>&1); then  
             :  
           else  
             $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2  
             $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2  
             AR_FLAGS=cq  
           fi  
5605            # Is there a better way of finding the last object in the list?            # Is there a better way of finding the last object in the list?
5606            for obj in $save_oldobjs            for obj in $save_oldobjs
5607            do            do
5608              last_oldobj=$obj              last_oldobj=$obj
5609            done              done
5610            for obj in $save_oldobjs            for obj in $save_oldobjs
5611            do            do
5612              oldobjs="$objlist $obj"              oldobjs="$objlist $obj"
5613              objlist="$objlist $obj"              objlist="$objlist $obj"
5614              eval test_cmds=\"$old_archive_cmds\"              eval test_cmds=\"$old_archive_cmds\"
5615              if len=`expr "X$test_cmds" : ".*"` &&              if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5616                 test "$len" -le "$max_cmd_len"; then                 test "$len" -le "$max_cmd_len"; then
5617                :                :
5618              else              else
# Line 5001  fi\ Line 5620  fi\
5620                oldobjs=$objlist                oldobjs=$objlist
5621                if test "$obj" = "$last_oldobj" ; then                if test "$obj" = "$last_oldobj" ; then
5622                  RANLIB=$save_RANLIB                  RANLIB=$save_RANLIB
5623                fi                  fi
5624                test -z "$concat_cmds" || concat_cmds=$concat_cmds~                test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5625                eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"                eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5626                objlist=                objlist=
# Line 5012  fi\ Line 5631  fi\
5631            if test "X$oldobjs" = "X" ; then            if test "X$oldobjs" = "X" ; then
5632              eval cmds=\"\$concat_cmds\"              eval cmds=\"\$concat_cmds\"
5633            else            else
5634              eval cmds=\"\$concat_cmds~$old_archive_cmds\"              eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5635            fi            fi
5636          fi          fi
5637        fi        fi
5638        save_ifs="$IFS"; IFS='~'        save_ifs="$IFS"; IFS='~'
5639        for cmd in $cmds; do        for cmd in $cmds; do
5640            eval cmd=\"$cmd\"
5641          IFS="$save_ifs"          IFS="$save_ifs"
5642          $show "$cmd"          $show "$cmd"
5643          $run eval "$cmd" || exit $?          $run eval "$cmd" || exit $?
# Line 5049  fi\ Line 5669  fi\
5669          fi          fi
5670        done        done
5671        # Quote the link command for shipping.        # Quote the link command for shipping.
5672        relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"        relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5673        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`        relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5674          if test "$hardcode_automatic" = yes ; then
5675            relink_command=
5676          fi
5677    
5678    
5679        # Only create the output if not a dry run.        # Only create the output if not a dry run.
5680        if test -z "$run"; then        if test -z "$run"; then
# Line 5069  fi\ Line 5693  fi\
5693                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5694                  if test -z "$libdir"; then                  if test -z "$libdir"; then
5695                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5696                    exit 1                    exit $EXIT_FAILURE
5697                  fi                  fi
5698                  newdependency_libs="$newdependency_libs $libdir/$name"                  newdependency_libs="$newdependency_libs $libdir/$name"
5699                  ;;                  ;;
# Line 5083  fi\ Line 5707  fi\
5707                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5708                if test -z "$libdir"; then                if test -z "$libdir"; then
5709                  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2                  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5710                  exit 1                  exit $EXIT_FAILURE
5711                fi                fi
5712                newdlfiles="$newdlfiles $libdir/$name"                newdlfiles="$newdlfiles $libdir/$name"
5713              done              done
# Line 5094  fi\ Line 5718  fi\
5718                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5719                if test -z "$libdir"; then                if test -z "$libdir"; then
5720                  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2                  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5721                  exit 1                  exit $EXIT_FAILURE
5722                fi                fi
5723                newdlprefiles="$newdlprefiles $libdir/$name"                newdlprefiles="$newdlprefiles $libdir/$name"
5724              done              done
5725              dlprefiles="$newdlprefiles"              dlprefiles="$newdlprefiles"
5726              else
5727                newdlfiles=
5728                for lib in $dlfiles; do
5729                  case $lib in
5730                    [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5731                    *) abs=`pwd`"/$lib" ;;
5732                  esac
5733                  newdlfiles="$newdlfiles $abs"
5734                done
5735                dlfiles="$newdlfiles"
5736                newdlprefiles=
5737                for lib in $dlprefiles; do
5738                  case $lib in
5739                    [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5740                    *) abs=`pwd`"/$lib" ;;
5741                  esac
5742                  newdlprefiles="$newdlprefiles $abs"
5743                done
5744                dlprefiles="$newdlprefiles"
5745            fi            fi
5746            $rm $output            $rm $output
5747            # place dlname in correct position for cygwin            # place dlname in correct position for cygwin
# Line 5155  relink_command=\"$relink_command\"" Line 5798  relink_command=\"$relink_command\""
5798        $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?        $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5799        ;;        ;;
5800      esac      esac
5801      exit 0      exit $EXIT_SUCCESS
5802      ;;      ;;
5803    
5804    # libtool install mode    # libtool install mode
# Line 5166  relink_command=\"$relink_command\"" Line 5809  relink_command=\"$relink_command\""
5809      # install_prog (especially on Windows NT).      # install_prog (especially on Windows NT).
5810      if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||      if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5811         # Allow the use of GNU shtool's install command.         # Allow the use of GNU shtool's install command.
5812         $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then         $echo "X$nonopt" | grep shtool > /dev/null; then
5813        # Aesthetically quote it.        # Aesthetically quote it.
5814        arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`        arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5815        case $arg in        case $arg in
5816        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5817          arg="\"$arg\""          arg="\"$arg\""
5818          ;;          ;;
5819        esac        esac
# Line 5179  relink_command=\"$relink_command\"" Line 5822  relink_command=\"$relink_command\""
5822        shift        shift
5823      else      else
5824        install_prog=        install_prog=
5825        arg="$nonopt"        arg=$nonopt
5826      fi      fi
5827    
5828      # The real first argument should be the name of the installation program.      # The real first argument should be the name of the installation program.
5829      # Aesthetically quote it.      # Aesthetically quote it.
5830      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5831      case $arg in      case $arg in
5832      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
5833        arg="\"$arg\""        arg="\"$arg\""
5834        ;;        ;;
5835      esac      esac
# Line 5204  relink_command=\"$relink_command\"" Line 5847  relink_command=\"$relink_command\""
5847      do      do
5848        if test -n "$dest"; then        if test -n "$dest"; then
5849          files="$files $dest"          files="$files $dest"
5850          dest="$arg"          dest=$arg
5851          continue          continue
5852        fi        fi
5853    
5854        case $arg in        case $arg in
5855        -d) isdir=yes ;;        -d) isdir=yes ;;
5856        -f) prev="-f" ;;        -f)
5857        -g) prev="-g" ;;          case " $install_prog " in
5858        -m) prev="-m" ;;          *[\\\ /]cp\ *) ;;
5859        -o) prev="-o" ;;          *) prev=$arg ;;
5860            esac
5861            ;;
5862          -g | -m | -o) prev=$arg ;;
5863        -s)        -s)
5864          stripme=" -s"          stripme=" -s"
5865          continue          continue
5866          ;;          ;;
5867        -*) ;;        -*)
5868            ;;
5869        *)        *)
5870          # If the previous option needed an argument, then skip it.          # If the previous option needed an argument, then skip it.
5871          if test -n "$prev"; then          if test -n "$prev"; then
5872            prev=            prev=
5873          else          else
5874            dest="$arg"            dest=$arg
5875            continue            continue
5876          fi          fi
5877          ;;          ;;
# Line 5234  relink_command=\"$relink_command\"" Line 5880  relink_command=\"$relink_command\""
5880        # Aesthetically quote the argument.        # Aesthetically quote the argument.
5881        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5882        case $arg in        case $arg in
5883        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5884          arg="\"$arg\""          arg="\"$arg\""
5885          ;;          ;;
5886        esac        esac
# Line 5244  relink_command=\"$relink_command\"" Line 5890  relink_command=\"$relink_command\""
5890      if test -z "$install_prog"; then      if test -z "$install_prog"; then
5891        $echo "$modename: you must specify an install program" 1>&2        $echo "$modename: you must specify an install program" 1>&2
5892        $echo "$help" 1>&2        $echo "$help" 1>&2
5893        exit 1        exit $EXIT_FAILURE
5894      fi      fi