/[pcre]/code/trunk/ltmain.sh
ViewVC logotype

Diff of /code/trunk/ltmain.sh

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

revision 53 by nigel, Sat Feb 24 21:39:42 2007 UTC revision 96 by nigel, Fri Mar 2 13:10:43 2007 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  # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5  # Free Software Foundation, Inc.  # 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  #  #
# 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    # define SED for historic ltconfig's generated by Libtool 1.3
37    test -z "$SED" && SED=sed
38    
39    # The name of this program:
40    progname=`echo "$progpath" | $SED $basename`
41    modename="$progname"
42    
43    # Global variables:
44    EXIT_SUCCESS=0
45    EXIT_FAILURE=1
46    
47    PROGRAM=ltmain.sh
48    PACKAGE=libtool
49    VERSION=1.5.22
50    TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
51    
52    # See if we are running on zsh, and set the options which allow our
53    # commands through without removal of \ escapes.
54    if test -n "${ZSH_VERSION+set}" ; then
55      setopt NO_GLOB_SUBST
56    fi
57    # Same for EGREP, and just to be sure, do LTCC as well
58    if test "X$EGREP" = X ; then
59        EGREP=egrep
60    fi
61    if test "X$LTCC" = X ; then
62        LTCC=${CC-gcc}
63    fi
64    
65  # Check that we have a working $echo.  # Check that we have a working $echo.
66  if test "X$1" = X--no-reexec; then  if test "X$1" = X--no-reexec; then
67    # 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 74  elif test "X`($echo '\t') 2>/dev/null`"
74    :    :
75  else  else
76    # Restart under the correct shell, and then maybe $echo will work.    # Restart under the correct shell, and then maybe $echo will work.
77    exec $SHELL "$0" --no-reexec ${1+"$@"}    exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78  fi  fi
79    
80  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 83  if test "X$1" = X--fallback-echo; then
83    cat <<EOF    cat <<EOF
84  $*  $*
85  EOF  EOF
86    exit 0    exit $EXIT_SUCCESS
87  fi  fi
88    
 # The name of this program.  
 progname=`$echo "$0" | sed 's%^.*/%%'`  
 modename="$progname"  
   
 # Constants.  
 PROGRAM=ltmain.sh  
 PACKAGE=libtool  
 VERSION=1.4  
 TIMESTAMP=" (1.920 2001/04/24 23:26:18)"  
   
89  default_mode=  default_mode=
90  help="Try \`$progname --help' for more information."  help="Try \`$progname --help' for more information."
91  magic="%%%MAGIC variable%%%"  magic="%%%MAGIC variable%%%"
# Line 67  rm="rm -f" Line 95  rm="rm -f"
95    
96  # Sed substitution that helps us do robust quoting.  It backslashifies  # Sed substitution that helps us do robust quoting.  It backslashifies
97  # metacharacters that are still active within double-quoted strings.  # metacharacters that are still active within double-quoted strings.
98  Xsed='sed -e 1s/^X//'  Xsed="${SED}"' -e 1s/^X//'
99  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
100  SP2NL='tr \040 \012'  # test EBCDIC or ASCII
101  NL2SP='tr \015\012 \040\040'  case `echo X|tr X '\101'` in
102     A) # ASCII based system
103        # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
104      SP2NL='tr \040 \012'
105      NL2SP='tr \015\012 \040\040'
106      ;;
107     *) # EBCDIC based system
108      SP2NL='tr \100 \n'
109      NL2SP='tr \r\n \100\100'
110      ;;
111    esac
112    
113  # NLS nuisances.  # NLS nuisances.
114  # Only set LANG and LC_ALL to C if already set.  # Only set LANG and LC_ALL to C if already set.
# Line 84  if test "${LANG+set}" = set; then Line 122  if test "${LANG+set}" = set; then
122    save_LANG="$LANG"; LANG=C; export LANG    save_LANG="$LANG"; LANG=C; export LANG
123  fi  fi
124    
125    # Make sure IFS has a sensible default
126    lt_nl='
127    '
128    IFS="   $lt_nl"
129    
130  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131    echo "$modename: not configured to build any kind of library" 1>&2    $echo "$modename: not configured to build any kind of library" 1>&2
132    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
133    exit 1    exit $EXIT_FAILURE
134  fi  fi
135    
136  # Global variables.  # Global variables.
# Line 99  run= Line 142  run=
142  show="$echo"  show="$echo"
143  show_help=  show_help=
144  execute_dlfiles=  execute_dlfiles=
145    duplicate_deps=no
146    preserve_args=
147  lo2o="s/\\.lo\$/.${objext}/"  lo2o="s/\\.lo\$/.${objext}/"
148  o2lo="s/\\.${objext}\$/.lo/"  o2lo="s/\\.${objext}\$/.lo/"
149    
150    if test -z "$max_cmd_len"; then
151      i=0
152      testring="ABCD"
153      new_result=
154    
155      # If test is not a shell built-in, we'll probably end up computing a
156      # maximum length that is only half of the actual maximum length, but
157      # we can't tell.
158      while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
159                 = "XX$testring") >/dev/null 2>&1 &&
160              new_result=`expr "X$testring" : ".*" 2>&1` &&
161              max_cmd_len="$new_result" &&
162              test "$i" != 17 # 1/2 MB should be enough
163      do
164        i=`expr $i + 1`
165        testring="$testring$testring"
166      done
167      testring=
168      # Add a significant safety factor because C++ compilers can tack on massive
169      # amounts of additional arguments before passing them to the linker.
170      # It appears as though 1/2 is a usable value.
171      max_cmd_len=`expr $max_cmd_len \/ 2`
172    fi
173    
174    #####################################
175    # Shell function definitions:
176    # This seems to be the best place for them
177    
178    # func_mktempdir [string]
179    # Make a temporary directory that won't clash with other running
180    # libtool processes, and avoids race conditions if possible.  If
181    # given, STRING is the basename for that directory.
182    func_mktempdir ()
183    {
184        my_template="${TMPDIR-/tmp}/${1-$progname}"
185    
186        if test "$run" = ":"; then
187          # Return a directory name, but don't create it in dry-run mode
188          my_tmpdir="${my_template}-$$"
189        else
190    
191          # If mktemp works, use that first and foremost
192          my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
193    
194          if test ! -d "$my_tmpdir"; then
195            # Failing that, at least try and use $RANDOM to avoid a race
196            my_tmpdir="${my_template}-${RANDOM-0}$$"
197    
198            save_mktempdir_umask=`umask`
199            umask 0077
200            $mkdir "$my_tmpdir"
201            umask $save_mktempdir_umask
202          fi
203    
204          # If we're not in dry-run mode, bomb out on failure
205          test -d "$my_tmpdir" || {
206            $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
207            exit $EXIT_FAILURE
208          }
209        fi
210    
211        $echo "X$my_tmpdir" | $Xsed
212    }
213    
214    
215    # func_win32_libid arg
216    # return the library type of file 'arg'
217    #
218    # Need a lot of goo to handle *both* DLLs and import libs
219    # Has to be a shell function in order to 'eat' the argument
220    # that is supplied when $file_magic_command is called.
221    func_win32_libid ()
222    {
223      win32_libid_type="unknown"
224      win32_fileres=`file -L $1 2>/dev/null`
225      case $win32_fileres in
226      *ar\ archive\ import\ library*) # definitely import
227        win32_libid_type="x86 archive import"
228        ;;
229      *ar\ archive*) # could be an import, or static
230        if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
231          $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
232          win32_nmres=`eval $NM -f posix -A $1 | \
233            $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
234          case $win32_nmres in
235          import*)  win32_libid_type="x86 archive import";;
236          *)        win32_libid_type="x86 archive static";;
237          esac
238        fi
239        ;;
240      *DLL*)
241        win32_libid_type="x86 DLL"
242        ;;
243      *executable*) # but shell scripts are "executable" too...
244        case $win32_fileres in
245        *MS\ Windows\ PE\ Intel*)
246          win32_libid_type="x86 DLL"
247          ;;
248        esac
249        ;;
250      esac
251      $echo $win32_libid_type
252    }
253    
254    
255    # func_infer_tag arg
256    # Infer tagged configuration to use if any are available and
257    # if one wasn't chosen via the "--tag" command line option.
258    # Only attempt this if the compiler in the base compile
259    # command doesn't match the default compiler.
260    # arg is usually of the form 'gcc ...'
261    func_infer_tag ()
262    {
263        if test -n "$available_tags" && test -z "$tagname"; then
264          CC_quoted=
265          for arg in $CC; do
266            case $arg in
267              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
268              arg="\"$arg\""
269              ;;
270            esac
271            CC_quoted="$CC_quoted $arg"
272          done
273          case $@ in
274          # Blanks in the command may have been stripped by the calling shell,
275          # but not from the CC environment variable when configure was run.
276          " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
277          # Blanks at the start of $base_compile will cause this to fail
278          # if we don't check for them as well.
279          *)
280            for z in $available_tags; do
281              if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
282                # Evaluate the configuration.
283                eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
284                CC_quoted=
285                for arg in $CC; do
286                # Double-quote args containing other shell metacharacters.
287                case $arg in
288                  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
289                  arg="\"$arg\""
290                  ;;
291                esac
292                CC_quoted="$CC_quoted $arg"
293              done
294                # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
295                trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
296                # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
297                extendcc=${host}-${CC}
298                # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc
299                # (Gentoo-specific hack because we always export $CHOST)
300                mungedcc=${CHOST-${host}}-${trimedcc}
301                case "$@ " in
302                  "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
303                  "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
304                  tagname=CC
305                  break ;;
306                  "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
307                  "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
308                  "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
309                  " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
310                  # The compiler in the base compile command matches
311                  # the one in the tagged configuration.
312                  # Assume this is the tagged configuration we want.
313                  tagname=$z
314                  break
315                  ;;
316                esac
317              fi
318            done
319            # If $tagname still isn't set, then no tagged configuration
320            # was found and let the user know that the "--tag" command
321            # line option must be used.
322            if test -z "$tagname"; then
323              $echo "$modename: unable to infer tagged configuration"
324              $echo "$modename: specify a tag with \`--tag'" 1>&2
325              exit $EXIT_FAILURE
326    #        else
327    #          $echo "$modename: using $tagname tagged configuration"
328            fi
329            ;;
330          esac
331        fi
332    }
333    
334    
335    # func_extract_an_archive dir oldlib
336    func_extract_an_archive ()
337    {
338        f_ex_an_ar_dir="$1"; shift
339        f_ex_an_ar_oldlib="$1"
340    
341        $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
342        $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
343        if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
344         :
345        else
346          $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
347          exit $EXIT_FAILURE
348        fi
349    }
350    
351    # func_extract_archives gentop oldlib ...
352    func_extract_archives ()
353    {
354        my_gentop="$1"; shift
355        my_oldlibs=${1+"$@"}
356        my_oldobjs=""
357        my_xlib=""
358        my_xabs=""
359        my_xdir=""
360        my_status=""
361    
362        $show "${rm}r $my_gentop"
363        $run ${rm}r "$my_gentop"
364        $show "$mkdir $my_gentop"
365        $run $mkdir "$my_gentop"
366        my_status=$?
367        if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
368          exit $my_status
369        fi
370    
371        for my_xlib in $my_oldlibs; do
372          # Extract the objects.
373          case $my_xlib in
374            [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
375            *) my_xabs=`pwd`"/$my_xlib" ;;
376          esac
377          my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
378          my_xdir="$my_gentop/$my_xlib"
379    
380          $show "${rm}r $my_xdir"
381          $run ${rm}r "$my_xdir"
382          $show "$mkdir $my_xdir"
383          $run $mkdir "$my_xdir"
384          exit_status=$?
385          if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
386            exit $exit_status
387          fi
388          case $host in
389          *-darwin*)
390            $show "Extracting $my_xabs"
391            # Do not bother doing anything if just a dry run
392            if test -z "$run"; then
393              darwin_orig_dir=`pwd`
394              cd $my_xdir || exit $?
395              darwin_archive=$my_xabs
396              darwin_curdir=`pwd`
397              darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
398              darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
399              if test -n "$darwin_arches"; then
400                darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
401                darwin_arch=
402                $show "$darwin_base_archive has multiple architectures $darwin_arches"
403                for darwin_arch in  $darwin_arches ; do
404                  mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
405                  lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
406                  cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
407                  func_extract_an_archive "`pwd`" "${darwin_base_archive}"
408                  cd "$darwin_curdir"
409                  $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
410                done # $darwin_arches
411          ## Okay now we have a bunch of thin objects, gotta fatten them up :)
412                darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
413                darwin_file=
414                darwin_files=
415                for darwin_file in $darwin_filelist; do
416                  darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
417                  lipo -create -output "$darwin_file" $darwin_files
418                done # $darwin_filelist
419                ${rm}r unfat-$$
420                cd "$darwin_orig_dir"
421              else
422                cd "$darwin_orig_dir"
423                func_extract_an_archive "$my_xdir" "$my_xabs"
424              fi # $darwin_arches
425            fi # $run
426            ;;
427          *)
428            func_extract_an_archive "$my_xdir" "$my_xabs"
429            ;;
430          esac
431          my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
432        done
433        func_extract_archives_result="$my_oldobjs"
434    }
435    # End of Shell function definitions
436    #####################################
437    
438    # Darwin sucks
439    eval std_shrext=\"$shrext_cmds\"
440    
441    disable_libs=no
442    
443  # Parse our command line options once, thoroughly.  # Parse our command line options once, thoroughly.
444  while test $# -gt 0  while test "$#" -gt 0
445  do  do
446    arg="$1"    arg="$1"
447    shift    shift
# Line 119  do Line 457  do
457      execute_dlfiles)      execute_dlfiles)
458        execute_dlfiles="$execute_dlfiles $arg"        execute_dlfiles="$execute_dlfiles $arg"
459        ;;        ;;
460        tag)
461          tagname="$arg"
462          preserve_args="${preserve_args}=$arg"
463    
464          # Check whether tagname contains only valid characters
465          case $tagname in
466          *[!-_A-Za-z0-9,/]*)
467            $echo "$progname: invalid tag name: $tagname" 1>&2
468            exit $EXIT_FAILURE
469            ;;
470          esac
471    
472          case $tagname in
473          CC)
474            # Don't test for the "default" C tag, as we know, it's there, but
475            # not specially marked.
476            ;;
477          *)
478            if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
479              taglist="$taglist $tagname"
480              # Evaluate the configuration.
481              eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
482            else
483              $echo "$progname: ignoring unknown tag $tagname" 1>&2
484            fi
485            ;;
486          esac
487          ;;
488      *)      *)
489        eval "$prev=\$arg"        eval "$prev=\$arg"
490        ;;        ;;
# Line 136  do Line 502  do
502      ;;      ;;
503    
504    --version)    --version)
505      echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"      $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
506      exit 0      $echo
507        $echo "Copyright (C) 2005  Free Software Foundation, Inc."
508        $echo "This is free software; see the source for copying conditions.  There is NO"
509        $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
510        exit $?
511      ;;      ;;
512    
513    --config)    --config)
514      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
515      exit 0      # Now print the configurations for the tags.
516        for tagname in $taglist; do
517          ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
518        done
519        exit $?
520      ;;      ;;
521    
522    --debug)    --debug)
523      echo "$progname: enabling shell trace mode"      $echo "$progname: enabling shell trace mode"
524      set -x      set -x
525        preserve_args="$preserve_args $arg"
526      ;;      ;;
527    
528    --dry-run | -n)    --dry-run | -n)
# Line 155  do Line 530  do
530      ;;      ;;
531    
532    --features)    --features)
533      echo "host: $host"      $echo "host: $host"
534      if test "$build_libtool_libs" = yes; then      if test "$build_libtool_libs" = yes; then
535        echo "enable shared libraries"        $echo "enable shared libraries"
536      else      else
537        echo "disable shared libraries"        $echo "disable shared libraries"
538      fi      fi
539      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
540        echo "enable static libraries"        $echo "enable static libraries"
541      else      else
542        echo "disable static libraries"        $echo "disable static libraries"
543      fi      fi
544      exit 0      exit $?
545      ;;      ;;
546    
547    --finish) mode="finish" ;;    --finish) mode="finish" ;;
# Line 174  do Line 549  do
549    --mode) prevopt="--mode" prev=mode ;;    --mode) prevopt="--mode" prev=mode ;;
550    --mode=*) mode="$optarg" ;;    --mode=*) mode="$optarg" ;;
551    
552      --preserve-dup-deps) duplicate_deps="yes" ;;
553    
554    --quiet | --silent)    --quiet | --silent)
555      show=:      show=:
556        preserve_args="$preserve_args $arg"
557        ;;
558    
559      --tag)
560        prevopt="--tag"
561        prev=tag
562        preserve_args="$preserve_args --tag"
563        ;;
564      --tag=*)
565        set tag "$optarg" ${1+"$@"}
566        shift
567        prev=tag
568        preserve_args="$preserve_args --tag"
569      ;;      ;;
570    
571    -dlopen)    -dlopen)
# Line 186  do Line 576  do
576    -*)    -*)
577      $echo "$modename: unrecognized option \`$arg'" 1>&2      $echo "$modename: unrecognized option \`$arg'" 1>&2
578      $echo "$help" 1>&2      $echo "$help" 1>&2
579      exit 1      exit $EXIT_FAILURE
580      ;;      ;;
581    
582    *)    *)
# Line 199  done Line 589  done
589  if test -n "$prevopt"; then  if test -n "$prevopt"; then
590    $echo "$modename: option \`$prevopt' requires an argument" 1>&2    $echo "$modename: option \`$prevopt' requires an argument" 1>&2
591    $echo "$help" 1>&2    $echo "$help" 1>&2
592    exit 1    exit $EXIT_FAILURE
593  fi  fi
594    
595    case $disable_libs in
596    no)
597      ;;
598    shared)
599      build_libtool_libs=no
600      build_old_libs=yes
601      ;;
602    static)
603      build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
604      ;;
605    esac
606    
607    # If this variable is set in any of the actions, the command in it
608    # will be execed at the end.  This prevents here-documents from being
609    # left over by shells.
610    exec_cmd=
611    
612  if test -z "$show_help"; then  if test -z "$show_help"; then
613    
614    # Infer the operation mode.    # Infer the operation mode.
615    if test -z "$mode"; then    if test -z "$mode"; then
616        $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
617        $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
618      case $nonopt in      case $nonopt in
619      *cc | *++ | gcc* | *-gcc*)      *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
620        mode=link        mode=link
621        for arg        for arg
622        do        do
# Line 248  if test -z "$show_help"; then Line 657  if test -z "$show_help"; then
657    if test -n "$execute_dlfiles" && test "$mode" != execute; then    if test -n "$execute_dlfiles" && test "$mode" != execute; then
658      $echo "$modename: unrecognized option \`-dlopen'" 1>&2      $echo "$modename: unrecognized option \`-dlopen'" 1>&2
659      $echo "$help" 1>&2      $echo "$help" 1>&2
660      exit 1      exit $EXIT_FAILURE
661    fi    fi
662    
663    # Change the help message to a mode-specific one.    # Change the help message to a mode-specific one.
# Line 262  if test -z "$show_help"; then Line 671  if test -z "$show_help"; then
671      modename="$modename: compile"      modename="$modename: compile"
672      # Get the compilation command and the source file.      # Get the compilation command and the source file.
673      base_compile=      base_compile=
674      prev=      srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
675      lastarg=      suppress_opt=yes
     srcfile="$nonopt"  
676      suppress_output=      suppress_output=
677        arg_mode=normal
678        libobj=
679        later=
680    
     user_target=no  
681      for arg      for arg
682      do      do
683        case $prev in        case $arg_mode in
684        "") ;;        arg  )
685        xcompiler)          # do not "continue".  Instead, add this to base_compile
686          # Aesthetically quote the previous argument.          lastarg="$arg"
687          prev=          arg_mode=normal
         lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`  
   
         case $arg in  
         # Double-quote args containing other shell metacharacters.  
         # Many Bourne shells cannot handle close brackets correctly  
         # in scan sets, so we specify it separately.  
         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")  
           arg="\"$arg\""  
           ;;  
         esac  
   
         # Add the previous argument to base_compile.  
         if test -z "$base_compile"; then  
           base_compile="$lastarg"  
         else  
           base_compile="$base_compile $lastarg"  
         fi  
         continue  
688          ;;          ;;
       esac  
689    
690        # Accept any command-line options.        target )
691        case $arg in          libobj="$arg"
692        -o)          arg_mode=normal
         if test "$user_target" != "no"; then  
           $echo "$modename: you cannot specify \`-o' more than once" 1>&2  
           exit 1  
         fi  
         user_target=next  
         ;;  
   
       -static)  
         build_old_libs=yes  
693          continue          continue
694          ;;          ;;
695    
696        -prefer-pic)        normal )
697          pic_mode=yes          # Accept any command-line options.
698          continue          case $arg in
699          ;;          -o)
700              if test -n "$libobj" ; then
701                $echo "$modename: you cannot specify \`-o' more than once" 1>&2
702                exit $EXIT_FAILURE
703              fi
704              arg_mode=target
705              continue
706              ;;
707    
708        -prefer-non-pic)          -static | -prefer-pic | -prefer-non-pic)
709          pic_mode=no            later="$later $arg"
710          continue            continue
711          ;;            ;;
712    
713        -Xcompiler)          -no-suppress)
714          prev=xcompiler            suppress_opt=no
715          continue            continue
716          ;;            ;;
717    
718        -Wc,*)          -Xcompiler)
719          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`            arg_mode=arg  #  the next one goes into the "base_compile" arg list
720          lastarg=            continue      #  The current "srcfile" will either be retained or
721          IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','            ;;            #  replaced later.  I would guess that would be a bug.
722          for arg in $args; do  
723            IFS="$save_ifs"          -Wc,*)
724              args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
725              lastarg=
726              save_ifs="$IFS"; IFS=','
727              for arg in $args; do
728                IFS="$save_ifs"
729    
730            # Double-quote args containing other shell metacharacters.              # Double-quote args containing other shell metacharacters.
731            # Many Bourne shells cannot handle close brackets correctly              # Many Bourne shells cannot handle close brackets correctly
732            # in scan sets, so we specify it separately.              # in scan sets, so we specify it separately.
733            case $arg in              case $arg in
734              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")                *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
735              arg="\"$arg\""                arg="\"$arg\""
736              ;;                ;;
737            esac              esac
738            lastarg="$lastarg $arg"              lastarg="$lastarg $arg"
739          done            done
740          IFS="$save_ifs"            IFS="$save_ifs"
741          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`            lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
742    
743          # Add the arguments to base_compile.            # Add the arguments to base_compile.
         if test -z "$base_compile"; then  
           base_compile="$lastarg"  
         else  
744            base_compile="$base_compile $lastarg"            base_compile="$base_compile $lastarg"
745          fi            continue
746          continue            ;;
         ;;  
       esac  
747    
748        case $user_target in          * )
749        next)            # Accept the current argument as the source file.
750          # The next one is the -o target name            # The previous "srcfile" becomes the current argument.
751          user_target=yes            #
752          continue            lastarg="$srcfile"
753          ;;            srcfile="$arg"
754        yes)            ;;
755          # We got the output file          esac  #  case $arg
         user_target=set  
         libobj="$arg"  
         continue  
756          ;;          ;;
757        esac        esac    #  case $arg_mode
   
       # Accept the current argument as the source file.  
       lastarg="$srcfile"  
       srcfile="$arg"  
758    
759        # Aesthetically quote the previous argument.        # Aesthetically quote the previous argument.
   
       # Backslashify any backslashes, double quotes, and dollar signs.  
       # These are the only characters that are still specially  
       # interpreted inside of double-quoted scrings.  
760        lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`        lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
761    
762          case $lastarg in
763        # Double-quote args containing other shell metacharacters.        # Double-quote args containing other shell metacharacters.
764        # Many Bourne shells cannot handle close brackets correctly        # Many Bourne shells cannot handle close brackets correctly
765        # in scan sets, so we specify it separately.        # in scan sets, and some SunOS ksh mistreat backslash-escaping
766        case $lastarg in        # in scan sets (worked around with variable expansion),
767          # and furthermore cannot handle '|' '&' '(' ')' in scan sets
768          # at all, so we specify them separately.
769        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
770          lastarg="\"$lastarg\""          lastarg="\"$lastarg\""
771          ;;          ;;
772        esac        esac
773    
774        # Add the previous argument to base_compile.        base_compile="$base_compile $lastarg"
775        if test -z "$base_compile"; then      done # for arg
         base_compile="$lastarg"  
       else  
         base_compile="$base_compile $lastarg"  
       fi  
     done  
776    
777      case $user_target in      case $arg_mode in
778      set)      arg)
779          $echo "$modename: you must specify an argument for -Xcompile"
780          exit $EXIT_FAILURE
781        ;;        ;;
782      no)      target)
783        # Get the name of the library object.        $echo "$modename: you must specify a target with \`-o'" 1>&2
784        libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`        exit $EXIT_FAILURE
785        ;;        ;;
786      *)      *)
787        $echo "$modename: you must specify a target with \`-o'" 1>&2        # Get the name of the library object.
788        exit 1        [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
789        ;;        ;;
790      esac      esac
791    
792      # Recognize several different file suffixes.      # Recognize several different file suffixes.
793      # If the user specifies -o file.o, it is replaced with file.lo      # If the user specifies -o file.o, it is replaced with file.lo
794      xform='[cCFSfmso]'      xform='[cCFSifmso]'
795      case $libobj in      case $libobj in
796      *.ada) xform=ada ;;      *.ada) xform=ada ;;
797      *.adb) xform=adb ;;      *.adb) xform=adb ;;
# Line 421  if test -z "$show_help"; then Line 799  if test -z "$show_help"; then
799      *.asm) xform=asm ;;      *.asm) xform=asm ;;
800      *.c++) xform=c++ ;;      *.c++) xform=c++ ;;
801      *.cc) xform=cc ;;      *.cc) xform=cc ;;
802        *.ii) xform=ii ;;
803        *.class) xform=class ;;
804      *.cpp) xform=cpp ;;      *.cpp) xform=cpp ;;
805      *.cxx) xform=cxx ;;      *.cxx) xform=cxx ;;
806      *.f90) xform=f90 ;;      *.f90) xform=f90 ;;
807      *.for) xform=for ;;      *.for) xform=for ;;
808        *.java) xform=java ;;
809      esac      esac
810    
811      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
# Line 433  if test -z "$show_help"; then Line 814  if test -z "$show_help"; then
814      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
815      *)      *)
816        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
817        exit 1        exit $EXIT_FAILURE
818        ;;        ;;
819      esac      esac
820    
821        func_infer_tag $base_compile
822    
823        for arg in $later; do
824          case $arg in
825          -static)
826            build_old_libs=yes
827            continue
828            ;;
829    
830          -prefer-pic)
831            pic_mode=yes
832            continue
833            ;;
834    
835          -prefer-non-pic)
836            pic_mode=no
837            continue
838            ;;
839          esac
840        done
841    
842        qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
843        case $qlibobj in
844          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
845            qlibobj="\"$qlibobj\"" ;;
846        esac
847        test "X$libobj" != "X$qlibobj" \
848            && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
849            && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
850        objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
851        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
852        if test "X$xdir" = "X$obj"; then
853          xdir=
854        else
855          xdir=$xdir/
856        fi
857        lobj=${xdir}$objdir/$objname
858    
859      if test -z "$base_compile"; then      if test -z "$base_compile"; then
860        $echo "$modename: you must specify a compilation command" 1>&2        $echo "$modename: you must specify a compilation command" 1>&2
861        $echo "$help" 1>&2        $echo "$help" 1>&2
862        exit 1        exit $EXIT_FAILURE
863      fi      fi
864    
865      # Delete any leftover library objects.      # Delete any leftover library objects.
866      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
867        removelist="$obj $libobj"        removelist="$obj $lobj $libobj ${libobj}T"
868      else      else
869        removelist="$libobj"        removelist="$lobj $libobj ${libobj}T"
870      fi      fi
871    
872      $run $rm $removelist      $run $rm $removelist
873      trap "$run $rm $removelist; exit 1" 1 2 15      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
874    
875      # 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
876      case $host_os in      case $host_os in
# Line 459  if test -z "$show_help"; then Line 878  if test -z "$show_help"; then
878        pic_mode=default        pic_mode=default
879        ;;        ;;
880      esac      esac
881      if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then      if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
882        # non-PIC code in shared libraries is not supported        # non-PIC code in shared libraries is not supported
883        pic_mode=default        pic_mode=default
884      fi      fi
# Line 470  if test -z "$show_help"; then Line 889  if test -z "$show_help"; then
889        output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}        output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
890        lockfile="$output_obj.lock"        lockfile="$output_obj.lock"
891        removelist="$removelist $output_obj $lockfile"        removelist="$removelist $output_obj $lockfile"
892        trap "$run $rm $removelist; exit 1" 1 2 15        trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
893      else      else
894          output_obj=
895        need_locks=no        need_locks=no
896        lockfile=        lockfile=
897      fi      fi
# Line 479  if test -z "$show_help"; then Line 899  if test -z "$show_help"; then
899      # Lock this critical section if it is needed      # Lock this critical section if it is needed
900      # 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
901      if test "$need_locks" = yes; then      if test "$need_locks" = yes; then
902        until $run ln "$0" "$lockfile" 2>/dev/null; do        until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
903          $show "Waiting for $lockfile to be removed"          $show "Waiting for $lockfile to be removed"
904          sleep 2          sleep 2
905        done        done
906      elif test "$need_locks" = warn; then      elif test "$need_locks" = warn; then
907        if test -f "$lockfile"; then        if test -f "$lockfile"; then
908          echo "\          $echo "\
909  *** ERROR, $lockfile exists and contains:  *** ERROR, $lockfile exists and contains:
910  `cat $lockfile 2>/dev/null`  `cat $lockfile 2>/dev/null`
911    
# Line 497  avoid parallel builds (make -j) in this Line 917  avoid parallel builds (make -j) in this
917  compiler."  compiler."
918    
919          $run $rm $removelist          $run $rm $removelist
920          exit 1          exit $EXIT_FAILURE
921        fi        fi
922        echo $srcfile > "$lockfile"        $echo "$srcfile" > "$lockfile"
923      fi      fi
924    
925      if test -n "$fix_srcfile_path"; then      if test -n "$fix_srcfile_path"; then
926        eval srcfile=\"$fix_srcfile_path\"        eval srcfile=\"$fix_srcfile_path\"
927      fi      fi
928        qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
929        case $qsrcfile in
930          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
931          qsrcfile="\"$qsrcfile\"" ;;
932        esac
933    
934        $run $rm "$libobj" "${libobj}T"
935    
936        # Create a libtool object file (analogous to a ".la" file),
937        # but don't create it if we're doing a dry run.
938        test -z "$run" && cat > ${libobj}T <<EOF
939    # $libobj - a libtool object file
940    # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
941    #
942    # Please DO NOT delete this file!
943    # It is necessary for linking the library.
944    
945    # Name of the PIC object.
946    EOF
947    
948      # Only build a PIC object if we are building libtool libraries.      # Only build a PIC object if we are building libtool libraries.
949      if test "$build_libtool_libs" = yes; then      if test "$build_libtool_libs" = yes; then
# Line 512  compiler." Line 951  compiler."
951        fbsd_hideous_sh_bug=$base_compile        fbsd_hideous_sh_bug=$base_compile
952    
953        if test "$pic_mode" != no; then        if test "$pic_mode" != no; then
954          # All platforms use -DPIC, to notify preprocessed assembler code.          command="$base_compile $qsrcfile $pic_flag"
         command="$base_compile $srcfile $pic_flag -DPIC"  
955        else        else
956          # Don't build PIC code          # Don't build PIC code
957          command="$base_compile $srcfile"          command="$base_compile $qsrcfile"
958        fi        fi
       if test "$build_old_libs" = yes; then  
         lo_libobj="$libobj"  
         dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`  
         if test "X$dir" = "X$libobj"; then  
           dir="$objdir"  
         else  
           dir="$dir/$objdir"  
         fi  
         libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`  
959    
960          if test -d "$dir"; then        if test ! -d "${xdir}$objdir"; then
961            $show "$rm $libobj"          $show "$mkdir ${xdir}$objdir"
962            $run $rm $libobj          $run $mkdir ${xdir}$objdir
963          else          exit_status=$?
964            $show "$mkdir $dir"          if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
965            $run $mkdir $dir            exit $exit_status
           status=$?  
           if test $status -ne 0 && test ! -d $dir; then  
             exit $status  
           fi  
966          fi          fi
967        fi        fi
968        if test "$compiler_o_lo" = yes; then  
969          output_obj="$libobj"        if test -z "$output_obj"; then
970          command="$command -o $output_obj"          # Place PIC objects in $objdir
971        elif test "$compiler_c_o" = yes; then          command="$command -o $lobj"
         output_obj="$obj"  
         command="$command -o $output_obj"  
972        fi        fi
973    
974        $run $rm "$output_obj"        $run $rm "$lobj" "$output_obj"
975    
976        $show "$command"        $show "$command"
977        if $run eval "$command"; then :        if $run eval "$command"; then :
978        else        else
979          test -n "$output_obj" && $run $rm $removelist          test -n "$output_obj" && $run $rm $removelist
980          exit 1          exit $EXIT_FAILURE
981        fi        fi
982    
983        if test "$need_locks" = warn &&        if test "$need_locks" = warn &&
984           test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then           test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
985          echo "\          $echo "\
986  *** ERROR, $lockfile contains:  *** ERROR, $lockfile contains:
987  `cat $lockfile 2>/dev/null`  `cat $lockfile 2>/dev/null`
988    
# Line 573  avoid parallel builds (make -j) in this Line 997  avoid parallel builds (make -j) in this
997  compiler."  compiler."
998    
999          $run $rm $removelist          $run $rm $removelist
1000          exit 1          exit $EXIT_FAILURE
1001        fi        fi
1002    
1003        # 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
1004        if test x"$output_obj" != x"$libobj"; then        if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1005          $show "$mv $output_obj $libobj"          $show "$mv $output_obj $lobj"
1006          if $run $mv $output_obj $libobj; then :          if $run $mv $output_obj $lobj; then :
1007          else          else
1008            error=$?            error=$?
1009            $run $rm $removelist            $run $rm $removelist
# Line 587  compiler." Line 1011  compiler."
1011          fi          fi
1012        fi        fi
1013    
1014        # If we have no pic_flag, then copy the object into place and finish.        # Append the name of the PIC object to the libtool object file.
1015        if (test -z "$pic_flag" || test "$pic_mode" != default) &&        test -z "$run" && cat >> ${libobj}T <<EOF
1016           test "$build_old_libs" = yes; then  pic_object='$objdir/$objname'
         # Rename the .lo from within objdir to obj  
         if test -f $obj; then  
           $show $rm $obj  
           $run $rm $obj  
         fi  
1017    
1018          $show "$mv $libobj $obj"  EOF
         if $run $mv $libobj $obj; then :  
         else  
           error=$?  
           $run $rm $removelist  
           exit $error  
         fi  
