~ubuntu-branches/ubuntu/maverick/rxtx/maverick

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Scott Howard
  • Date: 2010-06-03 23:19:16 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20100603231916-8bapendemannfwau
Tags: 2.2pre2-1
* New upstream release:
  - Fixes JVM crash and UnsatisfiedLinkError/NoClassDefFoundError
    (Closes: #523139) (Closes: #489701)
  - Fixes amd64 support (Closes: #574395)
* Added debian/watch file
* Switched to source format 3.0 (quilt)
  - moved debian changes into patch in debian/patches
* Changed rules to use dh
* Fixed multiple lintian errors and multiple warnings
  - Policy version 3.8.4
* Section moved to java from libs
* Moved to team maintenance: Maintainer: Debian Java maintainers
  - Mario and I moved to uploaders
* DM Uploads Allowed: yes
* Build depends on javahelper
  - Binary depends on ${java:Depends}, use jh_installlibs for versioned
    install
  - Versioned naming of RXTXcomm.jar (Debian java policy)
* Added VCS tags to debian/control
* Libs now install in /usr/lib/jni instead of /usr/lib
* Added doc-base file

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
PROGRAM=ltmain.sh
45
45
PACKAGE=libtool
46
 
VERSION=1.5.18
47
 
TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)"
 
46
VERSION="1.5.22 Debian 1.5.22-4"
 
47
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
48
48
 
49
49
# See if we are running on zsh, and set the options which allow our
50
50
# commands through without removal of \ escapes.
88
88
Xsed="${SED}"' -e 1s/^X//'
89
89
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
90
90
# test EBCDIC or ASCII
91
 
case `echo A|tr A '\301'` in
92
 
 A) # EBCDIC based system
93
 
  SP2NL="tr '\100' '\n'"
94
 
  NL2SP="tr '\r\n' '\100\100'"
 
91
case `echo X|tr X '\101'` in
 
92
 A) # ASCII based system
 
93
    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
 
94
  SP2NL='tr \040 \012'
 
95
  NL2SP='tr \015\012 \040\040'
95
96
  ;;
96
 
 *) # Assume ASCII based system
97
 
  SP2NL="tr '\040' '\012'"
98
 
  NL2SP="tr '\015\012' '\040\040'"
 
97
 *) # EBCDIC based system
 
98
  SP2NL='tr \100 \n'
 
99
  NL2SP='tr \r\n \100\100'
99
100
  ;;
100
101
esac
101
102
 
131
132
show="$echo"
132
133
show_help=
133
134
execute_dlfiles=
 
135
duplicate_deps=no
 
136
preserve_args=
134
137
lo2o="s/\\.lo\$/.${objext}/"
135
138
o2lo="s/\\.${objext}\$/.lo/"
136
 
quote_scanset='[[~#^*{};<>?'"'"'        ]'
137
139
 
138
140
#####################################
139
141
# Shell function definitions:
140
142
# This seems to be the best place for them
141
143
 
 
144
# func_mktempdir [string]
 
145
# Make a temporary directory that won't clash with other running
 
146
# libtool processes, and avoids race conditions if possible.  If
 
147
# given, STRING is the basename for that directory.
 
148
func_mktempdir ()
 
149
{
 
150
    my_template="${TMPDIR-/tmp}/${1-$progname}"
 
151
 
 
152
    if test "$run" = ":"; then
 
153
      # Return a directory name, but don't create it in dry-run mode
 
154
      my_tmpdir="${my_template}-$$"
 
155
    else
 
156
 
 
157
      # If mktemp works, use that first and foremost
 
158
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 
159
 
 
160
      if test ! -d "$my_tmpdir"; then
 
161
        # Failing that, at least try and use $RANDOM to avoid a race
 
162
        my_tmpdir="${my_template}-${RANDOM-0}$$"
 
163
 
 
164
        save_mktempdir_umask=`umask`
 
165
        umask 0077
 
166
        $mkdir "$my_tmpdir"
 
167
        umask $save_mktempdir_umask
 
168
      fi
 
169
 
 
170
      # If we're not in dry-run mode, bomb out on failure
 
171
      test -d "$my_tmpdir" || {
 
172
        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
 
173
        exit $EXIT_FAILURE
 
174
      }
 
175
    fi
 
176
 
 
177
    $echo "X$my_tmpdir" | $Xsed
 
178
}
 
179
 
 
180
 
142
181
# func_win32_libid arg
143
182
# return the library type of file 'arg'
144
183
#
157
196
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
158
197
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
159
198
      win32_nmres=`eval $NM -f posix -A $1 | \
160
 
        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
161
 
      if test "X$win32_nmres" = "Ximport" ; then
162
 
        win32_libid_type="x86 archive import"
163
 
      else
164
 
        win32_libid_type="x86 archive static"
165
 
      fi
 
199
        $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
 
200
      case $win32_nmres in
 
201
      import*)  win32_libid_type="x86 archive import";;
 
202
      *)        win32_libid_type="x86 archive static";;
 
203
      esac
166
204
    fi
167
205
    ;;
168
206
  *DLL*)
192
230
      CC_quoted=
193
231
      for arg in $CC; do
194
232
        case $arg in
195
 
          *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
233
          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
196
234
          arg="\"$arg\""
197
235
          ;;
198
236
        esac
213
251
            for arg in $CC; do
214
252
            # Double-quote args containing other shell metacharacters.
215
253
            case $arg in
216
 
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
254
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
217
255
              arg="\"$arg\""
218
256
              ;;
219
257
            esac
295
333
      $run ${rm}r "$my_xdir"
296
334
      $show "$mkdir $my_xdir"
297
335
      $run $mkdir "$my_xdir"
298
 
      status=$?
299
 
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
300
 
        exit $status
 
336
      exit_status=$?
 
337
      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
 
338
        exit $exit_status
301
339
      fi
302
340
      case $host in
303
341
      *-darwin*)
337
375
            func_extract_an_archive "$my_xdir" "$my_xabs"
338
376
          fi # $darwin_arches
339
377
        fi # $run
340
 
      ;;
 
378
        ;;
341
379
      *)
342
380
        func_extract_an_archive "$my_xdir" "$my_xabs"
343
381
        ;;
352
390
# Darwin sucks
353
391
eval std_shrext=\"$shrext_cmds\"
354
392
 
 
393
disable_libs=no
 
394
 
355
395
# Parse our command line options once, thoroughly.
356
396
while test "$#" -gt 0
357
397
do
468
508
    preserve_args="$preserve_args $arg"
469
509
    ;;
470
510
 
471
 
  --tag) prevopt="--tag" prev=tag ;;
 
511
  --tag)
 
512
    prevopt="--tag"
 
513
    prev=tag
 
514
    preserve_args="$preserve_args --tag"
 
515
    ;;
472
516
  --tag=*)
473
517
    set tag "$optarg" ${1+"$@"}
474
518
    shift
500
544
  exit $EXIT_FAILURE
501
545
fi
502
546
 
 
547
case $disable_libs in
 
548
no) 
 
549
  ;;
 
550
shared)
 
551
  build_libtool_libs=no
 
552
  build_old_libs=yes
 
553
  ;;
 
554
static)
 
555
  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 
556
  ;;
 
557
esac
 
558
 
503
559
# If this variable is set in any of the actions, the command in it
504
560
# will be execed at the end.  This prevents here-documents from being
505
561
# left over by shells.
576
632
 
577
633
    for arg
578
634
    do
579
 
      case "$arg_mode" in
 
635
      case $arg_mode in
580
636
      arg  )
581
637
        # do not "continue".  Instead, add this to base_compile
582
638
        lastarg="$arg"
627
683
            # Many Bourne shells cannot handle close brackets correctly
628
684
            # in scan sets, so we specify it separately.
629
685
            case $arg in
630
 
              *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
686
              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
631
687
              arg="\"$arg\""
632
688
              ;;
633
689
            esac
662
718
      # in scan sets (worked around with variable expansion),
663
719
      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
664
720
      # at all, so we specify them separately.
665
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
721
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
666
722
        lastarg="\"$lastarg\""
667
723
        ;;
668
724
      esac
737
793
 
738
794
    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
739
795
    case $qlibobj in
740
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
796
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
741
797
        qlibobj="\"$qlibobj\"" ;;
742
798
    esac
743
 
    if test "X$libobj" != "X$qlibobj"; then
744
 
        $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
745
 
        exit $EXIT_FAILURE
746
 
    fi
 
799
    test "X$libobj" != "X$qlibobj" \
 
800
        && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \
 
801
        && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
747
802
    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
748
803
    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
749
804
    if test "X$xdir" = "X$obj"; then
824
879
    fi
825
880
    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
826
881
    case $qsrcfile in
827
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
882
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
828
883
      qsrcfile="\"$qsrcfile\"" ;;
829
884
    esac
830
885
 
857
912
      if test ! -d "${xdir}$objdir"; then
858
913
        $show "$mkdir ${xdir}$objdir"
859
914
        $run $mkdir ${xdir}$objdir
860
 
        status=$?
861
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
862
 
          exit $status
 
915
        exit_status=$?
 
916
        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
917
          exit $exit_status
863
918
        fi
864
919
      fi
865
920
 
1062
1117
    no_install=no
1063
1118
    objs=
1064
1119
    non_pic_objects=
 
1120
    notinst_path= # paths that contain not-installed libtool libraries
1065
1121
    precious_files_regex=
1066
1122
    prefer_static_libs=no
1067
1123
    preload=no
1090
1146
          if test -n "$link_static_flag"; then
1091
1147
            dlopen_self=$dlopen_self_static
1092
1148
          fi
 
1149
          prefer_static_libs=yes
1093
1150
        else
1094
1151
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
1095
1152
            dlopen_self=$dlopen_self_static
1096
1153
          fi
 
1154
          prefer_static_libs=built
1097
1155
        fi
1098
1156
        build_libtool_libs=no
1099
1157
        build_old_libs=yes
1100
 
        prefer_static_libs=yes
1101
1158
        break
1102
1159
        ;;
1103
1160
      esac
1111
1168
      arg="$1"
1112
1169
      shift
1113
1170
      case $arg in
1114
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1171
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
1115
1172
        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1116
1173
        ;;
1117
1174
      *) qarg=$arg ;;
1272
1329
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1273
1330
                    arg="$non_pic_object"
1274
1331
                  fi
 
1332
                else
 
1333
                  # If the PIC object exists, use it instead.
 
1334
                  # $xdir was prepended to $pic_object above.
 
1335
                  non_pic_object="$pic_object"
 
1336
                  non_pic_objects="$non_pic_objects $non_pic_object"
1275
1337
                fi
1276
1338
              else
1277
1339
                # Only an error if not doing a dry-run.
1355
1417
          prev=
1356
1418
          continue
1357
1419
          ;;
1358
 
        darwin_framework)
1359
 
          compiler_flags="$compiler_flags $arg"
 
1420
        darwin_framework|darwin_framework_skip)
 
1421
          test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1360
1422
          compile_command="$compile_command $arg"
1361
1423
          finalize_command="$finalize_command $arg"
1362
1424
          prev=
1420
1482
        continue
1421
1483
        ;;
1422
1484
 
1423
 
      -framework)
1424
 
        prev=darwin_framework
1425
 
        compiler_flags="$compiler_flags $arg"
 
1485
      -framework|-arch|-isysroot)
 
1486
        case " $CC " in
 
1487
          *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
 
1488
                prev=darwin_framework_skip ;;
 
1489
          *) compiler_flags="$compiler_flags $arg"
 
1490
             prev=darwin_framework ;;
 
1491
        esac
1426
1492
        compile_command="$compile_command $arg"
1427
1493
        finalize_command="$finalize_command $arg"
1428
 
        continue
1429
 
        ;;
 
1494
        continue
 
1495
        ;;
1430
1496
 
1431
1497
      -inst-prefix-dir)
1432
1498
        prev=inst_prefix
1454
1520
          absdir=`cd "$dir" && pwd`
1455
1521
          if test -z "$absdir"; then
1456
1522
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1457
 
            exit $EXIT_FAILURE
 
1523
            absdir="$dir"
 
1524
            notinst_path="$notinst_path $dir"
1458
1525
          fi
1459
1526
          dir="$absdir"
1460
1527
          ;;
1468
1535
        esac
1469
1536
        case $host in
1470
1537
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1538
          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1471
1539
          case :$dllsearchpath: in
1472
1540
          *":$dir:"*) ;;
1473
1541
          *) dllsearchpath="$dllsearchpath:$dir";;
1474
1542
          esac
 
1543
          case :$dllsearchpath: in
 
1544
          *":$testbindir:"*) ;;
 
1545
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
1546
          esac
1475
1547
          ;;
1476
1548
        esac
1477
1549
        continue
1480
1552
      -l*)
1481
1553
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1482
1554
          case $host in
1483
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1555
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1484
1556
            # These systems don't actually have a C or math library (as such)
1485
1557
            continue
1486
1558
            ;;
1487
 
          *-*-mingw* | *-*-os2*)
 
1559
          *-*-os2*)
1488
1560
            # These systems don't actually have a C library (as such)
1489
1561
            test "X$arg" = "X-lc" && continue
1490
1562
            ;;
1496
1568
            # Rhapsody C and math libraries are in the System framework
1497
1569
            deplibs="$deplibs -framework System"
1498
1570
            continue
 
1571
            ;;
 
1572
          *-*-sco3.2v5* | *-*-sco5v6*)
 
1573
            # Causes problems with __ctype
 
1574
            test "X$arg" = "X-lc" && continue
 
1575
            ;;
 
1576
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
1577
            # Compiler inserts libc in the correct place for threads to work
 
1578
            test "X$arg" = "X-lc" && continue
 
1579
            ;;
1499
1580
          esac
1500
1581
        elif test "X$arg" = "X-lc_r"; then
1501
1582
         case $host in
1537
1618
      # +DA*, +DD* enable 64-bit mode on the HP compiler
1538
1619
      # -q* pass through compiler args for the IBM compiler
1539
1620
      # -m* pass through architecture-specific compiler args for GCC
1540
 
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
 
1621
      # -m*, -t[45]*, -txscale* pass through architecture-specific
 
1622
      # compiler args for GCC
 
1623
      # -pg pass through profiling flag for GCC
 
1624
      # @file GCC response files
 
1625
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
 
1626
      -t[45]*|-txscale*|@*)
1541
1627
 
1542
1628
        # Unknown arguments in both finalize_command and compile_command need
1543
1629
        # to be aesthetically quoted because they are evaled later.
1544
1630
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1545
1631
        case $arg in
1546
 
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1632
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1547
1633
          arg="\"$arg\""
1548
1634
          ;;
1549
1635
        esac
1550
1636
        compile_command="$compile_command $arg"
1551
1637
        finalize_command="$finalize_command $arg"
1552
 
        if test "$with_gcc" = "yes" ; then
1553
 
          compiler_flags="$compiler_flags $arg"
1554
 
        fi
 
1638
        compiler_flags="$compiler_flags $arg"
1555
1639
        continue
1556
1640
        ;;
1557
1641
 
1659
1743
        for flag in $args; do
1660
1744
          IFS="$save_ifs"
1661
1745
          case $flag in
1662
 
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1746
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1663
1747
            flag="\"$flag\""
1664
1748
            ;;
1665
1749
          esac
1677
1761
        for flag in $args; do
1678
1762
          IFS="$save_ifs"
1679
1763
          case $flag in
1680
 
            *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1764
            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1681
1765
            flag="\"$flag\""
1682
1766
            ;;
1683
1767
          esac
1710
1794
        # to be aesthetically quoted because they are evaled later.
1711
1795
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1712
1796
        case $arg in
1713
 
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1797
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1714
1798
          arg="\"$arg\""
1715
1799
          ;;
1716
1800
        esac
1789
1873
            if test -z "$pic_object" || test "$pic_object" = none ; then
1790
1874
              arg="$non_pic_object"
1791
1875
            fi
 
1876
          else
 
1877
            # If the PIC object exists, use it instead.
 
1878
            # $xdir was prepended to $pic_object above.
 
1879
            non_pic_object="$pic_object"
 
1880
            non_pic_objects="$non_pic_objects $non_pic_object"
1792
1881
          fi
1793
1882
        else
1794
1883
          # Only an error if not doing a dry-run.
1844
1933
        # to be aesthetically quoted because they are evaled later.
1845
1934
        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1846
1935
        case $arg in
1847
 
        *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
1936
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1848
1937
          arg="\"$arg\""
1849
1938
          ;;
1850
1939
        esac
1894
1983
    if test ! -d "$output_objdir"; then
1895
1984
      $show "$mkdir $output_objdir"
1896
1985
      $run $mkdir $output_objdir
1897
 
      status=$?
1898
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1899
 
        exit $status
 
1986
      exit_status=$?
 
1987
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
 
1988
        exit $exit_status
1900
1989
      fi
1901
1990
    fi
1902
1991
 
1959
2048
    newlib_search_path=
1960
2049
    need_relink=no # whether we're linking any uninstalled libtool libraries
1961
2050
    notinst_deplibs= # not-installed libtool libraries
1962
 
    notinst_path= # paths that contain not-installed libtool libraries
1963
2051
    case $linkmode in
1964
2052
    lib)
1965
2053
        passes="conv link"
1994
2082
        case $pass in
1995
2083
        dlopen) libs="$dlfiles" ;;
1996
2084
        dlpreopen) libs="$dlprefiles" ;;
1997
 
        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
 
2085
        link)
 
2086
          libs="$deplibs %DEPLIBS%"
 
2087
          test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
 
2088
          ;;
1998
2089
        esac
1999
2090
      fi
2000
2091
      if test "$pass" = dlopen; then
2195
2286
        esac # case $deplib
2196
2287
        if test "$found" = yes || test -f "$lib"; then :
2197
2288
        else
2198
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
 
2289
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2199
2290
          exit $EXIT_FAILURE
2200
2291
        fi
2201
2292
 
2409
2500
              case "$temp_rpath " in
2410
2501
              *" $dir "*) ;;
2411
2502
              *" $absdir "*) ;;
2412
 
              *) temp_rpath="$temp_rpath $dir" ;;
 
2503
              *) temp_rpath="$temp_rpath $absdir" ;;
2413
2504
              esac
2414
2505
            fi
2415
2506
 
2446
2537
        fi
2447
2538
 
2448
2539
        link_static=no # Whether the deplib will be linked statically
 
2540
        use_static_libs=$prefer_static_libs
 
2541
        if test "$use_static_libs" = built && test "$installed" = yes ; then
 
2542
          use_static_libs=no
 
2543
        fi
2449
2544
        if test -n "$library_names" &&
2450
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2545
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
2451
2546
          if test "$installed" = no; then
2452
2547
            notinst_deplibs="$notinst_deplibs $lib"
2453
2548
            need_relink=yes
2560
2655
              if test "$hardcode_direct" = no; then
2561
2656
                add="$dir/$linklib"
2562
2657
                case $host in
2563
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2658
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
2659
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
2660
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
2661
                    *-*-unixware7*) add_dir="-L$dir" ;;
2564
2662
                  *-*-darwin* )
2565
2663
                    # if the lib is a module then we can not link against
2566
2664
                    # it, someone is ignoring the new warnings I added
2567
 
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2665
                    if /usr/bin/file -L $add 2> /dev/null |
 
2666
                      $EGREP ": [^:]* bundle" >/dev/null ; then
2568
2667
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2569
2668
                      if test -z "$old_library" ; then
2570
2669
                        $echo
2595
2694
                add_dir="-L$dir"
2596
2695
                # Try looking first in the location we're being installed to.
2597
2696
                if test -n "$inst_prefix_dir"; then
2598
 
                  case "$libdir" in
 
2697
                  case $libdir in
2599
2698
                    [\\/]*)
2600
2699
                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2601
2700
                      ;;
2668
2767
              add_dir="-L$libdir"
2669
2768
              # Try looking first in the location we're being installed to.
2670
2769
              if test -n "$inst_prefix_dir"; then
2671
 
                case "$libdir" in
 
2770
                case $libdir in
2672
2771
                  [\\/]*)
2673
2772
                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2674
2773
                    ;;
2729
2828
              fi
2730
2829
            fi
2731
2830
          else
2732
 
            convenience="$convenience $dir/$old_library"
2733
 
            old_convenience="$old_convenience $dir/$old_library"
2734
2831
            deplibs="$dir/$old_library $deplibs"
2735
2832
            link_static=yes
2736
2833
          fi
3107
3204
            age="$number_minor"
3108
3205
            revision="$number_minor"
3109
3206
            ;;
 
3207
          *)
 
3208
            $echo "$modename: unknown library version type \`$version_type'" 1>&2
 
3209
            $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
 
3210
            exit $EXIT_FAILURE
 
3211
            ;;
3110
3212
          esac
3111
3213
          ;;
3112
3214
        no)
3317
3419
 
3318
3420
      # Eliminate all temporary directories.
3319
3421
      for path in $notinst_path; do
3320
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3321
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3322
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
 
3422
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
 
3423
        deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
 
3424
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3323
3425
      done
3324
3426
 
3325
3427
      if test -n "$xrpath"; then
3372
3474
            ;;
3373
3475
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3374
3476
            # Do not include libc due to us having libc/libc_r.
3375
 
            test "X$arg" = "X-lc" && continue
 
3477
            ;;
 
3478
          *-*-sco3.2v5* | *-*-sco5v6*)
 
3479
            # Causes problems with __ctype
 
3480
            ;;
 
3481
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
3482
            # Compiler inserts libc in the correct place for threads to work
3376
3483
            ;;
3377
3484
          *)
3378
3485
            # Add libc to deplibs on all other systems if necessary.
3416
3523
          int main() { return 0; }
3417
3524
EOF
3418
3525
          $rm conftest
3419
 
          $LTCC -o conftest conftest.c $deplibs
 
3526
          $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3420
3527
          if test "$?" -eq 0 ; then
3421
3528
            ldd_output=`ldd conftest`
3422
3529
            for i in $deplibs; do
3423
 
              name="`expr $i : '-l\(.*\)'`"
 
3530
              name=`expr $i : '-l\(.*\)'`
3424
3531
              # If $name is empty we are operating on a -L argument.
3425
3532
              if test "$name" != "" && test "$name" -ne "0"; then
3426
3533
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3457
3564
            # Error occurred in the first compile.  Let's try to salvage
3458
3565
            # the situation: Compile a separate program for each library.
3459
3566
            for i in $deplibs; do
3460
 
              name="`expr $i : '-l\(.*\)'`"
 
3567
              name=`expr $i : '-l\(.*\)'`
3461
3568
              # If $name is empty we are operating on a -L argument.
3462
3569
              if test "$name" != "" && test "$name" != "0"; then
3463
3570
                $rm conftest
3464
 
                $LTCC -o conftest conftest.c $i
 
3571
                $LTCC $LTCFLAGS -o conftest conftest.c $i
3465
3572
                # Did it work?
3466
3573
                if test "$?" -eq 0 ; then
3467
3574
                  ldd_output=`ldd conftest`
3509
3616
          set dummy $deplibs_check_method
3510
3617
          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3511
3618
          for a_deplib in $deplibs; do
3512
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3619
            name=`expr $a_deplib : '-l\(.*\)'`
3513
3620
            # If $name is empty we are operating on a -L argument.
3514
3621
            if test "$name" != "" && test  "$name" != "0"; then
3515
3622
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3578
3685
          set dummy $deplibs_check_method
3579
3686
          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3580
3687
          for a_deplib in $deplibs; do
3581
 
            name="`expr $a_deplib : '-l\(.*\)'`"
 
3688
            name=`expr $a_deplib : '-l\(.*\)'`
3582
3689
            # If $name is empty we are operating on a -L argument.
3583
3690
            if test -n "$name" && test "$name" != "0"; then
3584
3691
              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3708
3815
        deplibs=$newdeplibs
3709
3816
      fi
3710
3817
 
 
3818
 
 
3819
      # move library search paths that coincide with paths to not yet
 
3820
      # installed libraries to the beginning of the library search list
 
3821
      new_libs=
 
3822
      for path in $notinst_path; do
 
3823
        case " $new_libs " in
 
3824
        *" -L$path/$objdir "*) ;;
 
3825
        *)
 
3826
          case " $deplibs " in
 
3827
          *" -L$path/$objdir "*)
 
3828
            new_libs="$new_libs -L$path/$objdir" ;;
 
3829
          esac
 
3830
          ;;
 
3831
        esac
 
3832
      done
 
3833
      for deplib in $deplibs; do
 
3834
        case $deplib in
 
3835
        -L*)
 
3836
          case " $new_libs " in
 
3837
          *" $deplib "*) ;;
 
3838
          *) new_libs="$new_libs $deplib" ;;
 
3839
          esac
 
3840
          ;;
 
3841
        *) new_libs="$new_libs $deplib" ;;
 
3842
        esac
 
3843
      done
 
3844
      deplibs="$new_libs"
 
3845
 
 
3846
 
3711
3847
      # All the library-specific variables (install_libdir is set above).
3712
3848
      library_names=
3713
3849
      old_library=
3791
3927
        fi
3792
3928
 
3793
3929
        lib="$output_objdir/$realname"
 
3930
        linknames=
3794
3931
        for link
3795
3932
        do
3796
3933
          linknames="$linknames $link"
3819
3956
                # The command line is too long to execute in one step.
3820
3957
                $show "using reloadable object file for export list..."
3821
3958
                skipped_export=:
 
3959
                # Break out early, otherwise skipped_export may be
 
3960
                # set to false by a later but shorter cmd.
 
3961
                break
3822
3962
              fi
3823
3963
            done
3824
3964
            IFS="$save_ifs"
3888
4028
          fi
3889
4029
        fi
3890
4030
 
3891
 
        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
 
4031
        if test "X$skipped_export" != "X:" &&
 
4032
           len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3892
4033
           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3893
4034
          :
3894
4035
        else
3923
4064
          do
3924
4065
            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3925
4066
            if test "X$objlist" = X ||
3926
 
               { len=`expr "X$test_cmds" : ".*"` &&
 
4067
               { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3927
4068
                 test "$len" -le "$max_cmd_len"; }; then
3928
4069
              objlist="$objlist $obj"
3929
4070
            else
4013
4154
          IFS="$save_ifs"
4014
4155
          eval cmd=\"$cmd\"
4015
4156
          $show "$cmd"
4016
 
          $run eval "$cmd" || exit $?
 
4157
          $run eval "$cmd" || {
 
4158
            lt_exit=$?
 
4159
 
 
4160
            # Restore the uninstalled library and exit
 
4161
            if test "$mode" = relink; then
 
4162
              $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
4163
            fi
 
4164
 
 
4165
            exit $lt_exit
 
4166
          }
4017
4167
        done
4018
4168
        IFS="$save_ifs"
4019
4169
 
4020
4170
        # Restore the uninstalled library and exit
4021
4171
        if test "$mode" = relink; then
4022
4172
          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
 
4173
 
 
4174
          if test -n "$convenience"; then
 
4175
            if test -z "$whole_archive_flag_spec"; then
 
4176
              $show "${rm}r $gentop"
 
4177
              $run ${rm}r "$gentop"
 
4178
            fi
 
4179
          fi
 
4180
 
4023
4181
          exit $EXIT_SUCCESS
4024
4182
        fi
4025
4183
 
4201
4359
        ;;
4202
4360
      esac
4203
4361
 
 
4362
 
 
4363
      # move library search paths that coincide with paths to not yet
 
4364
      # installed libraries to the beginning of the library search list
 
4365
      new_libs=
 
4366
      for path in $notinst_path; do
 
4367
        case " $new_libs " in
 
4368
        *" -L$path/$objdir "*) ;;
 
4369
        *)
 
4370
          case " $compile_deplibs " in
 
4371
          *" -L$path/$objdir "*)
 
4372
            new_libs="$new_libs -L$path/$objdir" ;;
 
4373
          esac
 
4374
          ;;
 
4375
        esac
 
4376
      done
 
4377
      for deplib in $compile_deplibs; do
 
4378
        case $deplib in
 
4379
        -L*)
 
4380
          case " $new_libs " in
 
4381
          *" $deplib "*) ;;
 
4382
          *) new_libs="$new_libs $deplib" ;;
 
4383
          esac
 
4384
          ;;
 
4385
        *) new_libs="$new_libs $deplib" ;;
 
4386
        esac
 
4387
      done
 
4388
      compile_deplibs="$new_libs"
 
4389
 
 
4390
 
4204
4391
      compile_command="$compile_command $compile_deplibs"
4205
4392
      finalize_command="$finalize_command $finalize_deplibs"
4206
4393
 
4245
4432
        fi
4246
4433
        case $host in
4247
4434
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4435
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4248
4436
          case :$dllsearchpath: in
4249
4437
          *":$libdir:"*) ;;
4250
4438
          *) dllsearchpath="$dllsearchpath:$libdir";;
4251
4439
          esac
 
4440
          case :$dllsearchpath: in
 
4441
          *":$testbindir:"*) ;;
 
4442
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4443
          esac
4252
4444
          ;;
4253
4445
        esac
4254
4446
      done
4364
4556
            if test -z "$export_symbols"; then
4365
4557
              export_symbols="$output_objdir/$outputname.exp"
4366
4558
              $run $rm $export_symbols
4367
 
              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4559
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4560
              case $host in
 
4561
              *cygwin* | *mingw* )
 
4562
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4563
                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
4564
                ;;
 
4565
              esac
4368
4566
            else
4369
 
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4567
              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4370
4568
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4371
4569
              $run eval 'mv "$nlist"T "$nlist"'
 
4570
              case $host in
 
4571
              *cygwin* | *mingw* )
 
4572
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4573
                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
4574
                ;;
 
4575
              esac
4372
4576
            fi
4373
4577
          fi
4374
4578
 
4485
4689
          esac
4486
4690
 
4487
4691
          # Now compile the dynamic symbol file.
4488
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4489
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4692
          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4693
          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4490
4694
 
4491
4695
          # Clean up the generated files.
4492
4696
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4493
4697
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4494
4698
 
4495
4699
          # Transform the symbol file into the correct name.
4496
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4497
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4700
          case $host in
 
4701
          *cygwin* | *mingw* )
 
4702
            if test -f "$output_objdir/${outputname}.def" ; then
 
4703
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4704
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
 
4705
            else
 
4706
              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4707
              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4708
             fi
 
4709
            ;;
 
4710
          * )
 
4711
            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4712
            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4713
            ;;
 
4714
          esac
4498
4715
          ;;
4499
4716
        *)
4500
4717
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4519
4736
        # We have no uninstalled library dependencies, so finalize right now.
4520
4737
        $show "$link_command"
4521
4738
        $run eval "$link_command"
4522
 
        status=$?
 
4739
        exit_status=$?
4523
4740
 
4524
4741
        # Delete the generated files.
4525
4742
        if test -n "$dlsyms"; then
4527
4744
          $run $rm "$output_objdir/${outputname}S.${objext}"
4528
4745
        fi
4529
4746
 
4530
 
        exit $status
 
4747
        exit $exit_status
4531
4748
      fi
4532
4749
 
4533
4750
      if test -n "$shlibpath_var"; then
4667
4884
        esac
4668
4885
        case $host in
4669
4886
          *cygwin* | *mingw* )
4670
 
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
4671
 
            cwrapper=`$echo ${output}.exe`
4672
 
            $rm $cwrappersource $cwrapper
4673
 
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4887
            output_name=`basename $output`
 
4888
            output_path=`dirname $output`
 
4889
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4890
            cwrapper="$output_path/$output_name.exe"
 
4891
            $rm $cwrappersource $cwrapper
 
4892
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4674
4893
 
4675
4894
            cat > $cwrappersource <<EOF
4676
4895
 
4695
4914
#include <malloc.h>
4696
4915
#include <stdarg.h>
4697
4916
#include <assert.h>
 
4917
#include <string.h>
 
4918
#include <ctype.h>
 
4919
#include <sys/stat.h>
4698
4920
 
4699
4921
#if defined(PATH_MAX)
4700
4922
# define LT_PATHMAX PATH_MAX
4705
4927
#endif
4706
4928
 
4707
4929
#ifndef DIR_SEPARATOR
4708
 
#define DIR_SEPARATOR '/'
 
4930
# define DIR_SEPARATOR '/'
 
4931
# define PATH_SEPARATOR ':'
4709
4932
#endif
4710
4933
 
4711
4934
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4712
4935
  defined (__OS2__)
4713
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4714
 
#ifndef DIR_SEPARATOR_2
4715
 
#define DIR_SEPARATOR_2 '\\'
4716
 
#endif
 
4936
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4937
# ifndef DIR_SEPARATOR_2
 
4938
#  define DIR_SEPARATOR_2 '\\'
 
4939
# endif
 
4940
# ifndef PATH_SEPARATOR_2
 
4941
#  define PATH_SEPARATOR_2 ';'
 
4942
# endif
4717
4943
#endif
4718
4944
 
4719
4945
#ifndef DIR_SEPARATOR_2
4723
4949
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4724
4950
#endif /* DIR_SEPARATOR_2 */
4725
4951
 
 
4952
#ifndef PATH_SEPARATOR_2
 
4953
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
4954
#else /* PATH_SEPARATOR_2 */
 
4955
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
4956
#endif /* PATH_SEPARATOR_2 */
 
4957
 
4726
4958
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4727
4959
#define XFREE(stale) do { \
4728
4960
  if (stale) { free ((void *) stale); stale = 0; } \
4729
4961
} while (0)
4730
4962
 
 
4963
/* -DDEBUG is fairly common in CFLAGS.  */
 
4964
#undef DEBUG
 
4965
#if defined DEBUGWRAPPER
 
4966
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 
4967
#else
 
4968
# define DEBUG(format, ...)
 
4969
#endif
 
4970
 
4731
4971
const char *program_name = NULL;
4732
4972
 
4733
4973
void * xmalloc (size_t num);
4734
4974
char * xstrdup (const char *string);
4735
 
char * basename (const char *name);
4736
 
char * fnqualify(const char *path);
 
4975
const char * base_name (const char *name);
 
4976
char * find_executable(const char *wrapper);
 
4977
int    check_executable(const char *path);
4737
4978
char * strendzap(char *str, const char *pat);
4738
4979
void lt_fatal (const char *message, ...);
4739
4980
 
4743
4984
  char **newargz;
4744
4985
  int i;
4745
4986
 
4746
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
4987
  program_name = (char *) xstrdup (base_name (argv[0]));
 
4988
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
 
4989
  DEBUG("(main) program_name : %s\n",program_name);
4747
4990
  newargz = XMALLOC(char *, argc+2);
4748
4991
EOF
4749
4992
 
4750
 
            cat >> $cwrappersource <<EOF
4751
 
  newargz[0] = "$SHELL";
 
4993
            cat >> $cwrappersource <<EOF
 
4994
  newargz[0] = (char *) xstrdup("$SHELL");
4752
4995
EOF
4753
4996
 
4754
 
            cat >> $cwrappersource <<"EOF"
4755
 
  newargz[1] = fnqualify(argv[0]);
 
4997
            cat >> $cwrappersource <<"EOF"
 
4998
  newargz[1] = find_executable(argv[0]);
 
4999
  if (newargz[1] == NULL)
 
5000
    lt_fatal("Couldn't find %s", argv[0]);
 
5001
  DEBUG("(main) found exe at : %s\n",newargz[1]);
4756
5002
  /* we know the script has the same name, without the .exe */
4757
5003
  /* so make sure newargz[1] doesn't end in .exe */
4758
5004
  strendzap(newargz[1],".exe");
4759
5005
  for (i = 1; i < argc; i++)
4760
5006
    newargz[i+1] = xstrdup(argv[i]);
4761
5007
  newargz[argc+1] = NULL;
4762
 
EOF
4763
 
 
4764
 
            cat >> $cwrappersource <<EOF
 
5008
 
 
5009
  for (i=0; i<argc+1; i++)
 
5010
  {
 
5011
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
 
5012
    ;
 
5013
  }
 
5014
 
 
5015
EOF
 
5016
 
 
5017
            case $host_os in
 
5018
              mingw*)
 
5019
                cat >> $cwrappersource <<EOF
 
5020
  execv("$SHELL",(char const **)newargz);
 
5021
EOF
 
5022
              ;;
 
5023
              *)
 
5024
                cat >> $cwrappersource <<EOF
4765
5025
  execv("$SHELL",newargz);
4766
5026
EOF
 
5027
              ;;
 
5028
            esac
4767
5029
 
4768
 
            cat >> $cwrappersource <<"EOF"
 
5030
            cat >> $cwrappersource <<"EOF"
 
5031
  return 127;
4769
5032
}
4770
5033
 
4771
5034
void *
4785
5048
;
4786
5049
}
4787
5050
 
4788
 
char *
4789
 
basename (const char *name)
 
5051
const char *
 
5052
base_name (const char *name)
4790
5053
{
4791
5054
  const char *base;
4792
5055
 
4793
5056
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4794
5057
  /* Skip over the disk name in MSDOS pathnames. */
4795
 
  if (isalpha (name[0]) && name[1] == ':')
 
5058
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4796
5059
    name += 2;
4797
5060
#endif
4798
5061
 
4799
5062
  for (base = name; *name; name++)
4800
5063
    if (IS_DIR_SEPARATOR (*name))
4801
5064
      base = name + 1;
4802
 
  return (char *) base;
4803
 
}
4804
 
 
 
5065
  return base;
 
5066
}
 
5067
 
 
5068
int
 
5069
check_executable(const char * path)
 
5070
{
 
5071
  struct stat st;
 
5072
 
 
5073
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
 
5074
  if ((!path) || (!*path))
 
5075
    return 0;
 
5076
 
 
5077
  if ((stat (path, &st) >= 0) &&
 
5078
      (
 
5079
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
5080
#if defined (S_IXOTH)
 
5081
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
 
5082
#endif
 
5083
#if defined (S_IXGRP)
 
5084
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
 
5085
#endif
 
5086
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
5087
      )
 
5088
    return 1;
 
5089
  else
 
5090
    return 0;
 
5091
}
 
5092
 
 
5093
/* Searches for the full path of the wrapper.  Returns
 
5094
   newly allocated full path name if found, NULL otherwise */
4805
5095
char *
4806
 
fnqualify(const char *path)
 
5096
find_executable (const char* wrapper)
4807
5097
{
4808
 
  size_t size;
4809
 
  char *p;
 
5098
  int has_slash = 0;
 
5099
  const char* p;
 
5100
  const char* p_next;
 
5101
  /* static buffer for getcwd */
4810
5102
  char tmp[LT_PATHMAX + 1];
4811
 
 
4812
 
  assert(path != NULL);
4813
 
 
4814
 
  /* Is it qualified already? */
4815
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4816
 
  if (isalpha (path[0]) && path[1] == ':')
4817
 
    return xstrdup (path);
4818
 
#endif
4819
 
  if (IS_DIR_SEPARATOR (path[0]))
4820
 
    return xstrdup (path);
4821
 
 
4822
 
  /* prepend the current directory */
4823
 
  /* doesn't handle '~' */
 
5103
  int tmp_len;
 
5104
  char* concat_name;
 
5105
 
 
5106
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
 
5107
 
 
5108
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
5109
    return NULL;
 
5110
 
 
5111
  /* Absolute path? */
 
5112
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5113
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
 
5114
  {
 
5115
    concat_name = xstrdup (wrapper);
 
5116
    if (check_executable(concat_name))
 
5117
      return concat_name;
 
5118
    XFREE(concat_name);
 
5119
  }
 
5120
  else
 
5121
  {
 
5122
#endif
 
5123
    if (IS_DIR_SEPARATOR (wrapper[0]))
 
5124
    {
 
5125
      concat_name = xstrdup (wrapper);
 
5126
      if (check_executable(concat_name))
 
5127
        return concat_name;
 
5128
      XFREE(concat_name);
 
5129
    }
 
5130
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5131
  }
 
5132
#endif
 
5133
 
 
5134
  for (p = wrapper; *p; p++)
 
5135
    if (*p == '/')
 
5136
    {
 
5137
      has_slash = 1;
 
5138
      break;
 
5139
    }
 
5140
  if (!has_slash)
 
5141
  {
 
5142
    /* no slashes; search PATH */
 
5143
    const char* path = getenv ("PATH");
 
5144
    if (path != NULL)
 
5145
    {
 
5146
      for (p = path; *p; p = p_next)
 
5147
      {
 
5148
        const char* q;
 
5149
        size_t p_len;
 
5150
        for (q = p; *q; q++)
 
5151
          if (IS_PATH_SEPARATOR(*q))
 
5152
            break;
 
5153
        p_len = q - p;
 
5154
        p_next = (*q == '\0' ? q : q + 1);
 
5155
        if (p_len == 0)
 
5156
        {
 
5157
          /* empty path: current directory */
 
5158
          if (getcwd (tmp, LT_PATHMAX) == NULL)
 
5159
            lt_fatal ("getcwd failed");
 
5160
          tmp_len = strlen(tmp);
 
5161
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5162
          memcpy (concat_name, tmp, tmp_len);
 
5163
          concat_name[tmp_len] = '/';
 
5164
          strcpy (concat_name + tmp_len + 1, wrapper);
 
5165
        }
 
5166
        else
 
5167
        {
 
5168
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
 
5169
          memcpy (concat_name, p, p_len);
 
5170
          concat_name[p_len] = '/';
 
5171
          strcpy (concat_name + p_len + 1, wrapper);
 
5172
        }
 
5173
        if (check_executable(concat_name))
 
5174
          return concat_name;
 
5175
        XFREE(concat_name);
 
5176
      }
 
5177
    }
 
5178
    /* not found in PATH; assume curdir */
 
5179
  }
 
5180
  /* Relative path | not found in path: prepend cwd */
4824
5181
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4825
5182
    lt_fatal ("getcwd failed");
4826
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4827
 
  p = XMALLOC(char, size);
4828
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4829
 
  return p;
 
5183
  tmp_len = strlen(tmp);
 
5184
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5185
  memcpy (concat_name, tmp, tmp_len);
 
5186
  concat_name[tmp_len] = '/';
 
5187
  strcpy (concat_name + tmp_len + 1, wrapper);
 
5188
 
 
5189
  if (check_executable(concat_name))
 
5190
    return concat_name;
 
5191
  XFREE(concat_name);
 
5192
  return NULL;
4830
5193
}
4831
5194
 
4832
5195
char *
4870
5233
  va_end (ap);
4871
5234
}
4872
5235
EOF
4873
 
          # we should really use a build-platform specific compiler
4874
 
          # here, but OTOH, the wrappers (shell script and this C one)
4875
 
          # are only useful if you want to execute the "real" binary.
4876
 
          # Since the "real" binary is built for $host, then this
4877
 
          # wrapper might as well be built for $host, too.
4878
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4879
 
          ;;
4880
 
        esac
4881
 
        $rm $output
4882
 
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
 
5236
          # we should really use a build-platform specific compiler
 
5237
          # here, but OTOH, the wrappers (shell script and this C one)
 
5238
          # are only useful if you want to execute the "real" binary.
 
5239
          # Since the "real" binary is built for $host, then this
 
5240
          # wrapper might as well be built for $host, too.
 
5241
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5242
          ;;
 
5243
        esac
 
5244
        $rm $output
 
5245
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4883
5246
 
4884
5247
        $echo > $output "\
4885
5248
#! $SHELL
5029
5392
        # Backslashes separate directories on plain windows
5030
5393
        *-*-mingw | *-*-os2*)
5031
5394
          $echo >> $output "\
5032
 
      exec \$progdir\\\\\$program \${1+\"\$@\"}
 
5395
      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5033
5396
"
5034
5397
          ;;
5035
5398
 
5036
5399
        *)
5037
5400
          $echo >> $output "\
5038
 
      exec \$progdir/\$program \${1+\"\$@\"}
 
5401
      exec \"\$progdir/\$program\" \${1+\"\$@\"}
5039
5402
"
5040
5403
          ;;
5041
5404
        esac
5045
5408
    fi
5046
5409
  else
5047
5410
    # The program doesn't exist.
5048
 
    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
 
5411
    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5049
5412
    \$echo \"This script is just a wrapper for \$program.\" 1>&2
5050
5413
    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5051
5414
    exit $EXIT_FAILURE
5109
5472
            $run ${rm}r "$gentop"
5110
5473
            $show "$mkdir $gentop"
5111
5474
            $run $mkdir "$gentop"
5112
 
            status=$?
5113
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
5114
 
              exit $status
 
5475
            exit_status=$?
 
5476
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5477
              exit $exit_status
5115
5478
            fi
5116
5479
          fi
5117
5480
 
5168
5531
            oldobjs="$objlist $obj"
5169
5532
            objlist="$objlist $obj"
5170
5533
            eval test_cmds=\"$old_archive_cmds\"
5171
 
            if len=`expr "X$test_cmds" : ".*"` &&
 
5534
            if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5172
5535
               test "$len" -le "$max_cmd_len"; then
5173
5536
              :
5174
5537
            else
5365
5728
    # install_prog (especially on Windows NT).
5366
5729
    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5367
5730
       # Allow the use of GNU shtool's install command.
5368
 
       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
 
5731
       $echo "X$nonopt" | grep shtool > /dev/null; then
5369
5732
      # Aesthetically quote it.
5370
5733
      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5371
5734
      case $arg in
5372
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
5735
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5373
5736
        arg="\"$arg\""
5374
5737
        ;;
5375
5738
      esac
5378
5741
      shift
5379
5742
    else
5380
5743
      install_prog=
5381
 
      arg="$nonopt"
 
5744
      arg=$nonopt
5382
5745
    fi
5383
5746
 
5384
5747
    # The real first argument should be the name of the installation program.
5385
5748
    # Aesthetically quote it.
5386
5749
    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5387
5750
    case $arg in
5388
 
    *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
5751
    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
5389
5752
      arg="\"$arg\""
5390
5753
      ;;
5391
5754
    esac
5403
5766
    do
5404
5767
      if test -n "$dest"; then
5405
5768
        files="$files $dest"
5406
 
        dest="$arg"
 
5769
        dest=$arg
5407
5770
        continue
5408
5771
      fi
5409
5772
 
5410
5773
      case $arg in
5411
5774
      -d) isdir=yes ;;
5412
 
      -f) prev="-f" ;;
5413
 
      -g) prev="-g" ;;
5414
 
      -m) prev="-m" ;;
5415
 
      -o) prev="-o" ;;
 
5775
      -f) 
 
5776
        case " $install_prog " in
 
5777
        *[\\\ /]cp\ *) ;;
 
5778
        *) prev=$arg ;;
 
5779
        esac
 
5780
        ;;
 
5781
      -g | -m | -o) prev=$arg ;;
5416
5782
      -s)
5417
5783
        stripme=" -s"
5418
5784
        continue
5419
5785
        ;;
5420
 
      -*) ;;
5421
 
 
 
5786
      -*)
 
5787
        ;;
5422
5788
      *)
5423
5789
        # If the previous option needed an argument, then skip it.
5424
5790
        if test -n "$prev"; then
5425
5791
          prev=
5426
5792
        else
5427
 
          dest="$arg"
 
5793
          dest=$arg
5428
5794
          continue
5429
5795
        fi
5430
5796
        ;;
5433
5799
      # Aesthetically quote the argument.
5434
5800
      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5435
5801
      case $arg in
5436
 
      *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
 
5802
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
5437
5803
        arg="\"$arg\""
5438
5804
        ;;
5439
5805
      esac
5602
5968
 
5603
5969
          if test "$#" -gt 0; then
5604
5970
            # Delete the old symlinks, and create new ones.
 
5971
            # Try `ln -sf' first, because the `ln' binary might depend on
 
