/[public]/psiconv/trunk/ltmain.sh
ViewVC logotype

Diff of /psiconv/trunk/ltmain.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2 Revision 116
1# ltmain.sh - Provide generalized library-building support services. 1# ltmain.sh - Provide generalized library-building support services.
2# NOTE: Changing this file will not affect anything until you rerun ltconfig. 2# NOTE: Changing this file will not affect anything until you rerun configure.
3# 3#
4# Copyright (C) 1996-1999 Free Software Foundation, Inc. 4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5# Free Software Foundation, Inc.
5# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6# 7#
7# This program is free software; you can redistribute it and/or modify 8# 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# 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# the Free Software Foundation; either version 2 of the License, or
52modename="$progname" 53modename="$progname"
53 54
54# Constants. 55# Constants.
55PROGRAM=ltmain.sh 56PROGRAM=ltmain.sh
56PACKAGE=libtool 57PACKAGE=libtool
57VERSION=1.3.3 58VERSION=1.4
58TIMESTAMP=" (1.385.2.181 1999/07/02 15:49:11)" 59TIMESTAMP=" (1.920 2001/04/24 23:26:18)"
59 60
60default_mode= 61default_mode=
61help="Try \`$progname --help' for more information." 62help="Try \`$progname --help' for more information."
62magic="%%%MAGIC variable%%%" 63magic="%%%MAGIC variable%%%"
63mkdir="mkdir" 64mkdir="mkdir"
81fi 82fi
82if test "${LANG+set}" = set; then 83if test "${LANG+set}" = set; then
83 save_LANG="$LANG"; LANG=C; export LANG 84 save_LANG="$LANG"; LANG=C; export LANG
84fi 85fi
85 86
86if test "$LTCONFIG_VERSION" != "$VERSION"; then
87 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
88 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
89 exit 1
90fi
91
92if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 87if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
93 echo "$modename: not configured to build any kind of library" 1>&2 88 echo "$modename: not configured to build any kind of library" 1>&2
94 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 89 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
95 exit 1 90 exit 1
96fi 91fi
111while test $# -gt 0 106while test $# -gt 0
112do 107do
113 arg="$1" 108 arg="$1"
114 shift 109 shift
115 110
116 case "$arg" in 111 case $arg in
117 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 112 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
118 *) optarg= ;; 113 *) optarg= ;;
119 esac 114 esac
120 115
121 # If the previous option needs an argument, assign it. 116 # If the previous option needs an argument, assign it.
122 if test -n "$prev"; then 117 if test -n "$prev"; then
123 case "$prev" in 118 case $prev in
124 execute_dlfiles) 119 execute_dlfiles)
125 eval "$prev=\"\$$prev \$arg\"" 120 execute_dlfiles="$execute_dlfiles $arg"
126 ;; 121 ;;
127 *) 122 *)
128 eval "$prev=\$arg" 123 eval "$prev=\$arg"
129 ;; 124 ;;
130 esac 125 esac
133 prevopt= 128 prevopt=
134 continue 129 continue
135 fi 130 fi
136 131
137 # Have we seen a non-optional argument yet? 132 # Have we seen a non-optional argument yet?
138 case "$arg" in 133 case $arg in
139 --help) 134 --help)
140 show_help=yes 135 show_help=yes
141 ;; 136 ;;
142 137
143 --version) 138 --version)
144 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 139 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
145 exit 0 140 exit 0
146 ;; 141 ;;
147 142
148 --config) 143 --config)
149 sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 144 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
150 exit 0 145 exit 0
151 ;; 146 ;;
152 147
153 --debug) 148 --debug)
154 echo "$progname: enabling shell trace mode" 149 echo "$progname: enabling shell trace mode"
209 204
210if test -z "$show_help"; then 205if test -z "$show_help"; then
211 206
212 # Infer the operation mode. 207 # Infer the operation mode.
213 if test -z "$mode"; then 208 if test -z "$mode"; then
214 case "$nonopt" in 209 case $nonopt in
215 *cc | *++ | gcc* | *-gcc*) 210 *cc | *++ | gcc* | *-gcc*)
216 mode=link 211 mode=link
217 for arg 212 for arg
218 do 213 do
219 case "$arg" in 214 case $arg in
220 -c) 215 -c)
221 mode=compile 216 mode=compile
222 break 217 break
223 ;; 218 ;;
224 esac 219 esac
259 # Change the help message to a mode-specific one. 254 # Change the help message to a mode-specific one.
260 generic_help="$help" 255 generic_help="$help"
261 help="Try \`$modename --help --mode=$mode' for more information." 256 help="Try \`$modename --help --mode=$mode' for more information."
262 257
263 # These modes are in order of execution frequency so that they run quickly. 258 # These modes are in order of execution frequency so that they run quickly.
264 case "$mode" in 259 case $mode in
265 # libtool compile mode 260 # libtool compile mode
266 compile) 261 compile)
267 modename="$modename: compile" 262 modename="$modename: compile"
268 # Get the compilation command and the source file. 263 # Get the compilation command and the source file.
269 base_compile= 264 base_compile=
265 prev=
270 lastarg= 266 lastarg=
271 srcfile="$nonopt" 267 srcfile="$nonopt"
272 suppress_output= 268 suppress_output=
273 269
274 user_target=no 270 user_target=no
275 for arg 271 for arg
276 do 272 do
273 case $prev in
274 "") ;;
275 xcompiler)
276 # Aesthetically quote the previous argument.
277 prev=
278 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
279
280 case $arg in
281 # Double-quote args containing other shell metacharacters.
282 # Many Bourne shells cannot handle close brackets correctly
283 # in scan sets, so we specify it separately.
284 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
285 arg="\"$arg\""
286 ;;
287 esac
288
289 # Add the previous argument to base_compile.
290 if test -z "$base_compile"; then
291 base_compile="$lastarg"
292 else
293 base_compile="$base_compile $lastarg"
294 fi
295 continue
296 ;;
297 esac
298
277 # Accept any command-line options. 299 # Accept any command-line options.
278 case "$arg" in 300 case $arg in
279 -o) 301 -o)
280 if test "$user_target" != "no"; then 302 if test "$user_target" != "no"; then
281 $echo "$modename: you cannot specify \`-o' more than once" 1>&2 303 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
282 exit 1 304 exit 1
283 fi 305 fi
286 308
287 -static) 309 -static)
288 build_old_libs=yes 310 build_old_libs=yes
289 continue 311 continue
290 ;; 312 ;;
313
314 -prefer-pic)
315 pic_mode=yes
316 continue
317 ;;
318
319 -prefer-non-pic)
320 pic_mode=no
321 continue
322 ;;
323
324 -Xcompiler)
325 prev=xcompiler
326 continue
327 ;;
328
329 -Wc,*)
330 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
331 lastarg=
332 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
333 for arg in $args; do
334 IFS="$save_ifs"
335
336 # Double-quote args containing other shell metacharacters.
337 # Many Bourne shells cannot handle close brackets correctly
338 # in scan sets, so we specify it separately.
339 case $arg in
340 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
341 arg="\"$arg\""
342 ;;
343 esac
344 lastarg="$lastarg $arg"
345 done
346 IFS="$save_ifs"
347 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
348
349 # Add the arguments to base_compile.
350 if test -z "$base_compile"; then
351 base_compile="$lastarg"
352 else
353 base_compile="$base_compile $lastarg"
354 fi
355 continue
356 ;;
291 esac 357 esac
292 358
293 case "$user_target" in 359 case $user_target in
294 next) 360 next)
295 # The next one is the -o target name 361 # The next one is the -o target name
296 user_target=yes 362 user_target=yes
297 continue 363 continue
298 ;; 364 ;;
314 # These are the only characters that are still specially 380 # These are the only characters that are still specially
315 # interpreted inside of double-quoted scrings. 381 # interpreted inside of double-quoted scrings.
316 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 382 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
317 383
318 # Double-quote args containing other shell metacharacters. 384 # Double-quote args containing other shell metacharacters.
319 # Many Bourne shells cannot handle close brackets correctly in scan 385 # Many Bourne shells cannot handle close brackets correctly
320 # sets, so we specify it separately. 386 # in scan sets, so we specify it separately.
321 case "$lastarg" in 387 case $lastarg in
322 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 388 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
323 lastarg="\"$lastarg\"" 389 lastarg="\"$lastarg\""
324 ;; 390 ;;
325 esac 391 esac
326 392
327 # Add the previous argument to base_compile. 393 # Add the previous argument to base_compile.
330 else 396 else
331 base_compile="$base_compile $lastarg" 397 base_compile="$base_compile $lastarg"
332 fi 398 fi
333 done 399 done
334 400
335 case "$user_target" in 401 case $user_target in
336 set) 402 set)
337 ;; 403 ;;
338 no) 404 no)
339 # Get the name of the library object. 405 # Get the name of the library object.
340 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 406 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
346 esac 412 esac
347 413
348 # Recognize several different file suffixes. 414 # Recognize several different file suffixes.
349 # If the user specifies -o file.o, it is replaced with file.lo 415 # If the user specifies -o file.o, it is replaced with file.lo
350 xform='[cCFSfmso]' 416 xform='[cCFSfmso]'
351 case "$libobj" in 417 case $libobj in
352 *.ada) xform=ada ;; 418 *.ada) xform=ada ;;
353 *.adb) xform=adb ;; 419 *.adb) xform=adb ;;
354 *.ads) xform=ads ;; 420 *.ads) xform=ads ;;
355 *.asm) xform=asm ;; 421 *.asm) xform=asm ;;
356 *.c++) xform=c++ ;; 422 *.c++) xform=c++ ;;
361 *.for) xform=for ;; 427 *.for) xform=for ;;
362 esac 428 esac
363 429
364 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 430 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
365 431
366 case "$libobj" in 432 case $libobj in
367 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 433 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
368 *) 434 *)
369 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 435 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
370 exit 1 436 exit 1
371 ;; 437 ;;
385 fi 451 fi
386 452
387 $run $rm $removelist 453 $run $rm $removelist
388 trap "$run $rm $removelist; exit 1" 1 2 15 454 trap "$run $rm $removelist; exit 1" 1 2 15
389 455
456 # On Cygwin there's no "real" PIC flag so we must build both object types
457 case $host_os in
458 cygwin* | mingw* | pw32* | os2*)
459 pic_mode=default
460 ;;
461 esac
462 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
463 # non-PIC code in shared libraries is not supported
464 pic_mode=default
465 fi
466
390 # Calculate the filename of the output object if compiler does 467 # Calculate the filename of the output object if compiler does
391 # not support -o with -c 468 # not support -o with -c
392 if test "$compiler_c_o" = no; then 469 if test "$compiler_c_o" = no; then
393 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} 470 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
394 lockfile="$output_obj.lock" 471 lockfile="$output_obj.lock"
395 removelist="$removelist $output_obj $lockfile" 472 removelist="$removelist $output_obj $lockfile"
396 trap "$run $rm $removelist; exit 1" 1 2 15 473 trap "$run $rm $removelist; exit 1" 1 2 15
397 else 474 else
398 need_locks=no 475 need_locks=no
400 fi 477 fi
401 478
402 # Lock this critical section if it is needed 479 # Lock this critical section if it is needed
403 # We use this script file to make the link, it avoids creating a new file 480 # We use this script file to make the link, it avoids creating a new file
404 if test "$need_locks" = yes; then 481 if test "$need_locks" = yes; then
405 until ln "$0" "$lockfile" 2>/dev/null; do 482 until $run ln "$0" "$lockfile" 2>/dev/null; do
406 $show "Waiting for $lockfile to be removed" 483 $show "Waiting for $lockfile to be removed"
407 sleep 2 484 sleep 2
408 done 485 done
409 elif test "$need_locks" = warn; then 486 elif test "$need_locks" = warn; then
410 if test -f "$lockfile"; then 487 if test -f "$lockfile"; then
432 # Only build a PIC object if we are building libtool libraries. 509 # Only build a PIC object if we are building libtool libraries.
433 if test "$build_libtool_libs" = yes; then 510 if test "$build_libtool_libs" = yes; then
434 # Without this assignment, base_compile gets emptied. 511 # Without this assignment, base_compile gets emptied.
435 fbsd_hideous_sh_bug=$base_compile 512 fbsd_hideous_sh_bug=$base_compile
436 513
514 if test "$pic_mode" != no; then
437 # All platforms use -DPIC, to notify preprocessed assembler code. 515 # All platforms use -DPIC, to notify preprocessed assembler code.
438 command="$base_compile $pic_flag -DPIC $srcfile" 516 command="$base_compile $srcfile $pic_flag -DPIC"
517 else
518 # Don't build PIC code
519 command="$base_compile $srcfile"
520 fi
439 if test "$build_old_libs" = yes; then 521 if test "$build_old_libs" = yes; then
440 lo_libobj="$libobj" 522 lo_libobj="$libobj"
441 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` 523 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
442 if test "X$dir" = "X$libobj"; then 524 if test "X$dir" = "X$libobj"; then
443 dir="$objdir" 525 dir="$objdir"
504 exit $error 586 exit $error
505 fi 587 fi
506 fi 588 fi
507 589
508 # If we have no pic_flag, then copy the object into place and finish. 590 # If we have no pic_flag, then copy the object into place and finish.
509 if test -z "$pic_flag" && test "$build_old_libs" = yes; then 591 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
592 test "$build_old_libs" = yes; then
510 # Rename the .lo from within objdir to obj 593 # Rename the .lo from within objdir to obj
511 if test -f $obj; then 594 if test -f $obj; then
512 $show $rm $obj 595 $show $rm $obj
513 $run $rm $obj 596 $run $rm $obj
514 fi 597 fi
519 error=$? 602 error=$?
520 $run $rm $removelist 603 $run $rm $removelist
521 exit $error 604 exit $error
522 fi 605 fi
523 606
607 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
608 if test "X$xdir" = "X$obj"; then
609 xdir="."
610 else
611 xdir="$xdir"
612 fi
613 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
614 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
524 # Now arrange that obj and lo_libobj become the same file 615 # Now arrange that obj and lo_libobj become the same file
525 $show "$LN_S $obj $lo_libobj" 616 $show "(cd $xdir && $LN_S $baseobj $libobj)"
526 if $run $LN_S $obj $lo_libobj; then 617 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
527 exit 0 618 exit 0
528 else 619 else
529 error=$? 620 error=$?
530 $run $rm $removelist 621 $run $rm $removelist
531 exit $error 622 exit $error
536 suppress_output=' >/dev/null 2>&1' 627 suppress_output=' >/dev/null 2>&1'
537 fi 628 fi
538 629
539 # Only build a position-dependent object if we build old libraries. 630 # Only build a position-dependent object if we build old libraries.
540 if test "$build_old_libs" = yes; then 631 if test "$build_old_libs" = yes; then
632 if test "$pic_mode" != yes; then
633 # Don't build PIC code
541 command="$base_compile $srcfile" 634 command="$base_compile $srcfile"
635 else
636 # All platforms use -DPIC, to notify preprocessed assembler code.
637 command="$base_compile $srcfile $pic_flag -DPIC"
638 fi
542 if test "$compiler_c_o" = yes; then 639 if test "$compiler_c_o" = yes; then
543 command="$command -o $obj" 640 command="$command -o $obj"
544 output_obj="$obj" 641 output_obj="$obj"
545 fi 642 fi
546 643
602 fi 699 fi
603 fi 700 fi
604 701
605 # Unlock the critical section if it was locked 702 # Unlock the critical section if it was locked
606 if test "$need_locks" != no; then 703 if test "$need_locks" != no; then
607 $rm "$lockfile" 704 $run $rm "$lockfile"
608 fi 705 fi
609 706
610 exit 0 707 exit 0
611 ;; 708 ;;
612 709
613 # libtool link mode 710 # libtool link mode
614 link) 711 link | relink)
615 modename="$modename: link" 712 modename="$modename: link"
616 C_compiler="$CC" # save it, to compile generated C sources
617 CC="$nonopt"
618 case "$host" in 713 case $host in
619 *-*-cygwin* | *-*-mingw* | *-*-os2*) 714 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
620 # It is impossible to link a dll without this setting, and 715 # It is impossible to link a dll without this setting, and
621 # we shouldn't force the makefile maintainer to figure out 716 # we shouldn't force the makefile maintainer to figure out
622 # which system we are compiling for in order to pass an extra 717 # which system we are compiling for in order to pass an extra
623 # flag for every libtool invokation. 718 # flag for every libtool invokation.
624 # allow_undefined=no 719 # allow_undefined=no
627 # to make a dll which has undefined symbols, in which case not 722 # to make a dll which has undefined symbols, in which case not
628 # even a static library is built. For now, we need to specify 723 # even a static library is built. For now, we need to specify
629 # -no-undefined on the libtool link line when we can be certain 724 # -no-undefined on the libtool link line when we can be certain
630 # that all symbols are satisfied, otherwise we get a static library. 725 # that all symbols are satisfied, otherwise we get a static library.
631 allow_undefined=yes 726 allow_undefined=yes
632
633 # This is a source program that is used to create dlls on Windows
634 # Don't remove nor modify the starting and closing comments
635# /* ltdll.c starts here */
636# #define WIN32_LEAN_AND_MEAN
637# #include <windows.h>
638# #undef WIN32_LEAN_AND_MEAN
639# #include <stdio.h>
640#
641# #ifndef __CYGWIN__
642# # ifdef __CYGWIN32__
643# # define __CYGWIN__ __CYGWIN32__
644# # endif
645# #endif
646#
647# #ifdef __cplusplus
648# extern "C" {
649# #endif
650# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
651# #ifdef __cplusplus
652# }
653# #endif
654#
655# #ifdef __CYGWIN__
656# #include <cygwin/cygwin_dll.h>
657# DECLARE_CYGWIN_DLL( DllMain );
658# #endif
659# HINSTANCE __hDllInstance_base;
660#
661# BOOL APIENTRY
662# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
663# {
664# __hDllInstance_base = hInst;
665# return TRUE;
666# }
667# /* ltdll.c ends here */
668 # This is a source program that is used to create import libraries
669 # on Windows for dlls which lack them. Don't remove nor modify the
670 # starting and closing comments
671# /* impgen.c starts here */
672# /* Copyright (C) 1999 Free Software Foundation, Inc.
673#
674# This file is part of GNU libtool.
675#
676# This program is free software; you can redistribute it and/or modify
677# it under the terms of the GNU General Public License as published by
678# the Free Software Foundation; either version 2 of the License, or
679# (at your option) any later version.
680#
681# This program is distributed in the hope that it will be useful,
682# but WITHOUT ANY WARRANTY; without even the implied warranty of
683# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
684# GNU General Public License for more details.
685#
686# You should have received a copy of the GNU General Public License
687# along with this program; if not, write to the Free Software
688# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
689# */
690#
691# #include <stdio.h> /* for printf() */
692# #include <unistd.h> /* for open(), lseek(), read() */
693# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
694# #include <string.h> /* for strdup() */
695#
696# static unsigned int
697# pe_get16 (fd, offset)
698# int fd;
699# int offset;
700# {
701# unsigned char b[2];
702# lseek (fd, offset, SEEK_SET);
703# read (fd, b, 2);
704# return b[0] + (b[1]<<8);
705# }
706#
707# static unsigned int
708# pe_get32 (fd, offset)
709# int fd;
710# int offset;
711# {
712# unsigned char b[4];
713# lseek (fd, offset, SEEK_SET);
714# read (fd, b, 4);
715# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
716# }
717#
718# static unsigned int
719# pe_as32 (ptr)
720# void *ptr;
721# {
722# unsigned char *b = ptr;
723# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
724# }
725#
726# int
727# main (argc, argv)
728# int argc;
729# char *argv[];
730# {
731# int dll;
732# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
733# unsigned long export_rva, export_size, nsections, secptr, expptr;
734# unsigned long name_rvas, nexp;
735# unsigned char *expdata, *erva;
736# char *filename, *dll_name;
737#
738# filename = argv[1];
739#
740# dll = open(filename, O_RDONLY|O_BINARY);
741# if (!dll)
742# return 1;
743#
744# dll_name = filename;
745#
746# for (i=0; filename[i]; i++)
747# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
748# dll_name = filename + i +1;
749#
750# pe_header_offset = pe_get32 (dll, 0x3c);
751# opthdr_ofs = pe_header_offset + 4 + 20;
752# num_entries = pe_get32 (dll, opthdr_ofs + 92);
753#
754# if (num_entries < 1) /* no exports */
755# return 1;
756#
757# export_rva = pe_get32 (dll, opthdr_ofs + 96);
758# export_size = pe_get32 (dll, opthdr_ofs + 100);
759# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
760# secptr = (pe_header_offset + 4 + 20 +
761# pe_get16 (dll, pe_header_offset + 4 + 16));
762#
763# expptr = 0;
764# for (i = 0; i < nsections; i++)
765# {
766# char sname[8];
767# unsigned long secptr1 = secptr + 40 * i;
768# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
769# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
770# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
771# lseek(dll, secptr1, SEEK_SET);
772# read(dll, sname, 8);
773# if (vaddr <= export_rva && vaddr+vsize > export_rva)
774# {
775# expptr = fptr + (export_rva - vaddr);
776# if (export_rva + export_size > vaddr + vsize)
777# export_size = vsize - (export_rva - vaddr);
778# break;
779# }
780# }
781#
782# expdata = (unsigned char*)malloc(export_size);
783# lseek (dll, expptr, SEEK_SET);
784# read (dll, expdata, export_size);
785# erva = expdata - export_rva;
786#
787# nexp = pe_as32 (expdata+24);
788# name_rvas = pe_as32 (expdata+32);
789#
790# printf ("EXPORTS\n");
791# for (i = 0; i<nexp; i++)
792# {
793# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
794# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
795# }
796#
797# return 0;
798# }
799# /* impgen.c ends here */
800 ;; 727 ;;
801 *) 728 *)
802 allow_undefined=yes 729 allow_undefined=yes
803 ;; 730 ;;
804 esac 731 esac
732 libtool_args="$nonopt"
805 compile_command="$CC" 733 compile_command="$nonopt"
806 finalize_command="$CC" 734 finalize_command="$nonopt"
807 735
808 compile_rpath= 736 compile_rpath=
809 finalize_rpath= 737 finalize_rpath=
810 compile_shlibpath= 738 compile_shlibpath=
811 finalize_shlibpath= 739 finalize_shlibpath=
812 convenience= 740 convenience=
813 old_convenience= 741 old_convenience=
814 deplibs= 742 deplibs=
815 linkopts= 743 old_deplibs=
816 744 compiler_flags=
817 if test -n "$shlibpath_var"; then 745 linker_flags=
818 # get the directories listed in $shlibpath_var 746 dllsearchpath=
819 eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
820 else
821 lib_search_path= 747 lib_search_path=`pwd`
822 fi 748
823 # now prepend the system-specific ones
824 eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
825 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
826
827 avoid_version=no 749 avoid_version=no
828 dlfiles= 750 dlfiles=
829 dlprefiles= 751 dlprefiles=
830 dlself=no 752 dlself=no
831 export_dynamic=no 753 export_dynamic=no
832 export_symbols= 754 export_symbols=
833 export_symbols_regex= 755 export_symbols_regex=
834 generated= 756 generated=
835 libobjs= 757 libobjs=
836 link_against_libtool_libs=
837 ltlibs= 758 ltlibs=
838 module=no 759 module=no
760 no_install=no
839 objs= 761 objs=
840 prefer_static_libs=no 762 prefer_static_libs=no
841 preload=no 763 preload=no
842 prev= 764 prev=
843 prevarg= 765 prevarg=
850 vinfo= 772 vinfo=
851 773
852 # We need to know -static, to get the right output filenames. 774 # We need to know -static, to get the right output filenames.
853 for arg 775 for arg
854 do 776 do
855 case "$arg" in 777 case $arg in
856 -all-static | -static) 778 -all-static | -static)
857 if test "X$arg" = "X-all-static"; then 779 if test "X$arg" = "X-all-static"; then
858 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 780 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
859 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 781 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
860 fi 782 fi
879 801
880 # Go through the arguments, transforming them on the way. 802 # Go through the arguments, transforming them on the way.
881 while test $# -gt 0; do 803 while test $# -gt 0; do
882 arg="$1" 804 arg="$1"
883 shift 805 shift
806 case $arg in
807 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
808 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
809 ;;
810 *) qarg=$arg ;;
811 esac
812 libtool_args="$libtool_args $qarg"
884 813
885 # If the previous option needs an argument, assign it. 814 # If the previous option needs an argument, assign it.
886 if test -n "$prev"; then 815 if test -n "$prev"; then
887 case "$prev" in 816 case $prev in
888 output) 817 output)
889 compile_command="$compile_command @OUTPUT@" 818 compile_command="$compile_command @OUTPUT@"
890 finalize_command="$finalize_command @OUTPUT@" 819 finalize_command="$finalize_command @OUTPUT@"
891 ;; 820 ;;
892 esac 821 esac
893 822
894 case "$prev" in 823 case $prev in
895 dlfiles|dlprefiles) 824 dlfiles|dlprefiles)
896 if test "$preload" = no; then 825 if test "$preload" = no; then
897 # Add the symbol object into the linking commands. 826 # Add the symbol object into the linking commands.
898 compile_command="$compile_command @SYMFILE@" 827 compile_command="$compile_command @SYMFILE@"
899 finalize_command="$finalize_command @SYMFILE@" 828 finalize_command="$finalize_command @SYMFILE@"
900 preload=yes 829 preload=yes
901 fi 830 fi
902 case "$arg" in 831 case $arg in
903 *.la | *.lo) ;; # We handle these cases below. 832 *.la | *.lo) ;; # We handle these cases below.
904 force) 833 force)
905 if test "$dlself" = no; then 834 if test "$dlself" = no; then
906 dlself=needless 835 dlself=needless
907 export_dynamic=yes 836 export_dynamic=yes
926 dlfiles="$dlfiles $arg" 855 dlfiles="$dlfiles $arg"
927 else 856 else
928 dlprefiles="$dlprefiles $arg" 857 dlprefiles="$dlprefiles $arg"
929 fi 858 fi
930 prev= 859 prev=
860 continue
931 ;; 861 ;;
932 esac 862 esac
933 ;; 863 ;;
934 expsyms) 864 expsyms)
935 export_symbols="$arg" 865 export_symbols="$arg"
950 prev= 880 prev=
951 continue 881 continue
952 ;; 882 ;;
953 rpath | xrpath) 883 rpath | xrpath)
954 # We need an absolute path. 884 # We need an absolute path.
955 case "$arg" in 885 case $arg in
956 [\\/]* | [A-Za-z]:[\\/]*) ;; 886 [\\/]* | [A-Za-z]:[\\/]*) ;;
957 *) 887 *)
958 $echo "$modename: only absolute run-paths are allowed" 1>&2 888 $echo "$modename: only absolute run-paths are allowed" 1>&2
959 exit 1 889 exit 1
960 ;; 890 ;;
971 esac 901 esac
972 fi 902 fi
973 prev= 903 prev=
974 continue 904 continue
975 ;; 905 ;;
906 xcompiler)
907 compiler_flags="$compiler_flags $qarg"
908 prev=
909 compile_command="$compile_command $qarg"
910 finalize_command="$finalize_command $qarg"
911 continue
912 ;;
913 xlinker)
914 linker_flags="$linker_flags $qarg"
915 compiler_flags="$compiler_flags $wl$qarg"
916 prev=
917 compile_command="$compile_command $wl$qarg"
918 finalize_command="$finalize_command $wl$qarg"
919 continue
920 ;;
976 *) 921 *)
977 eval "$prev=\"\$arg\"" 922 eval "$prev=\"\$arg\""
978 prev= 923 prev=
979 continue 924 continue
980 ;; 925 ;;
981 esac 926 esac
982 fi 927 fi # test -n $prev
983 928
984 prevarg="$arg" 929 prevarg="$arg"
985 930
986 case "$arg" in 931 case $arg in
987 -all-static) 932 -all-static)
988 if test -n "$link_static_flag"; then 933 if test -n "$link_static_flag"; then
989 compile_command="$compile_command $link_static_flag" 934 compile_command="$compile_command $link_static_flag"
990 finalize_command="$finalize_command $link_static_flag" 935 finalize_command="$finalize_command $link_static_flag"
991 fi 936 fi
1018 continue 963 continue
1019 ;; 964 ;;
1020 965
1021 -export-symbols | -export-symbols-regex) 966 -export-symbols | -export-symbols-regex)
1022 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 967 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1023 $echo "$modename: not more than one -exported-symbols argument allowed" 968 $echo "$modename: more than one -exported-symbols argument is not allowed"
1024 exit 1 969 exit 1
1025 fi 970 fi
1026 if test "X$arg" = "X-export-symbols"; then 971 if test "X$arg" = "X-export-symbols"; then
1027 prev=expsyms 972 prev=expsyms
1028 else 973 else
1029 prev=expsyms_regex 974 prev=expsyms_regex
1030 fi 975 fi
1031 continue 976 continue
1032 ;; 977 ;;
1033 978
979 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
980 # so, if we see these flags be careful not to treat them like -L
981 -L[A-Z][A-Z]*:*)
982 case $with_gcc/$host in
983 no/*-*-irix*)
984 compile_command="$compile_command $arg"
985 finalize_command="$finalize_command $arg"
986 ;;
987 esac
988 continue
989 ;;
990
1034 -L*) 991 -L*)
1035 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 992 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1036 # We need an absolute path. 993 # We need an absolute path.
1037 case "$dir" in 994 case $dir in
1038 [\\/]* | [A-Za-z]:[\\/]*) ;; 995 [\\/]* | [A-Za-z]:[\\/]*) ;;
1039 *) 996 *)
1040 absdir=`cd "$dir" && pwd` 997 absdir=`cd "$dir" && pwd`
1041 if test -z "$absdir"; then 998 if test -z "$absdir"; then
1042 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 999 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1043 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 1000 exit 1
1044 absdir="$dir"
1045 fi 1001 fi
1046 dir="$absdir" 1002 dir="$absdir"
1047 ;; 1003 ;;
1048 esac 1004 esac
1049 case " $deplibs " in 1005 case "$deplibs " in
1050 *" $arg "*) ;; 1006 *" -L$dir "*) ;;
1007 *)
1051 *) deplibs="$deplibs $arg";; 1008 deplibs="$deplibs -L$dir"
1009 lib_search_path="$lib_search_path $dir"
1010 ;;
1052 esac 1011 esac
1012 case $host in
1013 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1053 case " $lib_search_path " in 1014 case :$dllsearchpath: in
1054 *" $dir "*) ;; 1015 *":$dir:"*) ;;
1055 *) lib_search_path="$lib_search_path $dir";; 1016 *) dllsearchpath="$dllsearchpath:$dir";;
1017 esac
1018 ;;
1056 esac 1019 esac
1057 case "$host" in 1020 continue
1058 *-*-cygwin* | *-*-mingw* | *-*-os2*)
1059 dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
1060 case ":$dllsearchpath:" in
1061 ::) dllsearchpath="$dllsearchdir";;
1062 *":$dllsearchdir:"*) ;;
1063 *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
1064 esac
1065 ;;
1066 esac
1067 ;; 1021 ;;
1068 1022
1069 -l*) 1023 -l*)
1070 if test "$arg" = "-lc"; then 1024 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1071 case "$host" in 1025 case $host in
1072 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) 1026 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1073 # These systems don't actually have c library (as such) 1027 # These systems don't actually have a C or math library (as such)
1074 continue 1028 continue
1075 ;; 1029 ;;
1076 esac
1077 elif test "$arg" = "-lm"; then
1078 case "$host" in
1079 *-*-cygwin* | *-*-beos*) 1030 *-*-mingw* | *-*-os2*)
1080 # These systems don't actually have math library (as such) 1031 # These systems don't actually have a C library (as such)
1081 continue 1032 test "X$arg" = "X-lc" && continue
1082 ;; 1033 ;;
1083 esac 1034 esac
1084 fi 1035 fi
1085 deplibs="$deplibs $arg" 1036 deplibs="$deplibs $arg"
1037 continue
1086 ;; 1038 ;;
1087 1039
1088 -module) 1040 -module)
1089 module=yes 1041 module=yes
1090 continue 1042 continue
1091 ;; 1043 ;;
1092 1044
1045 -no-fast-install)
1046 fast_install=no
1047 continue
1048 ;;
1049
1050 -no-install)
1051 case $host in
1052 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1053 # The PATH hackery in wrapper scripts is required on Windows
1054 # in order for the loader to find any dlls it needs.
1055 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1056 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1057 fast_install=no
1058 ;;
1059 *) no_install=yes ;;
1060 esac
1061 continue
1062 ;;
1063
1093 -no-undefined) 1064 -no-undefined)
1094 allow_undefined=no 1065 allow_undefined=no
1095 continue 1066 continue
1096 ;; 1067 ;;
1097 1068
1113 ;; 1084 ;;
1114 1085
1115 -R*) 1086 -R*)
1116 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1087 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1117 # We need an absolute path. 1088 # We need an absolute path.
1118 case "$dir" in 1089 case $dir in
1119 [\\/]* | [A-Za-z]:[\\/]*) ;; 1090 [\\/]* | [A-Za-z]:[\\/]*) ;;
1120 *) 1091 *)
1121 $echo "$modename: only absolute run-paths are allowed" 1>&2 1092 $echo "$modename: only absolute run-paths are allowed" 1>&2
1122 exit 1 1093 exit 1
1123 ;; 1094 ;;
1128 esac 1099 esac
1129 continue 1100 continue
1130 ;; 1101 ;;
1131 1102
1132 -static) 1103 -static)
1133 # If we have no pic_flag, then this is the same as -all-static. 1104 # The effects of -static are defined in a previous loop.
1134 if test -z "$pic_flag" && test -n "$link_static_flag"; then 1105 # We used to do the same as -all-static on platforms that
1135 compile_command="$compile_command $link_static_flag" 1106 # didn't have a PIC flag, but the assumption that the effects
1136 finalize_command="$finalize_command $link_static_flag" 1107 # would be equivalent was wrong. It would break on at least
1137 fi 1108 # Digital Unix and AIX.
1138 continue 1109 continue
1139 ;; 1110 ;;
1140 1111
1141 -thread-safe) 1112 -thread-safe)
1142 thread_safe=yes 1113 thread_safe=yes
1143 continue 1114 continue
1144 ;; 1115 ;;
1145 1116
1146 -version-info) 1117 -version-info)
1147 prev=vinfo 1118 prev=vinfo
1119 continue
1120 ;;
1121
1122 -Wc,*)
1123 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1124 arg=
1125 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1126 for flag in $args; do
1127 IFS="$save_ifs"
1128 case $flag in
1129 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1130 flag="\"$flag\""
1131 ;;
1132 esac
1133 arg="$arg $wl$flag"
1134 compiler_flags="$compiler_flags $flag"
1135 done
1136 IFS="$save_ifs"
1137 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1138 ;;
1139
1140 -Wl,*)
1141 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1142 arg=
1143 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1144 for flag in $args; do
1145 IFS="$save_ifs"
1146 case $flag in
1147 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1148 flag="\"$flag\""
1149 ;;
1150 esac
1151 arg="$arg $wl$flag"
1152 compiler_flags="$compiler_flags $wl$flag"
1153 linker_flags="$linker_flags $flag"
1154 done
1155 IFS="$save_ifs"
1156 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1157 ;;
1158
1159 -Xcompiler)
1160 prev=xcompiler
1161 continue
1162 ;;
1163
1164 -Xlinker)
1165 prev=xlinker
1148 continue 1166 continue
1149 ;; 1167 ;;
1150 1168
1151 # Some other compiler flag. 1169 # Some other compiler flag.
1152 -* | +*) 1170 -* | +*)
1153 # Unknown arguments in both finalize_command and compile_command need 1171 # Unknown arguments in both finalize_command and compile_command need
1154 # to be aesthetically quoted because they are evaled later. 1172 # to be aesthetically quoted because they are evaled later.
1155 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1173 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1156 case "$arg" in 1174 case $arg in
1157 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 1175 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1158 arg="\"$arg\"" 1176 arg="\"$arg\""
1159 ;; 1177 ;;
1160 esac 1178 esac
1161 ;; 1179 ;;
1162 1180
1163 *.o | *.obj | *.a | *.lib) 1181 *.lo | *.$objext)
1164 # A standard object. 1182 # A library or standard object.
1165 objs="$objs $arg"
1166 ;;
1167
1168 *.lo)
1169 # A library object.
1170 if test "$prev" = dlfiles; then 1183 if test "$prev" = dlfiles; then
1184 # This file was specified with -dlopen.
1185 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1171 dlfiles="$dlfiles $arg" 1186 dlfiles="$dlfiles $arg"
1172 if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
1173 prev= 1187 prev=
1174 continue 1188 continue
1175 else 1189 else
1176 # If libtool objects are unsupported, then we need to preload. 1190 # If libtool objects are unsupported, then we need to preload.
1177 prev=dlprefiles 1191 prev=dlprefiles
1180 1194
1181 if test "$prev" = dlprefiles; then 1195 if test "$prev" = dlprefiles; then
1182 # Preload the old-style object. 1196 # Preload the old-style object.
1183 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` 1197 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1184 prev= 1198 prev=
1185 fi 1199 else
1200 case $arg in
1186 libobjs="$libobjs $arg" 1201 *.lo) libobjs="$libobjs $arg" ;;
1202 *) objs="$objs $arg" ;;
1203 esac
1204 fi
1205 ;;
1206
1207 *.$libext)
1208 # An archive.
1209 deplibs="$deplibs $arg"
1210 old_deplibs="$old_deplibs $arg"
1211 continue
1187 ;; 1212 ;;
1188 1213
1189 *.la) 1214 *.la)
1190 # A libtool-controlled library. 1215 # A libtool-controlled library.
1191 1216
1217 if test "$prev" = dlfiles; then
1218 # This library was specified with -dlopen.
1219 dlfiles="$dlfiles $arg"
1220 prev=
1221 elif test "$prev" = dlprefiles; then
1222 # The library was specified with -dlpreopen.
1223 dlprefiles="$dlprefiles $arg"
1224 prev=
1225 else
1226 deplibs="$deplibs $arg"
1227 fi
1228 continue
1229 ;;
1230
1231 # Some other compiler argument.
1232 *)
1233 # Unknown arguments in both finalize_command and compile_command need
1234 # to be aesthetically quoted because they are evaled later.
1235 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1236 case $arg in
1237 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1238 arg="\"$arg\""
1239 ;;
1240 esac
1241 ;;
1242 esac # arg
1243
1244 # Now actually substitute the argument into the commands.
1245 if test -n "$arg"; then
1246 compile_command="$compile_command $arg"
1247 finalize_command="$finalize_command $arg"
1248 fi
1249 done # argument parsing loop
1250
1251 if test -n "$prev"; then
1252 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1253 $echo "$help" 1>&2
1254 exit 1
1255 fi
1256
1257 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1258 eval arg=\"$export_dynamic_flag_spec\"
1259 compile_command="$compile_command $arg"
1260 finalize_command="$finalize_command $arg"
1261 fi
1262
1263 # calculate the name of the file, without its directory
1264 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1265 libobjs_save="$libobjs"
1266
1267 if test -n "$shlibpath_var"; then
1268 # get the directories listed in $shlibpath_var
1269 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1270 else
1271 shlib_search_path=
1272 fi
1273 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1274 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1275
1276 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1277 if test "X$output_objdir" = "X$output"; then
1278 output_objdir="$objdir"
1279 else
1280 output_objdir="$output_objdir/$objdir"
1281 fi
1282 # Create the object directory.
1283 if test ! -d $output_objdir; then
1284 $show "$mkdir $output_objdir"
1285 $run $mkdir $output_objdir
1286 status=$?
1287 if test $status -ne 0 && test ! -d $output_objdir; then
1288 exit $status
1289 fi
1290 fi
1291
1292 # Determine the type of output
1293 case $output in
1294 "")
1295 $echo "$modename: you must specify an output file" 1>&2
1296 $echo "$help" 1>&2
1297 exit 1
1298 ;;
1299 *.$libext) linkmode=oldlib ;;
1300 *.lo | *.$objext) linkmode=obj ;;
1301 *.la) linkmode=lib ;;
1302 *) linkmode=prog ;; # Anything else should be a program.
1303 esac
1304
1305 specialdeplibs=
1306 libs=
1307 # Find all interdependent deplibs by searching for libraries
1308 # that are linked more than once (e.g. -la -lb -la)
1309 for deplib in $deplibs; do
1310 case "$libs " in
1311 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1312 esac
1313 libs="$libs $deplib"
1314 done
1315 deplibs=
1316 newdependency_libs=
1317 newlib_search_path=
1318 need_relink=no # whether we're linking any uninstalled libtool libraries
1319 notinst_deplibs= # not-installed libtool libraries
1320 notinst_path= # paths that contain not-installed libtool libraries
1321 case $linkmode in
1322 lib)
1323 passes="conv link"
1324 for file in $dlfiles $dlprefiles; do
1325 case $file in
1326 *.la) ;;
1327 *)
1328 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1329 exit 1
1330 ;;
1331 esac
1332 done
1333 ;;
1334 prog)
1335 compile_deplibs=
1336 finalize_deplibs=
1337 alldeplibs=no
1338 newdlfiles=
1339 newdlprefiles=
1340 passes="conv scan dlopen dlpreopen link"
1341 ;;
1342 *) passes="conv"
1343 ;;
1344 esac
1345 for pass in $passes; do
1346 if test $linkmode = prog; then
1347 # Determine which files to process
1348 case $pass in
1349 dlopen)
1350 libs="$dlfiles"
1351 save_deplibs="$deplibs" # Collect dlpreopened libraries
1352 deplibs=
1353 ;;
1354 dlpreopen) libs="$dlprefiles" ;;
1355 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1356 esac
1357 fi
1358 for deplib in $libs; do
1359 lib=
1360 found=no
1361 case $deplib in
1362 -l*)
1363 if test $linkmode = oldlib && test $linkmode = obj; then
1364 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1365 continue
1366 fi
1367 if test $pass = conv; then
1368 deplibs="$deplib $deplibs"
1369 continue
1370 fi
1371 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1372 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1373 # Search the libtool library
1374 lib="$searchdir/lib${name}.la"
1375 if test -f "$lib"; then
1376 found=yes
1377 break
1378 fi
1379 done
1380 if test "$found" != yes; then
1381 # deplib doesn't seem to be a libtool library
1382 if test "$linkmode,$pass" = "prog,link"; then
1383 compile_deplibs="$deplib $compile_deplibs"
1384 finalize_deplibs="$deplib $finalize_deplibs"
1385 else
1386 deplibs="$deplib $deplibs"
1387 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1388 fi
1389 continue
1390 fi
1391 ;; # -l
1392 -L*)
1393 case $linkmode in
1394 lib)
1395 deplibs="$deplib $deplibs"
1396 test $pass = conv && continue
1397 newdependency_libs="$deplib $newdependency_libs"
1398 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1399 ;;
1400 prog)
1401 if test $pass = conv; then
1402 deplibs="$deplib $deplibs"
1403 continue
1404 fi
1405 if test $pass = scan; then
1406 deplibs="$deplib $deplibs"
1407 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1408 else
1409 compile_deplibs="$deplib $compile_deplibs"
1410 finalize_deplibs="$deplib $finalize_deplibs"
1411 fi
1412 ;;
1413 *)
1414 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1415 ;;
1416 esac # linkmode
1417 continue
1418 ;; # -L
1419 -R*)
1420 if test $pass = link; then
1421 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1422 # Make sure the xrpath contains only unique directories.
1423 case "$xrpath " in
1424 *" $dir "*) ;;
1425 *) xrpath="$xrpath $dir" ;;
1426 esac
1427 fi
1428 deplibs="$deplib $deplibs"
1429 continue
1430 ;;
1431 *.la) lib="$deplib" ;;
1432 *.$libext)
1433 if test $pass = conv; then
1434 deplibs="$deplib $deplibs"
1435 continue
1436 fi
1437 case $linkmode in
1438 lib)
1439 if test "$deplibs_check_method" != pass_all; then
1440 echo
1441 echo "*** Warning: This library needs some functionality provided by $deplib."
1442 echo "*** I have the capability to make that library automatically link in when"
1443 echo "*** you link to this library. But I can only do this if you have a"
1444 echo "*** shared version of the library, which you do not appear to have."
1445 else
1446 echo
1447 echo "*** Warning: Linking the shared library $output against the"
1448 echo "*** static library $deplib is not portable!"
1449 deplibs="$deplib $deplibs"
1450 fi
1451 continue
1452 ;;
1453 prog)
1454 if test $pass != link; then
1455 deplibs="$deplib $deplibs"
1456 else
1457 compile_deplibs="$deplib $compile_deplibs"
1458 finalize_deplibs="$deplib $finalize_deplibs"
1459 fi
1460 continue
1461 ;;
1462 esac # linkmode
1463 ;; # *.$libext
1464 *.lo | *.$objext)
1465 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1466 # If there is no dlopen support or we're linking statically,
1467 # we need to preload.
1468 newdlprefiles="$newdlprefiles $deplib"
1469 compile_deplibs="$deplib $compile_deplibs"
1470 finalize_deplibs="$deplib $finalize_deplibs"
1471 else
1472 newdlfiles="$newdlfiles $deplib"
1473 fi
1474 continue
1475 ;;
1476 %DEPLIBS%)
1477 alldeplibs=yes
1478 continue
1479 ;;
1480 esac # case $deplib
1481 if test $found = yes || test -f "$lib"; then :
1482 else
1483 $echo "$modename: cannot find the library \`$lib'" 1>&2
1484 exit 1
1485 fi
1486
1487 # Check to see that this really is a libtool archive.
1488 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1489 else
1490 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1491 exit 1
1492 fi
1493
1494 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1495 test "X$ladir" = "X$lib" && ladir="."
1496
1192 dlname= 1497 dlname=
1498 dlopen=
1499 dlpreopen=
1193 libdir= 1500 libdir=
1194 library_names= 1501 library_names=
1195 old_library= 1502 old_library=
1196
1197 # Check to see that this really is a libtool archive.
1198 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1199 else
1200 $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
1201 exit 1
1202 fi
1203
1204 # If the library was installed with an old release of libtool, 1503 # If the library was installed with an old release of libtool,
1205 # it will not redefine variable installed. 1504 # it will not redefine variable installed.
1206 installed=yes 1505 installed=yes
1207 1506
1208 # Read the .la file 1507 # Read the .la file
1209 # If there is no directory component, then add one. 1508 case $lib in
1210 case "$arg" in
1211 */* | *\\*) . $arg ;; 1509 */* | *\\*) . $lib ;;
1212 *) . ./$arg ;; 1510 *) . ./$lib ;;
1213 esac 1511 esac
1512
1513 if test "$linkmode,$pass" = "lib,link" ||
1514 test "$linkmode,$pass" = "prog,scan" ||
1515 { test $linkmode = oldlib && test $linkmode = obj; }; then
1516 # Add dl[pre]opened files of deplib
1517 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1518 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1519 fi
1520
1521 if test $pass = conv; then
1522 # Only check for convenience libraries
1523 deplibs="$lib $deplibs"
1524 if test -z "$libdir"; then
1525 if test -z "$old_library"; then
1526 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1527 exit 1
1528 fi
1529 # It is a libtool convenience library, so add in its objects.
1530 convenience="$convenience $ladir/$objdir/$old_library"
1531 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1532 tmp_libs=
1533 for deplib in $dependency_libs; do
1534 deplibs="$deplib $deplibs"
1535 case "$tmp_libs " in
1536 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1537 esac
1538 tmp_libs="$tmp_libs $deplib"
1539 done
1540 elif test $linkmode != prog && test $linkmode != lib; then
1541 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1542 exit 1
1543 fi
1544 continue
1545 fi # $pass = conv
1214 1546
1215 # Get the name of the library we link against. 1547 # Get the name of the library we link against.
1216 linklib= 1548 linklib=
1217 for l in $old_library $library_names; do 1549 for l in $old_library $library_names; do
1218 linklib="$l" 1550 linklib="$l"
1219 done 1551 done
1220
1221 if test -z "$linklib"; then 1552 if test -z "$linklib"; then
1222 $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 1553 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1223 exit 1 1554 exit 1
1224 fi 1555 fi
1225 1556
1557 # This library was specified with -dlopen.
1558 if test $pass = dlopen; then
1559 if test -z "$libdir"; then
1560 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1561 exit 1
1562 fi
1563 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1564 # If there is no dlname, no dlopen support or we're linking
1565 # statically, we need to preload.
1566 dlprefiles="$dlprefiles $lib"
1567 else
1568 newdlfiles="$newdlfiles $lib"
1569 fi
1570 continue
1571 fi # $pass = dlopen
1572
1573 # We need an absolute path.
1574 case $ladir in
1575 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1576 *)
1577 abs_ladir=`cd "$ladir" && pwd`
1578 if test -z "$abs_ladir"; then
1579 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1580 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1581 abs_ladir="$ladir"
1582 fi
1583 ;;
1584 esac
1585 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1586
1226 # Find the relevant object directory and library name. 1587 # Find the relevant object directory and library name.
1227 name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
1228
1229 if test "X$installed" = Xyes; then 1588 if test "X$installed" = Xyes; then
1589 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1590 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1591 dir="$ladir"
1592 absdir="$abs_ladir"
1593 libdir="$abs_ladir"
1594 else
1230 dir="$libdir" 1595 dir="$libdir"
1596 absdir="$libdir"
1597 fi
1231 else 1598 else
1232 dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1233 if test "X$dir" = "X$arg"; then
1234 dir="$objdir"
1235 else
1236 dir="$dir/$objdir" 1599 dir="$ladir/$objdir"
1237 fi 1600 absdir="$abs_ladir/$objdir"
1238 fi 1601 # Remove this search path later
1602 notinst_path="$notinst_path $abs_ladir"
1603 fi # $installed = yes
1604 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1239 1605
1240 if test -n "$dependency_libs"; then
1241 # Extract -R and -L from dependency_libs
1242 temp_deplibs=
1243 for deplib in $dependency_libs; do
1244 case "$deplib" in
1245 -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1246 case " $rpath $xrpath " in
1247 *" $temp_xrpath "*) ;;
1248 *) xrpath="$xrpath $temp_xrpath";;
1249 esac;;
1250 -L*) case "$compile_command $temp_deplibs " in
1251 *" $deplib "*) ;;
1252 *) temp_deplibs="$temp_deplibs $deplib";;
1253 esac
1254 temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1255 case " $lib_search_path " in
1256 *" $temp_dir "*) ;;
1257 *) lib_search_path="$lib_search_path $temp_dir";;
1258 esac
1259 ;;
1260 *) temp_deplibs="$temp_deplibs $deplib";;
1261 esac
1262 done
1263 dependency_libs="$temp_deplibs"
1264 fi
1265
1266 if test -z "$libdir"; then
1267 # It is a libtool convenience library, so add in its objects.
1268 convenience="$convenience $dir/$old_library"
1269 old_convenience="$old_convenience $dir/$old_library"
1270 deplibs="$deplibs$dependency_libs"
1271 compile_command="$compile_command $dir/$old_library$dependency_libs"
1272 finalize_command="$finalize_command $dir/$old_library$dependency_libs"
1273 continue
1274 fi
1275
1276 # This library was specified with -dlopen.
1277 if test "$prev" = dlfiles; then
1278 dlfiles="$dlfiles $arg"
1279 if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
1280 # If there is no dlname, no dlopen support or we're linking statically,
1281 # we need to preload.
1282 prev=dlprefiles
1283 else
1284 # We should not create a dependency on this library, but we
1285 # may need any libraries it requires.
1286 compile_command="$compile_command$dependency_libs"
1287 finalize_command="$finalize_command$dependency_libs"
1288 prev=
1289 continue
1290 fi
1291 fi
1292
1293 # The library was specified with -dlpreopen. 1606 # This library was specified with -dlpreopen.
1294 if test "$prev" = dlprefiles; then 1607 if test $pass = dlpreopen; then
1608 if test -z "$libdir"; then
1609 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1610 exit 1
1611 fi
1295 # Prefer using a static library (so that no silly _DYNAMIC symbols 1612 # Prefer using a static library (so that no silly _DYNAMIC symbols
1296 # are required to link). 1613 # are required to link).
1297 if test -n "$old_library"; then 1614 if test -n "$old_library"; then
1298 dlprefiles="$dlprefiles $dir/$old_library" 1615 newdlprefiles="$newdlprefiles $dir/$old_library"
1616 # Otherwise, use the dlname, so that lt_dlopen finds it.
1617 elif test -n "$dlname"; then
1618 newdlprefiles="$newdlprefiles $dir/$dlname"
1299 else 1619 else
1300 dlprefiles="$dlprefiles $dir/$linklib" 1620 newdlprefiles="$newdlprefiles $dir/$linklib"
1621 fi
1622 fi # $pass = dlpreopen
1623
1624 if test -z "$libdir"; then
1625 # Link the convenience library
1626 if test $linkmode = lib; then
1627 deplibs="$dir/$old_library $deplibs"
1628 elif test "$linkmode,$pass" = "prog,link"; then
1629 compile_deplibs="$dir/$old_library $compile_deplibs"
1630 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1631 else
1632 deplibs="$lib $deplibs"
1633 fi
1634 continue
1635 fi
1636
1637 if test $linkmode = prog && test $pass != link; then
1638 newlib_search_path="$newlib_search_path $ladir"
1639 deplibs="$lib $deplibs"
1640
1641 linkalldeplibs=no
1642 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1643 test "$build_libtool_libs" = no; then
1644 linkalldeplibs=yes
1645 fi
1646
1647 tmp_libs=
1648 for deplib in $dependency_libs; do
1649 case $deplib in
1650 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1651 esac
1652 # Need to link against all dependency_libs?
1653 if test $linkalldeplibs = yes; then
1654 deplibs="$deplib $deplibs"
1655 else
1656 # Need to hardcode shared library paths
1657 # or/and link against static libraries
1658 newdependency_libs="$deplib $newdependency_libs"
1301 fi 1659 fi
1302 prev= 1660 case "$tmp_libs " in
1303 fi 1661 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1662 esac
1663 tmp_libs="$tmp_libs $deplib"
1664 done # for deplib
1665 continue
1666 fi # $linkmode = prog...
1304 1667
1668 link_static=no # Whether the deplib will be linked statically
1305 if test -n "$library_names" && 1669 if test -n "$library_names" &&
1306 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 1670 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1307 link_against_libtool_libs="$link_against_libtool_libs $arg" 1671 # Link against this shared library
1308 if test -n "$shlibpath_var"; then 1672
1309 # Make sure the rpath contains only unique directories. 1673 if test "$linkmode,$pass" = "prog,link" ||
1310 case "$temp_rpath " in 1674 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1675 # Hardcode the library path.
1676 # Skip directories that are in the system default run-time
1677 # search path.
1678 case " $sys_lib_dlsearch_path " in
1311 *" $dir "*) ;; 1679 *" $absdir "*) ;;
1680 *)
1681 case "$compile_rpath " in
1682 *" $absdir "*) ;;
1312 *) temp_rpath="$temp_rpath $dir" ;; 1683 *) compile_rpath="$compile_rpath $absdir"
1684 esac
1685 ;;
1313 esac 1686 esac
1314 fi 1687 case " $sys_lib_dlsearch_path " in
1315 1688 *" $libdir "*) ;;
1316 # We need an absolute path.
1317 case "$dir" in
1318 [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1319 *) 1689 *)
1320 absdir=`cd "$dir" && pwd` 1690 case "$finalize_rpath " in
1321 if test -z "$absdir"; then 1691 *" $libdir "*) ;;
1322 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 1692 *) finalize_rpath="$finalize_rpath $libdir"
1323 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 1693 esac
1324 absdir="$dir" 1694 ;;
1695 esac
1696 if test $linkmode = prog; then
1697 # We need to hardcode the library path
1698 if test -n "$shlibpath_var"; then
1699 # Make sure the rpath contains only unique directories.
1700 case "$temp_rpath " in
1701 *" $dir "*) ;;
1702 *" $absdir "*) ;;
1703 *) temp_rpath="$temp_rpath $dir" ;;
1704 esac
1705 fi
1325 fi 1706 fi
1326 ;; 1707 fi # $linkmode,$pass = prog,link...
1327 esac 1708
1709 if test "$alldeplibs" = yes &&
1710 { test "$deplibs_check_method" = pass_all ||
1711 { test "$build_libtool_libs" = yes &&
1712 test -n "$library_names"; }; }; then
1713 # We only need to search for static libraries
1714 continue
1328 1715 fi
1329 # This is the magic to use -rpath.
1330 # Skip directories that are in the system default run-time
1331 # search path, unless they have been requested with -R.
1332 case " $sys_lib_dlsearch_path " in
1333 *" $absdir "*) ;;
1334 *)
1335 case "$compile_rpath " in
1336 *" $absdir "*) ;;
1337 *) compile_rpath="$compile_rpath $absdir"
1338 esac
1339 ;;
1340 esac
1341 1716
1342 case " $sys_lib_dlsearch_path " in 1717 if test "$installed" = no; then
1343 *" $libdir "*) ;; 1718 notinst_deplibs="$notinst_deplibs $lib"
1344 *) 1719 need_relink=yes
1345 case "$finalize_rpath " in 1720 fi
1346 *" $libdir "*) ;;
1347 *) finalize_rpath="$finalize_rpath $libdir"
1348 esac
1349 ;;
1350 esac
1351 1721
1352 lib_linked=yes 1722 if test -n "$old_archive_from_expsyms_cmds"; then
1353 case "$hardcode_action" in 1723 # figure out the soname
1354 immediate | unsupported) 1724 set dummy $library_names
1355 if test "$hardcode_direct" = no; then 1725 realname="$2"
1356 compile_command="$compile_command $dir/$linklib" 1726 shift; shift
1357 deplibs="$deplibs $dir/$linklib" 1727 libname=`eval \\$echo \"$libname_spec\"`
1728 # use dlname if we got it. it's perfectly good, no?
1729 if test -n "$dlname"; then
1730 soname="$dlname"
1731 elif test -n "$soname_spec"; then
1732 # bleh windows
1358 case "$host" in 1733 case $host in
1359 *-*-cygwin* | *-*-mingw* | *-*-os2*) 1734 *cygwin*)
1360 dllsearchdir=`cd "$dir" && pwd || echo "$dir"` 1735 major=`expr $current - $age`
1361 if test -n "$dllsearchpath"; then 1736 versuffix="-$major"
1362 dllsearchpath="$dllsearchpath:$dllsearchdir"
1363 else
1364 dllsearchpath="$dllsearchdir"
1365 fi
1366 ;; 1737 ;;
1367 esac 1738 esac
1739 eval soname=\"$soname_spec\"
1740 else
1741 soname="$realname"
1742 fi
1743
1744 # Make a new name for the extract_expsyms_cmds to use
1745 soroot="$soname"
1746 soname=`echo $soroot | sed -e 's/^.*\///'`
1747 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1748
1749 # If the library has no export list, then create one now
1750 if test -f "$output_objdir/$soname-def"; then :
1751 else
1752 $show "extracting exported symbol list from \`$soname'"
1753 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1754 eval cmds=\"$extract_expsyms_cmds\"
1755 for cmd in $cmds; do
1756 IFS="$save_ifs"
1757 $show "$cmd"
1758 $run eval "$cmd" || exit $?
1759 done
1760 IFS="$save_ifs"
1761 fi
1762
1763 # Create $newlib
1764 if test -f "$output_objdir/$newlib"; then :; else
1765 $show "generating import library for \`$soname'"
1766 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1767 eval cmds=\"$old_archive_from_expsyms_cmds\"
1768 for cmd in $cmds; do
1769 IFS="$save_ifs"
1770 $show "$cmd"
1771 $run eval "$cmd" || exit $?
1772 done
1773 IFS="$save_ifs"
1774 fi
1775 # make sure the library variables are pointing to the new library
1776 dir=$output_objdir
1777 linklib=$newlib
1778 fi # test -n $old_archive_from_expsyms_cmds
1779
1780 if test $linkmode = prog || test "$mode" != relink; then
1781 add_shlibpath=
1782 add_dir=
1783 add=
1784 lib_linked=yes
1785 case $hardcode_action in
1786 immediate | unsupported)
1787 if test "$hardcode_direct" = no; then
1788 add="$dir/$linklib"
1368 elif test "$hardcode_minus_L" = no; then 1789 elif test "$hardcode_minus_L" = no; then
1369 case "$host" in 1790 case $host in
1370 *-*-sunos*) 1791 *-*-sunos*) add_shlibpath="$dir" ;;
1792 esac
1793 add_dir="-L$dir"
1794 add="-l$name"
1795 elif test "$hardcode_shlibpath_var" = no; then
1796 add_shlibpath="$dir"
1797 add="-l$name"
1798 else
1799 lib_linked=no
1800 fi
1801 ;;
1802 relink)
1803 if test "$hardcode_direct" = yes; then
1804 add="$dir/$linklib"
1805 elif test "$hardcode_minus_L" = yes; then
1806 add_dir="-L$dir"
1807 add="-l$name"
1808 elif test "$hardcode_shlibpath_var" = yes; then
1809 add_shlibpath="$dir"
1810 add="-l$name"
1811 else
1812 lib_linked=no
1813 fi
1814 ;;
1815 *) lib_linked=no ;;
1816 esac
1817
1818 if test "$lib_linked" != yes; then
1819 $echo "$modename: configuration error: unsupported hardcode properties"
1820 exit 1
1821 fi
1822
1823 if test -n "$add_shlibpath"; then
1824 case :$compile_shlibpath: in
1825 *":$add_shlibpath:"*) ;;
1371 compile_shlibpath="$compile_shlibpath$dir:" 1826 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1372 ;;
1373 esac 1827 esac
1374 case "$compile_command " in 1828 fi
1829 if test $linkmode = prog; then
1830 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1831 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1832 else
1833 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1834 test -n "$add" && deplibs="$add $deplibs"
1835 if test "$hardcode_direct" != yes && \
1836 test "$hardcode_minus_L" != yes && \
1837 test "$hardcode_shlibpath_var" = yes; then
1838 case :$finalize_shlibpath: in
1839 *":$libdir:"*) ;;
1840 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1841 esac
1842 fi
1843 fi
1844 fi
1845
1846 if test $linkmode = prog || test "$mode" = relink; then
1847 add_shlibpath=
1848 add_dir=
1849 add=
1850 # Finalize command for both is simple: just hardcode it.
1851 if test "$hardcode_direct" = yes; then
1852 add="$libdir/$linklib"
1853 elif test "$hardcode_minus_L" = yes; then
1854 add_dir="-L$libdir"
1855 add="-l$name"
1856 elif test "$hardcode_shlibpath_var" = yes; then
1857 case :$finalize_shlibpath: in
1375 *" -L$dir "*) ;; 1858 *":$libdir:"*) ;;
1376 *) compile_command="$compile_command -L$dir";; 1859 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1377 esac 1860 esac
1378 compile_command="$compile_command -l$name" 1861 add="-l$name"
1379 deplibs="$deplibs -L$dir -l$name"
1380 elif test "$hardcode_shlibpath_var" = no; then
1381 case ":$compile_shlibpath:" in
1382 *":$dir:"*) ;;
1383 *) compile_shlibpath="$compile_shlibpath$dir:";;
1384 esac
1385 compile_command="$compile_command -l$name"
1386 deplibs="$deplibs -l$name"
1387 else 1862 else
1388 lib_linked=no 1863 # We cannot seem to hardcode it, guess we'll fake it.
1864 add_dir="-L$libdir"
1865 add="-l$name"
1389 fi 1866 fi
1390 ;;
1391 1867
1392 relink) 1868 if test $linkmode = prog; then
1393 if test "$hardcode_direct" = yes; then 1869 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1394 compile_command="$compile_command $absdir/$linklib" 1870 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1395 deplibs="$deplibs $absdir/$linklib"
1396 elif test "$hardcode_minus_L" = yes; then
1397 case "$compile_command " in
1398 *" -L$absdir "*) ;;
1399 *) compile_command="$compile_command -L$absdir";;
1400 esac
1401 compile_command="$compile_command -l$name"
1402 deplibs="$deplibs -L$absdir -l$name"
1403 elif test "$hardcode_shlibpath_var" = yes; then
1404 case ":$compile_shlibpath:" in
1405 *":$absdir:"*) ;;
1406 *) compile_shlibpath="$compile_shlibpath$absdir:";;
1407 esac
1408 compile_command="$compile_command -l$name"
1409 deplibs="$deplibs -l$name"
1410 else 1871 else
1411 lib_linked=no 1872 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1873 test -n "$add" && deplibs="$add $deplibs"
1412 fi 1874 fi
1413 ;;
1414
1415 *)
1416 lib_linked=no
1417 ;;
1418 esac
1419
1420 if test "$lib_linked" != yes; then
1421 $echo "$modename: configuration error: unsupported hardcode properties"
1422 exit 1
1423 fi 1875 fi
1424 1876 elif test $linkmode = prog; then
1425 # Finalize command for both is simple: just hardcode it. 1877 if test "$alldeplibs" = yes &&
1426 if test "$hardcode_direct" = yes; then 1878 { test "$deplibs_check_method" = pass_all ||
1427 finalize_command="$finalize_command $libdir/$linklib" 1879 { test "$build_libtool_libs" = yes &&
1428 elif test "$hardcode_minus_L" = yes; then 1880 test -n "$library_names"; }; }; then
1429 case "$finalize_command " in 1881 # We only need to search for static libraries
1430 *" -L$libdir "*) ;; 1882 continue
1431 *) finalize_command="$finalize_command -L$libdir";;
1432 esac
1433 finalize_command="$finalize_command -l$name"
1434 elif test "$hardcode_shlibpath_var" = yes; then
1435 case ":$finalize_shlibpath:" in
1436 *":$libdir:"*) ;;
1437 *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
1438 esac
1439 finalize_command="$finalize_command -l$name"
1440 else
1441 # We cannot seem to hardcode it, guess we'll fake it.
1442 case "$finalize_command " in
1443 *" -L$dir "*) ;;
1444 *) finalize_command="$finalize_command -L$libdir";;
1445 esac
1446 finalize_command="$finalize_command -l$name"
1447 fi 1883 fi
1448 else
1449 # Transform directly to old archives if we don't build new libraries.
1450 if test -n "$pic_flag" && test -z "$old_library"; then
1451 $echo "$modename: cannot find static library for \`$arg'" 1>&2
1452 exit 1
1453 fi
1454 1884
1885 # Try to link the static library
1455 # Here we assume that one of hardcode_direct or hardcode_minus_L 1886 # Here we assume that one of hardcode_direct or hardcode_minus_L
1456 # is not unsupported. This is valid on all known static and 1887 # is not unsupported. This is valid on all known static and
1457 # shared platforms. 1888 # shared platforms.
1458 if test "$hardcode_direct" != unsupported; then 1889 if test "$hardcode_direct" != unsupported; then
1459 test -n "$old_library" && linklib="$old_library" 1890 test -n "$old_library" && linklib="$old_library"
1460 compile_command="$compile_command $dir/$linklib" 1891 compile_deplibs="$dir/$linklib $compile_deplibs"
1461 finalize_command="$finalize_command $dir/$linklib" 1892 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1462 else 1893 else
1463 case "$compile_command " in 1894 compile_deplibs="-l$name -L$dir $compile_deplibs"
1464 *" -L$dir "*) ;; 1895 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1465 *) compile_command="$compile_command -L$dir";; 1896 fi
1897 elif test "$build_libtool_libs" = yes; then
1898 # Not a shared library
1899 if test "$deplibs_check_method" != pass_all; then
1900 # We're trying link a shared library against a static one
1901 # but the system doesn't support it.
1902
1903 # Just print a warning and add the library to dependency_libs so
1904 # that the program can be linked against the static library.
1905 echo
1906 echo "*** Warning: This library needs some functionality provided by $lib."
1907 echo "*** I have the capability to make that library automatically link in when"
1908 echo "*** you link to this library. But I can only do this if you have a"
1909 echo "*** shared version of the library, which you do not appear to have."
1910 if test "$module" = yes; then
1911 echo "*** Therefore, libtool will create a static module, that should work "
1912 echo "*** as long as the dlopening application is linked with the -dlopen flag."
1913 if test -z "$global_symbol_pipe"; then
1914 echo
1915 echo "*** However, this would only work if libtool was able to extract symbol"
1916 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1917 echo "*** not find such a program. So, this module is probably useless."
1918 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1919 fi
1920 if test "$build_old_libs" = no; then
1921 build_libtool_libs=module
1922 build_old_libs=yes
1923 else
1924 build_libtool_libs=no
1925 fi
1926 fi
1927 else
1928 convenience="$convenience $dir/$old_library"
1929 old_convenience="$old_convenience $dir/$old_library"
1930 deplibs="$dir/$old_library $deplibs"
1931 link_static=yes
1932 fi
1933 fi # link shared/static library?
1934
1935 if test $linkmode = lib; then
1936 if test -n "$dependency_libs" &&
1937 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1938 test $link_static = yes; }; then
1939 # Extract -R from dependency_libs
1940 temp_deplibs=
1941 for libdir in $dependency_libs; do
1942 case $libdir in
1943 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1944 case " $xrpath " in
1945 *" $temp_xrpath "*) ;;
1946 *) xrpath="$xrpath $temp_xrpath";;
1947 esac;;
1948 *) temp_deplibs="$temp_deplibs $libdir";;
1949 esac
1950 done
1951 dependency_libs="$temp_deplibs"
1952 fi
1953
1954 newlib_search_path="$newlib_search_path $absdir"
1955 # Link against this library
1956 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1957 # ... and its dependency_libs
1958 tmp_libs=
1959 for deplib in $dependency_libs; do
1960 newdependency_libs="$deplib $newdependency_libs"
1961 case "$tmp_libs " in
1962 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1466 esac 1963 esac
1467 compile_command="$compile_command -l$name" 1964 tmp_libs="$tmp_libs $deplib"
1468 case "$finalize_command " in 1965 done
1966
1967 if test $link_all_deplibs != no; then
1968 # Add the search paths of all dependency libraries
1969 for deplib in $dependency_libs; do
1970 case $deplib in
1971 -L*) path="$deplib" ;;
1972 *.la)
1973 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
1974 test "X$dir" = "X$deplib" && dir="."
1975 # We need an absolute path.
1976 case $dir in
1977 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
1978 *)
1979 absdir=`cd "$dir" && pwd`
1980 if test -z "$absdir"; then
1981 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
1982 absdir="$dir"
1983 fi
1984 ;;
1985 esac
1986 if grep "^installed=no" $deplib > /dev/null; then
1987 path="-L$absdir/$objdir"
1988 else
1989 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
1990 if test -z "$libdir"; then
1991 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
1992 exit 1
1993 fi
1994 if test "$absdir" != "$libdir"; then
1995 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
1996 fi
1997 path="-L$absdir"
1998 fi
1999 ;;
2000 *) continue ;;
2001 esac
2002 case " $deplibs " in
2003 *" $path "*) ;;
2004 *) deplibs="$deplibs $path" ;;
2005 esac
2006 done
2007 fi # link_all_deplibs != no
2008 fi # linkmode = lib
2009 done # for deplib in $libs
2010 if test $pass = dlpreopen; then
2011 # Link the dlpreopened libraries before other libraries
2012 for deplib in $save_deplibs; do
2013 deplibs="$deplib $deplibs"
2014 done
2015 fi
2016 if test $pass != dlopen; then
2017 test $pass != scan && dependency_libs="$newdependency_libs"
2018 if test $pass != conv; then
2019 # Make sure lib_search_path contains only unique directories.
2020 lib_search_path=
2021 for dir in $newlib_search_path; do
2022 case "$lib_search_path " in
1469 *" -L$dir "*) ;; 2023 *" $dir "*) ;;
1470 *) finalize_command="$finalize_command -L$dir";; 2024 *) lib_search_path="$lib_search_path $dir" ;;
1471 esac 2025 esac
1472 finalize_command="$finalize_command -l$name" 2026 done
2027 newlib_search_path=
1473 fi 2028 fi
1474 fi
1475 2029
1476 # Add in any libraries that this one depends upon. 2030 if test "$linkmode,$pass" != "prog,link"; then
1477 compile_command="$compile_command$dependency_libs" 2031 vars="deplibs"
1478 finalize_command="$finalize_command$dependency_libs" 2032 else
1479 continue 2033 vars="compile_deplibs finalize_deplibs"
1480 ;; 2034 fi
1481 2035 for var in $vars dependency_libs; do
1482 # Some other compiler argument. 2036 # Add libraries to $var in reverse order
2037 eval tmp_libs=\"\$$var\"
2038 new_libs=
2039 for deplib in $tmp_libs; do
2040 case $deplib in
2041 -L*) new_libs="$deplib $new_libs" ;;
2042 *)
2043 case " $specialdeplibs " in
2044 *" $deplib "*) new_libs="$deplib $new_libs" ;;
1483 *) 2045 *)
1484 # Unknown arguments in both finalize_command and compile_command need 2046 case " $new_libs " in
1485 # to be aesthetically quoted because they are evaled later. 2047 *" $deplib "*) ;;
1486 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 2048 *) new_libs="$deplib $new_libs" ;;
1487 case "$arg" in
1488 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
1489 arg="\"$arg\""
1490 ;;
1491 esac 2049 esac
1492 ;; 2050 ;;
1493 esac 2051 esac
1494 2052 ;;
1495 # Now actually substitute the argument into the commands. 2053 esac
1496 if test -n "$arg"; then
1497 compile_command="$compile_command $arg"
1498 finalize_command="$finalize_command $arg"
1499 fi
1500 done 2054 done
1501 2055 tmp_libs=
1502 if test -n "$prev"; then 2056 for deplib in $new_libs; do
1503 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 2057 case $deplib in
1504 $echo "$help" 1>&2 2058 -L*)
1505 exit 1 2059 case " $tmp_libs " in
2060 *" $deplib "*) ;;
2061 *) tmp_libs="$tmp_libs $deplib" ;;
2062 esac
2063 ;;
2064 *) tmp_libs="$tmp_libs $deplib" ;;
2065 esac
2066 done
2067 eval $var=\"$tmp_libs\"
2068 done # for var
2069 fi
2070 if test "$pass" = "conv" &&
2071 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2072 libs="$deplibs" # reset libs
2073 deplibs=
2074 fi
2075 done # for pass
2076 if test $linkmode = prog; then
2077 dlfiles="$newdlfiles"
2078 dlprefiles="$newdlprefiles"
1506 fi 2079 fi
1507 2080
1508 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 2081 case $linkmode in
1509 eval arg=\"$export_dynamic_flag_spec\"
1510 compile_command="$compile_command $arg"
1511 finalize_command="$finalize_command $arg"
1512 fi
1513
1514 oldlibs= 2082 oldlib)
1515 # calculate the name of the file, without its directory
1516 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1517 libobjs_save="$libobjs"
1518
1519 case "$output" in
1520 "")
1521 $echo "$modename: you must specify an output file" 1>&2
1522 $echo "$help" 1>&2
1523 exit 1
1524 ;;
1525
1526 *.a | *.lib)
1527 if test -n "$link_against_libtool_libs"; then
1528 $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
1529 exit 1
1530 fi
1531
1532 if test -n "$deplibs"; then
1533 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
1534 fi
1535
1536 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 2083 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1537 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 2084 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
1538 fi 2085 fi
1539 2086
1540 if test -n "$rpath"; then 2087 if test -n "$rpath"; then
1558 fi 2105 fi
1559 2106
1560 # Now set the variables for building old libraries. 2107 # Now set the variables for building old libraries.
1561 build_libtool_libs=no 2108 build_libtool_libs=no
1562 oldlibs="$output" 2109 oldlibs="$output"
2110 objs="$objs$old_deplibs"
1563 ;; 2111 ;;
1564 2112
1565 *.la) 2113 lib)
1566 # Make sure we only generate libraries of the form `libNAME.la'. 2114 # Make sure we only generate libraries of the form `libNAME.la'.
1567 case "$outputname" in 2115 case $outputname in
1568 lib*) 2116 lib*)
1569 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2117 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1570 eval libname=\"$libname_spec\" 2118 eval libname=\"$libname_spec\"
1571 ;; 2119 ;;
1572 *) 2120 *)
1583 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 2131 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
1584 fi 2132 fi
1585 ;; 2133 ;;
1586 esac 2134 esac
1587 2135
1588 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1589 if test "X$output_objdir" = "X$output"; then
1590 output_objdir="$objdir"
1591 else
1592 output_objdir="$output_objdir/$objdir"
1593 fi
1594
1595 if test -n "$objs"; then 2136 if test -n "$objs"; then
2137 if test "$deplibs_check_method" != pass_all; then
1596 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 2138 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
1597 exit 1
1598 fi
1599
1600 # How the heck are we supposed to write a wrapper for a shared library?
1601 if test -n "$link_against_libtool_libs"; then
1602 $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
1603 exit 1 2139 exit 1
2140 else
2141 echo
2142 echo "*** Warning: Linking the shared library $output against the non-libtool"
2143 echo "*** objects $objs is not portable!"
2144 libobjs="$libobjs $objs"
2145 fi
1604 fi 2146 fi
1605 2147
1606 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 2148 if test "$dlself" != no; then
1607 $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 2149 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
1608 fi 2150 fi
1609 2151
1610 set dummy $rpath 2152 set dummy $rpath
1611 if test $# -gt 2; then 2153 if test $# -gt 2; then
1612 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 2154 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
1620 libext=al 2162 libext=al
1621 oldlibs="$output_objdir/$libname.$libext $oldlibs" 2163 oldlibs="$output_objdir/$libname.$libext $oldlibs"
1622 build_libtool_libs=convenience 2164 build_libtool_libs=convenience
1623 build_old_libs=yes 2165 build_old_libs=yes
1624 fi 2166 fi
1625 dependency_libs="$deplibs"
1626 2167
1627 if test -n "$vinfo"; then 2168 if test -n "$vinfo"; then
1628 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 2169 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
1629 fi 2170 fi
1630 2171
1647 current="$2" 2188 current="$2"
1648 revision="$3" 2189 revision="$3"
1649 age="$4" 2190 age="$4"
1650 2191
1651 # Check that each of the things are valid numbers. 2192 # Check that each of the things are valid numbers.
1652 case "$current" in 2193 case $current in
1653 0 | [1-9] | [1-9][0-9]*) ;; 2194 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
1654 *) 2195 *)
1655 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 2196 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
1656 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2197 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1657 exit 1 2198 exit 1
1658 ;; 2199 ;;
1659 esac 2200 esac
1660 2201
1661 case "$revision" in 2202 case $revision in
1662 0 | [1-9] | [1-9][0-9]*) ;; 2203 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
1663 *) 2204 *)
1664 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 2205 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
1665 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2206 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1666 exit 1 2207 exit 1
1667 ;; 2208 ;;
1668 esac 2209 esac
1669 2210
1670 case "$age" in 2211 case $age in
1671 0 | [1-9] | [1-9][0-9]*) ;; 2212 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
1672 *) 2213 *)
1673 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 2214 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
1674 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 2215 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
1675 exit 1 2216 exit 1
1676 ;; 2217 ;;
1684 2225
1685 # Calculate the version variables. 2226 # Calculate the version variables.
1686 major= 2227 major=
1687 versuffix= 2228 versuffix=
1688 verstring= 2229 verstring=
1689 case "$version_type" in 2230 case $version_type in
1690 none) ;; 2231 none) ;;
2232
2233 darwin)
2234 # Like Linux, but with the current version available in
2235 # verstring for coding it into the library header
2236 major=.`expr $current - $age`
2237 versuffix="$major.$age.$revision"
2238 # Darwin ld doesn't like 0 for these options...
2239 minor_current=`expr $current + 1`
2240 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2241 ;;
2242
2243 freebsd-aout)
2244 major=".$current"
2245 versuffix=".$current.$revision";
2246 ;;
2247
2248 freebsd-elf)
2249 major=".$current"
2250 versuffix=".$current";
2251 ;;
1691 2252
1692 irix) 2253 irix)
1693 major=`expr $current - $age + 1` 2254 major=`expr $current - $age + 1`
1694 versuffix="$major.$revision"
1695 verstring="sgi$major.$revision" 2255 verstring="sgi$major.$revision"
1696 2256
1697 # Add in all the interfaces that we are compatible with. 2257 # Add in all the interfaces that we are compatible with.
1698 loop=$revision 2258 loop=$revision
1699 while test $loop != 0; do 2259 while test $loop != 0; do
1700 iface=`expr $revision - $loop` 2260 iface=`expr $revision - $loop`
1701 loop=`expr $loop - 1` 2261 loop=`expr $loop - 1`
1702 verstring="sgi$major.$iface:$verstring" 2262 verstring="sgi$major.$iface:$verstring"
1703 done 2263 done
2264
2265 # Before this point, $major must not contain `.'.
2266 major=.$major
2267 versuffix="$major.$revision"
1704 ;; 2268 ;;
1705 2269
1706 linux) 2270 linux)
1707 major=.`expr $current - $age` 2271 major=.`expr $current - $age`
1708 versuffix="$major.$age.$revision" 2272 versuffix="$major.$age.$revision"
1728 sunos) 2292 sunos)
1729 major=".$current" 2293 major=".$current"
1730 versuffix=".$current.$revision" 2294 versuffix=".$current.$revision"
1731 ;; 2295 ;;
1732 2296
1733 freebsd-aout)
1734 major=".$current"
1735 versuffix=".$current.$revision";
1736 ;;
1737
1738 freebsd-elf)
1739 major=".$current"
1740 versuffix=".$current";
1741 ;;
1742
1743 windows) 2297 windows)
1744 # Like Linux, but with '-' rather than '.', since we only 2298 # Use '-' rather than '.', since we only want one
1745 # want one extension on Windows 95. 2299 # extension on DOS 8.3 filesystems.
1746 major=`expr $current - $age` 2300 major=`expr $current - $age`
1747 versuffix="-$major-$age-$revision" 2301 versuffix="-$major"
1748 ;; 2302 ;;
1749 2303
1750 *) 2304 *)
1751 $echo "$modename: unknown library version type \`$version_type'" 1>&2 2305 $echo "$modename: unknown library version type \`$version_type'" 1>&2
1752 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 2306 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
1769 if test "$avoid_version" = yes && test "$need_version" = no; then 2323 if test "$avoid_version" = yes && test "$need_version" = no; then
1770 major= 2324 major=
1771 versuffix= 2325 versuffix=
1772 verstring="" 2326 verstring=""
1773 fi 2327 fi
1774 2328
1775 # Check to see if the archive will have undefined symbols. 2329 # Check to see if the archive will have undefined symbols.
1776 if test "$allow_undefined" = yes; then 2330 if test "$allow_undefined" = yes; then
1777 if test "$allow_undefined_flag" = unsupported; then 2331 if test "$allow_undefined_flag" = unsupported; then
1778 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 2332 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
1779 build_libtool_libs=no 2333 build_libtool_libs=no
1781 fi 2335 fi
1782 else 2336 else
1783 # Don't allow undefined symbols. 2337 # Don't allow undefined symbols.
1784 allow_undefined_flag="$no_undefined_flag" 2338 allow_undefined_flag="$no_undefined_flag"
1785 fi 2339 fi
1786
1787 dependency_libs="$deplibs"
1788 case "$host" in
1789 *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
1790 # these systems don't actually have a c library (as such)!
1791 ;;
1792 *)
1793 # Add libc to deplibs on all other systems.
1794 deplibs="$deplibs -lc"
1795 ;;
1796 esac
1797 fi 2340 fi
1798 2341
1799 # Create the output directory, or remove our outputs if we need to. 2342 if test "$mode" != relink; then
1800 if test -d $output_objdir; then 2343 # Remove our outputs.
1801 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" 2344 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
1802 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* 2345 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
1803 else
1804 $show "$mkdir $output_objdir"
1805 $run $mkdir $output_objdir
1806 status=$?
1807 if test $status -ne 0 && test ! -d $output_objdir; then
1808 exit $status
1809 fi
1810 fi 2346 fi
1811 2347
1812 # Now set the variables for building old libraries. 2348 # Now set the variables for building old libraries.
1813 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 2349 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
1814 oldlibs="$oldlibs $output_objdir/$libname.$libext" 2350 oldlibs="$oldlibs $output_objdir/$libname.$libext"
1815 2351
1816 # Transform .lo files to .o files. 2352 # Transform .lo files to .o files.
1817 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 2353 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
1818 fi 2354 fi
1819 2355
2356 # Eliminate all temporary directories.
2357 for path in $notinst_path; do
2358 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2359 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2360 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2361 done
2362
2363 if test -n "$xrpath"; then
2364 # If the user specified any rpath flags, then add them.
2365 temp_xrpath=
2366 for libdir in $xrpath; do
2367 temp_xrpath="$temp_xrpath -R$libdir"
2368 case "$finalize_rpath " in
2369 *" $libdir "*) ;;
2370 *) finalize_rpath="$finalize_rpath $libdir" ;;
2371 esac
2372 done
2373 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2374 dependency_libs="$temp_xrpath $dependency_libs"
2375 fi
2376 fi
2377
2378 # Make sure dlfiles contains only unique files that won't be dlpreopened
2379 old_dlfiles="$dlfiles"
2380 dlfiles=
2381 for lib in $old_dlfiles; do
2382 case " $dlprefiles $dlfiles " in
2383 *" $lib "*) ;;
2384 *) dlfiles="$dlfiles $lib" ;;
2385 esac
2386 done
2387
2388 # Make sure dlprefiles contains only unique files
2389 old_dlprefiles="$dlprefiles"
2390 dlprefiles=
2391 for lib in $old_dlprefiles; do
2392 case "$dlprefiles " in
2393 *" $lib "*) ;;
2394 *) dlprefiles="$dlprefiles $lib" ;;
2395 esac
2396 done
2397
1820 if test "$build_libtool_libs" = yes; then 2398 if test "$build_libtool_libs" = yes; then
2399 if test -n "$rpath"; then
2400 case $host in
2401 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2402 # these systems don't actually have a c library (as such)!
2403 ;;
2404 *-*-rhapsody* | *-*-darwin1.[012])
2405 # Rhapsody C library is in the System framework
2406 deplibs="$deplibs -framework System"
2407 ;;
2408 *-*-netbsd*)
2409 # Don't link with libc until the a.out ld.so is fixed.
2410 ;;
2411 *)
2412 # Add libc to deplibs on all other systems if necessary.
2413 if test $build_libtool_need_lc = "yes"; then
2414 deplibs="$deplibs -lc"
2415 fi
2416 ;;
2417 esac
2418 fi
2419
1821 # Transform deplibs into only deplibs that can be linked in shared. 2420 # Transform deplibs into only deplibs that can be linked in shared.
1822 name_save=$name 2421 name_save=$name
1823 libname_save=$libname 2422 libname_save=$libname
1824 release_save=$release 2423 release_save=$release
1825 versuffix_save=$versuffix 2424 versuffix_save=$versuffix
1830 release="" 2429 release=""
1831 versuffix="" 2430 versuffix=""
1832 major="" 2431 major=""
1833 newdeplibs= 2432 newdeplibs=
1834 droppeddeps=no 2433 droppeddeps=no
1835 case "$deplibs_check_method" in 2434 case $deplibs_check_method in
1836 pass_all) 2435 pass_all)
1837 # Don't check for shared/static. Everything works. 2436 # Don't check for shared/static. Everything works.
1838 # This might be a little naive. We might want to check 2437 # This might be a little naive. We might want to check
1839 # whether the library exists or not. But this is on 2438 # whether the library exists or not. But this is on
1840 # osf3 & osf4 and I'm not really sure... Just 2439 # osf3 & osf4 and I'm not really sure... Just
1849 $rm conftest.c 2448 $rm conftest.c
1850 cat > conftest.c <<EOF 2449 cat > conftest.c <<EOF
1851 int main() { return 0; } 2450 int main() { return 0; }
1852EOF 2451EOF
1853 $rm conftest 2452 $rm conftest
1854 $C_compiler -o conftest conftest.c $deplibs 2453 $CC -o conftest conftest.c $deplibs
1855 if test $? -eq 0 ; then 2454 if test $? -eq 0 ; then
1856 ldd_output=`ldd conftest` 2455 ldd_output=`ldd conftest`
1857 for i in $deplibs; do 2456 for i in $deplibs; do
1858 name="`expr $i : '-l\(.*\)'`" 2457 name="`expr $i : '-l\(.*\)'`"
1859 # If $name is empty we are operating on a -L argument. 2458 # If $name is empty we are operating on a -L argument.
1860 if test "$name" != "" ; then 2459 if test -n "$name" && test "$name" != "0"; then
1861 libname=`eval \\$echo \"$libname_spec\"` 2460 libname=`eval \\$echo \"$libname_spec\"`
1862 deplib_matches=`eval \\$echo \"$library_names_spec\"` 2461 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1863 set dummy $deplib_matches 2462 set dummy $deplib_matches
1864 deplib_match=$2 2463 deplib_match=$2
1865 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 2464 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
1880 # Error occured in the first compile. Let's try to salvage the situation: 2479 # Error occured in the first compile. Let's try to salvage the situation:
1881 # Compile a seperate program for each library. 2480 # Compile a seperate program for each library.
1882 for i in $deplibs; do 2481 for i in $deplibs; do
1883 name="`expr $i : '-l\(.*\)'`" 2482 name="`expr $i : '-l\(.*\)'`"
1884 # If $name is empty we are operating on a -L argument. 2483 # If $name is empty we are operating on a -L argument.
1885 if test "$name" != "" ; then 2484 if test -n "$name" && test "$name" != "0"; then
1886 $rm conftest 2485 $rm conftest
1887 $C_compiler -o conftest conftest.c $i 2486 $CC -o conftest conftest.c $i
1888 # Did it work? 2487 # Did it work?
1889 if test $? -eq 0 ; then 2488 if test $? -eq 0 ; then
1890 ldd_output=`ldd conftest` 2489 ldd_output=`ldd conftest`
1891 libname=`eval \\$echo \"$libname_spec\"` 2490 libname=`eval \\$echo \"$libname_spec\"`
1892 deplib_matches=`eval \\$echo \"$library_names_spec\"` 2491 deplib_matches=`eval \\$echo \"$library_names_spec\"`
1916 done 2515 done
1917 fi 2516 fi
1918 ;; 2517 ;;
1919 file_magic*) 2518 file_magic*)
1920 set dummy $deplibs_check_method 2519 set dummy $deplibs_check_method
1921 file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`" 2520 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
1922 for a_deplib in $deplibs; do 2521 for a_deplib in $deplibs; do
1923 name="`expr $a_deplib : '-l\(.*\)'`" 2522 name="`expr $a_deplib : '-l\(.*\)'`"
1924 # If $name is empty we are operating on a -L argument. 2523 # If $name is empty we are operating on a -L argument.
1925 if test "$name" != "" ; then 2524 if test -n "$name" && test "$name" != "0"; then
1926 libname=`eval \\$echo \"$libname_spec\"` 2525 libname=`eval \\$echo \"$libname_spec\"`
1927 for i in $lib_search_path; do 2526 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
1928 potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 2527 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
1929 for potent_lib in $potential_libs; do 2528 for potent_lib in $potential_libs; do
1930 # Follow soft links. 2529 # Follow soft links.
1931 if ls -lLd "$potent_lib" 2>/dev/null \ 2530 if ls -lLd "$potent_lib" 2>/dev/null \
1932 | grep " -> " >/dev/null; then 2531 | grep " -> " >/dev/null; then
1933 continue 2532 continue
1934 fi 2533 fi
1935 # The statement above tries to avoid entering an 2534 # The statement above tries to avoid entering an
1936 # endless loop below, in case of cyclic links. 2535 # endless loop below, in case of cyclic links.
1937 # We might still enter an endless loop, since a link 2536 # We might still enter an endless loop, since a link
1938 # loop can be closed while we follow links, 2537 # loop can be closed while we follow links,
1939 # but so what? 2538 # but so what?
1940 potlib="$potent_lib" 2539 potlib="$potent_lib"
1941 while test -h "$potlib" 2>/dev/null; do 2540 while test -h "$potlib" 2>/dev/null; do
1942 potliblink=`ls -ld $potlib | sed 's/.* -> //'` 2541 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
1943 case "$potliblink" in 2542 case $potliblink in
1944 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 2543 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
1945 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 2544 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
1946 esac 2545 esac
1947 done 2546 done
1948 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 2547 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
1966 # Add a -L argument. 2565 # Add a -L argument.
1967 newdeplibs="$newdeplibs $a_deplib" 2566 newdeplibs="$newdeplibs $a_deplib"
1968 fi 2567 fi
1969 done # Gone through all deplibs. 2568 done # Gone through all deplibs.
1970 ;; 2569 ;;
2570 match_pattern*)
2571 set dummy $deplibs_check_method
2572 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2573 for a_deplib in $deplibs; do
2574 name="`expr $a_deplib : '-l\(.*\)'`"
2575 # If $name is empty we are operating on a -L argument.
2576 if test -n "$name" && test "$name" != "0"; then
2577 libname=`eval \\$echo \"$libname_spec\"`
2578 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2579 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2580 for potent_lib in $potential_libs; do
2581 if eval echo \"$potent_lib\" 2>/dev/null \
2582 | sed 10q \
2583 | egrep "$match_pattern_regex" > /dev/null; then
2584 newdeplibs="$newdeplibs $a_deplib"
2585 a_deplib=""
2586 break 2
2587 fi
2588 done
2589 done
2590 if test -n "$a_deplib" ; then
2591 droppeddeps=yes
2592 echo
2593 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2594 echo "*** I have the capability to make that library automatically link in when"
2595 echo "*** you link to this library. But I can only do this if you have a"
2596 echo "*** shared version of the library, which you do not appear to have."
2597 fi
2598 else
2599 # Add a -L argument.
2600 newdeplibs="$newdeplibs $a_deplib"
2601 fi
2602 done # Gone through all deplibs.
2603 ;;
1971 none | unknown | *) 2604 none | unknown | *)
1972 newdeplibs="" 2605 newdeplibs=""
1973 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 2606 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
1974 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | 2607 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
1975 grep . >/dev/null; then 2608 grep . >/dev/null; then
1987 versuffix=$versuffix_save 2620 versuffix=$versuffix_save
1988 major=$major_save 2621 major=$major_save
1989 release=$release_save 2622 release=$release_save
1990 libname=$libname_save 2623 libname=$libname_save
1991 name=$name_save 2624 name=$name_save
2625
2626 case $host in
2627 *-*-rhapsody* | *-*-darwin1.[012])
2628 # On Rhapsody replace the C library is the System framework
2629 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2630 ;;
2631 esac
1992 2632
1993 if test "$droppeddeps" = yes; then 2633 if test "$droppeddeps" = yes; then
1994 if test "$module" = yes; then 2634 if test "$module" = yes; then
1995 echo 2635 echo
1996 echo "*** Warning: libtool could not satisfy all declared inter-library" 2636 echo "*** Warning: libtool could not satisfy all declared inter-library"
2013 fi 2653 fi
2014 else 2654 else
2015 echo "*** The inter-library dependencies that have been dropped here will be" 2655 echo "*** The inter-library dependencies that have been dropped here will be"
2016 echo "*** automatically added whenever a program is linked with this library" 2656 echo "*** automatically added whenever a program is linked with this library"
2017 echo "*** or is declared to -dlopen it." 2657 echo "*** or is declared to -dlopen it."
2658
2659 if test $allow_undefined = no; then
2660 echo
2661 echo "*** Since this library must not contain undefined symbols,"
2662 echo "*** because either the platform does not support them or"
2663 echo "*** it was explicitly requested with -no-undefined,"
2664 echo "*** libtool will only create a static version of it."
2665 if test "$build_old_libs" = no; then
2666 oldlibs="$output_objdir/$libname.$libext"
2667 build_libtool_libs=module
2668 build_old_libs=yes
2669 else
2670 build_libtool_libs=no
2671 fi
2672 fi
2018 fi 2673 fi
2019 fi 2674 fi
2020 # Done checking deplibs! 2675 # Done checking deplibs!
2021 deplibs=$newdeplibs 2676 deplibs=$newdeplibs
2022 fi 2677 fi
2023 2678
2024 # All the library-specific variables (install_libdir is set above). 2679 # All the library-specific variables (install_libdir is set above).
2025 library_names= 2680 library_names=
2026 old_library= 2681 old_library=
2027 dlname= 2682 dlname=
2028 2683
2029 # Test again, we may have decided not to build it any more 2684 # Test again, we may have decided not to build it any more
2030 if test "$build_libtool_libs" = yes; then 2685 if test "$build_libtool_libs" = yes; then
2686 if test $hardcode_into_libs = yes; then
2687 # Hardcode the library paths
2688 hardcode_libdirs=
2689 dep_rpath=
2690 rpath="$finalize_rpath"
2691 test "$mode" != relink && rpath="$compile_rpath$rpath"
2692 for libdir in $rpath; do
2693 if test -n "$hardcode_libdir_flag_spec"; then
2694 if test -n "$hardcode_libdir_separator"; then
2695 if test -z "$hardcode_libdirs"; then
2696 hardcode_libdirs="$libdir"
2697 else
2698 # Just accumulate the unique libdirs.
2699 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2700 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2701 ;;
2702 *)
2703 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2704 ;;
2705 esac
2706 fi
2707 else
2708 eval flag=\"$hardcode_libdir_flag_spec\"
2709 dep_rpath="$dep_rpath $flag"
2710 fi
2711 elif test -n "$runpath_var"; then
2712 case "$perm_rpath " in
2713 *" $libdir "*) ;;
2714 *) perm_rpath="$perm_rpath $libdir" ;;
2715 esac
2716 fi
2717 done
2718 # Substitute the hardcoded libdirs into the rpath.
2719 if test -n "$hardcode_libdir_separator" &&
2720 test -n "$hardcode_libdirs"; then
2721 libdir="$hardcode_libdirs"
2722 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2723 fi
2724 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2725 # We should set the runpath_var.
2726 rpath=
2727 for dir in $perm_rpath; do
2728 rpath="$rpath$dir:"
2729 done
2730 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2731 fi
2732 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2733 fi
2734
2735 shlibpath="$finalize_shlibpath"
2736 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2737 if test -n "$shlibpath"; then
2738 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2739 fi
2740
2031 # Get the real and link names of the library. 2741 # Get the real and link names of the library.
2032 eval library_names=\"$library_names_spec\" 2742 eval library_names=\"$library_names_spec\"
2033 set dummy $library_names 2743 set dummy $library_names
2034 realname="$2" 2744 realname="$2"
2035 shift; shift 2745 shift; shift
2037 if test -n "$soname_spec"; then 2747 if test -n "$soname_spec"; then
2038 eval soname=\"$soname_spec\" 2748 eval soname=\"$soname_spec\"
2039 else 2749 else
2040 soname="$realname" 2750 soname="$realname"
2041 fi 2751 fi
2752 test -z "$dlname" && dlname=$soname
2042 2753
2043 lib="$output_objdir/$realname" 2754 lib="$output_objdir/$realname"
2044 for link 2755 for link
2045 do 2756 do
2046 linknames="$linknames $link" 2757 linknames="$linknames $link"
2047 done 2758 done
2048 2759
2049 # Ensure that we have .o objects for linkers which dislike .lo 2760 # Ensure that we have .o objects for linkers which dislike .lo
2050 # (e.g. aix) incase we are running --disable-static 2761 # (e.g. aix) in case we are running --disable-static
2051 for obj in $libobjs; do 2762 for obj in $libobjs; do
2763 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2764 if test "X$xdir" = "X$obj"; then
2765 xdir="."
2766 else
2767 xdir="$xdir"
2768 fi
2769 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2052 oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"` 2770 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2053 if test ! -f $oldobj; then 2771 if test ! -f $xdir/$oldobj; then
2054 $show "${LN_S} $obj $oldobj" 2772 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2055 $run ${LN_S} $obj $oldobj || exit $? 2773 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2056 fi 2774 fi
2057 done 2775 done
2058 2776
2059 # Use standard objects if they are pic 2777 # Use standard objects if they are pic
2060 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 2778 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2101 fi 2819 fi
2102 generated="$generated $gentop" 2820 generated="$generated $gentop"
2103 2821
2104 for xlib in $convenience; do 2822 for xlib in $convenience; do
2105 # Extract the objects. 2823 # Extract the objects.
2106 case "$xlib" in 2824 case $xlib in
2107 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; 2825 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2108 *) xabs=`pwd`"/$xlib" ;; 2826 *) xabs=`pwd`"/$xlib" ;;
2109 esac 2827 esac
2110 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` 2828 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2111 xdir="$gentop/$xlib" 2829 xdir="$gentop/$xlib"
2126 fi 2844 fi
2127 fi 2845 fi
2128 2846
2129 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 2847 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2130 eval flag=\"$thread_safe_flag_spec\" 2848 eval flag=\"$thread_safe_flag_spec\"
2131 linkopts="$linkopts $flag" 2849 linker_flags="$linker_flags $flag"
2850 fi
2851
2852 # Make a backup of the uninstalled library when relinking
2853 if test "$mode" = relink; then
2854 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2132 fi 2855 fi
2133 2856
2134 # Do each of the archive commands. 2857 # Do each of the archive commands.
2135 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 2858 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2136 eval cmds=\"$archive_expsym_cmds\" 2859 eval cmds=\"$archive_expsym_cmds\"
2143 $show "$cmd" 2866 $show "$cmd"
2144 $run eval "$cmd" || exit $? 2867 $run eval "$cmd" || exit $?
2145 done 2868 done
2146 IFS="$save_ifs" 2869 IFS="$save_ifs"
2147 2870
2871 # Restore the uninstalled library and exit
2872 if test "$mode" = relink; then
2873 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2874 exit 0
2875 fi
2876
2148 # Create links to the real library. 2877 # Create links to the real library.
2149 for linkname in $linknames; do 2878 for linkname in $linknames; do
2150 if test "$realname" != "$linkname"; then 2879 if test "$realname" != "$linkname"; then
2151 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 2880 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2152 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 2881 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2159 dlname="$soname" 2888 dlname="$soname"
2160 fi 2889 fi
2161 fi 2890 fi
2162 ;; 2891 ;;
2163 2892
2164 *.lo | *.o | *.obj) 2893 obj)
2165 if test -n "$link_against_libtool_libs"; then
2166 $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
2167 exit 1
2168 fi
2169
2170 if test -n "$deplibs"; then 2894 if test -n "$deplibs"; then
2171 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 2895 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2172 fi 2896 fi
2173 2897
2174 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 2898 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2189 2913
2190 if test -n "$release"; then 2914 if test -n "$release"; then
2191 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 2915 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2192 fi 2916 fi
2193 2917
2194 case "$output" in 2918 case $output in
2195 *.lo) 2919 *.lo)
2196 if test -n "$objs"; then 2920 if test -n "$objs$old_deplibs"; then
2197 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 2921 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2198 exit 1 2922 exit 1
2199 fi 2923 fi
2200 libobj="$output" 2924 libobj="$output"
2201 obj=`$echo "X$output" | $Xsed -e "$lo2o"` 2925 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2215 # the extraction. 2939 # the extraction.
2216 reload_conv_objs= 2940 reload_conv_objs=
2217 gentop= 2941 gentop=
2218 # reload_cmds runs $LD directly, so let us get rid of 2942 # reload_cmds runs $LD directly, so let us get rid of
2219 # -Wl from whole_archive_flag_spec 2943 # -Wl from whole_archive_flag_spec
2220 wl= 2944 wl=
2221 2945
2222 if test -n "$convenience"; then 2946 if test -n "$convenience"; then
2223 if test -n "$whole_archive_flag_spec"; then 2947 if test -n "$whole_archive_flag_spec"; then
2224 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 2948 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2225 else 2949 else
2234 fi 2958 fi
2235 generated="$generated $gentop" 2959 generated="$generated $gentop"
2236 2960
2237 for xlib in $convenience; do 2961 for xlib in $convenience; do
2238 # Extract the objects. 2962 # Extract the objects.
2239 case "$xlib" in 2963 case $xlib in
2240 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; 2964 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2241 *) xabs=`pwd`"/$xlib" ;; 2965 *) xabs=`pwd`"/$xlib" ;;
2242 esac 2966 esac
2243 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` 2967 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2244 xdir="$gentop/$xlib" 2968 xdir="$gentop/$xlib"
2258 done 2982 done
2259 fi 2983 fi
2260 fi 2984 fi
2261 2985
2262 # Create the old-style object. 2986 # Create the old-style object.
2263 reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" 2987 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
2264 2988
2265 output="$obj" 2989 output="$obj"
2266 eval cmds=\"$reload_cmds\" 2990 eval cmds=\"$reload_cmds\"
2267 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 2991 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2268 for cmd in $cmds; do 2992 for cmd in $cmds; do
2293 $show "echo timestamp > $libobj" 3017 $show "echo timestamp > $libobj"
2294 $run eval "echo timestamp > $libobj" || exit $? 3018 $run eval "echo timestamp > $libobj" || exit $?
2295 exit 0 3019 exit 0
2296 fi 3020 fi
2297 3021
2298 if test -n "$pic_flag"; then 3022 if test -n "$pic_flag" || test "$pic_mode" != default; then
2299 # Only do commands if we really have different PIC objects. 3023 # Only do commands if we really have different PIC objects.
2300 reload_objs="$libobjs $reload_conv_objs" 3024 reload_objs="$libobjs $reload_conv_objs"
2301 output="$libobj" 3025 output="$libobj"
2302 eval cmds=\"$reload_cmds\" 3026 eval cmds=\"$reload_cmds\"
2303 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 3027 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2309 IFS="$save_ifs" 3033 IFS="$save_ifs"
2310 else 3034 else
2311 # Just create a symlink. 3035 # Just create a symlink.
2312 $show $rm $libobj 3036 $show $rm $libobj
2313 $run $rm $libobj 3037 $run $rm $libobj
2314 $show "$LN_S $obj $libobj" 3038 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
2315 $run $LN_S $obj $libobj || exit $? 3039 if test "X$xdir" = "X$libobj"; then
3040 xdir="."
3041 else
3042 xdir="$xdir"
3043 fi
3044 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3045 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3046 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3047 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
2316 fi 3048 fi
2317 3049
2318 if test -n "$gentop"; then 3050 if test -n "$gentop"; then
2319 $show "${rm}r $gentop" 3051 $show "${rm}r $gentop"
2320 $run ${rm}r $gentop 3052 $run ${rm}r $gentop
2321 fi 3053 fi
2322 3054
2323 exit 0 3055 exit 0
2324 ;; 3056 ;;
2325 3057
2326 # Anything else should be a program. 3058 prog)
2327 *) 3059 case $host in
3060 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3061 esac
2328 if test -n "$vinfo"; then 3062 if test -n "$vinfo"; then
2329 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 3063 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
2330 fi 3064 fi
2331 3065
2332 if test -n "$release"; then 3066 if test -n "$release"; then
2333 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 3067 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
2334 fi 3068 fi
2335 3069
2336 if test "$preload" = yes; then 3070 if test "$preload" = yes; then
2337 if test "$dlopen" = unknown && test "$dlopen_self" = unknown && 3071 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
2338 test "$dlopen_self_static" = unknown; then 3072 test "$dlopen_self_static" = unknown; then
2339 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 3073 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
2340 fi 3074 fi
2341 fi 3075 fi
2342 3076
3077 case $host in
3078 *-*-rhapsody* | *-*-darwin1.[012])
3079 # On Rhapsody replace the C library is the System framework
3080 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3081 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3082 ;;
3083 esac
3084
3085 compile_command="$compile_command $compile_deplibs"
3086 finalize_command="$finalize_command $finalize_deplibs"
3087
2343 if test -n "$rpath$xrpath"; then 3088 if test -n "$rpath$xrpath"; then
2344 # If the user specified any rpath flags, then add them. 3089 # If the user specified any rpath flags, then add them.
2345 for libdir in $rpath $xrpath; do 3090 for libdir in $rpath $xrpath; do
2346 # This is the magic to use -rpath. 3091 # This is the magic to use -rpath.
2347 case "$compile_rpath " in
2348 *" $libdir "*) ;;
2349 *) compile_rpath="$compile_rpath $libdir" ;;
2350 esac
2351 case "$finalize_rpath " in 3092 case "$finalize_rpath " in
2352 *" $libdir "*) ;; 3093 *" $libdir "*) ;;
2353 *) finalize_rpath="$finalize_rpath $libdir" ;; 3094 *) finalize_rpath="$finalize_rpath $libdir" ;;
2354 esac 3095 esac
2355 done 3096 done
2363 if test -n "$hardcode_libdir_separator"; then 3104 if test -n "$hardcode_libdir_separator"; then
2364 if test -z "$hardcode_libdirs"; then 3105 if test -z "$hardcode_libdirs"; then
2365 hardcode_libdirs="$libdir" 3106 hardcode_libdirs="$libdir"
2366 else 3107 else
2367 # Just accumulate the unique libdirs. 3108 # Just accumulate the unique libdirs.
2368 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in 3109 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2369 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3110 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2370 ;; 3111 ;;
2371 *) 3112 *)
2372 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3113 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2373 ;; 3114 ;;
2381 case "$perm_rpath " in 3122 case "$perm_rpath " in
2382 *" $libdir "*) ;; 3123 *" $libdir "*) ;;
2383 *) perm_rpath="$perm_rpath $libdir" ;; 3124 *) perm_rpath="$perm_rpath $libdir" ;;
2384 esac 3125 esac
2385 fi 3126 fi
3127 case $host in
3128 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3129 case :$dllsearchpath: in
3130 *":$libdir:"*) ;;
3131 *) dllsearchpath="$dllsearchpath:$libdir";;
3132 esac
3133 ;;
3134 esac
2386 done 3135 done
2387 # Substitute the hardcoded libdirs into the rpath. 3136 # Substitute the hardcoded libdirs into the rpath.
2388 if test -n "$hardcode_libdir_separator" && 3137 if test -n "$hardcode_libdir_separator" &&
2389 test -n "$hardcode_libdirs"; then 3138 test -n "$hardcode_libdirs"; then
2390 libdir="$hardcode_libdirs" 3139 libdir="$hardcode_libdirs"
2399 if test -n "$hardcode_libdir_separator"; then 3148 if test -n "$hardcode_libdir_separator"; then
2400 if test -z "$hardcode_libdirs"; then 3149 if test -z "$hardcode_libdirs"; then
2401 hardcode_libdirs="$libdir" 3150 hardcode_libdirs="$libdir"
2402 else 3151 else
2403 # Just accumulate the unique libdirs. 3152 # Just accumulate the unique libdirs.
2404 case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in 3153 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2405 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3154 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2406 ;; 3155 ;;
2407 *) 3156 *)
2408 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3157 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2409 ;; 3158 ;;
2426 libdir="$hardcode_libdirs" 3175 libdir="$hardcode_libdirs"
2427 eval rpath=\" $hardcode_libdir_flag_spec\" 3176 eval rpath=\" $hardcode_libdir_flag_spec\"
2428 fi 3177 fi
2429 finalize_rpath="$rpath" 3178 finalize_rpath="$rpath"
2430 3179
2431 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2432 if test "X$output_objdir" = "X$output"; then
2433 output_objdir="$objdir"
2434 else
2435 output_objdir="$output_objdir/$objdir"
2436 fi
2437
2438 # Create the binary in the object directory, then wrap it.
2439 if test ! -d $output_objdir; then
2440 $show "$mkdir $output_objdir"
2441 $run $mkdir $output_objdir
2442 status=$?
2443 if test $status -ne 0 && test ! -d $output_objdir; then
2444 exit $status
2445 fi
2446 fi
2447
2448 if test -n "$libobjs" && test "$build_old_libs" = yes; then 3180 if test -n "$libobjs" && test "$build_old_libs" = yes; then
2449 # Transform all the library objects into standard objects. 3181 # Transform all the library objects into standard objects.
2450 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 3182 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2451 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 3183 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2452 fi 3184 fi
2459 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 3191 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
2460 fi 3192 fi
2461 fi 3193 fi
2462 3194
2463 if test -n "$dlsyms"; then 3195 if test -n "$dlsyms"; then
2464 case "$dlsyms" in 3196 case $dlsyms in
2465 "") ;; 3197 "") ;;
2466 *.c) 3198 *.c)
2467 # Discover the nlist of each of the dlfiles. 3199 # Discover the nlist of each of the dlfiles.
2468 nlist="$output_objdir/${outputname}.nm" 3200 nlist="$output_objdir/${outputname}.nm"
2469 3201
2491 $show "generating symbol list for \`$output'" 3223 $show "generating symbol list for \`$output'"
2492 3224
2493 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 3225 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
2494 3226
2495 # Add our own program objects to the symbol list. 3227 # Add our own program objects to the symbol list.
2496 progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 3228 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2497 for arg in $progfiles; do 3229 for arg in $progfiles; do
2498 $show "extracting global C symbols from \`$arg'" 3230 $show "extracting global C symbols from \`$arg'"
2499 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 3231 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
2500 done 3232 done
2501 3233
2502 if test -n "$exclude_expsyms"; then 3234 if test -n "$exclude_expsyms"; then
2503 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 3235 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
2504 $run eval '$mv "$nlist"T "$nlist"' 3236 $run eval '$mv "$nlist"T "$nlist"'
2505 fi 3237 fi
2506 3238
2507 if test -n "$export_symbols_regex"; then 3239 if test -n "$export_symbols_regex"; then
2508 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' 3240 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
2509 $run eval '$mv "$nlist"T "$nlist"' 3241 $run eval '$mv "$nlist"T "$nlist"'
2510 fi 3242 fi
2511 3243
2590#endif\ 3322#endif\
2591" 3323"
2592 fi 3324 fi
2593 3325
2594 pic_flag_for_symtable= 3326 pic_flag_for_symtable=
2595 case "$host" in 3327 case $host in
2596 # compiling the symbol table file with pic_flag works around 3328 # compiling the symbol table file with pic_flag works around
2597 # a FreeBSD bug that causes programs to crash when -lm is 3329 # a FreeBSD bug that causes programs to crash when -lm is
2598 # linked before any other PIC object. But we must not use 3330 # linked before any other PIC object. But we must not use
2599 # pic_flag when linking with -static. The problem exists in 3331 # pic_flag when linking with -static. The problem exists in
2600 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 3332 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
2601 *-*-freebsd2*|*-*-freebsd3.0*) 3333 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
2602 case "$compile_command " in 3334 case "$compile_command " in
2603 *" -static "*) ;; 3335 *" -static "*) ;;
2604 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; 3336 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3337 esac;;
3338 *-*-hpux*)
3339 case "$compile_command " in
3340 *" -static "*) ;;
3341 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
2605 esac 3342 esac
2606 esac 3343 esac
2607 3344
2608 # Now compile the dynamic symbol file. 3345 # Now compile the dynamic symbol file.
2609 $show "(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 3346 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
2610 $run eval '(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 3347 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
2611 3348
2612 # Clean up the generated files. 3349 # Clean up the generated files.
2613 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 3350 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
2614 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 3351 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
2615 3352
2630 # Nullify the symbol file. 3367 # Nullify the symbol file.
2631 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` 3368 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
2632 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` 3369 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
2633 fi 3370 fi
2634 3371
2635 if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then 3372 if test $need_relink = no || test "$build_libtool_libs" != yes; then
2636 # Replace the output file specification. 3373 # Replace the output file specification.
2637 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 3374 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
2638 link_command="$compile_command$compile_rpath" 3375 link_command="$compile_command$compile_rpath"
2639 3376
2640 # We have no uninstalled library dependencies, so finalize right now. 3377 # We have no uninstalled library dependencies, so finalize right now.
2641 $show "$link_command" 3378 $show "$link_command"
2642 $run eval "$link_command" 3379 $run eval "$link_command"
2643 status=$? 3380 status=$?
2644 3381
2645 # Delete the generated files. 3382 # Delete the generated files.
2646 if test -n "$dlsyms"; then 3383 if test -n "$dlsyms"; then
2647 $show "$rm $output_objdir/${outputname}S.${objext}" 3384 $show "$rm $output_objdir/${outputname}S.${objext}"
2648 $run $rm "$output_objdir/${outputname}S.${objext}" 3385 $run $rm "$output_objdir/${outputname}S.${objext}"
2649 fi 3386 fi
2653 3390
2654 if test -n "$shlibpath_var"; then 3391 if test -n "$shlibpath_var"; then
2655 # We should set the shlibpath_var 3392 # We should set the shlibpath_var
2656 rpath= 3393 rpath=
2657 for dir in $temp_rpath; do 3394 for dir in $temp_rpath; do
2658 case "$dir" in 3395 case $dir in
2659 [\\/]* | [A-Za-z]:[\\/]*) 3396 [\\/]* | [A-Za-z]:[\\/]*)
2660 # Absolute path. 3397 # Absolute path.
2661 rpath="$rpath$dir:" 3398 rpath="$rpath$dir:"
2662 ;; 3399 ;;
2663 *) 3400 *)
2695 done 3432 done
2696 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 3433 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
2697 fi 3434 fi
2698 fi 3435 fi
2699 3436
3437 if test "$no_install" = yes; then
3438 # We don't need to create a wrapper script.
3439 link_command="$compile_var$compile_command$compile_rpath"
3440 # Replace the output file specification.
3441 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3442 # Delete the old output file.
3443 $run $rm $output
3444 # Link the executable and exit
3445 $show "$link_command"
3446 $run eval "$link_command" || exit $?
3447 exit 0
3448 fi
3449
2700 if test "$hardcode_action" = relink; then 3450 if test "$hardcode_action" = relink; then
2701 # Fast installation is not supported 3451 # Fast installation is not supported
2702 link_command="$compile_var$compile_command$compile_rpath" 3452 link_command="$compile_var$compile_command$compile_rpath"
2703 relink_command="$finalize_var$finalize_command$finalize_rpath" 3453 relink_command="$finalize_var$finalize_command$finalize_rpath"
2704 3454
2705 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 3455 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
2706 $echo "$modename: \`$output' will be relinked during installation" 1>&2 3456 $echo "$modename: \`$output' will be relinked during installation" 1>&2
2707 else 3457 else
2708 if test "$fast_install" != no; then 3458 if test "$fast_install" != no; then
2709 link_command="$finalize_var$compile_command$finalize_rpath" 3459 link_command="$finalize_var$compile_command$finalize_rpath"
2719 fi 3469 fi
2720 fi 3470 fi
2721 3471
2722 # Replace the output file specification. 3472 # Replace the output file specification.
2723 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 3473 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
2724 3474
2725 # Delete the old output files. 3475 # Delete the old output files.
2726 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 3476 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
2727 3477
2728 $show "$link_command" 3478 $show "$link_command"
2729 $run eval "$link_command" || exit $? 3479 $run eval "$link_command" || exit $?
2731 # Now create the wrapper script. 3481 # Now create the wrapper script.
2732 $show "creating $output" 3482 $show "creating $output"
2733 3483
2734 # Quote the relink command for shipping. 3484 # Quote the relink command for shipping.
2735 if test -n "$relink_command"; then 3485 if test -n "$relink_command"; then
3486 # Preserve any variables that may affect compiler behavior
3487 for var in $variables_saved_for_relink; do
3488 if eval test -z \"\${$var+set}\"; then
3489 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3490 elif eval var_value=\$$var; test -z "$var_value"; then
3491 relink_command="$var=; export $var; $relink_command"
3492 else
3493 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3494 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3495 fi
3496 done
3497 relink_command="cd `pwd`; $relink_command"
2736 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` 3498 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
2737 fi 3499 fi
2738 3500
2739 # Quote $echo for shipping. 3501 # Quote $echo for shipping.
2740 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then 3502 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
2741 case "$0" in 3503 case $0 in
2742 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; 3504 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
2743 *) qecho="$SHELL `pwd`/$0 --fallback-echo";; 3505 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
2744 esac 3506 esac
2745 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 3507 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
2746 else 3508 else
2751 if test -z "$run"; then 3513 if test -z "$run"; then
2752 # win32 will think the script is a binary if it has 3514 # win32 will think the script is a binary if it has
2753 # a .exe suffix, so we strip it off here. 3515 # a .exe suffix, so we strip it off here.
2754 case $output in 3516 case $output in
2755 *.exe) output=`echo $output|sed 's,.exe$,,'` ;; 3517 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3518 esac
3519 # test for cygwin because mv fails w/o .exe extensions
3520 case $host in
3521 *cygwin*) exeext=.exe ;;
3522 *) exeext= ;;
2756 esac 3523 esac
2757 $rm $output 3524 $rm $output
2758 trap "$rm $output; exit 1" 1 2 15 3525 trap "$rm $output; exit 1" 1 2 15
2759 3526
2760 $echo > $output "\ 3527 $echo > $output "\
2774Xsed='sed -e 1s/^X//' 3541Xsed='sed -e 1s/^X//'
2775sed_quote_subst='$sed_quote_subst' 3542sed_quote_subst='$sed_quote_subst'
2776 3543
2777# The HP-UX ksh and POSIX shell print the target directory to stdout 3544# The HP-UX ksh and POSIX shell print the target directory to stdout
2778# if CDPATH is set. 3545# if CDPATH is set.
2779if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi 3546if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
2780 3547
2781relink_command=\"$relink_command\" 3548relink_command=\"$relink_command\"
2782 3549
2783# This environment variable determines our operation mode. 3550# This environment variable determines our operation mode.
2784if test \"\$libtool_install_magic\" = \"$magic\"; then 3551if test \"\$libtool_install_magic\" = \"$magic\"; then
2785 # install mode needs the following variable: 3552 # install mode needs the following variable:
2786 link_against_libtool_libs='$link_against_libtool_libs' 3553 notinst_deplibs='$notinst_deplibs'
2787else 3554else
2788 # When we are sourced in execute mode, \$file and \$echo are already set. 3555 # When we are sourced in execute mode, \$file and \$echo are already set.
2789 if test \"\$libtool_execute_magic\" != \"$magic\"; then 3556 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2790 echo=\"$qecho\" 3557 echo=\"$qecho\"
2791 file=\"\$0\" 3558 file=\"\$0\"
2814 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 3581 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
2815 3582
2816 # If there was a directory component, then change thisdir. 3583 # If there was a directory component, then change thisdir.
2817 if test \"x\$destdir\" != \"x\$file\"; then 3584 if test \"x\$destdir\" != \"x\$file\"; then
2818 case \"\$destdir\" in 3585 case \"\$destdir\" in
2819 [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; 3586 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
2820 *) thisdir=\"\$thisdir/\$destdir\" ;; 3587 *) thisdir=\"\$thisdir/\$destdir\" ;;
2821 esac 3588 esac
2822 fi 3589 fi
2823 3590
2824 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 3591 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
2830 test -n \"\$absdir\" && thisdir=\"\$absdir\" 3597 test -n \"\$absdir\" && thisdir=\"\$absdir\"
2831" 3598"
2832 3599
2833 if test "$fast_install" = yes; then 3600 if test "$fast_install" = yes; then
2834 echo >> $output "\ 3601 echo >> $output "\
2835 program=lt-'$outputname' 3602 program=lt-'$outputname'$exeext
2836 progdir=\"\$thisdir/$objdir\" 3603 progdir=\"\$thisdir/$objdir\"
2837 3604
2838 if test ! -f \"\$progdir/\$program\" || \\ 3605 if test ! -f \"\$progdir/\$program\" || \\
2839 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ 3606 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
2840 test \"X\$file\" != \"X\$progdir/\$program\"; }; then 3607 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
2841 3608
2842 file=\"\$\$-\$program\" 3609 file=\"\$\$-\$program\"
2849 3616
2850 echo >> $output "\ 3617 echo >> $output "\
2851 3618
2852 # relink executable if necessary 3619 # relink executable if necessary
2853 if test -n \"\$relink_command\"; then 3620 if test -n \"\$relink_command\"; then
2854 if (cd \"\$thisdir\" && eval \$relink_command); then : 3621 if (eval \$relink_command); then :
2855 else 3622 else
2856 $rm \"\$progdir/\$file\" 3623 $rm \"\$progdir/\$file\"
2857 exit 1 3624 exit 1
2858 fi 3625 fi
2859 fi 3626 fi
2863 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 3630 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
2864 $rm \"\$progdir/\$file\" 3631 $rm \"\$progdir/\$file\"
2865 fi" 3632 fi"
2866 else 3633 else
2867 echo >> $output "\ 3634 echo >> $output "\
2868 program='$outputname$exeext' 3635 program='$outputname'
2869 progdir=\"\$thisdir/$objdir\" 3636 progdir=\"\$thisdir/$objdir\"
2870" 3637"
2871 fi 3638 fi
2872 3639
2873 echo >> $output "\ 3640 echo >> $output "\
2899 $echo >> $output "\ 3666 $echo >> $output "\
2900 if test \"\$libtool_execute_magic\" != \"$magic\"; then 3667 if test \"\$libtool_execute_magic\" != \"$magic\"; then
2901 # Run the actual program with our arguments. 3668 # Run the actual program with our arguments.
2902" 3669"
2903 case $host in 3670 case $host in
2904 *-*-cygwin* | *-*-mingw | *-*-os2*)
2905 # win32 systems need to use the prog path for dll 3671 # win32 systems need to use the prog path for dll
2906 # lookup to work 3672 # lookup to work
3673 *-*-cygwin* | *-*-pw32*)
3674 $echo >> $output "\
3675 exec \$progdir/\$program \${1+\"\$@\"}
3676"
3677 ;;
3678
3679 # Backslashes separate directories on plain windows
3680 *-*-mingw | *-*-os2*)
2907 $echo >> $output "\ 3681 $echo >> $output "\
2908 exec \$progdir\\\\\$program \${1+\"\$@\"} 3682 exec \$progdir\\\\\$program \${1+\"\$@\"}
2909" 3683"
2910 ;; 3684 ;;
3685
2911 *) 3686 *)
2912 $echo >> $output "\ 3687 $echo >> $output "\
2913 # Export the path to the program. 3688 # Export the path to the program.
2914 PATH=\"\$progdir:\$PATH\" 3689 PATH=\"\$progdir:\$PATH\"
2915 export PATH 3690 export PATH
2947 else 3722 else
2948 if test "$build_libtool_libs" = module; then 3723 if test "$build_libtool_libs" = module; then
2949 oldobjs="$libobjs_save" 3724 oldobjs="$libobjs_save"
2950 build_libtool_libs=no 3725 build_libtool_libs=no
2951 else 3726 else
2952 oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` 3727 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
2953 fi 3728 fi
2954 addlibs="$old_convenience" 3729 addlibs="$old_convenience"
2955 fi 3730 fi
2956 3731
2957 if test -n "$addlibs"; then 3732 if test -n "$addlibs"; then
2963 status=$? 3738 status=$?
2964 if test $status -ne 0 && test ! -d "$gentop"; then 3739 if test $status -ne 0 && test ! -d "$gentop"; then
2965 exit $status 3740 exit $status
2966 fi 3741 fi
2967 generated="$generated $gentop" 3742 generated="$generated $gentop"
2968 3743
2969 # Add in members from convenience archives. 3744 # Add in members from convenience archives.
2970 for xlib in $addlibs; do 3745 for xlib in $addlibs; do
2971 # Extract the objects. 3746 # Extract the objects.
2972 case "$xlib" in 3747 case $xlib in
2973 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; 3748 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2974 *) xabs=`pwd`"/$xlib" ;; 3749 *) xabs=`pwd`"/$xlib" ;;
2975 esac 3750 esac
2976 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` 3751 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2977 xdir="$gentop/$xlib" 3752 xdir="$gentop/$xlib"
2993 3768
2994 # Do each command in the archive commands. 3769 # Do each command in the archive commands.
2995 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 3770 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
2996 eval cmds=\"$old_archive_from_new_cmds\" 3771 eval cmds=\"$old_archive_from_new_cmds\"
2997 else 3772 else
2998 # Ensure that we have .o objects in place incase we decided 3773 # Ensure that we have .o objects in place in case we decided
2999 # not to build a shared library, and have fallen back to building 3774 # not to build a shared library, and have fallen back to building
3000 # static libs even though --disable-static was passed! 3775 # static libs even though --disable-static was passed!
3001 for oldobj in $oldobjs; do 3776 for oldobj in $oldobjs; do
3002 if test ! -f $oldobj; then 3777 if test ! -f $oldobj; then
3778 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3779 if test "X$xdir" = "X$oldobj"; then
3780 xdir="."
3781 else
3782 xdir="$xdir"
3783 fi
3784 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3003 obj=`$echo "X$oldobj" | $Xsed -e "$o2lo"` 3785 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3004 $show "${LN_S} $obj $oldobj" 3786 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3005 $run ${LN_S} $obj $oldobj || exit $? 3787 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3006 fi 3788 fi
3007 done 3789 done
3008 3790
3009 eval cmds=\"$old_archive_cmds\" 3791 eval cmds=\"$old_archive_cmds\"
3010 fi 3792 fi
3021 $show "${rm}r$generated" 3803 $show "${rm}r$generated"
3022 $run ${rm}r$generated 3804 $run ${rm}r$generated
3023 fi 3805 fi
3024 3806
3025 # Now create the libtool archive. 3807 # Now create the libtool archive.
3026 case "$output" in 3808 case $output in
3027 *.la) 3809 *.la)
3028 old_library= 3810 old_library=
3029 test "$build_old_libs" = yes && old_library="$libname.$libext" 3811 test "$build_old_libs" = yes && old_library="$libname.$libext"
3030 $show "creating $output" 3812 $show "creating $output"
3031 3813
3032 if test -n "$xrpath"; then 3814 # Preserve any variables that may affect compiler behavior
3033 temp_xrpath= 3815 for var in $variables_saved_for_relink; do
3034 for libdir in $xrpath; do 3816 if eval test -z \"\${$var+set}\"; then
3035 temp_xrpath="$temp_xrpath -R$libdir" 3817 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3036 done 3818 elif eval var_value=\$$var; test -z "$var_value"; then
3037 dependency_libs="$temp_xrpath $dependency_libs" 3819 relink_command="$var=; export $var; $relink_command"
3038 fi 3820 else
3821 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3822 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3823 fi
3824 done
3825 # Quote the link command for shipping.
3826 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3827 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3039 3828
3040 # Only create the output if not a dry run. 3829 # Only create the output if not a dry run.
3041 if test -z "$run"; then 3830 if test -z "$run"; then
3042 for installed in no yes; do 3831 for installed in no yes; do
3043 if test "$installed" = yes; then 3832 if test "$installed" = yes; then
3044 if test -z "$install_libdir"; then 3833 if test -z "$install_libdir"; then
3045 break 3834 break
3046 fi 3835 fi
3047 output="$output_objdir/$outputname"i 3836 output="$output_objdir/$outputname"i
3837 # Replace all uninstalled libtool libraries with the installed ones
3838 newdependency_libs=
3839 for deplib in $dependency_libs; do
3840 case $deplib in
3841 *.la)
3842 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3843 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3844 if test -z "$libdir"; then
3845 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3846 exit 1
3847 fi
3848 newdependency_libs="$newdependency_libs $libdir/$name"
3849 ;;
3850 *) newdependency_libs="$newdependency_libs $deplib" ;;
3851 esac
3852 done
3853 dependency_libs="$newdependency_libs"
3854 newdlfiles=
3855 for lib in $dlfiles; do
3856 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3857 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3858 if test -z "$libdir"; then
3859 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3860 exit 1
3861 fi
3862 newdlfiles="$newdlfiles $libdir/$name"
3863 done
3864 dlfiles="$newdlfiles"
3865 newdlprefiles=
3866 for lib in $dlprefiles; do
3867 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3868 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3869 if test -z "$libdir"; then
3870 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3871 exit 1
3872 fi
3873 newdlprefiles="$newdlprefiles $libdir/$name"
3874 done
3875 dlprefiles="$newdlprefiles"
3048 fi 3876 fi
3049 $rm $output 3877 $rm $output
3878 # place dlname in correct position for cygwin
3879 tdlname=$dlname
3880 case $host,$output,$installed,$module,$dlname in
3881 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3882 esac
3050 $echo > $output "\ 3883 $echo > $output "\
3051# $outputname - a libtool library file 3884# $outputname - a libtool library file
3052# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 3885# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3053# 3886#
3054# Please DO NOT delete this file! 3887# Please DO NOT delete this file!
3055# It is necessary for linking the library. 3888# It is necessary for linking the library.
3056 3889
3057# The name that we can dlopen(3). 3890# The name that we can dlopen(3).
3058dlname='$dlname' 3891dlname='$tdlname'
3059 3892
3060# Names of this library. 3893# Names of this library.
3061library_names='$library_names' 3894library_names='$library_names'
3062 3895
3063# The name of the static archive. 3896# The name of the static archive.
3072revision=$revision 3905revision=$revision
3073 3906
3074# Is this an already installed library? 3907# Is this an already installed library?
3075installed=$installed 3908installed=$installed
3076 3909
3910# Files to dlopen/dlpreopen
3911dlopen='$dlfiles'
3912dlpreopen='$dlprefiles'
3913
3077# Directory that this library needs to be installed in: 3914# Directory that this library needs to be installed in:
3078libdir='$install_libdir'\ 3915libdir='$install_libdir'"
3079" 3916 if test "$installed" = no && test $need_relink = yes; then
3917 $echo >> $output "\
3918relink_command=\"$relink_command\""
3919 fi
3080 done 3920 done
3081 fi 3921 fi
3082 3922
3083 # Do a symbolic link so that the libtool archive can be found in 3923 # Do a symbolic link so that the libtool archive can be found in
3084 # LD_LIBRARY_PATH before the program is installed. 3924 # LD_LIBRARY_PATH before the program is installed.
3085 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 3925 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3086 $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? 3926 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3087 ;; 3927 ;;
3088 esac 3928 esac
3089 exit 0 3929 exit 0
3090 ;; 3930 ;;
3091 3931
3093 install) 3933 install)
3094 modename="$modename: install" 3934 modename="$modename: install"
3095 3935
3096 # There may be an optional sh(1) argument at the beginning of 3936 # There may be an optional sh(1) argument at the beginning of
3097 # install_prog (especially on Windows NT). 3937 # install_prog (especially on Windows NT).
3098 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then 3938 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3939 # Allow the use of GNU shtool's install command.
3940 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3099 # Aesthetically quote it. 3941 # Aesthetically quote it.
3100 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 3942 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3101 case "$arg" in 3943 case $arg in
3102 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 3944 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3103 arg="\"$arg\"" 3945 arg="\"$arg\""
3104 ;; 3946 ;;
3105 esac 3947 esac
3106 install_prog="$arg " 3948 install_prog="$arg "
3112 fi 3954 fi
3113 3955
3114 # The real first argument should be the name of the installation program. 3956 # The real first argument should be the name of the installation program.
3115 # Aesthetically quote it. 3957 # Aesthetically quote it.
3116 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 3958 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3117 case "$arg" in 3959 case $arg in
3118 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 3960 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3119 arg="\"$arg\"" 3961 arg="\"$arg\""
3120 ;; 3962 ;;
3121 esac 3963 esac
3122 install_prog="$install_prog$arg" 3964 install_prog="$install_prog$arg"
3135 files="$files $dest" 3977 files="$files $dest"
3136 dest="$arg" 3978 dest="$arg"
3137 continue 3979 continue
3138 fi 3980 fi
3139 3981
3140 case "$arg" in 3982 case $arg in
3141 -d) isdir=yes ;; 3983 -d) isdir=yes ;;
3142 -f) prev="-f" ;; 3984 -f) prev="-f" ;;
3143 -g) prev="-g" ;; 3985 -g) prev="-g" ;;
3144 -m) prev="-m" ;; 3986 -m) prev="-m" ;;
3145 -o) prev="-o" ;; 3987 -o) prev="-o" ;;
3160 ;; 4002 ;;
3161 esac 4003 esac
3162 4004
3163 # Aesthetically quote the argument. 4005 # Aesthetically quote the argument.
3164 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 4006 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3165 case "$arg" in 4007 case $arg in
3166 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 4008 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3167 arg="\"$arg\"" 4009 arg="\"$arg\""
3168 ;; 4010 ;;
3169 esac 4011 esac
3170 install_prog="$install_prog $arg" 4012 install_prog="$install_prog $arg"
3211 $echo "$modename: \`$dest' is not a directory" 1>&2 4053 $echo "$modename: \`$dest' is not a directory" 1>&2
3212 $echo "$help" 1>&2 4054 $echo "$help" 1>&2
3213 exit 1 4055 exit 1
3214 fi 4056 fi
3215 fi 4057 fi
3216 case "$destdir" in 4058 case $destdir in
3217 [\\/]* | [A-Za-z]:[\\/]*) ;; 4059 [\\/]* | [A-Za-z]:[\\/]*) ;;
3218 *) 4060 *)
3219 for file in $files; do 4061 for file in $files; do
3220 case "$file" in 4062 case $file in
3221 *.lo) ;; 4063 *.lo) ;;
3222 *) 4064 *)
3223 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 4065 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
3224 $echo "$help" 1>&2 4066 $echo "$help" 1>&2
3225 exit 1 4067 exit 1
3237 future_libdirs= 4079 future_libdirs=
3238 current_libdirs= 4080 current_libdirs=
3239 for file in $files; do 4081 for file in $files; do
3240 4082
3241 # Do each installation. 4083 # Do each installation.
3242 case "$file" in 4084 case $file in
3243 *.a | *.lib) 4085 *.$libext)
3244 # Do the static libraries later. 4086 # Do the static libraries later.
3245 staticlibs="$staticlibs $file" 4087 staticlibs="$staticlibs $file"
3246 ;; 4088 ;;
3247 4089
3248 *.la) 4090 *.la)
3254 exit 1 4096 exit 1
3255 fi 4097 fi
3256 4098
3257 library_names= 4099 library_names=
3258 old_library= 4100 old_library=
4101 relink_command=
3259 # If there is no directory component, then add one. 4102 # If there is no directory component, then add one.
3260 case "$file" in 4103 case $file in
3261 */* | *\\*) . $file ;; 4104 */* | *\\*) . $file ;;
3262 *) . ./$file ;; 4105 *) . ./$file ;;
3263 esac 4106 esac
3264 4107
3265 # Add the libdir to current_libdirs if it is the destination. 4108 # Add the libdir to current_libdirs if it is the destination.
3274 *" $libdir "*) ;; 4117 *" $libdir "*) ;;
3275 *) future_libdirs="$future_libdirs $libdir" ;; 4118 *) future_libdirs="$future_libdirs $libdir" ;;
3276 esac 4119 esac
3277 fi 4120 fi
3278 4121
3279 dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" 4122 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
3280 test "X$dir" = "X$file/" && dir= 4123 test "X$dir" = "X$file/" && dir=
3281 dir="$dir$objdir" 4124 dir="$dir$objdir"
4125
4126 if test -n "$relink_command"; then
4127 $echo "$modename: warning: relinking \`$file'" 1>&2
4128 $show "$relink_command"
4129 if $run eval "$relink_command"; then :
4130 else
4131 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4132 continue
4133 fi
4134 fi
3282 4135
3283 # See the names of the shared library. 4136 # See the names of the shared library.
3284 set dummy $library_names 4137 set dummy $library_names
3285 if test -n "$2"; then 4138 if test -n "$2"; then
3286 realname="$2" 4139 realname="$2"
3287 shift 4140 shift
3288 shift 4141 shift
3289 4142
4143 srcname="$realname"
4144 test -n "$relink_command" && srcname="$realname"T
4145
3290 # Install the shared library and build the symlinks. 4146 # Install the shared library and build the symlinks.
3291 $show "$install_prog $dir/$realname $destdir/$realname" 4147 $show "$install_prog $dir/$srcname $destdir/$realname"
3292 $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? 4148 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4149 if test -n "$stripme" && test -n "$striplib"; then
4150 $show "$striplib $destdir/$realname"
4151 $run eval "$striplib $destdir/$realname" || exit $?
4152 fi
3293 4153
3294 if test $# -gt 0; then 4154 if test $# -gt 0; then
3295 # Delete the old symlinks, and create new ones. 4155 # Delete the old symlinks, and create new ones.
3296 for linkname 4156 for linkname
3297 do 4157 do
3334 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4194 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3335 destfile="$destdir/$destfile" 4195 destfile="$destdir/$destfile"
3336 fi 4196 fi
3337 4197
3338 # Deduce the name of the destination old-style object file. 4198 # Deduce the name of the destination old-style object file.
3339 case "$destfile" in 4199 case $destfile in
3340 *.lo) 4200 *.lo)
3341 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 4201 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
3342 ;; 4202 ;;
3343 *.o | *.obj) 4203 *.$objext)
3344 staticdest="$destfile" 4204 staticdest="$destfile"
3345 destfile= 4205 destfile=
3346 ;; 4206 ;;
3347 *) 4207 *)
3348 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 4208 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
3377 destfile="$destdir/$destfile" 4237 destfile="$destdir/$destfile"
3378 fi 4238 fi
3379 4239
3380 # Do a test to see if this is really a libtool program. 4240 # Do a test to see if this is really a libtool program.
3381 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 4241 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3382 link_against_libtool_libs= 4242 notinst_deplibs=
3383 relink_command= 4243 relink_command=
3384 4244
3385 # If there is no directory component, then add one. 4245 # If there is no directory component, then add one.
3386 case "$file" in 4246 case $file in
3387 */* | *\\*) . $file ;; 4247 */* | *\\*) . $file ;;
3388 *) . ./$file ;; 4248 *) . ./$file ;;
3389 esac 4249 esac
3390 4250
3391 # Check the variables that should have been set. 4251 # Check the variables that should have been set.
3392 if test -z "$link_against_libtool_libs"; then 4252 if test -z "$notinst_deplibs"; then
3393 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 4253 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
3394 exit 1 4254 exit 1
3395 fi 4255 fi
3396 4256
3397 finalize=yes 4257 finalize=yes
3398 for lib in $link_against_libtool_libs; do 4258 for lib in $notinst_deplibs; do
3399 # Check to see that each library is installed. 4259 # Check to see that each library is installed.
3400 libdir= 4260 libdir=
3401 if test -f "$lib"; then 4261 if test -f "$lib"; then
3402 # If there is no directory component, then add one. 4262 # If there is no directory component, then add one.
3403 case "$lib" in 4263 case $lib in
3404 */* | *\\*) . $lib ;; 4264 */* | *\\*) . $lib ;;
3405 *) . ./$lib ;; 4265 *) . ./$lib ;;
3406 esac 4266 esac
3407 fi 4267 fi
3408 libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" 4268 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
3409 if test -n "$libdir" && test ! -f "$libfile"; then 4269 if test -n "$libdir" && test ! -f "$libfile"; then
3410 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 4270 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
3411 finalize=no 4271 finalize=no
3412 fi 4272 fi
3413 done 4273 done
4274
4275 relink_command=
4276 # If there is no directory component, then add one.
4277 case $file in
4278 */* | *\\*) . $file ;;
4279 *) . ./$file ;;
4280 esac
3414 4281
3415 outputname= 4282 outputname=
3416 if test "$fast_install" = no && test -n "$relink_command"; then 4283 if test "$fast_install" = no && test -n "$relink_command"; then
3417 if test "$finalize" = yes && test -z "$run"; then 4284 if test "$finalize" = yes && test -z "$run"; then
3418 tmpdir="/tmp" 4285 tmpdir="/tmp"
3421 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : 4288 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
3422 else 4289 else
3423 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 4290 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
3424 continue 4291 continue
3425 fi 4292 fi
4293 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
3426 outputname="$tmpdir/$file" 4294 outputname="$tmpdir/$file"
3427 # Replace the output file specification. 4295 # Replace the output file specification.
3428 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 4296 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
3429 4297
3430 $show "$relink_command" 4298 $show "$relink_command"
3442 # Install the binary that we compiled earlier. 4310 # Install the binary that we compiled earlier.
3443 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 4311 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
3444 fi 4312 fi
3445 fi 4313 fi
3446 4314
4315 # remove .exe since cygwin /usr/bin/install will append another
4316 # one anyways
4317 case $install_prog,$host in
4318 /usr/bin/install*,*cygwin*)
4319 case $file:$destfile in
4320 *.exe:*.exe)
4321 # this is ok
4322 ;;
4323 *.exe:*)
4324 destfile=$destfile.exe
4325 ;;
4326 *:*.exe)
4327 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4328 ;;
4329 esac
4330 ;;
4331 esac
3447 $show "$install_prog$stripme $file $destfile" 4332 $show "$install_prog$stripme $file $destfile"
3448 $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 4333 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
3449 test -n "$outputname" && ${rm}r "$tmpdir" 4334 test -n "$outputname" && ${rm}r "$tmpdir"
3450 ;; 4335 ;;
3451 esac 4336 esac
3457 # Set up the ranlib parameters. 4342 # Set up the ranlib parameters.
3458 oldlib="$destdir/$name" 4343 oldlib="$destdir/$name"
3459 4344
3460 $show "$install_prog $file $oldlib" 4345 $show "$install_prog $file $oldlib"
3461 $run eval "$install_prog \$file \$oldlib" || exit $? 4346 $run eval "$install_prog \$file \$oldlib" || exit $?
4347
4348 if test -n "$stripme" && test -n "$striplib"; then
4349 $show "$old_striplib $oldlib"
4350 $run eval "$old_striplib $oldlib" || exit $?
4351 fi
3462 4352
3463 # Do each command in the postinstall commands. 4353 # Do each command in the postinstall commands.
3464 eval cmds=\"$old_postinstall_cmds\" 4354 eval cmds=\"$old_postinstall_cmds\"
3465 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4355 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3466 for cmd in $cmds; do 4356 for cmd in $cmds; do
3518 fi 4408 fi
3519 done 4409 done
3520 fi 4410 fi
3521 4411
3522 # Exit here if they wanted silent mode. 4412 # Exit here if they wanted silent mode.
3523 test "$show" = : && exit 0 4413 test "$show" = ":" && exit 0
3524 4414
3525 echo "----------------------------------------------------------------------" 4415 echo "----------------------------------------------------------------------"
3526 echo "Libraries have been installed in:" 4416 echo "Libraries have been installed in:"
3527 for libdir in $libdirs; do 4417 for libdir in $libdirs; do
3528 echo " $libdir" 4418 echo " $libdir"
3529 done 4419 done
3530 echo 4420 echo
3531 echo "If you ever happen to want to link against installed libraries" 4421 echo "If you ever happen to want to link against installed libraries"
3532 echo "in a given directory, LIBDIR, you must either use libtool, and" 4422 echo "in a given directory, LIBDIR, you must either use libtool, and"
3533 echo "specify the full pathname of the library, or use \`-LLIBDIR'" 4423 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
3534 echo "flag during linking and do at least one of the following:" 4424 echo "flag during linking and do at least one of the following:"
3535 if test -n "$shlibpath_var"; then 4425 if test -n "$shlibpath_var"; then
3536 echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 4426 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
3537 echo " during execution" 4427 echo " during execution"
3538 fi 4428 fi
3578 $echo "$help" 1>&2 4468 $echo "$help" 1>&2
3579 exit 1 4469 exit 1
3580 fi 4470 fi
3581 4471
3582 dir= 4472 dir=
3583 case "$file" in 4473 case $file in
3584 *.la) 4474 *.la)
3585 # Check to see that this really is a libtool archive. 4475 # Check to see that this really is a libtool archive.
3586 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 4476 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3587 else 4477 else
3588 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 4478 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3593 # Read the libtool library. 4483 # Read the libtool library.
3594 dlname= 4484 dlname=
3595 library_names= 4485 library_names=
3596 4486
3597 # If there is no directory component, then add one. 4487 # If there is no directory component, then add one.
3598 case "$file" in 4488 case $file in
3599 */* | *\\*) . $file ;; 4489 */* | *\\*) . $file ;;
3600 *) . ./$file ;; 4490 *) . ./$file ;;
3601 esac 4491 esac
3602 4492
3603 # Skip this library if it cannot be dlopened. 4493 # Skip this library if it cannot be dlopened.
3648 4538
3649 # Check if any of the arguments is a wrapper script. 4539 # Check if any of the arguments is a wrapper script.
3650 args= 4540 args=
3651 for file 4541 for file
3652 do 4542 do
3653 case "$file" in 4543 case $file in
3654 -*) ;; 4544 -*) ;;
3655 *) 4545 *)
3656 # Do a test to see if this is really a libtool program. 4546 # Do a test to see if this is really a libtool program.
3657 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 4547 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3658 # If there is no directory component, then add one. 4548 # If there is no directory component, then add one.
3659 case "$file" in 4549 case $file in
3660 */* | *\\*) . $file ;; 4550 */* | *\\*) . $file ;;
3661 *) . ./$file ;; 4551 *) . ./$file ;;
3662 esac 4552 esac
3663 4553
3664 # Transform arg to wrapped name. 4554 # Transform arg to wrapped name.
3670 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 4560 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
3671 args="$args \"$file\"" 4561 args="$args \"$file\""
3672 done 4562 done
3673 4563
3674 if test -z "$run"; then 4564 if test -z "$run"; then
4565 if test -n "$shlibpath_var"; then
3675 # Export the shlibpath_var. 4566 # Export the shlibpath_var.
3676 eval "export $shlibpath_var" 4567 eval "export $shlibpath_var"
4568 fi
3677 4569
3678 # Restore saved enviroment variables 4570 # Restore saved enviroment variables
3679 if test "${save_LC_ALL+set}" = set; then 4571 if test "${save_LC_ALL+set}" = set; then
3680 LC_ALL="$save_LC_ALL"; export LC_ALL 4572 LC_ALL="$save_LC_ALL"; export LC_ALL
3681 fi 4573 fi
3688 4580
3689 $echo "$modename: cannot exec \$cmd$args" 4581 $echo "$modename: cannot exec \$cmd$args"
3690 exit 1 4582 exit 1
3691 else 4583 else
3692 # Display what would be done. 4584 # Display what would be done.
4585 if test -n "$shlibpath_var"; then
3693 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 4586 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
3694 $echo "export $shlibpath_var" 4587 $echo "export $shlibpath_var"
4588 fi
3695 $echo "$cmd$args" 4589 $echo "$cmd$args"
3696 exit 0 4590 exit 0
3697 fi 4591 fi
3698 ;; 4592 ;;
3699 4593
3700 # libtool uninstall mode 4594 # libtool clean and uninstall mode
3701 uninstall) 4595 clean | uninstall)
3702 modename="$modename: uninstall" 4596 modename="$modename: $mode"
3703 rm="$nonopt" 4597 rm="$nonopt"
3704 files= 4598 files=
4599 rmforce=
4600 exit_status=0
4601
4602 # This variable tells wrapper scripts just to set variables rather
4603 # than running their programs.
4604 libtool_install_magic="$magic"
3705 4605
3706 for arg 4606 for arg
3707 do 4607 do
3708 case "$arg" in 4608 case $arg in
4609 -f) rm="$rm $arg"; rmforce=yes ;;
3709 -*) rm="$rm $arg" ;; 4610 -*) rm="$rm $arg" ;;
3710 *) files="$files $arg" ;; 4611 *) files="$files $arg" ;;
3711 esac 4612 esac
3712 done 4613 done
3713 4614
3715 $echo "$modename: you must specify an RM program" 1>&2 4616 $echo "$modename: you must specify an RM program" 1>&2
3716 $echo "$help" 1>&2 4617 $echo "$help" 1>&2
3717 exit 1 4618 exit 1
3718 fi 4619 fi
3719 4620
4621 rmdirs=
4622
3720 for file in $files; do 4623 for file in $files; do
3721 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 4624 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
3722 test "X$dir" = "X$file" && dir=. 4625 if test "X$dir" = "X$file"; then
4626 dir=.
4627 objdir="$objdir"
4628 else
4629 objdir="$dir/$objdir"
4630 fi
3723 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 4631 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4632 test $mode = uninstall && objdir="$dir"
4633
4634 # Remember objdir for removal later, being careful to avoid duplicates
4635 if test $mode = clean; then
4636 case " $rmdirs " in
4637 *" $objdir "*) ;;
4638 *) rmdirs="$rmdirs $objdir" ;;
4639 esac
4640 fi
4641
4642 # Don't error if the file doesn't exist and rm -f was used.
4643 if (test -L "$file") >/dev/null 2>&1 \
4644 || (test -h "$file") >/dev/null 2>&1 \
4645 || test -f "$file"; then
4646 :
4647 elif test -d "$file"; then
4648 exit_status=1
4649 continue
4650 elif test "$rmforce" = yes; then
4651 continue
4652 fi
3724 4653
3725 rmfiles="$file" 4654 rmfiles="$file"
3726 4655
3727 case "$name" in 4656 case $name in
3728 *.la) 4657 *.la)
3729 # Possibly a libtool archive, so verify it. 4658 # Possibly a libtool archive, so verify it.
3730 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 4659 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
3731 . $dir/$name 4660 . $dir/$name
3732 4661
3733 # Delete the libtool libraries and symlinks. 4662 # Delete the libtool libraries and symlinks.
3734 for n in $library_names; do 4663 for n in $library_names; do
3735 rmfiles="$rmfiles $dir/$n" 4664 rmfiles="$rmfiles $objdir/$n"
3736 done 4665 done
3737 test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" 4666 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4667 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
3738 4668
3739 $show "$rm $rmfiles" 4669 if test $mode = uninstall; then
3740 $run $rm $rmfiles
3741
3742 if test -n "$library_names"; then 4670 if test -n "$library_names"; then
3743 # Do each command in the postuninstall commands. 4671 # Do each command in the postuninstall commands.
3744 eval cmds=\"$postuninstall_cmds\" 4672 eval cmds=\"$postuninstall_cmds\"
3745 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4673 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3746 for cmd in $cmds; do 4674 for cmd in $cmds; do
4675 IFS="$save_ifs"
4676 $show "$cmd"
4677 $run eval "$cmd"
4678 if test $? != 0 && test "$rmforce" != yes; then
4679 exit_status=1
4680 fi
4681 done
3747 IFS="$save_ifs" 4682 IFS="$save_ifs"
3748 $show "$cmd"
3749 $run eval "$cmd"
3750 done
3751 IFS="$save_ifs"
3752 fi 4683 fi
3753 4684
3754 if test -n "$old_library"; then 4685 if test -n "$old_library"; then
3755 # Do each command in the old_postuninstall commands. 4686 # Do each command in the old_postuninstall commands.
3756 eval cmds=\"$old_postuninstall_cmds\" 4687 eval cmds=\"$old_postuninstall_cmds\"
3757 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' 4688 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3758 for cmd in $cmds; do 4689 for cmd in $cmds; do
4690 IFS="$save_ifs"
4691 $show "$cmd"
4692 $run eval "$cmd"
4693 if test $? != 0 && test "$rmforce" != yes; then
4694 exit_status=1
4695 fi
4696 done
3759 IFS="$save_ifs" 4697 IFS="$save_ifs"
3760 $show "$cmd"
3761 $run eval "$cmd"
3762 done
3763 IFS="$save_ifs"
3764 fi 4698 fi
3765
3766 # FIXME: should reinstall the best remaining shared library. 4699 # FIXME: should reinstall the best remaining shared library.
4700 fi
3767 fi 4701 fi
3768 ;; 4702 ;;
3769 4703
3770 *.lo) 4704 *.lo)
3771 if test "$build_old_libs" = yes; then 4705 if test "$build_old_libs" = yes; then
3772 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` 4706 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
3773 rmfiles="$rmfiles $dir/$oldobj" 4707 rmfiles="$rmfiles $dir/$oldobj"
3774 fi 4708 fi
3775 $show "$rm $rmfiles"
3776 $run $rm $rmfiles
3777 ;; 4709 ;;
3778 4710
3779 *) 4711 *)
3780 $show "$rm $rmfiles" 4712 # Do a test to see if this is a libtool program.
3781 $run $rm $rmfiles 4713 if test $mode = clean &&
4714 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4715 relink_command=
4716 . $dir/$file
4717
4718 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4719 if test "$fast_install" = yes && test -n "$relink_command"; then
4720 rmfiles="$rmfiles $objdir/lt-$name"
4721 fi
4722 fi
3782 ;; 4723 ;;
3783 esac 4724 esac
4725 $show "$rm $rmfiles"
4726 $run $rm $rmfiles || exit_status=1
3784 done 4727 done
3785 exit 0 4728
4729 # Try to remove the ${objdir}s in the directories where we deleted files
4730 for dir in $rmdirs; do
4731 if test -d "$dir"; then
4732 $show "rmdir $dir"
4733 $run rmdir $dir >/dev/null 2>&1
4734 fi
4735 done
4736
4737 exit $exit_status
3786 ;; 4738 ;;
3787 4739
3788 "") 4740 "")
3789 $echo "$modename: you must specify a MODE" 1>&2 4741 $echo "$modename: you must specify a MODE" 1>&2
3790 $echo "$generic_help" 1>&2 4742 $echo "$generic_help" 1>&2
3796 $echo "$generic_help" 1>&2 4748 $echo "$generic_help" 1>&2
3797 exit 1 4749 exit 1
3798fi # test -z "$show_help" 4750fi # test -z "$show_help"
3799 4751
3800# We need to display help for each of the modes. 4752# We need to display help for each of the modes.
3801case "$mode" in 4753case $mode in
3802"") $echo \ 4754"") $echo \
3803"Usage: $modename [OPTION]... [MODE-ARG]... 4755"Usage: $modename [OPTION]... [MODE-ARG]...
3804 4756
3805Provide generalized library-building support services. 4757Provide generalized library-building support services.
3806 4758
3815 --silent don't print informational messages 4767 --silent don't print informational messages
3816 --version print version information 4768 --version print version information
3817 4769
3818MODE must be one of the following: 4770MODE must be one of the following:
3819 4771
4772 clean remove files from the build directory
3820 compile compile a source file into a libtool object 4773 compile compile a source file into a libtool object
3821 execute automatically set library path, then run a program 4774 execute automatically set library path, then run a program
3822 finish complete the installation of libtool libraries 4775 finish complete the installation of libtool libraries
3823 install install libraries or executables 4776 install install libraries or executables
3824 link create a library or an executable 4777 link create a library or an executable
3827MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 4780MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
3828a more detailed description of MODE." 4781a more detailed description of MODE."
3829 exit 0 4782 exit 0
3830 ;; 4783 ;;
3831 4784
4785clean)
4786 $echo \
4787"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4788
4789Remove files from the build directory.
4790
4791RM is the name of the program to use to delete files associated with each FILE
4792(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4793to RM.
4794
4795If FILE is a libtool library, object or program, all the files associated
4796with it are deleted. Otherwise, only FILE itself is deleted using RM."
4797 ;;
4798
3832compile) 4799compile)
3833 $echo \ 4800 $echo \
3834"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 4801"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3835 4802
3836Compile a source file into a libtool library object. 4803Compile a source file into a libtool library object.
3837 4804
3838This mode accepts the following additional options: 4805This mode accepts the following additional options:
3839 4806
3840 -o OUTPUT-FILE set the output file name to OUTPUT-FILE 4807 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4808 -prefer-pic try to building PIC objects only
4809 -prefer-non-pic try to building non-PIC objects only
3841 -static always build a \`.o' file suitable for static linking 4810 -static always build a \`.o' file suitable for static linking
3842 4811
3843COMPILE-COMMAND is a command to be used in creating a \`standard' object file 4812COMPILE-COMMAND is a command to be used in creating a \`standard' object file
3844from the given SOURCEFILE. 4813from the given SOURCEFILE.
3845 4814
3915 -export-symbols-regex REGEX 4884 -export-symbols-regex REGEX
3916 try to export only the symbols matching REGEX 4885 try to export only the symbols matching REGEX
3917 -LLIBDIR search LIBDIR for required installed libraries 4886 -LLIBDIR search LIBDIR for required installed libraries
3918 -lNAME OUTPUT-FILE requires the installed library libNAME 4887 -lNAME OUTPUT-FILE requires the installed library libNAME
3919 -module build a library that can dlopened 4888 -module build a library that can dlopened
4889 -no-fast-install disable the fast-install mode
4890 -no-install link a not-installable executable
3920 -no-undefined declare that a library does not refer to external symbols 4891 -no-undefined declare that a library does not refer to external symbols
3921 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 4892 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3922 -release RELEASE specify package release information 4893 -release RELEASE specify package release information
3923 -rpath LIBDIR the created library will eventually be installed in LIBDIR 4894 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3924 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 4895 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries

Legend:
Removed from v.2  
changed lines
  Added in v.116

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26