ltmain.sh
author Sam Lantinga <slouken@libsdl.org>
Sat, 01 Feb 2003 19:59:23 +0000
changeset 588 2c6510c0a304
parent 581 844addcf125e
child 608 d0fecf67cd93
permissions -rw-r--r--
Darrell added support for emulated SDL_DOUBLEBUF on MacOSX
     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 	  compile_command="$compile_command -framework $arg"
   957 	  prev=
   958 	  continue
   959 	  ;;
   960 	release)
   961 	  release="-$arg"
   962 	  prev=
   963 	  continue
   964 	  ;;
   965 	rpath | xrpath)
   966 	  # We need an absolute path.
   967 	  case "$arg" in
   968 	  [\\/]* | [A-Za-z]:[\\/]*) ;;
   969 	  *)
   970 	    $echo "$modename: only absolute run-paths are allowed" 1>&2
   971 	    exit 1
   972 	    ;;
   973 	  esac
   974 	  if test "$prev" = rpath; then
   975 	    case "$rpath " in
   976 	    *" $arg "*) ;;
   977 	    *) rpath="$rpath $arg" ;;
   978 	    esac
   979 	  else
   980 	    case "$xrpath " in
   981 	    *" $arg "*) ;;
   982 	    *) xrpath="$xrpath $arg" ;;
   983 	    esac
   984 	  fi
   985 	  prev=
   986 	  continue
   987 	  ;;
   988 	*)
   989 	  eval "$prev=\"\$arg\""
   990 	  prev=
   991 	  continue
   992 	  ;;
   993 	esac
   994       fi
   995 
   996       prevarg="$arg"
   997 
   998       case "$arg" in
   999       -all-static)
  1000 	if test -n "$link_static_flag"; then
  1001 	  compile_command="$compile_command $link_static_flag"
  1002 	  finalize_command="$finalize_command $link_static_flag"
  1003 	fi
  1004 	continue
  1005 	;;
  1006 
  1007       -allow-undefined)
  1008 	# FIXME: remove this flag sometime in the future.
  1009 	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1010 	continue
  1011 	;;
  1012 
  1013       -avoid-version)
  1014 	avoid_version=yes
  1015 	continue
  1016 	;;
  1017 
  1018       -dlopen)
  1019 	prev=dlfiles
  1020 	continue
  1021 	;;
  1022 
  1023       -dlpreopen)
  1024 	prev=dlprefiles
  1025 	continue
  1026 	;;
  1027 
  1028       -export-dynamic)
  1029 	export_dynamic=yes
  1030 	continue
  1031 	;;
  1032 
  1033       -export-symbols | -export-symbols-regex)
  1034 	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1035 	  $echo "$modename: not more than one -exported-symbols argument allowed"
  1036 	  exit 1
  1037 	fi
  1038 	if test "X$arg" = "X-export-symbols"; then
  1039 	  prev=expsyms
  1040 	else
  1041 	  prev=expsyms_regex
  1042 	fi
  1043 	continue
  1044 	;;
  1045 
  1046       -framework)
  1047 	prev=framework
  1048 	continue
  1049 	;;
  1050 
  1051       -L*)
  1052 	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1053 	# We need an absolute path.
  1054 	case "$dir" in
  1055 	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1056 	*)
  1057 	  absdir=`cd "$dir" && pwd`
  1058 	  if test -z "$absdir"; then
  1059 	    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1060 	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1061 	    absdir="$dir"
  1062 	  fi
  1063 	  dir="$absdir"
  1064 	  ;;
  1065 	esac
  1066 	case " $deplibs " in
  1067 	*" $arg "*) ;;
  1068 	*) deplibs="$deplibs $arg";;
  1069 	esac
  1070 	case " $lib_search_path " in
  1071 	*" $dir "*) ;;
  1072 	*) lib_search_path="$lib_search_path $dir";;
  1073 	esac
  1074 	case "$host" in
  1075 	*-*-cygwin* | *-*-mingw* | *-*-os2*)
  1076 	  dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1077 	  case ":$dllsearchpath:" in
  1078 	  ::) dllsearchpath="$dllsearchdir";;
  1079 	  *":$dllsearchdir:"*) ;;
  1080 	  *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  1081 	  esac
  1082 	  ;;
  1083 	esac
  1084 	;;
  1085 
  1086       -l*)
  1087 	if test "$arg" = "-lc"; then
  1088 	  case "$host" in
  1089 	  *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* |*-*-freebsd* )
  1090 	    # These systems don't actually have c library (as such)
  1091 	    continue
  1092 	    ;;
  1093           *-*-openbsd*)
  1094             # Do not include libc due to us having libc/libc_r.
  1095             continue
  1096             ;;
  1097 	  esac
  1098         elif test "$arg" = "-lc_r"; then
  1099           case "$host" in
  1100           *-*-openbsd*)
  1101             # Do not include libc_r directly, use -pthread flag.
  1102             continue
  1103             ;;
  1104           esac
  1105 	elif test "$arg" = "-lm"; then
  1106 	  case "$host" in
  1107 	  *-*-cygwin* | *-*-beos*)
  1108 	    # These systems don't actually have math library (as such)
  1109 	    continue
  1110 	    ;;
  1111 	  esac
  1112 	fi
  1113 	deplibs="$deplibs $arg"
  1114 	;;
  1115 
  1116       -?thread)
  1117         deplibs="$deplibs $arg"
  1118         ;;
  1119 
  1120       -module)
  1121 	module=yes
  1122 	continue
  1123 	;;
  1124 
  1125       -no-undefined)
  1126 	allow_undefined=no
  1127 	continue
  1128 	;;
  1129 
  1130       -o) prev=output ;;
  1131 
  1132       -release)
  1133 	prev=release
  1134 	continue
  1135 	;;
  1136 
  1137       -rpath)
  1138 	prev=rpath
  1139 	continue
  1140 	;;
  1141 
  1142       -R)
  1143 	prev=xrpath
  1144 	continue
  1145 	;;
  1146 
  1147       -R*)
  1148 	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1149 	# We need an absolute path.
  1150 	case "$dir" in
  1151 	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1152 	*)
  1153 	  $echo "$modename: only absolute run-paths are allowed" 1>&2
  1154 	  exit 1
  1155 	  ;;
  1156 	esac
  1157 	case "$xrpath " in
  1158 	*" $dir "*) ;;
  1159 	*) xrpath="$xrpath $dir" ;;
  1160 	esac
  1161 	continue
  1162 	;;
  1163 
  1164       -static)
  1165 	# If we have no pic_flag, then this is the same as -all-static.
  1166 	if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1167 	  compile_command="$compile_command $link_static_flag"
  1168 	  finalize_command="$finalize_command $link_static_flag"
  1169 	fi
  1170 	continue
  1171 	;;
  1172 
  1173       -thread-safe)
  1174 	thread_safe=yes
  1175 	continue
  1176 	;;
  1177 
  1178       -version-info)
  1179 	prev=vinfo
  1180 	continue
  1181 	;;
  1182 
  1183       # Some other compiler flag.
  1184       -* | +*)
  1185 	# Unknown arguments in both finalize_command and compile_command need
  1186 	# to be aesthetically quoted because they are evaled later.
  1187 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1188 	case "$arg" in
  1189 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1190 	  arg="\"$arg\""
  1191 	  ;;
  1192 	esac
  1193 	;;
  1194 
  1195       *.o | *.obj | *.a | *.lib)
  1196 	# A standard object.
  1197 	objs="$objs $arg"
  1198 	;;
  1199 
  1200       *.lo)
  1201 	# A library object.
  1202 	if test "$prev" = dlfiles; then
  1203 	  dlfiles="$dlfiles $arg"
  1204 	  if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1205 	    prev=
  1206 	    continue
  1207 	  else
  1208 	    # If libtool objects are unsupported, then we need to preload.
  1209 	    prev=dlprefiles
  1210 	  fi
  1211 	fi
  1212 
  1213 	if test "$prev" = dlprefiles; then
  1214 	  # Preload the old-style object.
  1215 	  dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1216 	  prev=
  1217 	fi
  1218 	libobjs="$libobjs $arg"
  1219 	;;
  1220 
  1221       *.la)
  1222 	# A libtool-controlled library.
  1223 
  1224 	dlname=
  1225 	libdir=
  1226 	library_names=
  1227 	old_library=
  1228 
  1229 	# Check to see that this really is a libtool archive.
  1230 	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1231 	else
  1232 	  $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1233 	  exit 1
  1234 	fi
  1235 
  1236 	# If the library was installed with an old release of libtool,
  1237 	# it will not redefine variable installed.
  1238 	installed=yes
  1239 
  1240 	# Read the .la file
  1241 	# If there is no directory component, then add one.
  1242 	case "$arg" in
  1243 	*/* | *\\*) . $arg ;;
  1244 	*) . ./$arg ;;
  1245 	esac
  1246 
  1247 	# Get the name of the library we link against.
  1248 	linklib=
  1249 	for l in $old_library $library_names; do
  1250 	  linklib="$l"
  1251 	done
  1252 
  1253 	if test -z "$linklib"; then
  1254 	  $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1255 	  exit 1
  1256 	fi
  1257 
  1258 	# Find the relevant object directory and library name.
  1259 	name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1260 
  1261 	if test "X$installed" = Xyes; then
  1262 	  dir="$libdir"
  1263 	else
  1264 	  dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1265 	  if test "X$dir" = "X$arg"; then
  1266 	    dir="$objdir"
  1267 	  else
  1268 	    dir="$dir/$objdir"
  1269 	  fi
  1270 	fi
  1271 
  1272 	if test -n "$dependency_libs"; then
  1273 	  # Extract -R and -L from dependency_libs
  1274 	  temp_deplibs=
  1275 	  for deplib in $dependency_libs; do
  1276 	    case "$deplib" in
  1277 	    -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1278 		 case " $rpath $xrpath " in
  1279 		 *" $temp_xrpath "*) ;;
  1280 		 *) xrpath="$xrpath $temp_xrpath";;
  1281 		 esac;;
  1282 	    -L*) case "$compile_command $temp_deplibs " in
  1283 		 *" $deplib "*) ;;
  1284 		 *) temp_deplibs="$temp_deplibs $deplib";;
  1285 		 esac
  1286 		 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1287 		 case " $lib_search_path " in
  1288 		 *" $temp_dir "*) ;;
  1289 		 *) lib_search_path="$lib_search_path $temp_dir";;
  1290 		 esac
  1291 		 ;;
  1292 	    *) temp_deplibs="$temp_deplibs $deplib";;
  1293 	    esac
  1294 	  done
  1295 	  dependency_libs="$temp_deplibs"
  1296 	fi
  1297 
  1298 	if test -z "$libdir"; then
  1299 	  # It is a libtool convenience library, so add in its objects.
  1300 	  convenience="$convenience $dir/$old_library"
  1301 	  old_convenience="$old_convenience $dir/$old_library"
  1302 	  deplibs="$deplibs$dependency_libs"
  1303 	  compile_command="$compile_command $dir/$old_library$dependency_libs"
  1304 	  finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1305 	  continue
  1306 	fi
  1307 
  1308 	# This library was specified with -dlopen.
  1309 	if test "$prev" = dlfiles; then
  1310 	  dlfiles="$dlfiles $arg"
  1311 	  if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1312 	    # If there is no dlname, no dlopen support or we're linking statically,
  1313 	    # we need to preload.
  1314 	    prev=dlprefiles
  1315 	  else
  1316 	    # We should not create a dependency on this library, but we
  1317 	    # may need any libraries it requires.
  1318 	    compile_command="$compile_command$dependency_libs"
  1319 	    finalize_command="$finalize_command$dependency_libs"
  1320 	    prev=
  1321 	    continue
  1322 	  fi
  1323 	fi
  1324 
  1325 	# The library was specified with -dlpreopen.
  1326 	if test "$prev" = dlprefiles; then
  1327 	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  1328 	  # are required to link).
  1329 	  if test -n "$old_library"; then
  1330 	    dlprefiles="$dlprefiles $dir/$old_library"
  1331 	  else
  1332 	    dlprefiles="$dlprefiles $dir/$linklib"
  1333 	  fi
  1334 	  prev=
  1335 	fi
  1336 
  1337 	if test -n "$library_names" &&
  1338 	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1339 	  link_against_libtool_libs="$link_against_libtool_libs $arg"
  1340 	  if test -n "$shlibpath_var"; then
  1341 	    # Make sure the rpath contains only unique directories.
  1342 	    case "$temp_rpath " in
  1343 	    *" $dir "*) ;;
  1344 	    *) temp_rpath="$temp_rpath $dir" ;;
  1345 	    esac
  1346 	  fi
  1347 
  1348 	  # We need an absolute path.
  1349 	  case "$dir" in
  1350 	  [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1351 	  *)
  1352 	    absdir=`cd "$dir" && pwd`
  1353 	    if test -z "$absdir"; then
  1354 	      $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1355 	      $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1356 	      absdir="$dir"
  1357 	    fi
  1358 	    ;;
  1359 	  esac
  1360 	  
  1361 	  # This is the magic to use -rpath.
  1362 	  # Skip directories that are in the system default run-time
  1363 	  # search path, unless they have been requested with -R.
  1364 	  case " $sys_lib_dlsearch_path " in
  1365 	  *" $absdir "*) ;;
  1366 	  *)
  1367 	    case "$compile_rpath " in
  1368 	    *" $absdir "*) ;;
  1369 	    *) compile_rpath="$compile_rpath $absdir" 
  1370 	    esac
  1371 	    ;;
  1372 	  esac
  1373 
  1374 	  case " $sys_lib_dlsearch_path " in
  1375 	  *" $libdir "*) ;;
  1376 	  *)
  1377 	    case "$finalize_rpath " in
  1378 	    *" $libdir "*) ;;
  1379 	    *) finalize_rpath="$finalize_rpath $libdir"
  1380 	    esac
  1381 	    ;;
  1382 	  esac
  1383 
  1384 	  lib_linked=yes
  1385 	  case "$hardcode_action" in
  1386 	  immediate | unsupported)
  1387 	    if test "$hardcode_direct" = no; then
  1388 	      compile_command="$compile_command $dir/$linklib"
  1389 	      deplibs="$deplibs $dir/$linklib"
  1390 	      case "$host" in
  1391 	      *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1392 		dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1393 		if test -n "$dllsearchpath"; then
  1394 		  dllsearchpath="$dllsearchpath:$dllsearchdir"
  1395 		else
  1396 		  dllsearchpath="$dllsearchdir"
  1397 		fi
  1398 		;;
  1399 	      esac
  1400 	    elif test "$hardcode_minus_L" = no; then
  1401 	      case "$host" in
  1402 	      *-*-sunos*)
  1403 		compile_shlibpath="$compile_shlibpath$dir:"
  1404 		;;
  1405 	      esac
  1406 	      case "$compile_command " in
  1407 	      *" -L$dir "*) ;;
  1408 	      *) compile_command="$compile_command -L$dir";;
  1409 	      esac
  1410 	      compile_command="$compile_command -l$name"
  1411 	      deplibs="$deplibs -L$dir -l$name"
  1412 	    elif test "$hardcode_shlibpath_var" = no; then
  1413 	      case ":$compile_shlibpath:" in
  1414 	      *":$dir:"*) ;;
  1415 	      *) compile_shlibpath="$compile_shlibpath$dir:";;
  1416 	      esac
  1417 	      compile_command="$compile_command -l$name"
  1418 	      deplibs="$deplibs -l$name"
  1419 	    else
  1420 	      lib_linked=no
  1421 	    fi
  1422 	    ;;
  1423 
  1424 	  relink)
  1425 	    if test "$hardcode_direct" = yes; then
  1426 	      compile_command="$compile_command $absdir/$linklib"
  1427 	      deplibs="$deplibs $absdir/$linklib"
  1428 	    elif test "$hardcode_minus_L" = yes; then
  1429 	      case "$compile_command " in
  1430 	      *" -L$absdir "*) ;;
  1431 	      *) compile_command="$compile_command -L$absdir";;
  1432 	      esac
  1433 	      compile_command="$compile_command -l$name"
  1434 	      deplibs="$deplibs -L$absdir -l$name"
  1435 	    elif test "$hardcode_shlibpath_var" = yes; then
  1436 	      case ":$compile_shlibpath:" in
  1437 	      *":$absdir:"*) ;;
  1438 	      *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1439 	      esac
  1440 	      compile_command="$compile_command -l$name"
  1441 	      deplibs="$deplibs -l$name"
  1442 	    else
  1443 	      lib_linked=no
  1444 	    fi
  1445 	    ;;
  1446 
  1447 	  *)
  1448 	    lib_linked=no
  1449 	    ;;
  1450 	  esac
  1451 
  1452 	  if test "$lib_linked" != yes; then
  1453 	    $echo "$modename: configuration error: unsupported hardcode properties"
  1454 	    exit 1
  1455 	  fi
  1456 
  1457 	  # Finalize command for both is simple: just hardcode it.
  1458 	  if test "$hardcode_direct" = yes; then
  1459 	    finalize_command="$finalize_command $libdir/$linklib"
  1460 	  elif test "$hardcode_minus_L" = yes; then
  1461 	    case "$finalize_command " in
  1462 	    *" -L$libdir "*) ;;
  1463 	    *) finalize_command="$finalize_command -L$libdir";;
  1464 	    esac
  1465 	    finalize_command="$finalize_command -l$name"
  1466 	  elif test "$hardcode_shlibpath_var" = yes; then
  1467 	    case ":$finalize_shlibpath:" in
  1468 	    *":$libdir:"*) ;;
  1469 	    *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1470 	    esac
  1471 	    finalize_command="$finalize_command -l$name"
  1472 	  else
  1473 	    # We cannot seem to hardcode it, guess we'll fake it.
  1474 	    case "$finalize_command " in
  1475 	    *" -L$dir "*) ;;
  1476 	    *) finalize_command="$finalize_command -L$libdir";;
  1477 	    esac
  1478 	    finalize_command="$finalize_command -l$name"
  1479 	  fi
  1480 	else
  1481 	  # Transform directly to old archives if we don't build new libraries.
  1482 	  if test -n "$pic_flag" && test -z "$old_library"; then
  1483 	    $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1484 	    exit 1
  1485 	  fi
  1486 
  1487 	  # Here we assume that one of hardcode_direct or hardcode_minus_L
  1488 	  # is not unsupported.  This is valid on all known static and
  1489 	  # shared platforms.
  1490 	  if test "$hardcode_direct" != unsupported; then
  1491 	    test -n "$old_library" && linklib="$old_library"
  1492 	    compile_command="$compile_command $dir/$linklib"
  1493 	    finalize_command="$finalize_command $dir/$linklib"
  1494 	  else
  1495 	    case "$compile_command " in
  1496 	    *" -L$dir "*) ;;
  1497 	    *) compile_command="$compile_command -L$dir";;
  1498 	    esac
  1499 	    compile_command="$compile_command -l$name"
  1500 	    case "$finalize_command " in
  1501 	    *" -L$dir "*) ;;
  1502 	    *) finalize_command="$finalize_command -L$dir";;
  1503 	    esac
  1504 	    finalize_command="$finalize_command -l$name"
  1505 	  fi
  1506 	fi
  1507 
  1508 	# Add in any libraries that this one depends upon.
  1509 	compile_command="$compile_command$dependency_libs"
  1510 	finalize_command="$finalize_command$dependency_libs"
  1511 	continue
  1512 	;;
  1513 
  1514       # Some other compiler argument.
  1515       *)
  1516 	# Unknown arguments in both finalize_command and compile_command need
  1517 	# to be aesthetically quoted because they are evaled later.
  1518 	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1519 	case "$arg" in
  1520 	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  1521 	  arg="\"$arg\""
  1522 	  ;;
  1523 	esac
  1524 	;;
  1525       esac
  1526 
  1527       # Now actually substitute the argument into the commands.
  1528       if test -n "$arg"; then
  1529 	compile_command="$compile_command $arg"
  1530 	finalize_command="$finalize_command $arg"
  1531       fi
  1532     done
  1533 
  1534     if test -n "$prev"; then
  1535       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1536       $echo "$help" 1>&2
  1537       exit 1
  1538     fi
  1539 
  1540     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1541       eval arg=\"$export_dynamic_flag_spec\"
  1542       compile_command="$compile_command $arg"
  1543       finalize_command="$finalize_command $arg"
  1544     fi
  1545 
  1546     oldlibs=
  1547     # calculate the name of the file, without its directory
  1548     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1549     libobjs_save="$libobjs"
  1550 
  1551     case "$output" in
  1552     "")
  1553       $echo "$modename: you must specify an output file" 1>&2
  1554       $echo "$help" 1>&2
  1555       exit 1
  1556       ;;
  1557 
  1558     *.a | *.lib)
  1559       if test -n "$link_against_libtool_libs"; then
  1560 	$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1561 	exit 1
  1562       fi
  1563 
  1564       if test -n "$deplibs"; then
  1565 	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1566       fi
  1567 
  1568       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1569 	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1570       fi
  1571 
  1572       if test -n "$rpath"; then
  1573 	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1574       fi
  1575 
  1576       if test -n "$xrpath"; then
  1577 	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1578       fi
  1579 
  1580       if test -n "$vinfo"; then
  1581 	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1582       fi
  1583 
  1584       if test -n "$release"; then
  1585 	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1586       fi
  1587 
  1588       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1589 	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1590       fi
  1591 
  1592       # Now set the variables for building old libraries.
  1593       build_libtool_libs=no
  1594       oldlibs="$output"
  1595       ;;
  1596 
  1597     *.la)
  1598       # Make sure we only generate libraries of the form `libNAME.la'.
  1599       case "$outputname" in
  1600       lib*)
  1601 	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1602 	eval libname=\"$libname_spec\"
  1603 	;;
  1604       *)
  1605 	if test "$module" = no; then
  1606 	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1607 	  $echo "$help" 1>&2
  1608 	  exit 1
  1609 	fi
  1610 	if test "$need_lib_prefix" != no; then
  1611 	  # Add the "lib" prefix for modules if required
  1612 	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1613 	  eval libname=\"$libname_spec\"
  1614 	else
  1615 	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1616 	fi
  1617 	;;
  1618       esac
  1619 
  1620       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1621       if test "X$output_objdir" = "X$output"; then
  1622 	output_objdir="$objdir"
  1623       else
  1624 	output_objdir="$output_objdir/$objdir"
  1625       fi
  1626 
  1627       if test -n "$objs"; then
  1628 	$echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1629 	exit 1
  1630       fi
  1631 
  1632       # How the heck are we supposed to write a wrapper for a shared library?
  1633       if test -n "$link_against_libtool_libs"; then
  1634 	 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1635 	 exit 1
  1636       fi
  1637 
  1638       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1639 	$echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1640       fi
  1641 
  1642       set dummy $rpath
  1643       if test $# -gt 2; then
  1644 	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1645       fi
  1646       install_libdir="$2"
  1647 
  1648       oldlibs=
  1649       if test -z "$rpath"; then
  1650 	if test "$build_libtool_libs" = yes; then
  1651 	  # Building a libtool convenience library.
  1652 	  libext=al
  1653 	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1654 	  build_libtool_libs=convenience
  1655 	  build_old_libs=yes
  1656 	fi
  1657 	dependency_libs="$deplibs"
  1658 
  1659 	if test -n "$vinfo"; then
  1660 	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1661 	fi
  1662 
  1663 	if test -n "$release"; then
  1664 	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1665 	fi
  1666       else
  1667 
  1668 	# Parse the version information argument.
  1669 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=':'
  1670 	set dummy $vinfo 0 0 0
  1671 	IFS="$save_ifs"
  1672 
  1673 	if test -n "$8"; then
  1674 	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1675 	  $echo "$help" 1>&2
  1676 	  exit 1
  1677 	fi
  1678 
  1679 	current="$2"
  1680 	revision="$3"
  1681 	age="$4"
  1682 
  1683 	# Check that each of the things are valid numbers.
  1684 	case "$current" in
  1685 	0 | [1-9] | [1-9][0-9]*) ;;
  1686 	*)
  1687 	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1688 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1689 	  exit 1
  1690 	  ;;
  1691 	esac
  1692 
  1693 	case "$revision" in
  1694 	0 | [1-9] | [1-9][0-9]*) ;;
  1695 	*)
  1696 	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1697 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1698 	  exit 1
  1699 	  ;;
  1700 	esac
  1701 
  1702 	case "$age" in
  1703 	0 | [1-9] | [1-9][0-9]*) ;;
  1704 	*)
  1705 	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1706 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1707 	  exit 1
  1708 	  ;;
  1709 	esac
  1710 
  1711 	if test $age -gt $current; then
  1712 	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1713 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1714 	  exit 1
  1715 	fi
  1716 
  1717 	# Calculate the version variables.
  1718 	major=
  1719 	versuffix=
  1720 	verstring=
  1721 	case "$version_type" in
  1722 	none) ;;
  1723 
  1724 	irix)
  1725 	  major=`expr $current - $age + 1`
  1726 	  versuffix="$major.$revision"
  1727 	  verstring="sgi$major.$revision"
  1728 
  1729 	  # Add in all the interfaces that we are compatible with.
  1730 	  loop=$revision
  1731 	  while test $loop != 0; do
  1732 	    iface=`expr $revision - $loop`
  1733 	    loop=`expr $loop - 1`
  1734 	    verstring="sgi$major.$iface:$verstring"
  1735 	  done
  1736 	  ;;
  1737 
  1738 	linux)
  1739 	  major=.`expr $current - $age`
  1740 	  versuffix="$major.$age.$revision"
  1741 	  ;;
  1742 
  1743 	osf)
  1744 	  major=`expr $current - $age`
  1745 	  versuffix=".$current.$age.$revision"
  1746 	  verstring="$current.$age.$revision"
  1747 
  1748 	  # Add in all the interfaces that we are compatible with.
  1749 	  loop=$age
  1750 	  while test $loop != 0; do
  1751 	    iface=`expr $current - $loop`
  1752 	    loop=`expr $loop - 1`
  1753 	    verstring="$verstring:${iface}.0"
  1754 	  done
  1755 
  1756 	  # Make executables depend on our current version.
  1757 	  verstring="$verstring:${current}.0"
  1758 	  ;;
  1759 
  1760 	sunos)
  1761 	  major=".$current"
  1762 	  versuffix=".$current.$revision"
  1763 	  ;;
  1764 
  1765 	freebsd-aout)
  1766 	  major=".$current"
  1767 	  versuffix=".$current.$revision";
  1768 	  ;;
  1769 
  1770 	freebsd-elf)
  1771 	  major=".$current"
  1772 	  versuffix=".$current";
  1773 	  ;;
  1774 
  1775 	windows)
  1776 	  # Like Linux, but with '-' rather than '.', since we only
  1777 	  # want one extension on Windows 95.
  1778 	  major=`expr $current - $age`
  1779 	  versuffix="-$major-$age-$revision"
  1780 	  ;;
  1781 
  1782 	darwin)
  1783 	  # Like Linux, but with the current version available in
  1784 	  # verstring for coding it into the library header
  1785 	  major=.`expr $current - $age`
  1786 	  versuffix="$major.$age.$revision"
  1787 	  # Darwin ld doesn't like 0 for these options...
  1788 	  minor_current=`expr $current + 1`
  1789 	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  1790 	  ;;
  1791 
  1792 	*)
  1793 	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1794 	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1795 	  exit 1
  1796 	  ;;
  1797 	esac
  1798 
  1799 	# Clear the version info if we defaulted, and they specified a release.
  1800 	if test -z "$vinfo" && test -n "$release"; then
  1801 	  major=
  1802 	  case "$version_type" in
  1803 	  darwin)
  1804 	    # we can't check for "0.0" in archive_cmds due to quoting
  1805 	    # problems, so we reset it completely
  1806 	    verstring=""
  1807 	    ;;
  1808 	  *)
  1809 	  verstring="0.0"
  1810 	    ;;
  1811 	  esac
  1812 	  if test "$need_version" = no; then
  1813 	    versuffix=
  1814 	  else
  1815 	    versuffix=".0.0"
  1816 	  fi
  1817 	fi
  1818 
  1819 	# Remove version info from name if versioning should be avoided
  1820 	if test "$avoid_version" = yes && test "$need_version" = no; then
  1821 	  major=
  1822 	  versuffix=
  1823 	  verstring=""
  1824 	fi
  1825 	
  1826 	# Check to see if the archive will have undefined symbols.
  1827 	if test "$allow_undefined" = yes; then
  1828 	  if test "$allow_undefined_flag" = unsupported; then
  1829 	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1830 	    build_libtool_libs=no
  1831 	    build_old_libs=yes
  1832 	  fi
  1833 	else
  1834 	  # Don't allow undefined symbols.
  1835 	  allow_undefined_flag="$no_undefined_flag"
  1836 	fi
  1837 
  1838 	dependency_libs="$deplibs"
  1839 	case "$host" in
  1840 	*-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* )
  1841 	  # these systems don't actually have a c library (as such)!
  1842 	  ;;
  1843         *-*-rhapsody*)
  1844 	  # rhapsody is a little odd...
  1845 	  deplibs="$deplibs -framework System"
  1846 	  ;;
  1847 	*-*-openbsd*)
  1848 	  # do not include libc due to us having libc/libc_r.
  1849 	  ;;
  1850 	*)
  1851 	  # Add libc to deplibs on all other systems.
  1852 	  deplibs="$deplibs -lc"
  1853 	  ;;
  1854 	esac
  1855       fi
  1856 
  1857       # Create the output directory, or remove our outputs if we need to.
  1858       if test -d $output_objdir; then
  1859 	$show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1860 	$run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1861       else
  1862 	$show "$mkdir $output_objdir"
  1863 	$run $mkdir $output_objdir
  1864 	status=$?
  1865 	if test $status -ne 0 && test ! -d $output_objdir; then
  1866 	  exit $status
  1867 	fi
  1868       fi
  1869 
  1870       # Now set the variables for building old libraries.
  1871       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  1872 	oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1873 
  1874 	# Transform .lo files to .o files.
  1875 	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1876       fi
  1877 
  1878       if test "$build_libtool_libs" = yes; then
  1879 	# Transform deplibs into only deplibs that can be linked in shared.
  1880 	name_save=$name
  1881 	libname_save=$libname
  1882 	release_save=$release
  1883 	versuffix_save=$versuffix
  1884 	major_save=$major
  1885 	# I'm not sure if I'm treating the release correctly.  I think
  1886 	# release should show up in the -l (ie -lgmp5) so we don't want to
  1887 	# add it in twice.  Is that correct?
  1888 	release=""
  1889 	versuffix=""
  1890 	major=""
  1891 	newdeplibs=
  1892 	droppeddeps=no
  1893 	case "$deplibs_check_method" in
  1894 	pass_all)
  1895 	  # Don't check for shared/static.  Everything works.
  1896 	  # This might be a little naive.  We might want to check
  1897 	  # whether the library exists or not.  But this is on
  1898 	  # osf3 & osf4 and I'm not really sure... Just
  1899 	  # implementing what was already the behaviour.
  1900 	  newdeplibs=$deplibs
  1901 	  ;;
  1902 	test_compile)
  1903 	  # This code stresses the "libraries are programs" paradigm to its
  1904 	  # limits. Maybe even breaks it.  We compile a program, linking it
  1905 	  # against the deplibs as a proxy for the library.  Then we can check
  1906 	  # whether they linked in statically or dynamically with ldd.
  1907 	  $rm conftest.c
  1908 	  cat > conftest.c <<EOF
  1909 	  int main() { return 0; }
  1910 EOF
  1911 	  $rm conftest
  1912 	  $CC -o conftest conftest.c $deplibs
  1913 	  if test $? -eq 0 ; then
  1914 	    ldd_output=`ldd conftest`
  1915 	    for i in $deplibs; do
  1916 	      name="`expr $i : '-l\(.*\)'`"
  1917 	      # If $name is empty we are operating on a -L argument.
  1918 	      if test "$name" != "" ; then
  1919 		libname=`eval \\$echo \"$libname_spec\"`
  1920 		deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1921 		set dummy $deplib_matches
  1922 		deplib_match=$2
  1923 		if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1924 		  newdeplibs="$newdeplibs $i"
  1925 		else
  1926 		  droppeddeps=yes
  1927 		  echo
  1928 		  echo "*** Warning: This library needs some functionality provided by $i."
  1929 		  echo "*** I have the capability to make that library automatically link in when"
  1930 		  echo "*** you link to this library.  But I can only do this if you have a"
  1931 		  echo "*** shared version of the library, which you do not appear to have."
  1932 		fi
  1933 	      else
  1934 		newdeplibs="$newdeplibs $i"
  1935 	      fi
  1936 	    done
  1937 	  else
  1938 	    # Error occured in the first compile.  Let's try to salvage the situation:
  1939 	    # Compile a seperate program for each library.
  1940 	    for i in $deplibs; do
  1941 	      name="`expr $i : '-l\(.*\)'`"
  1942 	     # If $name is empty we are operating on a -L argument.
  1943 	      if test "$name" != "" ; then
  1944 		$rm conftest
  1945 		$CC -o conftest conftest.c $i
  1946 		# Did it work?
  1947 		if test $? -eq 0 ; then
  1948 		  ldd_output=`ldd conftest`
  1949 		  libname=`eval \\$echo \"$libname_spec\"`
  1950 		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1951 		  set dummy $deplib_matches
  1952 		  deplib_match=$2
  1953 		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1954 		    newdeplibs="$newdeplibs $i"
  1955 		  else
  1956 		    droppeddeps=yes
  1957 		    echo
  1958 		    echo "*** Warning: This library needs some functionality provided by $i."
  1959 		    echo "*** I have the capability to make that library automatically link in when"
  1960 		    echo "*** you link to this library.  But I can only do this if you have a"
  1961 		    echo "*** shared version of the library, which you do not appear to have."
  1962 		  fi
  1963 		else
  1964 		  droppeddeps=yes
  1965 		  echo
  1966 		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1967 		  echo "***  make it link in!  You will probably need to install it or some"
  1968 		  echo "*** library that it depends on before this library will be fully"
  1969 		  echo "*** functional.  Installing it before continuing would be even better."
  1970 		fi
  1971 	      else
  1972 		newdeplibs="$newdeplibs $i"
  1973 	      fi
  1974 	    done
  1975 	  fi
  1976 	  ;;
  1977 	file_magic*)
  1978 	  set dummy $deplibs_check_method
  1979 	  file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  1980 	  for a_deplib in $deplibs; do
  1981 	    name="`expr $a_deplib : '-l\(.*\)'`"
  1982 	    # If $name is empty we are operating on a -L argument.
  1983 	    if test "$name" != "" ; then
  1984 	      libname=`eval \\$echo \"$libname_spec\"`
  1985 	      for i in $lib_search_path; do
  1986 		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1987 		    for potent_lib in $potential_libs; do
  1988 		      # Follow soft links.
  1989 		      if ls -lLd "$potent_lib" 2>/dev/null \
  1990 			 | grep " -> " >/dev/null; then
  1991 			continue 
  1992 		      fi
  1993 		      # The statement above tries to avoid entering an
  1994 		      # endless loop below, in case of cyclic links.
  1995 		      # We might still enter an endless loop, since a link
  1996 		      # loop can be closed while we follow links,
  1997 		      # but so what?
  1998 		      potlib="$potent_lib"
  1999 		      while test -h "$potlib" 2>/dev/null; do
  2000 			potliblink=`ls -ld $potlib | sed 's/.* -> //'`
  2001 			case "$potliblink" in
  2002 			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  2003 			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  2004 			esac
  2005 		      done
  2006 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  2007 			 | sed 10q \
  2008 			 | egrep "$file_magic_regex" > /dev/null; then
  2009 			newdeplibs="$newdeplibs $a_deplib"
  2010 			a_deplib=""
  2011 			break 2
  2012 		      fi
  2013 		    done
  2014 	      done
  2015 	      if test -n "$a_deplib" ; then
  2016 		droppeddeps=yes
  2017 		echo
  2018 		echo "*** Warning: This library needs some functionality provided by $a_deplib."
  2019 		echo "*** I have the capability to make that library automatically link in when"
  2020 		echo "*** you link to this library.  But I can only do this if you have a"
  2021 		echo "*** shared version of the library, which you do not appear to have."
  2022 	      fi
  2023 	    else
  2024 	      # Add a -L argument.
  2025 	      newdeplibs="$newdeplibs $a_deplib"
  2026 	    fi
  2027 	  done # Gone through all deplibs.
  2028 	  ;;
  2029 	none | unknown | *)
  2030 	  newdeplibs=""
  2031 	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  2032 	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
  2033 	     grep . >/dev/null; then
  2034 	    echo
  2035 	    if test "X$deplibs_check_method" = "Xnone"; then
  2036 	      echo "*** Warning: inter-library dependencies are not supported in this platform."
  2037 	    else
  2038 	      echo "*** Warning: inter-library dependencies are not known to be supported."
  2039 	    fi
  2040 	    echo "*** All declared inter-library dependencies are being dropped."
  2041 	    droppeddeps=yes
  2042 	  fi
  2043 	  ;;
  2044 	esac
  2045 	versuffix=$versuffix_save
  2046 	major=$major_save
  2047 	release=$release_save
  2048 	libname=$libname_save
  2049 	name=$name_save
  2050 
  2051 	if test "$droppeddeps" = yes; then
  2052 	  if test "$module" = yes; then
  2053 	    echo
  2054 	    echo "*** Warning: libtool could not satisfy all declared inter-library"
  2055 	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
  2056 	    echo "*** a static module, that should work as long as the dlopening"
  2057 	    echo "*** application is linked with the -dlopen flag."
  2058 	    if test -z "$global_symbol_pipe"; then
  2059 	      echo
  2060 	      echo "*** However, this would only work if libtool was able to extract symbol"
  2061 	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  2062 	      echo "*** not find such a program.  So, this module is probably useless."
  2063 	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
  2064 	    fi
  2065 	    if test "$build_old_libs" = no; then
  2066 	      oldlibs="$output_objdir/$libname.$libext"
  2067 	      build_libtool_libs=module
  2068 	      build_old_libs=yes
  2069 	    else
  2070 	      build_libtool_libs=no
  2071 	    fi
  2072 	  else
  2073 	    echo "*** The inter-library dependencies that have been dropped here will be"
  2074 	    echo "*** automatically added whenever a program is linked with this library"
  2075 	    echo "*** or is declared to -dlopen it."
  2076 	  fi
  2077 	fi
  2078 	# Done checking deplibs!
  2079 	deplibs=$newdeplibs
  2080       fi
  2081 
  2082       # All the library-specific variables (install_libdir is set above).
  2083       library_names=
  2084       old_library=
  2085       dlname=
  2086       
  2087       # Test again, we may have decided not to build it any more
  2088       if test "$build_libtool_libs" = yes; then
  2089 	# Get the real and link names of the library.
  2090 	eval library_names=\"$library_names_spec\"
  2091 	set dummy $library_names
  2092 	realname="$2"
  2093 	shift; shift
  2094 
  2095 	if test -n "$soname_spec"; then
  2096 	  eval soname=\"$soname_spec\"
  2097 	else
  2098 	  soname="$realname"
  2099 	fi
  2100 
  2101 	lib="$output_objdir/$realname"
  2102 	for link
  2103 	do
  2104 	  linknames="$linknames $link"
  2105 	done
  2106 
  2107 	# Ensure that we have .o objects for linkers which dislike .lo
  2108 	# (e.g. aix) in case we are running --disable-static
  2109 	for obj in $libobjs; do
  2110 	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  2111 	  if test "X$xdir" = "X$obj"; then
  2112 	    xdir="."
  2113 	  else
  2114 	    xdir="$xdir"
  2115 	  fi
  2116 	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  2117 	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2118 	  if test ! -f $xdir/$oldobj; then
  2119 	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
  2120 	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
  2121 	  fi
  2122 	done
  2123 
  2124 	# Use standard objects if they are pic
  2125 	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2126 
  2127 	# Prepare the list of exported symbols
  2128 	if test -z "$export_symbols"; then
  2129 	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  2130 	    $show "generating symbol list for \`$libname.la'"
  2131 	    export_symbols="$output_objdir/$libname.exp"
  2132 	    $run $rm $export_symbols
  2133 	    eval cmds=\"$export_symbols_cmds\"
  2134 	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  2135 	    for cmd in $cmds; do
  2136 	      IFS="$save_ifs"
  2137 	      $show "$cmd"
  2138 	      $run eval "$cmd" || exit $?
  2139 	    done
  2140 	    IFS="$save_ifs"
  2141 	    if test -n "$export_symbols_regex"; then
  2142 	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  2143 	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  2144 	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  2145 	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
  2146 	    fi
  2147 	  fi
  2148 	fi
  2149 
  2150 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
  2151 	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  2152 	fi
  2153 
  2154 	if test -n "$convenience"; then
  2155 	  if test -n "$whole_archive_flag_spec"; then
  2156 	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  2157 	  else
  2158 	    gentop="$output_objdir/${outputname}x"
  2159 	    $show "${rm}r $gentop"
  2160 	    $run ${rm}r "$gentop"
  2161 	    $show "mkdir $gentop"
  2162 	    $run mkdir "$gentop"
  2163 	    status=$?
  2164 	    if test $status -ne 0 && test ! -d "$gentop"; then
  2165 	      exit $status
  2166 	    fi
  2167 	    generated="$generated $gentop"
  2168 
  2169 	    for xlib in $convenience; do
  2170 	      # Extract the objects.
  2171 	      case "$xlib" in
  2172 	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2173 	      *) xabs=`pwd`"/$xlib" ;;
  2174 	      esac
  2175 	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2176 	      xdir="$gentop/$xlib"
  2177 
  2178 	      $show "${rm}r $xdir"
  2179 	      $run ${rm}r "$xdir"
  2180 	      $show "mkdir $xdir"
  2181 	      $run mkdir "$xdir"
  2182 	      status=$?
  2183 	      if test $status -ne 0 && test ! -d "$xdir"; then
  2184 		exit $status
  2185 	      fi
  2186 	      $show "(cd $xdir && $AR x $xabs)"
  2187 	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2188 
  2189 	      libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2190 	    done
  2191 	  fi
  2192 	fi
  2193 
  2194 	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  2195 	  eval flag=\"$thread_safe_flag_spec\"
  2196 	  linkopts="$linkopts $flag"
  2197 	fi
  2198 
  2199 	# Do each of the archive commands.
  2200 	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  2201 	  eval cmds=\"$archive_expsym_cmds\"
  2202 	else
  2203 	  eval cmds=\"$archive_cmds\"
  2204 	fi
  2205 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  2206 	for cmd in $cmds; do
  2207 	  IFS="$save_ifs"
  2208 	  $show "$cmd"
  2209 	  $run eval "$cmd" || exit $?
  2210 	done
  2211 	IFS="$save_ifs"
  2212 
  2213 	# Create links to the real library.
  2214 	for linkname in $linknames; do
  2215 	  if test "$realname" != "$linkname"; then
  2216 	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  2217 	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  2218 	  fi
  2219 	done
  2220 
  2221 	# If -module or -export-dynamic was specified, set the dlname.
  2222 	if test "$module" = yes || test "$export_dynamic" = yes; then
  2223 	  # On all known operating systems, these are identical.
  2224 	  dlname="$soname"
  2225 	fi
  2226       fi
  2227       ;;
  2228 
  2229     *.lo | *.o | *.obj)
  2230       if test -n "$link_against_libtool_libs"; then
  2231 	$echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  2232 	exit 1
  2233       fi
  2234 
  2235       if test -n "$deplibs"; then
  2236 	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  2237       fi
  2238 
  2239       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2240 	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  2241       fi
  2242 
  2243       if test -n "$rpath"; then
  2244 	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  2245       fi
  2246 
  2247       if test -n "$xrpath"; then
  2248 	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  2249       fi
  2250 
  2251       if test -n "$vinfo"; then
  2252 	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  2253       fi
  2254 
  2255       if test -n "$release"; then
  2256 	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  2257       fi
  2258 
  2259       case "$output" in
  2260       *.lo)
  2261 	if test -n "$objs"; then
  2262 	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  2263 	  exit 1
  2264 	fi
  2265 	libobj="$output"
  2266 	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  2267 	;;
  2268       *)
  2269 	libobj=
  2270 	obj="$output"
  2271 	;;
  2272       esac
  2273 
  2274       # Delete the old objects.
  2275       $run $rm $obj $libobj
  2276 
  2277       # Objects from convenience libraries.  This assumes
  2278       # single-version convenience libraries.  Whenever we create
  2279       # different ones for PIC/non-PIC, this we'll have to duplicate
  2280       # the extraction.
  2281       reload_conv_objs=
  2282       gentop=
  2283       # reload_cmds runs $LD directly, so let us get rid of
  2284       # -Wl from whole_archive_flag_spec
  2285       wl= 
  2286 
  2287       if test -n "$convenience"; then
  2288 	if test -n "$whole_archive_flag_spec"; then
  2289 	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  2290 	else
  2291 	  gentop="$output_objdir/${obj}x"
  2292 	  $show "${rm}r $gentop"
  2293 	  $run ${rm}r "$gentop"
  2294 	  $show "mkdir $gentop"
  2295 	  $run mkdir "$gentop"
  2296 	  status=$?
  2297 	  if test $status -ne 0 && test ! -d "$gentop"; then
  2298 	    exit $status
  2299 	  fi
  2300 	  generated="$generated $gentop"
  2301 
  2302 	  for xlib in $convenience; do
  2303 	    # Extract the objects.
  2304 	    case "$xlib" in
  2305 	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2306 	    *) xabs=`pwd`"/$xlib" ;;
  2307 	    esac
  2308 	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2309 	    xdir="$gentop/$xlib"
  2310 
  2311 	    $show "${rm}r $xdir"
  2312 	    $run ${rm}r "$xdir"
  2313 	    $show "mkdir $xdir"
  2314 	    $run mkdir "$xdir"
  2315 	    status=$?
  2316 	    if test $status -ne 0 && test ! -d "$xdir"; then
  2317 	      exit $status
  2318 	    fi
  2319 	    $show "(cd $xdir && $AR x $xabs)"
  2320 	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2321 
  2322 	    reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2323 	  done
  2324 	fi
  2325       fi
  2326 
  2327       # Create the old-style object.
  2328       reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  2329 
  2330       output="$obj"
  2331       eval cmds=\"$reload_cmds\"
  2332       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  2333       for cmd in $cmds; do
  2334 	IFS="$save_ifs"
  2335 	$show "$cmd"
  2336 	$run eval "$cmd" || exit $?
  2337       done
  2338       IFS="$save_ifs"
  2339 
  2340       # Exit if we aren't doing a library object file.
  2341       if test -z "$libobj"; then
  2342 	if test -n "$gentop"; then
  2343 	  $show "${rm}r $gentop"
  2344 	  $run ${rm}r $gentop
  2345 	fi
  2346 
  2347 	exit 0
  2348       fi
  2349 
  2350       if test "$build_libtool_libs" != yes; then
  2351 	if test -n "$gentop"; then
  2352 	  $show "${rm}r $gentop"
  2353 	  $run ${rm}r $gentop
  2354 	fi
  2355 
  2356 	# Create an invalid libtool object if no PIC, so that we don't
  2357 	# accidentally link it into a program.
  2358 	$show "echo timestamp > $libobj"
  2359 	$run eval "echo timestamp > $libobj" || exit $?
  2360 	exit 0
  2361       fi
  2362 
  2363       if test -n "$pic_flag"; then
  2364 	# Only do commands if we really have different PIC objects.
  2365 	reload_objs="$libobjs $reload_conv_objs"
  2366 	output="$libobj"
  2367 	eval cmds=\"$reload_cmds\"
  2368 	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  2369 	for cmd in $cmds; do
  2370 	  IFS="$save_ifs"
  2371 	  $show "$cmd"
  2372 	  $run eval "$cmd" || exit $?
  2373 	done
  2374 	IFS="$save_ifs"
  2375       else
  2376 	# Just create a symlink.
  2377 	$show $rm $libobj
  2378 	$run $rm $libobj
  2379 	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  2380 	if test "X$xdir" = "X$libobj"; then
  2381 	  xdir="."
  2382 	else
  2383 	  xdir="$xdir"
  2384 	fi
  2385 	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  2386 	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2387 	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
  2388 	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
  2389       fi
  2390 
  2391       if test -n "$gentop"; then
  2392 	$show "${rm}r $gentop"
  2393 	$run ${rm}r $gentop
  2394       fi
  2395 
  2396       exit 0
  2397       ;;
  2398 
  2399     # Anything else should be a program.
  2400     *)
  2401       if test -n "$vinfo"; then
  2402 	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  2403       fi
  2404 
  2405       if test -n "$release"; then
  2406 	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  2407       fi
  2408 
  2409       if test "$preload" = yes; then
  2410 	if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
  2411 	   test "$dlopen_self_static" = unknown; then
  2412 	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  2413 	fi 
  2414       fi
  2415     
  2416       if test -n "$rpath$xrpath"; then
  2417 	# If the user specified any rpath flags, then add them.
  2418 	for libdir in $rpath $xrpath; do
  2419 	  # This is the magic to use -rpath.
  2420 	  case "$compile_rpath " in
  2421 	  *" $libdir "*) ;;
  2422 	  *) compile_rpath="$compile_rpath $libdir" ;;
  2423 	  esac
  2424 	  case "$finalize_rpath " in
  2425 	  *" $libdir "*) ;;
  2426 	  *) finalize_rpath="$finalize_rpath $libdir" ;;
  2427 	  esac
  2428 	done
  2429       fi
  2430 
  2431       # Now hardcode the library paths
  2432       rpath=
  2433       hardcode_libdirs=
  2434       for libdir in $compile_rpath $finalize_rpath; do
  2435 	if test -n "$hardcode_libdir_flag_spec"; then
  2436 	  if test -n "$hardcode_libdir_separator"; then
  2437 	    if test -z "$hardcode_libdirs"; then
  2438 	      hardcode_libdirs="$libdir"
  2439 	    else
  2440 	      # Just accumulate the unique libdirs.
  2441 	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2442 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2443 		;;
  2444 	      *)
  2445 		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2446 		;;
  2447 	      esac
  2448 	    fi
  2449 	  else
  2450 	    eval flag=\"$hardcode_libdir_flag_spec\"
  2451 	    rpath="$rpath $flag"
  2452 	  fi
  2453 	elif test -n "$runpath_var"; then
  2454 	  case "$perm_rpath " in
  2455 	  *" $libdir "*) ;;
  2456 	  *) perm_rpath="$perm_rpath $libdir" ;;
  2457 	  esac
  2458 	fi
  2459       done
  2460       # Substitute the hardcoded libdirs into the rpath.
  2461       if test -n "$hardcode_libdir_separator" &&
  2462 	 test -n "$hardcode_libdirs"; then
  2463 	libdir="$hardcode_libdirs"
  2464 	eval rpath=\" $hardcode_libdir_flag_spec\"
  2465       fi
  2466       compile_rpath="$rpath"
  2467 
  2468       rpath=
  2469       hardcode_libdirs=
  2470       for libdir in $finalize_rpath; do
  2471 	if test -n "$hardcode_libdir_flag_spec"; then
  2472 	  if test -n "$hardcode_libdir_separator"; then
  2473 	    if test -z "$hardcode_libdirs"; then
  2474 	      hardcode_libdirs="$libdir"
  2475 	    else
  2476 	      # Just accumulate the unique libdirs.
  2477 	      case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2478 	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2479 		;;
  2480 	      *)
  2481 		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2482 		;;
  2483 	      esac
  2484 	    fi
  2485 	  else
  2486 	    eval flag=\"$hardcode_libdir_flag_spec\"
  2487 	    rpath="$rpath $flag"
  2488 	  fi
  2489 	elif test -n "$runpath_var"; then
  2490 	  case "$finalize_perm_rpath " in
  2491 	  *" $libdir "*) ;;
  2492 	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  2493 	  esac
  2494 	fi
  2495       done
  2496       # Substitute the hardcoded libdirs into the rpath.
  2497       if test -n "$hardcode_libdir_separator" &&
  2498 	 test -n "$hardcode_libdirs"; then
  2499 	libdir="$hardcode_libdirs"
  2500 	eval rpath=\" $hardcode_libdir_flag_spec\"
  2501       fi
  2502       finalize_rpath="$rpath"
  2503 
  2504       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  2505       if test "X$output_objdir" = "X$output"; then
  2506 	output_objdir="$objdir"
  2507       else
  2508 	output_objdir="$output_objdir/$objdir"
  2509       fi
  2510 
  2511       # Create the binary in the object directory, then wrap it.
  2512       if test ! -d $output_objdir; then
  2513 	$show "$mkdir $output_objdir"
  2514 	$run $mkdir $output_objdir
  2515 	status=$?
  2516 	if test $status -ne 0 && test ! -d $output_objdir; then
  2517 	  exit $status
  2518 	fi
  2519       fi
  2520 
  2521       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  2522 	# Transform all the library objects into standard objects.
  2523 	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2524 	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2525       fi
  2526 
  2527       dlsyms=
  2528       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2529 	if test -n "$NM" && test -n "$global_symbol_pipe"; then
  2530 	  dlsyms="${outputname}S.c"
  2531 	else
  2532 	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  2533 	fi
  2534       fi
  2535 
  2536       if test -n "$dlsyms"; then
  2537 	case "$dlsyms" in
  2538 	"") ;;
  2539 	*.c)
  2540 	  # Discover the nlist of each of the dlfiles.
  2541 	  nlist="$output_objdir/${outputname}.nm"
  2542 
  2543 	  $show "$rm $nlist ${nlist}S ${nlist}T"
  2544 	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
  2545 
  2546 	  # Parse the name list into a source file.
  2547 	  $show "creating $output_objdir/$dlsyms"
  2548 
  2549 	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  2550 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  2551 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  2552 
  2553 #ifdef __cplusplus
  2554 extern \"C\" {
  2555 #endif
  2556 
  2557 /* Prevent the only kind of declaration conflicts we can make. */
  2558 #define lt_preloaded_symbols some_other_symbol
  2559 
  2560 /* External symbol declarations for the compiler. */\
  2561 "
  2562 
  2563 	  if test "$dlself" = yes; then
  2564 	    $show "generating symbol list for \`$output'"
  2565 
  2566 	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  2567 
  2568 	    # Add our own program objects to the symbol list.
  2569 	    progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2570 	    for arg in $progfiles; do
  2571 	      $show "extracting global C symbols from \`$arg'"
  2572 	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2573 	    done
  2574 
  2575 	    if test -n "$exclude_expsyms"; then
  2576 	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2577 	      $run eval '$mv "$nlist"T "$nlist"'
  2578 	    fi
  2579 	    
  2580 	    if test -n "$export_symbols_regex"; then
  2581 	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2582 	      $run eval '$mv "$nlist"T "$nlist"'
  2583 	    fi
  2584 
  2585 	    # Prepare the list of exported symbols
  2586 	    if test -z "$export_symbols"; then
  2587 	      export_symbols="$output_objdir/$output.exp"
  2588 	      $run $rm $export_symbols
  2589 	      $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2590 	    else
  2591 	      $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  2592 	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  2593 	      $run eval 'mv "$nlist"T "$nlist"'
  2594 	    fi
  2595 	  fi
  2596 
  2597 	  for arg in $dlprefiles; do
  2598 	    $show "extracting global C symbols from \`$arg'"
  2599 	    name=`echo "$arg" | sed -e 's%^.*/%%'`
  2600 	    $run eval 'echo ": $name " >> "$nlist"'
  2601 	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2602 	  done
  2603 
  2604 	  if test -z "$run"; then
  2605 	    # Make sure we have at least an empty file.
  2606 	    test -f "$nlist" || : > "$nlist"
  2607 
  2608 	    if test -n "$exclude_expsyms"; then
  2609 	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2610 	      $mv "$nlist"T "$nlist"
  2611 	    fi
  2612 
  2613 	    # Try sorting and uniquifying the output.
  2614 	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
  2615 	      :
  2616 	    else
  2617 	      grep -v "^: " < "$nlist" > "$nlist"S
  2618 	    fi
  2619 
  2620 	    if test -f "$nlist"S; then
  2621 	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  2622 	    else
  2623 	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
  2624 	    fi
  2625 
  2626 	    $echo >> "$output_objdir/$dlsyms" "\
  2627 
  2628 #undef lt_preloaded_symbols
  2629 
  2630 #if defined (__STDC__) && __STDC__
  2631 # define lt_ptr_t void *
  2632 #else
  2633 # define lt_ptr_t char *
  2634 # define const
  2635 #endif
  2636 
  2637 /* The mapping between symbol names and symbols. */
  2638 const struct {
  2639   const char *name;
  2640   lt_ptr_t address;
  2641 }
  2642 lt_preloaded_symbols[] =
  2643 {\
  2644 "
  2645 
  2646 	    sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
  2647 		-e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
  2648 		  < "$nlist" >> "$output_objdir/$dlsyms"
  2649 
  2650 	    $echo >> "$output_objdir/$dlsyms" "\
  2651   {0, (lt_ptr_t) 0}
  2652 };
  2653 
  2654 /* This works around a problem in FreeBSD linker */
  2655 #ifdef FREEBSD_WORKAROUND
  2656 static const void *lt_preloaded_setup() {
  2657   return lt_preloaded_symbols;
  2658 }
  2659 #endif
  2660 
  2661 #ifdef __cplusplus
  2662 }
  2663 #endif\
  2664 "
  2665 	  fi
  2666 
  2667 	  pic_flag_for_symtable=
  2668 	  case "$host" in
  2669 	  # compiling the symbol table file with pic_flag works around
  2670 	  # a FreeBSD bug that causes programs to crash when -lm is
  2671 	  # linked before any other PIC object.  But we must not use
  2672 	  # pic_flag when linking with -static.  The problem exists in
  2673 	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2674 	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  2675 	    case "$compile_command " in
  2676 	    *" -static "*) ;;
  2677 	    *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  2678 	    esac;;
  2679 	  *-*-hpux*)
  2680 	    case "$compile_command " in
  2681 	    *" -static "*) ;;
  2682 	    *) pic_flag_for_symtable=" $pic_flag -DPIC";;
  2683 	    esac
  2684 	  esac
  2685 
  2686 	  # Now compile the dynamic symbol file.
  2687 	  $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  2688 	  $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  2689 
  2690 	  # Clean up the generated files.
  2691 	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  2692 	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  2693 
  2694 	  # Transform the symbol file into the correct name.
  2695 	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2696 	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2697 	  ;;
  2698 	*)
  2699 	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  2700 	  exit 1
  2701 	  ;;
  2702 	esac
  2703       else
  2704 	# We keep going just in case the user didn't refer to
  2705 	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  2706 	# really was required.
  2707 
  2708 	# Nullify the symbol file.
  2709 	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  2710 	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  2711       fi
  2712 
  2713       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  2714 	# Replace the output file specification.
  2715 	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  2716 	link_command="$compile_command$compile_rpath"
  2717 
  2718 	# We have no uninstalled library dependencies, so finalize right now.
  2719 	$show "$link_command"
  2720 	$run eval "$link_command"
  2721 	status=$?
  2722 	
  2723 	# Delete the generated files.
  2724 	if test -n "$dlsyms"; then
  2725 	  $show "$rm $output_objdir/${outputname}S.${objext}"
  2726 	  $run $rm "$output_objdir/${outputname}S.${objext}"
  2727 	fi
  2728 
  2729 	exit $status
  2730       fi
  2731 
  2732       if test -n "$shlibpath_var"; then
  2733 	# We should set the shlibpath_var
  2734 	rpath=
  2735 	for dir in $temp_rpath; do
  2736 	  case "$dir" in
  2737 	  [\\/]* | [A-Za-z]:[\\/]*)
  2738 	    # Absolute path.
  2739 	    rpath="$rpath$dir:"
  2740 	    ;;
  2741 	  *)
  2742 	    # Relative path: add a thisdir entry.
  2743 	    rpath="$rpath\$thisdir/$dir:"
  2744 	    ;;
  2745 	  esac
  2746 	done
  2747 	temp_rpath="$rpath"
  2748       fi
  2749 
  2750       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  2751 	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  2752       fi
  2753       if test -n "$finalize_shlibpath"; then
  2754 	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  2755       fi
  2756 
  2757       compile_var=
  2758       finalize_var=
  2759       if test -n "$runpath_var"; then
  2760 	if test -n "$perm_rpath"; then
  2761 	  # We should set the runpath_var.
  2762 	  rpath=
  2763 	  for dir in $perm_rpath; do
  2764 	    rpath="$rpath$dir:"
  2765 	  done
  2766 	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2767 	fi
  2768 	if test -n "$finalize_perm_rpath"; then
  2769 	  # We should set the runpath_var.
  2770 	  rpath=
  2771 	  for dir in $finalize_perm_rpath; do
  2772 	    rpath="$rpath$dir:"
  2773 	  done
  2774 	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2775 	fi
  2776       fi
  2777 
  2778       if test "$hardcode_action" = relink; then
  2779 	# Fast installation is not supported
  2780 	link_command="$compile_var$compile_command$compile_rpath"
  2781 	relink_command="$finalize_var$finalize_command$finalize_rpath"
  2782 	
  2783 	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  2784 	$echo "$modename: \`$output' will be relinked during installation" 1>&2
  2785       else
  2786 	if test "$fast_install" != no; then
  2787 	  link_command="$finalize_var$compile_command$finalize_rpath"
  2788 	  if test "$fast_install" = yes; then
  2789 	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  2790 	  else
  2791 	    # fast_install is set to needless
  2792 	    relink_command=
  2793 	  fi
  2794 	else
  2795 	  link_command="$compile_var$compile_command$compile_rpath"
  2796 	  relink_command="$finalize_var$finalize_command$finalize_rpath"
  2797 	fi
  2798       fi
  2799 
  2800       # Replace the output file specification.
  2801       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  2802       
  2803       # Delete the old output files.
  2804       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  2805 
  2806       $show "$link_command"
  2807       $run eval "$link_command" || exit $?
  2808 
  2809       # Now create the wrapper script.
  2810       $show "creating $output"
  2811 
  2812       # Quote the relink command for shipping.
  2813       if test -n "$relink_command"; then
  2814 	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  2815       fi
  2816 
  2817       # Quote $echo for shipping.
  2818       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  2819 	case "$0" in
  2820 	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  2821 	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  2822 	esac
  2823 	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  2824       else
  2825 	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  2826       fi
  2827 
  2828       # Only actually do things if our run command is non-null.
  2829       if test -z "$run"; then
  2830 	# win32 will think the script is a binary if it has
  2831 	# a .exe suffix, so we strip it off here.
  2832 	case $output in
  2833 	  *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
  2834 	esac
  2835 	$rm $output
  2836 	trap "$rm $output; exit 1" 1 2 15
  2837 
  2838 	$echo > $output "\
  2839 #! $SHELL
  2840 
  2841 # $output - temporary wrapper script for $objdir/$outputname
  2842 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  2843 #
  2844 # The $output program cannot be directly executed until all the libtool
  2845 # libraries that it depends on are installed.
  2846 #
  2847 # This wrapper script should never be moved out of the build directory.
  2848 # If it is, it will not operate correctly.
  2849 
  2850 # Sed substitution that helps us do robust quoting.  It backslashifies
  2851 # metacharacters that are still active within double-quoted strings.
  2852 Xsed='sed -e 1s/^X//'
  2853 sed_quote_subst='$sed_quote_subst'
  2854 
  2855 # The HP-UX ksh and POSIX shell print the target directory to stdout
  2856 # if CDPATH is set.
  2857 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
  2858 
  2859 relink_command=\"$relink_command\"
  2860 
  2861 # This environment variable determines our operation mode.
  2862 if test \"\$libtool_install_magic\" = \"$magic\"; then
  2863   # install mode needs the following variable:
  2864   link_against_libtool_libs='$link_against_libtool_libs'
  2865 else
  2866   # When we are sourced in execute mode, \$file and \$echo are already set.
  2867   if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2868     echo=\"$qecho\"
  2869     file=\"\$0\"
  2870     # Make sure echo works.
  2871     if test \"X\$1\" = X--no-reexec; then
  2872       # Discard the --no-reexec flag, and continue.
  2873       shift
  2874     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  2875       # Yippee, \$echo works!
  2876       :
  2877     else
  2878       # Restart under the correct shell, and then maybe \$echo will work.
  2879       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  2880     fi
  2881   fi\
  2882 "
  2883 	$echo >> $output "\
  2884 
  2885   # Find the directory that this script lives in.
  2886   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  2887   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2888 
  2889   # Follow symbolic links until we get to the real thisdir.
  2890   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  2891   while test -n \"\$file\"; do
  2892     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  2893 
  2894     # If there was a directory component, then change thisdir.
  2895     if test \"x\$destdir\" != \"x\$file\"; then
  2896       case \"\$destdir\" in
  2897       [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
  2898       *) thisdir=\"\$thisdir/\$destdir\" ;;
  2899       esac
  2900     fi
  2901 
  2902     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  2903     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  2904   done
  2905 
  2906   # Try to get the absolute directory name.
  2907   absdir=\`cd \"\$thisdir\" && pwd\`
  2908   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2909 "
  2910 
  2911 	if test "$fast_install" = yes; then
  2912 	  echo >> $output "\
  2913   program=lt-'$outputname'
  2914   progdir=\"\$thisdir/$objdir\"
  2915   
  2916   if test ! -f \"\$progdir/\$program\" || \\
  2917      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
  2918        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2919 
  2920     file=\"\$\$-\$program\"
  2921 
  2922     if test ! -d \"\$progdir\"; then
  2923       $mkdir \"\$progdir\"
  2924     else
  2925       $rm \"\$progdir/\$file\"
  2926     fi"
  2927 
  2928 	  echo >> $output "\
  2929 
  2930     # relink executable if necessary
  2931     if test -n \"\$relink_command\"; then
  2932       if (cd \"\$thisdir\" && eval \$relink_command); then :
  2933       else
  2934 	$rm \"\$progdir/\$file\"
  2935 	exit 1
  2936       fi
  2937     fi
  2938 
  2939     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2940     { $rm \"\$progdir/\$program\";
  2941       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2942     $rm \"\$progdir/\$file\"
  2943   fi"
  2944 	else
  2945 	  echo >> $output "\
  2946   program='$outputname'
  2947   progdir=\"\$thisdir/$objdir\"
  2948 "
  2949 	fi
  2950 
  2951 	echo >> $output "\
  2952 
  2953   if test -f \"\$progdir/\$program\"; then"
  2954 
  2955 	# Export our shlibpath_var if we have one.
  2956 	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2957 	  $echo >> $output "\
  2958     # Add our own library path to $shlibpath_var
  2959     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2960 
  2961     # Some systems cannot cope with colon-terminated $shlibpath_var
  2962     # The second colon is a workaround for a bug in BeOS R4 sed
  2963     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  2964 
  2965     export $shlibpath_var
  2966 "
  2967 	fi
  2968 
  2969 	# fixup the dll searchpath if we need to.
  2970 	if test -n "$dllsearchpath"; then
  2971 	  $echo >> $output "\
  2972     # Add the dll search path components to the executable PATH
  2973     PATH=$dllsearchpath:\$PATH
  2974 "
  2975 	fi
  2976 
  2977 	$echo >> $output "\
  2978     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2979       # Run the actual program with our arguments.
  2980 "
  2981 	case $host in
  2982 	  # win32 systems need to use the prog path for dll
  2983 	  # lookup to work
  2984 	*-*-cygwin*)
  2985 	  $echo >> $output "\
  2986       exec \$progdir/\$program \${1+\"\$@\"}
  2987 "
  2988 	  ;;
  2989 
  2990 	# Backslashes separate directories on plain windows
  2991 	*-*-mingw | *-*-os2*)
  2992 	  $echo >> $output "\
  2993       exec \$progdir\\\\\$program \${1+\"\$@\"}
  2994 "
  2995 	  ;;
  2996 
  2997 	*)
  2998 	  $echo >> $output "\
  2999       # Export the path to the program.
  3000       PATH=\"\$progdir:\$PATH\"
  3001       export PATH
  3002 
  3003       exec \$program \${1+\"\$@\"}
  3004 "
  3005 	  ;;
  3006 	esac
  3007 	$echo >> $output "\
  3008       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  3009       exit 1
  3010     fi
  3011   else
  3012     # The program doesn't exist.
  3013     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  3014     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  3015     echo \"See the $PACKAGE documentation for more information.\" 1>&2
  3016     exit 1
  3017   fi
  3018 fi\
  3019 "
  3020 	chmod +x $output
  3021       fi
  3022       exit 0
  3023       ;;
  3024     esac
  3025 
  3026     # See if we need to build an old-fashioned archive.
  3027     for oldlib in $oldlibs; do
  3028 
  3029       if test "$build_libtool_libs" = convenience; then
  3030 	oldobjs="$libobjs_save"
  3031 	addlibs="$convenience"
  3032 	build_libtool_libs=no
  3033       else
  3034 	if test "$build_libtool_libs" = module; then
  3035 	  oldobjs="$libobjs_save"
  3036 	  build_libtool_libs=no
  3037 	else
  3038 	  oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  3039 	fi
  3040 	addlibs="$old_convenience"
  3041       fi
  3042 
  3043       if test -n "$addlibs"; then
  3044 	gentop="$output_objdir/${outputname}x"
  3045 	$show "${rm}r $gentop"
  3046 	$run ${rm}r "$gentop"
  3047 	$show "mkdir $gentop"
  3048 	$run mkdir "$gentop"
  3049 	status=$?
  3050 	if test $status -ne 0 && test ! -d "$gentop"; then
  3051 	  exit $status
  3052 	fi
  3053 	generated="$generated $gentop"
  3054 	  
  3055 	# Add in members from convenience archives.
  3056 	for xlib in $addlibs; do
  3057 	  # Extract the objects.
  3058 	  case "$xlib" in
  3059 	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  3060 	  *) xabs=`pwd`"/$xlib" ;;
  3061 	  esac
  3062 	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  3063 	  xdir="$gentop/$xlib"
  3064 
  3065 	  $show "${rm}r $xdir"
  3066 	  $run ${rm}r "$xdir"
  3067 	  $show "mkdir $xdir"
  3068 	  $run mkdir "$xdir"
  3069 	  status=$?
  3070 	  if test $status -ne 0 && test ! -d "$xdir"; then
  3071 	    exit $status
  3072 	  fi
  3073 	  $show "(cd $xdir && $AR x $xabs)"
  3074 	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  3075 
  3076 	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  3077 	done
  3078       fi
  3079 
  3080       # Do each command in the archive commands.
  3081       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  3082 	eval cmds=\"$old_archive_from_new_cmds\"
  3083       else
  3084 	# Ensure that we have .o objects in place in case we decided
  3085 	# not to build a shared library, and have fallen back to building
  3086 	# static libs even though --disable-static was passed!
  3087 	for oldobj in $oldobjs; do
  3088 	  if test ! -f $oldobj; then
  3089 	    xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
  3090 	    if test "X$xdir" = "X$oldobj"; then
  3091 	      xdir="."
  3092 	    else
  3093 	      xdir="$xdir"
  3094 	    fi
  3095 	    baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
  3096 	    obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  3097 	    $show "(cd $xdir && ${LN_S} $obj $baseobj)"
  3098 	    $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
  3099 	  fi
  3100 	done
  3101 
  3102 	eval cmds=\"$old_archive_cmds\"
  3103       fi
  3104       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3105       for cmd in $cmds; do
  3106 	IFS="$save_ifs"
  3107 	$show "$cmd"
  3108 	$run eval "$cmd" || exit $?
  3109       done
  3110       IFS="$save_ifs"
  3111     done
  3112 
  3113     if test -n "$generated"; then
  3114       $show "${rm}r$generated"
  3115       $run ${rm}r$generated
  3116     fi
  3117 
  3118     # Now create the libtool archive.
  3119     case "$output" in
  3120     *.la)
  3121       old_library=
  3122       test "$build_old_libs" = yes && old_library="$libname.$libext"
  3123       $show "creating $output"
  3124 
  3125       if test -n "$xrpath"; then
  3126 	temp_xrpath=
  3127 	for libdir in $xrpath; do
  3128 	  temp_xrpath="$temp_xrpath -R$libdir"
  3129 	done
  3130 	dependency_libs="$temp_xrpath $dependency_libs"
  3131       fi
  3132 
  3133       # Only create the output if not a dry run.
  3134       if test -z "$run"; then
  3135 	for installed in no yes; do
  3136 	  if test "$installed" = yes; then
  3137 	    if test -z "$install_libdir"; then
  3138 	      break
  3139 	    fi
  3140 	    output="$output_objdir/$outputname"i
  3141 	  fi
  3142 	  $rm $output
  3143 	  $echo > $output "\
  3144 # $outputname - a libtool library file
  3145 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  3146 #
  3147 # Please DO NOT delete this file!
  3148 # It is necessary for linking the library.
  3149 
  3150 # The name that we can dlopen(3).
  3151 dlname='$dlname'
  3152 
  3153 # Names of this library.
  3154 library_names='$library_names'
  3155 
  3156 # The name of the static archive.
  3157 old_library='$old_library'
  3158 
  3159 # Libraries that this one depends upon.
  3160 dependency_libs='$dependency_libs'
  3161 
  3162 # Version information for $libname.
  3163 current=$current
  3164 age=$age
  3165 revision=$revision
  3166 
  3167 # Is this an already installed library?
  3168 installed=$installed
  3169 
  3170 # Directory that this library needs to be installed in:
  3171 libdir='$install_libdir'\
  3172 "
  3173 	done
  3174       fi
  3175 
  3176       # Do a symbolic link so that the libtool archive can be found in
  3177       # LD_LIBRARY_PATH before the program is installed.
  3178       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  3179       $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  3180       ;;
  3181     esac
  3182     exit 0
  3183     ;;
  3184 
  3185   # libtool install mode
  3186   install)
  3187     modename="$modename: install"
  3188 
  3189     # There may be an optional sh(1) argument at the beginning of
  3190     # install_prog (especially on Windows NT).
  3191     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
  3192       # Aesthetically quote it.
  3193       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  3194       case "$arg" in
  3195       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  3196 	arg="\"$arg\""
  3197 	;;
  3198       esac
  3199       install_prog="$arg "
  3200       arg="$1"
  3201       shift
  3202     else
  3203       install_prog=
  3204       arg="$nonopt"
  3205     fi
  3206 
  3207     # The real first argument should be the name of the installation program.
  3208     # Aesthetically quote it.
  3209     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3210     case "$arg" in
  3211     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  3212       arg="\"$arg\""
  3213       ;;
  3214     esac
  3215     install_prog="$install_prog$arg"
  3216 
  3217     # We need to accept at least all the BSD install flags.
  3218     dest=
  3219     files=
  3220     opts=
  3221     prev=
  3222     install_type=
  3223     isdir=no
  3224     stripme=
  3225     for arg
  3226     do
  3227       if test -n "$dest"; then
  3228 	files="$files $dest"
  3229 	dest="$arg"
  3230 	continue
  3231       fi
  3232 
  3233       case "$arg" in
  3234       -d) isdir=yes ;;
  3235       -f) prev="-f" ;;
  3236       -g) prev="-g" ;;
  3237       -m) prev="-m" ;;
  3238       -o) prev="-o" ;;
  3239       -s)
  3240 	stripme=" -s"
  3241 	continue
  3242 	;;
  3243       -*) ;;
  3244 
  3245       *)
  3246 	# If the previous option needed an argument, then skip it.
  3247 	if test -n "$prev"; then
  3248 	  prev=
  3249 	else
  3250 	  dest="$arg"
  3251 	  continue
  3252 	fi
  3253 	;;
  3254       esac
  3255 
  3256       # Aesthetically quote the argument.
  3257       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3258       case "$arg" in
  3259       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
  3260 	arg="\"$arg\""
  3261 	;;
  3262       esac
  3263       install_prog="$install_prog $arg"
  3264     done
  3265 
  3266     if test -z "$install_prog"; then
  3267       $echo "$modename: you must specify an install program" 1>&2
  3268       $echo "$help" 1>&2
  3269       exit 1
  3270     fi
  3271 
  3272     if test -n "$prev"; then
  3273       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  3274       $echo "$help" 1>&2
  3275       exit 1
  3276     fi
  3277 
  3278     if test -z "$files"; then
  3279       if test -z "$dest"; then
  3280 	$echo "$modename: no file or destination specified" 1>&2
  3281       else
  3282 	$echo "$modename: you must specify a destination" 1>&2
  3283       fi
  3284       $echo "$help" 1>&2
  3285       exit 1
  3286     fi
  3287 
  3288     # Strip any trailing slash from the destination.
  3289     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  3290 
  3291     # Check to see that the destination is a directory.
  3292     test -d "$dest" && isdir=yes
  3293     if test "$isdir" = yes; then
  3294       destdir="$dest"
  3295       destname=
  3296     else
  3297       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  3298       test "X$destdir" = "X$dest" && destdir=.
  3299       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  3300 
  3301       # Not a directory, so check to see that there is only one file specified.
  3302       set dummy $files
  3303       if test $# -gt 2; then
  3304 	$echo "$modename: \`$dest' is not a directory" 1>&2
  3305 	$echo "$help" 1>&2
  3306 	exit 1
  3307       fi
  3308     fi
  3309     case "$destdir" in
  3310     [\\/]* | [A-Za-z]:[\\/]*) ;;
  3311     *)
  3312       for file in $files; do
  3313 	case "$file" in
  3314 	*.lo) ;;
  3315 	*)
  3316 	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  3317 	  $echo "$help" 1>&2
  3318 	  exit 1
  3319 	  ;;
  3320 	esac
  3321       done
  3322       ;;
  3323     esac
  3324 
  3325     # This variable tells wrapper scripts just to set variables rather
  3326     # than running their programs.
  3327     libtool_install_magic="$magic"
  3328 
  3329     staticlibs=
  3330     future_libdirs=
  3331     current_libdirs=
  3332     for file in $files; do
  3333 
  3334       # Do each installation.
  3335       case "$file" in
  3336       *.a | *.lib)
  3337 	# Do the static libraries later.
  3338 	staticlibs="$staticlibs $file"
  3339 	;;
  3340 
  3341       *.la)
  3342 	# Check to see that this really is a libtool archive.
  3343 	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3344 	else
  3345 	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  3346 	  $echo "$help" 1>&2
  3347 	  exit 1
  3348 	fi
  3349 
  3350 	library_names=
  3351 	old_library=
  3352 	# If there is no directory component, then add one.
  3353 	case "$file" in
  3354 	*/* | *\\*) . $file ;;
  3355 	*) . ./$file ;;
  3356 	esac
  3357 
  3358 	# Add the libdir to current_libdirs if it is the destination.
  3359 	if test "X$destdir" = "X$libdir"; then
  3360 	  case "$current_libdirs " in
  3361 	  *" $libdir "*) ;;
  3362 	  *) current_libdirs="$current_libdirs $libdir" ;;
  3363 	  esac
  3364 	else
  3365 	  # Note the libdir as a future libdir.
  3366 	  case "$future_libdirs " in
  3367 	  *" $libdir "*) ;;
  3368 	  *) future_libdirs="$future_libdirs $libdir" ;;
  3369 	  esac
  3370 	fi
  3371 
  3372 	dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  3373 	test "X$dir" = "X$file/" && dir=
  3374 	dir="$dir$objdir"
  3375 
  3376 	# See the names of the shared library.
  3377 	set dummy $library_names
  3378 	if test -n "$2"; then
  3379 	  realname="$2"
  3380 	  shift
  3381 	  shift
  3382 
  3383 	  # Install the shared library and build the symlinks.
  3384 	  $show "$install_prog $dir/$realname $destdir/$realname"
  3385 	  $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  3386 
  3387 	  if test $# -gt 0; then
  3388 	    # Delete the old symlinks, and create new ones.
  3389 	    for linkname
  3390 	    do
  3391 	      if test "$linkname" != "$realname"; then
  3392 		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3393 		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3394 	      fi
  3395 	    done
  3396 	  fi
  3397 
  3398 	  # Do each command in the postinstall commands.
  3399 	  lib="$destdir/$realname"
  3400 	  eval cmds=\"$postinstall_cmds\"
  3401 	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3402 	  for cmd in $cmds; do
  3403 	    IFS="$save_ifs"
  3404 	    $show "$cmd"
  3405 	    $run eval "$cmd" || exit $?
  3406 	  done
  3407 	  IFS="$save_ifs"
  3408 	fi
  3409 
  3410 	# Install the pseudo-library for information purposes.
  3411 	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3412 	instname="$dir/$name"i
  3413 	$show "$install_prog $instname $destdir/$name"
  3414 	$run eval "$install_prog $instname $destdir/$name" || exit $?
  3415 
  3416 	# Maybe install the static library, too.
  3417 	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  3418 	;;
  3419 
  3420       *.lo)
  3421 	# Install (i.e. copy) a libtool object.
  3422 
  3423 	# Figure out destination file name, if it wasn't already specified.
  3424 	if test -n "$destname"; then
  3425 	  destfile="$destdir/$destname"
  3426 	else
  3427 	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3428 	  destfile="$destdir/$destfile"
  3429 	fi
  3430 
  3431 	# Deduce the name of the destination old-style object file.
  3432 	case "$destfile" in
  3433 	*.lo)
  3434 	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  3435 	  ;;
  3436 	*.o | *.obj)
  3437 	  staticdest="$destfile"
  3438 	  destfile=
  3439 	  ;;
  3440 	*)
  3441 	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  3442 	  $echo "$help" 1>&2
  3443 	  exit 1
  3444 	  ;;
  3445 	esac
  3446 
  3447 	# Install the libtool object if requested.
  3448 	if test -n "$destfile"; then
  3449 	  $show "$install_prog $file $destfile"
  3450 	  $run eval "$install_prog $file $destfile" || exit $?
  3451 	fi
  3452 
  3453 	# Install the old object if enabled.
  3454 	if test "$build_old_libs" = yes; then
  3455 	  # Deduce the name of the old-style object file.
  3456 	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  3457 
  3458 	  $show "$install_prog $staticobj $staticdest"
  3459 	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  3460 	fi
  3461 	exit 0
  3462 	;;
  3463 
  3464       *)
  3465 	# Figure out destination file name, if it wasn't already specified.
  3466 	if test -n "$destname"; then
  3467 	  destfile="$destdir/$destname"
  3468 	else
  3469 	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3470 	  destfile="$destdir/$destfile"
  3471 	fi
  3472 
  3473 	# Do a test to see if this is really a libtool program.
  3474 	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3475 	  link_against_libtool_libs=
  3476 	  relink_command=
  3477 
  3478 	  # If there is no directory component, then add one.
  3479 	  case "$file" in
  3480 	  */* | *\\*) . $file ;;
  3481 	  *) . ./$file ;;
  3482 	  esac
  3483 
  3484 	  # Check the variables that should have been set.
  3485 	  if test -z "$link_against_libtool_libs"; then
  3486 	    $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  3487 	    exit 1
  3488 	  fi
  3489 
  3490 	  finalize=yes
  3491 	  for lib in $link_against_libtool_libs; do
  3492 	    # Check to see that each library is installed.
  3493 	    libdir=
  3494 	    if test -f "$lib"; then
  3495 	      # If there is no directory component, then add one.
  3496 	      case "$lib" in
  3497 	      */* | *\\*) . $lib ;;
  3498 	      *) . ./$lib ;;
  3499 	      esac
  3500 	    fi
  3501 	    libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  3502 	    if test -n "$libdir" && test ! -f "$libfile"; then
  3503 	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  3504 	      finalize=no
  3505 	    fi
  3506 	  done
  3507 
  3508 	  outputname=
  3509 	  if test "$fast_install" = no && test -n "$relink_command"; then
  3510 	    if test "$finalize" = yes && test -z "$run"; then
  3511 	      tmpdir="/tmp"
  3512 	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
  3513 	      tmpdir="$tmpdir/libtool-$$"
  3514 	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  3515 	      else
  3516 		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  3517 		continue
  3518 	      fi
  3519 	      outputname="$tmpdir/$file"
  3520 	      # Replace the output file specification.
  3521 	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  3522 
  3523 	      $show "$relink_command"
  3524 	      if $run eval "$relink_command"; then :
  3525 	      else
  3526 		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  3527 		${rm}r "$tmpdir"
  3528 		continue
  3529 	      fi
  3530 	      file="$outputname"
  3531 	    else
  3532 	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
  3533 	    fi
  3534 	  else
  3535 	    # Install the binary that we compiled earlier.
  3536 	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  3537 	  fi
  3538 	fi
  3539 
  3540 	$show "$install_prog$stripme $file $destfile"
  3541 	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  3542 	test -n "$outputname" && ${rm}r "$tmpdir"
  3543 	;;
  3544       esac
  3545     done
  3546 
  3547     for file in $staticlibs; do
  3548       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3549 
  3550       # Set up the ranlib parameters.
  3551       oldlib="$destdir/$name"
  3552 
  3553       $show "$install_prog $file $oldlib"
  3554       $run eval "$install_prog \$file \$oldlib" || exit $?
  3555 
  3556       # Do each command in the postinstall commands.
  3557       eval cmds=\"$old_postinstall_cmds\"
  3558       IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3559       for cmd in $cmds; do
  3560 	IFS="$save_ifs"
  3561 	$show "$cmd"
  3562 	$run eval "$cmd" || exit $?
  3563       done
  3564       IFS="$save_ifs"
  3565     done
  3566 
  3567     if test -n "$future_libdirs"; then
  3568       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  3569     fi
  3570 
  3571     if test -n "$current_libdirs"; then
  3572       # Maybe just do a dry run.
  3573       test -n "$run" && current_libdirs=" -n$current_libdirs"
  3574       exec $SHELL $0 --finish$current_libdirs
  3575       exit 1
  3576     fi
  3577 
  3578     exit 0
  3579     ;;
  3580 
  3581   # libtool finish mode
  3582   finish)
  3583     modename="$modename: finish"
  3584     libdirs="$nonopt"
  3585     admincmds=
  3586 
  3587     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3588       for dir
  3589       do
  3590 	libdirs="$libdirs $dir"
  3591       done
  3592 
  3593       for libdir in $libdirs; do
  3594 	if test -n "$finish_cmds"; then
  3595 	  # Do each command in the finish commands.
  3596 	  eval cmds=\"$finish_cmds\"
  3597 	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3598 	  for cmd in $cmds; do
  3599 	    IFS="$save_ifs"
  3600 	    $show "$cmd"
  3601 	    $run eval "$cmd" || admincmds="$admincmds
  3602        $cmd"
  3603 	  done
  3604 	  IFS="$save_ifs"
  3605 	fi
  3606 	if test -n "$finish_eval"; then
  3607 	  # Do the single finish_eval.
  3608 	  eval cmds=\"$finish_eval\"
  3609 	  $run eval "$cmds" || admincmds="$admincmds
  3610        $cmds"
  3611 	fi
  3612       done
  3613     fi
  3614 
  3615     # Exit here if they wanted silent mode.
  3616     test "$show" = : && exit 0
  3617 
  3618     echo "----------------------------------------------------------------------"
  3619     echo "Libraries have been installed in:"
  3620     for libdir in $libdirs; do
  3621       echo "   $libdir"
  3622     done
  3623     echo
  3624     echo "If you ever happen to want to link against installed libraries"
  3625     echo "in a given directory, LIBDIR, you must either use libtool, and"
  3626     echo "specify the full pathname of the library, or use \`-LLIBDIR'"
  3627     echo "flag during linking and do at least one of the following:"
  3628     if test -n "$shlibpath_var"; then
  3629       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  3630       echo "     during execution"
  3631     fi
  3632     if test -n "$runpath_var"; then
  3633       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  3634       echo "     during linking"
  3635     fi
  3636     if test -n "$hardcode_libdir_flag_spec"; then
  3637       libdir=LIBDIR
  3638       eval flag=\"$hardcode_libdir_flag_spec\"
  3639 
  3640       echo "   - use the \`$flag' linker flag"
  3641     fi
  3642     if test -n "$admincmds"; then
  3643       echo "   - have your system administrator run these commands:$admincmds"
  3644     fi
  3645     if test -f /etc/ld.so.conf; then
  3646       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  3647     fi
  3648     echo
  3649     echo "See any operating system documentation about shared libraries for"
  3650     echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3651     echo "----------------------------------------------------------------------"
  3652     exit 0
  3653     ;;
  3654 
  3655   # libtool execute mode
  3656   execute)
  3657     modename="$modename: execute"
  3658 
  3659     # The first argument is the command name.
  3660     cmd="$nonopt"
  3661     if test -z "$cmd"; then
  3662       $echo "$modename: you must specify a COMMAND" 1>&2
  3663       $echo "$help"
  3664       exit 1
  3665     fi
  3666 
  3667     # Handle -dlopen flags immediately.
  3668     for file in $execute_dlfiles; do
  3669       if test ! -f "$file"; then
  3670 	$echo "$modename: \`$file' is not a file" 1>&2
  3671 	$echo "$help" 1>&2
  3672 	exit 1
  3673       fi
  3674 
  3675       dir=
  3676       case "$file" in
  3677       *.la)
  3678 	# Check to see that this really is a libtool archive.
  3679 	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3680 	else
  3681 	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  3682 	  $echo "$help" 1>&2
  3683 	  exit 1
  3684 	fi
  3685 
  3686 	# Read the libtool library.
  3687 	dlname=
  3688 	library_names=
  3689 
  3690 	# If there is no directory component, then add one.
  3691 	case "$file" in
  3692 	*/* | *\\*) . $file ;;
  3693 	*) . ./$file ;;
  3694 	esac
  3695 
  3696 	# Skip this library if it cannot be dlopened.
  3697 	if test -z "$dlname"; then
  3698 	  # Warn if it was a shared library.
  3699 	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  3700 	  continue
  3701 	fi
  3702 
  3703 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3704 	test "X$dir" = "X$file" && dir=.
  3705 
  3706 	if test -f "$dir/$objdir/$dlname"; then
  3707 	  dir="$dir/$objdir"
  3708 	else
  3709 	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  3710 	  exit 1
  3711 	fi
  3712 	;;
  3713 
  3714       *.lo)
  3715 	# Just add the directory containing the .lo file.
  3716 	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3717 	test "X$dir" = "X$file" && dir=.
  3718 	;;
  3719 
  3720       *)
  3721 	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  3722 	continue
  3723 	;;
  3724       esac
  3725 
  3726       # Get the absolute pathname.
  3727       absdir=`cd "$dir" && pwd`
  3728       test -n "$absdir" && dir="$absdir"
  3729 
  3730       # Now add the directory to shlibpath_var.
  3731       if eval "test -z \"\$$shlibpath_var\""; then
  3732 	eval "$shlibpath_var=\"\$dir\""
  3733       else
  3734 	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3735       fi
  3736     done
  3737 
  3738     # This variable tells wrapper scripts just to set shlibpath_var
  3739     # rather than running their programs.
  3740     libtool_execute_magic="$magic"
  3741 
  3742     # Check if any of the arguments is a wrapper script.
  3743     args=
  3744     for file
  3745     do
  3746       case "$file" in
  3747       -*) ;;
  3748       *)
  3749 	# Do a test to see if this is really a libtool program.
  3750 	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3751 	  # If there is no directory component, then add one.
  3752 	  case "$file" in
  3753 	  */* | *\\*) . $file ;;
  3754 	  *) . ./$file ;;
  3755 	  esac
  3756 
  3757 	  # Transform arg to wrapped name.
  3758 	  file="$progdir/$program"
  3759 	fi
  3760 	;;
  3761       esac
  3762       # Quote arguments (to preserve shell metacharacters).
  3763       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  3764       args="$args \"$file\""
  3765     done
  3766 
  3767     if test -z "$run"; then
  3768       if test -n "$shlibpath_var"; then
  3769         # Export the shlibpath_var.
  3770         eval "export $shlibpath_var"
  3771       fi
  3772 
  3773       # Restore saved enviroment variables
  3774       if test "${save_LC_ALL+set}" = set; then
  3775 	LC_ALL="$save_LC_ALL"; export LC_ALL
  3776       fi
  3777       if test "${save_LANG+set}" = set; then
  3778 	LANG="$save_LANG"; export LANG
  3779       fi
  3780 
  3781       # Now actually exec the command.
  3782       eval "exec \$cmd$args"
  3783 
  3784       $echo "$modename: cannot exec \$cmd$args"
  3785       exit 1
  3786     else
  3787       # Display what would be done.
  3788       if test -n "$shlibpath_var"; then
  3789         eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  3790         $echo "export $shlibpath_var"
  3791       fi
  3792       $echo "$cmd$args"
  3793       exit 0
  3794     fi
  3795     ;;
  3796 
  3797   # libtool uninstall mode
  3798   uninstall)
  3799     modename="$modename: uninstall"
  3800     rm="$nonopt"
  3801     files=
  3802 
  3803     for arg
  3804     do
  3805       case "$arg" in
  3806       -*) rm="$rm $arg" ;;
  3807       *) files="$files $arg" ;;
  3808       esac
  3809     done
  3810 
  3811     if test -z "$rm"; then
  3812       $echo "$modename: you must specify an RM program" 1>&2
  3813       $echo "$help" 1>&2
  3814       exit 1
  3815     fi
  3816 
  3817     for file in $files; do
  3818       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3819       test "X$dir" = "X$file" && dir=.
  3820       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3821 
  3822       rmfiles="$file"
  3823 
  3824       case "$name" in
  3825       *.la)
  3826 	# Possibly a libtool archive, so verify it.
  3827 	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3828 	  . $dir/$name
  3829 
  3830 	  # Delete the libtool libraries and symlinks.
  3831 	  for n in $library_names; do
  3832 	    rmfiles="$rmfiles $dir/$n"
  3833 	  done
  3834 	  test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  3835 
  3836 	  $show "$rm $rmfiles"
  3837 	  $run $rm $rmfiles
  3838 
  3839 	  if test -n "$library_names"; then
  3840 	    # Do each command in the postuninstall commands.
  3841 	    eval cmds=\"$postuninstall_cmds\"
  3842 	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3843 	    for cmd in $cmds; do
  3844 	      IFS="$save_ifs"
  3845 	      $show "$cmd"
  3846 	      $run eval "$cmd"
  3847 	    done
  3848 	    IFS="$save_ifs"
  3849 	  fi
  3850 
  3851 	  if test -n "$old_library"; then
  3852 	    # Do each command in the old_postuninstall commands.
  3853 	    eval cmds=\"$old_postuninstall_cmds\"
  3854 	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
  3855 	    for cmd in $cmds; do
  3856 	      IFS="$save_ifs"
  3857 	      $show "$cmd"
  3858 	      $run eval "$cmd"
  3859 	    done
  3860 	    IFS="$save_ifs"
  3861 	  fi
  3862 
  3863 	  # FIXME: should reinstall the best remaining shared library.
  3864 	fi
  3865 	;;
  3866 
  3867       *.lo)
  3868 	if test "$build_old_libs" = yes; then
  3869 	  oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  3870 	  rmfiles="$rmfiles $dir/$oldobj"
  3871 	fi
  3872 	$show "$rm $rmfiles"
  3873 	$run $rm $rmfiles
  3874 	;;
  3875 
  3876       *)
  3877 	$show "$rm $rmfiles"
  3878 	$run $rm $rmfiles
  3879 	;;
  3880       esac
  3881     done
  3882     exit 0
  3883     ;;
  3884 
  3885   "")
  3886     $echo "$modename: you must specify a MODE" 1>&2
  3887     $echo "$generic_help" 1>&2
  3888     exit 1
  3889     ;;
  3890   esac
  3891 
  3892   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3893   $echo "$generic_help" 1>&2
  3894   exit 1
  3895 fi # test -z "$show_help"
  3896 
  3897 # We need to display help for each of the modes.
  3898 case "$mode" in
  3899 "") $echo \
  3900 "Usage: $modename [OPTION]... [MODE-ARG]...
  3901 
  3902 Provide generalized library-building support services.
  3903 
  3904     --config          show all configuration variables
  3905     --debug           enable verbose shell tracing
  3906 -n, --dry-run         display commands without modifying any files
  3907     --features        display basic configuration information and exit
  3908     --finish          same as \`--mode=finish'
  3909     --help            display this help message and exit
  3910     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  3911     --quiet           same as \`--silent'
  3912     --silent          don't print informational messages
  3913     --version         print version information
  3914 
  3915 MODE must be one of the following:
  3916 
  3917       compile         compile a source file into a libtool object
  3918       execute         automatically set library path, then run a program
  3919       finish          complete the installation of libtool libraries
  3920       install         install libraries or executables
  3921       link            create a library or an executable
  3922       uninstall       remove libraries from an installed directory
  3923 
  3924 MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  3925 a more detailed description of MODE."
  3926   exit 0
  3927   ;;
  3928 
  3929 compile)
  3930   $echo \
  3931 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3932 
  3933 Compile a source file into a libtool library object.
  3934 
  3935 This mode accepts the following additional options:
  3936 
  3937   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  3938   -static           always build a \`.o' file suitable for static linking
  3939 
  3940 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  3941 from the given SOURCEFILE.
  3942 
  3943 The output file name is determined by removing the directory component from
  3944 SOURCEFILE, then substituting the C source code suffix \`.c' with the
  3945 library object suffix, \`.lo'."
  3946   ;;
  3947 
  3948 execute)
  3949   $echo \
  3950 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  3951 
  3952 Automatically set library path, then run a program.
  3953 
  3954 This mode accepts the following additional options:
  3955 
  3956   -dlopen FILE      add the directory containing FILE to the library path
  3957 
  3958 This mode sets the library path environment variable according to \`-dlopen'
  3959 flags.
  3960 
  3961 If any of the ARGS are libtool executable wrappers, then they are translated
  3962 into their corresponding uninstalled binary, and any of their required library
  3963 directories are added to the library path.
  3964 
  3965 Then, COMMAND is executed, with ARGS as arguments."
  3966   ;;
  3967 
  3968 finish)
  3969   $echo \
  3970 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  3971 
  3972 Complete the installation of libtool libraries.
  3973 
  3974 Each LIBDIR is a directory that contains libtool libraries.
  3975 
  3976 The commands that this mode executes may require superuser privileges.  Use
  3977 the \`--dry-run' option if you just want to see what would be executed."
  3978   ;;
  3979 
  3980 install)
  3981   $echo \
  3982 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  3983 
  3984 Install executables or libraries.
  3985 
  3986 INSTALL-COMMAND is the installation command.  The first component should be
  3987 either the \`install' or \`cp' program.
  3988 
  3989 The rest of the components are interpreted as arguments to that command (only
  3990 BSD-compatible install options are recognized)."
  3991   ;;
  3992 
  3993 link)
  3994   $echo \
  3995 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  3996 
  3997 Link object files or libraries together to form another library, or to
  3998 create an executable program.
  3999 
  4000 LINK-COMMAND is a command using the C compiler that you would use to create
  4001 a program from several object files.
  4002 
  4003 The following components of LINK-COMMAND are treated specially:
  4004 
  4005   -all-static       do not do any dynamic linking at all
  4006   -avoid-version    do not add a version suffix if possible
  4007   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  4008   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  4009   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  4010   -export-symbols SYMFILE
  4011 		    try to export only the symbols listed in SYMFILE
  4012   -export-symbols-regex REGEX
  4013 		    try to export only the symbols matching REGEX
  4014   -LLIBDIR          search LIBDIR for required installed libraries
  4015   -lNAME            OUTPUT-FILE requires the installed library libNAME
  4016   -module           build a library that can dlopened
  4017   -no-undefined     declare that a library does not refer to external symbols
  4018   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  4019   -release RELEASE  specify package release information
  4020   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  4021   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  4022   -static           do not do any dynamic linking of libtool libraries
  4023   -version-info CURRENT[:REVISION[:AGE]]
  4024 		    specify library version info [each variable defaults to 0]
  4025 
  4026 All other options (arguments beginning with \`-') are ignored.
  4027 
  4028 Every other argument is treated as a filename.  Files ending in \`.la' are
  4029 treated as uninstalled libtool libraries, other files are standard or library
  4030 object files.
  4031 
  4032 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  4033 only library objects (\`.lo' files) may be specified, and \`-rpath' is
  4034 required, except when creating a convenience library.
  4035 
  4036 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  4037 using \`ar' and \`ranlib', or on Windows using \`lib'.
  4038 
  4039 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  4040 is created, otherwise an executable program is created."
  4041   ;;
  4042 
  4043 uninstall)
  4044   $echo \
  4045 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  4046 
  4047 Remove libraries from an installation directory.
  4048 
  4049 RM is the name of the program to use to delete files associated with each FILE
  4050 (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  4051 to RM.
  4052 
  4053 If FILE is a libtool library, all the files associated with it are deleted.
  4054 Otherwise, only FILE itself is deleted using RM."
  4055   ;;
  4056 
  4057 *)
  4058   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  4059   $echo "$help" 1>&2
  4060   exit 1
  4061   ;;
  4062 esac
  4063 
  4064 echo
  4065 $echo "Try \`$modename --help' for more information about other modes."
  4066 
  4067 exit 0
  4068 
  4069 # Local Variables:
  4070 # mode:shell-script
  4071 # sh-indentation:2
  4072 # End: