Subversion Repositories Scribus

Rev

Rev 3728 | Details | Compare with Previous | Last modification | View Log | RSS feed

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