~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

1 by Camm Maguire
C_GC_OFFSET is 2 on m68k-linux
1
# ltmain.sh - Provide generalized library-building support services.
2
# NOTE: Changing this file will not affect anything until you rerun ltconfig.
3
#
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
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.4a-GCC3.0
59
TIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)"
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
SP2NL='tr \040 \012'
73
NL2SP='tr \015\012 \040\040'
74
75
# NLS nuisances.
76
# Only set LANG and LC_ALL to C if already set.
77
# These must not be set unconditionally because not all systems understand
78
# e.g. LANG=C (notably SCO).
79
# We save the old values to restore during execute mode.
80
if test "${LC_ALL+set}" = set; then
81
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
82
fi
83
if test "${LANG+set}" = set; then
84
  save_LANG="$LANG"; LANG=C; export LANG
85
fi
86
87
if test "$LTCONFIG_VERSION" != "$VERSION"; then
88
  echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
89
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
90
  exit 1
91
fi
92
93
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
94
  echo "$modename: not configured to build any kind of library" 1>&2
95
  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
96
  exit 1
97
fi
98
99
# Global variables.
100
mode=$default_mode
101
nonopt=
102
prev=
103
prevopt=
104
run=
105
show="$echo"
106
show_help=
107
execute_dlfiles=
108
lo2o="s/\\.lo\$/.${objext}/"
109
o2lo="s/\\.${objext}\$/.lo/"
110
taglist=
111
112
# Parse our command line options once, thoroughly.
113
while test $# -gt 0
114
do
115
  arg="$1"
116
  shift
117
118
  case $arg in
119
  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
120
  *) optarg= ;;
121
  esac
122
123
  # If the previous option needs an argument, assign it.
124
  if test -n "$prev"; then
125
    case $prev in
126
    execute_dlfiles)
127
      execute_dlfiles="$execute_dlfiles $arg"
128
      ;;
129
    tag)
130
      tagname="$arg"
131
132
      # Check whether tagname contains only valid characters
133
      case $tagname in
134
      *[!-_A-Za-z0-9,/]*)
135
	echo "$progname: invalid tag name: $tagname" 1>&2
136
	exit 1
137
        ;;
138
      esac
139
140
      case $tagname in
141
      CC)
142
	# Don't test for the "default" C tag, as we know, it's there, but
143
	# not specially marked.
144
	taglist="$taglist $tagname"
145
	;;
146
      *)
147
        if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
148
          taglist="$taglist $tagname"
149
	  # Evaluate the configuration.
150
	  eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
151
        else
152
	  echo "$progname: ignoring unknown tag $tagname" 1>&2
153
        fi
154
        ;;
155
      esac
156
      ;;
157
    *)
158
      eval "$prev=\$arg"
159
      ;;
160
    esac
161
162
    prev=
163
    prevopt=
164
    continue
165
  fi
166
167
  # Have we seen a non-optional argument yet?
168
  case $arg in
169
  --help)
170
    show_help=yes
171
    ;;
172
173
  --version)
174
    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
175
    exit 0
176
    ;;
177
178
  --config)
179
    sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0"
180
    # Now print the configurations for the tags.
181
    for tagname in $taglist; do
182
      sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
183
    done
184
    exit 0
185
    ;;
186
187
  --debug)
188
    echo "$progname: enabling shell trace mode"
189
    set -x
190
    ;;
191
192
  --dry-run | -n)
193
    run=:
194
    ;;
195
196
  --features)
197
    echo "host: $host"
198
    if test "$build_libtool_libs" = yes; then
199
      echo "enable shared libraries"
200
    else
201
      echo "disable shared libraries"
202
    fi
203
    if test "$build_old_libs" = yes; then
204
      echo "enable static libraries"
205
    else
206
      echo "disable static libraries"
207
    fi
208
    exit 0
209
    ;;
210
211
  --finish) mode="finish" ;;
212
213
  --mode) prevopt="--mode" prev=mode ;;
214
  --mode=*) mode="$optarg" ;;
215
216
  --quiet | --silent)
217
    show=:
218
    ;;
219
220
  --tag) prevopt="--tag" prev=tag ;;
221
  --tag=*)
222
    set tag "$optarg" ${1+"$@"}
223
    shift
224
    prev=tag
225
    ;;
226
227
  -dlopen)
228
    prevopt="-dlopen"
229
    prev=execute_dlfiles
230
    ;;
231
232
  -*)
233
    $echo "$modename: unrecognized option \`$arg'" 1>&2
234
    $echo "$help" 1>&2
235
    exit 1
236
    ;;
237
238
  *)
239
    nonopt="$arg"
240
    break
241
    ;;
242
  esac
243
done
244
245
if test -n "$prevopt"; then
246
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
247
  $echo "$help" 1>&2
248
  exit 1
249
fi
250
251
# If this variable is set in any of the actions, the command in it
252
# will be execed at the end.  This prevents here-documents from being
253
# left over by shells.
254
exec_cmd=
255
256
if test -z "$show_help"; then
257
258
  # Infer the operation mode.
259
  if test -z "$mode"; then
260
    case $nonopt in
261
    *cc | *++ | gcc* | *-gcc*)
262
      mode=link
263
      for arg
264
      do
265
	case $arg in
266
	-c)
267
	   mode=compile
268
	   break
269
	   ;;
270
	esac
271
      done
272
      ;;
273
    *db | *dbx | *strace | *truss)
274
      mode=execute
275
      ;;
276
    *install*|cp|mv)
277
      mode=install
278
      ;;
279
    *rm)
280
      mode=uninstall
281
      ;;
282
    *)
283
      # If we have no mode, but dlfiles were specified, then do execute mode.
284
      test -n "$execute_dlfiles" && mode=execute
285
286
      # Just use the default operation mode.
287
      if test -z "$mode"; then
288
	if test -n "$nonopt"; then
289
	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
290
	else
291
	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
292
	fi
293
      fi
294
      ;;
295
    esac
296
  fi
297
298
  # Only execute mode is allowed to have -dlopen flags.
299
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
300
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
301
    $echo "$help" 1>&2
302
    exit 1
303
  fi
304
305
  # Change the help message to a mode-specific one.
306
  generic_help="$help"
307
  help="Try \`$modename --help --mode=$mode' for more information."
308
309
  # These modes are in order of execution frequency so that they run quickly.
310
  case $mode in
311
  # libtool compile mode
312
  compile)
313
    modename="$modename: compile"
314
    # Get the compilation command and the source file.
315
    base_compile=
316
    prev=
317
    lastarg=
318
    srcfile="$nonopt"
319
    suppress_output=
320
321
    user_target=no
322
    for arg
323
    do
324
      case $prev in
325
      "") ;;
326
      xcompiler)
327
	# Aesthetically quote the previous argument.
328
	prev=
329
	lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
330
331
	case $arg in
332
	# Double-quote args containing other shell metacharacters.
333
	# Many Bourne shells cannot handle close brackets correctly
334
	# in scan sets, so we specify it separately.
335
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
336
	  arg="\"$arg\""
337
	  ;;
338
	esac
339
340
	# Add the previous argument to base_compile.
341
	if test -z "$base_compile"; then
342
	  base_compile="$lastarg"
343
	else
344
	  base_compile="$base_compile $lastarg"
345
	fi
346
	continue
347
	;;
348
      esac
349
350
      # Accept any command-line options.
351
      case $arg in
352
      -o)
353
	if test "$user_target" != "no"; then
354
	  $echo "$modename: you cannot specify \`-o' more than once" 1>&2
355
	  exit 1
356
	fi
357
	user_target=next
358
	;;
359
360
      -static)
361
	build_old_libs=yes
362
	continue
363
	;;
364
365
      -prefer-pic)
366
	pic_mode=yes
367
	continue
368
	;;
369
370
      -prefer-non-pic)
371
	pic_mode=no
372
	continue
373
	;;
374
375
      -Xcompiler)
376
	prev=xcompiler
377
	continue
378
	;;
379
380
      -Wc,*)
381
	args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
382
	lastarg=
383
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=','
384
	for arg in $args; do
385
	  IFS="$save_ifs"
386
387
	  # Double-quote args containing other shell metacharacters.
388
	  # Many Bourne shells cannot handle close brackets correctly
389
	  # in scan sets, so we specify it separately.
390
	  case $arg in
391
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
392
	    arg="\"$arg\""
393
	    ;;
394
	  esac
395
	  lastarg="$lastarg $arg"
396
	done
397
	IFS="$save_ifs"
398
	lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
399
400
	# Add the arguments to base_compile.
401
	if test -z "$base_compile"; then
402
	  base_compile="$lastarg"
403
	else
404
	  base_compile="$base_compile $lastarg"
405
	fi
406
	continue
407
	;;
408
      esac
409
410
      case $user_target in
411
      next)
412
	# The next one is the -o target name
413
	user_target=yes
414
	continue
415
	;;
416
      yes)
417
	# We got the output file
418
	user_target=set
419
	libobj="$arg"
420
	continue
421
	;;
422
      esac
423
424
      # Accept the current argument as the source file.
425
      lastarg="$srcfile"
426
      srcfile="$arg"
427
428
      # Aesthetically quote the previous argument.
429
430
      # Backslashify any backslashes, double quotes, and dollar signs.
431
      # These are the only characters that are still specially
432
      # interpreted inside of double-quoted scrings.
433
      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
434
435
      # Double-quote args containing other shell metacharacters.
436
      # Many Bourne shells cannot handle close brackets correctly
437
      # in scan sets, so we specify it separately.
438
      case $lastarg in
439
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
440
	lastarg="\"$lastarg\""
441
	;;
442
      esac
443
444
      # Add the previous argument to base_compile.
445
      if test -z "$base_compile"; then
446
	base_compile="$lastarg"
447
      else
448
	base_compile="$base_compile $lastarg"
449
      fi
450
    done
451
452
    case $user_target in
453
    set)
454
      ;;
455
    no)
456
      # Get the name of the library object.
457
      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
458
      ;;
459
    *)
460
      $echo "$modename: you must specify a target with \`-o'" 1>&2
461
      exit 1
462
      ;;
463
    esac
464
465
    # Recognize several different file suffixes.
466
    # If the user specifies -o file.o, it is replaced with file.lo
467
    xform='[cCFSfmso]'
468
    case $libobj in
469
    *.ada) xform=ada ;;
470
    *.adb) xform=adb ;;
471
    *.ads) xform=ads ;;
472
    *.asm) xform=asm ;;
473
    *.c++) xform=c++ ;;
474
    *.cc) xform=cc ;;
475
    *.class) xform=class ;;
476
    *.cpp) xform=cpp ;;
477
    *.cxx) xform=cxx ;;
478
    *.f90) xform=f90 ;;
479
    *.for) xform=for ;;
480
    *.java) xform=java ;;
481
    esac
482
483
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
484
485
    case $libobj in
486
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
487
    *)
488
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
489
      exit 1
490
      ;;
491
    esac
492
493
    # Infer tagged configuration to use if any are available and
494
    # if one wasn't chosen via the "--tag" command line option.
495
    # Only attempt this if the compiler in the base compile
496
    # command doesn't match the default compiler.
497
    if test -n "$available_tags" && test -z "$tagname"; then
498
      case $base_compile in
499
      "$CC "*) ;;
500
      # Blanks in the command may have been stripped by the calling shell,
501
      # but not from the CC environment variable when ltconfig was run.
502
      "`$echo $CC` "*) ;;
503
      *)
504
        for z in $available_tags; do
505
          if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
506
	    # Evaluate the configuration.
507
	    eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
508
            case $base_compile in
509
	    "$CC "*)
510
              # The compiler in the base compile command matches
511
              # the one in the tagged configuration.
512
              # Assume this is the tagged configuration we want.
513
              tagname=$z
514
              break
515
              ;;
516
	    "`$echo $CC` "*)
517
	      tagname=$z
518
	      break
519
	      ;;
520
	    esac
521
          fi
522
        done
523
        # If $tagname still isn't set, then no tagged configuration
524
        # was found and let the user know that the "--tag" command
525
        # line option must be used.
526
        if test -z "$tagname"; then
527
          echo "$modename: unable to infer tagged configuration"
528
          echo "$modename: specify a tag with \`--tag'" 1>&2
529
	  exit 1
530
#        else
531
#          echo "$modename: using $tagname tagged configuration"
532
        fi
533
	;;
534
      esac
535
    fi
536
537
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
538
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
539
    if test "X$xdir" = "X$obj"; then
540
      xdir=
541
    else
542
      xdir=$xdir/
543
    fi
544
    lobj=${xdir}$objdir/$objname
545
546
    if test -z "$base_compile"; then
547
      $echo "$modename: you must specify a compilation command" 1>&2
548
      $echo "$help" 1>&2
549
      exit 1
550
    fi
551
552
    # Delete any leftover library objects.
553
    if test "$build_old_libs" = yes; then
554
      removelist="$obj $lobj $libobj ${libobj}T"
555
    else
556
      removelist="$lobj $libobj ${libobj}T"
557
    fi
558
559
    $run $rm $removelist
560
    trap "$run $rm $removelist; exit 1" 1 2 15
561
562
    # On Cygwin there's no "real" PIC flag so we must build both object types
563
    case $host_os in
564
    cygwin* | mingw* | pw32* | os2*)
565
      pic_mode=default
566
      ;;
567
    esac
568
    if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
569
      # non-PIC code in shared libraries is not supported
570
      pic_mode=default
571
    fi
572
573
    # Calculate the filename of the output object if compiler does
574
    # not support -o with -c
575
    if test "$compiler_c_o" = no; then
576
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
577
      lockfile="$output_obj.lock"
578
      removelist="$removelist $output_obj $lockfile"
579
      trap "$run $rm $removelist; exit 1" 1 2 15
580
    else
581
      output_obj=
582
      need_locks=no
583
      lockfile=
584
    fi
585
586
    # Lock this critical section if it is needed
587
    # We use this script file to make the link, it avoids creating a new file
588
    if test "$need_locks" = yes; then
589
      until $run ln "$0" "$lockfile" 2>/dev/null; do
590
	$show "Waiting for $lockfile to be removed"
591
	sleep 2
592
      done
593
    elif test "$need_locks" = warn; then
594
      if test -f "$lockfile"; then
595
	echo "\
596
*** ERROR, $lockfile exists and contains:
597
`cat $lockfile 2>/dev/null`
598
599
This indicates that another process is trying to use the same
600
temporary object file, and libtool could not work around it because
601
your compiler does not support \`-c' and \`-o' together.  If you
602
repeat this compilation, it may succeed, by chance, but you had better
603
avoid parallel builds (make -j) in this platform, or get a better
604
compiler."
605
606
	$run $rm $removelist
607
	exit 1
608
      fi
609
      echo $srcfile > "$lockfile"
610
    fi
611
612
    if test -n "$fix_srcfile_path"; then
613
      eval srcfile=\"$fix_srcfile_path\"
614
    fi
615
616
    $run $rm "$libobj" "${libobj}T"
617
618
    # Create a libtool object file (analogous to a ".la" file),
619
    # but don't create it if we're doing a dry run.
620
    test -z "$run" && cat > ${libobj}T <<EOF
621
# $libobj - a libtool object file
622
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
623
#
624
# Please DO NOT delete this file!
625
# It is necessary for linking the library.
626
627
# Name of the PIC object.
628
EOF
629
630
    # Only build a PIC object if we are building libtool libraries.
631
    if test "$build_libtool_libs" = yes; then
632
      # Without this assignment, base_compile gets emptied.
633
      fbsd_hideous_sh_bug=$base_compile
634
635
      if test "$pic_mode" != no; then
636
	command="$base_compile $srcfile $pic_flag"
637
      else
638
	# Don't build PIC code
639
	command="$base_compile $srcfile"
640
      fi
641
642
      if test ! -d ${xdir}$objdir; then
643
	$show "$mkdir ${xdir}$objdir"
644
	$run $mkdir ${xdir}$objdir
645
	status=$?
646
	if test $status -ne 0 && test ! -d ${xdir}$objdir; then
647
	  exit $status
648
        fi
649
      fi 
650
651
      if test -z "$output_obj"; then
652
        # Place PIC objects in $objdir
653
        command="$command -o $lobj"
654
      fi
655
656
      $run $rm "$lobj" "$output_obj"
657
658
      $show "$command"
659
      if $run eval "$command"; then :
660
      else
661
	test -n "$output_obj" && $run $rm $removelist
662
	exit 1
663
      fi
664
665
      if test "$need_locks" = warn &&
666
	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
667
	echo "\
668
*** ERROR, $lockfile contains:
669
`cat $lockfile 2>/dev/null`
670
671
but it should contain:
672
$srcfile
673
674
This indicates that another process is trying to use the same
675
temporary object file, and libtool could not work around it because
676
your compiler does not support \`-c' and \`-o' together.  If you
677
repeat this compilation, it may succeed, by chance, but you had better
678
avoid parallel builds (make -j) in this platform, or get a better
679
compiler."
680
681
	$run $rm $removelist
682
	exit 1
683
      fi
684
685
      # Just move the object if needed, then go on to compile the next one
686
      if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
687
	$show "$mv $output_obj $lobj"
688
	if $run $mv $output_obj $lobj; then :
689
	else
690
	  error=$?
691
	  $run $rm $removelist
692
	  exit $error
693
	fi
694
      fi
695
696
      # Append the name of the PIC object to the libtool object file.
697
      test -z "$run" && cat >> ${libobj}T <<EOF
698
pic_object='$objdir/$objname'
699
700
EOF
701
702
      # Allow error messages only from the first compilation.
703
      suppress_output=' >/dev/null 2>&1'
704
    else
705
      # No PIC object so indicate it doesn't exist in the libtool
706
      # object file.
707
      test -z "$run" && cat >> ${libobj}T <<EOF
708
pic_object=none
709
710
EOF
711
    fi
712
713
    # Only build a position-dependent object if we build old libraries.
714
    if test "$build_old_libs" = yes; then
715
      if test "$pic_mode" != yes; then
716
	# Don't build PIC code
717
	command="$base_compile $srcfile"
718
      else
719
	command="$base_compile $srcfile $pic_flag"
720
      fi
721
      if test "$compiler_c_o" = yes; then
722
	command="$command -o $obj"
723
      fi
724
725
      # Suppress compiler output if we already did a PIC compilation.
726
      command="$command$suppress_output"
727
      $run $rm "$obj" "$output_obj"
728
      $show "$command"
729
      if $run eval "$command"; then :
730
      else
731
	$run $rm $removelist
732
	exit 1
733
      fi
734
735
      if test "$need_locks" = warn &&
736
	 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
737
	echo "\
738
*** ERROR, $lockfile contains:
739
`cat $lockfile 2>/dev/null`
740
741
but it should contain:
742
$srcfile
743
744
This indicates that another process is trying to use the same
745
temporary object file, and libtool could not work around it because
746
your compiler does not support \`-c' and \`-o' together.  If you
747
repeat this compilation, it may succeed, by chance, but you had better
748
avoid parallel builds (make -j) in this platform, or get a better
749
compiler."
750
751
	$run $rm $removelist
752
	exit 1
753
      fi
754
755
      # Just move the object if needed
756
      if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
757
	$show "$mv $output_obj $obj"
758
	if $run $mv $output_obj $obj; then :
759
	else
760
	  error=$?
761
	  $run $rm $removelist
762
	  exit $error
763
	fi
764
      fi
765
766
      # Append the name of the non-PIC object the libtool object file.
767
      # Only append if the libtool object file exists.
768
      test -z "$run" && cat >> ${libobj}T <<EOF
769
# Name of the non-PIC object.
770
non_pic_object='$objname'
771
772
EOF
773
    else
774
      # Append the name of the non-PIC object the libtool object file.
775
      # Only append if the libtool object file exists.
776
      test -z "$run" && cat >> ${libobj}T <<EOF
777
# Name of the non-PIC object.
778
non_pic_object=none
779
780
EOF
781
    fi
782
783
    $run $mv "${libobj}T" "${libobj}"
784
785
    # Unlock the critical section if it was locked
786
    if test "$need_locks" != no; then
787
      $run $rm "$lockfile"
788
    fi
789
790
    exit 0
791
    ;;
792
793
  # libtool link mode
794
  link | relink)
795
    modename="$modename: link"
796
    case $host in
797
    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
798
      # It is impossible to link a dll without this setting, and
799
      # we shouldn't force the makefile maintainer to figure out
800
      # which system we are compiling for in order to pass an extra
801
      # flag for every libtool invokation.
802
      # allow_undefined=no
803
804
      # FIXME: Unfortunately, there are problems with the above when trying
805
      # to make a dll which has undefined symbols, in which case not
806
      # even a static library is built.  For now, we need to specify
807
      # -no-undefined on the libtool link line when we can be certain
808
      # that all symbols are satisfied, otherwise we get a static library.
809
      allow_undefined=yes
810
      ;;
811
    *)
812
      allow_undefined=yes
813
      ;;
814
    esac
815
    libtool_args="$nonopt"
816
    base_compile="$nonopt"
817
    compile_command="$nonopt"
818
    finalize_command="$nonopt"
819
820
    compile_rpath=
821
    finalize_rpath=
822
    compile_shlibpath=
823
    finalize_shlibpath=
824
    convenience=
825
    old_convenience=
826
    deplibs=
827
    old_deplibs=
828
    compiler_flags=
829
    linker_flags=
830
    dllsearchpath=
831
    lib_search_path=`pwd`
832
833
    avoid_version=no
834
    dlfiles=
835
    dlprefiles=
836
    dlself=no
837
    export_dynamic=no
838
    export_symbols=
839
    export_symbols_regex=
840
    generated=
841
    libobjs=
842
    ltlibs=
843
    module=no
844
    no_install=no
845
    objs=
846
    non_pic_objects=
847
    prefer_static_libs=no
848
    preload=no
849
    prev=
850
    prevarg=
851
    release=
852
    rpath=
853
    xrpath=
854
    perm_rpath=
855
    temp_rpath=
856
    thread_safe=no
857
    vinfo=
858
859
    # We need to know -static, to get the right output filenames.
860
    for arg
861
    do
862
      case $arg in
863
      -all-static | -static)
864
	if test "X$arg" = "X-all-static"; then
865
	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
866
	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
867
	  fi
868
	  if test -n "$link_static_flag"; then
869
	    dlopen_self=$dlopen_self_static
870
	  fi
871
	else
872
	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
873
	    dlopen_self=$dlopen_self_static
874
	  fi
875
	fi
876
	build_libtool_libs=no
877
	build_old_libs=yes
878
	prefer_static_libs=yes
879
	break
880
	;;
881
      esac
882
    done
883
884
    # See if our shared archives depend on static archives.
885
    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
886
887
    # Go through the arguments, transforming them on the way.
888
    while test $# -gt 0; do
889
      arg="$1"
890
      base_compile="$base_compile $arg"
891
      shift
892
      case $arg in
893
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
894
	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
895
	;;
896
      *) qarg=$arg ;;
897
      esac
898
      libtool_args="$libtool_args $qarg"
899
900
      # If the previous option needs an argument, assign it.
901
      if test -n "$prev"; then
902
	case $prev in
903
	output)
904
	  compile_command="$compile_command @OUTPUT@"
905
	  finalize_command="$finalize_command @OUTPUT@"
906
	  ;;
907
	esac
908
909
	case $prev in
910
	dlfiles|dlprefiles)
911
	  if test "$preload" = no; then
912
	    # Add the symbol object into the linking commands.
913
	    compile_command="$compile_command @SYMFILE@"
914
	    finalize_command="$finalize_command @SYMFILE@"
915
	    preload=yes
916
	  fi
917
	  case $arg in
918
	  *.la | *.lo) ;;  # We handle these cases below.
919
	  force)
920
	    if test "$dlself" = no; then
921
	      dlself=needless
922
	      export_dynamic=yes
923
	    fi
924
	    prev=
925
	    continue
926
	    ;;
927
	  self)
928
	    if test "$prev" = dlprefiles; then
929
	      dlself=yes
930
	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
931
	      dlself=yes
932
	    else
933
	      dlself=needless
934
	      export_dynamic=yes
935
	    fi
936
	    prev=
937
	    continue
938
	    ;;
939
	  *)
940
	    if test "$prev" = dlfiles; then
941
	      dlfiles="$dlfiles $arg"
942
	    else
943
	      dlprefiles="$dlprefiles $arg"
944
	    fi
945
	    prev=
946
	    continue
947
	    ;;
948
	  esac
949
	  ;;
950
	expsyms)
951
	  export_symbols="$arg"
952
	  if test ! -f "$arg"; then
953
	    $echo "$modename: symbol file \`$arg' does not exist"
954
	    exit 1
955
	  fi
956
	  prev=
957
	  continue
958
	  ;;
959
	expsyms_regex)
960
	  export_symbols_regex="$arg"
961
	  prev=
962
	  continue
963
	  ;;
964
	release)
965
	  release="-$arg"
966
	  prev=
967
	  continue
968
	  ;;
969
	objectlist)
970
	  if test -f "$arg"; then
971
            save_arg=$arg
972
	    moreargs=
973
	    for fil in `cat $save_arg`
974
	    do
975
#	      moreargs="$moreargs $fil"
976
              arg=$fil
977
              # A libtool-controlled object.
978
979
	      # Check to see that this really is a libtool object.
980
	      if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
981
                pic_object=
982
                non_pic_object=
983
984
                # Read the .lo file
985
                # If there is no directory component, then add one.
986
                case $arg in
987
                */* | *\\*) . $arg ;;
988
                *) . ./$arg ;;
989
                esac
990
991
                if test -z "$pic_object" || \
992
                   test -z "$non_pic_object" ||
993
                   test "$pic_object" = none && \
994
                   test "$non_pic_object" = none; then
995
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
996
                  exit 1
997
                fi
998
999
	        # Extract subdirectory from the argument.
1000
	        xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1001
	        if test "X$xdir" = "X$arg"; then
1002
	          xdir=
1003
	        else
1004
	          xdir="$xdir/"
1005
	        fi
1006
1007
                if test "$pic_object" != none; then
1008
                  # Prepend the subdirectory the object is found in.
1009
	          pic_object="$xdir$pic_object"
1010
1011
	          if test "$prev" = dlfiles; then
1012
	            if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1013
	              dlfiles="$dlfiles $pic_object"
1014
	              prev=
1015
	              continue
1016
	            else
1017
	              # If libtool objects are unsupported, then we need to preload.
1018
	              prev=dlprefiles
1019
	            fi
1020
	          fi
1021
1022
	          # CHECK ME:  I think I busted this.  -Ossama
1023
                  if test "$prev" = dlprefiles; then
1024
	            # Preload the old-style object.
1025
	            dlprefiles="$dlprefiles $pic_object"
1026
	            prev=
1027
                  fi
1028
1029
                  # A PIC object.
1030
	          libobjs="$libobjs $pic_object"
1031
	          arg="$pic_object"
1032
                fi
1033
1034
                # Non-PIC object.
1035
                if test "$non_pic_object" != none; then
1036
                  # Prepend the subdirectory the object is found in.
1037
	          non_pic_object="$xdir$non_pic_object"
1038
1039
                  # A standard non-PIC object
1040
                  non_pic_objects="$non_pic_objects $non_pic_object"
1041
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1042
                    arg="$non_pic_object"
1043
                  fi
1044
                fi
1045
              else
1046
                # Only an error if not doing a dry-run.
1047
                if test -z "$run"; then
1048
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1049
                  exit 1
1050
                else
1051
                  # Dry-run case.
1052
1053
	          # Extract subdirectory from the argument.
1054
	          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1055
	          if test "X$xdir" = "X$arg"; then
1056
	            xdir=
1057
	          else
1058
	            xdir="$xdir/"
1059
	          fi
1060
1061
                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1062
                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1063
	          libobjs="$libobjs $pic_object"
1064
                  non_pic_objects="$non_pic_objects $non_pic_object"
1065
                fi
1066
	      fi
1067
	    done
1068
	  else
1069
	    $echo "$modename: link input file \`$save_arg' does not exist"
1070
	    exit 1
1071
	  fi
1072
          arg=$save_arg
1073
	  prev=
1074
	  continue
1075
	  ;;
1076
	rpath | xrpath)
1077
	  # We need an absolute path.
1078
	  case $arg in
1079
	  [\\/]* | [A-Za-z]:[\\/]*) ;;
1080
	  *)
1081
	    $echo "$modename: only absolute run-paths are allowed" 1>&2
1082
	    exit 1
1083
	    ;;
1084
	  esac
1085
	  if test "$prev" = rpath; then
1086
	    case "$rpath " in
1087
	    *" $arg "*) ;;
1088
	    *) rpath="$rpath $arg" ;;
1089
	    esac
1090
	  else
1091
	    case "$xrpath " in
1092
	    *" $arg "*) ;;
1093
	    *) xrpath="$xrpath $arg" ;;
1094
	    esac
1095
	  fi
1096
	  prev=
1097
	  continue
1098
	  ;;
1099
	xcompiler)
1100
	  compiler_flags="$compiler_flags $qarg"
1101
	  prev=
1102
	  compile_command="$compile_command $qarg"
1103
	  finalize_command="$finalize_command $qarg"
1104
	  continue
1105
	  ;;
1106
	xlinker)
1107
	  linker_flags="$linker_flags $qarg"
1108
	  compiler_flags="$compiler_flags $wl$qarg"
1109
	  prev=
1110
	  compile_command="$compile_command $wl$qarg"
1111
	  finalize_command="$finalize_command $wl$qarg"
1112
	  continue
1113
	  ;;
1114
	*)
1115
	  eval "$prev=\"\$arg\""
1116
	  prev=
1117
	  continue
1118
	  ;;
1119
	esac
1120
      fi # test -n $prev
1121
1122
      prevarg="$arg"
1123
1124
      case $arg in
1125
      -all-static)
1126
	if test -n "$link_static_flag"; then
1127
	  compile_command="$compile_command $link_static_flag"
1128
	  finalize_command="$finalize_command $link_static_flag"
1129
	fi
1130
	continue
1131
	;;
1132
1133
      -allow-undefined)
1134
	# FIXME: remove this flag sometime in the future.
1135
	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1136
	continue
1137
	;;
1138
1139
      -avoid-version)
1140
	avoid_version=yes
1141
	continue
1142
	;;
1143
1144
      -dlopen)
1145
	prev=dlfiles
1146
	continue
1147
	;;
1148
1149
      -dlpreopen)
1150
	prev=dlprefiles
1151
	continue
1152
	;;
1153
1154
      -export-dynamic)
1155
	export_dynamic=yes
1156
	continue
1157
	;;
1158
1159
      -export-symbols | -export-symbols-regex)
1160
	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1161
	  $echo "$modename: more than one -exported-symbols argument is not allowed"
1162
	  exit 1
1163
	fi
1164
	if test "X$arg" = "X-export-symbols"; then
1165
	  prev=expsyms
1166
	else
1167
	  prev=expsyms_regex
1168
	fi
1169
	continue
1170
	;;
1171
1172
      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1173
      # so, if we see these flags be careful not to treat them like -L
1174
      -L[A-Z][A-Z]*:*)
1175
	case $with_gcc/$host in
1176
	no/*-*-irix*)
1177
	  compile_command="$compile_command $arg"
1178
	  finalize_command="$finalize_command $arg"
1179
	  ;;
1180
	esac
1181
	continue
1182
	;;
1183
1184
      -L*)
1185
	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1186
	# We need an absolute path.
1187
	case $dir in
1188
	[\\/]* | [A-Za-z]:[\\/]*) ;;
1189
	*)
1190
	  absdir=`cd "$dir" && pwd`
1191
	  if test -z "$absdir"; then
1192
	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1193
	    exit 1
1194
	  fi
1195
	  dir="$absdir"
1196
	  ;;
1197
	esac
1198
	case "$deplibs " in
1199
	*" -L$dir "*) ;;
1200
	*)
1201
	  deplibs="$deplibs -L$dir"
1202
	  lib_search_path="$lib_search_path $dir"
1203
	  ;;
1204
	esac
1205
	case $host in
1206
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1207
	  case :$dllsearchpath: in
1208
	  *":$dir:"*) ;;
1209
	  *) dllsearchpath="$dllsearchpath:$dir";;
1210
	  esac
1211
	  ;;
1212
	esac
1213
	continue
1214
	;;
1215
1216
      -l*)
1217
	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1218
	  case $host in
1219
	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
1220
	    # These systems don't actually have a C or math library (as such)
1221
	    continue
1222
	    ;;
1223
	  *-*-mingw* | *-*-os2*)
1224
	    # These systems don't actually have a C library (as such)
1225
	    test "X$arg" = "X-lc" && continue
1226
	    ;;
1227
	  esac
1228
	fi
1229
	deplibs="$deplibs $arg"
1230
	continue
1231
	;;
1232
1233
      -module)
1234
	module=yes
1235
	continue
1236
	;;
1237
1238
      -no-fast-install)
1239
	fast_install=no
1240
	continue
1241
	;;
1242
1243
      -no-install)
1244
	case $host in
1245
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1246
	  # The PATH hackery in wrapper scripts is required on Windows
1247
	  # in order for the loader to find any dlls it needs.
1248
	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1249
	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1250
	  fast_install=no
1251
	  ;;
1252
	*) no_install=yes ;;
1253
	esac
1254
	continue
1255
	;;
1256
1257
      -no-undefined)
1258
	allow_undefined=no
1259
	continue
1260
	;;
1261
1262
      -objectlist)
1263
	prev=objectlist
1264
	continue
1265
	;;
1266
1267
      -o) prev=output ;;
1268
1269
      -release)
1270
	prev=release
1271
	continue
1272
	;;
1273
1274
      -rpath)
1275
	prev=rpath
1276
	continue
1277
	;;
1278
1279
      -R)
1280
	prev=xrpath
1281
	continue
1282
	;;
1283
1284
      -R*)
1285
	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1286
	# We need an absolute path.
1287
	case $dir in
1288
	[\\/]* | [A-Za-z]:[\\/]*) ;;
1289
	*)
1290
	  $echo "$modename: only absolute run-paths are allowed" 1>&2
1291
	  exit 1
1292
	  ;;
1293
	esac
1294
	case "$xrpath " in
1295
	*" $dir "*) ;;
1296
	*) xrpath="$xrpath $dir" ;;
1297
	esac
1298
	continue
1299
	;;
1300
1301
      -static)
1302
	# The effects of -static are defined in a previous loop.
1303
	# We used to do the same as -all-static on platforms that
1304
	# didn't have a PIC flag, but the assumption that the effects
1305
	# would be equivalent was wrong.  It would break on at least
1306
	# Digital Unix and AIX.
1307
	continue
1308
	;;
1309
1310
      -thread-safe)
1311
	thread_safe=yes
1312
	continue
1313
	;;
1314
1315
      -version-info)
1316
	prev=vinfo
1317
	continue
1318
	;;
1319
1320
      -Wc,*)
1321
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1322
	arg=
1323
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=','
1324
	for flag in $args; do
1325
	  IFS="$save_ifs"
1326
	  case $flag in
1327
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1328
	    flag="\"$flag\""
1329
	    ;;
1330
	  esac
1331
	  arg="$arg $wl$flag"
1332
	  compiler_flags="$compiler_flags $flag"
1333
	done
1334
	IFS="$save_ifs"
1335
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1336
	;;
1337
1338
      -Wl,*)
1339
	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1340
	arg=
1341
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=','
1342
	for flag in $args; do
1343
	  IFS="$save_ifs"
1344
	  case $flag in
1345
	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1346
	    flag="\"$flag\""
1347
	    ;;
1348
	  esac
1349
	  arg="$arg $wl$flag"
1350
	  compiler_flags="$compiler_flags $wl$flag"
1351
	  linker_flags="$linker_flags $flag"
1352
	done
1353
	IFS="$save_ifs"
1354
	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1355
	;;
1356
1357
      -Xcompiler)
1358
	prev=xcompiler
1359
	continue
1360
	;;
1361
1362
      -Xlinker)
1363
	prev=xlinker
1364
	continue
1365
	;;
1366
1367
      # Some other compiler flag.
1368
      -* | +*)
1369
	# Unknown arguments in both finalize_command and compile_command need
1370
	# to be aesthetically quoted because they are evaled later.
1371
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1372
	case $arg in
1373
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1374
	  arg="\"$arg\""
1375
	  ;;
1376
	esac
1377
	;;
1378
1379
      *.$objext)
1380
	# A standard object.
1381
	objs="$objs $arg"
1382
	;;
1383
1384
      *.lo)
1385
	# A libtool-controlled object.
1386
1387
	# Check to see that this really is a libtool object.
1388
	if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1389
          pic_object=
1390
          non_pic_object=
1391
1392
          # Read the .lo file
1393
          # If there is no directory component, then add one.
1394
          case $arg in
1395
          */* | *\\*) . $arg ;;
1396
          *) . ./$arg ;;
1397
          esac
1398
1399
          if test -z "$pic_object" || \
1400
             test -z "$non_pic_object" ||
1401
             test "$pic_object" = none && \
1402
             test "$non_pic_object" = none; then
1403
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1404
            exit 1
1405
          fi
1406
1407
	  # Extract subdirectory from the argument.
1408
	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1409
	  if test "X$xdir" = "X$arg"; then
1410
	    xdir=
1411
	  else
1412
	    xdir="$xdir/"
1413
	  fi
1414
1415
          if test "$pic_object" != none; then
1416
            # Prepend the subdirectory the object is found in.
1417
	    pic_object="$xdir$pic_object"
1418
1419
	    if test "$prev" = dlfiles; then
1420
	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1421
	        dlfiles="$dlfiles $pic_object"
1422
	        prev=
1423
	        continue
1424
	      else
1425
	        # If libtool objects are unsupported, then we need to preload.
1426
	        prev=dlprefiles
1427
	      fi
1428
	    fi
1429
1430
	    # CHECK ME:  I think I busted this.  -Ossama
1431
            if test "$prev" = dlprefiles; then
1432
	      # Preload the old-style object.
1433
	      dlprefiles="$dlprefiles $pic_object"
1434
	      prev=
1435
            fi
1436
1437
            # A PIC object.
1438
	    libobjs="$libobjs $pic_object"
1439
	    arg="$pic_object"
1440
          fi
1441
1442
          # Non-PIC object.
1443
          if test "$non_pic_object" != none; then
1444
            # Prepend the subdirectory the object is found in.
1445
	    non_pic_object="$xdir$non_pic_object"
1446
1447
            # A standard non-PIC object
1448
            non_pic_objects="$non_pic_objects $non_pic_object"
1449
            if test -z "$pic_object" || test "$pic_object" = none ; then
1450
              arg="$non_pic_object"
1451
            fi
1452
          fi
1453
        else
1454
          # Only an error if not doing a dry-run.
1455
          if test -z "$run"; then
1456
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1457
            exit 1
1458
          else
1459
            # Dry-run case.
1460
1461
	    # Extract subdirectory from the argument.
1462
	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1463
	    if test "X$xdir" = "X$arg"; then
1464
	      xdir=
1465
	    else
1466
	      xdir="$xdir/"
1467
	    fi
1468
1469
            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1470
            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1471
	    libobjs="$libobjs $pic_object"
1472
            non_pic_objects="$non_pic_objects $non_pic_object"
1473
          fi
1474
	fi
1475
	;;
1476
1477
      *.$libext)
1478
	# An archive.
1479
	deplibs="$deplibs $arg"
1480
	old_deplibs="$old_deplibs $arg"
1481
	continue
1482
	;;
1483
1484
      *.la)
1485
	# A libtool-controlled library.
1486
1487
	if test "$prev" = dlfiles; then
1488
	  # This library was specified with -dlopen.
1489
	  dlfiles="$dlfiles $arg"
1490
	  prev=
1491
	elif test "$prev" = dlprefiles; then
1492
	  # The library was specified with -dlpreopen.
1493
	  dlprefiles="$dlprefiles $arg"
1494
	  prev=
1495
	else
1496
	  deplibs="$deplibs $arg"
1497
	fi
1498
	continue
1499
	;;
1500
1501
      # Some other compiler argument.
1502
      *)
1503
	# Unknown arguments in both finalize_command and compile_command need
1504
	# to be aesthetically quoted because they are evaled later.
1505
	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1506
	case $arg in
1507
	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1508
	  arg="\"$arg\""
1509
	  ;;
1510
	esac
1511
	;;
1512
      esac # arg
1513
1514
      # Now actually substitute the argument into the commands.
1515
      if test -n "$arg"; then
1516
	compile_command="$compile_command $arg"
1517
	finalize_command="$finalize_command $arg"
1518
      fi
1519
    done # argument parsing loop
1520
1521
    if test -n "$prev"; then
1522
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1523
      $echo "$help" 1>&2
1524
      exit 1
1525
    fi
1526
1527
    # Infer tagged configuration to use if any are available and
1528
    # if one wasn't chosen via the "--tag" command line option.
1529
    # Only attempt this if the compiler in the base link
1530
    # command doesn't match the default compiler.
1531
    if test -n "$available_tags" && test -z "$tagname"; then
1532
      case $base_compile in
1533
      "$CC "*) ;;
1534
      # Blanks in the command may have been stripped by the calling shell,
1535
      # but not from the CC environment variable when ltconfig was run.
1536
      "`$echo $CC` "*) ;;
1537
      *)
1538
        for z in $available_tags; do
1539
          if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1540
	    # Evaluate the configuration.
1541
	    eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1542
            case $base_compile in
1543
	    "$CC "*)
1544
              # The compiler in $compile_command matches
1545
              # the one in the tagged configuration.
1546
              # Assume this is the tagged configuration we want.
1547
              tagname=$z
1548
              break
1549
	      ;;
1550
	    "`$echo $CC` "*)
1551
	      tagname=$z
1552
	      break
1553
	      ;;
1554
	    esac
1555
          fi
1556
        done
1557
        # If $tagname still isn't set, then no tagged configuration
1558
        # was found and let the user know that the "--tag" command
1559
        # line option must be used.
1560
        if test -z "$tagname"; then
1561
          echo "$modename: unable to infer tagged configuration"
1562
          echo "$modename: specify a tag with \`--tag'" 1>&2
1563
	  exit 1
1564
#       else
1565
#         echo "$modename: using $tagname tagged configuration"
1566
        fi
1567
	;;
1568
      esac
1569
    fi
1570
1571
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1572
      eval arg=\"$export_dynamic_flag_spec\"
1573
      compile_command="$compile_command $arg"
1574
      finalize_command="$finalize_command $arg"
1575
    fi
1576
1577
    # calculate the name of the file, without its directory
1578
    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1579
    libobjs_save="$libobjs"
1580
1581
    if test -n "$shlibpath_var"; then
1582
      # get the directories listed in $shlibpath_var
1583
      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1584
    else
1585
      shlib_search_path=
1586
    fi
1587
    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1588
    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1589
1590
    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1591
    if test "X$output_objdir" = "X$output"; then
1592
      output_objdir="$objdir"
1593
    else
1594
      output_objdir="$output_objdir/$objdir"
1595
    fi
1596
    # Create the object directory.
1597
    if test ! -d $output_objdir; then
1598
      $show "$mkdir $output_objdir"
1599
      $run $mkdir $output_objdir
1600
      status=$?
1601
      if test $status -ne 0 && test ! -d $output_objdir; then
1602
	exit $status
1603
      fi
1604
    fi
1605
1606
    # Determine the type of output
1607
    case $output in
1608
    "")
1609
      $echo "$modename: you must specify an output file" 1>&2
1610
      $echo "$help" 1>&2
1611
      exit 1
1612
      ;;
1613
    *.$libext) linkmode=oldlib ;;
1614
    *.lo | *.$objext) linkmode=obj ;;
1615
    *.la) linkmode=lib ;;
1616
    *) linkmode=prog ;; # Anything else should be a program.
1617
    esac
1618
1619
    specialdeplibs=
1620
    libs=
1621
    # Find all interdependent deplibs by searching for libraries
1622
    # that are linked more than once (e.g. -la -lb -la)
1623
    for deplib in $deplibs; do
1624
      case "$libs " in
1625
      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1626
      esac
1627
      libs="$libs $deplib"
1628
    done
1629
1630
    if test $linkmode = lib; then
1631
      libs="$predeps $libs $compiler_lib_search_path $postdeps"
1632
1633
      # Compute libraries that are listed more than once in $predeps
1634
      # $postdeps and mark them as special (i.e., whose duplicates are
1635
      # not to be eliminated).
1636
      pre_post_deps=
1637
      for pre_post_dep in $predeps $postdeps; do
1638
        case "$pre_post_deps " in
1639
	*" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1640
	esac
1641
	pre_post_deps="$pre_post_deps $pre_post_dep"
1642
      done
1643
      pre_post_deps=
1644
    fi
1645
1646
    deplibs=
1647
    newdependency_libs=
1648
    newlib_search_path=
1649
    need_relink=no # whether we're linking any uninstalled libtool libraries
1650
    notinst_deplibs= # not-installed libtool libraries
1651
    notinst_path= # paths that contain not-installed libtool libraries
1652
    case $linkmode in
1653
    lib)
1654
	passes="conv link"
1655
	for file in $dlfiles $dlprefiles; do
1656
	  case $file in
1657
	  *.la) ;;
1658
	  *)
1659
	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1660
	    exit 1
1661
	    ;;
1662
	  esac
1663
	done
1664
	;;
1665
    prog)
1666
	compile_deplibs=
1667
	finalize_deplibs=
1668
	alldeplibs=no
1669
	newdlfiles=
1670
	newdlprefiles=
1671
	passes="conv scan dlopen dlpreopen link"
1672
	;;
1673
    *)  passes="conv"
1674
	;;
1675
    esac
1676
    for pass in $passes; do
1677
      if test $linkmode = prog; then
1678
	# Determine which files to process
1679
	case $pass in
1680
	dlopen)
1681
	  libs="$dlfiles"
1682
	  save_deplibs="$deplibs" # Collect dlpreopened libraries
1683
	  deplibs=
1684
	  ;;
1685
	dlpreopen) libs="$dlprefiles" ;;
1686
	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1687
	esac
1688
      fi
1689
      for deplib in $libs; do
1690
	lib=
1691
	found=no
1692
	case $deplib in
1693
	-l*)
1694
	  if test $linkmode = oldlib && test $linkmode = obj; then
1695
	    $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1696
	    continue
1697
	  fi
1698
	  if test $pass = conv; then
1699
	    deplibs="$deplib $deplibs"
1700
	    continue
1701
	  fi
1702
	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1703
	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1704
	    # Search the libtool library
1705
	    lib="$searchdir/lib${name}.la"
1706
	    if test -f "$lib"; then
1707
	      found=yes
1708
	      break
1709
	    fi
1710
	  done
1711
	  if test "$found" != yes; then
1712
	    # deplib doesn't seem to be a libtool library
1713
	    if test "$linkmode,$pass" = "prog,link"; then
1714
	      compile_deplibs="$deplib $compile_deplibs"
1715
	      finalize_deplibs="$deplib $finalize_deplibs"
1716
	    else
1717
	      deplibs="$deplib $deplibs"
1718
	      test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1719
	    fi
1720
	    continue
1721
	  fi
1722
	  ;; # -l
1723
	-L*)
1724
	  case $linkmode in
1725
	  lib)
1726
	    deplibs="$deplib $deplibs"
1727
	    test $pass = conv && continue
1728
	    newdependency_libs="$deplib $newdependency_libs"
1729
	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1730
	    ;;
1731
	  prog)
1732
	    if test $pass = conv; then
1733
	      deplibs="$deplib $deplibs"
1734
	      continue
1735
	    fi
1736
	    if test $pass = scan; then
1737
	      deplibs="$deplib $deplibs"
1738
	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1739
	    else
1740
	      compile_deplibs="$deplib $compile_deplibs"
1741
	      finalize_deplibs="$deplib $finalize_deplibs"
1742
	    fi
1743
	    ;;
1744
	  *)
1745
	    $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1746
	    ;;
1747
	  esac # linkmode
1748
	  continue
1749
	  ;; # -L
1750
	-R*)
1751
	  if test $pass = link; then
1752
	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1753
	    # Make sure the xrpath contains only unique directories.
1754
	    case "$xrpath " in
1755
	    *" $dir "*) ;;
1756
	    *) xrpath="$xrpath $dir" ;;
1757
	    esac
1758
	  fi
1759
	  deplibs="$deplib $deplibs"
1760
	  continue
1761
	  ;;
1762
	*.la) lib="$deplib" ;;
1763
	*.$libext)
1764
	  if test $pass = conv; then
1765
	    deplibs="$deplib $deplibs"
1766
	    continue
1767
	  fi
1768
	  case $linkmode in
1769
	  lib)
1770
	    if test "$deplibs_check_method" != pass_all; then
1771
	      echo
1772
	      echo "*** Warning: This library needs some functionality provided by $deplib."
1773
	      echo "*** I have the capability to make that library automatically link in when"
1774
	      echo "*** you link to this library.  But I can only do this if you have a"
1775
	      echo "*** shared version of the library, which you do not appear to have."
1776
	    else
1777
	      echo
1778
	      echo "*** Warning: Linking the shared library $output against the"
1779
	      echo "*** static library $deplib is not portable!"
1780
	      deplibs="$deplib $deplibs"
1781
	    fi
1782
	    continue
1783
	    ;;
1784
	  prog)
1785
	    if test $pass != link; then
1786
	      deplibs="$deplib $deplibs"
1787
	    else
1788
	      compile_deplibs="$deplib $compile_deplibs"
1789
	      finalize_deplibs="$deplib $finalize_deplibs"
1790
	    fi
1791
	    continue
1792
	    ;;
1793
	  esac # linkmode
1794
	  ;; # *.$libext
1795
	*.lo | *.$objext)
1796
	  if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1797
	    # If there is no dlopen support or we're linking statically,
1798
	    # we need to preload.
1799
	    newdlprefiles="$newdlprefiles $deplib"
1800
	    compile_deplibs="$deplib $compile_deplibs"
1801
	    finalize_deplibs="$deplib $finalize_deplibs"
1802
	  else
1803
	    newdlfiles="$newdlfiles $deplib"
1804
	  fi
1805
	  continue
1806
	  ;;
1807
	%DEPLIBS%)
1808
	  alldeplibs=yes
1809
	  continue
1810
	  ;;
1811
	esac # case $deplib
1812
	if test $found = yes || test -f "$lib"; then :
1813
	else
1814
	  $echo "$modename: cannot find the library \`$lib'" 1>&2
1815
	  exit 1
1816
	fi
1817
1818
	# Check to see that this really is a libtool archive.
1819
	if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1820
	else
1821
	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1822
	  exit 1
1823
	fi
1824
1825
	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1826
	test "X$ladir" = "X$lib" && ladir="."
1827
1828
	dlname=
1829
	dlopen=
1830
	dlpreopen=
1831
	libdir=
1832
	library_names=
1833
	old_library=
1834
	# If the library was installed with an old release of libtool,
1835
	# it will not redefine variable installed.
1836
	installed=yes
1837
1838
	# Read the .la file
1839
	case $lib in
1840
	*/* | *\\*) . $lib ;;
1841
	*) . ./$lib ;;
1842
	esac
1843
1844
	if test "$linkmode,$pass" = "lib,link" ||
1845
	   test "$linkmode,$pass" = "prog,scan" ||
1846
	   { test $linkmode = oldlib && test $linkmode = obj; }; then
1847
	   # Add dl[pre]opened files of deplib
1848
	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1849
	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1850
	fi
1851
1852
	if test $pass = conv; then
1853
	  # Only check for convenience libraries
1854
	  deplibs="$lib $deplibs"
1855
	  if test -z "$libdir"; then
1856
	    if test -z "$old_library"; then
1857
	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1858
	      exit 1
1859
	    fi
1860
	    # It is a libtool convenience library, so add in its objects.
1861
	    convenience="$convenience $ladir/$objdir/$old_library"
1862
	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
1863
	    tmp_libs=
1864
	    for deplib in $dependency_libs; do
1865
	      deplibs="$deplib $deplibs"
1866
	      case "$tmp_libs " in
1867
	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1868
	      esac
1869
	      tmp_libs="$tmp_libs $deplib"
1870
	    done
1871
	  elif test $linkmode != prog && test $linkmode != lib; then
1872
	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
1873
	    exit 1
1874
	  fi
1875
	  continue
1876
	fi # $pass = conv
1877
1878
	# Get the name of the library we link against.
1879
	linklib=
1880
	for l in $old_library $library_names; do
1881
	  linklib="$l"
1882
	done
1883
	if test -z "$linklib"; then
1884
	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1885
	  exit 1
1886
	fi
1887
1888
	# This library was specified with -dlopen.
1889
	if test $pass = dlopen; then
1890
	  if test -z "$libdir"; then
1891
	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1892
	    exit 1
1893
	  fi
1894
	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1895
	    # If there is no dlname, no dlopen support or we're linking
1896
	    # statically, we need to preload.
1897
	    dlprefiles="$dlprefiles $lib"
1898
	  else
1899
	    newdlfiles="$newdlfiles $lib"
1900
	  fi
1901
	  continue
1902
	fi # $pass = dlopen
1903
1904
	# We need an absolute path.
1905
	case $ladir in
1906
	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1907
	*)
1908
	  abs_ladir=`cd "$ladir" && pwd`
1909
	  if test -z "$abs_ladir"; then
1910
	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1911
	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1912
	    abs_ladir="$ladir"
1913
	  fi
1914
	  ;;
1915
	esac
1916
	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1917
1918
	# Find the relevant object directory and library name.
1919
	if test "X$installed" = Xyes; then
1920
	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1921
	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
1922
	    dir="$ladir"
1923
	    absdir="$abs_ladir"
1924
	    libdir="$abs_ladir"
1925
	  else
1926
	    dir="$libdir"
1927
	    absdir="$libdir"
1928
	  fi
1929
	else
1930
	  dir="$ladir/$objdir"
1931
	  absdir="$abs_ladir/$objdir"
1932
	  # Remove this search path later
1933
	  notinst_path="$notinst_path $abs_ladir"
1934
	fi # $installed = yes
1935
	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1936
1937
	# This library was specified with -dlpreopen.
1938
	if test $pass = dlpreopen; then
1939
	  if test -z "$libdir"; then
1940
	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1941
	    exit 1
1942
	  fi
1943
	  # Prefer using a static library (so that no silly _DYNAMIC symbols
1944
	  # are required to link).
1945
	  if test -n "$old_library"; then
1946
	    newdlprefiles="$newdlprefiles $dir/$old_library"
1947
	  # Otherwise, use the dlname, so that lt_dlopen finds it.
1948
	  elif test -n "$dlname"; then
1949
	    newdlprefiles="$newdlprefiles $dir/$dlname"
1950
	  else
1951
	    newdlprefiles="$newdlprefiles $dir/$linklib"
1952
	  fi
1953
	fi # $pass = dlpreopen
1954
1955
	if test -z "$libdir"; then
1956
	  # Link the convenience library
1957
	  if test $linkmode = lib; then
1958
	    deplibs="$dir/$old_library $deplibs"
1959
	  elif test "$linkmode,$pass" = "prog,link"; then
1960
	    compile_deplibs="$dir/$old_library $compile_deplibs"
1961
	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
1962
	  else
1963
	    deplibs="$lib $deplibs"
1964
	  fi
1965
	  continue
1966
	fi
1967
1968
	if test $linkmode = prog && test $pass != link; then
1969
	  newlib_search_path="$newlib_search_path $ladir"
1970
	  deplibs="$lib $deplibs"
1971
1972
	  linkalldeplibs=no
1973
	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
1974
	     test "$build_libtool_libs" = no; then
1975
	    linkalldeplibs=yes
1976
	  fi
1977
1978
	  tmp_libs=
1979
	  for deplib in $dependency_libs; do
1980
	    case $deplib in
1981
	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1982
	    esac
1983
	    # Need to link against all dependency_libs?
1984
	    if test $linkalldeplibs = yes; then
1985
	      deplibs="$deplib $deplibs"
1986
	    else
1987
	      # Need to hardcode shared library paths
1988
	      # or/and link against static libraries
1989
	      newdependency_libs="$deplib $newdependency_libs"
1990
	    fi
1991
	    case "$tmp_libs " in
1992
	    *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1993
	    esac
1994
	    tmp_libs="$tmp_libs $deplib"
1995
	  done # for deplib
1996
	  continue
1997
	fi # $linkmode = prog...
1998
1999
	link_static=no # Whether the deplib will be linked statically
2000
	if test -n "$library_names" &&
2001
	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2002
	  # Link against this shared library
2003
2004
	  if test "$linkmode,$pass" = "prog,link" ||
2005
	   { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
2006
	    # Hardcode the library path.
2007
	    # Skip directories that are in the system default run-time
2008
	    # search path.
2009
	    case " $sys_lib_dlsearch_path " in
2010
	    *" $absdir "*) ;;
2011
	    *)
2012
	      case "$compile_rpath " in
2013
	      *" $absdir "*) ;;
2014
	      *) compile_rpath="$compile_rpath $absdir"
2015
	      esac
2016
	      ;;
2017
	    esac
2018
	    case " $sys_lib_dlsearch_path " in
2019
	    *" $libdir "*) ;;
2020
	    *)
2021
	      case "$finalize_rpath " in
2022
	      *" $libdir "*) ;;
2023
	      *) finalize_rpath="$finalize_rpath $libdir"
2024
	      esac
2025
	      ;;
2026
	    esac
2027
	    if test $linkmode = prog; then
2028
	      # We need to hardcode the library path
2029
	      if test -n "$shlibpath_var"; then
2030
		# Make sure the rpath contains only unique directories.
2031
		case "$temp_rpath " in
2032
		*" $dir "*) ;;
2033
		*" $absdir "*) ;;
2034
		*) temp_rpath="$temp_rpath $dir" ;;
2035
		esac
2036
	      fi
2037
	    fi
2038
	  fi # $linkmode,$pass = prog,link...
2039
2040
	  if test "$alldeplibs" = yes &&
2041
	     { test "$deplibs_check_method" = pass_all ||
2042
	       { test "$build_libtool_libs" = yes &&
2043
		 test -n "$library_names"; }; }; then
2044
	    # We only need to search for static libraries
2045
	    continue
2046
	  fi
2047
2048
	  if test "$installed" = no; then
2049
	    notinst_deplibs="$notinst_deplibs $lib"
2050
	    need_relink=yes
2051
	  fi
2052
2053
	  if test -n "$old_archive_from_expsyms_cmds"; then
2054
	    # figure out the soname
2055
	    set dummy $library_names
2056
	    realname="$2"
2057
	    shift; shift
2058
	    libname=`eval \\$echo \"$libname_spec\"`
2059
	    # use dlname if we got it. it's perfectly good, no?
2060
	    if test -n "$dlname"; then
2061
	      soname="$dlname"
2062
	    elif test -n "$soname_spec"; then
2063
	      # bleh windows
2064
	      case $host in
2065
	      *cygwin*)
2066
		major=`expr $current - $age`
2067
		versuffix="-$major"
2068
		;;
2069
	      esac
2070
	      eval soname=\"$soname_spec\"
2071
	    else
2072
	      soname="$realname"
2073
	    fi
2074
2075
	    # Make a new name for the extract_expsyms_cmds to use
2076
	    soroot="$soname"
2077
	    soname=`echo $soroot | sed -e 's/^.*\///'`
2078
	    newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
2079
2080
	    # If the library has no export list, then create one now
2081
	    if test -f "$output_objdir/$soname-def"; then :
2082
	    else
2083
	      $show "extracting exported symbol list from \`$soname'"
2084
	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
2085
	      eval cmds=\"$extract_expsyms_cmds\"
2086
	      for cmd in $cmds; do
2087
		IFS="$save_ifs"
2088
		$show "$cmd"
2089
		$run eval "$cmd" || exit $?
2090
	      done
2091
	      IFS="$save_ifs"
2092
	    fi
2093
2094
	    # Create $newlib
2095
	    if test -f "$output_objdir/$newlib"; then :; else
2096
	      $show "generating import library for \`$soname'"
2097
	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
2098
	      eval cmds=\"$old_archive_from_expsyms_cmds\"
2099
	      for cmd in $cmds; do
2100
		IFS="$save_ifs"
2101
		$show "$cmd"
2102
		$run eval "$cmd" || exit $?
2103
	      done
2104
	      IFS="$save_ifs"
2105
	    fi
2106
	    # make sure the library variables are pointing to the new library
2107
	    dir=$output_objdir
2108
	    linklib=$newlib
2109
	  fi # test -n $old_archive_from_expsyms_cmds
2110
2111
	  if test $linkmode = prog || test "$mode" != relink; then
2112
	    add_shlibpath=
2113
	    add_dir=
2114
	    add=
2115
	    lib_linked=yes
2116
	    case $hardcode_action in
2117
	    immediate | unsupported)
2118
	      if test "$hardcode_direct" = no; then
2119
		add="$dir/$linklib"
2120
	      elif test "$hardcode_minus_L" = no; then
2121
		case $host in
2122
		*-*-sunos*) add_shlibpath="$dir" ;;
2123
		esac
2124
		add_dir="-L$dir"
2125
		add="-l$name"
2126
	      elif test "$hardcode_shlibpath_var" = no; then
2127
		add_shlibpath="$dir"
2128
		add="-l$name"
2129
	      else
2130
		lib_linked=no
2131
	      fi
2132
	      ;;
2133
	    relink)
2134
	      if test "$hardcode_direct" = yes; then
2135
		add="$dir/$linklib"
2136
	      elif test "$hardcode_minus_L" = yes; then
2137
		add_dir="-L$dir"
2138
		add="-l$name"
2139
	      elif test "$hardcode_shlibpath_var" = yes; then
2140
		add_shlibpath="$dir"
2141
		add="-l$name"
2142
	      else
2143
		lib_linked=no
2144
	      fi
2145
	      ;;
2146
	    *) lib_linked=no ;;
2147
	    esac
2148
2149
	    if test "$lib_linked" != yes; then
2150
	      $echo "$modename: configuration error: unsupported hardcode properties"
2151
	      exit 1
2152
	    fi
2153
2154
	    if test -n "$add_shlibpath"; then
2155
	      case :$compile_shlibpath: in
2156
	      *":$add_shlibpath:"*) ;;
2157
	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2158
	      esac
2159
	    fi
2160
	    if test $linkmode = prog; then
2161
	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2162
	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
2163
	    else
2164
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2165
	      test -n "$add" && deplibs="$add $deplibs"
2166
	      if test "$hardcode_direct" != yes && \
2167
		 test "$hardcode_minus_L" != yes && \
2168
		 test "$hardcode_shlibpath_var" = yes; then
2169
		case :$finalize_shlibpath: in
2170
		*":$libdir:"*) ;;
