Develop and Download Open Source Software

Browse CVS Repository

Diff of /freewnn/FreeWnn/ltmain.sh

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

revision 1.4 by hiroo, Sat Sep 29 13:20:41 2001 UTC revision 1.5 by aono, Wed Jun 4 08:35:02 2003 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
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 49  EOF Line 49  EOF
49  fi  fi
50    
51  # The name of this program.  # The name of this program.
52  progname=`$echo "$0" | sed 's%^.*/%%'`  progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53  modename="$progname"  modename="$progname"
54    
55  # Constants.  # Constants.
56  PROGRAM=ltmain.sh  PROGRAM=ltmain.sh
57  PACKAGE=libtool  PACKAGE=libtool
58  VERSION=1.4  VERSION=1.5
59  TIMESTAMP=" (1.920 2001/04/24 23:26:18)"  TIMESTAMP=" (1.1220 2003/04/05 19:32:58)"
60    
61  default_mode=  default_mode=
62  help="Try \`$progname --help' for more information."  help="Try \`$progname --help' for more information."
# Line 67  rm="rm -f" Line 67  rm="rm -f"
67    
68  # Sed substitution that helps us do robust quoting.  It backslashifies  # Sed substitution that helps us do robust quoting.  It backslashifies
69  # metacharacters that are still active within double-quoted strings.  # metacharacters that are still active within double-quoted strings.
70  Xsed='sed -e 1s/^X//'  Xsed="${SED}"' -e 1s/^X//'
71  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'  sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72  SP2NL='tr \040 \012'  # test EBCDIC or ASCII
73  NL2SP='tr \015\012 \040\040'  case `echo A|od -x` in
74     *[Cc]1*) # EBCDIC based system
75      SP2NL="tr '\100' '\n'"
76      NL2SP="tr '\r\n' '\100\100'"
77      ;;
78     *) # Assume ASCII based system
79      SP2NL="tr '\040' '\012'"
80      NL2SP="tr '\015\012' '\040\040'"
81      ;;
82    esac
83    
84  # NLS nuisances.  # NLS nuisances.
85  # Only set LANG and LC_ALL to C if already set.  # Only set LANG and LC_ALL to C if already set.
# Line 84  if test "${LANG+set}" = set; then Line 93  if test "${LANG+set}" = set; then
93    save_LANG="$LANG"; LANG=C; export LANG    save_LANG="$LANG"; LANG=C; export LANG
94  fi  fi
95    
96    # Make sure IFS has a sensible default
97    : ${IFS="       "}
98    
99  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100    echo "$modename: not configured to build any kind of library" 1>&2    $echo "$modename: not configured to build any kind of library" 1>&2
101    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
102    exit 1    exit 1
103  fi  fi
104    
# Line 102  execute_dlfiles= Line 114  execute_dlfiles=
114  lo2o="s/\\.lo\$/.${objext}/"  lo2o="s/\\.lo\$/.${objext}/"
115  o2lo="s/\\.${objext}\$/.lo/"  o2lo="s/\\.${objext}\$/.lo/"
116    
117    #####################################
118    # Shell function definitions:
119    # This seems to be the best place for them
120    
121    # Need a lot of goo to handle *both* DLLs and import libs
122    # Has to be a shell function in order to 'eat' the argument
123    # that is supplied when $file_magic_command is called.
124    win32_libid () {
125      win32_libid_type="unknown"
126      win32_fileres=`file -L $1 2>/dev/null`
127      case $win32_fileres in
128      *ar\ archive\ import\ library*) # definitely import
129        win32_libid_type="x86 archive import"
130        ;;
131      *ar\ archive*) # could be an import, or static
132        if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
133          grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
134          win32_nmres=`eval $NM -f posix -A $1 | \
135            sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
136          if test "X$win32_nmres" = "Ximport" ; then
137            win32_libid_type="x86 archive import"
138          else
139            win32_libid_type="x86 archive static"
140          fi
141        fi
142        ;;
143      *DLL*)
144        win32_libid_type="x86 DLL"
145        ;;
146      *executable*) # but shell scripts are "executable" too...
147        case $win32_fileres in
148        *MS\ Windows\ PE\ Intel*)
149          win32_libid_type="x86 DLL"
150          ;;
151        esac
152        ;;
153      esac
154      $echo $win32_libid_type
155    }
156    
157    # End of Shell function definitions
158    #####################################
159    
160  # Parse our command line options once, thoroughly.  # Parse our command line options once, thoroughly.
161  while test $# -gt 0  while test "$#" -gt 0
162  do  do
163    arg="$1"    arg="$1"
164    shift    shift
# Line 119  do Line 174  do
174      execute_dlfiles)      execute_dlfiles)
175        execute_dlfiles="$execute_dlfiles $arg"        execute_dlfiles="$execute_dlfiles $arg"
176        ;;        ;;
177        tag)
178          tagname="$arg"
179    
180          # Check whether tagname contains only valid characters
181          case $tagname in
182          *[!-_A-Za-z0-9,/]*)
183            $echo "$progname: invalid tag name: $tagname" 1>&2
184            exit 1
185            ;;
186          esac
187    
188          case $tagname in
189          CC)
190            # Don't test for the "default" C tag, as we know, it's there, but
191            # not specially marked.
192            ;;
193          *)
194            if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
195              taglist="$taglist $tagname"
196              # Evaluate the configuration.
197              eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
198            else
199              $echo "$progname: ignoring unknown tag $tagname" 1>&2
200            fi
201            ;;
202          esac
203          ;;
204      *)      *)
205        eval "$prev=\$arg"        eval "$prev=\$arg"
206        ;;        ;;
# Line 136  do Line 218  do
218      ;;      ;;
219    
220    --version)    --version)
221      echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"      $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
222        $echo
223        $echo "Copyright (C) 2003  Free Software Foundation, Inc."
224        $echo "This is free software; see the source for copying conditions.  There is NO"
225        $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
226      exit 0      exit 0
227      ;;      ;;
228    
229    --config)    --config)
230      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' $0
231        # Now print the configurations for the tags.
232        for tagname in $taglist; do
233          ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
234        done
235      exit 0      exit 0
236      ;;      ;;
237    
238    --debug)    --debug)
239      echo "$progname: enabling shell trace mode"      $echo "$progname: enabling shell trace mode"
240      set -x      set -x
241      ;;      ;;
242    
# Line 155  do Line 245  do
245      ;;      ;;
246    
247    --features)    --features)
248      echo "host: $host"      $echo "host: $host"
249      if test "$build_libtool_libs" = yes; then      if test "$build_libtool_libs" = yes; then
250        echo "enable shared libraries"        $echo "enable shared libraries"
251      else      else
252        echo "disable shared libraries"        $echo "disable shared libraries"
253      fi      fi
254      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
255        echo "enable static libraries"        $echo "enable static libraries"
256      else      else
257        echo "disable static libraries"        $echo "disable static libraries"
258      fi      fi
259      exit 0      exit 0
260      ;;      ;;
# Line 174  do Line 264  do
264    --mode) prevopt="--mode" prev=mode ;;    --mode) prevopt="--mode" prev=mode ;;
265    --mode=*) mode="$optarg" ;;    --mode=*) mode="$optarg" ;;
266    
267      --preserve-dup-deps) duplicate_deps="yes" ;;
268    
269    --quiet | --silent)    --quiet | --silent)
270      show=:      show=:
271      ;;      ;;
272    
273      --tag) prevopt="--tag" prev=tag ;;
274      --tag=*)
275        set tag "$optarg" ${1+"$@"}
276        shift
277        prev=tag
278        ;;
279    
280    -dlopen)    -dlopen)
281      prevopt="-dlopen"      prevopt="-dlopen"
282      prev=execute_dlfiles      prev=execute_dlfiles
# Line 202  if test -n "$prevopt"; then Line 301  if test -n "$prevopt"; then
301    exit 1    exit 1
302  fi  fi
303    
304    # If this variable is set in any of the actions, the command in it
305    # will be execed at the end.  This prevents here-documents from being
306    # left over by shells.
307    exec_cmd=
308    
309  if test -z "$show_help"; then  if test -z "$show_help"; then
310    
311    # Infer the operation mode.    # Infer the operation mode.
312    if test -z "$mode"; then    if test -z "$mode"; then
313        $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
314        $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
315      case $nonopt in      case $nonopt in
316      *cc | *++ | gcc* | *-gcc*)      *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
317        mode=link        mode=link
318        for arg        for arg
319        do        do
# Line 262  if test -z "$show_help"; then Line 368  if test -z "$show_help"; then
368      modename="$modename: compile"      modename="$modename: compile"
369      # Get the compilation command and the source file.      # Get the compilation command and the source file.
370      base_compile=      base_compile=
371      prev=      srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
     lastarg=  
     srcfile="$nonopt"  
372      suppress_output=      suppress_output=
373        arg_mode=normal
374        libobj=
375    
     user_target=no  
376      for arg      for arg
377      do      do
378        case $prev in        case "$arg_mode" in
379        "") ;;        arg  )
380        xcompiler)          # do not "continue".  Instead, add this to base_compile
381          # Aesthetically quote the previous argument.          lastarg="$arg"
382          prev=          arg_mode=normal
383          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  
384    
385          # Add the previous argument to base_compile.        target )
386          if test -z "$base_compile"; then          libobj="$arg"
387            base_compile="$lastarg"          arg_mode=normal
         else  
           base_compile="$base_compile $lastarg"  
         fi  
388          continue          continue
389          ;;          ;;
       esac  
390    
391        # Accept any command-line options.        normal )
392        case $arg in          # Accept any command-line options.
393        -o)          case $arg in
394          if test "$user_target" != "no"; then          -o)
395            $echo "$modename: you cannot specify \`-o' more than once" 1>&2            if test -n "$libobj" ; then
396            exit 1              $echo "$modename: you cannot specify \`-o' more than once" 1>&2
397          fi              exit 1
398          user_target=next            fi
399          ;;            arg_mode=target
400              continue
401              ;;
402    
403        -static)          -static)
404          build_old_libs=yes            build_old_libs=yes
405          continue            continue
406          ;;            ;;
407    
408        -prefer-pic)          -prefer-pic)
409          pic_mode=yes            pic_mode=yes
410          continue            continue
411          ;;            ;;
412    
413        -prefer-non-pic)          -prefer-non-pic)
414          pic_mode=no            pic_mode=no
415          continue            continue
416          ;;            ;;
417    
418        -Xcompiler)          -Xcompiler)
419          prev=xcompiler            arg_mode=arg  #  the next one goes into the "base_compile" arg list
420          continue            continue      #  The current "srcfile" will either be retained or
421          ;;            ;;            #  replaced later.  I would guess that would be a bug.
422    
423            -Wc,*)
424              args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
425              lastarg=
426              save_ifs="$IFS"; IFS=','
427              for arg in $args; do
428                IFS="$save_ifs"
429    
430        -Wc,*)              # Double-quote args containing other shell metacharacters.
431          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`              # Many Bourne shells cannot handle close brackets correctly
432          lastarg=              # in scan sets, so we specify it separately.
433          IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','              case $arg in
434          for arg in $args; do                *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
435                  arg="\"$arg\""
436                  ;;
437                esac
438                lastarg="$lastarg $arg"
439              done
440            IFS="$save_ifs"            IFS="$save_ifs"
441              lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
442    
443            # Double-quote args containing other shell metacharacters.            # Add the arguments to base_compile.
           # Many Bourne shells cannot handle close brackets correctly  
           # in scan sets, so we specify it separately.  
           case $arg in  
             *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")  
             arg="\"$arg\""  
             ;;  
           esac  
           lastarg="$lastarg $arg"  
         done  
         IFS="$save_ifs"  
         lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`  
   
         # Add the arguments to base_compile.  
         if test -z "$base_compile"; then  
           base_compile="$lastarg"  
         else  
444            base_compile="$base_compile $lastarg"            base_compile="$base_compile $lastarg"
445          fi            continue
446          continue            ;;
         ;;  
       esac  
447    
448        case $user_target in          * )
449        next)            # Accept the current argument as the source file.
450          # The next one is the -o target name            # The previous "srcfile" becomes the current argument.
451          user_target=yes            #
452          continue            lastarg="$srcfile"
453          ;;            srcfile="$arg"
454        yes)            ;;
455          # We got the output file          esac  #  case $arg
         user_target=set  
         libobj="$arg"  
         continue  
456          ;;          ;;
457        esac        esac    #  case $arg_mode
   
       # Accept the current argument as the source file.  
       lastarg="$srcfile"  
       srcfile="$arg"  
458    
459        # 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.  
460        lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`        lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
461    
462          case $lastarg in
463        # Double-quote args containing other shell metacharacters.        # Double-quote args containing other shell metacharacters.
464        # Many Bourne shells cannot handle close brackets correctly        # Many Bourne shells cannot handle close brackets correctly
465        # in scan sets, so we specify it separately.        # in scan sets, so we specify it separately.
       case $lastarg in  
466        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
467          lastarg="\"$lastarg\""          lastarg="\"$lastarg\""
468          ;;          ;;
469        esac        esac
470    
471        # Add the previous argument to base_compile.        base_compile="$base_compile $lastarg"
472        if test -z "$base_compile"; then      done # for arg
         base_compile="$lastarg"  
       else  
         base_compile="$base_compile $lastarg"  
       fi  
     done  
473    
474      case $user_target in      case $arg_mode in
475      set)      arg)
476        ;;        $echo "$modename: you must specify an argument for -Xcompile"
477      no)        exit 1
       # Get the name of the library object.  
       libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`  
478        ;;        ;;
479      *)      target)
480        $echo "$modename: you must specify a target with \`-o'" 1>&2        $echo "$modename: you must specify a target with \`-o'" 1>&2
481        exit 1        exit 1
482        ;;        ;;
483        *)
484          # Get the name of the library object.
485          [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
486          ;;
487      esac      esac
488    
489      # Recognize several different file suffixes.      # Recognize several different file suffixes.
490      # 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
491      xform='[cCFSfmso]'      xform='[cCFSifmso]'
492      case $libobj in      case $libobj in
493      *.ada) xform=ada ;;      *.ada) xform=ada ;;
494      *.adb) xform=adb ;;      *.adb) xform=adb ;;
# Line 421  if test -z "$show_help"; then Line 496  if test -z "$show_help"; then
496      *.asm) xform=asm ;;      *.asm) xform=asm ;;
497      *.c++) xform=c++ ;;      *.c++) xform=c++ ;;
498      *.cc) xform=cc ;;      *.cc) xform=cc ;;
499        *.ii) xform=ii ;;
500        *.class) xform=class ;;
501      *.cpp) xform=cpp ;;      *.cpp) xform=cpp ;;
502      *.cxx) xform=cxx ;;      *.cxx) xform=cxx ;;
503      *.f90) xform=f90 ;;      *.f90) xform=f90 ;;
504      *.for) xform=for ;;      *.for) xform=for ;;
505        *.java) xform=java ;;
506      esac      esac
507    
508      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
# Line 437  if test -z "$show_help"; then Line 515  if test -z "$show_help"; then
515        ;;        ;;
516      esac      esac
517    
518        # Infer tagged configuration to use if any are available and
519        # if one wasn't chosen via the "--tag" command line option.
520        # Only attempt this if the compiler in the base compile
521        # command doesn't match the default compiler.
522        if test -n "$available_tags" && test -z "$tagname"; then
523          case $base_compile in
524          # Blanks in the command may have been stripped by the calling shell,
525          # but not from the CC environment variable when configure was run.
526          " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
527          # Blanks at the start of $base_compile will cause this to fail
528          # if we don't check for them as well.
529          *)
530            for z in $available_tags; do
531              if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
532                # Evaluate the configuration.
533                eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
534                case "$base_compile " in
535                "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
536                  # The compiler in the base compile command matches
537                  # the one in the tagged configuration.
538                  # Assume this is the tagged configuration we want.
539                  tagname=$z
540                  break
541                  ;;
542                esac
543              fi
544            done
545            # If $tagname still isn't set, then no tagged configuration
546            # was found and let the user know that the "--tag" command
547            # line option must be used.
548            if test -z "$tagname"; then
549              $echo "$modename: unable to infer tagged configuration"
550              $echo "$modename: specify a tag with \`--tag'" 1>&2
551              exit 1
552    #        else
553    #          $echo "$modename: using $tagname tagged configuration"
554            fi
555            ;;
556          esac
557        fi
558    
559        objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
560        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
561        if test "X$xdir" = "X$obj"; then
562          xdir=
563        else
564          xdir=$xdir/
565        fi
566        lobj=${xdir}$objdir/$objname
567    
568      if test -z "$base_compile"; then      if test -z "$base_compile"; then
569        $echo "$modename: you must specify a compilation command" 1>&2        $echo "$modename: you must specify a compilation command" 1>&2
570        $echo "$help" 1>&2        $echo "$help" 1>&2
# Line 445  if test -z "$show_help"; then Line 573  if test -z "$show_help"; then
573    
574      # Delete any leftover library objects.      # Delete any leftover library objects.
575      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
576        removelist="$obj $libobj"        removelist="$obj $lobj $libobj ${libobj}T"
577      else      else
578        removelist="$libobj"        removelist="$lobj $libobj ${libobj}T"
579      fi      fi
580    
581      $run $rm $removelist      $run $rm $removelist
# Line 459  if test -z "$show_help"; then Line 587  if test -z "$show_help"; then
587        pic_mode=default        pic_mode=default
588        ;;        ;;
589      esac      esac
590      if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then      if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
591        # non-PIC code in shared libraries is not supported        # non-PIC code in shared libraries is not supported
592        pic_mode=default        pic_mode=default
593      fi      fi
# Line 472  if test -z "$show_help"; then Line 600  if test -z "$show_help"; then
600        removelist="$removelist $output_obj $lockfile"        removelist="$removelist $output_obj $lockfile"
601        trap "$run $rm $removelist; exit 1" 1 2 15        trap "$run $rm $removelist; exit 1" 1 2 15
602      else      else
603          output_obj=
604        need_locks=no        need_locks=no
605        lockfile=        lockfile=
606      fi      fi
# Line 485  if test -z "$show_help"; then Line 614  if test -z "$show_help"; then
614        done        done
615      elif test "$need_locks" = warn; then      elif test "$need_locks" = warn; then
616        if test -f "$lockfile"; then        if test -f "$lockfile"; then
617          echo "\          $echo "\
618  *** ERROR, $lockfile exists and contains:  *** ERROR, $lockfile exists and contains:
619  `cat $lockfile 2>/dev/null`  `cat $lockfile 2>/dev/null`
620    
# Line 499  compiler." Line 628  compiler."
628          $run $rm $removelist          $run $rm $removelist
629          exit 1          exit 1
630        fi        fi
631        echo $srcfile > "$lockfile"        $echo $srcfile > "$lockfile"
632      fi      fi
633    
634      if test -n "$fix_srcfile_path"; then      if test -n "$fix_srcfile_path"; then
635        eval srcfile=\"$fix_srcfile_path\"        eval srcfile=\"$fix_srcfile_path\"
636      fi      fi
637    
638        $run $rm "$libobj" "${libobj}T"
639    
640        # Create a libtool object file (analogous to a ".la" file),
641        # but don't create it if we're doing a dry run.
642        test -z "$run" && cat > ${libobj}T <<EOF
643    # $libobj - a libtool object file
644    # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
645    #
646    # Please DO NOT delete this file!
647    # It is necessary for linking the library.
648    
649    # Name of the PIC object.
650    EOF
651    
652      # Only build a PIC object if we are building libtool libraries.      # Only build a PIC object if we are building libtool libraries.
653      if test "$build_libtool_libs" = yes; then      if test "$build_libtool_libs" = yes; then
654        # Without this assignment, base_compile gets emptied.        # Without this assignment, base_compile gets emptied.
655        fbsd_hideous_sh_bug=$base_compile        fbsd_hideous_sh_bug=$base_compile
656    
657        if test "$pic_mode" != no; then        if test "$pic_mode" != no; then
658          # All platforms use -DPIC, to notify preprocessed assembler code.          command="$base_compile $srcfile $pic_flag"
         command="$base_compile $srcfile $pic_flag -DPIC"  
659        else        else
660          # Don't build PIC code          # Don't build PIC code
661          command="$base_compile $srcfile"          command="$base_compile $srcfile"
662        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%^.*/%%'`  
663    
664          if test -d "$dir"; then        if test ! -d "${xdir}$objdir"; then
665            $show "$rm $libobj"          $show "$mkdir ${xdir}$objdir"
666            $run $rm $libobj          $run $mkdir ${xdir}$objdir
667          else          status=$?
668            $show "$mkdir $dir"          if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
669            $run $mkdir $dir            exit $status
           status=$?  
           if test $status -ne 0 && test ! -d $dir; then  
             exit $status  
           fi  
670          fi          fi
671        fi        fi
672        if test "$compiler_o_lo" = yes; then  
673          output_obj="$libobj"        if test -z "$output_obj"; then
674          command="$command -o $output_obj"          # Place PIC objects in $objdir
675        elif test "$compiler_c_o" = yes; then          command="$command -o $lobj"
         output_obj="$obj"  
         command="$command -o $output_obj"  
