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