ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Sun, 06 Oct 2002 20:31:34 +0000
changeset 515 230b156829ed
parent 393 84acd4f134e7
child 581 844addcf125e
permissions -rw-r--r--
*** empty log message ***
     1 # ltmain.sh - Provide generalized library-building support services.
     2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
     3 #
     4 # Copyright (C) 1996-1999 Free Software Foundation, Inc.
     5 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
     6 #
     7 # This program is free software; you can redistribute it and/or modify
     8 # it under the terms of the GNU General Public License as published by
     9 # the Free Software Foundation; either version 2 of the License, or
    10 # (at your option) any later version.
    11 #
    12 # This program is distributed in the hope that it will be useful, but
    13 # WITHOUT ANY WARRANTY; without even the implied warranty of
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    15 # General Public License for more details.
    16 #
    17 # You should have received a copy of the GNU General Public License
    18 # along with this program; if not, write to the Free Software
    19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    20 #
    21 # As a special exception to the GNU General Public License, if you
    22 # distribute this file as part of a program that contains a
    23 # configuration script generated by Autoconf, you may include it under
    24 # the same distribution terms that you use for the rest of that program.
    25 
    26 # Check that we have a working $echo.
    27 if test "X$1" = X--no-reexec; then
    28   # Discard the --no-reexec flag, and continue.
    29   shift
    30 elif test "X$1" = X--fallback-echo; then
    31   # Avoid inline document here, it may be left over
    32   :
    33 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
    34   # Yippee, $echo works!
    35   :
    36 else
    37   # Restart under the correct shell, and then maybe $echo will work.
    38   exec $SHELL "$0" --no-reexec ${1+"$@"}
    39 fi
    40 
    41 if test "X$1" = X--fallback-echo; then
    42   # used as fallback echo
    43   shift
    44   cat <<EOF
    45 $*
    46 EOF
    47   exit 0
    48 fi
    49 
    50 # The name of this program.
    51 progname=`$echo "$0" | sed 's%^.*/%%'`
    52 modename="$progname"
    53 
    54 # Constants.
    55 PROGRAM=ltmain.sh
    56 PACKAGE=libtool
    57 VERSION=1.3.5
    58 TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
    59 
    60 default_mode=
    61 help="Try \`$progname --help' for more information."
    62 magic="%%%MAGIC variable%%%"
    63 mkdir="mkdir"
    64 mv="mv -f"
    65 rm="rm -f"
    66 
    67 # Sed substitution that helps us do robust quoting.  It backslashifies
    68 # metacharacters that are still active within double-quoted strings.
    69 Xsed='sed -e 1s/^X//'
    70 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
    71 SP2NL='tr \040 \012'
    72 NL2SP='tr \015\012 \040\040'
    73 
    74 # NLS nuisances.
    75 # Only set LANG and LC_ALL to C if already set.
    76 # These must not be set unconditionally because not all systems understand
    77 # e.g. LANG=C (notably SCO).
    78 # We save the old values to restore during execute mode.
    79 if test "${LC_ALL+set}" = set; then
    80   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
    81 fi
    82 if test "${LANG+set}" = set; then
    83   save_LANG="$LANG"; LANG=C; export LANG
    84 fi
    85 
    86 if test "$LTCONFIG_VERSION" != "$VERSION"; then
    87   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
    88   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
    89   exit 1
    90 fi
    91 
    92 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
    93   echo "$modename: not configured to build any kind of library" 1>&2
    94   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
    95   exit 1
    96 fi
    97 
    98 # Global variables.
    99 mode=$default_mode
   100 nonopt=
   101 prev=
   102 prevopt=
   103 run=
   104 show="$echo"
   105 show_help=
   106 execute_dlfiles=
   107 lo2o="s/\\.lo\$/.${objext}/"
   108 o2lo="s/\\.${objext}\$/.lo/"
   109 
   110 # Parse our command line options once, thoroughly.
   111 while test $# -gt 0
   112 do
   113   arg="$1"
   114   shift
   115 
   116   case "$arg" in
   117   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
   118   *) optarg= ;;
   119   esac
   120 
   121   # If the previous option needs an argument, assign it.
   122   if test -n "$prev"; then
   123     case "$prev" in
   124     execute_dlfiles)
   125       eval "$prev=\"\$$prev \$arg\""
   126       ;;
   127     *)
   128       eval "$prev=\$arg"
   129       ;;
   130     esac
   131 
   132     prev=
   133     prevopt=
   134     continue
   135   fi
   136 
   137   # Have we seen a non-optional argument yet?
   138   case "$arg" in
   139   --help)
   140     show_help=yes
   141     ;;
   142 
   143   --version)
   144     echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
   145     exit 0
   146     ;;
   147 
   148   --config)
   149     sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
   150     exit 0
   151     ;;
   152 
   153   --debug)
   154     echo "$progname: enabling shell trace mode"
   155     set -x
   156     ;;
   157 
   158   --dry-run | -n)
   159     run=:
   160     ;;
   161 
   162   --features)
   163     echo "host: $host"
   164     if test "$build_libtool_libs" = yes; then
   165       echo "enable shared libraries"
   166     else
   167       echo "disable shared libraries"
   168     fi
   169     if test "$build_old_libs" = yes; then
   170       echo "enable static libraries"
   171     else
   172       echo "disable static libraries"
   173     fi
   174     exit 0
   175     ;;
   176 
   177   --finish) mode="finish" ;;
   178 
   179   --mode) prevopt="--mode" prev=mode ;;
   180   --mode=*) mode="$optarg" ;;
   181 
   182   --quiet | --silent)
   183     show=:
   184     ;;
   185 
   186   -dlopen)
   187     prevopt="-dlopen"
   188     prev=execute_dlfiles
   189     ;;
   190 
   191   -*)
   192     $echo "$modename: unrecognized option \`$arg'" 1>&2
   193     $echo "$help" 1>&2
   194     exit 1
   195     ;;
   196 
   197   *)
   198     nonopt="$arg"
   199     break
   200     ;;
   201   esac
   202 done
   203 
   204 if test -n "$prevopt"; then
   205   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
   206   $echo "$help" 1>&2
   207   exit 1
   208 fi
   209 
   210 if test -z "$show_help"; then
   211 
   212   # Infer the operation mode.
   213   if test -z "$mode"; then
   214     case "$nonopt" in
   215     *cc | *++ | gcc* | *-gcc*)
   216       mode=link
   217       for arg
   218       do
   219 	case "$arg" in
   220 	-c)
   221 	   mode=compile
   222 	   break
   223 	   ;;
   224 	esac
   225       done
   226       ;;
   227     *db | *dbx | *strace | *truss)
   228       mode=execute
   229       ;;
   230     *install*|cp|mv)
   231       mode=install
   232       ;;
   233     *rm)
   234       mode=uninstall
   235       ;;
   236     *)
   237       # If we have no mode, but dlfiles were specified, then do execute mode.
   238       test -n "$execute_dlfiles" && mode=execute
   239 
   240       # Just use the default operation mode.
   241       if test -z "$mode"; then
   242 	if test -n "$nonopt"; then
   243 	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
   244 	else
   245 	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
   246 	fi
   247       fi
   248       ;;
   249     esac
   250   fi
   251 
   252   # Only execute mode is allowed to have -dlopen flags.
   253   if test -n "$execute_dlfiles" && test "$mode" != execute; then
   254     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
   255     $echo "$help" 1>&2
   256     exit 1
   257   fi
   258 
   259   # Change the help message to a mode-specific one.
   260   generic_help="$help"
   261   help="Try \`$modename --help --mode=$mode' for more information."
   262 
   263   # These modes are in order of execution frequency so that they run quickly.
   264   case "$mode" in
   265   # libtool compile mode
   266   compile)
   267     modename="$modename: compile"
   268     # Get the compilation command and the source file.
   269     base_compile=
   270     lastarg=
   271     srcfile="$nonopt"
   272     suppress_output=
   273 
   274     user_target=no
   275     for arg
   276     do
   277       # Accept any command-line options.
   278       case "$arg" in
   279       -o)
   280 	if test "$user_target" != "no"; then
   281 	  $echo "$modename: you cannot specify \`-o' more than once" 1>&2
   282 	  exit 1
   283 	fi
   284 	user_target=next
   285 	;;
   286 
   287       -static)
   288 	build_old_libs=yes
   289 	continue
   290 	;;
   291       esac
   292 
   293       case "$user_target" in
   294       next)
   295 	# The next one is the -o target name
   296 	user_target=yes
   297 	continue
   298 	;;
   299       yes)
   300 	# We got the output file
   301 	user_target=set
   302 	libobj="$arg"
   303 	continue
   304 	;;
   305       esac
   306 
   307       # Accept the current argument as the source file.
   308       lastarg="$srcfile"
   309       srcfile="$arg"
   310 
   311       # Aesthetically quote the previous argument.
   312 
   313       # Backslashify any backslashes, double quotes, and dollar signs.
   314       # These are the only characters that are still specially
   315       # interpreted inside of double-quoted scrings.
   316       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
   317 
   318       # Double-quote args containing other shell metacharacters.
   319       # Many Bourne shells cannot handle close brackets correctly in scan
   320       # sets, so we specify it separately.
   321       case "$lastarg" in
   322       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
   323 	lastarg="\"$lastarg\""
   324 	;;
   325       esac
   326 
   327       # Add the previous argument to base_compile.
   328       if test -z "$base_compile"; then
   329 	base_compile="$lastarg"
   330       else
   331 	base_compile="$base_compile $lastarg"
   332       fi
   333     done
   334 
   335     case "$user_target" in
   336     set)
   337       ;;
   338     no)
   339       # Get the name of the library object.
   340       libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
   341       ;;
   342     *)
   343       $echo "$modename: you must specify a target with \`-o'" 1>&2
   344       exit 1
   345       ;;
   346     esac
   347 
   348     # Recognize several different file suffixes.
   349     # If the user specifies -o file.o, it is replaced with file.lo
   350     xform='[cCFSfmso]'
   351     case "$libobj" in
   352     *.ada) xform=ada ;;
   353     *.adb) xform=adb ;;
   354     *.ads) xform=ads ;;
   355     *.asm) xform=asm ;;
   356     *.c++) xform=c++ ;;
   357     *.cc) xform=cc ;;
   358     *.cpp) xform=cpp ;;
   359     *.cxx) xform=cxx ;;
   360     *.f90) xform=f90 ;;
   361     *.for) xform=for ;;
   362     esac
   363 
   364     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
   365 
   366     case "$libobj" in
   367     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
   368     *)
   369       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
   370       exit 1
   371       ;;
   372     esac
   373 
   374     if test -z "$base_compile"; then
   375       $echo "$modename: you must specify a compilation command" 1>&2
   376       $echo "$help" 1>&2
   377       exit 1
   378     fi
   379 
   380     # Delete any leftover library objects.
   381     if test "$build_old_libs" = yes; then
   382       removelist="$obj $libobj"
   383     else
   384       removelist="$libobj"
   385     fi
   386 
   387     $run $rm $removelist
   388     trap "$run $rm $removelist; exit 1" 1 2 15
   389 
   390     # Calculate the filename of the output object if compiler does
   391     # not support -o with -c
   392     if test "$compiler_c_o" = no; then
   393       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
   394       lockfile="$output_obj.lock"
   395       removelist="$removelist $output_obj $lockfile"
   396       trap "$run $rm $removelist; exit 1" 1 2 15
   397     else
   398       need_locks=no
   399       lockfile=
   400     fi
   401 
   402     # Lock this critical section if it is needed
   403     # We use this script file to make the link, it avoids creating a new file
   404     if test "$need_locks" = yes; then
   405       until ln "$0" "$lockfile" 2>/dev/null; do
   406 	$show "Waiting for $lockfile to be removed"
   407 	sleep 2
   408       done
   409     elif test "$need_locks" = warn; then
   410       if test -f "$lockfile"; then
   411 	echo "\
   412 *** ERROR, $lockfile exists and contains:
   413 `cat $lockfile 2>/dev/null`
   414 
   415 This indicates that another process is trying to use the same
   416 temporary object file, and libtool could not work around it because
   417 your compiler does not support \`-c' and \`-o' together.  If you
   418 repeat this compilation, it may succeed, by chance, but you had better
   419 avoid parallel builds (make -j) in this platform, or get a better
   420 compiler."
   421 
   422 	$run $rm $removelist
   423 	exit 1
   424       fi
   425       echo $srcfile > "$lockfile"
   426     fi
   427 
   428     if test -n "$fix_srcfile_path"; then
   429       eval srcfile=\"$fix_srcfile_path\"
   430     fi
   431 
   432     # Only build a PIC object if we are building libtool libraries.
   433     if test "$build_libtool_libs" = yes; then
   434       # Without this assignment, base_compile gets emptied.
   435       fbsd_hideous_sh_bug=$base_compile
   436 
   437       # All platforms use -DPIC, to notify preprocessed assembler code.
   438       command="$base_compile $srcfile $pic_flag -DPIC"
   439       if test "$build_old_libs" = yes; then
   440 	lo_libobj="$libobj"
   441 	dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
   442 	if test "X$dir" = "X$libobj"; then
   443 	  dir="$objdir"
   444 	else
   445 	  dir="$dir/$objdir"
   446 	fi
   447 	libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
   448 
   449 	if test -d "$dir"; then
   450 	  $show "$rm $libobj"
   451 	  $run $rm $libobj
   452 	else
   453 	  $show "$mkdir $dir"
   454 	  $run $mkdir $dir
   455 	  status=$?
   456 	  if test $status -ne 0 && test ! -d $dir; then
   457 	    exit $status
   458 	  fi
   459 	fi
   460       fi
   461       if test "$compiler_o_lo" = yes; then
   462 	output_obj="$libobj"
   463 	command="$command -o $output_obj"
   464       elif test "$compiler_c_o" = yes; then
   465 	output_obj="$obj"
   466 	command="$command -o $output_obj"
   467       fi
   468 
   469       $run $rm "$output_obj"
   470       $show "$command"
   471       if $run eval "$command"; then :
   472       else
   473 	test -n "$output_obj" && $run $rm $removelist
   474 	exit 1
   475       fi
   476 
   477       if test "$need_locks" = warn &&
   478 	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
   479 	echo "\
   480 *** ERROR, $lockfile contains:
   481 `cat $lockfile 2>/dev/null`
   482 
   483 but it should contain:
   484 $srcfile
   485 
   486 This indicates that another process is trying to use the same
   487 temporary object file, and libtool could not work around it because
   488 your compiler does not support \`-c' and \`-o' together.  If you
   489 repeat this compilation, it may succeed, by chance, but you had better
   490 avoid parallel builds (make -j) in this platform, or get a better
   491 compiler."
   492 
   493 	$run $rm $removelist
   494 	exit 1
   495       fi
   496 
   497       # Just move the object if needed, then go on to compile the next one
   498       if test x"$output_obj" != x"$libobj"; then
   499 	$show "$mv $output_obj $libobj"
   500 	if $run $mv $output_obj $libobj; then :
   501 	else
   502 	  error=$?
   503 	  $run $rm $removelist
   504 	  exit $error
   505 	fi
   506       fi
   507 
   508       # If we have no pic_flag, then copy the object into place and finish.
   509       if test -z "$pic_flag" && test "$build_old_libs" = yes; then
   510 	# Rename the .lo from within objdir to obj
   511 	if test -f $obj; then
   512 	  $show $rm $obj
   513 	  $run $rm $obj
   514 	fi
   515 
   516 	$show "$mv $libobj $obj"
   517 	if $run $mv $libobj $obj; then :
   518 	else
   519 	  error=$?
   520 	  $run $rm $removelist
   521 	  exit $error
   522 	fi
   523 
   524 	xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
   525 	if test "X$xdir" = "X$obj"; then
   526 	  xdir="."
   527 	else
   528 	  xdir="$xdir"
   529 	fi
   530 	baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
   531 	libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
   532 	# Now arrange that obj and lo_libobj become the same file
   533 	$show "(cd $xdir && $LN_S $baseobj $libobj)"
   534 	if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
   535 	  exit 0
   536 	else
   537 	  error=$?
   538 	  $run $rm $removelist
   539 	  exit $error
   540 	fi
   541       fi
   542 
   543       # Allow error messages only from the first compilation.
   544       suppress_output=' >/dev/null 2>&1'
   545     fi
   546 
   547     # Only build a position-dependent object if we build old libraries.
   548     if test "$build_old_libs" = yes; then
   549       command="$base_compile $srcfile"
   550       if test "$compiler_c_o" = yes; then
   551 	command="$command -o $obj"
   552 	output_obj="$obj"
   553       fi
   554 
   555       # Suppress compiler output if we already did a PIC compilation.
   556       command="$command$suppress_output"
   557       $run $rm "$output_obj"
   558       $show "$command"
   559       if $run eval "$command"; then :
   560       else
   561 	$run $rm $removelist
   562 	exit 1
   563       fi
   564 
   565       if test "$need_locks" = warn &&
   566 	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
   567 	echo "\
   568 *** ERROR, $lockfile contains:
   569 `cat $lockfile 2>/dev/null`
   570 
   571 but it should contain:
   572 $srcfile
   573 
   574 This indicates that another process is trying to use the same
   575 temporary object file, and libtool could not work around it because
   576 your compiler does not support \`-c' and \`-o' together.  If you
   577 repeat this compilation, it may succeed, by chance, but you had better
   578 avoid parallel builds (make -j) in this platform, or get a better
   579 compiler."
   580 
   581 	$run $rm $removelist
   582 	exit 1
   583       fi
   584 
   585       # Just move the object if needed
   586       if test x"$output_obj" != x"$obj"; then
   587 	$show "$mv $output_obj $obj"
   588 	if $run $mv $output_obj $obj; then :
   589 	else
   590 	  error=$?
   591 	  $run $rm $removelist
   592 	  exit $error
   593 	fi
   594       fi
   595 
   596       # Create an invalid libtool object if no PIC, so that we do not
   597       # accidentally link it into a program.
   598       if test "$build_libtool_libs" != yes; then
   599 	$show "echo timestamp > $libobj"
   600 	$run eval "echo timestamp > \$libobj" || exit $?
   601       else
   602 	# Move the .lo from within objdir
   603 	$show "$mv $libobj $lo_libobj"
   604 	if $run $mv $libobj $lo_libobj; then :
   605 	else
   606 	  error=$?
   607 	  $run $rm $removelist
   608 	  exit $error
   609 	fi
   610       fi
   611     fi
   612 
   613     # Unlock the critical section if it was locked
   614     if test "$need_locks" != no; then
   615       $rm "$lockfile"
   616     fi
   617 
   618     exit 0
   619     ;;
   620 
   621   # libtool link mode
   622   link)
   623     modename="$modename: link"
   624     case "$host" in
   625     *-*-cygwin* | *-*-mingw* | *-*-os2*)
   626       # It is impossible to link a dll without this setting, and
   627       # we shouldn't force the makefile maintainer to figure out
   628       # which system we are compiling for in order to pass an extra
   629       # flag for every libtool invokation.
   630       # allow_undefined=no
   631 
   632       # FIXME: Unfortunately, there are problems with the above when trying
   633       # to make a dll which has undefined symbols, in which case not
   634       # even a static library is built.  For now, we need to specify
   635       # -no-undefined on the libtool link line when we can be certain
   636       # that all symbols are satisfied, otherwise we get a static library.
   637       allow_undefined=yes
   638 
   639       # This is a source program that is used to create dlls on Windows
   640       # Don't remove nor modify the starting and closing comments
   641 # /* ltdll.c starts here */
   642 # #define WIN32_LEAN_AND_MEAN
   643 # #include <windows.h>
   644 # #undef WIN32_LEAN_AND_MEAN
   645 # #include <stdio.h>
   646 #
   647 # #ifndef __CYGWIN__
   648 # #  ifdef __CYGWIN32__
   649 # #    define __CYGWIN__ __CYGWIN32__
   650 # #  endif
   651 # #endif
   652 #
   653 # #ifdef __cplusplus
   654 # extern "C" {
   655 # #endif
   656 # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
   657 # #ifdef __cplusplus
   658 # }
   659 # #endif
   660 #
   661 # #ifdef __CYGWIN__
   662 # #include <cygwin/cygwin_dll.h>
   663 # DECLARE_CYGWIN_DLL( DllMain );
   664 # #endif
   665 # HINSTANCE __hDllInstance_base;
   666 #
   667 # BOOL APIENTRY
   668 # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
   669 # {
   670 #   __hDllInstance_base = hInst;
   671 #   return TRUE;
   672 # }
   673 # /* ltdll.c ends here */
   674       # This is a source program that is used to create import libraries
   675       # on Windows for dlls which lack them. Don't remove nor modify the
   676       # starting and closing comments
   677 # /* impgen.c starts here */
   678 # /*   Copyright (C) 1999 Free Software Foundation, Inc.
   679 # 
   680 #  This file is part of GNU libtool.
   681 # 
   682 #  This program is free software; you can redistribute it and/or modify
   683 #  it under the terms of the GNU General Public License as published by
   684 #  the Free Software Foundation; either version 2 of the License, or
   685 #  (at your option) any later version.
   686 # 
   687 #  This program is distributed in the hope that it will be useful,
   688 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
   689 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   690 #  GNU General Public License for more details.
   691 # 
   692 #  You should have received a copy of the GNU General Public License
   693 #  along with this program; if not, write to the Free Software
   694 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   695 #  */
   696 # 
   697 #  #include <stdio.h>		/* for printf() */
   698 #  #include <unistd.h>		/* for open(), lseek(), read() */
   699 #  #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
   700 #  #include <string.h>		/* for strdup() */
   701 # 
   702 #  static unsigned int
   703 #  pe_get16 (fd, offset)
   704 #       int fd;
   705 #       int offset;
   706 #  {
   707 #    unsigned char b[2];
   708 #    lseek (fd, offset, SEEK_SET);
   709 #    read (fd, b, 2);
   710 #    return b[0] + (b[1]<<8);
   711 #  }
   712 # 
   713 #  static unsigned int
   714 #  pe_get32 (fd, offset)
   715 #      int fd;
   716 #      int offset;
   717 #  {
   718 #    unsigned char b[4];
   719 #    lseek (fd, offset, SEEK_SET);
   720 #    read (fd, b, 4);
   721 #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
   722 #  }
   723 # 
   724 #  static unsigned int
   725 #  pe_as32 (ptr)
   726 #       void *ptr;
   727 #  {
   728 #    unsigned char *b = ptr;
   729 #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
   730 #  }
   731 # 
   732 #  int
   733 #  main (argc, argv)
   734 #      int argc;
   735 #      char *argv[];
   736 #  {
   737 #      int dll;
   738 #      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
   739 #      unsigned long export_rva, export_size, nsections, secptr, expptr;
   740 #      unsigned long name_rvas, nexp;
   741 #      unsigned char *expdata, *erva;
   742 #      char *filename, *dll_name;
   743 # 
   744 #      filename = argv[1];
   745 # 
   746 #      dll = open(filename, O_RDONLY|O_BINARY);
   747 #      if (!dll)
   748 #  	return 1;
   749 # 
   750 #      dll_name = filename;
   751 #    
   752 #      for (i=0; filename[i]; i++)
   753 #  	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
   754 #  	    dll_name = filename + i +1;
   755 # 
   756 #      pe_header_offset = pe_get32 (dll, 0x3c);
   757 #      opthdr_ofs = pe_header_offset + 4 + 20;
   758 #      num_entries = pe_get32 (dll, opthdr_ofs + 92);
   759 # 
   760 #      if (num_entries < 1) /* no exports */
   761 #  	return 1;
   762 # 
   763 #      export_rva = pe_get32 (dll, opthdr_ofs + 96);
   764 #      export_size = pe_get32 (dll, opthdr_ofs + 100);
   765 #      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
   766 #      secptr = (pe_header_offset + 4 + 20 +
   767 #  	      pe_get16 (dll, pe_header_offset + 4 + 16));
   768 # 
   769 #      expptr = 0;
   770 #      for (i = 0; i < nsections; i++)
   771 #      {
   772 #  	char sname[8];
   773 #  	unsigned long secptr1 = secptr + 40 * i;
   774 #  	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
   775 #  	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
   776 #  	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
   777 #  	lseek(dll, secptr1, SEEK_SET);
   778 #  	read(dll, sname, 8);
   779 #  	if (vaddr <= export_rva && vaddr+vsize > export_rva)
   780 #  	{
   781 #  	    expptr = fptr + (export_rva - vaddr);
   782 #  	    if (export_rva + export_size > vaddr + vsize)
   783 #  		export_size = vsize - (export_rva - vaddr);
   784 #  	    break;
   785 #  	}
   786 #      }
   787 # 
   788 #      expdata = (unsigned char*)malloc(export_size);
   789 #      lseek (dll, expptr, SEEK_SET);
   790 #      read (dll, expdata, export_size);
   791 #      erva = expdata - export_rva;
   792 # 
   793 #      nexp = pe_as32 (expdata+24);
   794 #      name_rvas = pe_as32 (expdata+32);
   795 # 
   796 #      printf ("EXPORTS\n");
   797 #      for (i = 0; i<nexp; i++)
   798 #      {
   799 #  	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
   800 #  	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
   801 #      }
   802 # 
   803 #      return 0;
   804 #  }
   805 # /* impgen.c ends here */
   806       ;;
   807     *)
   808       allow_undefined=yes
   809       ;;
   810     esac
   811     compile_command="$nonopt"
   812     finalize_command="$nonopt"
   813 
   814     compile_rpath=
   815     finalize_rpath=
   816     compile_shlibpath=
   817     finalize_shlibpath=
   818     convenience=
   819     old_convenience=
   820     deplibs=
   821     linkopts=
   822 
   823     if test -n "$shlibpath_var"; then
   824       # get the directories listed in $shlibpath_var
   825       eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
   826     else
   827       lib_search_path=
   828     fi
   829     # now prepend the system-specific ones
   830     eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
   831     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
   832     
   833     avoid_version=no
   834     dlfiles=
   835     dlprefiles=
   836     dlself=no
   837     export_dynamic=no
   838     export_symbols=
   839     export_symbols_regex=
   840     generated=
   841     libobjs=
   842     link_against_libtool_libs=
   843     ltlibs=
   844     module=no
   845     objs=
   846     prefer_static_libs=no
   847     preload=no
   848     prev=
   849     prevarg=
   850     release=
   851     rpath=
   852     xrpath=
   853     perm_rpath=
   854     temp_rpath=
   855     thread_safe=no
   856     vinfo=
   857 
   858     # We need to know -static, to get the right output filenames.
   859     for arg
   860     do
   861       case "$arg" in
   862       -all-static | -static)
   863 	if test "X$arg" = "X-all-static"; then
   864 	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
   865 	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
   866 	  fi
   867 	  if test -n "$link_static_flag"; then
   868 	    dlopen_self=$dlopen_self_static
   869 	  fi
   870 	else
   871 	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
   872 	    dlopen_self=$dlopen_self_static
   873 	  fi
   874 	fi
   875 	build_libtool_libs=no
   876 	build_old_libs=yes
   877 	prefer_static_libs=yes
   878 	break
   879 	;;
   880       esac
   881     done
   882 
   883     # See if our shared archives depend on static archives.
   884     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
   885 
   886     # Go through the arguments, transforming them on the way.
   887     while test $# -gt 0; do
   888       arg="$1"
   889       shift
   890 
   891       # If the previous option needs an argument, assign it.
   892       if test -n "$prev"; then
   893 	case "$prev" in
   894 	output)
   895 	  compile_command="$compile_command @OUTPUT@"
   896 	  finalize_command="$finalize_command @OUTPUT@"
   897 	  ;;
   898 	esac
   899 
   900 	case "$prev" in
   901 	dlfiles|dlprefiles)
   902 	  if test "$preload" = no; then
   903 	    # Add the symbol object into the linking commands.
   904 	    compile_command="$compile_command @SYMFILE@"
   905 	    finalize_command="$finalize_command @SYMFILE@"
   906 	    preload=yes
   907 	  fi
   908 	  case "$arg" in
   909 	  *.la | *.lo) ;;  # We handle these cases below.
   910 	  force)
   911 	    if test "$dlself" = no; then
   912 	      dlself=needless
   913 	      export_dynamic=yes
   914 	    fi
   915 	    prev=
   916 	    continue
   917 	    ;;
   918 	  self)
   919 	    if test "$prev" = dlprefiles; then
   920 	      dlself=yes
   921 	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
   922 	      dlself=yes
   923 	    else
   924 	      dlself=needless
   925 	      export_dynamic=yes
   926 	    fi
   927 	    prev=
   928 	    continue
   929 	    ;;
   930 	  *)
   931 	    if test "$prev" = dlfiles; then
   932 	      dlfiles="$dlfiles $arg"
   933 	    else
   934 	      dlprefiles="$dlprefiles $arg"
   935 	    fi
   936 	    prev=
   937 	    ;;
   938 	  esac
   939 	  ;;
   940 	expsyms)
   941 	  export_symbols="$arg"
   942 	  if test ! -f "$arg"; then
   943 	    $echo "$modename: symbol file \`$arg' does not exist"
   944 	    exit 1
   945 	  fi
   946 	  prev=
   947 	  continue
   948 	  ;;
   949 	expsyms_regex)
   950 	  export_symbols_regex="$arg"
   951 	  prev=
   952 	  continue
   953 	  ;;
   954 	framework)
   955 	  linkopts="$linkopts -framework $arg"
   956 	  prev=
   957 	  continue
   958 	  ;;
   959 	release)
   960 	  release="-$arg"
   961 	  prev=
   962 	  continue
   963 	  ;;
   964 	rpath | xrpath)
   965 	  # We need an absolute path.
   966 	  case "$arg" in
   967 	  [\\/]* | [A-Za-z]:[\\/]*) ;;
   968 	  *)
   969 	    $echo "$modename: only absolute run-paths are allowed" 1>&2
   970 	    exit 1
   971 	    ;;
   972 	  esac
   973 	  if test "$prev" = rpath; then
   974 	    case "$rpath " in
   975 	    *" $arg "*) ;;
   976 	    *) rpath="$rpath $arg" ;;
   977 	    esac
   978 	  else
   979 	    case "$xrpath " in
   980 	    *" $arg "*) ;;
   981 	    *) xrpath="$xrpath $arg" ;;
   982 	    esac
   983 	  fi
   984 	  prev=
   985 	  continue
   986 	  ;;
   987 	*)
   988 	  eval "$prev=\"\$arg\""
   989 	  prev=
   990 	  continue
   991 	  ;;
   992 	esac
   993       fi
   994 
   995       prevarg="$arg"
   996 
   997       case "$arg" in
   998       -all-static)
   999 	if test -n "$link_static_flag"; then
  1000 	  compile_command="$compile_command $link_static_flag"
  1001 	  finalize_command="$finalize_command $link_static_flag"
  1002 	fi
  1003 	continue
  1004 	;;
  1005 
  1006       -allow-undefined)
  1007 	# FIXME: remove this flag sometime in the future.
  1008 	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1009 	continue
  1010 	;;
  1011 
  1012       -avoid-version)
  1013 	avoid_version=yes
  1014 	continue
  1015 	;;
  1016 
  1017       -dlopen)
  1018 	prev=dlfiles
  1019 	continue
  1020 	;;
  1021 
  1022       -dlpreopen)
  1023 	prev=dlprefiles
  1024 	continue
  1025 	;;
  1026 
  1027       -export-dynamic)
  1028 	export_dynamic=yes
  1029 	continue
  1030 	;;
  1031 
  1032       -export-symbols | -export-symbols-regex)
  1033 	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1034 	  $echo "$modename: not more than one -exported-symbols argument allowed"
  1035 	  exit 1
  1036 	fi
  1037 	if test "X$arg" = "X-export-symbols"; then
  1038 	  prev=expsyms
  1039 	else
  1040 	  prev=expsyms_regex
  1041 	fi
  1042 	continue
  1043 	;;
  1044 
  1045       -framework)
  1046 	prev=framework
  1047 	continue
  1048 	;;
  1049 
  1050       -L*)
  1051 	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1052 	# We need an absolute path.
  1053 	case "$dir" in
  1054 	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1055 	*)
  1056 	  absdir=`cd "$dir" && pwd`
  1057 	  if test -z "$absdir"; then
  1058 	    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1059 	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1060 	    absdir="$dir"
  1061 	  fi
  1062 	  dir="$absdir"
  1063 	  ;;
  1064 	esac
  1065 	case " $deplibs " in
  1066 	*" $arg "*) ;;
  1067 	*) deplibs="$deplibs $arg";;
  1068 	esac
  1069 	case " $lib_search_path " in
  1070 	*" $dir "*) ;;
  1071 	*) lib_search_path="$lib_search_path $dir";;
  1072 	esac
  1073 	case "$host" in
  1074 	*-*-cygwin* | *-*-mingw* | *-*-os2*)
  1075 	  dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1076 	  case ":$dllsearchpath:" in
  1077 	  ::) dllsearchpath="$dllsearchdir";;
  1078 	  *":$dllsearchdir:"*) ;;
  1079 	  *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  1080 	  esac
  1081 	  ;;
  1082 	esac
  1083 	;;
  1084 
  1085       -l*)
  1086 	if test "$arg" = "-lc"; then
  1087 	  case "$host" in
  1088 	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* |*-*-freebsd* )
  1089 	    # These systems don't actually have c library (as such)
  1090 	    continue
  1091 	    ;;
  1092           *-*-openbsd*)
  1093             # Do not include libc due to us having libc/libc_r.
  1094             continue
  1095             ;;
  1096 	  esac
  1097         elif test "$arg" = "-lc_r"; then
  1098           case "$host" in
  1099           *-*-openbsd*)
  1100             # Do not include libc_r directly, use -pthread flag.
  1101             continue
  1102             ;;
  1103           esac
  1104 	elif test "$arg" = "-lm"; then
  1105 	  case "$host" in
  1106 	  *-*-cygwin* | *-*-beos*)
  1107 	    # These systems don't actually have math library (as such)
  1108 	    continue
  1109 	    ;;
  1110 	  esac
  1111 	fi
  1112 	deplibs="$deplibs $arg"
  1113 	;;
  1114 
  1115       -?thread)
  1116         deplibs="$deplibs $arg"
  1117         ;;
  1118 
  1119       -module)
  1120 	module=yes
  1121 	continue
  1122 	;;
  1123 
  1124       -no-undefined)
  1125 	allow_undefined=no
  1126 	continue
  1127 	;;
  1128 
  1129       -o) prev=output ;;
  1130 
  1131       -release)
  1132 	prev=release
  1133 	continue
  1134 	;;
  1135 
  1136       -rpath)
  1137 	prev=rpath
  1138 	continue
  1139 	;;
  1140 
  1141       -R)
  1142 	prev=xrpath
  1143 	continue
  1144 	;;
  1145 
  1146       -R*)
  1147 	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1148 	# We need an absolute path.
  1149 	case "$dir" in
  1150 	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1151 	*)
  1152 	  $echo "$modename: only absolute run-paths are allowed" 1>&2
  1153 	  exit 1
  1154 	  ;;
  1155 	esac
  1156 	case "$xrpath " in
  1157 	*" $dir "*) ;;
  1158 	*) xrpath="$xrpath $dir" ;;
  1159 	esac
  1160 	continue
  1161 	;;
  1162 
  1163       -static)
  1164 	# If we have no pic_flag, then this is the same as -all-static.
  1165 	if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1166 	  compile_command="$compile_command $link_static_flag"
  1167 	  finalize_command="$finalize_command $link_static_flag"
  1168 	fi
  1169 	continue
  1170 	;;
  1171 
  1172       -thread-safe)
  1173 	thread_safe=yes
  1174 	continue
  1175 	;;
  1176 
  1177       -version-info)
  1178 	prev=vinfo
  1179 	continue
  1180 	;;
  1181 
  1182       # Some other compiler flag.
  1183       -* | +*)
  1184 	# Unknown arguments in both finalize_command and compile_command need
  1185 	# to be aesthetically quoted because they are evaled later.
  1186 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1187 	case "$arg" in
  1188 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1189 	  arg="\"$arg\""
  1190 	  ;;
  1191 	esac
  1192 	;;
  1193 
  1194       *.o | *.obj | *.a | *.lib)
  1195 	# A standard object.
  1196 	objs="$objs $arg"
  1197 	;;
  1198 
  1199       *.lo)
  1200 	# A library object.
  1201 	if test "$prev" = dlfiles; then
  1202 	  dlfiles="$dlfiles $arg"
  1203 	  if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1204 	    prev=
  1205 	    continue
  1206 	  else
  1207 	    # If libtool objects are unsupported, then we need to preload.
  1208 	    prev=dlprefiles
  1209 	  fi
  1210 	fi
  1211 
  1212 	if test "$prev" = dlprefiles; then
  1213 	  # Preload the old-style object.
  1214 	  dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1215 	  prev=
  1216 	fi
  1217 	libobjs="$libobjs $arg"
  1218 	;;
  1219 
  1220       *.la)
  1221 	# A libtool-controlled library.
  1222 
  1223 	dlname=
  1224 	libdir=
  1225 	library_names=
  1226 	old_library=
  1227 
  1228 	# Check to see that this really is a libtool archive.
  1229 	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1230 	else
  1231 	  $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1232 	  exit 1
  1233 	fi
  1234 
  1235 	# If the library was installed with an old release of libtool,
  1236 	# it will not redefine variable installed.
  1237 	installed=yes
  1238 
  1239 	# Read the .la file
  1240 	# If there is no directory component, then add one.
  1241 	case "$arg" in
  1242 	*/* | *\\*) . $arg ;;
  1243 	*) . ./$arg ;;
  1244 	esac
  1245 
  1246 	# Get the name of the library we link against.
  1247 	linklib=
  1248 	for l in $old_library $library_names; do
  1249 	  linklib="$l"
  1250 	done
  1251 
  1252 	if test -z "$linklib"; then
  1253 	  $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1254 	  exit 1
  1255 	fi
  1256 
  1257 	# Find the relevant object directory and library name.
  1258 	name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1259 
  1260 	if test "X$installed" = Xyes; then
  1261 	  dir="$libdir"
  1262 	else
  1263 	  dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1264 	  if test "X$dir" = "X$arg"; then
  1265 	    dir="$objdir"
  1266 	  else
  1267 	    dir="$dir/$objdir"
  1268 	  fi
  1269 	fi
  1270 
  1271 	if test -n "$dependency_libs"; then
  1272 	  # Extract -R and -L from dependency_libs
  1273 	  temp_deplibs=
  1274 	  for deplib in $dependency_libs; do
  1275 	    case "$deplib" in
  1276 	    -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1277 		 case " $rpath $xrpath " in
  1278 		 *" $temp_xrpath "*) ;;
  1279 		 *) xrpath="$xrpath $temp_xrpath";;
  1280 		 esac;;
  1281 	    -L*) case "$compile_command $temp_deplibs " in
  1282 		 *" $deplib "*) ;;
  1283 		 *) temp_deplibs="$temp_deplibs $deplib";;
  1284 		 esac
  1285 		 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1286 		 case " $lib_search_path " in
  1287 		 *" $temp_dir "*) ;;
  1288 		 *) lib_search_path="$lib_search_path $temp_dir";;
  1289 		 esac
  1290 		 ;;
  1291 	    *) temp_deplibs="$temp_deplibs $deplib";;
  1292 	    esac
  1293 	  done
  1294 	  dependency_libs="$temp_deplibs"
  1295 	fi
  1296 
  1297 	if test -z "$libdir"; then
  1298 	  # It is a libtool convenience library, so add in its objects.
  1299 	  convenience="$convenience $dir/$old_library"
  1300 	  old_convenience="$old_convenience $dir/$old_library"
  1301 	  deplibs="$deplibs$dependency_libs"
  1302 	  compile_command="$compile_command $dir/$old_library$dependency_libs"
  1303 	  finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1304 	  continue
  1305 	fi
  1306 
  1307 	# This library was specified with -dlopen.
  1308 	if test "$prev" = dlfiles; then
  1309 	  dlfiles="$dlfiles $arg"
  1310 	  if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1311 	    # If there is no dlname, no dlopen support or we're linking statically,
  1312 	    # we need to preload.
  1313 	    prev=dlprefiles
  1314 	  else
  1315 	    # We should not create a dependency on this library, but we
  1316 	    # may need any libraries it requires.
  1317 	    compile_command="$compile_command$dependency_libs"
  1318 	    finalize_command="$finalize_command$dependency_libs"
  1319 	    prev=
  1320 	    continue
  1321 	  fi
  1322 	fi
  1323 
  1324 	# The library was specified with -dlpreopen.
  1325 	if test "$prev" = dlprefiles; then
  1326 	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  1327 	  # are required to link).
  1328 	  if test -n "$old_library"; then
  1329 	    dlprefiles="$dlprefiles $dir/$old_library"
  1330 	  else
  1331 	    dlprefiles="$dlprefiles $dir/$linklib"
  1332 	  fi
  1333 	  prev=
  1334 	fi
  1335 
  1336 	if test -n "$library_names" &&
  1337 	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1338 	  link_against_libtool_libs="$link_against_libtool_libs $arg"
  1339 	  if test -n "$shlibpath_var"; then
  1340 	    # Make sure the rpath contains only unique directories.
  1341 	    case "$temp_rpath " in
  1342 	    *" $dir "*) ;;
  1343 	    *) temp_rpath="$temp_rpath $dir" ;;
  1344 	    esac
  1345 	  fi
  1346 
  1347 	  # We need an absolute path.
  1348 	  case "$dir" in
  1349 	  [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1350 	  *)
  1351 	    absdir=`cd "$dir" && pwd`
  1352 	    if test -z "$absdir"; then
  1353 	      $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1354 	      $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1355 	      absdir="$dir"
  1356 	    fi
  1357 	    ;;
  1358 	  esac
  1359 	  
  1360 	  # This is the magic to use -rpath.
  1361 	  # Skip directories that are in the system default run-time
  1362 	  # search path, unless they have been requested with -R.
  1363 	  case " $sys_lib_dlsearch_path " in
  1364 	  *" $absdir "*) ;;
  1365 	  *)
  1366 	    case "$compile_rpath " in
  1367 	    *" $absdir "*) ;;
  1368 	    *) compile_rpath="$compile_rpath $absdir" 
  1369 	    esac
  1370 	    ;;
  1371 	  esac
  1372 
  1373 	  case " $sys_lib_dlsearch_path " in
  1374 	  *" $libdir "*) ;;
  1375 	  *)
  1376 	    case "$finalize_rpath " in
  1377 	    *" $libdir "*) ;;
  1378 	    *) finalize_rpath="$finalize_rpath $libdir"
  1379 	    esac
  1380 	    ;;
  1381 	  esac
  1382 
  1383 	  lib_linked=yes
  1384 	  case "$hardcode_action" in
  1385 	  immediate | unsupported)
  1386 	    if test "$hardcode_direct" = no; then
  1387 	      compile_command="$compile_command $dir/$linklib"
  1388 	      deplibs="$deplibs $dir/$linklib"
  1389 	      case "$host" in
  1390 	      *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1391 		dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1392 		if test -n "$dllsearchpath"; then
  1393 		  dllsearchpath="$dllsearchpath:$dllsearchdir"
  1394 		else
  1395 		  dllsearchpath="$dllsearchdir"
  1396 		fi
  1397 		;;
  1398 	      esac
  1399 	    elif test "$hardcode_minus_L" = no; then
  1400 	      case "$host" in
  1401 	      *-*-sunos*)
  1402 		compile_shlibpath="$compile_shlibpath$dir:"
  1403 		;;
  1404 	      esac
  1405 	      case "$compile_command " in
  1406 	      *" -L$dir "*) ;;
  1407 	      *) compile_command="$compile_command -L$dir";;
  1408 	      esac
  1409 	      compile_command="$compile_command -l$name"
  1410 	      deplibs="$deplibs -L$dir -l$name"
  1411 	    elif test "$hardcode_shlibpath_var" = no; then
  1412 	      case ":$compile_shlibpath:" in
  1413 	      *":$dir:"*) ;;
  1414 	      *) compile_shlibpath="$compile_shlibpath$dir:";;
  1415 	      esac
  1416 	      compile_command="$compile_command -l$name"
  1417 	      deplibs="$deplibs -l$name"
  1418 	    else
  1419 	      lib_linked=no
  1420 	    fi
  1421 	    ;;
  1422 
  1423 	  relink)
  1424 	    if test "$hardcode_direct" = yes; then
  1425 	      compile_command="$compile_command $absdir/$linklib"
  1426 	      deplibs="$deplibs $absdir/$linklib"
  1427 	    elif test "$hardcode_minus_L" = yes; then
  1428 	      case "$compile_command " in
  1429 	      *" -L$absdir "*) ;;
  1430 	      *) compile_command="$compile_command -L$absdir";;
  1431 	      esac
  1432 	      compile_command="$compile_command -l$name"
  1433 	      deplibs="$deplibs -L$absdir -l$name"
  1434 	    elif test "$hardcode_shlibpath_var" = yes; then
  1435 	      case ":$compile_shlibpath:" in
  1436 	      *":$absdir:"*) ;;
  1437 	      *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1438 	      esac
  1439 	      compile_command="$compile_command -l$name"
  1440 	      deplibs="$deplibs -l$name"
  1441 	    else
  1442 	      lib_linked=no
  1443 	    fi
  1444 	    ;;
  1445 
  1446 	  *)
  1447 	    lib_linked=no
  1448 	    ;;
  1449 	  esac
  1450 
  1451 	  if test "$lib_linked" != yes; then
  1452 	    $echo "$modename: configuration error: unsupported hardcode properties"
  1453 	    exit 1
  1454 	  fi
  1455 
  1456 	  # Finalize command for both is simple: just hardcode it.
  1457 	  if test "$hardcode_direct" = yes; then
  1458 	    finalize_command="$finalize_command $libdir/$linklib"
  1459 	  elif test "$hardcode_minus_L" = yes; then
  1460 	    case "$finalize_command " in
  1461 	    *" -L$libdir "*) ;;
  1462 	    *) finalize_command="$finalize_command -L$libdir";;
  1463 	    esac
  1464 	    finalize_command="$finalize_command -l$name"
  1465 	  elif test "$hardcode_shlibpath_var" = yes; then
  1466 	    case ":$finalize_shlibpath:" in
  1467 	    *":$libdir:"*) ;;
  1468 	    *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1469 	    esac
  1470 	    finalize_command="$finalize_command -l$name"
  1471 	  else
  1472 	    # We cannot seem to hardcode it, guess we'll fake it.
  1473 	    case "$finalize_command " in
  1474 	    *" -L$dir "*) ;;
  1475 	    *) finalize_command="$finalize_command -L$libdir";;
  1476 	    esac
  1477 	    finalize_command="$finalize_command -l$name"
  1478 	  fi
  1479 	else
  1480 	  # Transform directly to old archives if we don't build new libraries.
  1481 	  if test -n "$pic_flag" && test -z "$old_library"; then
  1482 	    $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1483 	    exit 1
  1484 	  fi
  1485 
  1486 	  # Here we assume that one of hardcode_direct or hardcode_minus_L
  1487 	  # is not unsupported.  This is valid on all known static and
  1488 	  # shared platforms.
  1489 	  if test "$hardcode_direct" != unsupported; then
  1490 	    test -n "$old_library" && linklib="$old_library"
  1491 	    compile_command="$compile_command $dir/$linklib"
  1492 	    finalize_command="$finalize_command $dir/$linklib"
  1493 	  else
  1494 	    case "$compile_command " in
  1495 	    *" -L$dir "*) ;;
  1496 	    *) compile_command="$compile_command -L$dir";;
  1497 	    esac
  1498 	    compile_command="$compile_command -l$name"
  1499 	    case "$finalize_command " in
  1500 	    *" -L$dir "*) ;;
  1501 	    *) finalize_command="$finalize_command -L$dir";;
  1502 	    esac
  1503 	    finalize_command="$finalize_command -l$name"
  1504 	  fi
  1505 	fi
  1506 
  1507 	# Add in any libraries that this one depends upon.
  1508 	compile_command="$compile_command$dependency_libs"
  1509 	finalize_command="$finalize_command$dependency_libs"
  1510 	continue
  1511 	;;
  1512 
  1513       # Some other compiler argument.
  1514       *)
  1515 	# Unknown arguments in both finalize_command and compile_command need
  1516 	# to be aesthetically quoted because they are evaled later.
  1517 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1518 	case "$arg" in
  1519 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1520 	  arg="\"$arg\""
  1521 	  ;;
  1522 	esac
  1523 	;;
  1524       esac
  1525 
  1526       # Now actually substitute the argument into the commands.
  1527       if test -n "$arg"; then
  1528 	compile_command="$compile_command $arg"
  1529 	finalize_command="$finalize_command $arg"
  1530       fi
  1531     done
  1532 
  1533     if test -n "$prev"; then
  1534       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1535       $echo "$help" 1>&2
  1536       exit 1
  1537     fi
  1538 
  1539     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1540       eval arg=\"$export_dynamic_flag_spec\"
  1541       compile_command="$compile_command $arg"
  1542       finalize_command="$finalize_command $arg"
  1543     fi
  1544 
  1545     oldlibs=
  1546     # calculate the name of the file, without its directory
  1547     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1548     libobjs_save="$libobjs"
  1549 
  1550     case "$output" in
  1551     "")
  1552       $echo "$modename: you must specify an output file" 1>&2
  1553       $echo "$help" 1>&2
  1554       exit 1
  1555       ;;
  1556 
  1557     *.a | *.lib)
  1558       if test -n "$link_against_libtool_libs"; then
  1559 	$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1560 	exit 1
  1561       fi
  1562 
  1563       if test -n "$deplibs"; then
  1564 	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1565       fi
  1566 
  1567       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1568 	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1569       fi
  1570 
  1571       if test -n "$rpath"; then
  1572 	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1573       fi
  1574 
  1575       if test -n "$xrpath"; then
  1576 	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1577       fi
  1578 
  1579       if test -n "$vinfo"; then
  1580 	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1581       fi
  1582 
  1583       if test -n "$release"; then
  1584 	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1585       fi
  1586 
  1587       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1588 	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1589       fi
  1590 
  1591       # Now set the variables for building old libraries.
  1592       build_libtool_libs=no
  1593       oldlibs="$output"
  1594       ;;
  1595 
  1596     *.la)
  1597       # Make sure we only generate libraries of the form `libNAME.la'.
  1598       case "$outputname" in
  1599       lib*)
  1600 	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1601 	eval libname=\"$libname_spec\"
  1602 	;;
  1603       *)
  1604 	if test "$module" = no; then
  1605 	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1606 	  $echo "$help" 1>&2
  1607 	  exit 1
  1608 	fi
  1609 	if test "$need_lib_prefix" != no; then
  1610 	  # Add the "lib" prefix for modules if required
  1611 	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1612 	  eval libname=\"$libname_spec\"
  1613 	else
  1614 	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1615 	fi
  1616 	;;
  1617       esac
  1618 
  1619       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1620       if test "X$output_objdir" = "X$output"; then
  1621 	output_objdir="$objdir"
  1622       else
  1623 	output_objdir="$output_objdir/$objdir"
  1624       fi
  1625 
  1626       if test -n "$objs"; then
  1627 	$echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1628 	exit 1
  1629       fi
  1630 
  1631       # How the heck are we supposed to write a wrapper for a shared library?
  1632       if test -n "$link_against_libtool_libs"; then
  1633 	 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1634 	 exit 1
  1635       fi
  1636 
  1637       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1638 	$echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1639       fi
  1640 
  1641       set dummy $rpath
  1642       if test $# -gt 2; then
  1643 	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1644       fi
  1645       install_libdir="$2"
  1646 
  1647       oldlibs=
  1648       if test -z "$rpath"; then
  1649 	if test "$build_libtool_libs" = yes; then
  1650 	  # Building a libtool convenience library.
  1651 	  libext=al
  1652 	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1653 	  build_libtool_libs=convenience
  1654 	  build_old_libs=yes
  1655 	fi
  1656 	dependency_libs="$deplibs"
  1657 
  1658 	if test -n "$vinfo"; then
  1659 	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1660 	fi
  1661 
  1662 	if test -n "$release"; then
  1663 	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1664 	fi
  1665       else
  1666 
  1667 	# Parse the version information argument.
  1668 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=':'
  1669 	set dummy $vinfo 0 0 0
  1670 	IFS="$save_ifs"
  1671 
  1672 	if test -n "$8"; then
  1673 	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1674 	  $echo "$help" 1>&2
  1675 	  exit 1
  1676 	fi
  1677 
  1678 	current="$2"
  1679 	revision="$3"
  1680 	age="$4"
  1681 
  1682 	# Check that each of the things are valid numbers.
  1683 	case "$current" in
  1684 	0 | [1-9] | [1-9][0-9]*) ;;
  1685 	*)
  1686 	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1687 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1688 	  exit 1
  1689 	  ;;
  1690 	esac
  1691 
  1692 	case "$revision" in
  1693 	0 | [1-9] | [1-9][0-9]*) ;;
  1694 	*)
  1695 	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1696 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1697 	  exit 1
  1698 	  ;;
  1699 	esac
  1700 
  1701 	case "$age" in
  1702 	0 | [1-9] | [1-9][0-9]*) ;;
  1703 	*)
  1704 	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1705 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1706 	  exit 1
  1707 	  ;;
  1708 	esac
  1709 
  1710 	if test $age -gt $current; then
  1711 	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1712 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1713 	  exit 1
  1714 	fi
  1715 
  1716 	# Calculate the version variables.
  1717 	major=
  1718 	versuffix=
  1719 	verstring=
  1720 	case "$version_type" in
  1721 	none) ;;
  1722 
  1723 	irix)
  1724 	  major=`expr $current - $age + 1`
  1725 	  versuffix="$major.$revision"
  1726 	  verstring="sgi$major.$revision"
  1727 
  1728 	  # Add in all the interfaces that we are compatible with.
  1729 	  loop=$revision
  1730 	  while test $loop != 0; do
  1731 	    iface=`expr $revision - $loop`
  1732 	    loop=`expr $loop - 1`
  1733 	    verstring="sgi$major.$iface:$verstring"
  1734 	  done
  1735 	  ;;
  1736 
  1737 	linux)
  1738 	  major=.`expr $current - $age`
  1739 	  versuffix="$major.$age.$revision"
  1740 	  ;;
  1741 
  1742 	osf)
  1743 	  major=`expr $current - $age`
  1744 	  versuffix=".$current.$age.$revision"
  1745 	  verstring="$current.$age.$revision"
  1746 
  1747 	  # Add in all the interfaces that we are compatible with.
  1748 	  loop=$age
  1749 	  while test $loop != 0; do
  1750 	    iface=`expr $current - $loop`
  1751 	    loop=`expr $loop - 1`
  1752 	    verstring="$verstring:${iface}.0"
  1753 	  done
  1754 
  1755 	  # Make executables depend on our current version.
  1756 	  verstring="$verstring:${current}.0"
  1757 	  ;;
  1758 
  1759 	sunos)
  1760 	  major=".$current"
  1761 	  versuffix=".$current.$revision"
  1762 	  ;;
  1763 
  1764 	freebsd-aout)
  1765 	  major=".$current"
  1766 	  versuffix=".$current.$revision";
  1767 	  ;;
  1768 
  1769 	freebsd-elf)
  1770 	  major=".$current"
  1771 	  versuffix=".$current";
  1772 	  ;;
  1773 
  1774 	windows)
  1775 	  # Like Linux, but with '-' rather than '.', since we only
  1776 	  # want one extension on Windows 95.
  1777 	  major=`expr $current - $age`
  1778 	  versuffix="-$major-$age-$revision"
  1779 	  ;;
  1780 
  1781 	darwin)
  1782 	  # Like Linux, but with the current version available in
  1783 	  # verstring for coding it into the library header
  1784 	  major=.`expr $current - $age`
  1785 	  versuffix="$major.$age.$revision"
  1786 	  # Darwin ld doesn't like 0 for these options...
  1787 	  minor_current=`expr $current + 1`
  1788 	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  1789 	  ;;
  1790 
  1791 	*)
  1792 	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1793 	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1794 	  exit 1
  1795 	  ;;
  1796 	esac
  1797 
  1798 	# Clear the version info if we defaulted, and they specified a release.
  1799 	if test -z "$vinfo" && test -n "$release"; then
  1800 	  major=
  1801 	  case "$version_type" in
  1802 	  darwin)
  1803 	    # we can't check for "0.0" in archive_cmds due to quoting
  1804 	    # problems, so we reset it completely
  1805 	    verstring=""
  1806 	    ;;
  1807 	  *)
  1808 	  verstring="0.0"
  1809 	    ;;
  1810 	  esac
  1811 	  if test "$need_version" = no; then
  1812 	    versuffix=
  1813 	  else
  1814 	    versuffix=".0.0"
  1815 	  fi
  1816 	fi
  1817 
  1818 	# Remove version info from name if versioning should be avoided
  1819 	if test "$avoid_version" = yes && test "$need_version" = no; then
  1820 	  major=
  1821 	  versuffix=
  1822 	  verstring=""
  1823 	fi
  1824 	
  1825 	# Check to see if the archive will have undefined symbols.
  1826 	if test "$allow_undefined" = yes; then
  1827 	  if test "$allow_undefined_flag" = unsupported; then
  1828 	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1829 	    build_libtool_libs=no
  1830 	    build_old_libs=yes
  1831 	  fi
  1832 	else
  1833 	  # Don't allow undefined symbols.
  1834 	  allow_undefined_flag="$no_undefined_flag"
  1835 	fi
  1836 
  1837 	dependency_libs="$deplibs"
  1838 	case "$host" in
  1839 	*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* )
  1840 	  # these systems don't actually have a c library (as such)!
  1841 	  ;;
  1842         *-*-rhapsody*)
  1843 	  # rhapsody is a little odd...
  1844 	  deplibs="$deplibs -framework System"
  1845 	  ;;
  1846 	*-*-openbsd*)
  1847 	  # do not include libc due to us having libc/libc_r.
  1848 	  ;;
  1849 	*)
  1850 	  # Add libc to deplibs on all other systems.
  1851 	  deplibs="$deplibs -lc"
  1852 	  ;;
  1853 	esac
  1854       fi
  1855 
  1856       # Create the output directory, or remove our outputs if we need to.
  1857       if test -d $output_objdir; then
  1858 	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1859 	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1860       else
  1861 	$show "$mkdir $output_objdir"
  1862 	$run $mkdir $output_objdir
  1863 	status=$?
  1864 	if test $status -ne 0 && test ! -d $output_objdir; then
  1865 	  exit $status
  1866 	fi
  1867       fi
  1868 
  1869       # Now set the variables for building old libraries.
  1870       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  1871 	oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1872 
  1873 	# Transform .lo files to .o files.
  1874 	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1875       fi
  1876 
  1877       if test "$build_libtool_libs" = yes; then
  1878 	# Transform deplibs into only deplibs that can be linked in shared.
  1879 	name_save=$name
  1880 	libname_save=$libname
  1881 	release_save=$release
  1882 	versuffix_save=$versuffix
  1883 	major_save=$major
  1884 	# I'm not sure if I'm treating the release correctly.  I think
  1885 	# release should show up in the -l (ie -lgmp5) so we don't want to
  1886 	# add it in twice.  Is that correct?
  1887 	release=""
  1888 	versuffix=""
  1889 	major=""
  1890 	newdeplibs=
  1891 	droppeddeps=no
  1892 	case "$deplibs_check_method" in
  1893 	pass_all)
  1894 	  # Don't check for shared/static.  Everything works.
  1895 	  # This might be a little naive.  We might want to check
  1896 	  # whether the library exists or not.  But this is on
  1897 	  # osf3 & osf4 and I'm not really sure... Just
  1898 	  # implementing what was already the behaviour.
  1899 	  newdeplibs=$deplibs
  1900 	  ;;
  1901 	test_compile)
  1902 	  # This code stresses the "libraries are programs" paradigm to its
  1903 	  # limits. Maybe even breaks it.  We compile a program, linking it
  1904 	  # against the deplibs as a proxy for the library.  Then we can check
  1905 	  # whether they linked in statically or dynamically with ldd.
  1906 	  $rm conftest.c
  1907 	  cat > conftest.c <<EOF
  1908 	  int main() { return 0; }
  1909 EOF
  1910 	  $rm conftest
  1911 	  $CC -o conftest conftest.c $deplibs
  1912 	  if test $? -eq 0 ; then
  1913 	    ldd_output=`ldd conftest`
  1914 	    for i in $deplibs; do
  1915 	      name="`expr $i : '-l\(.*\)'`"
  1916 	      # If $name is empty we are operating on a -L argument.
  1917 	      if test "$name" != "" ; then
  1918 		libname=`eval \\$echo \"$libname_spec\"`
  1919 		deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1920 		set dummy $deplib_matches
  1921 		deplib_match=$2
  1922 		if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1923 		  newdeplibs="$newdeplibs $i"
  1924 		else
  1925 		  droppeddeps=yes
  1926 		  echo
  1927 		  echo "*** Warning: This library needs some functionality provided by $i."
  1928 		  echo "*** I have the capability to make that library automatically link in when"
  1929 		  echo "*** you link to this library.  But I can only do this if you have a"
  1930 		  echo "*** shared version of the library, which you do not appear to have."
  1931 		fi
  1932 	      else
  1933 		newdeplibs="$newdeplibs $i"
  1934 	      fi
  1935 	    done
  1936 	  else
  1937 	    # Error occured in the first compile.  Let's try to salvage the situation:
  1938 	    # Compile a seperate program for each library.
  1939 	    for i in $deplibs; do
  1940 	      name="`expr $i : '-l\(.*\)'`"
  1941 	     # If $name is empty we are operating on a -L argument.
  1942 	      if test "$name" != "" ; then
  1943 		$rm conftest
  1944 		$CC -o conftest conftest.c $i
  1945 		# Did it work?
  1946 		if test $? -eq 0 ; then
  1947 		  ldd_output=`ldd conftest`
  1948 		  libname=`eval \\$echo \"$libname_spec\"`
  1949 		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1950 		  set dummy $deplib_matches
  1951 		  deplib_match=$2
  1952 		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1953 		    newdeplibs="$newdeplibs $i"
  1954 		  else
  1955 		    droppeddeps=yes
  1956 		    echo
  1957 		    echo "*** Warning: This library needs some functionality provided by $i."
  1958 		    echo "*** I have the capability to make that library automatically link in when"
  1959 		    echo "*** you link to this library.  But I can only do this if you have a"
  1960 		    echo "*** shared version of the library, which you do not appear to have."
  1961 		  fi
  1962 		else
  1963 		  droppeddeps=yes
  1964 		  echo
  1965 		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1966 		  echo "***  make it link in!  You will probably need to install it or some"
  1967 		  echo "*** library that it depends on before this library will be fully"
  1968 		  echo "*** functional.  Installing it before continuing would be even better."
  1969 		fi
  1970 	      else
  1971 		newdeplibs="$newdeplibs $i"
  1972 	      fi
  1973 	    done
  1974 	  fi
  1975 	  ;;
  1976 	file_magic*)
  1977 	  set dummy $deplibs_check_method
  1978 	  file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  1979 	  for a_deplib in $deplibs; do
  1980 	    name="`expr $a_deplib : '-l\(.*\)'`"
  1981 	    # If $name is empty we are operating on a -L argument.
  1982 	    if test "$name" != "" ; then
  1983 	      libname=`eval \\$echo \"$libname_spec\"`
  1984 	      for i in $lib_search_path; do
  1985 		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1986 		    for potent_lib in $potential_libs; do
  1987 		      # Follow soft links.
  1988 		      if ls -lLd "$potent_lib" 2>/dev/null \
  1989 			 | grep " -> " >/dev/null; then
  1990 			continue 
  1991 		      fi
  1992 		      # The statement above tries to avoid entering an
  1993 		      # endless loop below, in case of cyclic links.
  1994 		      # We might still enter an endless loop, since a link
  1995 		      # loop can be closed while we follow links,
  1996 		      # but so what?
  1997 		      potlib="$potent_lib"
  1998 		      while test -h "$potlib" 2>/dev/null; do
  1999 			potliblink=`ls -ld $potlib | sed 's/.* -> //'`
  2000 			case "$potliblink" in
  2001 			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  2002 			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  2003 			esac
  2004 		      done
  2005 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  2006 			 | sed 10q \
  2007 			 | egrep "$file_magic_regex" > /dev/null; then
  2008 			newdeplibs="$newdeplibs $a_deplib"
  2009 			a_deplib=""
  2010 			break 2
  2011 		      fi
  2012 		    done
  2013 	      done
  2014 	      if test -n "$a_deplib" ; then
  2015 		droppeddeps=yes
  2016 		echo
  2017 		echo "*** Warning: This library needs some functionality provided by $a_deplib."
  2018 		echo "*** I have the capability to make that library automatically link in when"
  2019 		echo "*** you link to this library.  But I can only do this if you have a"
  2020 		echo "*** shared version of the library, which you do not appear to have."
  2021 	      fi
  2022 	    else
  2023 	      # Add a -L argument.
  2024 	      newdeplibs="$newdeplibs $a_deplib"
  2025 	    fi
  2026 	  done # Gone through all deplibs.
  2027 	  ;;
  2028 	none | unknown | *)
  2029 	  newdeplibs=""
  2030 	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  2031 	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
  2032 	     grep . >/dev/null; then
  2033 	    echo
  2034 	    if test "X$deplibs_check_method" = "Xnone"; then
  2035 	      echo "*** Warning: inter-library dependencies are not supported in this platform."
  2036 	    else
  2037 	      echo "*** Warning: inter-library dependencies are not known to be supported."
  2038 	    fi
  2039 	    echo "*** All declared inter-library dependencies are being dropped."
  2040 	    droppeddeps=yes
  2041 	  fi
  2042 	  ;;
  2043 	esac
  2044 	versuffix=$versuffix_save
  2045 	major=$major_save
  2046 	release=$release_save
  2047 	libname=$libname_save
  2048 	name=$name_save
  2049 
  2050 	if test "$droppeddeps" = yes; then
  2051 	  if test "$module" = yes; then
  2052 	    echo
  2053 	    echo "*** Warning: libtool could not satisfy all declared inter-library"
  2054 	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
  2055 	    echo "*** a static module, that should work as long as the dlopening"
  2056 	    echo "*** application is linked with the -dlopen flag."
  2057 	    if test -z "$global_symbol_pipe"; then
  2058 	      echo
  2059 	      echo "*** However, this would only work if libtool was able to extract symbol"
  2060 	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  2061 	      echo "*** not find such a program.  So, this module is probably useless."
  2062 	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
  2063 	    fi
  2064 	    if test "$build_old_libs" = no; then
  2065 	      oldlibs="$output_objdir/$libname.$libext"
  2066 	      build_libtool_libs=module
  2067 	      build_old_libs=yes
  2068 	    else
  2069 	      build_libtool_libs=no
  2070 	    fi
  2071 	  else
  2072 	    echo "*** The inter-library dependencies that have been dropped here will be"
  2073 	    echo "*** automatically added whenever a program is linked with this library"
  2074 	    echo "*** or is declared to -dlopen it."
  2075 	  fi
  2076 	fi
  2077 	# Done checking deplibs!
  2078 	deplibs=$newdeplibs
  2079       fi
  2080 
  2081       # All the library-specific variables (install_libdir is set above).
  2082       library_names=
  2083       old_library=
  2084       dlname=
  2085       
  2086       # Test again, we may have decided not to build it any more
  2087       if test "$build_libtool_libs" = yes; then
  2088 	# Get the real and link names of the library.
  2089 	eval library_names=\"$library_names_spec\"
  2090 	set dummy $library_names
  2091 	realname="$2"
  2092 	shift; shift
  2093 
  2094 	if test -n "$soname_spec"; then
  2095 	  eval soname=\"$soname_spec\"
  2096 	else
  2097 	  soname="$realname"
  2098 	fi
  2099 
  2100 	lib="$output_objdir/$realname"
  2101 	for link
  2102 	do
  2103 	  linknames="$linknames $link"
  2104 	done
  2105 
  2106 	# Ensure that we have .o objects for linkers which dislike .lo
  2107 	# (e.g. aix) in case we are running --disable-static
  2108 	for obj in $libobjs; do
  2109 	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  2110 	  if test "X$xdir" = "X$obj"; then
  2111 	    xdir="."
  2112 	  else
  2113 	    xdir="$xdir"
  2114 	  fi
  2115 	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  2116 	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2117 	  if test ! -f $xdir/$oldobj; then
  2118 	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
  2119 	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
  2120 	  fi
  2121 	done
  2122 
  2123 	# Use standard objects if they are pic
  2124 	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2125 
  2126 	# Prepare the list of exported symbols
  2127 	if test -z "$export_symbols"; then
  2128 	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  2129 	    $show "generating symbol list for \`$libname.la'"
  2130 	    export_symbols="$output_objdir/$libname.exp"
  2131 	    $run $rm $export_symbols
  2132 	    eval cmds=\"$export_symbols_cmds\"
  2133 	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  2134 	    for cmd in $cmds; do
  2135 	      IFS="$save_ifs"
  2136 	      $show "$cmd"
  2137 	      $run eval "$cmd" || exit $?
  2138 	    done
  2139 	    IFS="$save_ifs"
  2140 	    if test -n "$export_symbols_regex"; then
  2141 	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  2142 	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  2143 	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  2144 	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
  2145 	    fi
  2146 	  fi
  2147 	fi
  2148 
  2149 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
  2150 	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  2151 	fi
  2152 
  2153 	if test -n "$convenience"; then
  2154 	  if test -n "$whole_archive_flag_spec"; then
  2155 	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  2156 	  else
  2157 	    gentop="$output_objdir/${outputname}x"
  2158 	    $show "${rm}r $gentop"
  2159 	    $run ${rm}r "$gentop"
  2160 	    $show "mkdir $gentop"
  2161 	    $run mkdir "$gentop"
  2162 	    status=$?
  2163 	    if test $status -ne 0 && test ! -d "$gentop"; then
  2164 	      exit $status
  2165 	    fi
  2166 	    generated="$generated $gentop"
  2167 
  2168 	    for xlib in $convenience; do
  2169 	      # Extract the objects.
  2170 	      case "$xlib" in
  2171 	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2172 	      *) xabs=`pwd`"/$xlib" ;;
  2173 	      esac
  2174 	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2175 	      xdir="$gentop/$xlib"
  2176 
  2177 	      $show "${rm}r $xdir"
  2178 	      $run ${rm}r "$xdir"
  2179 	      $show "mkdir $xdir"
  2180 	      $run mkdir "$xdir"
  2181 	      status=$?
  2182 	      if test $status -ne 0 && test ! -d "$xdir"; then
  2183 		exit $status
  2184 	      fi
  2185 	      $show "(cd $xdir && $AR x $xabs)"
  2186 	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2187 
  2188 	      libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2189 	    done
  2190 	  fi
  2191 	fi
  2192 
  2193 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  2194 	  eval flag=\"$thread_safe_flag_spec\"
  2195 	  linkopts="$linkopts $flag"
  2196 	fi
  2197 
  2198 	# Do each of the archive commands.
  2199 	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  2200 	  eval cmds=\"$archive_expsym_cmds\"
  2201 	else
  2202 	  eval cmds=\"$archive_cmds\"
  2203 	fi
  2204 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  2205 	for cmd in $cmds; do
  2206 	  IFS="$save_ifs"
  2207 	  $show "$cmd"
  2208 	  $run eval "$cmd" || exit $?
  2209 	done
  2210 	IFS="$save_ifs"
  2211 
  2212 	# Create links to the real library.
  2213 	for linkname in $linknames; do
  2214 	  if test "$realname" != "$linkname"; then
  2215 	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  2216 	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  2217 	  fi
  2218 	done
  2219 
  2220 	# If -module or -export-dynamic was specified, set the dlname.
  2221 	if test "$module" = yes || test "$export_dynamic" = yes; then
  2222 	  # On all known operating systems, these are identical.
  2223 	  dlname="$soname"
  2224 	fi
  2225       fi
  2226       ;;
  2227 
  2228     *.lo | *.o | *.obj)
  2229       if test -n "$link_against_libtool_libs"; then
  2230 	$echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  2231 	exit 1
  2232       fi
  2233 
  2234       if test -n "$deplibs"; then
  2235 	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  2236       fi
  2237 
  2238       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2239 	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  2240       fi
  2241 
  2242       if test -n "$rpath"; then
  2243 	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  2244       fi
  2245 
  2246       if test -n "$xrpath"; then
  2247 	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  2248       fi
  2249 
  2250       if test -n "$vinfo"; then
  2251 	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  2252       fi
  2253 
  2254       if test -n "$release"; then
  2255 	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  2256       fi
  2257 
  2258       case "$output" in
  2259       *.lo)
  2260 	if test -n "$objs"; then
  2261 	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  2262 	  exit 1
  2263 	fi
  2264 	libobj="$output"
  2265 	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  2266 	;;
  2267       *)
  2268 	libobj=
  2269 	obj="$output"
  2270 	;;
  2271       esac
  2272 
  2273       # Delete the old objects.
  2274       $run $rm $obj $libobj
  2275 
  2276       # Objects from convenience libraries.  This assumes
  2277       # single-version convenience libraries.  Whenever we create
  2278       # different ones for PIC/non-PIC, this we'll have to duplicate
  2279       # the extraction.
  2280       reload_conv_objs=
  2281       gentop=
  2282       # reload_cmds runs $LD directly, so let us get rid of
  2283       # -Wl from whole_archive_flag_spec
  2284       wl= 
  2285 
  2286       if test -n "$convenience"; then
  2287 	if test -n "$whole_archive_flag_spec"; then
  2288 	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  2289 	else
  2290 	  gentop="$output_objdir/${obj}x"
  2291 	  $show "${rm}r $gentop"
  2292 	  $run ${rm}r "$gentop"
  2293 	  $show "mkdir $gentop"
  2294 	  $run mkdir "$gentop"
  2295 	  status=$?
  2296 	  if test $status -ne 0 && test ! -d "$gentop"; then
  2297 	    exit $status
  2298 	  fi
  2299 	  generated="$generated $gentop"
  2300 
  2301 	  for xlib in $convenience; do
  2302 	    # Extract the objects.
  2303 	    case "$xlib" in
  2304 	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2305 	    *) xabs=`pwd`"/$xlib" ;;
  2306 	    esac
  2307 	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2308 	    xdir="$gentop/$xlib"
  2309 
  2310 	    $show "${rm}r $xdir"
  2311 	    $run ${rm}r "$xdir"
  2312 	    $show "mkdir $xdir"
  2313 	    $run mkdir "$xdir"
  2314 	    status=$?
  2315 	    if test $status -ne 0 && test ! -d "$xdir"; then
  2316 	      exit $status
  2317 	    fi
  2318 	    $show "(cd $xdir && $AR x $xabs)"
  2319 	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2320 
  2321 	    reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2322 	  done
  2323 	fi
  2324       fi
  2325 
  2326       # Create the old-style object.
  2327       reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  2328 
  2329       output="$obj"
  2330       eval cmds=\"$reload_cmds\"
  2331       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  2332       for cmd in $cmds; do
  2333 	IFS="$save_ifs"
  2334 	$show "$cmd"
  2335 	$run eval "$cmd" || exit $?
  2336       done
  2337       IFS="$save_ifs"
  2338 
  2339       # Exit if we aren't doing a library object file.
  2340       if test -z "$libobj"; then
  2341 	if test -n "$gentop"; then
  2342 	  $show "${rm}r $gentop"
  2343 	  $run ${rm}r $gentop
  2344 	fi
  2345 
  2346 	exit 0
  2347       fi
  2348 
  2349       if test "$build_libtool_libs" != yes; then
  2350 	if test -n "$gentop"; then
  2351 	  $show "${rm}r $gentop"
  2352 	  $run ${rm}r $gentop
  2353 	fi
  2354 
  2355 	# Create an invalid libtool object if no PIC, so that we don't
  2356 	# accidentally link it into a program.
  2357 	$show "echo timestamp > $libobj"
  2358 	$run eval "echo timestamp > $libobj" || exit $?
  2359 	exit 0
  2360       fi
  2361 
  2362       if test -n "$pic_flag"; then
  2363 	# Only do commands if we really have different PIC objects.
  2364 	reload_objs="$libobjs $reload_conv_objs"
  2365 	output="$libobj"
  2366 	eval cmds=\"$reload_cmds\"
  2367 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  2368 	for cmd in $cmds; do
  2369 	  IFS="$save_ifs"
  2370 	  $show "$cmd"
  2371 	  $run eval "$cmd" || exit $?
  2372 	done
  2373 	IFS="$save_ifs"
  2374       else
  2375 	# Just create a symlink.
  2376 	$show $rm $libobj
  2377 	$run $rm $libobj
  2378 	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  2379 	if test "X$xdir" = "X$libobj"; then
  2380 	  xdir="."
  2381 	else
  2382 	  xdir="$xdir"
  2383 	fi
  2384 	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  2385 	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2386 	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
  2387 	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
  2388       fi
  2389 
  2390       if test -n "$gentop"; then
  2391 	$show "${rm}r $gentop"
  2392 	$run ${rm}r $gentop
  2393       fi
  2394 
  2395       exit 0
  2396       ;;
  2397 
  2398     # Anything else should be a program.
  2399     *)
  2400       if test -n "$vinfo"; then
  2401 	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  2402       fi
  2403 
  2404       if test -n "$release"; then
  2405 	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  2406       fi
  2407 
  2408       if test "$preload" = yes; then
  2409 	if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
  2410 	   test "$dlopen_self_static" = unknown; then
  2411 	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  2412 	fi 
  2413       fi
  2414     
  2415       if test -n "$rpath$xrpath"; then
  2416 	# If the user specified any rpath flags, then add them.
  2417 	for libdir in $rpath $xrpath; do
  2418 	  # This is the magic to use -rpath.
  2419 	  case "$compile_rpath " in
  2420 	  *" $libdir "*) ;;
  2421 	  *) compile_rpath="$compile_rpath $libdir" ;;
  2422 	  esac
  2423 	  case "$finalize_rpath " in
  2424 	  *" $libdir "*) ;;
  2425 	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  2426 	  esac
  2427 	done
  2428       fi
  2429 
  2430       # Now hardcode the library paths
  2431       rpath=
  2432       hardcode_libdirs=
  2433       for libdir in $compile_rpath $finalize_rpath; do
  2434 	if test -n "$hardcode_libdir_flag_spec"; then
  2435 	  if test -n "$hardcode_libdir_separator"; then
  2436 	    if test -z "$hardcode_libdirs"; then
  2437 	      hardcode_libdirs="$libdir"
  2438 	    else
  2439 	      # Just accumulate the unique libdirs.
  2440 	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2441 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2442 		;;
  2443 	      *)
  2444 		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2445 		;;
  2446 	      esac
  2447 	    fi
  2448 	  else
  2449 	    eval flag=\"$hardcode_libdir_flag_spec\"
  2450 	    rpath="$rpath $flag"
  2451 	  fi
  2452 	elif test -n "$runpath_var"; then
  2453 	  case "$perm_rpath " in
  2454 	  *" $libdir "*) ;;
  2455 	  *) perm_rpath="$perm_rpath $libdir" ;;
  2456 	  esac
  2457 	fi
  2458       done
  2459       # Substitute the hardcoded libdirs into the rpath.
  2460       if test -n "$hardcode_libdir_separator" &&
  2461 	 test -n "$hardcode_libdirs"; then
  2462 	libdir="$hardcode_libdirs"
  2463 	eval rpath=\" $hardcode_libdir_flag_spec\"
  2464       fi
  2465       compile_rpath="$rpath"
  2466 
  2467       rpath=
  2468       hardcode_libdirs=
  2469       for libdir in $finalize_rpath; do
  2470 	if test -n "$hardcode_libdir_flag_spec"; then
  2471 	  if test -n "$hardcode_libdir_separator"; then
  2472 	    if test -z "$hardcode_libdirs"; then
  2473 	      hardcode_libdirs="$libdir"
  2474 	    else
  2475 	      # Just accumulate the unique libdirs.
  2476 	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2477 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2478 		;;
  2479 	      *)
  2480 		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2481 		;;
  2482 	      esac
  2483 	    fi
  2484 	  else
  2485 	    eval flag=\"$hardcode_libdir_flag_spec\"
  2486 	    rpath="$rpath $flag"
  2487 	  fi
  2488 	elif test -n "$runpath_var"; then
  2489 	  case "$finalize_perm_rpath " in
  2490 	  *" $libdir "*) ;;
  2491 	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  2492 	  esac
  2493 	fi
  2494       done
  2495       # Substitute the hardcoded libdirs into the rpath.
  2496       if test -n "$hardcode_libdir_separator" &&
  2497 	 test -n "$hardcode_libdirs"; then
  2498 	libdir="$hardcode_libdirs"
  2499 	eval rpath=\" $hardcode_libdir_flag_spec\"
  2500       fi
  2501       finalize_rpath="$rpath"
  2502 
  2503       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  2504       if test "X$output_objdir" = "X$output"; then
  2505 	output_objdir="$objdir"
  2506       else
  2507 	output_objdir="$output_objdir/$objdir"
  2508       fi
  2509 
  2510       # Create the binary in the object directory, then wrap it.
  2511       if test ! -d $output_objdir; then
  2512 	$show "$mkdir $output_objdir"
  2513 	$run $mkdir $output_objdir
  2514 	status=$?
  2515 	if test $status -ne 0 && test ! -d $output_objdir; then
  2516 	  exit $status
  2517 	fi
  2518       fi
  2519 
  2520       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  2521 	# Transform all the library objects into standard objects.
  2522 	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2523 	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2524       fi
  2525 
  2526       dlsyms=
  2527       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2528 	if test -n "$NM" && test -n "$global_symbol_pipe"; then
  2529 	  dlsyms="${outputname}S.c"
  2530 	else
  2531 	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  2532 	fi
  2533       fi
  2534 
  2535       if test -n "$dlsyms"; then
  2536 	case "$dlsyms" in
  2537 	"") ;;
  2538 	*.c)
  2539 	  # Discover the nlist of each of the dlfiles.
  2540 	  nlist="$output_objdir/${outputname}.nm"
  2541 
  2542 	  $show "$rm $nlist ${nlist}S ${nlist}T"
  2543 	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
  2544 
  2545 	  # Parse the name list into a source file.
  2546 	  $show "creating $output_objdir/$dlsyms"
  2547 
  2548 	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  2549 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  2550 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  2551 
  2552 #ifdef __cplusplus
  2553 extern \"C\" {
  2554 #endif
  2555 
  2556 /* Prevent the only kind of declaration conflicts we can make. */
  2557 #define lt_preloaded_symbols some_other_symbol
  2558 
  2559 /* External symbol declarations for the compiler. */\
  2560 "
  2561 
  2562 	  if test "$dlself" = yes; then
  2563 	    $show "generating symbol list for \`$output'"
  2564 
  2565 	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  2566 
  2567 	    # Add our own program objects to the symbol list.
  2568 	    progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2569 	    for arg in $progfiles; do
  2570 	      $show "extracting global C symbols from \`$arg'"
  2571 	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2572 	    done
  2573 
  2574 	    if test -n "$exclude_expsyms"; then
  2575 	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2576 	      $run eval '$mv "$nlist"T "$nlist"'
  2577 	    fi
  2578 	    
  2579 	    if test -n "$export_symbols_regex"; then
  2580 	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2581 	      $run eval '$mv "$nlist"T "$nlist"'
  2582 	    fi
  2583 
  2584 	    # Prepare the list of exported symbols
  2585 	    if test -z "$export_symbols"; then
  2586 	      export_symbols="$output_objdir/$output.exp"
  2587 	      $run $rm $export_symbols
  2588 	      $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2589 	    else
  2590 	      $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  2591 	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  2592 	      $run eval 'mv "$nlist"T "$nlist"'
  2593 	    fi
  2594 	  fi
  2595 
  2596 	  for arg in $dlprefiles; do
  2597 	    $show "extracting global C symbols from \`$arg'"
  2598 	    name=`echo "$arg" | sed -e 's%^.*/%%'`
  2599 	    $run eval 'echo ": $name " >> "$nlist"'
  2600 	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2601 	  done
  2602 
  2603 	  if test -z "$run"; then
  2604 	    # Make sure we have at least an empty file.
  2605 	    test -f "$nlist" || : > "$nlist"
  2606 
  2607 	    if test -n "$exclude_expsyms"; then
  2608 	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2609 	      $mv "$nlist"T "$nlist"
  2610 	    fi
  2611 
  2612 	    # Try sorting and uniquifying the output.
  2613 	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
  2614 	      :
  2615 	    else
  2616 	      grep -v "^: " < "$nlist" > "$nlist"S
  2617 	    fi
  2618 
  2619 	    if test -f "$nlist"S; then
  2620 	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  2621 	    else
  2622 	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
  2623 	    fi
  2624 
  2625 	    $echo >> "$output_objdir/$dlsyms" "\
  2626 
  2627 #undef lt_preloaded_symbols
  2628 
  2629 #if defined (__STDC__) && __STDC__
  2630 # define lt_ptr_t void *
  2631 #else
  2632 # define lt_ptr_t char *
  2633 # define const
  2634 #endif
  2635 
  2636 /* The mapping between symbol names and symbols. */
  2637 const struct {
  2638   const char *name;
  2639   lt_ptr_t address;
  2640 }
  2641 lt_preloaded_symbols[] =
  2642 {\
  2643 "
  2644 
  2645 	    sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
  2646 		-e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
  2647 		  < "$nlist" >> "$output_objdir/$dlsyms"
  2648 
  2649 	    $echo >> "$output_objdir/$dlsyms" "\
  2650   {0, (lt_ptr_t) 0}
  2651 };
  2652 
  2653 /* This works around a problem in FreeBSD linker */
  2654 #ifdef FREEBSD_WORKAROUND
  2655 static const void *lt_preloaded_setup() {
  2656   return lt_preloaded_symbols;
  2657 }
  2658 #endif
  2659 
  2660 #ifdef __cplusplus
  2661 }
  2662 #endif\
  2663 "
  2664 	  fi
  2665 
  2666 	  pic_flag_for_symtable=
  2667 	  case "$host" in
  2668 	  # compiling the symbol table file with pic_flag works around
  2669 	  # a FreeBSD bug that causes programs to crash when -lm is
  2670 	  # linked before any other PIC object.  But we must not use
  2671 	  # pic_flag when linking with -static.  The problem exists in
  2672 	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2673 	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  2674 	    case "$compile_command " in
  2675 	    *" -static "*) ;;
  2676 	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  2677 	    esac;;
  2678 	  *-*-hpux*)
  2679 	    case "$compile_command " in
  2680 	    *" -static "*) ;;
  2681 	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
  2682 	    esac
  2683 	  esac
  2684 
  2685 	  # Now compile the dynamic symbol file.
  2686 	  $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  2687 	  $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  2688 
  2689 	  # Clean up the generated files.
  2690 	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  2691 	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  2692 
  2693 	  # Transform the symbol file into the correct name.
  2694 	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2695 	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2696 	  ;;
  2697 	*)
  2698 	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  2699 	  exit 1
  2700 	  ;;
  2701 	esac
  2702       else
  2703 	# We keep going just in case the user didn't refer to
  2704 	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  2705 	# really was required.
  2706 
  2707 	# Nullify the symbol file.
  2708 	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  2709 	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  2710       fi
  2711 
  2712       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  2713 	# Replace the output file specification.
  2714 	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  2715 	link_command="$compile_command$compile_rpath"
  2716 
  2717 	# We have no uninstalled library dependencies, so finalize right now.
  2718 	$show "$link_command"
  2719 	$run eval "$link_command"
  2720 	status=$?
  2721 	
  2722 	# Delete the generated files.
  2723 	if test -n "$dlsyms"; then
  2724 	  $show "$rm $output_objdir/${outputname}S.${objext}"
  2725 	  $run $rm "$output_objdir/${outputname}S.${objext}"
  2726 	fi
  2727 
  2728 	exit $status
  2729       fi
  2730 
  2731       if test -n "$shlibpath_var"; then
  2732 	# We should set the shlibpath_var
  2733 	rpath=
  2734 	for dir in $temp_rpath; do
  2735 	  case "$dir" in
  2736 	  [\\/]* | [A-Za-z]:[\\/]*)
  2737 	    # Absolute path.
  2738 	    rpath="$rpath$dir:"
  2739 	    ;;
  2740 	  *)
  2741 	    # Relative path: add a thisdir entry.
  2742 	    rpath="$rpath\$thisdir/$dir:"
  2743 	    ;;
  2744 	  esac
  2745 	done
  2746 	temp_rpath="$rpath"
  2747       fi
  2748 
  2749       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  2750 	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  2751       fi
  2752       if test -n "$finalize_shlibpath"; then
  2753 	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  2754       fi
  2755 
  2756       compile_var=
  2757       finalize_var=
  2758       if test -n "$runpath_var"; then
  2759 	if test -n "$perm_rpath"; then
  2760 	  # We should set the runpath_var.
  2761 	  rpath=
  2762 	  for dir in $perm_rpath; do
  2763 	    rpath="$rpath$dir:"
  2764 	  done
  2765 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2766 	fi
  2767 	if test -n "$finalize_perm_rpath"; then
  2768 	  # We should set the runpath_var.
  2769 	  rpath=
  2770 	  for dir in $finalize_perm_rpath; do
  2771 	    rpath="$rpath$dir:"
  2772 	  done
  2773 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2774 	fi
  2775       fi
  2776 
  2777       if test "$hardcode_action" = relink; then
  2778 	# Fast installation is not supported
  2779 	link_command="$compile_var$compile_command$compile_rpath"
  2780 	relink_command="$finalize_var$finalize_command$finalize_rpath"
  2781 	
  2782 	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  2783 	$echo "$modename: \`$output' will be relinked during installation" 1>&2
  2784       else
  2785 	if test "$fast_install" != no; then
  2786 	  link_command="$finalize_var$compile_command$finalize_rpath"
  2787 	  if test "$fast_install" = yes; then
  2788 	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  2789 	  else
  2790 	    # fast_install is set to needless
  2791 	    relink_command=
  2792 	  fi
  2793 	else
  2794 	  link_command="$compile_var$compile_command$compile_rpath"
  2795 	  relink_command="$finalize_var$finalize_command$finalize_rpath"
  2796 	fi
  2797       fi
  2798 
  2799       # Replace the output file specification.
  2800       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  2801       
  2802       # Delete the old output files.
  2803       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  2804 
  2805       $show "$link_command"
  2806       $run eval "$link_command" || exit $?
  2807 
  2808       # Now create the wrapper script.
  2809       $show "creating $output"
  2810 
  2811       # Quote the relink command for shipping.
  2812       if test -n "$relink_command"; then
  2813 	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  2814       fi
  2815 
  2816       # Quote $echo for shipping.
  2817       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  2818 	case "$0" in
  2819 	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  2820 	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  2821 	esac
  2822 	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  2823       else
  2824 	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  2825       fi
  2826 
  2827       # Only actually do things if our run command is non-null.
  2828       if test -z "$run"; then
  2829 	# win32 will think the script is a binary if it has
  2830 	# a .exe suffix, so we strip it off here.
  2831 	case $output in
  2832 	  *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
  2833 	esac
  2834 	$rm $output
  2835 	trap "$rm $output; exit 1" 1 2 15
  2836 
  2837 	$echo > $output "\
  2838 #! $SHELL
  2839 
  2840 # $output - temporary wrapper script for $objdir/$outputname
  2841 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  2842 #
  2843 # The $output program cannot be directly executed until all the libtool
  2844 # libraries that it depends on are installed.
  2845 #
  2846 # This wrapper script should never be moved out of the build directory.
  2847 # If it is, it will not operate correctly.
  2848 
  2849 # Sed substitution that helps us do robust quoting.  It backslashifies
  2850 # metacharacters that are still active within double-quoted strings.
  2851 Xsed='sed -e 1s/^X//'
  2852 sed_quote_subst='$sed_quote_subst'
  2853 
  2854 # The HP-UX ksh and POSIX shell print the target directory to stdout
  2855 # if CDPATH is set.
  2856 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
  2857 
  2858 relink_command=\"$relink_command\"
  2859 
  2860 # This environment variable determines our operation mode.
  2861 if test \"\$libtool_install_magic\" = \"$magic\"; then
  2862   # install mode needs the following variable:
  2863   link_against_libtool_libs='$link_against_libtool_libs'
  2864 else
  2865   # When we are sourced in execute mode, \$file and \$echo are already set.
  2866   if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2867     echo=\"$qecho\"
  2868     file=\"\$0\"
  2869     # Make sure echo works.
  2870     if test \"X\$1\" = X--no-reexec; then
  2871       # Discard the --no-reexec flag, and continue.
  2872       shift
  2873     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  2874       # Yippee, \$echo works!
  2875       :
  2876     else
  2877       # Restart under the correct shell, and then maybe \$echo will work.
  2878       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  2879     fi
  2880   fi\
  2881 "
  2882 	$echo >> $output "\
  2883 
  2884   # Find the directory that this script lives in.
  2885   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  2886   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2887 
  2888   # Follow symbolic links until we get to the real thisdir.
  2889   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  2890   while test -n \"\$file\"; do
  2891     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  2892 
  2893     # If there was a directory component, then change thisdir.
  2894     if test \"x\$destdir\" != \"x\$file\"; then
  2895       case \"\$destdir\" in
  2896       [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
  2897       *) thisdir=\"\$thisdir/\$destdir\" ;;
  2898       esac
  2899     fi
  2900 
  2901     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  2902     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  2903   done
  2904 
  2905   # Try to get the absolute directory name.
  2906   absdir=\`cd \"\$thisdir\" && pwd\`
  2907   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2908 "
  2909 
  2910 	if test "$fast_install" = yes; then
  2911 	  echo >> $output "\
  2912   program=lt-'$outputname'
  2913   progdir=\"\$thisdir/$objdir\"
  2914   
  2915   if test ! -f \"\$progdir/\$program\" || \\
  2916      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
  2917        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2918 
  2919     file=\"\$\$-\$program\"
  2920 
  2921     if test ! -d \"\$progdir\"; then
  2922       $mkdir \"\$progdir\"
  2923     else
  2924       $rm \"\$progdir/\$file\"
  2925     fi"
  2926 
  2927 	  echo >> $output "\
  2928 
  2929     # relink executable if necessary
  2930     if test -n \"\$relink_command\"; then
  2931       if (cd \"\$thisdir\" && eval \$relink_command); then :
  2932       else
  2933 	$rm \"\$progdir/\$file\"
  2934 	exit 1
  2935       fi
  2936     fi
  2937 
  2938     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2939     { $rm \"\$progdir/\$program\";
  2940       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2941     $rm \"\$progdir/\$file\"
  2942   fi"
  2943 	else
  2944 	  echo >> $output "\
  2945   program='$outputname'
  2946   progdir=\"\$thisdir/$objdir\"
  2947 "
  2948 	fi
  2949 
  2950 	echo >> $output "\
  2951 
  2952   if test -f \"\$progdir/\$program\"; then"
  2953 
  2954 	# Export our shlibpath_var if we have one.
  2955 	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2956 	  $echo >> $output "\
  2957     # Add our own library path to $shlibpath_var
  2958     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2959 
  2960     # Some systems cannot cope with colon-terminated $shlibpath_var
  2961     # The second colon is a workaround for a bug in BeOS R4 sed
  2962     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  2963 
  2964     export $shlibpath_var
  2965 "
  2966 	fi
  2967 
  2968 	# fixup the dll searchpath if we need to.
  2969 	if test -n "$dllsearchpath"; then
  2970 	  $echo >> $output "\
  2971     # Add the dll search path components to the executable PATH
  2972     PATH=$dllsearchpath:\$PATH
  2973 "
  2974 	fi
  2975 
  2976 	$echo >> $output "\
  2977     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2978       # Run the actual program with our arguments.
  2979 "
  2980 	case $host in
  2981 	  # win32 systems need to use the prog path for dll
  2982 	  # lookup to work
  2983 	*-*-cygwin*)
  2984 	  $echo >> $output "\
  2985       exec \$progdir/\$program \${1+\"\$@\"}
  2986 "
  2987 	  ;;
  2988 
  2989 	# Backslashes separate directories on plain windows
  2990 	*-*-mingw | *-*-os2*)
  2991 	  $echo >> $output "\
  2992       exec \$progdir\\\\\$program \${1+\"\$@\"}
  2993 "
  2994 	  ;;
  2995 
  2996 	*)
  2997 	  $echo >> $output "\
  2998       # Export the path to the program.
  2999       PATH=\"\$progdir:\$PATH\"
  3000       export PATH
  3001 
  3002       exec \$program \${1+\"\$@\"}
  3003 "
  3004 	  ;;
  3005 	esac
  3006 	$echo >> $output "\
  3007       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  3008       exit 1
  3009     fi
  3010   else
  3011     # The program doesn't exist.
  3012     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  3013     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  3014     echo \"See the $PACKAGE documentation for more information.\" 1>&2
  3015     exit 1
  3016   fi
  3017 fi\
  3018 "
  3019 	chmod +x $output
  3020       fi
  3021       exit 0
  3022       ;;
  3023     esac
  3024 
  3025     # See if we need to build an old-fashioned archive.
  3026     for oldlib in $oldlibs; do
  3027 
  3028       if test "$build_libtool_libs" = convenience; then
  3029 	oldobjs="$libobjs_save"
  3030 	addlibs="$convenience"
  3031 	build_libtool_libs=no
  3032       else
  3033 	if test "$build_libtool_libs" = module; then
  3034 	  oldobjs="$libobjs_save"
  3035 	  build_libtool_libs=no
  3036 	else
  3037 	  oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  3038 	fi
  3039 	addlibs="$old_convenience"
  3040       fi
  3041 
  3042       if test -n "$addlibs"; then
  3043 	gentop="$output_objdir/${outputname}x"
  3044 	$show "${rm}r $gentop"
  3045 	$run ${rm}r "$gentop"
  3046 	$show "mkdir $gentop"
  3047 	$run mkdir "$gentop"
  3048 	status=$?
  3049 	if test $status -ne 0 && test ! -d "$gentop"; then
  3050 	  exit $status
  3051 	fi
  3052 	generated="$generated $gentop"
  3053 	  
  3054 	# Add in members from convenience archives.
  3055 	for xlib in $addlibs; do
  3056 	  # Extract the objects.
  3057 	  case "$xlib" in
  3058 	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  3059 	  *) xabs=`pwd`"/$xlib" ;;
  3060 	  esac
  3061 	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  3062 	  xdir="$gentop/$xlib"
  3063 
  3064 	  $show "${rm}r $xdir"
  3065 	  $run ${rm}r "$xdir"
  3066 	  $show "mkdir $xdir"
  3067 	  $run mkdir "$xdir"
  3068 	  status=$?
  3069 	  if test $status -ne 0 && test ! -d "$xdir"; then
  3070 	    exit $status
  3071 	  fi
  3072 	  $show "(cd $xdir && $AR x $xabs)"
  3073 	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  3074 
  3075 	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  3076 	done
  3077       fi
  3078 
  3079       # Do each command in the archive commands.
  3080       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  3081 	eval cmds=\"$old_archive_from_new_cmds\"
  3082       else
  3083 	# Ensure that we have .o objects in place in case we decided
  3084 	# not to build a shared library, and have fallen back to building
  3085 	# static libs even though --disable-static was passed!
  3086 	for oldobj in $oldobjs; do
  3087 	  if test ! -f $oldobj; then
  3088 	    xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
  3089 	    if test "X$xdir" = "X$oldobj"; then
  3090 	      xdir="."
  3091 	    else
  3092 	      xdir="$xdir"
  3093 	    fi
  3094 	    baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
  3095 	    obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  3096 	    $show "(cd $xdir && ${LN_S} $obj $baseobj)"
  3097 	    $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
  3098 	  fi
  3099 	done
  3100 
  3101 	eval cmds=\"$old_archive_cmds\"
  3102       fi
  3103       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3104       for cmd in $cmds; do
  3105 	IFS="$save_ifs"
  3106 	$show "$cmd"
  3107 	$run eval "$cmd" || exit $?
  3108       done
  3109       IFS="$save_ifs"
  3110     done
  3111 
  3112     if test -n "$generated"; then
  3113       $show "${rm}r$generated"
  3114       $run ${rm}r$generated
  3115     fi
  3116 
  3117     # Now create the libtool archive.
  3118     case "$output" in
  3119     *.la)
  3120       old_library=
  3121       test "$build_old_libs" = yes && old_library="$libname.$libext"
  3122       $show "creating $output"
  3123 
  3124       if test -n "$xrpath"; then
  3125 	temp_xrpath=
  3126 	for libdir in $xrpath; do
  3127 	  temp_xrpath="$temp_xrpath -R$libdir"
  3128 	done
  3129 	dependency_libs="$temp_xrpath $dependency_libs"
  3130       fi
  3131 
  3132       # Only create the output if not a dry run.
  3133       if test -z "$run"; then
  3134 	for installed in no yes; do
  3135 	  if test "$installed" = yes; then
  3136 	    if test -z "$install_libdir"; then
  3137 	      break
  3138 	    fi
  3139 	    output="$output_objdir/$outputname"i
  3140 	  fi
  3141 	  $rm $output
  3142 	  $echo > $output "\
  3143 # $outputname - a libtool library file
  3144 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  3145 #
  3146 # Please DO NOT delete this file!
  3147 # It is necessary for linking the library.
  3148 
  3149 # The name that we can dlopen(3).
  3150 dlname='$dlname'
  3151 
  3152 # Names of this library.
  3153 library_names='$library_names'
  3154 
  3155 # The name of the static archive.
  3156 old_library='$old_library'
  3157 
  3158 # Libraries that this one depends upon.
  3159 dependency_libs='$dependency_libs'
  3160 
  3161 # Version information for $libname.
  3162 current=$current
  3163 age=$age
  3164 revision=$revision
  3165 
  3166 # Is this an already installed library?
  3167 installed=$installed
  3168 
  3169 # Directory that this library needs to be installed in:
  3170 libdir='$install_libdir'\
  3171 "
  3172 	done
  3173       fi
  3174 
  3175       # Do a symbolic link so that the libtool archive can be found in
  3176       # LD_LIBRARY_PATH before the program is installed.
  3177       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  3178       $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  3179       ;;
  3180     esac
  3181     exit 0
  3182     ;;
  3183 
  3184   # libtool install mode
  3185   install)
  3186     modename="$modename: install"
  3187 
  3188     # There may be an optional sh(1) argument at the beginning of
  3189     # install_prog (especially on Windows NT).
  3190     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
  3191       # Aesthetically quote it.
  3192       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  3193       case "$arg" in
  3194       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  3195 	arg="\"$arg\""
  3196 	;;
  3197       esac
  3198       install_prog="$arg "
  3199       arg="$1"
  3200       shift
  3201     else
  3202       install_prog=
  3203       arg="$nonopt"
  3204     fi
  3205 
  3206     # The real first argument should be the name of the installation program.
  3207     # Aesthetically quote it.
  3208     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3209     case "$arg" in
  3210     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  3211       arg="\"$arg\""
  3212       ;;
  3213     esac
  3214     install_prog="$install_prog$arg"
  3215 
  3216     # We need to accept at least all the BSD install flags.
  3217     dest=
  3218     files=
  3219     opts=
  3220     prev=
  3221     install_type=
  3222     isdir=no
  3223     stripme=
  3224     for arg
  3225     do
  3226       if test -n "$dest"; then
  3227 	files="$files $dest"
  3228 	dest="$arg"
  3229 	continue
  3230       fi
  3231 
  3232       case "$arg" in
  3233       -d) isdir=yes ;;
  3234       -f) prev="-f" ;;
  3235       -g) prev="-g" ;;
  3236       -m) prev="-m" ;;
  3237       -o) prev="-o" ;;
  3238       -s)
  3239 	stripme=" -s"
  3240 	continue
  3241 	;;
  3242       -*) ;;
  3243 
  3244       *)
  3245 	# If the previous option needed an argument, then skip it.
  3246 	if test -n "$prev"; then
  3247 	  prev=
  3248 	else
  3249 	  dest="$arg"
  3250 	  continue
  3251 	fi
  3252 	;;
  3253       esac
  3254 
  3255       # Aesthetically quote the argument.
  3256       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3257       case "$arg" in
  3258       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  3259 	arg="\"$arg\""
  3260 	;;
  3261       esac
  3262       install_prog="$install_prog $arg"
  3263     done
  3264 
  3265     if test -z "$install_prog"; then
  3266       $echo "$modename: you must specify an install program" 1>&2
  3267       $echo "$help" 1>&2
  3268       exit 1
  3269     fi
  3270 
  3271     if test -n "$prev"; then
  3272       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  3273       $echo "$help" 1>&2
  3274       exit 1
  3275     fi
  3276 
  3277     if test -z "$files"; then
  3278       if test -z "$dest"; then
  3279 	$echo "$modename: no file or destination specified" 1>&2
  3280       else
  3281 	$echo "$modename: you must specify a destination" 1>&2
  3282       fi
  3283       $echo "$help" 1>&2
  3284       exit 1
  3285     fi
  3286 
  3287     # Strip any trailing slash from the destination.
  3288     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  3289 
  3290     # Check to see that the destination is a directory.
  3291     test -d "$dest" && isdir=yes
  3292     if test "$isdir" = yes; then
  3293       destdir="$dest"
  3294       destname=
  3295     else
  3296       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  3297       test "X$destdir" = "X$dest" && destdir=.
  3298       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  3299 
  3300       # Not a directory, so check to see that there is only one file specified.
  3301       set dummy $files
  3302       if test $# -gt 2; then
  3303 	$echo "$modename: \`$dest' is not a directory" 1>&2
  3304 	$echo "$help" 1>&2
  3305 	exit 1
  3306       fi
  3307     fi
  3308     case "$destdir" in
  3309     [\\/]* | [A-Za-z]:[\\/]*) ;;
  3310     *)
  3311       for file in $files; do
  3312 	case "$file" in
  3313 	*.lo) ;;
  3314 	*)
  3315 	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  3316 	  $echo "$help" 1>&2
  3317 	  exit 1
  3318 	  ;;
  3319 	esac
  3320       done
  3321       ;;
  3322     esac
  3323 
  3324     # This variable tells wrapper scripts just to set variables rather
  3325     # than running their programs.
  3326     libtool_install_magic="$magic"
  3327 
  3328     staticlibs=
  3329     future_libdirs=
  3330     current_libdirs=
  3331     for file in $files; do
  3332 
  3333       # Do each installation.
  3334       case "$file" in
  3335       *.a | *.lib)
  3336 	# Do the static libraries later.
  3337 	staticlibs="$staticlibs $file"
  3338 	;;
  3339 
  3340       *.la)
  3341 	# Check to see that this really is a libtool archive.
  3342 	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3343 	else
  3344 	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  3345 	  $echo "$help" 1>&2
  3346 	  exit 1
  3347 	fi
  3348 
  3349 	library_names=
  3350 	old_library=
  3351 	# If there is no directory component, then add one.
  3352 	case "$file" in
  3353 	*/* | *\\*) . $file ;;
  3354 	*) . ./$file ;;
  3355 	esac
  3356 
  3357 	# Add the libdir to current_libdirs if it is the destination.
  3358 	if test "X$destdir" = "X$libdir"; then
  3359 	  case "$current_libdirs " in
  3360 	  *" $libdir "*) ;;
  3361 	  *) current_libdirs="$current_libdirs $libdir" ;;
  3362 	  esac
  3363 	else
  3364 	  # Note the libdir as a future libdir.
  3365 	  case "$future_libdirs " in
  3366 	  *" $libdir "*) ;;
  3367 	  *) future_libdirs="$future_libdirs $libdir" ;;
  3368 	  esac
  3369 	fi
  3370 
  3371 	dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  3372 	test "X$dir" = "X$file/" && dir=
  3373 	dir="$dir$objdir"
  3374 
  3375 	# See the names of the shared library.
  3376 	set dummy $library_names
  3377 	if test -n "$2"; then
  3378 	  realname="$2"
  3379 	  shift
  3380 	  shift
  3381 
  3382 	  # Install the shared library and build the symlinks.
  3383 	  $show "$install_prog $dir/$realname $destdir/$realname"
  3384 	  $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  3385 
  3386 	  if test $# -gt 0; then
  3387 	    # Delete the old symlinks, and create new ones.
  3388 	    for linkname
  3389 	    do
  3390 	      if test "$linkname" != "$realname"; then
  3391 		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3392 		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3393 	      fi
  3394 	    done
  3395 	  fi
  3396 
  3397 	  # Do each command in the postinstall commands.
  3398 	  lib="$destdir/$realname"
  3399 	  eval cmds=\"$postinstall_cmds\"
  3400 	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3401 	  for cmd in $cmds; do
  3402 	    IFS="$save_ifs"
  3403 	    $show "$cmd"
  3404 	    $run eval "$cmd" || exit $?
  3405 	  done
  3406 	  IFS="$save_ifs"
  3407 	fi
  3408 
  3409 	# Install the pseudo-library for information purposes.
  3410 	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3411 	instname="$dir/$name"i
  3412 	$show "$install_prog $instname $destdir/$name"
  3413 	$run eval "$install_prog $instname $destdir/$name" || exit $?
  3414 
  3415 	# Maybe install the static library, too.
  3416 	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  3417 	;;
  3418 
  3419       *.lo)
  3420 	# Install (i.e. copy) a libtool object.
  3421 
  3422 	# Figure out destination file name, if it wasn't already specified.
  3423 	if test -n "$destname"; then
  3424 	  destfile="$destdir/$destname"
  3425 	else
  3426 	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3427 	  destfile="$destdir/$destfile"
  3428 	fi
  3429 
  3430 	# Deduce the name of the destination old-style object file.
  3431 	case "$destfile" in
  3432 	*.lo)
  3433 	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  3434 	  ;;
  3435 	*.o | *.obj)
  3436 	  staticdest="$destfile"
  3437 	  destfile=
  3438 	  ;;
  3439 	*)
  3440 	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  3441 	  $echo "$help" 1>&2
  3442 	  exit 1
  3443 	  ;;
  3444 	esac
  3445 
  3446 	# Install the libtool object if requested.
  3447 	if test -n "$destfile"; then
  3448 	  $show "$install_prog $file $destfile"
  3449 	  $run eval "$install_prog $file $destfile" || exit $?
  3450 	fi
  3451 
  3452 	# Install the old object if enabled.
  3453 	if test "$build_old_libs" = yes; then
  3454 	  # Deduce the name of the old-style object file.
  3455 	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  3456 
  3457 	  $show "$install_prog $staticobj $staticdest"
  3458 	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  3459 	fi
  3460 	exit 0
  3461 	;;
  3462 
  3463       *)
  3464 	# Figure out destination file name, if it wasn't already specified.
  3465 	if test -n "$destname"; then
  3466 	  destfile="$destdir/$destname"
  3467 	else
  3468 	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3469 	  destfile="$destdir/$destfile"
  3470 	fi
  3471 
  3472 	# Do a test to see if this is really a libtool program.
  3473 	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3474 	  link_against_libtool_libs=
  3475 	  relink_command=
  3476 
  3477 	  # If there is no directory component, then add one.
  3478 	  case "$file" in
  3479 	  */* | *\\*) . $file ;;
  3480 	  *) . ./$file ;;
  3481 	  esac
  3482 
  3483 	  # Check the variables that should have been set.
  3484 	  if test -z "$link_against_libtool_libs"; then
  3485 	    $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  3486 	    exit 1
  3487 	  fi
  3488 
  3489 	  finalize=yes
  3490 	  for lib in $link_against_libtool_libs; do
  3491 	    # Check to see that each library is installed.
  3492 	    libdir=
  3493 	    if test -f "$lib"; then
  3494 	      # If there is no directory component, then add one.
  3495 	      case "$lib" in
  3496 	      */* | *\\*) . $lib ;;
  3497 	      *) . ./$lib ;;
  3498 	      esac
  3499 	    fi
  3500 	    libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  3501 	    if test -n "$libdir" && test ! -f "$libfile"; then
  3502 	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  3503 	      finalize=no
  3504 	    fi
  3505 	  done
  3506 
  3507 	  outputname=
  3508 	  if test "$fast_install" = no && test -n "$relink_command"; then
  3509 	    if test "$finalize" = yes && test -z "$run"; then
  3510 	      tmpdir="/tmp"
  3511 	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
  3512 	      tmpdir="$tmpdir/libtool-$$"
  3513 	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  3514 	      else
  3515 		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  3516 		continue
  3517 	      fi
  3518 	      outputname="$tmpdir/$file"
  3519 	      # Replace the output file specification.
  3520 	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  3521 
  3522 	      $show "$relink_command"
  3523 	      if $run eval "$relink_command"; then :
  3524 	      else
  3525 		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  3526 		${rm}r "$tmpdir"
  3527 		continue
  3528 	      fi
  3529 	      file="$outputname"
  3530 	    else
  3531 	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
  3532 	    fi
  3533 	  else
  3534 	    # Install the binary that we compiled earlier.
  3535 	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  3536 	  fi
  3537 	fi
  3538 
  3539 	$show "$install_prog$stripme $file $destfile"
  3540 	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  3541 	test -n "$outputname" && ${rm}r "$tmpdir"
  3542 	;;
  3543       esac
  3544     done
  3545 
  3546     for file in $staticlibs; do
  3547       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3548 
  3549       # Set up the ranlib parameters.
  3550       oldlib="$destdir/$name"
  3551 
  3552       $show "$install_prog $file $oldlib"
  3553       $run eval "$install_prog \$file \$oldlib" || exit $?
  3554 
  3555       # Do each command in the postinstall commands.
  3556       eval cmds=\"$old_postinstall_cmds\"
  3557       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3558       for cmd in $cmds; do
  3559 	IFS="$save_ifs"
  3560 	$show "$cmd"
  3561 	$run eval "$cmd" || exit $?
  3562       done
  3563       IFS="$save_ifs"
  3564     done
  3565 
  3566     if test -n "$future_libdirs"; then
  3567       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  3568     fi
  3569 
  3570     if test -n "$current_libdirs"; then
  3571       # Maybe just do a dry run.
  3572       test -n "$run" && current_libdirs=" -n$current_libdirs"
  3573       exec $SHELL $0 --finish$current_libdirs
  3574       exit 1
  3575     fi
  3576 
  3577     exit 0
  3578     ;;
  3579 
  3580   # libtool finish mode
  3581   finish)
  3582     modename="$modename: finish"
  3583     libdirs="$nonopt"
  3584     admincmds=
  3585 
  3586     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3587       for dir
  3588       do
  3589 	libdirs="$libdirs $dir"
  3590       done
  3591 
  3592       for libdir in $libdirs; do
  3593 	if test -n "$finish_cmds"; then
  3594 	  # Do each command in the finish commands.
  3595 	  eval cmds=\"$finish_cmds\"
  3596 	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3597 	  for cmd in $cmds; do
  3598 	    IFS="$save_ifs"
  3599 	    $show "$cmd"
  3600 	    $run eval "$cmd" || admincmds="$admincmds
  3601        $cmd"
  3602 	  done
  3603 	  IFS="$save_ifs"
  3604 	fi
  3605 	if test -n "$finish_eval"; then
  3606 	  # Do the single finish_eval.
  3607 	  eval cmds=\"$finish_eval\"
  3608 	  $run eval "$cmds" || admincmds="$admincmds
  3609        $cmds"
  3610 	fi
  3611       done
  3612     fi
  3613 
  3614     # Exit here if they wanted silent mode.
  3615     test "$show" = : && exit 0
  3616 
  3617     echo "----------------------------------------------------------------------"
  3618     echo "Libraries have been installed in:"
  3619     for libdir in $libdirs; do
  3620       echo "   $libdir"
  3621     done
  3622     echo
  3623     echo "If you ever happen to want to link against installed libraries"
  3624     echo "in a given directory, LIBDIR, you must either use libtool, and"
  3625     echo "specify the full pathname of the library, or use \`-LLIBDIR'"
  3626     echo "flag during linking and do at least one of the following:"
  3627     if test -n "$shlibpath_var"; then
  3628       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  3629       echo "     during execution"
  3630     fi
  3631     if test -n "$runpath_var"; then
  3632       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  3633       echo "     during linking"
  3634     fi
  3635     if test -n "$hardcode_libdir_flag_spec"; then
  3636       libdir=LIBDIR
  3637       eval flag=\"$hardcode_libdir_flag_spec\"
  3638 
  3639       echo "   - use the \`$flag' linker flag"
  3640     fi
  3641     if test -n "$admincmds"; then
  3642       echo "   - have your system administrator run these commands:$admincmds"
  3643     fi
  3644     if test -f /etc/ld.so.conf; then
  3645       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  3646     fi
  3647     echo
  3648     echo "See any operating system documentation about shared libraries for"
  3649     echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3650     echo "----------------------------------------------------------------------"
  3651     exit 0
  3652     ;;
  3653 
  3654   # libtool execute mode
  3655   execute)
  3656     modename="$modename: execute"
  3657 
  3658     # The first argument is the command name.
  3659     cmd="$nonopt"
  3660     if test -z "$cmd"; then
  3661       $echo "$modename: you must specify a COMMAND" 1>&2
  3662       $echo "$help"
  3663       exit 1
  3664     fi
  3665 
  3666     # Handle -dlopen flags immediately.
  3667     for file in $execute_dlfiles; do
  3668       if test ! -f "$file"; then
  3669 	$echo "$modename: \`$file' is not a file" 1>&2
  3670 	$echo "$help" 1>&2
  3671 	exit 1
  3672       fi
  3673 
  3674       dir=
  3675       case "$file" in
  3676       *.la)
  3677 	# Check to see that this really is a libtool archive.
  3678 	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3679 	else
  3680 	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  3681 	  $echo "$help" 1>&2
  3682 	  exit 1
  3683 	fi
  3684 
  3685 	# Read the libtool library.
  3686 	dlname=
  3687 	library_names=
  3688 
  3689 	# If there is no directory component, then add one.
  3690 	case "$file" in
  3691 	*/* | *\\*) . $file ;;
  3692 	*) . ./$file ;;
  3693 	esac
  3694 
  3695 	# Skip this library if it cannot be dlopened.
  3696 	if test -z "$dlname"; then
  3697 	  # Warn if it was a shared library.
  3698 	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  3699 	  continue
  3700 	fi
  3701 
  3702 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3703 	test "X$dir" = "X$file" && dir=.
  3704 
  3705 	if test -f "$dir/$objdir/$dlname"; then
  3706 	  dir="$dir/$objdir"
  3707 	else
  3708 	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  3709 	  exit 1
  3710 	fi
  3711 	;;
  3712 
  3713       *.lo)
  3714 	# Just add the directory containing the .lo file.
  3715 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3716 	test "X$dir" = "X$file" && dir=.
  3717 	;;
  3718 
  3719       *)
  3720 	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  3721 	continue
  3722 	;;
  3723       esac
  3724 
  3725       # Get the absolute pathname.
  3726       absdir=`cd "$dir" && pwd`
  3727       test -n "$absdir" && dir="$absdir"
  3728 
  3729       # Now add the directory to shlibpath_var.
  3730       if eval "test -z \"\$$shlibpath_var\""; then
  3731 	eval "$shlibpath_var=\"\$dir\""
  3732       else
  3733 	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3734       fi
  3735     done
  3736 
  3737     # This variable tells wrapper scripts just to set shlibpath_var
  3738     # rather than running their programs.
  3739     libtool_execute_magic="$magic"
  3740 
  3741     # Check if any of the arguments is a wrapper script.
  3742     args=
  3743     for file
  3744     do
  3745       case "$file" in
  3746       -*) ;;
  3747       *)
  3748 	# Do a test to see if this is really a libtool program.
  3749 	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3750 	  # If there is no directory component, then add one.
  3751 	  case "$file" in
  3752 	  */* | *\\*) . $file ;;
  3753 	  *) . ./$file ;;
  3754 	  esac
  3755 
  3756 	  # Transform arg to wrapped name.
  3757 	  file="$progdir/$program"
  3758 	fi
  3759 	;;
  3760       esac
  3761       # Quote arguments (to preserve shell metacharacters).
  3762       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  3763       args="$args \"$file\""
  3764     done
  3765 
  3766     if test -z "$run"; then
  3767       if test -n "$shlibpath_var"; then
  3768         # Export the shlibpath_var.
  3769         eval "export $shlibpath_var"
  3770       fi
  3771 
  3772       # Restore saved enviroment variables
  3773       if test "${save_LC_ALL+set}" = set; then
  3774 	LC_ALL="$save_LC_ALL"; export LC_ALL
  3775       fi
  3776       if test "${save_LANG+set}" = set; then
  3777 	LANG="$save_LANG"; export LANG
  3778       fi
  3779 
  3780       # Now actually exec the command.
  3781       eval "exec \$cmd$args"
  3782 
  3783       $echo "$modename: cannot exec \$cmd$args"
  3784       exit 1
  3785     else
  3786       # Display what would be done.
  3787       if test -n "$shlibpath_var"; then
  3788         eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  3789         $echo "export $shlibpath_var"
  3790       fi
  3791       $echo "$cmd$args"
  3792       exit 0
  3793     fi
  3794     ;;
  3795 
  3796   # libtool uninstall mode
  3797   uninstall)
  3798     modename="$modename: uninstall"
  3799     rm="$nonopt"
  3800     files=
  3801 
  3802     for arg
  3803     do
  3804       case "$arg" in
  3805       -*) rm="$rm $arg" ;;
  3806       *) files="$files $arg" ;;
  3807       esac
  3808     done
  3809 
  3810     if test -z "$rm"; then
  3811       $echo "$modename: you must specify an RM program" 1>&2
  3812       $echo "$help" 1>&2
  3813       exit 1
  3814     fi
  3815 
  3816     for file in $files; do
  3817       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3818       test "X$dir" = "X$file" && dir=.
  3819       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3820 
  3821       rmfiles="$file"
  3822 
  3823       case "$name" in
  3824       *.la)
  3825 	# Possibly a libtool archive, so verify it.
  3826 	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3827 	  . $dir/$name
  3828 
  3829 	  # Delete the libtool libraries and symlinks.
  3830 	  for n in $library_names; do
  3831 	    rmfiles="$rmfiles $dir/$n"
  3832 	  done
  3833 	  test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  3834 
  3835 	  $show "$rm $rmfiles"
  3836 	  $run $rm $rmfiles
  3837 
  3838 	  if test -n "$library_names"; then
  3839 	    # Do each command in the postuninstall commands.
  3840 	    eval cmds=\"$postuninstall_cmds\"
  3841 	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3842 	    for cmd in $cmds; do
  3843 	      IFS="$save_ifs"
  3844 	      $show "$cmd"
  3845 	      $run eval "$cmd"
  3846 	    done
  3847 	    IFS="$save_ifs"
  3848 	  fi
  3849 
  3850 	  if test -n "$old_library"; then
  3851 	    # Do each command in the old_postuninstall commands.
  3852 	    eval cmds=\"$old_postuninstall_cmds\"
  3853 	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3854 	    for cmd in $cmds; do
  3855 	      IFS="$save_ifs"
  3856 	      $show "$cmd"
  3857 	      $run eval "$cmd"
  3858 	    done
  3859 	    IFS="$save_ifs"
  3860 	  fi
  3861 
  3862 	  # FIXME: should reinstall the best remaining shared library.
  3863 	fi
  3864 	;;
  3865 
  3866       *.lo)
  3867 	if test "$build_old_libs" = yes; then
  3868 	  oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  3869 	  rmfiles="$rmfiles $dir/$oldobj"
  3870 	fi
  3871 	$show "$rm $rmfiles"
  3872 	$run $rm $rmfiles
  3873 	;;
  3874 
  3875       *)
  3876 	$show "$rm $rmfiles"
  3877 	$run $rm $rmfiles
  3878 	;;
  3879       esac
  3880     done
  3881     exit 0
  3882     ;;
  3883 
  3884   "")
  3885     $echo "$modename: you must specify a MODE" 1>&2
  3886     $echo "$generic_help" 1>&2
  3887     exit 1
  3888     ;;
  3889   esac
  3890 
  3891   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3892   $echo "$generic_help" 1>&2
  3893   exit 1
  3894 fi # test -z "$show_help"
  3895 
  3896 # We need to display help for each of the modes.
  3897 case "$mode" in
  3898 "") $echo \
  3899 "Usage: $modename [OPTION]... [MODE-ARG]...
  3900 
  3901 Provide generalized library-building support services.
  3902 
  3903     --config          show all configuration variables
  3904     --debug           enable verbose shell tracing
  3905 -n, --dry-run         display commands without modifying any files
  3906     --features        display basic configuration information and exit
  3907     --finish          same as \`--mode=finish'
  3908     --help            display this help message and exit
  3909     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  3910     --quiet           same as \`--silent'
  3911     --silent          don't print informational messages
  3912     --version         print version information
  3913 
  3914 MODE must be one of the following:
  3915 
  3916       compile         compile a source file into a libtool object
  3917       execute         automatically set library path, then run a program
  3918       finish          complete the installation of libtool libraries
  3919       install         install libraries or executables
  3920       link            create a library or an executable
  3921       uninstall       remove libraries from an installed directory
  3922 
  3923 MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  3924 a more detailed description of MODE."
  3925   exit 0
  3926   ;;
  3927 
  3928 compile)
  3929   $echo \
  3930 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3931 
  3932 Compile a source file into a libtool library object.
  3933 
  3934 This mode accepts the following additional options:
  3935 
  3936   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  3937   -static           always build a \`.o' file suitable for static linking
  3938 
  3939 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  3940 from the given SOURCEFILE.
  3941 
  3942 The output file name is determined by removing the directory component from
  3943 SOURCEFILE, then substituting the C source code suffix \`.c' with the
  3944 library object suffix, \`.lo'."
  3945   ;;
  3946 
  3947 execute)
  3948   $echo \
  3949 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  3950 
  3951 Automatically set library path, then run a program.
  3952 
  3953 This mode accepts the following additional options:
  3954 
  3955   -dlopen FILE      add the directory containing FILE to the library path
  3956 
  3957 This mode sets the library path environment variable according to \`-dlopen'
  3958 flags.
  3959 
  3960 If any of the ARGS are libtool executable wrappers, then they are translated
  3961 into their corresponding uninstalled binary, and any of their required library
  3962 directories are added to the library path.
  3963 
  3964 Then, COMMAND is executed, with ARGS as arguments."
  3965   ;;
  3966 
  3967 finish)
  3968   $echo \
  3969 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  3970 
  3971 Complete the installation of libtool libraries.
  3972 
  3973 Each LIBDIR is a directory that contains libtool libraries.
  3974 
  3975 The commands that this mode executes may require superuser privileges.  Use
  3976 the \`--dry-run' option if you just want to see what would be executed."
  3977   ;;
  3978 
  3979 install)
  3980   $echo \
  3981 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  3982 
  3983 Install executables or libraries.
  3984 
  3985 INSTALL-COMMAND is the installation command.  The first component should be
  3986 either the \`install' or \`cp' program.
  3987 
  3988 The rest of the components are interpreted as arguments to that command (only
  3989 BSD-compatible install options are recognized)."
  3990   ;;
  3991 
  3992 link)
  3993   $echo \
  3994 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  3995 
  3996 Link object files or libraries together to form another library, or to
  3997 create an executable program.
  3998 
  3999 LINK-COMMAND is a command using the C compiler that you would use to create
  4000 a program from several object files.
  4001 
  4002 The following components of LINK-COMMAND are treated specially:
  4003 
  4004   -all-static       do not do any dynamic linking at all
  4005   -avoid-version    do not add a version suffix if possible
  4006   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  4007   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  4008   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  4009   -export-symbols SYMFILE
  4010 		    try to export only the symbols listed in SYMFILE
  4011   -export-symbols-regex REGEX
  4012 		    try to export only the symbols matching REGEX
  4013   -LLIBDIR          search LIBDIR for required installed libraries
  4014   -lNAME            OUTPUT-FILE requires the installed library libNAME
  4015   -module           build a library that can dlopened
  4016   -no-undefined     declare that a library does not refer to external symbols
  4017   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  4018   -release RELEASE  specify package release information
  4019   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  4020   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  4021   -static           do not do any dynamic linking of libtool libraries
  4022   -version-info CURRENT[:REVISION[:AGE]]
  4023 		    specify library version info [each variable defaults to 0]
  4024 
  4025 All other options (arguments beginning with \`-') are ignored.
  4026 
  4027 Every other argument is treated as a filename.  Files ending in \`.la' are
  4028 treated as uninstalled libtool libraries, other files are standard or library
  4029 object files.
  4030 
  4031 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  4032 only library objects (\`.lo' files) may be specified, and \`-rpath' is
  4033 required, except when creating a convenience library.
  4034 
  4035 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  4036 using \`ar' and \`ranlib', or on Windows using \`lib'.
  4037 
  4038 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  4039 is created, otherwise an executable program is created."
  4040   ;;
  4041 
  4042 uninstall)
  4043   $echo \
  4044 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  4045 
  4046 Remove libraries from an installation directory.
  4047 
  4048 RM is the name of the program to use to delete files associated with each FILE
  4049 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  4050 to RM.
  4051 
  4052 If FILE is a libtool library, all the files associated with it are deleted.
  4053 Otherwise, only FILE itself is deleted using RM."
  4054   ;;
  4055 
  4056 *)
  4057   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  4058   $echo "$help" 1>&2
  4059   exit 1
  4060   ;;
  4061 esac
  4062 
  4063 echo
  4064 $echo "Try \`$modename --help' for more information about other modes."
  4065 
  4066 exit 0
  4067 
  4068 # Local Variables:
  4069 # mode:shell-script
  4070 # sh-indentation:2
  4071 # End: