~ubuntu-branches/ubuntu/edgy/xserver-xorg-driver-suncg14/edgy

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Stone
  • Date: 2006-01-04 20:04:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060104200450-xsxlyg6rno7n4zel
Tags: 1:1.0.0.5-0ubuntu1
* New upstream release.
* Add provides on xserver-xorg-driver.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ltmain.sh - Provide generalized library-building support services.
2
2
# NOTE: Changing this file will not affect anything until you rerun configure.
3
3
#
4
 
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
5
5
# Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
7
#
24
24
# configuration script generated by Autoconf, you may include it under
25
25
# the same distribution terms that you use for the rest of that program.
26
26
 
 
27
basename="s,^.*/,,g"
 
28
 
 
29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
 
30
# is ksh but when the shell is invoked as "sh" and the current value of
 
31
# the _XPG environment variable is not equal to 1 (one), the special
 
32
# positional parameter $0, within a function call, is the name of the
 
33
# function.
 
34
progpath="$0"
 
35
 
 
36
# RH: define SED for historic ltconfig's generated by Libtool 1.3
 
37
[ -z "$SED" ] && SED=sed
 
38
 
 
39
# The name of this program:
 
40
progname=`echo "$progpath" | $SED $basename`
 
41
modename="$progname"
 
42
 
 
43
# Global variables:
 
44
EXIT_SUCCESS=0
 
45
EXIT_FAILURE=1
 
46
 
 
47
PROGRAM=ltmain.sh
 
48
PACKAGE=libtool
 
49
VERSION=1.5.6
 
50
TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42)"
 
51
 
 
52
 
27
53
# Check that we have a working $echo.
28
54
if test "X$1" = X--no-reexec; then
29
55
  # Discard the --no-reexec flag, and continue.
36
62
  :
37
63
else
38
64
  # Restart under the correct shell, and then maybe $echo will work.
39
 
  exec $SHELL "$0" --no-reexec ${1+"$@"}
 
65
  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
40
66
fi
41
67
 
42
68
if test "X$1" = X--fallback-echo; then
45
71
  cat <<EOF
46
72
$*
47
73
EOF
48
 
  exit 0
 
74
  exit $EXIT_SUCCESS
49
75
fi
50
76
 
51
 
# define SED for historic ltconfig's generated by Libtool 1.3
52
 
test -z "$SED" && SED=sed
53
 
 
54
 
# The name of this program.
55
 
progname=`$echo "$0" | ${SED} 's%^.*/%%'`
56
 
modename="$progname"
57
 
 
58
 
# Constants.
59
 
PROGRAM=ltmain.sh
60
 
PACKAGE=libtool
61
 
VERSION=1.5.2
62
 
TIMESTAMP=" (1.1220.2.60 2004/01/25 12:25:08)"
63
 
 
64
77
default_mode=
65
78
help="Try \`$progname --help' for more information."
66
79
magic="%%%MAGIC variable%%%"
103
116
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
104
117
  $echo "$modename: not configured to build any kind of library" 1>&2
105
118
  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
106
 
  exit 1
 
119
  exit $EXIT_FAILURE
107
120
fi
108
121
 
109
122
# Global variables.
118
131
lo2o="s/\\.lo\$/.${objext}/"
119
132
o2lo="s/\\.${objext}\$/.lo/"
120
133
 
121
 
if test -z "$max_cmd_len"; then
122
 
  i=0
123
 
  testring="ABCD"
124
 
  new_result=
125
 
  
126
 
  # If test is not a shell built-in, we'll probably end up computing a
127
 
  # maximum length that is only half of the actual maximum length, but
128
 
  # we can't tell.
129
 
  while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
130
 
             = "XX$testring") >/dev/null 2>&1 &&
131
 
          new_result=`expr "X$testring" : ".*" 2>&1` &&
132
 
          max_cmd_len="$new_result" &&
133
 
          test $i != 17 # 1/2 MB should be enough
134
 
  do
135
 
    i=`expr $i + 1`
136
 
    testring="$testring$testring"
137
 
  done
138
 
  testring=
139
 
  # Add a significant safety factor because C++ compilers can tack on massive
140
 
  # amounts of additional arguments before passing them to the linker.
141
 
  # It appears as though 1/2 is a usable value.
142
 
  max_cmd_len=`expr $max_cmd_len \/ 2`
143
 
fi
144
 
 
145
134
#####################################
146
135
# Shell function definitions:
147
136
# This seems to be the best place for them
148
137
 
 
138
# func_win32_libid arg
 
139
# return the library type of file 'arg'
 
140
#
149
141
# Need a lot of goo to handle *both* DLLs and import libs
150
142
# Has to be a shell function in order to 'eat' the argument
151
143
# that is supplied when $file_magic_command is called.
152
 
win32_libid () {
 
144
func_win32_libid () {
153
145
  win32_libid_type="unknown"
154
146
  win32_fileres=`file -L $1 2>/dev/null`
155
147
  case $win32_fileres in
158
150
    ;;
159
151
  *ar\ archive*) # could be an import, or static
160
152
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
161
 
      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
 
153
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
162
154
      win32_nmres=`eval $NM -f posix -A $1 | \
163
155
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
164
156
      if test "X$win32_nmres" = "Ximport" ; then
168
160
      fi
169
161
    fi
170
162
    ;;
171
 
  *DLL*) 
 
163
  *DLL*)
172
164
    win32_libid_type="x86 DLL"
173
165
    ;;
174
166
  *executable*) # but shell scripts are "executable" too...
182
174
  $echo $win32_libid_type
183
175
}
184
176
 
 
177
 
 
178
# func_infer_tag arg
 
179
# Infer tagged configuration to use if any are available and
 
180
# if one wasn't chosen via the "--tag" command line option.
 
181
# Only attempt this if the compiler in the base compile
 
182
# command doesn't match the default compiler.
 
183
# arg is usually of the form 'gcc ...'
 
184
func_infer_tag () {
 
185
    if test -n "$available_tags" && test -z "$tagname"; then
 
186
      CC_quoted=
 
187
      for arg in $CC; do
 
188
        case $arg in
 
189
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
 
190
          arg="\"$arg\""
 
191
          ;;
 
192
        esac
 
193
        CC_quoted="$CC_quoted $arg"
 
194
      done
 
195
      case $@ in
 
196
      # Blanks in the command may have been stripped by the calling shell,
 
197
      # but not from the CC environment variable when configure was run.
 
198
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
 
199
      # Blanks at the start of $base_compile will cause this to fail
 
200
      # if we don't check for them as well.
 
201
      *)
 
202
        for z in $available_tags; do
 
203
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 
204
            # Evaluate the configuration.
 
205
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 
206
            CC_quoted=
 
207
            for arg in $CC; do
 
208
            # Double-quote args containing other shell metacharacters.
 
209
            case $arg in
 
210
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
 
211
              arg="\"$arg\""
 
212
              ;;
 
213
            esac
 
214
            CC_quoted="$CC_quoted $arg"
 
215
          done
 
216
            case "$@ " in
 
217
              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
 
218
              # The compiler in the base compile command matches
 
219
              # the one in the tagged configuration.
 
220
              # Assume this is the tagged configuration we want.
 
221
              tagname=$z
 
222
              break
 
223
              ;;
 
224
            esac
 
225
          fi
 
226
        done
 
227
        # If $tagname still isn't set, then no tagged configuration
 
228
        # was found and let the user know that the "--tag" command
 
229
        # line option must be used.
 
230
        if test -z "$tagname"; then
 
231
          $echo "$modename: unable to infer tagged configuration"
 
232
          $echo "$modename: specify a tag with \`--tag'" 1>&2
 
233
          exit $EXIT_FAILURE
 
234
#        else
 
235
#          $echo "$modename: using $tagname tagged configuration"
 
236
        fi
 
237
        ;;
 
238
      esac
 
239
    fi
 
240
}
185
241
# End of Shell function definitions
186
242
#####################################
187
243
 
 
244
# Darwin sucks
 
245
eval std_shrext=\"$shrext_cmds\"
 
246
 
188
247
# Parse our command line options once, thoroughly.
189
248
while test "$#" -gt 0
190
249
do
210
269
      case $tagname in
211
270
      *[!-_A-Za-z0-9,/]*)
212
271
        $echo "$progname: invalid tag name: $tagname" 1>&2
213
 
        exit 1
 
272
        exit $EXIT_FAILURE
214
273
        ;;
215
274
      esac
216
275
 
220
279
        # not specially marked.
221
280
        ;;
222
281
      *)
223
 
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
 
282
        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
224
283
          taglist="$taglist $tagname"
225
284
          # Evaluate the configuration.
226
 
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
 
285
          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
227
286
        else
228
287
          $echo "$progname: ignoring unknown tag $tagname" 1>&2
229
288
        fi
252
311
    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
253
312
    $echo "This is free software; see the source for copying conditions.  There is NO"
254
313
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
255
 
    exit 0
 
314
    exit $EXIT_SUCCESS
256
315
    ;;
257
316
 
258
317
  --config)
259
 
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
 
318
    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
260
319
    # Now print the configurations for the tags.
261
320
    for tagname in $taglist; do
262
 
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
 
321
      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
263
322
    done
264
 
    exit 0
 
323
    exit $EXIT_SUCCESS
265
324
    ;;
266
325
 
267
326
  --debug)
286
345
    else
287
346
      $echo "disable static libraries"
288
347
    fi
289
 
    exit 0
 
348
    exit $EXIT_SUCCESS
290
349
    ;;
291
350
 
292
351
  --finish) mode="finish" ;;
317
376
  -*)
318
377
    $echo "$modename: unrecognized option \`$arg'" 1>&2
319
378
    $echo "$help" 1>&2
320
 
    exit 1
 
379
    exit $EXIT_FAILURE
321
380
    ;;
322
381
 
323
382
  *)
330
389
if test -n "$prevopt"; then
331
390
  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
332
391
  $echo "$help" 1>&2
333
 
  exit 1
 
392
  exit $EXIT_FAILURE
334
393
fi
335
394
 
336
395
# If this variable is set in any of the actions, the command in it
386
445
  if test -n "$execute_dlfiles" && test "$mode" != execute; then
387
446
    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
388
447
    $echo "$help" 1>&2
389
 
    exit 1
 
448
    exit $EXIT_FAILURE
390
449
  fi
391
450
 
392
451
  # Change the help message to a mode-specific one.
428
487
        -o)
429
488
          if test -n "$libobj" ; then
430
489
            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
431
 
            exit 1
 
490
            exit $EXIT_FAILURE
432
491
          fi
433
492
          arg_mode=target
434
493
          continue
453
512
          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
454
513
          lastarg=
455
514
          save_ifs="$IFS"; IFS=','
456
 
          for arg in $args; do
 
515
          for arg in $args; do
457
516
            IFS="$save_ifs"
458
517
 
459
518
            # Double-quote args containing other shell metacharacters.
503
562
    case $arg_mode in
504
563
    arg)
505
564
      $echo "$modename: you must specify an argument for -Xcompile"
506
 
      exit 1
 
565
      exit $EXIT_FAILURE
507
566
      ;;
508
567
    target)
509
568
      $echo "$modename: you must specify a target with \`-o'" 1>&2
510
 
      exit 1
 
569
      exit $EXIT_FAILURE
511
570
      ;;
512
571
    *)
513
572
      # Get the name of the library object.
540
599
    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
541
600
    *)
542
601
      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
543
 
      exit 1
 
602
      exit $EXIT_FAILURE
544
603
      ;;
545
604
    esac
546
605
 
547
 
    # Infer tagged configuration to use if any are available and
548
 
    # if one wasn't chosen via the "--tag" command line option.
549
 
    # Only attempt this if the compiler in the base compile
550
 
    # command doesn't match the default compiler.
551
 
    if test -n "$available_tags" && test -z "$tagname"; then
552
 
      case $base_compile in
553
 
      # Blanks in the command may have been stripped by the calling shell,
554
 
      # but not from the CC environment variable when configure was run.
555
 
      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
556
 
      # Blanks at the start of $base_compile will cause this to fail
557
 
      # if we don't check for them as well.
558
 
      *)
559
 
        for z in $available_tags; do
560
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
561
 
            # Evaluate the configuration.
562
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
563
 
            case "$base_compile " in
564
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
565
 
              # The compiler in the base compile command matches
566
 
              # the one in the tagged configuration.
567
 
              # Assume this is the tagged configuration we want.
568
 
              tagname=$z
569
 
              break
570
 
              ;;
571
 
            esac
572
 
          fi
573
 
        done
574
 
        # If $tagname still isn't set, then no tagged configuration
575
 
        # was found and let the user know that the "--tag" command
576
 
        # line option must be used.
577
 
        if test -z "$tagname"; then
578
 
          $echo "$modename: unable to infer tagged configuration"
579
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
580
 
          exit 1
581
 
#        else
582
 
#          $echo "$modename: using $tagname tagged configuration"
583
 
        fi
584
 
        ;;
585
 
      esac
586
 
    fi
 
606
    func_infer_tag $base_compile
587
607
 
588
608
    for arg in $later; do
589
609
      case $arg in
616
636
    if test -z "$base_compile"; then
617
637
      $echo "$modename: you must specify a compilation command" 1>&2
618
638
      $echo "$help" 1>&2
619
 
      exit 1
 
639
      exit $EXIT_FAILURE
620
640
    fi
621
641
 
622
642
    # Delete any leftover library objects.
627
647
    fi
628
648
 
629
649
    $run $rm $removelist
630
 
    trap "$run $rm $removelist; exit 1" 1 2 15
 
650
    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
631
651
 
632
652
    # On Cygwin there's no "real" PIC flag so we must build both object types
633
653
    case $host_os in
646
666
      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
647
667
      lockfile="$output_obj.lock"
648
668
      removelist="$removelist $output_obj $lockfile"
649
 
      trap "$run $rm $removelist; exit 1" 1 2 15
 
669
      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
650
670
    else
651
671
      output_obj=
652
672
      need_locks=no
656
676
    # Lock this critical section if it is needed
657
677
    # We use this script file to make the link, it avoids creating a new file
658
678
    if test "$need_locks" = yes; then
659
 
      until $run ln "$0" "$lockfile" 2>/dev/null; do
 
679
      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
660
680
        $show "Waiting for $lockfile to be removed"
661
681
        sleep 2
662
682
      done
674
694
compiler."
675
695
 
676
696
        $run $rm $removelist
677
 
        exit 1
 
697
        exit $EXIT_FAILURE
678
698
      fi
679
699
      $echo $srcfile > "$lockfile"
680
700
    fi
729
749
      if $run eval "$command"; then :
730
750
      else
731
751
        test -n "$output_obj" && $run $rm $removelist
732
 
        exit 1
 
752
        exit $EXIT_FAILURE
733
753
      fi
734
754
 
735
755
      if test "$need_locks" = warn &&
749
769
compiler."
750
770
 
751
771
        $run $rm $removelist
752
 
        exit 1
 
772
        exit $EXIT_FAILURE
753
773
      fi
754
774
 
755
775
      # Just move the object if needed, then go on to compile the next one
801
821
      if $run eval "$command"; then :
802
822
      else
803
823
        $run $rm $removelist
804
 
        exit 1
 
824
        exit $EXIT_FAILURE
805
825
      fi
806
826
 
807
827
      if test "$need_locks" = warn &&
821
841
compiler."
822
842
 
823
843
        $run $rm $removelist
824
 
        exit 1
 
844
        exit $EXIT_FAILURE
825
845
      fi
826
846
 
827
847
      # Just move the object if needed
859
879
      $run $rm "$lockfile"
860
880
    fi
861
881
 
862
 
    exit 0
 
882
    exit $EXIT_SUCCESS
863
883
    ;;
864
884
 
865
885
  # libtool link mode
931
951
    vinfo=
932
952
    vinfo_number=no
933
953
 
934
 
    # Infer tagged configuration to use if any are available and
935
 
    # if one wasn't chosen via the "--tag" command line option.
936
 
    # Only attempt this if the compiler in the base link
937
 
    # command doesn't match the default compiler.
938
 
    if test -n "$available_tags" && test -z "$tagname"; then
939
 
      case $base_compile in
940
 
      # Blanks in the command may have been stripped by the calling shell,
941
 
      # but not from the CC environment variable when configure was run.
942
 
      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
943
 
      # Blanks at the start of $base_compile will cause this to fail
944
 
      # if we don't check for them as well.
945
 
      *)
946
 
        for z in $available_tags; do
947
 
          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
948
 
            # Evaluate the configuration.
949
 
            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
950
 
            case $base_compile in
951
 
            "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
952
 
              # The compiler in $compile_command matches
953
 
              # the one in the tagged configuration.
954
 
              # Assume this is the tagged configuration we want.
955
 
              tagname=$z
956
 
              break
957
 
              ;;
958
 
            esac
959
 
          fi
960
 
        done
961
 
        # If $tagname still isn't set, then no tagged configuration
962
 
        # was found and let the user know that the "--tag" command
963
 
        # line option must be used.
964
 
        if test -z "$tagname"; then
965
 
          $echo "$modename: unable to infer tagged configuration"
966
 
          $echo "$modename: specify a tag with \`--tag'" 1>&2
967
 
          exit 1
968
 
#       else
969
 
#         $echo "$modename: using $tagname tagged configuration"
970
 
        fi
971
 
        ;;
972
 
      esac
973
 
    fi
 
954
    func_infer_tag $base_compile
974
955
 
975
956
    # We need to know -static, to get the right output filenames.
976
957
    for arg
1066
1047
          export_symbols="$arg"
1067
1048
          if test ! -f "$arg"; then
1068
1049
            $echo "$modename: symbol file \`$arg' does not exist"
1069
 
            exit 1
 
1050
            exit $EXIT_FAILURE
1070
1051
          fi
1071
1052
          prev=
1072
1053
          continue
1118
1099
                   test "$pic_object" = none && \
1119
1100
                   test "$non_pic_object" = none; then
1120
1101
                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1121
 
                  exit 1
 
1102
                  exit $EXIT_FAILURE
1122
1103
                fi
1123
1104
 
1124
1105
                # Extract subdirectory from the argument.
1171
1152
                # Only an error if not doing a dry-run.
1172
1153
                if test -z "$run"; then
1173
1154
                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1174
 
                  exit 1
 
1155
                  exit $EXIT_FAILURE
1175
1156
                else
1176
1157
                  # Dry-run case.
1177
1158
 
1192
1173
            done
1193
1174
          else
1194
1175
            $echo "$modename: link input file \`$save_arg' does not exist"
1195
 
            exit 1
 
1176
            exit $EXIT_FAILURE
1196
1177
          fi
1197
1178
          arg=$save_arg
1198
1179
          prev=
1204
1185
          [\\/]* | [A-Za-z]:[\\/]*) ;;
1205
1186
          *)
1206
1187
            $echo "$modename: only absolute run-paths are allowed" 1>&2
1207
 
            exit 1
 
1188
            exit $EXIT_FAILURE
1208
1189
            ;;
1209
1190
          esac
1210
1191
          if test "$prev" = rpath; then
1244
1225
          finalize_command="$finalize_command $qarg"
1245
1226
          continue
1246
1227
          ;;
 
1228
        shrext)
 
1229
          shrext_cmds="$arg"
 
1230
          prev=
 
1231
          continue
 
1232
          ;;
1247
1233
        *)
1248
1234
          eval "$prev=\"\$arg\""
1249
1235
          prev=
1292
1278
      -export-symbols | -export-symbols-regex)
1293
1279
        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1294
1280
          $echo "$modename: more than one -exported-symbols argument is not allowed"
1295
 
          exit 1
 
1281
          exit $EXIT_FAILURE
1296
1282
        fi
1297
1283
        if test "X$arg" = "X-export-symbols"; then
1298
1284
          prev=expsyms
1328
1314
          absdir=`cd "$dir" && pwd`
1329
1315
          if test -z "$absdir"; then
1330
1316
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1331
 
            exit 1
 
1317
            exit $EXIT_FAILURE
1332
1318
          fi
1333
1319
          dir="$absdir"
1334
1320
          ;;
1479
1465
        [\\/]* | [A-Za-z]:[\\/]*) ;;
1480
1466
        *)
1481
1467
          $echo "$modename: only absolute run-paths are allowed" 1>&2
1482
 
          exit 1
 
1468
          exit $EXIT_FAILURE
1483
1469
          ;;
1484
1470
        esac
1485
1471
        case "$xrpath " in
1565
1551
        continue
1566
1552
        ;;
1567
1553
 
1568
 
      -Kthread | -mthreads | -mt | -pthread | -pthreads | -threads | -qthreaded | -kthread )
1569
 
        compiler_flags="$compiler_flags $arg"
1570
 
        continue
1571
 
        ;;
1572
 
 
1573
1554
      # Some other compiler flag.
1574
1555
      -* | +*)
1575
1556
        # Unknown arguments in both finalize_command and compile_command need
1607
1588
             test "$pic_object" = none && \
1608
1589
             test "$non_pic_object" = none; then
1609
1590
            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1610
 
            exit 1
 
1591
            exit $EXIT_FAILURE
1611
1592
          fi
1612
1593
 
1613
1594
          # Extract subdirectory from the argument.
1660
1641
          # Only an error if not doing a dry-run.
1661
1642
          if test -z "$run"; then
1662
1643
            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1663
 
            exit 1
 
1644
            exit $EXIT_FAILURE
1664
1645
          else
1665
1646
            # Dry-run case.
1666
1647
 
1727
1708
    if test -n "$prev"; then
1728
1709
      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1729
1710
      $echo "$help" 1>&2
1730
 
      exit 1
 
1711
      exit $EXIT_FAILURE
1731
1712
    fi
1732
1713
 
1733
1714
    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1771
1752
    "")
1772
1753
      $echo "$modename: you must specify an output file" 1>&2
1773
1754
      $echo "$help" 1>&2
1774
 
      exit 1
 
1755
      exit $EXIT_FAILURE
1775
1756
      ;;
1776
1757
    *.$libext) linkmode=oldlib ;;
1777
1758
    *.lo | *.$objext) linkmode=obj ;;
1781
1762
 
1782
1763
    case $host in
1783
1764
    *cygwin* | *mingw* | *pw32*)
1784
 
      # don't eliminate duplcations in $postdeps and $predeps
 
1765
      # don't eliminate duplications in $postdeps and $predeps
1785
1766
      duplicate_compiler_generated_deps=yes
1786
1767
      ;;
1787
1768
    *)
1834
1815
          *.la) ;;
1835
1816
          *)
1836
1817
            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1837
 
            exit 1
 
1818
            exit $EXIT_FAILURE
1838
1819
            ;;
1839
1820
          esac
1840
1821
        done
1892
1873
          fi
1893
1874
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1894
1875
          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1895
 
            for search_ext in .la $shrext .so .a; do
 
1876
            for search_ext in .la $std_shrext .so .a; do
1896
1877
              # Search the libtool library
1897
1878
              lib="$searchdir/lib${name}${search_ext}"
1898
1879
              if test -f "$lib"; then
1968
1949
            fi
1969
1950
            if test "$pass" = scan; then
1970
1951
              deplibs="$deplib $deplibs"
1971
 
              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1972
1952
            else
1973
1953
              compile_deplibs="$deplib $compile_deplibs"
1974
1954
              finalize_deplibs="$deplib $finalize_deplibs"
1975
1955
            fi
 
1956
            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1976
1957
            ;;
1977
1958
          *)
1978
1959
            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2051
2032
        if test "$found" = yes || test -f "$lib"; then :
2052
2033
        else
2053
2034
          $echo "$modename: cannot find the library \`$lib'" 1>&2
2054
 
          exit 1
 
2035
          exit $EXIT_FAILURE
2055
2036
        fi
2056
2037
 
2057
2038
        # Check to see that this really is a libtool archive.
2058
2039
        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2059
2040
        else
2060
2041
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2061
 
          exit 1
 
2042
          exit $EXIT_FAILURE
2062
2043
        fi
2063
2044
 
2064
2045
        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2094
2075
          if test -z "$libdir"; then
2095
2076
            if test -z "$old_library"; then
2096
2077
              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2097
 
              exit 1
 
2078
              exit $EXIT_FAILURE
2098
2079
            fi
2099
2080
            # It is a libtool convenience library, so add in its objects.
2100
2081
            convenience="$convenience $ladir/$objdir/$old_library"
2111
2092
            done
2112
2093
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
2113
2094
            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2114
 
            exit 1
 
2095
            exit $EXIT_FAILURE
2115
2096
          fi
2116
2097
          continue
2117
2098
        fi # $pass = conv
2118
2099
 
2119
 
    
 
2100
 
2120
2101
        # Get the name of the library we link against.
2121
2102
        linklib=
2122
2103
        for l in $old_library $library_names; do
2124
2105
        done
2125
2106
        if test -z "$linklib"; then
2126
2107
          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2127
 
          exit 1
 
2108
          exit $EXIT_FAILURE
2128
2109
        fi
2129
2110
 
2130
2111
        # This library was specified with -dlopen.
2131
2112
        if test "$pass" = dlopen; then
2132
2113
          if test -z "$libdir"; then
2133
2114
            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2134
 
            exit 1
 
2115
            exit $EXIT_FAILURE
2135
2116
          fi
2136
 
          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
 
2117
          if test -z "$dlname" ||
 
2118
             test "$dlopen_support" != yes ||
 
2119
             test "$build_libtool_libs" = no; then
2137
2120
            # If there is no dlname, no dlopen support or we're linking
2138
2121
            # statically, we need to preload.  We also need to preload any
2139
2122
            # dependent libraries so libltdl's deplib preloader doesn't
2182
2165
        if test "$pass" = dlpreopen; then
2183
2166
          if test -z "$libdir"; then
2184
2167
            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2185
 
            exit 1
 
2168
            exit $EXIT_FAILURE
2186
2169
          fi
2187
2170
          # Prefer using a static library (so that no silly _DYNAMIC symbols
2188
2171
          # are required to link).
2209
2192
          continue
2210
2193
        fi
2211
2194
 
2212
 
    
 
2195
 
2213
2196
        if test "$linkmode" = prog && test "$pass" != link; then
2214
2197
          newlib_search_path="$newlib_search_path $ladir"
2215
2198
          deplibs="$lib $deplibs"
2296
2279
            need_relink=yes
2297
2280
          fi
2298
2281
          # This is a shared library
2299
 
        
2300
 
      # Warn about portability, can't link against -module's on some systems (darwin)
2301
 
      if test "$shouldnotlink" = yes && test "$pass" = link ; then
 
2282
 
 
2283
          # Warn about portability, can't link against -module's on
 
2284
          # some systems (darwin)
 
2285
          if test "$shouldnotlink" = yes && test "$pass" = link ; then
2302
2286
            $echo
2303
2287
            if test "$linkmode" = prog; then
2304
2288
              $echo "*** Warning: Linking the executable $output against the loadable module"
2305
2289
            else
2306
2290
              $echo "*** Warning: Linking the shared library $output against the loadable module"
2307
2291
            fi
2308
 
            $echo "*** $linklib is not portable!"    
2309
 
      fi          
 
2292
            $echo "*** $linklib is not portable!"
 
2293
          fi
2310
2294
          if test "$linkmode" = lib &&
2311
2295
             test "$hardcode_into_libs" = yes; then
2312
2296
            # Hardcode the library path.
2404
2388
                case $host in
2405
2389
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2406
2390
                  *-*-darwin* )
2407
 
                    # if the lib is a module then we can not link against it, someone
2408
 
                    # is ignoring the new warnings I added
2409
 
                    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
 
2391
                    # if the lib is a module then we can not link against
 
2392
                    # it, someone is ignoring the new warnings I added
 
2393
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2410
2394
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2411
2395
                      if test -z "$old_library" ; then
2412
2396
                        $echo
2414
2398
                        $echo "** The link will probably fail, sorry"
2415
2399
                      else
2416
2400
                        add="$dir/$old_library"
2417
 
                      fi 
 
2401
                      fi
2418
2402
                    fi
2419
2403
                esac
2420
2404
              elif test "$hardcode_minus_L" = no; then
2456
2440
 
2457
2441
            if test "$lib_linked" != yes; then
2458
2442
              $echo "$modename: configuration error: unsupported hardcode properties"
2459
 
              exit 1
 
2443
              exit $EXIT_FAILURE
2460
2444
            fi
2461
2445
 
2462
2446
            if test -n "$add_shlibpath"; then
2499
2483
              esac
2500
2484
              add="-l$name"
2501
2485
            elif test "$hardcode_automatic" = yes; then
2502
 
              if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
 
2486
              if test -n "$inst_prefix_dir" &&
 
2487
                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2503
2488
                add="$inst_prefix_dir$libdir/$linklib"
2504
2489
              else
2505
2490
                add="$libdir/$linklib"
2579
2564
 
2580
2565
        if test "$linkmode" = lib; then
2581
2566
          if test -n "$dependency_libs" &&
2582
 
             { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
 
2567
             { test "$hardcode_into_libs" != yes ||
 
2568
               test "$build_old_libs" = yes ||
2583
2569
               test "$link_static" = yes; }; then
2584
2570
            # Extract -R from dependency_libs
2585
2571
            temp_deplibs=
2636
2622
                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2637
2623
                  if test -z "$libdir"; then
2638
2624
                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2639
 
                    exit 1
 
2625
                    exit $EXIT_FAILURE
2640
2626
                  fi
2641
2627
                  if test "$absdir" != "$libdir"; then
2642
2628
                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2646
2632
                depdepl=
2647
2633
                case $host in
2648
2634
                *-*-darwin*)
2649
 
                  # we do not want to link against static libs, but need to link against shared
 
2635
                  # we do not want to link against static libs,
 
2636
                  # but need to link against shared
2650
2637
                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2651
2638
                  if test -n "$deplibrary_names" ; then
2652
2639
                    for tmp in $deplibrary_names ; do
2654
2641
                    done
2655
2642
                    if test -f "$path/$depdepl" ; then
2656
2643
                      depdepl="$path/$depdepl"
2657
 
                   fi
 
2644
                    fi
2658
2645
                    # do not add paths which are already there
2659
2646
                    case " $newlib_search_path " in
2660
2647
                    *" $path "*) ;;
2664
2651
                  path=""
2665
2652
                  ;;
2666
2653
                *)
2667
 
                path="-L$path"
2668
 
                ;;
2669
 
                esac 
2670
 
                
2671
 
                ;;
2672
 
                  -l*)
 
2654
                  path="-L$path"
 
2655
                  ;;
 
2656
                esac
 
2657
                ;;
 
2658
              -l*)
2673
2659
                case $host in
2674
2660
                *-*-darwin*)
2675
 
                 # Again, we only want to link against shared libraries
2676
 
                 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2677
 
                 for tmp in $newlib_search_path ; do
2678
 
                     if test -f "$tmp/lib$tmp_libs.dylib" ; then
2679
 
                       eval depdepl="$tmp/lib$tmp_libs.dylib"
2680
 
                       break
2681
 
                     fi  
2682
 
         done
2683
 
         path=""
 
2661
                  # Again, we only want to link against shared libraries
 
2662
                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
 
2663
                  for tmp in $newlib_search_path ; do
 
2664
                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
 
2665
                      eval depdepl="$tmp/lib$tmp_libs.dylib"
 
2666
                      break
 
2667
                    fi
 
2668
                  done
 
2669
                  path=""
2684
2670
                  ;;
2685
2671
                *) continue ;;
2686
 
                esac              
 
2672
                esac
2687
2673
                ;;
2688
2674
              *) continue ;;
2689
2675
              esac
2690
2676
              case " $deplibs " in
2691
2677
              *" $depdepl "*) ;;
2692
 
              *) deplibs="$deplibs $depdepl" ;;
2693
 
              esac            
 
2678
              *) deplibs="$depdepl $deplibs" ;;
 
2679
              esac
2694
2680
              case " $deplibs " in
2695
2681
              *" $path "*) ;;
2696
2682
              *) deplibs="$deplibs $path" ;;
2780
2766
          eval $var=\"$tmp_libs\"
2781
2767
        done # for var
2782
2768
      fi
2783
 
      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
 
2769
      # Last step: remove runtime libs from dependency_libs
 
2770
      # (they stay in deplibs)
2784
2771
      tmp_libs=
2785
2772
      for i in $dependency_libs ; do
2786
2773
        case " $predeps $postdeps $compiler_lib_search_path " in
2840
2827
      case $outputname in
2841
2828
      lib*)
2842
2829
        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2843
 
        eval shared_ext=\"$shrext\"
 
2830
        eval shared_ext=\"$shrext_cmds\"
2844
2831
        eval libname=\"$libname_spec\"
2845
2832
        ;;
2846
2833
      *)
2847
2834
        if test "$module" = no; then
2848
2835
          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2849
2836
          $echo "$help" 1>&2
2850
 
          exit 1
 
2837
          exit $EXIT_FAILURE
2851
2838
        fi
2852
2839
        if test "$need_lib_prefix" != no; then
2853
2840
          # Add the "lib" prefix for modules if required
2854
2841
          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2855
 
          eval shared_ext=\"$shrext\"
 
2842
          eval shared_ext=\"$shrext_cmds\"
2856
2843
          eval libname=\"$libname_spec\"
2857
2844
        else
2858
2845
          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2863
2850
      if test -n "$objs"; then
2864
2851
        if test "$deplibs_check_method" != pass_all; then
2865
2852
          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2866
 
          exit 1
 
2853
          exit $EXIT_FAILURE
2867
2854
        else
2868
2855
          $echo
2869
2856
          $echo "*** Warning: Linking the shared library $output against the non-libtool"
2911
2898
        if test -n "$8"; then
2912
2899
          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2913
2900
          $echo "$help" 1>&2
2914
 
          exit 1
 
2901
          exit $EXIT_FAILURE
2915
2902
        fi
2916
2903
 
2917
2904
        # convert absolute version numbers to libtool ages
2918
2905
        # this retains compatibility with .la files and attempts
2919
2906
        # to make the code below a bit more comprehensible
2920
 
        
 
2907
 
2921
2908
        case $vinfo_number in
2922
2909
        yes)
2923
2910
          number_major="$2"
2961
2948
        *)
2962
2949
          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2963
2950
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2964
 
          exit 1
 
2951
          exit $EXIT_FAILURE
2965
2952
          ;;
2966
2953
        esac
2967
2954
 
2970
2957
        *)
2971
2958
          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2972
2959
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2973
 
          exit 1
 
2960
          exit $EXIT_FAILURE
2974
2961
          ;;
2975
2962
        esac
2976
2963
 
2979
2966
        *)
2980
2967
          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2981
2968
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2982
 
          exit 1
 
2969
          exit $EXIT_FAILURE
2983
2970
          ;;
2984
2971
        esac
2985
2972
 
2986
2973
        if test "$age" -gt "$current"; then
2987
2974
          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2988
2975
          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2989
 
          exit 1
 
2976
          exit $EXIT_FAILURE
2990
2977
        fi
2991
2978
 
2992
2979
        # Calculate the version variables.
3075
3062
        *)
3076
3063
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
3077
3064
          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3078
 
          exit 1
 
3065
          exit $EXIT_FAILURE
3079
3066
          ;;
3080
3067
        esac
3081
3068
 
3129
3116
            *.$objext)
3130
3117
               ;;
3131
3118
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3132
 
               if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3133
 
               then
3134
 
                 continue
 
3119
               if test "X$precious_files_regex" != "X"; then
 
3120
                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 
3121
                 then
 
3122
                   continue
 
3123
                 fi
3135
3124
               fi
3136
3125
               removelist="$removelist $p"
3137
3126
               ;;
3380
3369
                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3381
3370
                        esac
3382
3371
                      done
3383
 
                      # It is ok to link against an archive when
3384
 
                      # building a shared library.
3385
 
                      if $AR -t $potlib > /dev/null 2>&1; then
3386
 
                        newdeplibs="$newdeplibs $a_deplib"
3387
 
                        a_deplib=""
3388
 
                        break 2
3389
 
                      fi
3390
3372
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3391
3373
                         | ${SED} 10q \
3392
3374
                         | $EGREP "$file_magic_regex" > /dev/null; then
3619
3601
        fi
3620
3602
 
3621
3603
        # Get the real and link names of the library.
3622
 
        eval shared_ext=\"$shrext\"
 
3604
        eval shared_ext=\"$shrext_cmds\"
3623
3605
        eval library_names=\"$library_names_spec\"
3624
3606
        set dummy $library_names
3625
3607
        realname="$2"
3683
3665
        for test_deplib in $deplibs; do
3684
3666
                case " $convenience " in
3685
3667
                *" $test_deplib "*) ;;
3686
 
                *) 
 
3668
                *)
3687
3669
                        tmp_deplibs="$tmp_deplibs $test_deplib"
3688
3670
                        ;;
3689
3671
                esac
3690
3672
        done
3691
 
        deplibs="$tmp_deplibs" 
 
3673
        deplibs="$tmp_deplibs"
3692
3674
 
3693
3675
        if test -n "$convenience"; then
3694
3676
          if test -n "$whole_archive_flag_spec"; then
3871
3853
          save_ifs="$IFS"; IFS='~'
3872
3854
          for cmd in $concat_cmds; do
3873
3855
            IFS="$save_ifs"
3874
 
            eval cmd=\"$cmd\"
3875
3856
            $show "$cmd"
3876
3857
            $run eval "$cmd" || exit $?
3877
3858
          done
3918
3899
        # Restore the uninstalled library and exit
3919
3900
        if test "$mode" = relink; then
3920
3901
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3921
 
          exit 0
 
3902
          exit $EXIT_SUCCESS
3922
3903
        fi
3923
3904
 
3924
3905
        # Create links to the real library.
3966
3947
      *.lo)
3967
3948
        if test -n "$objs$old_deplibs"; then
3968
3949
          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3969
 
          exit 1
 
3950
          exit $EXIT_FAILURE
3970
3951
        fi
3971
3952
        libobj="$output"
3972
3953
        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4077
4058
          $run ${rm}r $gentop
4078
4059
        fi
4079
4060
 
4080
 
        exit 0
 
4061
        exit $EXIT_SUCCESS
4081
4062
      fi
4082
4063
 
4083
4064
      if test "$build_libtool_libs" != yes; then
4090
4071
        # accidentally link it into a program.
4091
4072
        # $show "echo timestamp > $libobj"
4092
4073
        # $run eval "echo timestamp > $libobj" || exit $?
4093
 
        exit 0
 
4074
        exit $EXIT_SUCCESS
4094
4075
      fi
4095
4076
 
4096
4077
      if test -n "$pic_flag" || test "$pic_mode" != default; then
4113
4094
        $run ${rm}r $gentop
4114
4095
      fi
4115
4096
 
4116
 
      exit 0
 
4097
      exit $EXIT_SUCCESS
4117
4098
      ;;
4118
4099
 
4119
4100
    prog)
4431
4412
          ;;
4432
4413
        *)
4433
4414
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4434
 
          exit 1
 
4415
          exit $EXIT_FAILURE
4435
4416
          ;;
4436
4417
        esac
4437
4418
      else
4519
4500
        # Link the executable and exit
4520
4501
        $show "$link_command"
4521
4502
        $run eval "$link_command" || exit $?
4522
 
        exit 0
 
4503
        exit $EXIT_SUCCESS
4523
4504
      fi
4524
4505
 
4525
4506
      if test "$hardcode_action" = relink; then
4574
4555
      fi
4575
4556
 
4576
4557
      # Quote $echo for shipping.
4577
 
      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4578
 
        case $0 in
4579
 
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4580
 
        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
 
4558
      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
 
4559
        case $progpath in
 
4560
        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
 
4561
        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4581
4562
        esac
4582
4563
        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4583
4564
      else
4603
4584
            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4604
4585
            cwrapper=`$echo ${output}.exe`
4605
4586
            $rm $cwrappersource $cwrapper
4606
 
            trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
 
4587
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4607
4588
 
4608
4589
            cat > $cwrappersource <<EOF
4609
4590
 
4612
4593
 
4613
4594
   The $output program cannot be directly executed until all the libtool
4614
4595
   libraries that it depends on are installed.
4615
 
   
 
4596
 
4616
4597
   This wrapper executable should never be moved out of the build directory.
4617
4598
   If it is, it will not operate correctly.
4618
4599
 
4644
4625
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4645
4626
  defined (__OS2__)
4646
4627
#define HAVE_DOS_BASED_FILE_SYSTEM
4647
 
#ifndef DIR_SEPARATOR_2 
 
4628
#ifndef DIR_SEPARATOR_2
4648
4629
#define DIR_SEPARATOR_2 '\\'
4649
4630
#endif
4650
4631
#endif
4675
4656
{
4676
4657
  char **newargz;
4677
4658
  int i;
4678
 
  
 
4659
 
4679
4660
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
4680
4661
  newargz = XMALLOC(char *, argc+2);
4681
4662
EOF
4688
4669
  newargz[1] = fnqualify(argv[0]);
4689
4670
  /* we know the script has the same name, without the .exe */
4690
4671
  /* so make sure newargz[1] doesn't end in .exe */
4691
 
  strendzap(newargz[1],".exe"); 
 
4672
  strendzap(newargz[1],".exe");
4692
4673
  for (i = 1; i < argc; i++)
4693
4674
    newargz[i+1] = xstrdup(argv[i]);
4694
4675
  newargz[argc+1] = NULL;
4711
4692
  return p;
4712
4693
}
4713
4694
 
4714
 
char * 
 
4695
char *
4715
4696
xstrdup (const char *string)
4716
4697
{
4717
4698
  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4725
4706
 
4726
4707
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4727
4708
  /* Skip over the disk name in MSDOS pathnames. */
4728
 
  if (isalpha (name[0]) && name[1] == ':') 
 
4709
  if (isalpha (name[0]) && name[1] == ':')
4729
4710
    name += 2;
4730
4711
#endif
4731
4712
 
4735
4716
  return (char *) base;
4736
4717
}
4737
4718
 
4738
 
char * 
 
4719
char *
4739
4720
fnqualify(const char *path)
4740
4721
{
4741
4722
  size_t size;
4763
4744
}
4764
4745
 
4765
4746
char *
4766
 
strendzap(char *str, const char *pat) 
 
4747
strendzap(char *str, const char *pat)
4767
4748
{
4768
4749
  size_t len, patlen;
4769
4750
 
4783
4764
}
4784
4765
 
4785
4766
static void
4786
 
lt_error_core (int exit_status, const char * mode, 
 
4767
lt_error_core (int exit_status, const char * mode,
4787
4768
          const char * message, va_list ap)
4788
4769
{
4789
4770
  fprintf (stderr, "%s: %s: ", program_name, mode);
4812
4793
          ;;
4813
4794
        esac
4814
4795
        $rm $output
4815
 
        trap "$rm $output; exit 1" 1 2 15
 
4796
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4816
4797
 
4817
4798
        $echo > $output "\
4818
4799
#! $SHELL
4912
4893
      else
4913
4894
        $echo \"\$relink_command_output\" >&2
4914
4895
        $rm \"\$progdir/\$file\"
4915
 
        exit 1
 
4896
        exit $EXIT_FAILURE
4916
4897
      fi
4917
4898
    fi
4918
4899
 
4974
4955
        esac
4975
4956
        $echo >> $output "\
4976
4957
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4977
 
      exit 1
 
4958
      exit $EXIT_FAILURE
4978
4959
    fi
4979
4960
  else
4980
4961
    # The program doesn't exist.
4981
4962
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4982
4963
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4983
4964
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4984
 
    exit 1
 
4965
    exit $EXIT_FAILURE
4985
4966
  fi
4986
4967
fi\
4987
4968
"
4988
4969
        chmod +x $output
4989
4970
      fi
4990
 
      exit 0
 
4971
      exit $EXIT_SUCCESS
4991
4972
      ;;
4992
4973
    esac
4993
4974
 
5106
5087
          for obj in $save_oldobjs
5107
5088
          do
5108
5089
            last_oldobj=$obj
5109
 
          done  
 
5090
          done
5110
5091
          for obj in $save_oldobjs
5111
5092
          do
5112
5093
            oldobjs="$objlist $obj"
5120
5101
              oldobjs=$objlist
5121
5102
              if test "$obj" = "$last_oldobj" ; then
5122
5103
                RANLIB=$save_RANLIB
5123
 
              fi  
 
5104
              fi
5124
5105
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5125
5106
              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5126
5107
              objlist=
5169
5150
        fi
5170
5151
      done
5171
5152
      # Quote the link command for shipping.
5172
 
      relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
 
5153
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5173
5154
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5174
5155
      if test "$hardcode_automatic" = yes ; then
5175
 
        relink_command=
5176
 
      fi  
 
5156
        relink_command=
 
5157
      fi
 
5158
 
 
5159
 
5177
5160
      # Only create the output if not a dry run.
5178
5161
      if test -z "$run"; then
5179
5162
        for installed in no yes; do
5191
5174
                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5192
5175
                if test -z "$libdir"; then
5193
5176
                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5194
 
                  exit 1
5195
 
                fi
5196
 
                # We do not want portage's install root ($D) present.  Check only for
5197
 
                # this if the .la is being installed.
5198
 
                if test "$installed" = yes && test "$D"; then
5199
 
                  eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
5200
 
                else
5201
 
                  mynewdependency_lib="$libdir/$name"
5202
 
                fi
5203
 
                # Do not add duplicates
5204
 
                if test "$mynewdependency_lib"; then
5205
 
                  if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
5206
 
                    newdependency_libs="$newdependency_libs $mynewdependency_lib"
5207
 
                  fi
5208
 
                fi
5209
 
                ;;
5210
 
                  *)
5211
 
                if test "$installed" = yes; then
5212
 
          # Rather use S=WORKDIR if our version of portage supports it.
5213
 
          # This is because some ebuild (gcc) do not use $S as buildroot.
5214
 
                  if test "$PWORKDIR"; then
5215
 
                    S="$PWORKDIR"
5216
 
                  fi
5217
 
                  # We do not want portage's build root ($S) present.
5218
 
                  if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
5219
 
                    mynewdependency_lib=""
5220
 
                  # We do not want portage's install root ($D) present.
5221
 
                  elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
5222
 
                    eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
5223
 
                  else
5224
 
                    mynewdependency_lib="$deplib"
5225
 
                  fi
5226
 
                else
5227
 
                  mynewdependency_lib="$deplib"
5228
 
                fi
5229
 
                # Do not add duplicates
5230
 
                if test "$mynewdependency_lib"; then
5231
 
                  if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
5232
 
                        newdependency_libs="$newdependency_libs $mynewdependency_lib"
5233
 
                  fi
5234
 
                fi
5235
 
                ;;
 
5177
                  exit $EXIT_FAILURE
 
5178
                fi
 
5179
                newdependency_libs="$newdependency_libs $libdir/$name"
 
5180
                ;;
 
5181
              *) newdependency_libs="$newdependency_libs $deplib" ;;
5236
5182
              esac
5237
5183
            done
5238
5184
            dependency_libs="$newdependency_libs"
5242
5188
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5243
5189
              if test -z "$libdir"; then
5244
5190
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5245
 
                exit 1
 
5191
                exit $EXIT_FAILURE
5246
5192
              fi
5247
5193
              newdlfiles="$newdlfiles $libdir/$name"
5248
5194
            done
5253
5199
              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5254
5200
              if test -z "$libdir"; then
5255
5201
                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5256
 
                exit 1
 
5202
                exit $EXIT_FAILURE
5257
5203
              fi
5258
5204
              newdlprefiles="$newdlprefiles $libdir/$name"
5259
5205
            done
5261
5207
          else
5262
5208
            newdlfiles=
5263
5209
            for lib in $dlfiles; do
5264
 
              case $lib in 
 
5210
              case $lib in
5265
5211
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5266
5212
                *) abs=`pwd`"/$lib" ;;
5267
5213
              esac
5270
5216
            dlfiles="$newdlfiles"
5271
5217
            newdlprefiles=
5272
5218
            for lib in $dlprefiles; do
5273
 
              case $lib in 
 
5219
              case $lib in
5274
5220
                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5275
5221
                *) abs=`pwd`"/$lib" ;;
5276
5222
              esac
5284
5230
          case $host,$output,$installed,$module,$dlname in
5285
5231
            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5286
5232
          esac
5287
 
          # Do not add duplicates
5288
 
          if test "$installed" = yes && test "$D"; then
5289
 
            install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
5290
 
          fi
5291
5233
          $echo > $output "\
5292
5234
# $outputname - a libtool library file
5293
5235
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5337
5279
      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5338
5280
      ;;
5339
5281
    esac
5340
 
    exit 0
 
5282
    exit $EXIT_SUCCESS
5341
5283
    ;;
5342
5284
 
5343
5285
  # libtool install mode
5426
5368
    if test -z "$install_prog"; then
5427
5369
      $echo "$modename: you must specify an install program" 1>&2
5428
5370
      $echo "$help" 1>&2
5429
 
      exit 1
 
5371
      exit $EXIT_FAILURE
5430
5372
    fi
5431
5373
 
5432
5374
    if test -n "$prev"; then
5433
5375
      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5434
5376
      $echo "$help" 1>&2
5435
 
      exit 1
 
5377
      exit $EXIT_FAILURE
5436
5378
    fi
5437
5379
 
5438
5380
    if test -z "$files"; then
5442
5384
        $echo "$modename: you must specify a destination" 1>&2
5443
5385
      fi
5444
5386
      $echo "$help" 1>&2
5445
 
      exit 1
 
5387
      exit $EXIT_FAILURE
5446
5388
    fi
5447
5389
 
5448
5390
    # Strip any trailing slash from the destination.
5463
5405
      if test "$#" -gt 2; then
5464
5406
        $echo "$modename: \`$dest' is not a directory" 1>&2
5465
5407
        $echo "$help" 1>&2
5466
 
        exit 1
 
5408
        exit $EXIT_FAILURE
5467
5409
      fi
5468
5410
    fi
5469
5411
    case $destdir in
5475
5417
        *)
5476
5418
          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5477
5419
          $echo "$help" 1>&2
5478
 
          exit 1
 
5420
          exit $EXIT_FAILURE
5479
5421
          ;;
5480
5422
        esac
5481
5423
      done
5504
5446
        else
5505
5447
          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5506
5448
          $echo "$help" 1>&2
5507
 
          exit 1
 
5449
          exit $EXIT_FAILURE
5508
5450
        fi
5509
5451
 
5510
5452
        library_names=
5546
5488
          # but it's something to keep an eye on.
5547
5489
          if test "$inst_prefix_dir" = "$destdir"; then
5548
5490
            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5549
 
            exit 1
 
5491
            exit $EXIT_FAILURE
5550
5492
          fi
5551
5493
 
5552
5494
          if test -n "$inst_prefix_dir"; then
5561
5503
          if $run eval "$relink_command"; then :
5562
5504
          else
5563
5505
            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5564
 
            exit 1
 
5506
            exit $EXIT_FAILURE
5565
5507
          fi
5566
5508
        fi
5567
5509
 
5640
5582
        *)
5641
5583
          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5642
5584
          $echo "$help" 1>&2
5643
 
          exit 1
 
5585
          exit $EXIT_FAILURE
5644
5586
          ;;
5645
5587
        esac
5646
5588
 
5658
5600
          $show "$install_prog $staticobj $staticdest"
5659
5601
          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5660
5602
        fi
5661
 
        exit 0
 
5603
        exit $EXIT_SUCCESS
5662
5604
        ;;
5663
5605
 
5664
5606
      *)
5712
5654
          # Check the variables that should have been set.
5713
5655
          if test -z "$notinst_deplibs"; then
5714
5656
            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5715
 
            exit 1
 
5657
            exit $EXIT_FAILURE
5716
5658
          fi
5717
5659
 
5718
5660
          finalize=yes
5753
5695
              tmpdir="/tmp"
5754
5696
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5755
5697
              tmpdir="$tmpdir/libtool-$$"
5756
 
              if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
 
5698
              save_umask=`umask`
 
5699
              umask 0077
 
5700
              if $mkdir "$tmpdir"; then
 
5701
                umask $save_umask
5757
5702
              else
 
5703
                umask $save_umask
5758
5704
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5759
5705
                continue
5760
5706
              fi
5837
5783
    if test -n "$current_libdirs"; then
5838
5784
      # Maybe just do a dry run.
5839
5785
      test -n "$run" && current_libdirs=" -n$current_libdirs"
5840
 
      exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs'
 
5786
      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
5841
5787
    else
5842
 
      exit 0
 
5788
      exit $EXIT_SUCCESS
5843
5789
    fi
5844
5790
    ;;
5845
5791
 
5879
5825
    fi
5880
5826
 
5881
5827
    # Exit here if they wanted silent mode.
5882
 
    test "$show" = : && exit 0
 
5828
    test "$show" = : && exit $EXIT_SUCCESS
5883
5829
 
5884
5830
    $echo "----------------------------------------------------------------------"
5885
5831
    $echo "Libraries have been installed in:"
5915
5861
    $echo "See any operating system documentation about shared libraries for"
5916
5862
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5917
5863
    $echo "----------------------------------------------------------------------"
5918
 
    exit 0
 
5864
    exit $EXIT_SUCCESS
5919
5865
    ;;
5920
5866
 
5921
5867
  # libtool execute mode
5927
5873
    if test -z "$cmd"; then
5928
5874
      $echo "$modename: you must specify a COMMAND" 1>&2
5929
5875
      $echo "$help"
5930
 
      exit 1
 
5876
      exit $EXIT_FAILURE
5931
5877
    fi
5932
5878
 
5933
5879
    # Handle -dlopen flags immediately.
5935
5881
      if test ! -f "$file"; then
5936
5882
        $echo "$modename: \`$file' is not a file" 1>&2
5937
5883
        $echo "$help" 1>&2
5938
 
        exit 1
 
5884
        exit $EXIT_FAILURE
5939
5885
      fi
5940
5886
 
5941
5887
      dir=
5946
5892
        else
5947
5893
          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5948
5894
          $echo "$help" 1>&2
5949
 
          exit 1
 
5895
          exit $EXIT_FAILURE
5950
5896
        fi
5951
5897
 
5952
5898
        # Read the libtool library.
5973
5919
          dir="$dir/$objdir"
5974
5920
        else
5975
5921
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5976
 
          exit 1
 
5922
          exit $EXIT_FAILURE
5977
5923
        fi
5978
5924
        ;;
5979
5925
 
6053
5999
        $echo "export $shlibpath_var"
6054
6000
      fi
6055
6001
      $echo "$cmd$args"
6056
 
      exit 0
 
6002
      exit $EXIT_SUCCESS
6057
6003
    fi
6058
6004
    ;;
6059
6005
 
6081
6027
    if test -z "$rm"; then
6082
6028
      $echo "$modename: you must specify an RM program" 1>&2
6083
6029
      $echo "$help" 1>&2
6084
 
      exit 1
 
6030
      exit $EXIT_FAILURE
6085
6031
    fi
6086
6032
 
6087
6033
    rmdirs=
6195
6141
        if test "$mode" = clean ; then
6196
6142
          noexename=$name
6197
6143
          case $file in
6198
 
          *.exe) 
 
6144
          *.exe)
6199
6145
            file=`$echo $file|${SED} 's,.exe$,,'`
6200
6146
            noexename=`$echo $name|${SED} 's,.exe$,,'`
6201
6147
            # $file with .exe has already been added to rmfiles,
6240
6186
  "")
6241
6187
    $echo "$modename: you must specify a MODE" 1>&2
6242
6188
    $echo "$generic_help" 1>&2
6243
 
    exit 1
 
6189
    exit $EXIT_FAILURE
6244
6190
    ;;
6245
6191
  esac
6246
6192
 
6247
6193
  if test -z "$exec_cmd"; then
6248
6194
    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6249
6195
    $echo "$generic_help" 1>&2
6250
 
    exit 1
 
6196
    exit $EXIT_FAILURE
6251
6197
  fi
6252
6198
fi # test -z "$show_help"
6253
6199
 
6254
6200
if test -n "$exec_cmd"; then
6255
6201
  eval exec $exec_cmd
6256
 
  exit 1
 
6202
  exit $EXIT_FAILURE
6257
6203
fi
6258
6204
 
6259
6205
# We need to display help for each of the modes.
6289
6235
a more detailed description of MODE.
6290
6236
 
6291
6237
Report bugs to <bug-libtool@gnu.org>."
6292
 
  exit 0
 
6238
  exit $EXIT_SUCCESS
6293
6239
  ;;
6294
6240
 
6295
6241
clean)
6444
6390
*)
6445
6391
  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6446
6392
  $echo "$help" 1>&2
6447
 
  exit 1
 
6393
  exit $EXIT_FAILURE
6448
6394
  ;;
6449
6395
esac
6450
6396
 
6451
6397
$echo
6452
6398
$echo "Try \`$modename --help' for more information about other modes."
6453
6399
 
6454
 
exit 0
 
6400
exit $EXIT_SUCCESS
6455
6401
 
6456
6402
# The TAGs below are defined such that we never get into a situation
6457
6403
# in which we disable both kinds of libraries.  Given conflicting