5972
            # the symlink we replace!  Solaris /bin/ln does not understand -f,
 
5973
            # so we also need to try rm && ln -s.
5605
5974
            for linkname
5606
5975
            do
5607
5976
              if test "$linkname" != "$realname"; then
5608
 
                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5609
 
                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
 
5977
                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
 
5978
                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5610
5979
              fi
5611
5980
            done
5612
5981
          fi
5619
5988
            IFS="$save_ifs"
5620
5989
            eval cmd=\"$cmd\"
5621
5990
            $show "$cmd"
5622
 
            $run eval "$cmd" || exit $?
 
5991
            $run eval "$cmd" || {
 
5992
              lt_exit=$?
 
5993
 
 
5994
              # Restore the uninstalled library and exit
 
5995
              if test "$mode" = relink; then
 
5996
                $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
 
5997
              fi
 
5998
 
 
5999
              exit $lt_exit
 
6000
            }
5623
6001
          done
5624
6002
          IFS="$save_ifs"
5625
6003
        fi
5713
6091
          notinst_deplibs=
5714
6092
          relink_command=
5715
6093
 
5716
 
          # To insure that "foo" is sourced, and not "foo.exe",
5717
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5718
 
          # which disallows the automatic-append-.exe behavior.
5719
 
          case $build in
5720
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5721
 
          *) wrapperdot=${wrapper} ;;
5722
 
          esac
 
6094
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6095
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6096
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6097
          # `FILE.' does not work on cygwin managed mounts.
 
6098
          #
5723
6099
          # If there is no directory component, then add one.
5724
 
          case $file in
5725
 
          */* | *\\*) . ${wrapperdot} ;;
5726
 
          *) . ./${wrapperdot} ;;
 
6100
          case $wrapper in
 
6101
          */* | *\\*) . ${wrapper} ;;
 
6102
          *) . ./${wrapper} ;;
5727
6103
          esac
5728
6104
 
5729
6105
          # Check the variables that should have been set.
5751
6127
          done
5752
6128
 
5753
6129
          relink_command=
5754
 
          # To insure that "foo" is sourced, and not "foo.exe",
5755
 
          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5756
 
          # which disallows the automatic-append-.exe behavior.
5757
 
          case $build in
5758
 
          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5759
 
          *) wrapperdot=${wrapper} ;;
5760
 
          esac
 
6130
          # Note that it is not necessary on cygwin/mingw to append a dot to
 
6131
          # foo even if both foo and FILE.exe exist: automatic-append-.exe
 
6132
          # behavior happens only for exec(3), not for open(2)!  Also, sourcing
 
6133
          # `FILE.' does not work on cygwin managed mounts.
 
6134
          #
5761
6135
          # If there is no directory component, then add one.
5762
 
          case $file in
5763
 
          */* | *\\*) . ${wrapperdot} ;;
5764
 
          *) . ./${wrapperdot} ;;
 
6136
          case $wrapper in
 
6137
          */* | *\\*) . ${wrapper} ;;
 
6138
          *) . ./${wrapper} ;;
5765
6139
          esac
5766
6140
 
5767
6141
          outputname=
5768
6142
          if test "$fast_install" = no && test -n "$relink_command"; then
5769
6143
            if test "$finalize" = yes && test -z "$run"; then
5770
 
              tmpdir="/tmp"
5771
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5772
 
              tmpdir="$tmpdir/libtool-$$"
5773
 
              save_umask=`umask`
5774
 
              umask 0077
5775
 
              if $mkdir "$tmpdir"; then
5776
 
                umask $save_umask
5777
 
              else
5778
 
                umask $save_umask
5779
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5780
 
                continue
5781
 
              fi
 
6144
              tmpdir=`func_mktempdir`
5782
6145
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5783
6146
              outputname="$tmpdir/$file"
5784
6147
              # Replace the output file specification.
5802
6165
        fi
5803
6166
 
5804
6167
        # remove .exe since cygwin /usr/bin/install will append another
5805
 
        # one anyways
 
6168
        # one anyway 
5806
6169
        case $install_prog,$host in
5807
6170
        */usr/bin/install*,*cygwin*)
5808
6171
          case $file:$destfile in
5902
6265
    # Exit here if they wanted silent mode.
5903
6266
    test "$show" = : && exit $EXIT_SUCCESS
5904
6267
 
5905
 
    $echo "----------------------------------------------------------------------"
 
6268
    $echo "X----------------------------------------------------------------------" | $Xsed
5906
6269
    $echo "Libraries have been installed in:"
5907
6270
    for libdir in $libdirs; do
5908
6271
      $echo "   $libdir"
5935
6298
    $echo
5936
6299
    $echo "See any operating system documentation about shared libraries for"
5937
6300
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5938
 
    $echo "----------------------------------------------------------------------"
 
6301
    $echo "X----------------------------------------------------------------------" | $Xsed
5939
6302
    exit $EXIT_SUCCESS
5940
6303
    ;;
5941
6304
 
6152
6515
            rmfiles="$rmfiles $objdir/$n"
6153
6516
          done
6154
6517
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6155
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6156
6518
 
6157
 
          if test "$mode" = uninstall; then
 
6519
          case "$mode" in
 
6520
          clean)
 
6521
            case "  $library_names " in
 
6522
            # "  " in the beginning catches empty $dlname
 
6523
            *" $dlname "*) ;;
 
6524
            *) rmfiles="$rmfiles $objdir/$dlname" ;;
 
6525
            esac
 
6526
             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6527
            ;;
 
6528
          uninstall)
6158
6529
            if test -n "$library_names"; then
6159
6530
              # Do each command in the postuninstall commands.
6160
6531
              cmds=$postuninstall_cmds
6187
6558
              IFS="$save_ifs"
6188
6559
            fi
6189
6560
            # FIXME: should reinstall the best remaining shared library.
6190
 
          fi
 
6561
            ;;
 
6562
          esac
6191
6563
        fi
6192
6564
        ;;
6193
6565
 
6486
6858
# configuration.  But we'll never go from static-only to shared-only.
6487
6859
 
6488
6860
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6489
 
build_libtool_libs=no
6490
 
build_old_libs=yes
 
6861
disable_libs=shared
6491
6862
# ### END LIBTOOL TAG CONFIG: disable-shared
6492
6863
 
6493
6864
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6494
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6865
disable_libs=static
6495
6866
# ### END LIBTOOL TAG CONFIG: disable-static
6496
6867
 
6497
6868
# Local Variables: