Changeset 2554


Ignore:
Timestamp:
May 16, 2012 2:14:16 PM (8 years ago)
Author:
stefan
Message:

update autotools version numbers to current latest versions
update corresponding autotools files

Location:
branches/autotools-update
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/autotools-update/config.guess

    r416 r2554  
    22# Attempt to guess a canonical system name.
    33#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
    4 #   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
    5 #   Inc.
    6 
    7 timestamp='2007-05-17'
     4#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
     5#   2011, 2012 Free Software Foundation, Inc.
     6
     7timestamp='2012-02-10'
    88
    99# This file is free software; you can redistribute it and/or modify it
     
    1818#
    1919# You should have received a copy of the GNU General Public License
    20 # along with this program; if not, write to the Free Software
    21 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
    22 # 02110-1301, USA.
     20# along with this program; if not, see <http://www.gnu.org/licenses/>.
    2321#
    2422# As a special exception to the GNU General Public License, if you
     
    2826
    2927
    30 # Originally written by Per Bothner <per@bothner.com>.
    31 # Please send patches to <config-patches@gnu.org>.  Submit a context
    32 # diff and a properly formatted ChangeLog entry.
     28# Originally written by Per Bothner.  Please send patches (context
     29# diff format) to <config-patches@gnu.org> and include a ChangeLog
     30# entry.
    3331#
    3432# This script attempts to guess a canonical system name similar to
     
    3634# exits with 0.  Otherwise, it exits with 1.
    3735#
    38 # The plan is that this can be called by configure scripts if you
    39 # don't specify an explicit build system type.
     36# You can get the latest version of this script from:
     37# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
    4038
    4139me=`echo "$0" | sed -e 's,.*/,,'`
     
    5755
    5856Originally written by Per Bothner.
    59 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
     57Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
     582001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
    6059Free Software Foundation, Inc.
    6160
     
    145144    *:NetBSD:*:*)
    146145        # NetBSD (nbsd) targets should (where applicable) match one or
    147         # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
     146        # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
    148147        # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
    149148        # switched to ELF, *-*-netbsd* would select the old
     
    171170                eval $set_cc_for_build
    172171                if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
    173                         | grep __ELF__ >/dev/null
     172                        | grep -q __ELF__
    174173                then
    175174                    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
     
    181180                ;;
    182181            *)
    183                 os=netbsd
     182                os=netbsd
    184183                ;;
    185184        esac
     
    224223                ;;
    225224        *5.*)
    226                 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
     225                UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
    227226                ;;
    228227        esac
     
    270269        # 1.2 uses "1.2" for uname -r.
    271270        echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
    272         exit ;;
     271        # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
     272        exitcode=$?
     273        trap '' 0
     274        exit $exitcode ;;
    273275    Alpha\ *:Windows_NT*:*)
    274276        # How do we know it's Interix rather than the generic POSIX subsystem?
     
    296298        exit ;;
    297299    *:OS400:*:*)
    298         echo powerpc-ibm-os400
     300        echo powerpc-ibm-os400
    299301        exit ;;
    300302    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
     
    325327            sparc) echo sparc-icl-nx7; exit ;;
    326328        esac ;;
     329    s390x:SunOS:*:*)
     330        echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
     331        exit ;;
    327332    sun4H:SunOS:5.*:*)
    328333        echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
     
    331336        echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
    332337        exit ;;
    333     i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
    334         echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
     338    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
     339        echo i386-pc-auroraux${UNAME_RELEASE}
     340        exit ;;
     341    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
     342        eval $set_cc_for_build
     343        SUN_ARCH="i386"
     344        # If there is a compiler, see if it is configured for 64-bit objects.
     345        # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
     346        # This test works for both compilers.
     347        if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
     348            if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
     349                (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
     350                grep IS_64BIT_ARCH >/dev/null
     351            then
     352                SUN_ARCH="x86_64"
     353            fi
     354        fi
     355        echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
    335356        exit ;;
    336357    sun4*:SunOS:6*:*)
     
    376397    # be no problem.
    377398    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
    378         echo m68k-atari-mint${UNAME_RELEASE}
     399        echo m68k-atari-mint${UNAME_RELEASE}
    379400        exit ;;
    380401    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
    381402        echo m68k-atari-mint${UNAME_RELEASE}
    382         exit ;;
     403        exit ;;
    383404    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
    384         echo m68k-atari-mint${UNAME_RELEASE}
     405        echo m68k-atari-mint${UNAME_RELEASE}
    385406        exit ;;
    386407    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
    387         echo m68k-milan-mint${UNAME_RELEASE}
    388         exit ;;
     408        echo m68k-milan-mint${UNAME_RELEASE}
     409        exit ;;
    389410    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
    390         echo m68k-hades-mint${UNAME_RELEASE}
    391         exit ;;
     411        echo m68k-hades-mint${UNAME_RELEASE}
     412        exit ;;
    392413    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
    393         echo m68k-unknown-mint${UNAME_RELEASE}
    394         exit ;;
     414        echo m68k-unknown-mint${UNAME_RELEASE}
     415        exit ;;
    395416    m68k:machten:*:*)
    396417        echo m68k-apple-machten${UNAME_RELEASE}
     
    462483        exit ;;
    463484    AViiON:dgux:*:*)
    464         # DG/UX returns AViiON for all architectures
    465         UNAME_PROCESSOR=`/usr/bin/uname -p`
     485        # DG/UX returns AViiON for all architectures
     486        UNAME_PROCESSOR=`/usr/bin/uname -p`
    466487        if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
    467488        then
     
    476497            echo i586-dg-dgux${UNAME_RELEASE}
    477498        fi
    478         exit ;;
     499        exit ;;
    479500    M88*:DolphinOS:*:*) # DolphinOS (SVR3)
    480501        echo m88k-dolphin-sysv3
     
    533554        fi
    534555        exit ;;
    535     *:AIX:*:[45])
     556    *:AIX:*:[4567])
    536557        IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
    537558        if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
     
    576597                if [ -x /usr/bin/getconf ]; then
    577598                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
    578                     sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
    579                     case "${sc_cpu_version}" in
    580                       523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
    581                       528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
    582                       532)                      # CPU_PA_RISC2_0
    583                         case "${sc_kernel_bits}" in
    584                           32) HP_ARCH="hppa2.0n" ;;
    585                           64) HP_ARCH="hppa2.0w" ;;
     599                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
     600                    case "${sc_cpu_version}" in
     601                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
     602                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
     603                      532)                      # CPU_PA_RISC2_0
     604                        case "${sc_kernel_bits}" in
     605                          32) HP_ARCH="hppa2.0n" ;;
     606                          64) HP_ARCH="hppa2.0w" ;;
    586607                          '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
    587                         esac ;;
    588                     esac
     608                        esac ;;
     609                    esac
    589610                fi
    590611                if [ "${HP_ARCH}" = "" ]; then
    591612                    eval $set_cc_for_build
    592                     sed 's/^              //' << EOF >$dummy.c
    593 
    594               #define _HPUX_SOURCE
    595               #include <stdlib.h>
    596               #include <unistd.h>
    597 
    598               int main ()
    599               {
    600               #if defined(_SC_KERNEL_BITS)
    601                   long bits = sysconf(_SC_KERNEL_BITS);
    602               #endif
    603                   long cpu  = sysconf (_SC_CPU_VERSION);
    604 
    605                   switch (cpu)
    606                 {
    607                 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
    608                 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
    609                 case CPU_PA_RISC2_0:
    610               #if defined(_SC_KERNEL_BITS)
    611                     switch (bits)
    612                         {
    613                         case 64: puts ("hppa2.0w"); break;
    614                         case 32: puts ("hppa2.0n"); break;
    615                         default: puts ("hppa2.0"); break;
    616                         } break;
    617               #else  /* !defined(_SC_KERNEL_BITS) */
    618                     puts ("hppa2.0"); break;
    619               #endif
    620                 default: puts ("hppa1.0"); break;
    621                 }
    622                   exit (0);
    623               }
     613                    sed 's/^            //' << EOF >$dummy.c
     614
     615                #define _HPUX_SOURCE
     616                #include <stdlib.h>
     617                #include <unistd.h>
     618
     619                int main ()
     620                {
     621                #if defined(_SC_KERNEL_BITS)
     622                    long bits = sysconf(_SC_KERNEL_BITS);
     623                #endif
     624                    long cpu  = sysconf (_SC_CPU_VERSION);
     625
     626                    switch (cpu)
     627                        {
     628                        case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
     629                        case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
     630                        case CPU_PA_RISC2_0:
     631                #if defined(_SC_KERNEL_BITS)
     632                            switch (bits)
     633                                {
     634                                case 64: puts ("hppa2.0w"); break;
     635                                case 32: puts ("hppa2.0n"); break;
     636                                default: puts ("hppa2.0"); break;
     637                                } break;
     638                #else  /* !defined(_SC_KERNEL_BITS) */
     639                            puts ("hppa2.0"); break;
     640                #endif
     641                        default: puts ("hppa1.0"); break;
     642                        }
     643                    exit (0);
     644                }
    624645EOF
    625646                    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
     
    641662
    642663            if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
    643                 grep __LP64__ >/dev/null
     664                grep -q __LP64__
    644665            then
    645666                HP_ARCH="hppa2.0w"
     
    712733    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
    713734        echo c1-convex-bsd
    714         exit ;;
     735        exit ;;
    715736    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
    716737        if getsysinfo -f scalar_acc
     
    718739        else echo c2-convex-bsd
    719740        fi
    720         exit ;;
     741        exit ;;
    721742    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
    722743        echo c34-convex-bsd
    723         exit ;;
     744        exit ;;
    724745    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
    725746        echo c38-convex-bsd
    726         exit ;;
     747        exit ;;
    727748    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
    728749        echo c4-convex-bsd
    729         exit ;;
     750        exit ;;
    730751    CRAY*Y-MP:*:*:*)
    731752        echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
     
    751772    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
    752773        FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
    753         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
    754         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
    755         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
    756         exit ;;
     774        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
     775        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
     776        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
     777        exit ;;
    757778    5000:UNIX_System_V:4.*:*)
    758         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
    759         FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
    760         echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
     779        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
     780        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
     781        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
    761782        exit ;;
    762783    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
     
    770791        exit ;;
    771792    *:FreeBSD:*:*)
    772         case ${UNAME_MACHINE} in
    773             pc98)
    774                 echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
     793        UNAME_PROCESSOR=`/usr/bin/uname -p`
     794        case ${UNAME_PROCESSOR} in
    775795            amd64)
    776796                echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
    777797            *)
    778                 echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
     798                echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
    779799        esac
    780800        exit ;;
     
    785805        echo ${UNAME_MACHINE}-pc-mingw32
    786806        exit ;;
     807    i*:MSYS*:*)
     808        echo ${UNAME_MACHINE}-pc-msys
     809        exit ;;
    787810    i*:windows32*:*)
    788         # uname -m includes "-pc" on this system.
    789         echo ${UNAME_MACHINE}-mingw32
     811        # uname -m includes "-pc" on this system.
     812        echo ${UNAME_MACHINE}-mingw32
    790813        exit ;;
    791814    i*:PW*:*)
    792815        echo ${UNAME_MACHINE}-pc-pw32
    793816        exit ;;
    794     *:Interix*:[3456]*)
    795         case ${UNAME_MACHINE} in
    796             x86) 
     817    *:Interix*:*)
     818        case ${UNAME_MACHINE} in
     819            x86)
    797820                echo i586-pc-interix${UNAME_RELEASE}
    798821                exit ;;
    799             EM64T | authenticamd)
     822            authenticamd | genuineintel | EM64T)
    800823                echo x86_64-unknown-interix${UNAME_RELEASE}
     824                exit ;;
     825            IA64)
     826                echo ia64-unknown-interix${UNAME_RELEASE}
    801827                exit ;;
    802828        esac ;;
    803829    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
    804830        echo i${UNAME_MACHINE}-pc-mks
     831        exit ;;
     832    8664:Windows_NT:*)
     833        echo x86_64-pc-mks
    805834        exit ;;
    806835    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
     
    833862        echo ${UNAME_MACHINE}-pc-minix
    834863        exit ;;
    835     arm*:Linux:*:*)
     864    aarch64:Linux:*:*)
    836865        echo ${UNAME_MACHINE}-unknown-linux-gnu
    837866        exit ;;
    838     avr32*:Linux:*:*)
     867    aarch64_be:Linux:*:*)
     868        UNAME_MACHINE=aarch64_be
    839869        echo ${UNAME_MACHINE}-unknown-linux-gnu
    840         exit ;;
    841     cris:Linux:*:*)
    842         echo cris-axis-linux-gnu
    843         exit ;;
    844     crisv32:Linux:*:*)
    845         echo crisv32-axis-linux-gnu
    846         exit ;;
    847     frv:Linux:*:*)
    848         echo frv-unknown-linux-gnu
    849         exit ;;
    850     ia64:Linux:*:*)
    851         echo ${UNAME_MACHINE}-unknown-linux-gnu
    852         exit ;;
    853     m32r*:Linux:*:*)
    854         echo ${UNAME_MACHINE}-unknown-linux-gnu
    855         exit ;;
    856     m68*:Linux:*:*)
    857         echo ${UNAME_MACHINE}-unknown-linux-gnu
    858         exit ;;
    859     mips:Linux:*:*)
    860         eval $set_cc_for_build
    861         sed 's/^        //' << EOF >$dummy.c
    862         #undef CPU
    863         #undef mips
    864         #undef mipsel
    865         #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
    866         CPU=mipsel
    867         #else
    868         #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
    869         CPU=mips
    870         #else
    871         CPU=
    872         #endif
    873         #endif
    874 EOF
    875         eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
    876             /^CPU/{
    877                 s: ::g
    878                 p
    879             }'`"
    880         test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
    881         ;;
    882     mips64:Linux:*:*)
    883         eval $set_cc_for_build
    884         sed 's/^        //' << EOF >$dummy.c
    885         #undef CPU
    886         #undef mips64
    887         #undef mips64el
    888         #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
    889         CPU=mips64el
    890         #else
    891         #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
    892         CPU=mips64
    893         #else
    894         CPU=
    895         #endif
    896         #endif
    897 EOF
    898         eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
    899             /^CPU/{
    900                 s: ::g
    901                 p
    902             }'`"
    903         test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
    904         ;;
    905     or32:Linux:*:*)
    906         echo or32-unknown-linux-gnu
    907         exit ;;
    908     ppc:Linux:*:*)
    909         echo powerpc-unknown-linux-gnu
    910         exit ;;
    911     ppc64:Linux:*:*)
    912         echo powerpc64-unknown-linux-gnu
    913870        exit ;;
    914871    alpha:Linux:*:*)
     
    921878          EV67)  UNAME_MACHINE=alphaev67 ;;
    922879          EV68*) UNAME_MACHINE=alphaev68 ;;
    923         esac
    924         objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
     880        esac
     881        objdump --private-headers /bin/sh | grep -q ld.so.1
    925882        if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
    926883        echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
     884        exit ;;
     885    arm*:Linux:*:*)
     886        eval $set_cc_for_build
     887        if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
     888            | grep -q __ARM_EABI__
     889        then
     890            echo ${UNAME_MACHINE}-unknown-linux-gnu
     891        else
     892            if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
     893                | grep -q __ARM_PCS_VFP
     894            then
     895                echo ${UNAME_MACHINE}-unknown-linux-gnueabi
     896            else
     897                echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
     898            fi
     899        fi
     900        exit ;;
     901    avr32*:Linux:*:*)
     902        echo ${UNAME_MACHINE}-unknown-linux-gnu
     903        exit ;;
     904    cris:Linux:*:*)
     905        echo ${UNAME_MACHINE}-axis-linux-gnu
     906        exit ;;
     907    crisv32:Linux:*:*)
     908        echo ${UNAME_MACHINE}-axis-linux-gnu
     909        exit ;;
     910    frv:Linux:*:*)
     911        echo ${UNAME_MACHINE}-unknown-linux-gnu
     912        exit ;;
     913    hexagon:Linux:*:*)
     914        echo ${UNAME_MACHINE}-unknown-linux-gnu
     915        exit ;;
     916    i*86:Linux:*:*)
     917        LIBC=gnu
     918        eval $set_cc_for_build
     919        sed 's/^        //' << EOF >$dummy.c
     920        #ifdef __dietlibc__
     921        LIBC=dietlibc
     922        #endif
     923EOF
     924        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
     925        echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
     926        exit ;;
     927    ia64:Linux:*:*)
     928        echo ${UNAME_MACHINE}-unknown-linux-gnu
     929        exit ;;
     930    m32r*:Linux:*:*)
     931        echo ${UNAME_MACHINE}-unknown-linux-gnu
     932        exit ;;
     933    m68*:Linux:*:*)
     934        echo ${UNAME_MACHINE}-unknown-linux-gnu
     935        exit ;;
     936    mips:Linux:*:* | mips64:Linux:*:*)
     937        eval $set_cc_for_build
     938        sed 's/^        //' << EOF >$dummy.c
     939        #undef CPU
     940        #undef ${UNAME_MACHINE}
     941        #undef ${UNAME_MACHINE}el
     942        #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
     943        CPU=${UNAME_MACHINE}el
     944        #else
     945        #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
     946        CPU=${UNAME_MACHINE}
     947        #else
     948        CPU=
     949        #endif
     950        #endif
     951EOF
     952        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
     953        test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
     954        ;;
     955    or32:Linux:*:*)
     956        echo ${UNAME_MACHINE}-unknown-linux-gnu
     957        exit ;;
     958    padre:Linux:*:*)
     959        echo sparc-unknown-linux-gnu
     960        exit ;;
     961    parisc64:Linux:*:* | hppa64:Linux:*:*)
     962        echo hppa64-unknown-linux-gnu
    927963        exit ;;
    928964    parisc:Linux:*:* | hppa:Linux:*:*)
     
    934970        esac
    935971        exit ;;
    936     parisc64:Linux:*:* | hppa64:Linux:*:*)
    937         echo hppa64-unknown-linux-gnu
     972    ppc64:Linux:*:*)
     973        echo powerpc64-unknown-linux-gnu
     974        exit ;;
     975    ppc:Linux:*:*)
     976        echo powerpc-unknown-linux-gnu
    938977        exit ;;
    939978    s390:Linux:*:* | s390x:Linux:*:*)
     
    941980        exit ;;
    942981    sh64*:Linux:*:*)
    943         echo ${UNAME_MACHINE}-unknown-linux-gnu
     982        echo ${UNAME_MACHINE}-unknown-linux-gnu
    944983        exit ;;
    945984    sh*:Linux:*:*)
     
    949988        echo ${UNAME_MACHINE}-unknown-linux-gnu
    950989        exit ;;
     990    tile*:Linux:*:*)
     991        echo ${UNAME_MACHINE}-unknown-linux-gnu
     992        exit ;;
    951993    vax:Linux:*:*)
    952994        echo ${UNAME_MACHINE}-dec-linux-gnu
    953995        exit ;;
    954996    x86_64:Linux:*:*)
    955         echo x86_64-unknown-linux-gnu
    956         exit ;;
    957     xtensa:Linux:*:*)
    958         echo xtensa-unknown-linux-gnu
    959         exit ;;
    960     i*86:Linux:*:*)
    961         # The BFD linker knows what the default object file format is, so
    962         # first see if it will tell us. cd to the root directory to prevent
    963         # problems with other programs or directories called `ld' in the path.
    964         # Set LC_ALL=C to ensure ld outputs messages in English.
    965         ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
    966                          | sed -ne '/supported targets:/!d
    967                                     s/[         ][      ]*/ /g
    968                                     s/.*supported targets: *//
    969                                     s/ .*//
    970                                     p'`
    971         case "$ld_supported_targets" in
    972           elf32-i386)
    973                 TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
    974                 ;;
    975           a.out-i386-linux)
    976                 echo "${UNAME_MACHINE}-pc-linux-gnuaout"
    977                 exit ;;
    978           coff-i386)
    979                 echo "${UNAME_MACHINE}-pc-linux-gnucoff"
    980                 exit ;;
    981           "")
    982                 # Either a pre-BFD a.out linker (linux-gnuoldld) or
    983                 # one that does not give us useful --help.
    984                 echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
    985                 exit ;;
    986         esac
    987         # Determine whether the default compiler is a.out or elf
    988         eval $set_cc_for_build
    989         sed 's/^        //' << EOF >$dummy.c
    990         #include <features.h>
    991         #ifdef __ELF__
    992         # ifdef __GLIBC__
    993         #  if __GLIBC__ >= 2
    994         LIBC=gnu
    995         #  else
    996         LIBC=gnulibc1
    997         #  endif
    998         # else
    999         LIBC=gnulibc1
    1000         # endif
    1001         #else
    1002         #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
    1003         LIBC=gnu
    1004         #else
    1005         LIBC=gnuaout
    1006         #endif
    1007         #endif
    1008         #ifdef __dietlibc__
    1009         LIBC=dietlibc
    1010         #endif
    1011 EOF
    1012         eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
    1013             /^LIBC/{
    1014                 s: ::g
    1015                 p
    1016             }'`"
    1017         test x"${LIBC}" != x && {
    1018                 echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
    1019                 exit
    1020         }
    1021         test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
    1022         ;;
     997        echo ${UNAME_MACHINE}-unknown-linux-gnu
     998        exit ;;
     999    xtensa*:Linux:*:*)
     1000        echo ${UNAME_MACHINE}-unknown-linux-gnu
     1001        exit ;;
    10231002    i*86:DYNIX/ptx:4*:*)
    10241003        # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
     
    10281007        exit ;;
    10291008    i*86:UNIX_SV:4.2MP:2.*)
    1030         # Unixware is an offshoot of SVR4, but it has its own version
    1031         # number series starting with 2...
    1032         # I am not positive that other SVR4 systems won't match this,
     1009        # Unixware is an offshoot of SVR4, but it has its own version
     1010        # number series starting with 2...
     1011        # I am not positive that other SVR4 systems won't match this,
    10331012        # I just have to hope.  -- rms.
    1034         # Use sysv4.2uw... so that sysv4* matches it.
     1013        # Use sysv4.2uw... so that sysv4* matches it.
    10351014        echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
    10361015        exit ;;
     
    10491028        echo ${UNAME_MACHINE}-pc-syllable
    10501029        exit ;;
    1051     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
     1030    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
    10521031        echo i386-unknown-lynxos${UNAME_RELEASE}
    10531032        exit ;;
     
    10641043        exit ;;
    10651044    i*86:*:5:[678]*)
    1066         # UnixWare 7.x, OpenUNIX and OpenServer 6.
     1045        # UnixWare 7.x, OpenUNIX and OpenServer 6.
    10671046        case `/bin/uname -X | grep "^Machine"` in
    10681047            *486*)           UNAME_MACHINE=i486 ;;
     
    10921071    pc:*:*:*)
    10931072        # Left here for compatibility:
    1094         # uname -m prints for DJGPP always 'pc', but it prints nothing about
    1095         # the processor, so we play safe by assuming i386.
    1096         echo i386-pc-msdosdjgpp
    1097         exit ;;
     1073        # uname -m prints for DJGPP always 'pc', but it prints nothing about
     1074        # the processor, so we play safe by assuming i586.
     1075        # Note: whatever this is, it MUST be the same as what config.sub
     1076        # prints for the "djgpp" host, or else GDB configury will decide that
     1077        # this is a cross-build.
     1078        echo i586-pc-msdosdjgpp
     1079        exit ;;
    10981080    Intel:Mach:3*:*)
    10991081        echo i386-pc-mach3
     
    11301112          && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
    11311113    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
    1132         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
    1133           && { echo i486-ncr-sysv4; exit; } ;;
     1114        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
     1115          && { echo i486-ncr-sysv4; exit; } ;;
     1116    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
     1117        OS_REL='.3'
     1118        test -r /etc/.relid \
     1119            && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
     1120        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
     1121            && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
     1122        /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
     1123            && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
     1124        /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
     1125            && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
    11341126    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
    11351127        echo m68k-unknown-lynxos${UNAME_RELEASE}
     
    11441136        echo rs6000-unknown-lynxos${UNAME_RELEASE}
    11451137        exit ;;
    1146     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
     1138    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
    11471139        echo powerpc-unknown-lynxos${UNAME_RELEASE}
    11481140        exit ;;
     
    11641156        fi
    11651157        exit ;;
    1166     PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
    1167                       # says <Richard.M.Bartel@ccMail.Census.GOV>
    1168         echo i586-unisys-sysv4
    1169         exit ;;
     1158    PENTIUM:*:4.0*:*)   # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
     1159                        # says <Richard.M.Bartel@ccMail.Census.GOV>
     1160        echo i586-unisys-sysv4
     1161        exit ;;
    11701162    *:UNIX_System_V:4*:FTX*)
    11711163        # From Gerald Hewes <hewes@openmarket.com>.
     
    11931185    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
    11941186        if [ -d /usr/nec ]; then
    1195                 echo mips-nec-sysv${UNAME_RELEASE}
     1187                echo mips-nec-sysv${UNAME_RELEASE}
    11961188        else
    1197                 echo mips-unknown-sysv${UNAME_RELEASE}
    1198         fi
    1199         exit ;;
     1189                echo mips-unknown-sysv${UNAME_RELEASE}
     1190        fi
     1191        exit ;;
    12001192    BeBox:BeOS:*:*)     # BeOS running on hardware made by Be, PPC only.
    12011193        echo powerpc-be-beos
     
    12061198    BePC:BeOS:*:*)      # BeOS running on Intel PC compatible.
    12071199        echo i586-pc-beos
     1200        exit ;;
     1201    BePC:Haiku:*:*)     # Haiku running on Intel PC compatible.
     1202        echo i586-pc-haiku
    12081203        exit ;;
    12091204    SX-4:SUPER-UX:*:*)
     
    12341229        UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
    12351230        case $UNAME_PROCESSOR in
     1231            i386)
     1232                eval $set_cc_for_build
     1233                if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
     1234                  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
     1235                      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
     1236                      grep IS_64BIT_ARCH >/dev/null
     1237                  then
     1238                      UNAME_PROCESSOR="x86_64"
     1239                  fi
     1240                fi ;;
    12361241            unknown) UNAME_PROCESSOR=powerpc ;;
    12371242        esac
     
    12481253    *:QNX:*:4*)
    12491254        echo i386-pc-qnx
     1255        exit ;;
     1256    NEO-?:NONSTOP_KERNEL:*:*)
     1257        echo neo-tandem-nsk${UNAME_RELEASE}
    12501258        exit ;;
    12511259    NSE-?:NONSTOP_KERNEL:*:*)
     
    12941302        exit ;;
    12951303    SEI:*:*:SEIUX)
    1296         echo mips-sei-seiux${UNAME_RELEASE}
     1304        echo mips-sei-seiux${UNAME_RELEASE}
    12971305        exit ;;
    12981306    *:DragonFly:*:*)
     
    13001308        exit ;;
    13011309    *:*VMS:*:*)
    1302         UNAME_MACHINE=`(uname -p) 2>/dev/null`
     1310        UNAME_MACHINE=`(uname -p) 2>/dev/null`
    13031311        case "${UNAME_MACHINE}" in
    13041312            A*) echo alpha-dec-vms ; exit ;;
     
    13141322    i*86:rdos:*:*)
    13151323        echo ${UNAME_MACHINE}-pc-rdos
     1324        exit ;;
     1325    i*86:AROS:*:*)
     1326        echo ${UNAME_MACHINE}-pc-aros
     1327        exit ;;
     1328    x86_64:VMkernel:*:*)
     1329        echo ${UNAME_MACHINE}-unknown-esx
    13161330        exit ;;
    13171331esac
     
    13371351  printf ("m68k-sony-newsos%s\n",
    13381352#ifdef NEWSOS4
    1339           "4"
     1353        "4"
    13401354#else
    1341           ""
    1342 #endif
    1343          ); exit (0);
     1355        ""
     1356#endif
     1357        ); exit (0);
    13441358#endif
    13451359#endif
     
    14751489download the most up to date version of the config scripts from
    14761490
    1477   http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
     1491  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
    14781492and
    1479   http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
     1493  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
    14801494
    14811495If the version you run ($0) is already up to date, please
  • branches/autotools-update/config.sub

    r416 r2554  
    22# Configuration validation subroutine script.
    33#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
    4 #   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
    5 #   Inc.
    6 
    7 timestamp='2007-04-29'
     4#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
     5#   2011, 2012 Free Software Foundation, Inc.
     6
     7timestamp='2012-02-10'
    88
    99# This file is (in principle) common to ALL GNU software.
     
    2222#
    2323# You should have received a copy of the GNU General Public License
    24 # along with this program; if not, write to the Free Software
    25 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
    26 # 02110-1301, USA.
     24# along with this program; if not, see <http://www.gnu.org/licenses/>.
    2725#
    2826# As a special exception to the GNU General Public License, if you
     
    3331
    3432# Please send patches to <config-patches@gnu.org>.  Submit a context
    35 # diff and a properly formatted ChangeLog entry.
     33# diff and a properly formatted GNU ChangeLog entry.
    3634#
    3735# Configuration subroutine to validate and canonicalize a configuration type.
     
    3937# If it is invalid, we print an error message on stderr and exit with code 1.
    4038# Otherwise, we print the canonical config type on stdout and succeed.
     39
     40# You can get the latest version of this script from:
     41# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
    4142
    4243# This file is supposed to be the same for all GNU packages
     
    7374GNU config.sub ($timestamp)
    7475
    75 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
     76Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
     772001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
    7678Free Software Foundation, Inc.
    7779
     
    121123maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
    122124case $maybe_os in
    123   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
    124   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
     125  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
     126  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
     127  knetbsd*-gnu* | netbsd*-gnu* | \
     128  kopensolaris*-gnu* | \
    125129  storm-chaos* | os2-emx* | rtmk-nova*)
    126130    os=-$maybe_os
    127131    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     132    ;;
     133  android-linux)
     134    os=-linux-android
     135    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
    128136    ;;
    129137  *)
     
    149157        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
    150158        -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
    151         -apple | -axis | -knuth | -cray)
     159        -apple | -axis | -knuth | -cray | -microblaze)
    152160                os=
    153161                basic_machine=$1
     162                ;;
     163        -bluegene*)
     164                os=-cnk
    154165                ;;
    155166        -sim | -cisco | -oki | -wec | -winbond)
     
    167178                basic_machine=$1
    168179                ;;
    169         -chorusrdb)
    170                 os=-chorusrdb
     180        -chorusrdb)
     181                os=-chorusrdb
    171182                basic_machine=$1
    172                 ;;
     183                ;;
    173184        -hiux*)
    174185                os=-hiuxwe2
     
    239250        1750a | 580 \
    240251        | a29k \
     252        | aarch64 | aarch64_be \
    241253        | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
    242254        | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
    243255        | am33_2.0 \
    244256        | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
     257        | be32 | be64 \
    245258        | bfin \
    246259        | c4x | clipper \
    247260        | d10v | d30v | dlx | dsp16xx \
     261        | epiphany \
    248262        | fido | fr30 | frv \
    249263        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
     264        | hexagon \
    250265        | i370 | i860 | i960 | ia64 \
    251266        | ip2k | iq2000 \
     267        | le32 | le64 \
     268        | lm32 \
    252269        | m32c | m32r | m32rle | m68000 | m68k | m88k \
    253         | maxq | mb | microblaze | mcore | mep \
     270        | maxq | mb | microblaze | mcore | mep | metag \
    254271        | mips | mipsbe | mipseb | mipsel | mipsle \
    255272        | mips16 \
    256273        | mips64 | mips64el \
     274        | mips64octeon | mips64octeonel \
     275        | mips64orion | mips64orionel \
     276        | mips64r5900 | mips64r5900el \
    257277        | mips64vr | mips64vrel \
    258         | mips64orion | mips64orionel \
    259278        | mips64vr4100 | mips64vr4100el \
    260279        | mips64vr4300 | mips64vr4300el \
     
    269288        | mipstx39 | mipstx39el \
    270289        | mn10200 | mn10300 \
     290        | moxie \
    271291        | mt \
    272292        | msp430 \
     293        | nds32 | nds32le | nds32be \
    273294        | nios | nios2 \
    274295        | ns16k | ns32k \
     296        | open8 \
    275297        | or32 \
    276298        | pdp10 | pdp11 | pj | pjl \
    277         | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
     299        | powerpc | powerpc64 | powerpc64le | powerpcle \
    278300        | pyramid \
     301        | rl78 | rx \
    279302        | score \
    280         | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
     303        | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
    281304        | sh64 | sh64le \
    282305        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
    283306        | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
    284         | spu | strongarm \
    285         | tahoe | thumb | tic4x | tic80 | tron \
    286         | v850 | v850e \
     307        | spu \
     308        | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
     309        | ubicom32 \
     310        | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
    287311        | we32k \
    288         | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
    289         | z8k)
     312        | x86 | xc16x | xstormy16 | xtensa \
     313        | z8k | z80)
    290314                basic_machine=$basic_machine-unknown
    291315                ;;
    292         m6811 | m68hc11 | m6812 | m68hc12)
    293                 # Motorola 68HC11/12.
     316        c54x)
     317                basic_machine=tic54x-unknown
     318                ;;
     319        c55x)
     320                basic_machine=tic55x-unknown
     321                ;;
     322        c6x)
     323                basic_machine=tic6x-unknown
     324                ;;
     325        m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
    294326                basic_machine=$basic_machine-unknown
    295327                os=-none
     
    299331        ms1)
    300332                basic_machine=mt-unknown
     333                ;;
     334
     335        strongarm | thumb | xscale)
     336                basic_machine=arm-unknown
     337                ;;
     338        xgate)
     339                basic_machine=$basic_machine-unknown
     340                os=-none
     341                ;;
     342        xscaleeb)
     343                basic_machine=armeb-unknown
     344                ;;
     345
     346        xscaleel)
     347                basic_machine=armel-unknown
    301348                ;;
    302349
     
    315362        580-* \
    316363        | a29k-* \
     364        | aarch64-* | aarch64_be-* \
    317365        | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
    318366        | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
     
    320368        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
    321369        | avr-* | avr32-* \
     370        | be32-* | be64-* \
    322371        | bfin-* | bs2000-* \
    323         | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
     372        | c[123]* | c30-* | [cjt]90-* | c4x-* \
    324373        | clipper-* | craynv-* | cydra-* \
    325374        | d10v-* | d30v-* | dlx-* \
     
    328377        | h8300-* | h8500-* \
    329378        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
     379        | hexagon-* \
    330380        | i*86-* | i860-* | i960-* | ia64-* \
    331381        | ip2k-* | iq2000-* \
     382        | le32-* | le64-* \
     383        | lm32-* \
    332384        | m32c-* | m32r-* | m32rle-* \
    333385        | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
    334         | m88110-* | m88k-* | maxq-* | mcore-* \
     386        | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
    335387        | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
    336388        | mips16-* \
    337389        | mips64-* | mips64el-* \
     390        | mips64octeon-* | mips64octeonel-* \
     391        | mips64orion-* | mips64orionel-* \
     392        | mips64r5900-* | mips64r5900el-* \
    338393        | mips64vr-* | mips64vrel-* \
    339         | mips64orion-* | mips64orionel-* \
    340394        | mips64vr4100-* | mips64vr4100el-* \
    341395        | mips64vr4300-* | mips64vr4300el-* \
     
    352406        | mt-* \
    353407        | msp430-* \
     408        | nds32-* | nds32le-* | nds32be-* \
    354409        | nios-* | nios2-* \
    355410        | none-* | np1-* | ns16k-* | ns32k-* \
     411        | open8-* \
    356412        | orion-* \
    357413        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
    358         | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
     414        | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
    359415        | pyramid-* \
    360         | romp-* | rs6000-* \
    361         | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
     416        | rl78-* | romp-* | rs6000-* | rx-* \
     417        | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
    362418        | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
    363419        | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
    364420        | sparclite-* \
    365         | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
    366         | tahoe-* | thumb-* \
     421        | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
     422        | tahoe-* \
    367423        | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
     424        | tile*-* \
    368425        | tron-* \
    369         | v850-* | v850e-* | vax-* \
     426        | ubicom32-* \
     427        | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
     428        | vax-* \
    370429        | we32k-* \
    371         | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
    372         | xstormy16-* | xtensa-* \
     430        | x86-* | x86_64-* | xc16x-* | xps100-* \
     431        | xstormy16-* | xtensa*-* \
    373432        | ymp-* \
    374         | z8k-*)
     433        | z8k-* | z80-*)
     434                ;;
     435        # Recognize the basic CPU types without company name, with glob match.
     436        xtensa*)
     437                basic_machine=$basic_machine-unknown
    375438                ;;
    376439        # Recognize the various machine names and aliases which stand
     
    390453                os=-udi
    391454                ;;
    392         abacus)
     455        abacus)
    393456                basic_machine=abacus-unknown
    394457                ;;
     
    436499                os=-bsd
    437500                ;;
     501        aros)
     502                basic_machine=i386-pc
     503                os=-aros
     504                ;;
    438505        aux)
    439506                basic_machine=m68k-apple
     
    444511                os=-dynix
    445512                ;;
     513        blackfin)
     514                basic_machine=bfin-unknown
     515                os=-linux
     516                ;;
     517        blackfin-*)
     518                basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
     519                os=-linux
     520                ;;
     521        bluegene*)
     522                basic_machine=powerpc-ibm
     523                os=-cnk
     524                ;;
     525        c54x-*)
     526                basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
     527                ;;
     528        c55x-*)
     529                basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
     530                ;;
     531        c6x-*)
     532                basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
     533                ;;
    446534        c90)
    447535                basic_machine=c90-cray
    448536                os=-unicos
    449537                ;;
     538        cegcc)
     539                basic_machine=arm-unknown
     540                os=-cegcc
     541                ;;
    450542        convex-c1)
    451543                basic_machine=c1-convex
     
    476568                os=-unicosmp
    477569                ;;
    478         cr16c)
    479                 basic_machine=cr16c-unknown
     570        cr16 | cr16-*)
     571                basic_machine=cr16-unknown
    480572                os=-elf
    481573                ;;
     
    515607                os=-sysv3
    516608                ;;
     609        dicos)
     610                basic_machine=i686-pc
     611                os=-dicos
     612                ;;
    517613        djgpp)
    518614                basic_machine=i586-pc
     
    630726                basic_machine=i370-ibm
    631727                ;;
    632 # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
    633728        i*86v32)
    634729                basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
     
    669764                os=-sysv
    670765                ;;
     766        m68knommu)
     767                basic_machine=m68k-unknown
     768                os=-linux
     769                ;;
     770        m68knommu-*)
     771                basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
     772                os=-linux
     773                ;;
    671774        m88k-omron*)
    672775                basic_machine=m88k-omron
     
    680783                os=-sysv
    681784                ;;
     785        microblaze)
     786                basic_machine=microblaze-xilinx
     787                ;;
    682788        mingw32)
    683789                basic_machine=i386-pc
     
    716822                basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
    717823                ;;
     824        msys)
     825                basic_machine=i386-pc
     826                os=-msys
     827                ;;
    718828        mvs)
    719829                basic_machine=i370-ibm
    720830                os=-mvs
     831                ;;
     832        nacl)
     833                basic_machine=le32-unknown
     834                os=-nacl
    721835                ;;
    722836        ncr3000)
     
    784898                basic_machine=np1-gould
    785899                ;;
     900        neo-tandem)
     901                basic_machine=neo-tandem
     902                ;;
     903        nse-tandem)
     904                basic_machine=nse-tandem
     905                ;;
    786906        nsr-tandem)
    787907                basic_machine=nsr-tandem
     
    814934                os=-osf
    815935                ;;
     936        parisc)
     937                basic_machine=hppa-unknown
     938                os=-linux
     939                ;;
     940        parisc-*)
     941                basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
     942                os=-linux
     943                ;;
    816944        pbd)
    817945                basic_machine=sparc-tti
     
    858986        power)  basic_machine=power-ibm
    859987                ;;
    860         ppc)    basic_machine=powerpc-unknown
    861                 ;;
    862         ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
     988        ppc | ppcbe)    basic_machine=powerpc-unknown
     989                ;;
     990        ppc-* | ppcbe-*)
     991                basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
    863992                ;;
    864993        ppcle | powerpclittle | ppc-le | powerpc-little)
     
    9541083                os=-sysv4
    9551084                ;;
     1085        strongarm-* | thumb-*)
     1086                basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
     1087                ;;
    9561088        sun2)
    9571089                basic_machine=m68000-sun
     
    10101142                os=-unicos
    10111143                ;;
    1012         tic54x | c54x*)
    1013                 basic_machine=tic54x-unknown
    1014                 os=-coff
    1015                 ;;
    1016         tic55x | c55x*)
    1017                 basic_machine=tic55x-unknown
    1018                 os=-coff
    1019                 ;;
    1020         tic6x | c6x*)
    1021                 basic_machine=tic6x-unknown
    1022                 os=-coff
     1144        tile*)
     1145                basic_machine=$basic_machine-unknown
     1146                os=-linux-gnu
    10231147                ;;
    10241148        tx39)
     
    10891213                basic_machine=xps100-honeywell
    10901214                ;;
     1215        xscale-* | xscalee[bl]-*)
     1216                basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
     1217                ;;
    10911218        ymp)
    10921219                basic_machine=ymp-cray
     
    10951222        z8k-*-coff)
    10961223                basic_machine=z8k-unknown
     1224                os=-sim
     1225                ;;
     1226        z80-*-coff)
     1227                basic_machine=z80-unknown
    10971228                os=-sim
    10981229                ;;
     
    11351266                basic_machine=we32k-att
    11361267                ;;
    1137         sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
     1268        sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
    11381269                basic_machine=sh-unknown
    11391270                ;;
     
    11821313then
    11831314case $os in
    1184         # First match some system type aliases
    1185         # that might get confused with valid system types.
     1315        # First match some system type aliases
     1316        # that might get confused with valid system types.
    11861317        # -solaris* is a basic system type, with this one exception.
     1318        -auroraux)
     1319                os=-auroraux
     1320                ;;
    11871321        -solaris1 | -solaris1.*)
    11881322                os=`echo $os | sed -e 's|solaris1|sunos4|'`
     
    12051339        # -sysv* is not here because it comes later, after sysvr4.
    12061340        -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
    1207               | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
    1208               | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
     1341              | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
     1342              | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
     1343              | -sym* | -kopensolaris* \
    12091344              | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
    1210               | -aos* \
     1345              | -aos* | -aros* \
    12111346              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
    12121347              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
     
    12171352              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
    12181353              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
    1219               | -chorusos* | -chorusrdb* \
    1220               | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
    1221               | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
     1354              | -chorusos* | -chorusrdb* | -cegcc* \
     1355              | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
     1356              | -mingw32* | -linux-gnu* | -linux-android* \
     1357              | -linux-newlib* | -linux-uclibc* \
    12221358              | -uxpv* | -beos* | -mpeix* | -udk* \
    12231359              | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
     
    12271363              | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
    12281364              | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
    1229               | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
     1365              | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
    12301366        # Remember, each alternative MUST END IN *, to match a version number.
    12311367                ;;
     
    12661402                os=-openedition
    12671403                ;;
    1268         -os400*)
     1404        -os400*)
    12691405                os=-os400
    12701406                ;;
     
    13151451                os=-sysv4
    13161452                ;;
    1317         -tpf*)
     1453        -tpf*)
    13181454                os=-tpf
    13191455                ;;
     
    13561492        -zvmoe)
    13571493                os=-zvmoe
     1494                ;;
     1495        -dicos*)
     1496                os=-dicos
     1497                ;;
     1498        -nacl*)
    13581499                ;;
    13591500        -none)
     
    13791520
    13801521case $basic_machine in
    1381         score-*)
     1522        score-*)
    13821523                os=-elf
    13831524                ;;
    1384         spu-*)
     1525        spu-*)
    13851526                os=-elf
    13861527                ;;
     
    13941535                os=-aout
    13951536                ;;
    1396         c4x-* | tic4x-*)
    1397                 os=-coff
     1537        c4x-* | tic4x-*)
     1538                os=-coff
     1539                ;;
     1540        tic54x-*)
     1541                os=-coff
     1542                ;;
     1543        tic55x-*)
     1544                os=-coff
     1545                ;;
     1546        tic6x-*)
     1547                os=-coff
    13981548                ;;
    13991549        # This must come before the *-dec entry.
     
    14151565        m68000-sun)
    14161566                os=-sunos3
    1417                 # This also exists in the configure program, but was not the
    1418                 # default.
    1419                 # os=-sunos4
    14201567                ;;
    14211568        m68*-cisco)
    14221569                os=-aout
    14231570                ;;
    1424         mep-*)
     1571        mep-*)
    14251572                os=-elf
    14261573                ;;
     
    14491596                os=-aix
    14501597                ;;
    1451         *-knuth)
     1598        *-knuth)
    14521599                os=-mmixware
    14531600                ;;
     
    15541701                                vendor=sun
    15551702                                ;;
    1556                         -aix*)
     1703                        -cnk*|-aix*)
    15571704                                vendor=ibm
    15581705                                ;;
  • branches/autotools-update/depcomp

    r2 r2554  
    22# depcomp - compile a program generating dependencies as side-effects
    33
    4 scriptversion=2005-07-09.11
    5 
    6 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
     4scriptversion=2012-03-27.16; # UTC
     5
     6# Copyright (C) 1999-2012 Free Software Foundation, Inc.
    77
    88# This program is free software; you can redistribute it and/or modify
     
    1717
    1818# You should have received a copy of the GNU General Public License
    19 # along with this program; if not, write to the Free Software
    20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    21 # 02110-1301, USA.
     19# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    2220
    2321# As a special exception to the GNU General Public License, if you
     
    3028case $1 in
    3129  '')
    32      echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
     30     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
    3331     exit 1;
    3432     ;;
     
    4240Environment variables:
    4341  depmode     Dependency tracking mode.
    44   source      Source file read by `PROGRAMS ARGS'.
    45   object      Object file output by `PROGRAMS ARGS'.
     42  source      Source file read by 'PROGRAMS ARGS'.
     43  object      Object file output by 'PROGRAMS ARGS'.
    4644  DEPDIR      directory where to store dependencies.
    4745  depfile     Dependency file to output.
    48   tmpdepfile  Temporary file to use when outputing dependencies.
     46  tmpdepfile  Temporary file to use when outputting dependencies.
    4947  libtool     Whether libtool is used (yes/no).
    5048
     
    5957esac
    6058
     59# A tabulation character.
     60tab='   '
     61# A newline character.
     62nl='
     63'
     64
    6165if test -z "$depmode" || test -z "$source" || test -z "$object"; then
    6266  echo "depcomp: Variables source, object and depmode must be set" 1>&2
     
    8791fi
    8892
     93cygpath_u="cygpath -u -f -"
     94if test "$depmode" = msvcmsys; then
     95   # This is just like msvisualcpp but w/o cygpath translation.
     96   # Just convert the backslash-escaped backslashes to single forward
     97   # slashes to satisfy depend.m4
     98   cygpath_u='sed s,\\\\,/,g'
     99   depmode=msvisualcpp
     100fi
     101
     102if test "$depmode" = msvc7msys; then
     103   # This is just like msvc7 but w/o cygpath translation.
     104   # Just convert the backslash-escaped backslashes to single forward
     105   # slashes to satisfy depend.m4
     106   cygpath_u='sed s,\\\\,/,g'
     107   depmode=msvc7
     108fi
     109
     110if test "$depmode" = xlc; then
     111   # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
     112   gccflag=-qmakedep=gcc,-MF
     113   depmode=gcc
     114fi
     115
    89116case "$depmode" in
    90117gcc3)
     
    92119## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
    93120## it if -MD -MP comes after the -MF stuff.  Hmm.
    94   "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
     121## Unfortunately, FreeBSD c89 acceptance of flags depends upon
     122## the command line argument order; so add the flags where they
     123## appear in depend2.am.  Note that the slowdown incurred here
     124## affects only configure: in makefiles, %FASTDEP% shortcuts this.
     125  for arg
     126  do
     127    case $arg in
     128    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
     129    *)  set fnord "$@" "$arg" ;;
     130    esac
     131    shift # fnord
     132    shift # $arg
     133  done
     134  "$@"
    95135  stat=$?
    96136  if test $stat -eq 0; then :
     
    128168  sed -e 's/^[^:]*: / /' \
    129169      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
    130 ## This next piece of magic avoids the `deleted header file' problem.
     170## This next piece of magic avoids the "deleted header file" problem.
    131171## The problem is that when a header file which appears in a .P file
    132172## is deleted, the dependency causes make to die (because there is
     
    134174## dummy dependencies for each header file.  Too bad gcc doesn't do
    135175## this for us directly.
    136   tr ' ' '
    137 ' < "$tmpdepfile" |
    138 ## Some versions of gcc put a space before the `:'.  On the theory
     176  tr ' ' "$nl" < "$tmpdepfile" |
     177## Some versions of gcc put a space before the ':'.  On the theory
    139178## that the space means something, we add a space to the output as
    140 ## well.
     179## well.  hp depmode also adds that space, but also prefixes the VPATH
     180## to the object.  Take care to not repeat it in the output.
    141181## Some versions of the HPUX 10.20 sed can't process this invocation
    142182## correctly.  Breaking it into two sed invocations is a workaround.
    143     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
     183    sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
     184      | sed -e 's/$/ :/' >> "$depfile"
    144185  rm -f "$tmpdepfile"
    145186  ;;
     
    173214    # lines with more than a fixed number of characters (4096 in
    174215    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
    175     # the IRIX cc adds comments like `#:fec' to the end of the
     216    # the IRIX cc adds comments like '#:fec' to the end of the
    176217    # dependency line.
    177     tr ' ' '
    178 ' < "$tmpdepfile" \
     218    tr ' ' "$nl" < "$tmpdepfile" \
    179219    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
    180     tr '
    181 ' ' ' >> $depfile
    182     echo >> $depfile
     220    tr "$nl" ' ' >> "$depfile"
     221    echo >> "$depfile"
    183222
    184223    # The second pass generates a dummy entry for each header file.
    185     tr ' ' '
    186 ' < "$tmpdepfile" \
     224    tr ' ' "$nl" < "$tmpdepfile" \
    187225   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
    188    >> $depfile
     226   >> "$depfile"
    189227  else
    190228    # The sourcefile does not contain any dependencies, so just
     
    196234  ;;
    197235
     236xlc)
     237  # This case exists only to let depend.m4 do its work.  It works by
     238  # looking at the text of this script.  This case will never be run,
     239  # since it is checked for above.
     240  exit 1
     241  ;;
     242
    198243aix)
    199244  # The C for AIX Compiler uses -M and outputs the dependencies
    200245  # in a .u file.  In older versions, this file always lives in the
    201   # current directory.  Also, the AIX compiler puts `$object:' at the
     246  # current directory.  Also, the AIX compiler puts '$object:' at the
    202247  # start of each line; $object doesn't have directory information.
    203248  # Version 6 uses the directory in both cases.
    204   stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
    205   tmpdepfile="$stripped.u"
     249  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
     250  test "x$dir" = "x$object" && dir=
     251  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
    206252  if test "$libtool" = yes; then
     253    tmpdepfile1=$dir$base.u
     254    tmpdepfile2=$base.u
     255    tmpdepfile3=$dir.libs/$base.u
    207256    "$@" -Wc,-M
    208257  else
     258    tmpdepfile1=$dir$base.u
     259    tmpdepfile2=$dir$base.u
     260    tmpdepfile3=$dir$base.u
    209261    "$@" -M
    210262  fi
    211263  stat=$?
    212264
    213   if test -f "$tmpdepfile"; then :
    214   else
    215     stripped=`echo "$stripped" | sed 's,^.*/,,'`
    216     tmpdepfile="$stripped.u"
    217   fi
    218 
    219265  if test $stat -eq 0; then :
    220266  else
    221     rm -f "$tmpdepfile"
     267    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
    222268    exit $stat
    223269  fi
    224270
     271  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
     272  do
     273    test -f "$tmpdepfile" && break
     274  done
    225275  if test -f "$tmpdepfile"; then
    226     outname="$stripped.o"
    227     # Each line is of the form `foo.o: dependent.h'.
     276    # Each line is of the form 'foo.o: dependent.h'.
    228277    # Do two passes, one to just change these to
    229     # `$object: dependent.h' and one to simply `dependent.h:'.
    230     sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
    231     sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
     278    # '$object: dependent.h' and one to simply 'dependent.h:'.
     279    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
     280    sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    232281  else
    233282    # The sourcefile does not contain any dependencies, so just
     
    240289
    241290icc)
    242   # Intel's C compiler understands `-MD -MF file'.  However on
    243   #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
     291  # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
     292  # However on
     293  #    $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
    244294  # ICC 7.0 will fill foo.d with something like
    245295  #    foo.o: sub/foo.c
    246296  #    foo.o: sub/foo.h
    247   # which is wrong.  We want:
     297  # which is wrong.  We want
    248298  #    sub/foo.o: sub/foo.c
    249299  #    sub/foo.o: sub/foo.h
     
    252302  # ICC 7.1 will output
    253303  #    foo.o: sub/foo.c sub/foo.h
    254   # and will wrap long lines using \ :
     304  # and will wrap long lines using '\':
    255305  #    foo.o: sub/foo.c ... \
    256306  #     sub/foo.h ... \
    257307  #     ...
    258 
     308  # tcc 0.9.26 (FIXME still under development at the moment of writing)
     309  # will emit a similar output, but also prepend the continuation lines
     310  # with horizontal tabulation characters.
    259311  "$@" -MD -MF "$tmpdepfile"
    260312  stat=$?
     
    265317  fi
    266318  rm -f "$depfile"
    267   # Each line is of the form `foo.o: dependent.h',
    268   # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
     319  # Each line is of the form 'foo.o: dependent.h',
     320  # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
    269321  # Do two passes, one to just change these to
    270   # `$object: dependent.h' and one to simply `dependent.h:'.
    271   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
    272   # Some versions of the HPUX 10.20 sed can't process this invocation
    273   # correctly.  Breaking it into two sed invocations is a workaround.
    274   sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
    275     sed -e 's/$/ :/' >> "$depfile"
     322  # '$object: dependent.h' and one to simply 'dependent.h:'.
     323  sed -e "s/^[ $tab][ $tab]*/  /" -e "s,^[^:]*:,$object :," \
     324    < "$tmpdepfile" > "$depfile"
     325  sed '
     326    s/[ '"$tab"'][ '"$tab"']*/ /g
     327    s/^ *//
     328    s/ *\\*$//
     329    s/^[^:]*: *//
     330    /^$/d
     331    /:$/d
     332    s/$/ :/
     333  ' < "$tmpdepfile" >> "$depfile"
    276334  rm -f "$tmpdepfile"
     335  ;;
     336
     337hp2)
     338  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
     339  # compilers, which have integrated preprocessors.  The correct option
     340  # to use with these is +Maked; it writes dependencies to a file named
     341  # 'foo.d', which lands next to the object file, wherever that
     342  # happens to be.
     343  # Much of this is similar to the tru64 case; see comments there.
     344  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
     345  test "x$dir" = "x$object" && dir=
     346  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
     347  if test "$libtool" = yes; then
     348    tmpdepfile1=$dir$base.d
     349    tmpdepfile2=$dir.libs/$base.d
     350    "$@" -Wc,+Maked
     351  else
     352    tmpdepfile1=$dir$base.d
     353    tmpdepfile2=$dir$base.d
     354    "$@" +Maked
     355  fi
     356  stat=$?
     357  if test $stat -eq 0; then :
     358  else
     359     rm -f "$tmpdepfile1" "$tmpdepfile2"
     360     exit $stat
     361  fi
     362
     363  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
     364  do
     365    test -f "$tmpdepfile" && break
     366  done
     367  if test -f "$tmpdepfile"; then
     368    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
     369    # Add 'dependent.h:' lines.
     370    sed -ne '2,${
     371               s/^ *//
     372               s/ \\*$//
     373               s/$/:/
     374               p
     375             }' "$tmpdepfile" >> "$depfile"
     376  else
     377    echo "#dummy" > "$depfile"
     378  fi
     379  rm -f "$tmpdepfile" "$tmpdepfile2"
    277380  ;;
    278381
    279382tru64)
    280383   # The Tru64 compiler uses -MD to generate dependencies as a side
    281    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
     384   # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
    282385   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
    283    # dependencies in `foo.d' instead, so we check for that too.
     386   # dependencies in 'foo.d' instead, so we check for that too.
    284387   # Subdirectories are respected.
    285388   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
     
    289392   if test "$libtool" = yes; then
    290393      # With Tru64 cc, shared objects can also be used to make a
    291       # static library.  This mecanism is used in libtool 1.4 series to
     394      # static library.  This mechanism is used in libtool 1.4 series to
    292395      # handle both shared and static libraries in a single compilation.
    293396      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
     
    295398      # With libtool 1.5 this exception was removed, and libtool now
    296399      # generates 2 separate objects for the 2 libraries.  These two
    297       # compilations output dependencies in in $dir.libs/$base.o.d and
     400      # compilations output dependencies in $dir.libs/$base.o.d and
    298401      # in $dir$base.o.d.  We have to check for both files, because
    299402      # one of the two compilations can be disabled.  We should prefer
     
    327430   if test -f "$tmpdepfile"; then
    328431      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
    329       # That's a tab and a space in the [].
    330       sed -e 's,^.*\.[a-z]*:[    ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
     432      sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    331433   else
    332434      echo "#dummy" > "$depfile"
     
    335437   ;;
    336438
     439msvc7)
     440  if test "$libtool" = yes; then
     441    showIncludes=-Wc,-showIncludes
     442  else
     443    showIncludes=-showIncludes
     444  fi
     445  "$@" $showIncludes > "$tmpdepfile"
     446  stat=$?
     447  grep -v '^Note: including file: ' "$tmpdepfile"
     448  if test "$stat" = 0; then :
     449  else
     450    rm -f "$tmpdepfile"
     451    exit $stat
     452  fi
     453  rm -f "$depfile"
     454  echo "$object : \\" > "$depfile"
     455  # The first sed program below extracts the file names and escapes
     456  # backslashes for cygpath.  The second sed program outputs the file
     457  # name when reading, but also accumulates all include files in the
     458  # hold buffer in order to output them again at the end.  This only
     459  # works with sed implementations that can handle large buffers.
     460  sed < "$tmpdepfile" -n '
     461/^Note: including file:  *\(.*\)/ {
     462  s//\1/
     463  s/\\/\\\\/g
     464  p
     465}' | $cygpath_u | sort -u | sed -n '
     466s/ /\\ /g
     467s/\(.*\)/'"$tab"'\1 \\/p
     468s/.\(.*\) \\/\1:/
     469H
     470$ {
     471  s/.*/'"$tab"'/
     472  G
     473  p
     474}' >> "$depfile"
     475  rm -f "$tmpdepfile"
     476  ;;
     477
     478msvc7msys)
     479  # This case exists only to let depend.m4 do its work.  It works by
     480  # looking at the text of this script.  This case will never be run,
     481  # since it is checked for above.
     482  exit 1
     483  ;;
     484
    337485#nosideeffect)
    338486  # This comment above is used by automake to tell side-effect
     
    346494  # Remove the call to Libtool.
    347495  if test "$libtool" = yes; then
    348     while test $1 != '--mode=compile'; do
     496    while test "X$1" != 'X--mode=compile'; do
    349497      shift
    350498    done
     
    352500  fi
    353501
    354   # Remove `-o $object'.
     502  # Remove '-o $object'.
    355503  IFS=" "
    356504  for arg
     
    372520
    373521  test -z "$dashmflag" && dashmflag=-M
    374   # Require at least two characters before searching for `:'
     522  # Require at least two characters before searching for ':'
    375523  # in the target name.  This is to cope with DOS-style filenames:
    376   # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
     524  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
    377525  "$@" $dashmflag |
    378     sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
     526    sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
    379527  rm -f "$depfile"
    380528  cat < "$tmpdepfile" > "$depfile"
    381   tr ' ' '
    382 ' < "$tmpdepfile" | \
     529  tr ' ' "$nl" < "$tmpdepfile" | \
    383530## Some versions of the HPUX 10.20 sed can't process this invocation
    384531## correctly.  Breaking it into two sed invocations is a workaround.
     
    397544  # Remove any Libtool call
    398545  if test "$libtool" = yes; then
    399     while test $1 != '--mode=compile'; do
     546    while test "X$1" != 'X--mode=compile'; do
    400547      shift
    401548    done
     
    404551  # X makedepend
    405552  shift
    406   cleared=no
    407   for arg in "$@"; do
     553  cleared=no eat=no
     554  for arg
     555  do
    408556    case $cleared in
    409557    no)
     
    411559      cleared=yes ;;
    412560    esac
     561    if test $eat = yes; then
     562      eat=no
     563      continue
     564    fi
    413565    case "$arg" in
    414566    -D*|-I*)
     
    416568    # Strip any option that makedepend may not understand.  Remove
    417569    # the object too, otherwise makedepend will parse it as a source file.
     570    -arch)
     571      eat=yes ;;
    418572    -*|$object)
    419573      ;;
     
    422576    esac
    423577  done
    424   obj_suffix="`echo $object | sed 's/^.*\././'`"
     578  obj_suffix=`echo "$object" | sed 's/^.*\././'`
    425579  touch "$tmpdepfile"
    426580  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
    427581  rm -f "$depfile"
    428   cat < "$tmpdepfile" > "$depfile"
    429   sed '1,2d' "$tmpdepfile" | tr ' ' '
    430 ' | \
     582  # makedepend may prepend the VPATH from the source file name to the object.
     583  # No need to regex-escape $object, excess matching of '.' is harmless.
     584  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
     585  sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
    431586## Some versions of the HPUX 10.20 sed can't process this invocation
    432587## correctly.  Breaking it into two sed invocations is a workaround.
     
    442597  # Remove the call to Libtool.
    443598  if test "$libtool" = yes; then
    444     while test $1 != '--mode=compile'; do
     599    while test "X$1" != 'X--mode=compile'; do
    445600      shift
    446601    done
     
    448603  fi
    449604
    450   # Remove `-o $object'.
     605  # Remove '-o $object'.
    451606  IFS=" "
    452607  for arg
     
    480635msvisualcpp)
    481636  # Important note: in order to support this mode, a compiler *must*
    482   # always write the preprocessed file to stdout, regardless of -o,
    483   # because we must use -o when running libtool.
     637  # always write the preprocessed file to stdout.
    484638  "$@" || exit $?
     639
     640  # Remove the call to Libtool.
     641  if test "$libtool" = yes; then
     642    while test "X$1" != 'X--mode=compile'; do
     643      shift
     644    done
     645    shift
     646  fi
     647
    485648  IFS=" "
    486649  for arg
    487650  do
    488651    case "$arg" in
     652    -o)
     653      shift
     654      ;;
     655    $object)
     656      shift
     657      ;;
    489658    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
    490659        set fnord "$@"
     
    499668    esac
    500669  done
    501   "$@" -E |
    502   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
     670  "$@" -E 2>/dev/null |
     671  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
    503672  rm -f "$depfile"
    504673  echo "$object : \\" > "$depfile"
    505   . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::    \1 \\:p' >> "$depfile"
    506   echo "        " >> "$depfile"
    507   . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
     674  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
     675  echo "$tab" >> "$depfile"
     676  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
    508677  rm -f "$tmpdepfile"
     678  ;;
     679
     680msvcmsys)
     681  # This case exists only to let depend.m4 do its work.  It works by
     682  # looking at the text of this script.  This case will never be run,
     683  # since it is checked for above.
     684  exit 1
    509685  ;;
    510686
     
    527703# time-stamp-start: "scriptversion="
    528704# time-stamp-format: "%:y-%02m-%02d.%02H"
    529 # time-stamp-end: "$"
     705# time-stamp-time-zone: "UTC"
     706# time-stamp-end: "; # UTC"
    530707# End:
  • branches/autotools-update/install-sh

    r2 r2554  
    22# install - install a program, script, or datafile
    33
    4 scriptversion=2005-05-14.22
     4scriptversion=2011-11-20.07; # UTC
    55
    66# This originates from X11R5 (mit/util/scripts/install.sh), which was
     
    3636#
    3737# Calling this script install-sh is preferred over install.sh, to prevent
    38 # `make' implicit rules from creating a file called install from it
     38# 'make' implicit rules from creating a file called install from it
    3939# when there is no Makefile.
    4040#
    4141# This script is compatible with the BSD install script, but was written
    42 # from scratch.  It can only install one file at a time, a restriction
    43 # shared with many OS's install programs.
     42# from scratch.
     43
     44nl='
     45'
     46IFS=" ""        $nl"
    4447
    4548# set DOITPROG to echo to test this script
    4649
    4750# Don't use :- since 4.3BSD and earlier shells don't like it.
    48 doit="${DOITPROG-}"
    49 
    50 # put in absolute paths if you don't have them in your path; or use env. vars.
    51 
    52 mvprog="${MVPROG-mv}"
    53 cpprog="${CPPROG-cp}"
    54 chmodprog="${CHMODPROG-chmod}"
    55 chownprog="${CHOWNPROG-chown}"
    56 chgrpprog="${CHGRPPROG-chgrp}"
    57 stripprog="${STRIPPROG-strip}"
    58 rmprog="${RMPROG-rm}"
    59 mkdirprog="${MKDIRPROG-mkdir}"
    60 
    61 chmodcmd="$chmodprog 0755"
     51doit=${DOITPROG-}
     52if test -z "$doit"; then
     53  doit_exec=exec
     54else
     55  doit_exec=$doit
     56fi
     57
     58# Put in absolute file names if you don't have them in your path;
     59# or use environment vars.
     60
     61chgrpprog=${CHGRPPROG-chgrp}
     62chmodprog=${CHMODPROG-chmod}
     63chownprog=${CHOWNPROG-chown}
     64cmpprog=${CMPPROG-cmp}
     65cpprog=${CPPROG-cp}
     66mkdirprog=${MKDIRPROG-mkdir}
     67mvprog=${MVPROG-mv}
     68rmprog=${RMPROG-rm}
     69stripprog=${STRIPPROG-strip}
     70
     71posix_glob='?'
     72initialize_posix_glob='
     73  test "$posix_glob" != "?" || {
     74    if (set -f) 2>/dev/null; then
     75      posix_glob=
     76    else
     77      posix_glob=:
     78    fi
     79  }
     80'
     81
     82posix_mkdir=
     83
     84# Desired mode of installed file.
     85mode=0755
     86
     87chgrpcmd=
     88chmodcmd=$chmodprog
    6289chowncmd=
    63 chgrpcmd=
     90mvcmd=$mvprog
     91rmcmd="$rmprog -f"
    6492stripcmd=
    65 rmcmd="$rmprog -f"
    66 mvcmd="$mvprog"
     93
    6794src=
    6895dst=
    6996dir_arg=
    70 dstarg=
     97dst_arg=
     98
     99copy_on_change=false
    71100no_target_directory=
    72101
    73 usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
     102usage="\
     103Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
    74104   or: $0 [OPTION]... SRCFILES... DIRECTORY
    75105   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
     
    81111
    82112Options:
    83 -c         (ignored)
    84 -d         create directories instead of installing files.
    85 -g GROUP   $chgrpprog installed files to GROUP.
    86 -m MODE    $chmodprog installed files to MODE.
    87 -o USER    $chownprog installed files to USER.
    88 -s         $stripprog installed files.
    89 -t DIRECTORY  install into DIRECTORY.
    90 -T         report an error if DSTFILE is a directory.
    91 --help     display this help and exit.
    92 --version  display version info and exit.
     113     --help     display this help and exit.
     114     --version  display version info and exit.
     115
     116  -c            (ignored)
     117  -C            install only if different (preserve the last data modification time)
     118  -d            create directories instead of installing files.
     119  -g GROUP      $chgrpprog installed files to GROUP.
     120  -m MODE       $chmodprog installed files to MODE.
     121  -o USER       $chownprog installed files to USER.
     122  -s            $stripprog installed files.
     123  -t DIRECTORY  install into DIRECTORY.
     124  -T            report an error if DSTFILE is a directory.
    93125
    94126Environment variables override the default commands:
    95   CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
     127  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
     128  RMPROG STRIPPROG
    96129"
    97130
    98 while test -n "$1"; do
     131while test $# -ne 0; do
    99132  case $1 in
    100     -c) shift
    101         continue;;
    102 
    103     -d) dir_arg=true
    104         shift
    105         continue;;
     133    -c) ;;
     134
     135    -C) copy_on_change=true;;
     136
     137    -d) dir_arg=true;;
    106138
    107139    -g) chgrpcmd="$chgrpprog $2"
    108         shift
    109         shift
    110         continue;;
     140        shift;;
    111141
    112142    --help) echo "$usage"; exit $?;;
    113143
    114     -m) chmodcmd="$chmodprog $2"
    115         shift
    116         shift
    117         continue;;
     144    -m) mode=$2
     145        case $mode in
     146          *' '* | *'    '* | *'
     147'*        | *'*'* | *'?'* | *'['*)
     148            echo "$0: invalid mode: $mode" >&2
     149            exit 1;;
     150        esac
     151        shift;;
    118152
    119153    -o) chowncmd="$chownprog $2"
    120         shift
    121         shift
    122         continue;;
    123 
    124     -s) stripcmd=$stripprog
    125         shift
    126         continue;;
    127 
    128     -t) dstarg=$2
    129         shift
    130         shift
    131         continue;;
    132 
    133     -T) no_target_directory=true
    134         shift
    135         continue;;
     154        shift;;
     155
     156    -s) stripcmd=$stripprog;;
     157
     158    -t) dst_arg=$2
     159        # Protect names problematic for 'test' and other utilities.
     160        case $dst_arg in
     161          -* | [=\(\)!]) dst_arg=./$dst_arg;;
     162        esac
     163        shift;;
     164
     165    -T) no_target_directory=true;;
    136166
    137167    --version) echo "$0 $scriptversion"; exit $?;;
    138168
    139     *)  # When -d is used, all remaining arguments are directories to create.
    140         # When -t is used, the destination is already specified.
    141         test -n "$dir_arg$dstarg" && break
    142         # Otherwise, the last argument is the destination.  Remove it from $@.
    143         for arg
    144         do
    145           if test -n "$dstarg"; then
    146             # $@ is not empty: it contains at least $arg.
    147             set fnord "$@" "$dstarg"
    148             shift # fnord
    149           fi
    150           shift # arg
    151           dstarg=$arg
    152         done
     169    --) shift
    153170        break;;
     171
     172    -*) echo "$0: invalid option: $1" >&2
     173        exit 1;;
     174
     175    *)  break;;
    154176  esac
     177  shift
    155178done
    156179
    157 if test -z "$1"; then
     180if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     181  # When -d is used, all remaining arguments are directories to create.
     182  # When -t is used, the destination is already specified.
     183  # Otherwise, the last argument is the destination.  Remove it from $@.
     184  for arg
     185  do
     186    if test -n "$dst_arg"; then
     187      # $@ is not empty: it contains at least $arg.
     188      set fnord "$@" "$dst_arg"
     189      shift # fnord
     190    fi
     191    shift # arg
     192    dst_arg=$arg
     193    # Protect names problematic for 'test' and other utilities.
     194    case $dst_arg in
     195      -* | [=\(\)!]) dst_arg=./$dst_arg;;
     196    esac
     197  done
     198fi
     199
     200if test $# -eq 0; then
    158201  if test -z "$dir_arg"; then
    159202    echo "$0: no input file specified." >&2
    160203    exit 1
    161204  fi
    162   # It's OK to call `install-sh -d' without argument.
     205  # It's OK to call 'install-sh -d' without argument.
    163206  # This can happen when creating conditional directories.
    164207  exit 0
    165208fi
    166209
     210if test -z "$dir_arg"; then
     211  do_exit='(exit $ret); exit $ret'
     212  trap "ret=129; $do_exit" 1
     213  trap "ret=130; $do_exit" 2
     214  trap "ret=141; $do_exit" 13
     215  trap "ret=143; $do_exit" 15
     216
     217  # Set umask so as not to create temps with too-generous modes.
     218  # However, 'strip' requires both read and write access to temps.
     219  case $mode in
     220    # Optimize common cases.
     221    *644) cp_umask=133;;
     222    *755) cp_umask=22;;
     223
     224    *[0-7])
     225      if test -z "$stripcmd"; then
     226        u_plus_rw=
     227      else
     228        u_plus_rw='% 200'
     229      fi
     230      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
     231    *)
     232      if test -z "$stripcmd"; then
     233        u_plus_rw=
     234      else
     235        u_plus_rw=,u+rw
     236      fi
     237      cp_umask=$mode$u_plus_rw;;
     238  esac
     239fi
     240
    167241for src
    168242do
    169   # Protect names starting with `-'.
     243  # Protect names problematic for 'test' and other utilities.
    170244  case $src in
    171     -*) src=./$src ;;
     245    -* | [=\(\)!]) src=./$src;;
    172246  esac
    173247
    174248  if test -n "$dir_arg"; then
    175249    dst=$src
    176     src=
    177 
    178     if test -d "$dst"; then
    179       mkdircmd=:
    180       chmodcmd=
    181     else
    182       mkdircmd=$mkdirprog
    183     fi
     250    dstdir=$dst
     251    test -d "$dstdir"
     252    dstdir_status=$?
    184253  else
     254
    185255    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
    186256    # might cause directories to be created, which would be especially bad
     
    191261    fi
    192262
    193     if test -z "$dstarg"; then
     263    if test -z "$dst_arg"; then
    194264      echo "$0: no destination specified." >&2
    195265      exit 1
    196266    fi
    197 
    198     dst=$dstarg
    199     # Protect names starting with `-'.
    200     case $dst in
    201       -*) dst=./$dst ;;
    202     esac
     267    dst=$dst_arg
    203268
    204269    # If destination is a directory, append the input filename; won't work
     
    206271    if test -d "$dst"; then
    207272      if test -n "$no_target_directory"; then
    208         echo "$0: $dstarg: Is a directory" >&2
     273        echo "$0: $dst_arg: Is a directory" >&2
    209274        exit 1
    210275      fi
    211       dst=$dst/`basename "$src"`
     276      dstdir=$dst
     277      dst=$dstdir/`basename "$src"`
     278      dstdir_status=0
     279    else
     280      # Prefer dirname, but fall back on a substitute if dirname fails.
     281      dstdir=`
     282        (dirname "$dst") 2>/dev/null ||
     283        expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
     284             X"$dst" : 'X\(//\)[^/]' \| \
     285             X"$dst" : 'X\(//\)$' \| \
     286             X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
     287        echo X"$dst" |
     288            sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
     289                   s//\1/
     290                   q
     291                 }
     292                 /^X\(\/\/\)[^/].*/{
     293                   s//\1/
     294                   q
     295                 }
     296                 /^X\(\/\/\)$/{
     297                   s//\1/
     298                   q
     299                 }
     300                 /^X\(\/\).*/{
     301                   s//\1/
     302                   q
     303                 }
     304                 s/.*/./; q'
     305      `
     306
     307      test -d "$dstdir"
     308      dstdir_status=$?
    212309    fi
    213310  fi
    214311
    215   # This sed command emulates the dirname command.
    216   dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
    217 
    218   # Make sure that the destination directory exists.
    219 
    220   # Skip lots of stat calls in the usual case.
    221   if test ! -d "$dstdir"; then
    222     defaultIFS='
    223          '
    224     IFS="${IFS-$defaultIFS}"
    225 
    226     oIFS=$IFS
    227     # Some sh's can't handle IFS=/ for some reason.
    228     IFS='%'
    229     set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
    230     shift
    231     IFS=$oIFS
    232 
    233     pathcomp=
    234 
    235     while test $# -ne 0 ; do
    236       pathcomp=$pathcomp$1
     312  obsolete_mkdir_used=false
     313
     314  if test $dstdir_status != 0; then
     315    case $posix_mkdir in
     316      '')
     317        # Create intermediate dirs using mode 755 as modified by the umask.
     318        # This is like FreeBSD 'install' as of 1997-10-28.
     319        umask=`umask`
     320        case $stripcmd.$umask in
     321          # Optimize common cases.
     322          *[2367][2367]) mkdir_umask=$umask;;
     323          .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
     324
     325          *[0-7])
     326            mkdir_umask=`expr $umask + 22 \
     327              - $umask % 100 % 40 + $umask % 20 \
     328              - $umask % 10 % 4 + $umask % 2
     329            `;;
     330          *) mkdir_umask=$umask,go-w;;
     331        esac
     332
     333        # With -d, create the new directory with the user-specified mode.
     334        # Otherwise, rely on $mkdir_umask.
     335        if test -n "$dir_arg"; then
     336          mkdir_mode=-m$mode
     337        else
     338          mkdir_mode=
     339        fi
     340
     341        posix_mkdir=false
     342        case $umask in
     343          *[123567][0-7][0-7])
     344            # POSIX mkdir -p sets u+wx bits regardless of umask, which
     345            # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
     346            ;;
     347          *)
     348            tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
     349            trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
     350
     351            if (umask $mkdir_umask &&
     352                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
     353            then
     354              if test -z "$dir_arg" || {
     355                   # Check for POSIX incompatibilities with -m.
     356                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
     357                   # other-writable bit of parent directory when it shouldn't.
     358                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
     359                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
     360                   case $ls_ld_tmpdir in
     361                     d????-?r-*) different_mode=700;;
     362                     d????-?--*) different_mode=755;;
     363                     *) false;;
     364                   esac &&
     365                   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
     366                     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
     367                     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
     368                   }
     369                 }
     370              then posix_mkdir=:
     371              fi
     372              rmdir "$tmpdir/d" "$tmpdir"
     373            else
     374              # Remove any dirs left behind by ancient mkdir implementations.
     375              rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
     376            fi
     377            trap '' 0;;
     378        esac;;
     379    esac
     380
     381    if
     382      $posix_mkdir && (
     383        umask $mkdir_umask &&
     384        $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
     385      )
     386    then :
     387    else
     388
     389      # The umask is ridiculous, or mkdir does not conform to POSIX,
     390      # or it failed possibly due to a race condition.  Create the
     391      # directory the slow way, step by step, checking for races as we go.
     392
     393      case $dstdir in
     394        /*) prefix='/';;
     395        [-=\(\)!]*) prefix='./';;
     396        *)  prefix='';;
     397      esac
     398
     399      eval "$initialize_posix_glob"
     400
     401      oIFS=$IFS
     402      IFS=/
     403      $posix_glob set -f
     404      set fnord $dstdir
    237405      shift
    238       if test ! -d "$pathcomp"; then
    239         $mkdirprog "$pathcomp"
    240         # mkdir can fail with a `File exist' error in case several
    241         # install-sh are creating the directory concurrently.  This
    242         # is OK.
    243         test -d "$pathcomp" || exit
     406      $posix_glob set +f
     407      IFS=$oIFS
     408
     409      prefixes=
     410
     411      for d
     412      do
     413        test X"$d" = X && continue
     414
     415        prefix=$prefix$d
     416        if test -d "$prefix"; then
     417          prefixes=
     418        else
     419          if $posix_mkdir; then
     420            (umask=$mkdir_umask &&
     421             $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
     422            # Don't fail if two instances are running concurrently.
     423            test -d "$prefix" || exit 1
     424          else
     425            case $prefix in
     426              *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
     427              *) qprefix=$prefix;;
     428            esac
     429            prefixes="$prefixes '$qprefix'"
     430          fi
     431        fi
     432        prefix=$prefix/
     433      done
     434
     435      if test -n "$prefixes"; then
     436        # Don't fail if two instances are running concurrently.
     437        (umask $mkdir_umask &&
     438         eval "\$doit_exec \$mkdirprog $prefixes") ||
     439          test -d "$dstdir" || exit 1
     440        obsolete_mkdir_used=true
    244441      fi
    245       pathcomp=$pathcomp/
    246     done
     442    fi
    247443  fi
    248444
    249445  if test -n "$dir_arg"; then
    250     $doit $mkdircmd "$dst" \
    251       && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
    252       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
    253       && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
    254       && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
    255 
     446    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
     447    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
     448    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
     449      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
    256450  else
    257     dstfile=`basename "$dst"`
    258451
    259452    # Make a couple of temp file names in the proper directory.
     
    263456    # Trap to clean up those temp files at exit.
    264457    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
    265     trap '(exit $?); exit' 1 2 13 15
    266458
    267459    # Copy the file name to the temp name.
    268     $doit $cpprog "$src" "$dsttmp" &&
     460    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
    269461
    270462    # and set any options; do chmod last to preserve setuid bits.
     
    274466    # errors from the above "$doit $cpprog $src $dsttmp" command.
    275467    #
    276     { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
    277       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
    278       && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
    279       && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
    280 
    281     # Now rename the file to the real destination.
    282     { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
    283       || {
    284            # The rename failed, perhaps because mv can't rename something else
    285            # to itself, or perhaps because mv is so ancient that it does not
    286            # support -f.
    287 
    288            # Now remove or move aside any old file at destination location.
    289            # We try this two ways since rm can't unlink itself on some
    290            # systems and the destination file might be busy for other
    291            # reasons.  In this case, the final cleanup might fail but the new
    292            # file should still install successfully.
    293            {
    294              if test -f "$dstdir/$dstfile"; then
    295                $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
    296                || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
    297                || {
    298                  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
    299                  (exit 1); exit 1
    300                }
    301              else
    302                :
    303              fi
    304            } &&
    305 
    306            # Now rename the file to the real destination.
    307            $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
    308          }
    309     }
    310   fi || { (exit 1); exit 1; }
     468    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
     469    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
     470    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
     471    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
     472
     473    # If -C, don't bother to copy if it wouldn't change the file.
     474    if $copy_on_change &&
     475       old=`LC_ALL=C ls -dlL "$dst"     2>/dev/null` &&
     476       new=`LC_ALL=C ls -dlL "$dsttmp"  2>/dev/null` &&
     477
     478       eval "$initialize_posix_glob" &&
     479       $posix_glob set -f &&
     480       set X $old && old=:$2:$4:$5:$6 &&
     481       set X $new && new=:$2:$4:$5:$6 &&
     482       $posix_glob set +f &&
     483
     484       test "$old" = "$new" &&
     485       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
     486    then
     487      rm -f "$dsttmp"
     488    else
     489      # Rename the file to the real destination.
     490      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
     491
     492      # The rename failed, perhaps because mv can't rename something else
     493      # to itself, or perhaps because mv is so ancient that it does not
     494      # support -f.
     495      {
     496        # Now remove or move aside any old file at destination location.
     497        # We try this two ways since rm can't unlink itself on some
     498        # systems and the destination file might be busy for other
     499        # reasons.  In this case, the final cleanup might fail but the new
     500        # file should still install successfully.
     501        {
     502          test ! -f "$dst" ||
     503          $doit $rmcmd -f "$dst" 2>/dev/null ||
     504          { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
     505            { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
     506          } ||
     507          { echo "$0: cannot unlink or rename $dst" >&2
     508            (exit 1); exit 1
     509          }
     510        } &&
     511
     512        # Now rename the file to the real destination.
     513        $doit $mvcmd "$dsttmp" "$dst"
     514      }
     515    fi || exit 1
     516
     517    trap '' 0
     518  fi
    311519done
    312 
    313 # The final little trick to "correctly" pass the exit status to the exit trap.
    314 {
    315   (exit 0); exit 0
    316 }
    317520
    318521# Local variables:
     
    320523# time-stamp-start: "scriptversion="
    321524# time-stamp-format: "%:y-%02m-%02d.%02H"
    322 # time-stamp-end: "$"
     525# time-stamp-time-zone: "UTC"
     526# time-stamp-end: "; # UTC"
    323527# End:
  • branches/autotools-update/install_autotools.sh

    r2552 r2554  
     1#!/bin/sh
    12# script to download and install the autoools versions that we currently use with COIN-OR/BuildTools
    23# original script by Pierre Bonami
     
    45PREFIX=$HOME/local2
    56
     7acver=2.69
     8amver=1.12
     9ltver=2.4.2
     10
     11# exit immediately if something fails
     12set -e
     13
    614# so that we can configure automake with the new (then installed) autoconf
    715export PATH=$PREFIX/bin:$PATH
    816
    917# cleanup from previous (maybe failed) build
    10 rm -rf autoconf-2.68* automake-1.11.3* libtool-2.4.2*
     18rm -rf autoconf-$acver* automake-$amver* libtool-$ltver*
    1119
    12 wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz
    13 tar xvzf autoconf-2.68.tar.gz
    14 cd autoconf-2.68
     20wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-$acver.tar.gz
     21tar xvzf autoconf-$acver.tar.gz
     22cd autoconf-$acver
    1523./configure --prefix=$PREFIX
    1624make install
    1725cd ..
    1826
    19 wget ftp://ftp.gnu.org/gnu/automake/automake-1.11.3.tar.gz
    20 tar xvzf automake-1.11.3.tar.gz
    21 cd automake-1.11.3
     27wget ftp://ftp.gnu.org/gnu/automake/automake-$amver.tar.gz
     28tar xvzf automake-$amver.tar.gz
     29cd automake-$amver
    2230./configure --prefix=$PREFIX
    2331make install
    2432cd ..
    2533
    26 wget ftp://ftp.gnu.org/gnu/libtool/libtool-2.4.2.tar.gz
    27 tar xvzf libtool-2.4.2.tar.gz
    28 cd libtool-2.4.2
     34wget ftp://ftp.gnu.org/gnu/libtool/libtool-$ltver.tar.gz
     35tar xvzf libtool-$ltver.tar.gz
     36cd libtool-$ltver
    2937./configure --prefix=$PREFIX
    3038make install
    3139cd ..
    3240
    33 rm -rf autoconf-2.68* automake-1.11.3* libtool-2.4.2*
     41rm -rf autoconf-$acver* automake-$amver* libtool-$ltver*
  • branches/autotools-update/ltmain.sh

    r2 r2554  
    1 # ltmain.sh - Provide generalized library-building support services.
    2 # NOTE: Changing this file will not affect anything until you rerun configure.
    3 #
    4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
    5 # Free Software Foundation, Inc.
    6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
    7 #
    8 # This program is free software; you can redistribute it and/or modify
     1
     2# libtool (GNU libtool) 2.4.2
     3# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
     4
     5# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
     6# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
     7# This is free software; see the source for copying conditions.  There is NO
     8# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     9
     10# GNU Libtool is free software; you can redistribute it and/or modify
    911# it under the terms of the GNU General Public License as published by
    1012# the Free Software Foundation; either version 2 of the License, or
    1113# (at your option) any later version.
    1214#
    13 # This program is distributed in the hope that it will be useful, but
     15# As a special exception to the GNU General Public License,
     16# if you distribute this file as part of a program or library that
     17# is built using GNU Libtool, you may include this file under the
     18# same distribution terms that you use for the rest of that program.
     19#
     20# GNU Libtool is distributed in the hope that it will be useful, but
    1421# WITHOUT ANY WARRANTY; without even the implied warranty of
    1522# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     
    1724#
    1825# You should have received a copy of the GNU General Public License
    19 # along with this program; if not, write to the Free Software
    20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     26# along with GNU Libtool; see the file COPYING.  If not, a copy
     27# can be downloaded from http://www.gnu.org/licenses/gpl.html,
     28# or obtained by writing to the Free Software Foundation, Inc.,
     29# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     30
     31# Usage: $progname [OPTION]... [MODE-ARG]...
    2132#
    22 # As a special exception to the GNU General Public License, if you
    23 # distribute this file as part of a program that contains a
    24 # configuration script generated by Autoconf, you may include it under
    25 # the same distribution terms that you use for the rest of that program.
    26 
    27 basename="s,^.*/,,g"
     33# Provide generalized library-building support services.
     34#
     35#       --config             show all configuration variables
     36#       --debug              enable verbose shell tracing
     37#   -n, --dry-run            display commands without modifying any files
     38#       --features           display basic configuration information and exit
     39#       --mode=MODE          use operation mode MODE
     40#       --preserve-dup-deps  don't remove duplicate dependency libraries
     41#       --quiet, --silent    don't print informational messages
     42#       --no-quiet, --no-silent
     43#                            print informational messages (default)
     44#       --no-warn            don't display warning messages
     45#       --tag=TAG            use configuration variables from tag TAG
     46#   -v, --verbose            print more informational messages than default
     47#       --no-verbose         don't print the extra informational messages
     48#       --version            print version information
     49#   -h, --help, --help-all   print short, long, or detailed help message
     50#
     51# MODE must be one of the following:
     52#
     53#         clean              remove files from the build directory
     54#         compile            compile a source file into a libtool object
     55#         execute            automatically set library path, then run a program
     56#         finish             complete the installation of libtool libraries
     57#         install            install libraries or executables
     58#         link               create a library or an executable
     59#         uninstall          remove libraries from an installed directory
     60#
     61# MODE-ARGS vary depending on the MODE.  When passed as first option,
     62# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
     63# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
     64#
     65# When reporting a bug, please describe a test case to reproduce it and
     66# include the following information:
     67#
     68#         host-triplet: $host
     69#         shell:                $SHELL
     70#         compiler:             $LTCC
     71#         compiler flags:               $LTCFLAGS
     72#         linker:               $LD (gnu? $with_gnu_ld)
     73#         $progname:    (GNU libtool) 2.4.2
     74#         automake:     $automake_version
     75#         autoconf:     $autoconf_version
     76#
     77# Report bugs to <bug-libtool@gnu.org>.
     78# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
     79# General help using GNU software: <http://www.gnu.org/gethelp/>.
     80
     81PROGRAM=libtool
     82PACKAGE=libtool
     83VERSION=2.4.2
     84TIMESTAMP=""
     85package_revision=1.3337
     86
     87# Be Bourne compatible
     88if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
     89  emulate sh
     90  NULLCMD=:
     91  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
     92  # is contrary to our usage.  Disable this feature.
     93  alias -g '${1+"$@"}'='"$@"'
     94  setopt NO_GLOB_SUBST
     95else
     96  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
     97fi
     98BIN_SH=xpg4; export BIN_SH # for Tru64
     99DUALCASE=1; export DUALCASE # for MKS sh
     100
     101# A function that is used when there is no print builtin or printf.
     102func_fallback_echo ()
     103{
     104  eval 'cat <<_LTECHO_EOF
     105$1
     106_LTECHO_EOF'
     107}
     108
     109# NLS nuisances: We save the old values to restore during execute mode.
     110lt_user_locale=
     111lt_safe_locale=
     112for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
     113do
     114  eval "if test \"\${$lt_var+set}\" = set; then
     115          save_$lt_var=\$$lt_var
     116          $lt_var=C
     117          export $lt_var
     118          lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
     119          lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
     120        fi"
     121done
     122LC_ALL=C
     123LANGUAGE=C
     124export LANGUAGE LC_ALL
     125
     126$lt_unset CDPATH
     127
    28128
    29129# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
     
    34134progpath="$0"
    35135
    36 # The name of this program:
    37 progname=`echo "$progpath" | $SED $basename`
    38 modename="$progname"
     136
     137
     138: ${CP="cp -f"}
     139test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
     140: ${MAKE="make"}
     141: ${MKDIR="mkdir"}
     142: ${MV="mv -f"}
     143: ${RM="rm -f"}
     144: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
     145: ${Xsed="$SED -e 1s/^X//"}
    39146
    40147# Global variables:
    41148EXIT_SUCCESS=0
    42149EXIT_FAILURE=1
    43 
    44 PROGRAM=ltmain.sh
    45 PACKAGE=libtool
    46 VERSION=1.5.22
    47 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
    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
    52   setopt NO_GLOB_SUBST
    53 fi
    54 
    55 # Check that we have a working $echo.
    56 if test "X$1" = X--no-reexec; then
    57   # Discard the --no-reexec flag, and continue.
    58   shift
    59 elif test "X$1" = X--fallback-echo; then
    60   # Avoid inline document here, it may be left over
    61   :
    62 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
    63   # Yippee, $echo works!
    64   :
    65 else
    66   # Restart under the correct shell, and then maybe $echo will work.
    67   exec $SHELL "$progpath" --no-reexec ${1+"$@"}
    68 fi
    69 
    70 if test "X$1" = X--fallback-echo; then
    71   # used as fallback echo
    72   shift
    73   cat <<EOF
    74 $*
    75 EOF
    76   exit $EXIT_SUCCESS
    77 fi
    78 
    79 default_mode=
    80 help="Try \`$progname --help' for more information."
    81 magic="%%%MAGIC variable%%%"
    82 mkdir="mkdir"
    83 mv="mv -f"
    84 rm="rm -f"
    85 
    86 # Sed substitution that helps us do robust quoting.  It backslashifies
    87 # metacharacters that are still active within double-quoted strings.
    88 Xsed="${SED}"' -e 1s/^X//'
    89 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
    90 # test EBCDIC or ASCII
    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'
    96   ;;
    97  *) # EBCDIC based system
    98   SP2NL='tr \100 \n'
    99   NL2SP='tr \r\n \100\100'
    100   ;;
    101 esac
    102 
    103 # NLS nuisances.
    104 # Only set LANG and LC_ALL to C if already set.
    105 # These must not be set unconditionally because not all systems understand
    106 # e.g. LANG=C (notably SCO).
    107 # 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
     150EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
     151EXIT_SKIP=77      # $? = 77 is used to indicate a skipped test to automake.
     152
     153exit_status=$EXIT_SUCCESS
    114154
    115155# Make sure IFS has a sensible default
     
    118158IFS="   $lt_nl"
    119159
    120 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
    121   $echo "$modename: not configured to build any kind of library" 1>&2
    122   $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
    123   exit $EXIT_FAILURE
    124 fi
    125 
    126 # Global variables.
    127 mode=$default_mode
    128 nonopt=
    129 prev=
    130 prevopt=
    131 run=
    132 show="$echo"
    133 show_help=
    134 execute_dlfiles=
    135 duplicate_deps=no
    136 preserve_args=
    137 lo2o="s/\\.lo\$/.${objext}/"
    138 o2lo="s/\\.${objext}\$/.lo/"
    139 
    140 #####################################
    141 # Shell function definitions:
    142 # This seems to be the best place for them
     160dirname="s,/[^/]*$,,"
     161basename="s,^.*/,,"
     162
     163# func_dirname file append nondir_replacement
     164# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
     165# otherwise set result to NONDIR_REPLACEMENT.
     166func_dirname ()
     167{
     168    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
     169    if test "X$func_dirname_result" = "X${1}"; then
     170      func_dirname_result="${3}"
     171    else
     172      func_dirname_result="$func_dirname_result${2}"
     173    fi
     174} # func_dirname may be replaced by extended shell implementation
     175
     176
     177# func_basename file
     178func_basename ()
     179{
     180    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
     181} # func_basename may be replaced by extended shell implementation
     182
     183
     184# func_dirname_and_basename file append nondir_replacement
     185# perform func_basename and func_dirname in a single function
     186# call:
     187#   dirname:  Compute the dirname of FILE.  If nonempty,
     188#             add APPEND to the result, otherwise set result
     189#             to NONDIR_REPLACEMENT.
     190#             value returned in "$func_dirname_result"
     191#   basename: Compute filename of FILE.
     192#             value retuned in "$func_basename_result"
     193# Implementation must be kept synchronized with func_dirname
     194# and func_basename. For efficiency, we do not delegate to
     195# those functions but instead duplicate the functionality here.
     196func_dirname_and_basename ()
     197{
     198    # Extract subdirectory from the argument.
     199    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
     200    if test "X$func_dirname_result" = "X${1}"; then
     201      func_dirname_result="${3}"
     202    else
     203      func_dirname_result="$func_dirname_result${2}"
     204    fi
     205    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
     206} # func_dirname_and_basename may be replaced by extended shell implementation
     207
     208
     209# func_stripname prefix suffix name
     210# strip PREFIX and SUFFIX off of NAME.
     211# PREFIX and SUFFIX must not contain globbing or regex special
     212# characters, hashes, percent signs, but SUFFIX may contain a leading
     213# dot (in which case that matches only a dot).
     214# func_strip_suffix prefix name
     215func_stripname ()
     216{
     217    case ${2} in
     218      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
     219      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
     220    esac
     221} # func_stripname may be replaced by extended shell implementation
     222
     223
     224# These SED scripts presuppose an absolute path with a trailing slash.
     225pathcar='s,^/\([^/]*\).*$,\1,'
     226pathcdr='s,^/[^/]*,,'
     227removedotparts=':dotsl
     228                s@/\./@/@g
     229                t dotsl
     230                s,/\.$,/,'
     231collapseslashes='s@/\{1,\}@/@g'
     232finalslash='s,/*$,/,'
     233
     234# func_normal_abspath PATH
     235# Remove doubled-up and trailing slashes, "." path components,
     236# and cancel out any ".." path components in PATH after making
     237# it an absolute path.
     238#             value returned in "$func_normal_abspath_result"
     239func_normal_abspath ()
     240{
     241  # Start from root dir and reassemble the path.
     242  func_normal_abspath_result=
     243  func_normal_abspath_tpath=$1
     244  func_normal_abspath_altnamespace=
     245  case $func_normal_abspath_tpath in
     246    "")
     247      # Empty path, that just means $cwd.
     248      func_stripname '' '/' "`pwd`"
     249      func_normal_abspath_result=$func_stripname_result
     250      return
     251    ;;
     252    # The next three entries are used to spot a run of precisely
     253    # two leading slashes without using negated character classes;
     254    # we take advantage of case's first-match behaviour.
     255    ///*)
     256      # Unusual form of absolute path, do nothing.
     257    ;;
     258    //*)
     259      # Not necessarily an ordinary path; POSIX reserves leading '//'
     260      # and for example Cygwin uses it to access remote file shares
     261      # over CIFS/SMB, so we conserve a leading double slash if found.
     262      func_normal_abspath_altnamespace=/
     263    ;;
     264    /*)
     265      # Absolute path, do nothing.
     266    ;;
     267    *)
     268      # Relative path, prepend $cwd.
     269      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
     270    ;;
     271  esac
     272  # Cancel out all the simple stuff to save iterations.  We also want
     273  # the path to end with a slash for ease of parsing, so make sure
     274  # there is one (and only one) here.
     275  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
     276        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
     277  while :; do
     278    # Processed it all yet?
     279    if test "$func_normal_abspath_tpath" = / ; then
     280      # If we ascended to the root using ".." the result may be empty now.
     281      if test -z "$func_normal_abspath_result" ; then
     282        func_normal_abspath_result=/
     283      fi
     284      break
     285    fi
     286    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
     287        -e "$pathcar"`
     288    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
     289        -e "$pathcdr"`
     290    # Figure out what to do with it
     291    case $func_normal_abspath_tcomponent in
     292      "")
     293        # Trailing empty path component, ignore it.
     294      ;;
     295      ..)
     296        # Parent dir; strip last assembled component from result.
     297        func_dirname "$func_normal_abspath_result"
     298        func_normal_abspath_result=$func_dirname_result
     299      ;;
     300      *)
     301        # Actual path component, append it.
     302        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
     303      ;;
     304    esac
     305  done
     306  # Restore leading double-slash if one was found on entry.
     307  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
     308}
     309
     310# func_relative_path SRCDIR DSTDIR
     311# generates a relative path from SRCDIR to DSTDIR, with a trailing
     312# slash if non-empty, suitable for immediately appending a filename
     313# without needing to append a separator.
     314#             value returned in "$func_relative_path_result"
     315func_relative_path ()
     316{
     317  func_relative_path_result=
     318  func_normal_abspath "$1"
     319  func_relative_path_tlibdir=$func_normal_abspath_result
     320  func_normal_abspath "$2"
     321  func_relative_path_tbindir=$func_normal_abspath_result
     322
     323  # Ascend the tree starting from libdir
     324  while :; do
     325    # check if we have found a prefix of bindir
     326    case $func_relative_path_tbindir in
     327      $func_relative_path_tlibdir)
     328        # found an exact match
     329        func_relative_path_tcancelled=
     330        break
     331        ;;
     332      $func_relative_path_tlibdir*)
     333        # found a matching prefix
     334        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
     335        func_relative_path_tcancelled=$func_stripname_result
     336        if test -z "$func_relative_path_result"; then
     337          func_relative_path_result=.
     338        fi
     339        break
     340        ;;
     341      *)
     342        func_dirname $func_relative_path_tlibdir
     343        func_relative_path_tlibdir=${func_dirname_result}
     344        if test "x$func_relative_path_tlibdir" = x ; then
     345          # Have to descend all the way to the root!
     346          func_relative_path_result=../$func_relative_path_result
     347          func_relative_path_tcancelled=$func_relative_path_tbindir
     348          break
     349        fi
     350        func_relative_path_result=../$func_relative_path_result
     351        ;;
     352    esac
     353  done
     354
     355  # Now calculate path; take care to avoid doubling-up slashes.
     356  func_stripname '' '/' "$func_relative_path_result"
     357  func_relative_path_result=$func_stripname_result
     358  func_stripname '/' '/' "$func_relative_path_tcancelled"
     359  if test "x$func_stripname_result" != x ; then
     360    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
     361  fi
     362
     363  # Normalisation. If bindir is libdir, return empty string,
     364  # else relative path ending with a slash; either way, target
     365  # file name can be directly appended.
     366  if test ! -z "$func_relative_path_result"; then
     367    func_stripname './' '' "$func_relative_path_result/"
     368    func_relative_path_result=$func_stripname_result
     369  fi
     370}
     371
     372# The name of this program:
     373func_dirname_and_basename "$progpath"
     374progname=$func_basename_result
     375
     376# Make sure we have an absolute path for reexecution:
     377case $progpath in
     378  [\\/]*|[A-Za-z]:\\*) ;;
     379  *[\\/]*)
     380     progdir=$func_dirname_result
     381     progdir=`cd "$progdir" && pwd`
     382     progpath="$progdir/$progname"
     383     ;;
     384  *)
     385     save_IFS="$IFS"
     386     IFS=${PATH_SEPARATOR-:}
     387     for progdir in $PATH; do
     388       IFS="$save_IFS"
     389       test -x "$progdir/$progname" && break
     390     done
     391     IFS="$save_IFS"
     392     test -n "$progdir" || progdir=`pwd`
     393     progpath="$progdir/$progname"
     394     ;;
     395esac
     396
     397# Sed substitution that helps us do robust quoting.  It backslashifies
     398# metacharacters that are still active within double-quoted strings.
     399Xsed="${SED}"' -e 1s/^X//'
     400sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
     401
     402# Same as above, but do not quote variable references.
     403double_quote_subst='s/\(["`\\]\)/\\\1/g'
     404
     405# Sed substitution that turns a string into a regex matching for the
     406# string literally.
     407sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
     408
     409# Sed substitution that converts a w32 file name or path
     410# which contains forward slashes, into one that contains
     411# (escaped) backslashes.  A very naive implementation.
     412lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
     413
     414# Re-`\' parameter expansions in output of double_quote_subst that were
     415# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
     416# in input to double_quote_subst, that '$' was protected from expansion.
     417# Since each input `\' is now two `\'s, look for any number of runs of
     418# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
     419bs='\\'
     420bs2='\\\\'
     421bs4='\\\\\\\\'
     422dollar='\$'
     423sed_double_backslash="\
     424  s/$bs4/&\\
     425/g
     426  s/^$bs2$dollar/$bs&/
     427  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
     428  s/\n//g"
     429
     430# Standard options:
     431opt_dry_run=false
     432opt_help=false
     433opt_quiet=false
     434opt_verbose=false
     435opt_warning=:
     436
     437# func_echo arg...
     438# Echo program name prefixed message, along with the current mode
     439# name if it has been set yet.
     440func_echo ()
     441{
     442    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
     443}
     444
     445# func_verbose arg...
     446# Echo program name prefixed message in verbose mode only.
     447func_verbose ()
     448{
     449    $opt_verbose && func_echo ${1+"$@"}
     450
     451    # A bug in bash halts the script if the last line of a function
     452    # fails when set -e is in force, so we need another command to
     453    # work around that:
     454    :
     455}
     456
     457# func_echo_all arg...
     458# Invoke $ECHO with all args, space-separated.
     459func_echo_all ()
     460{
     461    $ECHO "$*"
     462}
     463
     464# func_error arg...
     465# Echo program name prefixed message to standard error.
     466func_error ()
     467{
     468    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
     469}
     470
     471# func_warning arg...
     472# Echo program name prefixed warning message to standard error.
     473func_warning ()
     474{
     475    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
     476
     477    # bash bug again:
     478    :
     479}
     480
     481# func_fatal_error arg...
     482# Echo program name prefixed message to standard error, and exit.
     483func_fatal_error ()
     484{
     485    func_error ${1+"$@"}
     486    exit $EXIT_FAILURE
     487}
     488
     489# func_fatal_help arg...
     490# Echo program name prefixed message to standard error, followed by
     491# a help hint, and exit.
     492func_fatal_help ()
     493{
     494    func_error ${1+"$@"}
     495    func_fatal_error "$help"
     496}
     497help="Try \`$progname --help' for more information."  ## default
     498
     499
     500# func_grep expression filename
     501# Check whether EXPRESSION matches any line of FILENAME, without output.
     502func_grep ()
     503{
     504    $GREP "$1" "$2" >/dev/null 2>&1
     505}
     506
     507
     508# func_mkdir_p directory-path
     509# Make sure the entire path to DIRECTORY-PATH is available.
     510func_mkdir_p ()
     511{
     512    my_directory_path="$1"
     513    my_dir_list=
     514
     515    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
     516
     517      # Protect directory names starting with `-'
     518      case $my_directory_path in
     519        -*) my_directory_path="./$my_directory_path" ;;
     520      esac
     521
     522      # While some portion of DIR does not yet exist...
     523      while test ! -d "$my_directory_path"; do
     524        # ...make a list in topmost first order.  Use a colon delimited
     525        # list incase some portion of path contains whitespace.
     526        my_dir_list="$my_directory_path:$my_dir_list"
     527
     528        # If the last portion added has no slash in it, the list is done
     529        case $my_directory_path in */*) ;; *) break ;; esac
     530
     531        # ...otherwise throw away the child directory and loop
     532        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
     533      done
     534      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
     535
     536      save_mkdir_p_IFS="$IFS"; IFS=':'
     537      for my_dir in $my_dir_list; do
     538        IFS="$save_mkdir_p_IFS"
     539        # mkdir can fail with a `File exist' error if two processes
     540        # try to create one of the directories concurrently.  Don't
     541        # stop in that case!
     542        $MKDIR "$my_dir" 2>/dev/null || :
     543      done
     544      IFS="$save_mkdir_p_IFS"
     545
     546      # Bail out if we (or some other process) failed to create a directory.
     547      test -d "$my_directory_path" || \
     548        func_fatal_error "Failed to create \`$1'"
     549    fi
     550}
     551
    143552
    144553# func_mktempdir [string]
     
    150559    my_template="${TMPDIR-/tmp}/${1-$progname}"
    151560
    152     if test "$run" = ":"; then
     561    if test "$opt_dry_run" = ":"; then
    153562      # Return a directory name, but don't create it in dry-run mode
    154563      my_tmpdir="${my_template}-$$"
     
    159568
    160569      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
     570        # Failing that, at least try and use $RANDOM to avoid a race
     571        my_tmpdir="${my_template}-${RANDOM-0}$$"
     572
     573        save_mktempdir_umask=`umask`
     574        umask 0077
     575        $MKDIR "$my_tmpdir"
     576        umask $save_mktempdir_umask
    168577      fi
    169578
    170579      # 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
     580      test -d "$my_tmpdir" || \
     581        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
     582    fi
     583
     584    $ECHO "$my_tmpdir"
     585}
     586
     587
     588# func_quote_for_eval arg
     589# Aesthetically quote ARG to be evaled later.
     590# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
     591# is double-quoted, suitable for a subsequent eval, whereas
     592# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
     593# which are still active within double quotes backslashified.
     594func_quote_for_eval ()
     595{
     596    case $1 in
     597      *[\\\`\"\$]*)
     598        func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
     599      *)
     600        func_quote_for_eval_unquoted_result="$1" ;;
     601    esac
     602
     603    case $func_quote_for_eval_unquoted_result in
     604      # Double-quote args containing shell metacharacters to delay
     605      # word splitting, command substitution and and variable
     606      # expansion for a subsequent eval.
     607      # Many Bourne shells cannot handle close brackets correctly
     608      # in scan sets, so we specify it separately.
     609      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
     610        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
     611        ;;
     612      *)
     613        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
     614    esac
     615}
     616
     617
     618# func_quote_for_expand arg
     619# Aesthetically quote ARG to be evaled later; same as above,
     620# but do not quote variable references.
     621func_quote_for_expand ()
     622{
     623    case $1 in
     624      *[\\\`\"]*)
     625        my_arg=`$ECHO "$1" | $SED \
     626            -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
     627      *)
     628        my_arg="$1" ;;
     629    esac
     630
     631    case $my_arg in
     632      # Double-quote args containing shell metacharacters to delay
     633      # word splitting and command substitution for a subsequent eval.
     634      # Many Bourne shells cannot handle close brackets correctly
     635      # in scan sets, so we specify it separately.
     636      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
     637        my_arg="\"$my_arg\""
     638        ;;
     639    esac
     640
     641    func_quote_for_expand_result="$my_arg"
     642}
     643
     644
     645# func_show_eval cmd [fail_exp]
     646# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
     647# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
     648# is given, then evaluate it.
     649func_show_eval ()
     650{
     651    my_cmd="$1"
     652    my_fail_exp="${2-:}"
     653
     654    ${opt_silent-false} || {
     655      func_quote_for_expand "$my_cmd"
     656      eval "func_echo $func_quote_for_expand_result"
     657    }
     658
     659    if ${opt_dry_run-false}; then :; else
     660      eval "$my_cmd"
     661      my_status=$?
     662      if test "$my_status" -eq 0; then :; else
     663        eval "(exit $my_status); $my_fail_exp"
     664      fi
     665    fi
     666}
     667
     668
     669# func_show_eval_locale cmd [fail_exp]
     670# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
     671# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
     672# is given, then evaluate it.  Use the saved locale for evaluation.
     673func_show_eval_locale ()
     674{
     675    my_cmd="$1"
     676    my_fail_exp="${2-:}"
     677
     678    ${opt_silent-false} || {
     679      func_quote_for_expand "$my_cmd"
     680      eval "func_echo $func_quote_for_expand_result"
     681    }
     682
     683    if ${opt_dry_run-false}; then :; else
     684      eval "$lt_user_locale
     685            $my_cmd"
     686      my_status=$?
     687      eval "$lt_safe_locale"
     688      if test "$my_status" -eq 0; then :; else
     689        eval "(exit $my_status); $my_fail_exp"
     690      fi
     691    fi
     692}
     693
     694# func_tr_sh
     695# Turn $1 into a string suitable for a shell variable name.
     696# Result is stored in $func_tr_sh_result.  All characters
     697# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
     698# if $1 begins with a digit, a '_' is prepended as well.
     699func_tr_sh ()
     700{
     701  case $1 in
     702  [0-9]* | *[!a-zA-Z0-9_]*)
     703    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
     704    ;;
     705  * )
     706    func_tr_sh_result=$1
     707    ;;
     708  esac
     709}
     710
     711
     712# func_version
     713# Echo version message to standard output and exit.
     714func_version ()
     715{
     716    $opt_debug
     717
     718    $SED -n '/(C)/!b go
     719        :more
     720        /\./!{
     721          N
     722          s/\n# / /
     723          b more
     724        }
     725        :go
     726        /^# '$PROGRAM' (GNU /,/# warranty; / {
     727        s/^# //
     728        s/^# *$//
     729        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
     730        p
     731     }' < "$progpath"
     732     exit $?
     733}
     734
     735# func_usage
     736# Echo short help message to standard output and exit.
     737func_usage ()
     738{
     739    $opt_debug
     740
     741    $SED -n '/^# Usage:/,/^#  *.*--help/ {
     742        s/^# //
     743        s/^# *$//
     744        s/\$progname/'$progname'/
     745        p
     746    }' < "$progpath"
     747    echo
     748    $ECHO "run \`$progname --help | more' for full usage"
     749    exit $?
     750}
     751
     752# func_help [NOEXIT]
     753# Echo long help message to standard output and exit,
     754# unless 'noexit' is passed as argument.
     755func_help ()
     756{
     757    $opt_debug
     758
     759    $SED -n '/^# Usage:/,/# Report bugs to/ {
     760        :print
     761        s/^# //
     762        s/^# *$//
     763        s*\$progname*'$progname'*
     764        s*\$host*'"$host"'*
     765        s*\$SHELL*'"$SHELL"'*
     766        s*\$LTCC*'"$LTCC"'*
     767        s*\$LTCFLAGS*'"$LTCFLAGS"'*
     768        s*\$LD*'"$LD"'*
     769        s/\$with_gnu_ld/'"$with_gnu_ld"'/
     770        s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
     771        s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
     772        p
     773        d
     774     }
     775     /^# .* home page:/b print
     776     /^# General help using/b print
     777     ' < "$progpath"
     778    ret=$?
     779    if test -z "$1"; then
     780      exit $ret
     781    fi
     782}
     783
     784# func_missing_arg argname
     785# Echo program name prefixed message to standard error and set global
     786# exit_cmd.
     787func_missing_arg ()
     788{
     789    $opt_debug
     790
     791    func_error "missing argument for $1."
     792    exit_cmd=exit
     793}
     794
     795
     796# func_split_short_opt shortopt
     797# Set func_split_short_opt_name and func_split_short_opt_arg shell
     798# variables after splitting SHORTOPT after the 2nd character.
     799func_split_short_opt ()
     800{
     801    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
     802    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
     803
     804    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
     805    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
     806} # func_split_short_opt may be replaced by extended shell implementation
     807
     808
     809# func_split_long_opt longopt
     810# Set func_split_long_opt_name and func_split_long_opt_arg shell
     811# variables after splitting LONGOPT at the `=' sign.
     812func_split_long_opt ()
     813{
     814    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
     815    my_sed_long_arg='1s/^--[^=]*=//'
     816
     817    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
     818    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
     819} # func_split_long_opt may be replaced by extended shell implementation
     820
     821exit_cmd=:
     822
     823
     824
     825
     826
     827magic="%%%MAGIC variable%%%"
     828magic_exe="%%%MAGIC EXE variable%%%"
     829
     830# Global variables.
     831nonopt=
     832preserve_args=
     833lo2o="s/\\.lo\$/.${objext}/"
     834o2lo="s/\\.${objext}\$/.lo/"
     835extracted_archives=
     836extracted_serial=0
     837
     838# If this variable is set in any of the actions, the command in it
     839# will be execed at the end.  This prevents here-documents from being
     840# left over by shells.
     841exec_cmd=
     842
     843# func_append var value
     844# Append VALUE to the end of shell variable VAR.
     845func_append ()
     846{
     847    eval "${1}=\$${1}\${2}"
     848} # func_append may be replaced by extended shell implementation
     849
     850# func_append_quoted var value
     851# Quote VALUE and append to the end of shell variable VAR, separated
     852# by a space.
     853func_append_quoted ()
     854{
     855    func_quote_for_eval "${2}"
     856    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
     857} # func_append_quoted may be replaced by extended shell implementation
     858
     859
     860# func_arith arithmetic-term...
     861func_arith ()
     862{
     863    func_arith_result=`expr "${@}"`
     864} # func_arith may be replaced by extended shell implementation
     865
     866
     867# func_len string
     868# STRING may not start with a hyphen.
     869func_len ()
     870{
     871    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
     872} # func_len may be replaced by extended shell implementation
     873
     874
     875# func_lo2o object
     876func_lo2o ()
     877{
     878    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
     879} # func_lo2o may be replaced by extended shell implementation
     880
     881
     882# func_xform libobj-or-source
     883func_xform ()
     884{
     885    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
     886} # func_xform may be replaced by extended shell implementation
     887
     888
     889# func_fatal_configuration arg...
     890# Echo program name prefixed message to standard error, followed by
     891# a configuration failure hint, and exit.
     892func_fatal_configuration ()
     893{
     894    func_error ${1+"$@"}
     895    func_error "See the $PACKAGE documentation for more information."
     896    func_fatal_error "Fatal configuration error."
     897}
     898
     899
     900# func_config
     901# Display the configuration for all the tags in this script.
     902func_config ()
     903{
     904    re_begincf='^# ### BEGIN LIBTOOL'
     905    re_endcf='^# ### END LIBTOOL'
     906
     907    # Default configuration.
     908    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
     909
     910    # Now print the configurations for the tags.
     911    for tagname in $taglist; do
     912      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
     913    done
     914
     915    exit $?
     916}
     917
     918# func_features
     919# Display the features supported by this script.
     920func_features ()
     921{
     922    echo "host: $host"
     923    if test "$build_libtool_libs" = yes; then
     924      echo "enable shared libraries"
     925    else
     926      echo "disable shared libraries"
     927    fi
     928    if test "$build_old_libs" = yes; then
     929      echo "enable static libraries"
     930    else
     931      echo "disable static libraries"
     932    fi
     933
     934    exit $?
     935}
     936
     937# func_enable_tag tagname
     938# Verify that TAGNAME is valid, and either flag an error and exit, or
     939# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
     940# variable here.
     941func_enable_tag ()
     942{
     943  # Global variable:
     944  tagname="$1"
     945
     946  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
     947  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
     948  sed_extractcf="/$re_begincf/,/$re_endcf/p"
     949
     950  # Validate tagname.
     951  case $tagname in
     952    *[!-_A-Za-z0-9,/]*)
     953      func_fatal_error "invalid tag name: $tagname"
     954      ;;
     955  esac
     956
     957  # Don't test for the "default" C tag, as we know it's
     958  # there but not specially marked.
     959  case $tagname in
     960    CC) ;;
     961    *)
     962      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
     963        taglist="$taglist $tagname"
     964
     965        # Evaluate the configuration.  Be careful to quote the path
     966        # and the sed script, to avoid splitting on whitespace, but
     967        # also don't use non-portable quotes within backquotes within
     968        # quotes we have to do it in 2 steps:
     969        extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
     970        eval "$extractedcf"
     971      else
     972        func_error "ignoring unknown tag $tagname"
     973      fi
     974      ;;
     975  esac
     976}
     977
     978# func_check_version_match
     979# Ensure that we are using m4 macros, and libtool script from the same
     980# release of libtool.
     981func_check_version_match ()
     982{
     983  if test "$package_revision" != "$macro_revision"; then
     984    if test "$VERSION" != "$macro_version"; then
     985      if test -z "$macro_version"; then
     986        cat >&2 <<_LT_EOF
     987$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
     988$progname: definition of this LT_INIT comes from an older release.
     989$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
     990$progname: and run autoconf again.
     991_LT_EOF
     992      else
     993        cat >&2 <<_LT_EOF
     994$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
     995$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
     996$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
     997$progname: and run autoconf again.
     998_LT_EOF
     999      fi
     1000    else
     1001      cat >&2 <<_LT_EOF
     1002$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
     1003$progname: but the definition of this LT_INIT comes from revision $macro_revision.
     1004$progname: You should recreate aclocal.m4 with macros from revision $package_revision
     1005$progname: of $PACKAGE $VERSION and run autoconf again.
     1006_LT_EOF
     1007    fi
     1008
     1009    exit $EXIT_MISMATCH
     1010  fi
     1011}
     1012
     1013
     1014# Shorthand for --mode=foo, only valid as the first argument
     1015case $1 in
     1016clean|clea|cle|cl)
     1017  shift; set dummy --mode clean ${1+"$@"}; shift
     1018  ;;
     1019compile|compil|compi|comp|com|co|c)
     1020  shift; set dummy --mode compile ${1+"$@"}; shift
     1021  ;;
     1022execute|execut|execu|exec|exe|ex|e)
     1023  shift; set dummy --mode execute ${1+"$@"}; shift
     1024  ;;
     1025finish|finis|fini|fin|fi|f)
     1026  shift; set dummy --mode finish ${1+"$@"}; shift
     1027  ;;
     1028install|instal|insta|inst|ins|in|i)
     1029  shift; set dummy --mode install ${1+"$@"}; shift
     1030  ;;
     1031link|lin|li|l)
     1032  shift; set dummy --mode link ${1+"$@"}; shift
     1033  ;;
     1034uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
     1035  shift; set dummy --mode uninstall ${1+"$@"}; shift
     1036  ;;
     1037esac
     1038
     1039
     1040
     1041# Option defaults:
     1042opt_debug=:
     1043opt_dry_run=false
     1044opt_config=false
     1045opt_preserve_dup_deps=false
     1046opt_features=false
     1047opt_finish=false
     1048opt_help=false
     1049opt_help_all=false
     1050opt_silent=:
     1051opt_warning=:
     1052opt_verbose=:
     1053opt_silent=false
     1054opt_verbose=false
     1055
     1056
     1057# Parse options once, thoroughly.  This comes as soon as possible in the
     1058# script to make things like `--version' happen as quickly as we can.
     1059{
     1060  # this just eases exit handling
     1061  while test $# -gt 0; do
     1062    opt="$1"
     1063    shift
     1064    case $opt in
     1065      --debug|-x)       opt_debug='set -x'
     1066                        func_echo "enabling shell trace mode"
     1067                        $opt_debug
     1068                        ;;
     1069      --dry-run|--dryrun|-n)
     1070                        opt_dry_run=:
     1071                        ;;
     1072      --config)
     1073                        opt_config=:
     1074func_config
     1075                        ;;
     1076      --dlopen|-dlopen)
     1077                        optarg="$1"
     1078                        opt_dlopen="${opt_dlopen+$opt_dlopen
     1079}$optarg"
     1080                        shift
     1081                        ;;
     1082      --preserve-dup-deps)
     1083                        opt_preserve_dup_deps=:
     1084                        ;;
     1085      --features)
     1086                        opt_features=:
     1087func_features
     1088                        ;;
     1089      --finish)
     1090                        opt_finish=:
     1091set dummy --mode finish ${1+"$@"}; shift
     1092                        ;;
     1093      --help)
     1094                        opt_help=:
     1095                        ;;
     1096      --help-all)
     1097                        opt_help_all=:
     1098opt_help=': help-all'
     1099                        ;;
     1100      --mode)
     1101                        test $# = 0 && func_missing_arg $opt && break
     1102                        optarg="$1"
     1103                        opt_mode="$optarg"
     1104case $optarg in
     1105  # Valid mode arguments:
     1106  clean|compile|execute|finish|install|link|relink|uninstall) ;;
     1107
     1108  # Catch anything else as an error
     1109  *) func_error "invalid argument for $opt"
     1110     exit_cmd=exit
     1111     break
     1112     ;;
     1113esac
     1114                        shift
     1115                        ;;
     1116      --no-silent|--no-quiet)
     1117                        opt_silent=false
     1118func_append preserve_args " $opt"
     1119                        ;;
     1120      --no-warning|--no-warn)
     1121                        opt_warning=false
     1122func_append preserve_args " $opt"
     1123                        ;;
     1124      --no-verbose)
     1125                        opt_verbose=false
     1126func_append preserve_args " $opt"
     1127                        ;;
     1128      --silent|--quiet)
     1129                        opt_silent=:
     1130func_append preserve_args " $opt"
     1131        opt_verbose=false
     1132                        ;;
     1133      --verbose|-v)
     1134                        opt_verbose=:
     1135func_append preserve_args " $opt"
     1136opt_silent=false
     1137                        ;;
     1138      --tag)
     1139                        test $# = 0 && func_missing_arg $opt && break
     1140                        optarg="$1"
     1141                        opt_tag="$optarg"
     1142func_append preserve_args " $opt $optarg"
     1143func_enable_tag "$optarg"
     1144                        shift
     1145                        ;;
     1146
     1147      -\?|-h)           func_usage                              ;;
     1148      --help)           func_help                               ;;
     1149      --version)        func_version                            ;;
     1150
     1151      # Separate optargs to long options:
     1152      --*=*)
     1153                        func_split_long_opt "$opt"
     1154                        set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
     1155                        shift
     1156                        ;;
     1157
     1158      # Separate non-argument short options:
     1159      -\?*|-h*|-n*|-v*)
     1160                        func_split_short_opt "$opt"
     1161                        set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
     1162                        shift
     1163                        ;;
     1164
     1165      --)               break                                   ;;
     1166      -*)               func_fatal_help "unrecognized option \`$opt'" ;;
     1167      *)                set dummy "$opt" ${1+"$@"};     shift; break  ;;
     1168    esac
     1169  done
     1170
     1171  # Validate options:
     1172
     1173  # save first non-option argument
     1174  if test "$#" -gt 0; then
     1175    nonopt="$opt"
     1176    shift
     1177  fi
     1178
     1179  # preserve --debug
     1180  test "$opt_debug" = : || func_append preserve_args " --debug"
     1181
     1182  case $host in
     1183    *cygwin* | *mingw* | *pw32* | *cegcc*)
     1184      # don't eliminate duplications in $postdeps and $predeps
     1185      opt_duplicate_compiler_generated_deps=:
     1186      ;;
     1187    *)
     1188      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
     1189      ;;
     1190  esac
     1191
     1192  $opt_help || {
     1193    # Sanity checks first:
     1194    func_check_version_match
     1195
     1196    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
     1197      func_fatal_configuration "not configured to build any kind of library"
     1198    fi
     1199
     1200    # Darwin sucks
     1201    eval std_shrext=\"$shrext_cmds\"
     1202
     1203    # Only execute mode is allowed to have -dlopen flags.
     1204    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
     1205      func_error "unrecognized option \`-dlopen'"
     1206      $ECHO "$help" 1>&2
     1207      exit $EXIT_FAILURE
     1208    fi
     1209
     1210    # Change the help message to a mode-specific one.
     1211    generic_help="$help"
     1212    help="Try \`$progname --help --mode=$opt_mode' for more information."
     1213  }
     1214
     1215
     1216  # Bail if the options were screwed
     1217  $exit_cmd $EXIT_FAILURE
     1218}
     1219
     1220
     1221
     1222
     1223## ----------- ##
     1224##    Main.    ##
     1225## ----------- ##
     1226
     1227# func_lalib_p file
     1228# True iff FILE is a libtool `.la' library or `.lo' object file.
     1229# This function is only a basic sanity check; it will hardly flush out
     1230# determined imposters.
     1231func_lalib_p ()
     1232{
     1233    test -f "$1" &&
     1234      $SED -e 4q "$1" 2>/dev/null \
     1235        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
     1236}
     1237
     1238# func_lalib_unsafe_p file
     1239# True iff FILE is a libtool `.la' library or `.lo' object file.
     1240# This function implements the same check as func_lalib_p without
     1241# resorting to external programs.  To this end, it redirects stdin and
     1242# closes it afterwards, without saving the original file descriptor.
     1243# As a safety measure, use it only where a negative result would be
     1244# fatal anyway.  Works if `file' does not exist.
     1245func_lalib_unsafe_p ()
     1246{
     1247    lalib_p=no
     1248    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
     1249        for lalib_p_l in 1 2 3 4
     1250        do
     1251            read lalib_p_line
     1252            case "$lalib_p_line" in
     1253                \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
     1254            esac
     1255        done
     1256        exec 0<&5 5<&-
     1257    fi
     1258    test "$lalib_p" = yes
     1259}
     1260
     1261# func_ltwrapper_script_p file
     1262# True iff FILE is a libtool wrapper script
     1263# This function is only a basic sanity check; it will hardly flush out
     1264# determined imposters.
     1265func_ltwrapper_script_p ()
     1266{
     1267    func_lalib_p "$1"
     1268}
     1269
     1270# func_ltwrapper_executable_p file
     1271# True iff FILE is a libtool wrapper executable
     1272# This function is only a basic sanity check; it will hardly flush out
     1273# determined imposters.
     1274func_ltwrapper_executable_p ()
     1275{
     1276    func_ltwrapper_exec_suffix=
     1277    case $1 in
     1278    *.exe) ;;
     1279    *) func_ltwrapper_exec_suffix=.exe ;;
     1280    esac
     1281    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
     1282}
     1283
     1284# func_ltwrapper_scriptname file
     1285# Assumes file is an ltwrapper_executable
     1286# uses $file to determine the appropriate filename for a
     1287# temporary ltwrapper_script.
     1288func_ltwrapper_scriptname ()
     1289{
     1290    func_dirname_and_basename "$1" "" "."
     1291    func_stripname '' '.exe' "$func_basename_result"
     1292    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
     1293}
     1294
     1295# func_ltwrapper_p file
     1296# True iff FILE is a libtool wrapper script or wrapper executable
     1297# This function is only a basic sanity check; it will hardly flush out
     1298# determined imposters.
     1299func_ltwrapper_p ()
     1300{
     1301    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
     1302}
     1303
     1304
     1305# func_execute_cmds commands fail_cmd
     1306# Execute tilde-delimited COMMANDS.
     1307# If FAIL_CMD is given, eval that upon failure.
     1308# FAIL_CMD may read-access the current command in variable CMD!
     1309func_execute_cmds ()
     1310{
     1311    $opt_debug
     1312    save_ifs=$IFS; IFS='~'
     1313    for cmd in $1; do
     1314      IFS=$save_ifs
     1315      eval cmd=\"$cmd\"
     1316      func_show_eval "$cmd" "${2-:}"
     1317    done
     1318    IFS=$save_ifs
     1319}
     1320
     1321
     1322# func_source file
     1323# Source FILE, adding directory component if necessary.
     1324# Note that it is not necessary on cygwin/mingw to append a dot to
     1325# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
     1326# behavior happens only for exec(3), not for open(2)!  Also, sourcing
     1327# `FILE.' does not work on cygwin managed mounts.
     1328func_source ()
     1329{
     1330    $opt_debug
     1331    case $1 in
     1332    */* | *\\*) . "$1" ;;
     1333    *)          . "./$1" ;;
     1334    esac
     1335}
     1336
     1337
     1338# func_resolve_sysroot PATH
     1339# Replace a leading = in PATH with a sysroot.  Store the result into
     1340# func_resolve_sysroot_result
     1341func_resolve_sysroot ()
     1342{
     1343  func_resolve_sysroot_result=$1
     1344  case $func_resolve_sysroot_result in
     1345  =*)
     1346    func_stripname '=' '' "$func_resolve_sysroot_result"
     1347    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
     1348    ;;
     1349  esac
     1350}
     1351
     1352# func_replace_sysroot PATH
     1353# If PATH begins with the sysroot, replace it with = and
     1354# store the result into func_replace_sysroot_result.
     1355func_replace_sysroot ()
     1356{
     1357  case "$lt_sysroot:$1" in
     1358  ?*:"$lt_sysroot"*)
     1359    func_stripname "$lt_sysroot" '' "$1"
     1360    func_replace_sysroot_result="=$func_stripname_result"
     1361    ;;
     1362  *)
     1363    # Including no sysroot.
     1364    func_replace_sysroot_result=$1
     1365    ;;
     1366  esac
     1367}
     1368
     1369# func_infer_tag arg
     1370# Infer tagged configuration to use if any are available and
     1371# if one wasn't chosen via the "--tag" command line option.
     1372# Only attempt this if the compiler in the base compile
     1373# command doesn't match the default compiler.
     1374# arg is usually of the form 'gcc ...'
     1375func_infer_tag ()
     1376{
     1377    $opt_debug
     1378    if test -n "$available_tags" && test -z "$tagname"; then
     1379      CC_quoted=
     1380      for arg in $CC; do
     1381        func_append_quoted CC_quoted "$arg"
     1382      done
     1383      CC_expanded=`func_echo_all $CC`
     1384      CC_quoted_expanded=`func_echo_all $CC_quoted`
     1385      case $@ in
     1386      # Blanks in the command may have been stripped by the calling shell,
     1387      # but not from the CC environment variable when configure was run.
     1388      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
     1389      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
     1390      # Blanks at the start of $base_compile will cause this to fail
     1391      # if we don't check for them as well.
     1392      *)
     1393        for z in $available_tags; do
     1394          if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
     1395            # Evaluate the configuration.
     1396            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
     1397            CC_quoted=
     1398            for arg in $CC; do
     1399              # Double-quote args containing other shell metacharacters.
     1400              func_append_quoted CC_quoted "$arg"
     1401            done
     1402            CC_expanded=`func_echo_all $CC`
     1403            CC_quoted_expanded=`func_echo_all $CC_quoted`
     1404            case "$@ " in
     1405            " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
     1406            " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
     1407              # The compiler in the base compile command matches
     1408              # the one in the tagged configuration.
     1409              # Assume this is the tagged configuration we want.
     1410              tagname=$z
     1411              break
     1412              ;;
     1413            esac
     1414          fi
     1415        done
     1416        # If $tagname still isn't set, then no tagged configuration
     1417        # was found and let the user know that the "--tag" command
     1418        # line option must be used.
     1419        if test -z "$tagname"; then
     1420          func_echo "unable to infer tagged configuration"
     1421          func_fatal_error "specify a tag with \`--tag'"
     1422#       else
     1423#         func_verbose "using $tagname tagged configuration"
     1424        fi
     1425        ;;
     1426      esac
     1427    fi
     1428}
     1429
     1430
     1431
     1432# func_write_libtool_object output_name pic_name nonpic_name
     1433# Create a libtool object file (analogous to a ".la" file),
     1434# but don't create it if we're doing a dry run.
     1435func_write_libtool_object ()
     1436{
     1437    write_libobj=${1}
     1438    if test "$build_libtool_libs" = yes; then
     1439      write_lobj=\'${2}\'
     1440    else
     1441      write_lobj=none
     1442    fi
     1443
     1444    if test "$build_old_libs" = yes; then
     1445      write_oldobj=\'${3}\'
     1446    else
     1447      write_oldobj=none
     1448    fi
     1449
     1450    $opt_dry_run || {
     1451      cat >${write_libobj}T <<EOF
     1452# $write_libobj - a libtool object file
     1453# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
     1454#
     1455# Please DO NOT delete this file!
     1456# It is necessary for linking the library.
     1457
     1458# Name of the PIC object.
     1459pic_object=$write_lobj
     1460
     1461# Name of the non-PIC object
     1462non_pic_object=$write_oldobj
     1463
     1464EOF
     1465      $MV "${write_libobj}T" "${write_libobj}"
     1466    }
     1467}
     1468
     1469
     1470##################################################
     1471# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
     1472##################################################
     1473
     1474# func_convert_core_file_wine_to_w32 ARG
     1475# Helper function used by file name conversion functions when $build is *nix,
     1476# and $host is mingw, cygwin, or some other w32 environment. Relies on a
     1477# correctly configured wine environment available, with the winepath program
     1478# in $build's $PATH.
     1479#
     1480# ARG is the $build file name to be converted to w32 format.
     1481# Result is available in $func_convert_core_file_wine_to_w32_result, and will
     1482# be empty on error (or when ARG is empty)
     1483func_convert_core_file_wine_to_w32 ()
     1484{
     1485  $opt_debug
     1486  func_convert_core_file_wine_to_w32_result="$1"
     1487  if test -n "$1"; then
     1488    # Unfortunately, winepath does not exit with a non-zero error code, so we
     1489    # are forced to check the contents of stdout. On the other hand, if the
     1490    # command is not found, the shell will set an exit code of 127 and print
     1491    # *an error message* to stdout. So we must check for both error code of
     1492    # zero AND non-empty stdout, which explains the odd construction:
     1493    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
     1494    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
     1495      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
     1496        $SED -e "$lt_sed_naive_backslashify"`
     1497    else
     1498      func_convert_core_file_wine_to_w32_result=
     1499    fi
     1500  fi
     1501}
     1502# end: func_convert_core_file_wine_to_w32
     1503
     1504
     1505# func_convert_core_path_wine_to_w32 ARG
     1506# Helper function used by path conversion functions when $build is *nix, and
     1507# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
     1508# configured wine environment available, with the winepath program in $build's
     1509# $PATH. Assumes ARG has no leading or trailing path separator characters.
     1510#
     1511# ARG is path to be converted from $build format to win32.
     1512# Result is available in $func_convert_core_path_wine_to_w32_result.
     1513# Unconvertible file (directory) names in ARG are skipped; if no directory names
     1514# are convertible, then the result may be empty.
     1515func_convert_core_path_wine_to_w32 ()
     1516{
     1517  $opt_debug
     1518  # unfortunately, winepath doesn't convert paths, only file names
     1519  func_convert_core_path_wine_to_w32_result=""
     1520  if test -n "$1"; then
     1521    oldIFS=$IFS
     1522    IFS=:
     1523    for func_convert_core_path_wine_to_w32_f in $1; do
     1524      IFS=$oldIFS
     1525      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
     1526      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
     1527        if test -z "$func_convert_core_path_wine_to_w32_result"; then
     1528          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
     1529        else
     1530          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
     1531        fi
     1532      fi
     1533    done
     1534    IFS=$oldIFS
     1535  fi
     1536}
     1537# end: func_convert_core_path_wine_to_w32
     1538
     1539
     1540# func_cygpath ARGS...
     1541# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
     1542# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
     1543# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
     1544# (2), returns the Cygwin file name or path in func_cygpath_result (input
     1545# file name or path is assumed to be in w32 format, as previously converted
     1546# from $build's *nix or MSYS format). In case (3), returns the w32 file name
     1547# or path in func_cygpath_result (input file name or path is assumed to be in
     1548# Cygwin format). Returns an empty string on error.
     1549#
     1550# ARGS are passed to cygpath, with the last one being the file name or path to
     1551# be converted.
     1552#
     1553# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
     1554# environment variable; do not put it in $PATH.
     1555func_cygpath ()
     1556{
     1557  $opt_debug
     1558  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
     1559    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
     1560    if test "$?" -ne 0; then
     1561      # on failure, ensure result is empty
     1562      func_cygpath_result=
     1563    fi
     1564  else
     1565    func_cygpath_result=
     1566    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
     1567  fi
     1568}
     1569#end: func_cygpath
     1570
     1571
     1572# func_convert_core_msys_to_w32 ARG
     1573# Convert file name or path ARG from MSYS format to w32 format.  Return
     1574# result in func_convert_core_msys_to_w32_result.
     1575func_convert_core_msys_to_w32 ()
     1576{
     1577  $opt_debug
     1578  # awkward: cmd appends spaces to result
     1579  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
     1580    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
     1581}
     1582#end: func_convert_core_msys_to_w32
     1583
     1584
     1585# func_convert_file_check ARG1 ARG2
     1586# Verify that ARG1 (a file name in $build format) was converted to $host
     1587# format in ARG2. Otherwise, emit an error message, but continue (resetting
     1588# func_to_host_file_result to ARG1).
     1589func_convert_file_check ()
     1590{
     1591  $opt_debug
     1592  if test -z "$2" && test -n "$1" ; then
     1593    func_error "Could not determine host file name corresponding to"
     1594    func_error "  \`$1'"
     1595    func_error "Continuing, but uninstalled executables may not work."
     1596    # Fallback:
     1597    func_to_host_file_result="$1"
     1598  fi
     1599}
     1600# end func_convert_file_check
     1601
     1602
     1603# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
     1604# Verify that FROM_PATH (a path in $build format) was converted to $host
     1605# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
     1606# func_to_host_file_result to a simplistic fallback value (see below).
     1607func_convert_path_check ()
     1608{
     1609  $opt_debug
     1610  if test -z "$4" && test -n "$3"; then
     1611    func_error "Could not determine the host path corresponding to"
     1612    func_error "  \`$3'"
     1613    func_error "Continuing, but uninstalled executables may not work."
     1614    # Fallback.  This is a deliberately simplistic "conversion" and
     1615    # should not be "improved".  See libtool.info.
     1616    if test "x$1" != "x$2"; then
     1617      lt_replace_pathsep_chars="s|$1|$2|g"
     1618      func_to_host_path_result=`echo "$3" |
     1619        $SED -e "$lt_replace_pathsep_chars"`
     1620    else
     1621      func_to_host_path_result="$3"
     1622    fi
     1623  fi
     1624}
     1625# end func_convert_path_check
     1626
     1627
     1628# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
     1629# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
     1630# and appending REPL if ORIG matches BACKPAT.
     1631func_convert_path_front_back_pathsep ()
     1632{
     1633  $opt_debug
     1634  case $4 in
     1635  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
     1636    ;;
     1637  esac
     1638  case $4 in
     1639  $2 ) func_append func_to_host_path_result "$3"
     1640    ;;
     1641  esac
     1642}
     1643# end func_convert_path_front_back_pathsep
     1644
     1645
     1646##################################################
     1647# $build to $host FILE NAME CONVERSION FUNCTIONS #
     1648##################################################
     1649# invoked via `$to_host_file_cmd ARG'
     1650#
     1651# In each case, ARG is the path to be converted from $build to $host format.
     1652# Result will be available in $func_to_host_file_result.
     1653
     1654
     1655# func_to_host_file ARG
     1656# Converts the file name ARG from $build format to $host format. Return result
     1657# in func_to_host_file_result.
     1658func_to_host_file ()
     1659{
     1660  $opt_debug
     1661  $to_host_file_cmd "$1"
     1662}
     1663# end func_to_host_file
     1664
     1665
     1666# func_to_tool_file ARG LAZY
     1667# converts the file name ARG from $build format to toolchain format. Return
     1668# result in func_to_tool_file_result.  If the conversion in use is listed
     1669# in (the comma separated) LAZY, no conversion takes place.
     1670func_to_tool_file ()
     1671{
     1672  $opt_debug
     1673  case ,$2, in
     1674    *,"$to_tool_file_cmd",*)
     1675      func_to_tool_file_result=$1
     1676      ;;
     1677    *)
     1678      $to_tool_file_cmd "$1"
     1679      func_to_tool_file_result=$func_to_host_file_result
     1680      ;;
     1681  esac
     1682}
     1683# end func_to_tool_file
     1684
     1685
     1686# func_convert_file_noop ARG
     1687# Copy ARG to func_to_host_file_result.
     1688func_convert_file_noop ()
     1689{
     1690  func_to_host_file_result="$1"
     1691}
     1692# end func_convert_file_noop
     1693
     1694
     1695# func_convert_file_msys_to_w32 ARG
     1696# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
     1697# conversion to w32 is not available inside the cwrapper.  Returns result in
     1698# func_to_host_file_result.
     1699func_convert_file_msys_to_w32 ()
     1700{
     1701  $opt_debug
     1702  func_to_host_file_result="$1"
     1703  if test -n "$1"; then
     1704    func_convert_core_msys_to_w32 "$1"
     1705    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
     1706  fi
     1707  func_convert_file_check "$1" "$func_to_host_file_result"
     1708}
     1709# end func_convert_file_msys_to_w32
     1710
     1711
     1712# func_convert_file_cygwin_to_w32 ARG
     1713# Convert file name ARG from Cygwin to w32 format.  Returns result in
     1714# func_to_host_file_result.
     1715func_convert_file_cygwin_to_w32 ()
     1716{
     1717  $opt_debug
     1718  func_to_host_file_result="$1"
     1719  if test -n "$1"; then
     1720    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
     1721    # LT_CYGPATH in this case.
     1722    func_to_host_file_result=`cygpath -m "$1"`
     1723  fi
     1724  func_convert_file_check "$1" "$func_to_host_file_result"
     1725}
     1726# end func_convert_file_cygwin_to_w32
     1727
     1728
     1729# func_convert_file_nix_to_w32 ARG
     1730# Convert file name ARG from *nix to w32 format.  Requires a wine environment
     1731# and a working winepath. Returns result in func_to_host_file_result.
     1732func_convert_file_nix_to_w32 ()
     1733{
     1734  $opt_debug
     1735  func_to_host_file_result="$1"
     1736  if test -n "$1"; then
     1737    func_convert_core_file_wine_to_w32 "$1"
     1738    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
     1739  fi
     1740  func_convert_file_check "$1" "$func_to_host_file_result"
     1741}
     1742# end func_convert_file_nix_to_w32
     1743
     1744
     1745# func_convert_file_msys_to_cygwin ARG
     1746# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
     1747# Returns result in func_to_host_file_result.
     1748func_convert_file_msys_to_cygwin ()
     1749{
     1750  $opt_debug
     1751  func_to_host_file_result="$1"
     1752  if test -n "$1"; then
     1753    func_convert_core_msys_to_w32 "$1"
     1754    func_cygpath -u "$func_convert_core_msys_to_w32_result"
     1755    func_to_host_file_result="$func_cygpath_result"
     1756  fi
     1757  func_convert_file_check "$1" "$func_to_host_file_result"
     1758}
     1759# end func_convert_file_msys_to_cygwin
     1760
     1761
     1762# func_convert_file_nix_to_cygwin ARG
     1763# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
     1764# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
     1765# in func_to_host_file_result.
     1766func_convert_file_nix_to_cygwin ()
     1767{
     1768  $opt_debug
     1769  func_to_host_file_result="$1"
     1770  if test -n "$1"; then
     1771    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
     1772    func_convert_core_file_wine_to_w32 "$1"
     1773    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
     1774    func_to_host_file_result="$func_cygpath_result"
     1775  fi
     1776  func_convert_file_check "$1" "$func_to_host_file_result"
     1777}
     1778# end func_convert_file_nix_to_cygwin
     1779
     1780
     1781#############################################
     1782# $build to $host PATH CONVERSION FUNCTIONS #
     1783#############################################
     1784# invoked via `$to_host_path_cmd ARG'
     1785#
     1786# In each case, ARG is the path to be converted from $build to $host format.
     1787# The result will be available in $func_to_host_path_result.
     1788#
     1789# Path separators are also converted from $build format to $host format.  If
     1790# ARG begins or ends with a path separator character, it is preserved (but
     1791# converted to $host format) on output.
     1792#
     1793# All path conversion functions are named using the following convention:
     1794#   file name conversion function    : func_convert_file_X_to_Y ()
     1795#   path conversion function         : func_convert_path_X_to_Y ()
     1796# where, for any given $build/$host combination the 'X_to_Y' value is the
     1797# same.  If conversion functions are added for new $build/$host combinations,
     1798# the two new functions must follow this pattern, or func_init_to_host_path_cmd
     1799# will break.
     1800
     1801
     1802# func_init_to_host_path_cmd
     1803# Ensures that function "pointer" variable $to_host_path_cmd is set to the
     1804# appropriate value, based on the value of $to_host_file_cmd.
     1805to_host_path_cmd=
     1806func_init_to_host_path_cmd ()
     1807{
     1808  $opt_debug
     1809  if test -z "$to_host_path_cmd"; then
     1810    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
     1811    to_host_path_cmd="func_convert_path_${func_stripname_result}"
     1812  fi
     1813}
     1814
     1815
     1816# func_to_host_path ARG
     1817# Converts the path ARG from $build format to $host format. Return result
     1818# in func_to_host_path_result.
     1819func_to_host_path ()
     1820{
     1821  $opt_debug
     1822  func_init_to_host_path_cmd
     1823  $to_host_path_cmd "$1"
     1824}
     1825# end func_to_host_path
     1826
     1827
     1828# func_convert_path_noop ARG
     1829# Copy ARG to func_to_host_path_result.
     1830func_convert_path_noop ()
     1831{
     1832  func_to_host_path_result="$1"
     1833}
     1834# end func_convert_path_noop
     1835
     1836
     1837# func_convert_path_msys_to_w32 ARG
     1838# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
     1839# conversion to w32 is not available inside the cwrapper.  Returns result in
     1840# func_to_host_path_result.
     1841func_convert_path_msys_to_w32 ()
     1842{
     1843  $opt_debug
     1844  func_to_host_path_result="$1"
     1845  if test -n "$1"; then
     1846    # Remove leading and trailing path separator characters from ARG.  MSYS
     1847    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
     1848    # and winepath ignores them completely.
     1849    func_stripname : : "$1"
     1850    func_to_host_path_tmp1=$func_stripname_result
     1851    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
     1852    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
     1853    func_convert_path_check : ";" \
     1854      "$func_to_host_path_tmp1" "$func_to_host_path_result"
     1855    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
     1856  fi
     1857}
     1858# end func_convert_path_msys_to_w32
     1859
     1860
     1861# func_convert_path_cygwin_to_w32 ARG
     1862# Convert path ARG from Cygwin to w32 format.  Returns result in
     1863# func_to_host_file_result.
     1864func_convert_path_cygwin_to_w32 ()
     1865{
     1866  $opt_debug
     1867  func_to_host_path_result="$1"
     1868  if test -n "$1"; then
     1869    # See func_convert_path_msys_to_w32:
     1870    func_stripname : : "$1"
     1871    func_to_host_path_tmp1=$func_stripname_result
     1872    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
     1873    func_convert_path_check : ";" \
     1874      "$func_to_host_path_tmp1" "$func_to_host_path_result"
     1875    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
     1876  fi
     1877}
     1878# end func_convert_path_cygwin_to_w32
     1879
     1880
     1881# func_convert_path_nix_to_w32 ARG
     1882# Convert path ARG from *nix to w32 format.  Requires a wine environment and
     1883# a working winepath.  Returns result in func_to_host_file_result.
     1884func_convert_path_nix_to_w32 ()
     1885{
     1886  $opt_debug
     1887  func_to_host_path_result="$1"
     1888  if test -n "$1"; then
     1889    # See func_convert_path_msys_to_w32:
     1890    func_stripname : : "$1"
     1891    func_to_host_path_tmp1=$func_stripname_result
     1892    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
     1893    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
     1894    func_convert_path_check : ";" \
     1895      "$func_to_host_path_tmp1" "$func_to_host_path_result"
     1896    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
     1897  fi
     1898}
     1899# end func_convert_path_nix_to_w32
     1900
     1901
     1902# func_convert_path_msys_to_cygwin ARG
     1903# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
     1904# Returns result in func_to_host_file_result.
     1905func_convert_path_msys_to_cygwin ()
     1906{
     1907  $opt_debug
     1908  func_to_host_path_result="$1"
     1909  if test -n "$1"; then
     1910    # See func_convert_path_msys_to_w32:
     1911    func_stripname : : "$1"
     1912    func_to_host_path_tmp1=$func_stripname_result
     1913    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
     1914    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
     1915    func_to_host_path_result="$func_cygpath_result"
     1916    func_convert_path_check : : \
     1917      "$func_to_host_path_tmp1" "$func_to_host_path_result"
     1918    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
     1919  fi
     1920}
     1921# end func_convert_path_msys_to_cygwin
     1922
     1923
     1924# func_convert_path_nix_to_cygwin ARG
     1925# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
     1926# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
     1927# func_to_host_file_result.
     1928func_convert_path_nix_to_cygwin ()
     1929{
     1930  $opt_debug
     1931  func_to_host_path_result="$1"
     1932  if test -n "$1"; then
     1933    # Remove leading and trailing path separator characters from
     1934    # ARG. msys behavior is inconsistent here, cygpath turns them
     1935    # into '.;' and ';.', and winepath ignores them completely.
     1936    func_stripname : : "$1"
     1937    func_to_host_path_tmp1=$func_stripname_result
     1938    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
     1939    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
     1940    func_to_host_path_result="$func_cygpath_result"
     1941    func_convert_path_check : : \
     1942      "$func_to_host_path_tmp1" "$func_to_host_path_result"
     1943    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
     1944  fi
     1945}
     1946# end func_convert_path_nix_to_cygwin
     1947
     1948
     1949# func_mode_compile arg...
     1950func_mode_compile ()
     1951{
     1952    $opt_debug
     1953    # Get the compilation command and the source file.
     1954    base_compile=
     1955    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
     1956    suppress_opt=yes
     1957    suppress_output=
     1958    arg_mode=normal
     1959    libobj=
     1960    later=
     1961    pie_flag=
     1962
     1963    for arg
     1964    do
     1965      case $arg_mode in
     1966      arg  )
     1967        # do not "continue".  Instead, add this to base_compile
     1968        lastarg="$arg"
     1969        arg_mode=normal
     1970        ;;
     1971
     1972      target )
     1973        libobj="$arg"
     1974        arg_mode=normal
     1975        continue
     1976        ;;
     1977
     1978      normal )
     1979        # Accept any command-line options.
     1980        case $arg in
     1981        -o)
     1982          test -n "$libobj" && \
     1983            func_fatal_error "you cannot specify \`-o' more than once"
     1984          arg_mode=target
     1985          continue
     1986          ;;
     1987
     1988        -pie | -fpie | -fPIE)
     1989          func_append pie_flag " $arg"
     1990          continue
     1991          ;;
     1992
     1993        -shared | -static | -prefer-pic | -prefer-non-pic)
     1994          func_append later " $arg"
     1995          continue
     1996          ;;
     1997
     1998        -no-suppress)
     1999          suppress_opt=no
     2000          continue
     2001          ;;
     2002
     2003        -Xcompiler)
     2004          arg_mode=arg  #  the next one goes into the "base_compile" arg list
     2005          continue      #  The current "srcfile" will either be retained or
     2006          ;;            #  replaced later.  I would guess that would be a bug.
     2007
     2008        -Wc,*)
     2009          func_stripname '-Wc,' '' "$arg"
     2010          args=$func_stripname_result
     2011          lastarg=
     2012          save_ifs="$IFS"; IFS=','
     2013          for arg in $args; do
     2014            IFS="$save_ifs"
     2015            func_append_quoted lastarg "$arg"
     2016          done
     2017          IFS="$save_ifs"
     2018          func_stripname ' ' '' "$lastarg"
     2019          lastarg=$func_stripname_result
     2020
     2021          # Add the arguments to base_compile.
     2022          func_append base_compile " $lastarg"
     2023          continue
     2024          ;;
     2025
     2026        *)
     2027          # Accept the current argument as the source file.
     2028          # The previous "srcfile" becomes the current argument.
     2029          #
     2030          lastarg="$srcfile"
     2031          srcfile="$arg"
     2032          ;;
     2033        esac  #  case $arg
     2034        ;;
     2035      esac    #  case $arg_mode
     2036
     2037      # Aesthetically quote the previous argument.
     2038      func_append_quoted base_compile "$lastarg"
     2039    done # for arg
     2040
     2041    case $arg_mode in
     2042    arg)
     2043      func_fatal_error "you must specify an argument for -Xcompile"
     2044      ;;
     2045    target)
     2046      func_fatal_error "you must specify a target with \`-o'"
     2047      ;;
     2048    *)
     2049      # Get the name of the library object.
     2050      test -z "$libobj" && {
     2051        func_basename "$srcfile"
     2052        libobj="$func_basename_result"
     2053      }
     2054      ;;
     2055    esac
     2056
     2057    # Recognize several different file suffixes.
     2058    # If the user specifies -o file.o, it is replaced with file.lo
     2059    case $libobj in
     2060    *.[cCFSifmso] | \
     2061    *.ada | *.adb | *.ads | *.asm | \
     2062    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
     2063    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
     2064      func_xform "$libobj"
     2065      libobj=$func_xform_result
     2066      ;;
     2067    esac
     2068
     2069    case $libobj in
     2070    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
     2071    *)
     2072      func_fatal_error "cannot determine name of library object from \`$libobj'"
     2073      ;;
     2074    esac
     2075
     2076    func_infer_tag $base_compile
     2077
     2078    for arg in $later; do
     2079      case $arg in
     2080      -shared)
     2081        test "$build_libtool_libs" != yes && \
     2082          func_fatal_configuration "can not build a shared library"
     2083        build_old_libs=no
     2084        continue
     2085        ;;
     2086
     2087      -static)
     2088        build_libtool_libs=no
     2089        build_old_libs=yes
     2090        continue
     2091        ;;
     2092
     2093      -prefer-pic)
     2094        pic_mode=yes
     2095        continue
     2096        ;;
     2097
     2098      -prefer-non-pic)
     2099        pic_mode=no
     2100        continue
     2101        ;;
     2102      esac
     2103    done
     2104
     2105    func_quote_for_eval "$libobj"
     2106    test "X$libobj" != "X$func_quote_for_eval_result" \
     2107      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'    &()|`$[]' \
     2108      && func_warning "libobj name \`$libobj' may not contain shell special characters."
     2109    func_dirname_and_basename "$obj" "/" ""
     2110    objname="$func_basename_result"
     2111    xdir="$func_dirname_result"
     2112    lobj=${xdir}$objdir/$objname
     2113
     2114    test -z "$base_compile" && \
     2115      func_fatal_help "you must specify a compilation command"
     2116
     2117    # Delete any leftover library objects.
     2118    if test "$build_old_libs" = yes; then
     2119      removelist="$obj $lobj $libobj ${libobj}T"
     2120    else
     2121      removelist="$lobj $libobj ${libobj}T"
     2122    fi
     2123
     2124    # On Cygwin there's no "real" PIC flag so we must build both object types
     2125    case $host_os in
     2126    cygwin* | mingw* | pw32* | os2* | cegcc*)
     2127      pic_mode=default
     2128      ;;
     2129    esac
     2130    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
     2131      # non-PIC code in shared libraries is not supported
     2132      pic_mode=default
     2133    fi
     2134
     2135    # Calculate the filename of the output object if compiler does
     2136    # not support -o with -c
     2137    if test "$compiler_c_o" = no; then
     2138      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
     2139      lockfile="$output_obj.lock"
     2140    else
     2141      output_obj=
     2142      need_locks=no
     2143      lockfile=
     2144    fi
     2145
     2146    # Lock this critical section if it is needed
     2147    # We use this script file to make the link, it avoids creating a new file
     2148    if test "$need_locks" = yes; then
     2149      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
     2150        func_echo "Waiting for $lockfile to be removed"
     2151        sleep 2
     2152      done
     2153    elif test "$need_locks" = warn; then
     2154      if test -f "$lockfile"; then
     2155        $ECHO "\
     2156*** ERROR, $lockfile exists and contains:
     2157`cat $lockfile 2>/dev/null`
     2158
     2159This indicates that another process is trying to use the same
     2160temporary object file, and libtool could not work around it because
     2161your compiler does not support \`-c' and \`-o' together.  If you
     2162repeat this compilation, it may succeed, by chance, but you had better
     2163avoid parallel builds (make -j) in this platform, or get a better
     2164compiler."
     2165
     2166        $opt_dry_run || $RM $removelist
    1732167        exit $EXIT_FAILURE
     2168      fi
     2169      func_append removelist " $output_obj"
     2170      $ECHO "$srcfile" > "$lockfile"
     2171    fi
     2172
     2173    $opt_dry_run || $RM $removelist
     2174    func_append removelist " $lockfile"
     2175    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
     2176
     2177    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
     2178    srcfile=$func_to_tool_file_result
     2179    func_quote_for_eval "$srcfile"
     2180    qsrcfile=$func_quote_for_eval_result
     2181
     2182    # Only build a PIC object if we are building libtool libraries.
     2183    if test "$build_libtool_libs" = yes; then
     2184      # Without this assignment, base_compile gets emptied.
     2185      fbsd_hideous_sh_bug=$base_compile
     2186
     2187      if test "$pic_mode" != no; then
     2188        command="$base_compile $qsrcfile $pic_flag"
     2189      else
     2190        # Don't build PIC code
     2191        command="$base_compile $qsrcfile"
     2192      fi
     2193
     2194      func_mkdir_p "$xdir$objdir"
     2195
     2196      if test -z "$output_obj"; then
     2197        # Place PIC objects in $objdir
     2198        func_append command " -o $lobj"
     2199      fi
     2200
     2201      func_show_eval_locale "$command"  \
     2202          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
     2203
     2204      if test "$need_locks" = warn &&
     2205         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
     2206        $ECHO "\
     2207*** ERROR, $lockfile contains:
     2208`cat $lockfile 2>/dev/null`
     2209
     2210but it should contain:
     2211$srcfile
     2212
     2213This indicates that another process is trying to use the same
     2214temporary object file, and libtool could not work around it because
     2215your compiler does not support \`-c' and \`-o' together.  If you
     2216repeat this compilation, it may succeed, by chance, but you had better
     2217avoid parallel builds (make -j) in this platform, or get a better
     2218compiler."
     2219
     2220        $opt_dry_run || $RM $removelist
     2221        exit $EXIT_FAILURE
     2222      fi
     2223
     2224      # Just move the object if needed, then go on to compile the next one
     2225      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
     2226        func_show_eval '$MV "$output_obj" "$lobj"' \
     2227          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
     2228      fi
     2229
     2230      # Allow error messages only from the first compilation.
     2231      if test "$suppress_opt" = yes; then
     2232        suppress_output=' >/dev/null 2>&1'
     2233      fi
     2234    fi
     2235
     2236    # Only build a position-dependent object if we build old libraries.
     2237    if test "$build_old_libs" = yes; then
     2238      if test "$pic_mode" != yes; then
     2239        # Don't build PIC code
     2240        command="$base_compile $qsrcfile$pie_flag"
     2241      else
     2242        command="$base_compile $qsrcfile $pic_flag"
     2243      fi
     2244      if test "$compiler_c_o" = yes; then
     2245        func_append command " -o $obj"
     2246      fi
     2247
     2248      # Suppress compiler output if we already did a PIC compilation.
     2249      func_append command "$suppress_output"
     2250      func_show_eval_locale "$command" \
     2251        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
     2252
     2253      if test "$need_locks" = warn &&
     2254         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
     2255        $ECHO "\
     2256*** ERROR, $lockfile contains:
     2257`cat $lockfile 2>/dev/null`
     2258
     2259but it should contain:
     2260$srcfile
     2261
     2262This indicates that another process is trying to use the same
     2263temporary object file, and libtool could not work around it because
     2264your compiler does not support \`-c' and \`-o' together.  If you
     2265repeat this compilation, it may succeed, by chance, but you had better
     2266avoid parallel builds (make -j) in this platform, or get a better
     2267compiler."
     2268
     2269        $opt_dry_run || $RM $removelist
     2270        exit $EXIT_FAILURE
     2271      fi
     2272
     2273      # Just move the object if needed
     2274      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
     2275        func_show_eval '$MV "$output_obj" "$obj"' \
     2276          'error=$?; $opt_dry_run || $RM $removelist; exit $error'
     2277      fi
     2278    fi
     2279
     2280    $opt_dry_run || {
     2281      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
     2282
     2283      # Unlock the critical section if it was locked
     2284      if test "$need_locks" != no; then
     2285        removelist=$lockfile
     2286        $RM "$lockfile"
     2287      fi
     2288    }
     2289
     2290    exit $EXIT_SUCCESS
     2291}
     2292
     2293$opt_help || {
     2294  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
     2295}
     2296
     2297func_mode_help ()
     2298{
     2299    # We need to display help for each of the modes.
     2300    case $opt_mode in
     2301      "")
     2302        # Generic help is extracted from the usage comments
     2303        # at the start of this file.
     2304        func_help
     2305        ;;
     2306
     2307      clean)
     2308        $ECHO \
     2309"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
     2310
     2311Remove files from the build directory.
     2312
     2313RM is the name of the program to use to delete files associated with each FILE
     2314(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
     2315to RM.
     2316
     2317If FILE is a libtool library, object or program, all the files associated
     2318with it are deleted. Otherwise, only FILE itself is deleted using RM."
     2319        ;;
     2320
     2321      compile)
     2322      $ECHO \
     2323"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
     2324
     2325Compile a source file into a libtool library object.
     2326
     2327This mode accepts the following additional options:
     2328
     2329  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
     2330  -no-suppress      do not suppress compiler output for multiple passes
     2331  -prefer-pic       try to build PIC objects only
     2332  -prefer-non-pic   try to build non-PIC objects only
     2333  -shared           do not build a \`.o' file suitable for static linking
     2334  -static           only build a \`.o' file suitable for static linking
     2335  -Wc,FLAG          pass FLAG directly to the compiler
     2336
     2337COMPILE-COMMAND is a command to be used in creating a \`standard' object file
     2338from the given SOURCEFILE.
     2339
     2340The output file name is determined by removing the directory component from
     2341SOURCEFILE, then substituting the C source code suffix \`.c' with the
     2342library object suffix, \`.lo'."
     2343        ;;
     2344
     2345      execute)
     2346        $ECHO \
     2347"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
     2348
     2349Automatically set library path, then run a program.
     2350
     2351This mode accepts the following additional options:
     2352
     2353  -dlopen FILE      add the directory containing FILE to the library path
     2354
     2355This mode sets the library path environment variable according to \`-dlopen'
     2356flags.
     2357
     2358If any of the ARGS are libtool executable wrappers, then they are translated
     2359into their corresponding uninstalled binary, and any of their required library
     2360directories are added to the library path.
     2361
     2362Then, COMMAND is executed, with ARGS as arguments."
     2363        ;;
     2364
     2365      finish)
     2366        $ECHO \
     2367"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
     2368
     2369Complete the installation of libtool libraries.
     2370
     2371Each LIBDIR is a directory that contains libtool libraries.
     2372
     2373The commands that this mode executes may require superuser privileges.  Use
     2374the \`--dry-run' option if you just want to see what would be executed."
     2375        ;;
     2376
     2377      install)
     2378        $ECHO \
     2379"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
     2380
     2381Install executables or libraries.
     2382
     2383INSTALL-COMMAND is the installation command.  The first component should be
     2384either the \`install' or \`cp' program.
     2385
     2386The following components of INSTALL-COMMAND are treated specially:
     2387
     2388  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
     2389
     2390The rest of the components are interpreted as arguments to that command (only
     2391BSD-compatible install options are recognized)."
     2392        ;;
     2393
     2394      link)
     2395        $ECHO \
     2396"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
     2397
     2398Link object files or libraries together to form another library, or to
     2399create an executable program.
     2400
     2401LINK-COMMAND is a command using the C compiler that you would use to create
     2402a program from several object files.
     2403
     2404The following components of LINK-COMMAND are treated specially:
     2405
     2406  -all-static       do not do any dynamic linking at all
     2407  -avoid-version    do not add a version suffix if possible
     2408  -bindir BINDIR    specify path to binaries directory (for systems where
     2409                    libraries must be found in the PATH setting at runtime)
     2410  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
     2411  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
     2412  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
     2413  -export-symbols SYMFILE
     2414                    try to export only the symbols listed in SYMFILE
     2415  -export-symbols-regex REGEX
     2416                    try to export only the symbols matching REGEX
     2417  -LLIBDIR          search LIBDIR for required installed libraries
     2418  -lNAME            OUTPUT-FILE requires the installed library libNAME
     2419  -module           build a library that can dlopened
     2420  -no-fast-install  disable the fast-install mode
     2421  -no-install       link a not-installable executable
     2422  -no-undefined     declare that a library does not refer to external symbols
     2423  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
     2424  -objectlist FILE  Use a list of object files found in FILE to specify objects
     2425  -precious-files-regex REGEX
     2426                    don't remove output files matching REGEX
     2427  -release RELEASE  specify package release information
     2428  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
     2429  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
     2430  -shared           only do dynamic linking of libtool libraries
     2431  -shrext SUFFIX    override the standard shared library file extension
     2432  -static           do not do any dynamic linking of uninstalled libtool libraries
     2433  -static-libtool-libs
     2434                    do not do any dynamic linking of libtool libraries
     2435  -version-info CURRENT[:REVISION[:AGE]]
     2436                    specify library version info [each variable defaults to 0]
     2437  -weak LIBNAME     declare that the target provides the LIBNAME interface
     2438  -Wc,FLAG
     2439  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
     2440  -Wl,FLAG
     2441  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
     2442  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
     2443
     2444All other options (arguments beginning with \`-') are ignored.
     2445
     2446Every other argument is treated as a filename.  Files ending in \`.la' are
     2447treated as uninstalled libtool libraries, other files are standard or library
     2448object files.
     2449
     2450If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
     2451only library objects (\`.lo' files) may be specified, and \`-rpath' is
     2452required, except when creating a convenience library.
     2453
     2454If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
     2455using \`ar' and \`ranlib', or on Windows using \`lib'.
     2456
     2457If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
     2458is created, otherwise an executable program is created."
     2459        ;;
     2460
     2461      uninstall)
     2462        $ECHO \
     2463"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
     2464
     2465Remove libraries from an installation directory.
     2466
     2467RM is the name of the program to use to delete files associated with each FILE
     2468(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
     2469to RM.
     2470
     2471If FILE is a libtool library, all the files associated with it are deleted.
     2472Otherwise, only FILE itself is deleted using RM."
     2473        ;;
     2474
     2475      *)
     2476        func_fatal_help "invalid operation mode \`$opt_mode'"
     2477        ;;
     2478    esac
     2479
     2480    echo
     2481    $ECHO "Try \`$progname --help' for more information about other modes."
     2482}
     2483
     2484# Now that we've collected a possible --mode arg, show help if necessary
     2485if $opt_help; then
     2486  if test "$opt_help" = :; then
     2487    func_mode_help
     2488  else
     2489    {
     2490      func_help noexit
     2491      for opt_mode in compile link execute install finish uninstall clean; do
     2492        func_mode_help
     2493      done
     2494    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
     2495    {
     2496      func_help noexit
     2497      for opt_mode in compile link execute install finish uninstall clean; do
     2498        echo
     2499        func_mode_help
     2500      done
     2501    } |
     2502    sed '1d
     2503      /^When reporting/,/^Report/{
     2504        H
     2505        d
    1742506      }
     2507      $x
     2508      /information about other modes/d
     2509      /more detailed .*MODE/d
     2510      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
     2511  fi
     2512  exit $?
     2513fi
     2514
     2515
     2516# func_mode_execute arg...
     2517func_mode_execute ()
     2518{
     2519    $opt_debug
     2520    # The first argument is the command name.
     2521    cmd="$nonopt"
     2522    test -z "$cmd" && \
     2523      func_fatal_help "you must specify a COMMAND"
     2524
     2525    # Handle -dlopen flags immediately.
     2526    for file in $opt_dlopen; do
     2527      test -f "$file" \
     2528        || func_fatal_help "\`$file' is not a file"
     2529
     2530      dir=
     2531      case $file in
     2532      *.la)
     2533        func_resolve_sysroot "$file"
     2534        file=$func_resolve_sysroot_result
     2535
     2536        # Check to see that this really is a libtool archive.
     2537        func_lalib_unsafe_p "$file" \
     2538          || func_fatal_help "\`$lib' is not a valid libtool archive"
     2539
     2540        # Read the libtool library.
     2541        dlname=
     2542        library_names=
     2543        func_source "$file"
     2544
     2545        # Skip this library if it cannot be dlopened.
     2546        if test -z "$dlname"; then
     2547          # Warn if it was a shared library.
     2548          test -n "$library_names" && \
     2549            func_warning "\`$file' was not linked with \`-export-dynamic'"
     2550          continue
     2551        fi
     2552
     2553        func_dirname "$file" "" "."
     2554        dir="$func_dirname_result"
     2555
     2556        if test -f "$dir/$objdir/$dlname"; then
     2557          func_append dir "/$objdir"
     2558        else
     2559          if test ! -f "$dir/$dlname"; then
     2560            func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
     2561          fi
     2562        fi
     2563        ;;
     2564
     2565      *.lo)
     2566        # Just add the directory containing the .lo file.
     2567        func_dirname "$file" "" "."
     2568        dir="$func_dirname_result"
     2569        ;;
     2570
     2571      *)
     2572        func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
     2573        continue
     2574        ;;
     2575      esac
     2576
     2577      # Get the absolute pathname.
     2578      absdir=`cd "$dir" && pwd`
     2579      test -n "$absdir" && dir="$absdir"
     2580
     2581      # Now add the directory to shlibpath_var.
     2582      if eval "test -z \"\$$shlibpath_var\""; then
     2583        eval "$shlibpath_var=\"\$dir\""
     2584      else
     2585        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
     2586      fi
     2587    done
     2588
     2589    # This variable tells wrapper scripts just to set shlibpath_var
     2590    # rather than running their programs.
     2591    libtool_execute_magic="$magic"
     2592
     2593    # Check if any of the arguments is a wrapper script.
     2594    args=
     2595    for file
     2596    do
     2597      case $file in
     2598      -* | *.la | *.lo ) ;;
     2599      *)
     2600        # Do a test to see if this is really a libtool program.
     2601        if func_ltwrapper_script_p "$file"; then
     2602          func_source "$file"
     2603          # Transform arg to wrapped name.
     2604          file="$progdir/$program"
     2605        elif func_ltwrapper_executable_p "$file"; then
     2606          func_ltwrapper_scriptname "$file"
     2607          func_source "$func_ltwrapper_scriptname_result"
     2608          # Transform arg to wrapped name.
     2609          file="$progdir/$program"
     2610        fi
     2611        ;;
     2612      esac
     2613      # Quote arguments (to preserve shell metacharacters).
     2614      func_append_quoted args "$file"
     2615    done
     2616
     2617    if test "X$opt_dry_run" = Xfalse; then
     2618      if test -n "$shlibpath_var"; then
     2619        # Export the shlibpath_var.
     2620        eval "export $shlibpath_var"
     2621      fi
     2622
     2623      # Restore saved environment variables
     2624      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
     2625      do
     2626        eval "if test \"\${save_$lt_var+set}\" = set; then
     2627                $lt_var=\$save_$lt_var; export $lt_var
     2628              else
     2629                $lt_unset $lt_var
     2630              fi"
     2631      done
     2632
     2633      # Now prepare to actually exec the command.
     2634      exec_cmd="\$cmd$args"
     2635    else
     2636      # Display what would be done.
     2637      if test -n "$shlibpath_var"; then
     2638        eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
     2639        echo "export $shlibpath_var"
     2640      fi
     2641      $ECHO "$cmd$args"
     2642      exit $EXIT_SUCCESS
    1752643    fi
    176 
    177     $echo "X$my_tmpdir" | $Xsed
    178 }
    179 
     2644}
     2645
     2646test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
     2647
     2648
     2649# func_mode_finish arg...
     2650func_mode_finish ()
     2651{
     2652    $opt_debug
     2653    libs=
     2654    libdirs=
     2655    admincmds=
     2656
     2657    for opt in "$nonopt" ${1+"$@"}
     2658    do
     2659      if test -d "$opt"; then
     2660        func_append libdirs " $opt"
     2661
     2662      elif test -f "$opt"; then
     2663        if func_lalib_unsafe_p "$opt"; then
     2664          func_append libs " $opt"
     2665        else
     2666          func_warning "\`$opt' is not a valid libtool archive"
     2667        fi
     2668
     2669      else
     2670        func_fatal_error "invalid argument \`$opt'"
     2671      fi
     2672    done
     2673
     2674    if test -n "$libs"; then
     2675      if test -n "$lt_sysroot"; then
     2676        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
     2677        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
     2678      else
     2679        sysroot_cmd=
     2680      fi
     2681
     2682      # Remove sysroot references
     2683      if $opt_dry_run; then
     2684        for lib in $libs; do
     2685          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
     2686        done
     2687      else
     2688        tmpdir=`func_mktempdir`
     2689        for lib in $libs; do
     2690          sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
     2691            > $tmpdir/tmp-la
     2692          mv -f $tmpdir/tmp-la $lib
     2693        done
     2694        ${RM}r "$tmpdir"
     2695      fi
     2696    fi
     2697
     2698    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
     2699      for libdir in $libdirs; do
     2700        if test -n "$finish_cmds"; then
     2701          # Do each command in the finish commands.
     2702          func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
     2703'"$cmd"'"'
     2704        fi
     2705        if test -n "$finish_eval"; then
     2706          # Do the single finish_eval.
     2707          eval cmds=\"$finish_eval\"
     2708          $opt_dry_run || eval "$cmds" || func_append admincmds "
     2709       $cmds"
     2710        fi
     2711      done
     2712    fi
     2713
     2714    # Exit here if they wanted silent mode.
     2715    $opt_silent && exit $EXIT_SUCCESS
     2716
     2717    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
     2718      echo "----------------------------------------------------------------------"
     2719      echo "Libraries have been installed in:"
     2720      for libdir in $libdirs; do
     2721        $ECHO "   $libdir"
     2722      done
     2723      echo
     2724      echo "If you ever happen to want to link against installed libraries"
     2725      echo "in a given directory, LIBDIR, you must either use libtool, and"
     2726      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
     2727      echo "flag during linking and do at least one of the following:"
     2728      if test -n "$shlibpath_var"; then
     2729        echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
     2730        echo "     during execution"
     2731      fi
     2732      if test -n "$runpath_var"; then
     2733        echo "   - add LIBDIR to the \`$runpath_var' environment variable"
     2734        echo "     during linking"
     2735      fi
     2736      if test -n "$hardcode_libdir_flag_spec"; then
     2737        libdir=LIBDIR
     2738        eval flag=\"$hardcode_libdir_flag_spec\"
     2739
     2740        $ECHO "   - use the \`$flag' linker flag"
     2741      fi
     2742      if test -n "$admincmds"; then
     2743        $ECHO "   - have your system administrator run these commands:$admincmds"
     2744      fi
     2745      if test -f /etc/ld.so.conf; then
     2746        echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
     2747      fi
     2748      echo
     2749
     2750      echo "See any operating system documentation about shared libraries for"
     2751      case $host in
     2752        solaris2.[6789]|solaris2.1[0-9])
     2753          echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
     2754          echo "pages."
     2755          ;;
     2756        *)
     2757          echo "more information, such as the ld(1) and ld.so(8) manual pages."
     2758          ;;
     2759      esac
     2760      echo "----------------------------------------------------------------------"
     2761    fi
     2762    exit $EXIT_SUCCESS
     2763}
     2764
     2765test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
     2766
     2767
     2768# func_mode_install arg...
     2769func_mode_install ()
     2770{
     2771    $opt_debug
     2772    # There may be an optional sh(1) argument at the beginning of
     2773    # install_prog (especially on Windows NT).
     2774    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
     2775       # Allow the use of GNU shtool's install command.
     2776       case $nonopt in *shtool*) :;; *) false;; esac; then
     2777      # Aesthetically quote it.
     2778      func_quote_for_eval "$nonopt"
     2779      install_prog="$func_quote_for_eval_result "
     2780      arg=$1
     2781      shift
     2782    else
     2783      install_prog=
     2784      arg=$nonopt
     2785    fi
     2786
     2787    # The real first argument should be the name of the installation program.
     2788    # Aesthetically quote it.
     2789    func_quote_for_eval "$arg"
     2790    func_append install_prog "$func_quote_for_eval_result"
     2791    install_shared_prog=$install_prog
     2792    case " $install_prog " in
     2793      *[\\\ /]cp\ *) install_cp=: ;;
     2794      *) install_cp=false ;;
     2795    esac
     2796
     2797    # We need to accept at least all the BSD install flags.
     2798    dest=
     2799    files=
     2800    opts=
     2801    prev=
     2802    install_type=
     2803    isdir=no
     2804    stripme=
     2805    no_mode=:
     2806    for arg
     2807    do
     2808      arg2=
     2809      if test -n "$dest"; then
     2810        func_append files " $dest"
     2811        dest=$arg
     2812        continue
     2813      fi
     2814
     2815      case $arg in
     2816      -d) isdir=yes ;;
     2817      -f)
     2818        if $install_cp; then :; else
     2819          prev=$arg
     2820        fi
     2821        ;;
     2822      -g | -m | -o)
     2823        prev=$arg
     2824        ;;
     2825      -s)
     2826        stripme=" -s"
     2827        continue
     2828        ;;
     2829      -*)
     2830        ;;
     2831      *)
     2832        # If the previous option needed an argument, then skip it.
     2833        if test -n "$prev"; then
     2834          if test "x$prev" = x-m && test -n "$install_override_mode"; then
     2835            arg2=$install_override_mode
     2836            no_mode=false
     2837          fi
     2838          prev=
     2839        else
     2840          dest=$arg
     2841          continue
     2842        fi
     2843        ;;
     2844      esac
     2845
     2846      # Aesthetically quote the argument.
     2847      func_quote_for_eval "$arg"
     2848      func_append install_prog " $func_quote_for_eval_result"
     2849      if test -n "$arg2"; then
     2850        func_quote_for_eval "$arg2"
     2851      fi
     2852      func_append install_shared_prog " $func_quote_for_eval_result"
     2853    done
     2854
     2855    test -z "$install_prog" && \
     2856      func_fatal_help "you must specify an install program"
     2857
     2858    test -n "$prev" && \
     2859      func_fatal_help "the \`$prev' option requires an argument"
     2860
     2861    if test -n "$install_override_mode" && $no_mode; then
     2862      if $install_cp; then :; else
     2863        func_quote_for_eval "$install_override_mode"
     2864        func_append install_shared_prog " -m $func_quote_for_eval_result"
     2865      fi
     2866    fi
     2867
     2868    if test -z "$files"; then
     2869      if test -z "$dest"; then
     2870        func_fatal_help "no file or destination specified"
     2871      else
     2872        func_fatal_help "you must specify a destination"
     2873      fi
     2874    fi
     2875
     2876    # Strip any trailing slash from the destination.
     2877    func_stripname '' '/' "$dest"
     2878    dest=$func_stripname_result
     2879
     2880    # Check to see that the destination is a directory.
     2881    test -d "$dest" && isdir=yes
     2882    if test "$isdir" = yes; then
     2883      destdir="$dest"
     2884      destname=
     2885    else
     2886      func_dirname_and_basename "$dest" "" "."
     2887      destdir="$func_dirname_result"
     2888      destname="$func_basename_result"
     2889
     2890      # Not a directory, so check to see that there is only one file specified.
     2891      set dummy $files; shift
     2892      test "$#" -gt 1 && \
     2893        func_fatal_help "\`$dest' is not a directory"
     2894    fi
     2895    case $destdir in
     2896    [\\/]* | [A-Za-z]:[\\/]*) ;;
     2897    *)
     2898      for file in $files; do
     2899        case $file in
     2900        *.lo) ;;
     2901        *)
     2902          func_fatal_help "\`$destdir' must be an absolute directory name"
     2903          ;;
     2904        esac
     2905      done
     2906      ;;
     2907    esac
     2908
     2909    # This variable tells wrapper scripts just to set variables rather
     2910    # than running their programs.
     2911    libtool_install_magic="$magic"
     2912
     2913    staticlibs=
     2914    future_libdirs=
     2915    current_libdirs=
     2916    for file in $files; do
     2917
     2918      # Do each installation.
     2919      case $file in
     2920      *.$libext)
     2921        # Do the static libraries later.
     2922        func_append staticlibs " $file"
     2923        ;;
     2924
     2925      *.la)
     2926        func_resolve_sysroot "$file"
     2927        file=$func_resolve_sysroot_result
     2928
     2929        # Check to see that this really is a libtool archive.
     2930        func_lalib_unsafe_p "$file" \
     2931          || func_fatal_help "\`$file' is not a valid libtool archive"
     2932
     2933        library_names=
     2934        old_library=
     2935        relink_command=
     2936        func_source "$file"
     2937
     2938        # Add the libdir to current_libdirs if it is the destination.
     2939        if test "X$destdir" = "X$libdir"; then
     2940          case "$current_libdirs " in
     2941          *" $libdir "*) ;;
     2942          *) func_append current_libdirs " $libdir" ;;
     2943          esac
     2944        else
     2945          # Note the libdir as a future libdir.
     2946          case "$future_libdirs " in
     2947          *" $libdir "*) ;;
     2948          *) func_append future_libdirs " $libdir" ;;
     2949          esac
     2950        fi
     2951
     2952        func_dirname "$file" "/" ""
     2953        dir="$func_dirname_result"
     2954        func_append dir "$objdir"
     2955
     2956        if test -n "$relink_command"; then
     2957          # Determine the prefix the user has applied to our future dir.
     2958          inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
     2959
     2960          # Don't allow the user to place us outside of our expected
     2961          # location b/c this prevents finding dependent libraries that
     2962          # are installed to the same prefix.
     2963          # At present, this check doesn't affect windows .dll's that
     2964          # are installed into $libdir/../bin (currently, that works fine)
     2965          # but it's something to keep an eye on.
     2966          test "$inst_prefix_dir" = "$destdir" && \
     2967            func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
     2968
     2969          if test -n "$inst_prefix_dir"; then
     2970            # Stick the inst_prefix_dir data into the link command.
     2971            relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
     2972          else
     2973            relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
     2974          fi
     2975
     2976          func_warning "relinking \`$file'"
     2977          func_show_eval "$relink_command" \
     2978            'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
     2979        fi
     2980
     2981        # See the names of the shared library.
     2982        set dummy $library_names; shift
     2983        if test -n "$1"; then
     2984          realname="$1"
     2985          shift
     2986
     2987          srcname="$realname"
     2988          test -n "$relink_command" && srcname="$realname"T
     2989
     2990          # Install the shared library and build the symlinks.
     2991          func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
     2992              'exit $?'
     2993          tstripme="$stripme"
     2994          case $host_os in
     2995          cygwin* | mingw* | pw32* | cegcc*)
     2996            case $realname in
     2997            *.dll.a)
     2998              tstripme=""
     2999              ;;
     3000            esac
     3001            ;;
     3002          esac
     3003          if test -n "$tstripme" && test -n "$striplib"; then
     3004            func_show_eval "$striplib $destdir/$realname" 'exit $?'
     3005          fi
     3006
     3007          if test "$#" -gt 0; then
     3008            # Delete the old symlinks, and create new ones.
     3009            # Try `ln -sf' first, because the `ln' binary might depend on
     3010            # the symlink we replace!  Solaris /bin/ln does not understand -f,
     3011            # so we also need to try rm && ln -s.
     3012            for linkname
     3013            do
     3014              test "$linkname" != "$realname" \
     3015                && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
     3016            done
     3017          fi
     3018
     3019          # Do each command in the postinstall commands.
     3020          lib="$destdir/$realname"
     3021          func_execute_cmds "$postinstall_cmds" 'exit $?'
     3022        fi
     3023
     3024        # Install the pseudo-library for information purposes.
     3025        func_basename "$file"
     3026        name="$func_basename_result"
     3027        instname="$dir/$name"i
     3028        func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
     3029
     3030        # Maybe install the static library, too.
     3031        test -n "$old_library" && func_append staticlibs " $dir/$old_library"
     3032        ;;
     3033
     3034      *.lo)
     3035        # Install (i.e. copy) a libtool object.
     3036
     3037        # Figure out destination file name, if it wasn't already specified.
     3038        if test -n "$destname"; then
     3039          destfile="$destdir/$destname"
     3040        else
     3041          func_basename "$file"
     3042          destfile="$func_basename_result"
     3043          destfile="$destdir/$destfile"
     3044        fi
     3045
     3046        # Deduce the name of the destination old-style object file.
     3047        case $destfile in
     3048        *.lo)
     3049          func_lo2o "$destfile"
     3050          staticdest=$func_lo2o_result
     3051          ;;
     3052        *.$objext)
     3053          staticdest="$destfile"
     3054          destfile=
     3055          ;;
     3056        *)
     3057          func_fatal_help "cannot copy a libtool object to \`$destfile'"
     3058          ;;
     3059        esac
     3060
     3061        # Install the libtool object if requested.
     3062        test -n "$destfile" && \
     3063          func_show_eval "$install_prog $file $destfile" 'exit $?'
     3064
     3065        # Install the old object if enabled.
     3066        if test "$build_old_libs" = yes; then
     3067          # Deduce the name of the old-style object file.
     3068          func_lo2o "$file"
     3069          staticobj=$func_lo2o_result
     3070          func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
     3071        fi
     3072        exit $EXIT_SUCCESS
     3073        ;;
     3074
     3075      *)
     3076        # Figure out destination file name, if it wasn't already specified.
     3077        if test -n "$destname"; then
     3078          destfile="$destdir/$destname"
     3079        else
     3080          func_basename "$file"
     3081          destfile="$func_basename_result"
     3082          destfile="$destdir/$destfile"
     3083        fi
     3084
     3085        # If the file is missing, and there is a .exe on the end, strip it
     3086        # because it is most likely a libtool script we actually want to
     3087        # install
     3088        stripped_ext=""
     3089        case $file in
     3090          *.exe)
     3091            if test ! -f "$file"; then
     3092              func_stripname '' '.exe' "$file"
     3093              file=$func_stripname_result
     3094              stripped_ext=".exe"
     3095            fi
     3096            ;;
     3097        esac
     3098
     3099        # Do a test to see if this is really a libtool program.
     3100        case $host in
     3101        *cygwin* | *mingw*)
     3102            if func_ltwrapper_executable_p "$file"; then
     3103              func_ltwrapper_scriptname "$file"
     3104              wrapper=$func_ltwrapper_scriptname_result
     3105            else
     3106              func_stripname '' '.exe' "$file"
     3107              wrapper=$func_stripname_result
     3108            fi
     3109            ;;
     3110        *)
     3111            wrapper=$file
     3112            ;;
     3113        esac
     3114        if func_ltwrapper_script_p "$wrapper"; then
     3115          notinst_deplibs=
     3116          relink_command=
     3117
     3118          func_source "$wrapper"
     3119
     3120          # Check the variables that should have been set.
     3121          test -z "$generated_by_libtool_version" && \
     3122            func_fatal_error "invalid libtool wrapper script \`$wrapper'"
     3123
     3124          finalize=yes
     3125          for lib in $notinst_deplibs; do
     3126            # Check to see that each library is installed.
     3127            libdir=
     3128            if test -f "$lib"; then
     3129              func_source "$lib"
     3130            fi
     3131            libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
     3132            if test -n "$libdir" && test ! -f "$libfile"; then
     3133              func_warning "\`$lib' has not been installed in \`$libdir'"
     3134              finalize=no
     3135            fi
     3136          done
     3137
     3138          relink_command=
     3139          func_source "$wrapper"
     3140
     3141          outputname=
     3142          if test "$fast_install" = no && test -n "$relink_command"; then
     3143            $opt_dry_run || {
     3144              if test "$finalize" = yes; then
     3145                tmpdir=`func_mktempdir`
     3146                func_basename "$file$stripped_ext"
     3147                file="$func_basename_result"
     3148                outputname="$tmpdir/$file"
     3149                # Replace the output file specification.
     3150                relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
     3151
     3152                $opt_silent || {
     3153                  func_quote_for_expand "$relink_command"
     3154                  eval "func_echo $func_quote_for_expand_result"
     3155                }
     3156                if eval "$relink_command"; then :
     3157                  else
     3158                  func_error "error: relink \`$file' with the above command before installing it"
     3159                  $opt_dry_run || ${RM}r "$tmpdir"
     3160                  continue
     3161                fi
     3162                file="$outputname"
     3163              else
     3164                func_warning "cannot relink \`$file'"
     3165              fi
     3166            }
     3167          else
     3168            # Install the binary that we compiled earlier.
     3169            file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
     3170          fi
     3171        fi
     3172
     3173        # remove .exe since cygwin /usr/bin/install will append another
     3174        # one anyway
     3175        case $install_prog,$host in
     3176        */usr/bin/install*,*cygwin*)
     3177          case $file:$destfile in
     3178          *.exe:*.exe)
     3179            # this is ok
     3180            ;;
     3181          *.exe:*)
     3182            destfile=$destfile.exe
     3183            ;;
     3184          *:*.exe)
     3185            func_stripname '' '.exe' "$destfile"
     3186            destfile=$func_stripname_result
     3187            ;;
     3188          esac
     3189          ;;
     3190        esac
     3191        func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
     3192        $opt_dry_run || if test -n "$outputname"; then
     3193          ${RM}r "$tmpdir"
     3194        fi
     3195        ;;
     3196      esac
     3197    done
     3198
     3199    for file in $staticlibs; do
     3200      func_basename "$file"
     3201      name="$func_basename_result"
     3202
     3203      # Set up the ranlib parameters.
     3204      oldlib="$destdir/$name"
     3205      func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
     3206      tool_oldlib=$func_to_tool_file_result
     3207
     3208      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
     3209
     3210      if test -n "$stripme" && test -n "$old_striplib"; then
     3211        func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
     3212      fi
     3213
     3214      # Do each command in the postinstall commands.
     3215      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
     3216    done
     3217
     3218