2171
		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2172
		esac
2173
	      fi
2174
	    fi
2175
	  fi
2176
2177
	  if test $linkmode = prog || test "$mode" = relink; then
2178
	    add_shlibpath=
2179
	    add_dir=
2180
	    add=
2181
	    # Finalize command for both is simple: just hardcode it.
2182
	    if test "$hardcode_direct" = yes; then
2183
	      add="$libdir/$linklib"
2184
	    elif test "$hardcode_minus_L" = yes; then
2185
	      add_dir="-L$libdir"
2186
	      add="-l$name"
2187
	    elif test "$hardcode_shlibpath_var" = yes; then
2188
	      case :$finalize_shlibpath: in
2189
	      *":$libdir:"*) ;;
2190
	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2191
	      esac
2192
	      add="-l$name"
2193
	    else
2194
	      # We cannot seem to hardcode it, guess we'll fake it.
2195
	      add_dir="-L$libdir"
2196
	      add="-l$name"
2197
	    fi
2198
2199
	    if test $linkmode = prog; then
2200
	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2201
	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2202
	    else
2203
	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2204
	      test -n "$add" && deplibs="$add $deplibs"
2205
	    fi
2206
	  fi
2207
	elif test $linkmode = prog; then
2208
	  if test "$alldeplibs" = yes &&
2209
	     { test "$deplibs_check_method" = pass_all ||
2210
	       { test "$build_libtool_libs" = yes &&
2211
		 test -n "$library_names"; }; }; then
2212
	    # We only need to search for static libraries
2213
	    continue
2214
	  fi
2215
2216
	  # Try to link the static library
2217
	  # Here we assume that one of hardcode_direct or hardcode_minus_L
2218
	  # is not unsupported.  This is valid on all known static and
2219
	  # shared platforms.
2220
	  if test "$hardcode_direct" != unsupported; then
2221
	    test -n "$old_library" && linklib="$old_library"
2222
	    compile_deplibs="$dir/$linklib $compile_deplibs"
2223
	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
2224
	  else
2225
	    compile_deplibs="-l$name -L$dir $compile_deplibs"
2226
	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2227
	  fi
2228
	elif test "$build_libtool_libs" = yes; then
2229
	  # Not a shared library
2230
	  if test "$deplibs_check_method" != pass_all; then
2231
	    # We're trying link a shared library against a static one
2232
	    # but the system doesn't support it.
2233
2234
	    # Just print a warning and add the library to dependency_libs so
2235
	    # that the program can be linked against the static library.
2236
	    echo
2237
	    echo "*** Warning: This library needs some functionality provided by $lib."
2238
	    echo "*** I have the capability to make that library automatically link in when"
2239
	    echo "*** you link to this library.  But I can only do this if you have a"
2240
	    echo "*** shared version of the library, which you do not appear to have."
2241
	    if test "$module" = yes; then
2242
	      echo "*** Therefore, libtool will create a static module, that should work "
2243
	      echo "*** as long as the dlopening application is linked with the -dlopen flag."
2244
	      if test -z "$global_symbol_pipe"; then
2245
	        echo
2246
	        echo "*** However, this would only work if libtool was able to extract symbol"
2247
	        echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2248
	        echo "*** not find such a program.  So, this module is probably useless."
2249
	        echo "*** \`nm' from GNU binutils and a full rebuild may help."
2250
	      fi
2251
	      if test "$build_old_libs" = no; then
2252
	        build_libtool_libs=module
2253
	        build_old_libs=yes
2254
	      else
2255
	        build_libtool_libs=no
2256
	      fi
2257
	    fi
2258
	  else
2259
	    convenience="$convenience $dir/$old_library"
2260
	    old_convenience="$old_convenience $dir/$old_library"
2261
	    deplibs="$dir/$old_library $deplibs"
2262
	    link_static=yes
2263
	  fi
2264
	fi # link shared/static library?
2265
2266
	if test $linkmode = lib; then
2267
	  if test -n "$dependency_libs" &&
2268
	     { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2269
	       test $link_static = yes; }; then
2270
	    # Extract -R from dependency_libs
2271
	    temp_deplibs=
2272
	    for libdir in $dependency_libs; do
2273
	      case $libdir in
2274
	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2275
		   case " $xrpath " in
2276
		   *" $temp_xrpath "*) ;;
2277
		   *) xrpath="$xrpath $temp_xrpath";;
2278
		   esac;;
2279
	      *) temp_deplibs="$temp_deplibs $libdir";;
2280
	      esac
2281
	    done
2282
	    dependency_libs="$temp_deplibs"
2283
	  fi
2284
2285
	  newlib_search_path="$newlib_search_path $absdir"
2286
	  # Link against this library
2287
	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2288
	  # ... and its dependency_libs
2289
	  tmp_libs=
2290
	  for deplib in $dependency_libs; do
2291
	    newdependency_libs="$deplib $newdependency_libs"
2292
	    case "$tmp_libs " in
2293
	    *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2294
	    esac
2295
	    tmp_libs="$tmp_libs $deplib"
2296
	  done
2297
2298
	  if test $link_all_deplibs != no; then
2299
	    # Add the search paths of all dependency libraries
2300
	    for deplib in $dependency_libs; do
2301
	      case $deplib in
2302
	      -L*) path="$deplib" ;;
2303
	      *.la)
2304
		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2305
		test "X$dir" = "X$deplib" && dir="."
2306
		# We need an absolute path.
2307
		case $dir in
2308
		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2309
		*)
2310
		  absdir=`cd "$dir" && pwd`
2311
		  if test -z "$absdir"; then
2312
		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2313
		    absdir="$dir"
2314
		  fi
2315
		  ;;
2316
		esac
2317
		if grep "^installed=no" $deplib > /dev/null; then
2318
		  path="-L$absdir/$objdir"
2319
		else
2320
		  eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2321
		  if test -z "$libdir"; then
2322
		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2323
		    exit 1
2324
		  fi
2325
		  if test "$absdir" != "$libdir"; then
2326
		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2327
		  fi
2328
		  path="-L$absdir"
2329
		fi
2330
		;;
2331
	      *) continue ;;
2332
	      esac
2333
	      case " $deplibs " in
2334
	      *" $path "*) ;;
2335
	      *) deplibs="$path $deplibs" ;;
2336
	      esac
2337
	    done
2338
	  fi # link_all_deplibs != no
2339
	fi # linkmode = lib
2340
      done # for deplib in $libs
2341
      if test $pass = dlpreopen; then
2342
	# Link the dlpreopened libraries before other libraries
2343
	for deplib in $save_deplibs; do
2344
	  deplibs="$deplib $deplibs"
2345
	done
2346
      fi
2347
      if test $pass != dlopen; then
2348
	test $pass != scan && dependency_libs="$newdependency_libs"
2349
	if test $pass != conv; then
2350
	  # Make sure lib_search_path contains only unique directories.
2351
	  lib_search_path=
2352
	  for dir in $newlib_search_path; do
2353
	    case "$lib_search_path " in
2354
	    *" $dir "*) ;;
2355
	    *) lib_search_path="$lib_search_path $dir" ;;
2356
	    esac
2357
	  done
2358
	  newlib_search_path=
2359
	fi
2360
2361
	if test "$linkmode,$pass" != "prog,link"; then
2362
	  vars="deplibs"
2363
	else
2364
	  vars="compile_deplibs finalize_deplibs"
2365
	fi
2366
	for var in $vars dependency_libs; do
2367
	  # Add libraries to $var in reverse order
2368
	  eval tmp_libs=\"\$$var\"
2369
	  new_libs=
2370
	  for deplib in $tmp_libs; do
2371
	    case $deplib in
2372
	    -L*) new_libs="$deplib $new_libs" ;;
2373
	    *)
2374
	      case " $specialdeplibs " in
2375
	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
2376
	      *)
2377
		case " $new_libs " in
2378
		*" $deplib "*) ;;
2379
		*) new_libs="$deplib $new_libs" ;;
2380
		esac
2381
		;;
2382
	      esac
2383
	      ;;
2384
	    esac
2385
	  done
2386
	  tmp_libs=
2387
	  for deplib in $new_libs; do
2388
	    case $deplib in
2389
	    -L*)
2390
	      case " $tmp_libs " in
2391
	      *" $deplib "*) ;;
2392
	      *) tmp_libs="$tmp_libs $deplib" ;;
2393
	      esac
2394
	      ;;
2395
	    *) tmp_libs="$tmp_libs $deplib" ;;
2396
	    esac
2397
	  done
2398
	  eval $var=\"$tmp_libs\"
2399
	done # for var
2400
      fi
2401
      if test "$pass" = "conv" &&
2402
       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2403
	libs="$deplibs" # reset libs
2404
	deplibs=
2405
      fi
2406
    done # for pass
2407
    if test $linkmode = prog; then
2408
      dlfiles="$newdlfiles"
2409
      dlprefiles="$newdlprefiles"
2410
    fi
2411
2412
    case $linkmode in
2413
    oldlib)
2414
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2415
	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2416
      fi
2417
2418
      if test -n "$rpath"; then
2419
	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2420
      fi
2421
2422
      if test -n "$xrpath"; then
2423
	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2424
      fi
2425
2426
      if test -n "$vinfo"; then
2427
	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2428
      fi
2429
2430
      if test -n "$release"; then
2431
	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2432
      fi
2433
2434
      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2435
	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2436
      fi
2437
2438
      # Now set the variables for building old libraries.
2439
      build_libtool_libs=no
2440
      oldlibs="$output"
2441
      objs="$objs$old_deplibs"
2442
      ;;
2443
2444
    lib)
2445
      # Make sure we only generate libraries of the form `libNAME.la'.
2446
      case $outputname in
2447
      lib*)
2448
	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2449
	eval libname=\"$libname_spec\"
2450
	;;
2451
      *)
2452
	if test "$module" = no; then
2453
	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2454
	  $echo "$help" 1>&2
2455
	  exit 1
2456
	fi
2457
	if test "$need_lib_prefix" != no; then
2458
	  # Add the "lib" prefix for modules if required
2459
	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2460
	  eval libname=\"$libname_spec\"
2461
	else
2462
	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2463
	fi
2464
	;;
2465
      esac
2466
2467
      if test -n "$objs"; then
2468
	if test "$deplibs_check_method" != pass_all; then
2469
	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2470
	  exit 1
2471
	else
2472
	  echo
2473
	  echo "*** Warning: Linking the shared library $output against the non-libtool"
2474
	  echo "*** objects $objs is not portable!"
2475
	  libobjs="$libobjs $objs"
2476
	fi
2477
      fi
2478
2479
      if test "$dlself" != no; then
2480
	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2481
      fi
2482
2483
      set dummy $rpath
2484
      if test $# -gt 2; then
2485
	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2486
      fi
2487
      install_libdir="$2"
2488
2489
      oldlibs=
2490
      if test -z "$rpath"; then
2491
	if test "$build_libtool_libs" = yes; then
2492
	  # Building a libtool convenience library.
2493
	  # Some compilers have problems with a `.al' extension so
2494
          # convenience libraries should have the same extension an
2495
          # archive normally would.
2496
	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
2497
	  build_libtool_libs=convenience
2498
	  build_old_libs=yes
2499
	fi
2500
2501
	if test -n "$vinfo"; then
2502
	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2503
	fi
2504
2505
	if test -n "$release"; then
2506
	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2507
	fi
2508
      else
2509
2510
	# Parse the version information argument.
2511
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=':'
2512
	set dummy $vinfo 0 0 0
2513
	IFS="$save_ifs"
2514
2515
	if test -n "$8"; then
2516
	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
2517
	  $echo "$help" 1>&2
2518
	  exit 1
2519
	fi
2520
2521
	current="$2"
2522
	revision="$3"
2523
	age="$4"
2524
2525
	# Check that each of the things are valid numbers.
2526
	case $current in
2527
	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2528
	*)
2529
	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2530
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2531
	  exit 1
2532
	  ;;
2533
	esac
2534
2535
	case $revision in
2536
	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2537
	*)
2538
	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2539
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2540
	  exit 1
2541
	  ;;
2542
	esac
2543
2544
	case $age in
2545
	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2546
	*)
2547
	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2548
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2549
	  exit 1
2550
	  ;;
2551
	esac
2552
2553
	if test $age -gt $current; then
2554
	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2555
	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2556
	  exit 1
2557
	fi
2558
2559
	# Calculate the version variables.
2560
	major=
2561
	versuffix=
2562
	verstring=
2563
	case $version_type in
2564
	none) ;;
2565
2566
	darwin)
2567
	  # Like Linux, but with the current version available in
2568
	  # verstring for coding it into the library header
2569
	  major=.`expr $current - $age`
2570
	  versuffix="$major.$age.$revision"
2571
	  # Darwin ld doesn't like 0 for these options...
2572
	  minor_current=`expr $current + 1`
2573
	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2574
	  ;;
2575
2576
	freebsd-aout)
2577
	  major=".$current"
2578
	  versuffix=".$current.$revision";
2579
	  ;;
2580
2581
	freebsd-elf)
2582
	  major=".$current"
2583
	  versuffix=".$current";
2584
	  ;;
2585
2586
	irix)
2587
	  major=`expr $current - $age + 1`
2588
	  verstring="sgi$major.$revision"
2589
2590
	  # Add in all the interfaces that we are compatible with.
2591
	  loop=$revision
2592
	  while test $loop != 0; do
2593
	    iface=`expr $revision - $loop`
2594
	    loop=`expr $loop - 1`
2595
	    verstring="sgi$major.$iface:$verstring"
2596
	  done
2597
2598
	  # Before this point, $major must not contain `.'.
2599
	  major=.$major
2600
	  versuffix="$major.$revision"
2601
	  ;;
2602
2603
	linux)
2604
	  major=.`expr $current - $age`
2605
	  versuffix="$major.$age.$revision"
2606
	  ;;
2607
2608
	osf)
2609
	  major=`expr $current - $age`
2610
	  versuffix=".$current.$age.$revision"
2611
	  verstring="$current.$age.$revision"
2612
2613
	  # Add in all the interfaces that we are compatible with.
2614
	  loop=$age
2615
	  while test $loop != 0; do
2616
	    iface=`expr $current - $loop`
2617
	    loop=`expr $loop - 1`
2618
	    verstring="$verstring:${iface}.0"
2619
	  done
2620
2621
	  # Make executables depend on our current version.
2622
	  verstring="$verstring:${current}.0"
2623
	  ;;
2624
2625
	sunos)
2626
	  major=".$current"
2627
	  versuffix=".$current.$revision"
2628
	  ;;
2629
2630
	windows)
2631
	  # Use '-' rather than '.', since we only want one
2632
	  # extension on DOS 8.3 filesystems.
2633
	  major=`expr $current - $age`
2634
	  versuffix="-$major"
2635
	  ;;
2636
2637
	*)
2638
	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
2639
	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2640
	  exit 1
2641
	  ;;
2642
	esac
2643
2644
	# Clear the version info if we defaulted, and they specified a release.
2645
	if test -z "$vinfo" && test -n "$release"; then
2646
	  major=
2647
	  verstring="0.0"
2648
	  if test "$need_version" = no; then
2649
	    versuffix=
2650
	  else
2651
	    versuffix=".0.0"
2652
	  fi
2653
	fi
2654
2655
	# Remove version info from name if versioning should be avoided
2656
	if test "$avoid_version" = yes && test "$need_version" = no; then
2657
	  major=
2658
	  versuffix=
2659
	  verstring=""
2660
	fi
2661
2662
	# Check to see if the archive will have undefined symbols.
2663
	if test "$allow_undefined" = yes; then
2664
	  if test "$allow_undefined_flag" = unsupported; then
2665
	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2666
	    build_libtool_libs=no
2667
	    build_old_libs=yes
2668
	  fi
2669
	else
2670
	  # Don't allow undefined symbols.
2671
	  allow_undefined_flag="$no_undefined_flag"
2672
	fi
2673
      fi
2674
2675
      if test "$mode" != relink; then
2676
	# Remove our outputs, but don't remove object files since they
2677
        # may have been created when compiling PIC objects.
2678
        removelist=
2679
        tempremovelist=`echo "$output_objdir/*"`
2680
	for p in $tempremovelist; do
2681
          case $p in
2682
            *.$objext)
2683
               ;;
2684
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2685
               removelist="$removelist $p"
2686
               ;;
2687
            *) ;;
2688
          esac
2689
        done
2690
        if test -n "$removelist"; then
2691
	  $show "${rm}r $removelist"
2692
	  $run ${rm}r $removelist
2693
        fi
2694
      fi
2695
2696
      # Now set the variables for building old libraries.
2697
      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2698
	oldlibs="$oldlibs $output_objdir/$libname.$libext"
2699
2700
	# Transform .lo files to .o files.
2701
	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2702
      fi
2703
2704
      # Eliminate all temporary directories.
2705
      for path in $notinst_path; do
2706
	lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2707
	deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2708
	dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2709
      done
2710
2711
      if test -n "$xrpath"; then
2712
	# If the user specified any rpath flags, then add them.
2713
	temp_xrpath=
2714
	for libdir in $xrpath; do
2715
	  temp_xrpath="$temp_xrpath -R$libdir"
2716
	  case "$finalize_rpath " in
2717
	  *" $libdir "*) ;;
2718
	  *) finalize_rpath="$finalize_rpath $libdir" ;;
2719
	  esac
2720
	done
2721
	if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2722
	  dependency_libs="$temp_xrpath $dependency_libs"
2723
	fi
2724
      fi
2725
2726
      # Make sure dlfiles contains only unique files that won't be dlpreopened
2727
      old_dlfiles="$dlfiles"
2728
      dlfiles=
2729
      for lib in $old_dlfiles; do
2730
	case " $dlprefiles $dlfiles " in
2731
	*" $lib "*) ;;
2732
	*) dlfiles="$dlfiles $lib" ;;
2733
	esac
2734
      done
2735
2736
      # Make sure dlprefiles contains only unique files
2737
      old_dlprefiles="$dlprefiles"
2738
      dlprefiles=
2739
      for lib in $old_dlprefiles; do
2740
	case "$dlprefiles " in
2741
	*" $lib "*) ;;
2742
	*) dlprefiles="$dlprefiles $lib" ;;
2743
	esac
2744
      done
2745
2746
      if test "$build_libtool_libs" = yes; then
2747
	if test -n "$rpath"; then
2748
	  case $host in
2749
	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2750
	    # these systems don't actually have a c library (as such)!
2751
	    ;;
2752
	  *-*-rhapsody* | *-*-darwin1.[012])
2753
	    # Rhapsody C library is in the System framework
2754
	    deplibs="$deplibs -framework System"
2755
	    ;;
2756
	  *-*-netbsd*)
2757
	    # Don't link with libc until the a.out ld.so is fixed.
2758
	    ;;
2759
	  *)
2760
	    # Add libc to deplibs on all other systems if necessary.
2761
	    if test $build_libtool_need_lc = "yes"; then
2762
	      deplibs="$deplibs -lc"
2763
	    fi
2764
	    ;;
2765
	  esac
2766
	fi
2767
2768
	# Transform deplibs into only deplibs that can be linked in shared.
2769
	name_save=$name
2770
	libname_save=$libname
2771
	release_save=$release
2772
	versuffix_save=$versuffix
2773
	major_save=$major
2774
	# I'm not sure if I'm treating the release correctly.  I think
2775
	# release should show up in the -l (ie -lgmp5) so we don't want to
2776
	# add it in twice.  Is that correct?
2777
	release=""
2778
	versuffix=""
2779
	major=""
2780
	newdeplibs=
2781
	droppeddeps=no
2782
	case $deplibs_check_method in
2783
	pass_all)
2784
	  # Don't check for shared/static.  Everything works.
2785
	  # This might be a little naive.  We might want to check
2786
	  # whether the library exists or not.  But this is on
2787
	  # osf3 & osf4 and I'm not really sure... Just
2788
	  # implementing what was already the behaviour.
2789
	  newdeplibs=$deplibs
2790
	  ;;
2791
	test_compile)
2792
	  # This code stresses the "libraries are programs" paradigm to its
2793
	  # limits. Maybe even breaks it.  We compile a program, linking it
2794
	  # against the deplibs as a proxy for the library.  Then we can check
2795
	  # whether they linked in statically or dynamically with ldd.
2796
	  $rm conftest.c
2797
	  cat > conftest.c <<EOF
2798
	  int main() { return 0; }
2799
EOF
2800
	  $rm conftest
2801
	  $LTCC -o conftest conftest.c $deplibs
2802
	  if test $? -eq 0 ; then
2803
	    ldd_output=`ldd conftest`
2804
	    for i in $deplibs; do
2805
	      name="`expr $i : '-l\(.*\)'`"
2806
	      # If $name is empty we are operating on a -L argument.
2807
	      if test -n "$name" && test "$name" != "0"; then
2808
		libname=`eval \\$echo \"$libname_spec\"`
2809
		deplib_matches=`eval \\$echo \"$library_names_spec\"`
2810
		set dummy $deplib_matches
2811
		deplib_match=$2
2812
		if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2813
		  newdeplibs="$newdeplibs $i"
2814
		else
2815
		  droppeddeps=yes
2816
		  echo
2817
		  echo "*** Warning: This library needs some functionality provided by $i."
2818
		  echo "*** I have the capability to make that library automatically link in when"
2819
		  echo "*** you link to this library.  But I can only do this if you have a"
2820
		  echo "*** shared version of the library, which you do not appear to have."
2821
		fi
2822
	      else
2823
		newdeplibs="$newdeplibs $i"
2824
	      fi
2825
	    done
2826
	  else
2827
	    # Error occured in the first compile.  Let's try to salvage the situation:
2828
	    # Compile a seperate program for each library.
2829
	    for i in $deplibs; do
2830
	      name="`expr $i : '-l\(.*\)'`"
2831
	     # If $name is empty we are operating on a -L argument.
2832
	      if test -n "$name" && test "$name" != "0"; then
2833
		$rm conftest
2834
		$LTCC -o conftest conftest.c $i
2835
		# Did it work?
2836
		if test $? -eq 0 ; then
2837
		  ldd_output=`ldd conftest`
2838
		  libname=`eval \\$echo \"$libname_spec\"`
2839
		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2840
		  set dummy $deplib_matches
2841
		  deplib_match=$2
2842
		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2843
		    newdeplibs="$newdeplibs $i"
2844
		  else
2845
		    droppeddeps=yes
2846
		    echo
2847
		    echo "*** Warning: This library needs some functionality provided by $i."
2848
		    echo "*** I have the capability to make that library automatically link in when"
2849
		    echo "*** you link to this library.  But I can only do this if you have a"
2850
		    echo "*** shared version of the library, which you do not appear to have."
2851
		  fi
2852
		else
2853
		  droppeddeps=yes
2854
		  echo
2855
		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2856
		  echo "***  make it link in!  You will probably need to install it or some"
2857
		  echo "*** library that it depends on before this library will be fully"
2858
		  echo "*** functional.  Installing it before continuing would be even better."
2859
		fi
2860
	      else
2861
		newdeplibs="$newdeplibs $i"
2862
	      fi
2863
	    done
2864
	  fi
2865
	  ;;
2866
	file_magic*)
2867
	  set dummy $deplibs_check_method
2868
	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2869
	  for a_deplib in $deplibs; do
2870
	    name="`expr $a_deplib : '-l\(.*\)'`"
2871
	    # If $name is empty we are operating on a -L argument.
2872
	    if test -n "$name" && test "$name" != "0"; then
2873
	      libname=`eval \\$echo \"$libname_spec\"`
2874
	      for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2875
		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2876
		    for potent_lib in $potential_libs; do
2877
		      # Follow soft links.
2878
		      if ls -lLd "$potent_lib" 2>/dev/null \
2879
			 | grep " -> " >/dev/null; then
2880
			continue
2881
		      fi
2882
		      # The statement above tries to avoid entering an
2883
		      # endless loop below, in case of cyclic links.
2884
		      # We might still enter an endless loop, since a link
2885
		      # loop can be closed while we follow links,
2886
		      # but so what?
2887
		      potlib="$potent_lib"
2888
		      while test -h "$potlib" 2>/dev/null; do
2889
			potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2890
			case $potliblink in
2891
			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2892
			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2893
			esac
2894
		      done
2895
		      # It is ok to link against an archive when
2896
		      # building a shared library.
2897
		      if $AR -t $potlib > /dev/null 2>&1; then
2898
			newdeplibs="$newdeplibs $a_deplib"
2899
			a_deplib=""
2900
			break 2
2901
		      fi
2902
		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2903
			 | sed 10q \
2904
			 | egrep "$file_magic_regex" > /dev/null; then
2905
			newdeplibs="$newdeplibs $a_deplib"
2906
			a_deplib=""
2907
			break 2
2908
		      fi
2909
		    done
2910
	      done
2911
	      if test -n "$a_deplib" ; then
2912
		droppeddeps=yes
2913
		echo
2914
		echo "*** Warning: This library needs some functionality provided by $a_deplib."
2915
		echo "*** I have the capability to make that library automatically link in when"
2916
		echo "*** you link to this library.  But I can only do this if you have a"
2917
		echo "*** shared version of the library, which you do not appear to have."
2918
	      fi
2919
	    else
2920
	      # Add a -L argument.
2921
	      newdeplibs="$newdeplibs $a_deplib"
2922
	    fi
2923
	  done # Gone through all deplibs.
2924
	  ;;
2925
	match_pattern*)
2926
	  set dummy $deplibs_check_method
2927
	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2928
	  for a_deplib in $deplibs; do
2929
	    name="`expr $a_deplib : '-l\(.*\)'`"
2930
	    # If $name is empty we are operating on a -L argument.
2931
	    if test -n "$name" && test "$name" != "0"; then
2932
	      libname=`eval \\$echo \"$libname_spec\"`
2933
	      for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2934
		potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2935
		for potent_lib in $potential_libs; do
2936
		  if eval echo \"$potent_lib\" 2>/dev/null \
2937
		      | sed 10q \
2938
		      | egrep "$match_pattern_regex" > /dev/null; then
2939
		    newdeplibs="$newdeplibs $a_deplib"
2940
		    a_deplib=""
2941
		    break 2
2942
		  fi
2943
		done
2944
	      done
2945
	      if test -n "$a_deplib" ; then
2946
		droppeddeps=yes
2947
		echo
2948
		echo "*** Warning: This library needs some functionality provided by $a_deplib."
2949
		echo "*** I have the capability to make that library automatically link in when"
2950
		echo "*** you link to this library.  But I can only do this if you have a"
2951
		echo "*** shared version of the library, which you do not appear to have."
2952
	      fi
2953
	    else
2954
	      # Add a -L argument.
2955
	      newdeplibs="$newdeplibs $a_deplib"
2956
	    fi
2957
	  done # Gone through all deplibs.
2958
	  ;;
2959
	none | unknown | *)
2960
	  newdeplibs=""
2961
	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2962
	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
2963
	     grep . >/dev/null; then
2964
	    echo
2965
	    if test "X$deplibs_check_method" = "Xnone"; then
2966
	      echo "*** Warning: inter-library dependencies are not supported in this platform."
2967
	    else
2968
	      echo "*** Warning: inter-library dependencies are not known to be supported."
2969
	    fi
2970
	    echo "*** All declared inter-library dependencies are being dropped."
2971
	    droppeddeps=yes
2972
	  fi
2973
	  ;;
2974
	esac
2975
	versuffix=$versuffix_save
2976
	major=$major_save
2977
	release=$release_save
2978
	libname=$libname_save
2979
	name=$name_save
2980
2981
	case $host in
2982
	*-*-rhapsody* | *-*-darwin1.[012])
2983
	  # On Rhapsody replace the C library is the System framework
2984
	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2985
	  ;;
2986
	esac
2987
2988
	if test "$droppeddeps" = yes; then
2989
	  if test "$module" = yes; then
2990
	    echo
2991
	    echo "*** Warning: libtool could not satisfy all declared inter-library"
2992
	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
2993
	    echo "*** a static module, that should work as long as the dlopening"
2994
	    echo "*** application is linked with the -dlopen flag."
2995
	    if test -z "$global_symbol_pipe"; then
2996
	      echo
2997
	      echo "*** However, this would only work if libtool was able to extract symbol"
2998
	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2999
	      echo "*** not find such a program.  So, this module is probably useless."
3000
	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
3001
	    fi
3002
	    if test "$build_old_libs" = no; then
3003
	      oldlibs="$output_objdir/$libname.$libext"
3004
	      build_libtool_libs=module
3005
	      build_old_libs=yes
3006
	    else
3007
	      build_libtool_libs=no
3008
	    fi
3009
	  else
3010
	    echo "*** The inter-library dependencies that have been dropped here will be"
3011
	    echo "*** automatically added whenever a program is linked with this library"
3012
	    echo "*** or is declared to -dlopen it."
3013
3014
	    if test $allow_undefined = no; then
3015
	      echo
3016
	      echo "*** Since this library must not contain undefined symbols,"
3017
	      echo "*** because either the platform does not support them or"
3018
	      echo "*** it was explicitly requested with -no-undefined,"
3019
	      echo "*** libtool will only create a static version of it."
3020
	      if test "$build_old_libs" = no; then
3021
		oldlibs="$output_objdir/$libname.$libext"
3022
		build_libtool_libs=module
3023
		build_old_libs=yes
3024
	      else
3025
		build_libtool_libs=no
3026
	      fi
3027
	    fi
3028
	  fi
3029
	fi
3030
	# Done checking deplibs!
3031
	deplibs=$newdeplibs
3032
      fi
3033
3034
      # All the library-specific variables (install_libdir is set above).
3035
      library_names=
3036
      old_library=
3037
      dlname=
3038
3039
      # Test again, we may have decided not to build it any more
3040
      if test "$build_libtool_libs" = yes; then
3041
	if test $hardcode_into_libs = yes; then
3042
	  # Hardcode the library paths
3043
	  hardcode_libdirs=
3044
	  dep_rpath=
3045
	  rpath="$finalize_rpath"
3046
	  test "$mode" != relink && rpath="$compile_rpath$rpath"
3047
	  for libdir in $rpath; do
3048
	    if test -n "$hardcode_libdir_flag_spec"; then
3049
	      if test -n "$hardcode_libdir_separator"; then
3050
		if test -z "$hardcode_libdirs"; then
3051
		  hardcode_libdirs="$libdir"
3052
		else
3053
		  # Just accumulate the unique libdirs.
3054
		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3055
		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3056
		    ;;
3057
		  *)
3058
		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3059
		    ;;
3060
		  esac
3061
		fi
3062
	      else
3063
		eval flag=\"$hardcode_libdir_flag_spec\"
3064
		dep_rpath="$dep_rpath $flag"
3065
	      fi
3066
	    elif test -n "$runpath_var"; then
3067
	      case "$perm_rpath " in
3068
	      *" $libdir "*) ;;
3069
	      *) perm_rpath="$perm_rpath $libdir" ;;
3070
	      esac
3071
	    fi
3072
	  done
3073
	  # Substitute the hardcoded libdirs into the rpath.
3074
	  if test -n "$hardcode_libdir_separator" &&
3075
	     test -n "$hardcode_libdirs"; then
3076
	    libdir="$hardcode_libdirs"
3077
	    eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3078
	  fi
3079
	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
3080
	    # We should set the runpath_var.
3081
	    rpath=
3082
	    for dir in $perm_rpath; do
3083
	      rpath="$rpath$dir:"
3084
	    done
3085
	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3086
	  fi
3087
	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3088
	fi
3089
3090
	shlibpath="$finalize_shlibpath"
3091
	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3092
	if test -n "$shlibpath"; then
3093
	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3094
	fi
3095
3096
	# Get the real and link names of the library.
3097
	eval library_names=\"$library_names_spec\"
3098
	set dummy $library_names
3099
	realname="$2"
3100
	shift; shift
3101
3102
	if test -n "$soname_spec"; then
3103
	  eval soname=\"$soname_spec\"
3104
	else
3105
	  soname="$realname"
3106
	fi
3107
	test -z "$dlname" && dlname=$soname
3108
3109
	lib="$output_objdir/$realname"
3110
	for link
3111
	do
3112
	  linknames="$linknames $link"
3113
	done
3114
3115
#	# Ensure that we have .o objects for linkers which dislike .lo
3116
#	# (e.g. aix) in case we are running --disable-static
3117
#	for obj in $libobjs; do
3118
#	  xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
3119
#	  if test "X$xdir" = "X$obj"; then
3120
#	    xdir="."
3121
#	  else
3122
#	    xdir="$xdir"
3123
#	  fi
3124
#	  baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
3125
#	  oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3126
#	  if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
3127
#	    $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
3128
#	    $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
3129
#	  fi
3130
#	done
3131
3132
	# Use standard objects if they are pic
3133
	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3134
3135
	# Prepare the list of exported symbols
3136
	if test -z "$export_symbols"; then
3137
	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3138
	    $show "generating symbol list for \`$libname.la'"
3139
	    export_symbols="$output_objdir/$libname.exp"
3140
	    $run $rm $export_symbols
3141
	    eval cmds=\"$export_symbols_cmds\"
3142
	    IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
3143
	    for cmd in $cmds; do
3144
	      IFS="$save_ifs"
3145
	      $show "$cmd"
3146
	      $run eval "$cmd" || exit $?
3147
	    done
3148
	    IFS="$save_ifs"
3149
	    if test -n "$export_symbols_regex"; then
3150
	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3151
	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3152
	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3153
	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
3154
	    fi
3155
	  fi
3156
	fi
3157
3158
	if test -n "$export_symbols" && test -n "$include_expsyms"; then
3159
	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3160
	fi
3161
3162
	if test -n "$convenience"; then
3163
	  if test -n "$whole_archive_flag_spec"; then
3164
	    save_libobjs=$libobjs
3165
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3166
	  else
3167
	    gentop="$output_objdir/${outputname}x"
3168
	    $show "${rm}r $gentop"
3169
	    $run ${rm}r "$gentop"
3170
	    $show "$mkdir $gentop"
3171
	    $run $mkdir "$gentop"
3172
	    status=$?
3173
	    if test $status -ne 0 && test ! -d "$gentop"; then
3174
	      exit $status
3175
	    fi
3176
	    generated="$generated $gentop"
3177
3178
	    for xlib in $convenience; do
3179
	      # Extract the objects.
3180
	      case $xlib in
3181
	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3182
	      *) xabs=`pwd`"/$xlib" ;;
3183
	      esac
3184
	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3185
	      xdir="$gentop/$xlib"
3186
3187
	      $show "${rm}r $xdir"
3188
	      $run ${rm}r "$xdir"
3189
	      $show "$mkdir $xdir"
3190
	      $run $mkdir "$xdir"
3191
	      status=$?
3192
	      if test $status -ne 0 && test ! -d "$xdir"; then
3193
		exit $status
3194
	      fi
3195
	      $show "(cd $xdir && $AR x $xabs)"
3196
	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3197
3198
	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3199
	    done
3200
	  fi
3201
	fi
3202
3203
	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3204
	  eval flag=\"$thread_safe_flag_spec\"
3205
	  linker_flags="$linker_flags $flag"
3206
	fi
3207
3208
	# Make a backup of the uninstalled library when relinking
3209
	if test "$mode" = relink; then
3210
	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3211
	fi
3212
3213
	# Do each of the archive commands.
3214
	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3215
	  eval cmds=\"$archive_expsym_cmds\"
3216
	else
3217
	  eval cmds=\"$archive_cmds\"
3218
	fi
3219
        if len=`expr "X$cmds" : ".*"` &&
3220
           test $len -le $max_cmd_len; then
3221
          :
3222
        else
3223
	  # The command line is too long to link in one step, link piecewise.
3224
          $echo "creating reloadable object files..."
3225
3226
	  # Save the value of $output and $libobjs because we want to
3227
	  # use them later.  If we have whole_archive_flag_spec, we
3228
	  # want to use save_libobjs as it was before
3229
	  # whole_archive_flag_spec was expanded, because we can't
3230
	  # assume the linker understands whole_archive_flag_spec.
3231
	  # This may have to be revisited, in case too many
3232
	  # convenience libraries get linked in and end up exceeding
3233
	  # the spec.
3234
	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3235
	    save_libobjs=$libobjs
3236
	  fi
3237
          save_output=$output
3238
3239
	  # Clear the reloadable object creation command queue and
3240
	  # initialize k to one.
3241
          test_cmds=
3242
          concat_cmds=
3243
          objlist=
3244
          delfiles=
3245
          last_robj=
3246
          k=1
3247
          output=$output_objdir/$save_output-${k}.$objext
3248
	  # Loop over the list of objects to be linked.
3249
          for obj in $save_libobjs
3250
          do
3251
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3252
            if test "X$objlist" = X ||
3253
	       { len=`expr "X$test_cmds" : ".*"` &&
3254
                 test $len -le $max_cmd_len; }; then
3255
              objlist="$objlist $obj"
3256
            else
3257
	      # The command $test_cmds is almost too long, add a
3258
	      # command to the queue.
3259
              if test $k -eq 1 ; then
3260
	        # The first file doesn't have a previous command to add.
3261
                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3262
              else
3263
	        # All subsequent reloadable object files will link in
3264
	        # the last one created.
3265
                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3266
              fi
3267
              last_robj=$output_objdir/$save_output-${k}.$objext
3268
              k=`expr $k + 1`
3269
              output=$output_objdir/$save_output-${k}.$objext
3270
              objlist=$obj
3271
              len=1
3272
            fi
3273
          done
3274
	  # Handle the remaining objects by creating one last
3275
	  # reloadable object file.  All subsequent reloadable object
3276
	  # files will link in the last one created.
3277
	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3278
          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3279
3280
	  # Set up a command to remove the reloadale object files
3281
	  # after they are used.
3282
          i=0
3283
          while test $i -lt $k
3284
          do
3285
            i=`expr $i + 1`
3286
            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3287
          done
3288
3289
          $echo "creating a temporary reloadable object file: $output"
3290
3291
	  # Loop through the commands generated above and execute them.
3292
          IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
3293
          for cmd in $concat_cmds; do
3294
            IFS="$save_ifs"
3295
            $show "$cmd"
3296
            $run eval "$cmd" || exit $?
3297
          done
3298
          IFS="$save_ifs"
3299
3300
          libobjs=$output
3301
	  # Restore the value of output.
3302
          output=$save_output
3303
3304
	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3305
	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3306
	  fi
3307
	  # Expand the library linking commands again to reset the
3308
	  # value of $libobjs for piecewise linking.
3309
3310
	  # Do each of the archive commands.
3311
          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3312
            eval cmds=\"$archive_expsym_cmds\"
3313
          else
3314
            eval cmds=\"$archive_cmds\"
3315
          fi
3316
3317
	  # Append the command to remove the reloadable object files
3318
	  # to the just-reset $cmds.
3319
          eval cmds=\"\$cmds~$rm $delfiles\"
3320
        fi
3321
        IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
3322
        for cmd in $cmds; do
3323
          IFS="$save_ifs"
3324
          $show "$cmd"
3325
          $run eval "$cmd" || exit $?
3326
        done
3327
        IFS="$save_ifs"
3328
3329
	# Restore the uninstalled library and exit
3330
	if test "$mode" = relink; then
3331
	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3332
	  exit 0
3333
	fi
3334
3335
	# Create links to the real library.
3336
	for linkname in $linknames; do
3337
	  if test "$realname" != "$linkname"; then
3338
	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3339
	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3340
	  fi
3341
	done
3342
3343
	# If -module or -export-dynamic was specified, set the dlname.
3344
	if test "$module" = yes || test "$export_dynamic" = yes; then
3345
	  # On all known operating systems, these are identical.
3346
	  dlname="$soname"
3347
	fi
3348
      fi
3349
      ;;
3350
3351
    obj)
3352
      if test -n "$deplibs"; then
3353
	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3354
      fi
3355
3356
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3357
	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3358
      fi
3359
3360
      if test -n "$rpath"; then
3361
	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3362
      fi
3363
3364
      if test -n "$xrpath"; then
3365
	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3366
      fi
3367
3368
      if test -n "$vinfo"; then
3369
	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3370
      fi
3371
3372
      if test -n "$release"; then
3373
	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3374
      fi
3375
3376
      case $output in
3377
      *.lo)
3378
	if test -n "$objs$old_deplibs"; then
3379
	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3380
	  exit 1
3381
	fi
3382
	libobj="$output"
3383
	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3384
	;;
3385
      *)
3386
	libobj=
3387
	obj="$output"
3388
	;;
3389
      esac
3390
3391
      # Delete the old objects.
3392
      $run $rm $obj $libobj
3393
3394
      # Objects from convenience libraries.  This assumes
3395
      # single-version convenience libraries.  Whenever we create
3396
      # different ones for PIC/non-PIC, this we'll have to duplicate
3397
      # the extraction.
3398
      reload_conv_objs=
3399
      gentop=
3400
      # reload_cmds runs $LD directly, so let us get rid of
3401
      # -Wl from whole_archive_flag_spec
3402
      wl=
3403
3404
      if test -n "$convenience"; then
3405
	if test -n "$whole_archive_flag_spec"; then
3406
	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3407
	else
3408
	  gentop="$output_objdir/${obj}x"
3409
	  $show "${rm}r $gentop"
3410
	  $run ${rm}r "$gentop"
3411
	  $show "$mkdir $gentop"
3412
	  $run $mkdir "$gentop"
3413
	  status=$?
3414
	  if test $status -ne 0 && test ! -d "$gentop"; then
3415
	    exit $status
3416
	  fi
3417
	  generated="$generated $gentop"
3418
3419
	  for xlib in $convenience; do
3420
	    # Extract the objects.
3421
	    case $xlib in
3422
	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3423
	    *) xabs=`pwd`"/$xlib" ;;
3424
	    esac
3425
	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3426
	    xdir="$gentop/$xlib"
3427
3428
	    $show "${rm}r $xdir"
3429
	    $run ${rm}r "$xdir"
3430
	    $show "$mkdir $xdir"
3431
	    $run $mkdir "$xdir"
3432
	    status=$?
3433
	    if test $status -ne 0 && test ! -d "$xdir"; then
3434
	      exit $status
3435
	    fi
3436
	    $show "(cd $xdir && $AR x $xabs)"
3437
	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3438
3439
	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3440
	  done
3441
	fi
3442
      fi
3443
3444
      # Create the old-style object.
3445
      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
3446
3447
      output="$obj"
3448
      eval cmds=\"$reload_cmds\"
3449
      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
3450
      for cmd in $cmds; do
3451
	IFS="$save_ifs"
3452
	$show "$cmd"
3453
	$run eval "$cmd" || exit $?
3454
      done
3455
      IFS="$save_ifs"
3456
3457
      # Exit if we aren't doing a library object file.
3458
      if test -z "$libobj"; then
3459
	if test -n "$gentop"; then
3460
	  $show "${rm}r $gentop"
3461
	  $run ${rm}r $gentop
3462
	fi
3463
3464
	exit 0
3465
      fi
3466
3467
      if test "$build_libtool_libs" != yes; then
3468
	if test -n "$gentop"; then
3469
	  $show "${rm}r $gentop"
3470
	  $run ${rm}r $gentop
3471
	fi
3472
3473
	# Create an invalid libtool object if no PIC, so that we don't
3474
	# accidentally link it into a program.
3475
	# $show "echo timestamp > $libobj"
3476
	# $run eval "echo timestamp > $libobj" || exit $?
3477
	exit 0
3478
      fi
3479
3480
      if test -n "$pic_flag" || test "$pic_mode" != default; then
3481
	# Only do commands if we really have different PIC objects.
3482
	reload_objs="$libobjs $reload_conv_objs"
3483
	output="$libobj"
3484
	eval cmds=\"$reload_cmds\"
3485
	IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
3486
	for cmd in $cmds; do
3487
	  IFS="$save_ifs"
3488
	  $show "$cmd"
3489
	  $run eval "$cmd" || exit $?
3490
	done
3491
	IFS="$save_ifs"
3492
#     else
3493
#	# Just create a symlink.
3494
#	$show $rm $libobj
3495
#	$run $rm $libobj
3496
#	xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3497
#	if test "X$xdir" = "X$libobj"; then
3498
#	  xdir="."
3499
#	else
3500
#	  xdir="$xdir"
3501
#	fi
3502
#	baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3503
#	oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3504
#	$show "(cd $xdir && $LN_S $oldobj $baseobj)"
3505
#	$run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3506
      fi
3507
3508
      if test -n "$gentop"; then
3509
	$show "${rm}r $gentop"
3510
	$run ${rm}r $gentop
3511
      fi
3512
3513
      exit 0
3514
      ;;
3515
3516
    prog)
3517
      case $host in
3518
	*cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3519
      esac
3520
      if test -n "$vinfo"; then
3521
	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3522
      fi
3523
3524
      if test -n "$release"; then
3525
	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3526
      fi
3527
3528
      if test "$preload" = yes; then
3529
	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3530
	   test "$dlopen_self_static" = unknown; then
3531
	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3532
	fi
3533
      fi
3534
3535
      case $host in
3536
      *-*-rhapsody* | *-*-darwin1.[012])
3537
	# On Rhapsody replace the C library is the System framework
3538
	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3539
	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3540
	;;
3541
      esac
3542
3543
      compile_command="$compile_command $compile_deplibs"
3544
      finalize_command="$finalize_command $finalize_deplibs"
3545
3546
      if test -n "$rpath$xrpath"; then
3547
	# If the user specified any rpath flags, then add them.
3548
	for libdir in $rpath $xrpath; do
3549
	  # This is the magic to use -rpath.
3550
	  case "$finalize_rpath " in
3551
	  *" $libdir "*) ;;
3552
	  *) finalize_rpath="$finalize_rpath $libdir" ;;
3553
	  esac
3554
	done
3555
      fi
3556
3557
      # Now hardcode the library paths
3558
      rpath=
3559
      hardcode_libdirs=
3560
      for libdir in $compile_rpath $finalize_rpath; do
3561
	if test -n "$hardcode_libdir_flag_spec"; then
3562
	  if test -n "$hardcode_libdir_separator"; then
3563
	    if test -z "$hardcode_libdirs"; then
3564
	      hardcode_libdirs="$libdir"
3565
	    else
3566
	      # Just accumulate the unique libdirs.
3567
	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3568
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3569
		;;
3570
	      *)
3571
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3572
		;;
3573
	      esac
3574
	    fi
3575
	  else
3576
	    eval flag=\"$hardcode_libdir_flag_spec\"
3577
	    rpath="$rpath $flag"
3578
	  fi
3579
	elif test -n "$runpath_var"; then
3580
	  case "$perm_rpath " in
3581
	  *" $libdir "*) ;;
3582
	  *) perm_rpath="$perm_rpath $libdir" ;;
3583
	  esac
3584
	fi
3585
	case $host in
3586
	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3587
	  case :$dllsearchpath: in
3588
	  *":$libdir:"*) ;;
3589
	  *) dllsearchpath="$dllsearchpath:$libdir";;
3590
	  esac
3591
	  ;;
3592
	esac
3593
      done
3594
      # Substitute the hardcoded libdirs into the rpath.
3595
      if test -n "$hardcode_libdir_separator" &&
3596
	 test -n "$hardcode_libdirs"; then
3597
	libdir="$hardcode_libdirs"
3598
	eval rpath=\" $hardcode_libdir_flag_spec\"
3599
      fi
3600
      compile_rpath="$rpath"
3601
3602
      rpath=
3603
      hardcode_libdirs=
3604
      for libdir in $finalize_rpath; do
3605
	if test -n "$hardcode_libdir_flag_spec"; then
3606
	  if test -n "$hardcode_libdir_separator"; then
3607
	    if test -z "$hardcode_libdirs"; then
3608
	      hardcode_libdirs="$libdir"
3609
	    else
3610
	      # Just accumulate the unique libdirs.
3611
	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3612
	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3613
		;;
3614
	      *)
3615
		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3616
		;;
3617
	      esac
3618
	    fi
3619
	  else
3620
	    eval flag=\"$hardcode_libdir_flag_spec\"
3621
	    rpath="$rpath $flag"
3622
	  fi
3623
	elif test -n "$runpath_var"; then
3624
	  case "$finalize_perm_rpath " in
3625
	  *" $libdir "*) ;;
3626
	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3627
	  esac
3628
	fi
3629
      done
3630
      # Substitute the hardcoded libdirs into the rpath.
3631
      if test -n "$hardcode_libdir_separator" &&
3632
	 test -n "$hardcode_libdirs"; then
3633
	libdir="$hardcode_libdirs"
3634
	eval rpath=\" $hardcode_libdir_flag_spec\"
3635
      fi
3636
      finalize_rpath="$rpath"
3637
3638
      dlsyms=
3639
      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3640
	if test -n "$NM" && test -n "$global_symbol_pipe"; then
3641
	  dlsyms="${outputname}S.c"
3642
	else
3643
	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3644
	fi
3645
      fi
3646
3647
      if test -n "$dlsyms"; then
3648
	case $dlsyms in
3649
	"") ;;
3650
	*.c)
3651
	  # Discover the nlist of each of the dlfiles.
3652
	  nlist="$output_objdir/${outputname}.nm"
3653
3654
	  $show "$rm $nlist ${nlist}S ${nlist}T"
3655
	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
3656
3657
	  # Parse the name list into a source file.
3658
	  $show "creating $output_objdir/$dlsyms"
3659
3660
	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3661
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3662
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3663
3664
#ifdef __cplusplus
3665
extern \"C\" {
3666
#endif
3667
3668
/* Prevent the only kind of declaration conflicts we can make. */
3669
#define lt_preloaded_symbols some_other_symbol
3670
3671
/* External symbol declarations for the compiler. */\
3672
"
3673
3674
	  if test "$dlself" = yes; then
3675
	    $show "generating symbol list for \`$output'"
3676
3677
	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3678
3679
	    # Add our own program objects to the symbol list.
3680
	    progfiles="$objs$old_deplibs"
3681
	    for arg in $progfiles; do
3682
	      $show "extracting global C symbols from \`$arg'"
3683
	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3684
	    done
3685
3686
	    if test -n "$exclude_expsyms"; then
3687
	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3688
	      $run eval '$mv "$nlist"T "$nlist"'
3689
	    fi
3690
3691
	    if test -n "$export_symbols_regex"; then
3692
	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3693
	      $run eval '$mv "$nlist"T "$nlist"'
3694
	    fi
3695
3696
	    # Prepare the list of exported symbols
3697
	    if test -z "$export_symbols"; then
3698
	      export_symbols="$output_objdir/$output.exp"
3699
	      $run $rm $export_symbols
3700
	      $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3701
	    else
3702
	      $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3703
	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3704
	      $run eval 'mv "$nlist"T "$nlist"'
3705
	    fi
3706
	  fi
3707
3708
	  for arg in $dlprefiles; do
3709
	    $show "extracting global C symbols from \`$arg'"
3710
	    name=`echo "$arg" | sed -e 's%^.*/%%'`
3711
	    $run eval 'echo ": $name " >> "$nlist"'
3712
	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3713
	  done
3714
3715
	  if test -z "$run"; then
3716
	    # Make sure we have at least an empty file.
3717
	    test -f "$nlist" || : > "$nlist"
3718
3719
	    if test -n "$exclude_expsyms"; then
3720
	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3721
	      $mv "$nlist"T "$nlist"
3722
	    fi
3723
3724
	    # Try sorting and uniquifying the output.
3725
	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3726
	      :
3727
	    else
3728
	      grep -v "^: " < "$nlist" > "$nlist"S
3729
	    fi
3730
3731
	    if test -f "$nlist"S; then
3732
	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3733
	    else
3734
	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
3735
	    fi
3736
3737
	    $echo >> "$output_objdir/$dlsyms" "\
3738
3739
#undef lt_preloaded_symbols
3740
3741
#if defined (__STDC__) && __STDC__
3742
# define lt_ptr_t void *
3743
#else
3744
# define lt_ptr_t char *
3745
# define const
3746
#endif
3747
3748
/* The mapping between symbol names and symbols. */
3749
const struct {
3750
  const char *name;
3751
  lt_ptr_t address;
3752
}
3753
lt_preloaded_symbols[] =
3754
{\
3755
"
3756
3757
	    sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
3758
		-e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
3759
		  < "$nlist" >> "$output_objdir/$dlsyms"
3760
3761
	    $echo >> "$output_objdir/$dlsyms" "\
3762
  {0, (lt_ptr_t) 0}
3763
};
3764
3765
/* This works around a problem in FreeBSD linker */
3766
#ifdef FREEBSD_WORKAROUND
3767
static const void *lt_preloaded_setup() {
3768
  return lt_preloaded_symbols;
3769
}
3770
#endif
3771
3772
#ifdef __cplusplus
3773
}
3774
#endif\
3775
"
3776
	  fi
3777
3778
	  pic_flag_for_symtable=
3779
	  case $host in
3780
	  # compiling the symbol table file with pic_flag works around
3781
	  # a FreeBSD bug that causes programs to crash when -lm is
3782
	  # linked before any other PIC object.  But we must not use
3783
	  # pic_flag when linking with -static.  The problem exists in
3784
	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3785
	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3786
	    case "$compile_command " in
3787
	    *" -static "*) ;;
3788
	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3789
	    esac;;
3790
	  *-*-hpux*)
3791
	    case "$compile_command " in
3792
	    *" -static "*) ;;
3793
	    *) pic_flag_for_symtable=" $pic_flag";;
3794
	    esac
3795
	  esac
3796
3797
	  # Now compile the dynamic symbol file.
3798
	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3799
	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3800
3801
	  # Clean up the generated files.
3802
	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3803
	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3804
3805
	  # Transform the symbol file into the correct name.
3806
	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3807
	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3808
	  ;;
3809
	*)
3810
	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3811
	  exit 1
3812
	  ;;
3813
	esac
3814
      else
3815
	# We keep going just in case the user didn't refer to
3816
	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
3817
	# really was required.
3818
3819
	# Nullify the symbol file.
3820
	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3821
	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3822
      fi
3823
3824
      if test $need_relink = no || test "$build_libtool_libs" != yes; then
3825
	# Replace the output file specification.
3826
	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3827
	link_command="$compile_command$compile_rpath"
3828
3829
	# We have no uninstalled library dependencies, so finalize right now.
3830
	$show "$link_command"
3831
	$run eval "$link_command"
3832
	status=$?
3833
3834
	# Delete the generated files.
3835
	if test -n "$dlsyms"; then
3836
	  $show "$rm $output_objdir/${outputname}S.${objext}"
3837
	  $run $rm "$output_objdir/${outputname}S.${objext}"
3838
	fi
3839
3840
	exit $status
3841
      fi
3842
3843
      if test -n "$shlibpath_var"; then
3844
	# We should set the shlibpath_var
3845
	rpath=
3846
	for dir in $temp_rpath; do
3847
	  case $dir in
3848
	  [\\/]* | [A-Za-z]:[\\/]*)
3849
	    # Absolute path.
3850
	    rpath="$rpath$dir:"
3851
	    ;;
3852
	  *)
3853
	    # Relative path: add a thisdir entry.
3854
	    rpath="$rpath\$thisdir/$dir:"
3855
	    ;;
3856
	  esac
3857
	done
3858
	temp_rpath="$rpath"
3859
      fi
3860
3861
      if test -n "$compile_shlibpath$finalize_shlibpath"; then
3862
	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3863
      fi
3864
      if test -n "$finalize_shlibpath"; then
3865
	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3866
      fi
3867
3868
      compile_var=
3869
      finalize_var=
3870
      if test -n "$runpath_var"; then
3871
	if test -n "$perm_rpath"; then
3872
	  # We should set the runpath_var.
3873
	  rpath=
3874
	  for dir in $perm_rpath; do
3875
	    rpath="$rpath$dir:"
3876
	  done
3877
	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3878
	fi
3879
	if test -n "$finalize_perm_rpath"; then
3880
	  # We should set the runpath_var.
3881
	  rpath=
3882
	  for dir in $finalize_perm_rpath; do
3883
	    rpath="$rpath$dir:"
3884
	  done
3885
	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3886
	fi
3887
      fi
3888
3889
      if test "$no_install" = yes; then
3890
	# We don't need to create a wrapper script.
3891
	link_command="$compile_var$compile_command$compile_rpath"
3892
	# Replace the output file specification.
3893
	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3894
	# Delete the old output file.
3895
	$run $rm $output
3896
	# Link the executable and exit
3897
	$show "$link_command"
3898
	$run eval "$link_command" || exit $?
3899
	exit 0
3900
      fi
3901
3902
      if test "$hardcode_action" = relink; then
3903
	# Fast installation is not supported
3904
	link_command="$compile_var$compile_command$compile_rpath"
3905
	relink_command="$finalize_var$finalize_command$finalize_rpath"
3906
3907
	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3908
	$echo "$modename: \`$output' will be relinked during installation" 1>&2
3909
      else
3910
	if test "$fast_install" != no; then
3911
	  link_command="$finalize_var$compile_command$finalize_rpath"
3912
	  if test "$fast_install" = yes; then
3913
	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3914
	  else
3915
	    # fast_install is set to needless
3916
	    relink_command=
3917
	  fi
3918
	else
3919
	  link_command="$compile_var$compile_command$compile_rpath"
3920
	  relink_command="$finalize_var$finalize_command$finalize_rpath"
3921
	fi
3922
      fi
3923
3924
      # Replace the output file specification.
3925
      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3926
3927
      # Delete the old output files.
3928
      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3929
3930
      $show "$link_command"
3931
      $run eval "$link_command" || exit $?
3932
3933
      # Now create the wrapper script.
3934
      $show "creating $output"
3935
3936
      # Quote the relink command for shipping.
3937
      if test -n "$relink_command"; then
3938
	# Preserve any variables that may affect compiler behavior
3939
	for var in $variables_saved_for_relink; do
3940
	  if eval test -z \"\${$var+set}\"; then
3941
	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3942
	  elif eval var_value=\$$var; test -z "$var_value"; then
3943
	    relink_command="$var=; export $var; $relink_command"
3944
	  else
3945
	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3946
	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
3947
	  fi
3948
	done
3949
	relink_command="cd `pwd`; $relink_command"
3950
	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3951
      fi
3952
3953
      # Quote $echo for shipping.
3954
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3955
	case $0 in
3956
	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3957
	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3958
	esac
3959
	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3960
      else
3961
	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3962
      fi
3963
3964
      # Only actually do things if our run command is non-null.
3965
      if test -z "$run"; then
3966
	# win32 will think the script is a binary if it has
3967
	# a .exe suffix, so we strip it off here.
3968
	case $output in
3969
	  *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3970
	esac
3971
	# test for cygwin because mv fails w/o .exe extensions
3972
	case $host in
3973
	  *cygwin*) exeext=.exe ;;
3974
	  *) exeext= ;;
3975
	esac
3976
	$rm $output
3977
	trap "$rm $output; exit 1" 1 2 15
3978
3979
	$echo > $output "\
3980
#! $SHELL
3981
3982
# $output - temporary wrapper script for $objdir/$outputname
3983
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3984
#
3985
# The $output program cannot be directly executed until all the libtool
3986
# libraries that it depends on are installed.
3987
#
3988
# This wrapper script should never be moved out of the build directory.
3989
# If it is, it will not operate correctly.
3990
3991
# Sed substitution that helps us do robust quoting.  It backslashifies
3992
# metacharacters that are still active within double-quoted strings.
3993
Xsed='sed -e 1s/^X//'
3994
sed_quote_subst='$sed_quote_subst'
3995
3996
# The HP-UX ksh and POSIX shell print the target directory to stdout
3997
# if CDPATH is set.
3998
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3999
4000
relink_command=\"$relink_command > /dev/null 2>&1\"
4001
4002
# This environment variable determines our operation mode.
4003
if test \"\$libtool_install_magic\" = \"$magic\"; then
4004
  # install mode needs the following variable:
4005
  notinst_deplibs='$notinst_deplibs'
4006
else
4007
  # When we are sourced in execute mode, \$file and \$echo are already set.
4008
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
4009
    echo=\"$qecho\"
4010
    file=\"\$0\"
4011
    # Make sure echo works.
4012
    if test \"X\$1\" = X--no-reexec; then
4013
      # Discard the --no-reexec flag, and continue.
4014
      shift
4015
    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4016
      # Yippee, \$echo works!
4017
      :
4018
    else
4019
      # Restart under the correct shell, and then maybe \$echo will work.
4020
      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4021
    fi
4022
  fi\
4023
"
4024
	$echo >> $output "\
4025
4026
  # Find the directory that this script lives in.
4027
  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4028
  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4029
4030
  # Follow symbolic links until we get to the real thisdir.
4031
  file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
4032
  while test -n \"\$file\"; do
4033
    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4034
4035
    # If there was a directory component, then change thisdir.
4036
    if test \"x\$destdir\" != \"x\$file\"; then
4037
      case \"\$destdir\" in
4038
      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4039
      *) thisdir=\"\$thisdir/\$destdir\" ;;
4040
      esac
4041
    fi
4042
4043
    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4044
    file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
4045
  done
4046
4047
  # Try to get the absolute directory name.
4048
  absdir=\`cd \"\$thisdir\" && pwd\`
4049
  test -n \"\$absdir\" && thisdir=\"\$absdir\"
4050
"
4051
4052
	if test "$fast_install" = yes; then
4053
	  echo >> $output "\
4054
  program=lt-'$outputname'$exeext
4055
  progdir=\"\$thisdir/$objdir\"
4056
4057
  if test ! -f \"\$progdir/\$program\" || \\
4058
     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
4059
       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4060
4061
    file=\"\$\$-\$program\"
4062
4063
    if test ! -d \"\$progdir\"; then
4064
      $mkdir \"\$progdir\"
4065
    else
4066
      $rm \"\$progdir/\$file\"
4067
    fi"
4068
4069
	  echo >> $output "\
4070
4071
    # relink executable if necessary
4072
    if test -n \"\$relink_command\"; then
4073
      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4074
      else
4075
        $echo \"\$relink_command_output\" >&2
4076
	$rm \"\$progdir/\$file\"
4077
	exit 1
4078
      fi
4079
    fi
4080
4081
    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4082
    { $rm \"\$progdir/\$program\";
4083
      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4084
    $rm \"\$progdir/\$file\"
4085
  fi"
4086
	else
4087
	  echo >> $output "\
4088
  program='$outputname'
4089
  progdir=\"\$thisdir/$objdir\"
4090
"
4091
	fi
4092
4093
	echo >> $output "\
4094
4095
  if test -f \"\$progdir/\$program\"; then"
4096
4097
	# Export our shlibpath_var if we have one.
4098
	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4099
	  $echo >> $output "\
4100
    # Add our own library path to $shlibpath_var
4101
    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4102
4103
    # Some systems cannot cope with colon-terminated $shlibpath_var
4104
    # The second colon is a workaround for a bug in BeOS R4 sed
4105
    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4106
4107
    export $shlibpath_var
4108
"
4109
	fi
4110
4111
	# fixup the dll searchpath if we need to.
4112
	if test -n "$dllsearchpath"; then
4113
	  $echo >> $output "\
4114
    # Add the dll search path components to the executable PATH
4115
    PATH=$dllsearchpath:\$PATH
4116
"
4117
	fi
4118
4119
	$echo >> $output "\
4120
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
4121
      # Run the actual program with our arguments.
4122
"
4123
	case $host in
4124
	# win32 systems need to use the prog path for dll
4125
	# lookup to work
4126
	*-*-cygwin* | *-*-pw32*)
4127
	  $echo >> $output "\
4128
      exec \$progdir/\$program \${1+\"\$@\"}
4129
"
4130
	  ;;
4131
4132
	# Backslashes separate directories on plain windows
4133
	*-*-mingw | *-*-os2*)
4134
	  $echo >> $output "\
4135
      exec \$progdir\\\\\$program \${1+\"\$@\"}
4136
"
4137
	  ;;
4138
4139
	*)
4140
	  $echo >> $output "\
4141
      # Export the path to the program.
4142
      PATH=\"\$progdir:\$PATH\"
4143
      export PATH
4144
4145
      exec \$program \${1+\"\$@\"}
4146
"
4147
	  ;;
4148
	esac
4149
	$echo >> $output "\
4150
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4151
      exit 1
4152
    fi
4153
  else
4154
    # The program doesn't exist.
4155
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4156
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4157
    echo \"See the $PACKAGE documentation for more information.\" 1>&2
4158
    exit 1
4159
  fi
4160
fi\
4161
"
4162
	chmod +x $output
4163
      fi
4164
      exit 0
4165
      ;;
4166
    esac
4167
4168
    # See if we need to build an old-fashioned archive.
4169
    for oldlib in $oldlibs; do
4170
4171
      if test "$build_libtool_libs" = convenience; then
4172
	oldobjs="$libobjs_save"
4173
	addlibs="$convenience"
4174
	build_libtool_libs=no
4175
      else
4176
	if test "$build_libtool_libs" = module; then
4177
	  oldobjs="$libobjs_save"
4178
	  build_libtool_libs=no
4179
	else
4180
	  oldobjs="$objs$old_deplibs $non_pic_objects"
4181
	fi
4182
	addlibs="$old_convenience"
4183
      fi
4184
4185
      if test -n "$addlibs"; then
4186
	gentop="$output_objdir/${outputname}x"
4187
	$show "${rm}r $gentop"
4188
	$run ${rm}r "$gentop"
4189
	$show "$mkdir $gentop"
4190
	$run $mkdir "$gentop"
4191
	status=$?
4192
	if test $status -ne 0 && test ! -d "$gentop"; then
4193
	  exit $status
4194
	fi
4195
	generated="$generated $gentop"
4196
4197
	# Add in members from convenience archives.
4198
	for xlib in $addlibs; do
4199
	  # Extract the objects.
4200
	  case $xlib in
4201
	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4202
	  *) xabs=`pwd`"/$xlib" ;;
4203
	  esac
4204
	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4205
	  xdir="$gentop/$xlib"
4206
4207
	  $show "${rm}r $xdir"
4208
	  $run ${rm}r "$xdir"
4209
	  $show "$mkdir $xdir"
4210
	  $run $mkdir "$xdir"
4211
	  status=$?
4212
	  if test $status -ne 0 && test ! -d "$xdir"; then
4213
	    exit $status
4214
	  fi
4215
	  $show "(cd $xdir && $AR x $xabs)"
4216
	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4217
4218
	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
4219
	done
4220
      fi
4221
4222
      # Do each command in the archive commands.
4223
      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4224
	eval cmds=\"$old_archive_from_new_cmds\"
4225
      else
4226
#	# Ensure that we have .o objects in place in case we decided
4227
#	# not to build a shared library, and have fallen back to building
4228
#	# static libs even though --disable-static was passed!
4229
#	for oldobj in $oldobjs; do
4230
#	  if test ! -f $oldobj; then
4231
#	    xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
4232
#	    if test "X$xdir" = "X$oldobj"; then
4233
#	      xdir="."
4234
#	    else
4235
#	      xdir="$xdir"
4236
#	    fi
4237
#	    baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
4238
#	    obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
4239
#	    $show "(cd $xdir && ${LN_S} $obj $baseobj)"
4240
#	    $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
4241
#	  fi
4242
#	done
4243
4244
        eval cmds=\"$old_archive_cmds\"
4245
4246
        if len=`expr "X$cmds" : ".*"` &&
4247
             test $len -le $max_cmd_len; then
4248
          :
4249
        else
4250
          # the command line is too long to link in one step, link in parts
4251
          $echo "using piecewise archive linking..."
4252
	  save_RANLIB=$RANLIB
4253
	  RANLIB=:
4254
          objlist=
4255
          concat_cmds=
4256
          save_oldobjs=$oldobjs
4257
          for obj in $save_oldobjs
4258
          do
4259
            oldobjs="$objlist $obj"
4260
            objlist="$objlist $obj"
4261
            eval test_cmds=\"$old_archive_cmds\"
4262
            if len=`expr "X$test_cmds" : ".*"` &&
4263
               test $len -le $max_cmd_len; then
4264
              :
4265
            else
4266
              # the above command should be used before it gets too long
4267
              oldobjs=$objlist
4268
	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4269
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4270
              objlist=
4271
            fi
4272
          done
4273
	  RANLIB=$save_RANLIB
4274
          oldobjs=$objlist
4275
          eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4276
        fi
4277
      fi
4278
      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
4279
      for cmd in $cmds; do
4280
	IFS="$save_ifs"
4281
	$show "$cmd"
4282
	$run eval "$cmd" || exit $?
4283
      done
4284
      IFS="$save_ifs"
4285
    done
4286
4287
    if test -n "$generated"; then
4288
      $show "${rm}r$generated"
4289
      $run ${rm}r$generated
4290
    fi
4291
4292
    # Now create the libtool archive.
4293
    case $output in
4294
    *.la)
4295
      old_library=
4296
      test "$build_old_libs" = yes && old_library="$libname.$libext"
4297
      $show "creating $output"
4298
4299
      # Preserve any variables that may affect compiler behavior
4300
      for var in $variables_saved_for_relink; do
4301
	if eval test -z \"\${$var+set}\"; then
4302
	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4303
	elif eval var_value=\$$var; test -z "$var_value"; then
4304
	  relink_command="$var=; export $var; $relink_command"
4305
	else
4306
	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4307
	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
4308
	fi
4309
      done
4310
      # Quote the link command for shipping.
4311
      tagopts=
4312
      for tag in $taglist; do
4313
        tagopts="$tagopts --tag $tag"
4314
      done
4315
      relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)"
4316
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4317
4318
      # Only create the output if not a dry run.
4319
      if test -z "$run"; then
4320
	for installed in no yes; do
4321
	  if test "$installed" = yes; then
4322
	    if test -z "$install_libdir"; then
4323
	      break
4324
	    fi
4325
	    output="$output_objdir/$outputname"i
4326
	    # Replace all uninstalled libtool libraries with the installed ones
4327
	    newdependency_libs=
4328
	    for deplib in $dependency_libs; do
4329
	      case $deplib in
4330
	      *.la)
4331
		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4332
		eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4333
		if test -z "$libdir"; then
4334
		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4335
		  exit 1
4336
		fi
4337
		newdependency_libs="$newdependency_libs $libdir/$name"
4338
		;;
4339
	      *) newdependency_libs="$newdependency_libs $deplib" ;;
4340
	      esac
4341
	    done
4342
	    dependency_libs="$newdependency_libs"
4343
	    newdlfiles=
4344
	    for lib in $dlfiles; do
4345
	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4346
	      eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4347
	      if test -z "$libdir"; then
4348
		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4349
		exit 1
4350
	      fi
4351
	      newdlfiles="$newdlfiles $libdir/$name"
4352
	    done
4353
	    dlfiles="$newdlfiles"
4354
	    newdlprefiles=
4355
	    for lib in $dlprefiles; do
4356
	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4357
	      eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4358
	      if test -z "$libdir"; then
4359
		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4360
		exit 1
4361
	      fi
4362
	      newdlprefiles="$newdlprefiles $libdir/$name"
4363
	    done
4364
	    dlprefiles="$newdlprefiles"
4365
	  fi
4366
	  $rm $output
4367
	  # place dlname in correct position for cygwin
4368
	  tdlname=$dlname
4369
	  case $host,$output,$installed,$module,$dlname in
4370
	    *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4371
	  esac
4372
	  $echo > $output "\
4373
# $outputname - a libtool library file
4374
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4375
#
4376
# Please DO NOT delete this file!
4377
# It is necessary for linking the library.
4378
4379
# The name that we can dlopen(3).
4380
dlname='$tdlname'
4381
4382
# Names of this library.
4383
library_names='$library_names'
4384
4385
# The name of the static archive.
4386
old_library='$old_library'
4387
4388
# Libraries that this one depends upon.
4389
dependency_libs='$dependency_libs'
4390
4391
# Version information for $libname.
4392
current=$current
4393
age=$age
4394
revision=$revision
4395
4396
# Is this an already installed library?
4397
installed=$installed
4398
4399
# Files to dlopen/dlpreopen
4400
dlopen='$dlfiles'
4401
dlpreopen='$dlprefiles'
4402
4403
# Directory that this library needs to be installed in:
4404
libdir='$install_libdir'"
4405
	  if test "$installed" = no && test $need_relink = yes; then
4406
	    $echo >> $output "\
4407
relink_command=\"$relink_command\""
4408
	  fi
4409
	done
4410
      fi
4411
4412
      # Do a symbolic link so that the libtool archive can be found in
4413
      # LD_LIBRARY_PATH before the program is installed.
4414
      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4415
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4416
      ;;
4417
    esac
4418
    exit 0
4419
    ;;
4420
4421
  # libtool install mode
4422
  install)
4423
    modename="$modename: install"
4424
4425
    # There may be an optional sh(1) argument at the beginning of
4426
    # install_prog (especially on Windows NT).
4427
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4428
       # Allow the use of GNU shtool's install command.
4429
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4430
      # Aesthetically quote it.
4431
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4432
      case $arg in
4433
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
4434
	arg="\"$arg\""
4435
	;;
4436
      esac
4437
      install_prog="$arg "
4438
      arg="$1"
4439
      shift
4440
    else
4441
      install_prog=
4442
      arg="$nonopt"
4443
    fi
4444
4445
    # The real first argument should be the name of the installation program.
4446
    # Aesthetically quote it.
4447
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4448
    case $arg in
4449
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
4450
      arg="\"$arg\""
4451
      ;;
4452
    esac
4453
    install_prog="$install_prog$arg"
4454
4455
    # We need to accept at least all the BSD install flags.
4456
    dest=
4457
    files=
4458
    opts=
4459
    prev=
4460
    install_type=
4461
    isdir=no
4462
    stripme=
4463
    for arg
4464
    do
4465
      if test -n "$dest"; then
4466
	files="$files $dest"
4467
	dest="$arg"
4468
	continue
4469
      fi
4470
4471
      case $arg in
4472
      -d) isdir=yes ;;
4473
      -f) prev="-f" ;;
4474
      -g) prev="-g" ;;
4475
      -m) prev="-m" ;;
4476
      -o) prev="-o" ;;
4477
      -s)
4478
	stripme=" -s"
4479
	continue
4480
	;;
4481
      -*) ;;
4482
4483
      *)
4484
	# If the previous option needed an argument, then skip it.
4485
	if test -n "$prev"; then
4486
	  prev=
4487
	else
4488
	  dest="$arg"
4489
	  continue
4490
	fi
4491
	;;
4492
      esac
4493
4494
      # Aesthetically quote the argument.
4495
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4496
      case $arg in
4497
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
4498
	arg="\"$arg\""
4499
	;;
4500
      esac
4501
      install_prog="$install_prog $arg"
4502
    done
4503
4504
    if test -z "$install_prog"; then
4505
      $echo "$modename: you must specify an install program" 1>&2
4506
      $echo "$help" 1>&2
4507
      exit 1
4508
    fi
4509
4510
    if test -n "$prev"; then
4511
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4512
      $echo "$help" 1>&2
4513
      exit 1
4514
    fi
4515
4516
    if test -z "$files"; then
4517
      if test -z "$dest"; then
4518
	$echo "$modename: no file or destination specified" 1>&2
4519
      else
4520
	$echo "$modename: you must specify a destination" 1>&2
4521
      fi
4522
      $echo "$help" 1>&2
4523
      exit 1
4524
    fi
4525
4526
    # Strip any trailing slash from the destination.
4527
    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4528
4529
    # Check to see that the destination is a directory.
4530
    test -d "$dest" && isdir=yes
4531
    if test "$isdir" = yes; then
4532
      destdir="$dest"
4533
      destname=
4534
    else
4535
      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4536
      test "X$destdir" = "X$dest" && destdir=.
4537
      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4538
4539
      # Not a directory, so check to see that there is only one file specified.
4540
      set dummy $files
4541
      if test $# -gt 2; then
4542
	$echo "$modename: \`$dest' is not a directory" 1>&2
4543
	$echo "$help" 1>&2
4544
	exit 1
4545
      fi
4546
    fi
4547
    case $destdir in
4548
    [\\/]* | [A-Za-z]:[\\/]*) ;;
4549
    *)
4550
      for file in $files; do
4551
	case $file in
4552
	*.lo) ;;
4553
	*)
4554
	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4555
	  $echo "$help" 1>&2
4556
	  exit 1
4557
	  ;;
4558
	esac
4559
      done
4560
      ;;
4561
    esac
4562
4563
    # This variable tells wrapper scripts just to set variables rather
4564
    # than running their programs.
4565
    libtool_install_magic="$magic"
4566
4567
    staticlibs=
4568
    future_libdirs=
4569
    current_libdirs=
4570
    for file in $files; do
4571
4572
      # Do each installation.
4573
      case $file in
4574
      *.$libext)
4575
	# Do the static libraries later.
4576
	staticlibs="$staticlibs $file"
4577
	;;
4578
4579
      *.la)
4580
	# Check to see that this really is a libtool archive.
4581
	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4582
	else
4583
	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4584
	  $echo "$help" 1>&2
4585
	  exit 1
4586
	fi
4587
4588
	library_names=
4589
	old_library=
4590
	relink_command=
4591
	# If there is no directory component, then add one.
4592
	case $file in
4593
	*/* | *\\*) . $file ;;
4594
	*) . ./$file ;;
4595
	esac
4596
4597
	# Add the libdir to current_libdirs if it is the destination.
4598
	if test "X$destdir" = "X$libdir"; then
4599
	  case "$current_libdirs " in
4600
	  *" $libdir "*) ;;
4601
	  *) current_libdirs="$current_libdirs $libdir" ;;
4602
	  esac
4603
	else
4604
	  # Note the libdir as a future libdir.
4605
	  case "$future_libdirs " in
4606
	  *" $libdir "*) ;;
4607
	  *) future_libdirs="$future_libdirs $libdir" ;;
4608
	  esac
4609
	fi
4610
4611
	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4612
	test "X$dir" = "X$file/" && dir=
4613
	dir="$dir$objdir"
4614
4615
	if test -n "$relink_command"; then
4616
	  $echo "$modename: warning: relinking \`$file'" 1>&2
4617
	  $show "$relink_command"
4618
	  if $run eval "$relink_command"; then :
4619
	  else
4620
	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4621
	    exit 1
4622
	  fi
4623
	fi
4624
4625
	# See the names of the shared library.
4626
	set dummy $library_names
4627
	if test -n "$2"; then
4628
	  realname="$2"
4629
	  shift
4630
	  shift
4631
4632
	  srcname="$realname"
4633
	  test -n "$relink_command" && srcname="$realname"T
4634
4635
	  # Install the shared library and build the symlinks.
4636
	  $show "$install_prog $dir/$srcname $destdir/$realname"
4637
	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4638
	  if test -n "$stripme" && test -n "$striplib"; then
4639
	    $show "$striplib $destdir/$realname"
4640
	    $run eval "$striplib $destdir/$realname" || exit $?
4641
	  fi
4642
4643
	  if test $# -gt 0; then
4644
	    # Delete the old symlinks, and create new ones.
4645
	    for linkname
4646
	    do
4647
	      if test "$linkname" != "$realname"; then
4648
		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4649
		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4650
	      fi
4651
	    done
4652
	  fi
4653
4654
	  # Do each command in the postinstall commands.
4655
	  lib="$destdir/$realname"
4656
	  eval cmds=\"$postinstall_cmds\"
4657
	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
4658
	  for cmd in $cmds; do
4659
	    IFS="$save_ifs"
4660
	    $show "$cmd"
4661
	    $run eval "$cmd" || exit $?
4662
	  done
4663
	  IFS="$save_ifs"
4664
	fi
4665
4666
	# Install the pseudo-library for information purposes.
4667
	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4668
	instname="$dir/$name"i
4669
	$show "$install_prog $instname $destdir/$name"
4670
	$run eval "$install_prog $instname $destdir/$name" || exit $?
4671
4672
	# Maybe install the static library, too.
4673
	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4674
	;;
4675
4676
      *.lo)
4677
	# Install (i.e. copy) a libtool object.
4678
4679
	# Figure out destination file name, if it wasn't already specified.
4680
	if test -n "$destname"; then
4681
	  destfile="$destdir/$destname"
4682
	else
4683
	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4684
	  destfile="$destdir/$destfile"
4685
	fi
4686
4687
	# Deduce the name of the destination old-style object file.
4688
	case $destfile in
4689
	*.lo)
4690
	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4691
	  ;;
4692
	*.$objext)
4693
	  staticdest="$destfile"
4694
	  destfile=
4695
	  ;;
4696
	*)
4697
	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4698
	  $echo "$help" 1>&2
4699
	  exit 1
4700
	  ;;
4701
	esac
4702
4703
	# Install the libtool object if requested.
4704
	if test -n "$destfile"; then
4705
	  $show "$install_prog $file $destfile"
4706
	  $run eval "$install_prog $file $destfile" || exit $?
4707
	fi
4708
4709
	# Install the old object if enabled.
4710
	if test "$build_old_libs" = yes; then
4711
	  # Deduce the name of the old-style object file.
4712
	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4713
4714
	  $show "$install_prog $staticobj $staticdest"
4715
	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4716
	fi
4717
	exit 0
4718
	;;
4719
4720
      *)
4721
	# Figure out destination file name, if it wasn't already specified.
4722
	if test -n "$destname"; then
4723
	  destfile="$destdir/$destname"
4724
	else
4725
	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4726
	  destfile="$destdir/$destfile"
4727
	fi
4728
4729
	# Do a test to see if this is really a libtool program.
4730
	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4731
	  notinst_deplibs=
4732
	  relink_command=
4733
4734
	  # If there is no directory component, then add one.
4735
	  case $file in
4736
	  */* | *\\*) . $file ;;
4737
	  *) . ./$file ;;
4738
	  esac
4739
4740
	  # Check the variables that should have been set.
4741
	  if test -z "$notinst_deplibs"; then
4742
	    $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4743
	    exit 1
4744
	  fi
4745
4746
	  finalize=yes
4747
	  for lib in $notinst_deplibs; do
4748
	    # Check to see that each library is installed.
4749
	    libdir=
4750
	    if test -f "$lib"; then
4751
	      # If there is no directory component, then add one.
4752
	      case $lib in
4753
	      */* | *\\*) . $lib ;;
4754
	      *) . ./$lib ;;
4755
	      esac
4756
	    fi
4757
	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4758
	    if test -n "$libdir" && test ! -f "$libfile"; then
4759
	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4760
	      finalize=no
4761
	    fi
4762
	  done
4763
4764
	  relink_command=
4765
	  # If there is no directory component, then add one.
4766
	  case $file in
4767
	  */* | *\\*) . $file ;;
4768
	  *) . ./$file ;;
4769
	  esac
4770
4771
	  outputname=
4772
	  if test "$fast_install" = no && test -n "$relink_command"; then
4773
	    if test "$finalize" = yes && test -z "$run"; then
4774
	      tmpdir="/tmp"
4775
	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
4776
	      tmpdir="$tmpdir/libtool-$$"
4777
	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4778
	      else
4779
		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4780
		continue
4781
	      fi
4782
	      file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4783
	      outputname="$tmpdir/$file"
4784
	      # Replace the output file specification.
4785
	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4786
4787
	      $show "$relink_command"
4788
	      if $run eval "$relink_command"; then :
4789
	      else
4790
		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4791
		${rm}r "$tmpdir"
4792
		continue
4793
	      fi
4794
	      file="$outputname"
4795
	    else
4796
	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
4797
	    fi
4798
	  else
4799
	    # Install the binary that we compiled earlier.
4800
	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4801
	  fi
4802
	fi
4803
4804
4805
	# remove .exe since cygwin /usr/bin/install will append another
4806
	# one anyways
4807
	case $install_prog,$host in
4808
	*/usr/bin/install*,*cygwin*)
4809
	  case $file:$destfile in
4810
	  *.exe:*.exe)
4811
	    # this is ok
4812
	    ;;
4813
	  *.exe:*)
4814
	    destfile=$destfile.exe
4815
	    ;;
4816
	  *:*.exe)
4817
	    destfile=`echo $destfile | sed -e 's,.exe$,,'`
4818
	    ;;
4819
	  esac
4820
	  ;;
4821
	esac
4822
4823
	$show "$install_prog$stripme $file $destfile"
4824
	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4825
	test -n "$outputname" && ${rm}r "$tmpdir"
4826
	;;
4827
      esac
4828
    done
4829
4830
    for file in $staticlibs; do
4831
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4832
4833
      # Set up the ranlib parameters.
4834
      oldlib="$destdir/$name"
4835
4836
      $show "$install_prog $file $oldlib"
4837
      $run eval "$install_prog \$file \$oldlib" || exit $?
4838
4839
      if test -n "$stripme" && test -n "$striplib"; then
4840
	$show "$old_striplib $oldlib"
4841
	$run eval "$old_striplib $oldlib" || exit $?
4842
      fi
4843
4844
      # Do each command in the postinstall commands.
4845
      eval cmds=\"$old_postinstall_cmds\"
4846
      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
4847
      for cmd in $cmds; do
4848
	IFS="$save_ifs"
4849
	$show "$cmd"
4850
	$run eval "$cmd" || exit $?
4851
      done
4852
      IFS="$save_ifs"
4853
    done
4854
4855
    if test -n "$future_libdirs"; then
4856
      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4857
    fi
4858
4859
    if test -n "$current_libdirs"; then
4860
      # Maybe just do a dry run.
4861
      test -n "$run" && current_libdirs=" -n$current_libdirs"
4862
      exec_cmd='$SHELL $0 --finish$current_libdirs'
4863
    else
4864
      exit 0
4865
    fi
4866
    ;;
4867
4868
  # libtool finish mode
4869
  finish)
4870
    modename="$modename: finish"
4871
    libdirs="$nonopt"
4872
    admincmds=
4873
4874
    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4875
      for dir
4876
      do
4877
	libdirs="$libdirs $dir"
4878
      done
4879
4880
      for libdir in $libdirs; do
4881
	if test -n "$finish_cmds"; then
4882
	  # Do each command in the finish commands.
4883
	  eval cmds=\"$finish_cmds\"
4884
	  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
4885
	  for cmd in $cmds; do
4886
	    IFS="$save_ifs"
4887
	    $show "$cmd"
4888
	    $run eval "$cmd" || admincmds="$admincmds
4889
       $cmd"
4890
	  done
4891
	  IFS="$save_ifs"
4892
	fi
4893
	if test -n "$finish_eval"; then
4894
	  # Do the single finish_eval.
4895
	  eval cmds=\"$finish_eval\"
4896
	  $run eval "$cmds" || admincmds="$admincmds
4897
       $cmds"
4898
	fi
4899
      done
4900
    fi
4901
4902
    # Exit here if they wanted silent mode.
4903
    test "$show" = ":" && exit 0
4904
4905
    echo "----------------------------------------------------------------------"
4906
    echo "Libraries have been installed in:"
4907
    for libdir in $libdirs; do
4908
      echo "   $libdir"
4909
    done
4910
    echo
4911
    echo "If you ever happen to want to link against installed libraries"
4912
    echo "in a given directory, LIBDIR, you must either use libtool, and"
4913
    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4914
    echo "flag during linking and do at least one of the following:"
4915
    if test -n "$shlibpath_var"; then
4916
      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4917
      echo "     during execution"
4918
    fi
4919
    if test -n "$runpath_var"; then
4920
      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4921
      echo "     during linking"
4922
    fi
4923
    if test -n "$hardcode_libdir_flag_spec"; then
4924
      libdir=LIBDIR
4925
      eval flag=\"$hardcode_libdir_flag_spec\"
4926
4927
      echo "   - use the \`$flag' linker flag"
4928
    fi
4929
    if test -n "$admincmds"; then
4930
      echo "   - have your system administrator run these commands:$admincmds"
4931
    fi
4932
    if test -f /etc/ld.so.conf; then
4933
      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4934
    fi
4935
    echo
4936
    echo "See any operating system documentation about shared libraries for"
4937
    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4938
    echo "----------------------------------------------------------------------"
4939
    exit 0
4940
    ;;
4941
4942
  # libtool execute mode
4943
  execute)
4944
    modename="$modename: execute"
4945
4946
    # The first argument is the command name.
4947
    cmd="$nonopt"
4948
    if test -z "$cmd"; then
4949
      $echo "$modename: you must specify a COMMAND" 1>&2
4950
      $echo "$help"
4951
      exit 1
4952
    fi
4953
4954
    # Handle -dlopen flags immediately.
4955
    for file in $execute_dlfiles; do
4956
      if test ! -f "$file"; then
4957
	$echo "$modename: \`$file' is not a file" 1>&2
4958
	$echo "$help" 1>&2
4959
	exit 1
4960
      fi
4961
4962
      dir=
4963
      case $file in
4964
      *.la)
4965
	# Check to see that this really is a libtool archive.
4966
	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4967
	else
4968
	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4969
	  $echo "$help" 1>&2
4970
	  exit 1
4971
	fi
4972
4973
	# Read the libtool library.
4974
	dlname=
4975
	library_names=
4976
4977
	# If there is no directory component, then add one.
4978
	case $file in
4979
	*/* | *\\*) . $file ;;
4980
	*) . ./$file ;;
4981
	esac
4982
4983
	# Skip this library if it cannot be dlopened.
4984
	if test -z "$dlname"; then
4985
	  # Warn if it was a shared library.
4986
	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4987
	  continue
4988
	fi
4989
4990
	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4991
	test "X$dir" = "X$file" && dir=.
4992
4993
	if test -f "$dir/$objdir/$dlname"; then
4994
	  dir="$dir/$objdir"
4995
	else
4996
	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4997
	  exit 1
4998
	fi
4999
	;;
5000
5001
      *.lo)
5002
	# Just add the directory containing the .lo file.
5003
	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5004
	test "X$dir" = "X$file" && dir=.
5005
	;;
5006
5007
      *)
5008
	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5009
	continue
5010
	;;
5011
      esac
5012
5013
      # Get the absolute pathname.
5014
      absdir=`cd "$dir" && pwd`
5015
      test -n "$absdir" && dir="$absdir"
5016
5017
      # Now add the directory to shlibpath_var.
5018
      if eval "test -z \"\$$shlibpath_var\""; then
5019
	eval "$shlibpath_var=\"\$dir\""
5020
      else
5021
	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5022
      fi
5023
    done
5024
5025
    # This variable tells wrapper scripts just to set shlibpath_var
5026
    # rather than running their programs.
5027
    libtool_execute_magic="$magic"
5028
5029
    # Check if any of the arguments is a wrapper script.
5030
    args=
5031
    for file
5032
    do
5033
      case $file in
5034
      -*) ;;
5035
      *)
5036
	# Do a test to see if this is really a libtool program.
5037
	if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5038
	  # If there is no directory component, then add one.
5039
	  case $file in
5040
	  */* | *\\*) . $file ;;
5041
	  *) . ./$file ;;
5042
	  esac
5043
5044
	  # Transform arg to wrapped name.
5045
	  file="$progdir/$program"
5046
	fi
5047
	;;
5048
      esac
5049
      # Quote arguments (to preserve shell metacharacters).
5050
      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5051
      args="$args \"$file\""
5052
    done
5053
5054
    if test -z "$run"; then
5055
      if test -n "$shlibpath_var"; then
5056
	# Export the shlibpath_var.
5057
	eval "export $shlibpath_var"
5058
      fi
5059
5060
      # Restore saved enviroment variables
5061
      if test "${save_LC_ALL+set}" = set; then
5062
	LC_ALL="$save_LC_ALL"; export LC_ALL
5063
      fi
5064
      if test "${save_LANG+set}" = set; then
5065
	LANG="$save_LANG"; export LANG
5066
      fi
5067
5068
      # Now prepare to actually exec the command.
5069
      exec_cmd='"$cmd"$args'
5070
    else
5071
      # Display what would be done.
5072
      if test -n "$shlibpath_var"; then
5073
	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5074
	$echo "export $shlibpath_var"
5075
      fi
5076
      $echo "$cmd$args"
5077
      exit 0
5078
    fi
5079
    ;;
5080
5081
  # libtool clean and uninstall mode
5082
  clean | uninstall)
5083
    modename="$modename: $mode"
5084
    rm="$nonopt"
5085
    files=
5086
    rmforce=
5087
    exit_status=0
5088
5089
    # This variable tells wrapper scripts just to set variables rather
5090
    # than running their programs.
5091
    libtool_install_magic="$magic"
5092
5093
    for arg
5094
    do
5095
      case $arg in
5096
      -f) rm="$rm $arg"; rmforce=yes ;;
5097
      -*) rm="$rm $arg" ;;
5098
      *) files="$files $arg" ;;
5099
      esac
5100
    done
5101
5102
    if test -z "$rm"; then
5103
      $echo "$modename: you must specify an RM program" 1>&2
5104
      $echo "$help" 1>&2
5105
      exit 1
5106
    fi
5107
5108
    rmdirs=
5109
5110
    for file in $files; do
5111
      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5112
      if test "X$dir" = "X$file"; then
5113
	dir=.
5114
	objdir="$objdir"
5115
      else
5116
	objdir="$dir/$objdir"
5117
      fi
5118
      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5119
      test $mode = uninstall && objdir="$dir"
5120
5121
      # Remember objdir for removal later, being careful to avoid duplicates
5122
      if test $mode = clean; then
5123
	case " $rmdirs " in
5124
	  *" $objdir "*) ;;
5125
	  *) rmdirs="$rmdirs $objdir" ;;
5126
	esac
5127
      fi
5128
5129
      # Don't error if the file doesn't exist and rm -f was used.
5130
      if (test -L "$file") >/dev/null 2>&1 \
5131
        || (test -h "$file") >/dev/null 2>&1 \
5132
	|| test -f "$file"; then
5133
        :
5134
      elif test -d "$file"; then
5135
        exit_status=1
5136
	continue
5137
      elif test "$rmforce" = yes; then
5138
        continue
5139
      fi
5140
5141
      rmfiles="$file"
5142
5143
      case $name in
5144
      *.la)
5145
	# Possibly a libtool archive, so verify it.
5146
	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5147
	  . $dir/$name
5148
5149
	  # Delete the libtool libraries and symlinks.
5150
	  for n in $library_names; do
5151
	    rmfiles="$rmfiles $objdir/$n"
5152
	  done
5153
	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5154
	  test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5155
5156
	  if test $mode = uninstall; then
5157
	    if test -n "$library_names"; then
5158
	      # Do each command in the postuninstall commands.
5159
	      eval cmds=\"$postuninstall_cmds\"
5160
	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
5161
	      for cmd in $cmds; do
5162
		IFS="$save_ifs"
5163
		$show "$cmd"
5164
		$run eval "$cmd"
5165
		if test $? != 0 && test "$rmforce" != yes; then
5166
		  exit_status=1
5167
		fi
5168
	      done
5169
	      IFS="$save_ifs"
5170
	    fi
5171
5172
	    if test -n "$old_library"; then
5173
	      # Do each command in the old_postuninstall commands.
5174
	      eval cmds=\"$old_postuninstall_cmds\"
5175
	      IFS="${IFS= 	}"; save_ifs="$IFS"; IFS='~'
5176
	      for cmd in $cmds; do
5177
		IFS="$save_ifs"
5178
		$show "$cmd"
5179
		$run eval "$cmd"
5180
		if test $? != 0 && test "$rmforce" != yes; then
5181
		  exit_status=1
5182
		fi
5183
	      done
5184
	      IFS="$save_ifs"
5185
	    fi
5186
	    # FIXME: should reinstall the best remaining shared library.
5187
	  fi
5188
	fi
5189
	;;
5190
5191
      *.lo)
5192
	# Possibly a libtool object, so verify it.
5193
	if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5194
5195
          # Read the .lo file
5196
          . $dir/$name
5197
5198
	  # Add PIC object to the list of files to remove.
5199
          if test -n "$pic_object" \
5200
             && test "$pic_object" != none; then
5201
	    rmfiles="$rmfiles $dir/$pic_object"
5202
          fi
5203
5204
	  # Add non-PIC object to the list of files to remove.
5205
          if test -n "$non_pic_object" \
5206
             && test "$non_pic_object" != none; then
5207
	    rmfiles="$rmfiles $dir/$non_pic_object"
5208
          fi
5209
	fi
5210
	;;
5211
5212
      *)
5213
	# Do a test to see if this is a libtool program.
5214
	if test $mode = clean &&
5215
	   (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5216
	  relink_command=
5217
	  . $dir/$file
5218
5219
	  rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5220
	  if test "$fast_install" = yes && test -n "$relink_command"; then
5221
	    rmfiles="$rmfiles $objdir/lt-$name"
5222
	  fi
5223
	fi
5224
	;;
5225
      esac
5226
      $show "$rm $rmfiles"
5227
      $run $rm $rmfiles || exit_status=1
5228
    done
5229
5230
    # Try to remove the ${objdir}s in the directories where we deleted files
5231
    for dir in $rmdirs; do
5232
      if test -d "$dir"; then
5233
	$show "rmdir $dir"
5234
	$run rmdir $dir >/dev/null 2>&1
5235
      fi
5236
    done
5237
5238
    exit $exit_status
5239
    ;;
5240
5241
  "")
5242
    $echo "$modename: you must specify a MODE" 1>&2
5243
    $echo "$generic_help" 1>&2
5244
    exit 1
5245
    ;;
5246
  esac
5247
5248
  if test -z "$exec_cmd"; then
5249
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
5250
    $echo "$generic_help" 1>&2
5251
    exit 1
5252
  fi
5253
fi # test -z "$show_help"
5254
5255
if test -n "$exec_cmd"; then
5256
  eval exec $exec_cmd
5257
  exit 1
5258
fi
5259
5260
# We need to display help for each of the modes.
5261
case $mode in
5262
"") $echo \
5263
"Usage: $modename [OPTION]... [MODE-ARG]...
5264
5265
Provide generalized library-building support services.
5266
5267
    --config          show all configuration variables
5268
    --debug           enable verbose shell tracing
5269
-n, --dry-run         display commands without modifying any files
5270
    --features        display basic configuration information and exit
5271
    --finish          same as \`--mode=finish'
5272
    --help            display this help message and exit
5273
    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
5274
    --quiet           same as \`--silent'
5275
    --silent          don't print informational messages
5276
    --tag=TAG         use configuration variables from tag TAG
5277
    --version         print version information
5278
5279
MODE must be one of the following:
5280
5281
      clean           remove files from the build directory
5282
      compile         compile a source file into a libtool object
5283
      execute         automatically set library path, then run a program
5284
      finish          complete the installation of libtool libraries
5285
      install         install libraries or executables
5286
      link            create a library or an executable
5287
      uninstall       remove libraries from an installed directory
5288
5289
MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
5290
a more detailed description of MODE."
5291
  exit 0
5292
  ;;
5293
5294
clean)
5295
  $echo \
5296
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5297
5298
Remove files from the build directory.
5299
5300
RM is the name of the program to use to delete files associated with each FILE
5301
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
5302
to RM.
5303
5304
If FILE is a libtool library, object or program, all the files associated
5305
with it are deleted. Otherwise, only FILE itself is deleted using RM."
5306
  ;;
5307
5308
compile)
5309
  $echo \
5310
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5311
5312
Compile a source file into a libtool library object.
5313
5314
This mode accepts the following additional options:
5315
5316
  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
5317
  -prefer-pic       try to building PIC objects only
5318
  -prefer-non-pic   try to building non-PIC objects only
5319
  -static           always build a \`.o' file suitable for static linking
5320
5321
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5322
from the given SOURCEFILE.
5323
5324
The output file name is determined by removing the directory component from
5325
SOURCEFILE, then substituting the C source code suffix \`.c' with the
5326
library object suffix, \`.lo'."
5327
  ;;
5328
5329
execute)
5330
  $echo \
5331
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5332
5333
Automatically set library path, then run a program.
5334
5335
This mode accepts the following additional options:
5336
5337
  -dlopen FILE      add the directory containing FILE to the library path
5338
5339
This mode sets the library path environment variable according to \`-dlopen'
5340
flags.
5341
5342
If any of the ARGS are libtool executable wrappers, then they are translated
5343
into their corresponding uninstalled binary, and any of their required library
5344
directories are added to the library path.
5345
5346
Then, COMMAND is executed, with ARGS as arguments."
5347
  ;;
5348
5349
finish)
5350
  $echo \
5351
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5352
5353
Complete the installation of libtool libraries.
5354
5355
Each LIBDIR is a directory that contains libtool libraries.
5356
5357
The commands that this mode executes may require superuser privileges.  Use
5358
the \`--dry-run' option if you just want to see what would be executed."
5359
  ;;
5360
5361
install)
5362
  $echo \
5363
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5364
5365
Install executables or libraries.
5366
5367
INSTALL-COMMAND is the installation command.  The first component should be
5368
either the \`install' or \`cp' program.
5369
5370
The rest of the components are interpreted as arguments to that command (only
5371
BSD-compatible install options are recognized)."
5372
  ;;
5373
5374
link)
5375
  $echo \
5376
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5377
5378
Link object files or libraries together to form another library, or to
5379
create an executable program.
5380
5381
LINK-COMMAND is a command using the C compiler that you would use to create
5382
a program from several object files.
5383
5384
The following components of LINK-COMMAND are treated specially:
5385
5386
  -all-static       do not do any dynamic linking at all
5387
  -avoid-version    do not add a version suffix if possible
5388
  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
5389
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
5390
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5391
  -export-symbols SYMFILE
5392
		    try to export only the symbols listed in SYMFILE
5393
  -export-symbols-regex REGEX
5394
		    try to export only the symbols matching REGEX
5395
  -LLIBDIR          search LIBDIR for required installed libraries
5396
  -lNAME            OUTPUT-FILE requires the installed library libNAME
5397
  -module           build a library that can dlopened
5398
  -no-fast-install  disable the fast-install mode
5399
  -no-install       link a not-installable executable
5400
  -no-undefined     declare that a library does not refer to external symbols
5401
  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
5402
  -objectlist FILE  Use a list of object files found in FILE to specify objects
5403
  -release RELEASE  specify package release information
5404
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
5405
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5406
  -static           do not do any dynamic linking of libtool libraries
5407
  -version-info CURRENT[:REVISION[:AGE]]
5408
		    specify library version info [each variable defaults to 0]
5409
5410
All other options (arguments beginning with \`-') are ignored.
5411
5412
Every other argument is treated as a filename.  Files ending in \`.la' are
5413
treated as uninstalled libtool libraries, other files are standard or library
5414
object files.
5415
5416
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5417
only library objects (\`.lo' files) may be specified, and \`-rpath' is
5418
required, except when creating a convenience library.
5419
5420
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5421
using \`ar' and \`ranlib', or on Windows using \`lib'.
5422
5423
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5424
is created, otherwise an executable program is created."
5425
  ;;
5426
5427
uninstall)
5428
  $echo \
5429
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5430
5431
Remove libraries from an installation directory.
5432
5433
RM is the name of the program to use to delete files associated with each FILE
5434
(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
5435
to RM.
5436
5437
If FILE is a libtool library, all the files associated with it are deleted.
5438
Otherwise, only FILE itself is deleted using RM."
5439
  ;;
5440
5441
*)
5442
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5443
  $echo "$help" 1>&2
5444
  exit 1
5445
  ;;
5446
esac
5447
5448
echo
5449
$echo "Try \`$modename --help' for more information about other modes."
5450
5451
exit 0
5452
5453
# The TAGs below are defined such that we never get into a situation
5454
# in which we disable both kinds of libraries.  Given conflicting
5455
# choices, we go for a static library, that is the most portable,
5456
# since we can't tell whether shared libraries were disabled because
5457
# the user asked for that or because the platform doesn't support
5458
# them.  This is particularly important on AIX, because we don't
5459
# support having both static and shared libraries enabled at the same
5460
# time on that platform, so we default to a shared-only configuration.
5461
# If a disable-shared tag is given, we'll fallback to a static-only
5462
# configuration.  But we'll never go from static-only to shared-only.
5463
5464
### BEGIN LIBTOOL TAG CONFIG: disable-shared
5465
build_libtool_libs=no
5466
build_old_libs=yes
5467
### END LIBTOOL TAG CONFIG: disable-shared
5468
5469
### BEGIN LIBTOOL TAG CONFIG: disable-static
5470
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5471
### END LIBTOOL TAG CONFIG: disable-static
5472
5473
# Local Variables:
5474
# mode:shell-script
5475
# sh-indentation:2
5476
# End: