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