ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Sun, 25 Jul 2004 19:43:56 +0000
changeset 916 46916168361d
parent 886 05c551e5bc64
child 947 3bb035750537
permissions -rw-r--r--
Date: Sun, 25 Jul 2004 23:10:03 +0800
From: Chris Taylor
Subject: SDL for Macintosh Programmer's Workshop: removed dynamic loading

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