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

Diff of /code/trunk/ltmain.sh

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

revision 41 by nigel, Sat Feb 24 21:39:17 2007 UTC revision 53 by nigel, Sat Feb 24 21:39:42 2007 UTC
# Line 1  Line 1 
1  # ltmain.sh - Provide generalized library-building support services.  # ltmain.sh - Provide generalized library-building support services.
2  # NOTE: Changing this file will not affect anything until you rerun ltconfig.  # NOTE: Changing this file will not affect anything until you rerun configure.
3  #  #
4  # Copyright (C) 1996-1999 Free Software Foundation, Inc.  # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5    # Free Software Foundation, Inc.
6  # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996  # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7  #  #
8  # This program is free software; you can redistribute it and/or modify  # This program is free software; you can redistribute it and/or modify
# Line 54  modename="$progname" Line 55  modename="$progname"
55  # Constants.  # Constants.
56  PROGRAM=ltmain.sh  PROGRAM=ltmain.sh
57  PACKAGE=libtool  PACKAGE=libtool
58  VERSION=1.3.4  VERSION=1.4
59  TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"  TIMESTAMP=" (1.920 2001/04/24 23:26:18)"
60    
61  default_mode=  default_mode=
62  help="Try \`$progname --help' for more information."  help="Try \`$progname --help' for more information."
# Line 83  if test "${LANG+set}" = set; then Line 84  if test "${LANG+set}" = set; then
84    save_LANG="$LANG"; LANG=C; export LANG    save_LANG="$LANG"; LANG=C; export LANG
85  fi  fi
86    
 if test "$LTCONFIG_VERSION" != "$VERSION"; then  
   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2  
   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2  
   exit 1  
 fi  
   
87  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
88    echo "$modename: not configured to build any kind of library" 1>&2    echo "$modename: not configured to build any kind of library" 1>&2
89    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
# Line 113  do Line 108  do
108    arg="$1"    arg="$1"
109    shift    shift
110    
111    case "$arg" in    case $arg in
112    -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;    -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
113    *) optarg= ;;    *) optarg= ;;
114    esac    esac
115    
116    # If the previous option needs an argument, assign it.    # If the previous option needs an argument, assign it.
117    if test -n "$prev"; then    if test -n "$prev"; then
118      case "$prev" in      case $prev in
119      execute_dlfiles)      execute_dlfiles)
120        eval "$prev=\"\$$prev \$arg\""        execute_dlfiles="$execute_dlfiles $arg"
121        ;;        ;;
122      *)      *)
123        eval "$prev=\$arg"        eval "$prev=\$arg"
# Line 135  do Line 130  do
130    fi    fi
131    
132    # Have we seen a non-optional argument yet?    # Have we seen a non-optional argument yet?
133    case "$arg" in    case $arg in
134    --help)    --help)
135      show_help=yes      show_help=yes
136      ;;      ;;
# Line 146  do Line 141  do
141      ;;      ;;
142    
143    --config)    --config)
144      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
145      exit 0      exit 0
146      ;;      ;;
147    
# Line 211  if test -z "$show_help"; then Line 206  if test -z "$show_help"; then
206    
207    # Infer the operation mode.    # Infer the operation mode.
208    if test -z "$mode"; then    if test -z "$mode"; then
209      case "$nonopt" in      case $nonopt in
210      *cc | *++ | gcc* | *-gcc*)      *cc | *++ | gcc* | *-gcc*)
211        mode=link        mode=link
212        for arg        for arg
213        do        do
214          case "$arg" in          case $arg in
215          -c)          -c)
216             mode=compile             mode=compile
217             break             break
# Line 261  if test -z "$show_help"; then Line 256  if test -z "$show_help"; then
256    help="Try \`$modename --help --mode=$mode' for more information."    help="Try \`$modename --help --mode=$mode' for more information."
257    
258    # These modes are in order of execution frequency so that they run quickly.    # These modes are in order of execution frequency so that they run quickly.
259    case "$mode" in    case $mode in
260    # libtool compile mode    # libtool compile mode
261    compile)    compile)
262      modename="$modename: compile"      modename="$modename: compile"
263      # Get the compilation command and the source file.      # Get the compilation command and the source file.
264      base_compile=      base_compile=
265        prev=
266      lastarg=      lastarg=
267      srcfile="$nonopt"      srcfile="$nonopt"
268      suppress_output=      suppress_output=
# Line 274  if test -z "$show_help"; then Line 270  if test -z "$show_help"; then
270      user_target=no      user_target=no
271      for arg      for arg
272      do      do
273          case $prev in
274          "") ;;
275          xcompiler)
276            # Aesthetically quote the previous argument.
277            prev=
278            lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
279    
280            case $arg in
281            # Double-quote args containing other shell metacharacters.
282            # Many Bourne shells cannot handle close brackets correctly
283            # in scan sets, so we specify it separately.
284            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
285              arg="\"$arg\""
286              ;;
287            esac
288    
289            # Add the previous argument to base_compile.
290            if test -z "$base_compile"; then
291              base_compile="$lastarg"
292            else
293              base_compile="$base_compile $lastarg"
294            fi
295            continue
296            ;;
297          esac
298    
299        # Accept any command-line options.        # Accept any command-line options.
300        case "$arg" in        case $arg in
301        -o)        -o)
302          if test "$user_target" != "no"; then          if test "$user_target" != "no"; then
303            $echo "$modename: you cannot specify \`-o' more than once" 1>&2            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
# Line 288  if test -z "$show_help"; then Line 310  if test -z "$show_help"; then
310          build_old_libs=yes          build_old_libs=yes
311          continue          continue
312          ;;          ;;
313    
314          -prefer-pic)
315            pic_mode=yes
316            continue
317            ;;
318    
319          -prefer-non-pic)
320            pic_mode=no
321            continue
322            ;;
323    
324          -Xcompiler)
325            prev=xcompiler
326            continue
327            ;;
328    
329          -Wc,*)
330            args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
331            lastarg=
332            IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
333            for arg in $args; do
334              IFS="$save_ifs"
335    
336              # Double-quote args containing other shell metacharacters.
337              # Many Bourne shells cannot handle close brackets correctly
338              # in scan sets, so we specify it separately.
339              case $arg in
340                *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
341                arg="\"$arg\""
342                ;;
343              esac
344              lastarg="$lastarg $arg"
345            done
346            IFS="$save_ifs"
347            lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
348    
349            # Add the arguments to base_compile.
350            if test -z "$base_compile"; then
351              base_compile="$lastarg"
352            else
353              base_compile="$base_compile $lastarg"
354            fi
355            continue
356            ;;
357        esac        esac
358    
359        case "$user_target" in        case $user_target in
360        next)        next)
361          # The next one is the -o target name          # The next one is the -o target name
362          user_target=yes          user_target=yes
# Line 316  if test -z "$show_help"; then Line 382  if test -z "$show_help"; then
382        lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`        lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
383    
384        # Double-quote args containing other shell metacharacters.        # Double-quote args containing other shell metacharacters.
385        # Many Bourne shells cannot handle close brackets correctly in scan        # Many Bourne shells cannot handle close brackets correctly
386        # sets, so we specify it separately.        # in scan sets, so we specify it separately.
387        case "$lastarg" in        case $lastarg in
388        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
389          lastarg="\"$lastarg\""          lastarg="\"$lastarg\""
390          ;;          ;;
391        esac        esac
# Line 332  if test -z "$show_help"; then Line 398  if test -z "$show_help"; then
398        fi        fi
399      done      done
400    
401      case "$user_target" in      case $user_target in
402      set)      set)
403        ;;        ;;
404      no)      no)
# Line 348  if test -z "$show_help"; then Line 414  if test -z "$show_help"; then
414      # Recognize several different file suffixes.      # Recognize several different file suffixes.
415      # 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
416      xform='[cCFSfmso]'      xform='[cCFSfmso]'
417      case "$libobj" in      case $libobj in
418      *.ada) xform=ada ;;      *.ada) xform=ada ;;
419      *.adb) xform=adb ;;      *.adb) xform=adb ;;
420      *.ads) xform=ads ;;      *.ads) xform=ads ;;
# Line 363  if test -z "$show_help"; then Line 429  if test -z "$show_help"; then
429    
430      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`      libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
431    
432      case "$libobj" in      case $libobj in
433      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;      *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
434      *)      *)
435        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2        $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
# Line 387  if test -z "$show_help"; then Line 453  if test -z "$show_help"; then
453      $run $rm $removelist      $run $rm $removelist
454      trap "$run $rm $removelist; exit 1" 1 2 15      trap "$run $rm $removelist; exit 1" 1 2 15
455    
456        # On Cygwin there's no "real" PIC flag so we must build both object types
457        case $host_os in
458        cygwin* | mingw* | pw32* | os2*)
459          pic_mode=default
460          ;;
461        esac
462        if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
463          # non-PIC code in shared libraries is not supported
464          pic_mode=default
465        fi
466    
467      # Calculate the filename of the output object if compiler does      # Calculate the filename of the output object if compiler does
468      # not support -o with -c      # not support -o with -c
469      if test "$compiler_c_o" = no; then      if test "$compiler_c_o" = no; then
470        output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}        output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
471        lockfile="$output_obj.lock"        lockfile="$output_obj.lock"
472        removelist="$removelist $output_obj $lockfile"        removelist="$removelist $output_obj $lockfile"
473        trap "$run $rm $removelist; exit 1" 1 2 15        trap "$run $rm $removelist; exit 1" 1 2 15
# Line 402  if test -z "$show_help"; then Line 479  if test -z "$show_help"; then
479      # Lock this critical section if it is needed      # Lock this critical section if it is needed
480      # We use this script file to make the link, it avoids creating a new file      # We use this script file to make the link, it avoids creating a new file
481      if test "$need_locks" = yes; then      if test "$need_locks" = yes; then
482        until ln "$0" "$lockfile" 2>/dev/null; do        until $run ln "$0" "$lockfile" 2>/dev/null; do
483          $show "Waiting for $lockfile to be removed"          $show "Waiting for $lockfile to be removed"
484          sleep 2          sleep 2
485        done        done
# Line 434  compiler." Line 511  compiler."
511        # Without this assignment, base_compile gets emptied.        # Without this assignment, base_compile gets emptied.
512        fbsd_hideous_sh_bug=$base_compile        fbsd_hideous_sh_bug=$base_compile
513    
514        # All platforms use -DPIC, to notify preprocessed assembler code.        if test "$pic_mode" != no; then
515        command="$base_compile $srcfile $pic_flag -DPIC"          # All platforms use -DPIC, to notify preprocessed assembler code.
516            command="$base_compile $srcfile $pic_flag -DPIC"
517          else
518            # Don't build PIC code
519            command="$base_compile $srcfile"
520          fi
521        if test "$build_old_libs" = yes; then        if test "$build_old_libs" = yes; then
522          lo_libobj="$libobj"          lo_libobj="$libobj"
523          dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`          dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
# Line 506  compiler." Line 588  compiler."
588        fi        fi
589    
590        # If we have no pic_flag, then copy the object into place and finish.        # If we have no pic_flag, then copy the object into place and finish.
591        if test -z "$pic_flag" && test "$build_old_libs" = yes; then        if (test -z "$pic_flag" || test "$pic_mode" != default) &&
592             test "$build_old_libs" = yes; then
593          # Rename the .lo from within objdir to obj          # Rename the .lo from within objdir to obj
594          if test -f $obj; then          if test -f $obj; then
595            $show $rm $obj            $show $rm $obj
# Line 546  compiler." Line 629  compiler."
629    
630      # Only build a position-dependent object if we build old libraries.      # Only build a position-dependent object if we build old libraries.
631      if test "$build_old_libs" = yes; then      if test "$build_old_libs" = yes; then
632        command="$base_compile $srcfile"        if test "$pic_mode" != yes; then
633            # Don't build PIC code
634            command="$base_compile $srcfile"
635          else
636            # All platforms use -DPIC, to notify preprocessed assembler code.
637            command="$base_compile $srcfile $pic_flag -DPIC"
638          fi
639        if test "$compiler_c_o" = yes; then        if test "$compiler_c_o" = yes; then
640          command="$command -o $obj"          command="$command -o $obj"
641          output_obj="$obj"          output_obj="$obj"
# Line 612  compiler." Line 701  compiler."
701    
702      # Unlock the critical section if it was locked      # Unlock the critical section if it was locked
703      if test "$need_locks" != no; then      if test "$need_locks" != no; then
704        $rm "$lockfile"        $run $rm "$lockfile"
705      fi      fi
706    
707      exit 0      exit 0
708      ;;      ;;
709    
710    # libtool link mode    # libtool link mode
711    link)    link | relink)
712      modename="$modename: link"      modename="$modename: link"
713      case "$host" in      case $host in
714      *-*-cygwin* | *-*-mingw* | *-*-os2*)      *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
715        # It is impossible to link a dll without this setting, and        # It is impossible to link a dll without this setting, and
716        # we shouldn't force the makefile maintainer to figure out        # we shouldn't force the makefile maintainer to figure out
717        # which system we are compiling for in order to pass an extra        # which system we are compiling for in order to pass an extra
# Line 635  compiler." Line 724  compiler."
724        # -no-undefined on the libtool link line when we can be certain        # -no-undefined on the libtool link line when we can be certain
725        # that all symbols are satisfied, otherwise we get a static library.        # that all symbols are satisfied, otherwise we get a static library.
726        allow_undefined=yes        allow_undefined=yes
   
       # This is a source program that is used to create dlls on Windows  
       # Don't remove nor modify the starting and closing comments  
 # /* ltdll.c starts here */  
 # #define WIN32_LEAN_AND_MEAN  
 # #include <windows.h>  
 # #undef WIN32_LEAN_AND_MEAN  
 # #include <stdio.h>  
 #  
 # #ifndef __CYGWIN__  
 # #  ifdef __CYGWIN32__  
 # #    define __CYGWIN__ __CYGWIN32__  
 # #  endif  
 # #endif  
 #  
 # #ifdef __cplusplus  
 # extern "C" {  
 # #endif  
 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);  
 # #ifdef __cplusplus  
 # }  
 # #endif  
 #  
 # #ifdef __CYGWIN__  
 # #include <cygwin/cygwin_dll.h>  
 # DECLARE_CYGWIN_DLL( DllMain );  
 # #endif  
 # HINSTANCE __hDllInstance_base;  
 #  
 # BOOL APIENTRY  
 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)  
 # {  
 #   __hDllInstance_base = hInst;  
 #   return TRUE;  
 # }  
 # /* ltdll.c ends here */  
       # This is a source program that is used to create import libraries  
       # on Windows for dlls which lack them. Don't remove nor modify the  
       # starting and closing comments  
 # /* impgen.c starts here */  
 # /*   Copyright (C) 1999 Free Software Foundation, Inc.  
 #  
 #  This file is part of GNU libtool.  
 #  
 #  This program is free software; you can redistribute it and/or modify  
 #  it under the terms of the GNU General Public License as published by  
 #  the Free Software Foundation; either version 2 of the License, or  
 #  (at your option) any later version.  
 #  
 #  This program is distributed in the hope that it will be useful,  
 #  but WITHOUT ANY WARRANTY; without even the implied warranty of  
 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 #  GNU General Public License for more details.  
 #  
 #  You should have received a copy of the GNU General Public License  
 #  along with this program; if not, write to the Free Software  
 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 #  */  
 #  
 #  #include <stdio.h>           /* for printf() */  
 #  #include <unistd.h>          /* for open(), lseek(), read() */  
 #  #include <fcntl.h>           /* for O_RDONLY, O_BINARY */  
 #  #include <string.h>          /* for strdup() */  
 #  
 #  static unsigned int  
 #  pe_get16 (fd, offset)  
 #       int fd;  
 #       int offset;  
 #  {  
 #    unsigned char b[2];  
 #    lseek (fd, offset, SEEK_SET);  
 #    read (fd, b, 2);  
 #    return b[0] + (b[1]<<8);  
 #  }  
 #  
 #  static unsigned int  
 #  pe_get32 (fd, offset)  
 #      int fd;  
 #      int offset;  
 #  {  
 #    unsigned char b[4];  
 #    lseek (fd, offset, SEEK_SET);  
 #    read (fd, b, 4);  
 #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);  
 #  }  
 #  
 #  static unsigned int  
 #  pe_as32 (ptr)  
 #       void *ptr;  
 #  {  
 #    unsigned char *b = ptr;  
 #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);  
 #  }  
 #  
 #  int  
 #  main (argc, argv)  
 #      int argc;  
 #      char *argv[];  
 #  {  
 #      int dll;  
 #      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;  
 #      unsigned long export_rva, export_size, nsections, secptr, expptr;  
 #      unsigned long name_rvas, nexp;  
 #      unsigned char *expdata, *erva;  
 #      char *filename, *dll_name;  
 #  
 #      filename = argv[1];  
 #  
 #      dll = open(filename, O_RDONLY|O_BINARY);  
 #      if (!dll)  
 #       return 1;  
 #  
 #      dll_name = filename;  
 #  
 #      for (i=0; filename[i]; i++)  
 #       if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')  
 #           dll_name = filename + i +1;  
 #  
 #      pe_header_offset = pe_get32 (dll, 0x3c);  
 #      opthdr_ofs = pe_header_offset + 4 + 20;  
 #      num_entries = pe_get32 (dll, opthdr_ofs + 92);  
 #  
 #      if (num_entries < 1) /* no exports */  
 #       return 1;  
 #  
 #      export_rva = pe_get32 (dll, opthdr_ofs + 96);  
 #      export_size = pe_get32 (dll, opthdr_ofs + 100);  
 #      nsections = pe_get16 (dll, pe_header_offset + 4 +2);  
 #      secptr = (pe_header_offset + 4 + 20 +  
 #             pe_get16 (dll, pe_header_offset + 4 + 16));  
 #  
 #      expptr = 0;  
 #      for (i = 0; i < nsections; i++)  
 #      {  
 #       char sname[8];  
 #       unsigned long secptr1 = secptr + 40 * i;  
 #       unsigned long vaddr = pe_get32 (dll, secptr1 + 12);  
 #       unsigned long vsize = pe_get32 (dll, secptr1 + 16);  
 #       unsigned long fptr = pe_get32 (dll, secptr1 + 20);  
 #       lseek(dll, secptr1, SEEK_SET);  
 #       read(dll, sname, 8);  
 #       if (vaddr <= export_rva && vaddr+vsize > export_rva)  
 #       {  
 #           expptr = fptr + (export_rva - vaddr);  
 #           if (export_rva + export_size > vaddr + vsize)  
 #               export_size = vsize - (export_rva - vaddr);  
 #           break;  
 #       }  
 #      }  
 #  
 #      expdata = (unsigned char*)malloc(export_size);  
 #      lseek (dll, expptr, SEEK_SET);  
 #      read (dll, expdata, export_size);  
 #      erva = expdata - export_rva;  
 #  
 #      nexp = pe_as32 (expdata+24);  
 #      name_rvas = pe_as32 (expdata+32);  
 #  
 #      printf ("EXPORTS\n");  
 #      for (i = 0; i<nexp; i++)  
 #      {  
 #       unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);  
 #       printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);  
 #      }  
 #  
 #      return 0;  
 #  }  
 # /* impgen.c ends here */  
727        ;;        ;;
728      *)      *)
729        allow_undefined=yes        allow_undefined=yes
730        ;;        ;;
731      esac      esac
732        libtool_args="$nonopt"
733      compile_command="$nonopt"      compile_command="$nonopt"
734      finalize_command="$nonopt"      finalize_command="$nonopt"
735    
# Line 818  compiler." Line 740  compiler."
740      convenience=      convenience=
741      old_convenience=      old_convenience=
742      deplibs=      deplibs=
743      linkopts=      old_deplibs=
744        compiler_flags=
745        linker_flags=
746        dllsearchpath=
747        lib_search_path=`pwd`
748    
     if test -n "$shlibpath_var"; then  
       # get the directories listed in $shlibpath_var  
       eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`  
     else  
       lib_search_path=  
     fi  
     # now prepend the system-specific ones  
     eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"  
     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"  
   
749      avoid_version=no      avoid_version=no
750      dlfiles=      dlfiles=
751      dlprefiles=      dlprefiles=
# Line 839  compiler." Line 755  compiler."
755      export_symbols_regex=      export_symbols_regex=
756      generated=      generated=
757      libobjs=      libobjs=
     link_against_libtool_libs=  
758      ltlibs=      ltlibs=
759      module=no      module=no
760        no_install=no
761      objs=      objs=
762      prefer_static_libs=no      prefer_static_libs=no
763      preload=no      preload=no
# Line 858  compiler." Line 774  compiler."
774      # We need to know -static, to get the right output filenames.      # We need to know -static, to get the right output filenames.
775      for arg      for arg
776      do      do
777        case "$arg" in        case $arg in
778        -all-static | -static)        -all-static | -static)
779          if test "X$arg" = "X-all-static"; then          if test "X$arg" = "X-all-static"; then
780            if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then            if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
# Line 887  compiler." Line 803  compiler."
803      while test $# -gt 0; do      while test $# -gt 0; do
804        arg="$1"        arg="$1"
805        shift        shift
806          case $arg in
807          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
808            qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
809            ;;
810          *) qarg=$arg ;;
811          esac
812          libtool_args="$libtool_args $qarg"
813    
814        # If the previous option needs an argument, assign it.        # If the previous option needs an argument, assign it.
815        if test -n "$prev"; then        if test -n "$prev"; then
816          case "$prev" in          case $prev in
817          output)          output)
818            compile_command="$compile_command @OUTPUT@"            compile_command="$compile_command @OUTPUT@"
819            finalize_command="$finalize_command @OUTPUT@"            finalize_command="$finalize_command @OUTPUT@"
820            ;;            ;;
821          esac          esac
822    
823          case "$prev" in          case $prev in
824          dlfiles|dlprefiles)          dlfiles|dlprefiles)
825            if test "$preload" = no; then            if test "$preload" = no; then
826              # Add the symbol object into the linking commands.              # Add the symbol object into the linking commands.
# Line 905  compiler." Line 828  compiler."
828              finalize_command="$finalize_command @SYMFILE@"              finalize_command="$finalize_command @SYMFILE@"
829              preload=yes              preload=yes
830            fi            fi
831            case "$arg" in            case $arg in
832            *.la | *.lo) ;;  # We handle these cases below.            *.la | *.lo) ;;  # We handle these cases below.
833            force)            force)
834              if test "$dlself" = no; then              if test "$dlself" = no; then
# Line 934  compiler." Line 857  compiler."
857                dlprefiles="$dlprefiles $arg"                dlprefiles="$dlprefiles $arg"
858              fi              fi
859              prev=              prev=
860                continue
861              ;;              ;;
862            esac            esac
863            ;;            ;;
# Line 958  compiler." Line 882  compiler."
882            ;;            ;;
883          rpath | xrpath)          rpath | xrpath)
884            # We need an absolute path.            # We need an absolute path.
885            case "$arg" in            case $arg in
886            [\\/]* | [A-Za-z]:[\\/]*) ;;            [\\/]* | [A-Za-z]:[\\/]*) ;;
887            *)            *)
888              $echo "$modename: only absolute run-paths are allowed" 1>&2              $echo "$modename: only absolute run-paths are allowed" 1>&2
# Line 979  compiler." Line 903  compiler."
903            prev=            prev=
904            continue            continue
905            ;;            ;;
906            xcompiler)
907              compiler_flags="$compiler_flags $qarg"
908              prev=
909              compile_command="$compile_command $qarg"
910              finalize_command="$finalize_command $qarg"
911              continue
912              ;;
913            xlinker)
914              linker_flags="$linker_flags $qarg"
915              compiler_flags="$compiler_flags $wl$qarg"
916              prev=
917              compile_command="$compile_command $wl$qarg"
918              finalize_command="$finalize_command $wl$qarg"
919              continue
920              ;;
921          *)          *)
922            eval "$prev=\"\$arg\""            eval "$prev=\"\$arg\""
923            prev=            prev=
924            continue            continue
925            ;;            ;;
926          esac          esac
927        fi        fi # test -n $prev
928    
929        prevarg="$arg"        prevarg="$arg"
930    
931        case "$arg" in        case $arg in
932        -all-static)        -all-static)
933          if test -n "$link_static_flag"; then          if test -n "$link_static_flag"; then
934            compile_command="$compile_command $link_static_flag"            compile_command="$compile_command $link_static_flag"
# Line 1026  compiler." Line 965  compiler."
965    
966        -export-symbols | -export-symbols-regex)        -export-symbols | -export-symbols-regex)
967          if test -n "$export_symbols" || test -n "$export_symbols_regex"; then          if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
968            $echo "$modename: not more than one -exported-symbols argument allowed"            $echo "$modename: more than one -exported-symbols argument is not allowed"
969            exit 1            exit 1
970          fi          fi
971          if test "X$arg" = "X-export-symbols"; then          if test "X$arg" = "X-export-symbols"; then
# Line 1037  compiler." Line 976  compiler."
976          continue          continue
977          ;;          ;;
978    
979          # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
980          # so, if we see these flags be careful not to treat them like -L
981          -L[A-Z][A-Z]*:*)
982            case $with_gcc/$host in
983            no/*-*-irix*)
984              compile_command="$compile_command $arg"
985              finalize_command="$finalize_command $arg"
986              ;;
987            esac
988            continue
989            ;;
990    
991        -L*)        -L*)
992          dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`          dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
993          # We need an absolute path.          # We need an absolute path.
994          case "$dir" in          case $dir in
995          [\\/]* | [A-Za-z]:[\\/]*) ;;          [\\/]* | [A-Za-z]:[\\/]*) ;;
996          *)          *)
997            absdir=`cd "$dir" && pwd`            absdir=`cd "$dir" && pwd`
998            if test -z "$absdir"; then            if test -z "$absdir"; then
999              $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2              $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1000              $echo "$modename: passing it literally to the linker, although it might fail" 1>&2              exit 1
             absdir="$dir"  
1001            fi            fi
1002            dir="$absdir"            dir="$absdir"
1003            ;;            ;;
1004          esac          esac
1005          case " $deplibs " in          case "$deplibs " in
1006          *" $arg "*) ;;          *" -L$dir "*) ;;
1007          *) deplibs="$deplibs $arg";;          *)
1008          esac            deplibs="$deplibs -L$dir"
1009          case " $lib_search_path " in            lib_search_path="$lib_search_path $dir"
1010          *" $dir "*) ;;            ;;
         *) lib_search_path="$lib_search_path $dir";;  
1011          esac          esac
1012          case "$host" in          case $host in
1013          *-*-cygwin* | *-*-mingw* | *-*-os2*)          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1014            dllsearchdir=`cd "$dir" && pwd || echo "$dir"`            case :$dllsearchpath: in
1015            case ":$dllsearchpath:" in            *":$dir:"*) ;;
1016            ::) dllsearchpath="$dllsearchdir";;            *) dllsearchpath="$dllsearchpath:$dir";;
           *":$dllsearchdir:"*) ;;  
           *) dllsearchpath="$dllsearchpath:$dllsearchdir";;  
1017            esac            esac
1018            ;;            ;;
1019          esac          esac
1020            continue
1021          ;;          ;;
1022    
1023        -l*)        -l*)
1024          if test "$arg" = "-lc"; then          if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1025            case "$host" in            case $host in
1026            *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)            *-*-cygwin* | *-*-pw32* | *-*-beos*)
1027              # These systems don't actually have c library (as such)              # These systems don't actually have a C or math library (as such)
1028              continue              continue
1029              ;;              ;;
1030            esac            *-*-mingw* | *-*-os2*)
1031          elif test "$arg" = "-lm"; then              # These systems don't actually have a C library (as such)
1032            case "$host" in              test "X$arg" = "X-lc" && continue
           *-*-cygwin* | *-*-beos*)  
             # These systems don't actually have math library (as such)  
             continue  
1033              ;;              ;;
1034            esac            esac
1035          fi          fi
1036          deplibs="$deplibs $arg"          deplibs="$deplibs $arg"
1037            continue
1038          ;;          ;;
1039    
1040        -module)        -module)
# Line 1096  compiler." Line 1042  compiler."
1042          continue          continue
1043          ;;          ;;
1044    
1045          -no-fast-install)
1046            fast_install=no
1047            continue
1048            ;;
1049    
1050          -no-install)
1051            case $host in
1052            *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1053              # The PATH hackery in wrapper scripts is required on Windows
1054              # in order for the loader to find any dlls it needs.
1055              $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1056              $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1057              fast_install=no
1058              ;;
1059            *) no_install=yes ;;
1060            esac
1061            continue
1062            ;;
1063    
1064        -no-undefined)        -no-undefined)
1065          allow_undefined=no          allow_undefined=no
1066          continue          continue
# Line 1121  compiler." Line 1086  compiler."
1086        -R*)        -R*)
1087          dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`          dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1088          # We need an absolute path.          # We need an absolute path.
1089          case "$dir" in          case $dir in
1090          [\\/]* | [A-Za-z]:[\\/]*) ;;          [\\/]* | [A-Za-z]:[\\/]*) ;;
1091          *)          *)
1092            $echo "$modename: only absolute run-paths are allowed" 1>&2            $echo "$modename: only absolute run-paths are allowed" 1>&2
# Line 1136  compiler." Line 1101  compiler."
1101          ;;          ;;
1102    
1103        -static)        -static)
1104          # If we have no pic_flag, then this is the same as -all-static.          # The effects of -static are defined in a previous loop.
1105          if test -z "$pic_flag" && test -n "$link_static_flag"; then          # We used to do the same as -all-static on platforms that
1106            compile_command="$compile_command $link_static_flag"          # didn't have a PIC flag, but the assumption that the effects
1107            finalize_command="$finalize_command $link_static_flag"          # would be equivalent was wrong.  It would break on at least
1108          fi          # Digital Unix and AIX.
1109          continue          continue
1110          ;;          ;;
1111    
# Line 1154  compiler." Line 1119  compiler."
1119          continue          continue
1120          ;;          ;;
1121    
1122          -Wc,*)
1123            args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1124            arg=
1125            IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
1126            for flag in $args; do
1127              IFS="$save_ifs"
1128              case $flag in
1129                *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1130                flag="\"$flag\""
1131                ;;
1132              esac
1133              arg="$arg $wl$flag"
1134              compiler_flags="$compiler_flags $flag"
1135            done
1136            IFS="$save_ifs"
1137            arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1138            ;;
1139    
1140          -Wl,*)
1141            args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1142            arg=
1143            IFS="${IFS=     }"; save_ifs="$IFS"; IFS=','
1144            for flag in $args; do
1145              IFS="$save_ifs"
1146              case $flag in
1147                *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1148                flag="\"$flag\""
1149                ;;
1150              esac
1151              arg="$arg $wl$flag"
1152              compiler_flags="$compiler_flags $wl$flag"
1153              linker_flags="$linker_flags $flag"
1154            done
1155            IFS="$save_ifs"
1156            arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1157            ;;
1158    
1159          -Xcompiler)
1160            prev=xcompiler
1161            continue
1162            ;;
1163    
1164          -Xlinker)
1165            prev=xlinker
1166            continue
1167            ;;
1168    
1169        # Some other compiler flag.        # Some other compiler flag.
1170        -* | +*)        -* | +*)
1171          # Unknown arguments in both finalize_command and compile_command need          # Unknown arguments in both finalize_command and compile_command need
1172          # to be aesthetically quoted because they are evaled later.          # to be aesthetically quoted because they are evaled later.
1173          arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`          arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1174          case "$arg" in          case $arg in
1175          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1176            arg="\"$arg\""            arg="\"$arg\""
1177            ;;            ;;
1178          esac          esac
1179          ;;          ;;
1180    
1181        *.o | *.obj | *.a | *.lib)        *.lo | *.$objext)
1182          # A standard object.          # A library or standard object.
         objs="$objs $arg"  
         ;;  
   
       *.lo)  
         # A library object.  
1183          if test "$prev" = dlfiles; then          if test "$prev" = dlfiles; then
1184            dlfiles="$dlfiles $arg"            # This file was specified with -dlopen.
1185            if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then            if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1186                dlfiles="$dlfiles $arg"
1187              prev=              prev=
1188              continue              continue
1189            else            else
# Line 1188  compiler." Line 1196  compiler."
1196            # Preload the old-style object.            # Preload the old-style object.
1197            dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`            dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1198            prev=            prev=
1199            else
1200              case $arg in
1201              *.lo) libobjs="$libobjs $arg" ;;
1202              *) objs="$objs $arg" ;;
1203              esac
1204          fi          fi
1205          libobjs="$libobjs $arg"          ;;
1206    
1207          *.$libext)
1208            # An archive.
1209            deplibs="$deplibs $arg"
1210            old_deplibs="$old_deplibs $arg"
1211            continue
1212          ;;          ;;
1213    
1214        *.la)        *.la)
1215          # A libtool-controlled library.          # A libtool-controlled library.
1216    
1217          dlname=          if test "$prev" = dlfiles; then
1218          libdir=            # This library was specified with -dlopen.
1219          library_names=            dlfiles="$dlfiles $arg"
1220          old_library=            prev=
1221            elif test "$prev" = dlprefiles; then
1222              # The library was specified with -dlpreopen.
1223              dlprefiles="$dlprefiles $arg"
1224              prev=
1225            else
1226              deplibs="$deplibs $arg"
1227            fi
1228            continue
1229            ;;
1230    
1231          # Some other compiler argument.
1232          *)
1233            # Unknown arguments in both finalize_command and compile_command need
1234            # to be aesthetically quoted because they are evaled later.
1235            arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1236            case $arg in
1237            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1238              arg="\"$arg\""
1239              ;;
1240            esac
1241            ;;
1242          esac # arg
1243    
1244          # Now actually substitute the argument into the commands.
1245          if test -n "$arg"; then
1246            compile_command="$compile_command $arg"
1247            finalize_command="$finalize_command $arg"
1248          fi
1249        done # argument parsing loop
1250    
1251        if test -n "$prev"; then
1252          $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1253          $echo "$help" 1>&2
1254          exit 1
1255        fi
1256    
1257        if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1258          eval arg=\"$export_dynamic_flag_spec\"
1259          compile_command="$compile_command $arg"
1260          finalize_command="$finalize_command $arg"
1261        fi
1262    
1263        # calculate the name of the file, without its directory
1264        outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1265        libobjs_save="$libobjs"
1266    
1267        if test -n "$shlibpath_var"; then
1268          # get the directories listed in $shlibpath_var
1269          eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1270        else
1271          shlib_search_path=
1272        fi
1273        eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1274        eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1275    
1276        output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1277        if test "X$output_objdir" = "X$output"; then
1278          output_objdir="$objdir"
1279        else
1280          output_objdir="$output_objdir/$objdir"
1281        fi
1282        # Create the object directory.
1283        if test ! -d $output_objdir; then
1284          $show "$mkdir $output_objdir"
1285          $run $mkdir $output_objdir
1286          status=$?
1287          if test $status -ne 0 && test ! -d $output_objdir; then
1288            exit $status
1289          fi
1290        fi
1291    
1292        # Determine the type of output
1293        case $output in
1294        "")
1295          $echo "$modename: you must specify an output file" 1>&2
1296          $echo "$help" 1>&2
1297          exit 1
1298          ;;
1299        *.$libext) linkmode=oldlib ;;
1300        *.lo | *.$objext) linkmode=obj ;;
1301        *.la) linkmode=lib ;;
1302        *) linkmode=prog ;; # Anything else should be a program.
1303        esac
1304    
1305        specialdeplibs=
1306        libs=
1307        # Find all interdependent deplibs by searching for libraries
1308        # that are linked more than once (e.g. -la -lb -la)
1309        for deplib in $deplibs; do
1310          case "$libs " in
1311          *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1312          esac
1313          libs="$libs $deplib"
1314        done
1315        deplibs=
1316        newdependency_libs=
1317        newlib_search_path=
1318        need_relink=no # whether we're linking any uninstalled libtool libraries
1319        notinst_deplibs= # not-installed libtool libraries
1320        notinst_path= # paths that contain not-installed libtool libraries
1321        case $linkmode in
1322        lib)
1323            passes="conv link"
1324            for file in $dlfiles $dlprefiles; do
1325              case $file in
1326              *.la) ;;
1327              *)
1328                $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1329                exit 1
1330                ;;
1331              esac
1332            done
1333            ;;
1334        prog)
1335            compile_deplibs=
1336            finalize_deplibs=
1337            alldeplibs=no
1338            newdlfiles=
1339            newdlprefiles=
1340            passes="conv scan dlopen dlpreopen link"
1341            ;;
1342        *)  passes="conv"
1343            ;;
1344        esac
1345        for pass in $passes; do
1346          if test $linkmode = prog; then
1347            # Determine which files to process
1348            case $pass in
1349            dlopen)
1350              libs="$dlfiles"
1351              save_deplibs="$deplibs" # Collect dlpreopened libraries
1352              deplibs=
1353              ;;
1354            dlpreopen) libs="$dlprefiles" ;;
1355            link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1356            esac
1357          fi
1358          for deplib in $libs; do
1359            lib=
1360            found=no
1361            case $deplib in
1362            -l*)
1363              if test $linkmode = oldlib && test $linkmode = obj; then
1364                $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1365                continue
1366              fi
1367              if test $pass = conv; then
1368                deplibs="$deplib $deplibs"
1369                continue
1370              fi
1371              name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1372              for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1373                # Search the libtool library
1374                lib="$searchdir/lib${name}.la"
1375                if test -f "$lib"; then
1376                  found=yes
1377                  break
1378                fi
1379              done
1380              if test "$found" != yes; then
1381                # deplib doesn't seem to be a libtool library
1382                if test "$linkmode,$pass" = "prog,link"; then
1383                  compile_deplibs="$deplib $compile_deplibs"
1384                  finalize_deplibs="$deplib $finalize_deplibs"
1385                else
1386                  deplibs="$deplib $deplibs"
1387                  test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1388                fi
1389                continue
1390              fi
1391              ;; # -l
1392            -L*)
1393              case $linkmode in
1394              lib)
1395                deplibs="$deplib $deplibs"
1396                test $pass = conv && continue
1397                newdependency_libs="$deplib $newdependency_libs"
1398                newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1399                ;;
1400              prog)
1401                if test $pass = conv; then
1402                  deplibs="$deplib $deplibs"
1403                  continue
1404                fi
1405                if test $pass = scan; then
1406                  deplibs="$deplib $deplibs"
1407                  newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1408                else
1409                  compile_deplibs="$deplib $compile_deplibs"
1410                  finalize_deplibs="$deplib $finalize_deplibs"
1411                fi
1412                ;;
1413              *)
1414                $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1415                ;;
1416              esac # linkmode
1417              continue
1418              ;; # -L
1419            -R*)
1420              if test $pass = link; then
1421                dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1422                # Make sure the xrpath contains only unique directories.
1423                case "$xrpath " in
1424                *" $dir "*) ;;
1425                *) xrpath="$xrpath $dir" ;;
1426                esac
1427              fi
1428              deplibs="$deplib $deplibs"
1429              continue
1430              ;;
1431            *.la) lib="$deplib" ;;
1432            *.$libext)
1433              if test $pass = conv; then
1434                deplibs="$deplib $deplibs"
1435                continue
1436              fi
1437              case $linkmode in
1438              lib)
1439                if test "$deplibs_check_method" != pass_all; then
1440                  echo
1441                  echo "*** Warning: This library needs some functionality provided by $deplib."
1442                  echo "*** I have the capability to make that library automatically link in when"
1443                  echo "*** you link to this library.  But I can only do this if you have a"
1444                  echo "*** shared version of the library, which you do not appear to have."
1445                else
1446                  echo
1447                  echo "*** Warning: Linking the shared library $output against the"
1448                  echo "*** static library $deplib is not portable!"
1449                  deplibs="$deplib $deplibs"
1450                fi
1451                continue
1452                ;;
1453              prog)
1454                if test $pass != link; then
1455                  deplibs="$deplib $deplibs"
1456                else
1457                  compile_deplibs="$deplib $compile_deplibs"
1458                  finalize_deplibs="$deplib $finalize_deplibs"
1459                fi
1460                continue
1461                ;;
1462              esac # linkmode
1463              ;; # *.$libext
1464            *.lo | *.$objext)
1465              if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1466                # If there is no dlopen support or we're linking statically,
1467                # we need to preload.
1468                newdlprefiles="$newdlprefiles $deplib"
1469                compile_deplibs="$deplib $compile_deplibs"
1470                finalize_deplibs="$deplib $finalize_deplibs"
1471              else
1472                newdlfiles="$newdlfiles $deplib"
1473              fi
1474              continue
1475              ;;
1476            %DEPLIBS%)
1477              alldeplibs=yes
1478              continue
1479              ;;
1480            esac # case $deplib
1481            if test $found = yes || test -f "$lib"; then :
1482            else
1483              $echo "$modename: cannot find the library \`$lib'" 1>&2
1484              exit 1
1485            fi
1486    
1487          # Check to see that this really is a libtool archive.          # Check to see that this really is a libtool archive.
1488          if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :          if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1489          else          else
1490            $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2            $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1491            exit 1            exit 1
1492          fi          fi
1493    
1494            ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1495            test "X$ladir" = "X$lib" && ladir="."
1496    
1497            dlname=
1498            dlopen=
1499            dlpreopen=
1500            libdir=
1501            library_names=
1502            old_library=
1503          # If the library was installed with an old release of libtool,          # If the library was installed with an old release of libtool,
1504          # it will not redefine variable installed.          # it will not redefine variable installed.
1505          installed=yes          installed=yes
1506    
1507          # Read the .la file          # Read the .la file
1508          # If there is no directory component, then add one.          case $lib in
1509          case "$arg" in          */* | *\\*) . $lib ;;
1510          */* | *\\*) . $arg ;;          *) . ./$lib ;;
         *) . ./$arg ;;  
1511          esac          esac
1512    
1513            if test "$linkmode,$pass" = "lib,link" ||
1514               test "$linkmode,$pass" = "prog,scan" ||
1515               { test $linkmode = oldlib && test $linkmode = obj; }; then
1516               # Add dl[pre]opened files of deplib
1517              test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1518              test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1519            fi
1520    
1521            if test $pass = conv; then
1522              # Only check for convenience libraries
1523              deplibs="$lib $deplibs"
1524              if test -z "$libdir"; then
1525                if test -z "$old_library"; then
1526                  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1527                  exit 1
1528                fi
1529                # It is a libtool convenience library, so add in its objects.
1530                convenience="$convenience $ladir/$objdir/$old_library"
1531                old_convenience="$old_convenience $ladir/$objdir/$old_library"
1532                tmp_libs=
1533                for deplib in $dependency_libs; do
1534                  deplibs="$deplib $deplibs"
1535                  case "$tmp_libs " in
1536                  *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1537                  esac
1538                  tmp_libs="$tmp_libs $deplib"
1539                done
1540              elif test $linkmode != prog && test $linkmode != lib; then
1541                $echo "$modename: \`$lib' is not a convenience library" 1>&2
1542                exit 1
1543              fi
1544              continue
1545            fi # $pass = conv
1546    
1547          # Get the name of the library we link against.          # Get the name of the library we link against.
1548          linklib=          linklib=
1549          for l in $old_library $library_names; do          for l in $old_library $library_names; do
1550            linklib="$l"            linklib="$l"
1551          done          done
   
1552          if test -z "$linklib"; then          if test -z "$linklib"; then
1553            $echo "$modename: cannot find name of link library for \`$arg'" 1>&2            $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1554            exit 1            exit 1
1555          fi          fi
1556    
1557          # Find the relevant object directory and library name.          # This library was specified with -dlopen.
1558          name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`          if test $pass = dlopen; then
1559              if test -z "$libdir"; then
1560          if test "X$installed" = Xyes; then              $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1561            dir="$libdir"              exit 1
1562          else            fi
1563            dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`            if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1564            if test "X$dir" = "X$arg"; then              # If there is no dlname, no dlopen support or we're linking
1565              dir="$objdir"              # statically, we need to preload.
1566                dlprefiles="$dlprefiles $lib"
1567            else            else
1568              dir="$dir/$objdir"              newdlfiles="$newdlfiles $lib"
1569            fi            fi
         fi  
   
         if test -n "$dependency_libs"; then  
           # Extract -R and -L from dependency_libs  
           temp_deplibs=  
           for deplib in $dependency_libs; do  
             case "$deplib" in  
             -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`  
                  case " $rpath $xrpath " in  
                  *" $temp_xrpath "*) ;;  
                  *) xrpath="$xrpath $temp_xrpath";;  
                  esac;;  
             -L*) case "$compile_command $temp_deplibs " in  
                  *" $deplib "*) ;;  
                  *) temp_deplibs="$temp_deplibs $deplib";;  
                  esac  
                  temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`  
                  case " $lib_search_path " in  
                  *" $temp_dir "*) ;;  
                  *) lib_search_path="$lib_search_path $temp_dir";;  
                  esac  
                  ;;  
             *) temp_deplibs="$temp_deplibs $deplib";;  
             esac  
           done  
           dependency_libs="$temp_deplibs"  
         fi  
   
         if test -z "$libdir"; then  
           # It is a libtool convenience library, so add in its objects.  
           convenience="$convenience $dir/$old_library"  
           old_convenience="$old_convenience $dir/$old_library"  
           deplibs="$deplibs$dependency_libs"  
           compile_command="$compile_command $dir/$old_library$dependency_libs"  
           finalize_command="$finalize_command $dir/$old_library$dependency_libs"  
1570            continue            continue
1571          fi          fi # $pass = dlopen
1572    
1573          # This library was specified with -dlopen.          # We need an absolute path.
1574          if test "$prev" = dlfiles; then          case $ladir in
1575            dlfiles="$dlfiles $arg"          [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1576            if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then          *)
1577              # If there is no dlname, no dlopen support or we're linking statically,            abs_ladir=`cd "$ladir" && pwd`
1578              # we need to preload.            if test -z "$abs_ladir"; then
1579              prev=dlprefiles              $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1580            else              $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1581              # We should not create a dependency on this library, but we              abs_ladir="$ladir"
             # may need any libraries it requires.  
             compile_command="$compile_command$dependency_libs"  
             finalize_command="$finalize_command$dependency_libs"  
             prev=  
             continue  
1582            fi            fi
1583          fi            ;;
1584            esac
1585            laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1586    
1587          # The library was specified with -dlpreopen.          # Find the relevant object directory and library name.
1588          if test "$prev" = dlprefiles; then          if test "X$installed" = Xyes; then
1589              if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1590                $echo "$modename: warning: library \`$lib' was moved." 1>&2
1591                dir="$ladir"
1592                absdir="$abs_ladir"
1593                libdir="$abs_ladir"
1594              else
1595                dir="$libdir"
1596                absdir="$libdir"
1597              fi
1598            else
1599              dir="$ladir/$objdir"
1600              absdir="$abs_ladir/$objdir"
1601              # Remove this search path later
1602              notinst_path="$notinst_path $abs_ladir"
1603            fi # $installed = yes
1604            name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1605    
1606            # This library was specified with -dlpreopen.
1607            if test $pass = dlpreopen; then
1608              if test -z "$libdir"; then
1609                $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1610                exit 1
1611              fi
1612            # Prefer using a static library (so that no silly _DYNAMIC symbols            # Prefer using a static library (so that no silly _DYNAMIC symbols
1613            # are required to link).            # are required to link).
1614            if test -n "$old_library"; then            if test -n "$old_library"; then
1615              dlprefiles="$dlprefiles $dir/$old_library"              newdlprefiles="$newdlprefiles $dir/$old_library"
1616              # Otherwise, use the dlname, so that lt_dlopen finds it.
1617              elif test -n "$dlname"; then
1618                newdlprefiles="$newdlprefiles $dir/$dlname"
1619            else            else
1620              dlprefiles="$dlprefiles $dir/$linklib"              newdlprefiles="$newdlprefiles $dir/$linklib"
1621            fi            fi
1622            prev=          fi # $pass = dlpreopen
1623    
1624            if test -z "$libdir"; then
1625              # Link the convenience library
1626              if test $linkmode = lib; then
1627                deplibs="$dir/$old_library $deplibs"
1628              elif test "$linkmode,$pass" = "prog,link"; then
1629                compile_deplibs="$dir/$old_library $compile_deplibs"
1630                finalize_deplibs="$dir/$old_library $finalize_deplibs"
1631              else
1632                deplibs="$lib $deplibs"
1633              fi
1634              continue
1635          fi          fi
1636    
1637          if test -n "$library_names" &&          if test $linkmode = prog && test $pass != link; then
1638             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then            newlib_search_path="$newlib_search_path $ladir"
1639            link_against_libtool_libs="$link_against_libtool_libs $arg"            deplibs="$lib $deplibs"
1640            if test -n "$shlibpath_var"; then  
1641              # Make sure the rpath contains only unique directories.            linkalldeplibs=no
1642              case "$temp_rpath " in            if test "$link_all_deplibs" != no || test -z "$library_names" ||
1643              *" $dir "*) ;;               test "$build_libtool_libs" = no; then
1644              *) temp_rpath="$temp_rpath $dir" ;;              linkalldeplibs=yes
             esac  
1645            fi            fi
1646    
1647            # We need an absolute path.            tmp_libs=
1648            case "$dir" in            for deplib in $dependency_libs; do
1649            [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;              case $deplib in
1650            *)              -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1651              absdir=`cd "$dir" && pwd`              esac
1652              if test -z "$absdir"; then              # Need to link against all dependency_libs?
1653                $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2              if test $linkalldeplibs = yes; then
1654                $echo "$modename: passing it literally to the linker, although it might fail" 1>&2                deplibs="$deplib $deplibs"
1655                absdir="$dir"              else
1656                  # Need to hardcode shared library paths
1657                  # or/and link against static libraries
1658                  newdependency_libs="$deplib $newdependency_libs"
1659              fi              fi
1660              ;;              case "$tmp_libs " in
1661            esac              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
   
           # This is the magic to use -rpath.  
           # Skip directories that are in the system default run-time  
           # search path, unless they have been requested with -R.  
           case " $sys_lib_dlsearch_path " in  
           *" $absdir "*) ;;  
           *)  
             case "$compile_rpath " in  
             *" $absdir "*) ;;  
             *) compile_rpath="$compile_rpath $absdir"  
1662              esac              esac
1663              ;;              tmp_libs="$tmp_libs $deplib"
1664            esac            done # for deplib
1665              continue
1666            fi # $linkmode = prog...
1667    
1668            case " $sys_lib_dlsearch_path " in          link_static=no # Whether the deplib will be linked statically
1669            *" $libdir "*) ;;          if test -n "$library_names" &&
1670            *)             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1671              case "$finalize_rpath " in            # Link against this shared library
1672    
1673              if test "$linkmode,$pass" = "prog,link" ||
1674               { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1675                # Hardcode the library path.
1676                # Skip directories that are in the system default run-time
1677                # search path.
1678                case " $sys_lib_dlsearch_path " in
1679                *" $absdir "*) ;;
1680                *)
1681                  case "$compile_rpath " in
1682                  *" $absdir "*) ;;
1683                  *) compile_rpath="$compile_rpath $absdir"
1684                  esac
1685                  ;;
1686                esac
1687                case " $sys_lib_dlsearch_path " in
1688              *" $libdir "*) ;;              *" $libdir "*) ;;
1689              *) finalize_rpath="$finalize_rpath $libdir"              *)
1690                  case "$finalize_rpath " in
1691                  *" $libdir "*) ;;
1692                  *) finalize_rpath="$finalize_rpath $libdir"
1693                  esac
1694                  ;;
1695              esac              esac
1696              ;;              if test $linkmode = prog; then
1697            esac                # We need to hardcode the library path
1698                  if test -n "$shlibpath_var"; then
1699                    # Make sure the rpath contains only unique directories.
1700                    case "$temp_rpath " in
1701                    *" $dir "*) ;;
1702                    *" $absdir "*) ;;
1703                    *) temp_rpath="$temp_rpath $dir" ;;
1704                    esac
1705                  fi
1706                fi
1707              fi # $linkmode,$pass = prog,link...
1708    
1709            lib_linked=yes            if test "$alldeplibs" = yes &&
1710            case "$hardcode_action" in               { test "$deplibs_check_method" = pass_all ||
1711            immediate | unsupported)                 { test "$build_libtool_libs" = yes &&
1712              if test "$hardcode_direct" = no; then                   test -n "$library_names"; }; }; then
1713                compile_command="$compile_command $dir/$linklib"              # We only need to search for static libraries
1714                deplibs="$deplibs $dir/$linklib"              continue
1715                case "$host" in            fi
1716                *-*-cygwin* | *-*-mingw* | *-*-os2*)  
1717                  dllsearchdir=`cd "$dir" && pwd || echo "$dir"`            if test "$installed" = no; then
1718                  if test -n "$dllsearchpath"; then              notinst_deplibs="$notinst_deplibs $lib"
1719                    dllsearchpath="$dllsearchpath:$dllsearchdir"              need_relink=yes
1720                  else            fi
1721                    dllsearchpath="$dllsearchdir"  
1722                  fi            if test -n "$old_archive_from_expsyms_cmds"; then
1723                  ;;              # figure out the soname
1724                esac              set dummy $library_names
1725              elif test "$hardcode_minus_L" = no; then              realname="$2"
1726                case "$host" in              shift; shift
1727                *-*-sunos*)              libname=`eval \\$echo \"$libname_spec\"`
1728                  compile_shlibpath="$compile_shlibpath$dir:"              # use dlname if we got it. it's perfectly good, no?
1729                if test -n "$dlname"; then
1730                  soname="$dlname"
1731                elif test -n "$soname_spec"; then
1732                  # bleh windows
1733                  case $host in
1734                  *cygwin*)
1735                    major=`expr $current - $age`
1736                    versuffix="-$major"
1737                  ;;                  ;;
1738                esac                esac
1739                case "$compile_command " in                eval soname=\"$soname_spec\"
1740                *" -L$dir "*) ;;              else
1741                *) compile_command="$compile_command -L$dir";;                soname="$realname"
1742                esac              fi
1743                compile_command="$compile_command -l$name"  
1744                deplibs="$deplibs -L$dir -l$name"              # Make a new name for the extract_expsyms_cmds to use
1745              elif test "$hardcode_shlibpath_var" = no; then              soroot="$soname"
1746                case ":$compile_shlibpath:" in              soname=`echo $soroot | sed -e 's/^.*\///'`
1747                *":$dir:"*) ;;              newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1748                *) compile_shlibpath="$compile_shlibpath$dir:";;  
1749                # If the library has no export list, then create one now
1750                if test -f "$output_objdir/$soname-def"; then :
1751                else
1752                  $show "extracting exported symbol list from \`$soname'"
1753                  IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
1754                  eval cmds=\"$extract_expsyms_cmds\"
1755                  for cmd in $cmds; do
1756                    IFS="$save_ifs"
1757                    $show "$cmd"
1758                    $run eval "$cmd" || exit $?
1759                  done
1760                  IFS="$save_ifs"
1761                fi
1762    
1763                # Create $newlib
1764                if test -f "$output_objdir/$newlib"; then :; else
1765                  $show "generating import library for \`$soname'"
1766                  IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
1767                  eval cmds=\"$old_archive_from_expsyms_cmds\"
1768                  for cmd in $cmds; do
1769                    IFS="$save_ifs"
1770                    $show "$cmd"
1771                    $run eval "$cmd" || exit $?
1772                  done
1773                  IFS="$save_ifs"
1774                fi
1775                # make sure the library variables are pointing to the new library
1776                dir=$output_objdir
1777                linklib=$newlib
1778              fi # test -n $old_archive_from_expsyms_cmds
1779    
1780              if test $linkmode = prog || test "$mode" != relink; then
1781                add_shlibpath=
1782                add_dir=
1783                add=
1784                lib_linked=yes
1785                case $hardcode_action in
1786                immediate | unsupported)
1787                  if test "$hardcode_direct" = no; then
1788                    add="$dir/$linklib"
1789                  elif test "$hardcode_minus_L" = no; then
1790                    case $host in
1791                    *-*-sunos*) add_shlibpath="$dir" ;;
1792                    esac
1793                    add_dir="-L$dir"
1794                    add="-l$name"
1795                  elif test "$hardcode_shlibpath_var" = no; then
1796                    add_shlibpath="$dir"
1797                    add="-l$name"
1798                  else
1799                    lib_linked=no
1800                  fi
1801                  ;;
1802                relink)
1803                  if test "$hardcode_direct" = yes; then
1804                    add="$dir/$linklib"
1805                  elif test "$hardcode_minus_L" = yes; then
1806                    add_dir="-L$dir"
1807                    add="-l$name"
1808                  elif test "$hardcode_shlibpath_var" = yes; then
1809                    add_shlibpath="$dir"
1810                    add="-l$name"
1811                  else
1812                    lib_linked=no
1813                  fi
1814                  ;;
1815                *) lib_linked=no ;;
1816                esac
1817    
1818                if test "$lib_linked" != yes; then
1819                  $echo "$modename: configuration error: unsupported hardcode properties"
1820                  exit 1
1821                fi
1822    
1823                if test -n "$add_shlibpath"; then
1824                  case :$compile_shlibpath: in
1825                  *":$add_shlibpath:"*) ;;
1826                  *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1827                esac                esac
1828                compile_command="$compile_command -l$name"              fi
1829                deplibs="$deplibs -l$name"              if test $linkmode = prog; then
1830                  test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1831                  test -n "$add" && compile_deplibs="$add $compile_deplibs"
1832              else              else
1833                lib_linked=no                test -n "$add_dir" && deplibs="$add_dir $deplibs"
1834                  test -n "$add" && deplibs="$add $deplibs"
1835                  if test "$hardcode_direct" != yes && \
1836                     test "$hardcode_minus_L" != yes && \
1837                     test "$hardcode_shlibpath_var" = yes; then
1838                    case :$finalize_shlibpath: in
1839                    *":$libdir:"*) ;;
1840                    *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1841                    esac
1842                  fi
1843              fi              fi
1844              ;;            fi
1845    
1846            relink)            if test $linkmode = prog || test "$mode" = relink; then
1847                add_shlibpath=
1848                add_dir=
1849                add=
1850                # Finalize command for both is simple: just hardcode it.
1851              if test "$hardcode_direct" = yes; then              if test "$hardcode_direct" = yes; then
1852                compile_command="$compile_command $absdir/$linklib"                add="$libdir/$linklib"
               deplibs="$deplibs $absdir/$linklib"  
1853              elif test "$hardcode_minus_L" = yes; then              elif test "$hardcode_minus_L" = yes; then
1854                case "$compile_command " in                add_dir="-L$libdir"
1855                *" -L$absdir "*) ;;                add="-l$name"
               *) compile_command="$compile_command -L$absdir";;  
               esac  
               compile_command="$compile_command -l$name"  
               deplibs="$deplibs -L$absdir -l$name"  
1856              elif test "$hardcode_shlibpath_var" = yes; then              elif test "$hardcode_shlibpath_var" = yes; then
1857                case ":$compile_shlibpath:" in                case :$finalize_shlibpath: in
1858                *":$absdir:"*) ;;                *":$libdir:"*) ;;
1859                *) compile_shlibpath="$compile_shlibpath$absdir:";;                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1860                esac                esac
1861                compile_command="$compile_command -l$name"                add="-l$name"
               deplibs="$deplibs -l$name"  
1862              else              else
1863                lib_linked=no                # We cannot seem to hardcode it, guess we'll fake it.
1864                  add_dir="-L$libdir"
1865                  add="-l$name"
1866              fi              fi
             ;;  
1867    
1868            *)              if test $linkmode = prog; then
1869              lib_linked=no                test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1870              ;;                test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1871            esac              else
1872                  test -n "$add_dir" && deplibs="$add_dir $deplibs"
1873            if test "$lib_linked" != yes; then                test -n "$add" && deplibs="$add $deplibs"
1874              $echo "$modename: configuration error: unsupported hardcode properties"              fi
             exit 1  
           fi  
   
           # Finalize command for both is simple: just hardcode it.  
           if test "$hardcode_direct" = yes; then  
             finalize_command="$finalize_command $libdir/$linklib"  
           elif test "$hardcode_minus_L" = yes; then  
             case "$finalize_command " in  
             *" -L$libdir "*) ;;  
             *) finalize_command="$finalize_command -L$libdir";;  
             esac  
             finalize_command="$finalize_command -l$name"  
           elif test "$hardcode_shlibpath_var" = yes; then  
             case ":$finalize_shlibpath:" in  
             *":$libdir:"*) ;;  
             *) finalize_shlibpath="$finalize_shlibpath$libdir:";;  
             esac  
             finalize_command="$finalize_command -l$name"  
           else  
             # We cannot seem to hardcode it, guess we'll fake it.  
             case "$finalize_command " in  
             *" -L$dir "*) ;;  
             *) finalize_command="$finalize_command -L$libdir";;  
             esac  
             finalize_command="$finalize_command -l$name"  
1875            fi            fi
1876          else          elif test $linkmode = prog; then
1877            # Transform directly to old archives if we don't build new libraries.            if test "$alldeplibs" = yes &&
1878            if test -n "$pic_flag" && test -z "$old_library"; then               { test "$deplibs_check_method" = pass_all ||
1879              $echo "$modename: cannot find static library for \`$arg'" 1>&2                 { test "$build_libtool_libs" = yes &&
1880              exit 1                   test -n "$library_names"; }; }; then
1881                # We only need to search for static libraries
1882                continue
1883            fi            fi
1884    
1885              # Try to link the static library
1886            # Here we assume that one of hardcode_direct or hardcode_minus_L            # Here we assume that one of hardcode_direct or hardcode_minus_L
1887            # is not unsupported.  This is valid on all known static and            # is not unsupported.  This is valid on all known static and
1888            # shared platforms.            # shared platforms.
1889            if test "$hardcode_direct" != unsupported; then            if test "$hardcode_direct" != unsupported; then
1890              test -n "$old_library" && linklib="$old_library"              test -n "$old_library" && linklib="$old_library"
1891              compile_command="$compile_command $dir/$linklib"              compile_deplibs="$dir/$linklib $compile_deplibs"
1892              finalize_command="$finalize_command $dir/$linklib"              finalize_deplibs="$dir/$linklib $finalize_deplibs"
1893            else            else
1894              case "$compile_command " in              compile_deplibs="-l$name -L$dir $compile_deplibs"
1895              *" -L$dir "*) ;;              finalize_deplibs="-l$name -L$dir $finalize_deplibs"
             *) compile_command="$compile_command -L$dir";;  
             esac  
             compile_command="$compile_command -l$name"  
             case "$finalize_command " in  
             *" -L$dir "*) ;;  
             *) finalize_command="$finalize_command -L$dir";;  
             esac  
             finalize_command="$finalize_command -l$name"  
1896            fi            fi
1897          fi          elif test "$build_libtool_libs" = yes; then
1898              # Not a shared library
1899          # Add in any libraries that this one depends upon.            if test "$deplibs_check_method" != pass_all; then
1900          compile_command="$compile_command$dependency_libs"              # We're trying link a shared library against a static one
1901          finalize_command="$finalize_command$dependency_libs"              # but the system doesn't support it.
         continue  
         ;;  
   
       # Some other compiler argument.  
       *)  
         # Unknown arguments in both finalize_command and compile_command need  
         # to be aesthetically quoted because they are evaled later.  
         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`  
         case "$arg" in  
         *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*)  
           arg="\"$arg\""  
           ;;  
         esac  
         ;;  
       esac  
   
       # Now actually substitute the argument into the commands.  
       if test -n "$arg"; then  
         compile_command="$compile_command $arg"  
         finalize_command="$finalize_command $arg"  
       fi  
     done  
1902    
1903      if test -n "$prev"; then              # Just print a warning and add the library to dependency_libs so
1904        $echo "$modename: the \`$prevarg' option requires an argument" 1>&2              # that the program can be linked against the static library.
1905        $echo "$help" 1>&2              echo
1906        exit 1              echo "*** Warning: This library needs some functionality provided by $lib."
1907      fi              echo "*** I have the capability to make that library automatically link in when"
1908                echo "*** you link to this library.  But I can only do this if you have a"
1909      if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then              echo "*** shared version of the library, which you do not appear to have."
1910        eval arg=\"$export_dynamic_flag_spec\"              if test "$module" = yes; then
1911        compile_command="$compile_command $arg"                echo "*** Therefore, libtool will create a static module, that should work "
1912        finalize_command="$finalize_command $arg"                echo "*** as long as the dlopening application is linked with the -dlopen flag."
1913      fi                if test -z "$global_symbol_pipe"; then
1914                    echo
1915      oldlibs=                  echo "*** However, this would only work if libtool was able to extract symbol"
1916      # calculate the name of the file, without its directory                  echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1917      outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`                  echo "*** not find such a program.  So, this module is probably useless."
1918      libobjs_save="$libobjs"                  echo "*** \`nm' from GNU binutils and a full rebuild may help."
1919                  fi
1920                  if test "$build_old_libs" = no; then
1921                    build_libtool_libs=module
1922                    build_old_libs=yes
1923                  else
1924                    build_libtool_libs=no
1925                  fi
1926                fi
1927              else
1928                convenience="$convenience $dir/$old_library"
1929                old_convenience="$old_convenience $dir/$old_library"
1930                deplibs="$dir/$old_library $deplibs"
1931                link_static=yes
1932              fi
1933            fi # link shared/static library?
1934    
1935            if test $linkmode = lib; then
1936              if test -n "$dependency_libs" &&
1937                 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1938                   test $link_static = yes; }; then
1939                # Extract -R from dependency_libs
1940                temp_deplibs=
1941                for libdir in $dependency_libs; do
1942                  case $libdir in
1943                  -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1944                       case " $xrpath " in
1945                       *" $temp_xrpath "*) ;;
1946                       *) xrpath="$xrpath $temp_xrpath";;
1947                       esac;;
1948                  *) temp_deplibs="$temp_deplibs $libdir";;
1949                  esac
1950                done
1951                dependency_libs="$temp_deplibs"
1952              fi
1953    
1954      case "$output" in            newlib_search_path="$newlib_search_path $absdir"
1955      "")            # Link against this library
1956        $echo "$modename: you must specify an output file" 1>&2            test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1957        $echo "$help" 1>&2            # ... and its dependency_libs
1958        exit 1            tmp_libs=
1959        ;;            for deplib in $dependency_libs; do
1960                newdependency_libs="$deplib $newdependency_libs"
1961                case "$tmp_libs " in
1962                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1963                esac
1964                tmp_libs="$tmp_libs $deplib"
1965              done
1966    
1967      *.a | *.lib)            if test $link_all_deplibs != no; then
1968        if test -n "$link_against_libtool_libs"; then              # Add the search paths of all dependency libraries
1969          $echo "$modename: error: cannot link libtool libraries into archives" 1>&2              for deplib in $dependency_libs; do
1970          exit 1                case $deplib in
1971                  -L*) path="$deplib" ;;
1972                  *.la)
1973                    dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
1974                    test "X$dir" = "X$deplib" && dir="."
1975                    # We need an absolute path.
1976                    case $dir in
1977                    [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1978                    *)
1979                      absdir=`cd "$dir" && pwd`
1980                      if test -z "$absdir"; then
1981                        $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1982                        absdir="$dir"
1983                      fi
1984                      ;;
1985                    esac
1986                    if grep "^installed=no" $deplib > /dev/null; then
1987                      path="-L$absdir/$objdir"
1988                    else
1989                      eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
1990                      if test -z "$libdir"; then
1991                        $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
1992                        exit 1
1993                      fi
1994                      if test "$absdir" != "$libdir"; then
1995                        $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
1996                      fi
1997                      path="-L$absdir"
1998                    fi
1999                    ;;
2000                  *) continue ;;
2001                  esac
2002                  case " $deplibs " in
2003                  *" $path "*) ;;
2004                  *) deplibs="$deplibs $path" ;;
2005                  esac
2006                done
2007              fi # link_all_deplibs != no
2008            fi # linkmode = lib
2009          done # for deplib in $libs
2010          if test $pass = dlpreopen; then
2011            # Link the dlpreopened libraries before other libraries
2012            for deplib in $save_deplibs; do
2013              deplibs="$deplib $deplibs"
2014            done
2015        fi        fi
2016          if test $pass != dlopen; then
2017            test $pass != scan && dependency_libs="$newdependency_libs"
2018            if test $pass != conv; then
2019              # Make sure lib_search_path contains only unique directories.
2020              lib_search_path=
2021              for dir in $newlib_search_path; do
2022                case "$lib_search_path " in
2023                *" $dir "*) ;;
2024                *) lib_search_path="$lib_search_path $dir" ;;
2025                esac
2026              done
2027              newlib_search_path=
2028            fi
2029    
2030        if test -n "$deplibs"; then          if test "$linkmode,$pass" != "prog,link"; then
2031          $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2            vars="deplibs"
2032            else
2033              vars="compile_deplibs finalize_deplibs"
2034            fi
2035            for var in $vars dependency_libs; do
2036              # Add libraries to $var in reverse order
2037              eval tmp_libs=\"\$$var\"
2038              new_libs=
2039              for deplib in $tmp_libs; do
2040                case $deplib in
2041                -L*) new_libs="$deplib $new_libs" ;;
2042                *)
2043                  case " $specialdeplibs " in
2044                  *" $deplib "*) new_libs="$deplib $new_libs" ;;
2045                  *)
2046                    case " $new_libs " in
2047                    *" $deplib "*) ;;
2048                    *) new_libs="$deplib $new_libs" ;;
2049                    esac
2050                    ;;
2051                  esac
2052                  ;;
2053                esac
2054              done
2055              tmp_libs=
2056              for deplib in $new_libs; do
2057                case $deplib in
2058                -L*)
2059                  case " $tmp_libs " in
2060                  *" $deplib "*) ;;
2061                  *) tmp_libs="$tmp_libs $deplib" ;;
2062                  esac
2063                  ;;
2064                *) tmp_libs="$tmp_libs $deplib" ;;
2065                esac
2066              done
2067              eval $var=\"$tmp_libs\"
2068            done # for var
2069        fi        fi
2070          if test "$pass" = "conv" &&
2071           { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2072            libs="$deplibs" # reset libs
2073            deplibs=
2074          fi
2075        done # for pass
2076        if test $linkmode = prog; then
2077          dlfiles="$newdlfiles"
2078          dlprefiles="$newdlprefiles"
2079        fi
2080    
2081        case $linkmode in
2082        oldlib)
2083        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2084          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2          $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2085        fi        fi
# Line 1566  compiler." Line 2107  compiler."
2107        # Now set the variables for building old libraries.        # Now set the variables for building old libraries.
2108        build_libtool_libs=no        build_libtool_libs=no
2109        oldlibs="$output"        oldlibs="$output"
2110          objs="$objs$old_deplibs"
2111        ;;        ;;
2112    
2113      *.la)      lib)
2114        # Make sure we only generate libraries of the form `libNAME.la'.        # Make sure we only generate libraries of the form `libNAME.la'.
2115        case "$outputname" in        case $outputname in
2116        lib*)        lib*)
2117          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2118          eval libname=\"$libname_spec\"          eval libname=\"$libname_spec\"
# Line 1591  compiler." Line 2133  compiler."
2133          ;;          ;;
2134        esac        esac
2135    
       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`  
       if test "X$output_objdir" = "X$output"; then  
         output_objdir="$objdir"  
       else  
         output_objdir="$output_objdir/$objdir"  
       fi  
   
2136        if test -n "$objs"; then        if test -n "$objs"; then
2137          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1          if test "$deplibs_check_method" != pass_all; then
2138          exit 1            $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2139        fi            exit 1
2140            else
2141        # How the heck are we supposed to write a wrapper for a shared library?            echo
2142        if test -n "$link_against_libtool_libs"; then            echo "*** Warning: Linking the shared library $output against the non-libtool"
2143           $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2            echo "*** objects $objs is not portable!"
2144           exit 1            libobjs="$libobjs $objs"
2145            fi
2146        fi        fi
2147    
2148        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then        if test "$dlself" != no; then
2149          $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2          $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2150        fi        fi
2151    
2152        set dummy $rpath        set dummy $rpath
# Line 1628  compiler." Line 2164  compiler."
2164            build_libtool_libs=convenience            build_libtool_libs=convenience
2165            build_old_libs=yes            build_old_libs=yes
2166          fi          fi
         dependency_libs="$deplibs"  
2167    
2168          if test -n "$vinfo"; then          if test -n "$vinfo"; then
2169            $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2            $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
# Line 1655  compiler." Line 2190  compiler."
2190          age="$4"          age="$4"
2191    
2192          # Check that each of the things are valid numbers.          # Check that each of the things are valid numbers.
2193          case "$current" in          case $current in
2194          0 | [1-9] | [1-9][0-9]*) ;;          0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2195          *)          *)
2196            $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2            $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2197            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
# Line 1664  compiler." Line 2199  compiler."
2199            ;;            ;;
2200          esac          esac
2201    
2202          case "$revision" in          case $revision in
2203          0 | [1-9] | [1-9][0-9]*) ;;          0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2204          *)          *)
2205            $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2            $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2206            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
# Line 1673  compiler." Line 2208  compiler."
2208            ;;            ;;
2209          esac          esac
2210    
2211          case "$age" in          case $age in
2212          0 | [1-9] | [1-9][0-9]*) ;;          0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2213          *)          *)
2214            $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2            $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2215            $echo "$modename: \`$vinfo' is not valid version information" 1>&2            $echo "$modename: \`$vinfo' is not valid version information" 1>&2
# Line 1692  compiler." Line 2227  compiler."
2227          major=          major=
2228          versuffix=          versuffix=
2229          verstring=          verstring=
2230          case "$version_type" in          case $version_type in
2231          none) ;;          none) ;;
2232    
2233            darwin)
2234              # Like Linux, but with the current version available in
2235              # verstring for coding it into the library header
2236              major=.`expr $current - $age`
2237              versuffix="$major.$age.$revision"
2238              # Darwin ld doesn't like 0 for these options...
2239              minor_current=`expr $current + 1`
2240              verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2241              ;;
2242    
2243            freebsd-aout)
2244              major=".$current"
2245              versuffix=".$current.$revision";
2246              ;;
2247    
2248            freebsd-elf)
2249              major=".$current"
2250              versuffix=".$current";
2251              ;;
2252    
2253          irix)          irix)
2254            major=`expr $current - $age + 1`            major=`expr $current - $age + 1`
           versuffix="$major.$revision"  
2255            verstring="sgi$major.$revision"            verstring="sgi$major.$revision"
2256    
2257            # Add in all the interfaces that we are compatible with.            # Add in all the interfaces that we are compatible with.
# Line 1707  compiler." Line 2261  compiler."
2261              loop=`expr $loop - 1`              loop=`expr $loop - 1`
2262              verstring="sgi$major.$iface:$verstring"              verstring="sgi$major.$iface:$verstring"
2263            done            done
2264    
2265              # Before this point, $major must not contain `.'.
2266              major=.$major
2267              versuffix="$major.$revision"
2268            ;;            ;;
2269    
2270          linux)          linux)
# Line 1736  compiler." Line 2294  compiler."
2294            versuffix=".$current.$revision"            versuffix=".$current.$revision"
2295            ;;            ;;
2296    
         freebsd-aout)  
           major=".$current"  
           versuffix=".$current.$revision";  
           ;;  
   
         freebsd-elf)  
           major=".$current"  
           versuffix=".$current";  
           ;;  
   
2297          windows)          windows)
2298            # Like Linux, but with '-' rather than '.', since we only            # Use '-' rather than '.', since we only want one
2299            # want one extension on Windows 95.            # extension on DOS 8.3 filesystems.
2300            major=`expr $current - $age`            major=`expr $current - $age`
2301            versuffix="-$major-$age-$revision"            versuffix="-$major"
2302            ;;            ;;
2303    
2304          *)          *)
# Line 1777  compiler." Line 2325  compiler."
2325            versuffix=            versuffix=
2326            verstring=""            verstring=""
2327          fi          fi
2328    
2329          # Check to see if the archive will have undefined symbols.          # Check to see if the archive will have undefined symbols.
2330          if test "$allow_undefined" = yes; then          if test "$allow_undefined" = yes; then
2331            if test "$allow_undefined_flag" = unsupported; then            if test "$allow_undefined_flag" = unsupported; then
# Line 1789  compiler." Line 2337  compiler."
2337            # Don't allow undefined symbols.            # Don't allow undefined symbols.
2338            allow_undefined_flag="$no_undefined_flag"            allow_undefined_flag="$no_undefined_flag"
2339          fi          fi
   
         dependency_libs="$deplibs"  
         case "$host" in  
         *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)  
           # these systems don't actually have a c library (as such)!  
           ;;  
         *)  
           # Add libc to deplibs on all other systems.  
           deplibs="$deplibs -lc"  
           ;;  
         esac  
2340        fi        fi
2341    
2342        # Create the output directory, or remove our outputs if we need to.        if test "$mode" != relink; then
2343        if test -d $output_objdir; then          # Remove our outputs.
2344          $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"          $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2345          $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*          $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
       else  
         $show "$mkdir $output_objdir"  
         $run $mkdir $output_objdir  
         status=$?  
         if test $status -ne 0 && test ! -d $output_objdir; then  
           exit $status  
         fi  
2346        fi        fi
2347    
2348        # Now set the variables for building old libraries.        # Now set the variables for building old libraries.
# Line 1823  compiler." Line 2353  compiler."
2353          oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`          oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2354        fi        fi
2355    
2356          # Eliminate all temporary directories.
2357          for path in $notinst_path; do
2358            lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2359            deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2360            dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2361          done
2362    
2363          if test -n "$xrpath"; then
2364            # If the user specified any rpath flags, then add them.
2365            temp_xrpath=
2366            for libdir in $xrpath; do
2367              temp_xrpath="$temp_xrpath -R$libdir"
2368              case "$finalize_rpath " in
2369              *" $libdir "*) ;;
2370              *) finalize_rpath="$finalize_rpath $libdir" ;;
2371              esac
2372            done
2373            if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2374              dependency_libs="$temp_xrpath $dependency_libs"
2375            fi
2376          fi
2377    
2378          # Make sure dlfiles contains only unique files that won't be dlpreopened
2379          old_dlfiles="$dlfiles"
2380          dlfiles=
2381          for lib in $old_dlfiles; do
2382            case " $dlprefiles $dlfiles " in
2383            *" $lib "*) ;;
2384            *) dlfiles="$dlfiles $lib" ;;
2385            esac
2386          done
2387    
2388          # Make sure dlprefiles contains only unique files
2389          old_dlprefiles="$dlprefiles"
2390          dlprefiles=
2391          for lib in $old_dlprefiles; do
2392            case "$dlprefiles " in
2393            *" $lib "*) ;;
2394            *) dlprefiles="$dlprefiles $lib" ;;
2395            esac
2396          done
2397    
2398        if test "$build_libtool_libs" = yes; then        if test "$build_libtool_libs" = yes; then
2399            if test -n "$rpath"; then
2400              case $host in
2401              *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2402                # these systems don't actually have a c library (as such)!
2403                ;;
2404              *-*-rhapsody* | *-*-darwin1.[012])
2405                # Rhapsody C library is in the System framework
2406                deplibs="$deplibs -framework System"
2407                ;;
2408              *-*-netbsd*)
2409                # Don't link with libc until the a.out ld.so is fixed.
2410                ;;
2411              *)
2412                # Add libc to deplibs on all other systems if necessary.
2413                if test $build_libtool_need_lc = "yes"; then
2414                  deplibs="$deplibs -lc"
2415                fi
2416                ;;
2417              esac
2418            fi
2419    
2420          # Transform deplibs into only deplibs that can be linked in shared.          # Transform deplibs into only deplibs that can be linked in shared.
2421          name_save=$name          name_save=$name
2422          libname_save=$libname          libname_save=$libname
# Line 1838  compiler." Line 2431  compiler."
2431          major=""          major=""
2432          newdeplibs=          newdeplibs=
2433          droppeddeps=no          droppeddeps=no
2434          case "$deplibs_check_method" in          case $deplibs_check_method in
2435          pass_all)          pass_all)
2436            # Don't check for shared/static.  Everything works.            # Don't check for shared/static.  Everything works.
2437            # This might be a little naive.  We might want to check            # This might be a little naive.  We might want to check
# Line 1863  EOF Line 2456  EOF
2456              for i in $deplibs; do              for i in $deplibs; do
2457                name="`expr $i : '-l\(.*\)'`"                name="`expr $i : '-l\(.*\)'`"
2458                # If $name is empty we are operating on a -L argument.                # If $name is empty we are operating on a -L argument.
2459                if test "$name" != "" ; then                if test -n "$name" && test "$name" != "0"; then
2460                  libname=`eval \\$echo \"$libname_spec\"`                  libname=`eval \\$echo \"$libname_spec\"`
2461                  deplib_matches=`eval \\$echo \"$library_names_spec\"`                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2462                  set dummy $deplib_matches                  set dummy $deplib_matches
# Line 1888  EOF Line 2481  EOF
2481              for i in $deplibs; do              for i in $deplibs; do
2482                name="`expr $i : '-l\(.*\)'`"                name="`expr $i : '-l\(.*\)'`"
2483               # If $name is empty we are operating on a -L argument.               # If $name is empty we are operating on a -L argument.
2484                if test "$name" != "" ; then                if test -n "$name" && test "$name" != "0"; then
2485                  $rm conftest                  $rm conftest
2486                  $CC -o conftest conftest.c $i                  $CC -o conftest conftest.c $i
2487                  # Did it work?                  # Did it work?
# Line 1924  EOF Line 2517  EOF
2517            ;;            ;;
2518          file_magic*)          file_magic*)
2519            set dummy $deplibs_check_method            set dummy $deplibs_check_method
2520            file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"            file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2521            for a_deplib in $deplibs; do            for a_deplib in $deplibs; do
2522              name="`expr $a_deplib : '-l\(.*\)'`"              name="`expr $a_deplib : '-l\(.*\)'`"
2523              # If $name is empty we are operating on a -L argument.              # If $name is empty we are operating on a -L argument.
2524              if test "$name" != "" ; then              if test -n "$name" && test "$name" != "0"; then
2525                libname=`eval \\$echo \"$libname_spec\"`                libname=`eval \\$echo \"$libname_spec\"`
2526                for i in $lib_search_path; do                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2527                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`                      potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2528                      for potent_lib in $potential_libs; do                      for potent_lib in $potential_libs; do
2529                        # Follow soft links.                        # Follow soft links.
2530                        if ls -lLd "$potent_lib" 2>/dev/null \                        if ls -lLd "$potent_lib" 2>/dev/null \
2531                           | grep " -> " >/dev/null; then                           | grep " -> " >/dev/null; then
2532                          continue                          continue
2533                        fi                        fi
2534                        # The statement above tries to avoid entering an                        # The statement above tries to avoid entering an
2535                        # endless loop below, in case of cyclic links.                        # endless loop below, in case of cyclic links.
# Line 1946  EOF Line 2539  EOF
2539                        potlib="$potent_lib"                        potlib="$potent_lib"
2540                        while test -h "$potlib" 2>/dev/null; do                        while test -h "$potlib" 2>/dev/null; do
2541                          potliblink=`ls -ld $potlib | sed 's/.* -> //'`                          potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2542                          case "$potliblink" in                          case $potliblink in
2543                          [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;                          [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2544                          *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;                          *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2545                          esac                          esac
# Line 1974  EOF Line 2567  EOF
2567              fi              fi
2568            done # Gone through all deplibs.            done # Gone through all deplibs.
2569            ;;            ;;
2570            match_pattern*)
2571              set dummy $deplibs_check_method
2572              match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2573              for a_deplib in $deplibs; do
2574                name="`expr $a_deplib : '-l\(.*\)'`"
2575                # If $name is empty we are operating on a -L argument.
2576                if test -n "$name" && test "$name" != "0"; then
2577                  libname=`eval \\$echo \"$libname_spec\"`
2578                  for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2579                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2580                    for potent_lib in $potential_libs; do
2581                      if eval echo \"$potent_lib\" 2>/dev/null \
2582                          | sed 10q \
2583                          | egrep "$match_pattern_regex" > /dev/null; then
2584                        newdeplibs="$newdeplibs $a_deplib"
2585                        a_deplib=""
2586                        break 2
2587                      fi
2588                    done
2589                  done
2590                  if test -n "$a_deplib" ; then
2591                    droppeddeps=yes
2592                    echo
2593                    echo "*** Warning: This library needs some functionality provided by $a_deplib."
2594                    echo "*** I have the capability to make that library automatically link in when"
2595                    echo "*** you link to this library.  But I can only do this if you have a"
2596                    echo "*** shared version of the library, which you do not appear to have."
2597                  fi
2598                else
2599                  # Add a -L argument.
2600                  newdeplibs="$newdeplibs $a_deplib"
2601                fi
2602              done # Gone through all deplibs.
2603              ;;
2604          none | unknown | *)          none | unknown | *)
2605            newdeplibs=""            newdeplibs=""
2606            if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \            if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
# Line 1996  EOF Line 2623  EOF
2623          libname=$libname_save          libname=$libname_save
2624          name=$name_save          name=$name_save
2625    
2626            case $host in
2627            *-*-rhapsody* | *-*-darwin1.[012])
2628              # On Rhapsody replace the C library is the System framework
2629              newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2630              ;;
2631            esac
2632    
2633          if test "$droppeddeps" = yes; then          if test "$droppeddeps" = yes; then
2634            if test "$module" = yes; then            if test "$module" = yes; then
2635              echo              echo
# Line 2021  EOF Line 2655  EOF
2655              echo "*** The inter-library dependencies that have been dropped here will be"              echo "*** The inter-library dependencies that have been dropped here will be"
2656              echo "*** automatically added whenever a program is linked with this library"              echo "*** automatically added whenever a program is linked with this library"
2657              echo "*** or is declared to -dlopen it."              echo "*** or is declared to -dlopen it."
2658    
2659                if test $allow_undefined = no; then
2660                  echo
2661                  echo "*** Since this library must not contain undefined symbols,"
2662                  echo "*** because either the platform does not support them or"
2663                  echo "*** it was explicitly requested with -no-undefined,"
2664                  echo "*** libtool will only create a static version of it."
2665                  if test "$build_old_libs" = no; then
2666                    oldlibs="$output_objdir/$libname.$libext"
2667                    build_libtool_libs=module
2668                    build_old_libs=yes
2669                  else
2670                    build_libtool_libs=no
2671                  fi
2672                fi
2673            fi            fi
2674          fi          fi
2675          # Done checking deplibs!          # Done checking deplibs!
# Line 2031  EOF Line 2680  EOF
2680        library_names=        library_names=
2681        old_library=        old_library=
2682        dlname=        dlname=
2683    
2684        # Test again, we may have decided not to build it any more        # Test again, we may have decided not to build it any more
2685        if test "$build_libtool_libs" = yes; then        if test "$build_libtool_libs" = yes; then
2686            if test $hardcode_into_libs = yes; then
2687              # Hardcode the library paths
2688              hardcode_libdirs=
2689              dep_rpath=
2690              rpath="$finalize_rpath"
2691              test "$mode" != relink && rpath="$compile_rpath$rpath"
2692              for libdir in $rpath; do
2693                if test -n "$hardcode_libdir_flag_spec"; then
2694                  if test -n "$hardcode_libdir_separator"; then
2695                    if test -z "$hardcode_libdirs"; then
2696                      hardcode_libdirs="$libdir"
2697                    else
2698                      # Just accumulate the unique libdirs.
2699                      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2700                      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2701                        ;;
2702                      *)
2703                        hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2704                        ;;
2705                      esac
2706                    fi
2707                  else
2708                    eval flag=\"$hardcode_libdir_flag_spec\"
2709                    dep_rpath="$dep_rpath $flag"
2710                  fi
2711                elif test -n "$runpath_var"; then
2712                  case "$perm_rpath " in
2713                  *" $libdir "*) ;;
2714                  *) perm_rpath="$perm_rpath $libdir" ;;
2715                  esac
2716                fi
2717              done
2718              # Substitute the hardcoded libdirs into the rpath.
2719              if test -n "$hardcode_libdir_separator" &&
2720                 test -n "$hardcode_libdirs"; then
2721                libdir="$hardcode_libdirs"
2722                eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2723              fi
2724              if test -n "$runpath_var" && test -n "$perm_rpath"; then
2725                # We should set the runpath_var.
2726                rpath=
2727                for dir in $perm_rpath; do
2728                  rpath="$rpath$dir:"
2729                done
2730                eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2731              fi
2732              test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2733            fi
2734    
2735            shlibpath="$finalize_shlibpath"
2736            test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2737            if test -n "$shlibpath"; then
2738              eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2739            fi
2740    
2741          # Get the real and link names of the library.          # Get the real and link names of the library.
2742          eval library_names=\"$library_names_spec\"          eval library_names=\"$library_names_spec\"
2743          set dummy $library_names          set dummy $library_names
# Line 2045  EOF Line 2749  EOF
2749          else          else
2750            soname="$realname"            soname="$realname"
2751          fi          fi
2752            test -z "$dlname" && dlname=$soname
2753    
2754          lib="$output_objdir/$realname"          lib="$output_objdir/$realname"
2755          for link          for link
# Line 2116  EOF Line 2821  EOF
2821    
2822              for xlib in $convenience; do              for xlib in $convenience; do
2823                # Extract the objects.                # Extract the objects.
2824                case "$xlib" in                case $xlib in
2825                [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;                [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2826                *) xabs=`pwd`"/$xlib" ;;                *) xabs=`pwd`"/$xlib" ;;
2827                esac                esac
# Line 2141  EOF Line 2846  EOF
2846    
2847          if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then          if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2848            eval flag=\"$thread_safe_flag_spec\"            eval flag=\"$thread_safe_flag_spec\"
2849            linkopts="$linkopts $flag"            linker_flags="$linker_flags $flag"
2850            fi
2851    
2852            # Make a backup of the uninstalled library when relinking
2853            if test "$mode" = relink; then
2854              $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2855          fi          fi
2856    
2857          # Do each of the archive commands.          # Do each of the archive commands.
# Line 2158  EOF Line 2868  EOF
2868          done          done
2869          IFS="$save_ifs"          IFS="$save_ifs"
2870    
2871            # Restore the uninstalled library and exit
2872            if test "$mode" = relink; then
2873              $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2874              exit 0
2875            fi
2876    
2877          # Create links to the real library.          # Create links to the real library.
2878          for linkname in $linknames; do          for linkname in $linknames; do
2879            if test "$realname" != "$linkname"; then            if test "$realname" != "$linkname"; then
# Line 2174  EOF Line 2890  EOF
2890        fi        fi
2891        ;;        ;;
2892    
2893      *.lo | *.o | *.obj)      obj)
       if test -n "$link_against_libtool_libs"; then  
         $echo "$modename: error: cannot link libtool libraries into objects" 1>&2  
         exit 1  
       fi  
   
2894        if test -n "$deplibs"; then        if test -n "$deplibs"; then
2895          $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2          $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2896        fi        fi
# Line 2204  EOF Line 2915  EOF
2915          $echo "$modename: warning: \`-release' is ignored for objects" 1>&2          $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2916        fi        fi
2917    
2918        case "$output" in        case $output in
2919        *.lo)        *.lo)
2920          if test -n "$objs"; then          if test -n "$objs$old_deplibs"; then
2921            $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2            $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2922            exit 1            exit 1
2923          fi          fi
# Line 2230  EOF Line 2941  EOF
2941        gentop=        gentop=
2942        # reload_cmds runs $LD directly, so let us get rid of        # reload_cmds runs $LD directly, so let us get rid of
2943        # -Wl from whole_archive_flag_spec        # -Wl from whole_archive_flag_spec
2944        wl=        wl=
2945    
2946        if test -n "$convenience"; then        if test -n "$convenience"; then
2947          if test -n "$whole_archive_flag_spec"; then          if test -n "$whole_archive_flag_spec"; then
# Line 2249  EOF Line 2960  EOF
2960    
2961            for xlib in $convenience; do            for xlib in $convenience; do
2962              # Extract the objects.              # Extract the objects.
2963              case "$xlib" in              case $xlib in
2964              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2965              *) xabs=`pwd`"/$xlib" ;;              *) xabs=`pwd`"/$xlib" ;;
2966              esac              esac
# Line 2273  EOF Line 2984  EOF
2984        fi        fi
2985    
2986        # Create the old-style object.        # Create the old-style object.
2987        reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"        reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
2988    
2989        output="$obj"        output="$obj"
2990        eval cmds=\"$reload_cmds\"        eval cmds=\"$reload_cmds\"
# Line 2308  EOF Line 3019  EOF
3019          exit 0          exit 0
3020        fi        fi
3021    
3022        if test -n "$pic_flag"; then        if test -n "$pic_flag" || test "$pic_mode" != default; then
3023          # Only do commands if we really have different PIC objects.          # Only do commands if we really have different PIC objects.
3024          reload_objs="$libobjs $reload_conv_objs"          reload_objs="$libobjs $reload_conv_objs"
3025          output="$libobj"          output="$libobj"
# Line 2344  EOF Line 3055  EOF
3055        exit 0        exit 0
3056        ;;        ;;
3057    
3058      # Anything else should be a program.      prog)
3059      *)        case $host in
3060            *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3061          esac
3062        if test -n "$vinfo"; then        if test -n "$vinfo"; then
3063          $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2          $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3064        fi        fi
# Line 2355  EOF Line 3068  EOF
3068        fi        fi
3069    
3070        if test "$preload" = yes; then        if test "$preload" = yes; then
3071          if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&          if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3072             test "$dlopen_self_static" = unknown; then             test "$dlopen_self_static" = unknown; then
3073            $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."            $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3074          fi          fi
3075        fi        fi
3076    
3077          case $host in
3078          *-*-rhapsody* | *-*-darwin1.[012])
3079            # On Rhapsody replace the C library is the System framework
3080            compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3081            finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3082            ;;
3083          esac
3084    
3085          compile_command="$compile_command $compile_deplibs"
3086          finalize_command="$finalize_command $finalize_deplibs"
3087    
3088        if test -n "$rpath$xrpath"; then        if test -n "$rpath$xrpath"; then
3089          # If the user specified any rpath flags, then add them.          # If the user specified any rpath flags, then add them.
3090          for libdir in $rpath $xrpath; do          for libdir in $rpath $xrpath; do
3091            # This is the magic to use -rpath.            # This is the magic to use -rpath.
           case "$compile_rpath " in  
           *" $libdir "*) ;;  
           *) compile_rpath="$compile_rpath $libdir" ;;  
           esac  
3092            case "$finalize_rpath " in            case "$finalize_rpath " in
3093            *" $libdir "*) ;;            *" $libdir "*) ;;
3094            *) finalize_rpath="$finalize_rpath $libdir" ;;            *) finalize_rpath="$finalize_rpath $libdir" ;;
# Line 2386  EOF Line 3106  EOF
3106                hardcode_libdirs="$libdir"                hardcode_libdirs="$libdir"
3107              else              else
3108                # Just accumulate the unique libdirs.                # Just accumulate the unique libdirs.
3109                case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in                case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3110                *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)                *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3111                  ;;                  ;;
3112                *)                *)
# Line 2404  EOF Line 3124  EOF
3124            *) perm_rpath="$perm_rpath $libdir" ;;            *) perm_rpath="$perm_rpath $libdir" ;;
3125            esac            esac
3126          fi          fi
3127            case $host in
3128            *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3129              case :$dllsearchpath: in
3130              *":$libdir:"*) ;;
3131              *) dllsearchpath="$dllsearchpath:$libdir";;
3132              esac
3133              ;;
3134            esac
3135        done        done
3136        # Substitute the hardcoded libdirs into the rpath.        # Substitute the hardcoded libdirs into the rpath.
3137        if test -n "$hardcode_libdir_separator" &&        if test -n "$hardcode_libdir_separator" &&
# Line 2422  EOF Line 3150  EOF
3150                hardcode_libdirs="$libdir"                hardcode_libdirs="$libdir"
3151              else              else
3152                # Just accumulate the unique libdirs.                # Just accumulate the unique libdirs.
3153                case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in                case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3154                *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)                *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3155                  ;;                  ;;
3156                *)                *)
# Line 2449  EOF Line 3177  EOF
3177        fi        fi
3178        finalize_rpath="$rpath"        finalize_rpath="$rpath"
3179    
       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`  
       if test "X$output_objdir" = "X$output"; then  
         output_objdir="$objdir"  
       else  
         output_objdir="$output_objdir/$objdir"  
       fi  
   
       # Create the binary in the object directory, then wrap it.  
       if test ! -d $output_objdir; then  
         $show "$mkdir $output_objdir"  
         $run $mkdir $output_objdir  
         status=$?  
         if test $status -ne 0 && test ! -d $output_objdir; then  
           exit $status  
         fi  
       fi  
   
3180        if test -n "$libobjs" && test "$build_old_libs" = yes; then        if test -n "$libobjs" && test "$build_old_libs" = yes; then
3181          # Transform all the library objects into standard objects.          # Transform all the library objects into standard objects.
3182          compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`          compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
# Line 2482  EOF Line 3193  EOF
3193        fi        fi
3194    
3195        if test -n "$dlsyms"; then        if test -n "$dlsyms"; then
3196          case "$dlsyms" in          case $dlsyms in
3197          "") ;;          "") ;;
3198          *.c)          *.c)
3199            # Discover the nlist of each of the dlfiles.            # Discover the nlist of each of the dlfiles.
# Line 2514  extern \"C\" { Line 3225  extern \"C\" {
3225              test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"              test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3226    
3227              # Add our own program objects to the symbol list.              # Add our own program objects to the symbol list.
3228              progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`              progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3229              for arg in $progfiles; do              for arg in $progfiles; do
3230                $show "extracting global C symbols from \`$arg'"                $show "extracting global C symbols from \`$arg'"
3231                $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"                $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
# Line 2524  extern \"C\" { Line 3235  extern \"C\" {
3235                $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'                $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3236                $run eval '$mv "$nlist"T "$nlist"'                $run eval '$mv "$nlist"T "$nlist"'
3237              fi              fi
3238    
3239              if test -n "$export_symbols_regex"; then              if test -n "$export_symbols_regex"; then
3240                $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'                $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3241                $run eval '$mv "$nlist"T "$nlist"'                $run eval '$mv "$nlist"T "$nlist"'
# Line 2613  static const void *lt_preloaded_setup() Line 3324  static const void *lt_preloaded_setup()
3324            fi            fi
3325    
3326            pic_flag_for_symtable=            pic_flag_for_symtable=
3327            case "$host" in            case $host in
3328            # compiling the symbol table file with pic_flag works around            # compiling the symbol table file with pic_flag works around
3329            # a FreeBSD bug that causes programs to crash when -lm is            # a FreeBSD bug that causes programs to crash when -lm is
3330            # linked before any other PIC object.  But we must not use            # linked before any other PIC object.  But we must not use
3331            # pic_flag when linking with -static.  The problem exists in            # pic_flag when linking with -static.  The problem exists in
3332            # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.            # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3333            *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)            *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3334              case "$compile_command " in              case "$compile_command " in
3335              *" -static "*) ;;              *" -static "*) ;;
3336              *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;              *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
# Line 2658  static const void *lt_preloaded_setup() Line 3369  static const void *lt_preloaded_setup()
3369          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3370        fi        fi
3371    
3372        if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then        if test $need_relink = no || test "$build_libtool_libs" != yes; then
3373          # Replace the output file specification.          # Replace the output file specification.
3374          compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`          compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3375          link_command="$compile_command$compile_rpath"          link_command="$compile_command$compile_rpath"
# Line 2667  static const void *lt_preloaded_setup() Line 3378  static const void *lt_preloaded_setup()
3378          $show "$link_command"          $show "$link_command"
3379          $run eval "$link_command"          $run eval "$link_command"
3380          status=$?          status=$?
3381    
3382          # Delete the generated files.          # Delete the generated files.
3383          if test -n "$dlsyms"; then          if test -n "$dlsyms"; then
3384            $show "$rm $output_objdir/${outputname}S.${objext}"            $show "$rm $output_objdir/${outputname}S.${objext}"
# Line 2681  static const void *lt_preloaded_setup() Line 3392  static const void *lt_preloaded_setup()
3392          # We should set the shlibpath_var          # We should set the shlibpath_var
3393          rpath=          rpath=
3394          for dir in $temp_rpath; do          for dir in $temp_rpath; do
3395            case "$dir" in            case $dir in
3396            [\\/]* | [A-Za-z]:[\\/]*)            [\\/]* | [A-Za-z]:[\\/]*)
3397              # Absolute path.              # Absolute path.
3398              rpath="$rpath$dir:"              rpath="$rpath$dir:"
# Line 2723  static const void *lt_preloaded_setup() Line 3434  static const void *lt_preloaded_setup()
3434          fi          fi
3435        fi        fi
3436    
3437          if test "$no_install" = yes; then
3438            # We don't need to create a wrapper script.
3439            link_command="$compile_var$compile_command$compile_rpath"
3440            # Replace the output file specification.
3441            link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3442            # Delete the old output file.
3443            $run $rm $output
3444            # Link the executable and exit
3445            $show "$link_command"
3446            $run eval "$link_command" || exit $?
3447            exit 0
3448          fi
3449    
3450        if test "$hardcode_action" = relink; then        if test "$hardcode_action" = relink; then
3451          # Fast installation is not supported          # Fast installation is not supported
3452          link_command="$compile_var$compile_command$compile_rpath"          link_command="$compile_var$compile_command$compile_rpath"
3453          relink_command="$finalize_var$finalize_command$finalize_rpath"          relink_command="$finalize_var$finalize_command$finalize_rpath"
3454    
3455          $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2          $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3456          $echo "$modename: \`$output' will be relinked during installation" 1>&2          $echo "$modename: \`$output' will be relinked during installation" 1>&2
3457        else        else
# Line 2747  static const void *lt_preloaded_setup() Line 3471  static const void *lt_preloaded_setup()
3471    
3472        # Replace the output file specification.        # Replace the output file specification.
3473        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3474    
3475        # Delete the old output files.        # Delete the old output files.
3476        $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname        $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3477    
# Line 2759  static const void *lt_preloaded_setup() Line 3483  static const void *lt_preloaded_setup()
3483    
3484        # Quote the relink command for shipping.        # Quote the relink command for shipping.
3485        if test -n "$relink_command"; then        if test -n "$relink_command"; then
3486            # Preserve any variables that may affect compiler behavior
3487            for var in $variables_saved_for_relink; do
3488              if eval test -z \"\${$var+set}\"; then
3489                relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3490              elif eval var_value=\$$var; test -z "$var_value"; then
3491                relink_command="$var=; export $var; $relink_command"
3492              else
3493                var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3494                relink_command="$var=\"$var_value\"; export $var; $relink_command"
3495              fi
3496            done
3497            relink_command="cd `pwd`; $relink_command"
3498          relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`          relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3499        fi        fi
3500    
3501        # Quote $echo for shipping.        # Quote $echo for shipping.
3502        if test "X$echo" = "X$SHELL $0 --fallback-echo"; then        if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3503          case "$0" in          case $0 in
3504          [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;          [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3505          *) qecho="$SHELL `pwd`/$0 --fallback-echo";;          *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3506          esac          esac
# Line 2780  static const void *lt_preloaded_setup() Line 3516  static const void *lt_preloaded_setup()
3516          case $output in          case $output in
3517            *.exe) output=`echo $output|sed 's,.exe$,,'` ;;            *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3518          esac          esac
3519            # test for cygwin because mv fails w/o .exe extensions
3520            case $host in
3521              *cygwin*) exeext=.exe ;;
3522              *) exeext= ;;
3523            esac
3524          $rm $output          $rm $output
3525          trap "$rm $output; exit 1" 1 2 15          trap "$rm $output; exit 1" 1 2 15
3526    
# Line 2809  relink_command=\"$relink_command\" Line 3550  relink_command=\"$relink_command\"
3550  # This environment variable determines our operation mode.  # This environment variable determines our operation mode.
3551  if test \"\$libtool_install_magic\" = \"$magic\"; then  if test \"\$libtool_install_magic\" = \"$magic\"; then
3552    # install mode needs the following variable:    # install mode needs the following variable:
3553    link_against_libtool_libs='$link_against_libtool_libs'    notinst_deplibs='$notinst_deplibs'
3554  else  else
3555    # When we are sourced in execute mode, \$file and \$echo are already set.    # When we are sourced in execute mode, \$file and \$echo are already set.
3556    if test \"\$libtool_execute_magic\" != \"$magic\"; then    if test \"\$libtool_execute_magic\" != \"$magic\"; then
# Line 2842  else Line 3583  else
3583      # If there was a directory component, then change thisdir.      # If there was a directory component, then change thisdir.
3584      if test \"x\$destdir\" != \"x\$file\"; then      if test \"x\$destdir\" != \"x\$file\"; then
3585        case \"\$destdir\" in        case \"\$destdir\" in
3586        [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;        [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3587        *) thisdir=\"\$thisdir/\$destdir\" ;;        *) thisdir=\"\$thisdir/\$destdir\" ;;
3588        esac        esac
3589      fi      fi
# Line 2858  else Line 3599  else
3599    
3600          if test "$fast_install" = yes; then          if test "$fast_install" = yes; then
3601            echo >> $output "\            echo >> $output "\
3602    program=lt-'$outputname'    program=lt-'$outputname'$exeext
3603    progdir=\"\$thisdir/$objdir\"    progdir=\"\$thisdir/$objdir\"
3604    
3605    if test ! -f \"\$progdir/\$program\" || \\    if test ! -f \"\$progdir/\$program\" || \\
3606       { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\       { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3607         test \"X\$file\" != \"X\$progdir/\$program\"; }; then         test \"X\$file\" != \"X\$progdir/\$program\"; }; then
# Line 2877  else Line 3618  else
3618    
3619      # relink executable if necessary      # relink executable if necessary
3620      if test -n \"\$relink_command\"; then      if test -n \"\$relink_command\"; then
3621        if (cd \"\$thisdir\" && eval \$relink_command); then :        if (eval \$relink_command); then :
3622        else        else
3623          $rm \"\$progdir/\$file\"          $rm \"\$progdir/\$file\"
3624          exit 1          exit 1
# Line 2927  else Line 3668  else
3668        # Run the actual program with our arguments.        # Run the actual program with our arguments.
3669  "  "
3670          case $host in          case $host in
3671          *-*-cygwin* | *-*-mingw | *-*-os2*)          # win32 systems need to use the prog path for dll
3672            # win32 systems need to use the prog path for dll          # lookup to work
3673            # lookup to work          *-*-cygwin* | *-*-pw32*)
3674              $echo >> $output "\
3675          exec \$progdir/\$program \${1+\"\$@\"}
3676    "
3677              ;;
3678    
3679            # Backslashes separate directories on plain windows
3680            *-*-mingw | *-*-os2*)
3681            $echo >> $output "\            $echo >> $output "\
3682        exec \$progdir\\\\\$program \${1+\"\$@\"}        exec \$progdir\\\\\$program \${1+\"\$@\"}
3683  "  "
3684            ;;            ;;
3685    
3686          *)          *)
3687            $echo >> $output "\            $echo >> $output "\
3688        # Export the path to the program.        # Export the path to the program.
# Line 2975  fi\ Line 3724  fi\
3724            oldobjs="$libobjs_save"            oldobjs="$libobjs_save"
3725            build_libtool_libs=no            build_libtool_libs=no
3726          else          else
3727            oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`            oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3728          fi          fi
3729          addlibs="$old_convenience"          addlibs="$old_convenience"
3730        fi        fi
# Line 2991  fi\ Line 3740  fi\
3740            exit $status            exit $status
3741          fi          fi
3742          generated="$generated $gentop"          generated="$generated $gentop"
3743    
3744          # Add in members from convenience archives.          # Add in members from convenience archives.
3745          for xlib in $addlibs; do          for xlib in $addlibs; do
3746            # Extract the objects.            # Extract the objects.
3747            case "$xlib" in            case $xlib in
3748            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3749            *) xabs=`pwd`"/$xlib" ;;            *) xabs=`pwd`"/$xlib" ;;
3750            esac            esac
# Line 3056  fi\ Line 3805  fi\
3805      fi      fi
3806    
3807      # Now create the libtool archive.      # Now create the libtool archive.
3808      case "$output" in      case $output in
3809      *.la)      *.la)
3810        old_library=        old_library=
3811        test "$build_old_libs" = yes && old_library="$libname.$libext"        test "$build_old_libs" = yes && old_library="$libname.$libext"
3812        $show "creating $output"        $show "creating $output"
3813    
3814        if test -n "$xrpath"; then        # Preserve any variables that may affect compiler behavior
3815          temp_xrpath=        for var in $variables_saved_for_relink; do
3816          for libdir in $xrpath; do          if eval test -z \"\${$var+set}\"; then
3817            temp_xrpath="$temp_xrpath -R$libdir"            relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3818          done          elif eval var_value=\$$var; test -z "$var_value"; then
3819          dependency_libs="$temp_xrpath $dependency_libs"            relink_command="$var=; export $var; $relink_command"
3820        fi          else
3821              var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3822              relink_command="$var=\"$var_value\"; export $var; $relink_command"
3823            fi
3824          done
3825          # Quote the link command for shipping.
3826          relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3827          relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3828    
3829        # Only create the output if not a dry run.        # Only create the output if not a dry run.
3830        if test -z "$run"; then        if test -z "$run"; then
# Line 3078  fi\ Line 3834  fi\
3834                break                break
3835              fi              fi
3836              output="$output_objdir/$outputname"i              output="$output_objdir/$outputname"i
3837                # Replace all uninstalled libtool libraries with the installed ones
3838                newdependency_libs=
3839                for deplib in $dependency_libs; do
3840                  case $deplib in
3841                  *.la)
3842                    name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3843                    eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3844                    if test -z "$libdir"; then
3845                      $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3846                      exit 1
3847                    fi
3848                    newdependency_libs="$newdependency_libs $libdir/$name"
3849                    ;;
3850                  *) newdependency_libs="$newdependency_libs $deplib" ;;
3851                  esac
3852                done
3853                dependency_libs="$newdependency_libs"
3854                newdlfiles=
3855                for lib in $dlfiles; do
3856                  name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3857                  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3858                  if test -z "$libdir"; then
3859                    $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3860                    exit 1
3861                  fi
3862                  newdlfiles="$newdlfiles $libdir/$name"
3863                done
3864                dlfiles="$newdlfiles"
3865                newdlprefiles=
3866                for lib in $dlprefiles; do
3867                  name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3868                  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3869                  if test -z "$libdir"; then
3870                    $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3871                    exit 1
3872                  fi
3873                  newdlprefiles="$newdlprefiles $libdir/$name"
3874                done
3875                dlprefiles="$newdlprefiles"
3876            fi            fi
3877            $rm $output            $rm $output
3878              # place dlname in correct position for cygwin
3879              tdlname=$dlname
3880              case $host,$output,$installed,$module,$dlname in
3881                *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3882              esac
3883            $echo > $output "\            $echo > $output "\
3884  # $outputname - a libtool library file  # $outputname - a libtool library file
3885  # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP  # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
# Line 3088  fi\ Line 3888  fi\
3888  # It is necessary for linking the library.  # It is necessary for linking the library.
3889    
3890  # The name that we can dlopen(3).  # The name that we can dlopen(3).
3891  dlname='$dlname'  dlname='$tdlname'
3892    
3893  # Names of this library.  # Names of this library.
3894  library_names='$library_names'  library_names='$library_names'
# Line 3107  revision=$revision Line 3907  revision=$revision
3907  # Is this an already installed library?  # Is this an already installed library?
3908  installed=$installed  installed=$installed
3909    
3910    # Files to dlopen/dlpreopen
3911    dlopen='$dlfiles'
3912    dlpreopen='$dlprefiles'
3913    
3914  # Directory that this library needs to be installed in:  # Directory that this library needs to be installed in:
3915  libdir='$install_libdir'\  libdir='$install_libdir'"
3916  "            if test "$installed" = no && test $need_relink = yes; then
3917                $echo >> $output "\
3918    relink_command=\"$relink_command\""
3919              fi
3920          done          done
3921        fi        fi
3922    
3923        # Do a symbolic link so that the libtool archive can be found in        # Do a symbolic link so that the libtool archive can be found in
3924        # LD_LIBRARY_PATH before the program is installed.        # LD_LIBRARY_PATH before the program is installed.
3925        $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"        $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3926        $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?        $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3927        ;;        ;;
3928      esac      esac
3929      exit 0      exit 0
# Line 3128  libdir='$install_libdir'\ Line 3935  libdir='$install_libdir'\
3935    
3936      # There may be an optional sh(1) argument at the beginning of      # There may be an optional sh(1) argument at the beginning of
3937      # install_prog (especially on Windows NT).      # install_prog (especially on Windows NT).
3938      if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then      if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3939           # Allow the use of GNU shtool's install command.
3940           $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3941        # Aesthetically quote it.        # Aesthetically quote it.
3942        arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`        arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3943        case "$arg" in        case $arg in
3944        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
3945          arg="\"$arg\""          arg="\"$arg\""
3946          ;;          ;;
# Line 3147  libdir='$install_libdir'\ Line 3956  libdir='$install_libdir'\
3956      # The real first argument should be the name of the installation program.      # The real first argument should be the name of the installation program.
3957      # Aesthetically quote it.      # Aesthetically quote it.
3958      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3959      case "$arg" in      case $arg in
3960      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
3961        arg="\"$arg\""        arg="\"$arg\""
3962        ;;        ;;
# Line 3170  libdir='$install_libdir'\ Line 3979  libdir='$install_libdir'\
3979          continue          continue
3980        fi        fi
3981    
3982        case "$arg" in        case $arg in
3983        -d) isdir=yes ;;        -d) isdir=yes ;;
3984        -f) prev="-f" ;;        -f) prev="-f" ;;
3985        -g) prev="-g" ;;        -g) prev="-g" ;;
# Line 3195  libdir='$install_libdir'\ Line 4004  libdir='$install_libdir'\
4004    
4005        # Aesthetically quote the argument.        # Aesthetically quote the argument.
4006        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4007        case "$arg" in        case $arg in
4008        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
4009          arg="\"$arg\""          arg="\"$arg\""
4010          ;;          ;;
# Line 3246  libdir='$install_libdir'\ Line 4055  libdir='$install_libdir'\
4055          exit 1          exit 1
4056        fi        fi
4057      fi      fi
4058      case "$destdir" in      case $destdir in
4059      [\\/]* | [A-Za-z]:[\\/]*) ;;      [\\/]* | [A-Za-z]:[\\/]*) ;;
4060      *)      *)
4061        for file in $files; do        for file in $files; do
4062          case "$file" in          case $file in
4063          *.lo) ;;          *.lo) ;;
4064          *)          *)
4065            $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2            $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
# Line 3272  libdir='$install_libdir'\ Line 4081  libdir='$install_libdir'\
4081      for file in $files; do      for file in $files; do
4082    
4083        # Do each installation.        # Do each installation.
4084        case "$file" in        case $file in
4085        *.a | *.lib)        *.$libext)
4086          # Do the static libraries later.          # Do the static libraries later.
4087          staticlibs="$staticlibs $file"          staticlibs="$staticlibs $file"
4088          ;;          ;;
# Line 3289  libdir='$install_libdir'\ Line 4098  libdir='$install_libdir'\
4098    
4099          library_names=          library_names=
4100          old_library=          old_library=
4101            relink_command=
4102          # If there is no directory component, then add one.          # If there is no directory component, then add one.
4103          case "$file" in          case $file in
4104          */* | *\\*) . $file ;;          */* | *\\*) . $file ;;
4105          *) . ./$file ;;          *) . ./$file ;;
4106          esac          esac
# Line 3309  libdir='$install_libdir'\ Line 4119  libdir='$install_libdir'\
4119            esac            esac
4120          fi          fi
4121    
4122          dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"          dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4123          test "X$dir" = "X$file/" && dir=          test "X$dir" = "X$file/" && dir=
4124          dir="$dir$objdir"          dir="$dir$objdir"
4125    
4126            if test -n "$relink_command"; then
4127              $echo "$modename: warning: relinking \`$file'" 1>&2
4128              $show "$relink_command"
4129              if $run eval "$relink_command"; then :
4130              else
4131                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4132                continue
4133              fi
4134            fi
4135    
4136          # See the names of the shared library.          # See the names of the shared library.
4137          set dummy $library_names          set dummy $library_names
4138          if test -n "$2"; then          if test -n "$2"; then
# Line 3320  libdir='$install_libdir'\ Line 4140  libdir='$install_libdir'\
4140            shift            shift
4141            shift            shift
4142    
4143              srcname="$realname"
4144              test -n "$relink_command" && srcname="$realname"T
4145    
4146            # Install the shared library and build the symlinks.            # Install the shared library and build the symlinks.
4147            $show "$install_prog $dir/$realname $destdir/$realname"            $show "$install_prog $dir/$srcname $destdir/$realname"
4148            $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?            $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4149              if test -n "$stripme" && test -n "$striplib"; then
4150                $show "$striplib $destdir/$realname"
4151                $run eval "$striplib $destdir/$realname" || exit $?
4152              fi
4153    
4154            if test $# -gt 0; then            if test $# -gt 0; then
4155              # Delete the old symlinks, and create new ones.              # Delete the old symlinks, and create new ones.
# Line 3369  libdir='$install_libdir'\ Line 4196  libdir='$install_libdir'\
4196          fi          fi
4197    
4198          # Deduce the name of the destination old-style object file.          # Deduce the name of the destination old-style object file.
4199          case "$destfile" in          case $destfile in
4200          *.lo)          *.lo)
4201            staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`            staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4202            ;;            ;;
4203          *.o | *.obj)          *.$objext)
4204            staticdest="$destfile"            staticdest="$destfile"
4205            destfile=            destfile=
4206            ;;            ;;
# Line 3412  libdir='$install_libdir'\ Line 4239  libdir='$install_libdir'\
4239    
4240          # Do a test to see if this is really a libtool program.          # Do a test to see if this is really a libtool program.
4241          if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then          if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4242            link_against_libtool_libs=            notinst_deplibs=
4243            relink_command=            relink_command=
4244    
4245            # If there is no directory component, then add one.            # If there is no directory component, then add one.
4246            case "$file" in            case $file in
4247            */* | *\\*) . $file ;;            */* | *\\*) . $file ;;
4248            *) . ./$file ;;            *) . ./$file ;;
4249            esac            esac
4250    
4251            # Check the variables that should have been set.            # Check the variables that should have been set.
4252            if test -z "$link_against_libtool_libs"; then            if test -z "$notinst_deplibs"; then
4253              $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2              $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4254              exit 1              exit 1
4255            fi            fi
4256    
4257            finalize=yes            finalize=yes
4258            for lib in $link_against_libtool_libs; do            for lib in $notinst_deplibs; do
4259              # Check to see that each library is installed.              # Check to see that each library is installed.
4260              libdir=              libdir=
4261              if test -f "$lib"; then              if test -f "$lib"; then
4262                # If there is no directory component, then add one.                # If there is no directory component, then add one.
4263                case "$lib" in                case $lib in
4264                */* | *\\*) . $lib ;;                */* | *\\*) . $lib ;;
4265                *) . ./$lib ;;                *) . ./$lib ;;
4266                esac                esac
4267              fi              fi
4268              libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"              libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4269              if test -n "$libdir" && test ! -f "$libfile"; then              if test -n "$libdir" && test ! -f "$libfile"; then
4270                $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2                $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4271                finalize=no                finalize=no
4272              fi              fi
4273            done            done
4274    
4275              relink_command=
4276              # If there is no directory component, then add one.
4277              case $file in
4278              */* | *\\*) . $file ;;
4279              *) . ./$file ;;
4280              esac
4281    
4282            outputname=            outputname=
4283            if test "$fast_install" = no && test -n "$relink_command"; then            if test "$fast_install" = no && test -n "$relink_command"; then
4284              if test "$finalize" = yes && test -z "$run"; then              if test "$finalize" = yes && test -z "$run"; then
# Line 3456  libdir='$install_libdir'\ Line 4290  libdir='$install_libdir'\
4290                  $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2                  $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4291                  continue                  continue
4292                fi                fi
4293                  file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4294                outputname="$tmpdir/$file"                outputname="$tmpdir/$file"
4295                # Replace the output file specification.                # Replace the output file specification.
4296                relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`                relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
# Line 3477  libdir='$install_libdir'\ Line 4312  libdir='$install_libdir'\
4312            fi            fi
4313          fi          fi
4314    
4315            # remove .exe since cygwin /usr/bin/install will append another
4316            # one anyways
4317            case $install_prog,$host in
4318            /usr/bin/install*,*cygwin*)
4319              case $file:$destfile in
4320              *.exe:*.exe)
4321                # this is ok
4322                ;;
4323              *.exe:*)
4324                destfile=$destfile.exe
4325                ;;
4326              *:*.exe)
4327                destfile=`echo $destfile | sed -e 's,.exe$,,'`
4328                ;;
4329              esac
4330              ;;
4331            esac
4332          $show "$install_prog$stripme $file $destfile"          $show "$install_prog$stripme $file $destfile"
4333          $run eval "$install_prog\$stripme \$file \$destfile" || exit $?          $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4334          test -n "$outputname" && ${rm}r "$tmpdir"          test -n "$outputname" && ${rm}r "$tmpdir"
# Line 3493  libdir='$install_libdir'\ Line 4345  libdir='$install_libdir'\
4345        $show "$install_prog $file $oldlib"        $show "$install_prog $file $oldlib"
4346        $run eval "$install_prog \$file \$oldlib" || exit $?        $run eval "$install_prog \$file \$oldlib" || exit $?
4347    
4348          if test -n "$stripme" && test -n "$striplib"; then
4349            $show "$old_striplib $oldlib"
4350            $run eval "$old_striplib $oldlib" || exit $?
4351          fi
4352    
4353        # Do each command in the postinstall commands.        # Do each command in the postinstall commands.
4354        eval cmds=\"$old_postinstall_cmds\"        eval cmds=\"$old_postinstall_cmds\"
4355        IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'        IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
# Line 3553  libdir='$install_libdir'\ Line 4410  libdir='$install_libdir'\
4410      fi      fi
4411    
4412      # Exit here if they wanted silent mode.      # Exit here if they wanted silent mode.
4413      test "$show" = : && exit 0      test "$show" = ":" && exit 0
4414    
4415      echo "----------------------------------------------------------------------"      echo "----------------------------------------------------------------------"
4416      echo "Libraries have been installed in:"      echo "Libraries have been installed in:"
# Line 3563  libdir='$install_libdir'\ Line 4420  libdir='$install_libdir'\
4420      echo      echo
4421      echo "If you ever happen to want to link against installed libraries"      echo "If you ever happen to want to link against installed libraries"
4422      echo "in a given directory, LIBDIR, you must either use libtool, and"      echo "in a given directory, LIBDIR, you must either use libtool, and"
4423      echo "specify the full pathname of the library, or use \`-LLIBDIR'"      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4424      echo "flag during linking and do at least one of the following:"      echo "flag during linking and do at least one of the following:"
4425      if test -n "$shlibpath_var"; then      if test -n "$shlibpath_var"; then
4426        echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"        echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
# Line 3613  libdir='$install_libdir'\ Line 4470  libdir='$install_libdir'\
4470        fi        fi
4471    
4472        dir=        dir=
4473        case "$file" in        case $file in
4474        *.la)        *.la)
4475          # Check to see that this really is a libtool archive.          # Check to see that this really is a libtool archive.
4476          if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :          if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
# Line 3628  libdir='$install_libdir'\ Line 4485  libdir='$install_libdir'\
4485          library_names=          library_names=
4486    
4487          # If there is no directory component, then add one.          # If there is no directory component, then add one.
4488          case "$file" in          case $file in
4489          */* | *\\*) . $file ;;          */* | *\\*) . $file ;;
4490          *) . ./$file ;;          *) . ./$file ;;
4491          esac          esac
# Line 3683  libdir='$install_libdir'\ Line 4540  libdir='$install_libdir'\
4540      args=      args=
4541      for file      for file
4542      do      do
4543        case "$file" in        case $file in
4544        -*) ;;        -*) ;;
4545        *)        *)
4546          # Do a test to see if this is really a libtool program.          # Do a test to see if this is really a libtool program.
4547          if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then          if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4548            # If there is no directory component, then add one.            # If there is no directory component, then add one.
4549            case "$file" in            case $file in
4550            */* | *\\*) . $file ;;            */* | *\\*) . $file ;;
4551            *) . ./$file ;;            *) . ./$file ;;
4552            esac            esac
# Line 3706  libdir='$install_libdir'\ Line 4563  libdir='$install_libdir'\
4563    
4564      if test -z "$run"; then      if test -z "$run"; then
4565        if test -n "$shlibpath_var"; then        if test -n "$shlibpath_var"; then
4566          # Export the shlibpath_var.          # Export the shlibpath_var.
4567          eval "export $shlibpath_var"          eval "export $shlibpath_var"
4568        fi        fi
4569    
4570        # Restore saved enviroment variables        # Restore saved enviroment variables
# Line 3726  libdir='$install_libdir'\ Line 4583  libdir='$install_libdir'\
4583      else      else
4584        # Display what would be done.        # Display what would be done.
4585        if test -n "$shlibpath_var"; then        if test -n "$shlibpath_var"; then
4586          eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""          eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4587          $echo "export $shlibpath_var"          $echo "export $shlibpath_var"
4588        fi        fi
4589        $echo "$cmd$args"        $echo "$cmd$args"
4590        exit 0        exit 0
4591      fi      fi
4592      ;;      ;;
4593    
4594    # libtool uninstall mode    # libtool clean and uninstall mode
4595    uninstall)    clean | uninstall)
4596      modename="$modename: uninstall"      modename="$modename: $mode"
4597      rm="$nonopt"      rm="$nonopt"
4598      files=      files=
4599        rmforce=
4600        exit_status=0
4601    
4602        # This variable tells wrapper scripts just to set variables rather
4603        # than running their programs.
4604        libtool_install_magic="$magic"
4605    
4606      for arg      for arg
4607      do      do
4608        case "$arg" in        case $arg in
4609          -f) rm="$rm $arg"; rmforce=yes ;;
4610        -*) rm="$rm $arg" ;;        -*) rm="$rm $arg" ;;
4611        *) files="$files $arg" ;;        *) files="$files $arg" ;;
4612        esac        esac
# Line 3754  libdir='$install_libdir'\ Line 4618  libdir='$install_libdir'\
4618        exit 1        exit 1
4619      fi      fi
4620    
4621        rmdirs=
4622    
4623      for file in $files; do      for file in $files; do
4624        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4625        test "X$dir" = "X$file" && dir=.        if test "X$dir" = "X$file"; then
4626            dir=.
4627            objdir="$objdir"
4628          else
4629            objdir="$dir/$objdir"
4630          fi
4631        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4632          test $mode = uninstall && objdir="$dir"
4633    
4634          # Remember objdir for removal later, being careful to avoid duplicates
4635          if test $mode = clean; then
4636            case " $rmdirs " in
4637              *" $objdir "*) ;;
4638              *) rmdirs="$rmdirs $objdir" ;;
4639            esac
4640          fi
4641    
4642          # Don't error if the file doesn't exist and rm -f was used.
4643          if (test -L "$file") >/dev/null 2>&1 \
4644            || (test -h "$file") >/dev/null 2>&1 \
4645            || test -f "$file"; then
4646            :
4647          elif test -d "$file"; then
4648            exit_status=1
4649            continue
4650          elif test "$rmforce" = yes; then
4651            continue
4652          fi
4653    
4654        rmfiles="$file"        rmfiles="$file"
4655    
4656        case "$name" in        case $name in
4657        *.la)        *.la)
4658          # Possibly a libtool archive, so verify it.          # Possibly a libtool archive, so verify it.
4659          if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then          if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
# Line 3769  libdir='$install_libdir'\ Line 4661  libdir='$install_libdir'\
4661    
4662            # Delete the libtool libraries and symlinks.            # Delete the libtool libraries and symlinks.
4663            for n in $library_names; do            for n in $library_names; do
4664              rmfiles="$rmfiles $dir/$n"              rmfiles="$rmfiles $objdir/$n"
4665            done            done
4666            test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"            test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4667              test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
           $show "$rm $rmfiles"  
           $run $rm $rmfiles  
4668    
4669            if test -n "$library_names"; then            if test $mode = uninstall; then
4670              # Do each command in the postuninstall commands.              if test -n "$library_names"; then
4671              eval cmds=\"$postuninstall_cmds\"                # Do each command in the postuninstall commands.
4672              IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'                eval cmds=\"$postuninstall_cmds\"
4673              for cmd in $cmds; do                IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
4674                  for cmd in $cmds; do
4675                    IFS="$save_ifs"
4676                    $show "$cmd"
4677                    $run eval "$cmd"
4678                    if test $? != 0 && test "$rmforce" != yes; then
4679                      exit_status=1
4680                    fi
4681                  done
4682                IFS="$save_ifs"                IFS="$save_ifs"
4683                $show "$cmd"              fi
               $run eval "$cmd"  
             done  
             IFS="$save_ifs"  
           fi  
4684    
4685            if test -n "$old_library"; then              if test -n "$old_library"; then
4686              # Do each command in the old_postuninstall commands.                # Do each command in the old_postuninstall commands.
4687              eval cmds=\"$old_postuninstall_cmds\"                eval cmds=\"$old_postuninstall_cmds\"
4688              IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'                IFS="${IFS=       }"; save_ifs="$IFS"; IFS='~'
4689              for cmd in $cmds; do                for cmd in $cmds; do
4690                    IFS="$save_ifs"
4691                    $show "$cmd"
4692                    $run eval "$cmd"
4693                    if test $? != 0 && test "$rmforce" != yes; then
4694                      exit_status=1
4695                    fi
4696                  done
4697                IFS="$save_ifs"                IFS="$save_ifs"
4698                $show "$cmd"              fi
4699                $run eval "$cmd"              # FIXME: should reinstall the best remaining shared library.
             done  
             IFS="$save_ifs"  
4700            fi            fi
   
           # FIXME: should reinstall the best remaining shared library.  
4701          fi          fi
4702          ;;          ;;
4703    
# Line 3809  libdir='$install_libdir'\ Line 4706  libdir='$install_libdir'\
4706            oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`            oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4707            rmfiles="$rmfiles $dir/$oldobj"            rmfiles="$rmfiles $dir/$oldobj"
4708          fi          fi
         $show "$rm $rmfiles"  
         $run $rm $rmfiles  
4709          ;;          ;;
4710    
4711        *)        *)
4712          $show "$rm $rmfiles"          # Do a test to see if this is a libtool program.
4713          $run $rm $rmfiles          if test $mode = clean &&
4714               (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4715              relink_command=
4716              . $dir/$file
4717    
4718              rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4719              if test "$fast_install" = yes && test -n "$relink_command"; then
4720                rmfiles="$rmfiles $objdir/lt-$name"
4721              fi
4722            fi
4723          ;;          ;;
4724        esac        esac
4725          $show "$rm $rmfiles"
4726          $run $rm $rmfiles || exit_status=1
4727      done      done
4728      exit 0  
4729        # Try to remove the ${objdir}s in the directories where we deleted files
4730        for dir in $rmdirs; do
4731          if test -d "$dir"; then
4732            $show "rmdir $dir"
4733            $run rmdir $dir >/dev/null 2>&1
4734          fi
4735        done
4736    
4737        exit $exit_status
4738      ;;      ;;
4739    
4740    "")    "")
# Line 3835  libdir='$install_libdir'\ Line 4750  libdir='$install_libdir'\
4750  fi # test -z "$show_help"  fi # test -z "$show_help"
4751    
4752  # We need to display help for each of the modes.  # We need to display help for each of the modes.
4753  case "$mode" in  case $mode in
4754  "") $echo \  "") $echo \
4755  "Usage: $modename [OPTION]... [MODE-ARG]...  "Usage: $modename [OPTION]... [MODE-ARG]...
4756    
# Line 3854  Provide generalized library-building sup Line 4769  Provide generalized library-building sup
4769    
4770  MODE must be one of the following:  MODE must be one of the following:
4771    
4772          clean           remove files from the build directory
4773        compile         compile a source file into a libtool object        compile         compile a source file into a libtool object
4774        execute         automatically set library path, then run a program        execute         automatically set library path, then run a program
4775        finish          complete the installation of libtool libraries        finish          complete the installation of libtool libraries
# Line 3866  a more detailed description of MODE." Line 4782  a more detailed description of MODE."
4782    exit 0    exit 0
4783    ;;    ;;
4784    
4785    clean)
4786      $echo \
4787    "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4788    
4789    Remove files from the build directory.
4790    
4791    RM is the name of the program to use to delete files associated with each FILE
4792    (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
4793    to RM.
4794    
4795    If FILE is a libtool library, object or program, all the files associated
4796    with it are deleted. Otherwise, only FILE itself is deleted using RM."
4797      ;;
4798    
4799  compile)  compile)
4800    $echo \    $echo \
4801  "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE  "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
# Line 3875  Compile a source file into a libtool lib Line 4805  Compile a source file into a libtool lib
4805  This mode accepts the following additional options:  This mode accepts the following additional options:
4806    
4807    -o OUTPUT-FILE    set the output file name to OUTPUT-FILE    -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
4808      -prefer-pic       try to building PIC objects only
4809      -prefer-non-pic   try to building non-PIC objects only
4810    -static           always build a \`.o' file suitable for static linking    -static           always build a \`.o' file suitable for static linking
4811    
4812  COMPILE-COMMAND is a command to be used in creating a \`standard' object file  COMPILE-COMMAND is a command to be used in creating a \`standard' object file
# Line 3954  The following components of LINK-COMMAND Line 4886  The following components of LINK-COMMAND
4886    -LLIBDIR          search LIBDIR for required installed libraries    -LLIBDIR          search LIBDIR for required installed libraries
4887    -lNAME            OUTPUT-FILE requires the installed library libNAME    -lNAME            OUTPUT-FILE requires the installed library libNAME
4888    -module           build a library that can dlopened    -module           build a library that can dlopened
4889      -no-fast-install  disable the fast-install mode
4890      -no-install       link a not-installable executable
4891    -no-undefined     declare that a library does not refer to external symbols    -no-undefined     declare that a library does not refer to external symbols
4892    -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects    -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
4893    -release RELEASE  specify package release information    -release RELEASE  specify package release information

Legend:
Removed from v.41  
changed lines
  Added in v.53

  ViewVC Help
Powered by ViewVC 1.1.5