1019    
1020          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`        # Allow error messages only from the first compilation.
1021          if test "X$xdir" = "X$obj"; then        if test "$suppress_opt" = yes; then
1022            xdir="."          suppress_output=' >/dev/null 2>&1'
         else  
           xdir="$xdir"  
         fi  
         baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`  
         libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`  
         # Now arrange that obj and lo_libobj become the same file  
         $show "(cd $xdir && $LN_S $baseobj $libobj)"  
         if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then  
           exit 0  
         else  
           error=$?  
           $run $rm $removelist  
           exit $error  
         fi  
1023        fi        fi
1024        else
1025          # No PIC object so indicate it doesn't exist in the libtool
1026          # object file.
1027          test -z "$run" && cat >> ${libobj}T <<EOF
1028    pic_object=none
1029    
1030        # Allow error messages only from the first compilation.  EOF
       suppress_output=' >/dev/null 2>&1'  
1031      fi      fi
1032    
1033      # Only build a position-dependent object if we build old libraries.      # Only build a position-dependent object if we build old libraries.
1034      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
1035        if test "$pic_mode" != yes; then        if test "$pic_mode" != yes; then
1036          # Don't build PIC code          # Don't build PIC code
1037          command="$base_compile $srcfile"          command="$base_compile $qsrcfile"
1038        else        else
1039          # All platforms use -DPIC, to notify preprocessed assembler code.          command="$base_compile $qsrcfile $pic_flag"
         command="$base_compile $srcfile $pic_flag -DPIC"  
1040        fi        fi
1041        if test "$compiler_c_o" = yes; then        if test "$compiler_c_o" = yes; then
1042          command="$command -o $obj"          command="$command -o $obj"
         output_obj="$obj"  
1043        fi        fi
1044    
1045        # Suppress compiler output if we already did a PIC compilation.        # Suppress compiler output if we already did a PIC compilation.
1046        command="$command$suppress_output"        command="$command$suppress_output"
1047        $run $rm "$output_obj"        $run $rm "$obj" "$output_obj"
1048        $show "$command"        $show "$command"
1049        if $run eval "$command"; then :        if $run eval "$command"; then :
1050        else        else
1051          $run $rm $removelist          $run $rm $removelist
1052          exit 1          exit $EXIT_FAILURE
1053        fi        fi
1054    
1055        if test "$need_locks" = warn &&        if test "$need_locks" = warn &&
1056           test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then           test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1057          echo "\          $echo "\
1058  *** ERROR, $lockfile contains:  *** ERROR, $lockfile contains:
1059  `cat $lockfile 2>/dev/null`  `cat $lockfile 2>/dev/null`
1060    
# Line 668  avoid parallel builds (make -j) in this Line 1069  avoid parallel builds (make -j) in this
1069  compiler."  compiler."
1070    
1071          $run $rm $removelist          $run $rm $removelist
1072          exit 1          exit $EXIT_FAILURE
1073        fi        fi
1074    
1075        # Just move the object if needed        # Just move the object if needed
1076        if test x"$output_obj" != x"$obj"; then        if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1077          $show "$mv $output_obj $obj"          $show "$mv $output_obj $obj"
1078          if $run $mv $output_obj $obj; then :          if $run $mv $output_obj $obj; then :
1079          else          else
# Line 682  compiler." Line 1083  compiler."
1083          fi          fi
1084        fi        fi
1085    
1086        # Create an invalid libtool object if no PIC, so that we do not        # Append the name of the non-PIC object the libtool object file.
1087        # accidentally link it into a program.        # Only append if the libtool object file exists.
1088        if test "$build_libtool_libs" != yes; then        test -z "$run" && cat >> ${libobj}T <<EOF
1089          $show "echo timestamp > $libobj"  # Name of the non-PIC object.
1090          $run eval "echo timestamp > \$libobj" || exit $?  non_pic_object='$objname'
1091        else  
1092          # Move the .lo from within objdir  EOF
1093          $show "$mv $libobj $lo_libobj"      else
1094          if $run $mv $libobj $lo_libobj; then :        # Append the name of the non-PIC object the libtool object file.
1095          else        # Only append if the libtool object file exists.
1096            error=$?        test -z "$run" && cat >> ${libobj}T <<EOF
1097            $run $rm $removelist  # Name of the non-PIC object.
1098            exit $error  non_pic_object=none
1099          fi  
1100        fi  EOF
1101      fi      fi
1102    
1103        $run $mv "${libobj}T" "${libobj}"
1104    
1105      # Unlock the critical section if it was locked      # Unlock the critical section if it was locked
1106      if test "$need_locks" != no; then      if test "$need_locks" != no; then
1107        $run $rm "$lockfile"        $run $rm "$lockfile"
1108      fi      fi
1109    
1110      exit 0      exit $EXIT_SUCCESS
1111      ;;      ;;
1112    
1113    # libtool link mode    # libtool link mode
# Line 715  compiler." Line 1118  compiler."
1118        # It is impossible to link a dll without this setting, and        # It is impossible to link a dll without this setting, and
1119        # we shouldn't force the makefile maintainer to figure out        # we shouldn't force the makefile maintainer to figure out
1120        # which system we are compiling for in order to pass an extra        # which system we are compiling for in order to pass an extra
1121        # flag for every libtool invokation.        # flag for every libtool invocation.
1122        # allow_undefined=no        # allow_undefined=no
1123    
1124        # FIXME: Unfortunately, there are problems with the above when trying        # FIXME: Unfortunately, there are problems with the above when trying
# Line 730  compiler." Line 1133  compiler."
1133        ;;        ;;
1134      esac      esac
1135      libtool_args="$nonopt"      libtool_args="$nonopt"
1136        base_compile="$nonopt $@"
1137      compile_command="$nonopt"      compile_command="$nonopt"
1138      finalize_command="$nonopt"      finalize_command="$nonopt"
1139    
# Line 745  compiler." Line 1149  compiler."
1149      linker_flags=      linker_flags=
1150      dllsearchpath=      dllsearchpath=
1151      lib_search_path=`pwd`      lib_search_path=`pwd`
1152        inst_prefix_dir=
1153    
1154      avoid_version=no      avoid_version=no
1155      dlfiles=      dlfiles=
# Line 759  compiler." Line 1164  compiler."
1164      module=no      module=no
1165      no_install=no      no_install=no
1166      objs=      objs=
1167        non_pic_objects=
1168        notinst_path= # paths that contain not-installed libtool libraries
1169        precious_files_regex=
1170      prefer_static_libs=no      prefer_static_libs=no
1171      preload=no      preload=no
1172      prev=      prev=
# Line 770  compiler." Line 1178  compiler."
1178      temp_rpath=      temp_rpath=
1179      thread_safe=no      thread_safe=no
1180      vinfo=      vinfo=
1181        vinfo_number=no
1182    
1183        func_infer_tag $base_compile
1184    
1185      # We need to know -static, to get the right output filenames.      # We need to know -static, to get the right output filenames.
1186      for arg      for arg
# Line 783  compiler." Line 1194  compiler."
1194            if test -n "$link_static_flag"; then            if test -n "$link_static_flag"; then
1195              dlopen_self=$dlopen_self_static              dlopen_self=$dlopen_self_static
1196            fi            fi
1197              prefer_static_libs=yes
1198          else          else
1199            if test -z "$pic_flag" && test -n "$link_static_flag"; then            if test -z "$pic_flag" && test -n "$link_static_flag"; then
1200              dlopen_self=$dlopen_self_static              dlopen_self=$dlopen_self_static
1201            fi            fi
1202              prefer_static_libs=built
1203          fi          fi
1204          build_libtool_libs=no          build_libtool_libs=no
1205          build_old_libs=yes          build_old_libs=yes
         prefer_static_libs=yes  
1206          break          break
1207          ;;          ;;
1208        esac        esac
# Line 800  compiler." Line 1212  compiler."
1212      test -n "$old_archive_from_new_cmds" && build_old_libs=yes      test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1213    
1214      # Go through the arguments, transforming them on the way.      # Go through the arguments, transforming them on the way.
1215      while test $# -gt 0; do      while test "$#" -gt 0; do
1216        arg="$1"        arg="$1"
1217        shift        shift
1218        case $arg in        case $arg in
# Line 865  compiler." Line 1277  compiler."
1277            export_symbols="$arg"            export_symbols="$arg"
1278            if test ! -f "$arg"; then            if test ! -f "$arg"; then
1279              $echo "$modename: symbol file \`$arg' does not exist"              $echo "$modename: symbol file \`$arg' does not exist"
1280              exit 1              exit $EXIT_FAILURE
1281            fi            fi
1282            prev=            prev=
1283            continue            continue
# Line 875  compiler." Line 1287  compiler."
1287            prev=            prev=
1288            continue            continue
1289            ;;            ;;
1290            inst_prefix)
1291              inst_prefix_dir="$arg"
1292              prev=
1293              continue
1294              ;;
1295            precious_regex)
1296              precious_files_regex="$arg"
1297              prev=
1298              continue
1299              ;;
1300          release)          release)
1301            release="-$arg"            release="-$arg"
1302            prev=            prev=
1303            continue            continue
1304            ;;            ;;
1305            objectlist)
1306              if test -f "$arg"; then
1307                save_arg=$arg
1308                moreargs=
1309                for fil in `cat $save_arg`
1310                do
1311    #             moreargs="$moreargs $fil"
1312                  arg=$fil
1313                  # A libtool-controlled object.
1314    
1315                  # Check to see that this really is a libtool object.
1316                  if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1317                    pic_object=
1318                    non_pic_object=
1319    
1320                    # Read the .lo file
1321                    # If there is no directory component, then add one.
1322                    case $arg in
1323                    */* | *\\*) . $arg ;;
1324                    *) . ./$arg ;;
1325                    esac
1326    
1327                    if test -z "$pic_object" || \
1328                       test -z "$non_pic_object" ||
1329                       test "$pic_object" = none && \
1330                       test "$non_pic_object" = none; then
1331                      $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1332                      exit $EXIT_FAILURE
1333                    fi
1334    
1335                    # Extract subdirectory from the argument.
1336                    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1337                    if test "X$xdir" = "X$arg"; then
1338                      xdir=
1339                    else
1340                      xdir="$xdir/"
1341                    fi
1342    
1343                    if test "$pic_object" != none; then
1344                      # Prepend the subdirectory the object is found in.
1345                      pic_object="$xdir$pic_object"
1346    
1347                      if test "$prev" = dlfiles; then
1348                        if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1349                          dlfiles="$dlfiles $pic_object"
1350                          prev=
1351                          continue
1352                        else
1353                          # If libtool objects are unsupported, then we need to preload.
1354                          prev=dlprefiles
1355                        fi
1356                      fi
1357    
1358                      # CHECK ME:  I think I busted this.  -Ossama
1359                      if test "$prev" = dlprefiles; then
1360                        # Preload the old-style object.
1361                        dlprefiles="$dlprefiles $pic_object"
1362                        prev=
1363                      fi
1364    
1365                      # A PIC object.
1366                      libobjs="$libobjs $pic_object"
1367                      arg="$pic_object"
1368                    fi
1369    
1370                    # Non-PIC object.
1371                    if test "$non_pic_object" != none; then
1372                      # Prepend the subdirectory the object is found in.
1373                      non_pic_object="$xdir$non_pic_object"
1374    
1375                      # A standard non-PIC object
1376                      non_pic_objects="$non_pic_objects $non_pic_object"
1377                      if test -z "$pic_object" || test "$pic_object" = none ; then
1378                        arg="$non_pic_object"
1379                      fi
1380                    else
1381                      # If the PIC object exists, use it instead.
1382                      # $xdir was prepended to $pic_object above.
1383                      non_pic_object="$pic_object"
1384                      non_pic_objects="$non_pic_objects $non_pic_object"
1385                    fi
1386                  else
1387                    # Only an error if not doing a dry-run.
1388                    if test -z "$run"; then
1389                      $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1390                      exit $EXIT_FAILURE
1391                    else
1392                      # Dry-run case.
1393    
1394                      # Extract subdirectory from the argument.
1395                      xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1396                      if test "X$xdir" = "X$arg"; then
1397                        xdir=
1398                      else
1399                        xdir="$xdir/"
1400                      fi
1401    
1402                      pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1403                      non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1404                      libobjs="$libobjs $pic_object"
1405                      non_pic_objects="$non_pic_objects $non_pic_object"
1406                    fi
1407                  fi
1408                done
1409              else
1410                $echo "$modename: link input file \`$save_arg' does not exist"
1411                exit $EXIT_FAILURE
1412              fi
1413              arg=$save_arg
1414              prev=
1415              continue
1416              ;;
1417          rpath | xrpath)          rpath | xrpath)
1418            # We need an absolute path.            # We need an absolute path.
1419            case $arg in            case $arg in
1420            [\\/]* | [A-Za-z]:[\\/]*) ;;            [\\/]* | [A-Za-z]:[\\/]*) ;;
1421            *)            *)
1422              $echo "$modename: only absolute run-paths are allowed" 1>&2              $echo "$modename: only absolute run-paths are allowed" 1>&2
1423              exit 1              exit $EXIT_FAILURE
1424              ;;              ;;
1425            esac            esac
1426            if test "$prev" = rpath; then            if test "$prev" = rpath; then
# Line 918  compiler." Line 1452  compiler."
1452            finalize_command="$finalize_command $wl$qarg"            finalize_command="$finalize_command $wl$qarg"
1453            continue            continue
1454            ;;            ;;
1455            xcclinker)
1456              linker_flags="$linker_flags $qarg"
1457              compiler_flags="$compiler_flags $qarg"
1458              prev=
1459              compile_command="$compile_command $qarg"
1460              finalize_command="$finalize_command $qarg"
1461              continue
1462              ;;
1463            shrext)
1464              shrext_cmds="$arg"
1465              prev=
1466              continue
1467              ;;
1468            darwin_framework|darwin_framework_skip)
1469              test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1470              compile_command="$compile_command $arg"
1471              finalize_command="$finalize_command $arg"
1472              prev=
1473              continue
1474              ;;
1475          *)          *)
1476            eval "$prev=\"\$arg\""            eval "$prev=\"\$arg\""
1477            prev=            prev=
1478            continue            continue
1479            ;;            ;;
1480          esac          esac
1481        fi # test -n $prev        fi # test -n "$prev"
1482    
1483        prevarg="$arg"        prevarg="$arg"
1484    
# Line 966  compiler." Line 1520  compiler."
1520        -export-symbols | -export-symbols-regex)        -export-symbols | -export-symbols-regex)
1521          if test -n "$export_symbols" || test -n "$export_symbols_regex"; then          if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1522            $echo "$modename: more than one -exported-symbols argument is not allowed"            $echo "$modename: more than one -exported-symbols argument is not allowed"
1523            exit 1            exit $EXIT_FAILURE
1524          fi          fi
1525          if test "X$arg" = "X-export-symbols"; then          if test "X$arg" = "X-export-symbols"; then
1526            prev=expsyms            prev=expsyms
# Line 976  compiler." Line 1530  compiler."
1530          continue          continue
1531          ;;          ;;
1532    
1533          -framework|-arch|-isysroot)
1534            case " $CC " in
1535              *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1536                    prev=darwin_framework_skip ;;
1537              *) compiler_flags="$compiler_flags $arg"
1538                 prev=darwin_framework ;;
1539            esac
1540            compile_command="$compile_command $arg"
1541            finalize_command="$finalize_command $arg"
1542            continue
1543            ;;
1544    
1545          -inst-prefix-dir)
1546            prev=inst_prefix
1547            continue
1548            ;;
1549    
1550        # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*        # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1551        # so, if we see these flags be careful not to treat them like -L        # so, if we see these flags be careful not to treat them like -L
1552        -L[A-Z][A-Z]*:*)        -L[A-Z][A-Z]*:*)
1553          case $with_gcc/$host in          case $with_gcc/$host in
1554          no/*-*-irix*)          no/*-*-irix* | /*-*-irix*)
1555            compile_command="$compile_command $arg"            compile_command="$compile_command $arg"
1556            finalize_command="$finalize_command $arg"            finalize_command="$finalize_command $arg"
1557            ;;            ;;
# Line 997  compiler." Line 1568  compiler."
1568            absdir=`cd "$dir" && pwd`            absdir=`cd "$dir" && pwd`
1569            if test -z "$absdir"; then            if test -z "$absdir"; then
1570              $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2              $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1571              exit 1              absdir="$dir"
1572                notinst_path="$notinst_path $dir"
1573            fi            fi
1574            dir="$absdir"            dir="$absdir"
1575            ;;            ;;
# Line 1011  compiler." Line 1583  compiler."
1583          esac          esac
1584          case $host in          case $host in
1585          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1586              testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1587            case :$dllsearchpath: in            case :$dllsearchpath: in
1588            *":$dir:"*) ;;            *":$dir:"*) ;;
1589            *) dllsearchpath="$dllsearchpath:$dir";;            *) dllsearchpath="$dllsearchpath:$dir";;
1590            esac            esac
1591              case :$dllsearchpath: in
1592              *":$testbindir:"*) ;;
1593              *) dllsearchpath="$dllsearchpath:$testbindir";;
1594              esac
1595            ;;            ;;
1596          esac          esac
1597          continue          continue
# Line 1023  compiler." Line 1600  compiler."
1600        -l*)        -l*)
1601          if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then          if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1602            case $host in            case $host in
1603            *-*-cygwin* | *-*-pw32* | *-*-beos*)            *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1604              # 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)
1605              continue              continue
1606              ;;              ;;
1607            *-*-mingw* | *-*-os2*)            *-*-os2*)
1608              # These systems don't actually have a C library (as such)              # These systems don't actually have a C library (as such)
1609              test "X$arg" = "X-lc" && continue              test "X$arg" = "X-lc" && continue
1610              ;;              ;;
1611              *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1612                # Do not include libc due to us having libc/libc_r.
1613                test "X$arg" = "X-lc" && continue
1614                ;;
1615              *-*-rhapsody* | *-*-darwin1.[012])
1616                # Rhapsody C and math libraries are in the System framework
1617                deplibs="$deplibs -framework System"
1618                continue
1619                ;;
1620              *-*-sco3.2v5* | *-*-sco5v6*)
1621                # Causes problems with __ctype
1622                test "X$arg" = "X-lc" && continue
1623                ;;
1624              *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1625                # Compiler inserts libc in the correct place for threads to work
1626                test "X$arg" = "X-lc" && continue
1627                ;;
1628            esac            esac
1629            elif test "X$arg" = "X-lc_r"; then
1630             case $host in
1631             *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1632               # Do not include libc_r directly, use -pthread flag.
1633               continue
1634               ;;
1635             esac
1636          fi          fi
1637          deplibs="$deplibs $arg"          deplibs="$deplibs $arg"
1638          continue          continue
1639          ;;          ;;
1640    
1641          # Tru64 UNIX uses -model [arg] to determine the layout of C++
1642          # classes, name mangling, and exception handling.
1643          -model)
1644            compile_command="$compile_command $arg"
1645            compiler_flags="$compiler_flags $arg"
1646            finalize_command="$finalize_command $arg"
1647            prev=xcompiler
1648            continue
1649            ;;
1650    
1651         -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1652            compiler_flags="$compiler_flags $arg"
1653            compile_command="$compile_command $arg"
1654            finalize_command="$finalize_command $arg"
1655            continue
1656            ;;
1657    
1658        -module)        -module)
1659          module=yes          module=yes
1660          continue          continue
1661          ;;          ;;
1662    
1663          # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1664          # -r[0-9][0-9]* specifies the processor on the SGI compiler
1665          # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1666          # +DA*, +DD* enable 64-bit mode on the HP compiler
1667          # -q* pass through compiler args for the IBM compiler
1668          # -m* pass through architecture-specific compiler args for GCC
1669          # -m*, -t[45]*, -txscale* pass through architecture-specific
1670          # compiler args for GCC
1671          # -pg pass through profiling flag for GCC
1672          # @file GCC response files
1673          -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1674          -t[45]*|-txscale*|@*)
1675    
1676            # Unknown arguments in both finalize_command and compile_command need
1677            # to be aesthetically quoted because they are evaled later.
1678            arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1679            case $arg in
1680            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1681              arg="\"$arg\""
1682              ;;
1683            esac
1684            compile_command="$compile_command $arg"
1685            finalize_command="$finalize_command $arg"
1686            compiler_flags="$compiler_flags $arg"
1687            continue
1688            ;;
1689    
1690          -shrext)
1691            prev=shrext
1692            continue
1693            ;;
1694    
1695        -no-fast-install)        -no-fast-install)
1696          fast_install=no          fast_install=no
1697          continue          continue
# Line 1066  compiler." Line 1716  compiler."
1716          continue          continue
1717          ;;          ;;
1718    
1719          -objectlist)
1720            prev=objectlist
1721            continue
1722            ;;
1723    
1724        -o) prev=output ;;        -o) prev=output ;;
1725    
1726          -precious-files-regex)
1727            prev=precious_regex
1728            continue
1729            ;;
1730    
1731        -release)        -release)
1732          prev=release          prev=release
1733          continue          continue
# Line 1090  compiler." Line 1750  compiler."
1750          [\\/]* | [A-Za-z]:[\\/]*) ;;          [\\/]* | [A-Za-z]:[\\/]*) ;;
1751          *)          *)
1752            $echo "$modename: only absolute run-paths are allowed" 1>&2            $echo "$modename: only absolute run-paths are allowed" 1>&2
1753            exit 1            exit $EXIT_FAILURE
1754            ;;            ;;
1755          esac          esac
1756          case "$xrpath " in          case "$xrpath " in
# Line 1118  compiler." Line 1778  compiler."
1778          prev=vinfo          prev=vinfo
1779          continue          continue
1780          ;;          ;;
1781          -version-number)
1782            prev=vinfo
1783            vinfo_number=yes
1784            continue
1785            ;;
1786    
1787        -Wc,*)        -Wc,*)
1788          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1789          arg=          arg=
1790          IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','          save_ifs="$IFS"; IFS=','
1791          for flag in $args; do          for flag in $args; do
1792            IFS="$save_ifs"            IFS="$save_ifs"
1793            case $flag in            case $flag in
# Line 1140  compiler." Line 1805  compiler."
1805        -Wl,*)        -Wl,*)
1806          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1807          arg=          arg=
1808          IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','          save_ifs="$IFS"; IFS=','
1809          for flag in $args; do          for flag in $args; do
1810            IFS="$save_ifs"            IFS="$save_ifs"
1811            case $flag in            case $flag in
# Line 1166  compiler." Line 1831  compiler."
1831          continue          continue
1832          ;;          ;;
1833    
1834          -XCClinker)
1835            prev=xcclinker
1836            continue
1837            ;;
1838    
1839        # Some other compiler flag.        # Some other compiler flag.
1840        -* | +*)        -* | +*)
1841          # Unknown arguments in both finalize_command and compile_command need          # Unknown arguments in both finalize_command and compile_command need
# Line 1178  compiler." Line 1848  compiler."
1848          esac          esac
1849          ;;          ;;
1850    
1851        *.lo | *.$objext)        *.$objext)
1852          # A library or standard object.          # A standard object.
1853          if test "$prev" = dlfiles; then          objs="$objs $arg"
1854            # This file was specified with -dlopen.          ;;
           if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then  
             dlfiles="$dlfiles $arg"  
             prev=  
             continue  
           else  
             # If libtool objects are unsupported, then we need to preload.  
             prev=dlprefiles  
           fi  
         fi  
1855    
1856          if test "$prev" = dlprefiles; then        *.lo)
1857            # Preload the old-style object.          # A libtool-controlled object.
1858            dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`  
1859            prev=          # Check to see that this really is a libtool object.
1860          else          if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1861              pic_object=
1862              non_pic_object=
1863    
1864              # Read the .lo file
1865              # If there is no directory component, then add one.
1866            case $arg in            case $arg in
1867            *.lo) libobjs="$libobjs $arg" ;;            */* | *\\*) . $arg ;;
1868            *) objs="$objs $arg" ;;            *) . ./$arg ;;
1869            esac            esac
1870    
1871              if test -z "$pic_object" || \
1872                 test -z "$non_pic_object" ||
1873                 test "$pic_object" = none && \
1874                 test "$non_pic_object" = none; then
1875                $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1876                exit $EXIT_FAILURE
1877              fi
1878    
1879              # Extract subdirectory from the argument.
1880              xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1881              if test "X$xdir" = "X$arg"; then
1882                xdir=
1883              else
1884                xdir="$xdir/"
1885              fi
1886    
1887              if test "$pic_object" != none; then
1888                # Prepend the subdirectory the object is found in.
1889                pic_object="$xdir$pic_object"
1890    
1891                if test "$prev" = dlfiles; then
1892                  if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1893                    dlfiles="$dlfiles $pic_object"
1894                    prev=
1895                    continue
1896                  else
1897                    # If libtool objects are unsupported, then we need to preload.
1898                    prev=dlprefiles
1899                  fi
1900                fi
1901    
1902                # CHECK ME:  I think I busted this.  -Ossama
1903                if test "$prev" = dlprefiles; then
1904                  # Preload the old-style object.
1905                  dlprefiles="$dlprefiles $pic_object"
1906                  prev=
1907                fi
1908    
1909                # A PIC object.
1910                libobjs="$libobjs $pic_object"
1911                arg="$pic_object"
1912              fi
1913    
1914              # Non-PIC object.
1915              if test "$non_pic_object" != none; then
1916                # Prepend the subdirectory the object is found in.
1917                non_pic_object="$xdir$non_pic_object"
1918    
1919                # A standard non-PIC object
1920                non_pic_objects="$non_pic_objects $non_pic_object"
1921                if test -z "$pic_object" || test "$pic_object" = none ; then
1922                  arg="$non_pic_object"
1923                fi
1924              else
1925                # If the PIC object exists, use it instead.
1926                # $xdir was prepended to $pic_object above.
1927                non_pic_object="$pic_object"
1928                non_pic_objects="$non_pic_objects $non_pic_object"
1929              fi
1930            else
1931              # Only an error if not doing a dry-run.
1932              if test -z "$run"; then
1933                $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1934                exit $EXIT_FAILURE
1935              else
1936                # Dry-run case.
1937    
1938                # Extract subdirectory from the argument.
1939                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1940                if test "X$xdir" = "X$arg"; then
1941                  xdir=
1942                else
1943                  xdir="$xdir/"
1944                fi
1945    
1946                pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1947                non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1948                libobjs="$libobjs $pic_object"
1949                non_pic_objects="$non_pic_objects $non_pic_object"
1950              fi
1951          fi          fi
1952          ;;          ;;
1953    
# Line 1251  compiler." Line 1998  compiler."
1998      if test -n "$prev"; then      if test -n "$prev"; then
1999        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2000        $echo "$help" 1>&2        $echo "$help" 1>&2
2001        exit 1        exit $EXIT_FAILURE
2002      fi      fi
2003    
2004      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 1260  compiler." Line 2007  compiler."
2007        finalize_command="$finalize_command $arg"        finalize_command="$finalize_command $arg"
2008      fi      fi
2009    
2010        oldlibs=
2011      # calculate the name of the file, without its directory      # calculate the name of the file, without its directory
2012      outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`      outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2013      libobjs_save="$libobjs"      libobjs_save="$libobjs"
# Line 1280  compiler." Line 2028  compiler."
2028        output_objdir="$output_objdir/$objdir"        output_objdir="$output_objdir/$objdir"
2029      fi      fi
2030      # Create the object directory.      # Create the object directory.
2031      if test ! -d $output_objdir; then      if test ! -d "$output_objdir"; then
2032        $show "$mkdir $output_objdir"        $show "$mkdir $output_objdir"
2033        $run $mkdir $output_objdir        $run $mkdir $output_objdir
2034        status=$?        exit_status=$?
2035        if test $status -ne 0 && test ! -d $output_objdir; then        if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2036          exit $status          exit $exit_status
2037        fi        fi
2038      fi      fi
2039    
# Line 1294  compiler." Line 2042  compiler."
2042      "")      "")
2043        $echo "$modename: you must specify an output file" 1>&2        $echo "$modename: you must specify an output file" 1>&2
2044        $echo "$help" 1>&2        $echo "$help" 1>&2
2045        exit 1        exit $EXIT_FAILURE
2046        ;;        ;;
2047      *.$libext) linkmode=oldlib ;;      *.$libext) linkmode=oldlib ;;
2048      *.lo | *.$objext) linkmode=obj ;;      *.lo | *.$objext) linkmode=obj ;;
# Line 1302  compiler." Line 2050  compiler."
2050      *) linkmode=prog ;; # Anything else should be a program.      *) linkmode=prog ;; # Anything else should be a program.
2051      esac      esac
2052    
2053        case $host in
2054        *cygwin* | *mingw* | *pw32*)
2055          # don't eliminate duplications in $postdeps and $predeps
2056          duplicate_compiler_generated_deps=yes
2057          ;;
2058        *)
2059          duplicate_compiler_generated_deps=$duplicate_deps
2060          ;;
2061        esac
2062      specialdeplibs=      specialdeplibs=
2063    
2064      libs=      libs=
2065      # Find all interdependent deplibs by searching for libraries      # Find all interdependent deplibs by searching for libraries
2066      # that are linked more than once (e.g. -la -lb -la)      # that are linked more than once (e.g. -la -lb -la)
2067      for deplib in $deplibs; do      for deplib in $deplibs; do
2068        case "$libs " in        if test "X$duplicate_deps" = "Xyes" ; then
2069        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;          case "$libs " in
2070        esac          *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2071            esac
2072          fi
2073        libs="$libs $deplib"        libs="$libs $deplib"
2074      done      done
2075    
2076        if test "$linkmode" = lib; then
2077          libs="$predeps $libs $compiler_lib_search_path $postdeps"
2078    
2079          # Compute libraries that are listed more than once in $predeps
2080          # $postdeps and mark them as special (i.e., whose duplicates are
2081          # not to be eliminated).
2082          pre_post_deps=
2083          if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2084            for pre_post_dep in $predeps $postdeps; do
2085              case "$pre_post_deps " in
2086              *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2087              esac
2088              pre_post_deps="$pre_post_deps $pre_post_dep"
2089            done
2090          fi
2091          pre_post_deps=
2092        fi
2093    
2094      deplibs=      deplibs=
2095      newdependency_libs=      newdependency_libs=
2096      newlib_search_path=      newlib_search_path=
2097      need_relink=no # whether we're linking any uninstalled libtool libraries      need_relink=no # whether we're linking any uninstalled libtool libraries
2098      notinst_deplibs= # not-installed libtool libraries      notinst_deplibs= # not-installed libtool libraries
     notinst_path= # paths that contain not-installed libtool libraries  
2099      case $linkmode in      case $linkmode in
2100      lib)      lib)
2101          passes="conv link"          passes="conv link"
# Line 1326  compiler." Line 2104  compiler."
2104            *.la) ;;            *.la) ;;
2105            *)            *)
2106              $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2              $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2107              exit 1              exit $EXIT_FAILURE
2108              ;;              ;;
2109            esac            esac
2110          done          done
# Line 1343  compiler." Line 2121  compiler."
2121          ;;          ;;
2122      esac      esac
2123      for pass in $passes; do      for pass in $passes; do
2124        if test $linkmode = prog; then        if test "$linkmode,$pass" = "lib,link" ||
2125          # Determine which files to process           test "$linkmode,$pass" = "prog,scan"; then
2126            libs="$deplibs"
2127            deplibs=
2128          fi
2129          if test "$linkmode" = prog; then
2130          case $pass in          case $pass in
2131          dlopen)          dlopen) libs="$dlfiles" ;;
           libs="$dlfiles"  
           save_deplibs="$deplibs" # Collect dlpreopened libraries  
           deplibs=  
           ;;  
2132          dlpreopen) libs="$dlprefiles" ;;          dlpreopen) libs="$dlprefiles" ;;
2133          link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;          link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2134          esac          esac
2135        fi        fi
2136          if test "$pass" = dlopen; then
2137            # Collect dlpreopened libraries
2138            save_deplibs="$deplibs"
2139            deplibs=
2140          fi
2141        for deplib in $libs; do        for deplib in $libs; do
2142          lib=          lib=
2143          found=no          found=no
2144          case $deplib in          case $deplib in
2145          -l*)          -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2146            if test $linkmode = oldlib && test $linkmode = obj; then            if test "$linkmode,$pass" = "prog,link"; then
2147              $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2              compile_deplibs="$deplib $compile_deplibs"
2148              continue              finalize_deplibs="$deplib $finalize_deplibs"
2149              else
2150                compiler_flags="$compiler_flags $deplib"
2151            fi            fi
2152            if test $pass = conv; then            continue
2153              deplibs="$deplib $deplibs"            ;;
2154            -l*)
2155              if test "$linkmode" != lib && test "$linkmode" != prog; then
2156                $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2157              continue              continue
2158            fi            fi
2159            name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`            name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2160            for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do            for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2161              # Search the libtool library              for search_ext in .la $std_shrext .so .a; do
2162              lib="$searchdir/lib${name}.la"                # Search the libtool library
2163              if test -f "$lib"; then                lib="$searchdir/lib${name}${search_ext}"
2164                found=yes                if test -f "$lib"; then
2165                break                  if test "$search_ext" = ".la"; then
2166              fi                    found=yes
2167                    else
2168                      found=no
2169                    fi
2170                    break 2
2171                  fi
2172                done
2173            done            done
2174            if test "$found" != yes; then            if test "$found" != yes; then
2175              # deplib doesn't seem to be a libtool library              # deplib doesn't seem to be a libtool library
# Line 1384  compiler." Line 2178  compiler."
2178                finalize_deplibs="$deplib $finalize_deplibs"                finalize_deplibs="$deplib $finalize_deplibs"
2179              else              else
2180                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2181                test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"                test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2182              fi              fi
2183              continue              continue
2184              else # deplib is a libtool library
2185                # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2186                # We need to do some special things here, and not later.
2187                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2188                  case " $predeps $postdeps " in
2189                  *" $deplib "*)
2190                    if (${SED} -e '2q' $lib |
2191                        grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2192                      library_names=
2193                      old_library=
2194                      case $lib in
2195                      */* | *\\*) . $lib ;;
2196                      *) . ./$lib ;;
2197                      esac
2198                      for l in $old_library $library_names; do
2199                        ll="$l"
2200                      done
2201                      if test "X$ll" = "X$old_library" ; then # only static version available
2202                        found=no
2203                        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2204                        test "X$ladir" = "X$lib" && ladir="."
2205                        lib=$ladir/$old_library
2206                        if test "$linkmode,$pass" = "prog,link"; then
2207                          compile_deplibs="$deplib $compile_deplibs"
2208                          finalize_deplibs="$deplib $finalize_deplibs"
2209                        else
2210                          deplibs="$deplib $deplibs"
2211                          test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2212                        fi
2213                        continue
2214                      fi
2215                    fi
2216                    ;;
2217                  *) ;;
2218                  esac
2219                fi
2220            fi            fi
2221            ;; # -l            ;; # -l
2222          -L*)          -L*)
2223            case $linkmode in            case $linkmode in
2224            lib)            lib)
2225              deplibs="$deplib $deplibs"              deplibs="$deplib $deplibs"
2226              test $pass = conv && continue              test "$pass" = conv && continue
2227              newdependency_libs="$deplib $newdependency_libs"              newdependency_libs="$deplib $newdependency_libs"
2228              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2229              ;;              ;;
2230            prog)            prog)
2231              if test $pass = conv; then              if test "$pass" = conv; then
2232                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2233                continue                continue
2234              fi              fi
2235              if test $pass = scan; then              if test "$pass" = scan; then
2236                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
               newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`  
2237              else              else
2238                compile_deplibs="$deplib $compile_deplibs"                compile_deplibs="$deplib $compile_deplibs"
2239                finalize_deplibs="$deplib $finalize_deplibs"                finalize_deplibs="$deplib $finalize_deplibs"
2240              fi              fi
2241                newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2242              ;;              ;;
2243            *)            *)
2244              $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2              $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2245              ;;              ;;
2246            esac # linkmode            esac # linkmode
2247            continue            continue
2248            ;; # -L            ;; # -L
2249          -R*)          -R*)
2250            if test $pass = link; then            if test "$pass" = link; then
2251              dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`              dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2252              # Make sure the xrpath contains only unique directories.              # Make sure the xrpath contains only unique directories.
2253              case "$xrpath " in              case "$xrpath " in
# Line 1430  compiler." Line 2260  compiler."
2260            ;;            ;;
2261          *.la) lib="$deplib" ;;          *.la) lib="$deplib" ;;
2262          *.$libext)          *.$libext)
2263            if test $pass = conv; then            if test "$pass" = conv; then
2264              deplibs="$deplib $deplibs"              deplibs="$deplib $deplibs"
2265              continue              continue
2266            fi            fi
2267            case $linkmode in            case $linkmode in
2268            lib)            lib)
2269              if test "$deplibs_check_method" != pass_all; then              valid_a_lib=no
2270                echo              case $deplibs_check_method in
2271                echo "*** Warning: This library needs some functionality provided by $deplib."                match_pattern*)
2272                echo "*** I have the capability to make that library automatically link in when"                  set dummy $deplibs_check_method
2273                echo "*** you link to this library.  But I can only do this if you have a"                  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2274                echo "*** shared version of the library, which you do not appear to have."                  if eval $echo \"$deplib\" 2>/dev/null \
2275                        | $SED 10q \
2276                        | $EGREP "$match_pattern_regex" > /dev/null; then
2277                      valid_a_lib=yes
2278                    fi
2279                    ;;
2280                  pass_all)
2281                    valid_a_lib=yes
2282                    ;;
2283                esac
2284                if test "$valid_a_lib" != yes; then
2285                  $echo
2286                  $echo "*** Warning: Trying to link with static lib archive $deplib."
2287                  $echo "*** I have the capability to make that library automatically link in when"
2288                  $echo "*** you link to this library.  But I can only do this if you have a"
2289                  $echo "*** shared version of the library, which you do not appear to have"
2290                  $echo "*** because the file extensions .$libext of this argument makes me believe"
2291                  $echo "*** that it is just a static archive that I should not used here."
2292              else              else
2293                echo                $echo
2294                echo "*** Warning: Linking the shared library $output against the"                $echo "*** Warning: Linking the shared library $output against the"
2295                echo "*** static library $deplib is not portable!"                $echo "*** static library $deplib is not portable!"
2296                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2297              fi              fi
2298              continue              continue
2299              ;;              ;;
2300            prog)            prog)
2301              if test $pass != link; then              if test "$pass" != link; then
2302                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2303              else              else
2304                compile_deplibs="$deplib $compile_deplibs"                compile_deplibs="$deplib $compile_deplibs"
# Line 1462  compiler." Line 2309  compiler."
2309            esac # linkmode            esac # linkmode
2310            ;; # *.$libext            ;; # *.$libext
2311          *.lo | *.$objext)          *.lo | *.$objext)
2312            if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then            if test "$pass" = conv; then
2313              # If there is no dlopen support or we're linking statically,              deplibs="$deplib $deplibs"
2314              # we need to preload.            elif test "$linkmode" = prog; then
2315              newdlprefiles="$newdlprefiles $deplib"              if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2316              compile_deplibs="$deplib $compile_deplibs"                # If there is no dlopen support or we're linking statically,
2317              finalize_deplibs="$deplib $finalize_deplibs"                # we need to preload.
2318            else                newdlprefiles="$newdlprefiles $deplib"
2319              newdlfiles="$newdlfiles $deplib"                compile_deplibs="$deplib $compile_deplibs"
2320                  finalize_deplibs="$deplib $finalize_deplibs"
2321                else
2322                  newdlfiles="$newdlfiles $deplib"
2323                fi
2324            fi            fi
2325            continue            continue
2326            ;;            ;;
# Line 1478  compiler." Line 2329  compiler."
2329            continue            continue
2330            ;;            ;;
2331          esac # case $deplib          esac # case $deplib
2332          if test $found = yes || test -f "$lib"; then :          if test "$found" = yes || test -f "$lib"; then :
2333          else          else
2334            $echo "$modename: cannot find the library \`$lib'" 1>&2            $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2335            exit 1            exit $EXIT_FAILURE
2336          fi          fi
2337    
2338          # Check to see that this really is a libtool archive.          # Check to see that this really is a libtool archive.
2339          if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :          if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2340          else          else
2341            $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2            $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2342            exit 1            exit $EXIT_FAILURE
2343          fi          fi
2344    
2345          ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`          ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
# Line 1501  compiler." Line 2352  compiler."
2352          library_names=          library_names=
2353          old_library=          old_library=
2354          # If the library was installed with an old release of libtool,          # If the library was installed with an old release of libtool,
2355          # it will not redefine variable installed.          # it will not redefine variables installed, or shouldnotlink
2356          installed=yes          installed=yes
2357            shouldnotlink=no
2358            avoidtemprpath=
2359    
2360    
2361          # Read the .la file          # Read the .la file
2362          case $lib in          case $lib in
# Line 1512  compiler." Line 2366  compiler."
2366    
2367          if test "$linkmode,$pass" = "lib,link" ||          if test "$linkmode,$pass" = "lib,link" ||
2368             test "$linkmode,$pass" = "prog,scan" ||             test "$linkmode,$pass" = "prog,scan" ||
2369             { test $linkmode = oldlib && test $linkmode = obj; }; then             { test "$linkmode" != prog && test "$linkmode" != lib; }; then
            # Add dl[pre]opened files of deplib  
2370            test -n "$dlopen" && dlfiles="$dlfiles $dlopen"            test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2371            test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"            test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2372          fi          fi
2373    
2374          if test $pass = conv; then          if test "$pass" = conv; then
2375            # Only check for convenience libraries            # Only check for convenience libraries
2376            deplibs="$lib $deplibs"            deplibs="$lib $deplibs"
2377            if test -z "$libdir"; then            if test -z "$libdir"; then
2378              if test -z "$old_library"; then              if test -z "$old_library"; then
2379                $echo "$modename: cannot find name of link library for \`$lib'" 1>&2                $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2380                exit 1                exit $EXIT_FAILURE
2381              fi              fi
2382              # It is a libtool convenience library, so add in its objects.              # It is a libtool convenience library, so add in its objects.
2383              convenience="$convenience $ladir/$objdir/$old_library"              convenience="$convenience $ladir/$objdir/$old_library"
# Line 1532  compiler." Line 2385  compiler."
2385              tmp_libs=              tmp_libs=
2386              for deplib in $dependency_libs; do              for deplib in $dependency_libs; do
2387                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2388                case "$tmp_libs " in                if test "X$duplicate_deps" = "Xyes" ; then
2389                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;                  case "$tmp_libs " in
2390                esac                  *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2391                    esac
2392                  fi
2393                tmp_libs="$tmp_libs $deplib"                tmp_libs="$tmp_libs $deplib"
2394              done              done
2395            elif test $linkmode != prog && test $linkmode != lib; then            elif test "$linkmode" != prog && test "$linkmode" != lib; then
2396              $echo "$modename: \`$lib' is not a convenience library" 1>&2              $echo "$modename: \`$lib' is not a convenience library" 1>&2
2397              exit 1              exit $EXIT_FAILURE
2398            fi            fi
2399            continue            continue
2400          fi # $pass = conv          fi # $pass = conv
2401    
2402    
2403          # Get the name of the library we link against.          # Get the name of the library we link against.
2404          linklib=          linklib=
2405          for l in $old_library $library_names; do          for l in $old_library $library_names; do
# Line 1551  compiler." Line 2407  compiler."
2407          done          done
2408          if test -z "$linklib"; then          if test -z "$linklib"; then
2409            $echo "$modename: cannot find name of link library for \`$lib'" 1>&2            $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2410            exit 1            exit $EXIT_FAILURE
2411          fi          fi
2412    
2413          # This library was specified with -dlopen.          # This library was specified with -dlopen.
2414          if test $pass = dlopen; then          if test "$pass" = dlopen; then
2415            if test -z "$libdir"; then            if test -z "$libdir"; then
2416              $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2              $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2417              exit 1              exit $EXIT_FAILURE
2418            fi            fi
2419            if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then            if test -z "$dlname" ||
2420                 test "$dlopen_support" != yes ||
2421                 test "$build_libtool_libs" = no; then
2422              # If there is no dlname, no dlopen support or we're linking              # If there is no dlname, no dlopen support or we're linking
2423              # statically, we need to preload.              # statically, we need to preload.  We also need to preload any
2424              dlprefiles="$dlprefiles $lib"              # dependent libraries so libltdl's deplib preloader doesn't
2425                # bomb out in the load deplibs phase.
2426                dlprefiles="$dlprefiles $lib $dependency_libs"
2427            else            else
2428              newdlfiles="$newdlfiles $lib"              newdlfiles="$newdlfiles $lib"
2429            fi            fi
# Line 1595  compiler." Line 2455  compiler."
2455              dir="$libdir"              dir="$libdir"
2456              absdir="$libdir"              absdir="$libdir"
2457            fi            fi
2458              test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2459          else          else
2460            dir="$ladir/$objdir"            if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2461            absdir="$abs_ladir/$objdir"              dir="$ladir"
2462            # Remove this search path later              absdir="$abs_ladir"
2463            notinst_path="$notinst_path $abs_ladir"              # Remove this search path later
2464                notinst_path="$notinst_path $abs_ladir"
2465              else
2466                dir="$ladir/$objdir"
2467                absdir="$abs_ladir/$objdir"
2468                # Remove this search path later
2469                notinst_path="$notinst_path $abs_ladir"
2470              fi
2471          fi # $installed = yes          fi # $installed = yes
2472          name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`          name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2473    
2474          # This library was specified with -dlpreopen.          # This library was specified with -dlpreopen.
2475          if test $pass = dlpreopen; then          if test "$pass" = dlpreopen; then
2476            if test -z "$libdir"; then            if test -z "$libdir"; then
2477              $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2              $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2478              exit 1              exit $EXIT_FAILURE
2479            fi            fi
2480            # Prefer using a static library (so that no silly _DYNAMIC symbols            # Prefer using a static library (so that no silly _DYNAMIC symbols
2481            # are required to link).            # are required to link).
# Line 1623  compiler." Line 2491  compiler."
2491    
2492          if test -z "$libdir"; then          if test -z "$libdir"; then
2493            # Link the convenience library            # Link the convenience library
2494            if test $linkmode = lib; then            if test "$linkmode" = lib; then
2495              deplibs="$dir/$old_library $deplibs"              deplibs="$dir/$old_library $deplibs"
2496            elif test "$linkmode,$pass" = "prog,link"; then            elif test "$linkmode,$pass" = "prog,link"; then
2497              compile_deplibs="$dir/$old_library $compile_deplibs"              compile_deplibs="$dir/$old_library $compile_deplibs"
2498              finalize_deplibs="$dir/$old_library $finalize_deplibs"              finalize_deplibs="$dir/$old_library $finalize_deplibs"
2499            else            else
2500              deplibs="$lib $deplibs"              deplibs="$lib $deplibs" # used for prog,scan pass
2501            fi            fi
2502            continue            continue
2503          fi          fi
2504    
2505          if test $linkmode = prog && test $pass != link; then  
2506            if test "$linkmode" = prog && test "$pass" != link; then
2507            newlib_search_path="$newlib_search_path $ladir"            newlib_search_path="$newlib_search_path $ladir"
2508            deplibs="$lib $deplibs"            deplibs="$lib $deplibs"
2509    
# Line 1650  compiler." Line 2519  compiler."
2519              -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test              -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2520              esac              esac
2521              # Need to link against all dependency_libs?              # Need to link against all dependency_libs?
2522              if test $linkalldeplibs = yes; then              if test "$linkalldeplibs" = yes; then
2523                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2524              else              else
2525                # Need to hardcode shared library paths                # Need to hardcode shared library paths
2526                # or/and link against static libraries                # or/and link against static libraries
2527                newdependency_libs="$deplib $newdependency_libs"                newdependency_libs="$deplib $newdependency_libs"
2528              fi              fi
2529              case "$tmp_libs " in              if test "X$duplicate_deps" = "Xyes" ; then
2530              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;                case "$tmp_libs " in
2531              esac                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2532                  esac
2533                fi
2534              tmp_libs="$tmp_libs $deplib"              tmp_libs="$tmp_libs $deplib"
2535            done # for deplib            done # for deplib
2536            continue            continue
2537          fi # $linkmode = prog...          fi # $linkmode = prog...
2538    
2539          link_static=no # Whether the deplib will be linked statically          if test "$linkmode,$pass" = "prog,link"; then
2540          if test -n "$library_names" &&            if test -n "$library_names" &&
2541             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then               { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2542            # Link against this shared library              # We need to hardcode the library path
2543                if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2544                  # Make sure the rpath contains only unique directories.
2545                  case "$temp_rpath " in
2546                  *" $dir "*) ;;
2547                  *" $absdir "*) ;;
2548                  *) temp_rpath="$temp_rpath $absdir" ;;
2549                  esac
2550                fi
2551    
           if test "$linkmode,$pass" = "prog,link" ||  
            { test $linkmode = lib && test $hardcode_into_libs = yes; }; then  
2552              # Hardcode the library path.              # Hardcode the library path.
2553              # Skip directories that are in the system default run-time              # Skip directories that are in the system default run-time
2554              # search path.              # search path.
# Line 1693  compiler." Line 2570  compiler."
2570                esac                esac
2571                ;;                ;;
2572              esac              esac
             if test $linkmode = prog; then  
               # We need to hardcode the library path  
               if test -n "$shlibpath_var"; then  
                 # Make sure the rpath contains only unique directories.  
                 case "$temp_rpath " in  
                 *" $dir "*) ;;  
                 *" $absdir "*) ;;  
                 *) temp_rpath="$temp_rpath $dir" ;;  
                 esac  
               fi  
             fi  
2573            fi # $linkmode,$pass = prog,link...            fi # $linkmode,$pass = prog,link...
2574    
2575            if test "$alldeplibs" = yes &&            if test "$alldeplibs" = yes &&
# Line 1713  compiler." Line 2579  compiler."
2579              # We only need to search for static libraries              # We only need to search for static libraries
2580              continue              continue
2581            fi            fi
2582            fi
2583    
2584            link_static=no # Whether the deplib will be linked statically
2585            use_static_libs=$prefer_static_libs
2586            if test "$use_static_libs" = built && test "$installed" = yes ; then
2587              use_static_libs=no
2588            fi
2589            if test -n "$library_names" &&
2590               { test "$use_static_libs" = no || test -z "$old_library"; }; then
2591            if test "$installed" = no; then            if test "$installed" = no; then
2592              notinst_deplibs="$notinst_deplibs $lib"              notinst_deplibs="$notinst_deplibs $lib"
2593              need_relink=yes              need_relink=yes
2594            fi            fi
2595              # This is a shared library
2596    
2597              # Warn about portability, can't link against -module's on
2598              # some systems (darwin)
2599              if test "$shouldnotlink" = yes && test "$pass" = link ; then
2600                $echo
2601                if test "$linkmode" = prog; then
2602                  $echo "*** Warning: Linking the executable $output against the loadable module"
2603                else
2604                  $echo "*** Warning: Linking the shared library $output against the loadable module"
2605                fi
2606                $echo "*** $linklib is not portable!"
2607              fi
2608              if test "$linkmode" = lib &&
2609                 test "$hardcode_into_libs" = yes; then
2610                # Hardcode the library path.
2611                # Skip directories that are in the system default run-time
2612                # search path.
2613                case " $sys_lib_dlsearch_path " in
2614                *" $absdir "*) ;;
2615                *)
2616                  case "$compile_rpath " in
2617                  *" $absdir "*) ;;
2618                  *) compile_rpath="$compile_rpath $absdir"
2619                  esac
2620                  ;;
2621                esac
2622                case " $sys_lib_dlsearch_path " in
2623                *" $libdir "*) ;;
2624                *)
2625                  case "$finalize_rpath " in
2626                  *" $libdir "*) ;;
2627                  *) finalize_rpath="$finalize_rpath $libdir"
2628                  esac
2629                  ;;
2630                esac
2631              fi
2632    
2633            if test -n "$old_archive_from_expsyms_cmds"; then            if test -n "$old_archive_from_expsyms_cmds"; then
2634              # figure out the soname              # figure out the soname
# Line 1731  compiler." Line 2642  compiler."
2642              elif test -n "$soname_spec"; then              elif test -n "$soname_spec"; then
2643                # bleh windows                # bleh windows
2644                case $host in                case $host in
2645                *cygwin*)                *cygwin* | mingw*)
2646                  major=`expr $current - $age`                  major=`expr $current - $age`
2647                  versuffix="-$major"                  versuffix="-$major"
2648                  ;;                  ;;
# Line 1743  compiler." Line 2654  compiler."
2654    
2655              # Make a new name for the extract_expsyms_cmds to use              # Make a new name for the extract_expsyms_cmds to use
2656              soroot="$soname"              soroot="$soname"
2657              soname=`echo $soroot | sed -e 's/^.*\///'`              soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2658              newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"              newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2659    
2660              # If the library has no export list, then create one now              # If the library has no export list, then create one now
2661              if test -f "$output_objdir/$soname-def"; then :              if test -f "$output_objdir/$soname-def"; then :
2662              else              else
2663                $show "extracting exported symbol list from \`$soname'"                $show "extracting exported symbol list from \`$soname'"
2664                IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'                save_ifs="$IFS"; IFS='~'
2665                eval cmds=\"$extract_expsyms_cmds\"                cmds=$extract_expsyms_cmds
2666                for cmd in $cmds; do                for cmd in $cmds; do
2667                  IFS="$save_ifs"                  IFS="$save_ifs"
2668                    eval cmd=\"$cmd\"
2669                  $show "$cmd"                  $show "$cmd"
2670                  $run eval "$cmd" || exit $?                  $run eval "$cmd" || exit $?
2671                done                done
# Line 1763  compiler." Line 2675  compiler."
2675              # Create $newlib              # Create $newlib
2676              if test -f "$output_objdir/$newlib"; then :; else              if test -f "$output_objdir/$newlib"; then :; else
2677                $show "generating import library for \`$soname'"                $show "generating import library for \`$soname'"
2678                IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'                save_ifs="$IFS"; IFS='~'
2679                eval cmds=\"$old_archive_from_expsyms_cmds\"                cmds=$old_archive_from_expsyms_cmds
2680                for cmd in $cmds; do                for cmd in $cmds; do
2681                  IFS="$save_ifs"                  IFS="$save_ifs"
2682                    eval cmd=\"$cmd\"
2683                  $show "$cmd"                  $show "$cmd"
2684                  $run eval "$cmd" || exit $?                  $run eval "$cmd" || exit $?
2685                done                done
# Line 1775  compiler." Line 2688  compiler."
2688              # make sure the library variables are pointing to the new library              # make sure the library variables are pointing to the new library
2689              dir=$output_objdir              dir=$output_objdir
2690              linklib=$newlib              linklib=$newlib
2691            fi # test -n $old_archive_from_expsyms_cmds            fi # test -n "$old_archive_from_expsyms_cmds"
2692    
2693            if test $linkmode = prog || test "$mode" != relink; then            if test "$linkmode" = prog || test "$mode" != relink; then
2694              add_shlibpath=              add_shlibpath=
2695              add_dir=              add_dir=
2696              add=              add=
# Line 1786  compiler." Line 2699  compiler."
2699              immediate | unsupported)              immediate | unsupported)
2700                if test "$hardcode_direct" = no; then                if test "$hardcode_direct" = no; then
2701                  add="$dir/$linklib"                  add="$dir/$linklib"
2702                    case $host in
2703                      *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2704                      *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2705                      *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2706                        *-*-unixware7*) add_dir="-L$dir" ;;
2707                      *-*-darwin* )
2708                        # if the lib is a module then we can not link against
2709                        # it, someone is ignoring the new warnings I added
2710                        if /usr/bin/file -L $add 2> /dev/null |
2711                          $EGREP ": [^:]* bundle" >/dev/null ; then
2712                          $echo "** Warning, lib $linklib is a module, not a shared library"
2713                          if test -z "$old_library" ; then
2714                            $echo
2715                            $echo "** And there doesn't seem to be a static archive available"
2716                            $echo "** The link will probably fail, sorry"
2717                          else
2718                            add="$dir/$old_library"
2719                          fi
2720                        fi
2721                    esac
2722                elif test "$hardcode_minus_L" = no; then                elif test "$hardcode_minus_L" = no; then
2723                  case $host in                  case $host in
2724                  *-*-sunos*) add_shlibpath="$dir" ;;                  *-*-sunos*) add_shlibpath="$dir" ;;
# Line 1804  compiler." Line 2737  compiler."
2737                  add="$dir/$linklib"                  add="$dir/$linklib"
2738                elif test "$hardcode_minus_L" = yes; then                elif test "$hardcode_minus_L" = yes; then
2739                  add_dir="-L$dir"                  add_dir="-L$dir"
2740                    # Try looking first in the location we're being installed to.
2741                    if test -n "$inst_prefix_dir"; then
2742                      case $libdir in
2743                        [\\/]*)
2744                          add_dir="$add_dir -L$inst_prefix_dir$libdir"
2745                          ;;
2746                      esac
2747                    fi
2748                  add="-l$name"                  add="-l$name"
2749                elif test "$hardcode_shlibpath_var" = yes; then                elif test "$hardcode_shlibpath_var" = yes; then
2750                  add_shlibpath="$dir"                  add_shlibpath="$dir"
# Line 1817  compiler." Line 2758  compiler."
2758    
2759              if test "$lib_linked" != yes; then              if test "$lib_linked" != yes; then
2760                $echo "$modename: configuration error: unsupported hardcode properties"                $echo "$modename: configuration error: unsupported hardcode properties"
2761                exit 1                exit $EXIT_FAILURE
2762              fi              fi
2763    
2764              if test -n "$add_shlibpath"; then              if test -n "$add_shlibpath"; then
# Line 1826  compiler." Line 2767  compiler."
2767                *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;                *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2768                esac                esac
2769              fi              fi
2770              if test $linkmode = prog; then              if test "$linkmode" = prog; then
2771                test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"                test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2772                test -n "$add" && compile_deplibs="$add $compile_deplibs"                test -n "$add" && compile_deplibs="$add $compile_deplibs"
2773              else              else
# Line 1843  compiler." Line 2784  compiler."
2784              fi              fi
2785            fi            fi
2786    
2787            if test $linkmode = prog || test "$mode" = relink; then            if test "$linkmode" = prog || test "$mode" = relink; then
2788              add_shlibpath=              add_shlibpath=
2789              add_dir=              add_dir=
2790              add=              add=
# Line 1859  compiler." Line 2800  compiler."
2800                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2801                esac                esac
2802                add="-l$name"                add="-l$name"
2803                elif test "$hardcode_automatic" = yes; then
2804                  if test -n "$inst_prefix_dir" &&
2805                     test -f "$inst_prefix_dir$libdir/$linklib" ; then
2806                    add="$inst_prefix_dir$libdir/$linklib"
2807                  else
2808                    add="$libdir/$linklib"
2809                  fi
2810              else              else
2811                # We cannot seem to hardcode it, guess we'll fake it.                # We cannot seem to hardcode it, guess we'll fake it.
2812                add_dir="-L$libdir"                add_dir="-L$libdir"
2813                  # Try looking first in the location we're being installed to.
2814                  if test -n "$inst_prefix_dir"; then
2815                    case $libdir in
2816                      [\\/]*)
2817                        add_dir="$add_dir -L$inst_prefix_dir$libdir"
2818                        ;;
2819                    esac
2820                  fi
2821                add="-l$name"                add="-l$name"
2822              fi              fi
2823    
2824              if test $linkmode = prog; then              if test "$linkmode" = prog; then
2825                test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"                test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2826                test -n "$add" && finalize_deplibs="$add $finalize_deplibs"                test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2827              else              else
# Line 1873  compiler." Line 2829  compiler."
2829                test -n "$add" && deplibs="$add $deplibs"                test -n "$add" && deplibs="$add $deplibs"
2830              fi              fi
2831            fi            fi
2832          elif test $linkmode = prog; then          elif test "$linkmode" = prog; then
           if test "$alldeplibs" = yes &&  
              { test "$deplibs_check_method" = pass_all ||  
                { test "$build_libtool_libs" = yes &&  
                  test -n "$library_names"; }; }; then  
             # We only need to search for static libraries  
             continue  
           fi  
   
           # Try to link the static library  
