ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Mon, 06 Oct 2003 07:13:16 +0000
changeset 729 dac996d69abb
parent 608 d0fecf67cd93
child 730 0f4f974d0201
permissions -rw-r--r--
Updated libtool support so Mingw32 builds work.
     1 # ltmain.sh - Provide generalized library-building support services.
     2 # NOTE: Changing this file will not affect anything until you rerun configure.
     3 #
     4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
     5 # Free Software Foundation, Inc.
     6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
     7 #
     8 # This program is free software; you can redistribute it and/or modify
     9 # it under the terms of the GNU General Public License as published by
    10 # the Free Software Foundation; either version 2 of the License, or
    11 # (at your option) any later version.
    12 #
    13 # This program is distributed in the hope that it will be useful, but
    14 # WITHOUT ANY WARRANTY; without even the implied warranty of
    15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16 # General Public License for more details.
    17 #
    18 # You should have received a copy of the GNU General Public License
    19 # along with this program; if not, write to the Free Software
    20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    21 #
    22 # As a special exception to the GNU General Public License, if you
    23 # distribute this file as part of a program that contains a
    24 # configuration script generated by Autoconf, you may include it under
    25 # the same distribution terms that you use for the rest of that program.
    26 
    27 # Check that we have a working $echo.
    28 if test "X$1" = X--no-reexec; then
    29   # Discard the --no-reexec flag, and continue.
    30   shift
    31 elif test "X$1" = X--fallback-echo; then
    32   # Avoid inline document here, it may be left over
    33   :
    34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
    35   # Yippee, $echo works!
    36   :
    37 else
    38   # Restart under the correct shell, and then maybe $echo will work.
    39   exec $SHELL "$0" --no-reexec ${1+"$@"}
    40 fi
    41 
    42 if test "X$1" = X--fallback-echo; then
    43   # used as fallback echo
    44   shift
    45   cat <<EOF
    46 $*
    47 EOF
    48   exit 0
    49 fi
    50 
    51 # The name of this program.
    52 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
    53 modename="$progname"
    54 
    55 # Constants.
    56 PROGRAM=ltmain.sh
    57 PACKAGE=libtool
    58 VERSION=1.5
    59 TIMESTAMP=" (1.1220.2.1 2003/04/14 22:48:00)"
    60 
    61 default_mode=
    62 help="Try \`$progname --help' for more information."
    63 magic="%%%MAGIC variable%%%"
    64 mkdir="mkdir"
    65 mv="mv -f"
    66 rm="rm -f"
    67 
    68 # Sed substitution that helps us do robust quoting.  It backslashifies
    69 # metacharacters that are still active within double-quoted strings.
    70 Xsed="${SED}"' -e 1s/^X//'
    71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
    72 # test EBCDIC or ASCII
    73 case `echo A|od -x` in
    74  *[Cc]1*) # EBCDIC based system
    75   SP2NL="tr '\100' '\n'"
    76   NL2SP="tr '\r\n' '\100\100'"
    77   ;;
    78  *) # Assume ASCII based system
    79   SP2NL="tr '\040' '\012'"
    80   NL2SP="tr '\015\012' '\040\040'"
    81   ;;
    82 esac
    83 
    84 # NLS nuisances.
    85 # Only set LANG and LC_ALL to C if already set.
    86 # These must not be set unconditionally because not all systems understand
    87 # e.g. LANG=C (notably SCO).
    88 # We save the old values to restore during execute mode.
    89 if test "${LC_ALL+set}" = set; then
    90   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
    91 fi
    92 if test "${LANG+set}" = set; then
    93   save_LANG="$LANG"; LANG=C; export LANG
    94 fi
    95 
    96 # Make sure IFS has a sensible default
    97 : ${IFS=" 	"}
    98 
    99 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
   100   $echo "$modename: not configured to build any kind of library" 1>&2
   101   $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
   102   exit 1
   103 fi
   104 
   105 # Global variables.
   106 mode=$default_mode
   107 nonopt=
   108 prev=
   109 prevopt=
   110 run=
   111 show="$echo"
   112 show_help=
   113 execute_dlfiles=
   114 lo2o="s/\\.lo\$/.${objext}/"
   115 o2lo="s/\\.${objext}\$/.lo/"
   116 
   117 #####################################
   118 # Shell function definitions:
   119 # This seems to be the best place for them
   120 
   121 # Need a lot of goo to handle *both* DLLs and import libs
   122 # Has to be a shell function in order to 'eat' the argument
   123 # that is supplied when $file_magic_command is called.
   124 win32_libid () {
   125   win32_libid_type="unknown"
   126   win32_fileres=`file -L $1 2>/dev/null`
   127   case $win32_fileres in
   128   *ar\ archive\ import\ library*) # definitely import
   129     win32_libid_type="x86 archive import"
   130     ;;
   131   *ar\ archive*) # could be an import, or static
   132     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
   133       grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
   134       win32_nmres=`eval $NM -f posix -A $1 | \
   135 	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
   136       if test "X$win32_nmres" = "Ximport" ; then
   137         win32_libid_type="x86 archive import"
   138       else
   139         win32_libid_type="x86 archive static"
   140       fi
   141     fi
   142     ;;
   143   *DLL*) 
   144     win32_libid_type="x86 DLL"
   145     ;;
   146   *executable*) # but shell scripts are "executable" too...
   147     case $win32_fileres in
   148     *MS\ Windows\ PE\ Intel*)
   149       win32_libid_type="x86 DLL"
   150       ;;
   151     esac
   152     ;;
   153   esac
   154   $echo $win32_libid_type
   155 }
   156 
   157 # End of Shell function definitions
   158 #####################################
   159 
   160 # Parse our command line options once, thoroughly.
   161 while test "$#" -gt 0
   162 do
   163   arg="$1"
   164   shift
   165 
   166   case $arg in
   167   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
   168   *) optarg= ;;
   169   esac
   170 
   171   # If the previous option needs an argument, assign it.
   172   if test -n "$prev"; then
   173     case $prev in
   174     execute_dlfiles)
   175       execute_dlfiles="$execute_dlfiles $arg"
   176       ;;
   177     tag)
   178       tagname="$arg"
   179 
   180       # Check whether tagname contains only valid characters
   181       case $tagname in
   182       *[!-_A-Za-z0-9,/]*)
   183 	$echo "$progname: invalid tag name: $tagname" 1>&2
   184 	exit 1
   185 	;;
   186       esac
   187 
   188       case $tagname in
   189       CC)
   190 	# Don't test for the "default" C tag, as we know, it's there, but
   191 	# not specially marked.
   192 	;;
   193       *)
   194 	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
   195 	  taglist="$taglist $tagname"
   196 	  # Evaluate the configuration.
   197 	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
   198 	else
   199 	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
   200 	fi
   201 	;;
   202       esac
   203       ;;
   204     *)
   205       eval "$prev=\$arg"
   206       ;;
   207     esac
   208 
   209     prev=
   210     prevopt=
   211     continue
   212   fi
   213 
   214   # Have we seen a non-optional argument yet?
   215   case $arg in
   216   --help)
   217     show_help=yes
   218     ;;
   219 
   220   --version)
   221     $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
   222     $echo
   223     $echo "Copyright (C) 2003  Free Software Foundation, Inc."
   224     $echo "This is free software; see the source for copying conditions.  There is NO"
   225     $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
   226     exit 0
   227     ;;
   228 
   229   --config)
   230     ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
   231     # Now print the configurations for the tags.
   232     for tagname in $taglist; do
   233       ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
   234     done
   235     exit 0
   236     ;;
   237 
   238   --debug)
   239     $echo "$progname: enabling shell trace mode"
   240     set -x
   241     ;;
   242 
   243   --dry-run | -n)
   244     run=:
   245     ;;
   246 
   247   --features)
   248     $echo "host: $host"
   249     if test "$build_libtool_libs" = yes; then
   250       $echo "enable shared libraries"
   251     else
   252       $echo "disable shared libraries"
   253     fi
   254     if test "$build_old_libs" = yes; then
   255       $echo "enable static libraries"
   256     else
   257       $echo "disable static libraries"
   258     fi
   259     exit 0
   260     ;;
   261 
   262   --finish) mode="finish" ;;
   263 
   264   --mode) prevopt="--mode" prev=mode ;;
   265   --mode=*) mode="$optarg" ;;
   266 
   267   --preserve-dup-deps) duplicate_deps="yes" ;;
   268 
   269   --quiet | --silent)
   270     show=:
   271     ;;
   272 
   273   --tag) prevopt="--tag" prev=tag ;;
   274   --tag=*)
   275     set tag "$optarg" ${1+"$@"}
   276     shift
   277     prev=tag
   278     ;;
   279 
   280   -dlopen)
   281     prevopt="-dlopen"
   282     prev=execute_dlfiles
   283     ;;
   284 
   285   -*)
   286     $echo "$modename: unrecognized option \`$arg'" 1>&2
   287     $echo "$help" 1>&2
   288     exit 1
   289     ;;
   290 
   291   *)
   292     nonopt="$arg"
   293     break
   294     ;;
   295   esac
   296 done
   297 
   298 if test -n "$prevopt"; then
   299   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
   300   $echo "$help" 1>&2
   301   exit 1
   302 fi
   303 
   304 # If this variable is set in any of the actions, the command in it
   305 # will be execed at the end.  This prevents here-documents from being
   306 # left over by shells.
   307 exec_cmd=
   308 
   309 if test -z "$show_help"; then
   310 
   311   # Infer the operation mode.
   312   if test -z "$mode"; then
   313     $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
   314     $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
   315     case $nonopt in
   316     *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
   317       mode=link
   318       for arg
   319       do
   320 	case $arg in
   321 	-c)
   322 	   mode=compile
   323 	   break
   324 	   ;;
   325 	esac
   326       done
   327       ;;
   328     *db | *dbx | *strace | *truss)
   329       mode=execute
   330       ;;
   331     *install*|cp|mv)
   332       mode=install
   333       ;;
   334     *rm)
   335       mode=uninstall
   336       ;;
   337     *)
   338       # If we have no mode, but dlfiles were specified, then do execute mode.
   339       test -n "$execute_dlfiles" && mode=execute
   340 
   341       # Just use the default operation mode.
   342       if test -z "$mode"; then
   343 	if test -n "$nonopt"; then
   344 	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
   345 	else
   346 	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
   347 	fi
   348       fi
   349       ;;
   350     esac
   351   fi
   352 
   353   # Only execute mode is allowed to have -dlopen flags.
   354   if test -n "$execute_dlfiles" && test "$mode" != execute; then
   355     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
   356     $echo "$help" 1>&2
   357     exit 1
   358   fi
   359 
   360   # Change the help message to a mode-specific one.
   361   generic_help="$help"
   362   help="Try \`$modename --help --mode=$mode' for more information."
   363 
   364   # These modes are in order of execution frequency so that they run quickly.
   365   case $mode in
   366   # libtool compile mode
   367   compile)
   368     modename="$modename: compile"
   369     # Get the compilation command and the source file.
   370     base_compile=
   371     srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
   372     suppress_output=
   373     arg_mode=normal
   374     libobj=
   375 
   376     for arg
   377     do
   378       case "$arg_mode" in
   379       arg  )
   380 	# do not "continue".  Instead, add this to base_compile
   381 	lastarg="$arg"
   382 	arg_mode=normal
   383 	;;
   384 
   385       target )
   386 	libobj="$arg"
   387 	arg_mode=normal
   388 	continue
   389 	;;
   390 
   391       normal )
   392 	# Accept any command-line options.
   393 	case $arg in
   394 	-o)
   395 	  if test -n "$libobj" ; then
   396 	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
   397 	    exit 1
   398 	  fi
   399 	  arg_mode=target
   400 	  continue
   401 	  ;;
   402 
   403 	-static)
   404 	  build_old_libs=yes
   405 	  continue
   406 	  ;;
   407 
   408 	-prefer-pic)
   409 	  pic_mode=yes
   410 	  continue
   411 	  ;;
   412 
   413 	-prefer-non-pic)
   414 	  pic_mode=no
   415 	  continue
   416 	  ;;
   417 
   418 	-Xcompiler)
   419 	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
   420 	  continue      #  The current "srcfile" will either be retained or
   421 	  ;;            #  replaced later.  I would guess that would be a bug.
   422 
   423 	-Wc,*)
   424 	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
   425 	  lastarg=
   426 	  save_ifs="$IFS"; IFS=','
   427 	  for arg in $args; do
   428 	    IFS="$save_ifs"
   429 
   430 	    # Double-quote args containing other shell metacharacters.
   431 	    # Many Bourne shells cannot handle close brackets correctly
   432 	    # in scan sets, so we specify it separately.
   433 	    case $arg in
   434 	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   435 	      arg="\"$arg\""
   436 	      ;;
   437 	    esac
   438 	    lastarg="$lastarg $arg"
   439 	  done
   440 	  IFS="$save_ifs"
   441 	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
   442 
   443 	  # Add the arguments to base_compile.
   444 	  base_compile="$base_compile $lastarg"
   445 	  continue
   446 	  ;;
   447 
   448 	* )
   449 	  # Accept the current argument as the source file.
   450 	  # The previous "srcfile" becomes the current argument.
   451 	  #
   452 	  lastarg="$srcfile"
   453 	  srcfile="$arg"
   454 	  ;;
   455 	esac  #  case $arg
   456 	;;
   457       esac    #  case $arg_mode
   458 
   459       # Aesthetically quote the previous argument.
   460       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
   461 
   462       case $lastarg in
   463       # Double-quote args containing other shell metacharacters.
   464       # Many Bourne shells cannot handle close brackets correctly
   465       # in scan sets, so we specify it separately.
   466       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   467 	lastarg="\"$lastarg\""
   468 	;;
   469       esac
   470 
   471       base_compile="$base_compile $lastarg"
   472     done # for arg
   473 
   474     case $arg_mode in
   475     arg)
   476       $echo "$modename: you must specify an argument for -Xcompile"
   477       exit 1
   478       ;;
   479     target)
   480       $echo "$modename: you must specify a target with \`-o'" 1>&2
   481       exit 1
   482       ;;
   483     *)
   484       # Get the name of the library object.
   485       [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
   486       ;;
   487     esac
   488 
   489     # Recognize several different file suffixes.
   490     # If the user specifies -o file.o, it is replaced with file.lo
   491     xform='[cCFSifmso]'
   492     case $libobj in
   493     *.ada) xform=ada ;;
   494     *.adb) xform=adb ;;
   495     *.ads) xform=ads ;;
   496     *.asm) xform=asm ;;
   497     *.c++) xform=c++ ;;
   498     *.cc) xform=cc ;;
   499     *.ii) xform=ii ;;
   500     *.class) xform=class ;;
   501     *.cpp) xform=cpp ;;
   502     *.cxx) xform=cxx ;;
   503     *.f90) xform=f90 ;;
   504     *.for) xform=for ;;
   505     *.java) xform=java ;;
   506     esac
   507 
   508     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
   509 
   510     case $libobj in
   511     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
   512     *)
   513       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
   514       exit 1
   515       ;;
   516     esac
   517 
   518     # Infer tagged configuration to use if any are available and
   519     # if one wasn't chosen via the "--tag" command line option.
   520     # Only attempt this if the compiler in the base compile
   521     # command doesn't match the default compiler.
   522     if test -n "$available_tags" && test -z "$tagname"; then
   523       case $base_compile in
   524       # Blanks in the command may have been stripped by the calling shell,
   525       # but not from the CC environment variable when configure was run.
   526       " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
   527       # Blanks at the start of $base_compile will cause this to fail
   528       # if we don't check for them as well.
   529       *)
   530 	for z in $available_tags; do
   531 	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
   532 	    # Evaluate the configuration.
   533 	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
   534 	    case "$base_compile " in
   535 	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
   536 	      # The compiler in the base compile command matches
   537 	      # the one in the tagged configuration.
   538 	      # Assume this is the tagged configuration we want.
   539 	      tagname=$z
   540 	      break
   541 	      ;;
   542 	    esac
   543 	  fi
   544 	done
   545 	# If $tagname still isn't set, then no tagged configuration
   546 	# was found and let the user know that the "--tag" command
   547 	# line option must be used.
   548 	if test -z "$tagname"; then
   549 	  $echo "$modename: unable to infer tagged configuration"
   550 	  $echo "$modename: specify a tag with \`--tag'" 1>&2
   551 	  exit 1
   552 #        else
   553 #          $echo "$modename: using $tagname tagged configuration"
   554 	fi
   555 	;;
   556       esac
   557     fi
   558 
   559     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
   560     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
   561     if test "X$xdir" = "X$obj"; then
   562       xdir=
   563     else
   564       xdir=$xdir/
   565     fi
   566     lobj=${xdir}$objdir/$objname
   567 
   568     if test -z "$base_compile"; then
   569       $echo "$modename: you must specify a compilation command" 1>&2
   570       $echo "$help" 1>&2
   571       exit 1
   572     fi
   573 
   574     # Delete any leftover library objects.
   575     if test "$build_old_libs" = yes; then
   576       removelist="$obj $lobj $libobj ${libobj}T"
   577     else
   578       removelist="$lobj $libobj ${libobj}T"
   579     fi
   580 
   581     $run $rm $removelist
   582     trap "$run $rm $removelist; exit 1" 1 2 15
   583 
   584     # On Cygwin there's no "real" PIC flag so we must build both object types
   585     case $host_os in
   586     cygwin* | mingw* | pw32* | os2*)
   587       pic_mode=default
   588       ;;
   589     esac
   590     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
   591       # non-PIC code in shared libraries is not supported
   592       pic_mode=default
   593     fi
   594 
   595     # Calculate the filename of the output object if compiler does
   596     # not support -o with -c
   597     if test "$compiler_c_o" = no; then
   598       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
   599       lockfile="$output_obj.lock"
   600       removelist="$removelist $output_obj $lockfile"
   601       trap "$run $rm $removelist; exit 1" 1 2 15
   602     else
   603       output_obj=
   604       need_locks=no
   605       lockfile=
   606     fi
   607 
   608     # Lock this critical section if it is needed
   609     # We use this script file to make the link, it avoids creating a new file
   610     if test "$need_locks" = yes; then
   611       until $run ln "$0" "$lockfile" 2>/dev/null; do
   612 	$show "Waiting for $lockfile to be removed"
   613 	sleep 2
   614       done
   615     elif test "$need_locks" = warn; then
   616       if test -f "$lockfile"; then
   617 	$echo "\
   618 *** ERROR, $lockfile exists and contains:
   619 `cat $lockfile 2>/dev/null`
   620 
   621 This indicates that another process is trying to use the same
   622 temporary object file, and libtool could not work around it because
   623 your compiler does not support \`-c' and \`-o' together.  If you
   624 repeat this compilation, it may succeed, by chance, but you had better
   625 avoid parallel builds (make -j) in this platform, or get a better
   626 compiler."
   627 
   628 	$run $rm $removelist
   629 	exit 1
   630       fi
   631       $echo $srcfile > "$lockfile"
   632     fi
   633 
   634     if test -n "$fix_srcfile_path"; then
   635       eval srcfile=\"$fix_srcfile_path\"
   636     fi
   637 
   638     $run $rm "$libobj" "${libobj}T"
   639 
   640     # Create a libtool object file (analogous to a ".la" file),
   641     # but don't create it if we're doing a dry run.
   642     test -z "$run" && cat > ${libobj}T <<EOF
   643 # $libobj - a libtool object file
   644 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
   645 #
   646 # Please DO NOT delete this file!
   647 # It is necessary for linking the library.
   648 
   649 # Name of the PIC object.
   650 EOF
   651 
   652     # Only build a PIC object if we are building libtool libraries.
   653     if test "$build_libtool_libs" = yes; then
   654       # Without this assignment, base_compile gets emptied.
   655       fbsd_hideous_sh_bug=$base_compile
   656 
   657       if test "$pic_mode" != no; then
   658 	command="$base_compile $srcfile $pic_flag"
   659       else
   660 	# Don't build PIC code
   661 	command="$base_compile $srcfile"
   662       fi
   663 
   664       if test ! -d "${xdir}$objdir"; then
   665 	$show "$mkdir ${xdir}$objdir"
   666 	$run $mkdir ${xdir}$objdir
   667 	status=$?
   668 	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
   669 	  exit $status
   670 	fi
   671       fi
   672 
   673       if test -z "$output_obj"; then
   674 	# Place PIC objects in $objdir
   675 	command="$command -o $lobj"
   676       fi
   677 
   678       $run $rm "$lobj" "$output_obj"
   679 
   680       $show "$command"
   681       if $run eval "$command"; then :
   682       else
   683 	test -n "$output_obj" && $run $rm $removelist
   684 	exit 1
   685       fi
   686 
   687       if test "$need_locks" = warn &&
   688 	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
   689 	$echo "\
   690 *** ERROR, $lockfile contains:
   691 `cat $lockfile 2>/dev/null`
   692 
   693 but it should contain:
   694 $srcfile
   695 
   696 This indicates that another process is trying to use the same
   697 temporary object file, and libtool could not work around it because
   698 your compiler does not support \`-c' and \`-o' together.  If you
   699 repeat this compilation, it may succeed, by chance, but you had better
   700 avoid parallel builds (make -j) in this platform, or get a better
   701 compiler."
   702 
   703 	$run $rm $removelist
   704 	exit 1
   705       fi
   706 
   707       # Just move the object if needed, then go on to compile the next one
   708       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
   709 	$show "$mv $output_obj $lobj"
   710 	if $run $mv $output_obj $lobj; then :
   711 	else
   712 	  error=$?
   713 	  $run $rm $removelist
   714 	  exit $error
   715 	fi
   716       fi
   717 
   718       # Append the name of the PIC object to the libtool object file.
   719       test -z "$run" && cat >> ${libobj}T <<EOF
   720 pic_object='$objdir/$objname'
   721 
   722 EOF
   723 
   724       # Allow error messages only from the first compilation.
   725       suppress_output=' >/dev/null 2>&1'
   726     else
   727       # No PIC object so indicate it doesn't exist in the libtool
   728       # object file.
   729       test -z "$run" && cat >> ${libobj}T <<EOF
   730 pic_object=none
   731 
   732 EOF
   733     fi
   734 
   735     # Only build a position-dependent object if we build old libraries.
   736     if test "$build_old_libs" = yes; then
   737       if test "$pic_mode" != yes; then
   738 	# Don't build PIC code
   739 	command="$base_compile $srcfile"
   740       else
   741 	command="$base_compile $srcfile $pic_flag"
   742       fi
   743       if test "$compiler_c_o" = yes; then
   744 	command="$command -o $obj"
   745       fi
   746 
   747       # Suppress compiler output if we already did a PIC compilation.
   748       command="$command$suppress_output"
   749       $run $rm "$obj" "$output_obj"
   750       $show "$command"
   751       if $run eval "$command"; then :
   752       else
   753 	$run $rm $removelist
   754 	exit 1
   755       fi
   756 
   757       if test "$need_locks" = warn &&
   758 	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
   759 	$echo "\
   760 *** ERROR, $lockfile contains:
   761 `cat $lockfile 2>/dev/null`
   762 
   763 but it should contain:
   764 $srcfile
   765 
   766 This indicates that another process is trying to use the same
   767 temporary object file, and libtool could not work around it because
   768 your compiler does not support \`-c' and \`-o' together.  If you
   769 repeat this compilation, it may succeed, by chance, but you had better
   770 avoid parallel builds (make -j) in this platform, or get a better
   771 compiler."
   772 
   773 	$run $rm $removelist
   774 	exit 1
   775       fi
   776 
   777       # Just move the object if needed
   778       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
   779 	$show "$mv $output_obj $obj"
   780 	if $run $mv $output_obj $obj; then :
   781 	else
   782 	  error=$?
   783 	  $run $rm $removelist
   784 	  exit $error
   785 	fi
   786       fi
   787 
   788       # Append the name of the non-PIC object the libtool object file.
   789       # Only append if the libtool object file exists.
   790       test -z "$run" && cat >> ${libobj}T <<EOF
   791 # Name of the non-PIC object.
   792 non_pic_object='$objname'
   793 
   794 EOF
   795     else
   796       # Append the name of the non-PIC object the libtool object file.
   797       # Only append if the libtool object file exists.
   798       test -z "$run" && cat >> ${libobj}T <<EOF
   799 # Name of the non-PIC object.
   800 non_pic_object=none
   801 
   802 EOF
   803     fi
   804 
   805     $run $mv "${libobj}T" "${libobj}"
   806 
   807     # Unlock the critical section if it was locked
   808     if test "$need_locks" != no; then
   809       $run $rm "$lockfile"
   810     fi
   811 
   812     exit 0
   813     ;;
   814 
   815   # libtool link mode
   816   link | relink)
   817     modename="$modename: link"
   818     case $host in
   819     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
   820       # It is impossible to link a dll without this setting, and
   821       # we shouldn't force the makefile maintainer to figure out
   822       # which system we are compiling for in order to pass an extra
   823       # flag for every libtool invocation.
   824       # allow_undefined=no
   825 
   826       # FIXME: Unfortunately, there are problems with the above when trying
   827       # to make a dll which has undefined symbols, in which case not
   828       # even a static library is built.  For now, we need to specify
   829       # -no-undefined on the libtool link line when we can be certain
   830       # that all symbols are satisfied, otherwise we get a static library.
   831       allow_undefined=yes
   832       ;;
   833     *)
   834       allow_undefined=yes
   835       ;;
   836     esac
   837     libtool_args="$nonopt"
   838     base_compile="$nonopt"
   839     compile_command="$nonopt"
   840     finalize_command="$nonopt"
   841 
   842     compile_rpath=
   843     finalize_rpath=
   844     compile_shlibpath=
   845     finalize_shlibpath=
   846     convenience=
   847     old_convenience=
   848     deplibs=
   849     old_deplibs=
   850     compiler_flags=
   851     linker_flags=
   852     dllsearchpath=
   853     lib_search_path=`pwd`
   854     inst_prefix_dir=
   855 
   856     avoid_version=no
   857     dlfiles=
   858     dlprefiles=
   859     dlself=no
   860     export_dynamic=no
   861     export_symbols=
   862     export_symbols_regex=
   863     generated=
   864     libobjs=
   865     ltlibs=
   866     module=no
   867     no_install=no
   868     objs=
   869     non_pic_objects=
   870     prefer_static_libs=no
   871     preload=no
   872     prev=
   873     prevarg=
   874     release=
   875     rpath=
   876     xrpath=
   877     perm_rpath=
   878     temp_rpath=
   879     thread_safe=no
   880     vinfo=
   881     vinfo_number=no
   882 
   883     # We need to know -static, to get the right output filenames.
   884     for arg
   885     do
   886       case $arg in
   887       -all-static | -static)
   888 	if test "X$arg" = "X-all-static"; then
   889 	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
   890 	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
   891 	  fi
   892 	  if test -n "$link_static_flag"; then
   893 	    dlopen_self=$dlopen_self_static
   894 	  fi
   895 	else
   896 	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
   897 	    dlopen_self=$dlopen_self_static
   898 	  fi
   899 	fi
   900 	build_libtool_libs=no
   901 	build_old_libs=yes
   902 	prefer_static_libs=yes
   903 	break
   904 	;;
   905       esac
   906     done
   907 
   908     # See if our shared archives depend on static archives.
   909     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
   910 
   911     # Go through the arguments, transforming them on the way.
   912     while test "$#" -gt 0; do
   913       arg="$1"
   914       base_compile="$base_compile $arg"
   915       shift
   916       case $arg in
   917       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   918 	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
   919 	;;
   920       *) qarg=$arg ;;
   921       esac
   922       libtool_args="$libtool_args $qarg"
   923 
   924       # If the previous option needs an argument, assign it.
   925       if test -n "$prev"; then
   926 	case $prev in
   927 	output)
   928 	  compile_command="$compile_command @OUTPUT@"
   929 	  finalize_command="$finalize_command @OUTPUT@"
   930 	  ;;
   931 	esac
   932 
   933 	case $prev in
   934 	dlfiles|dlprefiles)
   935 	  if test "$preload" = no; then
   936 	    # Add the symbol object into the linking commands.
   937 	    compile_command="$compile_command @SYMFILE@"
   938 	    finalize_command="$finalize_command @SYMFILE@"
   939 	    preload=yes
   940 	  fi
   941 	  case $arg in
   942 	  *.la | *.lo) ;;  # We handle these cases below.
   943 	  force)
   944 	    if test "$dlself" = no; then
   945 	      dlself=needless
   946 	      export_dynamic=yes
   947 	    fi
   948 	    prev=
   949 	    continue
   950 	    ;;
   951 	  self)
   952 	    if test "$prev" = dlprefiles; then
   953 	      dlself=yes
   954 	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
   955 	      dlself=yes
   956 	    else
   957 	      dlself=needless
   958 	      export_dynamic=yes
   959 	    fi
   960 	    prev=
   961 	    continue
   962 	    ;;
   963 	  *)
   964 	    if test "$prev" = dlfiles; then
   965 	      dlfiles="$dlfiles $arg"
   966 	    else
   967 	      dlprefiles="$dlprefiles $arg"
   968 	    fi
   969 	    prev=
   970 	    continue
   971 	    ;;
   972 	  esac
   973 	  ;;
   974 	expsyms)
   975 	  export_symbols="$arg"
   976 	  if test ! -f "$arg"; then
   977 	    $echo "$modename: symbol file \`$arg' does not exist"
   978 	    exit 1
   979 	  fi
   980 	  prev=
   981 	  continue
   982 	  ;;
   983 	expsyms_regex)
   984 	  export_symbols_regex="$arg"
   985 	  prev=
   986 	  continue
   987 	  ;;
   988 	inst_prefix)
   989 	  inst_prefix_dir="$arg"
   990 	  prev=
   991 	  continue
   992 	  ;;
   993 	release)
   994 	  release="-$arg"
   995 	  prev=
   996 	  continue
   997 	  ;;
   998 	objectlist)
   999 	  if test -f "$arg"; then
  1000 	    save_arg=$arg
  1001 	    moreargs=
  1002 	    for fil in `cat $save_arg`
  1003 	    do
  1004 #	      moreargs="$moreargs $fil"
  1005 	      arg=$fil
  1006 	      # A libtool-controlled object.
  1007 
  1008 	      # Check to see that this really is a libtool object.
  1009 	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1010 		pic_object=
  1011 		non_pic_object=
  1012 
  1013 		# Read the .lo file
  1014 		# If there is no directory component, then add one.
  1015 		case $arg in
  1016 		*/* | *\\*) . $arg ;;
  1017 		*) . ./$arg ;;
  1018 		esac
  1019 
  1020 		if test -z "$pic_object" || \
  1021 		   test -z "$non_pic_object" ||
  1022 		   test "$pic_object" = none && \
  1023 		   test "$non_pic_object" = none; then
  1024 		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1025 		  exit 1
  1026 		fi
  1027 
  1028 		# Extract subdirectory from the argument.
  1029 		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1030 		if test "X$xdir" = "X$arg"; then
  1031 		  xdir=
  1032 		else
  1033 		  xdir="$xdir/"
  1034 		fi
  1035 
  1036 		if test "$pic_object" != none; then
  1037 		  # Prepend the subdirectory the object is found in.
  1038 		  pic_object="$xdir$pic_object"
  1039 
  1040 		  if test "$prev" = dlfiles; then
  1041 		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1042 		      dlfiles="$dlfiles $pic_object"
  1043 		      prev=
  1044 		      continue
  1045 		    else
  1046 		      # If libtool objects are unsupported, then we need to preload.
  1047 		      prev=dlprefiles
  1048 		    fi
  1049 		  fi
  1050 
  1051 		  # CHECK ME:  I think I busted this.  -Ossama
  1052 		  if test "$prev" = dlprefiles; then
  1053 		    # Preload the old-style object.
  1054 		    dlprefiles="$dlprefiles $pic_object"
  1055 		    prev=
  1056 		  fi
  1057 
  1058 		  # A PIC object.
  1059 		  libobjs="$libobjs $pic_object"
  1060 		  arg="$pic_object"
  1061 		fi
  1062 
  1063 		# Non-PIC object.
  1064 		if test "$non_pic_object" != none; then
  1065 		  # Prepend the subdirectory the object is found in.
  1066 		  non_pic_object="$xdir$non_pic_object"
  1067 
  1068 		  # A standard non-PIC object
  1069 		  non_pic_objects="$non_pic_objects $non_pic_object"
  1070 		  if test -z "$pic_object" || test "$pic_object" = none ; then
  1071 		    arg="$non_pic_object"
  1072 		  fi
  1073 		fi
  1074 	      else
  1075 		# Only an error if not doing a dry-run.
  1076 		if test -z "$run"; then
  1077 		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1078 		  exit 1
  1079 		else
  1080 		  # Dry-run case.
  1081 
  1082 		  # Extract subdirectory from the argument.
  1083 		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1084 		  if test "X$xdir" = "X$arg"; then
  1085 		    xdir=
  1086 		  else
  1087 		    xdir="$xdir/"
  1088 		  fi
  1089 
  1090 		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1091 		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1092 		  libobjs="$libobjs $pic_object"
  1093 		  non_pic_objects="$non_pic_objects $non_pic_object"
  1094 		fi
  1095 	      fi
  1096 	    done
  1097 	  else
  1098 	    $echo "$modename: link input file \`$save_arg' does not exist"
  1099 	    exit 1
  1100 	  fi
  1101 	  arg=$save_arg
  1102 	  prev=
  1103 	  continue
  1104 	  ;;
  1105 	rpath | xrpath)
  1106 	  # We need an absolute path.
  1107 	  case $arg in
  1108 	  [\\/]* | [A-Za-z]:[\\/]*) ;;
  1109 	  *)
  1110 	    $echo "$modename: only absolute run-paths are allowed" 1>&2
  1111 	    exit 1
  1112 	    ;;
  1113 	  esac
  1114 	  if test "$prev" = rpath; then
  1115 	    case "$rpath " in
  1116 	    *" $arg "*) ;;
  1117 	    *) rpath="$rpath $arg" ;;
  1118 	    esac
  1119 	  else
  1120 	    case "$xrpath " in
  1121 	    *" $arg "*) ;;
  1122 	    *) xrpath="$xrpath $arg" ;;
  1123 	    esac
  1124 	  fi
  1125 	  prev=
  1126 	  continue
  1127 	  ;;
  1128 	xcompiler)
  1129 	  compiler_flags="$compiler_flags $qarg"
  1130 	  prev=
  1131 	  compile_command="$compile_command $qarg"
  1132 	  finalize_command="$finalize_command $qarg"
  1133 	  continue
  1134 	  ;;
  1135 	xlinker)
  1136 	  linker_flags="$linker_flags $qarg"
  1137 	  compiler_flags="$compiler_flags $wl$qarg"
  1138 	  prev=
  1139 	  compile_command="$compile_command $wl$qarg"
  1140 	  finalize_command="$finalize_command $wl$qarg"
  1141 	  continue
  1142 	  ;;
  1143 	xcclinker)
  1144 	  linker_flags="$linker_flags $qarg"
  1145 	  compiler_flags="$compiler_flags $qarg"
  1146 	  prev=
  1147 	  compile_command="$compile_command $qarg"
  1148 	  finalize_command="$finalize_command $qarg"
  1149 	  continue
  1150 	  ;;
  1151 	*)
  1152 	  eval "$prev=\"\$arg\""
  1153 	  prev=
  1154 	  continue
  1155 	  ;;
  1156 	esac
  1157       fi # test -n "$prev"
  1158 
  1159       prevarg="$arg"
  1160 
  1161       case $arg in
  1162       -all-static)
  1163 	if test -n "$link_static_flag"; then
  1164 	  compile_command="$compile_command $link_static_flag"
  1165 	  finalize_command="$finalize_command $link_static_flag"
  1166 	fi
  1167 	continue
  1168 	;;
  1169 
  1170       -allow-undefined)
  1171 	# FIXME: remove this flag sometime in the future.
  1172 	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1173 	continue
  1174 	;;
  1175 
  1176       -avoid-version)
  1177 	avoid_version=yes
  1178 	continue
  1179 	;;
  1180 
  1181       -dlopen)
  1182 	prev=dlfiles
  1183 	continue
  1184 	;;
  1185 
  1186       -dlpreopen)
  1187 	prev=dlprefiles
  1188 	continue
  1189 	;;
  1190 
  1191       -export-dynamic)
  1192 	export_dynamic=yes
  1193 	continue
  1194 	;;
  1195 
  1196       -export-symbols | -export-symbols-regex)
  1197 	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1198 	  $echo "$modename: more than one -exported-symbols argument is not allowed"
  1199 	  exit 1
  1200 	fi
  1201 	if test "X$arg" = "X-export-symbols"; then
  1202 	  prev=expsyms
  1203 	else
  1204 	  prev=expsyms_regex
  1205 	fi
  1206 	continue
  1207 	;;
  1208 
  1209       -inst-prefix-dir)
  1210 	prev=inst_prefix
  1211 	continue
  1212 	;;
  1213 
  1214       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  1215       # so, if we see these flags be careful not to treat them like -L
  1216       -L[A-Z][A-Z]*:*)
  1217 	case $with_gcc/$host in
  1218 	no/*-*-irix* | /*-*-irix*)
  1219 	  compile_command="$compile_command $arg"
  1220 	  finalize_command="$finalize_command $arg"
  1221 	  ;;
  1222 	esac
  1223 	continue
  1224 	;;
  1225 
  1226       -L*)
  1227 	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1228 	# We need an absolute path.
  1229 	case $dir in
  1230 	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1231 	*)
  1232 	  absdir=`cd "$dir" && pwd`
  1233 	  if test -z "$absdir"; then
  1234 	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1235 	    exit 1
  1236 	  fi
  1237 	  dir="$absdir"
  1238 	  ;;
  1239 	esac
  1240 	case "$deplibs " in
  1241 	*" -L$dir "*) ;;
  1242 	*)
  1243 	  deplibs="$deplibs -L$dir"
  1244 	  lib_search_path="$lib_search_path $dir"
  1245 	  ;;
  1246 	esac
  1247 	case $host in
  1248 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1249 	  case :$dllsearchpath: in
  1250 	  *":$dir:"*) ;;
  1251 	  *) dllsearchpath="$dllsearchpath:$dir";;
  1252 	  esac
  1253 	  ;;
  1254 	esac
  1255 	continue
  1256 	;;
  1257 
  1258       -l*)
  1259 	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1260 	  case $host in
  1261 	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
  1262 	    # These systems don't actually have a C or math library (as such)
  1263 	    continue
  1264 	    ;;
  1265 	  *-*-mingw* | *-*-os2*)
  1266 	    # These systems don't actually have a C library (as such)
  1267 	    test "X$arg" = "X-lc" && continue
  1268 	    ;;
  1269 	  *-*-openbsd* | *-*-freebsd*)
  1270 	    # Do not include libc due to us having libc/libc_r.
  1271 	    test "X$arg" = "X-lc" && continue
  1272 	    ;;
  1273 	  *-*-rhapsody* | *-*-darwin1.[012])
  1274 	    # Rhapsody C and math libraries are in the System framework
  1275 	    deplibs="$deplibs -framework System"
  1276 	    continue
  1277 	  esac
  1278 	elif test "X$arg" = "X-lc_r"; then
  1279 	 case $host in
  1280 	 *-*-openbsd* | *-*-freebsd*)
  1281 	   # Do not include libc_r directly, use -pthread flag.
  1282 	   continue
  1283 	   ;;
  1284 	 esac
  1285 	fi
  1286 	deplibs="$deplibs $arg"
  1287 	continue
  1288 	;;
  1289 
  1290       -module)
  1291 	module=yes
  1292 	continue
  1293 	;;
  1294 
  1295       # gcc -m* arguments should be passed to the linker via $compiler_flags
  1296       # in order to pass architecture information to the linker
  1297       # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
  1298       # but this is not reliable with gcc because gcc may use -mfoo to
  1299       # select a different linker, different libraries, etc, while
  1300       # -Wl,-mfoo simply passes -mfoo to the linker.
  1301       -m*)
  1302 	# Unknown arguments in both finalize_command and compile_command need
  1303 	# to be aesthetically quoted because they are evaled later.
  1304 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1305 	case $arg in
  1306 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1307 	  arg="\"$arg\""
  1308 	  ;;
  1309 	esac
  1310         compile_command="$compile_command $arg"
  1311         finalize_command="$finalize_command $arg"
  1312         if test "$with_gcc" = "yes" ; then
  1313           compiler_flags="$compiler_flags $arg"
  1314         fi
  1315         continue
  1316         ;;
  1317 
  1318       -shrext)
  1319 	prev=shrext
  1320 	continue
  1321 	;;
  1322 
  1323       -no-fast-install)
  1324 	fast_install=no
  1325 	continue
  1326 	;;
  1327 
  1328       -no-install)
  1329 	case $host in
  1330 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1331 	  # The PATH hackery in wrapper scripts is required on Windows
  1332 	  # in order for the loader to find any dlls it needs.
  1333 	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  1334 	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  1335 	  fast_install=no
  1336 	  ;;
  1337 	*) no_install=yes ;;
  1338 	esac
  1339 	continue
  1340 	;;
  1341 
  1342       -no-undefined)
  1343 	allow_undefined=no
  1344 	continue
  1345 	;;
  1346 
  1347       -objectlist)
  1348 	prev=objectlist
  1349 	continue
  1350 	;;
  1351 
  1352       -o) prev=output ;;
  1353 
  1354       -release)
  1355 	prev=release
  1356 	continue
  1357 	;;
  1358 
  1359       -rpath)
  1360 	prev=rpath
  1361 	continue
  1362 	;;
  1363 
  1364       -R)
  1365 	prev=xrpath
  1366 	continue
  1367 	;;
  1368 
  1369       -R*)
  1370 	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1371 	# We need an absolute path.
  1372 	case $dir in
  1373 	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1374 	*)
  1375 	  $echo "$modename: only absolute run-paths are allowed" 1>&2
  1376 	  exit 1
  1377 	  ;;
  1378 	esac
  1379 	case "$xrpath " in
  1380 	*" $dir "*) ;;
  1381 	*) xrpath="$xrpath $dir" ;;
  1382 	esac
  1383 	continue
  1384 	;;
  1385 
  1386       -static)
  1387 	# The effects of -static are defined in a previous loop.
  1388 	# We used to do the same as -all-static on platforms that
  1389 	# didn't have a PIC flag, but the assumption that the effects
  1390 	# would be equivalent was wrong.  It would break on at least
  1391 	# Digital Unix and AIX.
  1392 	continue
  1393 	;;
  1394 
  1395       -thread-safe)
  1396 	thread_safe=yes
  1397 	continue
  1398 	;;
  1399 
  1400       -version-info)
  1401 	prev=vinfo
  1402 	continue
  1403 	;;
  1404       -version-number)
  1405 	prev=vinfo
  1406 	vinfo_number=yes
  1407 	continue
  1408 	;;
  1409 
  1410       -Wc,*)
  1411 	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1412 	arg=
  1413 	save_ifs="$IFS"; IFS=','
  1414 	for flag in $args; do
  1415 	  IFS="$save_ifs"
  1416 	  case $flag in
  1417 	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1418 	    flag="\"$flag\""
  1419 	    ;;
  1420 	  esac
  1421 	  arg="$arg $wl$flag"
  1422 	  compiler_flags="$compiler_flags $flag"
  1423 	done
  1424 	IFS="$save_ifs"
  1425 	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1426 	;;
  1427 
  1428       -Wl,*)
  1429 	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1430 	arg=
  1431 	save_ifs="$IFS"; IFS=','
  1432 	for flag in $args; do
  1433 	  IFS="$save_ifs"
  1434 	  case $flag in
  1435 	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1436 	    flag="\"$flag\""
  1437 	    ;;
  1438 	  esac
  1439 	  arg="$arg $wl$flag"
  1440 	  compiler_flags="$compiler_flags $wl$flag"
  1441 	  linker_flags="$linker_flags $flag"
  1442 	done
  1443 	IFS="$save_ifs"
  1444 	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1445 	;;
  1446 
  1447       -Xcompiler)
  1448 	prev=xcompiler
  1449 	continue
  1450 	;;
  1451 
  1452       -Xlinker)
  1453 	prev=xlinker
  1454 	continue
  1455 	;;
  1456 
  1457       -XCClinker)
  1458 	prev=xcclinker
  1459 	continue
  1460 	;;
  1461 
  1462       # Some other compiler flag.
  1463       -* | +*)
  1464 	# Unknown arguments in both finalize_command and compile_command need
  1465 	# to be aesthetically quoted because they are evaled later.
  1466 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1467 	case $arg in
  1468 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1469 	  arg="\"$arg\""
  1470 	  ;;
  1471 	esac
  1472 	;;
  1473 
  1474       *.$objext)
  1475 	# A standard object.
  1476 	objs="$objs $arg"
  1477 	;;
  1478 
  1479       *.lo)
  1480 	# A libtool-controlled object.
  1481 
  1482 	# Check to see that this really is a libtool object.
  1483 	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1484 	  pic_object=
  1485 	  non_pic_object=
  1486 
  1487 	  # Read the .lo file
  1488 	  # If there is no directory component, then add one.
  1489 	  case $arg in
  1490 	  */* | *\\*) . $arg ;;
  1491 	  *) . ./$arg ;;
  1492 	  esac
  1493 
  1494 	  if test -z "$pic_object" || \
  1495 	     test -z "$non_pic_object" ||
  1496 	     test "$pic_object" = none && \
  1497 	     test "$non_pic_object" = none; then
  1498 	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1499 	    exit 1
  1500 	  fi
  1501 
  1502 	  # Extract subdirectory from the argument.
  1503 	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1504 	  if test "X$xdir" = "X$arg"; then
  1505 	    xdir=
  1506  	  else
  1507 	    xdir="$xdir/"
  1508 	  fi
  1509 
  1510 	  if test "$pic_object" != none; then
  1511 	    # Prepend the subdirectory the object is found in.
  1512 	    pic_object="$xdir$pic_object"
  1513 
  1514 	    if test "$prev" = dlfiles; then
  1515 	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1516 		dlfiles="$dlfiles $pic_object"
  1517 		prev=
  1518 		continue
  1519 	      else
  1520 		# If libtool objects are unsupported, then we need to preload.
  1521 		prev=dlprefiles
  1522 	      fi
  1523 	    fi
  1524 
  1525 	    # CHECK ME:  I think I busted this.  -Ossama
  1526 	    if test "$prev" = dlprefiles; then
  1527 	      # Preload the old-style object.
  1528 	      dlprefiles="$dlprefiles $pic_object"
  1529 	      prev=
  1530 	    fi
  1531 
  1532 	    # A PIC object.
  1533 	    libobjs="$libobjs $pic_object"
  1534 	    arg="$pic_object"
  1535 	  fi
  1536 
  1537 	  # Non-PIC object.
  1538 	  if test "$non_pic_object" != none; then
  1539 	    # Prepend the subdirectory the object is found in.
  1540 	    non_pic_object="$xdir$non_pic_object"
  1541 
  1542 	    # A standard non-PIC object
  1543 	    non_pic_objects="$non_pic_objects $non_pic_object"
  1544 	    if test -z "$pic_object" || test "$pic_object" = none ; then
  1545 	      arg="$non_pic_object"
  1546 	    fi
  1547 	  fi
  1548 	else
  1549 	  # Only an error if not doing a dry-run.
  1550 	  if test -z "$run"; then
  1551 	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1552 	    exit 1
  1553 	  else
  1554 	    # Dry-run case.
  1555 
  1556 	    # Extract subdirectory from the argument.
  1557 	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1558 	    if test "X$xdir" = "X$arg"; then
  1559 	      xdir=
  1560 	    else
  1561 	      xdir="$xdir/"
  1562 	    fi
  1563 
  1564 	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1565 	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1566 	    libobjs="$libobjs $pic_object"
  1567 	    non_pic_objects="$non_pic_objects $non_pic_object"
  1568 	  fi
  1569 	fi
  1570 	;;
  1571 
  1572       *.$libext)
  1573 	# An archive.
  1574 	deplibs="$deplibs $arg"
  1575 	old_deplibs="$old_deplibs $arg"
  1576 	continue
  1577 	;;
  1578 
  1579       *.la)
  1580 	# A libtool-controlled library.
  1581 
  1582 	if test "$prev" = dlfiles; then
  1583 	  # This library was specified with -dlopen.
  1584 	  dlfiles="$dlfiles $arg"
  1585 	  prev=
  1586 	elif test "$prev" = dlprefiles; then
  1587 	  # The library was specified with -dlpreopen.
  1588 	  dlprefiles="$dlprefiles $arg"
  1589 	  prev=
  1590 	else
  1591 	  deplibs="$deplibs $arg"
  1592 	fi
  1593 	continue
  1594 	;;
  1595 
  1596       # Some other compiler argument.
  1597       *)
  1598 	# Unknown arguments in both finalize_command and compile_command need
  1599 	# to be aesthetically quoted because they are evaled later.
  1600 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1601 	case $arg in
  1602 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1603 	  arg="\"$arg\""
  1604 	  ;;
  1605 	esac
  1606 	;;
  1607       esac # arg
  1608 
  1609       # Now actually substitute the argument into the commands.
  1610       if test -n "$arg"; then
  1611 	compile_command="$compile_command $arg"
  1612 	finalize_command="$finalize_command $arg"
  1613       fi
  1614     done # argument parsing loop
  1615 
  1616     if test -n "$prev"; then
  1617       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1618       $echo "$help" 1>&2
  1619       exit 1
  1620     fi
  1621 
  1622     # Infer tagged configuration to use if any are available and
  1623     # if one wasn't chosen via the "--tag" command line option.
  1624     # Only attempt this if the compiler in the base link
  1625     # command doesn't match the default compiler.
  1626     if test -n "$available_tags" && test -z "$tagname"; then
  1627       case $base_compile in
  1628       # Blanks in the command may have been stripped by the calling shell,
  1629       # but not from the CC environment variable when configure was run.
  1630       "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
  1631       # Blanks at the start of $base_compile will cause this to fail
  1632       # if we don't check for them as well.
  1633       *)
  1634 	for z in $available_tags; do
  1635 	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
  1636 	    # Evaluate the configuration.
  1637 	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
  1638 	    case $base_compile in
  1639 	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
  1640 	      # The compiler in $compile_command matches
  1641 	      # the one in the tagged configuration.
  1642 	      # Assume this is the tagged configuration we want.
  1643 	      tagname=$z
  1644 	      break
  1645 	      ;;
  1646 	    esac
  1647 	  fi
  1648 	done
  1649 	# If $tagname still isn't set, then no tagged configuration
  1650 	# was found and let the user know that the "--tag" command
  1651 	# line option must be used.
  1652 	if test -z "$tagname"; then
  1653 	  $echo "$modename: unable to infer tagged configuration"
  1654 	  $echo "$modename: specify a tag with \`--tag'" 1>&2
  1655 	  exit 1
  1656 #       else
  1657 #         $echo "$modename: using $tagname tagged configuration"
  1658 	fi
  1659 	;;
  1660       esac
  1661     fi
  1662 
  1663     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1664       eval arg=\"$export_dynamic_flag_spec\"
  1665       compile_command="$compile_command $arg"
  1666       finalize_command="$finalize_command $arg"
  1667     fi
  1668 
  1669     oldlibs=
  1670     # calculate the name of the file, without its directory
  1671     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1672     libobjs_save="$libobjs"
  1673 
  1674     if test -n "$shlibpath_var"; then
  1675       # get the directories listed in $shlibpath_var
  1676       eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1677     else
  1678       shlib_search_path=
  1679     fi
  1680     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1681     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1682 
  1683     output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1684     if test "X$output_objdir" = "X$output"; then
  1685       output_objdir="$objdir"
  1686     else
  1687       output_objdir="$output_objdir/$objdir"
  1688     fi
  1689     # Create the object directory.
  1690     if test ! -d "$output_objdir"; then
  1691       $show "$mkdir $output_objdir"
  1692       $run $mkdir $output_objdir
  1693       status=$?
  1694       if test "$status" -ne 0 && test ! -d "$output_objdir"; then
  1695 	exit $status
  1696       fi
  1697     fi
  1698 
  1699     # Determine the type of output
  1700     case $output in
  1701     "")
  1702       $echo "$modename: you must specify an output file" 1>&2
  1703       $echo "$help" 1>&2
  1704       exit 1
  1705       ;;
  1706     *.$libext) linkmode=oldlib ;;
  1707     *.lo | *.$objext) linkmode=obj ;;
  1708     *.la) linkmode=lib ;;
  1709     *) linkmode=prog ;; # Anything else should be a program.
  1710     esac
  1711 
  1712     case $host in
  1713     *cygwin* | *mingw* | *pw32*)
  1714       # don't eliminate duplcations in $postdeps and $predeps
  1715       duplicate_compiler_generated_deps=yes
  1716       ;;
  1717     *)
  1718       duplicate_compiler_generated_deps=$duplicate_deps
  1719       ;;
  1720     esac
  1721     specialdeplibs=
  1722 
  1723     libs=
  1724     # Find all interdependent deplibs by searching for libraries
  1725     # that are linked more than once (e.g. -la -lb -la)
  1726     for deplib in $deplibs; do
  1727       if test "X$duplicate_deps" = "Xyes" ; then
  1728 	case "$libs " in
  1729 	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1730 	esac
  1731       fi
  1732       libs="$libs $deplib"
  1733     done
  1734 
  1735     if test "$linkmode" = lib; then
  1736       libs="$predeps $libs $compiler_lib_search_path $postdeps"
  1737 
  1738       # Compute libraries that are listed more than once in $predeps
  1739       # $postdeps and mark them as special (i.e., whose duplicates are
  1740       # not to be eliminated).
  1741       pre_post_deps=
  1742       if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1743 	for pre_post_dep in $predeps $postdeps; do
  1744 	  case "$pre_post_deps " in
  1745 	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1746 	  esac
  1747 	  pre_post_deps="$pre_post_deps $pre_post_dep"
  1748 	done
  1749       fi
  1750       pre_post_deps=
  1751     fi
  1752 
  1753     deplibs=
  1754     newdependency_libs=
  1755     newlib_search_path=
  1756     need_relink=no # whether we're linking any uninstalled libtool libraries
  1757     notinst_deplibs= # not-installed libtool libraries
  1758     notinst_path= # paths that contain not-installed libtool libraries
  1759     case $linkmode in
  1760     lib)
  1761 	passes="conv link"
  1762 	for file in $dlfiles $dlprefiles; do
  1763 	  case $file in
  1764 	  *.la) ;;
  1765 	  *)
  1766 	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1767 	    exit 1
  1768 	    ;;
  1769 	  esac
  1770 	done
  1771 	;;
  1772     prog)
  1773 	compile_deplibs=
  1774 	finalize_deplibs=
  1775 	alldeplibs=no
  1776 	newdlfiles=
  1777 	newdlprefiles=
  1778 	passes="conv scan dlopen dlpreopen link"
  1779 	;;
  1780     *)  passes="conv"
  1781 	;;
  1782     esac
  1783     for pass in $passes; do
  1784       if test "$linkmode,$pass" = "lib,link" ||
  1785 	 test "$linkmode,$pass" = "prog,scan"; then
  1786 	libs="$deplibs"
  1787 	deplibs=
  1788       fi
  1789       if test "$linkmode" = prog; then
  1790 	case $pass in
  1791 	dlopen) libs="$dlfiles" ;;
  1792 	dlpreopen) libs="$dlprefiles" ;;
  1793 	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1794 	esac
  1795       fi
  1796       if test "$pass" = dlopen; then
  1797 	# Collect dlpreopened libraries
  1798 	save_deplibs="$deplibs"
  1799 	deplibs=
  1800       fi
  1801       for deplib in $libs; do
  1802 	lib=
  1803 	found=no
  1804 	case $deplib in
  1805 	-l*)
  1806 	  if test "$linkmode" != lib && test "$linkmode" != prog; then
  1807 	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  1808 	    continue
  1809 	  fi
  1810 	  if test "$pass" = conv; then
  1811 	    deplibs="$deplib $deplibs"
  1812 	    continue
  1813 	  fi
  1814 	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1815 	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1816 	    # Search the libtool library
  1817 	    lib="$searchdir/lib${name}.la"
  1818 	    if test -f "$lib"; then
  1819 	      found=yes
  1820 	      break
  1821 	    fi
  1822 	  done
  1823 	  if test "$found" != yes; then
  1824 	    # deplib doesn't seem to be a libtool library
  1825 	    if test "$linkmode,$pass" = "prog,link"; then
  1826 	      compile_deplibs="$deplib $compile_deplibs"
  1827 	      finalize_deplibs="$deplib $finalize_deplibs"
  1828 	    else
  1829 	      deplibs="$deplib $deplibs"
  1830 	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1831 	    fi
  1832 	    continue
  1833 	  else # deplib is a libtool library
  1834 	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  1835 	    # We need to do some special things here, and not later.
  1836 	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1837 	      case " $predeps $postdeps " in
  1838 	      *" $deplib "*)
  1839 		if (${SED} -e '2q' $lib |
  1840                     grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1841 		  library_names=
  1842 		  old_library=
  1843 		  case $lib in
  1844 		  */* | *\\*) . $lib ;;
  1845 		  *) . ./$lib ;;
  1846 		  esac
  1847 		  for l in $old_library $library_names; do
  1848 		    ll="$l"
  1849 		  done
  1850 		  if test "X$ll" = "X$old_library" ; then # only static version available
  1851 		    found=no
  1852 		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1853 		    test "X$ladir" = "X$lib" && ladir="."
  1854 		    lib=$ladir/$old_library
  1855 		    if test "$linkmode,$pass" = "prog,link"; then
  1856 		      compile_deplibs="$deplib $compile_deplibs"
  1857 		      finalize_deplibs="$deplib $finalize_deplibs"
  1858 		    else
  1859 		      deplibs="$deplib $deplibs"
  1860 		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1861 		    fi
  1862 		    continue
  1863 		  fi
  1864 		fi
  1865 	        ;;
  1866 	      *) ;;
  1867 	      esac
  1868 	    fi
  1869 	  fi
  1870 	  ;; # -l
  1871 	-L*)
  1872 	  case $linkmode in
  1873 	  lib)
  1874 	    deplibs="$deplib $deplibs"
  1875 	    test "$pass" = conv && continue
  1876 	    newdependency_libs="$deplib $newdependency_libs"
  1877 	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1878 	    ;;
  1879 	  prog)
  1880 	    if test "$pass" = conv; then
  1881 	      deplibs="$deplib $deplibs"
  1882 	      continue
  1883 	    fi
  1884 	    if test "$pass" = scan; then
  1885 	      deplibs="$deplib $deplibs"
  1886 	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1887 	    else
  1888 	      compile_deplibs="$deplib $compile_deplibs"
  1889 	      finalize_deplibs="$deplib $finalize_deplibs"
  1890 	    fi
  1891 	    ;;
  1892 	  *)
  1893 	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  1894 	    ;;
  1895 	  esac # linkmode
  1896 	  continue
  1897 	  ;; # -L
  1898 	-R*)
  1899 	  if test "$pass" = link; then
  1900 	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1901 	    # Make sure the xrpath contains only unique directories.
  1902 	    case "$xrpath " in
  1903 	    *" $dir "*) ;;
  1904 	    *) xrpath="$xrpath $dir" ;;
  1905 	    esac
  1906 	  fi
  1907 	  deplibs="$deplib $deplibs"
  1908 	  continue
  1909 	  ;;
  1910 	*.la) lib="$deplib" ;;
  1911 	*.$libext)
  1912 	  if test "$pass" = conv; then
  1913 	    deplibs="$deplib $deplibs"
  1914 	    continue
  1915 	  fi
  1916 	  case $linkmode in
  1917 	  lib)
  1918 	    if test "$deplibs_check_method" != pass_all; then
  1919 	      $echo
  1920 	      $echo "*** Warning: Trying to link with static lib archive $deplib."
  1921 	      $echo "*** I have the capability to make that library automatically link in when"
  1922 	      $echo "*** you link to this library.  But I can only do this if you have a"
  1923 	      $echo "*** shared version of the library, which you do not appear to have"
  1924 	      $echo "*** because the file extensions .$libext of this argument makes me believe"
  1925 	      $echo "*** that it is just a static archive that I should not used here."
  1926 	    else
  1927 	      $echo
  1928 	      $echo "*** Warning: Linking the shared library $output against the"
  1929 	      $echo "*** static library $deplib is not portable!"
  1930 	      deplibs="$deplib $deplibs"
  1931 	    fi
  1932 	    continue
  1933 	    ;;
  1934 	  prog)
  1935 	    if test "$pass" != link; then
  1936 	      deplibs="$deplib $deplibs"
  1937 	    else
  1938 	      compile_deplibs="$deplib $compile_deplibs"
  1939 	      finalize_deplibs="$deplib $finalize_deplibs"
  1940 	    fi
  1941 	    continue
  1942 	    ;;
  1943 	  esac # linkmode
  1944 	  ;; # *.$libext
  1945 	*.lo | *.$objext)
  1946 	  if test "$pass" = conv; then
  1947 	    deplibs="$deplib $deplibs"
  1948 	  elif test "$linkmode" = prog; then
  1949 	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1950 	      # If there is no dlopen support or we're linking statically,
  1951 	      # we need to preload.
  1952 	      newdlprefiles="$newdlprefiles $deplib"
  1953 	      compile_deplibs="$deplib $compile_deplibs"
  1954 	      finalize_deplibs="$deplib $finalize_deplibs"
  1955 	    else
  1956 	      newdlfiles="$newdlfiles $deplib"
  1957 	    fi
  1958 	  fi
  1959 	  continue
  1960 	  ;;
  1961 	%DEPLIBS%)
  1962 	  alldeplibs=yes
  1963 	  continue
  1964 	  ;;
  1965 	esac # case $deplib
  1966 	if test "$found" = yes || test -f "$lib"; then :
  1967 	else
  1968 	  $echo "$modename: cannot find the library \`$lib'" 1>&2
  1969 	  exit 1
  1970 	fi
  1971 
  1972 	# Check to see that this really is a libtool archive.
  1973 	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1974 	else
  1975 	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1976 	  exit 1
  1977 	fi
  1978 
  1979 	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1980 	test "X$ladir" = "X$lib" && ladir="."
  1981 
  1982 	dlname=
  1983 	dlopen=
  1984 	dlpreopen=
  1985 	libdir=
  1986 	library_names=
  1987 	old_library=
  1988 	# If the library was installed with an old release of libtool,
  1989 	# it will not redefine variables installed, or shouldnotlink
  1990 	installed=yes
  1991 	shouldnotlink=no
  1992 
  1993 	# Read the .la file
  1994 	case $lib in
  1995 	*/* | *\\*) . $lib ;;
  1996 	*) . ./$lib ;;
  1997 	esac
  1998 
  1999 	if test "$linkmode,$pass" = "lib,link" ||
  2000 	   test "$linkmode,$pass" = "prog,scan" ||
  2001 	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  2002 	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  2003 	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  2004 	fi
  2005 
  2006 	if test "$pass" = conv; then
  2007 	  # Only check for convenience libraries
  2008 	  deplibs="$lib $deplibs"
  2009 	  if test -z "$libdir"; then
  2010 	    if test -z "$old_library"; then
  2011 	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  2012 	      exit 1
  2013 	    fi
  2014 	    # It is a libtool convenience library, so add in its objects.
  2015 	    convenience="$convenience $ladir/$objdir/$old_library"
  2016 	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
  2017 	    tmp_libs=
  2018 	    for deplib in $dependency_libs; do
  2019 	      deplibs="$deplib $deplibs"
  2020               if test "X$duplicate_deps" = "Xyes" ; then
  2021 	        case "$tmp_libs " in
  2022 	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2023 	        esac
  2024               fi
  2025 	      tmp_libs="$tmp_libs $deplib"
  2026 	    done
  2027 	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
  2028 	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
  2029 	    exit 1
  2030 	  fi
  2031 	  continue
  2032 	fi # $pass = conv
  2033 
  2034     
  2035 	# Get the name of the library we link against.
  2036 	linklib=
  2037 	for l in $old_library $library_names; do
  2038 	  linklib="$l"
  2039 	done
  2040 	if test -z "$linklib"; then
  2041 	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  2042 	  exit 1
  2043 	fi
  2044 
  2045 	# This library was specified with -dlopen.
  2046 	if test "$pass" = dlopen; then
  2047 	  if test -z "$libdir"; then
  2048 	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  2049 	    exit 1
  2050 	  fi
  2051 	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  2052 	    # If there is no dlname, no dlopen support or we're linking
  2053 	    # statically, we need to preload.  We also need to preload any
  2054 	    # dependent libraries so libltdl's deplib preloader doesn't
  2055 	    # bomb out in the load deplibs phase.
  2056 	    dlprefiles="$dlprefiles $lib $dependency_libs"
  2057 	  else
  2058 	    newdlfiles="$newdlfiles $lib"
  2059 	  fi
  2060 	  continue
  2061 	fi # $pass = dlopen
  2062 
  2063 	# We need an absolute path.
  2064 	case $ladir in
  2065 	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  2066 	*)
  2067 	  abs_ladir=`cd "$ladir" && pwd`
  2068 	  if test -z "$abs_ladir"; then
  2069 	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  2070 	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  2071 	    abs_ladir="$ladir"
  2072 	  fi
  2073 	  ;;
  2074 	esac
  2075 	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  2076 
  2077 	# Find the relevant object directory and library name.
  2078 	if test "X$installed" = Xyes; then
  2079 	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  2080 	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
  2081 	    dir="$ladir"
  2082 	    absdir="$abs_ladir"
  2083 	    libdir="$abs_ladir"
  2084 	  else
  2085 	    dir="$libdir"
  2086 	    absdir="$libdir"
  2087 	  fi
  2088 	else
  2089 	  dir="$ladir/$objdir"
  2090 	  absdir="$abs_ladir/$objdir"
  2091 	  # Remove this search path later
  2092 	  notinst_path="$notinst_path $abs_ladir"
  2093 	fi # $installed = yes
  2094 	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  2095 
  2096 	# This library was specified with -dlpreopen.
  2097 	if test "$pass" = dlpreopen; then
  2098 	  if test -z "$libdir"; then
  2099 	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  2100 	    exit 1
  2101 	  fi
  2102 	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  2103 	  # are required to link).
  2104 	  if test -n "$old_library"; then
  2105 	    newdlprefiles="$newdlprefiles $dir/$old_library"
  2106 	  # Otherwise, use the dlname, so that lt_dlopen finds it.
  2107 	  elif test -n "$dlname"; then
  2108 	    newdlprefiles="$newdlprefiles $dir/$dlname"
  2109 	  else
  2110 	    newdlprefiles="$newdlprefiles $dir/$linklib"
  2111 	  fi
  2112 	fi # $pass = dlpreopen
  2113 
  2114 	if test -z "$libdir"; then
  2115 	  # Link the convenience library
  2116 	  if test "$linkmode" = lib; then
  2117 	    deplibs="$dir/$old_library $deplibs"
  2118 	  elif test "$linkmode,$pass" = "prog,link"; then
  2119 	    compile_deplibs="$dir/$old_library $compile_deplibs"
  2120 	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
  2121 	  else
  2122 	    deplibs="$lib $deplibs" # used for prog,scan pass
  2123 	  fi
  2124 	  continue
  2125 	fi
  2126 
  2127     
  2128 	if test "$linkmode" = prog && test "$pass" != link; then
  2129 	  newlib_search_path="$newlib_search_path $ladir"
  2130 	  deplibs="$lib $deplibs"
  2131 
  2132 	  linkalldeplibs=no
  2133 	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
  2134 	     test "$build_libtool_libs" = no; then
  2135 	    linkalldeplibs=yes
  2136 	  fi
  2137 
  2138 	  tmp_libs=
  2139 	  for deplib in $dependency_libs; do
  2140 	    case $deplib in
  2141 	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  2142 	    esac
  2143 	    # Need to link against all dependency_libs?
  2144 	    if test "$linkalldeplibs" = yes; then
  2145 	      deplibs="$deplib $deplibs"
  2146 	    else
  2147 	      # Need to hardcode shared library paths
  2148 	      # or/and link against static libraries
  2149 	      newdependency_libs="$deplib $newdependency_libs"
  2150 	    fi
  2151 	    if test "X$duplicate_deps" = "Xyes" ; then
  2152 	      case "$tmp_libs " in
  2153 	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2154 	      esac
  2155 	    fi
  2156 	    tmp_libs="$tmp_libs $deplib"
  2157 	  done # for deplib
  2158 	  continue
  2159 	fi # $linkmode = prog...
  2160 
  2161 	if test "$linkmode,$pass" = "prog,link"; then
  2162 	  if test -n "$library_names" &&
  2163 	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2164 	    # We need to hardcode the library path
  2165 	    if test -n "$shlibpath_var"; then
  2166 	      # Make sure the rpath contains only unique directories.
  2167 	      case "$temp_rpath " in
  2168 	      *" $dir "*) ;;
  2169 	      *" $absdir "*) ;;
  2170 	      *) temp_rpath="$temp_rpath $dir" ;;
  2171 	      esac
  2172 	    fi
  2173 
  2174 	    # Hardcode the library path.
  2175 	    # Skip directories that are in the system default run-time
  2176 	    # search path.
  2177 	    case " $sys_lib_dlsearch_path " in
  2178 	    *" $absdir "*) ;;
  2179 	    *)
  2180 	      case "$compile_rpath " in
  2181 	      *" $absdir "*) ;;
  2182 	      *) compile_rpath="$compile_rpath $absdir"
  2183 	      esac
  2184 	      ;;
  2185 	    esac
  2186 	    case " $sys_lib_dlsearch_path " in
  2187 	    *" $libdir "*) ;;
  2188 	    *)
  2189 	      case "$finalize_rpath " in
  2190 	      *" $libdir "*) ;;
  2191 	      *) finalize_rpath="$finalize_rpath $libdir"
  2192 	      esac
  2193 	      ;;
  2194 	    esac
  2195 	  fi # $linkmode,$pass = prog,link...
  2196 
  2197 	  if test "$alldeplibs" = yes &&
  2198 	     { test "$deplibs_check_method" = pass_all ||
  2199 	       { test "$build_libtool_libs" = yes &&
  2200 		 test -n "$library_names"; }; }; then
  2201 	    # We only need to search for static libraries
  2202 	    continue
  2203 	  fi
  2204 	fi
  2205 
  2206 	link_static=no # Whether the deplib will be linked statically
  2207 	if test -n "$library_names" &&
  2208 	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2209 	  if test "$installed" = no; then
  2210 	    notinst_deplibs="$notinst_deplibs $lib"
  2211 	    need_relink=yes
  2212 	  fi
  2213 	  # This is a shared library
  2214 	
  2215       # Warn about portability, can't link against -module's on some systems (darwin)
  2216       if test "$shouldnotlink" = yes && test "$pass" = link ; then
  2217 	    $echo
  2218 	    if test "$linkmode" = prog; then
  2219 	      $echo "*** Warning: Linking the executable $output against the loadable module"
  2220 	    else
  2221 	      $echo "*** Warning: Linking the shared library $output against the loadable module"
  2222 	    fi
  2223 	    $echo "*** $linklib is not portable!"    
  2224       fi	  
  2225 	  if test "$linkmode" = lib &&
  2226 	     test "$hardcode_into_libs" = yes; then
  2227 	    # Hardcode the library path.
  2228 	    # Skip directories that are in the system default run-time
  2229 	    # search path.
  2230 	    case " $sys_lib_dlsearch_path " in
  2231 	    *" $absdir "*) ;;
  2232 	    *)
  2233 	      case "$compile_rpath " in
  2234 	      *" $absdir "*) ;;
  2235 	      *) compile_rpath="$compile_rpath $absdir"
  2236 	      esac
  2237 	      ;;
  2238 	    esac
  2239 	    case " $sys_lib_dlsearch_path " in
  2240 	    *" $libdir "*) ;;
  2241 	    *)
  2242 	      case "$finalize_rpath " in
  2243 	      *" $libdir "*) ;;
  2244 	      *) finalize_rpath="$finalize_rpath $libdir"
  2245 	      esac
  2246 	      ;;
  2247 	    esac
  2248 	  fi
  2249 
  2250 	  if test -n "$old_archive_from_expsyms_cmds"; then
  2251 	    # figure out the soname
  2252 	    set dummy $library_names
  2253 	    realname="$2"
  2254 	    shift; shift
  2255 	    libname=`eval \\$echo \"$libname_spec\"`
  2256 	    # use dlname if we got it. it's perfectly good, no?
  2257 	    if test -n "$dlname"; then
  2258 	      soname="$dlname"
  2259 	    elif test -n "$soname_spec"; then
  2260 	      # bleh windows
  2261 	      case $host in
  2262 	      *cygwin* | mingw*)
  2263 		major=`expr $current - $age`
  2264 		versuffix="-$major"
  2265 		;;
  2266 	      esac
  2267 	      eval soname=\"$soname_spec\"
  2268 	    else
  2269 	      soname="$realname"
  2270 	    fi
  2271 
  2272 	    # Make a new name for the extract_expsyms_cmds to use
  2273 	    soroot="$soname"
  2274 	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
  2275 	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  2276 
  2277 	    # If the library has no export list, then create one now
  2278 	    if test -f "$output_objdir/$soname-def"; then :
  2279 	    else
  2280 	      $show "extracting exported symbol list from \`$soname'"
  2281 	      save_ifs="$IFS"; IFS='~'
  2282 	      eval cmds=\"$extract_expsyms_cmds\"
  2283 	      for cmd in $cmds; do
  2284 		IFS="$save_ifs"
  2285 		$show "$cmd"
  2286 		$run eval "$cmd" || exit $?
  2287 	      done
  2288 	      IFS="$save_ifs"
  2289 	    fi
  2290 
  2291 	    # Create $newlib
  2292 	    if test -f "$output_objdir/$newlib"; then :; else
  2293 	      $show "generating import library for \`$soname'"
  2294 	      save_ifs="$IFS"; IFS='~'
  2295 	      eval cmds=\"$old_archive_from_expsyms_cmds\"
  2296 	      for cmd in $cmds; do
  2297 		IFS="$save_ifs"
  2298 		$show "$cmd"
  2299 		$run eval "$cmd" || exit $?
  2300 	      done
  2301 	      IFS="$save_ifs"
  2302 	    fi
  2303 	    # make sure the library variables are pointing to the new library
  2304 	    dir=$output_objdir
  2305 	    linklib=$newlib
  2306 	  fi # test -n "$old_archive_from_expsyms_cmds"
  2307 
  2308 	  if test "$linkmode" = prog || test "$mode" != relink; then
  2309 	    add_shlibpath=
  2310 	    add_dir=
  2311 	    add=
  2312 	    lib_linked=yes
  2313 	    case $hardcode_action in
  2314 	    immediate | unsupported)
  2315 	      if test "$hardcode_direct" = no; then
  2316 		add="$dir/$linklib"
  2317 		case $host in
  2318 		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
  2319 		  *-*-darwin* )
  2320 		    # if the lib is a module then we can not link against it, someone
  2321 		    # is ignoring the new warnings I added
  2322 		    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
  2323 		      $echo "** Warning, lib $linklib is a module, not a shared library"
  2324 		      if test -z "$old_library" ; then
  2325 		        $echo
  2326 		        $echo "** And there doesn't seem to be a static archive available"
  2327 		        $echo "** The link will probably fail, sorry"
  2328 		      else
  2329 		        add="$dir/$old_library"
  2330 		      fi 
  2331 		    fi
  2332 		esac
  2333 	      elif test "$hardcode_minus_L" = no; then
  2334 		case $host in
  2335 		*-*-sunos*) add_shlibpath="$dir" ;;
  2336 		esac
  2337 		add_dir="-L$dir"
  2338 		add="-l$name"
  2339 	      elif test "$hardcode_shlibpath_var" = no; then
  2340 		add_shlibpath="$dir"
  2341 		add="-l$name"
  2342 	      else
  2343 		lib_linked=no
  2344 	      fi
  2345 	      ;;
  2346 	    relink)
  2347 	      if test "$hardcode_direct" = yes; then
  2348 		add="$dir/$linklib"
  2349 	      elif test "$hardcode_minus_L" = yes; then
  2350 		add_dir="-L$dir"
  2351 		# Try looking first in the location we're being installed to.
  2352 		if test -n "$inst_prefix_dir"; then
  2353 		  case "$libdir" in
  2354 		    [\\/]*)
  2355 		      add_dir="-L$inst_prefix_dir$libdir $add_dir"
  2356 		      ;;
  2357 		  esac
  2358 		fi
  2359 		add="-l$name"
  2360 	      elif test "$hardcode_shlibpath_var" = yes; then
  2361 		add_shlibpath="$dir"
  2362 		add="-l$name"
  2363 	      else
  2364 		lib_linked=no
  2365 	      fi
  2366 	      ;;
  2367 	    *) lib_linked=no ;;
  2368 	    esac
  2369 
  2370 	    if test "$lib_linked" != yes; then
  2371 	      $echo "$modename: configuration error: unsupported hardcode properties"
  2372 	      exit 1
  2373 	    fi
  2374 
  2375 	    if test -n "$add_shlibpath"; then
  2376 	      case :$compile_shlibpath: in
  2377 	      *":$add_shlibpath:"*) ;;
  2378 	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  2379 	      esac
  2380 	    fi
  2381 	    if test "$linkmode" = prog; then
  2382 	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  2383 	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
  2384 	    else
  2385 	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2386 	      test -n "$add" && deplibs="$add $deplibs"
  2387 	      if test "$hardcode_direct" != yes && \
  2388 		 test "$hardcode_minus_L" != yes && \
  2389 		 test "$hardcode_shlibpath_var" = yes; then
  2390 		case :$finalize_shlibpath: in
  2391 		*":$libdir:"*) ;;
  2392 		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2393 		esac
  2394 	      fi
  2395 	    fi
  2396 	  fi
  2397 
  2398 	  if test "$linkmode" = prog || test "$mode" = relink; then
  2399 	    add_shlibpath=
  2400 	    add_dir=
  2401 	    add=
  2402 	    # Finalize command for both is simple: just hardcode it.
  2403 	    if test "$hardcode_direct" = yes; then
  2404 	      add="$libdir/$linklib"
  2405 	    elif test "$hardcode_minus_L" = yes; then
  2406 	      add_dir="-L$libdir"
  2407 	      add="-l$name"
  2408 	    elif test "$hardcode_shlibpath_var" = yes; then
  2409 	      case :$finalize_shlibpath: in
  2410 	      *":$libdir:"*) ;;
  2411 	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2412 	      esac
  2413 	      add="-l$name"
  2414 	    elif test "$hardcode_automatic" = yes; then
  2415 	      if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
  2416 	        add="$inst_prefix_dir$libdir/$linklib"
  2417 	      else
  2418 	        add="$libdir/$linklib"
  2419 	      fi
  2420 	    else
  2421 	      # We cannot seem to hardcode it, guess we'll fake it.
  2422 	      add_dir="-L$libdir"
  2423 	      # Try looking first in the location we're being installed to.
  2424 	      if test -n "$inst_prefix_dir"; then
  2425 		case "$libdir" in
  2426 		  [\\/]*)
  2427 		    add_dir="-L$inst_prefix_dir$libdir $add_dir"
  2428 		    ;;
  2429 		esac
  2430 	      fi
  2431 	      add="-l$name"
  2432 	    fi
  2433 
  2434 	    if test "$linkmode" = prog; then
  2435 	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  2436 	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  2437 	    else
  2438 	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2439 	      test -n "$add" && deplibs="$add $deplibs"
  2440 	    fi
  2441 	  fi
  2442 	elif test "$linkmode" = prog; then
  2443 	  # Here we assume that one of hardcode_direct or hardcode_minus_L
  2444 	  # is not unsupported.  This is valid on all known static and
  2445 	  # shared platforms.
  2446 	  if test "$hardcode_direct" != unsupported; then
  2447 	    test -n "$old_library" && linklib="$old_library"
  2448 	    compile_deplibs="$dir/$linklib $compile_deplibs"
  2449 	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
  2450 	  else
  2451 	    compile_deplibs="-l$name -L$dir $compile_deplibs"
  2452 	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  2453 	  fi
  2454 	elif test "$build_libtool_libs" = yes; then
  2455 	  # Not a shared library
  2456 	  if test "$deplibs_check_method" != pass_all; then
  2457 	    # We're trying link a shared library against a static one
  2458 	    # but the system doesn't support it.
  2459 
  2460 	    # Just print a warning and add the library to dependency_libs so
  2461 	    # that the program can be linked against the static library.
  2462 	    $echo
  2463 	    $echo "*** Warning: This system can not link to static lib archive $lib."
  2464 	    $echo "*** I have the capability to make that library automatically link in when"
  2465 	    $echo "*** you link to this library.  But I can only do this if you have a"
  2466 	    $echo "*** shared version of the library, which you do not appear to have."
  2467 	    if test "$module" = yes; then
  2468 	      $echo "*** But as you try to build a module library, libtool will still create "
  2469 	      $echo "*** a static module, that should work as long as the dlopening application"
  2470 	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  2471 	      if test -z "$global_symbol_pipe"; then
  2472 		$echo
  2473 		$echo "*** However, this would only work if libtool was able to extract symbol"
  2474 		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  2475 		$echo "*** not find such a program.  So, this module is probably useless."
  2476 		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
  2477 	      fi
  2478 	      if test "$build_old_libs" = no; then
  2479 		build_libtool_libs=module
  2480 		build_old_libs=yes
  2481 	      else
  2482 		build_libtool_libs=no
  2483 	      fi
  2484 	    fi
  2485 	  else
  2486 	    convenience="$convenience $dir/$old_library"
  2487 	    old_convenience="$old_convenience $dir/$old_library"
  2488 	    deplibs="$dir/$old_library $deplibs"
  2489 	    link_static=yes
  2490 	  fi
  2491 	fi # link shared/static library?
  2492 
  2493 	if test "$linkmode" = lib; then
  2494 	  if test -n "$dependency_libs" &&
  2495 	     { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
  2496 	       test "$link_static" = yes; }; then
  2497 	    # Extract -R from dependency_libs
  2498 	    temp_deplibs=
  2499 	    for libdir in $dependency_libs; do
  2500 	      case $libdir in
  2501 	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  2502 		   case " $xrpath " in
  2503 		   *" $temp_xrpath "*) ;;
  2504 		   *) xrpath="$xrpath $temp_xrpath";;
  2505 		   esac;;
  2506 	      *) temp_deplibs="$temp_deplibs $libdir";;
  2507 	      esac
  2508 	    done
  2509 	    dependency_libs="$temp_deplibs"
  2510 	  fi
  2511 
  2512 	  newlib_search_path="$newlib_search_path $absdir"
  2513 	  # Link against this library
  2514 	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  2515 	  # ... and its dependency_libs
  2516 	  tmp_libs=
  2517 	  for deplib in $dependency_libs; do
  2518 	    newdependency_libs="$deplib $newdependency_libs"
  2519 	    if test "X$duplicate_deps" = "Xyes" ; then
  2520 	      case "$tmp_libs " in
  2521 	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2522 	      esac
  2523 	    fi
  2524 	    tmp_libs="$tmp_libs $deplib"
  2525 	  done
  2526 
  2527 	  if test "$link_all_deplibs" != no; then
  2528 	    # Add the search paths of all dependency libraries
  2529 	    for deplib in $dependency_libs; do
  2530 	      case $deplib in
  2531 	      -L*) path="$deplib" ;;
  2532 	      *.la)
  2533 		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  2534 		test "X$dir" = "X$deplib" && dir="."
  2535 		# We need an absolute path.
  2536 		case $dir in
  2537 		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  2538 		*)
  2539 		  absdir=`cd "$dir" && pwd`
  2540 		  if test -z "$absdir"; then
  2541 		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  2542 		    absdir="$dir"
  2543 		  fi
  2544 		  ;;
  2545 		esac
  2546 		if grep "^installed=no" $deplib > /dev/null; then
  2547 		  path="$absdir/$objdir"
  2548 		else
  2549 		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  2550 		  if test -z "$libdir"; then
  2551 		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  2552 		    exit 1
  2553 		  fi
  2554 		  if test "$absdir" != "$libdir"; then
  2555 		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  2556 		  fi
  2557 		  path="$absdir"
  2558 		fi
  2559 		depdepl=
  2560 		case $host in
  2561 		*-*-darwin*)
  2562 		  # we do not want to link against static libs, but need to link against shared
  2563 		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  2564 		  if test -n "$deplibrary_names" ; then
  2565 		    for tmp in $deplibrary_names ; do
  2566 		      depdepl=$tmp
  2567 		    done
  2568 		    if test -f "$path/$depdepl" ; then
  2569 		      depdepl="$path/$depdepl"
  2570 		   fi
  2571 		    newlib_search_path="$newlib_search_path $path"
  2572 		    path=""
  2573 		  fi
  2574 		  ;;
  2575 		*)
  2576 		path="-L$path"
  2577 		;;
  2578 		esac 
  2579 		
  2580 		;;
  2581 		  -l*)
  2582 		case $host in
  2583 		*-*-darwin*)
  2584 		 # Again, we only want to link against shared libraries
  2585 		 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  2586 		 for tmp in $newlib_search_path ; do
  2587 		     if test -f "$tmp/lib$tmp_libs.dylib" ; then
  2588 		       eval depdepl="$tmp/lib$tmp_libs.dylib"
  2589 		       break
  2590 		     fi  
  2591          done
  2592          path=""
  2593 		  ;;
  2594 		*) continue ;;
  2595 		esac  		  
  2596 		;;
  2597 	      *) continue ;;
  2598 	      esac
  2599 	      case " $deplibs " in
  2600 	      *" $depdepl "*) ;;
  2601 	      *) deplibs="$deplibs $depdepl" ;;
  2602 	      esac	      
  2603 	      case " $deplibs " in
  2604 	      *" $path "*) ;;
  2605 	      *) deplibs="$deplibs $path" ;;
  2606 	      esac
  2607 	    done
  2608 	  fi # link_all_deplibs != no
  2609 	fi # linkmode = lib
  2610       done # for deplib in $libs
  2611       dependency_libs="$newdependency_libs"
  2612       if test "$pass" = dlpreopen; then
  2613 	# Link the dlpreopened libraries before other libraries
  2614 	for deplib in $save_deplibs; do
  2615 	  deplibs="$deplib $deplibs"
  2616 	done
  2617       fi
  2618       if test "$pass" != dlopen; then
  2619 	if test "$pass" != conv; then
  2620 	  # Make sure lib_search_path contains only unique directories.
  2621 	  lib_search_path=
  2622 	  for dir in $newlib_search_path; do
  2623 	    case "$lib_search_path " in
  2624 	    *" $dir "*) ;;
  2625 	    *) lib_search_path="$lib_search_path $dir" ;;
  2626 	    esac
  2627 	  done
  2628 	  newlib_search_path=
  2629 	fi
  2630 
  2631 	if test "$linkmode,$pass" != "prog,link"; then
  2632 	  vars="deplibs"
  2633 	else
  2634 	  vars="compile_deplibs finalize_deplibs"
  2635 	fi
  2636 	for var in $vars dependency_libs; do
  2637 	  # Add libraries to $var in reverse order
  2638 	  eval tmp_libs=\"\$$var\"
  2639 	  new_libs=
  2640 	  for deplib in $tmp_libs; do
  2641 	    # FIXME: Pedantically, this is the right thing to do, so
  2642 	    #        that some nasty dependency loop isn't accidentally
  2643 	    #        broken:
  2644 	    #new_libs="$deplib $new_libs"
  2645 	    # Pragmatically, this seems to cause very few problems in
  2646 	    # practice:
  2647 	    case $deplib in
  2648 	    -L*) new_libs="$deplib $new_libs" ;;
  2649 	    -R*) ;;
  2650 	    *)
  2651 	      # And here is the reason: when a library appears more
  2652 	      # than once as an explicit dependence of a library, or
  2653 	      # is implicitly linked in more than once by the
  2654 	      # compiler, it is considered special, and multiple
  2655 	      # occurrences thereof are not removed.  Compare this
  2656 	      # with having the same library being listed as a
  2657 	      # dependency of multiple other libraries: in this case,
  2658 	      # we know (pedantically, we assume) the library does not
  2659 	      # need to be listed more than once, so we keep only the
  2660 	      # last copy.  This is not always right, but it is rare
  2661 	      # enough that we require users that really mean to play
  2662 	      # such unportable linking tricks to link the library
  2663 	      # using -Wl,-lname, so that libtool does not consider it
  2664 	      # for duplicate removal.
  2665 	      case " $specialdeplibs " in
  2666 	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
  2667 	      *)
  2668 		case " $new_libs " in
  2669 		*" $deplib "*) ;;
  2670 		*) new_libs="$deplib $new_libs" ;;
  2671 		esac
  2672 		;;
  2673 	      esac
  2674 	      ;;
  2675 	    esac
  2676 	  done
  2677 	  tmp_libs=
  2678 	  for deplib in $new_libs; do
  2679 	    case $deplib in
  2680 	    -L*)
  2681 	      case " $tmp_libs " in
  2682 	      *" $deplib "*) ;;
  2683 	      *) tmp_libs="$tmp_libs $deplib" ;;
  2684 	      esac
  2685 	      ;;
  2686 	    *) tmp_libs="$tmp_libs $deplib" ;;
  2687 	    esac
  2688 	  done
  2689 	  eval $var=\"$tmp_libs\"
  2690 	done # for var
  2691       fi
  2692       # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
  2693       tmp_libs=
  2694       for i in $dependency_libs ; do
  2695 	case " $predeps $postdeps $compiler_lib_search_path " in
  2696 	*" $i "*)
  2697 	  i=""
  2698 	  ;;
  2699 	esac
  2700 	if test -n "$i" ; then
  2701 	  tmp_libs="$tmp_libs $i"
  2702 	fi
  2703       done
  2704       dependency_libs=$tmp_libs
  2705     done # for pass
  2706     if test "$linkmode" = prog; then
  2707       dlfiles="$newdlfiles"
  2708       dlprefiles="$newdlprefiles"
  2709     fi
  2710 
  2711     case $linkmode in
  2712     oldlib)
  2713       if test -n "$deplibs"; then
  2714 	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  2715       fi
  2716 
  2717       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2718 	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  2719       fi
  2720 
  2721       if test -n "$rpath"; then
  2722 	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  2723       fi
  2724 
  2725       if test -n "$xrpath"; then
  2726 	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  2727       fi
  2728 
  2729       if test -n "$vinfo"; then
  2730 	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
  2731       fi
  2732 
  2733       if test -n "$release"; then
  2734 	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  2735       fi
  2736 
  2737       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  2738 	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  2739       fi
  2740 
  2741       # Now set the variables for building old libraries.
  2742       build_libtool_libs=no
  2743       oldlibs="$output"
  2744       objs="$objs$old_deplibs"
  2745       ;;
  2746 
  2747     lib)
  2748       # Make sure we only generate libraries of the form `libNAME.la'.
  2749       case $outputname in
  2750       lib*)
  2751 	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  2752 	eval shared_ext=\"$shrext\"
  2753 	eval libname=\"$libname_spec\"
  2754 	;;
  2755       *)
  2756 	if test "$module" = no; then
  2757 	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  2758 	  $echo "$help" 1>&2
  2759 	  exit 1
  2760 	fi
  2761 	if test "$need_lib_prefix" != no; then
  2762 	  # Add the "lib" prefix for modules if required
  2763 	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  2764 	  eval shared_ext=\"$shrext\"
  2765 	  eval libname=\"$libname_spec\"
  2766 	else
  2767 	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  2768 	fi
  2769 	;;
  2770       esac
  2771 
  2772       if test -n "$objs"; then
  2773 	if test "$deplibs_check_method" != pass_all; then
  2774 	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  2775 	  exit 1
  2776 	else
  2777 	  $echo
  2778 	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
  2779 	  $echo "*** objects $objs is not portable!"
  2780 	  libobjs="$libobjs $objs"
  2781 	fi
  2782       fi
  2783 
  2784       if test "$dlself" != no; then
  2785 	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
  2786       fi
  2787 
  2788       set dummy $rpath
  2789       if test "$#" -gt 2; then
  2790 	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  2791       fi
  2792       install_libdir="$2"
  2793 
  2794       oldlibs=
  2795       if test -z "$rpath"; then
  2796 	if test "$build_libtool_libs" = yes; then
  2797 	  # Building a libtool convenience library.
  2798 	  # Some compilers have problems with a `.al' extension so
  2799 	  # convenience libraries should have the same extension an
  2800 	  # archive normally would.
  2801 	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
  2802 	  build_libtool_libs=convenience
  2803 	  build_old_libs=yes
  2804 	fi
  2805 
  2806 	if test -n "$vinfo"; then
  2807 	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
  2808 	fi
  2809 
  2810 	if test -n "$release"; then
  2811 	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  2812 	fi
  2813       else
  2814 
  2815 	# Parse the version information argument.
  2816 	save_ifs="$IFS"; IFS=':'
  2817 	set dummy $vinfo 0 0 0
  2818 	IFS="$save_ifs"
  2819 
  2820 	if test -n "$8"; then
  2821 	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
  2822 	  $echo "$help" 1>&2
  2823 	  exit 1
  2824 	fi
  2825 
  2826 	# convert absolute version numbers to libtool ages
  2827 	# this retains compatibility with .la files and attempts
  2828 	# to make the code below a bit more comprehensible
  2829 	
  2830 	case $vinfo_number in
  2831 	yes)
  2832 	  number_major="$2"
  2833 	  number_minor="$3"
  2834 	  number_revision="$4"
  2835 	  #
  2836 	  # There are really only two kinds -- those that
  2837 	  # use the current revision as the major version
  2838 	  # and those that subtract age and use age as
  2839 	  # a minor version.  But, then there is irix
  2840 	  # which has an extra 1 added just for fun
  2841 	  #
  2842 	  case $version_type in
  2843 	  darwin|linux|osf|windows)
  2844 	    current=`expr $number_major + $number_minor`
  2845 	    age="$number_minor"
  2846 	    revision="$number_revision"
  2847 	    ;;
  2848 	  freebsd-aout|freebsd-elf|sunos)
  2849 	    current="$number_major"
  2850 	    revision="$number_minor"
  2851 	    age="0"
  2852 	    ;;
  2853 	  irix|nonstopux)
  2854 	    current=`expr $number_major + $number_minor - 1`
  2855 	    age="$number_minor"
  2856 	    revision="$number_minor"
  2857 	    ;;
  2858 	  esac
  2859 	  ;;
  2860 	no)
  2861 	  current="$2"
  2862 	  revision="$3"
  2863 	  age="$4"
  2864 	  ;;
  2865 	esac
  2866 
  2867 	# Check that each of the things are valid numbers.
  2868 	case $current in
  2869 	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2870 	*)
  2871 	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  2872 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2873 	  exit 1
  2874 	  ;;
  2875 	esac
  2876 
  2877 	case $revision in
  2878 	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2879 	*)
  2880 	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  2881 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2882 	  exit 1
  2883 	  ;;
  2884 	esac
  2885 
  2886 	case $age in
  2887 	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2888 	*)
  2889 	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  2890 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2891 	  exit 1
  2892 	  ;;
  2893 	esac
  2894 
  2895 	if test "$age" -gt "$current"; then
  2896 	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  2897 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2898 	  exit 1
  2899 	fi
  2900 
  2901 	# Calculate the version variables.
  2902 	major=
  2903 	versuffix=
  2904 	verstring=
  2905 	case $version_type in
  2906 	none) ;;
  2907 
  2908 	darwin)
  2909 	  # Like Linux, but with the current version available in
  2910 	  # verstring for coding it into the library header
  2911 	  major=.`expr $current - $age`
  2912 	  versuffix="$major.$age.$revision"
  2913 	  # Darwin ld doesn't like 0 for these options...
  2914 	  minor_current=`expr $current + 1`
  2915 	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  2916 	  ;;
  2917 
  2918 	freebsd-aout)
  2919 	  major=".$current"
  2920 	  versuffix=".$current.$revision";
  2921 	  ;;
  2922 
  2923 	freebsd-elf)
  2924 	  major=".$current"
  2925 	  versuffix=".$current";
  2926 	  ;;
  2927 
  2928 	irix | nonstopux)
  2929 	  major=`expr $current - $age + 1`
  2930 
  2931 	  case $version_type in
  2932 	    nonstopux) verstring_prefix=nonstopux ;;
  2933 	    *)         verstring_prefix=sgi ;;
  2934 	  esac
  2935 	  verstring="$verstring_prefix$major.$revision"
  2936 
  2937 	  # Add in all the interfaces that we are compatible with.
  2938 	  loop=$revision
  2939 	  while test "$loop" -ne 0; do
  2940 	    iface=`expr $revision - $loop`
  2941 	    loop=`expr $loop - 1`
  2942 	    verstring="$verstring_prefix$major.$iface:$verstring"
  2943 	  done
  2944 
  2945 	  # Before this point, $major must not contain `.'.
  2946 	  major=.$major
  2947 	  versuffix="$major.$revision"
  2948 	  ;;
  2949 
  2950 	linux)
  2951 	  major=.`expr $current - $age`
  2952 	  versuffix="$major.$age.$revision"
  2953 	  ;;
  2954 
  2955 	osf)
  2956 	  major=.`expr $current - $age`
  2957 	  versuffix=".$current.$age.$revision"
  2958 	  verstring="$current.$age.$revision"
  2959 
  2960 	  # Add in all the interfaces that we are compatible with.
  2961 	  loop=$age
  2962 	  while test "$loop" -ne 0; do
  2963 	    iface=`expr $current - $loop`
  2964 	    loop=`expr $loop - 1`
  2965 	    verstring="$verstring:${iface}.0"
  2966 	  done
  2967 
  2968 	  # Make executables depend on our current version.
  2969 	  verstring="$verstring:${current}.0"
  2970 	  ;;
  2971 
  2972 	sunos)
  2973 	  major=".$current"
  2974 	  versuffix=".$current.$revision"
  2975 	  ;;
  2976 
  2977 	windows)
  2978 	  # Use '-' rather than '.', since we only want one
  2979 	  # extension on DOS 8.3 filesystems.
  2980 	  major=`expr $current - $age`
  2981 	  versuffix="-$major"
  2982 	  ;;
  2983 
  2984 	*)
  2985 	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
  2986 	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  2987 	  exit 1
  2988 	  ;;
  2989 	esac
  2990 
  2991 	# Clear the version info if we defaulted, and they specified a release.
  2992 	if test -z "$vinfo" && test -n "$release"; then
  2993 	  major=
  2994 	  case $version_type in
  2995 	  darwin)
  2996 	    # we can't check for "0.0" in archive_cmds due to quoting
  2997 	    # problems, so we reset it completely
  2998 	    verstring=
  2999 	    ;;
  3000 	  *)
  3001 	    verstring="0.0"
  3002 	    ;;
  3003 	  esac
  3004 	  if test "$need_version" = no; then
  3005 	    versuffix=
  3006 	  else
  3007 	    versuffix=".0.0"
  3008 	  fi
  3009 	fi
  3010 
  3011 	# Remove version info from name if versioning should be avoided
  3012 	if test "$avoid_version" = yes && test "$need_version" = no; then
  3013 	  major=
  3014 	  versuffix=
  3015 	  verstring=""
  3016 	fi
  3017 
  3018 	# Check to see if the archive will have undefined symbols.
  3019 	if test "$allow_undefined" = yes; then
  3020 	  if test "$allow_undefined_flag" = unsupported; then
  3021 	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  3022 	    build_libtool_libs=no
  3023 	    build_old_libs=yes
  3024 	  fi
  3025 	else
  3026 	  # Don't allow undefined symbols.
  3027 	  allow_undefined_flag="$no_undefined_flag"
  3028 	fi
  3029       fi
  3030 
  3031       if test "$mode" != relink; then
  3032 	# Remove our outputs, but don't remove object files since they
  3033 	# may have been created when compiling PIC objects.
  3034 	removelist=
  3035 	tempremovelist=`$echo "$output_objdir/*"`
  3036 	for p in $tempremovelist; do
  3037 	  case $p in
  3038 	    *.$objext)
  3039 	       ;;
  3040 	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  3041 	       removelist="$removelist $p"
  3042 	       ;;
  3043 	    *) ;;
  3044 	  esac
  3045 	done
  3046 	if test -n "$removelist"; then
  3047 	  $show "${rm}r $removelist"
  3048 	  $run ${rm}r $removelist
  3049 	fi
  3050       fi
  3051 
  3052       # Now set the variables for building old libraries.
  3053       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  3054 	oldlibs="$oldlibs $output_objdir/$libname.$libext"
  3055 
  3056 	# Transform .lo files to .o files.
  3057 	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  3058       fi
  3059 
  3060       # Eliminate all temporary directories.
  3061       for path in $notinst_path; do
  3062 	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
  3063 	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
  3064 	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
  3065       done
  3066 
  3067       if test -n "$xrpath"; then
  3068 	# If the user specified any rpath flags, then add them.
  3069 	temp_xrpath=
  3070 	for libdir in $xrpath; do
  3071 	  temp_xrpath="$temp_xrpath -R$libdir"
  3072 	  case "$finalize_rpath " in
  3073 	  *" $libdir "*) ;;
  3074 	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  3075 	  esac
  3076 	done
  3077 	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  3078 	  dependency_libs="$temp_xrpath $dependency_libs"
  3079 	fi
  3080       fi
  3081 
  3082       # Make sure dlfiles contains only unique files that won't be dlpreopened
  3083       old_dlfiles="$dlfiles"
  3084       dlfiles=
  3085       for lib in $old_dlfiles; do
  3086 	case " $dlprefiles $dlfiles " in
  3087 	*" $lib "*) ;;
  3088 	*) dlfiles="$dlfiles $lib" ;;
  3089 	esac
  3090       done
  3091 
  3092       # Make sure dlprefiles contains only unique files
  3093       old_dlprefiles="$dlprefiles"
  3094       dlprefiles=
  3095       for lib in $old_dlprefiles; do
  3096 	case "$dlprefiles " in
  3097 	*" $lib "*) ;;
  3098 	*) dlprefiles="$dlprefiles $lib" ;;
  3099 	esac
  3100       done
  3101 
  3102       if test "$build_libtool_libs" = yes; then
  3103 	if test -n "$rpath"; then
  3104 	  case $host in
  3105 	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
  3106 	    # these systems don't actually have a c library (as such)!
  3107 	    ;;
  3108 	  *-*-rhapsody* | *-*-darwin1.[012])
  3109 	    # Rhapsody C library is in the System framework
  3110 	    deplibs="$deplibs -framework System"
  3111 	    ;;
  3112 	  *-*-netbsd*)
  3113 	    # Don't link with libc until the a.out ld.so is fixed.
  3114 	    ;;
  3115 	  *-*-openbsd* | *-*-freebsd*)
  3116 	    # Do not include libc due to us having libc/libc_r.
  3117 	    test "X$arg" = "X-lc" && continue
  3118 	    ;;
  3119  	  *)
  3120 	    # Add libc to deplibs on all other systems if necessary.
  3121 	    if test "$build_libtool_need_lc" = "yes"; then
  3122 	      deplibs="$deplibs -lc"
  3123 	    fi
  3124 	    ;;
  3125 	  esac
  3126 	fi
  3127 
  3128 	# Transform deplibs into only deplibs that can be linked in shared.
  3129 	name_save=$name
  3130 	libname_save=$libname
  3131 	release_save=$release
  3132 	versuffix_save=$versuffix
  3133 	major_save=$major
  3134 	# I'm not sure if I'm treating the release correctly.  I think
  3135 	# release should show up in the -l (ie -lgmp5) so we don't want to
  3136 	# add it in twice.  Is that correct?
  3137 	release=""
  3138 	versuffix=""
  3139 	major=""
  3140 	newdeplibs=
  3141 	droppeddeps=no
  3142 	case $deplibs_check_method in
  3143 	pass_all)
  3144 	  # Don't check for shared/static.  Everything works.
  3145 	  # This might be a little naive.  We might want to check
  3146 	  # whether the library exists or not.  But this is on
  3147 	  # osf3 & osf4 and I'm not really sure... Just
  3148 	  # implementing what was already the behavior.
  3149 	  newdeplibs=$deplibs
  3150 	  ;;
  3151 	test_compile)
  3152 	  # This code stresses the "libraries are programs" paradigm to its
  3153 	  # limits. Maybe even breaks it.  We compile a program, linking it
  3154 	  # against the deplibs as a proxy for the library.  Then we can check
  3155 	  # whether they linked in statically or dynamically with ldd.
  3156 	  $rm conftest.c
  3157 	  cat > conftest.c <<EOF
  3158 	  int main() { return 0; }
  3159 EOF
  3160 	  $rm conftest
  3161 	  $LTCC -o conftest conftest.c $deplibs
  3162 	  if test "$?" -eq 0 ; then
  3163 	    ldd_output=`ldd conftest`
  3164 	    for i in $deplibs; do
  3165 	      name="`expr $i : '-l\(.*\)'`"
  3166 	      # If $name is empty we are operating on a -L argument.
  3167               if test "$name" != "" && test "$name" -ne "0"; then
  3168 		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3169 		  case " $predeps $postdeps " in
  3170 		  *" $i "*)
  3171 		    newdeplibs="$newdeplibs $i"
  3172 		    i=""
  3173 		    ;;
  3174 		  esac
  3175 	        fi
  3176 		if test -n "$i" ; then
  3177 		  libname=`eval \\$echo \"$libname_spec\"`
  3178 		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
  3179 		  set dummy $deplib_matches
  3180 		  deplib_match=$2
  3181 		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  3182 		    newdeplibs="$newdeplibs $i"
  3183 		  else
  3184 		    droppeddeps=yes
  3185 		    $echo
  3186 		    $echo "*** Warning: dynamic linker does not accept needed library $i."
  3187 		    $echo "*** I have the capability to make that library automatically link in when"
  3188 		    $echo "*** you link to this library.  But I can only do this if you have a"
  3189 		    $echo "*** shared version of the library, which I believe you do not have"
  3190 		    $echo "*** because a test_compile did reveal that the linker did not use it for"
  3191 		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
  3192 		  fi
  3193 		fi
  3194 	      else
  3195 		newdeplibs="$newdeplibs $i"
  3196 	      fi
  3197 	    done
  3198 	  else
  3199 	    # Error occurred in the first compile.  Let's try to salvage
  3200 	    # the situation: Compile a separate program for each library.
  3201 	    for i in $deplibs; do
  3202 	      name="`expr $i : '-l\(.*\)'`"
  3203 	      # If $name is empty we are operating on a -L argument.
  3204               if test "$name" != "" && test "$name" != "0"; then
  3205 		$rm conftest
  3206 		$LTCC -o conftest conftest.c $i
  3207 		# Did it work?
  3208 		if test "$?" -eq 0 ; then
  3209 		  ldd_output=`ldd conftest`
  3210 		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3211 		    case " $predeps $postdeps " in
  3212 		    *" $i "*)
  3213 		      newdeplibs="$newdeplibs $i"
  3214 		      i=""
  3215 		      ;;
  3216 		    esac
  3217 		  fi
  3218 		  if test -n "$i" ; then
  3219 		    libname=`eval \\$echo \"$libname_spec\"`
  3220 		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
  3221 		    set dummy $deplib_matches
  3222 		    deplib_match=$2
  3223 		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  3224 		      newdeplibs="$newdeplibs $i"
  3225 		    else
  3226 		      droppeddeps=yes
  3227 		      $echo
  3228 		      $echo "*** Warning: dynamic linker does not accept needed library $i."
  3229 		      $echo "*** I have the capability to make that library automatically link in when"
  3230 		      $echo "*** you link to this library.  But I can only do this if you have a"
  3231 		      $echo "*** shared version of the library, which you do not appear to have"
  3232 		      $echo "*** because a test_compile did reveal that the linker did not use this one"
  3233 		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  3234 		    fi
  3235 		  fi
  3236 		else
  3237 		  droppeddeps=yes
  3238 		  $echo
  3239 		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
  3240 		  $echo "***  make it link in!  You will probably need to install it or some"
  3241 		  $echo "*** library that it depends on before this library will be fully"
  3242 		  $echo "*** functional.  Installing it before continuing would be even better."
  3243 		fi
  3244 	      else
  3245 		newdeplibs="$newdeplibs $i"
  3246 	      fi
  3247 	    done
  3248 	  fi
  3249 	  ;;
  3250 	file_magic*)
  3251 	  set dummy $deplibs_check_method
  3252 	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3253 	  for a_deplib in $deplibs; do
  3254 	    name="`expr $a_deplib : '-l\(.*\)'`"
  3255 	    # If $name is empty we are operating on a -L argument.
  3256             if test "$name" != "" && test  "$name" != "0"; then
  3257 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3258 		case " $predeps $postdeps " in
  3259 		*" $a_deplib "*)
  3260 		  newdeplibs="$newdeplibs $a_deplib"
  3261 		  a_deplib=""
  3262 		  ;;
  3263 		esac
  3264 	      fi
  3265 	      if test -n "$a_deplib" ; then
  3266 		libname=`eval \\$echo \"$libname_spec\"`
  3267 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3268 		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3269 		  for potent_lib in $potential_libs; do
  3270 		      # Follow soft links.
  3271 		      if ls -lLd "$potent_lib" 2>/dev/null \
  3272 			 | grep " -> " >/dev/null; then
  3273 			continue
  3274 		      fi
  3275 		      # The statement above tries to avoid entering an
  3276 		      # endless loop below, in case of cyclic links.
  3277 		      # We might still enter an endless loop, since a link
  3278 		      # loop can be closed while we follow links,
  3279 		      # but so what?
  3280 		      potlib="$potent_lib"
  3281 		      while test -h "$potlib" 2>/dev/null; do
  3282 			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  3283 			case $potliblink in
  3284 			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  3285 			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  3286 			esac
  3287 		      done
  3288 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  3289 			 | ${SED} 10q \
  3290 			 | $EGREP "$file_magic_regex" > /dev/null; then
  3291 			newdeplibs="$newdeplibs $a_deplib"
  3292 			a_deplib=""
  3293 			break 2
  3294 		      fi
  3295 		  done
  3296 		done
  3297 	      fi
  3298 	      if test -n "$a_deplib" ; then
  3299 		droppeddeps=yes
  3300 		$echo
  3301 		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  3302 		$echo "*** I have the capability to make that library automatically link in when"
  3303 		$echo "*** you link to this library.  But I can only do this if you have a"
  3304 		$echo "*** shared version of the library, which you do not appear to have"
  3305 		$echo "*** because I did check the linker path looking for a file starting"
  3306 		if test -z "$potlib" ; then
  3307 		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
  3308 		else
  3309 		  $echo "*** with $libname and none of the candidates passed a file format test"
  3310 		  $echo "*** using a file magic. Last file checked: $potlib"
  3311 		fi
  3312 	      fi
  3313 	    else
  3314 	      # Add a -L argument.
  3315 	      newdeplibs="$newdeplibs $a_deplib"
  3316 	    fi
  3317 	  done # Gone through all deplibs.
  3318 	  ;;
  3319 	match_pattern*)
  3320 	  set dummy $deplibs_check_method
  3321 	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3322 	  for a_deplib in $deplibs; do
  3323 	    name="`expr $a_deplib : '-l\(.*\)'`"
  3324 	    # If $name is empty we are operating on a -L argument.
  3325 	    if test -n "$name" && test "$name" != "0"; then
  3326 	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3327 		case " $predeps $postdeps " in
  3328 		*" $a_deplib "*)
  3329 		  newdeplibs="$newdeplibs $a_deplib"
  3330 		  a_deplib=""
  3331 		  ;;
  3332 		esac
  3333 	      fi
  3334 	      if test -n "$a_deplib" ; then
  3335 		libname=`eval \\$echo \"$libname_spec\"`
  3336 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3337 		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3338 		  for potent_lib in $potential_libs; do
  3339 		    potlib="$potent_lib" # see symlink-check above in file_magic test
  3340 		    if eval $echo \"$potent_lib\" 2>/dev/null \
  3341 		        | ${SED} 10q \
  3342 		        | $EGREP "$match_pattern_regex" > /dev/null; then
  3343 		      newdeplibs="$newdeplibs $a_deplib"
  3344 		      a_deplib=""
  3345 		      break 2
  3346 		    fi
  3347 		  done
  3348 		done
  3349 	      fi
  3350 	      if test -n "$a_deplib" ; then
  3351 		droppeddeps=yes
  3352 		$echo
  3353 		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  3354 		$echo "*** I have the capability to make that library automatically link in when"
  3355 		$echo "*** you link to this library.  But I can only do this if you have a"
  3356 		$echo "*** shared version of the library, which you do not appear to have"
  3357 		$echo "*** because I did check the linker path looking for a file starting"
  3358 		if test -z "$potlib" ; then
  3359 		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
  3360 		else
  3361 		  $echo "*** with $libname and none of the candidates passed a file format test"
  3362 		  $echo "*** using a regex pattern. Last file checked: $potlib"
  3363 		fi
  3364 	      fi
  3365 	    else
  3366 	      # Add a -L argument.
  3367 	      newdeplibs="$newdeplibs $a_deplib"
  3368 	    fi
  3369 	  done # Gone through all deplibs.
  3370 	  ;;
  3371 	none | unknown | *)
  3372 	  newdeplibs=""
  3373 	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  3374 	    -e 's/ -[LR][^ ]*//g'`
  3375 	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3376 	    for i in $predeps $postdeps ; do
  3377 	      # can't use Xsed below, because $i might contain '/'
  3378 	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
  3379 	    done
  3380 	  fi
  3381 	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
  3382 	    | grep . >/dev/null; then
  3383 	    $echo
  3384 	    if test "X$deplibs_check_method" = "Xnone"; then
  3385 	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
  3386 	    else
  3387 	      $echo "*** Warning: inter-library dependencies are not known to be supported."
  3388 	    fi
  3389 	    $echo "*** All declared inter-library dependencies are being dropped."
  3390 	    droppeddeps=yes
  3391 	  fi
  3392 	  ;;
  3393 	esac
  3394 	versuffix=$versuffix_save
  3395 	major=$major_save
  3396 	release=$release_save
  3397 	libname=$libname_save
  3398 	name=$name_save
  3399 
  3400 	case $host in
  3401 	*-*-rhapsody* | *-*-darwin1.[012])
  3402 	  # On Rhapsody replace the C library is the System framework
  3403 	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3404 	  ;;
  3405 	esac
  3406 
  3407 	if test "$droppeddeps" = yes; then
  3408 	  if test "$module" = yes; then
  3409 	    $echo
  3410 	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
  3411 	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
  3412 	    $echo "*** a static module, that should work as long as the dlopening"
  3413 	    $echo "*** application is linked with the -dlopen flag."
  3414 	    if test -z "$global_symbol_pipe"; then
  3415 	      $echo
  3416 	      $echo "*** However, this would only work if libtool was able to extract symbol"
  3417 	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  3418 	      $echo "*** not find such a program.  So, this module is probably useless."
  3419 	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  3420 	    fi
  3421 	    if test "$build_old_libs" = no; then
  3422 	      oldlibs="$output_objdir/$libname.$libext"
  3423 	      build_libtool_libs=module
  3424 	      build_old_libs=yes
  3425 	    else
  3426 	      build_libtool_libs=no
  3427 	    fi
  3428 	  else
  3429 	    $echo "*** The inter-library dependencies that have been dropped here will be"
  3430 	    $echo "*** automatically added whenever a program is linked with this library"
  3431 	    $echo "*** or is declared to -dlopen it."
  3432 
  3433 	    if test "$allow_undefined" = no; then
  3434 	      $echo
  3435 	      $echo "*** Since this library must not contain undefined symbols,"
  3436 	      $echo "*** because either the platform does not support them or"
  3437 	      $echo "*** it was explicitly requested with -no-undefined,"
  3438 	      $echo "*** libtool will only create a static version of it."
  3439 	      if test "$build_old_libs" = no; then
  3440 		oldlibs="$output_objdir/$libname.$libext"
  3441 		build_libtool_libs=module
  3442 		build_old_libs=yes
  3443 	      else
  3444 		build_libtool_libs=no
  3445 	      fi
  3446 	    fi
  3447 	  fi
  3448 	fi
  3449 	# Done checking deplibs!
  3450 	deplibs=$newdeplibs
  3451       fi
  3452 
  3453       # All the library-specific variables (install_libdir is set above).
  3454       library_names=
  3455       old_library=
  3456       dlname=
  3457 
  3458       # Test again, we may have decided not to build it any more
  3459       if test "$build_libtool_libs" = yes; then
  3460 	if test "$hardcode_into_libs" = yes; then
  3461 	  # Hardcode the library paths
  3462 	  hardcode_libdirs=
  3463 	  dep_rpath=
  3464 	  rpath="$finalize_rpath"
  3465 	  test "$mode" != relink && rpath="$compile_rpath$rpath"
  3466 	  for libdir in $rpath; do
  3467 	    if test -n "$hardcode_libdir_flag_spec"; then
  3468 	      if test -n "$hardcode_libdir_separator"; then
  3469 		if test -z "$hardcode_libdirs"; then
  3470 		  hardcode_libdirs="$libdir"
  3471 		else
  3472 		  # Just accumulate the unique libdirs.
  3473 		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  3474 		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  3475 		    ;;
  3476 		  *)
  3477 		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  3478 		    ;;
  3479 		  esac
  3480 		fi
  3481 	      else
  3482 		eval flag=\"$hardcode_libdir_flag_spec\"
  3483 		dep_rpath="$dep_rpath $flag"
  3484 	      fi
  3485 	    elif test -n "$runpath_var"; then
  3486 	      case "$perm_rpath " in
  3487 	      *" $libdir "*) ;;
  3488 	      *) perm_rpath="$perm_rpath $libdir" ;;
  3489 	      esac
  3490 	    fi
  3491 	  done
  3492 	  # Substitute the hardcoded libdirs into the rpath.
  3493 	  if test -n "$hardcode_libdir_separator" &&
  3494 	     test -n "$hardcode_libdirs"; then
  3495 	    libdir="$hardcode_libdirs"
  3496 	    if test -n "$hardcode_libdir_flag_spec_ld"; then
  3497 	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  3498 	    else
  3499 	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  3500 	    fi
  3501 	  fi
  3502 	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
  3503 	    # We should set the runpath_var.
  3504 	    rpath=
  3505 	    for dir in $perm_rpath; do
  3506 	      rpath="$rpath$dir:"
  3507 	    done
  3508 	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  3509 	  fi
  3510 	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  3511 	fi
  3512 
  3513 	shlibpath="$finalize_shlibpath"
  3514 	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  3515 	if test -n "$shlibpath"; then
  3516 	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  3517 	fi
  3518 
  3519 	# Get the real and link names of the library.
  3520 	eval shared_ext=\"$shrext\"
  3521 	eval library_names=\"$library_names_spec\"
  3522 	set dummy $library_names
  3523 	realname="$2"
  3524 	shift; shift
  3525 
  3526 	if test -n "$soname_spec"; then
  3527 	  eval soname=\"$soname_spec\"
  3528 	else
  3529 	  soname="$realname"
  3530 	fi
  3531 	if test -z "$dlname"; then
  3532 	  dlname=$soname
  3533 	fi
  3534 
  3535 	lib="$output_objdir/$realname"
  3536 	for link
  3537 	do
  3538 	  linknames="$linknames $link"
  3539 	done
  3540 
  3541 	# Use standard objects if they are pic
  3542 	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3543 
  3544 	# Prepare the list of exported symbols
  3545 	if test -z "$export_symbols"; then
  3546 	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  3547 	    $show "generating symbol list for \`$libname.la'"
  3548 	    export_symbols="$output_objdir/$libname.exp"
  3549 	    $run $rm $export_symbols
  3550 	    eval cmds=\"$export_symbols_cmds\"
  3551 	    save_ifs="$IFS"; IFS='~'
  3552 	    for cmd in $cmds; do
  3553 	      IFS="$save_ifs"
  3554 	      if len=`expr "X$cmd" : ".*"` &&
  3555 	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  3556 	        $show "$cmd"
  3557 	        $run eval "$cmd" || exit $?
  3558 	        skipped_export=false
  3559 	      else
  3560 	        # The command line is too long to execute in one step.
  3561 	        $show "using reloadable object file for export list..."
  3562 	        skipped_export=:
  3563 	      fi
  3564 	    done
  3565 	    IFS="$save_ifs"
  3566 	    if test -n "$export_symbols_regex"; then
  3567 	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  3568 	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  3569 	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  3570 	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
  3571 	    fi
  3572 	  fi
  3573 	fi
  3574 
  3575 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
  3576 	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  3577 	fi
  3578 
  3579 	tmp_deplibs=
  3580 	for test_deplib in $deplibs; do
  3581 		case " $convenience " in
  3582 		*" $test_deplib "*) ;;
  3583 		*) 
  3584 			tmp_deplibs="$tmp_deplibs $test_deplib"
  3585 			;;
  3586 		esac
  3587 	done
  3588 	deplibs="$tmp_deplibs" 
  3589 
  3590 	if test -n "$convenience"; then
  3591 	  if test -n "$whole_archive_flag_spec"; then
  3592 	    save_libobjs=$libobjs
  3593 	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  3594 	  else
  3595 	    gentop="$output_objdir/${outputname}x"
  3596 	    $show "${rm}r $gentop"
  3597 	    $run ${rm}r "$gentop"
  3598 	    $show "$mkdir $gentop"
  3599 	    $run $mkdir "$gentop"
  3600 	    status=$?
  3601 	    if test "$status" -ne 0 && test ! -d "$gentop"; then
  3602 	      exit $status
  3603 	    fi
  3604 	    generated="$generated $gentop"
  3605 
  3606 	    for xlib in $convenience; do
  3607 	      # Extract the objects.
  3608 	      case $xlib in
  3609 	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  3610 	      *) xabs=`pwd`"/$xlib" ;;
  3611 	      esac
  3612 	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  3613 	      xdir="$gentop/$xlib"
  3614 
  3615 	      $show "${rm}r $xdir"
  3616 	      $run ${rm}r "$xdir"
  3617 	      $show "$mkdir $xdir"
  3618 	      $run $mkdir "$xdir"
  3619 	      status=$?
  3620 	      if test "$status" -ne 0 && test ! -d "$xdir"; then
  3621 		exit $status
  3622 	      fi
  3623 	      # We will extract separately just the conflicting names and we will no
  3624 	      # longer touch any unique names. It is faster to leave these extract
  3625 	      # automatically by $AR in one run.
  3626 	      $show "(cd $xdir && $AR x $xabs)"
  3627 	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  3628 	      if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  3629 		:
  3630 	      else
  3631 		$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  3632 		$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  3633 		$AR t "$xabs" | sort | uniq -cd | while read -r count name
  3634 		do
  3635 		  i=1
  3636 		  while test "$i" -le "$count"
  3637 		  do
  3638 		   # Put our $i before any first dot (extension)
  3639 		   # Never overwrite any file
  3640 		   name_to="$name"
  3641 		   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  3642 		   do
  3643 		     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  3644 		   done
  3645 		   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  3646 		   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  3647 		   i=`expr $i + 1`
  3648 		  done
  3649 		done
  3650 	      fi
  3651 
  3652 	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  3653 	    done
  3654 	  fi
  3655 	fi
  3656 
  3657 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  3658 	  eval flag=\"$thread_safe_flag_spec\"
  3659 	  linker_flags="$linker_flags $flag"
  3660 	fi
  3661 
  3662 	# Make a backup of the uninstalled library when relinking
  3663 	if test "$mode" = relink; then
  3664 	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  3665 	fi
  3666 
  3667 	# Do each of the archive commands.
  3668 	if test "$module" = yes && test -n "$module_cmds" ; then
  3669 	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  3670 	    eval cmds=\"$module_expsym_cmds\"
  3671 	  else
  3672 	    eval cmds=\"$module_cmds\"
  3673 	  fi
  3674 	else
  3675 	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  3676 	  eval cmds=\"$archive_expsym_cmds\"
  3677 	else
  3678 	  eval cmds=\"$archive_cmds\"
  3679 	  fi
  3680 	fi
  3681 
  3682 	if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
  3683 	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  3684 	  :
  3685 	else
  3686 	  # The command line is too long to link in one step, link piecewise.
  3687 	  $echo "creating reloadable object files..."
  3688 
  3689 	  # Save the value of $output and $libobjs because we want to
  3690 	  # use them later.  If we have whole_archive_flag_spec, we
  3691 	  # want to use save_libobjs as it was before
  3692 	  # whole_archive_flag_spec was expanded, because we can't
  3693 	  # assume the linker understands whole_archive_flag_spec.
  3694 	  # This may have to be revisited, in case too many
  3695 	  # convenience libraries get linked in and end up exceeding
  3696 	  # the spec.
  3697 	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  3698 	    save_libobjs=$libobjs
  3699 	  fi
  3700 	  save_output=$output
  3701 
  3702 	  # Clear the reloadable object creation command queue and
  3703 	  # initialize k to one.
  3704 	  test_cmds=
  3705 	  concat_cmds=
  3706 	  objlist=
  3707 	  delfiles=
  3708 	  last_robj=
  3709 	  k=1
  3710 	  output=$output_objdir/$save_output-${k}.$objext
  3711 	  # Loop over the list of objects to be linked.
  3712 	  for obj in $save_libobjs
  3713 	  do
  3714 	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  3715 	    if test "X$objlist" = X ||
  3716 	       { len=`expr "X$test_cmds" : ".*"` &&
  3717 		 test "$len" -le "$max_cmd_len"; }; then
  3718 	      objlist="$objlist $obj"
  3719 	    else
  3720 	      # The command $test_cmds is almost too long, add a
  3721 	      # command to the queue.
  3722 	      if test "$k" -eq 1 ; then
  3723 		# The first file doesn't have a previous command to add.
  3724 		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  3725 	      else
  3726 		# All subsequent reloadable object files will link in
  3727 		# the last one created.
  3728 		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  3729 	      fi
  3730 	      last_robj=$output_objdir/$save_output-${k}.$objext
  3731 	      k=`expr $k + 1`
  3732 	      output=$output_objdir/$save_output-${k}.$objext
  3733 	      objlist=$obj
  3734 	      len=1
  3735 	    fi
  3736 	  done
  3737 	  # Handle the remaining objects by creating one last
  3738 	  # reloadable object file.  All subsequent reloadable object
  3739 	  # files will link in the last one created.
  3740 	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  3741 	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  3742 
  3743 	  if ${skipped_export-false}; then
  3744 	    $show "generating symbol list for \`$libname.la'"
  3745 	    export_symbols="$output_objdir/$libname.exp"
  3746 	    $run $rm $export_symbols
  3747 	    libobjs=$output
  3748 	    # Append the command to create the export file.
  3749 	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  3750           fi
  3751 
  3752 	  # Set up a command to remove the reloadale object files
  3753 	  # after they are used.
  3754 	  i=0
  3755 	  while test "$i" -lt "$k"
  3756 	  do
  3757 	    i=`expr $i + 1`
  3758 	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
  3759 	  done
  3760 
  3761 	  $echo "creating a temporary reloadable object file: $output"
  3762 
  3763 	  # Loop through the commands generated above and execute them.
  3764 	  save_ifs="$IFS"; IFS='~'
  3765 	  for cmd in $concat_cmds; do
  3766 	    IFS="$save_ifs"
  3767 	    $show "$cmd"
  3768 	    $run eval "$cmd" || exit $?
  3769 	  done
  3770 	  IFS="$save_ifs"
  3771 
  3772 	  libobjs=$output
  3773 	  # Restore the value of output.
  3774 	  output=$save_output
  3775 
  3776 	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  3777 	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  3778 	  fi
  3779 	  # Expand the library linking commands again to reset the
  3780 	  # value of $libobjs for piecewise linking.
  3781 
  3782 	  # Do each of the archive commands.
  3783 	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  3784 	    eval cmds=\"$archive_expsym_cmds\"
  3785 	  else
  3786 	    eval cmds=\"$archive_cmds\"
  3787 	  fi
  3788 
  3789 	  # Append the command to remove the reloadable object files
  3790 	  # to the just-reset $cmds.
  3791 	  eval cmds=\"\$cmds~$rm $delfiles\"
  3792 	fi
  3793 	save_ifs="$IFS"; IFS='~'
  3794 	for cmd in $cmds; do
  3795 	  IFS="$save_ifs"
  3796 	  $show "$cmd"
  3797 	  $run eval "$cmd" || exit $?
  3798 	done
  3799 	IFS="$save_ifs"
  3800 
  3801 	# Restore the uninstalled library and exit
  3802 	if test "$mode" = relink; then
  3803 	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  3804 	  exit 0
  3805 	fi
  3806 
  3807 	# Create links to the real library.
  3808 	for linkname in $linknames; do
  3809 	  if test "$realname" != "$linkname"; then
  3810 	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  3811 	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  3812 	  fi
  3813 	done
  3814 
  3815 	# If -module or -export-dynamic was specified, set the dlname.
  3816 	if test "$module" = yes || test "$export_dynamic" = yes; then
  3817 	  # On all known operating systems, these are identical.
  3818 	  dlname="$soname"
  3819 	fi
  3820       fi
  3821       ;;
  3822 
  3823     obj)
  3824       if test -n "$deplibs"; then
  3825 	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  3826       fi
  3827 
  3828       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  3829 	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  3830       fi
  3831 
  3832       if test -n "$rpath"; then
  3833 	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  3834       fi
  3835 
  3836       if test -n "$xrpath"; then
  3837 	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  3838       fi
  3839 
  3840       if test -n "$vinfo"; then
  3841 	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  3842       fi
  3843 
  3844       if test -n "$release"; then
  3845 	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  3846       fi
  3847 
  3848       case $output in
  3849       *.lo)
  3850 	if test -n "$objs$old_deplibs"; then
  3851 	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  3852 	  exit 1
  3853 	fi
  3854 	libobj="$output"
  3855 	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  3856 	;;
  3857       *)
  3858 	libobj=
  3859 	obj="$output"
  3860 	;;
  3861       esac
  3862 
  3863       # Delete the old objects.
  3864       $run $rm $obj $libobj
  3865 
  3866       # Objects from convenience libraries.  This assumes
  3867       # single-version convenience libraries.  Whenever we create
  3868       # different ones for PIC/non-PIC, this we'll have to duplicate
  3869       # the extraction.
  3870       reload_conv_objs=
  3871       gentop=
  3872       # reload_cmds runs $LD directly, so let us get rid of
  3873       # -Wl from whole_archive_flag_spec
  3874       wl=
  3875 
  3876       if test -n "$convenience"; then
  3877 	if test -n "$whole_archive_flag_spec"; then
  3878 	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  3879 	else
  3880 	  gentop="$output_objdir/${obj}x"
  3881 	  $show "${rm}r $gentop"
  3882 	  $run ${rm}r "$gentop"
  3883 	  $show "$mkdir $gentop"
  3884 	  $run $mkdir "$gentop"
  3885 	  status=$?
  3886 	  if test "$status" -ne 0 && test ! -d "$gentop"; then
  3887 	    exit $status
  3888 	  fi
  3889 	  generated="$generated $gentop"
  3890 
  3891 	  for xlib in $convenience; do
  3892 	    # Extract the objects.
  3893 	    case $xlib in
  3894 	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  3895 	    *) xabs=`pwd`"/$xlib" ;;
  3896 	    esac
  3897 	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  3898 	    xdir="$gentop/$xlib"
  3899 
  3900 	    $show "${rm}r $xdir"
  3901 	    $run ${rm}r "$xdir"
  3902 	    $show "$mkdir $xdir"
  3903 	    $run $mkdir "$xdir"
  3904 	    status=$?
  3905 	    if test "$status" -ne 0 && test ! -d "$xdir"; then
  3906 	      exit $status
  3907 	    fi
  3908 	    # We will extract separately just the conflicting names and we will no
  3909 	    # longer touch any unique names. It is faster to leave these extract
  3910 	    # automatically by $AR in one run.
  3911 	    $show "(cd $xdir && $AR x $xabs)"
  3912 	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  3913 	    if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  3914 	      :
  3915 	    else
  3916 	      $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  3917 	      $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  3918 	      $AR t "$xabs" | sort | uniq -cd | while read -r count name
  3919 	      do
  3920 		i=1
  3921 		while test "$i" -le "$count"
  3922 		do
  3923 		 # Put our $i before any first dot (extension)
  3924 		 # Never overwrite any file
  3925 		 name_to="$name"
  3926 		 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  3927 		 do
  3928 		   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  3929 		 done
  3930 		 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  3931 		 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  3932 		 i=`expr $i + 1`
  3933 		done
  3934 	      done
  3935 	    fi
  3936 
  3937 	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  3938 	  done
  3939 	fi
  3940       fi
  3941 
  3942       # Create the old-style object.
  3943       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
  3944 
  3945       output="$obj"
  3946       eval cmds=\"$reload_cmds\"
  3947       save_ifs="$IFS"; IFS='~'
  3948       for cmd in $cmds; do
  3949 	IFS="$save_ifs"
  3950 	$show "$cmd"
  3951 	$run eval "$cmd" || exit $?
  3952       done
  3953       IFS="$save_ifs"
  3954 
  3955       # Exit if we aren't doing a library object file.
  3956       if test -z "$libobj"; then
  3957 	if test -n "$gentop"; then
  3958 	  $show "${rm}r $gentop"
  3959 	  $run ${rm}r $gentop
  3960 	fi
  3961 
  3962 	exit 0
  3963       fi
  3964 
  3965       if test "$build_libtool_libs" != yes; then
  3966 	if test -n "$gentop"; then
  3967 	  $show "${rm}r $gentop"
  3968 	  $run ${rm}r $gentop
  3969 	fi
  3970 
  3971 	# Create an invalid libtool object if no PIC, so that we don't
  3972 	# accidentally link it into a program.
  3973 	# $show "echo timestamp > $libobj"
  3974 	# $run eval "echo timestamp > $libobj" || exit $?
  3975 	exit 0
  3976       fi
  3977 
  3978       if test -n "$pic_flag" || test "$pic_mode" != default; then
  3979 	# Only do commands if we really have different PIC objects.
  3980 	reload_objs="$libobjs $reload_conv_objs"
  3981 	output="$libobj"
  3982 	eval cmds=\"$reload_cmds\"
  3983 	save_ifs="$IFS"; IFS='~'
  3984 	for cmd in $cmds; do
  3985 	  IFS="$save_ifs"
  3986 	  $show "$cmd"
  3987 	  $run eval "$cmd" || exit $?
  3988 	done
  3989 	IFS="$save_ifs"
  3990       fi
  3991 
  3992       if test -n "$gentop"; then
  3993 	$show "${rm}r $gentop"
  3994 	$run ${rm}r $gentop
  3995       fi
  3996 
  3997       exit 0
  3998       ;;
  3999 
  4000     prog)
  4001       case $host in
  4002 	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
  4003       esac
  4004       if test -n "$vinfo"; then
  4005 	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  4006       fi
  4007 
  4008       if test -n "$release"; then
  4009 	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  4010       fi
  4011 
  4012       if test "$preload" = yes; then
  4013 	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
  4014 	   test "$dlopen_self_static" = unknown; then
  4015 	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  4016 	fi
  4017       fi
  4018 
  4019       case $host in
  4020       *-*-rhapsody* | *-*-darwin1.[012])
  4021 	# On Rhapsody replace the C library is the System framework
  4022 	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  4023 	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  4024 	;;
  4025       esac
  4026 
  4027       case $host in
  4028       *darwin*)
  4029         # Don't allow lazy linking, it breaks C++ global constructors
  4030         if test "$tagname" = CXX ; then
  4031         compile_command="$compile_command ${wl}-bind_at_load"
  4032         finalize_command="$finalize_command ${wl}-bind_at_load"
  4033         fi
  4034         ;;
  4035       esac
  4036 
  4037       compile_command="$compile_command $compile_deplibs"
  4038       finalize_command="$finalize_command $finalize_deplibs"
  4039 
  4040       if test -n "$rpath$xrpath"; then
  4041 	# If the user specified any rpath flags, then add them.
  4042 	for libdir in $rpath $xrpath; do
  4043 	  # This is the magic to use -rpath.
  4044 	  case "$finalize_rpath " in
  4045 	  *" $libdir "*) ;;
  4046 	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  4047 	  esac
  4048 	done
  4049       fi
  4050 
  4051       # Now hardcode the library paths
  4052       rpath=
  4053       hardcode_libdirs=
  4054       for libdir in $compile_rpath $finalize_rpath; do
  4055 	if test -n "$hardcode_libdir_flag_spec"; then
  4056 	  if test -n "$hardcode_libdir_separator"; then
  4057 	    if test -z "$hardcode_libdirs"; then
  4058 	      hardcode_libdirs="$libdir"
  4059 	    else
  4060 	      # Just accumulate the unique libdirs.
  4061 	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  4062 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  4063 		;;
  4064 	      *)
  4065 		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  4066 		;;
  4067 	      esac
  4068 	    fi
  4069 	  else
  4070 	    eval flag=\"$hardcode_libdir_flag_spec\"
  4071 	    rpath="$rpath $flag"
  4072 	  fi
  4073 	elif test -n "$runpath_var"; then
  4074 	  case "$perm_rpath " in
  4075 	  *" $libdir "*) ;;
  4076 	  *) perm_rpath="$perm_rpath $libdir" ;;
  4077 	  esac
  4078 	fi
  4079 	case $host in
  4080 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  4081 	  case :$dllsearchpath: in
  4082 	  *":$libdir:"*) ;;
  4083 	  *) dllsearchpath="$dllsearchpath:$libdir";;
  4084 	  esac
  4085 	  ;;
  4086 	esac
  4087       done
  4088       # Substitute the hardcoded libdirs into the rpath.
  4089       if test -n "$hardcode_libdir_separator" &&
  4090 	 test -n "$hardcode_libdirs"; then
  4091 	libdir="$hardcode_libdirs"
  4092 	eval rpath=\" $hardcode_libdir_flag_spec\"
  4093       fi
  4094       compile_rpath="$rpath"
  4095 
  4096       rpath=
  4097       hardcode_libdirs=
  4098       for libdir in $finalize_rpath; do
  4099 	if test -n "$hardcode_libdir_flag_spec"; then
  4100 	  if test -n "$hardcode_libdir_separator"; then
  4101 	    if test -z "$hardcode_libdirs"; then
  4102 	      hardcode_libdirs="$libdir"
  4103 	    else
  4104 	      # Just accumulate the unique libdirs.
  4105 	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  4106 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  4107 		;;
  4108 	      *)
  4109 		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  4110 		;;
  4111 	      esac
  4112 	    fi
  4113 	  else
  4114 	    eval flag=\"$hardcode_libdir_flag_spec\"
  4115 	    rpath="$rpath $flag"
  4116 	  fi
  4117 	elif test -n "$runpath_var"; then
  4118 	  case "$finalize_perm_rpath " in
  4119 	  *" $libdir "*) ;;
  4120 	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  4121 	  esac
  4122 	fi
  4123       done
  4124       # Substitute the hardcoded libdirs into the rpath.
  4125       if test -n "$hardcode_libdir_separator" &&
  4126 	 test -n "$hardcode_libdirs"; then
  4127 	libdir="$hardcode_libdirs"
  4128 	eval rpath=\" $hardcode_libdir_flag_spec\"
  4129       fi
  4130       finalize_rpath="$rpath"
  4131 
  4132       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  4133 	# Transform all the library objects into standard objects.
  4134 	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  4135 	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  4136       fi
  4137 
  4138       dlsyms=
  4139       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  4140 	if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4141 	  dlsyms="${outputname}S.c"
  4142 	else
  4143 	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  4144 	fi
  4145       fi
  4146 
  4147       if test -n "$dlsyms"; then
  4148 	case $dlsyms in
  4149 	"") ;;
  4150 	*.c)
  4151 	  # Discover the nlist of each of the dlfiles.
  4152 	  nlist="$output_objdir/${outputname}.nm"
  4153 
  4154 	  $show "$rm $nlist ${nlist}S ${nlist}T"
  4155 	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
  4156 
  4157 	  # Parse the name list into a source file.
  4158 	  $show "creating $output_objdir/$dlsyms"
  4159 
  4160 	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  4161 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  4162 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  4163 
  4164 #ifdef __cplusplus
  4165 extern \"C\" {
  4166 #endif
  4167 
  4168 /* Prevent the only kind of declaration conflicts we can make. */
  4169 #define lt_preloaded_symbols some_other_symbol
  4170 
  4171 /* External symbol declarations for the compiler. */\
  4172 "
  4173 
  4174 	  if test "$dlself" = yes; then
  4175 	    $show "generating symbol list for \`$output'"
  4176 
  4177 	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  4178 
  4179 	    # Add our own program objects to the symbol list.
  4180 	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  4181 	    for arg in $progfiles; do
  4182 	      $show "extracting global C symbols from \`$arg'"
  4183 	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  4184 	    done
  4185 
  4186 	    if test -n "$exclude_expsyms"; then
  4187 	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4188 	      $run eval '$mv "$nlist"T "$nlist"'
  4189 	    fi
  4190 
  4191 	    if test -n "$export_symbols_regex"; then
  4192 	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4193 	      $run eval '$mv "$nlist"T "$nlist"'
  4194 	    fi
  4195 
  4196 	    # Prepare the list of exported symbols
  4197 	    if test -z "$export_symbols"; then
  4198 	      export_symbols="$output_objdir/$output.exp"
  4199 	      $run $rm $export_symbols
  4200 	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4201 	    else
  4202 	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  4203 	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  4204 	      $run eval 'mv "$nlist"T "$nlist"'
  4205 	    fi
  4206 	  fi
  4207 
  4208 	  for arg in $dlprefiles; do
  4209 	    $show "extracting global C symbols from \`$arg'"
  4210 	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
  4211 	    $run eval '$echo ": $name " >> "$nlist"'
  4212 	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  4213 	  done
  4214 
  4215 	  if test -z "$run"; then
  4216 	    # Make sure we have at least an empty file.
  4217 	    test -f "$nlist" || : > "$nlist"
  4218 
  4219 	    if test -n "$exclude_expsyms"; then
  4220 	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4221 	      $mv "$nlist"T "$nlist"
  4222 	    fi
  4223 
  4224 	    # Try sorting and uniquifying the output.
  4225 	    if grep -v "^: " < "$nlist" |
  4226 		if sort -k 3 </dev/null >/dev/null 2>&1; then
  4227 		  sort -k 3
  4228 		else
  4229 		  sort +2
  4230 		fi |
  4231 		uniq > "$nlist"S; then
  4232 	      :
  4233 	    else
  4234 	      grep -v "^: " < "$nlist" > "$nlist"S
  4235 	    fi
  4236 
  4237 	    if test -f "$nlist"S; then
  4238 	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  4239 	    else
  4240 	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
  4241 	    fi
  4242 
  4243 	    $echo >> "$output_objdir/$dlsyms" "\
  4244 
  4245 #undef lt_preloaded_symbols
  4246 
  4247 #if defined (__STDC__) && __STDC__
  4248 # define lt_ptr void *
  4249 #else
  4250 # define lt_ptr char *
  4251 # define const
  4252 #endif
  4253 
  4254 /* The mapping between symbol names and symbols. */
  4255 const struct {
  4256   const char *name;
  4257   lt_ptr address;
  4258 }
  4259 lt_preloaded_symbols[] =
  4260 {\
  4261 "
  4262 
  4263 	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
  4264 
  4265 	    $echo >> "$output_objdir/$dlsyms" "\
  4266   {0, (lt_ptr) 0}
  4267 };
  4268 
  4269 /* This works around a problem in FreeBSD linker */
  4270 #ifdef FREEBSD_WORKAROUND
  4271 static const void *lt_preloaded_setup() {
  4272   return lt_preloaded_symbols;
  4273 }
  4274 #endif
  4275 
  4276 #ifdef __cplusplus
  4277 }
  4278 #endif\
  4279 "
  4280 	  fi
  4281 
  4282 	  pic_flag_for_symtable=
  4283 	  case $host in
  4284 	  # compiling the symbol table file with pic_flag works around
  4285 	  # a FreeBSD bug that causes programs to crash when -lm is
  4286 	  # linked before any other PIC object.  But we must not use
  4287 	  # pic_flag when linking with -static.  The problem exists in
  4288 	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4289 	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4290 	    case "$compile_command " in
  4291 	    *" -static "*) ;;
  4292 	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
  4293 	    esac;;
  4294 	  *-*-hpux*)
  4295 	    case "$compile_command " in
  4296 	    *" -static "*) ;;
  4297 	    *) pic_flag_for_symtable=" $pic_flag";;
  4298 	    esac
  4299 	  esac
  4300 
  4301 	  # Now compile the dynamic symbol file.
  4302 	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  4303 	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  4304 
  4305 	  # Clean up the generated files.
  4306 	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  4307 	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  4308 
  4309 	  # Transform the symbol file into the correct name.
  4310 	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4311 	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4312 	  ;;
  4313 	*)
  4314 	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  4315 	  exit 1
  4316 	  ;;
  4317 	esac
  4318       else
  4319 	# We keep going just in case the user didn't refer to
  4320 	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  4321 	# really was required.
  4322 
  4323 	# Nullify the symbol file.
  4324 	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  4325 	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  4326       fi
  4327 
  4328       if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  4329 	# Replace the output file specification.
  4330 	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4331 	link_command="$compile_command$compile_rpath"
  4332 
  4333 	# We have no uninstalled library dependencies, so finalize right now.
  4334 	$show "$link_command"
  4335 	$run eval "$link_command"
  4336 	status=$?
  4337 
  4338 	# Delete the generated files.
  4339 	if test -n "$dlsyms"; then
  4340 	  $show "$rm $output_objdir/${outputname}S.${objext}"
  4341 	  $run $rm "$output_objdir/${outputname}S.${objext}"
  4342 	fi
  4343 
  4344 	exit $status
  4345       fi
  4346 
  4347       if test -n "$shlibpath_var"; then
  4348 	# We should set the shlibpath_var
  4349 	rpath=
  4350 	for dir in $temp_rpath; do
  4351 	  case $dir in
  4352 	  [\\/]* | [A-Za-z]:[\\/]*)
  4353 	    # Absolute path.
  4354 	    rpath="$rpath$dir:"
  4355 	    ;;
  4356 	  *)
  4357 	    # Relative path: add a thisdir entry.
  4358 	    rpath="$rpath\$thisdir/$dir:"
  4359 	    ;;
  4360 	  esac
  4361 	done
  4362 	temp_rpath="$rpath"
  4363       fi
  4364 
  4365       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  4366 	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  4367       fi
  4368       if test -n "$finalize_shlibpath"; then
  4369 	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  4370       fi
  4371 
  4372       compile_var=
  4373       finalize_var=
  4374       if test -n "$runpath_var"; then
  4375 	if test -n "$perm_rpath"; then
  4376 	  # We should set the runpath_var.
  4377 	  rpath=
  4378 	  for dir in $perm_rpath; do
  4379 	    rpath="$rpath$dir:"
  4380 	  done
  4381 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4382 	fi
  4383 	if test -n "$finalize_perm_rpath"; then
  4384 	  # We should set the runpath_var.
  4385 	  rpath=
  4386 	  for dir in $finalize_perm_rpath; do
  4387 	    rpath="$rpath$dir:"
  4388 	  done
  4389 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4390 	fi
  4391       fi
  4392 
  4393       if test "$no_install" = yes; then
  4394 	# We don't need to create a wrapper script.
  4395 	link_command="$compile_var$compile_command$compile_rpath"
  4396 	# Replace the output file specification.
  4397 	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4398 	# Delete the old output file.
  4399 	$run $rm $output
  4400 	# Link the executable and exit
  4401 	$show "$link_command"
  4402 	$run eval "$link_command" || exit $?
  4403 	exit 0
  4404       fi
  4405 
  4406       if test "$hardcode_action" = relink; then
  4407 	# Fast installation is not supported
  4408 	link_command="$compile_var$compile_command$compile_rpath"
  4409 	relink_command="$finalize_var$finalize_command$finalize_rpath"
  4410 
  4411 	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  4412 	$echo "$modename: \`$output' will be relinked during installation" 1>&2
  4413       else
  4414 	if test "$fast_install" != no; then
  4415 	  link_command="$finalize_var$compile_command$finalize_rpath"
  4416 	  if test "$fast_install" = yes; then
  4417 	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  4418 	  else
  4419 	    # fast_install is set to needless
  4420 	    relink_command=
  4421 	  fi
  4422 	else
  4423 	  link_command="$compile_var$compile_command$compile_rpath"
  4424 	  relink_command="$finalize_var$finalize_command$finalize_rpath"
  4425 	fi
  4426       fi
  4427 
  4428       # Replace the output file specification.
  4429       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  4430 
  4431       # Delete the old output files.
  4432       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  4433 
  4434       $show "$link_command"
  4435       $run eval "$link_command" || exit $?
  4436 
  4437       # Now create the wrapper script.
  4438       $show "creating $output"
  4439 
  4440       # Quote the relink command for shipping.
  4441       if test -n "$relink_command"; then
  4442 	# Preserve any variables that may affect compiler behavior
  4443 	for var in $variables_saved_for_relink; do
  4444 	  if eval test -z \"\${$var+set}\"; then
  4445 	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  4446 	  elif eval var_value=\$$var; test -z "$var_value"; then
  4447 	    relink_command="$var=; export $var; $relink_command"
  4448 	  else
  4449 	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  4450 	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
  4451 	  fi
  4452 	done
  4453 	relink_command="(cd `pwd`; $relink_command)"
  4454 	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  4455       fi
  4456 
  4457       # Quote $echo for shipping.
  4458       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  4459 	case $0 in
  4460 	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  4461 	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  4462 	esac
  4463 	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  4464       else
  4465 	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  4466       fi
  4467 
  4468       # Only actually do things if our run command is non-null.
  4469       if test -z "$run"; then
  4470 	# win32 will think the script is a binary if it has
  4471 	# a .exe suffix, so we strip it off here.
  4472 	case $output in
  4473 	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
  4474 	esac
  4475 	# test for cygwin because mv fails w/o .exe extensions
  4476 	case $host in
  4477 	  *cygwin*)
  4478 	    exeext=.exe
  4479 	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
  4480 	  *) exeext= ;;
  4481 	esac
  4482 	case $host in
  4483 	  *cygwin* | *mingw* )
  4484 	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
  4485 	    cwrapper=`$echo ${output}.exe`
  4486 	    $rm $cwrappersource $cwrapper
  4487 	    trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
  4488 
  4489 	    cat > $cwrappersource <<EOF
  4490 
  4491 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  4492    Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4493 
  4494    The $output program cannot be directly executed until all the libtool
  4495    libraries that it depends on are installed.
  4496    
  4497    This wrapper executable should never be moved out of the build directory.
  4498    If it is, it will not operate correctly.
  4499 
  4500    Currently, it simply execs the wrapper *script* "/bin/sh $output",
  4501    but could eventually absorb all of the scripts functionality and
  4502    exec $objdir/$outputname directly.
  4503 */
  4504 EOF
  4505 	    cat >> $cwrappersource<<"EOF"
  4506 #include <stdio.h>
  4507 #include <stdlib.h>
  4508 #include <unistd.h>
  4509 #include <malloc.h>
  4510 #include <stdarg.h>
  4511 #include <assert.h>
  4512 #include <sys/stat.h>
  4513 
  4514 #if defined(PATH_MAX)
  4515 # define LT_PATHMAX PATH_MAX
  4516 #elif defined(MAXPATHLEN)
  4517 # define LT_PATHMAX MAXPATHLEN
  4518 #else
  4519 # define LT_PATHMAX 1024
  4520 #endif
  4521 
  4522 #ifndef DIR_SEPARATOR
  4523 # define DIR_SEPARATOR '/'
  4524 # define PATH_SEPARATOR ':'
  4525 #endif
  4526 
  4527 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  4528   defined (__OS2__)
  4529 # define HAVE_DOS_BASED_FILE_SYSTEM
  4530 # ifndef DIR_SEPARATOR_2 
  4531 #  define DIR_SEPARATOR_2 '\\'
  4532 # endif
  4533 # ifndef PATH_SEPARATOR_2 
  4534 #  define PATH_SEPARATOR_2 ';'
  4535 # endif
  4536 #endif
  4537 
  4538 #ifndef DIR_SEPARATOR_2
  4539 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  4540 #else /* DIR_SEPARATOR_2 */
  4541 # define IS_DIR_SEPARATOR(ch) \
  4542         (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  4543 #endif /* DIR_SEPARATOR_2 */
  4544 
  4545 #ifndef PATH_SEPARATOR_2
  4546 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  4547 #else /* PATH_SEPARATOR_2 */
  4548 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  4549 #endif /* PATH_SEPARATOR_2 */
  4550 
  4551 #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  4552 #define XFREE(stale) do { \
  4553   if (stale) { free ((void *) stale); stale = 0; } \
  4554 } while (0)
  4555 
  4556 #if defined DEBUGWRAPPER
  4557 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
  4558 #else
  4559 # define DEBUG(format, ...) 
  4560 #endif
  4561 
  4562 const char *program_name = NULL;
  4563 
  4564 void * xmalloc (size_t num);
  4565 char * xstrdup (const char *string);
  4566 char * basename (const char *name);
  4567 char * find_executable(const char *wrapper);
  4568 int    check_executable(const char *path);
  4569 char * strendzap(char *str, const char *pat);
  4570 void lt_fatal (const char *message, ...);
  4571 
  4572 int
  4573 main (int argc, char *argv[])
  4574 {
  4575   char **newargz;
  4576   int i;
  4577   
  4578   program_name = (char *) xstrdup ((char *) basename (argv[0]));
  4579   DEBUG("(main) argv[0]      : %s\n",argv[0]);
  4580   DEBUG("(main) program_name : %s\n",program_name);
  4581   newargz = XMALLOC(char *, argc+2);
  4582 EOF
  4583 
  4584 	    cat >> $cwrappersource <<EOF
  4585   newargz[0] = "$SHELL";
  4586 EOF
  4587 
  4588 	    cat >> $cwrappersource <<"EOF"
  4589   newargz[1] = find_executable(argv[0]);
  4590   if (newargz[1] == NULL)
  4591     lt_fatal("Couldn't find %s", argv[0]);
  4592   DEBUG("(main) found exe at : %s\n",newargz[1]);
  4593   /* we know the script has the same name, without the .exe */
  4594   /* so make sure newargz[1] doesn't end in .exe */
  4595   strendzap(newargz[1],".exe"); 
  4596   for (i = 1; i < argc; i++)
  4597     newargz[i+1] = xstrdup(argv[i]);
  4598   newargz[argc+1] = NULL;
  4599 
  4600   for (i=0; i<argc+1; i++)
  4601   {
  4602     DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
  4603     ;
  4604   }
  4605 
  4606 EOF
  4607 
  4608 	    cat >> $cwrappersource <<EOF
  4609   execv("$SHELL",newargz);
  4610 EOF
  4611 
  4612 	    cat >> $cwrappersource <<"EOF"
  4613 }
  4614 
  4615 void *
  4616 xmalloc (size_t num)
  4617 {
  4618   void * p = (void *) malloc (num);
  4619   if (!p)
  4620     lt_fatal ("Memory exhausted");
  4621 
  4622   return p;
  4623 }
  4624 
  4625 char * 
  4626 xstrdup (const char *string)
  4627 {
  4628   return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
  4629 ;
  4630 }
  4631 
  4632 char *
  4633 basename (const char *name)
  4634 {
  4635   const char *base;
  4636 
  4637 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4638   /* Skip over the disk name in MSDOS pathnames. */
  4639   if (isalpha (name[0]) && name[1] == ':') 
  4640     name += 2;
  4641 #endif
  4642 
  4643   for (base = name; *name; name++)
  4644     if (IS_DIR_SEPARATOR (*name))
  4645       base = name + 1;
  4646   return (char *) base;
  4647 }
  4648 
  4649 int
  4650 check_executable(const char * path)
  4651 {
  4652   struct stat st;
  4653 
  4654   DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
  4655   if ((!path) || (!*path))
  4656     return 0;
  4657 
  4658   if ((stat (path, &st) >= 0) &&
  4659       (((st.st_mode & S_IXOTH) == S_IXOTH) ||
  4660        ((st.st_mode & S_IXGRP) == S_IXGRP) ||
  4661        ((st.st_mode & S_IXUSR) == S_IXUSR)))
  4662     return 1;
  4663   else
  4664     return 0;
  4665 }
  4666 
  4667 /* Searches for the full path of the wrapper.  Returns
  4668    newly allocated full path name if found, NULL otherwise */
  4669 char *
  4670 find_executable (const char* wrapper)
  4671 {
  4672   int has_slash = 0;
  4673   const char* p;
  4674   const char* p_next;
  4675   struct stat st;
  4676   /* static buffer for getcwd */
  4677   char tmp[LT_PATHMAX + 1];
  4678   int tmp_len;
  4679   char* concat_name;
  4680 
  4681   DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
  4682   
  4683   if ((wrapper == NULL) || (*wrapper == '\0'))
  4684     return NULL;
  4685 
  4686   /* Absolute path? */
  4687 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4688   if (isalpha (wrapper[0]) && wrapper[1] == ':')
  4689   {
  4690     concat_name = xstrdup (wrapper);
  4691     if (check_executable(concat_name))
  4692       return concat_name;
  4693     XFREE(concat_name);
  4694   }
  4695   else
  4696   {
  4697 #endif
  4698     if (IS_DIR_SEPARATOR (wrapper[0]))
  4699     {
  4700       concat_name = xstrdup (wrapper);
  4701       if (check_executable(concat_name))
  4702         return concat_name;
  4703       XFREE(concat_name);
  4704     }
  4705 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4706   }
  4707 #endif
  4708 
  4709   for (p = wrapper; *p; p++)
  4710     if (*p == '/')
  4711     {
  4712       has_slash = 1;
  4713       break;
  4714     }
  4715   if (!has_slash)
  4716   {
  4717     /* no slashes; search PATH */
  4718     const char* path = getenv ("PATH");
  4719     if (path != NULL)
  4720     {
  4721       for (p = path; *p; p = p_next)
  4722       {
  4723         const char* q;
  4724         size_t p_len;
  4725         for (q = p; *q; q++)
  4726           if (IS_PATH_SEPARATOR(*q))
  4727             break;
  4728         p_len = q - p;
  4729         p_next = (*q == '\0' ? q : q + 1);
  4730         if (p_len == 0)
  4731         {
  4732           /* empty path: current directory */
  4733           if (getcwd (tmp, LT_PATHMAX) == NULL)
  4734             lt_fatal ("getcwd failed");
  4735           tmp_len = strlen(tmp);
  4736           concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  4737           memcpy (concat_name, tmp, tmp_len);
  4738           concat_name[tmp_len] = '/';
  4739           strcpy (concat_name + tmp_len + 1, wrapper);
  4740         }
  4741         else
  4742         {
  4743           concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
  4744           memcpy (concat_name, p, p_len);
  4745           concat_name[p_len] = '/';
  4746           strcpy (concat_name + p_len + 1, wrapper);
  4747         }
  4748         if (check_executable(concat_name))
  4749           return concat_name;
  4750         XFREE(concat_name);
  4751       }
  4752     }
  4753     /* not found in PATH; assume curdir */
  4754   }
  4755   /* Relative path | not found in path: prepend cwd */
  4756   if (getcwd (tmp, LT_PATHMAX) == NULL)
  4757     lt_fatal ("getcwd failed");
  4758   tmp_len = strlen(tmp);
  4759   concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
  4760   memcpy (concat_name, tmp, tmp_len);
  4761   concat_name[tmp_len] = '/';
  4762   strcpy (concat_name + tmp_len + 1, wrapper);
  4763 
  4764   if (check_executable(concat_name))
  4765     return concat_name;
  4766   XFREE(concat_name);
  4767   return NULL;
  4768 }
  4769 
  4770 char *
  4771 strendzap(char *str, const char *pat) 
  4772 {
  4773   size_t len, patlen;
  4774 
  4775   assert(str != NULL);
  4776   assert(pat != NULL);
  4777 
  4778   len = strlen(str);
  4779   patlen = strlen(pat);
  4780 
  4781   if (patlen <= len)
  4782   {
  4783     str += len - patlen;
  4784     if (strcmp(str, pat) == 0)
  4785       *str = '\0';
  4786   }
  4787   return str;
  4788 }
  4789 
  4790 static void
  4791 lt_error_core (int exit_status, const char * mode, 
  4792           const char * message, va_list ap)
  4793 {
  4794   fprintf (stderr, "%s: %s: ", program_name, mode);
  4795   vfprintf (stderr, message, ap);
  4796   fprintf (stderr, ".\n");
  4797 
  4798   if (exit_status >= 0)
  4799     exit (exit_status);
  4800 }
  4801 
  4802 void
  4803 lt_fatal (const char *message, ...)
  4804 {
  4805   va_list ap;
  4806   va_start (ap, message);
  4807   lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  4808   va_end (ap);
  4809 }
  4810 EOF
  4811 	  # we should really use a build-platform specific compiler
  4812 	  # here, but OTOH, the wrappers (shell script and this C one)
  4813 	  # are only useful if you want to execute the "real" binary.
  4814 	  # Since the "real" binary is built for $host, then this
  4815 	  # wrapper might as well be built for $host, too.
  4816 	  $run $LTCC -s -o $cwrapper $cwrappersource
  4817 	  ;;
  4818 	esac
  4819 	$rm $output
  4820 	trap "$rm $output; exit 1" 1 2 15
  4821 
  4822 	$echo > $output "\
  4823 #! $SHELL
  4824 
  4825 # $output - temporary wrapper script for $objdir/$outputname
  4826 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4827 #
  4828 # The $output program cannot be directly executed until all the libtool
  4829 # libraries that it depends on are installed.
  4830 #
  4831 # This wrapper script should never be moved out of the build directory.
  4832 # If it is, it will not operate correctly.
  4833 
  4834 # Sed substitution that helps us do robust quoting.  It backslashifies
  4835 # metacharacters that are still active within double-quoted strings.
  4836 Xsed='${SED} -e 1s/^X//'
  4837 sed_quote_subst='$sed_quote_subst'
  4838 
  4839 # The HP-UX ksh and POSIX shell print the target directory to stdout
  4840 # if CDPATH is set.
  4841 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
  4842 
  4843 relink_command=\"$relink_command\"
  4844 
  4845 # This environment variable determines our operation mode.
  4846 if test \"\$libtool_install_magic\" = \"$magic\"; then
  4847   # install mode needs the following variable:
  4848   notinst_deplibs='$notinst_deplibs'
  4849 else
  4850   # When we are sourced in execute mode, \$file and \$echo are already set.
  4851   if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4852     echo=\"$qecho\"
  4853     file=\"\$0\"
  4854     # Make sure echo works.
  4855     if test \"X\$1\" = X--no-reexec; then
  4856       # Discard the --no-reexec flag, and continue.
  4857       shift
  4858     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  4859       # Yippee, \$echo works!
  4860       :
  4861     else
  4862       # Restart under the correct shell, and then maybe \$echo will work.
  4863       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  4864     fi
  4865   fi\
  4866 "
  4867 	$echo >> $output "\
  4868 
  4869   # Find the directory that this script lives in.
  4870   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  4871   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  4872 
  4873   # Follow symbolic links until we get to the real thisdir.
  4874   file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  4875   while test -n \"\$file\"; do
  4876     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  4877 
  4878     # If there was a directory component, then change thisdir.
  4879     if test \"x\$destdir\" != \"x\$file\"; then
  4880       case \"\$destdir\" in
  4881       [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  4882       *) thisdir=\"\$thisdir/\$destdir\" ;;
  4883       esac
  4884     fi
  4885 
  4886     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  4887     file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  4888   done
  4889 
  4890   # Try to get the absolute directory name.
  4891   absdir=\`cd \"\$thisdir\" && pwd\`
  4892   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  4893 "
  4894 
  4895 	if test "$fast_install" = yes; then
  4896 	  $echo >> $output "\
  4897   program=lt-'$outputname'$exeext
  4898   progdir=\"\$thisdir/$objdir\"
  4899 
  4900   if test ! -f \"\$progdir/\$program\" || \\
  4901      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  4902        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  4903 
  4904     file=\"\$\$-\$program\"
  4905 
  4906     if test ! -d \"\$progdir\"; then
  4907       $mkdir \"\$progdir\"
  4908     else
  4909       $rm \"\$progdir/\$file\"
  4910     fi"
  4911 
  4912 	  $echo >> $output "\
  4913 
  4914     # relink executable if necessary
  4915     if test -n \"\$relink_command\"; then
  4916       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  4917       else
  4918 	$echo \"\$relink_command_output\" >&2
  4919 	$rm \"\$progdir/\$file\"
  4920 	exit 1
  4921       fi
  4922     fi
  4923 
  4924     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  4925     { $rm \"\$progdir/\$program\";
  4926       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  4927     $rm \"\$progdir/\$file\"
  4928   fi"
  4929 	else
  4930 	  $echo >> $output "\
  4931   program='$outputname'
  4932   progdir=\"\$thisdir/$objdir\"
  4933 "
  4934 	fi
  4935 
  4936 	$echo >> $output "\
  4937 
  4938   if test -f \"\$progdir/\$program\"; then"
  4939 
  4940 	# Export our shlibpath_var if we have one.
  4941 	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  4942 	  $echo >> $output "\
  4943     # Add our own library path to $shlibpath_var
  4944     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  4945 
  4946     # Some systems cannot cope with colon-terminated $shlibpath_var
  4947     # The second colon is a workaround for a bug in BeOS R4 sed
  4948     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  4949 
  4950     export $shlibpath_var
  4951 "
  4952 	fi
  4953 
  4954 	# fixup the dll searchpath if we need to.
  4955 	if test -n "$dllsearchpath"; then
  4956 	  $echo >> $output "\
  4957     # Add the dll search path components to the executable PATH
  4958     PATH=$dllsearchpath:\$PATH
  4959 "
  4960 	fi
  4961 
  4962 	$echo >> $output "\
  4963     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4964       # Run the actual program with our arguments.
  4965 "
  4966 	case $host in
  4967 	# Backslashes separate directories on plain windows
  4968 	*-*-mingw | *-*-os2*)
  4969 	  $echo >> $output "\
  4970       exec \$progdir\\\\\$program \${1+\"\$@\"}
  4971 "
  4972 	  ;;
  4973 
  4974 	*)
  4975 	  $echo >> $output "\
  4976       exec \$progdir/\$program \${1+\"\$@\"}
  4977 "
  4978 	  ;;
  4979 	esac
  4980 	$echo >> $output "\
  4981       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  4982       exit 1
  4983     fi
  4984   else
  4985     # The program doesn't exist.
  4986     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  4987     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  4988     $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  4989     exit 1
  4990   fi
  4991 fi\
  4992 "
  4993 	chmod +x $output
  4994       fi
  4995       exit 0
  4996       ;;
  4997     esac
  4998 
  4999     # See if we need to build an old-fashioned archive.
  5000     for oldlib in $oldlibs; do
  5001 
  5002       if test "$build_libtool_libs" = convenience; then
  5003 	oldobjs="$libobjs_save"
  5004 	addlibs="$convenience"
  5005 	build_libtool_libs=no
  5006       else
  5007 	if test "$build_libtool_libs" = module; then
  5008 	  oldobjs="$libobjs_save"
  5009 	  build_libtool_libs=no
  5010 	else
  5011 	  oldobjs="$old_deplibs $non_pic_objects"
  5012 	fi
  5013 	addlibs="$old_convenience"
  5014       fi
  5015 
  5016       if test -n "$addlibs"; then
  5017 	gentop="$output_objdir/${outputname}x"
  5018 	$show "${rm}r $gentop"
  5019 	$run ${rm}r "$gentop"
  5020 	$show "$mkdir $gentop"
  5021 	$run $mkdir "$gentop"
  5022 	status=$?
  5023 	if test "$status" -ne 0 && test ! -d "$gentop"; then
  5024 	  exit $status
  5025 	fi
  5026 	generated="$generated $gentop"
  5027 
  5028 	# Add in members from convenience archives.
  5029 	for xlib in $addlibs; do
  5030 	  # Extract the objects.
  5031 	  case $xlib in
  5032 	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  5033 	  *) xabs=`pwd`"/$xlib" ;;
  5034 	  esac
  5035 	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  5036 	  xdir="$gentop/$xlib"
  5037 
  5038 	  $show "${rm}r $xdir"
  5039 	  $run ${rm}r "$xdir"
  5040 	  $show "$mkdir $xdir"
  5041 	  $run $mkdir "$xdir"
  5042 	  status=$?
  5043 	  if test "$status" -ne 0 && test ! -d "$xdir"; then
  5044 	    exit $status
  5045 	  fi
  5046 	  # We will extract separately just the conflicting names and we will no
  5047 	  # longer touch any unique names. It is faster to leave these extract
  5048 	  # automatically by $AR in one run.
  5049 	  $show "(cd $xdir && $AR x $xabs)"
  5050 	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  5051 	  if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
  5052 	    :
  5053 	  else
  5054 	    $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  5055 	    $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  5056 	    $AR t "$xabs" | sort | uniq -cd | while read -r count name
  5057 	    do
  5058 	      i=1
  5059 	      while test "$i" -le "$count"
  5060 	      do
  5061 	       # Put our $i before any first dot (extension)
  5062 	       # Never overwrite any file
  5063 	       name_to="$name"
  5064 	       while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
  5065 	       do
  5066 		 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  5067 	       done
  5068 	       $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
  5069 	       $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
  5070 	       i=`expr $i + 1`
  5071 	      done
  5072 	    done
  5073 	  fi
  5074 
  5075 	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  5076 	done
  5077       fi
  5078 
  5079       # Do each command in the archive commands.
  5080       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  5081 	eval cmds=\"$old_archive_from_new_cmds\"
  5082       else
  5083 	eval cmds=\"$old_archive_cmds\"
  5084 
  5085 	if len=`expr "X$cmds" : ".*"` &&
  5086 	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  5087 	  :
  5088 	else
  5089 	  # the command line is too long to link in one step, link in parts
  5090 	  $echo "using piecewise archive linking..."
  5091 	  save_RANLIB=$RANLIB
  5092 	  RANLIB=:
  5093 	  objlist=
  5094 	  concat_cmds=
  5095 	  save_oldobjs=$oldobjs
  5096 	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
  5097 	  # encoded into archives.  This makes 'ar r' malfunction in
  5098 	  # this piecewise linking case whenever conflicting object
  5099 	  # names appear in distinct ar calls; check, warn and compensate.
  5100 	    if (for obj in $save_oldobjs
  5101 	    do
  5102 	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
  5103 	    done | sort | sort -uc >/dev/null 2>&1); then
  5104 	    :
  5105 	  else
  5106 	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
  5107 	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
  5108 	    AR_FLAGS=cq
  5109 	  fi
  5110 	  # Is there a better way of finding the last object in the list?
  5111 	  for obj in $save_oldobjs
  5112 	  do
  5113 	    last_oldobj=$obj
  5114 	  done  
  5115 	  for obj in $save_oldobjs
  5116 	  do
  5117 	    oldobjs="$objlist $obj"
  5118 	    objlist="$objlist $obj"
  5119 	    eval test_cmds=\"$old_archive_cmds\"
  5120 	    if len=`expr "X$test_cmds" : ".*"` &&
  5121 	       test "$len" -le "$max_cmd_len"; then
  5122 	      :
  5123 	    else
  5124 	      # the above command should be used before it gets too long
  5125 	      oldobjs=$objlist
  5126 	      if test "$obj" = "$last_oldobj" ; then
  5127 	        RANLIB=$save_RANLIB
  5128 	      fi  
  5129 	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  5130 	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  5131 	      objlist=
  5132 	    fi
  5133 	  done
  5134 	  RANLIB=$save_RANLIB
  5135 	  oldobjs=$objlist
  5136 	  if test "X$oldobjs" = "X" ; then
  5137 	    eval cmds=\"\$concat_cmds\"
  5138 	  else
  5139 	    eval cmds=\"\$concat_cmds~$old_archive_cmds\"
  5140 	  fi
  5141 	fi
  5142       fi
  5143       save_ifs="$IFS"; IFS='~'
  5144       for cmd in $cmds; do
  5145 	IFS="$save_ifs"
  5146 	$show "$cmd"
  5147 	$run eval "$cmd" || exit $?
  5148       done
  5149       IFS="$save_ifs"
  5150     done
  5151 
  5152     if test -n "$generated"; then
  5153       $show "${rm}r$generated"
  5154       $run ${rm}r$generated
  5155     fi
  5156 
  5157     # Now create the libtool archive.
  5158     case $output in
  5159     *.la)
  5160       old_library=
  5161       test "$build_old_libs" = yes && old_library="$libname.$libext"
  5162       $show "creating $output"
  5163 
  5164       # Preserve any variables that may affect compiler behavior
  5165       for var in $variables_saved_for_relink; do
  5166 	if eval test -z \"\${$var+set}\"; then
  5167 	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  5168 	elif eval var_value=\$$var; test -z "$var_value"; then
  5169 	  relink_command="$var=; export $var; $relink_command"
  5170 	else
  5171 	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  5172 	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
  5173 	fi
  5174       done
  5175       # Quote the link command for shipping.
  5176       relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
  5177       relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  5178 
  5179       # Only create the output if not a dry run.
  5180       if test -z "$run"; then
  5181 	for installed in no yes; do
  5182 	  if test "$installed" = yes; then
  5183 	    if test -z "$install_libdir"; then
  5184 	      break
  5185 	    fi
  5186 	    output="$output_objdir/$outputname"i
  5187 	    # Replace all uninstalled libtool libraries with the installed ones
  5188 	    newdependency_libs=
  5189 	    for deplib in $dependency_libs; do
  5190 	      case $deplib in
  5191 	      *.la)
  5192 		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
  5193 		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  5194 		if test -z "$libdir"; then
  5195 		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  5196 		  exit 1
  5197 		fi
  5198 		newdependency_libs="$newdependency_libs $libdir/$name"
  5199 		;;
  5200 	      *) newdependency_libs="$newdependency_libs $deplib" ;;
  5201 	      esac
  5202 	    done
  5203 	    dependency_libs="$newdependency_libs"
  5204 	    newdlfiles=
  5205 	    for lib in $dlfiles; do
  5206 	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  5207 	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  5208 	      if test -z "$libdir"; then
  5209 		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5210 		exit 1
  5211 	      fi
  5212 	      newdlfiles="$newdlfiles $libdir/$name"
  5213 	    done
  5214 	    dlfiles="$newdlfiles"
  5215 	    newdlprefiles=
  5216 	    for lib in $dlprefiles; do
  5217 	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  5218 	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  5219 	      if test -z "$libdir"; then
  5220 		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5221 		exit 1
  5222 	      fi
  5223 	      newdlprefiles="$newdlprefiles $libdir/$name"
  5224 	    done
  5225 	    dlprefiles="$newdlprefiles"
  5226 	  fi
  5227 	  $rm $output
  5228 	  # place dlname in correct position for cygwin
  5229 	  tdlname=$dlname
  5230 	  case $host,$output,$installed,$module,$dlname in
  5231 	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  5232 	  esac
  5233 	  $echo > $output "\
  5234 # $outputname - a libtool library file
  5235 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  5236 #
  5237 # Please DO NOT delete this file!
  5238 # It is necessary for linking the library.
  5239 
  5240 # The name that we can dlopen(3).
  5241 dlname='$tdlname'
  5242 
  5243 # Names of this library.
  5244 library_names='$library_names'
  5245 
  5246 # The name of the static archive.
  5247 old_library='$old_library'
  5248 
  5249 # Libraries that this one depends upon.
  5250 dependency_libs='$dependency_libs'
  5251 
  5252 # Version information for $libname.
  5253 current=$current
  5254 age=$age
  5255 revision=$revision
  5256 
  5257 # Is this an already installed library?
  5258 installed=$installed
  5259 
  5260 # Should we warn about portability when linking against -modules?
  5261 shouldnotlink=$module
  5262 
  5263 # Files to dlopen/dlpreopen
  5264 dlopen='$dlfiles'
  5265 dlpreopen='$dlprefiles'
  5266 
  5267 # Directory that this library needs to be installed in:
  5268 libdir='$install_libdir'"
  5269 	  if test "$installed" = no && test "$need_relink" = yes; then
  5270 	    $echo >> $output "\
  5271 relink_command=\"$relink_command\""
  5272 	  fi
  5273 	done
  5274       fi
  5275 
  5276       # Do a symbolic link so that the libtool archive can be found in
  5277       # LD_LIBRARY_PATH before the program is installed.
  5278       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  5279       $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  5280       ;;
  5281     esac
  5282     exit 0
  5283     ;;
  5284 
  5285   # libtool install mode
  5286   install)
  5287     modename="$modename: install"
  5288 
  5289     # There may be an optional sh(1) argument at the beginning of
  5290     # install_prog (especially on Windows NT).
  5291     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  5292        # Allow the use of GNU shtool's install command.
  5293        $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
  5294       # Aesthetically quote it.
  5295       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  5296       case $arg in
  5297       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  5298 	arg="\"$arg\""
  5299 	;;
  5300       esac
  5301       install_prog="$arg "
  5302       arg="$1"
  5303       shift
  5304     else
  5305       install_prog=
  5306       arg="$nonopt"
  5307     fi
  5308 
  5309     # The real first argument should be the name of the installation program.
  5310     # Aesthetically quote it.
  5311     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  5312     case $arg in
  5313     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  5314       arg="\"$arg\""
  5315       ;;
  5316     esac
  5317     install_prog="$install_prog$arg"
  5318 
  5319     # We need to accept at least all the BSD install flags.
  5320     dest=
  5321     files=
  5322     opts=
  5323     prev=
  5324     install_type=
  5325     isdir=no
  5326     stripme=
  5327     for arg
  5328     do
  5329       if test -n "$dest"; then
  5330 	files="$files $dest"
  5331 	dest="$arg"
  5332 	continue
  5333       fi
  5334 
  5335       case $arg in
  5336       -d) isdir=yes ;;
  5337       -f) prev="-f" ;;
  5338       -g) prev="-g" ;;
  5339       -m) prev="-m" ;;
  5340       -o) prev="-o" ;;
  5341       -s)
  5342 	stripme=" -s"
  5343 	continue
  5344 	;;
  5345       -*) ;;
  5346 
  5347       *)
  5348 	# If the previous option needed an argument, then skip it.
  5349 	if test -n "$prev"; then
  5350 	  prev=
  5351 	else
  5352 	  dest="$arg"
  5353 	  continue
  5354 	fi
  5355 	;;
  5356       esac
  5357 
  5358       # Aesthetically quote the argument.
  5359       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  5360       case $arg in
  5361       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  5362 	arg="\"$arg\""
  5363 	;;
  5364       esac
  5365       install_prog="$install_prog $arg"
  5366     done
  5367 
  5368     if test -z "$install_prog"; then
  5369       $echo "$modename: you must specify an install program" 1>&2
  5370       $echo "$help" 1>&2
  5371       exit 1
  5372     fi
  5373 
  5374     if test -n "$prev"; then
  5375       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  5376       $echo "$help" 1>&2
  5377       exit 1
  5378     fi
  5379 
  5380     if test -z "$files"; then
  5381       if test -z "$dest"; then
  5382 	$echo "$modename: no file or destination specified" 1>&2
  5383       else
  5384 	$echo "$modename: you must specify a destination" 1>&2
  5385       fi
  5386       $echo "$help" 1>&2
  5387       exit 1
  5388     fi
  5389 
  5390     # Strip any trailing slash from the destination.
  5391     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  5392 
  5393     # Check to see that the destination is a directory.
  5394     test -d "$dest" && isdir=yes
  5395     if test "$isdir" = yes; then
  5396       destdir="$dest"
  5397       destname=
  5398     else
  5399       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  5400       test "X$destdir" = "X$dest" && destdir=.
  5401       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  5402 
  5403       # Not a directory, so check to see that there is only one file specified.
  5404       set dummy $files
  5405       if test "$#" -gt 2; then
  5406 	$echo "$modename: \`$dest' is not a directory" 1>&2
  5407 	$echo "$help" 1>&2
  5408 	exit 1
  5409       fi
  5410     fi
  5411     case $destdir in
  5412     [\\/]* | [A-Za-z]:[\\/]*) ;;
  5413     *)
  5414       for file in $files; do
  5415 	case $file in
  5416 	*.lo) ;;
  5417 	*)
  5418 	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  5419 	  $echo "$help" 1>&2
  5420 	  exit 1
  5421 	  ;;
  5422 	esac
  5423       done
  5424       ;;
  5425     esac
  5426 
  5427     # This variable tells wrapper scripts just to set variables rather
  5428     # than running their programs.
  5429     libtool_install_magic="$magic"
  5430 
  5431     staticlibs=
  5432     future_libdirs=
  5433     current_libdirs=
  5434     for file in $files; do
  5435 
  5436       # Do each installation.
  5437       case $file in
  5438       *.$libext)
  5439 	# Do the static libraries later.
  5440 	staticlibs="$staticlibs $file"
  5441 	;;
  5442 
  5443       *.la)
  5444 	# Check to see that this really is a libtool archive.
  5445 	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  5446 	else
  5447 	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  5448 	  $echo "$help" 1>&2
  5449 	  exit 1
  5450 	fi
  5451 
  5452 	library_names=
  5453 	old_library=
  5454 	relink_command=
  5455 	# If there is no directory component, then add one.
  5456 	case $file in
  5457 	*/* | *\\*) . $file ;;
  5458 	*) . ./$file ;;
  5459 	esac
  5460 
  5461 	# Add the libdir to current_libdirs if it is the destination.
  5462 	if test "X$destdir" = "X$libdir"; then
  5463 	  case "$current_libdirs " in
  5464 	  *" $libdir "*) ;;
  5465 	  *) current_libdirs="$current_libdirs $libdir" ;;
  5466 	  esac
  5467 	else
  5468 	  # Note the libdir as a future libdir.
  5469 	  case "$future_libdirs " in
  5470 	  *" $libdir "*) ;;
  5471 	  *) future_libdirs="$future_libdirs $libdir" ;;
  5472 	  esac
  5473 	fi
  5474 
  5475 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
  5476 	test "X$dir" = "X$file/" && dir=
  5477 	dir="$dir$objdir"
  5478 
  5479 	if test -n "$relink_command"; then
  5480 	  # Determine the prefix the user has applied to our future dir.
  5481 	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
  5482 
  5483 	  # Don't allow the user to place us outside of our expected
  5484 	  # location b/c this prevents finding dependent libraries that
  5485 	  # are installed to the same prefix.
  5486 	  # At present, this check doesn't affect windows .dll's that
  5487 	  # are installed into $libdir/../bin (currently, that works fine)
  5488 	  # but it's something to keep an eye on.
  5489 	  if test "$inst_prefix_dir" = "$destdir"; then
  5490 	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
  5491 	    exit 1
  5492 	  fi
  5493 
  5494 	  if test -n "$inst_prefix_dir"; then
  5495 	    # Stick the inst_prefix_dir data into the link command.
  5496 	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  5497 	  else
  5498 	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  5499 	  fi
  5500 
  5501 	  $echo "$modename: warning: relinking \`$file'" 1>&2
  5502 	  $show "$relink_command"
  5503 	  if $run eval "$relink_command"; then :
  5504 	  else
  5505 	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  5506 	    exit 1
  5507 	  fi
  5508 	fi
  5509 
  5510 	# See the names of the shared library.
  5511 	set dummy $library_names
  5512 	if test -n "$2"; then
  5513 	  realname="$2"
  5514 	  shift
  5515 	  shift
  5516 
  5517 	  srcname="$realname"
  5518 	  test -n "$relink_command" && srcname="$realname"T
  5519 
  5520 	  # Install the shared library and build the symlinks.
  5521 	  $show "$install_prog $dir/$srcname $destdir/$realname"
  5522 	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
  5523 	  if test -n "$stripme" && test -n "$striplib"; then
  5524 	    $show "$striplib $destdir/$realname"
  5525 	    $run eval "$striplib $destdir/$realname" || exit $?
  5526 	  fi
  5527 
  5528 	  if test "$#" -gt 0; then
  5529 	    # Delete the old symlinks, and create new ones.
  5530 	    for linkname
  5531 	    do
  5532 	      if test "$linkname" != "$realname"; then
  5533 		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  5534 		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  5535 	      fi
  5536 	    done
  5537 	  fi
  5538 
  5539 	  # Do each command in the postinstall commands.
  5540 	  lib="$destdir/$realname"
  5541 	  eval cmds=\"$postinstall_cmds\"
  5542 	  save_ifs="$IFS"; IFS='~'
  5543 	  for cmd in $cmds; do
  5544 	    IFS="$save_ifs"
  5545 	    $show "$cmd"
  5546 	    $run eval "$cmd" || exit $?
  5547 	  done
  5548 	  IFS="$save_ifs"
  5549 	fi
  5550 
  5551 	# Install the pseudo-library for information purposes.
  5552 	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5553 	instname="$dir/$name"i
  5554 	$show "$install_prog $instname $destdir/$name"
  5555 	$run eval "$install_prog $instname $destdir/$name" || exit $?
  5556 
  5557 	# Maybe install the static library, too.
  5558 	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  5559 	;;
  5560 
  5561       *.lo)
  5562 	# Install (i.e. copy) a libtool object.
  5563 
  5564 	# Figure out destination file name, if it wasn't already specified.
  5565 	if test -n "$destname"; then
  5566 	  destfile="$destdir/$destname"
  5567 	else
  5568 	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5569 	  destfile="$destdir/$destfile"
  5570 	fi
  5571 
  5572 	# Deduce the name of the destination old-style object file.
  5573 	case $destfile in
  5574 	*.lo)
  5575 	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  5576 	  ;;
  5577 	*.$objext)
  5578 	  staticdest="$destfile"
  5579 	  destfile=
  5580 	  ;;
  5581 	*)
  5582 	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  5583 	  $echo "$help" 1>&2
  5584 	  exit 1
  5585 	  ;;
  5586 	esac
  5587 
  5588 	# Install the libtool object if requested.
  5589 	if test -n "$destfile"; then
  5590 	  $show "$install_prog $file $destfile"
  5591 	  $run eval "$install_prog $file $destfile" || exit $?
  5592 	fi
  5593 
  5594 	# Install the old object if enabled.
  5595 	if test "$build_old_libs" = yes; then
  5596 	  # Deduce the name of the old-style object file.
  5597 	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  5598 
  5599 	  $show "$install_prog $staticobj $staticdest"
  5600 	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  5601 	fi
  5602 	exit 0
  5603 	;;
  5604 
  5605       *)
  5606 	# Figure out destination file name, if it wasn't already specified.
  5607 	if test -n "$destname"; then
  5608 	  destfile="$destdir/$destname"
  5609 	else
  5610 	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5611 	  destfile="$destdir/$destfile"
  5612 	fi
  5613 
  5614 	# If the file is missing, and there is a .exe on the end, strip it
  5615 	# because it is most likely a libtool script we actually want to
  5616 	# install
  5617 	stripped_ext=""
  5618 	case $file in
  5619 	  *.exe)
  5620 	    if test ! -f "$file"; then
  5621 	      file=`$echo $file|${SED} 's,.exe$,,'`
  5622 	      stripped_ext=".exe"
  5623 	    fi
  5624 	    ;;
  5625 	esac
  5626 
  5627 	# Do a test to see if this is really a libtool program.
  5628 	case $host in
  5629 	*cygwin*|*mingw*)
  5630 	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
  5631 	    ;;
  5632 	*)
  5633 	    wrapper=$file
  5634 	    ;;
  5635 	esac
  5636 	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
  5637 	  notinst_deplibs=
  5638 	  relink_command=
  5639 
  5640 	  # To insure that "foo" is sourced, and not "foo.exe",
  5641 	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  5642 	  # which disallows the automatic-append-.exe behavior.
  5643 	  case $build in
  5644 	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  5645 	  *) wrapperdot=${wrapper} ;;
  5646 	  esac
  5647 	  # If there is no directory component, then add one.
  5648 	  case $file in
  5649 	  */* | *\\*) . ${wrapperdot} ;;
  5650 	  *) . ./${wrapperdot} ;;
  5651 	  esac
  5652 
  5653 	  # Check the variables that should have been set.
  5654 	  if test -z "$notinst_deplibs"; then
  5655 	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
  5656 	    exit 1
  5657 	  fi
  5658 
  5659 	  finalize=yes
  5660 	  for lib in $notinst_deplibs; do
  5661 	    # Check to see that each library is installed.
  5662 	    libdir=
  5663 	    if test -f "$lib"; then
  5664 	      # If there is no directory component, then add one.
  5665 	      case $lib in
  5666 	      */* | *\\*) . $lib ;;
  5667 	      *) . ./$lib ;;
  5668 	      esac
  5669 	    fi
  5670 	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  5671 	    if test -n "$libdir" && test ! -f "$libfile"; then
  5672 	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  5673 	      finalize=no
  5674 	    fi
  5675 	  done
  5676 
  5677 	  relink_command=
  5678 	  # To insure that "foo" is sourced, and not "foo.exe",
  5679 	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
  5680 	  # which disallows the automatic-append-.exe behavior.
  5681 	  case $build in
  5682 	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  5683 	  *) wrapperdot=${wrapper} ;;
  5684 	  esac
  5685 	  # If there is no directory component, then add one.
  5686 	  case $file in
  5687 	  */* | *\\*) . ${wrapperdot} ;;
  5688 	  *) . ./${wrapperdot} ;;
  5689 	  esac
  5690 
  5691 	  outputname=
  5692 	  if test "$fast_install" = no && test -n "$relink_command"; then
  5693 	    if test "$finalize" = yes && test -z "$run"; then
  5694 	      tmpdir="/tmp"
  5695 	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
  5696 	      tmpdir="$tmpdir/libtool-$$"
  5697 	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  5698 	      else
  5699 		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  5700 		continue
  5701 	      fi
  5702 	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
  5703 	      outputname="$tmpdir/$file"
  5704 	      # Replace the output file specification.
  5705 	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  5706 
  5707 	      $show "$relink_command"
  5708 	      if $run eval "$relink_command"; then :
  5709 	      else
  5710 		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  5711 		${rm}r "$tmpdir"
  5712 		continue
  5713 	      fi
  5714 	      file="$outputname"
  5715 	    else
  5716 	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
  5717 	    fi
  5718 	  else
  5719 	    # Install the binary that we compiled earlier.
  5720 	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  5721 	  fi
  5722 	fi
  5723 
  5724 	# remove .exe since cygwin /usr/bin/install will append another
  5725 	# one anyways
  5726 	case $install_prog,$host in
  5727 	*/usr/bin/install*,*cygwin*)
  5728 	  case $file:$destfile in
  5729 	  *.exe:*.exe)
  5730 	    # this is ok
  5731 	    ;;
  5732 	  *.exe:*)
  5733 	    destfile=$destfile.exe
  5734 	    ;;
  5735 	  *:*.exe)
  5736 	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
  5737 	    ;;
  5738 	  esac
  5739 	  ;;
  5740 	esac
  5741 	$show "$install_prog$stripme $file $destfile"
  5742 	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  5743 	test -n "$outputname" && ${rm}r "$tmpdir"
  5744 	;;
  5745       esac
  5746     done
  5747 
  5748     for file in $staticlibs; do
  5749       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5750 
  5751       # Set up the ranlib parameters.
  5752       oldlib="$destdir/$name"
  5753 
  5754       $show "$install_prog $file $oldlib"
  5755       $run eval "$install_prog \$file \$oldlib" || exit $?
  5756 
  5757       if test -n "$stripme" && test -n "$striplib"; then
  5758 	$show "$old_striplib $oldlib"
  5759 	$run eval "$old_striplib $oldlib" || exit $?
  5760       fi
  5761 
  5762       # Do each command in the postinstall commands.
  5763       eval cmds=\"$old_postinstall_cmds\"
  5764       save_ifs="$IFS"; IFS='~'
  5765       for cmd in $cmds; do
  5766 	IFS="$save_ifs"
  5767 	$show "$cmd"
  5768 	$run eval "$cmd" || exit $?
  5769       done
  5770       IFS="$save_ifs"
  5771     done
  5772 
  5773     if test -n "$future_libdirs"; then
  5774       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  5775     fi
  5776 
  5777     if test -n "$current_libdirs"; then
  5778       # Maybe just do a dry run.
  5779       test -n "$run" && current_libdirs=" -n$current_libdirs"
  5780       exec_cmd='$SHELL $0 --finish$current_libdirs'
  5781     else
  5782       exit 0
  5783     fi
  5784     ;;
  5785 
  5786   # libtool finish mode
  5787   finish)
  5788     modename="$modename: finish"
  5789     libdirs="$nonopt"
  5790     admincmds=
  5791 
  5792     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  5793       for dir
  5794       do
  5795 	libdirs="$libdirs $dir"
  5796       done
  5797 
  5798       for libdir in $libdirs; do
  5799 	if test -n "$finish_cmds"; then
  5800 	  # Do each command in the finish commands.
  5801 	  eval cmds=\"$finish_cmds\"
  5802 	  save_ifs="$IFS"; IFS='~'
  5803 	  for cmd in $cmds; do
  5804 	    IFS="$save_ifs"
  5805 	    $show "$cmd"
  5806 	    $run eval "$cmd" || admincmds="$admincmds
  5807        $cmd"
  5808 	  done
  5809 	  IFS="$save_ifs"
  5810 	fi
  5811 	if test -n "$finish_eval"; then
  5812 	  # Do the single finish_eval.
  5813 	  eval cmds=\"$finish_eval\"
  5814 	  $run eval "$cmds" || admincmds="$admincmds
  5815        $cmds"
  5816 	fi
  5817       done
  5818     fi
  5819 
  5820     # Exit here if they wanted silent mode.
  5821     test "$show" = : && exit 0
  5822 
  5823     $echo "----------------------------------------------------------------------"
  5824     $echo "Libraries have been installed in:"
  5825     for libdir in $libdirs; do
  5826       $echo "   $libdir"
  5827     done
  5828     $echo
  5829     $echo "If you ever happen to want to link against installed libraries"
  5830     $echo "in a given directory, LIBDIR, you must either use libtool, and"
  5831     $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  5832     $echo "flag during linking and do at least one of the following:"
  5833     if test -n "$shlibpath_var"; then
  5834       $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  5835       $echo "     during execution"
  5836     fi
  5837     if test -n "$runpath_var"; then
  5838       $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  5839       $echo "     during linking"
  5840     fi
  5841     if test -n "$hardcode_libdir_flag_spec"; then
  5842       libdir=LIBDIR
  5843       eval flag=\"$hardcode_libdir_flag_spec\"
  5844 
  5845       $echo "   - use the \`$flag' linker flag"
  5846     fi
  5847     if test -n "$admincmds"; then
  5848       $echo "   - have your system administrator run these commands:$admincmds"
  5849     fi
  5850     if test -f /etc/ld.so.conf; then
  5851       $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  5852     fi
  5853     $echo
  5854     $echo "See any operating system documentation about shared libraries for"
  5855     $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  5856     $echo "----------------------------------------------------------------------"
  5857     exit 0
  5858     ;;
  5859 
  5860   # libtool execute mode
  5861   execute)
  5862     modename="$modename: execute"
  5863 
  5864     # The first argument is the command name.
  5865     cmd="$nonopt"
  5866     if test -z "$cmd"; then
  5867       $echo "$modename: you must specify a COMMAND" 1>&2
  5868       $echo "$help"
  5869       exit 1
  5870     fi
  5871 
  5872     # Handle -dlopen flags immediately.
  5873     for file in $execute_dlfiles; do
  5874       if test ! -f "$file"; then
  5875 	$echo "$modename: \`$file' is not a file" 1>&2
  5876 	$echo "$help" 1>&2
  5877 	exit 1
  5878       fi
  5879 
  5880       dir=
  5881       case $file in
  5882       *.la)
  5883 	# Check to see that this really is a libtool archive.
  5884 	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  5885 	else
  5886 	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5887 	  $echo "$help" 1>&2
  5888 	  exit 1
  5889 	fi
  5890 
  5891 	# Read the libtool library.
  5892 	dlname=
  5893 	library_names=
  5894 
  5895 	# If there is no directory component, then add one.
  5896 	case $file in
  5897 	*/* | *\\*) . $file ;;
  5898 	*) . ./$file ;;
  5899 	esac
  5900 
  5901 	# Skip this library if it cannot be dlopened.
  5902 	if test -z "$dlname"; then
  5903 	  # Warn if it was a shared library.
  5904 	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  5905 	  continue
  5906 	fi
  5907 
  5908 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5909 	test "X$dir" = "X$file" && dir=.
  5910 
  5911 	if test -f "$dir/$objdir/$dlname"; then
  5912 	  dir="$dir/$objdir"
  5913 	else
  5914 	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  5915 	  exit 1
  5916 	fi
  5917 	;;
  5918 
  5919       *.lo)
  5920 	# Just add the directory containing the .lo file.
  5921 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5922 	test "X$dir" = "X$file" && dir=.
  5923 	;;
  5924 
  5925       *)
  5926 	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  5927 	continue
  5928 	;;
  5929       esac
  5930 
  5931       # Get the absolute pathname.
  5932       absdir=`cd "$dir" && pwd`
  5933       test -n "$absdir" && dir="$absdir"
  5934 
  5935       # Now add the directory to shlibpath_var.
  5936       if eval "test -z \"\$$shlibpath_var\""; then
  5937 	eval "$shlibpath_var=\"\$dir\""
  5938       else
  5939 	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  5940       fi
  5941     done
  5942 
  5943     # This variable tells wrapper scripts just to set shlibpath_var
  5944     # rather than running their programs.
  5945     libtool_execute_magic="$magic"
  5946 
  5947     # Check if any of the arguments is a wrapper script.
  5948     args=
  5949     for file
  5950     do
  5951       case $file in
  5952       -*) ;;
  5953       *)
  5954 	# Do a test to see if this is really a libtool program.
  5955 	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5956 	  # If there is no directory component, then add one.
  5957 	  case $file in
  5958 	  */* | *\\*) . $file ;;
  5959 	  *) . ./$file ;;
  5960 	  esac
  5961 
  5962 	  # Transform arg to wrapped name.
  5963 	  file="$progdir/$program"
  5964 	fi
  5965 	;;
  5966       esac
  5967       # Quote arguments (to preserve shell metacharacters).
  5968       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  5969       args="$args \"$file\""
  5970     done
  5971 
  5972     if test -z "$run"; then
  5973       if test -n "$shlibpath_var"; then
  5974 	# Export the shlibpath_var.
  5975 	eval "export $shlibpath_var"
  5976       fi
  5977 
  5978       # Restore saved environment variables
  5979       if test "${save_LC_ALL+set}" = set; then
  5980 	LC_ALL="$save_LC_ALL"; export LC_ALL
  5981       fi
  5982       if test "${save_LANG+set}" = set; then
  5983 	LANG="$save_LANG"; export LANG
  5984       fi
  5985 
  5986       # Now prepare to actually exec the command.
  5987       exec_cmd="\$cmd$args"
  5988     else
  5989       # Display what would be done.
  5990       if test -n "$shlibpath_var"; then
  5991 	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  5992 	$echo "export $shlibpath_var"
  5993       fi
  5994       $echo "$cmd$args"
  5995       exit 0
  5996     fi
  5997     ;;
  5998 
  5999   # libtool clean and uninstall mode
  6000   clean | uninstall)
  6001     modename="$modename: $mode"
  6002     rm="$nonopt"
  6003     files=
  6004     rmforce=
  6005     exit_status=0
  6006 
  6007     # This variable tells wrapper scripts just to set variables rather
  6008     # than running their programs.
  6009     libtool_install_magic="$magic"
  6010 
  6011     for arg
  6012     do
  6013       case $arg in
  6014       -f) rm="$rm $arg"; rmforce=yes ;;
  6015       -*) rm="$rm $arg" ;;
  6016       *) files="$files $arg" ;;
  6017       esac
  6018     done
  6019 
  6020     if test -z "$rm"; then
  6021       $echo "$modename: you must specify an RM program" 1>&2
  6022       $echo "$help" 1>&2
  6023       exit 1
  6024     fi
  6025 
  6026     rmdirs=
  6027 
  6028     origobjdir="$objdir"
  6029     for file in $files; do
  6030       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  6031       if test "X$dir" = "X$file"; then
  6032 	dir=.
  6033 	objdir="$origobjdir"
  6034       else
  6035 	objdir="$dir/$origobjdir"
  6036       fi
  6037       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  6038       test "$mode" = uninstall && objdir="$dir"
  6039 
  6040       # Remember objdir for removal later, being careful to avoid duplicates
  6041       if test "$mode" = clean; then
  6042 	case " $rmdirs " in
  6043 	  *" $objdir "*) ;;
  6044 	  *) rmdirs="$rmdirs $objdir" ;;
  6045 	esac
  6046       fi
  6047 
  6048       # Don't error if the file doesn't exist and rm -f was used.
  6049       if (test -L "$file") >/dev/null 2>&1 \
  6050 	|| (test -h "$file") >/dev/null 2>&1 \
  6051 	|| test -f "$file"; then
  6052 	:
  6053       elif test -d "$file"; then
  6054 	exit_status=1
  6055 	continue
  6056       elif test "$rmforce" = yes; then
  6057 	continue
  6058       fi
  6059 
  6060       rmfiles="$file"
  6061 
  6062       case $name in
  6063       *.la)
  6064 	# Possibly a libtool archive, so verify it.
  6065 	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  6066 	  . $dir/$name
  6067 
  6068 	  # Delete the libtool libraries and symlinks.
  6069 	  for n in $library_names; do
  6070 	    rmfiles="$rmfiles $objdir/$n"
  6071 	  done
  6072 	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  6073 	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  6074 
  6075 	  if test "$mode" = uninstall; then
  6076 	    if test -n "$library_names"; then
  6077 	      # Do each command in the postuninstall commands.
  6078 	      eval cmds=\"$postuninstall_cmds\"
  6079 	      save_ifs="$IFS"; IFS='~'
  6080 	      for cmd in $cmds; do
  6081 		IFS="$save_ifs"
  6082 		$show "$cmd"
  6083 		$run eval "$cmd"
  6084 		if test "$?" -ne 0 && test "$rmforce" != yes; then
  6085 		  exit_status=1
  6086 		fi
  6087 	      done
  6088 	      IFS="$save_ifs"
  6089 	    fi
  6090 
  6091 	    if test -n "$old_library"; then
  6092 	      # Do each command in the old_postuninstall commands.
  6093 	      eval cmds=\"$old_postuninstall_cmds\"
  6094 	      save_ifs="$IFS"; IFS='~'
  6095 	      for cmd in $cmds; do
  6096 		IFS="$save_ifs"
  6097 		$show "$cmd"
  6098 		$run eval "$cmd"
  6099 		if test "$?" -ne 0 && test "$rmforce" != yes; then
  6100 		  exit_status=1
  6101 		fi
  6102 	      done
  6103 	      IFS="$save_ifs"
  6104 	    fi
  6105 	    # FIXME: should reinstall the best remaining shared library.
  6106 	  fi
  6107 	fi
  6108 	;;
  6109 
  6110       *.lo)
  6111 	# Possibly a libtool object, so verify it.
  6112 	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  6113 
  6114 	  # Read the .lo file
  6115 	  . $dir/$name
  6116 
  6117 	  # Add PIC object to the list of files to remove.
  6118 	  if test -n "$pic_object" \
  6119 	     && test "$pic_object" != none; then
  6120 	    rmfiles="$rmfiles $dir/$pic_object"
  6121 	  fi
  6122 
  6123 	  # Add non-PIC object to the list of files to remove.
  6124 	  if test -n "$non_pic_object" \
  6125 	     && test "$non_pic_object" != none; then
  6126 	    rmfiles="$rmfiles $dir/$non_pic_object"
  6127 	  fi
  6128 	fi
  6129 	;;
  6130 
  6131       *)
  6132 	if test "$mode" = clean ; then
  6133 	  noexename=$name
  6134 	  case $file in
  6135 	  *.exe) 
  6136 	    file=`$echo $file|${SED} 's,.exe$,,'`
  6137 	    noexename=`$echo $name|${SED} 's,.exe$,,'`
  6138 	    # $file with .exe has already been added to rmfiles,
  6139 	    # add $file without .exe
  6140 	    rmfiles="$rmfiles $file"
  6141 	    ;;
  6142 	  esac
  6143 	  # Do a test to see if this is a libtool program.
  6144 	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  6145 	    relink_command=
  6146 	    . $dir/$noexename
  6147 
  6148 	    # note $name still contains .exe if it was in $file originally
  6149 	    # as does the version of $file that was added into $rmfiles
  6150 	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  6151 	    if test "$fast_install" = yes && test -n "$relink_command"; then
  6152 	      rmfiles="$rmfiles $objdir/lt-$name"
  6153 	    fi
  6154 	    if test "X$noexename" != "X$name" ; then
  6155 	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
  6156 	    fi
  6157 	  fi
  6158 	fi
  6159 	;;
  6160       esac
  6161       $show "$rm $rmfiles"
  6162       $run $rm $rmfiles || exit_status=1
  6163     done
  6164     objdir="$origobjdir"
  6165 
  6166     # Try to remove the ${objdir}s in the directories where we deleted files
  6167     for dir in $rmdirs; do
  6168       if test -d "$dir"; then
  6169 	$show "rmdir $dir"
  6170 	$run rmdir $dir >/dev/null 2>&1
  6171       fi
  6172     done
  6173 
  6174     exit $exit_status
  6175     ;;
  6176 
  6177   "")
  6178     $echo "$modename: you must specify a MODE" 1>&2
  6179     $echo "$generic_help" 1>&2
  6180     exit 1
  6181     ;;
  6182   esac
  6183 
  6184   if test -z "$exec_cmd"; then
  6185     $echo "$modename: invalid operation mode \`$mode'" 1>&2
  6186     $echo "$generic_help" 1>&2
  6187     exit 1
  6188   fi
  6189 fi # test -z "$show_help"
  6190 
  6191 if test -n "$exec_cmd"; then
  6192   eval exec $exec_cmd
  6193   exit 1
  6194 fi
  6195 
  6196 # We need to display help for each of the modes.
  6197 case $mode in
  6198 "") $echo \
  6199 "Usage: $modename [OPTION]... [MODE-ARG]...
  6200 
  6201 Provide generalized library-building support services.
  6202 
  6203     --config          show all configuration variables
  6204     --debug           enable verbose shell tracing
  6205 -n, --dry-run         display commands without modifying any files
  6206     --features        display basic configuration information and exit
  6207     --finish          same as \`--mode=finish'
  6208     --help            display this help message and exit
  6209     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  6210     --quiet           same as \`--silent'
  6211     --silent          don't print informational messages
  6212     --tag=TAG         use configuration variables from tag TAG
  6213     --version         print version information
  6214 
  6215 MODE must be one of the following:
  6216 
  6217       clean           remove files from the build directory
  6218       compile         compile a source file into a libtool object
  6219       execute         automatically set library path, then run a program
  6220       finish          complete the installation of libtool libraries
  6221       install         install libraries or executables
  6222       link            create a library or an executable
  6223       uninstall       remove libraries from an installed directory
  6224 
  6225 MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  6226 a more detailed description of MODE.
  6227 
  6228 Report bugs to <bug-libtool@gnu.org>."
  6229   exit 0
  6230   ;;
  6231 
  6232 clean)
  6233   $echo \
  6234 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  6235 
  6236 Remove files from the build directory.
  6237 
  6238 RM is the name of the program to use to delete files associated with each FILE
  6239 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  6240 to RM.
  6241 
  6242 If FILE is a libtool library, object or program, all the files associated
  6243 with it are deleted. Otherwise, only FILE itself is deleted using RM."
  6244   ;;
  6245 
  6246 compile)
  6247   $echo \
  6248 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  6249 
  6250 Compile a source file into a libtool library object.
  6251 
  6252 This mode accepts the following additional options:
  6253 
  6254   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  6255   -prefer-pic       try to building PIC objects only
  6256   -prefer-non-pic   try to building non-PIC objects only
  6257   -static           always build a \`.o' file suitable for static linking
  6258 
  6259 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  6260 from the given SOURCEFILE.
  6261 
  6262 The output file name is determined by removing the directory component from
  6263 SOURCEFILE, then substituting the C source code suffix \`.c' with the
  6264 library object suffix, \`.lo'."
  6265   ;;
  6266 
  6267 execute)
  6268   $echo \
  6269 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  6270 
  6271 Automatically set library path, then run a program.
  6272 
  6273 This mode accepts the following additional options:
  6274 
  6275   -dlopen FILE      add the directory containing FILE to the library path
  6276 
  6277 This mode sets the library path environment variable according to \`-dlopen'
  6278 flags.
  6279 
  6280 If any of the ARGS are libtool executable wrappers, then they are translated
  6281 into their corresponding uninstalled binary, and any of their required library
  6282 directories are added to the library path.
  6283 
  6284 Then, COMMAND is executed, with ARGS as arguments."
  6285   ;;
  6286 
  6287 finish)
  6288   $echo \
  6289 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  6290 
  6291 Complete the installation of libtool libraries.
  6292 
  6293 Each LIBDIR is a directory that contains libtool libraries.
  6294 
  6295 The commands that this mode executes may require superuser privileges.  Use
  6296 the \`--dry-run' option if you just want to see what would be executed."
  6297   ;;
  6298 
  6299 install)
  6300   $echo \
  6301 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  6302 
  6303 Install executables or libraries.
  6304 
  6305 INSTALL-COMMAND is the installation command.  The first component should be
  6306 either the \`install' or \`cp' program.
  6307 
  6308 The rest of the components are interpreted as arguments to that command (only
  6309 BSD-compatible install options are recognized)."
  6310   ;;
  6311 
  6312 link)
  6313   $echo \
  6314 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  6315 
  6316 Link object files or libraries together to form another library, or to
  6317 create an executable program.
  6318 
  6319 LINK-COMMAND is a command using the C compiler that you would use to create
  6320 a program from several object files.
  6321 
  6322 The following components of LINK-COMMAND are treated specially:
  6323 
  6324   -all-static       do not do any dynamic linking at all
  6325   -avoid-version    do not add a version suffix if possible
  6326   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  6327   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  6328   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  6329   -export-symbols SYMFILE
  6330 		    try to export only the symbols listed in SYMFILE
  6331   -export-symbols-regex REGEX
  6332 		    try to export only the symbols matching REGEX
  6333   -LLIBDIR          search LIBDIR for required installed libraries
  6334   -lNAME            OUTPUT-FILE requires the installed library libNAME
  6335   -module           build a library that can dlopened
  6336   -no-fast-install  disable the fast-install mode
  6337   -no-install       link a not-installable executable
  6338   -no-undefined     declare that a library does not refer to external symbols
  6339   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  6340   -objectlist FILE  Use a list of object files found in FILE to specify objects
  6341   -release RELEASE  specify package release information
  6342   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  6343   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  6344   -static           do not do any dynamic linking of libtool libraries
  6345   -version-info CURRENT[:REVISION[:AGE]]
  6346 		    specify library version info [each variable defaults to 0]
  6347 
  6348 All other options (arguments beginning with \`-') are ignored.
  6349 
  6350 Every other argument is treated as a filename.  Files ending in \`.la' are
  6351 treated as uninstalled libtool libraries, other files are standard or library
  6352 object files.
  6353 
  6354 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  6355 only library objects (\`.lo' files) may be specified, and \`-rpath' is
  6356 required, except when creating a convenience library.
  6357 
  6358 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  6359 using \`ar' and \`ranlib', or on Windows using \`lib'.
  6360 
  6361 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  6362 is created, otherwise an executable program is created."
  6363   ;;
  6364 
  6365 uninstall)
  6366   $echo \
  6367 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  6368 
  6369 Remove libraries from an installation directory.
  6370 
  6371 RM is the name of the program to use to delete files associated with each FILE
  6372 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  6373 to RM.
  6374 
  6375 If FILE is a libtool library, all the files associated with it are deleted.
  6376 Otherwise, only FILE itself is deleted using RM."
  6377   ;;
  6378 
  6379 *)
  6380   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  6381   $echo "$help" 1>&2
  6382   exit 1
  6383   ;;
  6384 esac
  6385 
  6386 $echo
  6387 $echo "Try \`$modename --help' for more information about other modes."
  6388 
  6389 exit 0
  6390 
  6391 # The TAGs below are defined such that we never get into a situation
  6392 # in which we disable both kinds of libraries.  Given conflicting
  6393 # choices, we go for a static library, that is the most portable,
  6394 # since we can't tell whether shared libraries were disabled because
  6395 # the user asked for that or because the platform doesn't support
  6396 # them.  This is particularly important on AIX, because we don't
  6397 # support having both static and shared libraries enabled at the same
  6398 # time on that platform, so we default to a shared-only configuration.
  6399 # If a disable-shared tag is given, we'll fallback to a static-only
  6400 # configuration.  But we'll never go from static-only to shared-only.
  6401 
  6402 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  6403 build_libtool_libs=no
  6404 build_old_libs=yes
  6405 # ### END LIBTOOL TAG CONFIG: disable-shared
  6406 
  6407 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  6408 build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
  6409 # ### END LIBTOOL TAG CONFIG: disable-static
  6410 
  6411 # Local Variables:
  6412 # mode:shell-script
  6413 # sh-indentation:2
  6414 # End: