root/tags/gdal_1_3_2/ltmain.sh

Revision 5876, 178.5 kB (checked in by aamici, 5 years ago)

BEWARE!
this fixes bug 499 on i686-pc-linux-gnu (--disable-static). the aix
bug might be solved as well.

REMEMBER TO ADD THIS HACK BACK on libtool updates (unless upstream fixes
the problem).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
3 #
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5 # Free Software Foundation, Inc.
6 # 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 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 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 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29   # Discard the --no-reexec flag, and continue.
30   shift
31 elif test "X$1" = X--fallback-echo; then
32   # Avoid inline document here, it may be left over
33   :
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35   # Yippee, $echo works!
36   :
37 else
38   # Restart under the correct shell, and then maybe $echo will work.
39   exec $SHELL "$0" --no-reexec ${1+"$@"}
40 fi
41
42 if test "X$1" = X--fallback-echo; then
43   # used as fallback echo
44   shift
45   cat <<EOF
46 $*
47 EOF
48   exit 0
49 fi
50
51 # The name of this program.
52 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53 modename="$progname"
54
55 # Constants.
56 PROGRAM=ltmain.sh
57 PACKAGE=libtool
58 VERSION=1.5.2
59 TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08) Debian$Rev: 192 $"
60
61 default_mode=
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
64 mkdir="mkdir"
65 mv="mv -f"
66 rm="rm -f"
67
68 # Sed substitution that helps us do robust quoting.  It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed="${SED}"' -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 # test EBCDIC or ASCII
73 case `echo A|tr A '\301'` in
74  A) # EBCDIC based system
75   SP2NL="tr '\100' '\n'"
76   NL2SP="tr '\r\n' '\100\100'"
77   ;;
78  *) # Assume ASCII based system
79   SP2NL="tr '\040' '\012'"
80   NL2SP="tr '\015\012' '\040\040'"
81   ;;
82 esac
83
84 # NLS nuisances.
85 # Only set LANG and LC_ALL to C if already set.
86 # These must not be set unconditionally because not all systems understand
87 # e.g. LANG=C (notably SCO).
88 # We save the old values to restore during execute mode.
89 if test "${LC_ALL+set}" = set; then
90   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
91 fi
92 if test "${LANG+set}" = set; then
93   save_LANG="$LANG"; LANG=C; export LANG
94 fi
95
96 # Make sure IFS has a sensible default
97 : ${IFS="      
98 "}
99
100 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
101   $echo "$modename: not configured to build any kind of library" 1>&2
102   $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
103   exit 1
104 fi
105
106 # Global variables.
107 mode=$default_mode
108 nonopt=
109 prev=
110 prevopt=
111 run=
112 show="$echo"
113 show_help=
114 execute_dlfiles=
115 lo2o="s/\\.lo\$/.${objext}/"
116 o2lo="s/\\.${objext}\$/.lo/"
117
118 #####################################
119 # Shell function definitions:
120 # This seems to be the best place for them
121
122 # Need a lot of goo to handle *both* DLLs and import libs
123 # Has to be a shell function in order to 'eat' the argument
124 # that is supplied when $file_magic_command is called.
125 win32_libid () {
126   win32_libid_type="unknown"
127   win32_fileres=`file -L $1 2>/dev/null`
128   case $win32_fileres in
129   *ar\ archive\ import\ library*) # definitely import
130     win32_libid_type="x86 archive import"
131     ;;
132   *ar\ archive*) # could be an import, or static
133     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
134       grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
135       win32_nmres=`eval $NM -f posix -A $1 | \
136         sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
137       if test "X$win32_nmres" = "Ximport" ; then
138         win32_libid_type="x86 archive import"
139       else
140         win32_libid_type="x86 archive static"
141       fi
142     fi
143     ;;
144   *DLL*)
145     win32_libid_type="x86 DLL"
146     ;;
147   *executable*) # but shell scripts are "executable" too...
148     case $win32_fileres in
149     *MS\ Windows\ PE\ Intel*)
150       win32_libid_type="x86 DLL"
151       ;;
152     esac
153     ;;
154   esac
155   $echo $win32_libid_type
156 }
157
158 # End of Shell function definitions
159 #####################################
160
161 # Parse our command line options once, thoroughly.
162 while test "$#" -gt 0
163 do
164   arg="$1"
165   shift
166
167   case $arg in
168   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
169   *) optarg= ;;
170   esac
171
172   # If the previous option needs an argument, assign it.
173   if test -n "$prev"; then
174     case $prev in
175     execute_dlfiles)
176       execute_dlfiles="$execute_dlfiles $arg"
177       ;;
178     tag)
179       tagname="$arg"
180       preserve_args="${preserve_args}=$arg"
181
182       # Check whether tagname contains only valid characters
183       case $tagname in
184       *[!-_A-Za-z0-9,/]*)
185         $echo "$progname: invalid tag name: $tagname" 1>&2
186         exit 1
187         ;;
188       esac
189
190       case $tagname in
191       CC)
192         # Don't test for the "default" C tag, as we know, it's there, but
193         # not specially marked.
194         ;;
195       *)
196         if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
197           taglist="$taglist $tagname"
198           # Evaluate the configuration.
199           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
200         else
201           $echo "$progname: ignoring unknown tag $tagname" 1>&2
202         fi
203         ;;
204       esac
205       ;;
206     *)
207       eval "$prev=\$arg"
208       ;;
209     esac
210
211     prev=
212     prevopt=
213     continue
214   fi
215
216   # Have we seen a non-optional argument yet?
217   case $arg in
218   --help)
219     show_help=yes
220     ;;
221
222   --version)
223     $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
224     $echo
225     $echo "Copyright (C) 2003  Free Software Foundation, Inc."
226     $echo "This is free software; see the source for copying conditions.  There is NO"
227     $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
228     exit 0
229     ;;
230
231   --config)
232     ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
233     # Now print the configurations for the tags.
234     for tagname in $taglist; do
235       ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
236     done
237     exit 0
238     ;;
239
240   --debug)
241     $echo "$progname: enabling shell trace mode"
242     set -x
243     preserve_args="$preserve_args $arg"
244     ;;
245
246   --dry-run | -n)
247     run=:
248     ;;
249
250   --features)
251     $echo "host: $host"
252     if test "$build_libtool_libs" = yes; then
253       $echo "enable shared libraries"
254     else
255       $echo "disable shared libraries"
256     fi
257     if test "$build_old_libs" = yes; then
258       $echo "enable static libraries"
259     else
260       $echo "disable static libraries"
261     fi
262     exit 0
263     ;;
264
265   --finish) mode="finish" ;;
266
267   --mode) prevopt="--mode" prev=mode ;;
268   --mode=*) mode="$optarg" ;;
269
270   --preserve-dup-deps) duplicate_deps="yes" ;;
271
272   --quiet | --silent)
273     show=:
274     preserve_args="$preserve_args $arg"
275     ;;
276
277   --tag) prevopt="--tag" prev=tag ;;
278   --tag=*)
279     set tag "$optarg" ${1+"$@"}
280     shift
281     prev=tag
282     preserve_args="$preserve_args --tag"
283     ;;
284
285   -dlopen)
286     prevopt="-dlopen"
287     prev=execute_dlfiles
288     ;;
289
290   -*)
291     $echo "$modename: unrecognized option \`$arg'" 1>&2
292     $echo "$help" 1>&2
293     exit 1
294     ;;
295
296   *)
297     nonopt="$arg"
298     break
299     ;;
300   esac
301 done
302
303 if test -n "$prevopt"; then
304   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
305   $echo "$help" 1>&2
306   exit 1
307 fi
308
309 # If this variable is set in any of the actions, the command in it
310 # will be execed at the end.  This prevents here-documents from being
311 # left over by shells.
312 exec_cmd=
313
314 if test -z "$show_help"; then
315
316   # Infer the operation mode.
317   if test -z "$mode"; then
318     $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
319     $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
320     case $nonopt in
321     *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
322       mode=link
323       for arg
324       do
325         case $arg in
326         -c)
327            mode=compile
328            break
329            ;;
330         esac
331       done
332       ;;
333     *db | *dbx | *strace | *truss)
334       mode=execute
335       ;;
336     *install*|cp|mv)
337       mode=install
338       ;;
339     *rm)
340       mode=uninstall
341       ;;
342     *)
343       # If we have no mode, but dlfiles were specified, then do execute mode.
344       test -n "$execute_dlfiles" && mode=execute
345
346       # Just use the default operation mode.
347       if test -z "$mode"; then
348         if test -n "$nonopt"; then
349           $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
350         else
351           $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
352         fi
353       fi
354       ;;
355     esac
356   fi
357
358   # Only execute mode is allowed to have -dlopen flags.
359   if test -n "$execute_dlfiles" && test "$mode" != execute; then
360     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
361     $echo "$help" 1>&2
362     exit 1
363   fi
364
365   # Change the help message to a mode-specific one.
366   generic_help="$help"
367   help="Try \`$modename --help --mode=$mode' for more information."
368
369   # These modes are in order of execution frequency so that they run quickly.
370   case $mode in
371   # libtool compile mode
372   compile)
373     modename="$modename: compile"
374     # Get the compilation command and the source file.
375     base_compile=
376     srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
377     suppress_opt=yes
378     suppress_output=
379     arg_mode=normal
380     libobj=
381     later=
382
383     for arg
384     do
385       case "$arg_mode" in
386       arg  )
387         # do not "continue".  Instead, add this to base_compile
388         lastarg="$arg"
389         arg_mode=normal
390         ;;
391
392       target )
393         libobj="$arg"
394         arg_mode=normal
395         continue
396         ;;
397
398       normal )
399         # Accept any command-line options.
400         case $arg in
401         -o)
402           if test -n "$libobj" ; then
403             $echo "$modename: you cannot specify \`-o' more than once" 1>&2
404             exit 1
405           fi
406           arg_mode=target
407           continue
408           ;;
409
410         -static | -prefer-pic | -prefer-non-pic)
411           later="$later $arg"
412           continue
413           ;;
414
415         -no-suppress)
416           suppress_opt=no
417           continue
418           ;;
419
420         -Xcompiler)
421           arg_mode=arg  #  the next one goes into the "base_compile" arg list
422           continue      #  The current "srcfile" will either be retained or
423           ;;            #  replaced later.  I would guess that would be a bug.
424
425         -Wc,*)
426           args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
427           lastarg=
428           save_ifs="$IFS"; IFS=','
429           for arg in $args; do
430             IFS="$save_ifs"
431
432             # Double-quote args containing other shell metacharacters.
433             # Many Bourne shells cannot handle close brackets correctly
434             # in scan sets, so we specify it separately.
435             case $arg in
436               *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
437               arg="\"$arg\""
438               ;;
439             esac
440             lastarg="$lastarg $arg"
441           done
442           IFS="$save_ifs"
443           lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
444
445           # Add the arguments to base_compile.
446           base_compile="$base_compile $lastarg"
447           continue
448           ;;
449
450         * )
451           # Accept the current argument as the source file.
452           # The previous "srcfile" becomes the current argument.
453           #
454           lastarg="$srcfile"
455           srcfile="$arg"
456           ;;
457         esac  #  case $arg
458         ;;
459       esac    #  case $arg_mode
460
461       # Aesthetically quote the previous argument.
462       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
463
464       case $lastarg in
465       # Double-quote args containing other shell metacharacters.
466       # Many Bourne shells cannot handle close brackets correctly
467       # in scan sets, so we specify it separately.
468       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
469         lastarg="\"$lastarg\""
470         ;;
471       esac
472
473       base_compile="$base_compile $lastarg"
474     done # for arg
475
476     case $arg_mode in
477     arg)
478       $echo "$modename: you must specify an argument for -Xcompile"
479       exit 1
480       ;;
481     target)
482       $echo "$modename: you must specify a target with \`-o'" 1>&2
483       exit 1
484       ;;
485     *)
486       # Get the name of the library object.
487       [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
488       ;;
489     esac
490
491     # Recognize several different file suffixes.
492     # If the user specifies -o file.o, it is replaced with file.lo
493     xform='[cCFSifmso]'
494     case $libobj in
495     *.ada) xform=ada ;;
496     *.adb) xform=adb ;;
497     *.ads) xform=ads ;;
498     *.asm) xform=asm ;;
499     *.c++) xform=c++ ;;
500     *.cc) xform=cc ;;
501     *.ii) xform=ii ;;
502     *.class) xform=class ;;
503     *.cpp) xform=cpp ;;
504     *.cxx) xform=cxx ;;
505     *.f90) xform=f90 ;;
506     *.for) xform=for ;;
507     *.java) xform=java ;;
508     esac
509
510     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
511
512     case $libobj in
513     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
514     *)
515       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
516       exit 1
517       ;;
518     esac
519
520     # Infer tagged configuration to use if any are available and
521     # if one wasn't chosen via the "--tag" command line option.
522     # Only attempt this if the compiler in the base compile
523     # command doesn't match the default compiler.
524     if test -n "$available_tags" && test -z "$tagname"; then
525       case $base_compile in
526       # Blanks in the command may have been stripped by the calling shell,
527       # but not from the CC environment variable when configure was run.
528       " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
529       # Blanks at the start of $base_compile will cause this to fail
530       # if we don't check for them as well.
531       *)
532         for z in $available_tags; do
533           if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
534             # Evaluate the configuration.
535             eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
536             case "$base_compile " in
537             "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
538               # The compiler in the base compile command matches
539               # the one in the tagged configuration.
540               # Assume this is the tagged configuration we want.
541               tagname=$z
542               break
543               ;;
544             esac
545           fi
546         done
547         # If $tagname still isn't set, then no tagged configuration
548         # was found and let the user know that the "--tag" command
549         # line option must be used.
550         if test -z "$tagname"; then
551           $echo "$modename: unable to infer tagged configuration"
552           $echo "$modename: specify a tag with \`--tag'" 1>&2
553           exit 1
554 #        else
555 #          $echo "$modename: using $tagname tagged configuration"
556         fi
557         ;;
558       esac
559     fi
560
561     for arg in $later; do
562       case $arg in
563       -static)
564         build_old_libs=yes
565         continue
566         ;;
567
568       -prefer-pic)
569         pic_mode=yes
570         continue
571         ;;
572
573       -prefer-non-pic)
574         pic_mode=no
575         continue
576         ;;
577       esac
578     done
579
580     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
581     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
582     if test "X$xdir" = "X$obj"; then
583       xdir=
584     else
585       xdir=$xdir/
586     fi
587     lobj=${xdir}$objdir/$objname
588
589     if test -z "$base_compile"; then
590       $echo "$modename: you must specify a compilation command" 1>&2
591       $echo "$help" 1>&2
592       exit 1
593     fi
594
595     # Delete any leftover library objects.
596     if test "$build_old_libs" = yes; then
597       removelist="$obj $lobj $libobj ${libobj}T"
598     else
599       removelist="$lobj $libobj ${libobj}T"
600     fi
601
602     $run $rm $removelist
603     trap "$run $rm $removelist; exit 1" 1 2 15
604
605     # On Cygwin there's no "real" PIC flag so we must build both object types
606     case $host_os in
607     cygwin* | mingw* | pw32* | os2*)
608       pic_mode=default
609       ;;
610     esac
611     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
612       # non-PIC code in shared libraries is not supported
613       pic_mode=default
614     fi
615
616     # Calculate the filename of the output object if compiler does
617     # not support -o with -c
618     if test "$compiler_c_o" = no; then
619       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
620       lockfile="$output_obj.lock"
621       removelist="$removelist $output_obj $lockfile"
622       trap "$run $rm $removelist; exit 1" 1 2 15
623     else
624       output_obj=
625       need_locks=no
626       lockfile=
627     fi
628
629     # Lock this critical section if it is needed
630     # We use this script file to make the link, it avoids creating a new file
631     if test "$need_locks" = yes; then
632       until $run ln "$0" "$lockfile" 2>/dev/null; do
633         $show "Waiting for $lockfile to be removed"
634         sleep 2
635       done
636     elif test "$need_locks" = warn; then
637       if test -f "$lockfile"; then
638         $echo "\
639 *** ERROR, $lockfile exists and contains:
640 `cat $lockfile 2>/dev/null`
641
642 This indicates that another process is trying to use the same
643 temporary object file, and libtool could not work around it because
644 your compiler does not support \`-c' and \`-o' together.  If you
645 repeat this compilation, it may succeed, by chance, but you had better
646 avoid parallel builds (make -j) in this platform, or get a better
647 compiler."
648
649         $run $rm $removelist
650         exit 1
651       fi
652       $echo $srcfile > "$lockfile"
653     fi
654
655     if test -n "$fix_srcfile_path"; then
656       eval srcfile=\"$fix_srcfile_path\"
657     fi
658
659     $run $rm "$libobj" "${libobj}T"
660
661     # Create a libtool object file (analogous to a ".la" file),
662     # but don't create it if we're doing a dry run.
663     test -z "$run" && cat > ${libobj}T <<EOF
664 # $libobj - a libtool object file
665 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
666 #
667 # Please DO NOT delete this file!
668 # It is necessary for linking the library.
669
670 # Name of the PIC object.
671 EOF
672
673     # Only build a PIC object if we are building libtool libraries.
674     if test "$build_libtool_libs" = yes; then
675       # Without this assignment, base_compile gets emptied.
676       fbsd_hideous_sh_bug=$base_compile
677
678       if test "$pic_mode" != no; then
679         command="$base_compile $srcfile $pic_flag"
680       else
681         # Don't build PIC code
682         command="$base_compile $srcfile"
683       fi
684
685       if test ! -d "${xdir}$objdir"; then
686         $show "$mkdir ${xdir}$objdir"
687         $run $mkdir ${xdir}$objdir
688         status=$?
689         if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
690           exit $status
691         fi
692       fi
693
694       if test -z "$output_obj"; then
695         # Place PIC objects in $objdir
696         command="$command -o $lobj"
697       fi
698
699       $run $rm "$lobj" "$output_obj"
700
701       $show "$command"
702       if $run eval "$command"; then :
703       else
704         test -n "$output_obj" && $run $rm $removelist
705         exit 1
706       fi
707
708       if test "$need_locks" = warn &&
709          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
710         $echo "\
711 *** ERROR, $lockfile contains:
712 `cat $lockfile 2>/dev/null`
713
714 but it should contain:
715 $srcfile
716
717 This indicates that another process is trying to use the same
718 temporary object file, and libtool could not work around it because
719 your compiler does not support \`-c' and \`-o' together.  If you
720 repeat this compilation, it may succeed, by chance, but you had better
721 avoid parallel builds (make -j) in this platform, or get a better
722 compiler."
723
724         $run $rm $removelist
725         exit 1
726       fi
727
728       # Just move the object if needed, then go on to compile the next one
729       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
730         $show "$mv $output_obj $lobj"
731         if $run $mv $output_obj $lobj; then :
732         else
733           error=$?
734           $run $rm $removelist
735           exit $error
736         fi
737       fi
738
739       # Append the name of the PIC object to the libtool object file.
740       test -z "$run" && cat >> ${libobj}T <<EOF
741 pic_object='$objdir/$objname'
742
743 EOF
744
745       # Allow error messages only from the first compilation.
746       if test "$suppress_opt" = yes; then
747         suppress_output=' >/dev/null 2>&1'
748       fi
749     else
750       # No PIC object so indicate it doesn't exist in the libtool
751       # object file.
752       test -z "$run" && cat >> ${libobj}T <<EOF
753 pic_object=none
754
755 EOF
756     fi
757
758     # Only build a position-dependent object if we build old libraries.
759     if test "$build_old_libs" = yes; then
760       if test "$pic_mode" != yes; then
761         # Don't build PIC code
762         command="$base_compile $srcfile"
763       else
764         command="$base_compile $srcfile $pic_flag"
765       fi
766       if test "$compiler_c_o" = yes; then
767         command="$command -o $obj"
768       fi
769
770       # Suppress compiler output if we already did a PIC compilation.
771       command="$command$suppress_output"
772       $run $rm "$obj" "$output_obj"
773       $show "$command"
774       if $run eval "$command"; then :
775       else
776         $run $rm $removelist
777         exit 1
778       fi
779
780       if test "$need_locks" = warn &&
781          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
782         $echo "\
783 *** ERROR, $lockfile contains:
784 `cat $lockfile 2>/dev/null`
785
786 but it should contain:
787 $srcfile
788
789 This indicates that another process is trying to use the same
790 temporary object file, and libtool could not work around it because
791 your compiler does not support \`-c' and \`-o' together.  If you
792 repeat this compilation, it may succeed, by chance, but you had better
793 avoid parallel builds (make -j) in this platform, or get a better
794 compiler."
795
796         $run $rm $removelist
797         exit 1
798       fi
799
800       # Just move the object if needed
801       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
802         $show "$mv $output_obj $obj"
803         if $run $mv $output_obj $obj; then :
804         else
805           error=$?
806           $run $rm $removelist
807           exit $error
808         fi
809       fi
810
811       # Append the name of the non-PIC object the libtool object file.
812       # Only append if the libtool object file exists.
813       test -z "$run" && cat >> ${libobj}T <<EOF
814 # Name of the non-PIC object.
815 non_pic_object='$objname'
816
817 EOF
818     else
819       # Append the name of the non-PIC object the libtool object file.
820       # Only append if the libtool object file exists.
821       test -z "$run" && cat >> ${libobj}T <<EOF
822 # Name of the non-PIC object.
823 non_pic_object=none
824
825 EOF
826       $show " cp $lobj $obj"
827       $run cp $lobj $obj
828     fi
829
830     $run $mv "${libobj}T" "${libobj}"
831
832     # Unlock the critical section if it was locked
833     if test "$need_locks" != no; then
834       $run $rm "$lockfile"
835     fi
836
837     exit 0
838     ;;
839
840   # libtool link mode
841   link | relink)
842     modename="$modename: link"
843     case $host in
844     *-*-cygwin* | *-*-