2833            # Here we assume that one of hardcode_direct or hardcode_minus_L            # Here we assume that one of hardcode_direct or hardcode_minus_L
2834            # is not unsupported.  This is valid on all known static and            # is not unsupported.  This is valid on all known static and
2835            # shared platforms.            # shared platforms.
# Line 1902  compiler." Line 2849  compiler."
2849    
2850              # Just print a warning and add the library to dependency_libs so              # Just print a warning and add the library to dependency_libs so
2851              # that the program can be linked against the static library.              # that the program can be linked against the static library.
2852              echo              $echo
2853              echo "*** Warning: This library needs some functionality provided by $lib."              $echo "*** Warning: This system can not link to static lib archive $lib."
2854              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"
2855              echo "*** you link to this library.  But I can only do this if you have a"              $echo "*** you link to this library.  But I can only do this if you have a"
2856              echo "*** shared version of the library, which you do not appear to have."              $echo "*** shared version of the library, which you do not appear to have."
2857              if test "$module" = yes; then              if test "$module" = yes; then
2858                echo "*** Therefore, libtool will create a static module, that should work "                $echo "*** But as you try to build a module library, libtool will still create "
2859                echo "*** as long as the dlopening application is linked with the -dlopen flag."                $echo "*** a static module, that should work as long as the dlopening application"
2860                  $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2861                if test -z "$global_symbol_pipe"; then                if test -z "$global_symbol_pipe"; then
2862                  echo                  $echo
2863                  echo "*** However, this would only work if libtool was able to extract symbol"                  $echo "*** However, this would only work if libtool was able to extract symbol"
2864                  echo "*** lists from a program, using \`nm' or equivalent, but libtool could"                  $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2865                  echo "*** not find such a program.  So, this module is probably useless."                  $echo "*** not find such a program.  So, this module is probably useless."
2866                  echo "*** \`nm' from GNU binutils and a full rebuild may help."                  $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2867                fi                fi
2868                if test "$build_old_libs" = no; then                if test "$build_old_libs" = no; then
2869                  build_libtool_libs=module                  build_libtool_libs=module
2870                  build_old_libs=yes                  build_old_libs=yes
2871                else                else
2872                  build_libtool_libs=no                  build_libtool_libs=no
2873                fi                fi
2874              fi              fi
2875            else            else
             convenience="$convenience $dir/$old_library"  
             old_convenience="$old_convenience $dir/$old_library"  
2876              deplibs="$dir/$old_library $deplibs"              deplibs="$dir/$old_library $deplibs"
2877              link_static=yes              link_static=yes
2878            fi            fi
2879          fi # link shared/static library?          fi # link shared/static library?
2880    
2881          if test $linkmode = lib; then          if test "$linkmode" = lib; then
2882            if test -n "$dependency_libs" &&            if test -n "$dependency_libs" &&
2883               { test $hardcode_into_libs != yes || test $build_old_libs = yes ||               { test "$hardcode_into_libs" != yes ||
2884                 test $link_static = yes; }; then                 test "$build_old_libs" = yes ||
2885                   test "$link_static" = yes; }; then
2886              # Extract -R from dependency_libs              # Extract -R from dependency_libs
2887              temp_deplibs=              temp_deplibs=
2888              for libdir in $dependency_libs; do              for libdir in $dependency_libs; do
# Line 1958  compiler." Line 2905  compiler."
2905            tmp_libs=            tmp_libs=
2906            for deplib in $dependency_libs; do            for deplib in $dependency_libs; do
2907              newdependency_libs="$deplib $newdependency_libs"              newdependency_libs="$deplib $newdependency_libs"
2908              case "$tmp_libs " in              if test "X$duplicate_deps" = "Xyes" ; then
2909              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;                case "$tmp_libs " in
2910              esac                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2911                  esac
2912                fi
2913              tmp_libs="$tmp_libs $deplib"              tmp_libs="$tmp_libs $deplib"
2914            done            done
2915    
2916            if test $link_all_deplibs != no; then            if test "$link_all_deplibs" != no; then
2917              # Add the search paths of all dependency libraries              # Add the search paths of all dependency libraries
2918              for deplib in $dependency_libs; do              for deplib in $dependency_libs; do
2919                case $deplib in                case $deplib in
# Line 1984  compiler." Line 2933  compiler."
2933                    ;;                    ;;
2934                  esac                  esac
2935                  if grep "^installed=no" $deplib > /dev/null; then                  if grep "^installed=no" $deplib > /dev/null; then
2936                    path="-L$absdir/$objdir"                    path="$absdir/$objdir"
2937                  else                  else
2938                    eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`                    eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2939                    if test -z "$libdir"; then                    if test -z "$libdir"; then
2940                      $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2                      $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2941                      exit 1                      exit $EXIT_FAILURE
2942                    fi                    fi
2943                    if test "$absdir" != "$libdir"; then                    if test "$absdir" != "$libdir"; then
2944                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2945                    fi                    fi
2946                    path="-L$absdir"                    path="$absdir"
2947                  fi                  fi
2948                    depdepl=
2949                    case $host in
2950                    *-*-darwin*)
2951                      # we do not want to link against static libs,
2952                      # but need to link against shared
2953                      eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2954                      if test -n "$deplibrary_names" ; then
2955                        for tmp in $deplibrary_names ; do
2956                          depdepl=$tmp
2957                        done
2958                        if test -f "$path/$depdepl" ; then
2959                          depdepl="$path/$depdepl"
2960                        fi
2961                        # do not add paths which are already there
2962                        case " $newlib_search_path " in
2963                        *" $path "*) ;;
2964                        *) newlib_search_path="$newlib_search_path $path";;
2965                        esac
2966                      fi
2967                      path=""
2968                      ;;
2969                    *)
2970                      path="-L$path"
2971                      ;;
2972                    esac
2973                    ;;
2974                  -l*)
2975                    case $host in
2976                    *-*-darwin*)
2977                      # Again, we only want to link against shared libraries
2978                      eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2979                      for tmp in $newlib_search_path ; do
2980                        if test -f "$tmp/lib$tmp_libs.dylib" ; then
2981                          eval depdepl="$tmp/lib$tmp_libs.dylib"
2982                          break
2983                        fi
2984                      done
2985                      path=""
2986                      ;;
2987                    *) continue ;;
2988                    esac
2989                  ;;                  ;;
2990                *) continue ;;                *) continue ;;
2991                esac                esac
2992                case " $deplibs " in                case " $deplibs " in
2993                *" $path "*) ;;                *" $path "*) ;;
2994                *) deplibs="$deplibs $path" ;;                *) deplibs="$path $deplibs" ;;
2995                  esac
2996                  case " $deplibs " in
2997                  *" $depdepl "*) ;;
2998                  *) deplibs="$depdepl $deplibs" ;;
2999                esac                esac
3000              done              done
3001            fi # link_all_deplibs != no            fi # link_all_deplibs != no
3002          fi # linkmode = lib          fi # linkmode = lib
3003        done # for deplib in $libs        done # for deplib in $libs
3004        if test $pass = dlpreopen; then        dependency_libs="$newdependency_libs"
3005          if test "$pass" = dlpreopen; then
3006          # Link the dlpreopened libraries before other libraries          # Link the dlpreopened libraries before other libraries
3007          for deplib in $save_deplibs; do          for deplib in $save_deplibs; do
3008            deplibs="$deplib $deplibs"            deplibs="$deplib $deplibs"
3009          done          done
3010        fi        fi
3011        if test $pass != dlopen; then        if test "$pass" != dlopen; then
3012          test $pass != scan && dependency_libs="$newdependency_libs"          if test "$pass" != conv; then
         if test $pass != conv; then  
3013            # Make sure lib_search_path contains only unique directories.            # Make sure lib_search_path contains only unique directories.
3014            lib_search_path=            lib_search_path=
3015            for dir in $newlib_search_path; do            for dir in $newlib_search_path; do
# Line 2037  compiler." Line 3031  compiler."
3031            eval tmp_libs=\"\$$var\"            eval tmp_libs=\"\$$var\"
3032            new_libs=            new_libs=
3033            for deplib in $tmp_libs; do            for deplib in $tmp_libs; do
3034                # FIXME: Pedantically, this is the right thing to do, so
3035                #        that some nasty dependency loop isn't accidentally
3036                #        broken:
3037                #new_libs="$deplib $new_libs"
3038                # Pragmatically, this seems to cause very few problems in
3039                # practice:
3040              case $deplib in              case $deplib in
3041              -L*) new_libs="$deplib $new_libs" ;;              -L*) new_libs="$deplib $new_libs" ;;
3042                -R*) ;;
3043              *)              *)
3044                  # And here is the reason: when a library appears more
3045                  # than once as an explicit dependence of a library, or
3046                  # is implicitly linked in more than once by the
3047                  # compiler, it is considered special, and multiple
3048                  # occurrences thereof are not removed.  Compare this
3049                  # with having the same library being listed as a
3050                  # dependency of multiple other libraries: in this case,
3051                  # we know (pedantically, we assume) the library does not
3052                  # need to be listed more than once, so we keep only the
3053                  # last copy.  This is not always right, but it is rare
3054                  # enough that we require users that really mean to play
3055                  # such unportable linking tricks to link the library
3056                  # using -Wl,-lname, so that libtool does not consider it
3057                  # for duplicate removal.
3058                case " $specialdeplibs " in                case " $specialdeplibs " in
3059                *" $deplib "*) new_libs="$deplib $new_libs" ;;                *" $deplib "*) new_libs="$deplib $new_libs" ;;
3060                *)                *)
# Line 2067  compiler." Line 3082  compiler."
3082            eval $var=\"$tmp_libs\"            eval $var=\"$tmp_libs\"
3083          done # for var          done # for var
3084        fi        fi
3085        if test "$pass" = "conv" &&        # Last step: remove runtime libs from dependency_libs
3086         { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then        # (they stay in deplibs)
3087          libs="$deplibs" # reset libs        tmp_libs=
3088          deplibs=        for i in $dependency_libs ; do
3089        fi          case " $predeps $postdeps $compiler_lib_search_path " in
3090            *" $i "*)
3091              i=""
3092              ;;
3093            esac
3094            if test -n "$i" ; then
3095              tmp_libs="$tmp_libs $i"
3096            fi
3097          done
3098          dependency_libs=$tmp_libs
3099      done # for pass      done # for pass
3100      if test $linkmode = prog; then      if test "$linkmode" = prog; then
3101        dlfiles="$newdlfiles"        dlfiles="$newdlfiles"
3102        dlprefiles="$newdlprefiles"        dlprefiles="$newdlprefiles"
3103      fi      fi
3104    
3105      case $linkmode in      case $linkmode in
3106      oldlib)      oldlib)
3107          if test -n "$deplibs"; then
3108            $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3109          fi
3110    
3111        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3112          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3113        fi        fi
# Line 2093  compiler." Line 3121  compiler."
3121        fi        fi
3122    
3123        if test -n "$vinfo"; then        if test -n "$vinfo"; then
3124          $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2          $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3125        fi        fi
3126    
3127        if test -n "$release"; then        if test -n "$release"; then
# Line 2115  compiler." Line 3143  compiler."
3143        case $outputname in        case $outputname in
3144        lib*)        lib*)
3145          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3146            eval shared_ext=\"$shrext_cmds\"
3147          eval libname=\"$libname_spec\"          eval libname=\"$libname_spec\"
3148          ;;          ;;
3149        *)        *)
3150          if test "$module" = no; then          if test "$module" = no; then
3151            $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2            $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3152            $echo "$help" 1>&2            $echo "$help" 1>&2
3153            exit 1            exit $EXIT_FAILURE
3154          fi          fi
3155          if test "$need_lib_prefix" != no; then          if test "$need_lib_prefix" != no; then
3156            # Add the "lib" prefix for modules if required            # Add the "lib" prefix for modules if required
3157            name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`            name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3158              eval shared_ext=\"$shrext_cmds\"
3159            eval libname=\"$libname_spec\"            eval libname=\"$libname_spec\"
3160          else          else
3161            libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`            libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
# Line 2136  compiler." Line 3166  compiler."
3166        if test -n "$objs"; then        if test -n "$objs"; then
3167          if test "$deplibs_check_method" != pass_all; then          if test "$deplibs_check_method" != pass_all; then
3168            $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
3169            exit 1            exit $EXIT_FAILURE
3170          else          else
3171            echo            $echo
3172            echo "*** Warning: Linking the shared library $output against the non-libtool"            $echo "*** Warning: Linking the shared library $output against the non-libtool"
3173            echo "*** objects $objs is not portable!"            $echo "*** objects $objs is not portable!"
3174            libobjs="$libobjs $objs"            libobjs="$libobjs $objs"
3175          fi          fi
3176        fi        fi
# Line 2150  compiler." Line 3180  compiler."
3180        fi        fi
3181    
3182        set dummy $rpath        set dummy $rpath
3183        if test $# -gt 2; then        if test "$#" -gt 2; then
3184          $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2          $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3185        fi        fi
3186        install_libdir="$2"        install_libdir="$2"
# Line 2159  compiler." Line 3189  compiler."
3189        if test -z "$rpath"; then        if test -z "$rpath"; then
3190          if test "$build_libtool_libs" = yes; then          if test "$build_libtool_libs" = yes; then
3191            # Building a libtool convenience library.            # Building a libtool convenience library.
3192            libext=al            # Some compilers have problems with a `.al' extension so
3193              # convenience libraries should have the same extension an
3194              # archive normally would.
3195            oldlibs="$output_objdir/$libname.$libext $oldlibs"            oldlibs="$output_objdir/$libname.$libext $oldlibs"
3196            build_libtool_libs=convenience            build_libtool_libs=convenience
3197            build_old_libs=yes            build_old_libs=yes
3198          fi          fi
3199    
3200          if test -n "$vinfo"; then          if test -n "$vinfo"; then
3201            $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2            $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3202          fi          fi
3203    
3204          if test -n "$release"; then          if test -n "$release"; then
# Line 2175  compiler." Line 3207  compiler."
3207        else        else
3208    
3209          # Parse the version information argument.          # Parse the version information argument.
3210          IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'          save_ifs="$IFS"; IFS=':'
3211          set dummy $vinfo 0 0 0          set dummy $vinfo 0 0 0
3212          IFS="$save_ifs"          IFS="$save_ifs"
3213    
3214          if test -n "$8"; then          if test -n "$8"; then
3215            $echo "$modename: too many parameters to \`-version-info'" 1>&2            $echo "$modename: too many parameters to \`-version-info'" 1>&2
3216            $echo "$help" 1>&2            $echo "$help" 1>&2
3217            exit 1            exit $EXIT_FAILURE
3218          fi          fi
3219    
3220          current="$2"          # convert absolute version numbers to libtool ages
3221          revision="$3"          # this retains compatibility with .la files and attempts
3222          age="$4"          # to make the code below a bit more comprehensible
3223    
3224            case $vinfo_number in
3225            yes)
3226              number_major="$2"
3227              number_minor="$3"
3228              number_revision="$4"
3229              #
3230              # There are really only two kinds -- those that
3231              # use the current revision as the major version
3232              # and those that subtract age and use age as
3233              # a minor version.  But, then there is irix
3234              # which has an extra 1 added just for fun
3235              #
3236              case $version_type in
3237              darwin|linux|osf|windows)
3238                current=`expr $number_major + $number_minor`
3239                age="$number_minor"
3240                revision="$number_revision"
3241                ;;
3242              freebsd-aout|freebsd-elf|sunos)
3243                current="$number_major"
3244                revision="$number_minor"
3245                age="0"
3246                ;;
3247              irix|nonstopux)
3248                current=`expr $number_major + $number_minor - 1`
3249                age="$number_minor"
3250                revision="$number_minor"
3251                ;;
3252              esac
3253              ;;
3254            no)
3255              current="$2"
3256              revision="$3"
3257              age="$4"
3258              ;;
3259            esac
3260    
3261          # Check that each of the things are valid numbers.          # Check that each of the things are valid numbers.
3262          case $current in          case $current in
3263          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]) ;;
3264          *)          *)
3265            $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2            $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3266            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3267            exit 1            exit $EXIT_FAILURE
3268            ;;            ;;
3269          esac          esac
3270    
3271          case $revision in          case $revision in
3272          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]) ;;
3273          *)          *)
3274            $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2            $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3275            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3276            exit 1            exit $EXIT_FAILURE
3277            ;;            ;;
3278          esac          esac
3279    
3280          case $age in          case $age in
3281          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]) ;;
3282          *)          *)
3283            $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2            $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3284            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3285            exit 1            exit $EXIT_FAILURE
3286            ;;            ;;
3287          esac          esac
3288    
3289          if test $age -gt $current; then          if test "$age" -gt "$current"; then
3290            $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
3291            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3292            exit 1            exit $EXIT_FAILURE
3293          fi          fi
3294    
3295          # Calculate the version variables.          # Calculate the version variables.
# Line 2237  compiler." Line 3306  compiler."
3306            versuffix="$major.$age.$revision"            versuffix="$major.$age.$revision"
3307            # Darwin ld doesn't like 0 for these options...            # Darwin ld doesn't like 0 for these options...
3308            minor_current=`expr $current + 1`            minor_current=`expr $current + 1`
3309            verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"            verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3310            ;;            ;;
3311    
3312          freebsd-aout)          freebsd-aout)
# Line 2250  compiler." Line 3319  compiler."
3319            versuffix=".$current";            versuffix=".$current";
3320            ;;            ;;
3321    
3322          irix)          irix | nonstopux)
3323            major=`expr $current - $age + 1`            major=`expr $current - $age + 1`
3324            verstring="sgi$major.$revision"  
3325              case $version_type in
3326                nonstopux) verstring_prefix=nonstopux ;;
3327                *)         verstring_prefix=sgi ;;
3328              esac
3329              verstring="$verstring_prefix$major.$revision"
3330    
3331            # Add in all the interfaces that we are compatible with.            # Add in all the interfaces that we are compatible with.
3332            loop=$revision            loop=$revision
3333            while test $loop != 0; do            while test "$loop" -ne 0; do
3334              iface=`expr $revision - $loop`              iface=`expr $revision - $loop`
3335              loop=`expr $loop - 1`              loop=`expr $loop - 1`
3336              verstring="sgi$major.$iface:$verstring"              verstring="$verstring_prefix$major.$iface:$verstring"
3337            done            done
3338    
3339            # Before this point, $major must not contain `.'.            # Before this point, $major must not contain `.'.
# Line 2273  compiler." Line 3347  compiler."
3347            ;;            ;;
3348    
3349          osf)          osf)
3350            major=`expr $current - $age`            major=.`expr $current - $age`
3351            versuffix=".$current.$age.$revision"            versuffix=".$current.$age.$revision"
3352            verstring="$current.$age.$revision"            verstring="$current.$age.$revision"
3353    
3354            # Add in all the interfaces that we are compatible with.            # Add in all the interfaces that we are compatible with.
3355            loop=$age            loop=$age
3356            while test $loop != 0; do            while test "$loop" -ne 0; do
3357              iface=`expr $current - $loop`              iface=`expr $current - $loop`
3358              loop=`expr $loop - 1`              loop=`expr $loop - 1`
3359              verstring="$verstring:${iface}.0"              verstring="$verstring:${iface}.0"
# Line 2303  compiler." Line 3377  compiler."
3377    
3378          *)          *)
3379            $echo "$modename: unknown library version type \`$version_type'" 1>&2            $echo "$modename: unknown library version type \`$version_type'" 1>&2
3380            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
3381            exit 1            exit $EXIT_FAILURE
3382            ;;            ;;
3383          esac          esac
3384    
3385          # Clear the version info if we defaulted, and they specified a release.          # Clear the version info if we defaulted, and they specified a release.
3386          if test -z "$vinfo" && test -n "$release"; then          if test -z "$vinfo" && test -n "$release"; then
3387            major=            major=
3388            verstring="0.0"            case $version_type in
3389              darwin)
3390                # we can't check for "0.0" in archive_cmds due to quoting
3391                # problems, so we reset it completely
3392                verstring=
3393                ;;
3394              *)
3395                verstring="0.0"
3396                ;;
3397              esac
3398            if test "$need_version" = no; then            if test "$need_version" = no; then
3399              versuffix=              versuffix=
3400            else            else
# Line 2340  compiler." Line 3423  compiler."
3423        fi        fi
3424    
3425        if test "$mode" != relink; then        if test "$mode" != relink; then
3426          # Remove our outputs.          # Remove our outputs, but don't remove object files since they
3427          $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"          # may have been created when compiling PIC objects.
3428          $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*          removelist=
3429            tempremovelist=`$echo "$output_objdir/*"`
3430            for p in $tempremovelist; do
3431              case $p in
3432                *.$objext)
3433                   ;;
3434                $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3435                   if test "X$precious_files_regex" != "X"; then
3436                     if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3437                     then
3438                       continue
3439                     fi
3440                   fi
3441                   removelist="$removelist $p"
3442                   ;;
3443                *) ;;
3444              esac
3445            done
3446            if test -n "$removelist"; then
3447              $show "${rm}r $removelist"
3448              $run ${rm}r $removelist
3449            fi
3450        fi        fi
3451    
3452        # Now set the variables for building old libraries.        # Now set the variables for building old libraries.
# Line 2355  compiler." Line 3459  compiler."
3459    
3460        # Eliminate all temporary directories.        # Eliminate all temporary directories.
3461        for path in $notinst_path; do        for path in $notinst_path; do
3462          lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`          lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3463          deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`          deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3464          dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`          dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3465        done        done
3466    
3467        if test -n "$xrpath"; then        if test -n "$xrpath"; then
# Line 2370  compiler." Line 3474  compiler."
3474            *) finalize_rpath="$finalize_rpath $libdir" ;;            *) finalize_rpath="$finalize_rpath $libdir" ;;
3475            esac            esac
3476          done          done
3477          if test $hardcode_into_libs != yes || test $build_old_libs = yes; then          if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3478            dependency_libs="$temp_xrpath $dependency_libs"            dependency_libs="$temp_xrpath $dependency_libs"
3479          fi          fi
3480        fi        fi
# Line 2408  compiler." Line 3512  compiler."
3512            *-*-netbsd*)            *-*-netbsd*)
3513              # 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.
3514              ;;              ;;
3515            *)            *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3516                # Do not include libc due to us having libc/libc_r.
3517                ;;
3518              *-*-sco3.2v5* | *-*-sco5v6*)
3519                # Causes problems with __ctype
3520                ;;
3521              *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3522                # Compiler inserts libc in the correct place for threads to work
3523                ;;
3524              *)
3525              # Add libc to deplibs on all other systems if necessary.              # Add libc to deplibs on all other systems if necessary.
3526              if test $build_libtool_need_lc = "yes"; then              if test "$build_libtool_need_lc" = "yes"; then
3527                deplibs="$deplibs -lc"                deplibs="$deplibs -lc"
3528              fi              fi
3529              ;;              ;;
# Line 2437  compiler." Line 3550  compiler."
3550            # This might be a little naive.  We might want to check            # This might be a little naive.  We might want to check
3551            # whether the library exists or not.  But this is on            # whether the library exists or not.  But this is on
3552            # osf3 & osf4 and I'm not really sure... Just            # osf3 & osf4 and I'm not really sure... Just
3553            # implementing what was already the behaviour.            # implementing what was already the behavior.
3554            newdeplibs=$deplibs            newdeplibs=$deplibs
3555            ;;            ;;
3556          test_compile)          test_compile)
# Line 2450  compiler." Line 3563  compiler."
3563            int main() { return 0; }            int main() { return 0; }
3564  EOF  EOF
3565            $rm conftest            $rm conftest
3566            $CC -o conftest conftest.c $deplibs            $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3567            if test $? -eq 0 ; then            if test "$?" -eq 0 ; then
3568              ldd_output=`ldd conftest`              ldd_output=`ldd conftest`
3569              for i in $deplibs; do              for i in $deplibs; do
3570                name="`expr $i : '-l\(.*\)'`"                name=`expr $i : '-l\(.*\)'`
3571                # If $name is empty we are operating on a -L argument.                # If $name is empty we are operating on a -L argument.
3572                if test -n "$name" && test "$name" != "0"; then                if test "$name" != "" && test "$name" -ne "0"; then
3573                  libname=`eval \\$echo \"$libname_spec\"`                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3574                  deplib_matches=`eval \\$echo \"$library_names_spec\"`                    case " $predeps $postdeps " in
3575                  set dummy $deplib_matches                    *" $i "*)
3576                  deplib_match=$2                      newdeplibs="$newdeplibs $i"
3577                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then                      i=""
3578                    newdeplibs="$newdeplibs $i"                      ;;
3579                  else                    esac
3580                    droppeddeps=yes                  fi
3581                    echo                  if test -n "$i" ; then
3582                    echo "*** Warning: This library needs some functionality provided by $i."                    libname=`eval \\$echo \"$libname_spec\"`
3583                    echo "*** I have the capability to make that library automatically link in when"                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3584                    echo "*** you link to this library.  But I can only do this if you have a"                    set dummy $deplib_matches
3585                    echo "*** shared version of the library, which you do not appear to have."                    deplib_match=$2
3586                      if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3587                        newdeplibs="$newdeplibs $i"
3588                      else
3589                        droppeddeps=yes
3590                        $echo
3591                        $echo "*** Warning: dynamic linker does not accept needed library $i."
3592                        $echo "*** I have the capability to make that library automatically link in when"
3593                        $echo "*** you link to this library.  But I can only do this if you have a"
3594                        $echo "*** shared version of the library, which I believe you do not have"
3595                        $echo "*** because a test_compile did reveal that the linker did not use it for"
3596                        $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3597                      fi
3598                  fi                  fi
3599                else                else
3600                  newdeplibs="$newdeplibs $i"                  newdeplibs="$newdeplibs $i"
3601                fi                fi
3602              done              done
3603            else            else
3604              # Error occured in the first compile.  Let's try to salvage the situation:              # Error occurred in the first compile.  Let's try to salvage
3605              # Compile a seperate program for each library.              # the situation: Compile a separate program for each library.
3606              for i in $deplibs; do              for i in $deplibs; do
3607                name="`expr $i : '-l\(.*\)'`"                name=`expr $i : '-l\(.*\)'`
3608               # If $name is empty we are operating on a -L argument.                # If $name is empty we are operating on a -L argument.
3609                if test -n "$name" && test "$name" != "0"; then                if test "$name" != "" && test "$name" != "0"; then
3610                  $rm conftest                  $rm conftest
3611                  $CC -o conftest conftest.c $i                  $LTCC $LTCFLAGS -o conftest conftest.c $i
3612                  # Did it work?                  # Did it work?
3613                  if test $? -eq 0 ; then                  if test "$?" -eq 0 ; then
3614                    ldd_output=`ldd conftest`                    ldd_output=`ldd conftest`
3615                    libname=`eval \\$echo \"$libname_spec\"`                    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3616                    deplib_matches=`eval \\$echo \"$library_names_spec\"`                      case " $predeps $postdeps " in
3617                    set dummy $deplib_matches                      *" $i "*)
3618                    deplib_match=$2                        newdeplibs="$newdeplibs $i"
3619                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then                        i=""
3620                      newdeplibs="$newdeplibs $i"                        ;;
3621                    else                      esac
3622                      droppeddeps=yes                    fi
3623                      echo                    if test -n "$i" ; then
3624                      echo "*** Warning: This library needs some functionality provided by $i."                      libname=`eval \\$echo \"$libname_spec\"`
3625                      echo "*** I have the capability to make that library automatically link in when"                      deplib_matches=`eval \\$echo \"$library_names_spec\"`
3626                      echo "*** you link to this library.  But I can only do this if you have a"                      set dummy $deplib_matches
3627                      echo "*** shared version of the library, which you do not appear to have."                      deplib_match=$2
3628                        if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3629                          newdeplibs="$newdeplibs $i"
3630                        else
3631                          droppeddeps=yes
3632                          $echo
3633                          $echo "*** Warning: dynamic linker does not accept needed library $i."
3634                          $echo "*** I have the capability to make that library automatically link in when"
3635                          $echo "*** you link to this library.  But I can only do this if you have a"
3636                          $echo "*** shared version of the library, which you do not appear to have"
3637                          $echo "*** because a test_compile did reveal that the linker did not use this one"
3638                          $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3639                        fi
3640                    fi                    fi
3641                  else                  else
3642                    droppeddeps=yes                    droppeddeps=yes
3643                    echo                    $echo
3644                    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"
3645                    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"
3646                    echo "*** library that it depends on before this library will be fully"                    $echo "*** library that it depends on before this library will be fully"
3647                    echo "*** functional.  Installing it before continuing would be even better."                    $echo "*** functional.  Installing it before continuing would be even better."
3648                  fi                  fi
3649                else                else
3650                  newdeplibs="$newdeplibs $i"                  newdeplibs="$newdeplibs $i"
# Line 2519  EOF Line 3656  EOF
3656            set dummy $deplibs_check_method            set dummy $deplibs_check_method
3657            file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`            file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3658            for a_deplib in $deplibs; do            for a_deplib in $deplibs; do
3659              name="`expr $a_deplib : '-l\(.*\)'`"              name=`expr $a_deplib : '-l\(.*\)'`
3660              # If $name is empty we are operating on a -L argument.              # If $name is empty we are operating on a -L argument.
3661              if test -n "$name" && test "$name" != "0"; then              if test "$name" != "" && test  "$name" != "0"; then
3662                libname=`eval \\$echo \"$libname_spec\"`                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3663                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do                  case " $predeps $postdeps " in
3664                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`                  *" $a_deplib "*)
3665                      for potent_lib in $potential_libs; do                    newdeplibs="$newdeplibs $a_deplib"
3666                      a_deplib=""
3667                      ;;
3668                    esac
3669                  fi
3670                  if test -n "$a_deplib" ; then
3671                    libname=`eval \\$echo \"$libname_spec\"`
3672                    for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3673                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3674                      for potent_lib in $potential_libs; do
3675                        # Follow soft links.                        # Follow soft links.
3676                        if ls -lLd "$potent_lib" 2>/dev/null \                        if ls -lLd "$potent_lib" 2>/dev/null \
3677                           | grep " -> " >/dev/null; then                           | grep " -> " >/dev/null; then
# Line 2538  EOF Line 3684  EOF
3684                        # but so what?                        # but so what?
3685                        potlib="$potent_lib"                        potlib="$potent_lib"
3686                        while test -h "$potlib" 2>/dev/null; do                        while test -h "$potlib" 2>/dev/null; do
3687                          potliblink=`ls -ld $potlib | sed 's/.* -> //'`                          potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3688                          case $potliblink in                          case $potliblink in
3689                          [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;                          [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3690                          *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;                          *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3691                          esac                          esac
3692                        done                        done
3693                          # It is ok to link against an archive when
3694                          # building a shared library.
3695                          if $AR -t $potlib > /dev/null 2>&1; then
3696                            newdeplibs="$newdeplibs $a_deplib"
3697                            a_deplib=""
3698                            break 2
3699                          fi
3700                        if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \                        if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3701                           | sed 10q \                           | ${SED} 10q \
3702                           | egrep "$file_magic_regex" > /dev/null; then                           | $EGREP "$file_magic_regex" > /dev/null; then
3703                          newdeplibs="$newdeplibs $a_deplib"                          newdeplibs="$newdeplibs $a_deplib"
3704                          a_deplib=""                          a_deplib=""
3705                          break 2                          break 2
3706                        fi                        fi
3707                      done                    done
3708                done                  done
3709                  fi
3710                if test -n "$a_deplib" ; then                if test -n "$a_deplib" ; then
3711                  droppeddeps=yes                  droppeddeps=yes
3712                  echo                  $echo
3713                  echo "*** Warning: This library needs some functionality provided by $a_deplib."                  $echo "*** Warning: linker path does not have real file for library $a_deplib."
3714                  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"
3715                  echo "*** you link to this library.  But I can only do this if you have a"                  $echo "*** you link to this library.  But I can only do this if you have a"
3716                  echo "*** shared version of the library, which you do not appear to have."                  $echo "*** shared version of the library, which you do not appear to have"
3717                    $echo "*** because I did check the linker path looking for a file starting"
3718                    if test -z "$potlib" ; then
3719                      $echo "*** with $libname but no candidates were found. (...for file magic test)"
3720                    else
3721                      $echo "*** with $libname and none of the candidates passed a file format test"
3722                      $echo "*** using a file magic. Last file checked: $potlib"
3723                    fi
3724                fi                fi
3725              else              else
3726                # Add a -L argument.                # Add a -L argument.
# Line 2571  EOF Line 3732  EOF
3732            set dummy $deplibs_check_method            set dummy $deplibs_check_method
3733            match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`            match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3734            for a_deplib in $deplibs; do            for a_deplib in $deplibs; do
3735              name="`expr $a_deplib : '-l\(.*\)'`"              name=`expr $a_deplib : '-l\(.*\)'`
3736              # If $name is empty we are operating on a -L argument.              # If $name is empty we are operating on a -L argument.
3737              if test -n "$name" && test "$name" != "0"; then              if test -n "$name" && test "$name" != "0"; then
3738                libname=`eval \\$echo \"$libname_spec\"`                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3739                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do                  case " $predeps $postdeps " in
3740                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`                  *" $a_deplib "*)
3741                  for potent_lib in $potential_libs; do                    newdeplibs="$newdeplibs $a_deplib"
3742                    if eval echo \"$potent_lib\" 2>/dev/null \                    a_deplib=""
3743                        | sed 10q \                    ;;
3744                        | egrep "$match_pattern_regex" > /dev/null; then                  esac
3745                      newdeplibs="$newdeplibs $a_deplib"                fi
3746                      a_deplib=""                if test -n "$a_deplib" ; then
3747                      break 2                  libname=`eval \\$echo \"$libname_spec\"`
3748                    fi                  for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3749                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3750                      for potent_lib in $potential_libs; do
3751                        potlib="$potent_lib" # see symlink-check above in file_magic test
3752                        if eval $echo \"$potent_lib\" 2>/dev/null \
3753                            | ${SED} 10q \
3754                            | $EGREP "$match_pattern_regex" > /dev/null; then