llvm.org GIT mirror llvm / 0164f27
Drop libtool from llvm. We were only using it so find the shared library extension and nm. There are simpler ways to do those things :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202524 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
13 changed file(s) with 7482 addition(s) and 42666 deletion(s). Raw diff Collapse all Expand all
1616 want_autoconf_version='2\.60'
1717 want_autoheader_version=$want_autoconf_version
1818 want_aclocal_version='1\.9\.6'
19 want_libtool_version='1\.5\.22'
2019 ### END NOTE #########################################################
2120
2221 outfile=configure
2524 want_autoconf_version_clean=$(clean $want_autoconf_version)
2625 want_autoheader_version_clean=$(clean $want_autoheader_version)
2726 want_aclocal_version_clean=$(clean $want_aclocal_version)
28 want_libtool_version_clean=$(clean $want_libtool_version)
2927
3028 test -d autoconf && test -f autoconf/$configfile && cd autoconf
3129 test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
3533 test $? -eq 0 || die "Your aclocal was not detected as being $want_aclocal_version_clean"
3634 autoheader --version | grep '^autoheader.*'$want_autoheader_version > /dev/null
3735 test $? -eq 0 || die "Your autoheader was not detected as being $want_autoheader_version_clean"
38 libtool --version | grep $want_libtool_version > /dev/null
39 test $? -eq 0 || die "Your libtool was not detected as being $want_libtool_version_clean"
4036 echo ""
4137 echo "### NOTE: ############################################################"
4238 echo "### If you get *any* warnings from autoconf below you MUST fix the"
12341234 dnl===
12351235 dnl===-----------------------------------------------------------------------===
12361236
1237 AC_PROG_NM
1238 AC_SUBST(NM)
1239
12401237 dnl Check for the tools that the makefiles require
12411238 AC_CHECK_GNU_MAKE
12421239 AC_PROG_LN_S
1240 AC_PATH_PROG(NM, [nm], [nm])
12431241 AC_PATH_PROG(CMP, [cmp], [cmp])
12441242 AC_PATH_PROG(CP, [cp], [cp])
12451243 AC_PATH_PROG(DATE, [date], [date])
13851383 dnl Determine whether the linker supports the --version-script option.
13861384 AC_LINK_VERSION_SCRIPT
13871385
1388 dnl Check for libtool and the library that has dlopen function (which must come
1389 dnl before the AC_PROG_LIBTOOL check in order to enable dlopening libraries with
1390 dnl libtool).
1391 AC_LIBTOOL_DLOPEN
1392 AC_LIB_LTDL
1386 AC_CHECK_HEADERS([errno.h])
1387
1388 case "$llvm_cv_os_type" in
1389 Cygwin|MingW|Win32) llvm_shlib_ext=.dll ;;
1390 Darwin) llvm_shlib_ext=.dylib ;;
1391 *) llvm_shlib_ext=.so ;;
1392 esac
1393
1394 AC_DEFINE_UNQUOTED([LTDL_SHLIB_EXT], ["$llvm_shlib_ext"], [The shared library extension])
13931395
13941396 AC_MSG_CHECKING([tool compatibility])
13951397
18991901
19001902 dnl Propagate the shared library extension that the libltdl checks did to
19011903 dnl the Makefiles so we can use it there too
1902 AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
1904 AC_SUBST(SHLIBEXT,$llvm_shlib_ext)
19031905
19041906 dnl Translate the various configuration directories and other basic
19051907 dnl information into substitutions that will end up in Makefile.config.in
+0
-522
autoconf/depcomp less more
None #! /bin/sh
1 # depcomp - compile a program generating dependencies as side-effects
2
3 scriptversion=2004-05-31.23
4
5 # Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 # 02111-1307, USA.
21
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
26
27 # Originally written by Alexandre Oliva .
28
29 case $1 in
30 '')
31 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
32 exit 1;
33 ;;
34 -h | --h*)
35 cat <<\EOF
36 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
37
38 Run PROGRAMS ARGS to compile a file, generating dependencies
39 as side-effects.
40
41 Environment variables:
42 depmode Dependency tracking mode.
43 source Source file read by `PROGRAMS ARGS'.
44 object Object file output by `PROGRAMS ARGS'.
45 DEPDIR directory where to store dependencies.
46 depfile Dependency file to output.
47 tmpdepfile Temporary file to use when outputing dependencies.
48 libtool Whether libtool is used (yes/no).
49
50 Report bugs to .
51 EOF
52 exit 0
53 ;;
54 -v | --v*)
55 echo "depcomp $scriptversion"
56 exit 0
57 ;;
58 esac
59
60 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
61 echo "depcomp: Variables source, object and depmode must be set" 1>&2
62 exit 1
63 fi
64
65 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
66 depfile=${depfile-`echo "$object" |
67 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
68 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
69
70 rm -f "$tmpdepfile"
71
72 # Some modes work just like other modes, but use different flags. We
73 # parameterize here, but still list the modes in the big case below,
74 # to make depend.m4 easier to write. Note that we *cannot* use a case
75 # here, because this file can only contain one case statement.
76 if test "$depmode" = hp; then
77 # HP compiler uses -M and no extra arg.
78 gccflag=-M
79 depmode=gcc
80 fi
81
82 if test "$depmode" = dashXmstdout; then
83 # This is just like dashmstdout with a different argument.
84 dashmflag=-xM
85 depmode=dashmstdout
86 fi
87
88 case "$depmode" in
89 gcc3)
90 ## gcc 3 implements dependency tracking that does exactly what
91 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
92 ## it if -MD -MP comes after the -MF stuff. Hmm.
93 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
94 stat=$?
95 if test $stat -eq 0; then :
96 else
97 rm -f "$tmpdepfile"
98 exit $stat
99 fi
100 mv "$tmpdepfile" "$depfile"
101 ;;
102
103 gcc)
104 ## There are various ways to get dependency output from gcc. Here's
105 ## why we pick this rather obscure method:
106 ## - Don't want to use -MD because we'd like the dependencies to end
107 ## up in a subdir. Having to rename by hand is ugly.
108 ## (We might end up doing this anyway to support other compilers.)
109 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
110 ## -MM, not -M (despite what the docs say).
111 ## - Using -M directly means running the compiler twice (even worse
112 ## than renaming).
113 if test -z "$gccflag"; then
114 gccflag=-MD,
115 fi
116 "$@" -Wp,"$gccflag$tmpdepfile"
117 stat=$?
118 if test $stat -eq 0; then :
119 else
120 rm -f "$tmpdepfile"
121 exit $stat
122 fi
123 rm -f "$depfile"
124 echo "$object : \\" > "$depfile"
125 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
126 ## The second -e expression handles DOS-style file names with drive letters.
127 sed -e 's/^[^:]*: / /' \
128 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
129 ## This next piece of magic avoids the `deleted header file' problem.
130 ## The problem is that when a header file which appears in a .P file
131 ## is deleted, the dependency causes make to die (because there is
132 ## typically no way to rebuild the header). We avoid this by adding
133 ## dummy dependencies for each header file. Too bad gcc doesn't do
134 ## this for us directly.
135 tr ' ' '
136 ' < "$tmpdepfile" |
137 ## Some versions of gcc put a space before the `:'. On the theory
138 ## that the space means something, we add a space to the output as
139 ## well.
140 ## Some versions of the HPUX 10.20 sed can't process this invocation
141 ## correctly. Breaking it into two sed invocations is a workaround.
142 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
143 rm -f "$tmpdepfile"
144 ;;
145
146 hp)
147 # This case exists only to let depend.m4 do its work. It works by
148 # looking at the text of this script. This case will never be run,
149 # since it is checked for above.
150 exit 1
151 ;;
152
153 sgi)
154 if test "$libtool" = yes; then
155 "$@" "-Wp,-MDupdate,$tmpdepfile"
156 else
157 "$@" -MDupdate "$tmpdepfile"
158 fi
159 stat=$?
160 if test $stat -eq 0; then :
161 else
162 rm -f "$tmpdepfile"
163 exit $stat
164 fi
165 rm -f "$depfile"
166
167 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
168 echo "$object : \\" > "$depfile"
169
170 # Clip off the initial element (the dependent). Don't try to be
171 # clever and replace this with sed code, as IRIX sed won't handle
172 # lines with more than a fixed number of characters (4096 in
173 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
174 # the IRIX cc adds comments like `#:fec' to the end of the
175 # dependency line.
176 tr ' ' '
177 ' < "$tmpdepfile" \
178 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
179 tr '
180 ' ' ' >> $depfile
181 echo >> $depfile
182
183 # The second pass generates a dummy entry for each header file.
184 tr ' ' '
185 ' < "$tmpdepfile" \
186 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
187 >> $depfile
188 else
189 # The sourcefile does not contain any dependencies, so just
190 # store a dummy comment line, to avoid errors with the Makefile
191 # "include basename.Plo" scheme.
192 echo "#dummy" > "$depfile"
193 fi
194 rm -f "$tmpdepfile"
195 ;;
196
197 aix)
198 # The C for AIX Compiler uses -M and outputs the dependencies
199 # in a .u file. In older versions, this file always lives in the
200 # current directory. Also, the AIX compiler puts `$object:' at the
201 # start of each line; $object doesn't have directory information.
202 # Version 6 uses the directory in both cases.
203 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
204 tmpdepfile="$stripped.u"
205 if test "$libtool" = yes; then
206 "$@" -Wc,-M
207 else
208 "$@" -M
209 fi
210 stat=$?
211
212 if test -f "$tmpdepfile"; then :
213 else
214 stripped=`echo "$stripped" | sed 's,^.*/,,'`
215 tmpdepfile="$stripped.u"
216 fi
217
218 if test $stat -eq 0; then :
219 else
220 rm -f "$tmpdepfile"
221 exit $stat
222 fi
223
224 if test -f "$tmpdepfile"; then
225 outname="$stripped.o"
226 # Each line is of the form `foo.o: dependent.h'.
227 # Do two passes, one to just change these to
228 # `$object: dependent.h' and one to simply `dependent.h:'.
229 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
230 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
231 else
232 # The sourcefile does not contain any dependencies, so just
233 # store a dummy comment line, to avoid errors with the Makefile
234 # "include basename.Plo" scheme.
235 echo "#dummy" > "$depfile"
236 fi
237 rm -f "$tmpdepfile"
238 ;;
239
240 icc)
241 # Intel's C compiler understands `-MD -MF file'. However on
242 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
243 # ICC 7.0 will fill foo.d with something like
244 # foo.o: sub/foo.c
245 # foo.o: sub/foo.h
246 # which is wrong. We want:
247 # sub/foo.o: sub/foo.c
248 # sub/foo.o: sub/foo.h
249 # sub/foo.c:
250 # sub/foo.h:
251 # ICC 7.1 will output
252 # foo.o: sub/foo.c sub/foo.h
253 # and will wrap long lines using \ :
254 # foo.o: sub/foo.c ... \
255 # sub/foo.h ... \
256 # ...
257
258 "$@" -MD -MF "$tmpdepfile"
259 stat=$?
260 if test $stat -eq 0; then :
261 else
262 rm -f "$tmpdepfile"
263 exit $stat
264 fi
265 rm -f "$depfile"
266 # Each line is of the form `foo.o: dependent.h',
267 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
268 # Do two passes, one to just change these to
269 # `$object: dependent.h' and one to simply `dependent.h:'.
270 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
271 # Some versions of the HPUX 10.20 sed can't process this invocation
272 # correctly. Breaking it into two sed invocations is a workaround.
273 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
274 sed -e 's/$/ :/' >> "$depfile"
275 rm -f "$tmpdepfile"
276 ;;
277
278 tru64)
279 # The Tru64 compiler uses -MD to generate dependencies as a side
280 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
281 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
282 # dependencies in `foo.d' instead, so we check for that too.
283 # Subdirectories are respected.
284 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
285 test "x$dir" = "x$object" && dir=
286 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
287
288 if test "$libtool" = yes; then
289 # Dependencies are output in .lo.d with libtool 1.4.
290 # With libtool 1.5 they are output both in $dir.libs/$base.o.d
291 # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
292 # latter, because the former will be cleaned when $dir.libs is
293 # erased.
294 tmpdepfile1="$dir.libs/$base.lo.d"
295 tmpdepfile2="$dir$base.o.d"
296 tmpdepfile3="$dir.libs/$base.d"
297 "$@" -Wc,-MD
298 else
299 tmpdepfile1="$dir$base.o.d"
300 tmpdepfile2="$dir$base.d"
301 tmpdepfile3="$dir$base.d"
302 "$@" -MD
303 fi
304
305 stat=$?
306 if test $stat -eq 0; then :
307 else
308 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
309 exit $stat
310 fi
311
312 if test -f "$tmpdepfile1"; then
313 tmpdepfile="$tmpdepfile1"
314 elif test -f "$tmpdepfile2"; then
315 tmpdepfile="$tmpdepfile2"
316 else
317 tmpdepfile="$tmpdepfile3"
318 fi
319 if test -f "$tmpdepfile"; then
320 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
321 # That's a tab and a space in the [].
322 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
323 else
324 echo "#dummy" > "$depfile"
325 fi
326 rm -f "$tmpdepfile"
327 ;;
328
329 #nosideeffect)
330 # This comment above is used by automake to tell side-effect
331 # dependency tracking mechanisms from slower ones.
332
333 dashmstdout)
334 # Important note: in order to support this mode, a compiler *must*
335 # always write the preprocessed file to stdout, regardless of -o.
336 "$@" || exit $?
337
338 # Remove the call to Libtool.
339 if test "$libtool" = yes; then
340 while test $1 != '--mode=compile'; do
341 shift
342 done
343 shift
344 fi
345
346 # Remove `-o $object'.
347 IFS=" "
348 for arg
349 do
350 case $arg in
351 -o)
352 shift
353 ;;
354 $object)
355 shift
356 ;;
357 *)
358 set fnord "$@" "$arg"
359 shift # fnord
360 shift # $arg
361 ;;
362 esac
363 done
364
365 test -z "$dashmflag" && dashmflag=-M
366 # Require at least two characters before searching for `:'
367 # in the target name. This is to cope with DOS-style filenames:
368 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
369 "$@" $dashmflag |
370 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
371 rm -f "$depfile"
372 cat < "$tmpdepfile" > "$depfile"
373 tr ' ' '
374 ' < "$tmpdepfile" | \
375 ## Some versions of the HPUX 10.20 sed can't process this invocation
376 ## correctly. Breaking it into two sed invocations is a workaround.
377 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
378 rm -f "$tmpdepfile"
379 ;;
380
381 dashXmstdout)
382 # This case only exists to satisfy depend.m4. It is never actually
383 # run, as this mode is specially recognized in the preamble.
384 exit 1
385 ;;
386
387 makedepend)
388 "$@" || exit $?
389 # Remove any Libtool call
390 if test "$libtool" = yes; then
391 while test $1 != '--mode=compile'; do
392 shift
393 done
394 shift
395 fi
396 # X makedepend
397 shift
398 cleared=no
399 for arg in "$@"; do
400 case $cleared in
401 no)
402 set ""; shift
403 cleared=yes ;;
404 esac
405 case "$arg" in
406 -D*|-I*)
407 set fnord "$@" "$arg"; shift ;;
408 # Strip any option that makedepend may not understand. Remove
409 # the object too, otherwise makedepend will parse it as a source file.
410 -*|$object)
411 ;;
412 *)
413 set fnord "$@" "$arg"; shift ;;
414 esac
415 done
416 obj_suffix="`echo $object | sed 's/^.*\././'`"
417 touch "$tmpdepfile"
418 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
419 rm -f "$depfile"
420 cat < "$tmpdepfile" > "$depfile"
421 sed '1,2d' "$tmpdepfile" | tr ' ' '
422 ' | \
423 ## Some versions of the HPUX 10.20 sed can't process this invocation
424 ## correctly. Breaking it into two sed invocations is a workaround.
425 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
426 rm -f "$tmpdepfile" "$tmpdepfile".bak
427 ;;
428
429 cpp)
430 # Important note: in order to support this mode, a compiler *must*
431 # always write the preprocessed file to stdout.
432 "$@" || exit $?
433
434 # Remove the call to Libtool.
435 if test "$libtool" = yes; then
436 while test $1 != '--mode=compile'; do
437 shift
438 done
439 shift
440 fi
441
442 # Remove `-o $object'.
443 IFS=" "
444 for arg
445 do
446 case $arg in
447 -o)
448 shift
449 ;;
450 $object)
451 shift
452 ;;
453 *)
454 set fnord "$@" "$arg"
455 shift # fnord
456 shift # $arg
457 ;;
458 esac
459 done
460
461 "$@" -E |
462 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
463 sed '$ s: \\$::' > "$tmpdepfile"
464 rm -f "$depfile"
465 echo "$object : \\" > "$depfile"
466 cat < "$tmpdepfile" >> "$depfile"
467 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
468 rm -f "$tmpdepfile"
469 ;;
470
471 msvisualcpp)
472 # Important note: in order to support this mode, a compiler *must*
473 # always write the preprocessed file to stdout, regardless of -o,
474 # because we must use -o when running libtool.
475 "$@" || exit $?
476 IFS=" "
477 for arg
478 do
479 case "$arg" in
480 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
481 set fnord "$@"
482 shift
483 shift
484 ;;
485 *)
486 set fnord "$@" "$arg"
487 shift
488 shift
489 ;;
490 esac
491 done
492 "$@" -E |
493 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
494 rm -f "$depfile"
495 echo "$object : \\" > "$depfile"
496 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
497 echo " " >> "$depfile"
498 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
499 rm -f "$tmpdepfile"
500 ;;
501
502 none)
503 exec "$@"
504 ;;
505
506 *)
507 echo "Unknown depmode $depmode" 1>&2
508 exit 1
509 ;;
510 esac
511
512 exit 0
513
514 # Local Variables:
515 # mode: shell-script
516 # sh-indentation: 2
517 # eval: (add-hook 'write-file-hooks 'time-stamp)
518 # time-stamp-start: "scriptversion="
519 # time-stamp-format: "%:y-%02m-%02d.%02H"
520 # time-stamp-end: "$"
521 # End:
+0
-6863
autoconf/ltmain.sh less more
None # ltmain.sh - Provide generalized library-building support services.
1 # NOTE: Changing this file will not affect anything until you rerun configure.
2 #
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
4 # Free Software Foundation, Inc.
5 # Originally by Gordon Matzigkeit , 1996
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
25
26 basename="s,^.*/,,g"
27
28 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
29 # is ksh but when the shell is invoked as "sh" and the current value of
30 # the _XPG environment variable is not equal to 1 (one), the special
31 # positional parameter $0, within a function call, is the name of the
32 # function.
33 progpath="$0"
34
35 # The name of this program:
36 progname=`echo "$progpath" | $SED $basename`
37 modename="$progname"
38
39 # Global variables:
40 EXIT_SUCCESS=0
41 EXIT_FAILURE=1
42
43 PROGRAM=ltmain.sh
44 PACKAGE=libtool
45 VERSION=1.5.22
46 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
47
48 # See if we are running on zsh, and set the options which allow our
49 # commands through without removal of \ escapes.
50 if test -n "${ZSH_VERSION+set}" ; then
51 setopt NO_GLOB_SUBST
52 fi
53
54 # Check that we have a working $echo.
55 if test "X$1" = X--no-reexec; then
56 # Discard the --no-reexec flag, and continue.
57 shift
58 elif test "X$1" = X--fallback-echo; then
59 # Avoid inline document here, it may be left over
60 :
61 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
62 # Yippee, $echo works!
63 :
64 else
65 # Restart under the correct shell, and then maybe $echo will work.
66 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
67 fi
68
69 if test "X$1" = X--fallback-echo; then
70 # used as fallback echo
71 shift
72 cat <
73 $*
74 EOF
75 exit $EXIT_SUCCESS
76 fi
77
78 default_mode=
79 help="Try \`$progname --help' for more information."
80 magic="%%%MAGIC variable%%%"
81 mkdir="mkdir"
82 mv="mv -f"
83 rm="rm -f"
84
85 # Sed substitution that helps us do robust quoting. It backslashifies
86 # metacharacters that are still active within double-quoted strings.
87 Xsed="${SED}"' -e 1s/^X//'
88 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
89 # test EBCDIC or ASCII
90 case `echo X|tr X '\101'` in
91 A) # ASCII based system
92 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
93 SP2NL='tr \040 \012'
94 NL2SP='tr \015\012 \040\040'
95 ;;
96 *) # EBCDIC based system
97 SP2NL='tr \100 \n'
98 NL2SP='tr \r\n \100\100'
99 ;;
100 esac
101
102 # NLS nuisances.
103 # Only set LANG and LC_ALL to C if already set.
104 # These must not be set unconditionally because not all systems understand
105 # e.g. LANG=C (notably SCO).
106 # We save the old values to restore during execute mode.
107 if test "${LC_ALL+set}" = set; then
108 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
109 fi
110 if test "${LANG+set}" = set; then
111 save_LANG="$LANG"; LANG=C; export LANG
112 fi
113
114 # Make sure IFS has a sensible default
115 lt_nl='
116 '
117 IFS=" $lt_nl"
118
119 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
120 $echo "$modename: not configured to build any kind of library" 1>&2
121 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
122 exit $EXIT_FAILURE
123 fi
124
125 # Global variables.
126 mode=$default_mode
127 nonopt=
128 prev=
129 prevopt=
130 run=
131 show="$echo"
132 show_help=
133 execute_dlfiles=
134 duplicate_deps=no
135 preserve_args=
136 lo2o="s/\\.lo\$/.${objext}/"
137 o2lo="s/\\.${objext}\$/.lo/"
138
139 #####################################
140 # Shell function definitions:
141 # This seems to be the best place for them
142
143 # func_mktempdir [string]
144 # Make a temporary directory that won't clash with other running
145 # libtool processes, and avoids race conditions if possible. If
146 # given, STRING is the basename for that directory.
147 func_mktempdir ()
148 {
149 my_template="${TMPDIR-/tmp}/${1-$progname}"
150
151 if test "$run" = ":"; then
152 # Return a directory name, but don't create it in dry-run mode
153 my_tmpdir="${my_template}-$$"
154 else
155
156 # If mktemp works, use that first and foremost
157 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
158
159 if test ! -d "$my_tmpdir"; then
160 # Failing that, at least try and use $RANDOM to avoid a race
161 my_tmpdir="${my_template}-${RANDOM-0}$$"
162
163 save_mktempdir_umask=`umask`
164 umask 0077
165 $mkdir "$my_tmpdir"
166 umask $save_mktempdir_umask
167 fi
168
169 # If we're not in dry-run mode, bomb out on failure
170 test -d "$my_tmpdir" || {
171 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
172 exit $EXIT_FAILURE
173 }
174 fi
175
176 $echo "X$my_tmpdir" | $Xsed
177 }
178
179
180 # func_win32_libid arg
181 # return the library type of file 'arg'
182 #
183 # Need a lot of goo to handle *both* DLLs and import libs
184 # Has to be a shell function in order to 'eat' the argument
185 # that is supplied when $file_magic_command is called.
186 func_win32_libid ()
187 {
188 win32_libid_type="unknown"
189 win32_fileres=`file -L $1 2>/dev/null`
190 case $win32_fileres in
191 *ar\ archive\ import\ library*) # definitely import
192 win32_libid_type="x86 archive import"
193 ;;
194 *ar\ archive*) # could be an import, or static
195 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
196 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
197 win32_nmres=`eval $NM -f posix -A $1 | \
198 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
199 case $win32_nmres in
200 import*) win32_libid_type="x86 archive import";;
201 *) win32_libid_type="x86 archive static";;
202 esac
203 fi
204 ;;
205 *DLL*)
206 win32_libid_type="x86 DLL"
207 ;;
208 *executable*) # but shell scripts are "executable" too...
209 case $win32_fileres in
210 *MS\ Windows\ PE\ Intel*)
211 win32_libid_type="x86 DLL"
212 ;;
213 esac
214 ;;
215 esac
216 $echo $win32_libid_type
217 }
218
219
220 # func_infer_tag arg
221 # Infer tagged configuration to use if any are available and
222 # if one wasn't chosen via the "--tag" command line option.
223 # Only attempt this if the compiler in the base compile
224 # command doesn't match the default compiler.
225 # arg is usually of the form 'gcc ...'
226 func_infer_tag ()
227 {
228 if test -n "$available_tags" && test -z "$tagname"; then
229 CC_quoted=
230 for arg in $CC; do
231 case $arg in
232 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
233 arg="\"$arg\""
234 ;;
235 esac
236 CC_quoted="$CC_quoted $arg"
237 done
238 case $@ in
239 # Blanks in the command may have been stripped by the calling shell,
240 # but not from the CC environment variable when configure was run.
241 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
242 # Blanks at the start of $base_compile will cause this to fail
243 # if we don't check for them as well.
244 *)
245 for z in $available_tags; do
246 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
247 # Evaluate the configuration.
248 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
249 CC_quoted=
250 for arg in $CC; do
251 # Double-quote args containing other shell metacharacters.
252 case $arg in
253 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
254 arg="\"$arg\""
255 ;;
256 esac
257 CC_quoted="$CC_quoted $arg"
258 done
259 case "$@ " in
260 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
261 # The compiler in the base compile command matches
262 # the one in the tagged configuration.
263 # Assume this is the tagged configuration we want.
264 tagname=$z
265 break
266 ;;
267 esac
268 fi
269 done
270 # If $tagname still isn't set, then no tagged configuration
271 # was found and let the user know that the "--tag" command
272 # line option must be used.
273 if test -z "$tagname"; then
274 $echo "$modename: unable to infer tagged configuration"
275 $echo "$modename: specify a tag with \`--tag'" 1>&2
276 exit $EXIT_FAILURE
277 # else
278 # $echo "$modename: using $tagname tagged configuration"
279 fi
280 ;;
281 esac
282 fi
283 }
284
285
286 # func_extract_an_archive dir oldlib
287 func_extract_an_archive ()
288 {
289 f_ex_an_ar_dir="$1"; shift
290 f_ex_an_ar_oldlib="$1"
291
292 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
293 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
294 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
295 :
296 else
297 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
298 exit $EXIT_FAILURE
299 fi
300 }
301
302 # func_extract_archives gentop oldlib ...
303 func_extract_archives ()
304 {
305 my_gentop="$1"; shift
306 my_oldlibs=${1+"$@"}
307 my_oldobjs=""
308 my_xlib=""
309 my_xabs=""
310 my_xdir=""
311 my_status=""
312
313 $show "${rm}r $my_gentop"
314 $run ${rm}r "$my_gentop"
315 $show "$mkdir $my_gentop"
316 $run $mkdir "$my_gentop"
317 my_status=$?
318 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
319 exit $my_status
320 fi
321
322 for my_xlib in $my_oldlibs; do
323 # Extract the objects.
324 case $my_xlib in
325 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
326 *) my_xabs=`pwd`"/$my_xlib" ;;
327 esac
328 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
329 my_xdir="$my_gentop/$my_xlib"
330
331 $show "${rm}r $my_xdir"
332 $run ${rm}r "$my_xdir"
333 $show "$mkdir $my_xdir"
334 $run $mkdir "$my_xdir"
335 exit_status=$?
336 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
337 exit $exit_status
338 fi
339 case $host in
340 *-darwin*)
341 $show "Extracting $my_xabs"
342 # Do not bother doing anything if just a dry run
343 if test -z "$run"; then
344 darwin_orig_dir=`pwd`
345 cd $my_xdir || exit $?
346 darwin_archive=$my_xabs
347 darwin_curdir=`pwd`
348 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
349 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
350 if test -n "$darwin_arches"; then
351 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
352 darwin_arch=
353 $show "$darwin_base_archive has multiple architectures $darwin_arches"
354 for darwin_arch in $darwin_arches ; do
355 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
356 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
357 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
358 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
359 cd "$darwin_curdir"
360 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
361 done # $darwin_arches
362 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
363 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
364 darwin_file=
365 darwin_files=
366 for darwin_file in $darwin_filelist; do
367 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
368 lipo -create -output "$darwin_file" $darwin_files
369 done # $darwin_filelist
370 ${rm}r unfat-$$
371 cd "$darwin_orig_dir"
372 else
373 cd "$darwin_orig_dir"
374 func_extract_an_archive "$my_xdir" "$my_xabs"
375 fi # $darwin_arches
376 fi # $run
377 ;;
378 *)
379 func_extract_an_archive "$my_xdir" "$my_xabs"
380 ;;
381 esac
382 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
383 done
384 func_extract_archives_result="$my_oldobjs"
385 }
386 # End of Shell function definitions
387 #####################################
388
389 # Darwin sucks
390 eval std_shrext=\"$shrext_cmds\"
391
392 disable_libs=no
393
394 # Parse our command line options once, thoroughly.
395 while test "$#" -gt 0
396 do
397 arg="$1"
398 shift
399
400 case $arg in
401 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
402 *) optarg= ;;
403 esac
404
405 # If the previous option needs an argument, assign it.
406 if test -n "$prev"; then
407 case $prev in
408 execute_dlfiles)
409 execute_dlfiles="$execute_dlfiles $arg"
410 ;;
411 tag)
412 tagname="$arg"
413 preserve_args="${preserve_args}=$arg"
414
415 # Check whether tagname contains only valid characters
416 case $tagname in
417 *[!-_A-Za-z0-9,/]*)
418 $echo "$progname: invalid tag name: $tagname" 1>&2
419 exit $EXIT_FAILURE
420 ;;
421 esac
422
423 case $tagname in
424 CC)
425 # Don't test for the "default" C tag, as we know, it's there, but
426 # not specially marked.
427 ;;
428 *)
429 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
430 taglist="$taglist $tagname"
431 # Evaluate the configuration.
432 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
433 else
434 $echo "$progname: ignoring unknown tag $tagname" 1>&2
435 fi
436 ;;
437 esac
438 ;;
439 *)
440 eval "$prev=\$arg"
441 ;;
442 esac
443
444 prev=
445 prevopt=
446 continue
447 fi
448
449 # Have we seen a non-optional argument yet?
450 case $arg in
451 --help)
452 show_help=yes
453 ;;
454
455 --version)
456 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
457 $echo
458 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
459 $echo "This is free software; see the source for copying conditions. There is NO"
460 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
461 exit $?
462 ;;
463
464 --config)
465 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
466 # Now print the configurations for the tags.
467 for tagname in $taglist; do
468 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
469 done
470 exit $?
471 ;;
472
473 --debug)
474 $echo "$progname: enabling shell trace mode"
475 set -x
476 preserve_args="$preserve_args $arg"
477 ;;
478
479 --dry-run | -n)
480 run=:
481 ;;
482
483 --features)
484 $echo "host: $host"
485 if test "$build_libtool_libs" = yes; then
486 $echo "enable shared libraries"
487 else
488 $echo "disable shared libraries"
489 fi
490 if test "$build_old_libs" = yes; then
491 $echo "enable static libraries"
492 else
493 $echo "disable static libraries"
494 fi
495 exit $?
496 ;;
497
498 --finish) mode="finish" ;;
499
500 --mode) prevopt="--mode" prev=mode ;;
501 --mode=*) mode="$optarg" ;;
502
503 --preserve-dup-deps) duplicate_deps="yes" ;;
504
505 --quiet | --silent)
506 show=:
507 preserve_args="$preserve_args $arg"
508 ;;
509
510 --tag)
511 prevopt="--tag"
512 prev=tag
513 preserve_args="$preserve_args --tag"
514 ;;
515 --tag=*)
516 set tag "$optarg" ${1+"$@"}
517 shift
518 prev=tag
519 preserve_args="$preserve_args --tag"
520 ;;
521
522 -dlopen)
523 prevopt="-dlopen"
524 prev=execute_dlfiles
525 ;;
526
527 -*)
528 $echo "$modename: unrecognized option \`$arg'" 1>&2
529 $echo "$help" 1>&2
530 exit $EXIT_FAILURE
531 ;;
532
533 *)
534 nonopt="$arg"
535 break
536 ;;
537 esac
538 done
539
540 if test -n "$prevopt"; then
541 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
542 $echo "$help" 1>&2
543 exit $EXIT_FAILURE
544 fi
545
546 case $disable_libs in
547 no)
548 ;;
549 shared)
550 build_libtool_libs=no
551 build_old_libs=yes
552 ;;
553 static)
554 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
555 ;;
556 esac
557
558 # If this variable is set in any of the actions, the command in it
559 # will be execed at the end. This prevents here-documents from being
560 # left over by shells.
561 exec_cmd=
562
563 if test -z "$show_help"; then
564
565 # Infer the operation mode.
566 if test -z "$mode"; then
567 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
568 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
569 case $nonopt in
570 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
571 mode=link
572 for arg
573 do
574 case $arg in
575 -c)
576 mode=compile
577 break
578 ;;
579 esac
580 done
581 ;;
582 *db | *dbx | *strace | *truss)
583 mode=execute
584 ;;
585 *install*|cp|mv)
586 mode=install
587 ;;
588 *rm)
589 mode=uninstall
590 ;;
591 *)
592 # If we have no mode, but dlfiles were specified, then do execute mode.
593 test -n "$execute_dlfiles" && mode=execute
594
595 # Just use the default operation mode.
596 if test -z "$mode"; then
597 if test -n "$nonopt"; then
598 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
599 else
600 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
601 fi
602 fi
603 ;;
604 esac
605 fi
606
607 # Only execute mode is allowed to have -dlopen flags.
608 if test -n "$execute_dlfiles" && test "$mode" != execute; then
609 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
610 $echo "$help" 1>&2
611 exit $EXIT_FAILURE
612 fi
613
614 # Change the help message to a mode-specific one.
615 generic_help="$help"
616 help="Try \`$modename --help --mode=$mode' for more information."
617
618 # These modes are in order of execution frequency so that they run quickly.
619 case $mode in
620 # libtool compile mode
621 compile)
622 modename="$modename: compile"
623 # Get the compilation command and the source file.
624 base_compile=
625 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
626 suppress_opt=yes
627 suppress_output=
628 arg_mode=normal
629 libobj=
630 later=
631
632 for arg
633 do
634 case $arg_mode in
635 arg )
636 # do not "continue". Instead, add this to base_compile
637 lastarg="$arg"
638 arg_mode=normal
639 ;;
640
641 target )
642 libobj="$arg"
643 arg_mode=normal
644 continue
645 ;;
646
647 normal )
648 # Accept any command-line options.
649 case $arg in
650 -o)
651 if test -n "$libobj" ; then
652 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
653 exit $EXIT_FAILURE
654 fi
655 arg_mode=target
656 continue
657 ;;
658
659 -static | -prefer-pic | -prefer-non-pic)
660 later="$later $arg"
661 continue
662 ;;
663
664 -no-suppress)
665 suppress_opt=no
666 continue
667 ;;
668
669 -Xcompiler)
670 arg_mode=arg # the next one goes into the "base_compile" arg list
671 continue # The current "srcfile" will either be retained or
672 ;; # replaced later. I would guess that would be a bug.
673
674 -Wc,*)
675 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
676 lastarg=
677 save_ifs="$IFS"; IFS=','
678 for arg in $args; do
679 IFS="$save_ifs"
680
681 # Double-quote args containing other shell metacharacters.
682 # Many Bourne shells cannot handle close brackets correctly
683 # in scan sets, so we specify it separately.
684 case $arg in
685 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
686 arg="\"$arg\""
687 ;;
688 esac
689 lastarg="$lastarg $arg"
690 done
691 IFS="$save_ifs"
692 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
693
694 # Add the arguments to base_compile.
695 base_compile="$base_compile $lastarg"
696 continue
697 ;;
698
699 * )
700 # Accept the current argument as the source file.
701 # The previous "srcfile" becomes the current argument.
702 #
703 lastarg="$srcfile"
704 srcfile="$arg"
705 ;;
706 esac # case $arg
707 ;;
708 esac # case $arg_mode
709
710 # Aesthetically quote the previous argument.
711 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
712
713 case $lastarg in
714 # Double-quote args containing other shell metacharacters.
715 # Many Bourne shells cannot handle close brackets correctly
716 # in scan sets, and some SunOS ksh mistreat backslash-escaping
717 # in scan sets (worked around with variable expansion),
718 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
719 # at all, so we specify them separately.
720 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
721 lastarg="\"$lastarg\""
722 ;;
723 esac
724
725 base_compile="$base_compile $lastarg"
726 done # for arg
727
728 case $arg_mode in
729 arg)
730 $echo "$modename: you must specify an argument for -Xcompile"
731 exit $EXIT_FAILURE
732 ;;
733 target)
734 $echo "$modename: you must specify a target with \`-o'" 1>&2
735 exit $EXIT_FAILURE
736 ;;
737 *)
738 # Get the name of the library object.
739 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
740 ;;
741 esac
742
743 # Recognize several different file suffixes.
744 # If the user specifies -o file.o, it is replaced with file.lo
745 xform='[cCFSifmso]'
746 case $libobj in
747 *.ada) xform=ada ;;
748 *.adb) xform=adb ;;
749 *.ads) xform=ads ;;
750 *.asm) xform=asm ;;
751 *.c++) xform=c++ ;;
752 *.cc) xform=cc ;;
753 *.ii) xform=ii ;;
754 *.class) xform=class ;;
755 *.cpp) xform=cpp ;;
756 *.cxx) xform=cxx ;;
757 *.f90) xform=f90 ;;
758 *.for) xform=for ;;
759 *.java) xform=java ;;
760 esac
761
762 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
763
764 case $libobj in
765 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
766 *)
767 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
768 exit $EXIT_FAILURE
769 ;;
770 esac
771
772 func_infer_tag $base_compile
773
774 for arg in $later; do
775 case $arg in
776 -static)
777 build_old_libs=yes
778 continue
779 ;;
780
781 -prefer-pic)
782 pic_mode=yes
783 continue
784 ;;
785
786 -prefer-non-pic)
787 pic_mode=no
788 continue
789 ;;
790 esac
791 done
792
793 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
794 case $qlibobj in
795 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
796 qlibobj="\"$qlibobj\"" ;;
797 esac
798 test "X$libobj" != "X$qlibobj" \
799 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
800 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
801 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
802 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
803 if test "X$xdir" = "X$obj"; then
804 xdir=
805 else
806 xdir=$xdir/
807 fi
808 lobj=${xdir}$objdir/$objname
809
810 if test -z "$base_compile"; then
811 $echo "$modename: you must specify a compilation command" 1>&2
812 $echo "$help" 1>&2
813 exit $EXIT_FAILURE
814 fi
815
816 # Delete any leftover library objects.
817 if test "$build_old_libs" = yes; then
818 removelist="$obj $lobj $libobj ${libobj}T"
819 else
820 removelist="$lobj $libobj ${libobj}T"
821 fi
822
823 $run $rm $removelist
824 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
825
826 # On Cygwin there's no "real" PIC flag so we must build both object types
827 case $host_os in
828 cygwin* | mingw* | pw32* | os2*)
829 pic_mode=default
830 ;;
831 esac
832 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
833 # non-PIC code in shared libraries is not supported
834 pic_mode=default
835 fi
836
837 # Calculate the filename of the output object if compiler does
838 # not support -o with -c
839 if test "$compiler_c_o" = no; then
840 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
841 lockfile="$output_obj.lock"
842 removelist="$removelist $output_obj $lockfile"
843 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
844 else
845 output_obj=
846 need_locks=no
847 lockfile=
848 fi
849
850 # Lock this critical section if it is needed
851 # We use this script file to make the link, it avoids creating a new file
852 if test "$need_locks" = yes; then
853 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
854 $show "Waiting for $lockfile to be removed"
855 sleep 2
856 done
857 elif test "$need_locks" = warn; then
858 if test -f "$lockfile"; then
859 $echo "\
860 *** ERROR, $lockfile exists and contains:
861 `cat $lockfile 2>/dev/null`
862
863 This indicates that another process is trying to use the same
864 temporary object file, and libtool could not work around it because
865 your compiler does not support \`-c' and \`-o' together. If you
866 repeat this compilation, it may succeed, by chance, but you had better
867 avoid parallel builds (make -j) in this platform, or get a better
868 compiler."
869
870 $run $rm $removelist
871 exit $EXIT_FAILURE
872 fi
873 $echo "$srcfile" > "$lockfile"
874 fi
875
876 if test -n "$fix_srcfile_path"; then
877 eval srcfile=\"$fix_srcfile_path\"
878 fi
879 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
880 case $qsrcfile in
881 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
882 qsrcfile="\"$qsrcfile\"" ;;
883 esac
884
885 $run $rm "$libobj" "${libobj}T"
886
887 # Create a libtool object file (analogous to a ".la" file),
888 # but don't create it if we're doing a dry run.
889 test -z "$run" && cat > ${libobj}T <
890 # $libobj - a libtool object file
891 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
892 #
893 # Please DO NOT delete this file!
894 # It is necessary for linking the library.
895
896 # Name of the PIC object.
897 EOF
898
899 # Only build a PIC object if we are building libtool libraries.
900 if test "$build_libtool_libs" = yes; then
901 # Without this assignment, base_compile gets emptied.
902 fbsd_hideous_sh_bug=$base_compile
903
904 if test "$pic_mode" != no; then
905 command="$base_compile $qsrcfile $pic_flag"
906 else
907 # Don't build PIC code
908 command="$base_compile $qsrcfile"
909 fi
910
911 if test ! -d "${xdir}$objdir"; then
912 $show "$mkdir ${xdir}$objdir"
913 $run $mkdir ${xdir}$objdir
914 exit_status=$?
915 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
916 exit $exit_status
917 fi
918 fi
919
920 if test -z "$output_obj"; then
921 # Place PIC objects in $objdir
922 command="$command -o $lobj"
923 fi
924
925 $run $rm "$lobj" "$output_obj"
926
927 $show "$command"
928 if $run eval "$command"; then :
929 else
930 test -n "$output_obj" && $run $rm $removelist
931 exit $EXIT_FAILURE
932 fi
933
934 if test "$need_locks" = warn &&
935 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
936 $echo "\
937 *** ERROR, $lockfile contains:
938 `cat $lockfile 2>/dev/null`
939
940 but it should contain:
941 $srcfile
942
943 This indicates that another process is trying to use the same
944 temporary object file, and libtool could not work around it because
945 your compiler does not support \`-c' and \`-o' together. If you
946 repeat this compilation, it may succeed, by chance, but you had better
947 avoid parallel builds (make -j) in this platform, or get a better
948 compiler."
949
950 $run $rm $removelist
951 exit $EXIT_FAILURE
952 fi
953
954 # Just move the object if needed, then go on to compile the next one
955 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
956 $show "$mv $output_obj $lobj"
957 if $run $mv $output_obj $lobj; then :
958 else
959 error=$?
960 $run $rm $removelist
961 exit $error
962 fi
963 fi
964
965 # Append the name of the PIC object to the libtool object file.
966 test -z "$run" && cat >> ${libobj}T <
967 pic_object='$objdir/$objname'
968
969 EOF
970
971 # Allow error messages only from the first compilation.
972 if test "$suppress_opt" = yes; then
973 suppress_output=' >/dev/null 2>&1'
974 fi
975 else
976 # No PIC object so indicate it doesn't exist in the libtool
977 # object file.
978 test -z "$run" && cat >> ${libobj}T <
979 pic_object=none
980
981 EOF
982 fi
983
984 # Only build a position-dependent object if we build old libraries.
985 if test "$build_old_libs" = yes; then
986 if test "$pic_mode" != yes; then
987 # Don't build PIC code
988 command="$base_compile $qsrcfile"
989 else
990 command="$base_compile $qsrcfile $pic_flag"
991 fi
992 if test "$compiler_c_o" = yes; then
993 command="$command -o $obj"
994 fi
995
996 # Suppress compiler output if we already did a PIC compilation.
997 command="$command$suppress_output"
998 $run $rm "$obj" "$output_obj"
999 $show "$command"
1000 if $run eval "$command"; then :
1001 else
1002 $run $rm $removelist
1003 exit $EXIT_FAILURE
1004 fi
1005
1006 if test "$need_locks" = warn &&
1007 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1008 $echo "\
1009 *** ERROR, $lockfile contains:
1010 `cat $lockfile 2>/dev/null`
1011
1012 but it should contain:
1013 $srcfile
1014
1015 This indicates that another process is trying to use the same
1016 temporary object file, and libtool could not work around it because
1017 your compiler does not support \`-c' and \`-o' together. If you
1018 repeat this compilation, it may succeed, by chance, but you had better
1019 avoid parallel builds (make -j) in this platform, or get a better
1020 compiler."
1021
1022 $run $rm $removelist
1023 exit $EXIT_FAILURE
1024 fi
1025
1026 # Just move the object if needed
1027 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1028 $show "$mv $output_obj $obj"
1029 if $run $mv $output_obj $obj; then :
1030 else
1031 error=$?
1032 $run $rm $removelist
1033 exit $error
1034 fi
1035 fi
1036
1037 # Append the name of the non-PIC object the libtool object file.
1038 # Only append if the libtool object file exists.
1039 test -z "$run" && cat >> ${libobj}T <
1040 # Name of the non-PIC object.
1041 non_pic_object='$objname'
1042
1043 EOF
1044 else
1045 # Append the name of the non-PIC object the libtool object file.
1046 # Only append if the libtool object file exists.
1047 test -z "$run" && cat >> ${libobj}T <
1048 # Name of the non-PIC object.
1049 non_pic_object=none
1050
1051 EOF
1052 fi
1053
1054 $run $mv "${libobj}T" "${libobj}"
1055
1056 # Unlock the critical section if it was locked
1057 if test "$need_locks" != no; then
1058 $run $rm "$lockfile"
1059 fi
1060
1061 exit $EXIT_SUCCESS
1062 ;;
1063
1064 # libtool link mode
1065 link | relink)
1066 modename="$modename: link"
1067 case $host in
1068 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1069 # It is impossible to link a dll without this setting, and
1070 # we shouldn't force the makefile maintainer to figure out
1071 # which system we are compiling for in order to pass an extra
1072 # flag for every libtool invocation.
1073 # allow_undefined=no
1074
1075 # FIXME: Unfortunately, there are problems with the above when trying
1076 # to make a dll which has undefined symbols, in which case not
1077 # even a static library is built. For now, we need to specify
1078 # -no-undefined on the libtool link line when we can be certain
1079 # that all symbols are satisfied, otherwise we get a static library.
1080 allow_undefined=yes
1081 ;;
1082 *)
1083 allow_undefined=yes
1084 ;;
1085 esac
1086 libtool_args="$nonopt"
1087 base_compile="$nonopt $@"
1088 compile_command="$nonopt"
1089 finalize_command="$nonopt"
1090
1091 compile_rpath=
1092 finalize_rpath=
1093 compile_shlibpath=
1094 finalize_shlibpath=
1095 convenience=
1096 old_convenience=
1097 deplibs=
1098 old_deplibs=
1099 compiler_flags=
1100 linker_flags=
1101 dllsearchpath=
1102 lib_search_path=`pwd`
1103 inst_prefix_dir=
1104
1105 avoid_version=no
1106 dlfiles=
1107 dlprefiles=
1108 dlself=no
1109 export_dynamic=no
1110 export_symbols=
1111 export_symbols_regex=
1112 generated=
1113 libobjs=
1114 ltlibs=
1115 module=no
1116 no_install=no
1117 objs=
1118 non_pic_objects=
1119 notinst_path= # paths that contain not-installed libtool libraries
1120 precious_files_regex=
1121 prefer_static_libs=no
1122 preload=no
1123 prev=
1124 prevarg=
1125 release=
1126 rpath=
1127 xrpath=
1128 perm_rpath=
1129 temp_rpath=
1130 thread_safe=no
1131 vinfo=
1132 vinfo_number=no
1133
1134 func_infer_tag $base_compile
1135
1136 # We need to know -static, to get the right output filenames.
1137 for arg
1138 do
1139 case $arg in
1140 -all-static | -static)
1141 if test "X$arg" = "X-all-static"; then
1142 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1143 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1144 fi
1145 if test -n "$link_static_flag"; then
1146 dlopen_self=$dlopen_self_static
1147 fi
1148 prefer_static_libs=yes
1149 else
1150 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1151 dlopen_self=$dlopen_self_static
1152 fi
1153 prefer_static_libs=built
1154 fi
1155 build_libtool_libs=no
1156 build_old_libs=yes
1157 break
1158 ;;
1159 esac
1160 done
1161
1162 # See if our shared archives depend on static archives.
1163 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1164
1165 # Go through the arguments, transforming them on the way.
1166 while test "$#" -gt 0; do
1167 arg="$1"
1168 shift
1169 case $arg in
1170 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1171 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1172 ;;
1173 *) qarg=$arg ;;
1174 esac
1175 libtool_args="$libtool_args $qarg"
1176
1177 # If the previous option needs an argument, assign it.
1178 if test -n "$prev"; then
1179 case $prev in
1180 output)
1181 compile_command="$compile_command @OUTPUT@"
1182 finalize_command="$finalize_command @OUTPUT@"
1183 ;;
1184 esac
1185
1186 case $prev in
1187 dlfiles|dlprefiles)
1188 if test "$preload" = no; then
1189 # Add the symbol object into the linking commands.
1190 compile_command="$compile_command @SYMFILE@"
1191 finalize_command="$finalize_command @SYMFILE@"
1192 preload=yes
1193 fi
1194 case $arg in
1195 *.la | *.lo) ;; # We handle these cases below.
1196 force)
1197 if test "$dlself" = no; then
1198 dlself=needless
1199 export_dynamic=yes
1200 fi
1201 prev=
1202 continue
1203 ;;
1204 self)
1205 if test "$prev" = dlprefiles; then
1206 dlself=yes
1207 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1208 dlself=yes
1209 else
1210 dlself=needless
1211 export_dynamic=yes
1212 fi
1213 prev=
1214 continue
1215 ;;
1216 *)
1217 if test "$prev" = dlfiles; then
1218 dlfiles="$dlfiles $arg"
1219 else
1220 dlprefiles="$dlprefiles $arg"
1221 fi
1222 prev=
1223 continue
1224 ;;
1225 esac
1226 ;;
1227 expsyms)
1228 export_symbols="$arg"
1229 if test ! -f "$arg"; then
1230 $echo "$modename: symbol file \`$arg' does not exist"
1231 exit $EXIT_FAILURE
1232 fi
1233 prev=
1234 continue
1235 ;;
1236 expsyms_regex)
1237 export_symbols_regex="$arg"
1238 prev=
1239 continue
1240 ;;
1241 inst_prefix)
1242 inst_prefix_dir="$arg"
1243 prev=
1244 continue
1245 ;;
1246 precious_regex)
1247 precious_files_regex="$arg"
1248 prev=
1249 continue
1250 ;;
1251 release)
1252 release="-$arg"
1253 prev=
1254 continue
1255 ;;
1256 objectlist)
1257 if test -f "$arg"; then
1258 save_arg=$arg
1259 moreargs=
1260 for fil in `cat $save_arg`
1261 do
1262 # moreargs="$moreargs $fil"
1263 arg=$fil
1264 # A libtool-controlled object.
1265
1266 # Check to see that this really is a libtool object.
1267 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1268 pic_object=
1269 non_pic_object=
1270
1271 # Read the .lo file
1272 # If there is no directory component, then add one.
1273 case $arg in
1274 */* | *\\*) . $arg ;;
1275 *) . ./$arg ;;
1276 esac
1277
1278 if test -z "$pic_object" || \
1279 test -z "$non_pic_object" ||
1280 test "$pic_object" = none && \
1281 test "$non_pic_object" = none; then
1282 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1283 exit $EXIT_FAILURE
1284 fi
1285
1286 # Extract subdirectory from the argument.
1287 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1288 if test "X$xdir" = "X$arg"; then
1289 xdir=
1290 else
1291 xdir="$xdir/"
1292 fi
1293
1294 if test "$pic_object" != none; then
1295 # Prepend the subdirectory the object is found in.
1296 pic_object="$xdir$pic_object"
1297
1298 if test "$prev" = dlfiles; then
1299 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1300 dlfiles="$dlfiles $pic_object"
1301 prev=
1302 continue
1303 else
1304 # If libtool objects are unsupported, then we need to preload.
1305 prev=dlprefiles
1306 fi
1307 fi
1308
1309 # CHECK ME: I think I busted this. -Ossama
1310 if test "$prev" = dlprefiles; then
1311 # Preload the old-style object.
1312 dlprefiles="$dlprefiles $pic_object"
1313 prev=
1314 fi
1315
1316 # A PIC object.
1317 libobjs="$libobjs $pic_object"
1318 arg="$pic_object"
1319 fi
1320
1321 # Non-PIC object.
1322 if test "$non_pic_object" != none; then
1323 # Prepend the subdirectory the object is found in.
1324 non_pic_object="$xdir$non_pic_object"
1325
1326 # A standard non-PIC object
1327 non_pic_objects="$non_pic_objects $non_pic_object"
1328 if test -z "$pic_object" || test "$pic_object" = none ; then
1329 arg="$non_pic_object"
1330 fi
1331 else
1332 # If the PIC object exists, use it instead.
1333 # $xdir was prepended to $pic_object above.
1334 non_pic_object="$pic_object"
1335 non_pic_objects="$non_pic_objects $non_pic_object"
1336 fi
1337 else
1338 # Only an error if not doing a dry-run.
1339 if test -z "$run"; then
1340 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1341 exit $EXIT_FAILURE
1342 else
1343 # Dry-run case.
1344
1345 # Extract subdirectory from the argument.
1346 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1347 if test "X$xdir" = "X$arg"; then
1348 xdir=
1349 else
1350 xdir="$xdir/"
1351 fi
1352
1353 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1354 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1355 libobjs="$libobjs $pic_object"
1356 non_pic_objects="$non_pic_objects $non_pic_object"
1357 fi
1358 fi
1359 done
1360 else
1361 $echo "$modename: link input file \`$save_arg' does not exist"
1362 exit $EXIT_FAILURE
1363 fi
1364 arg=$save_arg
1365 prev=
1366 continue
1367 ;;
1368 rpath | xrpath)
1369 # We need an absolute path.
1370 case $arg in
1371 [\\/]* | [A-Za-z]:[\\/]*) ;;
1372 *)
1373 $echo "$modename: only absolute run-paths are allowed" 1>&2
1374 exit $EXIT_FAILURE
1375 ;;
1376 esac
1377 if test "$prev" = rpath; then
1378 case "$rpath " in
1379 *" $arg "*) ;;
1380 *) rpath="$rpath $arg" ;;
1381 esac
1382 else
1383 case "$xrpath " in
1384 *" $arg "*) ;;
1385 *) xrpath="$xrpath $arg" ;;
1386 esac
1387 fi
1388 prev=
1389 continue
1390 ;;
1391 xcompiler)
1392 compiler_flags="$compiler_flags $qarg"
1393 prev=
1394 compile_command="$compile_command $qarg"
1395 finalize_command="$finalize_command $qarg"
1396 continue
1397 ;;
1398 xlinker)
1399 linker_flags="$linker_flags $qarg"
1400 compiler_flags="$compiler_flags $wl$qarg"
1401 prev=
1402 compile_command="$compile_command $wl$qarg"
1403 finalize_command="$finalize_command $wl$qarg"
1404 continue
1405 ;;
1406 xcclinker)
1407 linker_flags="$linker_flags $qarg"
1408 compiler_flags="$compiler_flags $qarg"
1409 prev=
1410 compile_command="$compile_command $qarg"
1411 finalize_command="$finalize_command $qarg"
1412 continue
1413 ;;
1414 shrext)
1415 shrext_cmds="$arg"
1416 prev=
1417 continue
1418 ;;
1419 darwin_framework|darwin_framework_skip)
1420 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1421 compile_command="$compile_command $arg"
1422 finalize_command="$finalize_command $arg"
1423 prev=
1424 continue
1425 ;;
1426 *)
1427 eval "$prev=\"\$arg\""
1428 prev=
1429 continue
1430 ;;
1431 esac
1432 fi # test -n "$prev"
1433
1434 prevarg="$arg"
1435
1436 case $arg in
1437 -all-static)
1438 if test -n "$link_static_flag"; then
1439 compile_command="$compile_command $link_static_flag"
1440 finalize_command="$finalize_command $link_static_flag"
1441 fi
1442 continue
1443 ;;
1444
1445 -allow-undefined)
1446 # FIXME: remove this flag sometime in the future.
1447 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1448 continue
1449 ;;
1450
1451 -avoid-version)
1452 avoid_version=yes
1453 continue
1454 ;;
1455
1456 -dlopen)
1457 prev=dlfiles
1458 continue
1459 ;;
1460
1461 -dlpreopen)
1462 prev=dlprefiles
1463 continue
1464 ;;
1465
1466 -export-dynamic)
1467 export_dynamic=yes
1468 continue
1469 ;;
1470
1471 -export-symbols | -export-symbols-regex)
1472 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1473 $echo "$modename: more than one -exported-symbols argument is not allowed"
1474 exit $EXIT_FAILURE
1475 fi
1476 if test "X$arg" = "X-export-symbols"; then
1477 prev=expsyms
1478 else
1479 prev=expsyms_regex
1480 fi
1481 continue
1482 ;;
1483
1484 -framework|-arch|-isysroot)
1485 case " $CC " in
1486 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1487 prev=darwin_framework_skip ;;
1488 *) compiler_flags="$compiler_flags $arg"
1489 prev=darwin_framework ;;
1490 esac
1491 compile_command="$compile_command $arg"
1492 finalize_command="$finalize_command $arg"
1493 continue
1494 ;;
1495
1496 -inst-prefix-dir)
1497 prev=inst_prefix
1498 continue
1499 ;;
1500
1501 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1502 # so, if we see these flags be careful not to treat them like -L
1503 -L[A-Z][A-Z]*:*)
1504 case $with_gcc/$host in
1505 no/*-*-irix* | /*-*-irix*)
1506 compile_command="$compile_command $arg"
1507 finalize_command="$finalize_command $arg"
1508 ;;
1509 esac
1510 continue
1511 ;;
1512
1513 -L*)
1514 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1515 # We need an absolute path.
1516 case $dir in
1517 [\\/]* | [A-Za-z]:[\\/]*) ;;
1518 *)
1519 absdir=`cd "$dir" && pwd`
1520 if test -z "$absdir"; then
1521 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1522 absdir="$dir"
1523 notinst_path="$notinst_path $dir"
1524 fi
1525 dir="$absdir"
1526 ;;
1527 esac
1528 case "$deplibs " in
1529 *" -L$dir "*) ;;
1530 *)
1531 deplibs="$deplibs -L$dir"
1532 lib_search_path="$lib_search_path $dir"
1533 ;;
1534 esac
1535 case $host in
1536 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1537 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1538 case :$dllsearchpath: in
1539 *":$dir:"*) ;;
1540 *) dllsearchpath="$dllsearchpath:$dir";;
1541 esac
1542 case :$dllsearchpath: in
1543 *":$testbindir:"*) ;;
1544 *) dllsearchpath="$dllsearchpath:$testbindir";;
1545 esac
1546 ;;
1547 esac
1548 continue
1549 ;;
1550
1551 -l*)
1552 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1553 case $host in
1554 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1555 # These systems don't actually have a C or math library (as such)
1556 continue
1557 ;;
1558 *-*-os2*)
1559 # These systems don't actually have a C library (as such)
1560 test "X$arg" = "X-lc" && continue
1561 ;;
1562 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
1563 # Do not include libc due to us having libc/libc_r.
1564 test "X$arg" = "X-lc" && continue
1565 ;;
1566 *-*-rhapsody* | *-*-darwin1.[012])
1567 # Rhapsody C and math libraries are in the System framework
1568 deplibs="$deplibs -framework System"
1569 continue
1570 ;;
1571 *-*-sco3.2v5* | *-*-sco5v6*)
1572 # Causes problems with __ctype
1573 test "X$arg" = "X-lc" && continue
1574 ;;
1575 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1576 # Compiler inserts libc in the correct place for threads to work
1577 test "X$arg" = "X-lc" && continue
1578 ;;
1579 esac
1580 elif test "X$arg" = "X-lc_r"; then
1581 case $host in
1582 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | -*-*-bitrig*)
1583 # Do not include libc_r directly, use -pthread flag.
1584 continue
1585 ;;
1586 esac
1587 fi
1588 deplibs="$deplibs $arg"
1589 continue
1590 ;;
1591
1592 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1593 # classes, name mangling, and exception handling.
1594 -model)
1595 compile_command="$compile_command $arg"
1596 compiler_flags="$compiler_flags $arg"
1597 finalize_command="$finalize_command $arg"
1598 prev=xcompiler
1599 continue
1600 ;;
1601
1602 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1603 compiler_flags="$compiler_flags $arg"
1604 compile_command="$compile_command $arg"
1605 finalize_command="$finalize_command $arg"
1606 continue
1607 ;;
1608
1609 -module)
1610 module=yes
1611 continue
1612 ;;
1613
1614 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1615 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1616 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1617 # +DA*, +DD* enable 64-bit mode on the HP compiler
1618 # -q* pass through compiler args for the IBM compiler
1619 # -m* pass through architecture-specific compiler args for GCC
1620 # -m*, -t[45]*, -txscale* pass through architecture-specific
1621 # compiler args for GCC
1622 # -pg pass through profiling flag for GCC
1623 # @file GCC response files
1624 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1625 -t[45]*|-txscale*|@*)
1626
1627 # Unknown arguments in both finalize_command and compile_command need
1628 # to be aesthetically quoted because they are evaled later.
1629 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1630 case $arg in
1631 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1632 arg="\"$arg\""
1633 ;;
1634 esac
1635 compile_command="$compile_command $arg"
1636 finalize_command="$finalize_command $arg"
1637 compiler_flags="$compiler_flags $arg"
1638 continue
1639 ;;
1640
1641 -shrext)
1642 prev=shrext
1643 continue
1644 ;;
1645
1646 -no-fast-install)
1647 fast_install=no
1648 continue
1649 ;;
1650
1651 -no-install)
1652 case $host in
1653 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1654 # The PATH hackery in wrapper scripts is required on Windows
1655 # in order for the loader to find any dlls it needs.
1656 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1657 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1658 fast_install=no
1659 ;;
1660 *) no_install=yes ;;
1661 esac
1662 continue
1663 ;;
1664
1665 -no-undefined)
1666 allow_undefined=no
1667 continue
1668 ;;
1669
1670 -objectlist)
1671 prev=objectlist
1672 continue
1673 ;;
1674
1675 -o) prev=output ;;
1676
1677 -precious-files-regex)
1678 prev=precious_regex
1679 continue
1680 ;;
1681
1682 -release)
1683 prev=release
1684 continue
1685 ;;
1686
1687 -rpath)
1688 prev=rpath
1689 continue
1690 ;;
1691
1692 -R)
1693 prev=xrpath
1694 continue
1695 ;;
1696
1697 -R*)
1698 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1699 # We need an absolute path.
1700 case $dir in
1701 [\\/]* | [A-Za-z]:[\\/]*) ;;
1702 *)
1703 $echo "$modename: only absolute run-paths are allowed" 1>&2
1704 exit $EXIT_FAILURE
1705 ;;
1706 esac
1707 case "$xrpath " in
1708 *" $dir "*) ;;
1709 *) xrpath="$xrpath $dir" ;;
1710 esac
1711 continue
1712 ;;
1713
1714 -static)
1715 # The effects of -static are defined in a previous loop.
1716 # We used to do the same as -all-static on platforms that
1717 # didn't have a PIC flag, but the assumption that the effects
1718 # would be equivalent was wrong. It would break on at least
1719 # Digital Unix and AIX.
1720 continue
1721 ;;
1722
1723 -thread-safe)
1724 thread_safe=yes
1725 continue
1726 ;;
1727
1728 -version-info)
1729 prev=vinfo
1730 continue
1731 ;;
1732 -version-number)
1733 prev=vinfo
1734 vinfo_number=yes
1735 continue
1736 ;;
1737
1738 -Wc,*)
1739 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1740 arg=
1741 save_ifs="$IFS"; IFS=','
1742 for flag in $args; do
1743 IFS="$save_ifs"
1744 case $flag in
1745 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1746 flag="\"$flag\""
1747 ;;
1748 esac
1749 arg="$arg $wl$flag"
1750 compiler_flags="$compiler_flags $flag"
1751 done
1752 IFS="$save_ifs"
1753 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1754 ;;
1755
1756 -Wl,*)
1757 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1758 arg=
1759 save_ifs="$IFS"; IFS=','
1760 for flag in $args; do
1761 IFS="$save_ifs"
1762 case $flag in
1763 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1764 flag="\"$flag\""
1765 ;;
1766 esac
1767 arg="$arg $wl$flag"
1768 compiler_flags="$compiler_flags $wl$flag"
1769 linker_flags="$linker_flags $flag"
1770 done
1771 IFS="$save_ifs"
1772 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1773 ;;
1774
1775 -Xcompiler)
1776 prev=xcompiler
1777 continue
1778 ;;
1779
1780 -Xlinker)
1781 prev=xlinker
1782 continue
1783 ;;
1784
1785 -XCClinker)
1786 prev=xcclinker
1787 continue
1788 ;;
1789
1790 # Some other compiler flag.
1791 -* | +*)
1792 # Unknown arguments in both finalize_command and compile_command need
1793 # to be aesthetically quoted because they are evaled later.
1794 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1795 case $arg in
1796 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1797 arg="\"$arg\""
1798 ;;
1799 esac
1800 ;;
1801
1802 *.$objext)
1803 # A standard object.
1804 objs="$objs $arg"
1805 ;;
1806
1807 *.lo)
1808 # A libtool-controlled object.
1809
1810 # Check to see that this really is a libtool object.
1811 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1812 pic_object=
1813 non_pic_object=
1814
1815 # Read the .lo file
1816 # If there is no directory component, then add one.
1817 case $arg in
1818 */* | *\\*) . $arg ;;
1819 *) . ./$arg ;;
1820 esac
1821
1822 if test -z "$pic_object" || \
1823 test -z "$non_pic_object" ||
1824 test "$pic_object" = none && \
1825 test "$non_pic_object" = none; then
1826 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1827 exit $EXIT_FAILURE
1828 fi
1829
1830 # Extract subdirectory from the argument.
1831 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1832 if test "X$xdir" = "X$arg"; then
1833 xdir=
1834 else
1835 xdir="$xdir/"
1836 fi
1837
1838 if test "$pic_object" != none; then
1839 # Prepend the subdirectory the object is found in.
1840 pic_object="$xdir$pic_object"
1841
1842 if test "$prev" = dlfiles; then
1843 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1844 dlfiles="$dlfiles $pic_object"
1845 prev=
1846 continue
1847 else
1848 # If libtool objects are unsupported, then we need to preload.
1849 prev=dlprefiles
1850 fi
1851 fi
1852
1853 # CHECK ME: I think I busted this. -Ossama
1854 if test "$prev" = dlprefiles; then
1855 # Preload the old-style object.
1856 dlprefiles="$dlprefiles $pic_object"
1857 prev=
1858 fi
1859
1860 # A PIC object.
1861 libobjs="$libobjs $pic_object"
1862 arg="$pic_object"
1863 fi
1864
1865 # Non-PIC object.
1866 if test "$non_pic_object" != none; then
1867 # Prepend the subdirectory the object is found in.
1868 non_pic_object="$xdir$non_pic_object"
1869
1870 # A standard non-PIC object
1871 non_pic_objects="$non_pic_objects $non_pic_object"
1872 if test -z "$pic_object" || test "$pic_object" = none ; then
1873 arg="$non_pic_object"
1874 fi
1875 else
1876 # If the PIC object exists, use it instead.
1877 # $xdir was prepended to $pic_object above.
1878 non_pic_object="$pic_object"
1879 non_pic_objects="$non_pic_objects $non_pic_object"
1880 fi
1881 else
1882 # Only an error if not doing a dry-run.
1883 if test -z "$run"; then
1884 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1885 exit $EXIT_FAILURE
1886 else
1887 # Dry-run case.
1888
1889 # Extract subdirectory from the argument.
1890 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1891 if test "X$xdir" = "X$arg"; then
1892 xdir=
1893 else
1894 xdir="$xdir/"
1895 fi
1896
1897 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1898 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1899 libobjs="$libobjs $pic_object"
1900 non_pic_objects="$non_pic_objects $non_pic_object"
1901 fi
1902 fi
1903 ;;
1904
1905 *.$libext)
1906 # An archive.
1907 deplibs="$deplibs $arg"
1908 old_deplibs="$old_deplibs $arg"
1909 continue
1910 ;;
1911
1912 *.la)
1913 # A libtool-controlled library.
1914
1915 if test "$prev" = dlfiles; then
1916 # This library was specified with -dlopen.
1917 dlfiles="$dlfiles $arg"
1918 prev=
1919 elif test "$prev" = dlprefiles; then
1920 # The library was specified with -dlpreopen.
1921 dlprefiles="$dlprefiles $arg"
1922 prev=
1923 else
1924 deplibs="$deplibs $arg"
1925 fi
1926 continue
1927 ;;
1928
1929 # Some other compiler argument.
1930 *)
1931 # Unknown arguments in both finalize_command and compile_command need
1932 # to be aesthetically quoted because they are evaled later.
1933 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1934 case $arg in
1935 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1936 arg="\"$arg\""
1937 ;;
1938 esac
1939 ;;
1940 esac # arg
1941
1942 # Now actually substitute the argument into the commands.
1943 if test -n "$arg"; then
1944 compile_command="$compile_command $arg"
1945 finalize_command="$finalize_command $arg"
1946 fi
1947 done # argument parsing loop
1948
1949 if test -n "$prev"; then
1950 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1951 $echo "$help" 1>&2
1952 exit $EXIT_FAILURE
1953 fi
1954
1955 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1956 eval arg=\"$export_dynamic_flag_spec\"
1957 compile_command="$compile_command $arg"
1958 finalize_command="$finalize_command $arg"
1959 fi
1960
1961 oldlibs=
1962 # calculate the name of the file, without its directory
1963 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1964 libobjs_save="$libobjs"
1965
1966 if test -n "$shlibpath_var"; then
1967 # get the directories listed in $shlibpath_var
1968 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1969 else
1970 shlib_search_path=
1971 fi
1972 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1973 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1974
1975 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1976 if test "X$output_objdir" = "X$output"; then
1977 output_objdir="$objdir"
1978 else
1979 output_objdir="$output_objdir/$objdir"
1980 fi
1981 # Create the object directory.
1982 if test ! -d "$output_objdir"; then
1983 $show "$mkdir $output_objdir"
1984 $run $mkdir $output_objdir
1985 exit_status=$?
1986 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
1987 exit $exit_status
1988 fi
1989 fi
1990
1991 # Determine the type of output
1992 case $output in
1993 "")
1994 $echo "$modename: you must specify an output file" 1>&2
1995 $echo "$help" 1>&2
1996 exit $EXIT_FAILURE
1997 ;;
1998 *.$libext) linkmode=oldlib ;;
1999 *.lo | *.$objext) linkmode=obj ;;
2000 *.la) linkmode=lib ;;
2001 *) linkmode=prog ;; # Anything else should be a program.
2002 esac
2003
2004 case $host in
2005 *cygwin* | *mingw* | *pw32*)
2006 # don't eliminate duplications in $postdeps and $predeps
2007 duplicate_compiler_generated_deps=yes
2008 ;;
2009 *)
2010 duplicate_compiler_generated_deps=$duplicate_deps
2011 ;;
2012 esac
2013 specialdeplibs=
2014
2015 libs=
2016 # Find all interdependent deplibs by searching for libraries
2017 # that are linked more than once (e.g. -la -lb -la)
2018 for deplib in $deplibs; do
2019 if test "X$duplicate_deps" = "Xyes" ; then
2020 case "$libs " in
2021 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2022 esac
2023 fi
2024 libs="$libs $deplib"
2025 done
2026
2027 if test "$linkmode" = lib; then
2028 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2029
2030 # Compute libraries that are listed more than once in $predeps
2031 # $postdeps and mark them as special (i.e., whose duplicates are
2032 # not to be eliminated).
2033 pre_post_deps=
2034 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2035 for pre_post_dep in $predeps $postdeps; do
2036 case "$pre_post_deps " in
2037 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2038 esac
2039 pre_post_deps="$pre_post_deps $pre_post_dep"
2040 done
2041 fi
2042 pre_post_deps=
2043 fi
2044
2045 deplibs=
2046 newdependency_libs=
2047 newlib_search_path=
2048 need_relink=no # whether we're linking any uninstalled libtool libraries
2049 notinst_deplibs= # not-installed libtool libraries
2050 case $linkmode in
2051 lib)
2052 passes="conv link"
2053 for file in $dlfiles $dlprefiles; do
2054 case $file in
2055 *.la) ;;
2056 *)
2057 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2058 exit $EXIT_FAILURE
2059 ;;
2060 esac
2061 done
2062 ;;
2063 prog)
2064 compile_deplibs=
2065 finalize_deplibs=
2066 alldeplibs=no
2067 newdlfiles=
2068 newdlprefiles=
2069 passes="conv scan dlopen dlpreopen link"
2070 ;;
2071 *) passes="conv"
2072 ;;
2073 esac
2074 for pass in $passes; do
2075 if test "$linkmode,$pass" = "lib,link" ||
2076 test "$linkmode,$pass" = "prog,scan"; then
2077 libs="$deplibs"
2078 deplibs=
2079 fi
2080 if test "$linkmode" = prog; then
2081 case $pass in
2082 dlopen) libs="$dlfiles" ;;
2083 dlpreopen) libs="$dlprefiles" ;;
2084 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2085 esac
2086 fi
2087 if test "$pass" = dlopen; then
2088 # Collect dlpreopened libraries
2089 save_deplibs="$deplibs"
2090 deplibs=
2091 fi
2092 for deplib in $libs; do
2093 lib=
2094 found=no
2095 case $deplib in
2096 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2097 if test "$linkmode,$pass" = "prog,link"; then
2098 compile_deplibs="$deplib $compile_deplibs"
2099 finalize_deplibs="$deplib $finalize_deplibs"
2100 else
2101 compiler_flags="$compiler_flags $deplib"
2102 fi
2103 continue
2104 ;;
2105 -l*)
2106 if test "$linkmode" != lib && test "$linkmode" != prog; then
2107 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2108 continue
2109 fi
2110 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2111 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2112 for search_ext in .la $std_shrext .so .a; do
2113 # Search the libtool library
2114 lib="$searchdir/lib${name}${search_ext}"
2115 if test -f "$lib"; then
2116 if test "$search_ext" = ".la"; then
2117 found=yes
2118 else
2119 found=no
2120 fi
2121 break 2
2122 fi
2123 done
2124 done
2125 if test "$found" != yes; then
2126 # deplib doesn't seem to be a libtool library
2127 if test "$linkmode,$pass" = "prog,link"; then
2128 compile_deplibs="$deplib $compile_deplibs"
2129 finalize_deplibs="$deplib $finalize_deplibs"
2130 else
2131 deplibs="$deplib $deplibs"
2132 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2133 fi
2134 continue
2135 else # deplib is a libtool library
2136 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2137 # We need to do some special things here, and not later.
2138 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2139 case " $predeps $postdeps " in
2140 *" $deplib "*)
2141 if (${SED} -e '2q' $lib |
2142 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2143 library_names=
2144 old_library=
2145 case $lib in
2146 */* | *\\*) . $lib ;;
2147 *) . ./$lib ;;
2148 esac
2149 for l in $old_library $library_names; do
2150 ll="$l"
2151 done
2152 if test "X$ll" = "X$old_library" ; then # only static version available
2153 found=no
2154 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2155 test "X$ladir" = "X$lib" && ladir="."
2156 lib=$ladir/$old_library
2157 if test "$linkmode,$pass" = "prog,link"; then
2158 compile_deplibs="$deplib $compile_deplibs"
2159 finalize_deplibs="$deplib $finalize_deplibs"
2160 else
2161 deplibs="$deplib $deplibs"
2162 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2163 fi
2164 continue
2165 fi
2166 fi
2167 ;;
2168 *) ;;
2169 esac
2170 fi
2171 fi
2172 ;; # -l
2173 -L*)
2174 case $linkmode in
2175 lib)
2176 deplibs="$deplib $deplibs"
2177 test "$pass" = conv && continue
2178 newdependency_libs="$deplib $newdependency_libs"
2179 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2180 ;;
2181 prog)
2182 if test "$pass" = conv; then
2183 deplibs="$deplib $deplibs"
2184 continue
2185 fi
2186 if test "$pass" = scan; then
2187 deplibs="$deplib $deplibs"
2188 else
2189 compile_deplibs="$deplib $compile_deplibs"
2190 finalize_deplibs="$deplib $finalize_deplibs"
2191 fi
2192 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2193 ;;
2194 *)
2195 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2196 ;;
2197 esac # linkmode
2198 continue
2199 ;; # -L
2200 -R*)
2201 if test "$pass" = link; then
2202 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2203 # Make sure the xrpath contains only unique directories.
2204 case "$xrpath " in
2205 *" $dir "*) ;;
2206 *) xrpath="$xrpath $dir" ;;
2207 esac
2208 fi
2209 deplibs="$deplib $deplibs"
2210 continue
2211 ;;
2212 *.la) lib="$deplib" ;;
2213 *.$libext)
2214 if test "$pass" = conv; then
2215 deplibs="$deplib $deplibs"
2216 continue
2217 fi
2218 case $linkmode in
2219 lib)
2220 valid_a_lib=no
2221 case $deplibs_check_method in
2222 match_pattern*)
2223 set dummy $deplibs_check_method
2224 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2225 if eval $echo \"$deplib\" 2>/dev/null \
2226 | $SED 10q \
2227 | $EGREP "$match_pattern_regex" > /dev/null; then
2228 valid_a_lib=yes
2229 fi
2230 ;;
2231 pass_all)
2232 valid_a_lib=yes
2233 ;;
2234 esac
2235 if test "$valid_a_lib" != yes; then
2236 $echo
2237 $echo "*** Warning: Trying to link with static lib archive $deplib."
2238 $echo "*** I have the capability to make that library automatically link in when"
2239 $echo "*** you link to this library. But I can only do this if you have a"
2240 $echo "*** shared version of the library, which you do not appear to have"
2241 $echo "*** because the file extensions .$libext of this argument makes me believe"
2242 $echo "*** that it is just a static archive that I should not used here."
2243 else
2244 $echo
2245 $echo "*** Warning: Linking the shared library $output against the"
2246 $echo "*** static library $deplib is not portable!"
2247 deplibs="$deplib $deplibs"
2248 fi
2249 continue
2250 ;;
2251 prog)
2252 if test "$pass" != link; then
2253 deplibs="$deplib $deplibs"
2254 else
2255 compile_deplibs="$deplib $compile_deplibs"
2256 finalize_deplibs="$deplib $finalize_deplibs"
2257 fi
2258 continue
2259 ;;
2260 esac # linkmode
2261 ;; # *.$libext
2262 *.lo | *.$objext)
2263 if test "$pass" = conv; then
2264 deplibs="$deplib $deplibs"
2265 elif test "$linkmode" = prog; then
2266 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2267 # If there is no dlopen support or we're linking statically,
2268 # we need to preload.
2269 newdlprefiles="$newdlprefiles $deplib"
2270 compile_deplibs="$deplib $compile_deplibs"
2271 finalize_deplibs="$deplib $finalize_deplibs"
2272 else
2273 newdlfiles="$newdlfiles $deplib"
2274 fi
2275 fi
2276 continue
2277 ;;
2278 %DEPLIBS%)
2279 alldeplibs=yes
2280 continue
2281 ;;
2282 esac # case $deplib
2283 if test "$found" = yes || test -f "$lib"; then :
2284 else
2285 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2286 exit $EXIT_FAILURE
2287 fi
2288
2289 # Check to see that this really is a libtool archive.
2290 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2291 else
2292 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2293 exit $EXIT_FAILURE
2294 fi
2295
2296 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2297 test "X$ladir" = "X$lib" && ladir="."
2298
2299 dlname=
2300 dlopen=
2301 dlpreopen=
2302 libdir=
2303 library_names=
2304 old_library=
2305 # If the library was installed with an old release of libtool,
2306 # it will not redefine variables installed, or shouldnotlink
2307 installed=yes
2308 shouldnotlink=no
2309 avoidtemprpath=
2310
2311
2312 # Read the .la file
2313 case $lib in
2314 */* | *\\*) . $lib ;;
2315 *) . ./$lib ;;
2316 esac
2317
2318 if test "$linkmode,$pass" = "lib,link" ||
2319 test "$linkmode,$pass" = "prog,scan" ||
2320 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2321 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2322 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2323 fi
2324
2325 if test "$pass" = conv; then
2326 # Only check for convenience libraries
2327 deplibs="$lib $deplibs"
2328 if test -z "$libdir"; then
2329 if test -z "$old_library"; then
2330 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2331 exit $EXIT_FAILURE
2332 fi
2333 # It is a libtool convenience library, so add in its objects.
2334 convenience="$convenience $ladir/$objdir/$old_library"
2335 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2336 tmp_libs=
2337 for deplib in $dependency_libs; do
2338 deplibs="$deplib $deplibs"
2339 if test "X$duplicate_deps" = "Xyes" ; then
2340 case "$tmp_libs " in
2341 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2342 esac
2343 fi
2344 tmp_libs="$tmp_libs $deplib"
2345 done
2346 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2347 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2348 exit $EXIT_FAILURE
2349 fi
2350 continue
2351 fi # $pass = conv
2352
2353
2354 # Get the name of the library we link against.
2355 linklib=
2356 for l in $old_library $library_names; do
2357 linklib="$l"
2358 done
2359 if test -z "$linklib"; then
2360 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2361 exit $EXIT_FAILURE
2362 fi
2363
2364 # This library was specified with -dlopen.
2365 if test "$pass" = dlopen; then
2366 if test -z "$libdir"; then
2367 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2368 exit $EXIT_FAILURE
2369 fi
2370 if test -z "$dlname" ||
2371 test "$dlopen_support" != yes ||
2372 test "$build_libtool_libs" = no; then
2373 # If there is no dlname, no dlopen support or we're linking
2374 # statically, we need to preload. We also need to preload any
2375 # dependent libraries so libltdl's deplib preloader doesn't
2376 # bomb out in the load deplibs phase.
2377 dlprefiles="$dlprefiles $lib $dependency_libs"
2378 else
2379 newdlfiles="$newdlfiles $lib"
2380 fi
2381 continue
2382 fi # $pass = dlopen
2383
2384 # We need an absolute path.
2385 case $ladir in
2386 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2387 *)
2388 abs_ladir=`cd "$ladir" && pwd`
2389 if test -z "$abs_ladir"; then
2390 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2391 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2392 abs_ladir="$ladir"
2393 fi
2394 ;;
2395 esac
2396 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2397
2398 # Find the relevant object directory and library name.
2399 if test "X$installed" = Xyes; then
2400 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2401 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2402 dir="$ladir"
2403 absdir="$abs_ladir"
2404 libdir="$abs_ladir"
2405 else
2406 dir="$libdir"
2407 absdir="$libdir"
2408 fi
2409 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2410 else
2411 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2412 dir="$ladir"
2413 absdir="$abs_ladir"
2414 # Remove this search path later
2415 notinst_path="$notinst_path $abs_ladir"
2416 else
2417 dir="$ladir/$objdir"
2418 absdir="$abs_ladir/$objdir"
2419 # Remove this search path later
2420 notinst_path="$notinst_path $abs_ladir"
2421 fi
2422 fi # $installed = yes
2423 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2424
2425 # This library was specified with -dlpreopen.
2426 if test "$pass" = dlpreopen; then
2427 if test -z "$libdir"; then
2428 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2429 exit $EXIT_FAILURE
2430 fi
2431 # Prefer using a static library (so that no silly _DYNAMIC symbols
2432 # are required to link).
2433 if test -n "$old_library"; then
2434 newdlprefiles="$newdlprefiles $dir/$old_library"
2435 # Otherwise, use the dlname, so that lt_dlopen finds it.
2436 elif test -n "$dlname"; then
2437 newdlprefiles="$newdlprefiles $dir/$dlname"
2438 else
2439 newdlprefiles="$newdlprefiles $dir/$linklib"
2440 fi
2441 fi # $pass = dlpreopen
2442
2443 if test -z "$libdir"; then
2444 # Link the convenience library
2445 if test "$linkmode" = lib; then
2446 deplibs="$dir/$old_library $deplibs"
2447 elif test "$linkmode,$pass" = "prog,link"; then
2448 compile_deplibs="$dir/$old_library $compile_deplibs"
2449 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2450 else
2451 deplibs="$lib $deplibs" # used for prog,scan pass
2452 fi
2453 continue
2454 fi
2455
2456
2457 if test "$linkmode" = prog && test "$pass" != link; then
2458 newlib_search_path="$newlib_search_path $ladir"
2459 deplibs="$lib $deplibs"
2460
2461 linkalldeplibs=no
2462 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2463 test "$build_libtool_libs" = no; then
2464 linkalldeplibs=yes
2465 fi
2466
2467 tmp_libs=
2468 for deplib in $dependency_libs; do
2469 case $deplib in
2470 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2471 esac
2472 # Need to link against all dependency_libs?
2473 if test "$linkalldeplibs" = yes; then
2474 deplibs="$deplib $deplibs"
2475 else
2476 # Need to hardcode shared library paths
2477 # or/and link against static libraries
2478 newdependency_libs="$deplib $newdependency_libs"
2479 fi
2480 if test "X$duplicate_deps" = "Xyes" ; then
2481 case "$tmp_libs " in
2482 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2483 esac
2484 fi
2485 tmp_libs="$tmp_libs $deplib"
2486 done # for deplib
2487 continue
2488 fi # $linkmode = prog...
2489
2490 if test "$linkmode,$pass" = "prog,link"; then
2491 if test -n "$library_names" &&
2492 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2493 # We need to hardcode the library path
2494 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2495 # Make sure the rpath contains only unique directories.
2496 case "$temp_rpath " in
2497 *" $dir "*) ;;
2498 *" $absdir "*) ;;
2499 *) temp_rpath="$temp_rpath $absdir" ;;
2500 esac
2501 fi
2502
2503 # Hardcode the library path.
2504 # Skip directories that are in the system default run-time
2505 # search path.
2506 case " $sys_lib_dlsearch_path " in
2507 *" $absdir "*) ;;
2508 *)
2509 case "$compile_rpath " in
2510 *" $absdir "*) ;;
2511 *) compile_rpath="$compile_rpath $absdir"
2512 esac
2513 ;;
2514 esac
2515 case " $sys_lib_dlsearch_path " in
2516 *" $libdir "*) ;;
2517 *)
2518 case "$finalize_rpath " in
2519 *" $libdir "*) ;;
2520 *) finalize_rpath="$finalize_rpath $libdir"
2521 esac
2522 ;;
2523 esac
2524 fi # $linkmode,$pass = prog,link...
2525
2526 if test "$alldeplibs" = yes &&
2527 { test "$deplibs_check_method" = pass_all ||
2528 { test "$build_libtool_libs" = yes &&
2529 test -n "$library_names"; }; }; then
2530 # We only need to search for static libraries
2531 continue
2532 fi
2533 fi
2534
2535 link_static=no # Whether the deplib will be linked statically
2536 use_static_libs=$prefer_static_libs
2537 if test "$use_static_libs" = built && test "$installed" = yes ; then
2538 use_static_libs=no
2539 fi
2540 if test -n "$library_names" &&
2541 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2542 if test "$installed" = no; then
2543 notinst_deplibs="$notinst_deplibs $lib"
2544 need_relink=yes
2545 fi
2546 # This is a shared library
2547
2548 # Warn about portability, can't link against -module's on
2549 # some systems (darwin)
2550 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2551 $echo
2552 if test "$linkmode" = prog; then
2553 $echo "*** Warning: Linking the executable $output against the loadable module"
2554 else
2555 $echo "*** Warning: Linking the shared library $output against the loadable module"
2556 fi
2557 $echo "*** $linklib is not portable!"
2558 fi
2559 if test "$linkmode" = lib &&
2560 test "$hardcode_into_libs" = yes; then
2561 # Hardcode the library path.
2562 # Skip directories that are in the system default run-time
2563 # search path.
2564 case " $sys_lib_dlsearch_path " in
2565 *" $absdir "*) ;;
2566 *)
2567 case "$compile_rpath " in
2568 *" $absdir "*) ;;
2569 *) compile_rpath="$compile_rpath $absdir"
2570 esac
2571 ;;
2572 esac
2573 case " $sys_lib_dlsearch_path " in
2574 *" $libdir "*) ;;
2575 *)
2576 case "$finalize_rpath " in
2577 *" $libdir "*) ;;
2578 *) finalize_rpath="$finalize_rpath $libdir"
2579 esac
2580 ;;
2581 esac
2582 fi
2583
2584 if test -n "$old_archive_from_expsyms_cmds"; then
2585 # figure out the soname
2586 set dummy $library_names
2587 realname="$2"
2588 shift; shift
2589 libname=`eval \\$echo \"$libname_spec\"`
2590 # use dlname if we got it. it's perfectly good, no?
2591 if test -n "$dlname"; then
2592 soname="$dlname"
2593 elif test -n "$soname_spec"; then
2594 # bleh windows
2595 case $host in
2596 *cygwin* | mingw*)
2597 major=`expr $current - $age`
2598 versuffix="-$major"
2599 ;;
2600 esac
2601 eval soname=\"$soname_spec\"
2602 else
2603 soname="$realname"
2604 fi
2605
2606 # Make a new name for the extract_expsyms_cmds to use
2607 soroot="$soname"
2608 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2609 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2610
2611 # If the library has no export list, then create one now
2612 if test -f "$output_objdir/$soname-def"; then :
2613 else
2614 $show "extracting exported symbol list from \`$soname'"
2615 save_ifs="$IFS"; IFS='~'
2616 cmds=$extract_expsyms_cmds
2617 for cmd in $cmds; do
2618 IFS="$save_ifs"
2619 eval cmd=\"$cmd\"
2620 $show "$cmd"
2621 $run eval "$cmd" || exit $?
2622 done
2623 IFS="$save_ifs"
2624 fi
2625
2626 # Create $newlib
2627 if test -f "$output_objdir/$newlib"; then :; else
2628 $show "generating import library for \`$soname'"
2629 save_ifs="$IFS"; IFS='~'
2630 cmds=$old_archive_from_expsyms_cmds
2631 for cmd in $cmds; do
2632 IFS="$save_ifs"
2633 eval cmd=\"$cmd\"
2634 $show "$cmd"
2635 $run eval "$cmd" || exit $?
2636 done
2637 IFS="$save_ifs"
2638 fi
2639 # make sure the library variables are pointing to the new library
2640 dir=$output_objdir
2641 linklib=$newlib
2642 fi # test -n "$old_archive_from_expsyms_cmds"
2643
2644 if test "$linkmode" = prog || test "$mode" != relink; then
2645 add_shlibpath=
2646 add_dir=
2647 add=
2648 lib_linked=yes
2649 case $hardcode_action in
2650 immediate | unsupported)
2651 if test "$hardcode_direct" = no; then
2652 add="$dir/$linklib"
2653 case $host in
2654 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2655 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2656 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2657 *-*-unixware7*) add_dir="-L$dir" ;;
2658 *-*-darwin* )
2659 # if the lib is a module then we can not link against
2660 # it, someone is ignoring the new warnings I added
2661 if /usr/bin/file -L $add 2> /dev/null |
2662 $EGREP ": [^:]* bundle" >/dev/null ; then
2663 $echo "** Warning, lib $linklib is a module, not a shared library"
2664 if test -z "$old_library" ; then
2665 $echo
2666 $echo "** And there doesn't seem to be a static archive available"
2667 $echo "** The link will probably fail, sorry"
2668 else
2669 add="$dir/$old_library"
2670 fi
2671 fi
2672 esac
2673 elif test "$hardcode_minus_L" = no; then
2674 case $host in
2675 *-*-sunos*) add_shlibpath="$dir" ;;
2676 esac
2677 add_dir="-L$dir"
2678 add="-l$name"
2679 elif test "$hardcode_shlibpath_var" = no; then
2680 add_shlibpath="$dir"
2681 add="-l$name"
2682 else
2683 lib_linked=no
2684 fi
2685 ;;
2686 relink)
2687 if test "$hardcode_direct" = yes; then
2688 add="$dir/$linklib"
2689 elif test "$hardcode_minus_L" = yes; then
2690 add_dir="-L$dir"
2691 # Try looking first in the location we're being installed to.
2692 if test -n "$inst_prefix_dir"; then
2693 case $libdir in
2694 [\\/]*)
2695 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2696 ;;
2697 esac
2698 fi
2699 add="-l$name"
2700 elif test "$hardcode_shlibpath_var" = yes; then
2701 add_shlibpath="$dir"
2702 add="-l$name"
2703 else
2704 lib_linked=no
2705 fi
2706 ;;
2707 *) lib_linked=no ;;
2708 esac
2709
2710 if test "$lib_linked" != yes; then
2711 $echo "$modename: configuration error: unsupported hardcode properties"
2712 exit $EXIT_FAILURE
2713 fi
2714
2715 if test -n "$add_shlibpath"; then
2716 case :$compile_shlibpath: in
2717 *":$add_shlibpath:"*) ;;
2718 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2719 esac
2720 fi
2721 if test "$linkmode" = prog; then
2722 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2723 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2724 else
2725 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2726 test -n "$add" && deplibs="$add $deplibs"
2727 if test "$hardcode_direct" != yes && \
2728 test "$hardcode_minus_L" != yes && \
2729 test "$hardcode_shlibpath_var" = yes; then
2730 case :$finalize_shlibpath: in
2731 *":$libdir:"*) ;;
2732 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2733 esac
2734 fi
2735 fi
2736 fi
2737
2738 if test "$linkmode" = prog || test "$mode" = relink; then
2739 add_shlibpath=
2740 add_dir=
2741 add=
2742 # Finalize command for both is simple: just hardcode it.
2743 if test "$hardcode_direct" = yes; then
2744 add="$libdir/$linklib"
2745 elif test "$hardcode_minus_L" = yes; then
2746 add_dir="-L$libdir"
2747 add="-l$name"
2748 elif test "$hardcode_shlibpath_var" = yes; then
2749 case :$finalize_shlibpath: in
2750 *":$libdir:"*) ;;
2751 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2752 esac
2753 add="-l$name"
2754 elif test "$hardcode_automatic" = yes; then
2755 if test -n "$inst_prefix_dir" &&
2756 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2757 add="$inst_prefix_dir$libdir/$linklib"
2758 else
2759 add="$libdir/$linklib"
2760 fi
2761 else
2762 # We cannot seem to hardcode it, guess we'll fake it.
2763 add_dir="-L$libdir"
2764 # Try looking first in the location we're being installed to.
2765 if test -n "$inst_prefix_dir"; then
2766 case $libdir in
2767 [\\/]*)
2768 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2769 ;;
2770 esac
2771 fi
2772 add="-l$name"
2773 fi
2774
2775 if test "$linkmode" = prog; then
2776 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2777 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2778 else
2779 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2780 test -n "$add" && deplibs="$add $deplibs"
2781 fi
2782 fi
2783 elif test "$linkmode" = prog; then
2784 # Here we assume that one of hardcode_direct or hardcode_minus_L
2785 # is not unsupported. This is valid on all known static and
2786 # shared platforms.
2787 if test "$hardcode_direct" != unsupported; then
2788 test -n "$old_library" && linklib="$old_library"
2789 compile_deplibs="$dir/$linklib $compile_deplibs"
2790 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2791 else
2792 compile_deplibs="-l$name -L$dir $compile_deplibs"
2793 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2794 fi
2795 elif test "$build_libtool_libs" = yes; then
2796 # Not a shared library
2797 if test "$deplibs_check_method" != pass_all; then
2798 # We're trying link a shared library against a static one
2799 # but the system doesn't support it.
2800
2801 # Just print a warning and add the library to dependency_libs so
2802 # that the program can be linked against the static library.
2803 $echo
2804 $echo "*** Warning: This system can not link to static lib archive $lib."
2805 $echo "*** I have the capability to make that library automatically link in when"
2806 $echo "*** you link to this library. But I can only do this if you have a"
2807 $echo "*** shared version of the library, which you do not appear to have."
2808 if test "$module" = yes; then
2809 $echo "*** But as you try to build a module library, libtool will still create "
2810 $echo "*** a static module, that should work as long as the dlopening application"
2811 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2812 if test -z "$global_symbol_pipe"; then
2813 $echo
2814 $echo "*** However, this would only work if libtool was able to extract symbol"
2815 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2816 $echo "*** not find such a program. So, this module is probably useless."
2817 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2818 fi
2819 if test "$build_old_libs" = no; then
2820 build_libtool_libs=module
2821 build_old_libs=yes
2822 else
2823 build_libtool_libs=no
2824 fi
2825 fi
2826 else
2827 deplibs="$dir/$old_library $deplibs"
2828 link_static=yes
2829 fi
2830 fi # link shared/static library?
2831
2832 if test "$linkmode" = lib; then
2833 if test -n "$dependency_libs" &&
2834 { test "$hardcode_into_libs" != yes ||
2835 test "$build_old_libs" = yes ||
2836 test "$link_static" = yes; }; then
2837 # Extract -R from dependency_libs
2838 temp_deplibs=
2839 for libdir in $dependency_libs; do
2840 case $libdir in
2841 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2842 case " $xrpath " in
2843 *" $temp_xrpath "*) ;;
2844 *) xrpath="$xrpath $temp_xrpath";;
2845 esac;;
2846 *) temp_deplibs="$temp_deplibs $libdir";;
2847 esac
2848 done
2849 dependency_libs="$temp_deplibs"
2850 fi
2851
2852 newlib_search_path="$newlib_search_path $absdir"
2853 # Link against this library
2854 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2855 # ... and its dependency_libs
2856 tmp_libs=
2857 for deplib in $dependency_libs; do
2858 newdependency_libs="$deplib $newdependency_libs"
2859 if test "X$duplicate_deps" = "Xyes" ; then
2860 case "$tmp_libs " in
2861 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2862 esac
2863 fi
2864 tmp_libs="$tmp_libs $deplib"
2865 done
2866
2867 if test "$link_all_deplibs" != no; then
2868 # Add the search paths of all dependency libraries
2869 for deplib in $dependency_libs; do
2870 case $deplib in
2871 -L*) path="$deplib" ;;
2872 *.la)
2873 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2874 test "X$dir" = "X$deplib" && dir="."
2875 # We need an absolute path.
2876 case $dir in
2877 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2878 *)
2879 absdir=`cd "$dir" && pwd`
2880 if test -z "$absdir"; then
2881 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2882 absdir="$dir"
2883 fi
2884 ;;
2885 esac
2886 if grep "^installed=no" $deplib > /dev/null; then
2887 path="$absdir/$objdir"
2888 else
2889 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2890 if test -z "$libdir"; then
2891 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2892 exit $EXIT_FAILURE
2893 fi
2894 if test "$absdir" != "$libdir"; then
2895 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2896 fi
2897 path="$absdir"
2898 fi
2899 depdepl=
2900 case $host in
2901 *-*-darwin*)
2902 # we do not want to link against static libs,
2903 # but need to link against shared
2904 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2905 if test -n "$deplibrary_names" ; then
2906 for tmp in $deplibrary_names ; do
2907 depdepl=$tmp
2908 done
2909 if test -f "$path/$depdepl" ; then
2910 depdepl="$path/$depdepl"
2911 fi
2912 # do not add paths which are already there
2913 case " $newlib_search_path " in
2914 *" $path "*) ;;
2915 *) newlib_search_path="$newlib_search_path $path";;
2916 esac
2917 fi
2918 path=""
2919 ;;
2920 *)
2921 path="-L$path"
2922 ;;
2923 esac
2924 ;;
2925 -l*)
2926 case $host in
2927 *-*-darwin*)
2928 # Again, we only want to link against shared libraries
2929 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2930 for tmp in $newlib_search_path ; do
2931 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2932 eval depdepl="$tmp/lib$tmp_libs.dylib"
2933 break
2934 fi
2935 done
2936 path=""
2937 ;;
2938 *) continue ;;
2939 esac
2940 ;;
2941 *) continue ;;
2942 esac
2943 case " $deplibs " in
2944 *" $path "*) ;;
2945 *) deplibs="$path $deplibs" ;;
2946 esac
2947 case " $deplibs " in
2948 *" $depdepl "*) ;;
2949 *) deplibs="$depdepl $deplibs" ;;
2950 esac
2951 done
2952 fi # link_all_deplibs != no
2953 fi # linkmode = lib
2954 done # for deplib in $libs
2955 dependency_libs="$newdependency_libs"
2956 if test "$pass" = dlpreopen; then
2957 # Link the dlpreopened libraries before other libraries
2958 for deplib in $save_deplibs; do
2959 deplibs="$deplib $deplibs"
2960 done
2961 fi
2962 if test "$pass" != dlopen; then
2963 if test "$pass" != conv; then
2964 # Make sure lib_search_path contains only unique directories.
2965 lib_search_path=
2966 for dir in $newlib_search_path; do
2967 case "$lib_search_path " in
2968 *" $dir "*) ;;
2969 *) lib_search_path="$lib_search_path $dir" ;;
2970 esac
2971 done
2972 newlib_search_path=
2973 fi
2974
2975 if test "$linkmode,$pass" != "prog,link"; then
2976 vars="deplibs"
2977 else
2978 vars="compile_deplibs finalize_deplibs"
2979 fi
2980 for var in $vars dependency_libs; do
2981 # Add libraries to $var in reverse order
2982 eval tmp_libs=\"\$$var\"
2983 new_libs=
2984 for deplib in $tmp_libs; do
2985 # FIXME: Pedantically, this is the right thing to do, so
2986 # that some nasty dependency loop isn't accidentally
2987 # broken:
2988 #new_libs="$deplib $new_libs"
2989 # Pragmatically, this seems to cause very few problems in
2990 # practice:
2991 case $deplib in
2992 -L*) new_libs="$deplib $new_libs" ;;
2993 -R*) ;;
2994 *)
2995 # And here is the reason: when a library appears more
2996 # than once as an explicit dependence of a library, or
2997 # is implicitly linked in more than once by the
2998 # compiler, it is considered special, and multiple
2999 # occurrences thereof are not removed. Compare this
3000 # with having the same library being listed as a
3001 # dependency of multiple other libraries: in this case,
3002 # we know (pedantically, we assume) the library does not
3003 # need to be listed more than once, so we keep only the
3004 # last copy. This is not always right, but it is rare
3005 # enough that we require users that really mean to play
3006 # such unportable linking tricks to link the library
3007 # using -Wl,-lname, so that libtool does not consider it
3008 # for duplicate removal.
3009 case " $specialdeplibs " in
3010 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3011 *)
3012 case " $new_libs " in
3013 *" $deplib "*) ;;
3014 *) new_libs="$deplib $new_libs" ;;
3015 esac
3016 ;;
3017 esac
3018 ;;
3019 esac
3020 done
3021 tmp_libs=
3022 for deplib in $new_libs; do
3023 case $deplib in
3024 -L*)
3025 case " $tmp_libs " in
3026 *" $deplib "*) ;;
3027 *) tmp_libs="$tmp_libs $deplib" ;;
3028 esac
3029 ;;
3030 *) tmp_libs="$tmp_libs $deplib" ;;
3031 esac
3032 done
3033 eval $var=\"$tmp_libs\"
3034 done # for var
3035 fi
3036 # Last step: remove runtime libs from dependency_libs
3037 # (they stay in deplibs)
3038 tmp_libs=
3039 for i in $dependency_libs ; do
3040 case " $predeps $postdeps $compiler_lib_search_path " in
3041 *" $i "*)
3042 i=""
3043 ;;
3044 esac
3045 if test -n "$i" ; then
3046 tmp_libs="$tmp_libs $i"
3047 fi
3048 done
3049 dependency_libs=$tmp_libs
3050 done # for pass
3051 if test "$linkmode" = prog; then
3052 dlfiles="$newdlfiles"
3053 dlprefiles="$newdlprefiles"
3054 fi
3055
3056 case $linkmode in
3057 oldlib)
3058 if test -n "$deplibs"; then
3059 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3060 fi
3061
3062 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3063 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3064 fi
3065
3066 if test -n "$rpath"; then
3067 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3068 fi
3069
3070 if test -n "$xrpath"; then
3071 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3072 fi
3073
3074 if test -n "$vinfo"; then
3075 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3076 fi
3077
3078 if test -n "$release"; then
3079 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3080 fi
3081
3082 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3083 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3084 fi
3085
3086 # Now set the variables for building old libraries.
3087 build_libtool_libs=no
3088 oldlibs="$output"
3089 objs="$objs$old_deplibs"
3090 ;;
3091
3092 lib)
3093 # Make sure we only generate libraries of the form `libNAME.la'.
3094 case $outputname in
3095 lib*)
3096 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3097 eval shared_ext=\"$shrext_cmds\"
3098 eval libname=\"$libname_spec\"
3099 ;;
3100 *)
3101 if test "$module" = no; then
3102 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3103 $echo "$help" 1>&2
3104 exit $EXIT_FAILURE
3105 fi
3106 if test "$need_lib_prefix" != no; then
3107 # Add the "lib" prefix for modules if required
3108 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3109 eval shared_ext=\"$shrext_cmds\"
3110 eval libname=\"$libname_spec\"
3111 else
3112 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3113 fi
3114 ;;
3115 esac
3116
3117 if test -n "$objs"; then
3118 if test "$deplibs_check_method" != pass_all; then
3119 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3120 exit $EXIT_FAILURE
3121 else
3122 $echo
3123 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3124 $echo "*** objects $objs is not portable!"
3125 libobjs="$libobjs $objs"
3126 fi
3127 fi
3128
3129 if test "$dlself" != no; then
3130 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3131 fi
3132
3133 set dummy $rpath
3134 if test "$#" -gt 2; then
3135 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3136 fi
3137 install_libdir="$2"
3138
3139 oldlibs=
3140 if test -z "$rpath"; then
3141 if test "$build_libtool_libs" = yes; then
3142 # Building a libtool convenience library.
3143 # Some compilers have problems with a `.al' extension so
3144 # convenience libraries should have the same extension an
3145 # archive normally would.
3146 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3147 build_libtool_libs=convenience
3148 build_old_libs=yes
3149 fi
3150
3151 if test -n "$vinfo"; then
3152 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3153 fi
3154
3155 if test -n "$release"; then
3156 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3157 fi
3158 else
3159
3160 # Parse the version information argument.
3161 save_ifs="$IFS"; IFS=':'
3162 set dummy $vinfo 0 0 0
3163 IFS="$save_ifs"
3164
3165 if test -n "$8"; then
3166 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3167 $echo "$help" 1>&2
3168 exit $EXIT_FAILURE
3169 fi
3170
3171 # convert absolute version numbers to libtool ages
3172 # this retains compatibility with .la files and attempts
3173 # to make the code below a bit more comprehensible
3174
3175 case $vinfo_number in
3176 yes)
3177 number_major="$2"
3178 number_minor="$3"
3179 number_revision="$4"
3180 #
3181 # There are really only two kinds -- those that
3182 # use the current revision as the major version
3183 # and those that subtract age and use age as
3184 # a minor version. But, then there is irix
3185 # which has an extra 1 added just for fun
3186 #
3187 case $version_type in
3188 darwin|linux|osf|windows)
3189 current=`expr $number_major + $number_minor`
3190 age="$number_minor"
3191 revision="$number_revision"
3192 ;;
3193 freebsd-aout|freebsd-elf|sunos)
3194 current="$number_major"
3195 revision="$number_minor"
3196 age="0"
3197 ;;
3198 irix|nonstopux)
3199 current=`expr $number_major + $number_minor - 1`