/[debian]/cdck/trunk/ltmain.sh
ViewVC logotype

Diff of /cdck/trunk/ltmain.sh

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

revision 201 by gregoa, Mon Apr 17 15:16:59 2006 UTC revision 303 by gregoa, Tue Jun 27 17:59:26 2006 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    # The name of this program:
37    progname=`echo "$progpath" | $SED $basename`
38    modename="$progname"
39    
40    # Global variables:
41    EXIT_SUCCESS=0
42    EXIT_FAILURE=1
43    
44    PROGRAM=ltmain.sh
45    PACKAGE=libtool
46    VERSION="1.5.22 Debian 1.5.22-4"
47    TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
48    
49    # See if we are running on zsh, and set the options which allow our
50    # commands through without removal of \ escapes.
51    if test -n "${ZSH_VERSION+set}" ; then
52      setopt NO_GLOB_SUBST
53    fi
54    
55  # Check that we have a working $echo.  # Check that we have a working $echo.
56  if test "X$1" = X--no-reexec; then  if test "X$1" = X--no-reexec; then
57    # 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 64  elif test "X`($echo '\t') 2>/dev/null`"
64    :    :
65  else  else
66    # Restart under the correct shell, and then maybe $echo will work.    # Restart under the correct shell, and then maybe $echo will work.
67    exec $SHELL "$0" --no-reexec ${1+"$@"}    exec $SHELL "$progpath" --no-reexec ${1+"$@"}
68  fi  fi
69    
70  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 73  if test "X$1" = X--fallback-echo; then
73    cat <<EOF    cat <<EOF
74  $*  $*
75  EOF  EOF
76    exit 0    exit $EXIT_SUCCESS
77  fi  fi
78    
 # The name of this program.  
 progname=`$echo "$0" | sed 's%^.*/%%'`  
 modename="$progname"  
   
 # Constants.  
 PROGRAM=ltmain.sh  
 PACKAGE=libtool  
 VERSION=1.4.2  
 TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)"  
   
79  default_mode=  default_mode=
80  help="Try \`$progname --help' for more information."  help="Try \`$progname --help' for more information."
81  magic="%%%MAGIC variable%%%"  magic="%%%MAGIC variable%%%"
# Line 67  rm="rm -f" Line 85  rm="rm -f"
85    
86  # Sed substitution that helps us do robust quoting.  It backslashifies  # Sed substitution that helps us do robust quoting.  It backslashifies
87  # metacharacters that are still active within double-quoted strings.  # metacharacters that are still active within double-quoted strings.
88  Xsed='sed -e 1s/^X//'  Xsed="${SED}"' -e 1s/^X//'
89  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
90  SP2NL='tr \040 \012'  # test EBCDIC or ASCII
91  NL2SP='tr \015\012 \040\040'  case `echo X|tr X '\101'` in
92     A) # ASCII based system
93        # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
94      SP2NL='tr \040 \012'
95      NL2SP='tr \015\012 \040\040'
96      ;;
97     *) # EBCDIC based system
98      SP2NL='tr \100 \n'
99      NL2SP='tr \r\n \100\100'
100      ;;
101    esac
102    
103  # NLS nuisances.  # NLS nuisances.
104  # Only set LANG and LC_ALL to C if already set.  # Only set LANG and LC_ALL to C if already set.
# Line 85  if test "${LANG+set}" = set; then Line 113  if test "${LANG+set}" = set; then
113  fi  fi
114    
115  # Make sure IFS has a sensible default  # Make sure IFS has a sensible default
116  : ${IFS="       "}  lt_nl='
117    '
118    IFS="   $lt_nl"
119    
120  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
121    echo "$modename: not configured to build any kind of library" 1>&2    $echo "$modename: not configured to build any kind of library" 1>&2
122    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
123    exit 1    exit $EXIT_FAILURE
124  fi  fi
125    
126  # Global variables.  # Global variables.
# Line 102  run= Line 132  run=
132  show="$echo"  show="$echo"
133  show_help=  show_help=
134  execute_dlfiles=  execute_dlfiles=
135    duplicate_deps=no
136    preserve_args=
137  lo2o="s/\\.lo\$/.${objext}/"  lo2o="s/\\.lo\$/.${objext}/"
138  o2lo="s/\\.${objext}\$/.lo/"  o2lo="s/\\.${objext}\$/.lo/"
139    
140    #####################################
141    # Shell function definitions:
142    # This seems to be the best place for them
143    
144    # func_mktempdir [string]
145    # Make a temporary directory that won't clash with other running
146    # libtool processes, and avoids race conditions if possible.  If
147    # given, STRING is the basename for that directory.
148    func_mktempdir ()
149    {
150        my_template="${TMPDIR-/tmp}/${1-$progname}"
151    
152        if test "$run" = ":"; then
153          # Return a directory name, but don't create it in dry-run mode
154          my_tmpdir="${my_template}-$$"
155        else
156    
157          # If mktemp works, use that first and foremost
158          my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
159    
160          if test ! -d "$my_tmpdir"; then
161            # Failing that, at least try and use $RANDOM to avoid a race
162            my_tmpdir="${my_template}-${RANDOM-0}$$"
163    
164            save_mktempdir_umask=`umask`
165            umask 0077
166            $mkdir "$my_tmpdir"
167            umask $save_mktempdir_umask
168          fi
169    
170          # If we're not in dry-run mode, bomb out on failure
171          test -d "$my_tmpdir" || {
172            $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
173            exit $EXIT_FAILURE
174          }
175        fi
176    
177        $echo "X$my_tmpdir" | $Xsed
178    }
179    
180    
181    # func_win32_libid arg
182    # return the library type of file 'arg'
183    #
184    # Need a lot of goo to handle *both* DLLs and import libs
185    # Has to be a shell function in order to 'eat' the argument
186    # that is supplied when $file_magic_command is called.
187    func_win32_libid ()
188    {
189      win32_libid_type="unknown"
190      win32_fileres=`file -L $1 2>/dev/null`
191      case $win32_fileres in
192      *ar\ archive\ import\ library*) # definitely import
193        win32_libid_type="x86 archive import"
194        ;;
195      *ar\ archive*) # could be an import, or static
196        if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
197          $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
198          win32_nmres=`eval $NM -f posix -A $1 | \
199            $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
200          case $win32_nmres in
201          import*)  win32_libid_type="x86 archive import";;
202          *)        win32_libid_type="x86 archive static";;
203          esac
204        fi
205        ;;
206      *DLL*)
207        win32_libid_type="x86 DLL"
208        ;;
209      *executable*) # but shell scripts are "executable" too...
210        case $win32_fileres in
211        *MS\ Windows\ PE\ Intel*)
212          win32_libid_type="x86 DLL"
213          ;;
214        esac
215        ;;
216      esac
217      $echo $win32_libid_type
218    }
219    
220    
221    # func_infer_tag arg
222    # Infer tagged configuration to use if any are available and
223    # if one wasn't chosen via the "--tag" command line option.
224    # Only attempt this if the compiler in the base compile
225    # command doesn't match the default compiler.
226    # arg is usually of the form 'gcc ...'
227    func_infer_tag ()
228    {
229        if test -n "$available_tags" && test -z "$tagname"; then
230          CC_quoted=
231          for arg in $CC; do
232            case $arg in
233              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
234              arg="\"$arg\""
235              ;;
236            esac
237            CC_quoted="$CC_quoted $arg"
238          done
239          case $@ in
240          # Blanks in the command may have been stripped by the calling shell,
241          # but not from the CC environment variable when configure was run.
242          " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
243          # Blanks at the start of $base_compile will cause this to fail
244          # if we don't check for them as well.
245          *)
246            for z in $available_tags; do
247              if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
248                # Evaluate the configuration.
249                eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
250                CC_quoted=
251                for arg in $CC; do
252                # Double-quote args containing other shell metacharacters.
253                case $arg in
254                  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
255                  arg="\"$arg\""
256                  ;;
257                esac
258                CC_quoted="$CC_quoted $arg"
259              done
260                case "$@ " in
261                  " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
262                  # The compiler in the base compile command matches
263                  # the one in the tagged configuration.
264                  # Assume this is the tagged configuration we want.
265                  tagname=$z
266                  break
267                  ;;
268                esac
269              fi
270            done
271            # If $tagname still isn't set, then no tagged configuration
272            # was found and let the user know that the "--tag" command
273            # line option must be used.
274            if test -z "$tagname"; then
275              $echo "$modename: unable to infer tagged configuration"
276              $echo "$modename: specify a tag with \`--tag'" 1>&2
277              exit $EXIT_FAILURE
278    #        else
279    #          $echo "$modename: using $tagname tagged configuration"
280            fi
281            ;;
282          esac
283        fi
284    }
285    
286    
287    # func_extract_an_archive dir oldlib
288    func_extract_an_archive ()
289    {
290        f_ex_an_ar_dir="$1"; shift
291        f_ex_an_ar_oldlib="$1"
292    
293        $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
294        $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
295        if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
296         :
297        else
298          $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
299          exit $EXIT_FAILURE
300        fi
301    }
302    
303    # func_extract_archives gentop oldlib ...
304    func_extract_archives ()
305    {
306        my_gentop="$1"; shift
307        my_oldlibs=${1+"$@"}
308        my_oldobjs=""
309        my_xlib=""
310        my_xabs=""
311        my_xdir=""
312        my_status=""
313    
314        $show "${rm}r $my_gentop"
315        $run ${rm}r "$my_gentop"
316        $show "$mkdir $my_gentop"
317        $run $mkdir "$my_gentop"
318        my_status=$?
319        if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
320          exit $my_status
321        fi
322    
323        for my_xlib in $my_oldlibs; do
324          # Extract the objects.
325          case $my_xlib in
326            [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
327            *) my_xabs=`pwd`"/$my_xlib" ;;
328          esac
329          my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
330          my_xdir="$my_gentop/$my_xlib"
331    
332          $show "${rm}r $my_xdir"
333          $run ${rm}r "$my_xdir"
334          $show "$mkdir $my_xdir"
335          $run $mkdir "$my_xdir"
336          exit_status=$?
337          if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
338            exit $exit_status
339          fi
340          case $host in
341          *-darwin*)
342            $show "Extracting $my_xabs"
343            # Do not bother doing anything if just a dry run
344            if test -z "$run"; then
345              darwin_orig_dir=`pwd`
346              cd $my_xdir || exit $?
347              darwin_archive=$my_xabs
348              darwin_curdir=`pwd`
349              darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
350              darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
351              if test -n "$darwin_arches"; then
352                darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
353                darwin_arch=
354                $show "$darwin_base_archive has multiple architectures $darwin_arches"
355                for darwin_arch in  $darwin_arches ; do
356                  mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
357                  lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
358                  cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
359                  func_extract_an_archive "`pwd`" "${darwin_base_archive}"
360                  cd "$darwin_curdir"
361                  $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
362                done # $darwin_arches
363          ## Okay now we have a bunch of thin objects, gotta fatten them up :)
364                darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
365                darwin_file=
366                darwin_files=
367                for darwin_file in $darwin_filelist; do
368                  darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
369                  lipo -create -output "$darwin_file" $darwin_files
370                done # $darwin_filelist
371                ${rm}r unfat-$$
372                cd "$darwin_orig_dir"
373              else
374                cd "$darwin_orig_dir"
375                func_extract_an_archive "$my_xdir" "$my_xabs"
376              fi # $darwin_arches
377            fi # $run
378            ;;
379          *)
380            func_extract_an_archive "$my_xdir" "$my_xabs"
381            ;;
382          esac
383          my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
384        done
385        func_extract_archives_result="$my_oldobjs"
386    }
387    # End of Shell function definitions
388    #####################################
389    
390    # Darwin sucks
391    eval std_shrext=\"$shrext_cmds\"
392    
393    disable_libs=no
394    
395  # Parse our command line options once, thoroughly.  # Parse our command line options once, thoroughly.
396  while test $# -gt 0  while test "$#" -gt 0
397  do  do
398    arg="$1"    arg="$1"
399    shift    shift
# Line 122  do Line 409  do
409      execute_dlfiles)      execute_dlfiles)
410        execute_dlfiles="$execute_dlfiles $arg"        execute_dlfiles="$execute_dlfiles $arg"
411        ;;        ;;
412        tag)
413          tagname="$arg"
414          preserve_args="${preserve_args}=$arg"
415    
416          # Check whether tagname contains only valid characters
417          case $tagname in
418          *[!-_A-Za-z0-9,/]*)
419            $echo "$progname: invalid tag name: $tagname" 1>&2
420            exit $EXIT_FAILURE
421            ;;
422          esac
423    
424          case $tagname in
425          CC)
426            # Don't test for the "default" C tag, as we know, it's there, but
427            # not specially marked.
428            ;;
429          *)
430            if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
431              taglist="$taglist $tagname"
432              # Evaluate the configuration.
433              eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
434            else
435              $echo "$progname: ignoring unknown tag $tagname" 1>&2
436            fi
437            ;;
438          esac
439          ;;
440      *)      *)
441        eval "$prev=\$arg"        eval "$prev=\$arg"
442        ;;        ;;
# Line 139  do Line 454  do
454      ;;      ;;
455    
456    --version)    --version)
457      echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"      $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
458      exit 0      $echo
459        $echo "Copyright (C) 2005  Free Software Foundation, Inc."
460        $echo "This is free software; see the source for copying conditions.  There is NO"
461        $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
462        exit $?
463      ;;      ;;
464    
465    --config)    --config)
466      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
467      exit 0      # Now print the configurations for the tags.
468        for tagname in $taglist; do
469          ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
470        done
471        exit $?
472      ;;      ;;
473    
474    --debug)    --debug)
475      echo "$progname: enabling shell trace mode"      $echo "$progname: enabling shell trace mode"
476      set -x      set -x
477        preserve_args="$preserve_args $arg"
478      ;;      ;;
479    
480    --dry-run | -n)    --dry-run | -n)
# Line 158  do Line 482  do
482      ;;      ;;
483    
484    --features)    --features)
485      echo "host: $host"      $echo "host: $host"
486      if test "$build_libtool_libs" = yes; then      if test "$build_libtool_libs" = yes; then
487        echo "enable shared libraries"        $echo "enable shared libraries"
488      else      else
489        echo "disable shared libraries"        $echo "disable shared libraries"
490      fi      fi
491      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
492        echo "enable static libraries"        $echo "enable static libraries"
493      else      else
494        echo "disable static libraries"        $echo "disable static libraries"
495      fi      fi
496      exit 0      exit $?
497      ;;      ;;
498    
499    --finish) mode="finish" ;;    --finish) mode="finish" ;;
# Line 177  do Line 501  do
501    --mode) prevopt="--mode" prev=mode ;;    --mode) prevopt="--mode" prev=mode ;;
502    --mode=*) mode="$optarg" ;;    --mode=*) mode="$optarg" ;;
503    
504      --preserve-dup-deps) duplicate_deps="yes" ;;
505    
506    --quiet | --silent)    --quiet | --silent)
507      show=:      show=:
508        preserve_args="$preserve_args $arg"
509        ;;
510    
511      --tag)
512        prevopt="--tag"
513        prev=tag
514        preserve_args="$preserve_args --tag"
515        ;;
516      --tag=*)
517        set tag "$optarg" ${1+"$@"}
518        shift
519        prev=tag
520        preserve_args="$preserve_args --tag"
521      ;;      ;;
522    
523    -dlopen)    -dlopen)
# Line 189  do Line 528  do
528    -*)    -*)
529      $echo "$modename: unrecognized option \`$arg'" 1>&2      $echo "$modename: unrecognized option \`$arg'" 1>&2
530      $echo "$help" 1>&2      $echo "$help" 1>&2
531      exit 1      exit $EXIT_FAILURE
532      ;;      ;;
533    
534    *)    *)
# Line 202  done Line 541  done
541  if test -n "$prevopt"; then  if test -n "$prevopt"; then
542    $echo "$modename: option \`$prevopt' requires an argument" 1>&2    $echo "$modename: option \`$prevopt' requires an argument" 1>&2
543    $echo "$help" 1>&2    $echo "$help" 1>&2
544    exit 1    exit $EXIT_FAILURE
545  fi  fi
546    
547    case $disable_libs in
548    no)
549      ;;
550    shared)
551      build_libtool_libs=no
552      build_old_libs=yes
553      ;;
554    static)
555      build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
556      ;;
557    esac
558    
559  # If this variable is set in any of the actions, the command in it  # If this variable is set in any of the actions, the command in it
560  # will be execed at the end.  This prevents here-documents from being  # will be execed at the end.  This prevents here-documents from being
561  # left over by shells.  # left over by shells.
# Line 214  if test -z "$show_help"; then Line 565  if test -z "$show_help"; then
565    
566    # Infer the operation mode.    # Infer the operation mode.
567    if test -z "$mode"; then    if test -z "$mode"; then
568        $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
569        $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
570      case $nonopt in      case $nonopt in
571      *cc | *++ | gcc* | *-gcc*)      *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
572        mode=link        mode=link
573        for arg        for arg
574        do        do
# Line 256  if test -z "$show_help"; then Line 609  if test -z "$show_help"; then
609    if test -n "$execute_dlfiles" && test "$mode" != execute; then    if test -n "$execute_dlfiles" && test "$mode" != execute; then
610      $echo "$modename: unrecognized option \`-dlopen'" 1>&2      $echo "$modename: unrecognized option \`-dlopen'" 1>&2
611      $echo "$help" 1>&2      $echo "$help" 1>&2
612      exit 1      exit $EXIT_FAILURE
613    fi    fi
614    
615    # Change the help message to a mode-specific one.    # Change the help message to a mode-specific one.
# Line 270  if test -z "$show_help"; then Line 623  if test -z "$show_help"; then
623      modename="$modename: compile"      modename="$modename: compile"
624      # Get the compilation command and the source file.      # Get the compilation command and the source file.
625      base_compile=      base_compile=
626      prev=      srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
627      lastarg=      suppress_opt=yes
     srcfile="$nonopt"  
628      suppress_output=      suppress_output=
629        arg_mode=normal
630        libobj=
631        later=
632    
     user_target=no  
633      for arg      for arg
634      do      do
635        case $prev in        case $arg_mode in
636        "") ;;        arg  )
637        xcompiler)          # do not "continue".  Instead, add this to base_compile
638          # Aesthetically quote the previous argument.          lastarg="$arg"
639          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  
         ;;  
       esac  
   
       # Accept any command-line options.  
       case $arg in  
       -o)  
         if test "$user_target" != "no"; then  
           $echo "$modename: you cannot specify \`-o' more than once" 1>&2  
           exit 1  
         fi  
         user_target=next  
640          ;;          ;;
641    
642        -static)        target )
643          build_old_libs=yes          libobj="$arg"
644            arg_mode=normal
645          continue          continue
646          ;;          ;;
647    
648        -prefer-pic)        normal )
649          pic_mode=yes          # Accept any command-line options.
650          continue          case $arg in
651          ;;          -o)
652              if test -n "$libobj" ; then
653                $echo "$modename: you cannot specify \`-o' more than once" 1>&2
654                exit $EXIT_FAILURE
655              fi
656              arg_mode=target
657              continue
658              ;;
659    
660        -prefer-non-pic)          -static | -prefer-pic | -prefer-non-pic)
661          pic_mode=no            later="$later $arg"
662          continue            continue
663          ;;            ;;
664    
665        -Xcompiler)          -no-suppress)
666          prev=xcompiler            suppress_opt=no
667          continue            continue
668          ;;            ;;
669    
670        -Wc,*)          -Xcompiler)
671          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`            arg_mode=arg  #  the next one goes into the "base_compile" arg list
672          lastarg=            continue      #  The current "srcfile" will either be retained or
673          save_ifs="$IFS"; IFS=','            ;;            #  replaced later.  I would guess that would be a bug.
674          for arg in $args; do  
675            IFS="$save_ifs"          -Wc,*)
676              args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
677              lastarg=
678              save_ifs="$IFS"; IFS=','
679              for arg in $args; do
680                IFS="$save_ifs"
681    
682            # Double-quote args containing other shell metacharacters.              # Double-quote args containing other shell metacharacters.
683            # Many Bourne shells cannot handle close brackets correctly              # Many Bourne shells cannot handle close brackets correctly
684            # in scan sets, so we specify it separately.              # in scan sets, so we specify it separately.
685            case $arg in              case $arg in
686              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")                *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
687              arg="\"$arg\""                arg="\"$arg\""
688              ;;                ;;
689            esac              esac
690            lastarg="$lastarg $arg"              lastarg="$lastarg $arg"
691          done            done
692          IFS="$save_ifs"            IFS="$save_ifs"
693          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`            lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
694    
695          # Add the arguments to base_compile.            # Add the arguments to base_compile.
         if test -z "$base_compile"; then  
           base_compile="$lastarg"  
         else  
696            base_compile="$base_compile $lastarg"            base_compile="$base_compile $lastarg"
697          fi            continue
698          continue            ;;
         ;;  
       esac  
699    
700        case $user_target in          * )
701        next)            # Accept the current argument as the source file.
702          # The next one is the -o target name            # The previous "srcfile" becomes the current argument.
703          user_target=yes            #
704          continue            lastarg="$srcfile"
705          ;;            srcfile="$arg"
706        yes)            ;;
707          # We got the output file          esac  #  case $arg
         user_target=set  
         libobj="$arg"  
         continue  
708          ;;          ;;
709        esac        esac    #  case $arg_mode
   
       # Accept the current argument as the source file.  
       lastarg="$srcfile"  
       srcfile="$arg"  
710    
711        # 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.  
712        lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`        lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
713    
714          case $lastarg in
715        # Double-quote args containing other shell metacharacters.        # Double-quote args containing other shell metacharacters.
716        # Many Bourne shells cannot handle close brackets correctly        # Many Bourne shells cannot handle close brackets correctly
717        # in scan sets, so we specify it separately.        # in scan sets, and some SunOS ksh mistreat backslash-escaping
718        case $lastarg in        # in scan sets (worked around with variable expansion),
719          # and furthermore cannot handle '|' '&' '(' ')' in scan sets
720          # at all, so we specify them separately.
721        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
722          lastarg="\"$lastarg\""          lastarg="\"$lastarg\""
723          ;;          ;;
724        esac        esac
725    
726        # Add the previous argument to base_compile.        base_compile="$base_compile $lastarg"
727        if test -z "$base_compile"; then      done # for arg
         base_compile="$lastarg"  
       else  
         base_compile="$base_compile $lastarg"  
       fi  
     done  
728    
729      case $user_target in      case $arg_mode in
730      set)      arg)
731          $echo "$modename: you must specify an argument for -Xcompile"
732          exit $EXIT_FAILURE
733        ;;        ;;
734      no)      target)
735        # Get the name of the library object.        $echo "$modename: you must specify a target with \`-o'" 1>&2
736        libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`        exit $EXIT_FAILURE
737        ;;        ;;
738      *)      *)
739        $echo "$modename: you must specify a target with \`-o'" 1>&2        # Get the name of the library object.
740        exit 1        [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
741        ;;        ;;
742      esac      esac
743    
744      # Recognize several different file suffixes.      # Recognize several different file suffixes.
745      # 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
746      xform='[cCFSfmso]'      xform='[cCFSifmso]'
747      case $libobj in      case $libobj in
748      *.ada) xform=ada ;;      *.ada) xform=ada ;;
749      *.adb) xform=adb ;;      *.adb) xform=adb ;;
# Line 429  if test -z "$show_help"; then Line 751  if test -z "$show_help"; then
751      *.asm) xform=asm ;;      *.asm) xform=asm ;;
752      *.c++) xform=c++ ;;      *.c++) xform=c++ ;;
753      *.cc) xform=cc ;;      *.cc) xform=cc ;;
754        *.ii) xform=ii ;;
755        *.class) xform=class ;;
756      *.cpp) xform=cpp ;;      *.cpp) xform=cpp ;;
757      *.cxx) xform=cxx ;;      *.cxx) xform=cxx ;;
758      *.f90) xform=f90 ;;      *.f90) xform=f90 ;;
759      *.for) xform=for ;;      *.for) xform=for ;;
760        *.java) xform=java ;;
761      esac      esac
762    
763      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
# Line 441  if test -z "$show_help"; then Line 766  if test -z "$show_help"; then
766      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
767      *)      *)
768        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
769        exit 1        exit $EXIT_FAILURE
770        ;;        ;;
771      esac      esac
772    
773        func_infer_tag $base_compile
774    
775        for arg in $later; do
776          case $arg in
777          -static)
778            build_old_libs=yes
779            continue
780            ;;
781    
782          -prefer-pic)
783            pic_mode=yes
784            continue
785            ;;
786    
787          -prefer-non-pic)
788            pic_mode=no
789            continue
790            ;;
791          esac
792        done
793    
794        qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
795        case $qlibobj in
796          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
797            qlibobj="\"$qlibobj\"" ;;
798        esac
799        test "X$libobj" != "X$qlibobj" \
800            && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
801            && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
802        objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
803        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
804        if test "X$xdir" = "X$obj"; then
805          xdir=
806        else
807          xdir=$xdir/
808        fi
809        lobj=${xdir}$objdir/$objname
810    
811      if test -z "$base_compile"; then      if test -z "$base_compile"; then
812        $echo "$modename: you must specify a compilation command" 1>&2        $echo "$modename: you must specify a compilation command" 1>&2
813        $echo "$help" 1>&2        $echo "$help" 1>&2
814        exit 1        exit $EXIT_FAILURE
815      fi      fi
816    
817      # Delete any leftover library objects.      # Delete any leftover library objects.
818      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
819        removelist="$obj $libobj"        removelist="$obj $lobj $libobj ${libobj}T"
820      else      else
821        removelist="$libobj"        removelist="$lobj $libobj ${libobj}T"
822      fi      fi
823    
824      $run $rm $removelist      $run $rm $removelist
825      trap "$run $rm $removelist; exit 1" 1 2 15      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
826    
827      # 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
828      case $host_os in      case $host_os in
# Line 467  if test -z "$show_help"; then Line 830  if test -z "$show_help"; then
830        pic_mode=default        pic_mode=default
831        ;;        ;;
832      esac      esac
833      if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then      if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
834        # non-PIC code in shared libraries is not supported        # non-PIC code in shared libraries is not supported
835        pic_mode=default        pic_mode=default
836      fi      fi
# Line 478  if test -z "$show_help"; then Line 841  if test -z "$show_help"; then
841        output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}        output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
842        lockfile="$output_obj.lock"        lockfile="$output_obj.lock"
843        removelist="$removelist $output_obj $lockfile"        removelist="$removelist $output_obj $lockfile"
844        trap "$run $rm $removelist; exit 1" 1 2 15        trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
845      else      else
846          output_obj=
847        need_locks=no        need_locks=no
848        lockfile=        lockfile=
849      fi      fi
# Line 487  if test -z "$show_help"; then Line 851  if test -z "$show_help"; then
851      # Lock this critical section if it is needed      # Lock this critical section if it is needed
852      # 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
853      if test "$need_locks" = yes; then      if test "$need_locks" = yes; then
854        until $run ln "$0" "$lockfile" 2>/dev/null; do        until $run ln "$progpath" "$lockfile" 2>/dev/null; do
855          $show "Waiting for $lockfile to be removed"          $show "Waiting for $lockfile to be removed"
856          sleep 2          sleep 2
857        done        done
858      elif test "$need_locks" = warn; then      elif test "$need_locks" = warn; then
859        if test -f "$lockfile"; then        if test -f "$lockfile"; then
860          echo "\          $echo "\
861  *** ERROR, $lockfile exists and contains:  *** ERROR, $lockfile exists and contains:
862  `cat $lockfile 2>/dev/null`  `cat $lockfile 2>/dev/null`
863    
# Line 505  avoid parallel builds (make -j) in this Line 869  avoid parallel builds (make -j) in this
869  compiler."  compiler."
870    
871          $run $rm $removelist          $run $rm $removelist
872          exit 1          exit $EXIT_FAILURE
873        fi        fi
874        echo $srcfile > "$lockfile"        $echo "$srcfile" > "$lockfile"
875      fi      fi
876    
877      if test -n "$fix_srcfile_path"; then      if test -n "$fix_srcfile_path"; then
878        eval srcfile=\"$fix_srcfile_path\"        eval srcfile=\"$fix_srcfile_path\"
879      fi      fi
880        qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
881        case $qsrcfile in
882          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
883          qsrcfile="\"$qsrcfile\"" ;;
884        esac
885    
886        $run $rm "$libobj" "${libobj}T"
887    
888        # Create a libtool object file (analogous to a ".la" file),
889        # but don't create it if we're doing a dry run.
890        test -z "$run" && cat > ${libobj}T <<EOF
891    # $libobj - a libtool object file
892    # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
893    #
894    # Please DO NOT delete this file!
895    # It is necessary for linking the library.
896    
897    # Name of the PIC object.
898    EOF
899    
900      # Only build a PIC object if we are building libtool libraries.      # Only build a PIC object if we are building libtool libraries.
901      if test "$build_libtool_libs" = yes; then      if test "$build_libtool_libs" = yes; then
# Line 520  compiler." Line 903  compiler."
903        fbsd_hideous_sh_bug=$base_compile        fbsd_hideous_sh_bug=$base_compile
904    
905        if test "$pic_mode" != no; then        if test "$pic_mode" != no; then
906          # All platforms use -DPIC, to notify preprocessed assembler code.          command="$base_compile $qsrcfile $pic_flag"
         command="$base_compile $srcfile $pic_flag -DPIC"  
907        else        else
908          # Don't build PIC code          # Don't build PIC code
909          command="$base_compile $srcfile"          command="$base_compile $qsrcfile"
910        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%^.*/%%'`  
911    
912          if test -d "$dir"; then        if test ! -d "${xdir}$objdir"; then
913            $show "$rm $libobj"          $show "$mkdir ${xdir}$objdir"
914            $run $rm $libobj          $run $mkdir ${xdir}$objdir
915          else          exit_status=$?
916            $show "$mkdir $dir"          if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
917            $run $mkdir $dir            exit $exit_status
           status=$?  
           if test $status -ne 0 && test ! -d $dir; then  
             exit $status  
           fi  
918          fi          fi
919        fi        fi
920        if test "$compiler_o_lo" = yes; then  
921          output_obj="$libobj"        if test -z "$output_obj"; then
922          command="$command -o $output_obj"          # Place PIC objects in $objdir
923        elif test "$compiler_c_o" = yes; then          command="$command -o $lobj"
         output_obj="$obj"  
         command="$command -o $output_obj"  
924        fi        fi
925    
926        $run $rm "$output_obj"        $run $rm "$lobj" "$output_obj"
927    
928        $show "$command"        $show "$command"
929        if $run eval "$command"; then :        if $run eval "$command"; then :
930        else        else
931          test -n "$output_obj" && $run $rm $removelist          test -n "$output_obj" && $run $rm $removelist
932          exit 1          exit $EXIT_FAILURE
933        fi        fi
934    
935        if test "$need_locks" = warn &&        if test "$need_locks" = warn &&
936           test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then           test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
937          echo "\          $echo "\
938  *** ERROR, $lockfile contains:  *** ERROR, $lockfile contains:
939  `cat $lockfile 2>/dev/null`  `cat $lockfile 2>/dev/null`
940    
# Line 581  avoid parallel builds (make -j) in this Line 949  avoid parallel builds (make -j) in this
949  compiler."  compiler."
950    
951          $run $rm $removelist          $run $rm $removelist
952          exit 1          exit $EXIT_FAILURE
953        fi        fi
954    
955        # 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
956        if test x"$output_obj" != x"$libobj"; then        if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
957          $show "$mv $output_obj $libobj"          $show "$mv $output_obj $lobj"
958          if $run $mv $output_obj $libobj; then :          if $run $mv $output_obj $lobj; then :
959          else          else
960            error=$?            error=$?
961            $run $rm $removelist            $run $rm $removelist
# Line 595  compiler." Line 963  compiler."
963          fi          fi
964        fi        fi
965    
966        # 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.
967        if (test -z "$pic_flag" || test "$pic_mode" != default) &&        test -z "$run" && cat >> ${libobj}T <<EOF
968           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  
969    
970          $show "$mv $libobj $obj"  EOF
         if $run $mv $libobj $obj; then :  
         else  
           error=$?  
           $run $rm $removelist  
           exit $error  
         fi  
971    
972          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`        # Allow error messages only from the first compilation.
973          if test "X$xdir" = "X$obj"; then        if test "$suppress_opt" = yes; then
974            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  
           # Unlock the critical section if it was locked  
           if test "$need_locks" != no; then  
             $run $rm "$lockfile"  
           fi  
           exit 0  
         else  
           error=$?  
           $run $rm $removelist  
           exit $error  
         fi  
975        fi        fi
976        else
977          # No PIC object so indicate it doesn't exist in the libtool
978          # object file.
979          test -z "$run" && cat >> ${libobj}T <<EOF
980    pic_object=none
981    
982        # Allow error messages only from the first compilation.  EOF
       suppress_output=' >/dev/null 2>&1'  
983      fi      fi
984    
985      # Only build a position-dependent object if we build old libraries.      # Only build a position-dependent object if we build old libraries.
986      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
987        if test "$pic_mode" != yes; then        if test "$pic_mode" != yes; then
988          # Don't build PIC code          # Don't build PIC code
989          command="$base_compile $srcfile"          command="$base_compile $qsrcfile"
990        else        else
991          # All platforms use -DPIC, to notify preprocessed assembler code.          command="$base_compile $qsrcfile $pic_flag"
         command="$base_compile $srcfile $pic_flag -DPIC"  
992        fi        fi
993        if test "$compiler_c_o" = yes; then        if test "$compiler_c_o" = yes; then
994          command="$command -o $obj"          command="$command -o $obj"
         output_obj="$obj"  
995        fi        fi
996    
997        # Suppress compiler output if we already did a PIC compilation.        # Suppress compiler output if we already did a PIC compilation.
998        command="$command$suppress_output"        command="$command$suppress_output"
999        $run $rm "$output_obj"        $run $rm "$obj" "$output_obj"
1000        $show "$command"        $show "$command"
1001        if $run eval "$command"; then :        if $run eval "$command"; then :
1002        else        else
1003          $run $rm $removelist          $run $rm $removelist
1004          exit 1          exit $EXIT_FAILURE
1005        fi        fi
1006    
1007        if test "$need_locks" = warn &&        if test "$need_locks" = warn &&
1008           test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then           test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1009          echo "\          $echo "\
1010  *** ERROR, $lockfile contains:  *** ERROR, $lockfile contains:
1011  `cat $lockfile 2>/dev/null`  `cat $lockfile 2>/dev/null`
1012    
# Line 680  avoid parallel builds (make -j) in this Line 1021  avoid parallel builds (make -j) in this
1021  compiler."  compiler."
1022    
1023          $run $rm $removelist          $run $rm $removelist
1024          exit 1          exit $EXIT_FAILURE
1025        fi        fi
1026    
1027        # Just move the object if needed        # Just move the object if needed
1028        if test x"$output_obj" != x"$obj"; then        if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1029          $show "$mv $output_obj $obj"          $show "$mv $output_obj $obj"
1030          if $run $mv $output_obj $obj; then :          if $run $mv $output_obj $obj; then :
1031          else          else
# Line 694  compiler." Line 1035  compiler."
1035          fi          fi
1036        fi        fi
1037    
1038        # 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.
1039        # accidentally link it into a program.        # Only append if the libtool object file exists.
1040        if test "$build_libtool_libs" != yes; then        test -z "$run" && cat >> ${libobj}T <<EOF
1041          $show "echo timestamp > $libobj"  # Name of the non-PIC object.
1042          $run eval "echo timestamp > \$libobj" || exit $?  non_pic_object='$objname'
1043        else  
1044          # Move the .lo from within objdir  EOF
1045          $show "$mv $libobj $lo_libobj"      else
1046          if $run $mv $libobj $lo_libobj; then :        # Append the name of the non-PIC object the libtool object file.
1047          else        # Only append if the libtool object file exists.
1048            error=$?        test -z "$run" && cat >> ${libobj}T <<EOF
1049            $run $rm $removelist  # Name of the non-PIC object.
1050            exit $error  non_pic_object=none
1051          fi  
1052        fi  EOF
1053      fi      fi
1054    
1055        $run $mv "${libobj}T" "${libobj}"
1056    
1057      # Unlock the critical section if it was locked      # Unlock the critical section if it was locked
1058      if test "$need_locks" != no; then      if test "$need_locks" != no; then
1059        $run $rm "$lockfile"        $run $rm "$lockfile"
1060      fi      fi
1061    
1062      exit 0      exit $EXIT_SUCCESS
1063      ;;      ;;
1064    
1065    # libtool link mode    # libtool link mode
# Line 727  compiler." Line 1070  compiler."
1070        # It is impossible to link a dll without this setting, and        # It is impossible to link a dll without this setting, and
1071        # we shouldn't force the makefile maintainer to figure out        # we shouldn't force the makefile maintainer to figure out
1072        # which system we are compiling for in order to pass an extra        # which system we are compiling for in order to pass an extra
1073        # flag for every libtool invokation.        # flag for every libtool invocation.
1074        # allow_undefined=no        # allow_undefined=no
1075    
1076        # FIXME: Unfortunately, there are problems with the above when trying        # FIXME: Unfortunately, there are problems with the above when trying
# Line 742  compiler." Line 1085  compiler."
1085        ;;        ;;
1086      esac      esac
1087      libtool_args="$nonopt"      libtool_args="$nonopt"
1088        base_compile="$nonopt $@"
1089      compile_command="$nonopt"      compile_command="$nonopt"
1090      finalize_command="$nonopt"      finalize_command="$nonopt"
1091    
# Line 757  compiler." Line 1101  compiler."
1101      linker_flags=      linker_flags=
1102      dllsearchpath=      dllsearchpath=
1103      lib_search_path=`pwd`      lib_search_path=`pwd`
1104        inst_prefix_dir=
1105    
1106      avoid_version=no      avoid_version=no
1107      dlfiles=      dlfiles=
# Line 771  compiler." Line 1116  compiler."
1116      module=no      module=no
1117      no_install=no      no_install=no
1118      objs=      objs=
1119        non_pic_objects=
1120        notinst_path= # paths that contain not-installed libtool libraries
1121        precious_files_regex=
1122      prefer_static_libs=no      prefer_static_libs=no
1123      preload=no      preload=no
1124      prev=      prev=
# Line 782  compiler." Line 1130  compiler."
1130      temp_rpath=      temp_rpath=
1131      thread_safe=no      thread_safe=no
1132      vinfo=      vinfo=
1133        vinfo_number=no
1134    
1135        func_infer_tag $base_compile
1136    
1137      # We need to know -static, to get the right output filenames.      # We need to know -static, to get the right output filenames.
1138      for arg      for arg
# Line 795  compiler." Line 1146  compiler."
1146            if test -n "$link_static_flag"; then            if test -n "$link_static_flag"; then
1147              dlopen_self=$dlopen_self_static              dlopen_self=$dlopen_self_static
1148            fi            fi
1149              prefer_static_libs=yes
1150          else          else
1151            if test -z "$pic_flag" && test -n "$link_static_flag"; then            if test -z "$pic_flag" && test -n "$link_static_flag"; then
1152              dlopen_self=$dlopen_self_static              dlopen_self=$dlopen_self_static
1153            fi            fi
1154              prefer_static_libs=built
1155          fi          fi
1156          build_libtool_libs=no          build_libtool_libs=no
1157          build_old_libs=yes          build_old_libs=yes
         prefer_static_libs=yes  
1158          break          break
1159          ;;          ;;
1160        esac        esac
# Line 812  compiler." Line 1164  compiler."
1164      test -n "$old_archive_from_new_cmds" && build_old_libs=yes      test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1165    
1166      # Go through the arguments, transforming them on the way.      # Go through the arguments, transforming them on the way.
1167      while test $# -gt 0; do      while test "$#" -gt 0; do
1168        arg="$1"        arg="$1"
1169        shift        shift
1170        case $arg in        case $arg in
# Line 877  compiler." Line 1229  compiler."
1229            export_symbols="$arg"            export_symbols="$arg"
1230            if test ! -f "$arg"; then            if test ! -f "$arg"; then
1231              $echo "$modename: symbol file \`$arg' does not exist"              $echo "$modename: symbol file \`$arg' does not exist"
1232              exit 1              exit $EXIT_FAILURE
1233            fi            fi
1234            prev=            prev=
1235            continue            continue
# Line 887  compiler." Line 1239  compiler."
1239            prev=            prev=
1240            continue            continue
1241            ;;            ;;
1242            inst_prefix)
1243              inst_prefix_dir="$arg"
1244              prev=
1245              continue
1246              ;;
1247            precious_regex)
1248              precious_files_regex="$arg"
1249              prev=
1250              continue
1251              ;;
1252          release)          release)
1253            release="-$arg"            release="-$arg"
1254            prev=            prev=
1255            continue            continue
1256            ;;            ;;
1257            objectlist)
1258              if test -f "$arg"; then
1259                save_arg=$arg
1260                moreargs=
1261                for fil in `cat $save_arg`
1262                do
1263    #             moreargs="$moreargs $fil"
1264                  arg=$fil
1265                  # A libtool-controlled object.
1266    
1267                  # Check to see that this really is a libtool object.
1268                  if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1269                    pic_object=
1270                    non_pic_object=
1271    
1272                    # Read the .lo file
1273                    # If there is no directory component, then add one.
1274                    case $arg in
1275                    */* | *\\*) . $arg ;;
1276                    *) . ./$arg ;;
1277                    esac
1278    
1279                    if test -z "$pic_object" || \
1280                       test -z "$non_pic_object" ||
1281                       test "$pic_object" = none && \
1282                       test "$non_pic_object" = none; then
1283                      $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1284                      exit $EXIT_FAILURE
1285                    fi
1286    
1287                    # Extract subdirectory from the argument.
1288                    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1289                    if test "X$xdir" = "X$arg"; then
1290                      xdir=
1291                    else
1292                      xdir="$xdir/"
1293                    fi
1294    
1295                    if test "$pic_object" != none; then
1296                      # Prepend the subdirectory the object is found in.
1297                      pic_object="$xdir$pic_object"
1298    
1299                      if test "$prev" = dlfiles; then
1300                        if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1301                          dlfiles="$dlfiles $pic_object"
1302                          prev=
1303                          continue
1304                        else
1305                          # If libtool objects are unsupported, then we need to preload.
1306                          prev=dlprefiles
1307                        fi
1308                      fi
1309    
1310                      # CHECK ME:  I think I busted this.  -Ossama
1311                      if test "$prev" = dlprefiles; then
1312                        # Preload the old-style object.
1313                        dlprefiles="$dlprefiles $pic_object"
1314                        prev=
1315                      fi
1316    
1317                      # A PIC object.
1318                      libobjs="$libobjs $pic_object"
1319                      arg="$pic_object"
1320                    fi
1321    
1322                    # Non-PIC object.
1323                    if test "$non_pic_object" != none; then
1324                      # Prepend the subdirectory the object is found in.
1325                      non_pic_object="$xdir$non_pic_object"
1326    
1327                      # A standard non-PIC object
1328                      non_pic_objects="$non_pic_objects $non_pic_object"
1329                      if test -z "$pic_object" || test "$pic_object" = none ; then
1330                        arg="$non_pic_object"
1331                      fi
1332                    else
1333                      # If the PIC object exists, use it instead.
1334                      # $xdir was prepended to $pic_object above.
1335                      non_pic_object="$pic_object"
1336                      non_pic_objects="$non_pic_objects $non_pic_object"
1337                    fi
1338                  else
1339                    # Only an error if not doing a dry-run.
1340                    if test -z "$run"; then
1341                      $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1342                      exit $EXIT_FAILURE
1343                    else
1344                      # Dry-run case.
1345    
1346                      # Extract subdirectory from the argument.
1347                      xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1348                      if test "X$xdir" = "X$arg"; then
1349                        xdir=
1350                      else
1351                        xdir="$xdir/"
1352                      fi
1353    
1354                      pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1355                      non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1356                      libobjs="$libobjs $pic_object"
1357                      non_pic_objects="$non_pic_objects $non_pic_object"
1358                    fi
1359                  fi
1360                done
1361              else
1362                $echo "$modename: link input file \`$save_arg' does not exist"
1363                exit $EXIT_FAILURE
1364              fi
1365              arg=$save_arg
1366              prev=
1367              continue
1368              ;;
1369          rpath | xrpath)          rpath | xrpath)
1370            # We need an absolute path.            # We need an absolute path.
1371            case $arg in            case $arg in
1372            [\\/]* | [A-Za-z]:[\\/]*) ;;            [\\/]* | [A-Za-z]:[\\/]*) ;;
1373            *)            *)
1374              $echo "$modename: only absolute run-paths are allowed" 1>&2              $echo "$modename: only absolute run-paths are allowed" 1>&2
1375              exit 1              exit $EXIT_FAILURE
1376              ;;              ;;
1377            esac            esac
1378            if test "$prev" = rpath; then            if test "$prev" = rpath; then
# Line 930  compiler." Line 1404  compiler."
1404            finalize_command="$finalize_command $wl$qarg"            finalize_command="$finalize_command $wl$qarg"
1405            continue            continue
1406            ;;            ;;
1407            xcclinker)
1408              linker_flags="$linker_flags $qarg"
1409              compiler_flags="$compiler_flags $qarg"
1410              prev=
1411              compile_command="$compile_command $qarg"
1412              finalize_command="$finalize_command $qarg"
1413              continue
1414              ;;
1415            shrext)
1416              shrext_cmds="$arg"
1417              prev=
1418              continue
1419              ;;
1420            darwin_framework|darwin_framework_skip)
1421              test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1422              compile_command="$compile_command $arg"
1423              finalize_command="$finalize_command $arg"
1424              prev=
1425              continue
1426              ;;
1427          *)          *)
1428            eval "$prev=\"\$arg\""            eval "$prev=\"\$arg\""
1429            prev=            prev=
1430            continue            continue
1431            ;;            ;;
1432          esac          esac
1433        fi # test -n $prev        fi # test -n "$prev"
1434    
1435        prevarg="$arg"        prevarg="$arg"
1436    
# Line 978  compiler." Line 1472  compiler."
1472        -export-symbols | -export-symbols-regex)        -export-symbols | -export-symbols-regex)
1473          if test -n "$export_symbols" || test -n "$export_symbols_regex"; then          if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1474            $echo "$modename: more than one -exported-symbols argument is not allowed"            $echo "$modename: more than one -exported-symbols argument is not allowed"
1475            exit 1            exit $EXIT_FAILURE
1476          fi          fi
1477          if test "X$arg" = "X-export-symbols"; then          if test "X$arg" = "X-export-symbols"; then
1478            prev=expsyms            prev=expsyms
# Line 988  compiler." Line 1482  compiler."
1482          continue          continue
1483          ;;          ;;
1484    
1485          -framework|-arch|-isysroot)
1486            case " $CC " in
1487              *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1488                    prev=darwin_framework_skip ;;
1489              *) compiler_flags="$compiler_flags $arg"
1490                 prev=darwin_framework ;;
1491            esac
1492            compile_command="$compile_command $arg"
1493            finalize_command="$finalize_command $arg"
1494            continue
1495            ;;
1496    
1497          -inst-prefix-dir)
1498            prev=inst_prefix
1499            continue
1500            ;;
1501    
1502        # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*        # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1503        # 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
1504        -L[A-Z][A-Z]*:*)        -L[A-Z][A-Z]*:*)
1505          case $with_gcc/$host in          case $with_gcc/$host in
1506          no/*-*-irix*)          no/*-*-irix* | /*-*-irix*)
1507            compile_command="$compile_command $arg"            compile_command="$compile_command $arg"
1508            finalize_command="$finalize_command $arg"            finalize_command="$finalize_command $arg"
1509            ;;            ;;
# Line 1009  compiler." Line 1520  compiler."
1520            absdir=`cd "$dir" && pwd`            absdir=`cd "$dir" && pwd`
1521            if test -z "$absdir"; then            if test -z "$absdir"; then
1522              $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2              $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1523              exit 1              absdir="$dir"
1524                notinst_path="$notinst_path $dir"
1525            fi            fi
1526            dir="$absdir"            dir="$absdir"
1527            ;;            ;;
# Line 1023  compiler." Line 1535  compiler."
1535          esac          esac
1536          case $host in          case $host in
1537          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1538              testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1539            case :$dllsearchpath: in            case :$dllsearchpath: in
1540            *":$dir:"*) ;;            *":$dir:"*) ;;
1541            *) dllsearchpath="$dllsearchpath:$dir";;            *) dllsearchpath="$dllsearchpath:$dir";;
1542            esac            esac
1543              case :$dllsearchpath: in
1544              *":$testbindir:"*) ;;
1545              *) dllsearchpath="$dllsearchpath:$testbindir";;
1546              esac
1547            ;;            ;;
1548          esac          esac
1549          continue          continue
# Line 1035  compiler." Line 1552  compiler."
1552        -l*)        -l*)
1553          if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then          if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1554            case $host in            case $host in
1555            *-*-cygwin* | *-*-pw32* | *-*-beos*)            *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1556              # 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)
1557              continue              continue
1558              ;;              ;;
1559            *-*-mingw* | *-*-os2*)            *-*-os2*)
1560              # These systems don't actually have a C library (as such)              # These systems don't actually have a C library (as such)
1561              test "X$arg" = "X-lc" && continue              test "X$arg" = "X-lc" && continue
1562              ;;              ;;
1563            *-*-openbsd*)            *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1564              # Do not include libc due to us having libc/libc_r.              # Do not include libc due to us having libc/libc_r.
1565              test "X$arg" = "X-lc" && continue              test "X$arg" = "X-lc" && continue
1566              ;;              ;;
1567            esac            *-*-rhapsody* | *-*-darwin1.[012])
1568           elif test "X$arg" = "X-lc_r"; then              # Rhapsody C and math libraries are in the System framework
1569            case $host in              deplibs="$deplibs -framework System"
           *-*-openbsd*)  
             # Do not include libc_r directly, use -pthread flag.  
1570              continue              continue
1571              ;;              ;;
1572              *-*-sco3.2v5* | *-*-sco5v6*)
1573                # Causes problems with __ctype
1574                test "X$arg" = "X-lc" && continue
1575                ;;
1576              *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1577                # Compiler inserts libc in the correct place for threads to work
1578                test "X$arg" = "X-lc" && continue
1579                ;;
1580            esac            esac
1581            elif test "X$arg" = "X-lc_r"; then
1582             case $host in
1583             *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1584               # Do not include libc_r directly, use -pthread flag.
1585               continue
1586               ;;
1587             esac
1588          fi          fi
1589          deplibs="$deplibs $arg"          deplibs="$deplibs $arg"
1590          continue          continue
1591          ;;          ;;
1592    
1593          # Tru64 UNIX uses -model [arg] to determine the layout of C++
1594          # classes, name mangling, and exception handling.
1595          -model)
1596            compile_command="$compile_command $arg"
1597            compiler_flags="$compiler_flags $arg"
1598            finalize_command="$finalize_command $arg"
1599            prev=xcompiler
1600            continue
1601            ;;
1602    
1603         -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1604            compiler_flags="$compiler_flags $arg"
1605            compile_command="$compile_command $arg"
1606            finalize_command="$finalize_command $arg"
1607            continue
1608            ;;
1609    
1610        -module)        -module)
1611          module=yes          module=yes
1612          continue          continue
1613          ;;          ;;
1614    
1615          # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1616          # -r[0-9][0-9]* specifies the processor on the SGI compiler
1617          # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1618          # +DA*, +DD* enable 64-bit mode on the HP compiler
1619          # -q* pass through compiler args for the IBM compiler
1620          # -m* pass through architecture-specific compiler args for GCC
1621          # -m*, -t[45]*, -txscale* pass through architecture-specific
1622          # compiler args for GCC
1623          # -pg pass through profiling flag for GCC
1624          # @file GCC response files
1625          -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1626          -t[45]*|-txscale*|@*)
1627    
1628            # Unknown arguments in both finalize_command and compile_command need
1629            # to be aesthetically quoted because they are evaled later.
1630            arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1631            case $arg in
1632            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1633              arg="\"$arg\""
1634              ;;
1635            esac
1636            compile_command="$compile_command $arg"
1637            finalize_command="$finalize_command $arg"
1638            compiler_flags="$compiler_flags $arg"
1639            continue
1640            ;;
1641    
1642          -shrext)
1643            prev=shrext
1644            continue
1645            ;;
1646    
1647        -no-fast-install)        -no-fast-install)
1648          fast_install=no          fast_install=no
1649          continue          continue
# Line 1089  compiler." Line 1668  compiler."
1668          continue          continue
1669          ;;          ;;
1670    
1671          -objectlist)
1672            prev=objectlist
1673            continue
1674            ;;
1675    
1676        -o) prev=output ;;        -o) prev=output ;;
1677    
1678          -precious-files-regex)
1679            prev=precious_regex
1680            continue
1681            ;;
1682    
1683        -release)        -release)
1684          prev=release          prev=release
1685          continue          continue
# Line 1113  compiler." Line 1702  compiler."
1702          [\\/]* | [A-Za-z]:[\\/]*) ;;          [\\/]* | [A-Za-z]:[\\/]*) ;;
1703          *)          *)
1704            $echo "$modename: only absolute run-paths are allowed" 1>&2            $echo "$modename: only absolute run-paths are allowed" 1>&2
1705            exit 1            exit $EXIT_FAILURE
1706            ;;            ;;
1707          esac          esac
1708          case "$xrpath " in          case "$xrpath " in
# Line 1141  compiler." Line 1730  compiler."
1730          prev=vinfo          prev=vinfo
1731          continue          continue
1732          ;;          ;;
1733          -version-number)
1734            prev=vinfo
1735            vinfo_number=yes
1736            continue
1737            ;;
1738    
1739        -Wc,*)        -Wc,*)
1740          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
# Line 1189  compiler." Line 1783  compiler."
1783          continue          continue
1784          ;;          ;;
1785    
1786          -XCClinker)
1787            prev=xcclinker
1788            continue
1789            ;;
1790    
1791        # Some other compiler flag.        # Some other compiler flag.
1792        -* | +*)        -* | +*)
1793          # Unknown arguments in both finalize_command and compile_command need          # Unknown arguments in both finalize_command and compile_command need
# Line 1201  compiler." Line 1800  compiler."
1800          esac          esac
1801          ;;          ;;
1802    
1803        *.lo | *.$objext)        *.$objext)
1804          # A library or standard object.          # A standard object.
1805          if test "$prev" = dlfiles; then          objs="$objs $arg"
1806            # 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  
1807    
1808          if test "$prev" = dlprefiles; then        *.lo)
1809            # Preload the old-style object.          # A libtool-controlled object.
1810            dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`  
1811            prev=          # Check to see that this really is a libtool object.
1812          else          if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1813              pic_object=
1814              non_pic_object=
1815    
1816              # Read the .lo file
1817              # If there is no directory component, then add one.
1818            case $arg in            case $arg in
1819            *.lo) libobjs="$libobjs $arg" ;;            */* | *\\*) . $arg ;;
1820            *) objs="$objs $arg" ;;            *) . ./$arg ;;
1821            esac            esac
1822    
1823              if test -z "$pic_object" || \
1824                 test -z "$non_pic_object" ||
1825                 test "$pic_object" = none && \
1826                 test "$non_pic_object" = none; then
1827                $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1828                exit $EXIT_FAILURE
1829              fi
1830    
1831              # Extract subdirectory from the argument.
1832              xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1833              if test "X$xdir" = "X$arg"; then
1834                xdir=
1835              else
1836                xdir="$xdir/"
1837              fi
1838    
1839              if test "$pic_object" != none; then
1840                # Prepend the subdirectory the object is found in.
1841                pic_object="$xdir$pic_object"
1842    
1843                if test "$prev" = dlfiles; then
1844                  if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1845                    dlfiles="$dlfiles $pic_object"
1846                    prev=
1847                    continue
1848                  else
1849                    # If libtool objects are unsupported, then we need to preload.
1850                    prev=dlprefiles
1851                  fi
1852                fi
1853    
1854                # CHECK ME:  I think I busted this.  -Ossama
1855                if test "$prev" = dlprefiles; then
1856                  # Preload the old-style object.
1857                  dlprefiles="$dlprefiles $pic_object"
1858                  prev=
1859                fi
1860    
1861                # A PIC object.
1862                libobjs="$libobjs $pic_object"
1863                arg="$pic_object"
1864              fi
1865    
1866              # Non-PIC object.
1867              if test "$non_pic_object" != none; then
1868                # Prepend the subdirectory the object is found in.
1869                non_pic_object="$xdir$non_pic_object"
1870    
1871                # A standard non-PIC object
1872                non_pic_objects="$non_pic_objects $non_pic_object"
1873                if test -z "$pic_object" || test "$pic_object" = none ; then
1874                  arg="$non_pic_object"
1875                fi
1876              else
1877                # If the PIC object exists, use it instead.
1878                # $xdir was prepended to $pic_object above.
1879                non_pic_object="$pic_object"
1880                non_pic_objects="$non_pic_objects $non_pic_object"
1881              fi
1882            else
1883              # Only an error if not doing a dry-run.
1884              if test -z "$run"; then
1885                $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1886                exit $EXIT_FAILURE
1887              else
1888                # Dry-run case.
1889    
1890                # Extract subdirectory from the argument.
1891                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1892                if test "X$xdir" = "X$arg"; then
1893                  xdir=
1894                else
1895                  xdir="$xdir/"
1896                fi
1897    
1898                pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1899                non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1900                libobjs="$libobjs $pic_object"
1901                non_pic_objects="$non_pic_objects $non_pic_object"
1902              fi
1903          fi          fi
1904          ;;          ;;
1905    
# Line 1274  compiler." Line 1950  compiler."
1950      if test -n "$prev"; then      if test -n "$prev"; then
1951        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1952        $echo "$help" 1>&2        $echo "$help" 1>&2
1953        exit 1        exit $EXIT_FAILURE
1954      fi      fi
1955    
1956      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 1283  compiler." Line 1959  compiler."
1959        finalize_command="$finalize_command $arg"        finalize_command="$finalize_command $arg"
1960      fi      fi
1961    
1962        oldlibs=
1963      # calculate the name of the file, without its directory      # calculate the name of the file, without its directory
1964      outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`      outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1965      libobjs_save="$libobjs"      libobjs_save="$libobjs"
# Line 1303  compiler." Line 1980  compiler."
1980        output_objdir="$output_objdir/$objdir"        output_objdir="$output_objdir/$objdir"
1981      fi      fi
1982      # Create the object directory.      # Create the object directory.
1983      if test ! -d $output_objdir; then      if test ! -d "$output_objdir"; then
1984        $show "$mkdir $output_objdir"        $show "$mkdir $output_objdir"
1985        $run $mkdir $output_objdir        $run $mkdir $output_objdir
1986        status=$?        exit_status=$?
1987        if test $status -ne 0 && test ! -d $output_objdir; then        if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
1988          exit $status          exit $exit_status
1989        fi        fi
1990      fi      fi
1991    
# Line 1317  compiler." Line 1994  compiler."
1994      "")      "")
1995        $echo "$modename: you must specify an output file" 1>&2        $echo "$modename: you must specify an output file" 1>&2
1996        $echo "$help" 1>&2        $echo "$help" 1>&2
1997        exit 1        exit $EXIT_FAILURE
1998        ;;        ;;
1999      *.$libext) linkmode=oldlib ;;      *.$libext) linkmode=oldlib ;;
2000      *.lo | *.$objext) linkmode=obj ;;      *.lo | *.$objext) linkmode=obj ;;
# Line 1325  compiler." Line 2002  compiler."
2002      *) linkmode=prog ;; # Anything else should be a program.      *) linkmode=prog ;; # Anything else should be a program.
2003      esac      esac
2004    
2005        case $host in
2006        *cygwin* | *mingw* | *pw32*)
2007          # don't eliminate duplications in $postdeps and $predeps
2008          duplicate_compiler_generated_deps=yes
2009          ;;
2010        *)
2011          duplicate_compiler_generated_deps=$duplicate_deps
2012          ;;
2013        esac
2014      specialdeplibs=      specialdeplibs=
2015    
2016      libs=      libs=
2017      # Find all interdependent deplibs by searching for libraries      # Find all interdependent deplibs by searching for libraries
2018      # that are linked more than once (e.g. -la -lb -la)      # that are linked more than once (e.g. -la -lb -la)
2019      for deplib in $deplibs; do      for deplib in $deplibs; do
2020        case "$libs " in        if test "X$duplicate_deps" = "Xyes" ; then
2021        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;          case "$libs " in
2022        esac          *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2023            esac
2024          fi
2025        libs="$libs $deplib"        libs="$libs $deplib"
2026      done      done
2027    
2028        if test "$linkmode" = lib; then
2029          libs="$predeps $libs $compiler_lib_search_path $postdeps"
2030    
2031          # Compute libraries that are listed more than once in $predeps
2032          # $postdeps and mark them as special (i.e., whose duplicates are
2033          # not to be eliminated).
2034          pre_post_deps=
2035          if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2036            for pre_post_dep in $predeps $postdeps; do
2037              case "$pre_post_deps " in
2038              *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2039              esac
2040              pre_post_deps="$pre_post_deps $pre_post_dep"
2041            done
2042          fi
2043          pre_post_deps=
2044        fi
2045    
2046      deplibs=      deplibs=
2047      newdependency_libs=      newdependency_libs=
2048      newlib_search_path=      newlib_search_path=
2049      need_relink=no # whether we're linking any uninstalled libtool libraries      need_relink=no # whether we're linking any uninstalled libtool libraries
2050      notinst_deplibs= # not-installed libtool libraries      notinst_deplibs= # not-installed libtool libraries
     notinst_path= # paths that contain not-installed libtool libraries  
2051      case $linkmode in      case $linkmode in
2052      lib)      lib)
2053          passes="conv link"          passes="conv link"
# Line 1349  compiler." Line 2056  compiler."
2056            *.la) ;;            *.la) ;;
2057            *)            *)
2058              $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2              $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2059              exit 1              exit $EXIT_FAILURE
2060              ;;              ;;
2061            esac            esac
2062          done          done
# Line 1366  compiler." Line 2073  compiler."
2073          ;;          ;;
2074      esac      esac
2075      for pass in $passes; do      for pass in $passes; do
2076        if test $linkmode = prog; then        if test "$linkmode,$pass" = "lib,link" ||
2077          # Determine which files to process           test "$linkmode,$pass" = "prog,scan"; then
2078            libs="$deplibs"
2079            deplibs=
2080          fi
2081          if test "$linkmode" = prog; then
2082          case $pass in          case $pass in
2083          dlopen)          dlopen) libs="$dlfiles" ;;
           libs="$dlfiles"  
           save_deplibs="$deplibs" # Collect dlpreopened libraries  
           deplibs=  
           ;;  
2084          dlpreopen) libs="$dlprefiles" ;;          dlpreopen) libs="$dlprefiles" ;;
2085          link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;          link)
2086              libs="$deplibs %DEPLIBS%"
2087              test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
2088              ;;
2089          esac          esac
2090        fi        fi
2091          if test "$pass" = dlopen; then
2092            # Collect dlpreopened libraries
2093            save_deplibs="$deplibs"
2094            deplibs=
2095          fi
2096        for deplib in $libs; do        for deplib in $libs; do
2097          lib=          lib=
2098          found=no          found=no
2099          case $deplib in          case $deplib in
2100          -l*)          -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2101            if test $linkmode = oldlib && test $linkmode = obj; then            if test "$linkmode,$pass" = "prog,link"; then
2102              $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2              compile_deplibs="$deplib $compile_deplibs"
2103              continue              finalize_deplibs="$deplib $finalize_deplibs"
2104              else
2105                compiler_flags="$compiler_flags $deplib"
2106            fi            fi
2107            if test $pass = conv; then            continue
2108              deplibs="$deplib $deplibs"            ;;
2109            -l*)
2110              if test "$linkmode" != lib && test "$linkmode" != prog; then
2111                $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2112              continue              continue
2113            fi            fi
2114            name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`            name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2115            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
2116              # Search the libtool library              for search_ext in .la $std_shrext .so .a; do
2117              lib="$searchdir/lib${name}.la"                # Search the libtool library
2118              if test -f "$lib"; then                lib="$searchdir/lib${name}${search_ext}"
2119                found=yes                if test -f "$lib"; then
2120                break                  if test "$search_ext" = ".la"; then
2121              fi                    found=yes
2122                    else
2123                      found=no
2124                    fi
2125                    break 2
2126                  fi
2127                done
2128            done            done
2129            if test "$found" != yes; then            if test "$found" != yes; then
2130              # deplib doesn't seem to be a libtool library              # deplib doesn't seem to be a libtool library
# Line 1407  compiler." Line 2133  compiler."
2133                finalize_deplibs="$deplib $finalize_deplibs"                finalize_deplibs="$deplib $finalize_deplibs"
2134              else              else
2135                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2136                test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"                test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2137              fi              fi
2138              continue              continue
2139              else # deplib is a libtool library
2140                # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2141                # We need to do some special things here, and not later.
2142                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2143                  case " $predeps $postdeps " in
2144                  *" $deplib "*)
2145                    if (${SED} -e '2q' $lib |
2146                        grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2147                      library_names=
2148                      old_library=
2149                      case $lib in
2150                      */* | *\\*) . $lib ;;
2151                      *) . ./$lib ;;
2152                      esac
2153                      for l in $old_library $library_names; do
2154                        ll="$l"
2155                      done
2156                      if test "X$ll" = "X$old_library" ; then # only static version available
2157                        found=no
2158                        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2159                        test "X$ladir" = "X$lib" && ladir="."
2160                        lib=$ladir/$old_library
2161                        if test "$linkmode,$pass" = "prog,link"; then
2162                          compile_deplibs="$deplib $compile_deplibs"
2163                          finalize_deplibs="$deplib $finalize_deplibs"
2164                        else
2165                          deplibs="$deplib $deplibs"
2166                          test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2167                        fi
2168                        continue
2169                      fi
2170                    fi
2171                    ;;
2172                  *) ;;
2173                  esac
2174                fi
2175            fi            fi
2176            ;; # -l            ;; # -l
2177          -L*)          -L*)
2178            case $linkmode in            case $linkmode in
2179            lib)            lib)
2180              deplibs="$deplib $deplibs"              deplibs="$deplib $deplibs"
2181              test $pass = conv && continue              test "$pass" = conv && continue
2182              newdependency_libs="$deplib $newdependency_libs"              newdependency_libs="$deplib $newdependency_libs"
2183              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//'`
2184              ;;              ;;
2185            prog)            prog)
2186              if test $pass = conv; then              if test "$pass" = conv; then
2187                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2188                continue                continue
2189              fi              fi
2190              if test $pass = scan; then              if test "$pass" = scan; then
2191                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
               newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`  
2192              else              else
2193                compile_deplibs="$deplib $compile_deplibs"                compile_deplibs="$deplib $compile_deplibs"
2194                finalize_deplibs="$deplib $finalize_deplibs"                finalize_deplibs="$deplib $finalize_deplibs"
2195              fi              fi
2196                newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2197              ;;              ;;
2198            *)            *)
2199              $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2              $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2200              ;;              ;;
2201            esac # linkmode            esac # linkmode
2202            continue            continue
2203            ;; # -L            ;; # -L
2204          -R*)          -R*)
2205            if test $pass = link; then            if test "$pass" = link; then
2206              dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`              dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2207              # Make sure the xrpath contains only unique directories.              # Make sure the xrpath contains only unique directories.
2208              case "$xrpath " in              case "$xrpath " in
# Line 1453  compiler." Line 2215  compiler."
2215            ;;            ;;
2216          *.la) lib="$deplib" ;;          *.la) lib="$deplib" ;;
2217          *.$libext)          *.$libext)
2218            if test $pass = conv; then            if test "$pass" = conv; then
2219              deplibs="$deplib $deplibs"              deplibs="$deplib $deplibs"
2220              continue              continue
2221            fi            fi
2222            case $linkmode in            case $linkmode in
2223            lib)            lib)
2224              if test "$deplibs_check_method" != pass_all; then              valid_a_lib=no
2225                echo              case $deplibs_check_method in
2226                echo "*** Warning: This library needs some functionality provided by $deplib."                match_pattern*)
2227                echo "*** I have the capability to make that library automatically link in when"                  set dummy $deplibs_check_method
2228                echo "*** you link to this library.  But I can only do this if you have a"                  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2229                echo "*** shared version of the library, which you do not appear to have."                  if eval $echo \"$deplib\" 2>/dev/null \
2230                        | $SED 10q \
2231                        | $EGREP "$match_pattern_regex" > /dev/null; then
2232                      valid_a_lib=yes
2233                    fi
2234                    ;;
2235                  pass_all)
2236                    valid_a_lib=yes
2237                    ;;
2238                esac
2239                if test "$valid_a_lib" != yes; then
2240                  $echo
2241                  $echo "*** Warning: Trying to link with static lib archive $deplib."
2242                  $echo "*** I have the capability to make that library automatically link in when"
2243                  $echo "*** you link to this library.  But I can only do this if you have a"
2244                  $echo "*** shared version of the library, which you do not appear to have"
2245                  $echo "*** because the file extensions .$libext of this argument makes me believe"
2246                  $echo "*** that it is just a static archive that I should not used here."
2247              else              else
2248                echo                $echo
2249                echo "*** Warning: Linking the shared library $output against the"                $echo "*** Warning: Linking the shared library $output against the"
2250                echo "*** static library $deplib is not portable!"                $echo "*** static library $deplib is not portable!"
2251                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2252              fi              fi
2253              continue              continue
2254              ;;              ;;
2255            prog)            prog)
2256              if test $pass != link; then              if test "$pass" != link; then
2257                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2258              else              else
2259                compile_deplibs="$deplib $compile_deplibs"                compile_deplibs="$deplib $compile_deplibs"
# Line 1485  compiler." Line 2264  compiler."
2264            esac # linkmode            esac # linkmode
2265            ;; # *.$libext            ;; # *.$libext
2266          *.lo | *.$objext)          *.lo | *.$objext)
2267            if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then            if test "$pass" = conv; then
2268              # If there is no dlopen support or we're linking statically,              deplibs="$deplib $deplibs"
2269              # we need to preload.            elif test "$linkmode" = prog; then
2270              newdlprefiles="$newdlprefiles $deplib"              if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2271              compile_deplibs="$deplib $compile_deplibs"                # If there is no dlopen support or we're linking statically,
2272              finalize_deplibs="$deplib $finalize_deplibs"                # we need to preload.
2273            else                newdlprefiles="$newdlprefiles $deplib"
2274              newdlfiles="$newdlfiles $deplib"                compile_deplibs="$deplib $compile_deplibs"
2275                  finalize_deplibs="$deplib $finalize_deplibs"
2276                else
2277                  newdlfiles="$newdlfiles $deplib"
2278                fi
2279            fi            fi
2280            continue            continue
2281            ;;            ;;
# Line 1501  compiler." Line 2284  compiler."
2284            continue            continue
2285            ;;            ;;
2286          esac # case $deplib          esac # case $deplib
2287          if test $found = yes || test -f "$lib"; then :          if test "$found" = yes || test -f "$lib"; then :
2288          else          else
2289            $echo "$modename: cannot find the library \`$lib'" 1>&2            $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2290            exit 1            exit $EXIT_FAILURE
2291          fi          fi
2292    
2293          # Check to see that this really is a libtool archive.          # Check to see that this really is a libtool archive.
2294          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 :
2295          else          else
2296            $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2            $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2297            exit 1            exit $EXIT_FAILURE
2298          fi          fi
2299    
2300          ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`          ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
# Line 1524  compiler." Line 2307  compiler."
2307          library_names=          library_names=
2308          old_library=          old_library=
2309          # If the library was installed with an old release of libtool,          # If the library was installed with an old release of libtool,
2310          # it will not redefine variable installed.          # it will not redefine variables installed, or shouldnotlink
2311          installed=yes          installed=yes
2312            shouldnotlink=no
2313            avoidtemprpath=
2314    
2315    
2316          # Read the .la file          # Read the .la file
2317          case $lib in          case $lib in
# Line 1535  compiler." Line 2321  compiler."
2321    
2322          if test "$linkmode,$pass" = "lib,link" ||          if test "$linkmode,$pass" = "lib,link" ||
2323             test "$linkmode,$pass" = "prog,scan" ||             test "$linkmode,$pass" = "prog,scan" ||
2324             { test $linkmode = oldlib && test $linkmode = obj; }; then             { test "$linkmode" != prog && test "$linkmode" != lib; }; then
            # Add dl[pre]opened files of deplib  
2325            test -n "$dlopen" && dlfiles="$dlfiles $dlopen"            test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2326            test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"            test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2327          fi          fi
2328    
2329          if test $pass = conv; then          if test "$pass" = conv; then
2330            # Only check for convenience libraries            # Only check for convenience libraries
2331            deplibs="$lib $deplibs"            deplibs="$lib $deplibs"
2332            if test -z "$libdir"; then            if test -z "$libdir"; then
2333              if test -z "$old_library"; then              if test -z "$old_library"; then
2334                $echo "$modename: cannot find name of link library for \`$lib'" 1>&2                $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2335                exit 1                exit $EXIT_FAILURE
2336              fi              fi
2337              # It is a libtool convenience library, so add in its objects.              # It is a libtool convenience library, so add in its objects.
2338              convenience="$convenience $ladir/$objdir/$old_library"              convenience="$convenience $ladir/$objdir/$old_library"
# Line 1555  compiler." Line 2340  compiler."
2340              tmp_libs=              tmp_libs=
2341              for deplib in $dependency_libs; do              for deplib in $dependency_libs; do
2342                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2343                case "$tmp_libs " in                if test "X$duplicate_deps" = "Xyes" ; then
2344                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;                  case "$tmp_libs " in
2345                esac                  *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2346                    esac
2347                  fi
2348                tmp_libs="$tmp_libs $deplib"                tmp_libs="$tmp_libs $deplib"
2349              done              done
2350            elif test $linkmode != prog && test $linkmode != lib; then            elif test "$linkmode" != prog && test "$linkmode" != lib; then
2351              $echo "$modename: \`$lib' is not a convenience library" 1>&2              $echo "$modename: \`$lib' is not a convenience library" 1>&2
2352              exit 1              exit $EXIT_FAILURE
2353            fi            fi
2354            continue            continue
2355          fi # $pass = conv          fi # $pass = conv
2356    
2357    
2358          # Get the name of the library we link against.          # Get the name of the library we link against.
2359          linklib=          linklib=
2360          for l in $old_library $library_names; do          for l in $old_library $library_names; do
# Line 1574  compiler." Line 2362  compiler."
2362          done          done
2363          if test -z "$linklib"; then          if test -z "$linklib"; then
2364            $echo "$modename: cannot find name of link library for \`$lib'" 1>&2            $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2365            exit 1            exit $EXIT_FAILURE
2366          fi          fi
2367    
2368          # This library was specified with -dlopen.          # This library was specified with -dlopen.
2369          if test $pass = dlopen; then          if test "$pass" = dlopen; then
2370            if test -z "$libdir"; then            if test -z "$libdir"; then
2371              $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2              $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2372              exit 1              exit $EXIT_FAILURE
2373            fi            fi
2374            if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then            if test -z "$dlname" ||
2375                 test "$dlopen_support" != yes ||
2376                 test "$build_libtool_libs" = no; then
2377              # If there is no dlname, no dlopen support or we're linking              # If there is no dlname, no dlopen support or we're linking
2378              # statically, we need to preload.              # statically, we need to preload.  We also need to preload any
2379              dlprefiles="$dlprefiles $lib"              # dependent libraries so libltdl's deplib preloader doesn't
2380                # bomb out in the load deplibs phase.
2381                dlprefiles="$dlprefiles $lib $dependency_libs"
2382            else            else
2383              newdlfiles="$newdlfiles $lib"              newdlfiles="$newdlfiles $lib"
2384            fi            fi
# Line 1618  compiler." Line 2410  compiler."
2410              dir="$libdir"              dir="$libdir"
2411              absdir="$libdir"              absdir="$libdir"
2412            fi            fi
2413              test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2414          else          else
2415            dir="$ladir/$objdir"            if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2416            absdir="$abs_ladir/$objdir"              dir="$ladir"
2417            # Remove this search path later              absdir="$abs_ladir"
2418            notinst_path="$notinst_path $abs_ladir"              # Remove this search path later
2419                notinst_path="$notinst_path $abs_ladir"
2420              else
2421                dir="$ladir/$objdir"
2422                absdir="$abs_ladir/$objdir"
2423                # Remove this search path later
2424                notinst_path="$notinst_path $abs_ladir"
2425              fi
2426          fi # $installed = yes          fi # $installed = yes
2427          name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`          name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2428    
2429          # This library was specified with -dlpreopen.          # This library was specified with -dlpreopen.
2430          if test $pass = dlpreopen; then          if test "$pass" = dlpreopen; then
2431            if test -z "$libdir"; then            if test -z "$libdir"; then
2432              $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2              $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2433              exit 1              exit $EXIT_FAILURE
2434            fi            fi
2435            # Prefer using a static library (so that no silly _DYNAMIC symbols            # Prefer using a static library (so that no silly _DYNAMIC symbols
2436            # are required to link).            # are required to link).
# Line 1646  compiler." Line 2446  compiler."
2446    
2447          if test -z "$libdir"; then          if test -z "$libdir"; then
2448            # Link the convenience library            # Link the convenience library
2449            if test $linkmode = lib; then            if test "$linkmode" = lib; then
2450              deplibs="$dir/$old_library $deplibs"              deplibs="$dir/$old_library $deplibs"
2451            elif test "$linkmode,$pass" = "prog,link"; then            elif test "$linkmode,$pass" = "prog,link"; then
2452              compile_deplibs="$dir/$old_library $compile_deplibs"              compile_deplibs="$dir/$old_library $compile_deplibs"
2453              finalize_deplibs="$dir/$old_library $finalize_deplibs"              finalize_deplibs="$dir/$old_library $finalize_deplibs"
2454            else            else
2455              deplibs="$lib $deplibs"              deplibs="$lib $deplibs" # used for prog,scan pass
2456            fi            fi
2457            continue            continue
2458          fi          fi
2459    
2460          if test $linkmode = prog && test $pass != link; then  
2461            if test "$linkmode" = prog && test "$pass" != link; then
2462            newlib_search_path="$newlib_search_path $ladir"            newlib_search_path="$newlib_search_path $ladir"
2463            deplibs="$lib $deplibs"            deplibs="$lib $deplibs"
2464    
# Line 1673  compiler." Line 2474  compiler."
2474              -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
2475              esac              esac
2476              # Need to link against all dependency_libs?              # Need to link against all dependency_libs?
2477              if test $linkalldeplibs = yes; then              if test "$linkalldeplibs" = yes; then
2478                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2479              else              else
2480                # Need to hardcode shared library paths                # Need to hardcode shared library paths
2481                # or/and link against static libraries                # or/and link against static libraries
2482                newdependency_libs="$deplib $newdependency_libs"                newdependency_libs="$deplib $newdependency_libs"
2483              fi              fi
2484              case "$tmp_libs " in              if test "X$duplicate_deps" = "Xyes" ; then
2485              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;                case "$tmp_libs " in
2486              esac                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2487                  esac
2488                fi
2489              tmp_libs="$tmp_libs $deplib"              tmp_libs="$tmp_libs $deplib"
2490            done # for deplib            done # for deplib
2491            continue            continue
2492          fi # $linkmode = prog...          fi # $linkmode = prog...
2493    
2494          link_static=no # Whether the deplib will be linked statically          if test "$linkmode,$pass" = "prog,link"; then
2495          if test -n "$library_names" &&            if test -n "$library_names" &&
2496             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then               { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2497            # Link against this shared library              # We need to hardcode the library path
2498                if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2499                  # Make sure the rpath contains only unique directories.
2500                  case "$temp_rpath " in
2501                  *" $dir "*) ;;
2502                  *" $absdir "*) ;;
2503                  *) temp_rpath="$temp_rpath $absdir" ;;
2504                  esac
2505                fi
2506    
           if test "$linkmode,$pass" = "prog,link" ||  
            { test $linkmode = lib && test $hardcode_into_libs = yes; }; then  
2507              # Hardcode the library path.              # Hardcode the library path.
2508              # Skip directories that are in the system default run-time              # Skip directories that are in the system default run-time
2509              # search path.              # search path.
# Line 1716  compiler." Line 2525  compiler."
2525                esac                esac
2526                ;;                ;;
2527              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  
2528            fi # $linkmode,$pass = prog,link...            fi # $linkmode,$pass = prog,link...
2529    
2530            if test "$alldeplibs" = yes &&            if test "$alldeplibs" = yes &&
# Line 1736  compiler." Line 2534  compiler."
2534              # We only need to search for static libraries              # We only need to search for static libraries
2535              continue              continue
2536            fi            fi
2537            fi
2538    
2539            link_static=no # Whether the deplib will be linked statically
2540            use_static_libs=$prefer_static_libs
2541            if test "$use_static_libs" = built && test "$installed" = yes ; then
2542              use_static_libs=no
2543            fi
2544            if test -n "$library_names" &&
2545               { test "$use_static_libs" = no || test -z "$old_library"; }; then
2546            if test "$installed" = no; then            if test "$installed" = no; then
2547              notinst_deplibs="$notinst_deplibs $lib"              notinst_deplibs="$notinst_deplibs $lib"
2548              need_relink=yes              need_relink=yes
2549            fi            fi
2550              # This is a shared library
2551    
2552              # Warn about portability, can't link against -module's on
2553              # some systems (darwin)
2554              if test "$shouldnotlink" = yes && test "$pass" = link ; then
2555                $echo
2556                if test "$linkmode" = prog; then
2557                  $echo "*** Warning: Linking the executable $output against the loadable module"
2558                else
2559                  $echo "*** Warning: Linking the shared library $output against the loadable module"
2560                fi
2561                $echo "*** $linklib is not portable!"
2562              fi
2563              if test "$linkmode" = lib &&
2564                 test "$hardcode_into_libs" = yes; then
2565                # Hardcode the library path.
2566                # Skip directories that are in the system default run-time
2567                # search path.
2568                case " $sys_lib_dlsearch_path " in
2569                *" $absdir "*) ;;
2570                *)
2571                  case "$compile_rpath " in
2572                  *" $absdir "*) ;;
2573                  *) compile_rpath="$compile_rpath $absdir"
2574                  esac
2575                  ;;
2576                esac
2577                case " $sys_lib_dlsearch_path " in
2578                *" $libdir "*) ;;
2579                *)
2580                  case "$finalize_rpath " in
2581                  *" $libdir "*) ;;
2582                  *) finalize_rpath="$finalize_rpath $libdir"
2583                  esac
2584                  ;;
2585                esac
2586              fi
2587    
2588            if test -n "$old_archive_from_expsyms_cmds"; then            if test -n "$old_archive_from_expsyms_cmds"; then
2589              # figure out the soname              # figure out the soname
# Line 1754  compiler." Line 2597  compiler."
2597              elif test -n "$soname_spec"; then              elif test -n "$soname_spec"; then
2598                # bleh windows                # bleh windows
2599                case $host in                case $host in
2600                *cygwin*)                *cygwin* | mingw*)
2601                  major=`expr $current - $age`                  major=`expr $current - $age`
2602                  versuffix="-$major"                  versuffix="-$major"
2603                  ;;                  ;;
# Line 1766  compiler." Line 2609  compiler."
2609    
2610              # Make a new name for the extract_expsyms_cmds to use              # Make a new name for the extract_expsyms_cmds to use
2611              soroot="$soname"              soroot="$soname"
2612              soname=`echo $soroot | sed -e 's/^.*\///'`              soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2613              newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"              newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2614    
2615              # If the library has no export list, then create one now              # If the library has no export list, then create one now
2616              if test -f "$output_objdir/$soname-def"; then :              if test -f "$output_objdir/$soname-def"; then :
2617              else              else
2618                $show "extracting exported symbol list from \`$soname'"                $show "extracting exported symbol list from \`$soname'"
2619                save_ifs="$IFS"; IFS='~'                save_ifs="$IFS"; IFS='~'
2620                eval cmds=\"$extract_expsyms_cmds\"                cmds=$extract_expsyms_cmds
2621                for cmd in $cmds; do                for cmd in $cmds; do
2622                  IFS="$save_ifs"                  IFS="$save_ifs"
2623                    eval cmd=\"$cmd\"
2624                  $show "$cmd"                  $show "$cmd"
2625                  $run eval "$cmd" || exit $?                  $run eval "$cmd" || exit $?
2626                done                done
# Line 1787  compiler." Line 2631  compiler."
2631              if test -f "$output_objdir/$newlib"; then :; else              if test -f "$output_objdir/$newlib"; then :; else
2632                $show "generating import library for \`$soname'"                $show "generating import library for \`$soname'"
2633                save_ifs="$IFS"; IFS='~'                save_ifs="$IFS"; IFS='~'
2634                eval cmds=\"$old_archive_from_expsyms_cmds\"                cmds=$old_archive_from_expsyms_cmds
2635                for cmd in $cmds; do                for cmd in $cmds; do
2636                  IFS="$save_ifs"                  IFS="$save_ifs"
2637                    eval cmd=\"$cmd\"
2638                  $show "$cmd"                  $show "$cmd"
2639                  $run eval "$cmd" || exit $?                  $run eval "$cmd" || exit $?
2640                done                done
# Line 1798  compiler." Line 2643  compiler."
2643              # make sure the library variables are pointing to the new library              # make sure the library variables are pointing to the new library
2644              dir=$output_objdir              dir=$output_objdir
2645              linklib=$newlib              linklib=$newlib
2646            fi # test -n $old_archive_from_expsyms_cmds            fi # test -n "$old_archive_from_expsyms_cmds"
2647    
2648            if test $linkmode = prog || test "$mode" != relink; then            if test "$linkmode" = prog || test "$mode" != relink; then
2649              add_shlibpath=              add_shlibpath=
2650              add_dir=              add_dir=
2651              add=              add=
# Line 1809  compiler." Line 2654  compiler."
2654              immediate | unsupported)              immediate | unsupported)
2655                if test "$hardcode_direct" = no; then                if test "$hardcode_direct" = no; then
2656                  add="$dir/$linklib"                  add="$dir/$linklib"
2657                    case $host in
2658                      *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2659                      *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2660                      *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2661                        *-*-unixware7*) add_dir="-L$dir" ;;
2662                      *-*-darwin* )
2663                        # if the lib is a module then we can not link against
2664                        # it, someone is ignoring the new warnings I added
2665                        if /usr/bin/file -L $add 2> /dev/null |
2666                          $EGREP ": [^:]* bundle" >/dev/null ; then
2667                          $echo "** Warning, lib $linklib is a module, not a shared library"
2668                          if test -z "$old_library" ; then
2669                            $echo
2670                            $echo "** And there doesn't seem to be a static archive available"
2671                            $echo "** The link will probably fail, sorry"
2672                          else
2673                            add="$dir/$old_library"
2674                          fi
2675                        fi
2676                    esac
2677                elif test "$hardcode_minus_L" = no; then                elif test "$hardcode_minus_L" = no; then
2678                  case $host in                  case $host in
2679                  *-*-sunos*) add_shlibpath="$dir" ;;                  *-*-sunos*) add_shlibpath="$dir" ;;
# Line 1827  compiler." Line 2692  compiler."
2692                  add="$dir/$linklib"                  add="$dir/$linklib"
2693                elif test "$hardcode_minus_L" = yes; then                elif test "$hardcode_minus_L" = yes; then
2694                  add_dir="-L$dir"                  add_dir="-L$dir"
2695                    # Try looking first in the location we're being installed to.
2696                    if test -n "$inst_prefix_dir"; then
2697                      case $libdir in
2698                        [\\/]*)
2699                          add_dir="$add_dir -L$inst_prefix_dir$libdir"
2700                          ;;
2701                      esac
2702                    fi
2703                  add="-l$name"                  add="-l$name"
2704                elif test "$hardcode_shlibpath_var" = yes; then                elif test "$hardcode_shlibpath_var" = yes; then
2705                  add_shlibpath="$dir"                  add_shlibpath="$dir"
# Line 1840  compiler." Line 2713  compiler."
2713    
2714              if test "$lib_linked" != yes; then              if test "$lib_linked" != yes; then
2715                $echo "$modename: configuration error: unsupported hardcode properties"                $echo "$modename: configuration error: unsupported hardcode properties"
2716                exit 1                exit $EXIT_FAILURE
2717              fi              fi
2718    
2719              if test -n "$add_shlibpath"; then              if test -n "$add_shlibpath"; then
# Line 1849  compiler." Line 2722  compiler."
2722                *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;                *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2723                esac                esac
2724              fi              fi
2725              if test $linkmode = prog; then              if test "$linkmode" = prog; then
2726                test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"                test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2727                test -n "$add" && compile_deplibs="$add $compile_deplibs"                test -n "$add" && compile_deplibs="$add $compile_deplibs"
2728              else              else
# Line 1866  compiler." Line 2739  compiler."
2739              fi              fi
2740            fi            fi
2741    
2742            if test $linkmode = prog || test "$mode" = relink; then            if test "$linkmode" = prog || test "$mode" = relink; then
2743              add_shlibpath=              add_shlibpath=
2744              add_dir=              add_dir=
2745              add=              add=
# Line 1882  compiler." Line 2755  compiler."
2755                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2756                esac                esac
2757                add="-l$name"                add="-l$name"
2758                elif test "$hardcode_automatic" = yes; then
2759                  if test -n "$inst_prefix_dir" &&
2760                     test -f "$inst_prefix_dir$libdir/$linklib" ; then
2761                    add="$inst_prefix_dir$libdir/$linklib"
2762                  else
2763                    add="$libdir/$linklib"
2764                  fi
2765              else              else
2766                # We cannot seem to hardcode it, guess we'll fake it.                # We cannot seem to hardcode it, guess we'll fake it.
2767                add_dir="-L$libdir"                add_dir="-L$libdir"
2768                  # Try looking first in the location we're being installed to.
2769                  if test -n "$inst_prefix_dir"; then
2770                    case $libdir in
2771                      [\\/]*)
2772                        add_dir="$add_dir -L$inst_prefix_dir$libdir"
2773                        ;;
2774                    esac
2775                  fi
2776                add="-l$name"                add="-l$name"
2777              fi              fi
2778    
2779              if test $linkmode = prog; then              if test "$linkmode" = prog; then
2780                test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"                test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2781                test -n "$add" && finalize_deplibs="$add $finalize_deplibs"                test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2782              else              else
# Line 1896  compiler." Line 2784  compiler."
2784                test -n "$add" && deplibs="$add $deplibs"                test -n "$add" && deplibs="$add $deplibs"
2785              fi              fi
2786            fi            fi
2787          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  
2788            # Here we assume that one of hardcode_direct or hardcode_minus_L            # Here we assume that one of hardcode_direct or hardcode_minus_L
2789            # is not unsupported.  This is valid on all known static and            # is not unsupported.  This is valid on all known static and
2790            # shared platforms.            # shared platforms.
# Line 1925  compiler." Line 2804  compiler."
2804    
2805              # Just print a warning and add the library to dependency_libs so              # Just print a warning and add the library to dependency_libs so
2806              # that the program can be linked against the static library.              # that the program can be linked against the static library.
2807              echo              $echo
2808              echo "*** Warning: This library needs some functionality provided by $lib."              $echo "*** Warning: This system can not link to static lib archive $lib."
2809              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"
2810              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"
2811              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."
2812              if test "$module" = yes; then              if test "$module" = yes; then
2813                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 "
2814                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"
2815                  $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2816                if test -z "$global_symbol_pipe"; then                if test -z "$global_symbol_pipe"; then
2817                  echo                  $echo
2818                  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"
2819                  echo "*** lists from a program, using \`nm' or equivalent, but libtool could"                  $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2820                  echo "*** not find such a program.  So, this module is probably useless."                  $echo "*** not find such a program.  So, this module is probably useless."
2821                  echo "*** \`nm' from GNU binutils and a full rebuild may help."                  $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2822                fi                fi
2823                if test "$build_old_libs" = no; then                if test "$build_old_libs" = no; then
2824                  build_libtool_libs=module                  build_libtool_libs=module
# Line 1948  compiler." Line 2828  compiler."
2828                fi                fi
2829              fi              fi
2830            else            else
             convenience="$convenience $dir/$old_library"  
             old_convenience="$old_convenience $dir/$old_library"  
2831              deplibs="$dir/$old_library $deplibs"              deplibs="$dir/$old_library $deplibs"
2832              link_static=yes              link_static=yes
2833            fi            fi
2834          fi # link shared/static library?          fi # link shared/static library?
2835    
2836          if test $linkmode = lib; then          if test "$linkmode" = lib; then
2837            if test -n "$dependency_libs" &&            if test -n "$dependency_libs" &&
2838               { test $hardcode_into_libs != yes || test $build_old_libs = yes ||               { test "$hardcode_into_libs" != yes ||
2839                 test $link_static = yes; }; then                 test "$build_old_libs" = yes ||
2840                   test "$link_static" = yes; }; then
2841              # Extract -R from dependency_libs              # Extract -R from dependency_libs
2842              temp_deplibs=              temp_deplibs=
2843              for libdir in $dependency_libs; do              for libdir in $dependency_libs; do
# Line 1981  compiler." Line 2860  compiler."
2860            tmp_libs=            tmp_libs=
2861            for deplib in $dependency_libs; do            for deplib in $dependency_libs; do
2862              newdependency_libs="$deplib $newdependency_libs"              newdependency_libs="$deplib $newdependency_libs"
2863              case "$tmp_libs " in              if test "X$duplicate_deps" = "Xyes" ; then
2864              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;                case "$tmp_libs " in
2865              esac                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2866                  esac
2867                fi
2868              tmp_libs="$tmp_libs $deplib"              tmp_libs="$tmp_libs $deplib"
2869            done            done
2870    
2871            if test $link_all_deplibs != no; then            if test "$link_all_deplibs" != no; then
2872              # Add the search paths of all dependency libraries              # Add the search paths of all dependency libraries
2873              for deplib in $dependency_libs; do              for deplib in $dependency_libs; do
2874                case $deplib in                case $deplib in
# Line 2007  compiler." Line 2888  compiler."
2888                    ;;                    ;;
2889                  esac                  esac
2890                  if grep "^installed=no" $deplib > /dev/null; then                  if grep "^installed=no" $deplib > /dev/null; then
2891                    path="-L$absdir/$objdir"                    path="$absdir/$objdir"
2892                  else                  else
2893                    eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`                    eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2894                    if test -z "$libdir"; then                    if test -z "$libdir"; then
2895                      $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2                      $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2896                      exit 1                      exit $EXIT_FAILURE
2897                    fi                    fi
2898                    if test "$absdir" != "$libdir"; then                    if test "$absdir" != "$libdir"; then
2899                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2900                    fi                    fi
2901                    path="-L$absdir"                    path="$absdir"
2902                  fi                  fi
2903                    depdepl=
2904                    case $host in
2905                    *-*-darwin*)
2906                      # we do not want to link against static libs,
2907                      # but need to link against shared
2908                      eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2909                      if test -n "$deplibrary_names" ; then
2910                        for tmp in $deplibrary_names ; do
2911                          depdepl=$tmp
2912                        done
2913                        if test -f "$path/$depdepl" ; then
2914                          depdepl="$path/$depdepl"
2915                        fi
2916                        # do not add paths which are already there
2917                        case " $newlib_search_path " in
2918                        *" $path "*) ;;
2919                        *) newlib_search_path="$newlib_search_path $path";;
2920                        esac
2921                      fi
2922                      path=""
2923                      ;;
2924                    *)
2925                      path="-L$path"
2926                      ;;
2927                    esac
2928                    ;;
2929                  -l*)
2930                    case $host in
2931                    *-*-darwin*)
2932                      # Again, we only want to link against shared libraries
2933                      eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2934                      for tmp in $newlib_search_path ; do
2935                        if test -f "$tmp/lib$tmp_libs.dylib" ; then
2936                          eval depdepl="$tmp/lib$tmp_libs.dylib"
2937                          break
2938                        fi
2939                      done
2940                      path=""
2941                      ;;
2942                    *) continue ;;
2943                    esac
2944                  ;;                  ;;
2945                *) continue ;;                *) continue ;;
2946                esac                esac
2947                case " $deplibs " in                case " $deplibs " in
2948                *" $path "*) ;;                *" $path "*) ;;
2949                *) deplibs="$deplibs $path" ;;                *) deplibs="$path $deplibs" ;;
2950                  esac
2951                  case " $deplibs " in
2952                  *" $depdepl "*) ;;
2953                  *) deplibs="$depdepl $deplibs" ;;
2954                esac                esac
2955              done              done
2956            fi # link_all_deplibs != no            fi # link_all_deplibs != no
2957          fi # linkmode = lib          fi # linkmode = lib
2958        done # for deplib in $libs        done # for deplib in $libs
2959        if test $pass = dlpreopen; then        dependency_libs="$newdependency_libs"
2960          if test "$pass" = dlpreopen; then
2961          # Link the dlpreopened libraries before other libraries          # Link the dlpreopened libraries before other libraries
2962          for deplib in $save_deplibs; do          for deplib in $save_deplibs; do
2963            deplibs="$deplib $deplibs"            deplibs="$deplib $deplibs"
2964          done          done
2965        fi        fi
2966        if test $pass != dlopen; then        if test "$pass" != dlopen; then
2967          test $pass != scan && dependency_libs="$newdependency_libs"          if test "$pass" != conv; then
         if test $pass != conv; then  
2968            # Make sure lib_search_path contains only unique directories.            # Make sure lib_search_path contains only unique directories.
2969            lib_search_path=            lib_search_path=
2970            for dir in $newlib_search_path; do            for dir in $newlib_search_path; do
# Line 2060  compiler." Line 2986  compiler."
2986            eval tmp_libs=\"\$$var\"            eval tmp_libs=\"\$$var\"
2987            new_libs=            new_libs=
2988            for deplib in $tmp_libs; do            for deplib in $tmp_libs; do
2989                # FIXME: Pedantically, this is the right thing to do, so
2990                #        that some nasty dependency loop isn't accidentally
2991                #        broken:
2992                #new_libs="$deplib $new_libs"
2993                # Pragmatically, this seems to cause very few problems in
2994                # practice:
2995              case $deplib in              case $deplib in
2996              -L*) new_libs="$deplib $new_libs" ;;              -L*) new_libs="$deplib $new_libs" ;;
2997                -R*) ;;
2998              *)              *)
2999                  # And here is the reason: when a library appears more
3000                  # than once as an explicit dependence of a library, or
3001                  # is implicitly linked in more than once by the
3002                  # compiler, it is considered special, and multiple
3003                  # occurrences thereof are not removed.  Compare this
3004                  # with having the same library being listed as a
3005                  # dependency of multiple other libraries: in this case,
3006                  # we know (pedantically, we assume) the library does not
3007                  # need to be listed more than once, so we keep only the
3008                  # last copy.  This is not always right, but it is rare
3009                  # enough that we require users that really mean to play
3010                  # such unportable linking tricks to link the library
3011                  # using -Wl,-lname, so that libtool does not consider it
3012                  # for duplicate removal.
3013                case " $specialdeplibs " in                case " $specialdeplibs " in
3014                *" $deplib "*) new_libs="$deplib $new_libs" ;;                *" $deplib "*) new_libs="$deplib $new_libs" ;;
3015                *)                *)
# Line 2090  compiler." Line 3037  compiler."
3037            eval $var=\"$tmp_libs\"            eval $var=\"$tmp_libs\"
3038          done # for var          done # for var
3039        fi        fi
3040        if test "$pass" = "conv" &&        # Last step: remove runtime libs from dependency_libs
3041         { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then        # (they stay in deplibs)
3042          libs="$deplibs" # reset libs        tmp_libs=
3043          deplibs=        for i in $dependency_libs ; do
3044        fi          case " $predeps $postdeps $compiler_lib_search_path " in
3045            *" $i "*)
3046              i=""
3047              ;;
3048            esac
3049            if test -n "$i" ; then
3050              tmp_libs="$tmp_libs $i"
3051            fi
3052          done
3053          dependency_libs=$tmp_libs
3054      done # for pass      done # for pass
3055      if test $linkmode = prog; then      if test "$linkmode" = prog; then
3056        dlfiles="$newdlfiles"        dlfiles="$newdlfiles"
3057        dlprefiles="$newdlprefiles"        dlprefiles="$newdlprefiles"
3058      fi      fi
3059    
3060      case $linkmode in      case $linkmode in
3061      oldlib)      oldlib)
3062          if test -n "$deplibs"; then
3063            $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3064          fi
3065    
3066        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3067          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3068        fi        fi
# Line 2116  compiler." Line 3076  compiler."
3076        fi        fi
3077    
3078        if test -n "$vinfo"; then        if test -n "$vinfo"; then
3079          $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2          $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3080        fi        fi
3081    
3082        if test -n "$release"; then        if test -n "$release"; then
# Line 2138  compiler." Line 3098  compiler."
3098        case $outputname in        case $outputname in
3099        lib*)        lib*)
3100          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3101            eval shared_ext=\"$shrext_cmds\"
3102          eval libname=\"$libname_spec\"          eval libname=\"$libname_spec\"
3103          ;;          ;;
3104        *)        *)
3105          if test "$module" = no; then          if test "$module" = no; then
3106            $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2            $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3107            $echo "$help" 1>&2            $echo "$help" 1>&2
3108            exit 1            exit $EXIT_FAILURE
3109          fi          fi
3110          if test "$need_lib_prefix" != no; then          if test "$need_lib_prefix" != no; then
3111            # Add the "lib" prefix for modules if required            # Add the "lib" prefix for modules if required
3112            name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`            name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3113              eval shared_ext=\"$shrext_cmds\"
3114            eval libname=\"$libname_spec\"            eval libname=\"$libname_spec\"
3115          else          else
3116            libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`            libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
# Line 2159  compiler." Line 3121  compiler."
3121        if test -n "$objs"; then        if test -n "$objs"; then
3122          if test "$deplibs_check_method" != pass_all; then          if test "$deplibs_check_method" != pass_all; then
3123            $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
3124            exit 1            exit $EXIT_FAILURE
3125          else          else
3126            echo            $echo
3127            echo "*** Warning: Linking the shared library $output against the non-libtool"            $echo "*** Warning: Linking the shared library $output against the non-libtool"
3128            echo "*** objects $objs is not portable!"            $echo "*** objects $objs is not portable!"
3129            libobjs="$libobjs $objs"            libobjs="$libobjs $objs"
3130          fi          fi
3131        fi        fi
# Line 2173  compiler." Line 3135  compiler."
3135        fi        fi
3136    
3137        set dummy $rpath        set dummy $rpath
3138        if test $# -gt 2; then        if test "$#" -gt 2; then
3139          $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
3140        fi        fi
3141        install_libdir="$2"        install_libdir="$2"
# Line 2182  compiler." Line 3144  compiler."
3144        if test -z "$rpath"; then        if test -z "$rpath"; then
3145          if test "$build_libtool_libs" = yes; then          if test "$build_libtool_libs" = yes; then
3146            # Building a libtool convenience library.            # Building a libtool convenience library.
3147            libext=al            # Some compilers have problems with a `.al' extension so
3148              # convenience libraries should have the same extension an
3149              # archive normally would.
3150            oldlibs="$output_objdir/$libname.$libext $oldlibs"            oldlibs="$output_objdir/$libname.$libext $oldlibs"
3151            build_libtool_libs=convenience            build_libtool_libs=convenience
3152            build_old_libs=yes            build_old_libs=yes
3153          fi          fi
3154    
3155          if test -n "$vinfo"; then          if test -n "$vinfo"; then
3156            $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
3157          fi          fi
3158    
3159          if test -n "$release"; then          if test -n "$release"; then
# Line 2205  compiler." Line 3169  compiler."
3169          if test -n "$8"; then          if test -n "$8"; then
3170            $echo "$modename: too many parameters to \`-version-info'" 1>&2            $echo "$modename: too many parameters to \`-version-info'" 1>&2
3171            $echo "$help" 1>&2            $echo "$help" 1>&2
3172            exit 1            exit $EXIT_FAILURE
3173          fi          fi
3174    
3175          current="$2"          # convert absolute version numbers to libtool ages
3176          revision="$3"          # this retains compatibility with .la files and attempts
3177          age="$4"          # to make the code below a bit more comprehensible
3178    
3179            case $vinfo_number in
3180            yes)
3181              number_major="$2"
3182              number_minor="$3"
3183              number_revision="$4"
3184              #
3185              # There are really only two kinds -- those that
3186              # use the current revision as the major version
3187              # and those that subtract age and use age as
3188              # a minor version.  But, then there is irix
3189              # which has an extra 1 added just for fun
3190              #
3191              case $version_type in
3192              darwin|linux|osf|windows)
3193                current=`expr $number_major + $number_minor`
3194                age="$number_minor"
3195                revision="$number_revision"
3196                ;;
3197              freebsd-aout|freebsd-elf|sunos)
3198                current="$number_major"
3199                revision="$number_minor"
3200                age="0"
3201                ;;
3202              irix|nonstopux)
3203                current=`expr $number_major + $number_minor - 1`
3204                age="$number_minor"
3205                revision="$number_minor"
3206                ;;
3207              *)
3208                $echo "$modename: unknown library version type \`$version_type'" 1>&2
3209                $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3210                exit $EXIT_FAILURE
3211                ;;
3212              esac
3213              ;;
3214            no)
3215              current="$2"
3216              revision="$3"
3217              age="$4"
3218              ;;
3219            esac
3220    
3221          # Check that each of the things are valid numbers.          # Check that each of the things are valid numbers.
3222          case $current in          case $current in
3223          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]) ;;
3224          *)          *)
3225            $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2            $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3226            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3227            exit 1            exit $EXIT_FAILURE
3228            ;;            ;;
3229          esac          esac
3230    
3231          case $revision in          case $revision in
3232          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]) ;;
3233          *)          *)
3234            $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2            $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3235            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3236            exit 1            exit $EXIT_FAILURE
3237            ;;            ;;
3238          esac          esac
3239    
3240          case $age in          case $age in
3241          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]) ;;
3242          *)          *)
3243            $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2            $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3244            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3245            exit 1            exit $EXIT_FAILURE
3246            ;;            ;;
3247          esac          esac
3248    
3249          if test $age -gt $current; then          if test "$age" -gt "$current"; then
3250            $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
3251            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3252            exit 1            exit $EXIT_FAILURE
3253          fi          fi
3254    
3255          # Calculate the version variables.          # Calculate the version variables.
# Line 2260  compiler." Line 3266  compiler."
3266            versuffix="$major.$age.$revision"            versuffix="$major.$age.$revision"
3267            # Darwin ld doesn't like 0 for these options...            # Darwin ld doesn't like 0 for these options...
3268            minor_current=`expr $current + 1`            minor_current=`expr $current + 1`
3269            verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"            verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3270            ;;            ;;
3271    
3272          freebsd-aout)          freebsd-aout)
# Line 2273  compiler." Line 3279  compiler."
3279            versuffix=".$current";            versuffix=".$current";
3280            ;;            ;;
3281    
3282          irix)          irix | nonstopux)
3283            major=`expr $current - $age + 1`            major=`expr $current - $age + 1`
3284            verstring="sgi$major.$revision"  
3285              case $version_type in
3286                nonstopux) verstring_prefix=nonstopux ;;
3287                *)         verstring_prefix=sgi ;;
3288              esac
3289              verstring="$verstring_prefix$major.$revision"
3290    
3291            # Add in all the interfaces that we are compatible with.            # Add in all the interfaces that we are compatible with.
3292            loop=$revision            loop=$revision
3293            while test $loop != 0; do            while test "$loop" -ne 0; do
3294              iface=`expr $revision - $loop`              iface=`expr $revision - $loop`
3295              loop=`expr $loop - 1`              loop=`expr $loop - 1`
3296              verstring="sgi$major.$iface:$verstring"              verstring="$verstring_prefix$major.$iface:$verstring"
3297            done            done
3298    
3299            # Before this point, $major must not contain `.'.            # Before this point, $major must not contain `.'.
# Line 2296  compiler." Line 3307  compiler."
3307            ;;            ;;
3308    
3309          osf)          osf)
3310            major=`expr $current - $age`            major=.`expr $current - $age`
3311            versuffix=".$current.$age.$revision"            versuffix=".$current.$age.$revision"
3312            verstring="$current.$age.$revision"            verstring="$current.$age.$revision"
3313    
3314            # Add in all the interfaces that we are compatible with.            # Add in all the interfaces that we are compatible with.
3315            loop=$age            loop=$age
3316            while test $loop != 0; do            while test "$loop" -ne 0; do
3317              iface=`expr $current - $loop`              iface=`expr $current - $loop`
3318              loop=`expr $loop - 1`              loop=`expr $loop - 1`
3319              verstring="$verstring:${iface}.0"              verstring="$verstring:${iface}.0"
# Line 2326  compiler." Line 3337  compiler."
3337    
3338          *)          *)
3339            $echo "$modename: unknown library version type \`$version_type'" 1>&2            $echo "$modename: unknown library version type \`$version_type'" 1>&2
3340            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
3341            exit 1            exit $EXIT_FAILURE
3342            ;;            ;;
3343          esac          esac
3344    
3345          # Clear the version info if we defaulted, and they specified a release.          # Clear the version info if we defaulted, and they specified a release.
3346          if test -z "$vinfo" && test -n "$release"; then          if test -z "$vinfo" && test -n "$release"; then
3347            major=            major=
           verstring="0.0"  
3348            case $version_type in            case $version_type in
3349            darwin)            darwin)
3350              # we can't check for "0.0" in archive_cmds due to quoting              # we can't check for "0.0" in archive_cmds due to quoting
3351              # problems, so we reset it completely              # problems, so we reset it completely
3352              verstring=""              verstring=
3353              ;;              ;;
3354            *)            *)
3355              verstring="0.0"              verstring="0.0"
# Line 2373  compiler." Line 3383  compiler."
3383        fi        fi
3384    
3385        if test "$mode" != relink; then        if test "$mode" != relink; then
3386          # Remove our outputs.          # Remove our outputs, but don't remove object files since they
3387          $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"          # may have been created when compiling PIC objects.
3388          $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*          removelist=
3389            tempremovelist=`$echo "$output_objdir/*"`
3390            for p in $tempremovelist; do
3391              case $p in
3392                *.$objext)
3393                   ;;
3394                $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3395                   if test "X$precious_files_regex" != "X"; then
3396                     if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3397                     then
3398                       continue
3399                     fi
3400                   fi
3401                   removelist="$removelist $p"
3402                   ;;
3403                *) ;;
3404              esac
3405            done
3406            if test -n "$removelist"; then
3407              $show "${rm}r $removelist"
3408              $run ${rm}r $removelist
3409            fi
3410        fi        fi
3411    
3412        # Now set the variables for building old libraries.        # Now set the variables for building old libraries.
# Line 2388  compiler." Line 3419  compiler."
3419    
3420        # Eliminate all temporary directories.        # Eliminate all temporary directories.
3421        for path in $notinst_path; do        for path in $notinst_path; do
3422          lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`          lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3423          deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`          deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3424          dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`          dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3425        done        done
3426    
3427        if test -n "$xrpath"; then        if test -n "$xrpath"; then
# Line 2403  compiler." Line 3434  compiler."
3434            *) finalize_rpath="$finalize_rpath $libdir" ;;            *) finalize_rpath="$finalize_rpath $libdir" ;;
3435            esac            esac
3436          done          done
3437          if test $hardcode_into_libs != yes || test $build_old_libs = yes; then          if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3438            dependency_libs="$temp_xrpath $dependency_libs"            dependency_libs="$temp_xrpath $dependency_libs"
3439          fi          fi
3440        fi        fi
# Line 2441  compiler." Line 3472  compiler."
3472            *-*-netbsd*)            *-*-netbsd*)
3473              # 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.
3474              ;;              ;;
3475            *-*-openbsd*)            *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3476              # Do not include libc due to us having libc/libc_r.              # Do not include libc due to us having libc/libc_r.
3477              ;;              ;;
3478            *)            *-*-sco3.2v5* | *-*-sco5v6*)
3479                # Causes problems with __ctype
3480                ;;
3481              *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3482                # Compiler inserts libc in the correct place for threads to work
3483                ;;
3484              *)
3485              # Add libc to deplibs on all other systems if necessary.              # Add libc to deplibs on all other systems if necessary.
3486              if test $build_libtool_need_lc = "yes"; then              if test "$build_libtool_need_lc" = "yes"; then
3487                deplibs="$deplibs -lc"                deplibs="$deplibs -lc"
3488              fi              fi
3489              ;;              ;;
# Line 2473  compiler." Line 3510  compiler."
3510            # This might be a little naive.  We might want to check            # This might be a little naive.  We might want to check
3511            # whether the library exists or not.  But this is on            # whether the library exists or not.  But this is on
3512            # osf3 & osf4 and I'm not really sure... Just            # osf3 & osf4 and I'm not really sure... Just
3513            # implementing what was already the behaviour.            # implementing what was already the behavior.
3514            newdeplibs=$deplibs            newdeplibs=$deplibs
3515            ;;            ;;
3516          test_compile)          test_compile)
# Line 2486  compiler." Line 3523  compiler."
3523            int main() { return 0; }            int main() { return 0; }
3524  EOF  EOF
3525            $rm conftest            $rm conftest
3526            $CC -o conftest conftest.c $deplibs            $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3527            if test $? -eq 0 ; then            if test "$?" -eq 0 ; then
3528              ldd_output=`ldd conftest`              ldd_output=`ldd conftest`
3529              for i in $deplibs; do              for i in $deplibs; do
3530                name="`expr $i : '-l\(.*\)'`"                name=`expr $i : '-l\(.*\)'`
3531                # If $name is empty we are operating on a -L argument.                # If $name is empty we are operating on a -L argument.
3532                if test -n "$name" && test "$name" != "0"; then                if test "$name" != "" && test "$name" -ne "0"; then
3533                  libname=`eval \\$echo \"$libname_spec\"`                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3534                  deplib_matches=`eval \\$echo \"$library_names_spec\"`                    case " $predeps $postdeps " in
3535                  set dummy $deplib_matches                    *" $i "*)
3536                  deplib_match=$2                      newdeplibs="$newdeplibs $i"
3537                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then                      i=""
3538                    newdeplibs="$newdeplibs $i"                      ;;
3539                  else                    esac
3540                    droppeddeps=yes                  fi
3541                    echo                  if test -n "$i" ; then
3542                    echo "*** Warning: This library needs some functionality provided by $i."                    libname=`eval \\$echo \"$libname_spec\"`
3543                    echo "*** I have the capability to make that library automatically link in when"                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3544                    echo "*** you link to this library.  But I can only do this if you have a"                    set dummy $deplib_matches
3545                    echo "*** shared version of the library, which you do not appear to have."                    deplib_match=$2
3546                      if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3547                        newdeplibs="$newdeplibs $i"
3548                      else
3549                        droppeddeps=yes
3550                        $echo
3551                        $echo "*** Warning: dynamic linker does not accept needed library $i."
3552                        $echo "*** I have the capability to make that library automatically link in when"
3553                        $echo "*** you link to this library.  But I can only do this if you have a"
3554                        $echo "*** shared version of the library, which I believe you do not have"
3555                        $echo "*** because a test_compile did reveal that the linker did not use it for"
3556                        $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3557                      fi
3558                  fi                  fi
3559                else                else
3560                  newdeplibs="$newdeplibs $i"                  newdeplibs="$newdeplibs $i"
3561                fi                fi
3562              done              done
3563            else            else
3564              # Error occured in the first compile.  Let's try to salvage the situation:              # Error occurred in the first compile.  Let's try to salvage
3565              # Compile a seperate program for each library.              # the situation: Compile a separate program for each library.
3566              for i in $deplibs; do              for i in $deplibs; do
3567                name="`expr $i : '-l\(.*\)'`"                name=`expr $i : '-l\(.*\)'`
3568               # If $name is empty we are operating on a -L argument.                # If $name is empty we are operating on a -L argument.
3569                if test -n "$name" && test "$name" != "0"; then                if test "$name" != "" && test "$name" != "0"; then
3570                  $rm conftest                  $rm conftest
3571                  $CC -o conftest conftest.c $i                  $LTCC $LTCFLAGS -o conftest conftest.c $i
3572                  # Did it work?                  # Did it work?
3573                  if test $? -eq 0 ; then                  if test "$?" -eq 0 ; then
3574                    ldd_output=`ldd conftest`                    ldd_output=`ldd conftest`
3575                    libname=`eval \\$echo \"$libname_spec\"`                    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3576                    deplib_matches=`eval \\$echo \"$library_names_spec\"`                      case " $predeps $postdeps " in
3577                    set dummy $deplib_matches                      *" $i "*)
3578                    deplib_match=$2                        newdeplibs="$newdeplibs $i"
3579                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then                        i=""
3580                      newdeplibs="$newdeplibs $i"                        ;;
3581                    else                      esac
3582                      droppeddeps=yes                    fi
3583                      echo                    if test -n "$i" ; then
3584                      echo "*** Warning: This library needs some functionality provided by $i."                      libname=`eval \\$echo \"$libname_spec\"`
3585                      echo "*** I have the capability to make that library automatically link in when"                      deplib_matches=`eval \\$echo \"$library_names_spec\"`
3586                      echo "*** you link to this library.  But I can only do this if you have a"                      set dummy $deplib_matches
3587                      echo "*** shared version of the library, which you do not appear to have."                      deplib_match=$2
3588                        if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3589                          newdeplibs="$newdeplibs $i"
3590                        else
3591                          droppeddeps=yes
3592                          $echo
3593                          $echo "*** Warning: dynamic linker does not accept needed library $i."
3594                          $echo "*** I have the capability to make that library automatically link in when"
3595                          $echo "*** you link to this library.  But I can only do this if you have a"
3596                          $echo "*** shared version of the library, which you do not appear to have"
3597                          $echo "*** because a test_compile did reveal that the linker did not use this one"
3598                          $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3599                        fi
3600                    fi                    fi
3601                  else                  else
3602                    droppeddeps=yes                    droppeddeps=yes
3603                    echo                    $echo
3604                    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"
3605                    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"
3606                    echo "*** library that it depends on before this library will be fully"                    $echo "*** library that it depends on before this library will be fully"
3607                    echo "*** functional.  Installing it before continuing would be even better."                    $echo "*** functional.  Installing it before continuing would be even better."
3608                  fi                  fi
3609                else                else
3610                  newdeplibs="$newdeplibs $i"                  newdeplibs="$newdeplibs $i"
# Line 2555  EOF Line 3616  EOF
3616            set dummy $deplibs_check_method            set dummy $deplibs_check_method
3617            file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`            file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3618            for a_deplib in $deplibs; do            for a_deplib in $deplibs; do
3619              name="`expr $a_deplib : '-l\(.*\)'`"              name=`expr $a_deplib : '-l\(.*\)'`
3620              # If $name is empty we are operating on a -L argument.              # If $name is empty we are operating on a -L argument.
3621              if test -n "$name" && test "$name" != "0"; then              if test "$name" != "" && test  "$name" != "0"; then
3622                libname=`eval \\$echo \"$libname_spec\"`                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3623                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do                  case " $predeps $postdeps " in
3624                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`                  *" $a_deplib "*)
3625                      for potent_lib in $potential_libs; do                    newdeplibs="$newdeplibs $a_deplib"
3626                      a_deplib=""
3627                      ;;
3628                    esac
3629                  fi
3630                  if test -n "$a_deplib" ; then
3631                    libname=`eval \\$echo \"$libname_spec\"`
3632                    for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3633                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3634                      for potent_lib in $potential_libs; do
3635                        # Follow soft links.                        # Follow soft links.
3636                        if ls -lLd "$potent_lib" 2>/dev/null \                        if ls -lLd "$potent_lib" 2>/dev/null \
3637                           | grep " -> " >/dev/null; then                           | grep " -> " >/dev/null; then
# Line 2574  EOF Line 3644  EOF
3644                        # but so what?                        # but so what?
3645                        potlib="$potent_lib"                        potlib="$potent_lib"
3646                        while test -h "$potlib" 2>/dev/null; do                        while test -h "$potlib" 2>/dev/null; do
3647                          potliblink=`ls -ld $potlib | sed 's/.* -> //'`                          potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3648                          case $potliblink in                          case $potliblink in
3649                          [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;                          [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3650                          *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;                          *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3651                          esac                          esac
3652                        done                        done
3653                        if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \                        if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3654                           | sed 10q \                           | ${SED} 10q \
3655                           | egrep "$file_magic_regex" > /dev/null; then                           | $EGREP "$file_magic_regex" > /dev/null; then
3656                          newdeplibs="$newdeplibs $a_deplib"                          newdeplibs="$newdeplibs $a_deplib"
3657                          a_deplib=""                          a_deplib=""
3658                          break 2                          break 2
3659                        fi                        fi
3660                      done                    done
3661                done                  done
3662                  fi
3663                if test -n "$a_deplib" ; then                if test -n "$a_deplib" ; then
3664                  droppeddeps=yes                  droppeddeps=yes
3665                  echo                  $echo
3666                  echo "*** Warning: This library needs some functionality provided by $a_deplib."                  $echo "*** Warning: linker path does not have real file for library $a_deplib."
3667                  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"
3668                  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"
3669                  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"
3670                    $echo "*** because I did check the linker path looking for a file starting"
3671                    if test -z "$potlib" ; then
3672                      $echo "*** with $libname but no candidates were found. (...for file magic test)"
3673                    else
3674                      $echo "*** with $libname and none of the candidates passed a file format test"
3675                      $echo "*** using a file magic. Last file checked: $potlib"