~ubuntu-branches/ubuntu/lucid/tidy/lucid

« back to all changes in this revision

Viewing changes to ltmain.sh

  • Committer: Bazaar Package Importer
  • Author(s): Jason Thomas
  • Date: 2008-01-20 21:46:03 UTC
  • mfrom: (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080120214603-poklofici9og61tx
Tags: 20080116cvs-2
* debian/control: build depends on xsltproc
  (closes: #461608)
* debian/tidy.preinst,postinst: add code to move old config file
  (closes: #461623)

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, 2004, 2005
5
 
# Free Software Foundation, Inc.
 
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
 
5
# 2007  Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
7
#
8
8
# This program is free software; you can redistribute it and/or modify
43
43
 
44
44
PROGRAM=ltmain.sh
45
45
PACKAGE=libtool
46
 
VERSION="1.5.20 Debian 1.5.20-2"
47
 
TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
 
46
VERSION="1.5.24 Debian 1.5.24-2"
 
47
TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)"
48
48
 
49
 
# See if we are running on zsh, and set the options which allow our
50
 
# commands through without removal of \ escapes.
51
 
if test -n "${ZSH_VERSION+set}" ; then
 
49
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
 
50
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
 
51
  emulate sh
 
52
  NULLCMD=:
 
53
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
 
54
  # is contrary to our usage.  Disable this feature.
 
55
  alias -g '${1+"$@"}'='"$@"'
52
56
  setopt NO_GLOB_SUBST
 
57
else
 
58
  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
53
59
fi
 
60
BIN_SH=xpg4; export BIN_SH # for Tru64
 
61
DUALCASE=1; export DUALCASE # for MKS sh
54
62
 
55
63
# Check that we have a working $echo.
56
64
if test "X$1" = X--no-reexec; then
105
113
# These must not be set unconditionally because not all systems understand
106
114
# e.g. LANG=C (notably SCO).
107
115
# We save the old values to restore during execute mode.
108
 
if test "${LC_ALL+set}" = set; then
109
 
  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
110
 
fi
111
 
if test "${LANG+set}" = set; then
112
 
  save_LANG="$LANG"; LANG=C; export LANG
113
 
fi
 
116
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
117
do
 
118
  eval "if test \"\${$lt_var+set}\" = set; then
 
119
          save_$lt_var=\$$lt_var
 
120
          $lt_var=C
 
121
          export $lt_var
 
122
        fi"
 
123
done
114
124
 
115
125
# Make sure IFS has a sensible default
116
126
lt_nl='
132
142
show="$echo"
133
143
show_help=
134
144
execute_dlfiles=
 
145
duplicate_deps=no
 
146
preserve_args=
135
147
lo2o="s/\\.lo\$/.${objext}/"
136
148
o2lo="s/\\.${objext}\$/.lo/"
 
149
extracted_archives=
 
150
extracted_serial=0
137
151
 
138
152
#####################################
139
153
# Shell function definitions:
140
154
# This seems to be the best place for them
141
155
 
 
156
# func_mktempdir [string]
 
157
# Make a temporary directory that won't clash with other running
 
158
# libtool processes, and avoids race conditions if possible.  If
 
159
# given, STRING is the basename for that directory.
 
160
func_mktempdir ()
 
161
{
 
162
    my_template="${TMPDIR-/tmp}/${1-$progname}"
 
163
 
 
164
    if test "$run" = ":"; then
 
165
      # Return a directory name, but don't create it in dry-run mode
 
166
      my_tmpdir="${my_template}-$$"
 
167
    else
 
168
 
 
169
      # If mktemp works, use that first and foremost
 
170
      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
 
171
 
 
172
      if test ! -d "$my_tmpdir"; then
 
173
        # Failing that, at least try and use $RANDOM to avoid a race
 
174
        my_tmpdir="${my_template}-${RANDOM-0}$$"
 
175
 
 
176
        save_mktempdir_umask=`umask`
 
177
        umask 0077
 
178
        $mkdir "$my_tmpdir"
 
179
        umask $save_mktempdir_umask
 
180
      fi
 
181
 
 
182
      # If we're not in dry-run mode, bomb out on failure
 
183
      test -d "$my_tmpdir" || {
 
184
        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
 
185
        exit $EXIT_FAILURE
 
186
      }
 
187
    fi
 
188
 
 
189
    $echo "X$my_tmpdir" | $Xsed
 
190
}
 
191
 
 
192
 
142
193
# func_win32_libid arg
143
194
# return the library type of file 'arg'
144
195
#
157
208
    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
158
209
      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
159
210
      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
 
211
        $SED -n -e '1,100{
 
212
                / I /{
 
213
                        s,.*,import,
 
214
                        p
 
215
                        q
 
216
                        }
 
217
                }'`
 
218
      case $win32_nmres in
 
219
      import*)  win32_libid_type="x86 archive import";;
 
220
      *)        win32_libid_type="x86 archive static";;
 
221
      esac
166
222
    fi
167
223
    ;;
168
224
  *DLL*)
289
345
        *) my_xabs=`pwd`"/$my_xlib" ;;
290
346
      esac
291
347
      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
292
 
      my_xdir="$my_gentop/$my_xlib"
 
348
      my_xlib_u=$my_xlib
 
349
      while :; do
 
350
        case " $extracted_archives " in
 
351
        *" $my_xlib_u "*)
 
352
          extracted_serial=`expr $extracted_serial + 1`
 
353
          my_xlib_u=lt$extracted_serial-$my_xlib ;;
 
354
        *) break ;;
 
355
        esac
 
356
      done
 
357
      extracted_archives="$extracted_archives $my_xlib_u"
 
358
      my_xdir="$my_gentop/$my_xlib_u"
293
359
 
294
360
      $show "${rm}r $my_xdir"
295
361
      $run ${rm}r "$my_xdir"
296
362
      $show "$mkdir $my_xdir"
297
363
      $run $mkdir "$my_xdir"
298
 
      status=$?
299
 
      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
300
 
        exit $status
 
364
      exit_status=$?
 
365
      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
 
366
        exit $exit_status
301
367
      fi
302
368
      case $host in
303
369
      *-darwin*)
352
418
# Darwin sucks
353
419
eval std_shrext=\"$shrext_cmds\"
354
420
 
 
421
disable_libs=no
 
422
 
355
423
# Parse our command line options once, thoroughly.
356
424
while test "$#" -gt 0
357
425
do
414
482
    ;;
415
483
 
416
484
  --version)
417
 
    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
418
 
    $echo
419
 
    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
420
 
    $echo "This is free software; see the source for copying conditions.  There is NO"
421
 
    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
485
    echo "\
 
486
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
 
487
 
 
488
Copyright (C) 2007  Free Software Foundation, Inc.
 
489
This is free software; see the source for copying conditions.  There is NO
 
490
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
422
491
    exit $?
423
492
    ;;
424
493
 
468
537
    preserve_args="$preserve_args $arg"
469
538
    ;;
470
539
 
471
 
  --tag) prevopt="--tag" prev=tag ;;
 
540
  --tag)
 
541
    prevopt="--tag"
 
542
    prev=tag
 
543
    preserve_args="$preserve_args --tag"
 
544
    ;;
472
545
  --tag=*)
473
546
    set tag "$optarg" ${1+"$@"}
474
547
    shift
500
573
  exit $EXIT_FAILURE
501
574
fi
502
575
 
 
576
case $disable_libs in
 
577
no) 
 
578
  ;;
 
579
shared)
 
580
  build_libtool_libs=no
 
581
  build_old_libs=yes
 
582
  ;;
 
583
static)
 
584
  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 
585
  ;;
 
586
esac
 
587
 
503
588
# If this variable is set in any of the actions, the command in it
504
589
# will be execed at the end.  This prevents here-documents from being
505
590
# left over by shells.
699
784
    *.class) xform=class ;;
700
785
    *.cpp) xform=cpp ;;
701
786
    *.cxx) xform=cxx ;;
702
 
    *.f90) xform=f90 ;;
 
787
    *.[fF][09]?) xform=[fF][09]. ;;
703
788
    *.for) xform=for ;;
704
789
    *.java) xform=java ;;
 
790
    *.obj) xform=obj ;;
705
791
    esac
706
792
 
707
793
    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
856
942
      if test ! -d "${xdir}$objdir"; then
857
943
        $show "$mkdir ${xdir}$objdir"
858
944
        $run $mkdir ${xdir}$objdir
859
 
        status=$?
860
 
        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
861
 
          exit $status
 
945
        exit_status=$?
 
946
        if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
 
947
          exit $exit_status
862
948
        fi
863
949
      fi
864
950
 
1061
1147
    no_install=no
1062
1148
    objs=
1063
1149
    non_pic_objects=
 
1150
    notinst_path= # paths that contain not-installed libtool libraries
1064
1151
    precious_files_regex=
1065
1152
    prefer_static_libs=no
1066
1153
    preload=no
1081
1168
    for arg
1082
1169
    do
1083
1170
      case $arg in
1084
 
      -all-static | -static)
1085
 
        if test "X$arg" = "X-all-static"; then
 
1171
      -all-static | -static | -static-libtool-libs)
 
1172
        case $arg in
 
1173
        -all-static)
1086
1174
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1087
1175
            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1088
1176
          fi
1089
1177
          if test -n "$link_static_flag"; then
1090
1178
            dlopen_self=$dlopen_self_static
1091
1179
          fi
1092
 
        else
1093
 
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
1094
 
            dlopen_self=$dlopen_self_static
1095
 
          fi
1096
 
        fi
 
1180
          prefer_static_libs=yes
 
1181
          ;;
 
1182
        -static)
 
1183
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
1184
            dlopen_self=$dlopen_self_static
 
1185
          fi
 
1186
          prefer_static_libs=built
 
1187
          ;;
 
1188
        -static-libtool-libs)
 
1189
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
 
1190
            dlopen_self=$dlopen_self_static
 
1191
          fi
 
1192
          prefer_static_libs=yes
 
1193
          ;;
 
1194
        esac
1097
1195
        build_libtool_libs=no
1098
1196
        build_old_libs=yes
1099
 
        prefer_static_libs=yes
1100
1197
        break
1101
1198
        ;;
1102
1199
      esac
1271
1368
                  if test -z "$pic_object" || test "$pic_object" = none ; then
1272
1369
                    arg="$non_pic_object"
1273
1370
                  fi
 
1371
                else
 
1372
                  # If the PIC object exists, use it instead.
 
1373
                  # $xdir was prepended to $pic_object above.
 
1374
                  non_pic_object="$pic_object"
 
1375
                  non_pic_objects="$non_pic_objects $non_pic_object"
1274
1376
                fi
1275
1377
              else
1276
1378
                # Only an error if not doing a dry-run.
1354
1456
          prev=
1355
1457
          continue
1356
1458
          ;;
1357
 
        darwin_framework)
1358
 
          compiler_flags="$compiler_flags $arg"
 
1459
        darwin_framework|darwin_framework_skip)
 
1460
          test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1359
1461
          compile_command="$compile_command $arg"
1360
1462
          finalize_command="$finalize_command $arg"
1361
1463
          prev=
1419
1521
        continue
1420
1522
        ;;
1421
1523
 
1422
 
      -framework|-arch)
1423
 
        prev=darwin_framework
1424
 
        compiler_flags="$compiler_flags $arg"
 
1524
      -framework|-arch|-isysroot)
 
1525
        case " $CC " in
 
1526
          *" ${arg} ${1} "* | *" ${arg} ${1} "*) 
 
1527
                prev=darwin_framework_skip ;;
 
1528
          *) compiler_flags="$compiler_flags $arg"
 
1529
             prev=darwin_framework ;;
 
1530
        esac
1425
1531
        compile_command="$compile_command $arg"
1426
1532
        finalize_command="$finalize_command $arg"
1427
 
        continue
1428
 
        ;;
 
1533
        continue
 
1534
        ;;
1429
1535
 
1430
1536
      -inst-prefix-dir)
1431
1537
        prev=inst_prefix
1453
1559
          absdir=`cd "$dir" && pwd`
1454
1560
          if test -z "$absdir"; then
1455
1561
            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1456
 
            exit $EXIT_FAILURE
 
1562
            absdir="$dir"
 
1563
            notinst_path="$notinst_path $dir"
1457
1564
          fi
1458
1565
          dir="$absdir"
1459
1566
          ;;
1467
1574
        esac
1468
1575
        case $host in
1469
1576
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1577
          testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1470
1578
          case :$dllsearchpath: in
1471
1579
          *":$dir:"*) ;;
1472
1580
          *) dllsearchpath="$dllsearchpath:$dir";;
1473
1581
          esac
 
1582
          case :$dllsearchpath: in
 
1583
          *":$testbindir:"*) ;;
 
1584
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
1585
          esac
1474
1586
          ;;
1475
1587
        esac
1476
1588
        continue
1479
1591
      -l*)
1480
1592
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1481
1593
          case $host in
1482
 
          *-*-cygwin* | *-*-pw32* | *-*-beos*)
 
1594
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1483
1595
            # These systems don't actually have a C or math library (as such)
1484
1596
            continue
1485
1597
            ;;
1486
 
          *-*-mingw* | *-*-os2*)
 
1598
          *-*-os2*)
1487
1599
            # These systems don't actually have a C library (as such)
1488
1600
            test "X$arg" = "X-lc" && continue
1489
1601
            ;;
1495
1607
            # Rhapsody C and math libraries are in the System framework
1496
1608
            deplibs="$deplibs -framework System"
1497
1609
            continue
 
1610
            ;;
 
1611
          *-*-sco3.2v5* | *-*-sco5v6*)
 
1612
            # Causes problems with __ctype
 
1613
            test "X$arg" = "X-lc" && continue
 
1614
            ;;
 
1615
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
1616
            # Compiler inserts libc in the correct place for threads to work
 
1617
            test "X$arg" = "X-lc" && continue
 
1618
            ;;
1498
1619
          esac
1499
1620
        elif test "X$arg" = "X-lc_r"; then
1500
1621
         case $host in
1518
1639
        continue
1519
1640
        ;;
1520
1641
 
1521
 
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
1642
     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1522
1643
        compiler_flags="$compiler_flags $arg"
1523
1644
        compile_command="$compile_command $arg"
1524
1645
        finalize_command="$finalize_command $arg"
1536
1657
      # +DA*, +DD* enable 64-bit mode on the HP compiler
1537
1658
      # -q* pass through compiler args for the IBM compiler
1538
1659
      # -m* pass through architecture-specific compiler args for GCC
1539
 
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
 
1660
      # -m*, -t[45]*, -txscale* pass through architecture-specific
 
1661
      # compiler args for GCC
 
1662
      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
 
1663
      # -F/path gives path to uninstalled frameworks, gcc on darwin
 
1664
      # @file GCC response files
 
1665
      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
 
1666
      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1540
1667
 
1541
1668
        # Unknown arguments in both finalize_command and compile_command need
1542
1669
        # to be aesthetically quoted because they are evaled later.
1548
1675
        esac
1549
1676
        compile_command="$compile_command $arg"
1550
1677
        finalize_command="$finalize_command $arg"
1551
 
        if test "$with_gcc" = "yes" ; then
1552
 
          compiler_flags="$compiler_flags $arg"
1553
 
        fi
 
1678
        compiler_flags="$compiler_flags $arg"
1554
1679
        continue
1555
1680
        ;;
1556
1681
 
1566
1691
 
1567
1692
      -no-install)
1568
1693
        case $host in
1569
 
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
1694
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1570
1695
          # The PATH hackery in wrapper scripts is required on Windows
1571
 
          # in order for the loader to find any dlls it needs.
 
1696
          # and Darwin in order for the loader to find any dlls it needs.
1572
1697
          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1573
1698
          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1574
1699
          fast_install=no
1627
1752
        continue
1628
1753
        ;;
1629
1754
 
1630
 
      -static)
 
1755
      -static | -static-libtool-libs)
1631
1756
        # The effects of -static are defined in a previous loop.
1632
1757
        # We used to do the same as -all-static on platforms that
1633
1758
        # didn't have a PIC flag, but the assumption that the effects
1788
1913
            if test -z "$pic_object" || test "$pic_object" = none ; then
1789
1914
              arg="$non_pic_object"
1790
1915
            fi
 
1916
          else
 
1917
            # If the PIC object exists, use it instead.
 
1918
            # $xdir was prepended to $pic_object above.
 
1919
            non_pic_object="$pic_object"
 
1920
            non_pic_objects="$non_pic_objects $non_pic_object"
1791
1921
          fi
1792
1922
        else
1793
1923
          # Only an error if not doing a dry-run.
1893
2023
    if test ! -d "$output_objdir"; then
1894
2024
      $show "$mkdir $output_objdir"
1895
2025
      $run $mkdir $output_objdir
1896
 
      status=$?
1897
 
      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1898
 
        exit $status
 
2026
      exit_status=$?
 
2027
      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
 
2028
        exit $exit_status
1899
2029
      fi
1900
2030
    fi
1901
2031
 
1958
2088
    newlib_search_path=
1959
2089
    need_relink=no # whether we're linking any uninstalled libtool libraries
1960
2090
    notinst_deplibs= # not-installed libtool libraries
1961
 
    notinst_path= # paths that contain not-installed libtool libraries
1962
2091
    case $linkmode in
1963
2092
    lib)
1964
2093
        passes="conv link"
2008
2137
        lib=
2009
2138
        found=no
2010
2139
        case $deplib in
2011
 
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
 
2140
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2012
2141
          if test "$linkmode,$pass" = "prog,link"; then
2013
2142
            compile_deplibs="$deplib $compile_deplibs"
2014
2143
            finalize_deplibs="$deplib $finalize_deplibs"
2197
2326
        esac # case $deplib
2198
2327
        if test "$found" = yes || test -f "$lib"; then :
2199
2328
        else
2200
 
          $echo "$modename: cannot find the library \`$lib'" 1>&2
 
2329
          $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2201
2330
          exit $EXIT_FAILURE
2202
2331
        fi
2203
2332
 
2404
2533
 
2405
2534
        if test "$linkmode,$pass" = "prog,link"; then
2406
2535
          if test -n "$library_names" &&
2407
 
             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2536
             { { test "$prefer_static_libs" = no ||
 
2537
                 test "$prefer_static_libs,$installed" = "built,yes"; } ||
 
2538
               test -z "$old_library"; }; then
2408
2539
            # We need to hardcode the library path
2409
2540
            if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2410
2541
              # Make sure the rpath contains only unique directories.
2448
2579
        fi
2449
2580
 
2450
2581
        link_static=no # Whether the deplib will be linked statically
 
2582
        use_static_libs=$prefer_static_libs
 
2583
        if test "$use_static_libs" = built && test "$installed" = yes ; then
 
2584
          use_static_libs=no
 
2585
        fi
2451
2586
        if test -n "$library_names" &&
2452
 
           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
 
2587
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
2453
2588
          if test "$installed" = no; then
2454
2589
            notinst_deplibs="$notinst_deplibs $lib"
2455
2590
            need_relink=yes
2562
2697
              if test "$hardcode_direct" = no; then
2563
2698
                add="$dir/$linklib"
2564
2699
                case $host in
2565
 
                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
 
2700
                  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
 
2701
                  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
 
2702
                  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
 
2703
                    *-*-unixware7*) add_dir="-L$dir" ;;
2566
2704
                  *-*-darwin* )
2567
2705
                    # if the lib is a module then we can not link against
2568
2706
                    # it, someone is ignoring the new warnings I added
2569
 
                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
 
2707
                    if /usr/bin/file -L $add 2> /dev/null |
 
2708
                      $EGREP ": [^:]* bundle" >/dev/null ; then
2570
2709
                      $echo "** Warning, lib $linklib is a module, not a shared library"
2571
2710
                      if test -z "$old_library" ; then
2572
2711
                        $echo
3092
3231
          # which has an extra 1 added just for fun
3093
3232
          #
3094
3233
          case $version_type in
3095
 
          darwin|linux|osf|windows)
 
3234
          darwin|linux|osf|windows|none)
3096
3235
            current=`expr $number_major + $number_minor`
3097
3236
            age="$number_minor"
3098
3237
            revision="$number_revision"
3103
3242
            age="0"
3104
3243
            ;;
3105
3244
          irix|nonstopux)
3106
 
            current=`expr $number_major + $number_minor - 1`
 
3245
            current=`expr $number_major + $number_minor`
3107
3246
            age="$number_minor"
3108
3247
            revision="$number_minor"
 
3248
            lt_irix_increment=no
3109
3249
            ;;
3110
3250
          *)
3111
3251
            $echo "$modename: unknown library version type \`$version_type'" 1>&2
3169
3309
          versuffix="$major.$age.$revision"
3170
3310
          # Darwin ld doesn't like 0 for these options...
3171
3311
          minor_current=`expr $current + 1`
3172
 
          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
 
3312
          xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
 
3313
          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3173
3314
          ;;
3174
3315
 
3175
3316
        freebsd-aout)
3183
3324
          ;;
3184
3325
 
3185
3326
        irix | nonstopux)
3186
 
          major=`expr $current - $age + 1`
3187
 
 
 
3327
          if test "X$lt_irix_increment" = "Xno"; then
 
3328
            major=`expr $current - $age`
 
3329
          else
 
3330
            major=`expr $current - $age + 1`
 
3331
          fi
3188
3332
          case $version_type in
3189
3333
            nonstopux) verstring_prefix=nonstopux ;;
3190
3334
            *)         verstring_prefix=sgi ;;
3321
3465
      fi
3322
3466
 
3323
3467
      # Eliminate all temporary directories.
3324
 
      for path in $notinst_path; do
3325
 
        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3326
 
        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3327
 
        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3328
 
      done
 
3468
      #for path in $notinst_path; do
 
3469
      # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
 
3470
      # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
 
3471
      # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
 
3472
      #done
3329
3473
 
3330
3474
      if test -n "$xrpath"; then
3331
3475
        # If the user specified any rpath flags, then add them.
3377
3521
            ;;
3378
3522
          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3379
3523
            # Do not include libc due to us having libc/libc_r.
3380
 
            test "X$arg" = "X-lc" && continue
 
3524
            ;;
 
3525
          *-*-sco3.2v5* | *-*-sco5v6*)
 
3526
            # Causes problems with __ctype
 
3527
            ;;
 
3528
          *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 
3529
            # Compiler inserts libc in the correct place for threads to work
3381
3530
            ;;
3382
3531
          *)
3383
3532
            # Add libc to deplibs on all other systems if necessary.
3421
3570
          int main() { return 0; }
3422
3571
EOF
3423
3572
          $rm conftest
3424
 
          $LTCC -o conftest conftest.c $deplibs
3425
 
          if test "$?" -eq 0 ; then
 
3573
          if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3426
3574
            ldd_output=`ldd conftest`
3427
3575
            for i in $deplibs; do
3428
3576
              name=`expr $i : '-l\(.*\)'`
3429
3577
              # If $name is empty we are operating on a -L argument.
3430
 
              if test "$name" != "" && test "$name" -ne "0"; then
 
3578
              if test "$name" != "" && test "$name" != "0"; then
3431
3579
                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3432
3580
                  case " $predeps $postdeps " in
3433
3581
                  *" $i "*)
3466
3614
              # If $name is empty we are operating on a -L argument.
3467
3615
              if test "$name" != "" && test "$name" != "0"; then
3468
3616
                $rm conftest
3469
 
                $LTCC -o conftest conftest.c $i
3470
 
                # Did it work?
3471
 
                if test "$?" -eq 0 ; then
 
3617
                if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3472
3618
                  ldd_output=`ldd conftest`
3473
3619
                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3474
3620
                    case " $predeps $postdeps " in
3500
3646
                  droppeddeps=yes
3501
3647
                  $echo
3502
3648
                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3503
 
                  $echo "***  make it link in!  You will probably need to install it or some"
 
3649
                  $echo "*** make it link in!  You will probably need to install it or some"
3504
3650
                  $echo "*** library that it depends on before this library will be fully"
3505
3651
                  $echo "*** functional.  Installing it before continuing would be even better."
3506
3652
                fi
3713
3859
        deplibs=$newdeplibs
3714
3860
      fi
3715
3861
 
 
3862
 
 
3863
      # move library search paths that coincide with paths to not yet
 
3864
      # installed libraries to the beginning of the library search list
 
3865
      new_libs=
 
3866
      for path in $notinst_path; do
 
3867
        case " $new_libs " in
 
3868
        *" -L$path/$objdir "*) ;;
 
3869
        *)
 
3870
          case " $deplibs " in
 
3871
          *" -L$path/$objdir "*)
 
3872
            new_libs="$new_libs -L$path/$objdir" ;;
 
3873
          esac
 
3874
          ;;
 
3875
        esac
 
3876
      done
 
3877
      for deplib in $deplibs; do
 
3878
        case $deplib in
 
3879
        -L*)
 
3880
          case " $new_libs " in
 
3881
          *" $deplib "*) ;;
 
3882
          *) new_libs="$new_libs $deplib" ;;
 
3883
          esac
 
3884
          ;;
 
3885
        *) new_libs="$new_libs $deplib" ;;
 
3886
        esac
 
3887
      done
 
3888
      deplibs="$new_libs"
 
3889
 
 
3890
 
3716
3891
      # All the library-specific variables (install_libdir is set above).
3717
3892
      library_names=
3718
3893
      old_library=
3757
3932
             test -n "$hardcode_libdirs"; then
3758
3933
            libdir="$hardcode_libdirs"
3759
3934
            if test -n "$hardcode_libdir_flag_spec_ld"; then
3760
 
              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
 
3935
              case $archive_cmds in
 
3936
              *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
 
3937
              *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
 
3938
              esac
3761
3939
            else
3762
3940
              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3763
3941
            fi
3796
3974
        fi
3797
3975
 
3798
3976
        lib="$output_objdir/$realname"
 
3977
        linknames=
3799
3978
        for link
3800
3979
        do
3801
3980
          linknames="$linknames $link"
4115
4294
      reload_conv_objs=
4116
4295
      gentop=
4117
4296
      # reload_cmds runs $LD directly, so let us get rid of
4118
 
      # -Wl from whole_archive_flag_spec
 
4297
      # -Wl from whole_archive_flag_spec and hope we can get by with
 
4298
      # turning comma into space..
4119
4299
      wl=
4120
4300
 
4121
4301
      if test -n "$convenience"; then
4122
4302
        if test -n "$whole_archive_flag_spec"; then
4123
 
          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
 
4303
          eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
 
4304
          reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4124
4305
        else
4125
4306
          gentop="$output_objdir/${obj}x"
4126
4307
          generated="$generated $gentop"
4227
4408
        ;;
4228
4409
      esac
4229
4410
 
 
4411
 
 
4412
      # move library search paths that coincide with paths to not yet
 
4413
      # installed libraries to the beginning of the library search list
 
4414
      new_libs=
 
4415
      for path in $notinst_path; do
 
4416
        case " $new_libs " in
 
4417
        *" -L$path/$objdir "*) ;;
 
4418
        *)
 
4419
          case " $compile_deplibs " in
 
4420
          *" -L$path/$objdir "*)
 
4421
            new_libs="$new_libs -L$path/$objdir" ;;
 
4422
          esac
 
4423
          ;;
 
4424
        esac
 
4425
      done
 
4426
      for deplib in $compile_deplibs; do
 
4427
        case $deplib in
 
4428
        -L*)
 
4429
          case " $new_libs " in
 
4430
          *" $deplib "*) ;;
 
4431
          *) new_libs="$new_libs $deplib" ;;
 
4432
          esac
 
4433
          ;;
 
4434
        *) new_libs="$new_libs $deplib" ;;
 
4435
        esac
 
4436
      done
 
4437
      compile_deplibs="$new_libs"
 
4438
 
 
4439
 
4230
4440
      compile_command="$compile_command $compile_deplibs"
4231
4441
      finalize_command="$finalize_command $finalize_deplibs"
4232
4442
 
4271
4481
        fi
4272
4482
        case $host in
4273
4483
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
 
4484
          testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4274
4485
          case :$dllsearchpath: in
4275
4486
          *":$libdir:"*) ;;
4276
4487
          *) dllsearchpath="$dllsearchpath:$libdir";;
4277
4488
          esac
 
4489
          case :$dllsearchpath: in
 
4490
          *":$testbindir:"*) ;;
 
4491
          *) dllsearchpath="$dllsearchpath:$testbindir";;
 
4492
          esac
4278
4493
          ;;
4279
4494
        esac
4280
4495
      done
4391
4606
              export_symbols="$output_objdir/$outputname.exp"
4392
4607
              $run $rm $export_symbols
4393
4608
              $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 
4609
              case $host in
 
4610
              *cygwin* | *mingw* )
 
4611
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4612
                $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
 
4613
                ;;
 
4614
              esac
4394
4615
            else
4395
 
              $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 
4616
              $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4396
4617
              $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4397
4618
              $run eval 'mv "$nlist"T "$nlist"'
 
4619
              case $host in
 
4620
              *cygwin* | *mingw* )
 
4621
                $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
 
4622
                $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
 
4623
                ;;
 
4624
              esac
4398
4625
            fi
4399
4626
          fi
4400
4627
 
4511
4738
          esac
4512
4739
 
4513
4740
          # Now compile the dynamic symbol file.
4514
 
          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4515
 
          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
4741
          $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
 
4742
          $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4516
4743
 
4517
4744
          # Clean up the generated files.
4518
4745
          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4519
4746
          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4520
4747
 
4521
4748
          # Transform the symbol file into the correct name.
4522
 
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4523
 
          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
 
4749
          case $host in
 
4750
          *cygwin* | *mingw* )
 
4751
            if test -f "$output_objdir/${outputname}.def" ; then
 
4752
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4753
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4754
            else
 
4755
              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4756
              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4757
             fi
 
4758
            ;;
 
4759
          * )
 
4760
            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4761
            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
 
4762
            ;;
 
4763
          esac
4524
4764
          ;;
4525
4765
        *)
4526
4766
          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4533
4773
        # really was required.
4534
4774
 
4535
4775
        # Nullify the symbol file.
4536
 
        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4537
 
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
 
4776
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
 
4777
        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4538
4778
      fi
4539
4779
 
4540
4780
      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4541
4781
        # Replace the output file specification.
4542
 
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
 
4782
        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4543
4783
        link_command="$compile_command$compile_rpath"
4544
4784
 
4545
4785
        # We have no uninstalled library dependencies, so finalize right now.
4546
4786
        $show "$link_command"
4547
4787
        $run eval "$link_command"
4548
 
        status=$?
 
4788
        exit_status=$?
4549
4789
 
4550
4790
        # Delete the generated files.
4551
4791
        if test -n "$dlsyms"; then
4553
4793
          $run $rm "$output_objdir/${outputname}S.${objext}"
4554
4794
        fi
4555
4795
 
4556
 
        exit $status
 
4796
        exit $exit_status
4557
4797
      fi
4558
4798
 
4559
4799
      if test -n "$shlibpath_var"; then
4626
4866
        if test "$fast_install" != no; then
4627
4867
          link_command="$finalize_var$compile_command$finalize_rpath"
4628
4868
          if test "$fast_install" = yes; then
4629
 
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
 
4869
            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4630
4870
          else
4631
4871
            # fast_install is set to needless
4632
4872
            relink_command=
4663
4903
          fi
4664
4904
        done
4665
4905
        relink_command="(cd `pwd`; $relink_command)"
4666
 
        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
4906
        relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4667
4907
      fi
4668
4908
 
4669
4909
      # Quote $echo for shipping.
4693
4933
        esac
4694
4934
        case $host in
4695
4935
          *cygwin* | *mingw* )
4696
 
            cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
4697
 
            cwrapper=`$echo ${output}.exe`
4698
 
            $rm $cwrappersource $cwrapper
4699
 
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
4936
            output_name=`basename $output`
 
4937
            output_path=`dirname $output`
 
4938
            cwrappersource="$output_path/$objdir/lt-$output_name.c"
 
4939
            cwrapper="$output_path/$output_name.exe"
 
4940
            $rm $cwrappersource $cwrapper
 
4941
            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4700
4942
 
4701
4943
            cat > $cwrappersource <<EOF
4702
4944
 
4721
4963
#include <malloc.h>
4722
4964
#include <stdarg.h>
4723
4965
#include <assert.h>
 
4966
#include <string.h>
 
4967
#include <ctype.h>
 
4968
#include <sys/stat.h>
4724
4969
 
4725
4970
#if defined(PATH_MAX)
4726
4971
# define LT_PATHMAX PATH_MAX
4731
4976
#endif
4732
4977
 
4733
4978
#ifndef DIR_SEPARATOR
4734
 
#define DIR_SEPARATOR '/'
 
4979
# define DIR_SEPARATOR '/'
 
4980
# define PATH_SEPARATOR ':'
4735
4981
#endif
4736
4982
 
4737
4983
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4738
4984
  defined (__OS2__)
4739
 
#define HAVE_DOS_BASED_FILE_SYSTEM
4740
 
#ifndef DIR_SEPARATOR_2
4741
 
#define DIR_SEPARATOR_2 '\\'
4742
 
#endif
 
4985
# define HAVE_DOS_BASED_FILE_SYSTEM
 
4986
# ifndef DIR_SEPARATOR_2
 
4987
#  define DIR_SEPARATOR_2 '\\'
 
4988
# endif
 
4989
# ifndef PATH_SEPARATOR_2
 
4990
#  define PATH_SEPARATOR_2 ';'
 
4991
# endif
4743
4992
#endif
4744
4993
 
4745
4994
#ifndef DIR_SEPARATOR_2
4749
4998
        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4750
4999
#endif /* DIR_SEPARATOR_2 */
4751
5000
 
 
5001
#ifndef PATH_SEPARATOR_2
 
5002
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
 
5003
#else /* PATH_SEPARATOR_2 */
 
5004
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 
5005
#endif /* PATH_SEPARATOR_2 */
 
5006
 
4752
5007
#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4753
5008
#define XFREE(stale) do { \
4754
5009
  if (stale) { free ((void *) stale); stale = 0; } \
4755
5010
} while (0)
4756
5011
 
 
5012
/* -DDEBUG is fairly common in CFLAGS.  */
 
5013
#undef DEBUG
 
5014
#if defined DEBUGWRAPPER
 
5015
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
 
5016
#else
 
5017
# define DEBUG(format, ...)
 
5018
#endif
 
5019
 
4757
5020
const char *program_name = NULL;
4758
5021
 
4759
5022
void * xmalloc (size_t num);
4760
5023
char * xstrdup (const char *string);
4761
 
char * basename (const char *name);
4762
 
char * fnqualify(const char *path);
 
5024
const char * base_name (const char *name);
 
5025
char * find_executable(const char *wrapper);
 
5026
int    check_executable(const char *path);
4763
5027
char * strendzap(char *str, const char *pat);
4764
5028
void lt_fatal (const char *message, ...);
4765
5029
 
4769
5033
  char **newargz;
4770
5034
  int i;
4771
5035
 
4772
 
  program_name = (char *) xstrdup ((char *) basename (argv[0]));
 
5036
  program_name = (char *) xstrdup (base_name (argv[0]));
 
5037
  DEBUG("(main) argv[0]      : %s\n",argv[0]);
 
5038
  DEBUG("(main) program_name : %s\n",program_name);
4773
5039
  newargz = XMALLOC(char *, argc+2);
4774
5040
EOF
4775
5041
 
4776
 
            cat >> $cwrappersource <<EOF
4777
 
  newargz[0] = "$SHELL";
 
5042
            cat >> $cwrappersource <<EOF
 
5043
  newargz[0] = (char *) xstrdup("$SHELL");
4778
5044
EOF
4779
5045
 
4780
 
            cat >> $cwrappersource <<"EOF"
4781
 
  newargz[1] = fnqualify(argv[0]);
 
5046
            cat >> $cwrappersource <<"EOF"
 
5047
  newargz[1] = find_executable(argv[0]);
 
5048
  if (newargz[1] == NULL)
 
5049
    lt_fatal("Couldn't find %s", argv[0]);
 
5050
  DEBUG("(main) found exe at : %s\n",newargz[1]);
4782
5051
  /* we know the script has the same name, without the .exe */
4783
5052
  /* so make sure newargz[1] doesn't end in .exe */
4784
5053
  strendzap(newargz[1],".exe");
4785
5054
  for (i = 1; i < argc; i++)
4786
5055
    newargz[i+1] = xstrdup(argv[i]);
4787
5056
  newargz[argc+1] = NULL;
4788
 
EOF
4789
 
 
4790
 
            cat >> $cwrappersource <<EOF
 
5057
 
 
5058
  for (i=0; i<argc+1; i++)
 
5059
  {
 
5060
    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
 
5061
    ;
 
5062
  }
 
5063
 
 
5064
EOF
 
5065
 
 
5066
            case $host_os in
 
5067
              mingw*)
 
5068
                cat >> $cwrappersource <<EOF
 
5069
  execv("$SHELL",(char const **)newargz);
 
5070
EOF
 
5071
              ;;
 
5072
              *)
 
5073
                cat >> $cwrappersource <<EOF
4791
5074
  execv("$SHELL",newargz);
4792
5075
EOF
 
5076
              ;;
 
5077
            esac
4793
5078
 
4794
 
            cat >> $cwrappersource <<"EOF"
 
5079
            cat >> $cwrappersource <<"EOF"
4795
5080
  return 127;
4796
5081
}
4797
5082
 
4812
5097
;
4813
5098
}
4814
5099
 
4815
 
char *
4816
 
basename (const char *name)
 
5100
const char *
 
5101
base_name (const char *name)
4817
5102
{
4818
5103
  const char *base;
4819
5104
 
4820
5105
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4821
5106
  /* Skip over the disk name in MSDOS pathnames. */
4822
 
  if (isalpha (name[0]) && name[1] == ':')
 
5107
  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4823
5108
    name += 2;
4824
5109
#endif
4825
5110
 
4826
5111
  for (base = name; *name; name++)
4827
5112
    if (IS_DIR_SEPARATOR (*name))
4828
5113
      base = name + 1;
4829
 
  return (char *) base;
4830
 
}
4831
 
 
 
5114
  return base;
 
5115
}
 
5116
 
 
5117
int
 
5118
check_executable(const char * path)
 
5119
{
 
5120
  struct stat st;
 
5121
 
 
5122
  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
 
5123
  if ((!path) || (!*path))
 
5124
    return 0;
 
5125
 
 
5126
  if ((stat (path, &st) >= 0) &&
 
5127
      (
 
5128
        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
 
5129
#if defined (S_IXOTH)
 
5130
       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
 
5131
#endif
 
5132
#if defined (S_IXGRP)
 
5133
       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
 
5134
#endif
 
5135
       ((st.st_mode & S_IXUSR) == S_IXUSR))
 
5136
      )
 
5137
    return 1;
 
5138
  else
 
5139
    return 0;
 
5140
}
 
5141
 
 
5142
/* Searches for the full path of the wrapper.  Returns
 
5143
   newly allocated full path name if found, NULL otherwise */
4832
5144
char *
4833
 
fnqualify(const char *path)
 
5145
find_executable (const char* wrapper)
4834
5146
{
4835
 
  size_t size;
4836
 
  char *p;
 
5147
  int has_slash = 0;
 
5148
  const char* p;
 
5149
  const char* p_next;
 
5150
  /* static buffer for getcwd */
4837
5151
  char tmp[LT_PATHMAX + 1];
4838
 
 
4839
 
  assert(path != NULL);
4840
 
 
4841
 
  /* Is it qualified already? */
4842
 
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4843
 
  if (isalpha (path[0]) && path[1] == ':')
4844
 
    return xstrdup (path);
4845
 
#endif
4846
 
  if (IS_DIR_SEPARATOR (path[0]))
4847
 
    return xstrdup (path);
4848
 
 
4849
 
  /* prepend the current directory */
4850
 
  /* doesn't handle '~' */
 
5152
  int tmp_len;
 
5153
  char* concat_name;
 
5154
 
 
5155
  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
 
5156
 
 
5157
  if ((wrapper == NULL) || (*wrapper == '\0'))
 
5158
    return NULL;
 
5159
 
 
5160
  /* Absolute path? */
 
5161
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5162
  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
 
5163
  {
 
5164
    concat_name = xstrdup (wrapper);
 
5165
    if (check_executable(concat_name))
 
5166
      return concat_name;
 
5167
    XFREE(concat_name);
 
5168
  }
 
5169
  else
 
5170
  {
 
5171
#endif
 
5172
    if (IS_DIR_SEPARATOR (wrapper[0]))
 
5173
    {
 
5174
      concat_name = xstrdup (wrapper);
 
5175
      if (check_executable(concat_name))
 
5176
        return concat_name;
 
5177
      XFREE(concat_name);
 
5178
    }
 
5179
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
 
5180
  }
 
5181
#endif
 
5182
 
 
5183
  for (p = wrapper; *p; p++)
 
5184
    if (*p == '/')
 
5185
    {
 
5186
      has_slash = 1;
 
5187
      break;
 
5188
    }
 
5189
  if (!has_slash)
 
5190
  {
 
5191
    /* no slashes; search PATH */
 
5192
    const char* path = getenv ("PATH");
 
5193
    if (path != NULL)
 
5194
    {
 
5195
      for (p = path; *p; p = p_next)
 
5196
      {
 
5197
        const char* q;
 
5198
        size_t p_len;
 
5199
        for (q = p; *q; q++)
 
5200
          if (IS_PATH_SEPARATOR(*q))
 
5201
            break;
 
5202
        p_len = q - p;
 
5203
        p_next = (*q == '\0' ? q : q + 1);
 
5204
        if (p_len == 0)
 
5205
        {
 
5206
          /* empty path: current directory */
 
5207
          if (getcwd (tmp, LT_PATHMAX) == NULL)
 
5208
            lt_fatal ("getcwd failed");
 
5209
          tmp_len = strlen(tmp);
 
5210
          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5211
          memcpy (concat_name, tmp, tmp_len);
 
5212
          concat_name[tmp_len] = '/';
 
5213
          strcpy (concat_name + tmp_len + 1, wrapper);
 
5214
        }
 
5215
        else
 
5216
        {
 
5217
          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
 
5218
          memcpy (concat_name, p, p_len);
 
5219
          concat_name[p_len] = '/';
 
5220
          strcpy (concat_name + p_len + 1, wrapper);
 
5221
        }
 
5222
        if (check_executable(concat_name))
 
5223
          return concat_name;
 
5224
        XFREE(concat_name);
 
5225
      }
 
5226
    }
 
5227
    /* not found in PATH; assume curdir */
 
5228
  }
 
5229
  /* Relative path | not found in path: prepend cwd */
4851
5230
  if (getcwd (tmp, LT_PATHMAX) == NULL)
4852
5231
    lt_fatal ("getcwd failed");
4853
 
  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4854
 
  p = XMALLOC(char, size);
4855
 
  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4856
 
  return p;
 
5232
  tmp_len = strlen(tmp);
 
5233
  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
 
5234
  memcpy (concat_name, tmp, tmp_len);
 
5235
  concat_name[tmp_len] = '/';
 
5236
  strcpy (concat_name + tmp_len + 1, wrapper);
 
5237
 
 
5238
  if (check_executable(concat_name))
 
5239
    return concat_name;
 
5240
  XFREE(concat_name);
 
5241
  return NULL;
4857
5242
}
4858
5243
 
4859
5244
char *
4897
5282
  va_end (ap);
4898
5283
}
4899
5284
EOF
4900
 
          # we should really use a build-platform specific compiler
4901
 
          # here, but OTOH, the wrappers (shell script and this C one)
4902
 
          # are only useful if you want to execute the "real" binary.
4903
 
          # Since the "real" binary is built for $host, then this
4904
 
          # wrapper might as well be built for $host, too.
4905
 
          $run $LTCC -s -o $cwrapper $cwrappersource
4906
 
          ;;
4907
 
        esac
4908
 
        $rm $output
4909
 
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
 
5285
          # we should really use a build-platform specific compiler
 
5286
          # here, but OTOH, the wrappers (shell script and this C one)
 
5287
          # are only useful if you want to execute the "real" binary.
 
5288
          # Since the "real" binary is built for $host, then this
 
5289
          # wrapper might as well be built for $host, too.
 
5290
          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
 
5291
          ;;
 
5292
        esac
 
5293
        $rm $output
 
5294
        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4910
5295
 
4911
5296
        $echo > $output "\
4912
5297
#! $SHELL
4925
5310
Xsed='${SED} -e 1s/^X//'
4926
5311
sed_quote_subst='$sed_quote_subst'
4927
5312
 
 
5313
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
 
5314
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
 
5315
  emulate sh
 
5316
  NULLCMD=:
 
5317
  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
 
5318
  # is contrary to our usage.  Disable this feature.
 
5319
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
 
5320
  setopt NO_GLOB_SUBST
 
5321
else
 
5322
  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
 
5323
fi
 
5324
BIN_SH=xpg4; export BIN_SH # for Tru64
 
5325
DUALCASE=1; export DUALCASE # for MKS sh
 
5326
 
4928
5327
# The HP-UX ksh and POSIX shell print the target directory to stdout
4929
5328
# if CDPATH is set.
4930
5329
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5067
5466
          ;;
5068
5467
        esac
5069
5468
        $echo >> $output "\
5070
 
      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
 
5469
      \$echo \"\$0: cannot exec \$program \$*\"
5071
5470
      exit $EXIT_FAILURE
5072
5471
    fi
5073
5472
  else
5136
5535
            $run ${rm}r "$gentop"
5137
5536
            $show "$mkdir $gentop"
5138
5537
            $run $mkdir "$gentop"
5139
 
            status=$?
5140
 
            if test "$status" -ne 0 && test ! -d "$gentop"; then
5141
 
              exit $status
 
5538
            exit_status=$?
 
5539
            if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
 
5540
              exit $exit_status
5142
5541
            fi
5143
5542
          fi
5144
5543
 
5253
5652
      done
5254
5653
      # Quote the link command for shipping.
5255
5654
      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5256
 
      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
 
5655
      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5257
5656
      if test "$hardcode_automatic" = yes ; then
5258
5657
        relink_command=
5259
5658
      fi
5598
5997
 
5599
5998
          if test -n "$inst_prefix_dir"; then
5600
5999
            # Stick the inst_prefix_dir data into the link command.
5601
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
 
6000
            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
5602
6001
          else
5603
 
            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 
6002
            relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
5604
6003
          fi
5605
6004
 
5606
6005
          $echo "$modename: warning: relinking \`$file'" 1>&2
5805
6204
          outputname=
5806
6205
          if test "$fast_install" = no && test -n "$relink_command"; then
5807
6206
            if test "$finalize" = yes && test -z "$run"; then
5808
 
              tmpdir="/tmp"
5809
 
              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5810
 
              tmpdir="$tmpdir/libtool-$$"
5811
 
              save_umask=`umask`
5812
 
              umask 0077
5813
 
              if $mkdir "$tmpdir"; then
5814
 
                umask $save_umask
5815
 
              else
5816
 
                umask $save_umask
5817
 
                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5818
 
                continue
5819
 
              fi
 
6207
              tmpdir=`func_mktempdir`
5820
6208
              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5821
6209
              outputname="$tmpdir/$file"
5822
6210
              # Replace the output file specification.
5823
 
              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
 
6211
              relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
5824
6212
 
5825
6213
              $show "$relink_command"
5826
6214
              if $run eval "$relink_command"; then :
5940
6328
    # Exit here if they wanted silent mode.
5941
6329
    test "$show" = : && exit $EXIT_SUCCESS
5942
6330
 
5943
 
    $echo "----------------------------------------------------------------------"
 
6331
    $echo "X----------------------------------------------------------------------" | $Xsed
5944
6332
    $echo "Libraries have been installed in:"
5945
6333
    for libdir in $libdirs; do
5946
6334
      $echo "   $libdir"
5973
6361
    $echo
5974
6362
    $echo "See any operating system documentation about shared libraries for"
5975
6363
    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5976
 
    $echo "----------------------------------------------------------------------"
 
6364
    $echo "X----------------------------------------------------------------------" | $Xsed
5977
6365
    exit $EXIT_SUCCESS
5978
6366
    ;;
5979
6367
 
6031
6419
        if test -f "$dir/$objdir/$dlname"; then
6032
6420
          dir="$dir/$objdir"
6033
6421
        else
6034
 
          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6035
 
          exit $EXIT_FAILURE
 
6422
          if test ! -f "$dir/$dlname"; then
 
6423
            $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
 
6424
            exit $EXIT_FAILURE
 
6425
          fi
6036
6426
        fi
6037
6427
        ;;
6038
6428
 
6096
6486
      fi
6097
6487
 
6098
6488
      # Restore saved environment variables
6099
 
      if test "${save_LC_ALL+set}" = set; then
6100
 
        LC_ALL="$save_LC_ALL"; export LC_ALL
6101
 
      fi
6102
 
      if test "${save_LANG+set}" = set; then
6103
 
        LANG="$save_LANG"; export LANG
6104
 
      fi
 
6489
      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 
6490
      do
 
6491
        eval "if test \"\${save_$lt_var+set}\" = set; then
 
6492
                $lt_var=\$save_$lt_var; export $lt_var
 
6493
              fi"
 
6494
      done
6105
6495
 
6106
6496
      # Now prepare to actually exec the command.
6107
6497
      exec_cmd="\$cmd$args"
6190
6580
            rmfiles="$rmfiles $objdir/$n"
6191
6581
          done
6192
6582
          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6193
 
          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6194
6583
 
6195
 
          if test "$mode" = uninstall; then
 
6584
          case "$mode" in
 
6585
          clean)
 
6586
            case "  $library_names " in
 
6587
            # "  " in the beginning catches empty $dlname
 
6588
            *" $dlname "*) ;;
 
6589
            *) rmfiles="$rmfiles $objdir/$dlname" ;;
 
6590
            esac
 
6591
             test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
 
6592
            ;;
 
6593
          uninstall)
6196
6594
            if test -n "$library_names"; then
6197
6595
              # Do each command in the postuninstall commands.
6198
6596
              cmds=$postuninstall_cmds
6225
6623
              IFS="$save_ifs"
6226
6624
            fi
6227
6625
            # FIXME: should reinstall the best remaining shared library.
6228
 
          fi
 
6626
            ;;
 
6627
          esac
6229
6628
        fi
6230
6629
        ;;
6231
6630
 
6449
6848
  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6450
6849
  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6451
6850
  -export-symbols SYMFILE
6452
 
                    try to export only the symbols listed in SYMFILE
 
6851
                    try to export only the symbols listed in SYMFILE
6453
6852
  -export-symbols-regex REGEX
6454
 
                    try to export only the symbols matching REGEX
 
6853
                    try to export only the symbols matching REGEX
6455
6854
  -LLIBDIR          search LIBDIR for required installed libraries
6456
6855
  -lNAME            OUTPUT-FILE requires the installed library libNAME
6457
6856
  -module           build a library that can dlopened
6465
6864
  -release RELEASE  specify package release information
6466
6865
  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6467
6866
  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6468
 
  -static           do not do any dynamic linking of libtool libraries
 
6867
  -static           do not do any dynamic linking of uninstalled libtool libraries
 
6868
  -static-libtool-libs
 
6869
                    do not do any dynamic linking of libtool libraries
6469
6870
  -version-info CURRENT[:REVISION[:AGE]]
6470
 
                    specify library version info [each variable defaults to 0]
 
6871
                    specify library version info [each variable defaults to 0]
6471
6872
 
6472
6873
All other options (arguments beginning with \`-') are ignored.
6473
6874
 
6524
6925
# configuration.  But we'll never go from static-only to shared-only.
6525
6926
 
6526
6927
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6527
 
build_libtool_libs=no
6528
 
build_old_libs=yes
 
6928
disable_libs=shared
6529
6929
# ### END LIBTOOL TAG CONFIG: disable-shared
6530
6930
 
6531
6931
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6532
 
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 
6932
disable_libs=static
6533
6933
# ### END LIBTOOL TAG CONFIG: disable-static
6534
6934
 
6535
6935
# Local Variables: