Develop and Download Open Source Software

Browse CVS Repository

Annotation of /freewnn/FreeWnn/ltmain.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (hide annotations) (download) (as text)
Sat Sep 5 19:35:51 2009 UTC (14 years, 7 months ago) by aonoto
Branch: MAIN
CVS Tags: freewnn-1-1-1-a023-1, freewnn-1-1-1-a023, freewnn-1-1-1-a022, freewnn-1-1-1-a022I002, HEAD
Branch point for: freewnn-1-1-1-a022I001
Changes since 1.5: +1416 -750 lines
File MIME type: text/x-sh
Update libtool to 1.5.26 (last release of 1.5 series - bit old).
Also update config.guess, so maybe it will build on AVR32 architecture.
(cf. Debian Bug #534811)

1 ura 1.1 # ltmain.sh - Provide generalized library-building support services.
2 hiroo 1.2 # NOTE: Changing this file will not affect anything until you rerun configure.
3 ura 1.1 #
4 aonoto 1.6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5     # 2007, 2008 Free Software Foundation, Inc.
6 ura 1.1 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7     #
8     # This program is free software; you can redistribute it and/or modify
9     # it under the terms of the GNU General Public License as published by
10     # the Free Software Foundation; either version 2 of the License, or
11     # (at your option) any later version.
12     #
13     # This program is distributed in the hope that it will be useful, but
14     # WITHOUT ANY WARRANTY; without even the implied warranty of
15     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16     # General Public License for more details.
17     #
18     # You should have received a copy of the GNU General Public License
19     # along with this program; if not, write to the Free Software
20 aonoto 1.6 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 ura 1.1 #
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 aonoto 1.6 basename="s,^.*/,,g"
28    
29     # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30     # is ksh but when the shell is invoked as "sh" and the current value of
31     # the _XPG environment variable is not equal to 1 (one), the special
32     # positional parameter $0, within a function call, is the name of the
33     # function.
34     progpath="$0"
35    
36     # The name of this program:
37     progname=`echo "$progpath" | $SED $basename`
38     modename="$progname"
39    
40     # Global variables:
41     EXIT_SUCCESS=0
42     EXIT_FAILURE=1
43    
44     PROGRAM=ltmain.sh
45     PACKAGE=libtool
46     VERSION=1.5.26
47     TIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
48    
49     # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50     if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
51     emulate sh
52     NULLCMD=:
53     # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54     # is contrary to our usage. Disable this feature.
55     alias -g '${1+"$@"}'='"$@"'
56     setopt NO_GLOB_SUBST
57     else
58     case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59     fi
60     BIN_SH=xpg4; export BIN_SH # for Tru64
61     DUALCASE=1; export DUALCASE # for MKS sh
62    
63 ura 1.1 # Check that we have a working $echo.
64     if test "X$1" = X--no-reexec; then
65     # Discard the --no-reexec flag, and continue.
66     shift
67     elif test "X$1" = X--fallback-echo; then
68     # Avoid inline document here, it may be left over
69     :
70     elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71     # Yippee, $echo works!
72     :
73     else
74     # Restart under the correct shell, and then maybe $echo will work.
75 aonoto 1.6 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76 ura 1.1 fi
77    
78     if test "X$1" = X--fallback-echo; then
79     # used as fallback echo
80     shift
81     cat <<EOF
82     $*
83     EOF
84 aonoto 1.6 exit $EXIT_SUCCESS
85 ura 1.1 fi
86    
87     default_mode=
88     help="Try \`$progname --help' for more information."
89     magic="%%%MAGIC variable%%%"
90     mkdir="mkdir"
91     mv="mv -f"
92     rm="rm -f"
93    
94     # Sed substitution that helps us do robust quoting. It backslashifies
95     # metacharacters that are still active within double-quoted strings.
96 aono 1.5 Xsed="${SED}"' -e 1s/^X//'
97 ura 1.1 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 aono 1.5 # test EBCDIC or ASCII
99 aonoto 1.6 case `echo X|tr X '\101'` in
100     A) # ASCII based system
101     # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
102     SP2NL='tr \040 \012'
103     NL2SP='tr \015\012 \040\040'
104 aono 1.5 ;;
105 aonoto 1.6 *) # EBCDIC based system
106     SP2NL='tr \100 \n'
107     NL2SP='tr \r\n \100\100'
108 aono 1.5 ;;
109     esac
110 ura 1.1
111     # NLS nuisances.
112     # Only set LANG and LC_ALL to C if already set.
113     # These must not be set unconditionally because not all systems understand
114     # e.g. LANG=C (notably SCO).
115     # We save the old values to restore during execute mode.
116 aonoto 1.6 lt_env=
117     for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118     do
119     eval "if test \"\${$lt_var+set}\" = set; then
120     save_$lt_var=\$$lt_var
121     lt_env=\"$lt_var=\$$lt_var \$lt_env\"
122     $lt_var=C
123     export $lt_var
124     fi"
125     done
126    
127     if test -n "$lt_env"; then
128     lt_env="env $lt_env"
129 ura 1.1 fi
130    
131 aono 1.5 # Make sure IFS has a sensible default
132 aonoto 1.6 lt_nl='
133     '
134     IFS=" $lt_nl"
135 aono 1.5
136 ura 1.1 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137 aono 1.5 $echo "$modename: not configured to build any kind of library" 1>&2
138     $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
139 aonoto 1.6 exit $EXIT_FAILURE
140 ura 1.1 fi
141    
142     # Global variables.
143     mode=$default_mode
144     nonopt=
145     prev=
146     prevopt=
147     run=
148     show="$echo"
149     show_help=
150     execute_dlfiles=
151 aonoto 1.6 duplicate_deps=no
152     preserve_args=
153 ura 1.1 lo2o="s/\\.lo\$/.${objext}/"
154     o2lo="s/\\.${objext}\$/.lo/"
155 aonoto 1.6 extracted_archives=
156     extracted_serial=0
157 ura 1.1
158 aono 1.5 #####################################
159     # Shell function definitions:
160     # This seems to be the best place for them
161    
162 aonoto 1.6 # func_mktempdir [string]
163     # Make a temporary directory that won't clash with other running
164     # libtool processes, and avoids race conditions if possible. If
165     # given, STRING is the basename for that directory.
166     func_mktempdir ()
167     {
168     my_template="${TMPDIR-/tmp}/${1-$progname}"
169    
170     if test "$run" = ":"; then
171     # Return a directory name, but don't create it in dry-run mode
172     my_tmpdir="${my_template}-$$"
173     else
174    
175     # If mktemp works, use that first and foremost
176     my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
177    
178     if test ! -d "$my_tmpdir"; then
179     # Failing that, at least try and use $RANDOM to avoid a race
180     my_tmpdir="${my_template}-${RANDOM-0}$$"
181    
182     save_mktempdir_umask=`umask`
183     umask 0077
184     $mkdir "$my_tmpdir"
185     umask $save_mktempdir_umask
186     fi
187    
188     # If we're not in dry-run mode, bomb out on failure
189     test -d "$my_tmpdir" || {
190     $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
191     exit $EXIT_FAILURE
192     }
193     fi
194    
195     $echo "X$my_tmpdir" | $Xsed
196     }
197    
198    
199     # func_win32_libid arg
200     # return the library type of file 'arg'
201     #
202 aono 1.5 # Need a lot of goo to handle *both* DLLs and import libs
203     # Has to be a shell function in order to 'eat' the argument
204     # that is supplied when $file_magic_command is called.
205 aonoto 1.6 func_win32_libid ()
206     {
207 aono 1.5 win32_libid_type="unknown"
208     win32_fileres=`file -L $1 2>/dev/null`
209     case $win32_fileres in
210     *ar\ archive\ import\ library*) # definitely import
211     win32_libid_type="x86 archive import"
212     ;;
213     *ar\ archive*) # could be an import, or static
214     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215 aonoto 1.6 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216 aono 1.5 win32_nmres=`eval $NM -f posix -A $1 | \
217 aonoto 1.6 $SED -n -e '1,100{
218     / I /{
219     s,.*,import,
220     p
221     q
222     }
223     }'`
224     case $win32_nmres in
225     import*) win32_libid_type="x86 archive import";;
226     *) win32_libid_type="x86 archive static";;
227     esac
228 aono 1.5 fi
229     ;;
230 aonoto 1.6 *DLL*)
231 aono 1.5 win32_libid_type="x86 DLL"
232     ;;
233     *executable*) # but shell scripts are "executable" too...
234     case $win32_fileres in
235     *MS\ Windows\ PE\ Intel*)
236     win32_libid_type="x86 DLL"
237     ;;
238     esac
239     ;;
240     esac
241     $echo $win32_libid_type
242     }
243    
244 aonoto 1.6
245     # func_infer_tag arg
246     # Infer tagged configuration to use if any are available and
247     # if one wasn't chosen via the "--tag" command line option.
248     # Only attempt this if the compiler in the base compile
249     # command doesn't match the default compiler.
250     # arg is usually of the form 'gcc ...'
251     func_infer_tag ()
252     {
253     if test -n "$available_tags" && test -z "$tagname"; then
254     CC_quoted=
255     for arg in $CC; do
256     case $arg in
257     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
258     arg="\"$arg\""
259     ;;
260     esac
261     CC_quoted="$CC_quoted $arg"
262     done
263     case $@ in
264     # Blanks in the command may have been stripped by the calling shell,
265     # but not from the CC environment variable when configure was run.
266     " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267     # Blanks at the start of $base_compile will cause this to fail
268     # if we don't check for them as well.
269     *)
270     for z in $available_tags; do
271     if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272     # Evaluate the configuration.
273     eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
274     CC_quoted=
275     for arg in $CC; do
276     # Double-quote args containing other shell metacharacters.
277     case $arg in
278     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
279     arg="\"$arg\""
280     ;;
281     esac
282     CC_quoted="$CC_quoted $arg"
283     done
284     case "$@ " in
285     " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286     # The compiler in the base compile command matches
287     # the one in the tagged configuration.
288     # Assume this is the tagged configuration we want.
289     tagname=$z
290     break
291     ;;
292     esac
293     fi
294     done
295     # If $tagname still isn't set, then no tagged configuration
296     # was found and let the user know that the "--tag" command
297     # line option must be used.
298     if test -z "$tagname"; then
299     $echo "$modename: unable to infer tagged configuration"
300     $echo "$modename: specify a tag with \`--tag'" 1>&2
301     exit $EXIT_FAILURE
302     # else
303     # $echo "$modename: using $tagname tagged configuration"
304     fi
305     ;;
306     esac
307     fi
308     }
309    
310    
311     # func_extract_an_archive dir oldlib
312     func_extract_an_archive ()
313     {
314     f_ex_an_ar_dir="$1"; shift
315     f_ex_an_ar_oldlib="$1"
316    
317     $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318     $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
320     :
321     else
322     $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
323     exit $EXIT_FAILURE
324     fi
325     }
326    
327     # func_extract_archives gentop oldlib ...
328     func_extract_archives ()
329     {
330     my_gentop="$1"; shift
331     my_oldlibs=${1+"$@"}
332     my_oldobjs=""
333     my_xlib=""
334     my_xabs=""
335     my_xdir=""
336     my_status=""
337    
338     $show "${rm}r $my_gentop"
339     $run ${rm}r "$my_gentop"
340     $show "$mkdir $my_gentop"
341     $run $mkdir "$my_gentop"
342     my_status=$?
343     if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
344     exit $my_status
345     fi
346    
347     for my_xlib in $my_oldlibs; do
348     # Extract the objects.
349     case $my_xlib in
350     [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351     *) my_xabs=`pwd`"/$my_xlib" ;;
352     esac
353     my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
354     my_xlib_u=$my_xlib
355     while :; do
356     case " $extracted_archives " in
357     *" $my_xlib_u "*)
358     extracted_serial=`expr $extracted_serial + 1`
359     my_xlib_u=lt$extracted_serial-$my_xlib ;;
360     *) break ;;
361     esac
362     done
363     extracted_archives="$extracted_archives $my_xlib_u"
364     my_xdir="$my_gentop/$my_xlib_u"
365    
366     $show "${rm}r $my_xdir"
367     $run ${rm}r "$my_xdir"
368     $show "$mkdir $my_xdir"
369     $run $mkdir "$my_xdir"
370     exit_status=$?
371     if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
372     exit $exit_status
373     fi
374     case $host in
375     *-darwin*)
376     $show "Extracting $my_xabs"
377     # Do not bother doing anything if just a dry run
378     if test -z "$run"; then
379     darwin_orig_dir=`pwd`
380     cd $my_xdir || exit $?
381     darwin_archive=$my_xabs
382     darwin_curdir=`pwd`
383     darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384     darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385     if test -n "$darwin_arches"; then
386     darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
387     darwin_arch=
388     $show "$darwin_base_archive has multiple architectures $darwin_arches"
389     for darwin_arch in $darwin_arches ; do
390     mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391     lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392     cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393     func_extract_an_archive "`pwd`" "${darwin_base_archive}"
394     cd "$darwin_curdir"
395     $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396     done # $darwin_arches
397     ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398     darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
399     darwin_file=
400     darwin_files=
401     for darwin_file in $darwin_filelist; do
402     darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403     lipo -create -output "$darwin_file" $darwin_files
404     done # $darwin_filelist
405     ${rm}r unfat-$$
406     cd "$darwin_orig_dir"
407     else
408     cd "$darwin_orig_dir"
409     func_extract_an_archive "$my_xdir" "$my_xabs"
410     fi # $darwin_arches
411     fi # $run
412     ;;
413     *)
414     func_extract_an_archive "$my_xdir" "$my_xabs"
415     ;;
416     esac
417     my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
418     done
419     func_extract_archives_result="$my_oldobjs"
420     }
421 aono 1.5 # End of Shell function definitions
422     #####################################
423    
424 aonoto 1.6 # Darwin sucks
425     eval std_shrext=\"$shrext_cmds\"
426    
427     disable_libs=no
428    
429 ura 1.1 # Parse our command line options once, thoroughly.
430 aono 1.5 while test "$#" -gt 0
431 ura 1.1 do
432     arg="$1"
433     shift
434    
435 hiroo 1.2 case $arg in
436 ura 1.1 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
437     *) optarg= ;;
438     esac
439    
440     # If the previous option needs an argument, assign it.
441     if test -n "$prev"; then
442 hiroo 1.2 case $prev in
443 ura 1.1 execute_dlfiles)
444 hiroo 1.2 execute_dlfiles="$execute_dlfiles $arg"
445 ura 1.1 ;;
446 aono 1.5 tag)
447     tagname="$arg"
448 aonoto 1.6 preserve_args="${preserve_args}=$arg"
449 aono 1.5
450     # Check whether tagname contains only valid characters
451     case $tagname in
452     *[!-_A-Za-z0-9,/]*)
453     $echo "$progname: invalid tag name: $tagname" 1>&2
454 aonoto 1.6 exit $EXIT_FAILURE
455 aono 1.5 ;;
456     esac
457    
458     case $tagname in
459     CC)
460     # Don't test for the "default" C tag, as we know, it's there, but
461     # not specially marked.
462     ;;
463     *)
464 aonoto 1.6 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
465 aono 1.5 taglist="$taglist $tagname"
466     # Evaluate the configuration.
467 aonoto 1.6 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
468 aono 1.5 else
469     $echo "$progname: ignoring unknown tag $tagname" 1>&2
470     fi
471     ;;
472     esac
473     ;;
474 ura 1.1 *)
475     eval "$prev=\$arg"
476     ;;
477     esac
478    
479     prev=
480     prevopt=
481     continue
482     fi
483    
484     # Have we seen a non-optional argument yet?
485 hiroo 1.2 case $arg in
486 ura 1.1 --help)
487     show_help=yes
488     ;;
489    
490     --version)
491 aonoto 1.6 echo "\
492     $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
493    
494     Copyright (C) 2008 Free Software Foundation, Inc.
495     This is free software; see the source for copying conditions. There is NO
496     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
497     exit $?
498 ura 1.1 ;;
499    
500     --config)
501 aonoto 1.6 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
502 aono 1.5 # Now print the configurations for the tags.
503     for tagname in $taglist; do
504 aonoto 1.6 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
505 aono 1.5 done
506 aonoto 1.6 exit $?
507 ura 1.1 ;;
508    
509     --debug)
510 aono 1.5 $echo "$progname: enabling shell trace mode"
511 ura 1.1 set -x
512 aonoto 1.6 preserve_args="$preserve_args $arg"
513 ura 1.1 ;;
514    
515     --dry-run | -n)
516     run=:
517     ;;
518    
519     --features)
520 aono 1.5 $echo "host: $host"
521 ura 1.1 if test "$build_libtool_libs" = yes; then
522 aono 1.5 $echo "enable shared libraries"
523 ura 1.1 else
524 aono 1.5 $echo "disable shared libraries"
525 ura 1.1 fi
526     if test "$build_old_libs" = yes; then
527 aono 1.5 $echo "enable static libraries"
528 ura 1.1 else
529 aono 1.5 $echo "disable static libraries"
530 ura 1.1 fi
531 aonoto 1.6 exit $?
532 ura 1.1 ;;
533    
534     --finish) mode="finish" ;;
535    
536     --mode) prevopt="--mode" prev=mode ;;
537     --mode=*) mode="$optarg" ;;
538    
539 aono 1.5 --preserve-dup-deps) duplicate_deps="yes" ;;
540    
541 ura 1.1 --quiet | --silent)
542     show=:
543 aonoto 1.6 preserve_args="$preserve_args $arg"
544 ura 1.1 ;;
545    
546 aonoto 1.6 --tag)
547     prevopt="--tag"
548     prev=tag
549     preserve_args="$preserve_args --tag"
550     ;;
551 aono 1.5 --tag=*)
552     set tag "$optarg" ${1+"$@"}
553     shift
554     prev=tag
555 aonoto 1.6 preserve_args="$preserve_args --tag"
556 aono 1.5 ;;
557    
558 ura 1.1 -dlopen)
559     prevopt="-dlopen"
560     prev=execute_dlfiles
561     ;;
562    
563     -*)
564     $echo "$modename: unrecognized option \`$arg'" 1>&2
565     $echo "$help" 1>&2
566 aonoto 1.6 exit $EXIT_FAILURE
567 ura 1.1 ;;
568    
569     *)
570     nonopt="$arg"
571     break
572     ;;
573     esac
574     done
575    
576     if test -n "$prevopt"; then
577     $echo "$modename: option \`$prevopt' requires an argument" 1>&2
578     $echo "$help" 1>&2
579 aonoto 1.6 exit $EXIT_FAILURE
580 ura 1.1 fi
581    
582 aonoto 1.6 case $disable_libs in
583     no)
584     ;;
585     shared)
586     build_libtool_libs=no
587     build_old_libs=yes
588     ;;
589     static)
590     build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
591     ;;
592     esac
593    
594 aono 1.5 # If this variable is set in any of the actions, the command in it
595     # will be execed at the end. This prevents here-documents from being
596     # left over by shells.
597     exec_cmd=
598    
599 ura 1.1 if test -z "$show_help"; then
600    
601     # Infer the operation mode.
602     if test -z "$mode"; then
603 aono 1.5 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604 aonoto 1.6 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
605 hiroo 1.2 case $nonopt in
606 aono 1.5 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
607 ura 1.1 mode=link
608     for arg
609     do
610 hiroo 1.2 case $arg in
611 ura 1.1 -c)
612     mode=compile
613     break
614     ;;
615     esac
616     done
617     ;;
618     *db | *dbx | *strace | *truss)
619     mode=execute
620     ;;
621     *install*|cp|mv)
622     mode=install
623     ;;
624     *rm)
625     mode=uninstall
626     ;;
627     *)
628     # If we have no mode, but dlfiles were specified, then do execute mode.
629     test -n "$execute_dlfiles" && mode=execute
630    
631     # Just use the default operation mode.
632     if test -z "$mode"; then
633     if test -n "$nonopt"; then
634     $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
635     else
636     $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637     fi
638     fi
639     ;;
640     esac
641     fi
642    
643     # Only execute mode is allowed to have -dlopen flags.
644     if test -n "$execute_dlfiles" && test "$mode" != execute; then
645     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
646     $echo "$help" 1>&2
647 aonoto 1.6 exit $EXIT_FAILURE
648 ura 1.1 fi
649    
650     # Change the help message to a mode-specific one.
651     generic_help="$help"
652     help="Try \`$modename --help --mode=$mode' for more information."
653    
654     # These modes are in order of execution frequency so that they run quickly.
655 hiroo 1.2 case $mode in
656 ura 1.1 # libtool compile mode
657     compile)
658     modename="$modename: compile"
659     # Get the compilation command and the source file.
660     base_compile=
661 aono 1.5 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
662 aonoto 1.6 suppress_opt=yes
663 ura 1.1 suppress_output=
664 aono 1.5 arg_mode=normal
665     libobj=
666 aonoto 1.6 later=
667 ura 1.1
668     for arg
669     do
670 aonoto 1.6 case $arg_mode in
671 aono 1.5 arg )
672     # do not "continue". Instead, add this to base_compile
673     lastarg="$arg"
674     arg_mode=normal
675     ;;
676 hiroo 1.2
677 aono 1.5 target )
678     libobj="$arg"
679     arg_mode=normal
680 hiroo 1.2 continue
681     ;;
682    
683 aono 1.5 normal )
684     # Accept any command-line options.
685     case $arg in
686     -o)
687     if test -n "$libobj" ; then
688     $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689 aonoto 1.6 exit $EXIT_FAILURE
690 aono 1.5 fi
691     arg_mode=target
692     continue
693     ;;
694 ura 1.1
695 aonoto 1.6 -static | -prefer-pic | -prefer-non-pic)
696     later="$later $arg"
697 aono 1.5 continue
698     ;;
699 hiroo 1.2
700 aonoto 1.6 -no-suppress)
701     suppress_opt=no
702 aono 1.5 continue
703     ;;
704 hiroo 1.2
705 aono 1.5 -Xcompiler)
706     arg_mode=arg # the next one goes into the "base_compile" arg list
707     continue # The current "srcfile" will either be retained or
708     ;; # replaced later. I would guess that would be a bug.
709    
710     -Wc,*)
711     args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
712     lastarg=
713     save_ifs="$IFS"; IFS=','
714 aonoto 1.6 for arg in $args; do
715 aono 1.5 IFS="$save_ifs"
716 hiroo 1.2
717 aono 1.5 # Double-quote args containing other shell metacharacters.
718     # Many Bourne shells cannot handle close brackets correctly
719     # in scan sets, so we specify it separately.
720     case $arg in
721     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
722     arg="\"$arg\""
723     ;;
724     esac
725     lastarg="$lastarg $arg"
726     done
727 hiroo 1.2 IFS="$save_ifs"
728 aono 1.5 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
729 hiroo 1.2
730 aono 1.5 # Add the arguments to base_compile.
731 hiroo 1.2 base_compile="$base_compile $lastarg"
732 aono 1.5 continue
733     ;;
734 ura 1.1
735 aono 1.5 * )
736     # Accept the current argument as the source file.
737     # The previous "srcfile" becomes the current argument.
738     #
739     lastarg="$srcfile"
740     srcfile="$arg"
741     ;;
742     esac # case $arg
743 ura 1.1 ;;
744 aono 1.5 esac # case $arg_mode
745 ura 1.1
746     # Aesthetically quote the previous argument.
747     lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
748    
749 aono 1.5 case $lastarg in
750 ura 1.1 # Double-quote args containing other shell metacharacters.
751 hiroo 1.2 # Many Bourne shells cannot handle close brackets correctly
752 aonoto 1.6 # in scan sets, and some SunOS ksh mistreat backslash-escaping
753     # in scan sets (worked around with variable expansion),
754     # and furthermore cannot handle '|' '&' '(' ')' in scan sets
755     # at all, so we specify them separately.
756 hiroo 1.2 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
757 ura 1.1 lastarg="\"$lastarg\""
758     ;;
759     esac
760    
761 aono 1.5 base_compile="$base_compile $lastarg"
762     done # for arg
763 ura 1.1
764 aono 1.5 case $arg_mode in
765     arg)
766     $echo "$modename: you must specify an argument for -Xcompile"
767 aonoto 1.6 exit $EXIT_FAILURE
768 ura 1.1 ;;
769 aono 1.5 target)
770     $echo "$modename: you must specify a target with \`-o'" 1>&2
771 aonoto 1.6 exit $EXIT_FAILURE
772 ura 1.1 ;;
773     *)
774 aono 1.5 # Get the name of the library object.
775     [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
776 ura 1.1 ;;
777     esac
778    
779     # Recognize several different file suffixes.
780     # If the user specifies -o file.o, it is replaced with file.lo
781 aono 1.5 xform='[cCFSifmso]'
782 hiroo 1.2 case $libobj in
783 ura 1.1 *.ada) xform=ada ;;
784     *.adb) xform=adb ;;
785     *.ads) xform=ads ;;
786     *.asm) xform=asm ;;
787     *.c++) xform=c++ ;;
788     *.cc) xform=cc ;;
789 aono 1.5 *.ii) xform=ii ;;
790     *.class) xform=class ;;
791 ura 1.1 *.cpp) xform=cpp ;;
792     *.cxx) xform=cxx ;;
793 aonoto 1.6 *.[fF][09]?) xform=[fF][09]. ;;
794 ura 1.1 *.for) xform=for ;;
795 aono 1.5 *.java) xform=java ;;
796 aonoto 1.6 *.obj) xform=obj ;;
797     *.sx) xform=sx ;;
798 ura 1.1 esac
799    
800     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
801    
802 hiroo 1.2 case $libobj in
803 ura 1.1 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
804     *)
805     $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
806 aonoto 1.6 exit $EXIT_FAILURE
807 ura 1.1 ;;
808     esac
809    
810 aonoto 1.6 func_infer_tag $base_compile
811    
812     for arg in $later; do
813     case $arg in
814     -static)
815     build_old_libs=yes
816     continue
817     ;;
818    
819     -prefer-pic)
820     pic_mode=yes
821     continue
822     ;;
823    
824     -prefer-non-pic)
825     pic_mode=no
826     continue
827 aono 1.5 ;;
828     esac
829 aonoto 1.6 done
830 aono 1.5
831 aonoto 1.6 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
832     case $qlibobj in
833     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
834     qlibobj="\"$qlibobj\"" ;;
835     esac
836     test "X$libobj" != "X$qlibobj" \
837     && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
838     && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
839 aono 1.5 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
840     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
841     if test "X$xdir" = "X$obj"; then
842     xdir=
843     else
844     xdir=$xdir/
845     fi
846     lobj=${xdir}$objdir/$objname
847    
848 ura 1.1 if test -z "$base_compile"; then
849     $echo "$modename: you must specify a compilation command" 1>&2
850     $echo "$help" 1>&2
851 aonoto 1.6 exit $EXIT_FAILURE
852 ura 1.1 fi
853    
854     # Delete any leftover library objects.
855     if test "$build_old_libs" = yes; then
856 aono 1.5 removelist="$obj $lobj $libobj ${libobj}T"
857 ura 1.1 else
858 aono 1.5 removelist="$lobj $libobj ${libobj}T"
859 ura 1.1 fi
860    
861     $run $rm $removelist
862 aonoto 1.6 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
863 ura 1.1
864 hiroo 1.2 # On Cygwin there's no "real" PIC flag so we must build both object types
865     case $host_os in
866     cygwin* | mingw* | pw32* | os2*)
867     pic_mode=default
868     ;;
869     esac
870 aono 1.5 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
871 hiroo 1.2 # non-PIC code in shared libraries is not supported
872     pic_mode=default
873     fi
874    
875 ura 1.1 # Calculate the filename of the output object if compiler does
876     # not support -o with -c
877     if test "$compiler_c_o" = no; then
878 hiroo 1.2 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
879 ura 1.1 lockfile="$output_obj.lock"
880     removelist="$removelist $output_obj $lockfile"
881 aonoto 1.6 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
882 ura 1.1 else
883 aono 1.5 output_obj=
884 ura 1.1 need_locks=no
885     lockfile=
886     fi
887    
888     # Lock this critical section if it is needed
889     # We use this script file to make the link, it avoids creating a new file
890     if test "$need_locks" = yes; then
891 aonoto 1.6 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
892 ura 1.1 $show "Waiting for $lockfile to be removed"
893     sleep 2
894     done
895     elif test "$need_locks" = warn; then
896     if test -f "$lockfile"; then
897 aono 1.5 $echo "\
898 ura 1.1 *** ERROR, $lockfile exists and contains:
899     `cat $lockfile 2>/dev/null`
900    
901     This indicates that another process is trying to use the same
902     temporary object file, and libtool could not work around it because
903     your compiler does not support \`-c' and \`-o' together. If you
904     repeat this compilation, it may succeed, by chance, but you had better
905     avoid parallel builds (make -j) in this platform, or get a better
906     compiler."
907    
908     $run $rm $removelist
909 aonoto 1.6 exit $EXIT_FAILURE
910 ura 1.1 fi
911 aonoto 1.6 $echo "$srcfile" > "$lockfile"
912 ura 1.1 fi
913    
914     if test -n "$fix_srcfile_path"; then
915     eval srcfile=\"$fix_srcfile_path\"
916     fi
917 aonoto 1.6 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
918     case $qsrcfile in
919     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
920     qsrcfile="\"$qsrcfile\"" ;;
921     esac
922 ura 1.1
923 aono 1.5 $run $rm "$libobj" "${libobj}T"
924    
925     # Create a libtool object file (analogous to a ".la" file),
926     # but don't create it if we're doing a dry run.
927     test -z "$run" && cat > ${libobj}T <<EOF
928     # $libobj - a libtool object file
929     # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
930     #
931     # Please DO NOT delete this file!
932     # It is necessary for linking the library.
933    
934     # Name of the PIC object.
935     EOF
936    
937 ura 1.1 # Only build a PIC object if we are building libtool libraries.
938     if test "$build_libtool_libs" = yes; then
939     # Without this assignment, base_compile gets emptied.
940     fbsd_hideous_sh_bug=$base_compile
941    
942 hiroo 1.2 if test "$pic_mode" != no; then
943 aonoto 1.6 command="$base_compile $qsrcfile $pic_flag"
944 hiroo 1.2 else
945     # Don't build PIC code
946 aonoto 1.6 command="$base_compile $qsrcfile"
947 hiroo 1.2 fi
948 ura 1.1
949 aono 1.5 if test ! -d "${xdir}$objdir"; then
950     $show "$mkdir ${xdir}$objdir"
951     $run $mkdir ${xdir}$objdir
952 aonoto 1.6 exit_status=$?
953     if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
954     exit $exit_status
955 ura 1.1 fi
956     fi
957 aono 1.5
958     if test -z "$output_obj"; then
959     # Place PIC objects in $objdir
960     command="$command -o $lobj"
961 ura 1.1 fi
962    
963 aono 1.5 $run $rm "$lobj" "$output_obj"
964    
965 ura 1.1 $show "$command"
966 aonoto 1.6 if $run eval $lt_env "$command"; then :
967 ura 1.1 else
968     test -n "$output_obj" && $run $rm $removelist
969 aonoto 1.6 exit $EXIT_FAILURE
970 ura 1.1 fi
971    
972     if test "$need_locks" = warn &&
973 aono 1.5 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
974     $echo "\
975 ura 1.1 *** ERROR, $lockfile contains:
976     `cat $lockfile 2>/dev/null`
977    
978     but it should contain:
979     $srcfile
980    
981     This indicates that another process is trying to use the same
982     temporary object file, and libtool could not work around it because
983     your compiler does not support \`-c' and \`-o' together. If you
984     repeat this compilation, it may succeed, by chance, but you had better
985     avoid parallel builds (make -j) in this platform, or get a better
986     compiler."
987    
988     $run $rm $removelist
989 aonoto 1.6 exit $EXIT_FAILURE
990 ura 1.1 fi
991    
992     # Just move the object if needed, then go on to compile the next one
993 aono 1.5 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
994     $show "$mv $output_obj $lobj"
995     if $run $mv $output_obj $lobj; then :
996 ura 1.1 else
997     error=$?
998     $run $rm $removelist
999     exit $error
1000     fi
1001     fi
1002    
1003 aono 1.5 # Append the name of the PIC object to the libtool object file.
1004     test -z "$run" && cat >> ${libobj}T <<EOF
1005     pic_object='$objdir/$objname'
1006 ura 1.1
1007 aono 1.5 EOF
1008 ura 1.1
1009     # Allow error messages only from the first compilation.
1010 aonoto 1.6 if test "$suppress_opt" = yes; then
1011     suppress_output=' >/dev/null 2>&1'
1012     fi
1013 aono 1.5 else
1014     # No PIC object so indicate it doesn't exist in the libtool
1015     # object file.
1016     test -z "$run" && cat >> ${libobj}T <<EOF
1017     pic_object=none
1018    
1019     EOF
1020 ura 1.1 fi
1021    
1022     # Only build a position-dependent object if we build old libraries.
1023     if test "$build_old_libs" = yes; then
1024 hiroo 1.2 if test "$pic_mode" != yes; then
1025     # Don't build PIC code
1026 aonoto 1.6 command="$base_compile $qsrcfile"
1027 hiroo 1.2 else
1028 aonoto 1.6 command="$base_compile $qsrcfile $pic_flag"
1029 hiroo 1.2 fi
1030 ura 1.1 if test "$compiler_c_o" = yes; then
1031     command="$command -o $obj"
1032     fi
1033    
1034     # Suppress compiler output if we already did a PIC compilation.
1035     command="$command$suppress_output"
1036 aono 1.5 $run $rm "$obj" "$output_obj"
1037 ura 1.1 $show "$command"
1038 aonoto 1.6 if $run eval $lt_env "$command"; then :
1039 ura 1.1 else
1040     $run $rm $removelist
1041 aonoto 1.6 exit $EXIT_FAILURE
1042 ura 1.1 fi
1043    
1044     if test "$need_locks" = warn &&
1045 aono 1.5 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1046     $echo "\
1047 ura 1.1 *** ERROR, $lockfile contains:
1048     `cat $lockfile 2>/dev/null`
1049    
1050     but it should contain:
1051     $srcfile
1052    
1053     This indicates that another process is trying to use the same
1054     temporary object file, and libtool could not work around it because
1055     your compiler does not support \`-c' and \`-o' together. If you
1056     repeat this compilation, it may succeed, by chance, but you had better
1057     avoid parallel builds (make -j) in this platform, or get a better
1058     compiler."
1059    
1060     $run $rm $removelist
1061 aonoto 1.6 exit $EXIT_FAILURE
1062 ura 1.1 fi
1063    
1064     # Just move the object if needed
1065 aono 1.5 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1066 ura 1.1 $show "$mv $output_obj $obj"
1067     if $run $mv $output_obj $obj; then :
1068     else
1069     error=$?
1070     $run $rm $removelist
1071     exit $error
1072     fi
1073     fi
1074    
1075 aono 1.5 # Append the name of the non-PIC object the libtool object file.
1076     # Only append if the libtool object file exists.
1077     test -z "$run" && cat >> ${libobj}T <<EOF
1078     # Name of the non-PIC object.
1079     non_pic_object='$objname'
1080    
1081     EOF
1082     else
1083     # Append the name of the non-PIC object the libtool object file.
1084     # Only append if the libtool object file exists.
1085     test -z "$run" && cat >> ${libobj}T <<EOF
1086     # Name of the non-PIC object.
1087     non_pic_object=none
1088    
1089     EOF
1090 ura 1.1 fi
1091    
1092 aono 1.5 $run $mv "${libobj}T" "${libobj}"
1093    
1094 ura 1.1 # Unlock the critical section if it was locked
1095     if test "$need_locks" != no; then
1096 hiroo 1.2 $run $rm "$lockfile"
1097 ura 1.1 fi
1098    
1099 aonoto 1.6 exit $EXIT_SUCCESS
1100 ura 1.1 ;;
1101    
1102     # libtool link mode
1103 hiroo 1.2 link | relink)
1104 ura 1.1 modename="$modename: link"
1105 hiroo 1.2 case $host in
1106     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1107 ura 1.1 # It is impossible to link a dll without this setting, and
1108     # we shouldn't force the makefile maintainer to figure out
1109     # which system we are compiling for in order to pass an extra
1110 aono 1.5 # flag for every libtool invocation.
1111 ura 1.1 # allow_undefined=no
1112    
1113     # FIXME: Unfortunately, there are problems with the above when trying
1114     # to make a dll which has undefined symbols, in which case not
1115     # even a static library is built. For now, we need to specify
1116     # -no-undefined on the libtool link line when we can be certain
1117     # that all symbols are satisfied, otherwise we get a static library.
1118     allow_undefined=yes
1119     ;;
1120     *)
1121     allow_undefined=yes
1122     ;;
1123     esac
1124 hiroo 1.2 libtool_args="$nonopt"
1125 aonoto 1.6 base_compile="$nonopt $@"
1126 ura 1.1 compile_command="$nonopt"
1127     finalize_command="$nonopt"
1128    
1129     compile_rpath=
1130     finalize_rpath=
1131     compile_shlibpath=
1132     finalize_shlibpath=
1133     convenience=
1134     old_convenience=
1135     deplibs=
1136 hiroo 1.2 old_deplibs=
1137     compiler_flags=
1138     linker_flags=
1139     dllsearchpath=
1140     lib_search_path=`pwd`
1141 aono 1.5 inst_prefix_dir=
1142 ura 1.1
1143     avoid_version=no
1144     dlfiles=
1145     dlprefiles=
1146     dlself=no
1147     export_dynamic=no
1148     export_symbols=
1149     export_symbols_regex=
1150     generated=
1151     libobjs=
1152     ltlibs=
1153     module=no
1154 hiroo 1.2 no_install=no
1155 ura 1.1 objs=
1156 aono 1.5 non_pic_objects=
1157 aonoto 1.6 notinst_path= # paths that contain not-installed libtool libraries
1158     precious_files_regex=
1159 ura 1.1 prefer_static_libs=no
1160     preload=no
1161     prev=
1162     prevarg=
1163     release=
1164     rpath=
1165     xrpath=
1166     perm_rpath=
1167     temp_rpath=
1168     thread_safe=no
1169     vinfo=
1170 aono 1.5 vinfo_number=no
1171 aonoto 1.6 single_module="${wl}-single_module"
1172    
1173     func_infer_tag $base_compile
1174 ura 1.1
1175     # We need to know -static, to get the right output filenames.
1176     for arg
1177     do
1178 hiroo 1.2 case $arg in
1179 aonoto 1.6 -all-static | -static | -static-libtool-libs)
1180     case $arg in
1181     -all-static)
1182 ura 1.1 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1183     $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1184     fi
1185     if test -n "$link_static_flag"; then
1186     dlopen_self=$dlopen_self_static
1187     fi
1188 aonoto 1.6 prefer_static_libs=yes
1189     ;;
1190     -static)
1191     if test -z "$pic_flag" && test -n "$link_static_flag"; then
1192     dlopen_self=$dlopen_self_static
1193     fi
1194     prefer_static_libs=built
1195     ;;
1196     -static-libtool-libs)
1197 ura 1.1 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198     dlopen_self=$dlopen_self_static
1199     fi
1200 aonoto 1.6 prefer_static_libs=yes
1201     ;;
1202     esac
1203 ura 1.1 build_libtool_libs=no
1204     build_old_libs=yes
1205     break
1206     ;;
1207     esac
1208     done
1209    
1210     # See if our shared archives depend on static archives.
1211     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1212    
1213     # Go through the arguments, transforming them on the way.
1214 aono 1.5 while test "$#" -gt 0; do
1215 ura 1.1 arg="$1"
1216     shift
1217 hiroo 1.2 case $arg in
1218     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1219     qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1220     ;;
1221     *) qarg=$arg ;;
1222     esac
1223     libtool_args="$libtool_args $qarg"
1224 ura 1.1
1225     # If the previous option needs an argument, assign it.
1226     if test -n "$prev"; then
1227 hiroo 1.2 case $prev in
1228 ura 1.1 output)
1229     compile_command="$compile_command @OUTPUT@"
1230     finalize_command="$finalize_command @OUTPUT@"
1231     ;;
1232     esac
1233    
1234 hiroo 1.2 case $prev in
1235 ura 1.1 dlfiles|dlprefiles)
1236     if test "$preload" = no; then
1237     # Add the symbol object into the linking commands.
1238     compile_command="$compile_command @SYMFILE@"
1239     finalize_command="$finalize_command @SYMFILE@"
1240     preload=yes
1241     fi
1242 hiroo 1.2 case $arg in
1243 ura 1.1 *.la | *.lo) ;; # We handle these cases below.
1244     force)
1245     if test "$dlself" = no; then
1246     dlself=needless
1247     export_dynamic=yes
1248     fi
1249     prev=
1250     continue
1251     ;;
1252     self)
1253     if test "$prev" = dlprefiles; then
1254     dlself=yes
1255     elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1256     dlself=yes
1257     else
1258     dlself=needless
1259     export_dynamic=yes
1260     fi
1261     prev=
1262     continue
1263     ;;
1264     *)
1265     if test "$prev" = dlfiles; then
1266     dlfiles="$dlfiles $arg"
1267     else
1268     dlprefiles="$dlprefiles $arg"
1269     fi
1270     prev=
1271 hiroo 1.2 continue
1272 ura 1.1 ;;
1273     esac
1274     ;;
1275     expsyms)
1276     export_symbols="$arg"
1277     if test ! -f "$arg"; then
1278     $echo "$modename: symbol file \`$arg' does not exist"
1279 aonoto 1.6 exit $EXIT_FAILURE
1280 ura 1.1 fi
1281     prev=
1282     continue
1283     ;;
1284     expsyms_regex)
1285     export_symbols_regex="$arg"
1286     prev=
1287     continue
1288     ;;
1289 aono 1.5 inst_prefix)
1290     inst_prefix_dir="$arg"
1291     prev=
1292     continue
1293     ;;
1294 aonoto 1.6 precious_regex)
1295     precious_files_regex="$arg"
1296     prev=
1297     continue
1298     ;;
1299 ura 1.1 release)
1300     release="-$arg"
1301     prev=
1302     continue
1303     ;;
1304 aono 1.5 objectlist)
1305     if test -f "$arg"; then
1306     save_arg=$arg
1307     moreargs=
1308     for fil in `cat $save_arg`
1309     do
1310     # moreargs="$moreargs $fil"
1311     arg=$fil
1312     # A libtool-controlled object.
1313    
1314     # Check to see that this really is a libtool object.
1315     if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1316     pic_object=
1317     non_pic_object=
1318    
1319     # Read the .lo file
1320     # If there is no directory component, then add one.
1321     case $arg in
1322     */* | *\\*) . $arg ;;
1323     *) . ./$arg ;;
1324     esac
1325    
1326     if test -z "$pic_object" || \
1327     test -z "$non_pic_object" ||
1328     test "$pic_object" = none && \
1329     test "$non_pic_object" = none; then
1330     $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1331 aonoto 1.6 exit $EXIT_FAILURE
1332 aono 1.5 fi
1333    
1334     # Extract subdirectory from the argument.
1335     xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1336     if test "X$xdir" = "X$arg"; then
1337     xdir=
1338     else
1339     xdir="$xdir/"
1340     fi
1341    
1342     if test "$pic_object" != none; then
1343     # Prepend the subdirectory the object is found in.
1344     pic_object="$xdir$pic_object"
1345    
1346     if test "$prev" = dlfiles; then
1347     if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1348     dlfiles="$dlfiles $pic_object"
1349     prev=
1350     continue
1351     else
1352     # If libtool objects are unsupported, then we need to preload.
1353     prev=dlprefiles
1354     fi
1355     fi
1356    
1357     # CHECK ME: I think I busted this. -Ossama
1358     if test "$prev" = dlprefiles; then
1359     # Preload the old-style object.
1360     dlprefiles="$dlprefiles $pic_object"
1361     prev=
1362     fi
1363    
1364     # A PIC object.
1365     libobjs="$libobjs $pic_object"
1366     arg="$pic_object"
1367     fi
1368    
1369     # Non-PIC object.
1370     if test "$non_pic_object" != none; then
1371     # Prepend the subdirectory the object is found in.
1372     non_pic_object="$xdir$non_pic_object"
1373    
1374     # A standard non-PIC object
1375     non_pic_objects="$non_pic_objects $non_pic_object"
1376     if test -z "$pic_object" || test "$pic_object" = none ; then
1377     arg="$non_pic_object"
1378     fi
1379 aonoto 1.6 else
1380     # If the PIC object exists, use it instead.
1381     # $xdir was prepended to $pic_object above.
1382     non_pic_object="$pic_object"
1383     non_pic_objects="$non_pic_objects $non_pic_object"
1384 aono 1.5 fi
1385     else
1386     # Only an error if not doing a dry-run.
1387     if test -z "$run"; then
1388     $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1389 aonoto 1.6 exit $EXIT_FAILURE
1390 aono 1.5 else
1391     # Dry-run case.
1392    
1393     # Extract subdirectory from the argument.
1394     xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1395     if test "X$xdir" = "X$arg"; then
1396     xdir=
1397     else
1398     xdir="$xdir/"
1399     fi
1400    
1401     pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1402     non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1403     libobjs="$libobjs $pic_object"
1404     non_pic_objects="$non_pic_objects $non_pic_object"
1405     fi
1406     fi
1407     done
1408     else
1409     $echo "$modename: link input file \`$save_arg' does not exist"
1410 aonoto 1.6 exit $EXIT_FAILURE
1411 aono 1.5 fi
1412     arg=$save_arg
1413     prev=
1414     continue
1415     ;;
1416 ura 1.1 rpath | xrpath)
1417     # We need an absolute path.
1418 hiroo 1.2 case $arg in
1419 ura 1.1 [\\/]* | [A-Za-z]:[\\/]*) ;;
1420     *)
1421     $echo "$modename: only absolute run-paths are allowed" 1>&2
1422 aonoto 1.6 exit $EXIT_FAILURE
1423 ura 1.1 ;;
1424     esac
1425     if test "$prev" = rpath; then
1426     case "$rpath " in
1427     *" $arg "*) ;;
1428     *) rpath="$rpath $arg" ;;
1429     esac
1430     else
1431     case "$xrpath " in
1432     *" $arg "*) ;;
1433     *) xrpath="$xrpath $arg" ;;
1434     esac
1435     fi
1436     prev=
1437     continue
1438     ;;
1439 hiroo 1.2 xcompiler)
1440     compiler_flags="$compiler_flags $qarg"
1441     prev=
1442     compile_command="$compile_command $qarg"
1443     finalize_command="$finalize_command $qarg"
1444     continue
1445     ;;
1446     xlinker)
1447     linker_flags="$linker_flags $qarg"
1448     compiler_flags="$compiler_flags $wl$qarg"
1449     prev=
1450     compile_command="$compile_command $wl$qarg"
1451     finalize_command="$finalize_command $wl$qarg"
1452     continue
1453     ;;
1454 aono 1.5 xcclinker)
1455     linker_flags="$linker_flags $qarg"
1456     compiler_flags="$compiler_flags $qarg"
1457     prev=
1458     compile_command="$compile_command $qarg"
1459     finalize_command="$finalize_command $qarg"
1460     continue
1461     ;;
1462 aonoto 1.6 shrext)
1463     shrext_cmds="$arg"
1464     prev=
1465     continue
1466     ;;
1467     darwin_framework|darwin_framework_skip)
1468     test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1469     compile_command="$compile_command $arg"
1470     finalize_command="$finalize_command $arg"
1471     prev=
1472     continue
1473     ;;
1474 ura 1.1 *)
1475     eval "$prev=\"\$arg\""
1476     prev=
1477     continue
1478     ;;
1479     esac
1480 aono 1.5 fi # test -n "$prev"
1481 ura 1.1
1482     prevarg="$arg"
1483    
1484 hiroo 1.2 case $arg in
1485 ura 1.1 -all-static)
1486     if test -n "$link_static_flag"; then
1487     compile_command="$compile_command $link_static_flag"
1488     finalize_command="$finalize_command $link_static_flag"
1489     fi
1490     continue
1491     ;;
1492    
1493     -allow-undefined)
1494     # FIXME: remove this flag sometime in the future.
1495     $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1496     continue
1497     ;;
1498    
1499     -avoid-version)
1500     avoid_version=yes
1501     continue
1502     ;;
1503    
1504     -dlopen)
1505     prev=dlfiles
1506     continue
1507     ;;
1508    
1509     -dlpreopen)
1510     prev=dlprefiles
1511     continue
1512     ;;
1513    
1514     -export-dynamic)
1515     export_dynamic=yes
1516     continue
1517     ;;
1518    
1519     -export-symbols | -export-symbols-regex)
1520     if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1521 hiroo 1.2 $echo "$modename: more than one -exported-symbols argument is not allowed"
1522 aonoto 1.6 exit $EXIT_FAILURE
1523 ura 1.1 fi
1524     if test "X$arg" = "X-export-symbols"; then
1525     prev=expsyms
1526     else
1527     prev=expsyms_regex
1528     fi
1529     continue
1530     ;;
1531    
1532 aonoto 1.6 -framework|-arch|-isysroot)
1533     case " $CC " in
1534     *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1535     prev=darwin_framework_skip ;;
1536     *) compiler_flags="$compiler_flags $arg"
1537     prev=darwin_framework ;;
1538     esac
1539     compile_command="$compile_command $arg"
1540     finalize_command="$finalize_command $arg"
1541     continue
1542     ;;
1543    
1544 aono 1.5 -inst-prefix-dir)
1545     prev=inst_prefix
1546     continue
1547     ;;
1548    
1549 hiroo 1.2 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1550     # so, if we see these flags be careful not to treat them like -L
1551     -L[A-Z][A-Z]*:*)
1552     case $with_gcc/$host in
1553 aono 1.5 no/*-*-irix* | /*-*-irix*)
1554 hiroo 1.2 compile_command="$compile_command $arg"
1555     finalize_command="$finalize_command $arg"
1556     ;;
1557     esac
1558     continue
1559     ;;
1560    
1561 ura 1.1 -L*)
1562     dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1563     # We need an absolute path.
1564 hiroo 1.2 case $dir in
1565 ura 1.1 [\\/]* | [A-Za-z]:[\\/]*) ;;
1566     *)
1567     absdir=`cd "$dir" && pwd`
1568     if test -z "$absdir"; then
1569 hiroo 1.2 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1570 aonoto 1.6 absdir="$dir"
1571     notinst_path="$notinst_path $dir"
1572 ura 1.1 fi
1573     dir="$absdir"
1574     ;;
1575     esac
1576 hiroo 1.2 case "$deplibs " in
1577     *" -L$dir "*) ;;
1578     *)
1579     deplibs="$deplibs -L$dir"
1580     lib_search_path="$lib_search_path $dir"
1581     ;;
1582 ura 1.1 esac
1583 hiroo 1.2 case $host in
1584     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1585 aonoto 1.6 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1586 hiroo 1.2 case :$dllsearchpath: in
1587     *":$dir:"*) ;;
1588     *) dllsearchpath="$dllsearchpath:$dir";;
1589 ura 1.1 esac
1590 aonoto 1.6 case :$dllsearchpath: in
1591     *":$testbindir:"*) ;;
1592     *) dllsearchpath="$dllsearchpath:$testbindir";;
1593     esac
1594 ura 1.1 ;;
1595     esac
1596 hiroo 1.2 continue
1597 ura 1.1 ;;
1598    
1599     -l*)
1600 hiroo 1.2 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1601     case $host in
1602 aonoto 1.6 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1603 hiroo 1.2 # These systems don't actually have a C or math library (as such)
1604 ura 1.1 continue
1605     ;;
1606 aonoto 1.6 *-*-os2*)
1607 hiroo 1.2 # These systems don't actually have a C library (as such)
1608     test "X$arg" = "X-lc" && continue
1609 ura 1.1 ;;
1610 aonoto 1.6 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1611 aono 1.5 # Do not include libc due to us having libc/libc_r.
1612     test "X$arg" = "X-lc" && continue
1613     ;;
1614     *-*-rhapsody* | *-*-darwin1.[012])
1615     # Rhapsody C and math libraries are in the System framework
1616     deplibs="$deplibs -framework System"
1617     continue
1618 aonoto 1.6 ;;
1619     *-*-sco3.2v5* | *-*-sco5v6*)
1620     # Causes problems with __ctype
1621     test "X$arg" = "X-lc" && continue
1622     ;;
1623     *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1624     # Compiler inserts libc in the correct place for threads to work
1625     test "X$arg" = "X-lc" && continue
1626     ;;
1627 ura 1.1 esac
1628 aono 1.5 elif test "X$arg" = "X-lc_r"; then
1629     case $host in
1630 aonoto 1.6 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1631 aono 1.5 # Do not include libc_r directly, use -pthread flag.
1632     continue
1633     ;;
1634     esac
1635 ura 1.1 fi
1636     deplibs="$deplibs $arg"
1637 hiroo 1.2 continue
1638 ura 1.1 ;;
1639    
1640 aonoto 1.6 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1641     # classes, name mangling, and exception handling.
1642     -model)
1643     compile_command="$compile_command $arg"
1644     compiler_flags="$compiler_flags $arg"
1645     finalize_command="$finalize_command $arg"
1646     prev=xcompiler
1647     continue
1648     ;;
1649    
1650     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1651     compiler_flags="$compiler_flags $arg"
1652     compile_command="$compile_command $arg"
1653     finalize_command="$finalize_command $arg"
1654     continue
1655     ;;
1656    
1657     -multi_module)
1658     single_module="${wl}-multi_module"
1659     continue
1660     ;;
1661    
1662 ura 1.1 -module)
1663     module=yes
1664     continue
1665     ;;
1666    
1667 aonoto 1.6 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1668     # -r[0-9][0-9]* specifies the processor on the SGI compiler
1669     # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1670     # +DA*, +DD* enable 64-bit mode on the HP compiler
1671     # -q* pass through compiler args for the IBM compiler
1672     # -m* pass through architecture-specific compiler args for GCC
1673     # -m*, -t[45]*, -txscale* pass through architecture-specific
1674     # compiler args for GCC
1675     # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1676     # -F/path gives path to uninstalled frameworks, gcc on darwin
1677     # @file GCC response files
1678     -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1679     -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1680    
1681 aono 1.5 # Unknown arguments in both finalize_command and compile_command need
1682     # to be aesthetically quoted because they are evaled later.
1683     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1684     case $arg in
1685     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1686     arg="\"$arg\""
1687     ;;
1688     esac
1689     compile_command="$compile_command $arg"
1690     finalize_command="$finalize_command $arg"
1691 aonoto 1.6 compiler_flags="$compiler_flags $arg"
1692 aono 1.5 continue
1693     ;;
1694    
1695     -shrext)
1696     prev=shrext
1697     continue
1698     ;;
1699    
1700 hiroo 1.2 -no-fast-install)
1701     fast_install=no
1702     continue
1703     ;;
1704    
1705     -no-install)
1706     case $host in
1707 aonoto 1.6 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1708 hiroo 1.2 # The PATH hackery in wrapper scripts is required on Windows
1709 aonoto 1.6 # and Darwin in order for the loader to find any dlls it needs.
1710 hiroo 1.2 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1711     $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1712     fast_install=no
1713     ;;
1714     *) no_install=yes ;;
1715     esac
1716     continue
1717     ;;
1718    
1719 ura 1.1 -no-undefined)
1720     allow_undefined=no
1721     continue
1722     ;;
1723    
1724 aono 1.5 -objectlist)
1725     prev=objectlist
1726     continue
1727     ;;
1728    
1729 ura 1.1 -o) prev=output ;;
1730    
1731 aonoto 1.6 -precious-files-regex)
1732     prev=precious_regex
1733     continue
1734     ;;
1735    
1736 ura 1.1 -release)
1737     prev=release
1738     continue
1739     ;;
1740    
1741     -rpath)
1742     prev=rpath
1743     continue
1744     ;;
1745    
1746     -R)
1747     prev=xrpath
1748     continue
1749     ;;
1750    
1751     -R*)
1752     dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1753     # We need an absolute path.
1754 hiroo 1.2 case $dir in
1755 ura 1.1 [\\/]* | [A-Za-z]:[\\/]*) ;;
1756     *)
1757     $echo "$modename: only absolute run-paths are allowed" 1>&2
1758 aonoto 1.6 exit $EXIT_FAILURE
1759 ura 1.1 ;;
1760     esac
1761     case "$xrpath " in
1762     *" $dir "*) ;;
1763     *) xrpath="$xrpath $dir" ;;
1764     esac
1765     continue
1766     ;;
1767    
1768 aonoto 1.6 -static | -static-libtool-libs)
1769 hiroo 1.2 # The effects of -static are defined in a previous loop.
1770     # We used to do the same as -all-static on platforms that
1771     # didn't have a PIC flag, but the assumption that the effects
1772     # would be equivalent was wrong. It would break on at least
1773     # Digital Unix and AIX.
1774 ura 1.1 continue
1775     ;;
1776    
1777     -thread-safe)
1778     thread_safe=yes
1779     continue
1780     ;;
1781    
1782     -version-info)
1783     prev=vinfo
1784     continue
1785     ;;
1786 aono 1.5 -version-number)
1787     prev=vinfo
1788     vinfo_number=yes
1789     continue
1790     ;;
1791 ura 1.1
1792 hiroo 1.2 -Wc,*)
1793     args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1794     arg=
1795 aono 1.5 save_ifs="$IFS"; IFS=','
1796 hiroo 1.2 for flag in $args; do
1797     IFS="$save_ifs"
1798     case $flag in
1799     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1800     flag="\"$flag\""
1801     ;;
1802     esac
1803     arg="$arg $wl$flag"
1804     compiler_flags="$compiler_flags $flag"
1805     done
1806     IFS="$save_ifs"
1807     arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1808     ;;
1809    
1810     -Wl,*)
1811     args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1812     arg=
1813 aono 1.5 save_ifs="$IFS"; IFS=','
1814 hiroo 1.2 for flag in $args; do
1815     IFS="$save_ifs"
1816     case $flag in
1817     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1818     flag="\"$flag\""
1819     ;;
1820     esac
1821     arg="$arg $wl$flag"
1822     compiler_flags="$compiler_flags $wl$flag"
1823     linker_flags="$linker_flags $flag"
1824     done
1825     IFS="$save_ifs"
1826     arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1827     ;;
1828    
1829     -Xcompiler)
1830     prev=xcompiler
1831     continue
1832     ;;
1833    
1834     -Xlinker)
1835     prev=xlinker
1836     continue
1837     ;;
1838    
1839 aono 1.5 -XCClinker)
1840     prev=xcclinker
1841     continue
1842     ;;
1843    
1844 ura 1.1 # Some other compiler flag.
1845     -* | +*)
1846     # Unknown arguments in both finalize_command and compile_command need
1847     # to be aesthetically quoted because they are evaled later.
1848     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1849 hiroo 1.2 case $arg in
1850     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1851 ura 1.1 arg="\"$arg\""
1852     ;;
1853     esac
1854     ;;
1855    
1856 aono 1.5 *.$objext)
1857     # A standard object.
1858     objs="$objs $arg"
1859     ;;
1860    
1861     *.lo)
1862     # A libtool-controlled object.
1863    
1864     # Check to see that this really is a libtool object.
1865     if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1866     pic_object=
1867     non_pic_object=
1868    
1869     # Read the .lo file
1870     # If there is no directory component, then add one.
1871     case $arg in
1872     */* | *\\*) . $arg ;;
1873     *) . ./$arg ;;
1874     esac
1875    
1876     if test -z "$pic_object" || \
1877     test -z "$non_pic_object" ||
1878     test "$pic_object" = none && \
1879     test "$non_pic_object" = none; then
1880     $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1881 aonoto 1.6 exit $EXIT_FAILURE
1882 aono 1.5 fi
1883    
1884     # Extract subdirectory from the argument.
1885     xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1886     if test "X$xdir" = "X$arg"; then
1887     xdir=
1888     else
1889     xdir="$xdir/"
1890     fi
1891    
1892     if test "$pic_object" != none; then
1893     # Prepend the subdirectory the object is found in.
1894     pic_object="$xdir$pic_object"
1895    
1896     if test "$prev" = dlfiles; then
1897     if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1898     dlfiles="$dlfiles $pic_object"
1899     prev=
1900     continue
1901     else
1902     # If libtool objects are unsupported, then we need to preload.
1903     prev=dlprefiles
1904     fi
1905     fi
1906    
1907     # CHECK ME: I think I busted this. -Ossama
1908     if test "$prev" = dlprefiles; then
1909     # Preload the old-style object.
1910     dlprefiles="$dlprefiles $pic_object"
1911     prev=
1912     fi
1913    
1914     # A PIC object.
1915     libobjs="$libobjs $pic_object"
1916     arg="$pic_object"
1917 ura 1.1 fi
1918    
1919 aono 1.5 # Non-PIC object.
1920     if test "$non_pic_object" != none; then
1921     # Prepend the subdirectory the object is found in.
1922     non_pic_object="$xdir$non_pic_object"
1923    
1924     # A standard non-PIC object
1925     non_pic_objects="$non_pic_objects $non_pic_object"
1926     if test -z "$pic_object" || test "$pic_object" = none ; then
1927     arg="$non_pic_object"
1928     fi
1929 aonoto 1.6 else
1930     # If the PIC object exists, use it instead.
1931     # $xdir was prepended to $pic_object above.
1932     non_pic_object="$pic_object"
1933     non_pic_objects="$non_pic_objects $non_pic_object"
1934 aono 1.5 fi
1935 hiroo 1.2 else
1936 aono 1.5 # Only an error if not doing a dry-run.
1937     if test -z "$run"; then
1938     $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1939 aonoto 1.6 exit $EXIT_FAILURE
1940 aono 1.5 else
1941     # Dry-run case.
1942    
1943     # Extract subdirectory from the argument.
1944     xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1945     if test "X$xdir" = "X$arg"; then
1946     xdir=
1947     else
1948     xdir="$xdir/"
1949     fi
1950    
1951     pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1952     non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1953     libobjs="$libobjs $pic_object"
1954     non_pic_objects="$non_pic_objects $non_pic_object"
1955     fi
1956 ura 1.1 fi
1957 hiroo 1.2 ;;
1958    
1959     *.$libext)
1960     # An archive.
1961     deplibs="$deplibs $arg"
1962     old_deplibs="$old_deplibs $arg"
1963     continue
1964 ura 1.1 ;;
1965    
1966     *.la)
1967     # A libtool-controlled library.
1968    
1969 hiroo 1.2 if test "$prev" = dlfiles; then
1970     # This library was specified with -dlopen.
1971     dlfiles="$dlfiles $arg"
1972     prev=
1973     elif test "$prev" = dlprefiles; then
1974     # The library was specified with -dlpreopen.
1975     dlprefiles="$dlprefiles $arg"
1976     prev=
1977     else
1978     deplibs="$deplibs $arg"
1979     fi
1980     continue
1981     ;;
1982    
1983     # Some other compiler argument.
1984     *)
1985     # Unknown arguments in both finalize_command and compile_command need
1986     # to be aesthetically quoted because they are evaled later.
1987     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1988     case $arg in
1989     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1990     arg="\"$arg\""
1991     ;;
1992     esac
1993     ;;
1994     esac # arg
1995    
1996     # Now actually substitute the argument into the commands.
1997     if test -n "$arg"; then
1998     compile_command="$compile_command $arg"
1999     finalize_command="$finalize_command $arg"
2000     fi
2001     done # argument parsing loop
2002    
2003     if test -n "$prev"; then
2004     $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2005     $echo "$help" 1>&2
2006 aonoto 1.6 exit $EXIT_FAILURE
2007 aono 1.5 fi
2008    
2009 hiroo 1.2 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2010     eval arg=\"$export_dynamic_flag_spec\"
2011     compile_command="$compile_command $arg"
2012     finalize_command="$finalize_command $arg"
2013     fi
2014    
2015 aono 1.5 oldlibs=
2016 hiroo 1.2 # calculate the name of the file, without its directory
2017     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2018     libobjs_save="$libobjs"
2019    
2020     if test -n "$shlibpath_var"; then
2021     # get the directories listed in $shlibpath_var
2022     eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2023     else
2024     shlib_search_path=
2025     fi
2026     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2027     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2028    
2029     output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2030     if test "X$output_objdir" = "X$output"; then
2031     output_objdir="$objdir"
2032     else
2033     output_objdir="$output_objdir/$objdir"
2034     fi
2035     # Create the object directory.
2036 aono 1.5 if test ! -d "$output_objdir"; then
2037 hiroo 1.2 $show "$mkdir $output_objdir"
2038     $run $mkdir $output_objdir
2039 aonoto 1.6 exit_status=$?
2040     if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2041     exit $exit_status
2042 hiroo 1.2 fi
2043     fi
2044    
2045     # Determine the type of output
2046     case $output in
2047     "")
2048     $echo "$modename: you must specify an output file" 1>&2
2049     $echo "$help" 1>&2
2050 aonoto 1.6 exit $EXIT_FAILURE
2051 hiroo 1.2 ;;
2052     *.$libext) linkmode=oldlib ;;
2053     *.lo | *.$objext) linkmode=obj ;;
2054     *.la) linkmode=lib ;;
2055     *) linkmode=prog ;; # Anything else should be a program.
2056     esac
2057    
2058 aono 1.5 case $host in
2059     *cygwin* | *mingw* | *pw32*)
2060 aonoto 1.6 # don't eliminate duplications in $postdeps and $predeps
2061 aono 1.5 duplicate_compiler_generated_deps=yes
2062     ;;
2063     *)
2064     duplicate_compiler_generated_deps=$duplicate_deps
2065     ;;
2066     esac
2067 hiroo 1.2 specialdeplibs=
2068 aono 1.5
2069 hiroo 1.2 libs=
2070     # Find all interdependent deplibs by searching for libraries
2071     # that are linked more than once (e.g. -la -lb -la)
2072     for deplib in $deplibs; do
2073 aono 1.5 if test "X$duplicate_deps" = "Xyes" ; then
2074     case "$libs " in
2075     *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2076     esac
2077     fi
2078 hiroo 1.2 libs="$libs $deplib"
2079     done
2080 aono 1.5
2081     if test "$linkmode" = lib; then
2082     libs="$predeps $libs $compiler_lib_search_path $postdeps"
2083    
2084     # Compute libraries that are listed more than once in $predeps
2085     # $postdeps and mark them as special (i.e., whose duplicates are
2086     # not to be eliminated).
2087     pre_post_deps=
2088     if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2089     for pre_post_dep in $predeps $postdeps; do
2090     case "$pre_post_deps " in
2091     *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2092     esac
2093     pre_post_deps="$pre_post_deps $pre_post_dep"
2094     done
2095     fi
2096     pre_post_deps=
2097     fi
2098    
2099 hiroo 1.2 deplibs=
2100     newdependency_libs=
2101     newlib_search_path=
2102     need_relink=no # whether we're linking any uninstalled libtool libraries
2103     notinst_deplibs= # not-installed libtool libraries
2104     case $linkmode in
2105     lib)
2106     passes="conv link"
2107     for file in $dlfiles $dlprefiles; do
2108     case $file in
2109     *.la) ;;
2110     *)
2111     $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2112 aonoto 1.6 exit $EXIT_FAILURE
2113 hiroo 1.2 ;;
2114     esac
2115     done
2116     ;;
2117     prog)
2118     compile_deplibs=
2119     finalize_deplibs=
2120     alldeplibs=no
2121     newdlfiles=
2122     newdlprefiles=
2123     passes="conv scan dlopen dlpreopen link"
2124     ;;
2125     *) passes="conv"
2126     ;;
2127     esac
2128     for pass in $passes; do
2129 aono 1.5 if test "$linkmode,$pass" = "lib,link" ||
2130     test "$linkmode,$pass" = "prog,scan"; then
2131     libs="$deplibs"
2132     deplibs=
2133     fi
2134     if test "$linkmode" = prog; then
2135 hiroo 1.2 case $pass in
2136 aono 1.5 dlopen) libs="$dlfiles" ;;
2137 hiroo 1.2 dlpreopen) libs="$dlprefiles" ;;
2138     link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2139     esac
2140     fi
2141 aono 1.5 if test "$pass" = dlopen; then
2142     # Collect dlpreopened libraries
2143     save_deplibs="$deplibs"
2144     deplibs=
2145     fi
2146 hiroo 1.2 for deplib in $libs; do
2147     lib=
2148     found=no
2149     case $deplib in
2150 aonoto 1.6 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2151     if test "$linkmode,$pass" = "prog,link"; then
2152     compile_deplibs="$deplib $compile_deplibs"
2153     finalize_deplibs="$deplib $finalize_deplibs"
2154     else
2155     compiler_flags="$compiler_flags $deplib"
2156     fi
2157     continue
2158     ;;
2159 hiroo 1.2 -l*)
2160 aono 1.5 if test "$linkmode" != lib && test "$linkmode" != prog; then
2161     $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2162 hiroo 1.2 continue
2163     fi
2164 aonoto 1.6 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2165     if test "$linkmode" = lib; then
2166     searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2167     else
2168     searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2169 hiroo 1.2 fi
2170 aonoto 1.6 for searchdir in $searchdirs; do
2171     for search_ext in .la $std_shrext .so .a; do
2172     # Search the libtool library
2173     lib="$searchdir/lib${name}${search_ext}"
2174     if test -f "$lib"; then
2175     if test "$search_ext" = ".la"; then
2176     found=yes
2177     else
2178     found=no
2179     fi
2180     break 2
2181     fi
2182     done
2183 hiroo 1.2 done
2184     if test "$found" != yes; then
2185     # deplib doesn't seem to be a libtool library
2186     if test "$linkmode,$pass" = "prog,link"; then
2187     compile_deplibs="$deplib $compile_deplibs"
2188     finalize_deplibs="$deplib $finalize_deplibs"
2189     else
2190     deplibs="$deplib $deplibs"
2191 aono 1.5 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2192 hiroo 1.2 fi
2193     continue
2194 aono 1.5 else # deplib is a libtool library
2195     # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2196     # We need to do some special things here, and not later.
2197     if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2198     case " $predeps $postdeps " in
2199     *" $deplib "*)
2200     if (${SED} -e '2q' $lib |
2201     grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2202     library_names=
2203     old_library=
2204     case $lib in
2205     */* | *\\*) . $lib ;;
2206     *) . ./$lib ;;
2207     esac
2208     for l in $old_library $library_names; do
2209     ll="$l"
2210     done
2211     if test "X$ll" = "X$old_library" ; then # only static version available
2212     found=no
2213     ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2214     test "X$ladir" = "X$lib" && ladir="."
2215     lib=$ladir/$old_library
2216     if test "$linkmode,$pass" = "prog,link"; then
2217     compile_deplibs="$deplib $compile_deplibs"
2218     finalize_deplibs="$deplib $finalize_deplibs"
2219     else
2220     deplibs="$deplib $deplibs"
2221     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2222     fi
2223     continue
2224     fi
2225     fi
2226     ;;
2227     *) ;;
2228     esac
2229     fi
2230 hiroo 1.2 fi
2231     ;; # -l
2232     -L*)
2233     case $linkmode in
2234     lib)
2235     deplibs="$deplib $deplibs"
2236 aono 1.5 test "$pass" = conv && continue
2237 hiroo 1.2 newdependency_libs="$deplib $newdependency_libs"
2238     newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2239     ;;
2240     prog)
2241 aono 1.5 if test "$pass" = conv; then
2242 hiroo 1.2 deplibs="$deplib $deplibs"
2243     continue
2244     fi
2245 aono 1.5 if test "$pass" = scan; then
2246 hiroo 1.2 deplibs="$deplib $deplibs"
2247     else
2248     compile_deplibs="$deplib $compile_deplibs"
2249     finalize_deplibs="$deplib $finalize_deplibs"
2250     fi
2251 aonoto 1.6 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2252 hiroo 1.2 ;;
2253     *)
2254 aono 1.5 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2255 hiroo 1.2 ;;
2256     esac # linkmode
2257     continue
2258     ;; # -L
2259     -R*)
2260 aono 1.5 if test "$pass" = link; then
2261 hiroo 1.2 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2262     # Make sure the xrpath contains only unique directories.
2263     case "$xrpath " in
2264     *" $dir "*) ;;
2265     *) xrpath="$xrpath $dir" ;;
2266     esac
2267     fi
2268     deplibs="$deplib $deplibs"
2269     continue
2270     ;;
2271     *.la) lib="$deplib" ;;
2272     *.$libext)
2273 aono 1.5 if test "$pass" = conv; then
2274 hiroo 1.2 deplibs="$deplib $deplibs"
2275     continue
2276     fi
2277     case $linkmode in
2278     lib)
2279 aonoto 1.6 valid_a_lib=no
2280     case $deplibs_check_method in
2281     match_pattern*)
2282     set dummy $deplibs_check_method
2283     match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2284     if eval $echo \"$deplib\" 2>/dev/null \
2285     | $SED 10q \
2286     | $EGREP "$match_pattern_regex" > /dev/null; then
2287     valid_a_lib=yes
2288     fi
2289     ;;
2290     pass_all)
2291     valid_a_lib=yes
2292     ;;
2293     esac
2294     if test "$valid_a_lib" != yes; then
2295 aono 1.5 $echo
2296     $echo "*** Warning: Trying to link with static lib archive $deplib."
2297     $echo "*** I have the capability to make that library automatically link in when"
2298     $echo "*** you link to this library. But I can only do this if you have a"
2299     $echo "*** shared version of the library, which you do not appear to have"
2300     $echo "*** because the file extensions .$libext of this argument makes me believe"
2301     $echo "*** that it is just a static archive that I should not used here."
2302 hiroo 1.2 else
2303 aono 1.5 $echo
2304     $echo "*** Warning: Linking the shared library $output against the"
2305     $echo "*** static library $deplib is not portable!"
2306 hiroo 1.2 deplibs="$deplib $deplibs"
2307     fi
2308     continue
2309     ;;
2310     prog)
2311 aono 1.5 if test "$pass" != link; then
2312 hiroo 1.2 deplibs="$deplib $deplibs"
2313     else
2314     compile_deplibs="$deplib $compile_deplibs"
2315     finalize_deplibs="$deplib $finalize_deplibs"
2316     fi
2317     continue
2318     ;;
2319     esac # linkmode
2320     ;; # *.$libext
2321     *.lo | *.$objext)
2322 aono 1.5 if test "$pass" = conv; then
2323     deplibs="$deplib $deplibs"
2324     elif test "$linkmode" = prog; then
2325     if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2326     # If there is no dlopen support or we're linking statically,
2327     # we need to preload.
2328     newdlprefiles="$newdlprefiles $deplib"
2329     compile_deplibs="$deplib $compile_deplibs"
2330     finalize_deplibs="$deplib $finalize_deplibs"
2331     else
2332     newdlfiles="$newdlfiles $deplib"
2333     fi
2334 hiroo 1.2 fi
2335     continue
2336     ;;
2337     %DEPLIBS%)
2338     alldeplibs=yes
2339     continue
2340     ;;
2341     esac # case $deplib
2342 aono 1.5 if test "$found" = yes || test -f "$lib"; then :
2343 hiroo 1.2 else
2344 aonoto 1.6 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2345     exit $EXIT_FAILURE
2346 hiroo 1.2 fi
2347 ura 1.1
2348     # Check to see that this really is a libtool archive.
2349 aono 1.5 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2350 ura 1.1 else
2351 hiroo 1.2 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2352 aonoto 1.6 exit $EXIT_FAILURE
2353 ura 1.1 fi
2354    
2355 hiroo 1.2 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2356     test "X$ladir" = "X$lib" && ladir="."
2357    
2358     dlname=
2359     dlopen=
2360     dlpreopen=
2361     libdir=
2362     library_names=
2363     old_library=
2364 ura 1.1 # If the library was installed with an old release of libtool,
2365 aono 1.5 # it will not redefine variables installed, or shouldnotlink
2366 ura 1.1 installed=yes
2367 aono 1.5 shouldnotlink=no
2368 aonoto 1.6 avoidtemprpath=
2369    
2370 ura 1.1
2371     # Read the .la file
2372 hiroo 1.2 case $lib in
2373     */* | *\\*) . $lib ;;
2374     *) . ./$lib ;;
2375 ura 1.1 esac
2376    
2377 hiroo 1.2 if test "$linkmode,$pass" = "lib,link" ||
2378     test "$linkmode,$pass" = "prog,scan" ||
2379 aono 1.5 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2380 hiroo 1.2 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2381     test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2382     fi
2383    
2384 aono 1.5 if test "$pass" = conv; then
2385 hiroo 1.2 # Only check for convenience libraries
2386     deplibs="$lib $deplibs"
2387     if test -z "$libdir"; then
2388     if test -z "$old_library"; then
2389     $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2390 aonoto 1.6 exit $EXIT_FAILURE
2391 hiroo 1.2 fi
2392     # It is a libtool convenience library, so add in its objects.
2393     convenience="$convenience $ladir/$objdir/$old_library"
2394     old_convenience="$old_convenience $ladir/$objdir/$old_library"
2395     tmp_libs=
2396     for deplib in $dependency_libs; do
2397     deplibs="$deplib $deplibs"
2398 aono 1.5 if test "X$duplicate_deps" = "Xyes" ; then
2399     case "$tmp_libs " in
2400     *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2401     esac
2402     fi
2403 hiroo 1.2 tmp_libs="$tmp_libs $deplib"
2404     done
2405 aono 1.5 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2406 hiroo 1.2 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2407 aonoto 1.6 exit $EXIT_FAILURE
2408 hiroo 1.2 fi
2409     continue
2410     fi # $pass = conv
2411    
2412 aonoto 1.6
2413 ura 1.1 # Get the name of the library we link against.
2414     linklib=
2415     for l in $old_library $library_names; do
2416     linklib="$l"
2417     done
2418     if test -z "$linklib"; then
2419 hiroo 1.2 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2420 aonoto 1.6 exit $EXIT_FAILURE
2421 ura 1.1 fi
2422    
2423 hiroo 1.2 # This library was specified with -dlopen.
2424 aono 1.5 if test "$pass" = dlopen; then
2425 hiroo 1.2 if test -z "$libdir"; then
2426     $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2427 aonoto 1.6 exit $EXIT_FAILURE
2428 hiroo 1.2 fi
2429 aonoto 1.6 if test -z "$dlname" ||
2430     test "$dlopen_support" != yes ||
2431     test "$build_libtool_libs" = no; then
2432 hiroo 1.2 # If there is no dlname, no dlopen support or we're linking
2433 aono 1.5 # statically, we need to preload. We also need to preload any
2434     # dependent libraries so libltdl's deplib preloader doesn't
2435     # bomb out in the load deplibs phase.
2436     dlprefiles="$dlprefiles $lib $dependency_libs"
2437 hiroo 1.2 else
2438     newdlfiles="$newdlfiles $lib"
2439     fi
2440     continue
2441     fi # $pass = dlopen
2442    
2443     # We need an absolute path.
2444     case $ladir in
2445     [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2446     *)
2447     abs_ladir=`cd "$ladir" && pwd`
2448     if test -z "$abs_ladir"; then
2449     $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2450     $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2451     abs_ladir="$ladir"
2452     fi
2453     ;;
2454     esac
2455     laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2456    
2457 ura 1.1 # Find the relevant object directory and library name.
2458     if test "X$installed" = Xyes; then
2459 hiroo 1.2 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2460     $echo "$modename: warning: library \`$lib' was moved." 1>&2
2461     dir="$ladir"
2462     absdir="$abs_ladir"
2463     libdir="$abs_ladir"
2464     else
2465     dir="$libdir"
2466     absdir="$libdir"
2467     fi
2468 aonoto 1.6 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2469 ura 1.1 else
2470 aonoto 1.6 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2471     dir="$ladir"
2472     absdir="$abs_ladir"
2473     # Remove this search path later
2474     notinst_path="$notinst_path $abs_ladir"
2475     else
2476     dir="$ladir/$objdir"
2477     absdir="$abs_ladir/$objdir"
2478     # Remove this search path later
2479     notinst_path="$notinst_path $abs_ladir"
2480     fi
2481 hiroo 1.2 fi # $installed = yes
2482     name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2483    
2484     # This library was specified with -dlpreopen.
2485 aono 1.5 if test "$pass" = dlpreopen; then
2486 hiroo 1.2 if test -z "$libdir"; then
2487     $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2488 aonoto 1.6 exit $EXIT_FAILURE
2489 hiroo 1.2 fi
2490     # Prefer using a static library (so that no silly _DYNAMIC symbols
2491     # are required to link).
2492     if test -n "$old_library"; then
2493     newdlprefiles="$newdlprefiles $dir/$old_library"
2494     # Otherwise, use the dlname, so that lt_dlopen finds it.
2495     elif test -n "$dlname"; then
2496     newdlprefiles="$newdlprefiles $dir/$dlname"
2497 ura 1.1 else
2498 hiroo 1.2 newdlprefiles="$newdlprefiles $dir/$linklib"
2499 ura 1.1 fi
2500 hiroo 1.2 fi # $pass = dlpreopen
2501 ura 1.1
2502     if test -z "$libdir"; then
2503 hiroo 1.2 # Link the convenience library
2504 aono 1.5 if test "$linkmode" = lib; then
2505 hiroo 1.2 deplibs="$dir/$old_library $deplibs"
2506     elif test "$linkmode,$pass" = "prog,link"; then
2507     compile_deplibs="$dir/$old_library $compile_deplibs"
2508     finalize_deplibs="$dir/$old_library $finalize_deplibs"
2509     else
2510 aono 1.5 deplibs="$lib $deplibs" # used for prog,scan pass
2511 hiroo 1.2 fi
2512 ura 1.1 continue
2513     fi
2514    
2515 aonoto 1.6
2516 aono 1.5 if test "$linkmode" = prog && test "$pass" != link; then
2517 hiroo 1.2 newlib_search_path="$newlib_search_path $ladir"
2518     deplibs="$lib $deplibs"
2519    
2520     linkalldeplibs=no
2521     if test "$link_all_deplibs" != no || test -z "$library_names" ||
2522     test "$build_libtool_libs" = no; then
2523     linkalldeplibs=yes
2524 ura 1.1 fi
2525    
2526 hiroo 1.2 tmp_libs=
2527     for deplib in $dependency_libs; do
2528     case $deplib in
2529     -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2530     esac
2531     # Need to link against all dependency_libs?
2532 aono 1.5 if test "$linkalldeplibs" = yes; then
2533 hiroo 1.2 deplibs="$deplib $deplibs"
2534     else
2535     # Need to hardcode shared library paths
2536     # or/and link against static libraries
2537     newdependency_libs="$deplib $newdependency_libs"
2538     fi
2539 aono 1.5 if test "X$duplicate_deps" = "Xyes" ; then
2540     case "$tmp_libs " in
2541     *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2542     esac
2543     fi
2544 hiroo 1.2 tmp_libs="$tmp_libs $deplib"
2545     done # for deplib
2546     continue
2547     fi # $linkmode = prog...
2548 ura 1.1
2549 aono 1.5 if test "$linkmode,$pass" = "prog,link"; then
2550     if test -n "$library_names" &&
2551 aonoto 1.6 { { test "$prefer_static_libs" = no ||
2552     test "$prefer_static_libs,$installed" = "built,yes"; } ||
2553     test -z "$old_library"; }; then
2554 aono 1.5 # We need to hardcode the library path
2555 aonoto 1.6 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2556 aono 1.5 # Make sure the rpath contains only unique directories.
2557     case "$temp_rpath " in
2558     *" $dir "*) ;;
2559     *" $absdir "*) ;;
2560 aonoto 1.6 *) temp_rpath="$temp_rpath $absdir" ;;
2561 aono 1.5 esac
2562     fi
2563 ura 1.1
2564 hiroo 1.2 # Hardcode the library path.
2565     # Skip directories that are in the system default run-time
2566     # search path.
2567     case " $sys_lib_dlsearch_path " in
2568 ura 1.1 *" $absdir "*) ;;
2569 hiroo 1.2 *)
2570     case "$compile_rpath " in
2571     *" $absdir "*) ;;
2572     *) compile_rpath="$compile_rpath $absdir"
2573     esac
2574     ;;
2575 ura 1.1 esac
2576 hiroo 1.2 case " $sys_lib_dlsearch_path " in
2577 ura 1.1 *" $libdir "*) ;;
2578 hiroo 1.2 *)
2579     case "$finalize_rpath " in
2580     *" $libdir "*) ;;
2581     *) finalize_rpath="$finalize_rpath $libdir"
2582     esac
2583     ;;
2584 ura 1.1 esac
2585 hiroo 1.2 fi # $linkmode,$pass = prog,link...
2586    
2587     if test "$alldeplibs" = yes &&
2588     { test "$deplibs_check_method" = pass_all ||
2589     { test "$build_libtool_libs" = yes &&
2590     test -n "$library_names"; }; }; then
2591     # We only need to search for static libraries
2592     continue
2593     fi
2594 aono 1.5 fi
2595 ura 1.1
2596 aono 1.5 link_static=no # Whether the deplib will be linked statically
2597 aonoto 1.6 use_static_libs=$prefer_static_libs
2598     if test "$use_static_libs" = built && test "$installed" = yes ; then
2599     use_static_libs=no
2600     fi
2601 aono 1.5 if test -n "$library_names" &&
2602 aonoto 1.6 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2603 hiroo 1.2 if test "$installed" = no; then
2604     notinst_deplibs="$notinst_deplibs $lib"
2605     need_relink=yes
2606     fi
2607 aono 1.5 # This is a shared library
2608 aonoto 1.6
2609     # Warn about portability, can't link against -module's on
2610     # some systems (darwin)
2611     if test "$shouldnotlink" = yes && test "$pass" = link ; then
2612 aono 1.5 $echo
2613     if test "$linkmode" = prog; then
2614     $echo "*** Warning: Linking the executable $output against the loadable module"
2615     else
2616     $echo "*** Warning: Linking the shared library $output against the loadable module"
2617     fi
2618 aonoto 1.6 $echo "*** $linklib is not portable!"
2619     fi
2620 aono 1.5 if test "$linkmode" = lib &&
2621     test "$hardcode_into_libs" = yes; then
2622     # Hardcode the library path.
2623     # Skip directories that are in the system default run-time
2624     # search path.
2625     case " $sys_lib_dlsearch_path " in
2626     *" $absdir "*) ;;
2627     *)
2628     case "$compile_rpath " in
2629     *" $absdir "*) ;;
2630     *) compile_rpath="$compile_rpath $absdir"
2631     esac
2632     ;;
2633     esac
2634     case " $sys_lib_dlsearch_path " in
2635     *" $libdir "*) ;;
2636     *)
2637     case "$finalize_rpath " in
2638     *" $libdir "*) ;;
2639     *) finalize_rpath="$finalize_rpath $libdir"
2640     esac
2641     ;;
2642     esac
2643     fi
2644 hiroo 1.2
2645     if test -n "$old_archive_from_expsyms_cmds"; then
2646     # figure out the soname
2647     set dummy $library_names
2648     realname="$2"
2649     shift; shift
2650     libname=`eval \\$echo \"$libname_spec\"`
2651     # use dlname if we got it. it's perfectly good, no?
2652     if test -n "$dlname"; then
2653     soname="$dlname"
2654     elif test -n "$soname_spec"; then
2655     # bleh windows
2656     case $host in
2657 aono 1.5 *cygwin* | mingw*)
2658 hiroo 1.2 major=`expr $current - $age`
2659     versuffix="-$major"
2660 ura 1.1 ;;
2661     esac
2662 hiroo 1.2 eval soname=\"$soname_spec\"
2663     else
2664     soname="$realname"
2665     fi
2666    
2667     # Make a new name for the extract_expsyms_cmds to use
2668     soroot="$soname"
2669 aono 1.5 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2670     newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2671 hiroo 1.2
2672     # If the library has no export list, then create one now
2673     if test -f "$output_objdir/$soname-def"; then :
2674     else
2675     $show "extracting exported symbol list from \`$soname'"
2676 aono 1.5 save_ifs="$IFS"; IFS='~'
2677 aonoto 1.6 cmds=$extract_expsyms_cmds
2678 hiroo 1.2 for cmd in $cmds; do
2679     IFS="$save_ifs"
2680 aonoto 1.6 eval cmd=\"$cmd\"
2681 hiroo 1.2 $show "$cmd"
2682     $run eval "$cmd" || exit $?
2683     done
2684     IFS="$save_ifs"
2685     fi
2686    
2687     # Create $newlib
2688     if test -f "$output_objdir/$newlib"; then :; else
2689     $show "generating import library for \`$soname'"
2690 aono 1.5 save_ifs="$IFS"; IFS='~'
2691 aonoto 1.6 cmds=$old_archive_from_expsyms_cmds
2692 hiroo 1.2 for cmd in $cmds; do
2693     IFS="$save_ifs"
2694 aonoto 1.6 eval cmd=\"$cmd\"
2695 hiroo 1.2 $show "$cmd"
2696     $run eval "$cmd" || exit $?
2697     done
2698     IFS="$save_ifs"
2699     fi
2700     # make sure the library variables are pointing to the new library
2701     dir=$output_objdir
2702     linklib=$newlib
2703 aono 1.5 fi # test -n "$old_archive_from_expsyms_cmds"
2704 hiroo 1.2
2705 aono 1.5 if test "$linkmode" = prog || test "$mode" != relink; then
2706 hiroo 1.2 add_shlibpath=
2707     add_dir=
2708     add=
2709     lib_linked=yes
2710     case $hardcode_action in
2711     immediate | unsupported)
2712     if test "$hardcode_direct" = no; then
2713     add="$dir