676        fi        fi
677    
678        $run $rm "$output_obj"        $run $rm "$lobj" "$output_obj"
679    
680        $show "$command"        $show "$command"
681        if $run eval "$command"; then :        if $run eval "$command"; then :
682        else        else
# Line 557  compiler." Line 685  compiler."
685        fi        fi
686    
687        if test "$need_locks" = warn &&        if test "$need_locks" = warn &&
688           test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then           test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
689          echo "\          $echo "\
690  *** ERROR, $lockfile contains:  *** ERROR, $lockfile contains:
691  `cat $lockfile 2>/dev/null`  `cat $lockfile 2>/dev/null`
692    
# Line 577  compiler." Line 705  compiler."
705        fi        fi
706    
707        # 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
708        if test x"$output_obj" != x"$libobj"; then        if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
709          $show "$mv $output_obj $libobj"          $show "$mv $output_obj $lobj"
710          if $run $mv $output_obj $libobj; then :          if $run $mv $output_obj $lobj; then :
711          else          else
712            error=$?            error=$?
713            $run $rm $removelist            $run $rm $removelist
# Line 587  compiler." Line 715  compiler."
715          fi          fi
716        fi        fi
717    
718        # 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.
719        if (test -z "$pic_flag" || test "$pic_mode" != default) &&        test -z "$run" && cat >> ${libobj}T <<EOF
720           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  
721    
722          $show "$mv $libobj $obj"  EOF
         if $run $mv $libobj $obj; then :  
         else  
           error=$?  
           $run $rm $removelist  
           exit $error  
         fi  
   
         xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`  
         if test "X$xdir" = "X$obj"; then  
           xdir="."  
         else  
           xdir="$xdir"  
         fi  
         baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`  
         libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`  
         # Now arrange that obj and lo_libobj become the same file  
         $show "(cd $xdir && $LN_S $baseobj $libobj)"  
         if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then  
           exit 0  
         else  
           error=$?  
           $run $rm $removelist  
           exit $error  
         fi  
       fi  
723    
724        # Allow error messages only from the first compilation.        # Allow error messages only from the first compilation.
725        suppress_output=' >/dev/null 2>&1'        suppress_output=' >/dev/null 2>&1'
726        else
727          # No PIC object so indicate it doesn't exist in the libtool
728          # object file.
729          test -z "$run" && cat >> ${libobj}T <<EOF
730    pic_object=none
731    
732    EOF
733      fi      fi
734    
735      # Only build a position-dependent object if we build old libraries.      # Only build a position-dependent object if we build old libraries.
# Line 633  compiler." Line 738  compiler."
738          # Don't build PIC code          # Don't build PIC code
739          command="$base_compile $srcfile"          command="$base_compile $srcfile"
740        else        else
741          # All platforms use -DPIC, to notify preprocessed assembler code.          command="$base_compile $srcfile $pic_flag"
         command="$base_compile $srcfile $pic_flag -DPIC"  
742        fi        fi
743        if test "$compiler_c_o" = yes; then        if test "$compiler_c_o" = yes; then
744          command="$command -o $obj"          command="$command -o $obj"
         output_obj="$obj"  
745        fi        fi
746    
747        # Suppress compiler output if we already did a PIC compilation.        # Suppress compiler output if we already did a PIC compilation.
748        command="$command$suppress_output"        command="$command$suppress_output"
749        $run $rm "$output_obj"        $run $rm "$obj" "$output_obj"
750        $show "$command"        $show "$command"
751        if $run eval "$command"; then :        if $run eval "$command"; then :
752        else        else
# Line 652  compiler." Line 755  compiler."
755        fi        fi
756    
757        if test "$need_locks" = warn &&        if test "$need_locks" = warn &&
758           test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then           test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
759          echo "\          $echo "\
760  *** ERROR, $lockfile contains:  *** ERROR, $lockfile contains:
761  `cat $lockfile 2>/dev/null`  `cat $lockfile 2>/dev/null`
762    
# Line 672  compiler." Line 775  compiler."
775        fi        fi
776    
777        # Just move the object if needed        # Just move the object if needed
778        if test x"$output_obj" != x"$obj"; then        if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
779          $show "$mv $output_obj $obj"          $show "$mv $output_obj $obj"
780          if $run $mv $output_obj $obj; then :          if $run $mv $output_obj $obj; then :
781          else          else
# Line 682  compiler." Line 785  compiler."
785          fi          fi
786        fi        fi
787    
788        # 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.
789        # accidentally link it into a program.        # Only append if the libtool object file exists.
790        if test "$build_libtool_libs" != yes; then        test -z "$run" && cat >> ${libobj}T <<EOF
791          $show "echo timestamp > $libobj"  # Name of the non-PIC object.
792          $run eval "echo timestamp > \$libobj" || exit $?  non_pic_object='$objname'
793        else  
794          # Move the .lo from within objdir  EOF
795          $show "$mv $libobj $lo_libobj"      else
796          if $run $mv $libobj $lo_libobj; then :        # Append the name of the non-PIC object the libtool object file.
797          else        # Only append if the libtool object file exists.
798            error=$?        test -z "$run" && cat >> ${libobj}T <<EOF
799            $run $rm $removelist  # Name of the non-PIC object.
800            exit $error  non_pic_object=none
801          fi  
802        fi  EOF
803      fi      fi
804    
805        $run $mv "${libobj}T" "${libobj}"
806    
807      # Unlock the critical section if it was locked      # Unlock the critical section if it was locked
808      if test "$need_locks" != no; then      if test "$need_locks" != no; then
809        $run $rm "$lockfile"        $run $rm "$lockfile"
# Line 715  compiler." Line 820  compiler."
820        # It is impossible to link a dll without this setting, and        # It is impossible to link a dll without this setting, and
821        # we shouldn't force the makefile maintainer to figure out        # we shouldn't force the makefile maintainer to figure out
822        # which system we are compiling for in order to pass an extra        # which system we are compiling for in order to pass an extra
823        # flag for every libtool invokation.        # flag for every libtool invocation.
824        # allow_undefined=no        # allow_undefined=no
825    
826        # FIXME: Unfortunately, there are problems with the above when trying        # FIXME: Unfortunately, there are problems with the above when trying
# Line 730  compiler." Line 835  compiler."
835        ;;        ;;
836      esac      esac
837      libtool_args="$nonopt"      libtool_args="$nonopt"
838        base_compile="$nonopt"
839      compile_command="$nonopt"      compile_command="$nonopt"
840      finalize_command="$nonopt"      finalize_command="$nonopt"
841    
# Line 745  compiler." Line 851  compiler."
851      linker_flags=      linker_flags=
852      dllsearchpath=      dllsearchpath=
853      lib_search_path=`pwd`      lib_search_path=`pwd`
854        inst_prefix_dir=
855    
856      avoid_version=no      avoid_version=no
857      dlfiles=      dlfiles=
# Line 759  compiler." Line 866  compiler."
866      module=no      module=no
867      no_install=no      no_install=no
868      objs=      objs=
869        non_pic_objects=
870      prefer_static_libs=no      prefer_static_libs=no
871      preload=no      preload=no
872      prev=      prev=
# Line 770  compiler." Line 878  compiler."
878      temp_rpath=      temp_rpath=
879      thread_safe=no      thread_safe=no
880      vinfo=      vinfo=
881        vinfo_number=no
882    
883      # We need to know -static, to get the right output filenames.      # We need to know -static, to get the right output filenames.
884      for arg      for arg
# Line 800  compiler." Line 909  compiler."
909      test -n "$old_archive_from_new_cmds" && build_old_libs=yes      test -n "$old_archive_from_new_cmds" && build_old_libs=yes
910    
911      # Go through the arguments, transforming them on the way.      # Go through the arguments, transforming them on the way.
912      while test $# -gt 0; do      while test "$#" -gt 0; do
913        arg="$1"        arg="$1"
914          base_compile="$base_compile $arg"
915        shift        shift
916        case $arg in        case $arg in
917        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
# Line 875  compiler." Line 985  compiler."
985            prev=            prev=
986            continue            continue
987            ;;            ;;
988            inst_prefix)
989              inst_prefix_dir="$arg"
990              prev=
991              continue
992              ;;
993          release)          release)
994            release="-$arg"            release="-$arg"
995            prev=            prev=
996            continue            continue
997            ;;            ;;
998            objectlist)
999              if test -f "$arg"; then
1000                save_arg=$arg
1001                moreargs=
1002                for fil in `cat $save_arg`
1003                do
1004    #             moreargs="$moreargs $fil"
1005                  arg=$fil
1006                  # A libtool-controlled object.
1007    
1008                  # Check to see that this really is a libtool object.
1009                  if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1010                    pic_object=
1011                    non_pic_object=
1012    
1013                    # Read the .lo file
1014                    # If there is no directory component, then add one.
1015                    case $arg in
1016                    */* | *\\*) . $arg ;;
1017                    *) . ./$arg ;;
1018                    esac
1019    
1020                    if test -z "$pic_object" || \
1021                       test -z "$non_pic_object" ||
1022                       test "$pic_object" = none && \
1023                       test "$non_pic_object" = none; then
1024                      $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1025                      exit 1
1026                    fi
1027    
1028                    # Extract subdirectory from the argument.
1029                    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1030                    if test "X$xdir" = "X$arg"; then
1031                      xdir=
1032                    else
1033                      xdir="$xdir/"
1034                    fi
1035    
1036                    if test "$pic_object" != none; then
1037                      # Prepend the subdirectory the object is found in.
1038                      pic_object="$xdir$pic_object"
1039    
1040                      if test "$prev" = dlfiles; then
1041                        if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1042                          dlfiles="$dlfiles $pic_object"
1043                          prev=
1044                          continue
1045                        else
1046                          # If libtool objects are unsupported, then we need to preload.
1047                          prev=dlprefiles
1048                        fi
1049                      fi
1050    
1051                      # CHECK ME:  I think I busted this.  -Ossama
1052                      if test "$prev" = dlprefiles; then
1053                        # Preload the old-style object.
1054                        dlprefiles="$dlprefiles $pic_object"
1055                        prev=
1056                      fi
1057    
1058                      # A PIC object.
1059                      libobjs="$libobjs $pic_object"
1060                      arg="$pic_object"
1061                    fi
1062    
1063                    # Non-PIC object.
1064                    if test "$non_pic_object" != none; then
1065                      # Prepend the subdirectory the object is found in.
1066                      non_pic_object="$xdir$non_pic_object"
1067    
1068                      # A standard non-PIC object
1069                      non_pic_objects="$non_pic_objects $non_pic_object"
1070                      if test -z "$pic_object" || test "$pic_object" = none ; then
1071                        arg="$non_pic_object"
1072                      fi
1073                    fi
1074                  else
1075                    # Only an error if not doing a dry-run.
1076                    if test -z "$run"; then
1077                      $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1078                      exit 1
1079                    else
1080                      # Dry-run case.
1081    
1082                      # Extract subdirectory from the argument.
1083                      xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1084                      if test "X$xdir" = "X$arg"; then
1085                        xdir=
1086                      else
1087                        xdir="$xdir/"
1088                      fi
1089    
1090                      pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1091                      non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1092                      libobjs="$libobjs $pic_object"
1093                      non_pic_objects="$non_pic_objects $non_pic_object"
1094                    fi
1095                  fi
1096                done
1097              else
1098                $echo "$modename: link input file \`$save_arg' does not exist"
1099                exit 1
1100              fi
1101              arg=$save_arg
1102              prev=
1103              continue
1104              ;;
1105          rpath | xrpath)          rpath | xrpath)
1106            # We need an absolute path.            # We need an absolute path.
1107            case $arg in            case $arg in
# Line 918  compiler." Line 1140  compiler."
1140            finalize_command="$finalize_command $wl$qarg"            finalize_command="$finalize_command $wl$qarg"
1141            continue            continue
1142            ;;            ;;
1143            xcclinker)
1144              linker_flags="$linker_flags $qarg"
1145              compiler_flags="$compiler_flags $qarg"
1146              prev=
1147              compile_command="$compile_command $qarg"
1148              finalize_command="$finalize_command $qarg"
1149              continue
1150              ;;
1151          *)          *)
1152            eval "$prev=\"\$arg\""            eval "$prev=\"\$arg\""
1153            prev=            prev=
1154            continue            continue
1155            ;;            ;;
1156          esac          esac
1157        fi # test -n $prev        fi # test -n "$prev"
1158    
1159        prevarg="$arg"        prevarg="$arg"
1160    
# Line 976  compiler." Line 1206  compiler."
1206          continue          continue
1207          ;;          ;;
1208    
1209          -inst-prefix-dir)
1210            prev=inst_prefix
1211            continue
1212            ;;
1213    
1214        # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*        # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1215        # 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
1216        -L[A-Z][A-Z]*:*)        -L[A-Z][A-Z]*:*)
1217          case $with_gcc/$host in          case $with_gcc/$host in
1218          no/*-*-irix*)          no/*-*-irix* | /*-*-irix*)
1219            compile_command="$compile_command $arg"            compile_command="$compile_command $arg"
1220            finalize_command="$finalize_command $arg"            finalize_command="$finalize_command $arg"
1221            ;;            ;;
# Line 1031  compiler." Line 1266  compiler."
1266              # These systems don't actually have a C library (as such)              # These systems don't actually have a C library (as such)
1267              test "X$arg" = "X-lc" && continue              test "X$arg" = "X-lc" && continue
1268              ;;              ;;
1269              *-*-openbsd* | *-*-freebsd*)
1270                # Do not include libc due to us having libc/libc_r.
1271                test "X$arg" = "X-lc" && continue
1272                ;;
1273              *-*-rhapsody* | *-*-darwin1.[012])
1274                # Rhapsody C and math libraries are in the System framework
1275                deplibs="$deplibs -framework System"
1276                continue
1277            esac            esac
1278            elif test "X$arg" = "X-lc_r"; then
1279             case $host in
1280             *-*-openbsd* | *-*-freebsd*)
1281               # Do not include libc_r directly, use -pthread flag.
1282               continue
1283               ;;
1284             esac
1285          fi          fi
1286          deplibs="$deplibs $arg"          deplibs="$deplibs $arg"
1287          continue          continue
# Line 1042  compiler." Line 1292  compiler."
1292          continue          continue
1293          ;;          ;;
1294    
1295          # gcc -m* arguments should be passed to the linker via $compiler_flags
1296          # in order to pass architecture information to the linker
1297          # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1298          # but this is not reliable with gcc because gcc may use -mfoo to
1299          # select a different linker, different libraries, etc, while
1300          # -Wl,-mfoo simply passes -mfoo to the linker.
1301          -m*)
1302            # Unknown arguments in both finalize_command and compile_command need
1303            # to be aesthetically quoted because they are evaled later.
1304            arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1305            case $arg in
1306            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1307              arg="\"$arg\""
1308              ;;
1309            esac
1310            compile_command="$compile_command $arg"
1311            finalize_command="$finalize_command $arg"
1312            if test "$with_gcc" = "yes" ; then
1313              compiler_flags="$compiler_flags $arg"
1314            fi
1315            continue
1316            ;;
1317    
1318          -shrext)
1319            prev=shrext
1320            continue
1321            ;;
1322    
1323        -no-fast-install)        -no-fast-install)
1324          fast_install=no          fast_install=no
1325          continue          continue
# Line 1066  compiler." Line 1344  compiler."
1344          continue          continue
1345          ;;          ;;
1346    
1347          -objectlist)
1348            prev=objectlist
1349            continue
1350            ;;
1351    
1352        -o) prev=output ;;        -o) prev=output ;;
1353    
1354        -release)        -release)
# Line 1118  compiler." Line 1401  compiler."
1401          prev=vinfo          prev=vinfo
1402          continue          continue
1403          ;;          ;;
1404          -version-number)
1405            prev=vinfo
1406            vinfo_number=yes
1407            continue
1408            ;;
1409    
1410        -Wc,*)        -Wc,*)
1411          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1412          arg=          arg=
1413          IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','          save_ifs="$IFS"; IFS=','
1414          for flag in $args; do          for flag in $args; do
1415            IFS="$save_ifs"            IFS="$save_ifs"
1416            case $flag in            case $flag in
# Line 1140  compiler." Line 1428  compiler."
1428        -Wl,*)        -Wl,*)
1429          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`          args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1430          arg=          arg=
1431          IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','          save_ifs="$IFS"; IFS=','
1432          for flag in $args; do          for flag in $args; do
1433            IFS="$save_ifs"            IFS="$save_ifs"
1434            case $flag in            case $flag in
# Line 1166  compiler." Line 1454  compiler."
1454          continue          continue
1455          ;;          ;;
1456    
1457          -XCClinker)
1458            prev=xcclinker
1459            continue
1460            ;;
1461    
1462        # Some other compiler flag.        # Some other compiler flag.
1463        -* | +*)        -* | +*)
1464          # Unknown arguments in both finalize_command and compile_command need          # Unknown arguments in both finalize_command and compile_command need
# Line 1178  compiler." Line 1471  compiler."
1471          esac          esac
1472          ;;          ;;
1473    
1474        *.lo | *.$objext)        *.$objext)
1475          # A library or standard object.          # A standard object.
1476          if test "$prev" = dlfiles; then          objs="$objs $arg"
1477            # 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  
1478    
1479          if test "$prev" = dlprefiles; then        *.lo)
1480            # Preload the old-style object.          # A libtool-controlled object.
1481            dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`  
1482            prev=          # Check to see that this really is a libtool object.
1483          else          if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1484              pic_object=
1485              non_pic_object=
1486    
1487              # Read the .lo file
1488              # If there is no directory component, then add one.
1489            case $arg in            case $arg in
1490            *.lo) libobjs="$libobjs $arg" ;;            */* | *\\*) . $arg ;;
1491            *) objs="$objs $arg" ;;            *) . ./$arg ;;
1492            esac            esac
1493    
1494              if test -z "$pic_object" || \
1495                 test -z "$non_pic_object" ||
1496                 test "$pic_object" = none && \
1497                 test "$non_pic_object" = none; then
1498                $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1499                exit 1
1500              fi
1501    
1502              # Extract subdirectory from the argument.
1503              xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1504              if test "X$xdir" = "X$arg"; then
1505                xdir=
1506              else
1507                xdir="$xdir/"
1508              fi
1509    
1510              if test "$pic_object" != none; then
1511                # Prepend the subdirectory the object is found in.
1512                pic_object="$xdir$pic_object"
1513    
1514                if test "$prev" = dlfiles; then
1515                  if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1516                    dlfiles="$dlfiles $pic_object"
1517                    prev=
1518                    continue
1519                  else
1520                    # If libtool objects are unsupported, then we need to preload.
1521                    prev=dlprefiles
1522                  fi
1523                fi
1524    
1525                # CHECK ME:  I think I busted this.  -Ossama
1526                if test "$prev" = dlprefiles; then
1527                  # Preload the old-style object.
1528                  dlprefiles="$dlprefiles $pic_object"
1529                  prev=
1530                fi
1531    
1532                # A PIC object.
1533                libobjs="$libobjs $pic_object"
1534                arg="$pic_object"
1535              fi
1536    
1537              # Non-PIC object.
1538              if test "$non_pic_object" != none; then
1539                # Prepend the subdirectory the object is found in.
1540                non_pic_object="$xdir$non_pic_object"
1541    
1542                # A standard non-PIC object
1543                non_pic_objects="$non_pic_objects $non_pic_object"
1544                if test -z "$pic_object" || test "$pic_object" = none ; then
1545                  arg="$non_pic_object"
1546                fi
1547              fi
1548            else
1549              # Only an error if not doing a dry-run.
1550              if test -z "$run"; then
1551                $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1552                exit 1
1553              else
1554                # Dry-run case.
1555    
1556                # Extract subdirectory from the argument.
1557                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1558                if test "X$xdir" = "X$arg"; then
1559                  xdir=
1560                else
1561                  xdir="$xdir/"
1562                fi
1563    
1564                pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1565                non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1566                libobjs="$libobjs $pic_object"
1567                non_pic_objects="$non_pic_objects $non_pic_object"
1568              fi
1569          fi          fi
1570          ;;          ;;
1571    
# Line 1254  compiler." Line 1619  compiler."
1619        exit 1        exit 1
1620      fi      fi
1621    
1622        # Infer tagged configuration to use if any are available and
1623        # if one wasn't chosen via the "--tag" command line option.
1624        # Only attempt this if the compiler in the base link
1625        # command doesn't match the default compiler.
1626        if test -n "$available_tags" && test -z "$tagname"; then
1627          case $base_compile in
1628          # Blanks in the command may have been stripped by the calling shell,
1629          # but not from the CC environment variable when configure was run.
1630          "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1631          # Blanks at the start of $base_compile will cause this to fail
1632          # if we don't check for them as well.
1633          *)
1634            for z in $available_tags; do
1635              if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1636                # Evaluate the configuration.
1637                eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1638                case $base_compile in
1639                "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1640                  # The compiler in $compile_command matches
1641                  # the one in the tagged configuration.
1642                  # Assume this is the tagged configuration we want.
1643                  tagname=$z
1644                  break
1645                  ;;
1646                esac
1647              fi
1648            done
1649            # If $tagname still isn't set, then no tagged configuration
1650            # was found and let the user know that the "--tag" command
1651            # line option must be used.
1652            if test -z "$tagname"; then
1653              $echo "$modename: unable to infer tagged configuration"
1654              $echo "$modename: specify a tag with \`--tag'" 1>&2
1655              exit 1
1656    #       else
1657    #         $echo "$modename: using $tagname tagged configuration"
1658            fi
1659            ;;
1660          esac
1661        fi
1662    
1663      if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then      if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1664        eval arg=\"$export_dynamic_flag_spec\"        eval arg=\"$export_dynamic_flag_spec\"
1665        compile_command="$compile_command $arg"        compile_command="$compile_command $arg"
1666        finalize_command="$finalize_command $arg"        finalize_command="$finalize_command $arg"
1667      fi      fi
1668    
1669        oldlibs=
1670      # calculate the name of the file, without its directory      # calculate the name of the file, without its directory
1671      outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`      outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1672      libobjs_save="$libobjs"      libobjs_save="$libobjs"
# Line 1280  compiler." Line 1687  compiler."
1687        output_objdir="$output_objdir/$objdir"        output_objdir="$output_objdir/$objdir"
1688      fi      fi
1689      # Create the object directory.      # Create the object directory.
1690      if test ! -d $output_objdir; then      if test ! -d "$output_objdir"; then
1691        $show "$mkdir $output_objdir"        $show "$mkdir $output_objdir"
1692        $run $mkdir $output_objdir        $run $mkdir $output_objdir
1693        status=$?        status=$?
1694        if test $status -ne 0 && test ! -d $output_objdir; then        if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1695          exit $status          exit $status
1696        fi        fi
1697      fi      fi
# Line 1302  compiler." Line 1709  compiler."
1709      *) linkmode=prog ;; # Anything else should be a program.      *) linkmode=prog ;; # Anything else should be a program.
1710      esac      esac
1711    
1712        case $host in
1713        *cygwin* | *mingw* | *pw32*)
1714          # don't eliminate duplcations in $postdeps and $predeps
1715          duplicate_compiler_generated_deps=yes
1716          ;;
1717        *)
1718          duplicate_compiler_generated_deps=$duplicate_deps
1719          ;;
1720        esac
1721      specialdeplibs=      specialdeplibs=
1722    
1723      libs=      libs=
1724      # Find all interdependent deplibs by searching for libraries      # Find all interdependent deplibs by searching for libraries
1725      # that are linked more than once (e.g. -la -lb -la)      # that are linked more than once (e.g. -la -lb -la)
1726      for deplib in $deplibs; do      for deplib in $deplibs; do
1727        case "$libs " in        if test "X$duplicate_deps" = "Xyes" ; then
1728        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;          case "$libs " in
1729        esac          *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1730            esac
1731          fi
1732        libs="$libs $deplib"        libs="$libs $deplib"
1733      done      done
1734    
1735        if test "$linkmode" = lib; then
1736          libs="$predeps $libs $compiler_lib_search_path $postdeps"
1737    
1738          # Compute libraries that are listed more than once in $predeps
1739          # $postdeps and mark them as special (i.e., whose duplicates are
1740          # not to be eliminated).
1741          pre_post_deps=
1742          if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1743            for pre_post_dep in $predeps $postdeps; do
1744              case "$pre_post_deps " in
1745              *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1746              esac
1747              pre_post_deps="$pre_post_deps $pre_post_dep"
1748            done
1749          fi
1750          pre_post_deps=
1751        fi
1752    
1753      deplibs=      deplibs=
1754      newdependency_libs=      newdependency_libs=
1755      newlib_search_path=      newlib_search_path=
# Line 1343  compiler." Line 1781  compiler."
1781          ;;          ;;
1782      esac      esac
1783      for pass in $passes; do      for pass in $passes; do
1784        if test $linkmode = prog; then        if test "$linkmode,$pass" = "lib,link" ||
1785          # Determine which files to process           test "$linkmode,$pass" = "prog,scan"; then
1786            libs="$deplibs"
1787            deplibs=
1788          fi
1789          if test "$linkmode" = prog; then
1790          case $pass in          case $pass in
1791          dlopen)          dlopen) libs="$dlfiles" ;;
           libs="$dlfiles"  
           save_deplibs="$deplibs" # Collect dlpreopened libraries  
           deplibs=  
           ;;  
1792          dlpreopen) libs="$dlprefiles" ;;          dlpreopen) libs="$dlprefiles" ;;
1793          link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;          link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1794          esac          esac
1795        fi        fi
1796          if test "$pass" = dlopen; then
1797            # Collect dlpreopened libraries
1798            save_deplibs="$deplibs"
1799            deplibs=
1800          fi
1801        for deplib in $libs; do        for deplib in $libs; do
1802          lib=          lib=
1803          found=no          found=no
1804          case $deplib in          case $deplib in
1805          -l*)          -l*)
1806            if test $linkmode = oldlib && test $linkmode = obj; then            if test "$linkmode" != lib && test "$linkmode" != prog; then
1807              $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2              $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1808              continue              continue
1809            fi            fi
1810            if test $pass = conv; then            if test "$pass" = conv; then
1811              deplibs="$deplib $deplibs"              deplibs="$deplib $deplibs"
1812              continue              continue
1813            fi            fi
# Line 1384  compiler." Line 1827  compiler."
1827                finalize_deplibs="$deplib $finalize_deplibs"                finalize_deplibs="$deplib $finalize_deplibs"
1828              else              else
1829                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
1830                test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"                test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1831              fi              fi
1832              continue              continue
1833              else # deplib is a libtool library
1834                # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1835                # We need to do some special things here, and not later.
1836                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1837                  case " $predeps $postdeps " in
1838                  *" $deplib "*)
1839                    if (${SED} -e '2q' $lib |
1840                        grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1841                      library_names=
1842                      old_library=
1843                      case $lib in
1844                      */* | *\\*) . $lib ;;
1845                      *) . ./$lib ;;
1846                      esac
1847                      for l in $old_library $library_names; do
1848                        ll="$l"
1849                      done
1850                      if test "X$ll" = "X$old_library" ; then # only static version available
1851                        found=no
1852                        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1853                        test "X$ladir" = "X$lib" && ladir="."
1854                        lib=$ladir/$old_library
1855                        if test "$linkmode,$pass" = "prog,link"; then
1856                          compile_deplibs="$deplib $compile_deplibs"
1857                          finalize_deplibs="$deplib $finalize_deplibs"
1858                        else
1859                          deplibs="$deplib $deplibs"
1860                          test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1861                        fi
1862                        continue
1863                      fi
1864                    fi
1865                    ;;
1866                  *) ;;
1867                  esac
1868                fi
1869            fi            fi
1870            ;; # -l            ;; # -l
1871          -L*)          -L*)
1872            case $linkmode in            case $linkmode in
1873            lib)            lib)
1874              deplibs="$deplib $deplibs"              deplibs="$deplib $deplibs"
1875              test $pass = conv && continue              test "$pass" = conv && continue
1876              newdependency_libs="$deplib $newdependency_libs"              newdependency_libs="$deplib $newdependency_libs"
1877              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//'`
1878              ;;              ;;
1879            prog)            prog)
1880              if test $pass = conv; then              if test "$pass" = conv; then
1881                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
1882                continue                continue
1883              fi              fi
1884              if test $pass = scan; then              if test "$pass" = scan; then
1885                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
1886                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//'`
1887              else              else
# Line 1411  compiler." Line 1890  compiler."
1890              fi              fi
1891              ;;              ;;
1892            *)            *)
1893              $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2              $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1894              ;;              ;;
1895            esac # linkmode            esac # linkmode
1896            continue            continue
1897            ;; # -L            ;; # -L
1898          -R*)          -R*)
1899            if test $pass = link; then            if test "$pass" = link; then
1900              dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`              dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1901              # Make sure the xrpath contains only unique directories.              # Make sure the xrpath contains only unique directories.
1902              case "$xrpath " in              case "$xrpath " in
# Line 1430  compiler." Line 1909  compiler."
1909            ;;            ;;
1910          *.la) lib="$deplib" ;;          *.la) lib="$deplib" ;;
1911          *.$libext)          *.$libext)
1912            if test $pass = conv; then            if test "$pass" = conv; then
1913              deplibs="$deplib $deplibs"              deplibs="$deplib $deplibs"
1914              continue              continue
1915            fi            fi
1916            case $linkmode in            case $linkmode in
1917            lib)            lib)
1918              if test "$deplibs_check_method" != pass_all; then              if test "$deplibs_check_method" != pass_all; then
1919                echo                $echo
1920                echo "*** Warning: This library needs some functionality provided by $deplib."                $echo "*** Warning: Trying to link with static lib archive $deplib."
1921                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"
1922                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"
1923                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"
1924                  $echo "*** because the file extensions .$libext of this argument makes me believe"
1925                  $echo "*** that it is just a static archive that I should not used here."
1926              else              else
1927                echo                $echo
1928                echo "*** Warning: Linking the shared library $output against the"                $echo "*** Warning: Linking the shared library $output against the"
1929                echo "*** static library $deplib is not portable!"                $echo "*** static library $deplib is not portable!"
1930                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
1931              fi              fi
1932              continue              continue
1933              ;;              ;;
1934            prog)            prog)
1935              if test $pass != link; then              if test "$pass" != link; then
1936                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
1937              else              else
1938                compile_deplibs="$deplib $compile_deplibs"                compile_deplibs="$deplib $compile_deplibs"
# Line 1462  compiler." Line 1943  compiler."
1943            esac # linkmode            esac # linkmode
1944            ;; # *.$libext            ;; # *.$libext
1945          *.lo | *.$objext)          *.lo | *.$objext)
1946            if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then            if test "$pass" = conv; then
1947              # If there is no dlopen support or we're linking statically,              deplibs="$deplib $deplibs"
1948              # we need to preload.            elif test "$linkmode" = prog; then
1949              newdlprefiles="$newdlprefiles $deplib"              if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1950              compile_deplibs="$deplib $compile_deplibs"                # If there is no dlopen support or we're linking statically,
1951              finalize_deplibs="$deplib $finalize_deplibs"                # we need to preload.
1952            else                newdlprefiles="$newdlprefiles $deplib"
1953              newdlfiles="$newdlfiles $deplib"                compile_deplibs="$deplib $compile_deplibs"
1954                  finalize_deplibs="$deplib $finalize_deplibs"
1955                else
1956                  newdlfiles="$newdlfiles $deplib"
1957                fi
1958            fi            fi
1959            continue            continue
1960            ;;            ;;
# Line 1478  compiler." Line 1963  compiler."
1963            continue            continue
1964            ;;            ;;
1965          esac # case $deplib          esac # case $deplib
1966          if test $found = yes || test -f "$lib"; then :          if test "$found" = yes || test -f "$lib"; then :
1967          else          else
1968            $echo "$modename: cannot find the library \`$lib'" 1>&2            $echo "$modename: cannot find the library \`$lib'" 1>&2
1969            exit 1            exit 1
1970          fi          fi
1971    
1972          # Check to see that this really is a libtool archive.          # Check to see that this really is a libtool archive.
1973          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 :
1974          else          else
1975            $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2            $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1976            exit 1            exit 1
# Line 1501  compiler." Line 1986  compiler."
1986          library_names=          library_names=
1987          old_library=          old_library=
1988          # If the library was installed with an old release of libtool,          # If the library was installed with an old release of libtool,
1989          # it will not redefine variable installed.          # it will not redefine variables installed, or shouldnotlink
1990          installed=yes          installed=yes
1991            shouldnotlink=no
1992    
1993          # Read the .la file          # Read the .la file
1994          case $lib in          case $lib in
# Line 1512  compiler." Line 1998  compiler."
1998    
1999          if test "$linkmode,$pass" = "lib,link" ||          if test "$linkmode,$pass" = "lib,link" ||
2000             test "$linkmode,$pass" = "prog,scan" ||             test "$linkmode,$pass" = "prog,scan" ||
2001             { test $linkmode = oldlib && test $linkmode = obj; }; then             { test "$linkmode" != prog && test "$linkmode" != lib; }; then
            # Add dl[pre]opened files of deplib  
2002            test -n "$dlopen" && dlfiles="$dlfiles $dlopen"            test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2003            test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"            test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2004          fi          fi
2005    
2006          if test $pass = conv; then          if test "$pass" = conv; then
2007            # Only check for convenience libraries            # Only check for convenience libraries
2008            deplibs="$lib $deplibs"            deplibs="$lib $deplibs"
2009            if test -z "$libdir"; then            if test -z "$libdir"; then
# Line 1532  compiler." Line 2017  compiler."
2017              tmp_libs=              tmp_libs=
2018              for deplib in $dependency_libs; do              for deplib in $dependency_libs; do
2019                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2020                case "$tmp_libs " in                if test "X$duplicate_deps" = "Xyes" ; then
2021                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;                  case "$tmp_libs " in
2022                esac                  *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2023                    esac
2024                  fi
2025                tmp_libs="$tmp_libs $deplib"                tmp_libs="$tmp_libs $deplib"
2026              done              done
2027            elif test $linkmode != prog && test $linkmode != lib; then            elif test "$linkmode" != prog && test "$linkmode" != lib; then
2028              $echo "$modename: \`$lib' is not a convenience library" 1>&2              $echo "$modename: \`$lib' is not a convenience library" 1>&2
2029              exit 1              exit 1
2030            fi            fi
2031            continue            continue
2032          fi # $pass = conv          fi # $pass = conv
2033    
2034        
2035          # Get the name of the library we link against.          # Get the name of the library we link against.
2036          linklib=          linklib=
2037          for l in $old_library $library_names; do          for l in $old_library $library_names; do
# Line 1555  compiler." Line 2043  compiler."
2043          fi          fi
2044    
2045          # This library was specified with -dlopen.          # This library was specified with -dlopen.
2046          if test $pass = dlopen; then          if test "$pass" = dlopen; then
2047            if test -z "$libdir"; then            if test -z "$libdir"; then
2048              $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2              $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2049              exit 1              exit 1
2050            fi            fi
2051            if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then            if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2052              # If there is no dlname, no dlopen support or we're linking              # If there is no dlname, no dlopen support or we're linking
2053              # statically, we need to preload.              # statically, we need to preload.  We also need to preload any
2054              dlprefiles="$dlprefiles $lib"              # dependent libraries so libltdl's deplib preloader doesn't
2055                # bomb out in the load deplibs phase.
2056                dlprefiles="$dlprefiles $lib $dependency_libs"
2057            else            else
2058              newdlfiles="$newdlfiles $lib"              newdlfiles="$newdlfiles $lib"
2059            fi            fi
# Line 1604  compiler." Line 2094  compiler."
2094          name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`          name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2095    
2096          # This library was specified with -dlpreopen.          # This library was specified with -dlpreopen.
2097          if test $pass = dlpreopen; then          if test "$pass" = dlpreopen; then
2098            if test -z "$libdir"; then            if test -z "$libdir"; then
2099              $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2              $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2100              exit 1              exit 1
# Line 1623  compiler." Line 2113  compiler."
2113    
2114          if test -z "$libdir"; then          if test -z "$libdir"; then
2115            # Link the convenience library            # Link the convenience library
2116            if test $linkmode = lib; then            if test "$linkmode" = lib; then
2117              deplibs="$dir/$old_library $deplibs"              deplibs="$dir/$old_library $deplibs"
2118            elif test "$linkmode,$pass" = "prog,link"; then            elif test "$linkmode,$pass" = "prog,link"; then
2119              compile_deplibs="$dir/$old_library $compile_deplibs"              compile_deplibs="$dir/$old_library $compile_deplibs"
2120              finalize_deplibs="$dir/$old_library $finalize_deplibs"              finalize_deplibs="$dir/$old_library $finalize_deplibs"
2121            else            else
2122              deplibs="$lib $deplibs"              deplibs="$lib $deplibs" # used for prog,scan pass
2123            fi            fi
2124            continue            continue
2125          fi          fi
2126    
2127          if test $linkmode = prog && test $pass != link; then      
2128            if test "$linkmode" = prog && test "$pass" != link; then
2129            newlib_search_path="$newlib_search_path $ladir"            newlib_search_path="$newlib_search_path $ladir"
2130            deplibs="$lib $deplibs"            deplibs="$lib $deplibs"
2131    
# Line 1650  compiler." Line 2141  compiler."
2141              -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
2142              esac              esac
2143              # Need to link against all dependency_libs?              # Need to link against all dependency_libs?
2144              if test $linkalldeplibs = yes; then              if test "$linkalldeplibs" = yes; then
2145                deplibs="$deplib $deplibs"                deplibs="$deplib $deplibs"
2146              else              else
2147                # Need to hardcode shared library paths                # Need to hardcode shared library paths
2148                # or/and link against static libraries                # or/and link against static libraries
2149                newdependency_libs="$deplib $newdependency_libs"                newdependency_libs="$deplib $newdependency_libs"
2150              fi              fi
2151              case "$tmp_libs " in              if test "X$duplicate_deps" = "Xyes" ; then
2152              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;                case "$tmp_libs " in
2153              esac                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2154                  esac
2155                fi
2156              tmp_libs="$tmp_libs $deplib"              tmp_libs="$tmp_libs $deplib"
2157            done # for deplib            done # for deplib
2158            continue            continue
2159          fi # $linkmode = prog...          fi # $linkmode = prog...
2160    
2161          link_static=no # Whether the deplib will be linked statically          if test "$linkmode,$pass" = "prog,link"; then
2162          if test -n "$library_names" &&            if test -n "$library_names" &&
2163             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then               { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2164            # Link against this shared library              # We need to hardcode the library path
2165                if test -n "$shlibpath_var"; then
2166                  # Make sure the rpath contains only unique directories.
2167                  case "$temp_rpath " in
2168                  *" $dir "*) ;;
2169                  *" $absdir "*) ;;
2170                  *) temp_rpath="$temp_rpath $dir" ;;
2171                  esac
2172                fi
2173    
           if test "$linkmode,$pass" = "prog,link" ||  
            { test $linkmode = lib && test $hardcode_into_libs = yes; }; then  
2174              # Hardcode the library path.              # Hardcode the library path.
2175              # Skip directories that are in the system default run-time              # Skip directories that are in the system default run-time
2176              # search path.              # search path.
# Line 1693  compiler." Line 2192  compiler."
2192                esac                esac
2193                ;;                ;;
2194              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  
2195            fi # $linkmode,$pass = prog,link...            fi # $linkmode,$pass = prog,link...
2196    
2197            if test "$alldeplibs" = yes &&            if test "$alldeplibs" = yes &&
# Line 1713  compiler." Line 2201  compiler."
2201              # We only need to search for static libraries              # We only need to search for static libraries
2202              continue              continue
2203            fi            fi
2204            fi
2205    
2206            link_static=no # Whether the deplib will be linked statically
2207            if test -n "$library_names" &&
2208               { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2209            if test "$installed" = no; then            if test "$installed" = no; then
2210              notinst_deplibs="$notinst_deplibs $lib"              notinst_deplibs="$notinst_deplibs $lib"
2211              need_relink=yes              need_relink=yes
2212            fi            fi
2213              # This is a shared library
2214            
2215          # Warn about portability, can't link against -module's on some systems (darwin)
2216          if test "$shouldnotlink" = yes && test "$pass" = link ; then
2217                $echo
2218                if test "$linkmode" = prog; then
2219                  $echo "*** Warning: Linking the executable $output against the loadable module"
2220                else
2221                  $echo "*** Warning: Linking the shared library $output against the loadable module"
2222                fi
2223                $echo "*** $linklib is not portable!"    
2224          fi          
2225              if test "$linkmode" = lib &&
2226                 test "$hardcode_into_libs" = yes; then
2227                # Hardcode the library path.
2228                # Skip directories that are in the system default run-time
2229                # search path.
2230                case " $sys_lib_dlsearch_path " in
2231                *" $absdir "*) ;;
2232                *)
2233                  case "$compile_rpath " in
2234                  *" $absdir "*) ;;
2235                  *) compile_rpath="$compile_rpath $absdir"
2236                  esac
2237                  ;;
2238                esac
2239                case " $sys_lib_dlsearch_path " in
2240                *" $libdir "*) ;;
2241                *)
2242                  case "$finalize_rpath " in
2243                  *" $libdir "*) ;;
2244                  *) finalize_rpath="$finalize_rpath $libdir"
2245                  esac
2246                  ;;
2247                esac
2248              fi
2249    
2250            if test -n "$old_archive_from_expsyms_cmds"; then            if test -n "$old_archive_from_expsyms_cmds"; then
2251              # figure out the soname              # figure out the soname
# Line 1731  compiler." Line 2259  compiler."
2259              elif test -n "$soname_spec"; then              elif test -n "$soname_spec"; then
2260                # bleh windows                # bleh windows
2261                case $host in                case $host in
2262                *cygwin*)                *cygwin* | mingw*)
2263                  major=`expr $current - $age`                  major=`expr $current - $age`
2264                  versuffix="-$major"                  versuffix="-$major"
2265                  ;;                  ;;
# Line 1743  compiler." Line 2271  compiler."
2271    
2272              # Make a new name for the extract_expsyms_cmds to use              # Make a new name for the extract_expsyms_cmds to use
2273              soroot="$soname"              soroot="$soname"
2274              soname=`echo $soroot | sed -e 's/^.*\///'`              soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2275              newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"              newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2276    
2277              # If the library has no export list, then create one now              # If the library has no export list, then create one now
2278              if test -f "$output_objdir/$soname-def"; then :              if test -f "$output_objdir/$soname-def"; then :
2279              else              else
2280                $show "extracting exported symbol list from \`$soname'"                $show "extracting exported symbol list from \`$soname'"
2281                IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'                save_ifs="$IFS"; IFS='~'
2282                eval cmds=\"$extract_expsyms_cmds\"                eval cmds=\"$extract_expsyms_cmds\"
2283                for cmd in $cmds; do                for cmd in $cmds; do
2284                  IFS="$save_ifs"                  IFS="$save_ifs"
# Line 1763  compiler." Line 2291  compiler."
2291              # Create $newlib              # Create $newlib
2292              if test -f "$output_objdir/$newlib"; then :; else              if test -f "$output_objdir/$newlib"; then :; else
2293                $show "generating import library for \`$soname'"                $show "generating import library for \`$soname'"
2294                IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'                save_ifs="$IFS"; IFS='~'
2295                eval cmds=\"$old_archive_from_expsyms_cmds\"                eval cmds=\"$old_archive_from_expsyms_cmds\"
2296                for cmd in $cmds; do                for cmd in $cmds; do
2297                  IFS="$save_ifs"                  IFS="$save_ifs"
# Line 1775  compiler." Line 2303  compiler."
2303              # make sure the library variables are pointing to the new library              # make sure the library variables are pointing to the new library
2304              dir=$output_objdir              dir=$output_objdir
2305              linklib=$newlib              linklib=$newlib
2306            fi # test -n $old_archive_from_expsyms_cmds            fi # test -n "$old_archive_from_expsyms_cmds"
2307    
2308            if test $linkmode = prog || test "$mode" != relink; then            if test "$linkmode" = prog || test "$mode" != relink; then
2309              add_shlibpath=              add_shlibpath=
2310              add_dir=              add_dir=
2311              add=              add=
# Line 1786  compiler." Line 2314  compiler."
2314              immediate | unsupported)              immediate | unsupported)
2315                if test "$hardcode_direct" = no; then                if test "$hardcode_direct" = no; then
2316                  add="$dir/$linklib"                  add="$dir/$linklib"
2317                    case $host in
2318                      *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2319                      *-*-darwin* )
2320                        # if the lib is a module then we can not link against it, someone
2321                        # is ignoring the new warnings I added
2322                        if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2323                          $echo "** Warning, lib $linklib is a module, not a shared library"
2324                          if test -z "$old_library" ; then
2325                            $echo
2326                            $echo "** And there doesn't seem to be a static archive available"
2327                            $echo "** The link will probably fail, sorry"
2328                          else
2329                            add="$dir/$old_library"
2330                          fi
2331                        fi
2332                    esac
2333                elif test "$hardcode_minus_L" = no; then                elif test "$hardcode_minus_L" = no; then
2334                  case $host in                  case $host in
2335                  *-*-sunos*) add_shlibpath="$dir" ;;                  *-*-sunos*) add_shlibpath="$dir" ;;
# Line 1804  compiler." Line 2348  compiler."
2348                  add="$dir/$linklib"                  add="$dir/$linklib"
2349                elif test "$hardcode_minus_L" = yes; then                elif test "$hardcode_minus_L" = yes; then
2350                  add_dir="-L$dir"                  add_dir="-L$dir"
2351                    # Try looking first in the location we're being installed to.
2352                    if test -n "$inst_prefix_dir"; then
2353                      case "$libdir" in
2354                        [\\/]*)
2355                          add_dir="-L$inst_prefix_dir$libdir $add_dir"
2356                          ;;
2357                      esac
2358                    fi
2359                  add="-l$name"                  add="-l$name"
2360                elif test "$hardcode_shlibpath_var" = yes; then                elif test "$hardcode_shlibpath_var" = yes; then
2361                  add_shlibpath="$dir"                  add_shlibpath="$dir"
# Line 1826  compiler." Line 2378  compiler."
2378                *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;                *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2379                esac                esac
2380              fi              fi
2381              if test $linkmode = prog; then              if test "$linkmode" = prog; then
2382                test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"                test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2383                test -n "$add" && compile_deplibs="$add $compile_deplibs"                test -n "$add" && compile_deplibs="$add $compile_deplibs"
2384              else              else
# Line 1843  compiler." Line 2395  compiler."
2395              fi              fi
2396            fi            fi
2397    
2398            if test $linkmode = prog || test "$mode" = relink; then            if test "$linkmode" = prog || test "$mode" = relink; then
2399              add_shlibpath=              add_shlibpath=
2400              add_dir=              add_dir=
2401              add=              add=
# Line 1859  compiler." Line 2411  compiler."
2411                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2412                esac                esac
2413                add="-l$name"                add="-l$name"
2414                elif test "$hardcode_automatic" = yes; then
2415                  if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2416                    add="$inst_prefix_dir$libdir/$linklib"
2417                  else
2418                    add="$libdir/$linklib"
2419                  fi
2420              else              else
2421                # We cannot seem to hardcode it, guess we'll fake it.                # We cannot seem to hardcode it, guess we'll fake it.
2422                add_dir="-L$libdir"                add_dir="-L$libdir"
2423                  # Try looking first in the location we're being installed to.
2424                  if test -n "$inst_prefix_dir"; then
2425                    case "$libdir" in
2426                      [\\/]*)
2427                        add_dir="-L$inst_prefix_dir$libdir $add_dir"
2428                        ;;
2429                    esac
2430                  fi
2431                add="-l$name"                add="-l$name"
2432              fi              fi
2433    
2434              if test $linkmode = prog; then              if test "$linkmode" = prog; then
2435                test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"                test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2436                test -n "$add" && finalize_deplibs="$add $finalize_deplibs"                test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2437              else              else
# Line 1873  compiler." Line 2439  compiler."
2439                test -n "$add" && deplibs="$add $deplibs"                test -n "$add" && deplibs="$add $deplibs"
2440              fi              fi
2441            fi            fi
2442          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  
2443            # Here we assume that one of hardcode_direct or hardcode_minus_L            # Here we assume that one of hardcode_direct or hardcode_minus_L
2444            # is not unsupported.  This is valid on all known static and            # is not unsupported.  This is valid on all known static and
2445            # shared platforms.            # shared platforms.
# Line 1902  compiler." Line 2459  compiler."
2459    
2460              # Just print a warning and add the library to dependency_libs so              # Just print a warning and add the library to dependency_libs so
2461              # that the program can be linked against the static library.              # that the program can be linked against the static library.
2462              echo              $echo
2463              echo "*** Warning: This library needs some functionality provided by $lib."              $echo "*** Warning: This system can not link to static lib archive $lib."
2464              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"
2465              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"
2466              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."
2467              if test "$module" = yes; then              if test "$module" = yes; then
2468                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 "
2469                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"
2470                  $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2471                if test -z "$global_symbol_pipe"; then                if test -z "$global_symbol_pipe"; then
2472                  echo                  $echo
2473                  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"
2474                  echo "*** lists from a program, using \`nm' or equivalent, but libtool could"                  $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2475                  echo "*** not find such a program.  So, this module is probably useless."                  $echo "*** not find such a program.  So, this module is probably useless."
2476                  echo "*** \`nm' from GNU binutils and a full rebuild may help."                  $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2477                fi                fi
2478                if test "$build_old_libs" = no; then                if test "$build_old_libs" = no; then
2479                  build_libtool_libs=module                  build_libtool_libs=module
2480                  build_old_libs=yes                  build_old_libs=yes
2481                else                else
2482                  build_libtool_libs=no                  build_libtool_libs=no
2483                fi                fi
2484              fi              fi
2485            else            else
# Line 1932  compiler." Line 2490  compiler."
2490            fi            fi
2491          fi # link shared/static library?          fi # link shared/static library?
2492    
2493          if test $linkmode = lib; then          if test "$linkmode" = lib; then
2494            if test -n "$dependency_libs" &&            if test -n "$dependency_libs" &&
2495               { test $hardcode_into_libs != yes || test $build_old_libs = yes ||               { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2496                 test $link_static = yes; }; then                 test "$link_static" = yes; }; then
2497              # Extract -R from dependency_libs              # Extract -R from dependency_libs
2498              temp_deplibs=              temp_deplibs=
2499              for libdir in $dependency_libs; do              for libdir in $dependency_libs; do
# Line 1958  compiler." Line 2516  compiler."
2516            tmp_libs=            tmp_libs=
2517            for deplib in $dependency_libs; do            for deplib in $dependency_libs; do
2518              newdependency_libs="$deplib $newdependency_libs"              newdependency_libs="$deplib $newdependency_libs"
2519              case "$tmp_libs " in              if test "X$duplicate_deps" = "Xyes" ; then
2520              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;                case "$tmp_libs " in
2521              esac                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2522                  esac
2523                fi
2524              tmp_libs="$tmp_libs $deplib"              tmp_libs="$tmp_libs $deplib"
2525            done            done
2526    
2527            if test $link_all_deplibs != no; then            if test "$link_all_deplibs" != no; then
2528              # Add the search paths of all dependency libraries              # Add the search paths of all dependency libraries
2529              for deplib in $dependency_libs; do              for deplib in $dependency_libs; do
2530                case $deplib in                case $deplib in
# Line 1984  compiler." Line 2544  compiler."
2544                    ;;                    ;;
2545                  esac                  esac
2546                  if grep "^installed=no" $deplib > /dev/null; then                  if grep "^installed=no" $deplib > /dev/null; then
2547                    path="-L$absdir/$objdir"                    path="$absdir/$objdir"
2548                  else                  else
2549                    eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`                    eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2550                    if test -z "$libdir"; then                    if test -z "$libdir"; then
2551                      $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2                      $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2552                      exit 1                      exit 1
# Line 1994  compiler." Line 2554  compiler."
2554                    if test "$absdir" != "$libdir"; then                    if test "$absdir" != "$libdir"; then
2555                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2                      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2556                    fi                    fi
2557                    path="-L$absdir"                    path="$absdir"
2558                  fi                  fi
2559                    depdepl=
2560                    case $host in
2561                    *-*-darwin*)
2562                      # we do not want to link against static libs, but need to link against shared
2563                      eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2564                      if test -n "$deplibrary_names" ; then
2565                        for tmp in $deplibrary_names ; do
2566                          depdepl=$tmp
2567                        done
2568                        if test -f "$path/$depdepl" ; then
2569                          depdepl="$path/$depdepl"
2570                       fi
2571                        newlib_search_path="$newlib_search_path $path"
2572                        path=""
2573                      fi
2574                      ;;
2575                    *)
2576                    path="-L$path"
2577                    ;;
2578                    esac
2579                    
2580                    ;;
2581                      -l*)
2582                    case $host in
2583                    *-*-darwin*)
2584                     # Again, we only want to link against shared libraries
2585                     eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2586                     for tmp in $newlib_search_path ; do
2587                         if test -f "$tmp/lib$tmp_libs.dylib" ; then
2588                           eval depdepl="$tmp/lib$tmp_libs.dylib"
2589                           break
2590                         fi  
2591             done
2592             path=""
2593                      ;;
2594                    *) continue ;;
2595                    esac              
2596                  ;;                  ;;
2597                *) continue ;;                *) continue ;;
2598                esac                esac
2599                case " $deplibs " in                case " $deplibs " in
2600                  *" $depdepl "*) ;;
2601                  *) deplibs="$deplibs $depdepl" ;;
2602                  esac            
2603                  case " $deplibs " in
2604                *" $path "*) ;;                *" $path "*) ;;
2605                *) deplibs="$deplibs $path" ;;                *) deplibs="$deplibs $path" ;;
2606                esac                esac
# Line 2007  compiler." Line 2608  compiler."
2608            fi # link_all_deplibs != no            fi # link_all_deplibs != no
2609          fi # linkmode = lib          fi # linkmode = lib
2610        done # for deplib in $libs        done # for deplib in $libs
2611        if test $pass = dlpreopen; then        dependency_libs="$newdependency_libs"
2612          if test "$pass" = dlpreopen; then
2613          # Link the dlpreopened libraries before other libraries          # Link the dlpreopened libraries before other libraries
2614          for deplib in $save_deplibs; do          for deplib in $save_deplibs; do
2615            deplibs="$deplib $deplibs"            deplibs="$deplib $deplibs"
2616          done          done
2617        fi        fi
2618        if test $pass != dlopen; then        if test "$pass" != dlopen; then
2619          test $pass != scan && dependency_libs="$newdependency_libs"          if test "$pass" != conv; then
         if test $pass != conv; then  
2620            # Make sure lib_search_path contains only unique directories.            # Make sure lib_search_path contains only unique directories.
2621            lib_search_path=            lib_search_path=
2622            for dir in $newlib_search_path; do            for dir in $newlib_search_path; do
# Line 2037  compiler." Line 2638  compiler."
2638            eval tmp_libs=\"\$$var\"            eval tmp_libs=\"\$$var\"
2639            new_libs=            new_libs=
2640            for deplib in $tmp_libs; do            for deplib in $tmp_libs; do
2641                # FIXME: Pedantically, this is the right thing to do, so
2642                #        that some nasty dependency loop isn't accidentally
2643                #        broken:
2644                #new_libs="$deplib $new_libs"
2645                # Pragmatically, this seems to cause very few problems in
2646                # practice:
2647              case $deplib in              case $deplib in
2648              -L*) new_libs="$deplib $new_libs" ;;              -L*) new_libs="$deplib $new_libs" ;;
2649                -R*) ;;
2650              *)              *)
2651                  # And here is the reason: when a library appears more
2652                  # than once as an explicit dependence of a library, or
2653                  # is implicitly linked in more than once by the
2654                  # compiler, it is considered special, and multiple
2655                  # occurrences thereof are not removed.  Compare this
2656                  # with having the same library being listed as a
2657                  # dependency of multiple other libraries: in this case,
2658                  # we know (pedantically, we assume) the library does not
2659                  # need to be listed more than once, so we keep only the
2660                  # last copy.  This is not always right, but it is rare
2661                  # enough that we require users that really mean to play
2662                  # such unportable linking tricks to link the library
2663                  # using -Wl,-lname, so that libtool does not consider it
2664                  # for duplicate removal.
2665                case " $specialdeplibs " in                case " $specialdeplibs " in
2666                *" $deplib "*) new_libs="$deplib $new_libs" ;;                *" $deplib "*) new_libs="$deplib $new_libs" ;;
2667                *)                *)
# Line 2067  compiler." Line 2689  compiler."
2689            eval $var=\"$tmp_libs\"            eval $var=\"$tmp_libs\"
2690          done # for var          done # for var
2691        fi        fi
2692        if test "$pass" = "conv" &&        # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2693         { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then        tmp_libs=
2694          libs="$deplibs" # reset libs        for i in $dependency_libs ; do
2695          deplibs=          case " $predeps $postdeps $compiler_lib_search_path " in
2696        fi          *" $i "*)
2697              i=""
2698              ;;
2699            esac
2700            if test -n "$i" ; then
2701              tmp_libs="$tmp_libs $i"
2702            fi
2703          done
2704          dependency_libs=$tmp_libs
2705      done # for pass      done # for pass
2706      if test $linkmode = prog; then      if test "$linkmode" = prog; then
2707        dlfiles="$newdlfiles"        dlfiles="$newdlfiles"
2708        dlprefiles="$newdlprefiles"        dlprefiles="$newdlprefiles"
2709      fi      fi
2710    
2711      case $linkmode in      case $linkmode in
2712      oldlib)      oldlib)
2713          if test -n "$deplibs"; then
2714            $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2715          fi
2716    
2717        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2718          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2719        fi        fi
# Line 2093  compiler." Line 2727  compiler."
2727        fi        fi
2728    
2729        if test -n "$vinfo"; then        if test -n "$vinfo"; then
2730          $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2          $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2731        fi        fi
2732    
2733        if test -n "$release"; then        if test -n "$release"; then
# Line 2115  compiler." Line 2749  compiler."
2749        case $outputname in        case $outputname in
2750        lib*)        lib*)
2751          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2752            eval shared_ext=\"$shrext\"
2753          eval libname=\"$libname_spec\"          eval libname=\"$libname_spec\"
2754          ;;          ;;
2755        *)        *)
# Line 2126  compiler." Line 2761  compiler."
2761          if test "$need_lib_prefix" != no; then          if test "$need_lib_prefix" != no; then
2762            # Add the "lib" prefix for modules if required            # Add the "lib" prefix for modules if required
2763            name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`            name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2764              eval shared_ext=\"$shrext\"
2765            eval libname=\"$libname_spec\"            eval libname=\"$libname_spec\"
2766          else          else
2767            libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`            libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
# Line 2138  compiler." Line 2774  compiler."
2774            $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
2775            exit 1            exit 1
2776          else          else
2777            echo            $echo
2778            echo "*** Warning: Linking the shared library $output against the non-libtool"            $echo "*** Warning: Linking the shared library $output against the non-libtool"
2779            echo "*** objects $objs is not portable!"            $echo "*** objects $objs is not portable!"
2780            libobjs="$libobjs $objs"            libobjs="$libobjs $objs"
2781          fi          fi
2782        fi        fi
# Line 2150  compiler." Line 2786  compiler."
2786        fi        fi
2787    
2788        set dummy $rpath        set dummy $rpath
2789        if test $# -gt 2; then        if test "$#" -gt 2; then
2790          $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
2791        fi        fi
2792        install_libdir="$2"        install_libdir="$2"
# Line 2159  compiler." Line 2795  compiler."
2795        if test -z "$rpath"; then        if test -z "$rpath"; then
2796          if test "$build_libtool_libs" = yes; then          if test "$build_libtool_libs" = yes; then
2797            # Building a libtool convenience library.            # Building a libtool convenience library.
2798            libext=al            # Some compilers have problems with a `.al' extension so
2799              # convenience libraries should have the same extension an
2800              # archive normally would.
2801            oldlibs="$output_objdir/$libname.$libext $oldlibs"            oldlibs="$output_objdir/$libname.$libext $oldlibs"
2802            build_libtool_libs=convenience            build_libtool_libs=convenience
2803            build_old_libs=yes            build_old_libs=yes
2804          fi          fi
2805    
2806          if test -n "$vinfo"; then          if test -n "$vinfo"; then
2807            $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
2808          fi          fi
2809    
2810          if test -n "$release"; then          if test -n "$release"; then
# Line 2175  compiler." Line 2813  compiler."
2813        else        else
2814    
2815          # Parse the version information argument.          # Parse the version information argument.
2816          IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'          save_ifs="$IFS"; IFS=':'
2817          set dummy $vinfo 0 0 0          set dummy $vinfo 0 0 0
2818          IFS="$save_ifs"          IFS="$save_ifs"
2819    
# Line 2185  compiler." Line 2823  compiler."
2823            exit 1            exit 1
2824          fi          fi
2825    
2826          current="$2"          # convert absolute version numbers to libtool ages
2827          revision="$3"          # this retains compatibility with .la files and attempts
2828          age="$4"          # to make the code below a bit more comprehensible
2829            
2830            case $vinfo_number in
2831            yes)
2832              number_major="$2"
2833              number_minor="$3"
2834              number_revision="$4"
2835              #
2836              # There are really only two kinds -- those that
2837              # use the current revision as the major version
2838              # and those that subtract age and use age as
2839              # a minor version.  But, then there is irix
2840              # which has an extra 1 added just for fun
2841              #
2842              case $version_type in
2843              darwin|linux|osf|windows)
2844                current=`expr $number_major + $number_minor`
2845                age="$number_minor"
2846                revision="$number_revision"
2847                ;;
2848              freebsd-aout|freebsd-elf|sunos)
2849                current="$number_major"
2850                revision="$number_minor"
2851                age="0"
2852                ;;
2853              irix|nonstopux)
2854                current=`expr $number_major + $number_minor - 1`
2855                age="$number_minor"
2856                revision="$number_minor"
2857                ;;
2858              esac
2859              ;;
2860            no)
2861              current="$2"
2862              revision="$3"
2863              age="$4"
2864              ;;
2865            esac
2866    
2867          # Check that each of the things are valid numbers.          # Check that each of the things are valid numbers.
2868          case $current in          case $current in
# Line 2217  compiler." Line 2892  compiler."
2892            ;;            ;;
2893          esac          esac
2894    
2895          if test $age -gt $current; then          if test "$age" -gt "$current"; then
2896            $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
2897            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2898            exit 1            exit 1
# Line 2250  compiler." Line 2925  compiler."
2925            versuffix=".$current";            versuffix=".$current";
2926            ;;            ;;
2927    
2928          irix)          irix | nonstopux)
2929            major=`expr $current - $age + 1`            major=`expr $current - $age + 1`
2930            verstring="sgi$major.$revision"  
2931              case $version_type in
2932                nonstopux) verstring_prefix=nonstopux ;;
2933                *)         verstring_prefix=sgi ;;
2934              esac
2935              verstring="$verstring_prefix$major.$revision"
2936    
2937            # Add in all the interfaces that we are compatible with.            # Add in all the interfaces that we are compatible with.
2938            loop=$revision            loop=$revision
2939            while test $loop != 0; do            while test "$loop" -ne 0; do
2940              iface=`expr $revision - $loop`              iface=`expr $revision - $loop`
2941              loop=`expr $loop - 1`              loop=`expr $loop - 1`
2942              verstring="sgi$major.$iface:$verstring"              verstring="$verstring_prefix$major.$iface:$verstring"
2943            done            done
2944    
2945            # Before this point, $major must not contain `.'.            # Before this point, $major must not contain `.'.
# Line 2273  compiler." Line 2953  compiler."
2953            ;;            ;;
2954    
2955          osf)          osf)
2956            major=`expr $current - $age`            major=.`expr $current - $age`
2957            versuffix=".$current.$age.$revision"            versuffix=".$current.$age.$revision"
2958            verstring="$current.$age.$revision"            verstring="$current.$age.$revision"
2959    
2960            # Add in all the interfaces that we are compatible with.            # Add in all the interfaces that we are compatible with.
2961            loop=$age            loop=$age
2962            while test $loop != 0; do            while test "$loop" -ne 0; do
2963              iface=`expr $current - $loop`              iface=`expr $current - $loop`
2964              loop=`expr $loop - 1`              loop=`expr $loop - 1`
2965              verstring="$verstring:${iface}.0"              verstring="$verstring:${iface}.0"
# Line 2303  compiler." Line 2983  compiler."
2983    
2984          *)          *)
2985            $echo "$modename: unknown library version type \`$version_type'" 1>&2            $echo "$modename: unknown library version type \`$version_type'" 1>&2
2986            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
2987            exit 1            exit 1
2988            ;;            ;;
2989          esac          esac
# Line 2311  compiler." Line 2991  compiler."
2991          # Clear the version info if we defaulted, and they specified a release.          # Clear the version info if we defaulted, and they specified a release.
2992          if test -z "$vinfo" && test -n "$release"; then          if test -z "$vinfo" && test -n "$release"; then
2993            major=            major=
2994            verstring="0.0"            case $version_type in
2995              darwin)
2996                # we can't check for "0.0" in archive_cmds due to quoting
2997                # problems, so we reset it completely
2998                verstring=
2999                ;;
3000              *)
3001                verstring="0.0"
3002                ;;
3003              esac
3004            if test "$need_version" = no; then            if test "$need_version" = no; then
3005              versuffix=              versuffix=
3006            else            else
# Line 2340  compiler." Line 3029  compiler."
3029        fi        fi
3030    
3031        if test "$mode" != relink; then        if test "$mode" != relink; then
3032          # Remove our outputs.          # Remove our outputs, but don't remove object files since they
3033          $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"          # may have been created when compiling PIC objects.
3034          $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*          removelist=
3035            tempremovelist=`$echo "$output_objdir/*"`
3036            for p in $tempremovelist; do
3037              case $p in
3038                *.$objext)
3039                   ;;
3040                $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3041                   removelist="$removelist $p"
3042                   ;;
3043                *) ;;
3044              esac
3045            done
3046            if test -n "$removelist"; then
3047              $show "${rm}r $removelist"
3048              $run ${rm}r $removelist
3049            fi
3050        fi        fi
3051    
3052        # Now set the variables for building old libraries.        # Now set the variables for building old libraries.
# Line 2355  compiler." Line 3059  compiler."
3059    
3060        # Eliminate all temporary directories.        # Eliminate all temporary directories.
3061        for path in $notinst_path; do        for path in $notinst_path; do
3062          lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`          lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3063          deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`          deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3064          dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`          dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3065        done        done
3066    
3067        if test -n "$xrpath"; then        if test -n "$xrpath"; then
# Line 2370  compiler." Line 3074  compiler."
3074            *) finalize_rpath="$finalize_rpath $libdir" ;;            *) finalize_rpath="$finalize_rpath $libdir" ;;
3075            esac            esac
3076          done          done
3077          if test $hardcode_into_libs != yes || test $build_old_libs = yes; then          if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3078            dependency_libs="$temp_xrpath $dependency_libs"            dependency_libs="$temp_xrpath $dependency_libs"
3079          fi          fi
3080        fi        fi
# Line 2408  compiler." Line 3112  compiler."
3112            *-*-netbsd*)            *-*-netbsd*)
3113              # 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.
3114              ;;              ;;
3115            *)            *-*-openbsd* | *-*-freebsd*)
3116                # Do not include libc due to us having libc/libc_r.
3117                test "X$arg" = "X-lc" && continue
3118                ;;
3119              *)
3120              # Add libc to deplibs on all other systems if necessary.              # Add libc to deplibs on all other systems if necessary.
3121              if test $build_libtool_need_lc = "yes"; then              if test "$build_libtool_need_lc" = "yes"; then
3122                deplibs="$deplibs -lc"                deplibs="$deplibs -lc"
3123              fi              fi
3124              ;;              ;;
# Line 2437  compiler." Line 3145  compiler."
3145            # This might be a little naive.  We might want to check            # This might be a little naive.  We might want to check
3146            # whether the library exists or not.  But this is on            # whether the library exists or not.  But this is on
3147            # osf3 & osf4 and I'm not really sure... Just            # osf3 & osf4 and I'm not really sure... Just
3148            # implementing what was already the behaviour.            # implementing what was already the behavior.
3149            newdeplibs=$deplibs            newdeplibs=$deplibs
3150            ;;            ;;
3151          test_compile)          test_compile)
# Line 2450  compiler." Line 3158  compiler."
3158            int main() { return 0; }            int main() { return 0; }
3159  EOF  EOF
3160            $rm conftest            $rm conftest
3161            $CC -o conftest conftest.c $deplibs            $LTCC -o conftest conftest.c $deplibs
3162            if test $? -eq 0 ; then            if test "$?" -eq 0 ; then
3163              ldd_output=`ldd conftest`              ldd_output=`ldd conftest`
3164              for i in $deplibs; do              for i in $deplibs; do
3165                name="`expr $i : '-l\(.*\)'`"                name="`expr $i : '-l\(.*\)'`"
3166                # If $name is empty we are operating on a -L argument.                # If $name is empty we are operating on a -L argument.
3167                if test -n "$name" && test "$name" != "0"; then                if test "$name" != "" && test "$name" -ne "0"; then
3168                  libname=`eval \\$echo \"$libname_spec\"`                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3169                  deplib_matches=`eval \\$echo \"$library_names_spec\"`                    case " $predeps $postdeps " in
3170                  set dummy $deplib_matches                    *" $i "*)
3171                  deplib_match=$2                      newdeplibs="$newdeplibs $i"
3172                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then                      i=""
3173                    newdeplibs="$newdeplibs $i"                      ;;
3174                  else                    esac
3175                    droppeddeps=yes                  fi
3176                    echo                  if test -n "$i" ; then
3177                    echo "*** Warning: This library needs some functionality provided by $i."                    libname=`eval \\$echo \"$libname_spec\"`
3178                    echo "*** I have the capability to make that library automatically link in when"                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3179                    echo "*** you link to this library.  But I can only do this if you have a"                    set dummy $deplib_matches
3180                    echo "*** shared version of the library, which you do not appear to have."                    deplib_match=$2
3181                      if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3182                        newdeplibs="$newdeplibs $i"
3183                      else
3184                        droppeddeps=yes
3185                        $echo
3186                        $echo "*** Warning: dynamic linker does not accept needed library $i."
3187                        $echo "*** I have the capability to make that library automatically link in when"
3188                        $echo "*** you link to this library.  But I can only do this if you have a"
3189                        $echo "*** shared version of the library, which I believe you do not have"
3190                        $echo "*** because a test_compile did reveal that the linker did not use it for"
3191                        $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3192                      fi
3193                  fi                  fi
3194                else                else
3195                  newdeplibs="$newdeplibs $i"                  newdeplibs="$newdeplibs $i"
3196                fi                fi
3197              done              done
3198            else            else
3199              # Error occured in the first compile.  Let's try to salvage the situation:              # Error occurred in the first compile.  Let's try to salvage
3200              # Compile a seperate program for each library.              # the situation: Compile a separate program for each library.
3201              for i in $deplibs; do              for i in $deplibs; do
3202                name="`expr $i : '-l\(.*\)'`"                name="`expr $i : '-l\(.*\)'`"
3203               # If $name is empty we are operating on a -L argument.                # If $name is empty we are operating on a -L argument.
3204                if test -n "$name" && test "$name" != "0"; then                if test "$name" != "" && test "$name" != "0"; then
3205                  $rm conftest                  $rm conftest
3206                  $CC -o conftest conftest.c $i                  $LTCC -o conftest conftest.c $i
3207                  # Did it work?                  # Did it work?
3208                  if test $? -eq 0 ; then                  if test "$?" -eq 0 ; then
3209                    ldd_output=`ldd conftest`                    ldd_output=`ldd conftest`
3210                    libname=`eval \\$echo \"$libname_spec\"`                    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3211                    deplib_matches=`eval \\$echo \"$library_names_spec\"`                      case " $predeps $postdeps " in
3212                    set dummy $deplib_matches                      *" $i "*)
3213                    deplib_match=$2                        newdeplibs="$newdeplibs $i"
3214                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then                        i=""
3215                      newdeplibs="$newdeplibs $i"                        ;;
3216                    else                      esac
3217                      droppeddeps=yes                    fi
3218                      echo                    if test -n "$i" ; then
3219                      echo "*** Warning: This library needs some functionality provided by $i."                      libname=`eval \\$echo \"$libname_spec\"`
3220                      echo "*** I have the capability to make that library automatically link in when"                      deplib_matches=`eval \\$echo \"$library_names_spec\"`
3221                      echo "*** you link to this library.  But I can only do this if you have a"                      set dummy $deplib_matches
3222                      echo "*** shared version of the library, which you do not appear to have."                      deplib_match=$2
3223                        if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3224                          newdeplibs="$newdeplibs $i"
3225                        else
3226                          droppeddeps=yes
3227                          $echo
3228                          $echo "*** Warning: dynamic linker does not accept needed library $i."
3229                          $echo "*** I have the capability to make that library automatically link in when"
3230                          $echo "*** you link to this library.  But I can only do this if you have a"
3231                          $echo "*** shared version of the library, which you do not appear to have"
3232                          $echo "*** because a test_compile did reveal that the linker did not use this one"
3233                          $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3234                        fi
3235                    fi                    fi
3236                  else                  else
3237                    droppeddeps=yes                    droppeddeps=yes
3238                    echo                    $echo
3239                    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"
3240                    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"
3241                    echo "*** library that it depends on before this library will be fully"                    $echo "*** library that it depends on before this library will be fully"
3242                    echo "*** functional.  Installing it before continuing would be even better."                    $echo "*** functional.  Installing it before continuing would be even better."
3243                  fi                  fi
3244                else                else
3245                  newdeplibs="$newdeplibs $i"                  newdeplibs="$newdeplibs $i"
# Line 2521  EOF Line 3253  EOF
3253            for a_deplib in $deplibs; do            for a_deplib in $deplibs; do
3254              name="`expr $a_deplib : '-l\(.*\)'`"              name="`expr $a_deplib : '-l\(.*\)'`"
3255              # If $name is empty we are operating on a -L argument.              # If $name is empty we are operating on a -L argument.
3256              if test -n "$name" && test "$name" != "0"; then              if test "$name" != "" && test  "$name" != "0"; then
3257                libname=`eval \\$echo \"$libname_spec\"`                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3258                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do                  case " $predeps $postdeps " in
3259                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`                  *" $a_deplib "*)
3260                      for potent_lib in $potential_libs; do                    newdeplibs="$newdeplibs $a_deplib"
3261                      a_deplib=""
3262                      ;;
3263                    esac
3264                  fi
3265                  if test -n "$a_deplib" ; then
3266                    libname=`eval \\$echo \"$libname_spec\"`
3267                    for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3268                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3269                      for potent_lib in $potential_libs; do
3270                        # Follow soft links.                        # Follow soft links.
3271                        if ls -lLd "$potent_lib" 2>/dev/null \                        if ls -lLd "$potent_lib" 2>/dev/null \
3272                           | grep " -> " >/dev/null; then                           | grep " -> " >/dev/null; then
# Line 2538  EOF Line 3279  EOF
3279                        # but so what?                        # but so what?
3280                        potlib="$potent_lib"                        potlib="$potent_lib"
3281                        while test -h "$potlib" 2>/dev/null; do                        while test -h "$potlib" 2>/dev/null; do
3282                          potliblink=`ls -ld $potlib | sed 's/.* -> //'`                          potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3283                          case $potliblink in                          case $potliblink in
3284                          [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;                          [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3285                          *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;                          *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3286                          esac                          esac
3287                        done                        done
3288                        if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \                        if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3289                           | sed 10q \                           | ${SED} 10q \
3290                           | egrep "$file_magic_regex" > /dev/null; then                           | $EGREP "$file_magic_regex" > /dev/null; then
3291                          newdeplibs="$newdeplibs $a_deplib"                          newdeplibs="$newdeplibs $a_deplib"
3292                          a_deplib=""                          a_deplib=""
3293                          break 2                          break 2
3294                        fi                        fi
3295                      done                    done
3296                done                  done
3297                  fi
3298                if test -n "$a_deplib" ; then                if test -n "$a_deplib" ; then
3299                  droppeddeps=yes                  droppeddeps=yes
3300                  echo                  $echo
3301                  echo "*** Warning: This library needs some functionality provided by $a_deplib."                  $echo "*** Warning: linker path does not have real file for library $a_deplib."
3302                  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"
3303                  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"
3304                  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"
3305                    $echo "*** because I did check the linker path looking for a file starting"
3306                    if test -z "$potlib" ; then
3307                      $echo "*** with $libname but no candidates were found. (...for file magic test)"
3308                    else
3309                      $echo "*** with $libname and none of the candidates passed a file format test"
3310                      $echo "*** using a file magic. Last file checked: $potlib"
3311                    fi
3312                fi                fi
3313              else              else
3314                # Add a -L argument.                # Add a -L argument.
# Line 2574  EOF Line 3323  EOF
3323              name="`expr $a_deplib : '-l\(.*\)'`"              name="`expr $a_deplib : '-l\(.*\)'`"
3324              # If $name is empty we are operating on a -L argument.              # If $name is empty we are operating on a -L argument.
3325              if test -n "$name" && test "$name" != "0"; then              if test -n "$name" && test "$name" != "0"; then
3326                libname=`eval \\$echo \"$libname_spec\"`                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3327                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do                  case " $predeps $postdeps " in
3328                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`                  *" $a_deplib "*)
3329                  for potent_lib in $potential_libs; do                    newdeplibs="$newdeplibs $a_deplib"
3330                    if eval echo \"$potent_lib\" 2>/dev/null \                    a_deplib=""
3331                        | sed 10q \                    ;;
3332                        | egrep "$match_pattern_regex" > /dev/null; then                  esac
3333                      newdeplibs="$newdeplibs $a_deplib"                fi
3334                      a_deplib=""                if test -n "$a_deplib" ; then
3335                      break 2                  libname=`eval \\$echo \"$libname_spec\"`
3336                    fi                  for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3337                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3338                      for potent_lib in $potential_libs; do
3339                        potlib="$potent_lib" # see symlink-check above in file_magic test
3340                        if eval $echo \"$potent_lib\" 2>/dev/null \
3341                            | ${SED} 10q \
3342                            | $EGREP "$match_pattern_regex" > /dev/null; then
3343                          newdeplibs="$newdeplibs $a_deplib"
3344                          a_deplib=""
3345                          break 2
3346                        fi
3347                      done
3348                  done                  done
3349                done                fi
3350                if test -n "$a_deplib" ; then                if test -n "$a_deplib" ; then
3351                  droppeddeps=yes                  droppeddeps=yes
3352                  echo                  $echo
3353                  echo "*** Warning: This library needs some functionality provided by $a_deplib."                  $echo "*** Warning: linker path does not have real file for library $a_deplib."
3354                  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"
3355                  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"
3356                  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"
3357                    $echo "*** because I did check the linker path looking for a file starting"
3358                    if test -z "$potlib" ; then
3359                      $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3360                    else
3361                      $echo "*** with $libname and none of the candidates passed a file format test"
3362                      $echo "*** using a regex pattern. Last file checked: $potlib"
3363                    fi
3364                fi                fi
3365              else              else
3366                # Add a -L argument.                # Add a -L argument.
# Line 2603  EOF Line 3370  EOF
3370            ;;            ;;
3371          none | unknown | *)          none | unknown | *)
3372            newdeplibs=""            newdeplibs=""
3373            if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \            tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3374                 -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |              -e 's/ -[LR][^ ]*//g'`
3375               grep . >/dev/null; then            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3376              echo              for i in $predeps $postdeps ; do
3377                  # can't use Xsed below, because $i might contain '/'
3378                  tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3379                done
3380              fi
3381              if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
3382                | grep . >/dev/null; then
3383                $echo
3384              if test "X$deplibs_check_method" = "Xnone"; then              if test "X$deplibs_check_method" = "Xnone"; then
3385                echo "*** Warning: inter-library dependencies are not supported in this platform."                $echo "*** Warning: inter-library dependencies are not supported in this platform."
3386              else              else
3387                echo "*** Warning: inter-library dependencies are not known to be supported."                $echo "*** Warning: inter-library dependencies are not known to be supported."
3388              fi              fi
3389              echo "*** All declared inter-library dependencies are being dropped."              $echo "*** All declared inter-library dependencies are being dropped."
3390              droppeddeps=yes              droppeddeps=yes
3391            fi            fi
3392            ;;            ;;
# Line 2632  EOF Line 3406  EOF
3406    
3407          if test "$droppeddeps" = yes; then          if test "$droppeddeps" = yes; then
3408            if test "$module" = yes; then            if test "$module" = yes; then
3409              echo              $echo
3410              echo "*** Warning: libtool could not satisfy all declared inter-library"              $echo "*** Warning: libtool could not satisfy all declared inter-library"
3411              echo "*** dependencies of module $libname.  Therefore, libtool will create"              $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3412              echo "*** a static module, that should work as long as the dlopening"              $echo "*** a static module, that should work as long as the dlopening"
3413              echo "*** application is linked with the -dlopen flag."              $echo "*** application is linked with the -dlopen flag."
3414              if test -z "$global_symbol_pipe"; then              if test -z "$global_symbol_pipe"; then
3415                echo                $echo
3416                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"
3417                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3418                echo "*** not find such a program.  So, this module is probably useless."                $echo "*** not find such a program.  So, this module is probably useless."
3419                echo "*** \`nm' from GNU binutils and a full rebuild may help."                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3420              fi              fi
3421              if test "$build_old_libs" = no; then              if test "$build_old_libs" = no; then
3422                oldlibs="$output_objdir/$libname.$libext"                oldlibs="$output_objdir/$libname.$libext"
# Line 2652  EOF Line 3426  EOF
3426                build_libtool_libs=no                build_libtool_libs=no
3427              fi              fi
3428            else            else
3429              echo "*** The inter-library dependencies that have been dropped here will be"              $echo "*** The inter-library dependencies that have been dropped here will be"
3430              echo "*** automatically added whenever a program is linked with this library"              $echo "*** automatically added whenever a program is linked with this library"
3431              echo "*** or is declared to -dlopen it."              $echo "*** or is declared to -dlopen it."
3432    
3433              if test $allow_undefined = no; then              if test "$allow_undefined" = no; then
3434                echo                $echo
3435                echo "*** Since this library must not contain undefined symbols,"                $echo "*** Since this library must not contain undefined symbols,"
3436                echo "*** because either the platform does not support them or"                $echo "*** because either the platform does not support them or"
3437                echo "*** it was explicitly requested with -no-undefined,"                $echo "*** it was explicitly requested with -no-undefined,"
3438                echo "*** libtool will only create a static version of it."                $echo "*** libtool will only create a static version of it."
3439                if test "$build_old_libs" = no; then                if test "$build_old_libs" = no; then
3440                  oldlibs="$output_objdir/$libname.$libext"                  oldlibs="$output_objdir/$libname.$libext"
3441                  build_libtool_libs=module                  build_libtool_libs=module
# Line 2683  EOF Line 3457  EOF
3457    
3458        # Test again, we may have decided not to build it any more        # Test again, we may have decided not to build it any more
3459        if test "$build_libtool_libs" = yes; then        if test "$build_libtool_libs" = yes; then
3460          if test $hardcode_into_libs = yes; then          if test "$hardcode_into_libs" = yes; then
3461            # Hardcode the library paths            # Hardcode the library paths
3462            hardcode_libdirs=            hardcode_libdirs=
3463            dep_rpath=            dep_rpath=
# Line 2719  EOF Line 3493  EOF
3493            if test -n "$hardcode_libdir_separator" &&            if test -n "$hardcode_libdir_separator" &&
3494               test -n "$hardcode_libdirs"; then               test -n "$hardcode_libdirs"; then
3495              libdir="$hardcode_libdirs"              libdir="$hardcode_libdirs"
3496              eval dep_rpath=\"$hardcode_libdir_flag_spec\"              if test -n "$hardcode_libdir_flag_spec_ld"; then
3497                  eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3498                else
3499                  eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3500                fi
3501            fi            fi
3502            if test -n "$runpath_var" && test -n "$perm_rpath"; then            if test -n "$runpath_var" && test -n "$perm_rpath"; then
3503              # We should set the runpath_var.              # We should set the runpath_var.
# Line 2739  EOF Line 3517  EOF
3517          fi          fi
3518    
3519          # Get the real and link names of the library.          # Get the real and link names of the library.
3520            eval shared_ext=\"$shrext\"
3521          eval library_names=\"$library_names_spec\"          eval library_names=\"$library_names_spec\"
3522          set dummy $library_names          set dummy $library_names
3523          realname="$2"          realname="$2"
# Line 2749  EOF Line 3528  EOF
3528          else          else
3529            soname="$realname"            soname="$realname"
3530          fi          fi
3531          test -z "$dlname" && dlname=$soname          if test -z "$dlname"; then
3532              dlname=$soname
3533            fi
3534    
3535          lib="$output_objdir/$realname"          lib="$output_objdir/$realname"
3536          for link          for link
# Line 2757  EOF Line 3538  EOF
3538            linknames="$linknames $link"            linknames="$linknames $link"
3539          done          done
3540    
         # Ensure that we have .o objects for linkers which dislike .lo  
         # (e.g. aix) in case we are running --disable-static  
         for obj in $libobjs; do  
           xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`  
           if test "X$xdir" = "X$obj"; then  
             xdir="."  
           else  
             xdir="$xdir"  
           fi  
           baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`  
           oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`  
           if test ! -f $xdir/$oldobj; then  
             $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"  
             $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?  
           fi  
         done  
   
3541          # Use standard objects if they are pic          # Use standard objects if they are pic
3542          test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`          test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3543    
# Line 2784  EOF Line 3548  EOF
3548              export_symbols="$output_objdir/$libname.exp"              export_symbols="$output_objdir/$libname.exp"
3549              $run $rm $export_symbols              $run $rm $export_symbols
3550              eval cmds=\"$export_symbols_cmds\"              eval cmds=\"$export_symbols_cmds\"
3551              IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'              save_ifs="$IFS"; IFS='~'
3552              for cmd in $cmds; do              for cmd in $cmds; do
3553                IFS="$save_ifs"                IFS="$save_ifs"
3554                $show "$cmd"                if len=`expr "X$cmd" : ".*"` &&
3555                $run eval "$cmd" || exit $?                 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3556                    $show "$cmd"
3557                    $run eval "$cmd" || exit $?
3558                    skipped_export=false
3559                  else
3560                    # The command line is too long to execute in one step.
3561                    $show "using reloadable object file for export list..."
3562                    skipped_export=:
3563                  fi
3564              done              done
3565              IFS="$save_ifs"              IFS="$save_ifs"
3566              if test -n "$export_symbols_regex"; then              if test -n "$export_symbols_regex"; then
3567                $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""                $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3568                $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'                $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3569                $show "$mv \"${export_symbols}T\" \"$export_symbols\""                $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3570                $run eval '$mv "${export_symbols}T" "$export_symbols"'                $run eval '$mv "${export_symbols}T" "$export_symbols"'
3571              fi              fi
# Line 2804  EOF Line 3576  EOF
3576            $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'            $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3577          fi          fi
3578    
3579            tmp_deplibs=
3580            for test_deplib in $deplibs; do
3581                    case " $convenience " in
3582                    *" $test_deplib "*) ;;
3583                    *)
3584                            tmp_deplibs="$tmp_deplibs $test_deplib"
3585                            ;;
3586                    esac
3587            done
3588            deplibs="$tmp_deplibs"
3589    
3590          if test -n "$convenience"; then          if test -n "$convenience"; then
3591            if test -n "$whole_archive_flag_spec"; then            if test -n "$whole_archive_flag_spec"; then
3592                save_libobjs=$libobjs
3593              eval libobjs=\"\$libobjs $whole_archive_flag_spec\"              eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3594            else            else
3595              gentop="$output_objdir/${outputname}x"              gentop="$output_objdir/${outputname}x"
3596              $show "${rm}r $gentop"              $show "${rm}r $gentop"
3597              $run ${rm}r "$gentop"              $run ${rm}r "$gentop"
3598              $show "mkdir $gentop"              $show "$mkdir $gentop"
3599              $run mkdir "$gentop"              $run $mkdir "$gentop"
3600              status=$?              status=$?
3601              if test $status -ne 0 && test ! -d "$gentop"; then              if test "$status" -ne 0 && test ! -d "$gentop"; then
3602                exit $status                exit $status
3603              fi              fi
3604              generated="$generated $gentop"              generated="$generated $gentop"
# Line 2830  EOF Line 3614  EOF
3614    
3615                $show "${rm}r $xdir"                $show "${rm}r $xdir"
3616                $run ${rm}r "$xdir"                $run ${rm}r "$xdir"
3617                $show "mkdir $xdir"                $show "$mkdir $xdir"
3618                $run mkdir "$xdir"                $run $mkdir "$xdir"
3619                status=$?                status=$?
3620                if test $status -ne 0 && test ! -d "$xdir"; then                if test "$status" -ne 0 && test ! -d "$xdir"; then
3621                  exit $status                  exit $status
3622                fi                fi
3623                  # We will extract separately just the conflicting names and we will no
3624                  # longer touch any unique names. It is faster to leave these extract
3625                  # automatically by $AR in one run.
3626                $show "(cd $xdir && $AR x $xabs)"                $show "(cd $xdir && $AR x $xabs)"
3627                $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?                $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3628                  if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3629                    :
3630                  else
3631                    $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3632                    $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3633                    $AR t "$xabs" | sort | uniq -cd | while read -r count name
3634                    do
3635                      i=1
3636                      while test "$i" -le "$count"
3637                      do
3638                       # Put our $i before any first dot (extension)
3639                       # Never overwrite any file
3640                       name_to="$name"
3641                       while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3642                       do
3643                         name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3644                       done
3645                       $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3646                       $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3647                       i=`expr $i + 1`
3648                      done
3649                    done
3650                  fi
3651    
3652                libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`                libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3653              done              done
3654            fi            fi
3655          fi          fi
# Line 2855  EOF Line 3665  EOF
3665          fi          fi
3666    
3667          # Do each of the archive commands.          # Do each of the archive commands.
3668            if test "$module" = yes && test -n "$module_cmds" ; then
3669              if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3670                eval cmds=\"$module_expsym_cmds\"
3671              else
3672                eval cmds=\"$module_cmds\"
3673              fi
3674            else
3675          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3676            eval cmds=\"$archive_expsym_cmds\"            eval cmds=\"$archive_expsym_cmds\"
3677          else          else
3678            eval cmds=\"$archive_cmds\"            eval cmds=\"$archive_cmds\"
3679              fi
3680            fi
3681    
3682            if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
3683               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3684              :
3685            else
3686              # The command line is too long to link in one step, link piecewise.
3687              $echo "creating reloadable object files..."
3688    
3689              # Save the value of $output and $libobjs because we want to
3690              # use them later.  If we have whole_archive_flag_spec, we
3691              # want to use save_libobjs as it was before
3692              # whole_archive_flag_spec was expanded, because we can't
3693              # assume the linker understands whole_archive_flag_spec.
3694              # This may have to be revisited, in case too many
3695              # convenience libraries get linked in and end up exceeding
3696              # the spec.
3697              if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3698                save_libobjs=$libobjs
3699              fi
3700              save_output=$output
3701    
3702              # Clear the reloadable object creation command queue and
3703              # initialize k to one.
3704              test_cmds=
3705              concat_cmds=
3706              objlist=
3707              delfiles=
3708              last_robj=
3709              k=1
3710              output=$output_objdir/$save_output-${k}.$objext
3711              # Loop over the list of objects to be linked.
3712              for obj in $save_libobjs
3713              do
3714                eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3715                if test "X$objlist" = X ||
3716                   { len=`expr "X$test_cmds" : ".*"` &&
3717                     test "$len" -le "$max_cmd_len"; }; then
3718                  objlist="$objlist $obj"
3719                else
3720                  # The command $test_cmds is almost too long, add a
3721                  # command to the queue.
3722                  if test "$k" -eq 1 ; then
3723                    # The first file doesn't have a previous command to add.
3724                    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3725                  else
3726                    # All subsequent reloadable object files will link in
3727                    # the last one created.
3728                    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3729                  fi
3730                  last_robj=$output_objdir/$save_output-${k}.$objext
3731                  k=`expr $k + 1`
3732                  output=$output_objdir/$save_output-${k}.$objext
3733                  objlist=$obj
3734                  len=1
3735                fi
3736              done
3737              # Handle the remaining objects by creating one last
3738              # reloadable object file.  All subsequent reloadable object
3739              # files will link in the last one created.
3740              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3741              eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3742    
3743              if ${skipped_export-false}; then
3744                $show "generating symbol list for \`$libname.la'"
3745                export_symbols="$output_objdir/$libname.exp"
3746                $run $rm $export_symbols
3747                libobjs=$output
3748                # Append the command to create the export file.
3749                eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3750              fi
3751    
3752              # Set up a command to remove the reloadale object files
3753              # after they are used.
3754              i=0
3755              while test "$i" -lt "$k"
3756              do
3757                i=`expr $i + 1`
3758                delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3759              done
3760    
3761              $echo "creating a temporary reloadable object file: $output"
3762    
3763              # Loop through the commands generated above and execute them.
3764              save_ifs="$IFS"; IFS='~'
3765              for cmd in $concat_cmds; do
3766                IFS="$save_ifs"
3767                $show "$cmd"
3768                $run eval "$cmd" || exit $?
3769              done
3770              IFS="$save_ifs"
3771    
3772              libobjs=$output
3773              # Restore the value of output.
3774              output=$save_output
3775    
3776              if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3777                eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3778              fi
3779              # Expand the library linking commands again to reset the
3780              # value of $libobjs for piecewise linking.
3781    
3782              # Do each of the archive commands.
3783              if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3784                eval cmds=\"$archive_expsym_cmds\"
3785              else
3786                eval cmds=\"$archive_cmds\"
3787              fi
3788    
3789              # Append the command to remove the reloadable object files
3790              # to the just-reset $cmds.
3791              eval cmds=\"\$cmds~$rm $delfiles\"
3792          fi          fi
3793          IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'          save_ifs="$IFS"; IFS='~'
3794          for cmd in $cmds; do          for cmd in $cmds; do
3795            IFS="$save_ifs"            IFS="$save_ifs"
3796            $show "$cmd"            $show "$cmd"
# Line 2950  EOF Line 3880  EOF
3880            gentop="$output_objdir/${obj}x"            gentop="$output_objdir/${obj}x"
3881            $show "${rm}r $gentop"            $show "${rm}r $gentop"
3882            $run ${rm}r "$gentop"            $run ${rm}r "$gentop"
3883            $show "mkdir $gentop"            $show "$mkdir $gentop"
3884            $run mkdir "$gentop"            $run $mkdir "$gentop"
3885            status=$?            status=$?
3886            if test $status -ne 0 && test ! -d "$gentop"; then            if test "$status" -ne 0 && test ! -d "$gentop"; then
3887              exit $status              exit $status
3888            fi            fi
3889            generated="$generated $gentop"            generated="$generated $gentop"
# Line 2969  EOF Line 3899  EOF
3899    
3900              $show "${rm}r $xdir"              $show "${rm}r $xdir"
3901              $run ${rm}r "$xdir"              $run ${rm}r "$xdir"
3902              $show "mkdir $xdir"              $show "$mkdir $xdir"
3903              $run mkdir "$xdir"              $run $mkdir "$xdir"
3904              status=$?              status=$?
3905              if test $status -ne 0 && test ! -d "$xdir"; then              if test "$status" -ne 0 && test ! -d "$xdir"; then
3906                exit $status                exit $status
3907              fi              fi
3908                # We will extract separately just the conflicting names and we will no
3909                # longer touch any unique names. It is faster to leave these extract
3910                # automatically by $AR in one run.
3911              $show "(cd $xdir && $AR x $xabs)"              $show "(cd $xdir && $AR x $xabs)"
3912              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3913                if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3914                  :
3915                else
3916                  $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3917                  $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3918                  $AR t "$xabs" | sort | uniq -cd | while read -r count name
3919                  do
3920                    i=1
3921                    while test "$i" -le "$count"
3922                    do
3923                     # Put our $i before any first dot (extension)
3924                     # Never overwrite any file
3925                     name_to="$name"
3926                     while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3927                     do
3928                       name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3929                     done
3930                     $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3931                     $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3932                     i=`expr $i + 1`
3933                    done
3934                  done
3935                fi
3936    
3937              reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`              reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3938            done            done
3939          fi          fi
3940        fi        fi
# Line 2988  EOF Line 3944  EOF
3944    
3945        output="$obj"        output="$obj"
3946        eval cmds=\"$reload_cmds\"        eval cmds=\"$reload_cmds\"
3947        IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'        save_ifs="$IFS"; IFS='~'
3948        for cmd in $cmds; do        for cmd in $cmds; do
3949          IFS="$save_ifs"          IFS="$save_ifs"
3950          $show "$cmd"          $show "$cmd"
# Line 3014  EOF Line 3970  EOF
3970    
3971          # Create an invalid libtool object if no PIC, so that we don't          # Create an invalid libtool object if no PIC, so that we don't
3972          # accidentally link it into a program.          # accidentally link it into a program.
3973          $show "echo timestamp > $libobj"          # $show "echo timestamp > $libobj"
3974          $run eval "echo timestamp > $libobj" || exit $?          # $run eval "echo timestamp > $libobj" || exit $?
3975          exit 0          exit 0
3976        fi        fi
3977    
# Line 3024  EOF Line 3980  EOF
3980          reload_objs="$libobjs $reload_conv_objs"          reload_objs="$libobjs $reload_conv_objs"
3981          output="$libobj"          output="$libobj"
3982          eval cmds=\"$reload_cmds\"          eval cmds=\"$reload_cmds\"
3983          IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'          save_ifs="$IFS"; IFS='~'
3984          for cmd in $cmds; do          for cmd in $cmds; do
3985            IFS="$save_ifs"            IFS="$save_ifs"
3986            $show "$cmd"            $show "$cmd"
3987            $run eval "$cmd" || exit $?            $run eval "$cmd" || exit $?
3988          done          done
3989          IFS="$save_ifs"          IFS="$save_ifs"
       else  
         # Just create a symlink.  
         $show $rm $libobj  
         $run $rm $libobj  
         xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`  
         if test "X$xdir" = "X$libobj"; then  
           xdir="."  
         else  
           xdir="$xdir"  
         fi  
         baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`  
         oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`  
         $show "(cd $xdir && $LN_S $oldobj $baseobj)"  
         $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?  
3990        fi        fi
3991    
3992        if test -n "$gentop"; then        if test -n "$gentop"; then
# Line 3057  EOF Line 3999  EOF
3999    
4000      prog)      prog)
4001        case $host in        case $host in
4002          *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;          *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4003        esac        esac
4004        if test -n "$vinfo"; then        if test -n "$vinfo"; then
4005          $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2          $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
# Line 3082  EOF Line 4024  EOF
4024          ;;          ;;
4025        esac        esac
4026    
4027          case $host in
4028          *darwin*)
4029            # Don't allow lazy linking, it breaks C++ global constructors
4030            if test "$tagname" = CXX ; then
4031            compile_command="$compile_command ${wl}-bind_at_load"
4032            finalize_command="$finalize_command ${wl}-bind_at_load"
4033            fi
4034            ;;
4035          esac
4036    
4037        compile_command="$compile_command $compile_deplibs"        compile_command="$compile_command $compile_deplibs"
4038        finalize_command="$finalize_command $finalize_deplibs"        finalize_command="$finalize_command $finalize_deplibs"
4039    
# Line 3232  extern \"C\" { Line 4184  extern \"C\" {
4184              done              done
4185    
4186              if test -n "$exclude_expsyms"; then              if test -n "$exclude_expsyms"; then
4187                $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'                $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4188                $run eval '$mv "$nlist"T "$nlist"'                $run eval '$mv "$nlist"T "$nlist"'
4189              fi              fi
4190    
4191              if test -n "$export_symbols_regex"; then              if test -n "$export_symbols_regex"; then
4192                $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'                $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4193                $run eval '$mv "$nlist"T "$nlist"'                $run eval '$mv "$nlist"T "$nlist"'
4194              fi              fi
4195    
# Line 3245  extern \"C\" { Line 4197  extern \"C\" {
4197              if test -z "$export_symbols"; then              if test -z "$export_symbols"; then
4198                export_symbols="$output_objdir/$output.exp"                export_symbols="$output_objdir/$output.exp"
4199                $run $rm $export_symbols                $run $rm $export_symbols
4200                $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'                $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4201              else              else
4202                $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'                $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4203                $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'                $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4204                $run eval 'mv "$nlist"T "$nlist"'                $run eval 'mv "$nlist"T "$nlist"'
4205              fi              fi
# Line 3255  extern \"C\" { Line 4207  extern \"C\" {
4207    
4208            for arg in $dlprefiles; do            for arg in $dlprefiles; do
4209              $show "extracting global C symbols from \`$arg'"              $show "extracting global C symbols from \`$arg'"
4210              name=`echo "$arg" | sed -e 's%^.*/%%'`              name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4211              $run eval 'echo ": $name " >> "$nlist"'              $run eval '$echo ": $name " >> "$nlist"'
4212              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4213            done            done
4214    
# Line 3265  extern \"C\" { Line 4217  extern \"C\" {
4217              test -f "$nlist" || : > "$nlist"              test -f "$nlist" || : > "$nlist"
4218    
4219              if test -n "$exclude_expsyms"; then              if test -n "$exclude_expsyms"; then
4220                egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T                $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4221                $mv "$nlist"T "$nlist"                $mv "$nlist"T "$nlist"
4222              fi              fi
4223    
4224              # Try sorting and uniquifying the output.              # Try sorting and uniquifying the output.
4225              if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then              if grep -v "^: " < "$nlist" |
4226                    if sort -k 3 </dev/null >/dev/null 2>&1; then
4227                      sort -k 3
4228                    else
4229                      sort +2
4230                    fi |
4231                    uniq > "$nlist"S; then
4232                :                :
4233              else              else
4234                grep -v "^: " < "$nlist" > "$nlist"S                grep -v "^: " < "$nlist" > "$nlist"S
# Line 3279  extern \"C\" { Line 4237  extern \"C\" {
4237              if test -f "$nlist"S; then              if test -f "$nlist"S; then
4238                eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'                eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4239              else              else
4240                echo '/* NONE */' >> "$output_objdir/$dlsyms"                $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4241              fi              fi
4242    
4243              $echo >> "$output_objdir/$dlsyms" "\              $echo >> "$output_objdir/$dlsyms" "\
# Line 3287  extern \"C\" { Line 4245  extern \"C\" {
4245  #undef lt_preloaded_symbols  #undef lt_preloaded_symbols
4246    
4247  #if defined (__STDC__) && __STDC__  #if defined (__STDC__) && __STDC__
4248  # define lt_ptr_t void *  # define lt_ptr void *
4249  #else  #else
4250  # define lt_ptr_t char *  # define lt_ptr char *
4251  # define const  # define const
4252  #endif  #endif
4253    
4254  /* The mapping between symbol names and symbols. */  /* The mapping between symbol names and symbols. */
4255  const struct {  const struct {
4256    const char *name;    const char *name;
4257    lt_ptr_t address;    lt_ptr address;
4258  }  }
4259  lt_preloaded_symbols[] =  lt_preloaded_symbols[] =
4260  {\  {\
4261  "  "
4262    
4263              sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \              eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
                 -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \  
                   < "$nlist" >> "$output_objdir/$dlsyms"  
4264    
4265              $echo >> "$output_objdir/$dlsyms" "\              $echo >> "$output_objdir/$dlsyms" "\
4266    {0, (lt_ptr_t) 0}    {0, (lt_ptr) 0}
4267  };  };
4268    
4269  /* This works around a problem in FreeBSD linker */  /* This works around a problem in FreeBSD linker */
# Line 3333  static const void *lt_preloaded_setup() Line 4289  static const void *lt_preloaded_setup()
4289            *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)            *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4290              case "$compile_command " in              case "$compile_command " in
4291              *" -static "*) ;;              *" -static "*) ;;
4292              *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;              *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4293              esac;;              esac;;
4294            *-*-hpux*)            *-*-hpux*)
4295              case "$compile_command " in              case "$compile_command " in
4296              *" -static "*) ;;              *" -static "*) ;;
4297              *) pic_flag_for_symtable=" $pic_flag -DPIC";;              *) pic_flag_for_symtable=" $pic_flag";;
4298              esac              esac
4299            esac            esac
4300    
4301            # Now compile the dynamic symbol file.            # Now compile the dynamic symbol file.
4302            $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"            $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4303            $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?            $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4304    
4305            # Clean up the generated files.            # Clean up the generated files.
4306            $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"            $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
# Line 3369  static const void *lt_preloaded_setup() Line 4325  static const void *lt_preloaded_setup()
4325          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4326        fi        fi
4327    
4328        if test $need_relink = no || test "$build_libtool_libs" != yes; then        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4329          # Replace the output file specification.          # Replace the output file specification.
4330          compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`          compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4331          link_command="$compile_command$compile_rpath"          link_command="$compile_command$compile_rpath"
# Line 3494  static const void *lt_preloaded_setup() Line 4450  static const void *lt_preloaded_setup()
4450              relink_command="$var=\"$var_value\"; export $var; $relink_command"              relink_command="$var=\"$var_value\"; export $var; $relink_command"
4451            fi            fi
4452          done          done
4453          relink_command="cd `pwd`; $relink_command"          relink_command="(cd `pwd`; $relink_command)"
4454          relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`          relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4455        fi        fi
4456    
# Line 3514  static const void *lt_preloaded_setup() Line 4470  static const void *lt_preloaded_setup()
4470          # win32 will think the script is a binary if it has          # win32 will think the script is a binary if it has
4471          # a .exe suffix, so we strip it off here.          # a .exe suffix, so we strip it off here.
4472          case $output in          case $output in
4473            *.exe) output=`echo $output|sed 's,.exe$,,'` ;;            *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4474          esac          esac
4475          # test for cygwin because mv fails w/o .exe extensions          # test for cygwin because mv fails w/o .exe extensions
4476          case $host in          case $host in
4477            *cygwin*) exeext=.exe ;;            *cygwin*)
4478                exeext=.exe
4479                outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4480            *) exeext= ;;            *) exeext= ;;
4481          esac          esac
4482            case $host in
4483              *cygwin* | *mingw* )
4484                cwrappersource=`$echo ${objdir}/lt-${output}.c`
4485                cwrapper=`$echo ${output}.exe`
4486                $rm $cwrappersource $cwrapper
4487                trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4488    
4489                cat > $cwrappersource <<EOF
4490    
4491    /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4492       Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4493    
4494       The $output program cannot be directly executed until all the libtool
4495       libraries that it depends on are installed.
4496      
4497       This wrapper executable should never be moved out of the build directory.
4498       If it is, it will not operate correctly.
4499    
4500       Currently, it simply execs the wrapper *script* "/bin/sh $output",
4501       but could eventually absorb all of the scripts functionality and
4502       exec $objdir/$outputname directly.
4503    */
4504    EOF
4505                cat >> $cwrappersource<<"EOF"
4506    #include <stdio.h>
4507    #include <stdlib.h>
4508    #include <unistd.h>
4509    #include <malloc.h>
4510    #include <stdarg.h>
4511    #include <assert.h>
4512    
4513    #if defined(PATH_MAX)
4514    # define LT_PATHMAX PATH_MAX
4515    #elif defined(MAXPATHLEN)
4516    # define LT_PATHMAX MAXPATHLEN
4517    #else
4518    # define LT_PATHMAX 1024
4519    #endif
4520    
4521    #ifndef DIR_SEPARATOR
4522    #define DIR_SEPARATOR '/'
4523    #endif
4524    
4525    #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4526      defined (__OS2__)
4527    #define HAVE_DOS_BASED_FILE_SYSTEM
4528    #ifndef DIR_SEPARATOR_2
4529    #define DIR_SEPARATOR_2 '\\'
4530    #endif
4531    #endif
4532    
4533    #ifndef DIR_SEPARATOR_2
4534    # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4535    #else /* DIR_SEPARATOR_2 */
4536    # define IS_DIR_SEPARATOR(ch) \
4537            (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4538    #endif /* DIR_SEPARATOR_2 */
4539    
4540    #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4541    #define XFREE(stale) do { \
4542      if (stale) { free ((void *) stale); stale = 0; } \
4543    } while (0)
4544    
4545    const char *program_name = NULL;
4546    
4547    void * xmalloc (size_t num);
4548    char * xstrdup (const char *string);
4549    char * basename (const char *name);
4550    char * fnqualify(const char *path);
4551    char * strendzap(char *str, const char *pat);
4552    void lt_fatal (const char *message, ...);
4553    
4554    int
4555    main (int argc, char *argv[])
4556    {
4557      char **newargz;
4558      int i;
4559      
4560      program_name = (char *) xstrdup ((char *) basename (argv[0]));
4561      newargz = XMALLOC(char *, argc+2);
4562    EOF
4563    
4564                cat >> $cwrappersource <<EOF
4565      newargz[0] = "$SHELL";
4566    EOF
4567    
4568                cat >> $cwrappersource <<"EOF"
4569      newargz[1] = fnqualify(argv[0]);
4570      /* we know the script has the same name, without the .exe */
4571      /* so make sure newargz[1] doesn't end in .exe */
4572      strendzap(newargz[1],".exe");
4573      for (i = 1; i < argc; i++)
4574        newargz[i+1] = xstrdup(argv[i]);
4575      newargz[argc+1] = NULL;
4576    EOF
4577    
4578                cat >> $cwrappersource <<EOF
4579      execv("$SHELL",newargz);
4580    EOF
4581    
4582                cat >> $cwrappersource <<"EOF"
4583    }
4584    
4585    void *
4586    xmalloc (size_t num)
4587    {
4588      void * p = (void *) malloc (num);
4589      if (!p)
4590        lt_fatal ("Memory exhausted");
4591    
4592      return p;
4593    }
4594    
4595    char *
4596    xstrdup (const char *string)
4597    {
4598      return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4599    ;
4600    }
4601    
4602    char *
4603    basename (const char *name)
4604    {
4605      const char *base;
4606    
4607    #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4608      /* Skip over the disk name in MSDOS pathnames. */
4609      if (isalpha (name[0]) && name[1] == ':')
4610        name += 2;
4611    #endif
4612    
4613      for (base = name; *name; name++)
4614        if (IS_DIR_SEPARATOR (*name))
4615          base = name + 1;
4616      return (char *) base;
4617    }
4618    
4619    char *
4620    fnqualify(const char *path)
4621    {
4622      size_t size;
4623      char *p;
4624      char tmp[LT_PATHMAX + 1];
4625    
4626      assert(path != NULL);
4627    
4628      /* Is it qualified already? */
4629    #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4630      if (isalpha (path[0]) && path[1] == ':')
4631        return xstrdup (path);
4632    #endif
4633      if (IS_DIR_SEPARATOR (path[0]))
4634        return xstrdup (path);
4635    
4636      /* prepend the current directory */
4637      /* doesn't handle '~' */
4638      if (getcwd (tmp, LT_PATHMAX) == NULL)
4639        lt_fatal ("getcwd failed");
4640      size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4641      p = XMALLOC(char, size);
4642      sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4643      return p;
4644    }
4645    
4646    char *
4647    strendzap(char *str, const char *pat)
4648    {
4649      size_t len, patlen;
4650    
4651      assert(str != NULL);
4652      assert(pat != NULL);
4653    
4654      len = strlen(str);
4655      patlen = strlen(pat);
4656    
4657      if (patlen <= len)
4658      {
4659        str += len - patlen;
4660        if (strcmp(str, pat) == 0)
4661          *str = '\0';
4662      }
4663      return str;
4664    }
4665    
4666    static void
4667    lt_error_core (int exit_status, const char * mode,
4668              const char * message, va_list ap)
4669    {
4670      fprintf (stderr, "%s: %s: ", program_name, mode);
4671      vfprintf (stderr, message, ap);
4672      fprintf (stderr, ".\n");
4673    
4674      if (exit_status >= 0)
4675        exit (exit_status);
4676    }
4677    
4678    void
4679    lt_fatal (const char *message, ...)
4680    {
4681      va_list ap;
4682      va_start (ap, message);
4683      lt_erro