diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2008-05-27 18:52:46 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2008-05-27 18:52:46 +0000 |
commit | 86e45ce09e10777490158ee1df477f8c59e7ebc1 (patch) | |
tree | d9a779455e90123197be2980f7e318261d605304 /gnu | |
parent | 0b8ec47fce997b1416e40d2f6810d547ffb7615e (diff) |
Merge OpenBSD specific changes:
- pexecute implementation replaced with the older gcc 2.95 implementation,
as gcc 2.95's collect2 relies upon an implementation behaviour which has
been lost in further libiberty updates.
- keep the old hash table interfaces, which are used by gcc 2.95.
- keep the OpenBSD replacement for the md5 interface.
- keep the OpenBSD strl{cat,cpy} and snprinft usage.
Bump libiberty minor version due to the addition of a few new symbols.
Diffstat (limited to 'gnu')
84 files changed, 18382 insertions, 11578 deletions
diff --git a/gnu/lib/libiberty/Makefile.bsd-wrapper b/gnu/lib/libiberty/Makefile.bsd-wrapper index 6642f888512..54ebd2bac14 100644 --- a/gnu/lib/libiberty/Makefile.bsd-wrapper +++ b/gnu/lib/libiberty/Makefile.bsd-wrapper @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.10 2006/07/12 23:00:07 espie Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.11 2008/05/27 18:52:40 miod Exp $ LIB= iberty -CPPFLAGS+= -DHAVE_CONFIG_H -I$(.CURDIR) -I$(.CURDIR)/include -I$(.OBJDIR) +CPPFLAGS+= -DHAVE_CONFIG_H -I$(.CURDIR)/src -I$(.CURDIR)/include -I$(.OBJDIR) NOLINT= @@ -9,6 +9,7 @@ HOST_FILES!= cat $(.OBJDIR)/needed-list 2>/dev/null||true .PATH: ${.CURDIR}/src +# XXX remove oldhashtab.c once gcc 2.95 is no longer used SRCS= argv.c choose-temp.c concat.c cplus-dem.c cp-demangle.c \ dyn-string.c \ fdmatch.c getopt.c getopt1.c getpwd.c getruntime.c \ @@ -16,20 +17,14 @@ SRCS= argv.c choose-temp.c concat.c cplus-dem.c cp-demangle.c \ floatformat.c make-temp-file.c make-relative-prefix.c \ objalloc.c obstack.c oldhashtab.c \ pexecute.c regex.c safe-ctype.c spaces.c splay-tree.c \ - strerror.c strsignal.c \ + strerror.c strsignal.c strverscmp.c \ xatexit.c xexit.c xmalloc.c xmemdup.c xstrerror.c xstrdup.c \ physmem.c lbasename.c lrealpath.c \ $(HOST_FILES) -# choose-temp.c fnmatch.c objalloc.c pexecute.c xstrdup.c \ -# basename.c vasprintf.c - # XXX -- These files are generated during the PREREQ variable assignment. CLEANFILES+= config.h config.status needed-list -# XXX -- Why are these not removed by the generated Makefile? -CLEANFILES+= insque.o insque.go insque.po insque.so - # and more CLEANFILES+= Makefile config.cache config.log stamp-h xhost-mkfrag \ testsuite/Makefile libiberty.info diff --git a/gnu/lib/libiberty/config.guess b/gnu/lib/libiberty/config.guess index c989465abca..17690aea342 100644 --- a/gnu/lib/libiberty/config.guess +++ b/gnu/lib/libiberty/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2003-01-30' +timestamp='2006-01-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,13 +17,15 @@ timestamp='2003-01-30' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner <per@bothner.com>. # Please send patches to <config-patches@gnu.org>. Submit a context # diff and a properly formatted ChangeLog entry. @@ -53,7 +55,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -66,11 +68,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -106,6 +108,7 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; @@ -122,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -195,18 +198,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; + exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:MicroBSD:*:*) - echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU @@ -244,39 +261,49 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -284,29 +311,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -315,10 +345,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -330,10 +360,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -344,37 +374,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -398,32 +431,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -439,29 +473,29 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -469,7 +503,7 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -484,14 +518,18 @@ EOF exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; + exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then @@ -505,28 +543,28 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -588,9 +626,19 @@ EOF esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -598,11 +646,11 @@ EOF fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -630,147 +678,171 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; + exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 - exit 0 ;; + exit ;; + x86:Interix*:[345]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix - exit 0 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -787,8 +859,8 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -806,15 +878,18 @@ EOF #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu - exit 0 ;; + exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -828,7 +903,7 @@ EOF objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -836,22 +911,28 @@ EOF PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu - exit 0 ;; + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -869,15 +950,15 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -894,23 +975,29 @@ EOF LIBC=gnulibc1 # endif #else - #ifdef __INTEL_COMPILER + #if defined(__INTEL_COMPILER) || defined(__PGI) LIBC=gnu #else LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -918,24 +1005,27 @@ EOF # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -943,15 +1033,16 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` @@ -969,73 +1060,73 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv32 fi - exit 0 ;; + exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp - exit 0 ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 - exit 0 ;; + exit ;; paragon:*:*:*) echo i860-intel-osf1 - exit 0 ;; + exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1043,68 +1134,72 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1112,22 +1207,25 @@ EOF UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1138,25 +1236,47 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1188,7 +1308,7 @@ main () #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1277,11 +1397,12 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1290,22 +1411,22 @@ then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1316,7 +1437,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/gnu/lib/libiberty/config.sub b/gnu/lib/libiberty/config.sub index 53f9660a58a..a4e8a94a335 100644 --- a/gnu/lib/libiberty/config.sub +++ b/gnu/lib/libiberty/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2003-01-28' +timestamp='2006-01-02' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +21,15 @@ timestamp='2003-01-28' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to <config-patches@gnu.org>. Submit a context # diff and a properly formatted ChangeLog entry. # @@ -70,7 +71,7 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -83,11 +84,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +100,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,7 +119,9 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -144,7 +147,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -169,6 +172,10 @@ case $os in -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -185,6 +192,10 @@ case $os in # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -228,14 +239,16 @@ case $basic_machine in | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | clipper \ + | bfin \ + | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -244,30 +257,37 @@ case $basic_machine in | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | mt \ | msp430 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ - | tahoe | thumb | tic80 | tron \ + | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; + m32c) + basic_machine=$basic_machine-unknown + ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -275,6 +295,9 @@ case $basic_machine in ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -295,19 +318,19 @@ case $basic_machine in | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ - | clipper-* | cydra-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -316,31 +339,40 @@ case $basic_machine in | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; + m32c-*) + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -357,6 +389,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -436,12 +471,27 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -464,6 +514,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -642,10 +696,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -658,6 +708,9 @@ case $basic_machine in basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -726,10 +779,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -737,9 +786,12 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson @@ -766,24 +818,36 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; + pentium4) + basic_machine=i786-pc + ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pn) basic_machine=pn-gould ;; @@ -816,6 +880,10 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -842,6 +910,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -849,6 +921,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh64) + basic_machine=sh64-unknown + ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks @@ -923,14 +998,18 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -944,6 +1023,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -987,6 +1070,10 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; @@ -1017,6 +1104,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1033,13 +1123,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -1112,19 +1199,23 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -microbsd*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1142,12 +1233,15 @@ case $os in os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -1160,6 +1254,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1181,6 +1278,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1203,6 +1303,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1236,6 +1339,12 @@ case $os in -aros*) os=-aros ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; -none) ;; *) @@ -1267,6 +1376,9 @@ case $basic_machine in arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1310,9 +1422,15 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1445,9 +1563,15 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; @@ -1472,7 +1596,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/gnu/lib/libiberty/include/ansidecl.h b/gnu/lib/libiberty/include/ansidecl.h index cdb9fb71961..3254c810ca6 100644 --- a/gnu/lib/libiberty/include/ansidecl.h +++ b/gnu/lib/libiberty/include/ansidecl.h @@ -1,5 +1,6 @@ /* ANSI and traditional C compatability macros - Copyright 1991, 1992, 1996 Free Software Foundation, Inc. + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -14,150 +15,357 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* ANSI and traditional C compatibility macros ANSI C is assumed if __STDC__ is #defined. - Macro ANSI C definition Traditional C definition - ----- ---- - ---------- ----------- - ---------- - PTR `void *' `char *' - LONG_DOUBLE `long double' `double' - VOLATILE `volatile' `' - SIGNED `signed' `' - PTRCONST `void *const' `char *' - ANSI_PROTOTYPES 1 not defined - - CONST is also defined, but is obsolete. Just use const. - - obsolete -- DEFUN (name, arglist, args) - - Defines function NAME. - - ARGLIST lists the arguments, separated by commas and enclosed in - parentheses. ARGLIST becomes the argument list in traditional C. - - ARGS list the arguments with their types. It becomes a prototype in - ANSI C, and the type declarations in traditional C. Arguments should - be separated with `AND'. For functions with a variable number of - arguments, the last thing listed should be `DOTS'. - - obsolete -- DEFUN_VOID (name) - - Defines a function NAME, which takes no arguments. - - obsolete -- EXFUN (name, (prototype)) -- obsolete. - - Replaced by PARAMS. Do not use; will disappear someday soon. - Was used in external function declarations. - In ANSI C it is `NAME PROTOTYPE' (so PROTOTYPE should be enclosed in - parentheses). In traditional C it is `NAME()'. - For a function that takes no arguments, PROTOTYPE should be `(void)'. - - obsolete -- PROTO (type, name, (prototype) -- obsolete. - - This one has also been replaced by PARAMS. Do not use. - - PARAMS ((args)) - - We could use the EXFUN macro to handle prototype declarations, but - the name is misleading and the result is ugly. So we just define a - simple macro to handle the parameter lists, as in: - - static int foo PARAMS ((int, char)); - - This produces: `static int foo();' or `static int foo (int, char);' - - EXFUN would have done it like this: - - static int EXFUN (foo, (int, char)); - - but the function is not external...and it's hard to visually parse - the function name out of the mess. EXFUN should be considered - obsolete; new code should be written to use PARAMS. - - DOTS is also obsolete. - - Examples: - - extern int printf PARAMS ((const char *format, ...)); -*/ + Macro ANSI C definition Traditional C definition + ----- ---- - ---------- ----------- - ---------- + ANSI_PROTOTYPES 1 not defined + PTR `void *' `char *' + PTRCONST `void *const' `char *' + LONG_DOUBLE `long double' `double' + const not defined `' + volatile not defined `' + signed not defined `' + VA_START(ap, var) va_start(ap, var) va_start(ap) + + Note that it is safe to write "void foo();" indicating a function + with no return value, in all K+R compilers we have been able to test. + + For declaring functions with prototypes, we also provide these: + + PARAMS ((prototype)) + -- for functions which take a fixed number of arguments. Use this + when declaring the function. When defining the function, write a + K+R style argument list. For example: + + char *strcpy PARAMS ((char *dest, char *source)); + ... + char * + strcpy (dest, source) + char *dest; + char *source; + { ... } + + + VPARAMS ((prototype, ...)) + -- for functions which take a variable number of arguments. Use + PARAMS to declare the function, VPARAMS to define it. For example: + + int printf PARAMS ((const char *format, ...)); + ... + int + printf VPARAMS ((const char *format, ...)) + { + ... + } + + For writing functions which take variable numbers of arguments, we + also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros. These + hide the differences between K+R <varargs.h> and C89 <stdarg.h> more + thoroughly than the simple VA_START() macro mentioned above. + + VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end. + Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls + corresponding to the list of fixed arguments. Then use va_arg + normally to get the variable arguments, or pass your va_list object + around. You do not declare the va_list yourself; VA_OPEN does it + for you. + + Here is a complete example: + + int + printf VPARAMS ((const char *format, ...)) + { + int result; + + VA_OPEN (ap, format); + VA_FIXEDARG (ap, const char *, format); + + result = vfprintf (stdout, format, ap); + VA_CLOSE (ap); + + return result; + } + + + You can declare variables either before or after the VA_OPEN, + VA_FIXEDARG sequence. Also, VA_OPEN and VA_CLOSE are the beginning + and end of a block. They must appear at the same nesting level, + and any variables declared after VA_OPEN go out of scope at + VA_CLOSE. Unfortunately, with a K+R compiler, that includes the + argument list. You can have multiple instances of VA_OPEN/VA_CLOSE + pairs in a single function in case you need to traverse the + argument list more than once. + + For ease of writing code which uses GCC extensions but needs to be + portable to other compilers, we provide the GCC_VERSION macro that + simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various + wrappers around __attribute__. Also, __extension__ will be #defined + to nothing if it doesn't work. See below. + + This header also defines a lot of obsolete macros: + CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID, + AND, DOTS, NOARGS. Don't use them. */ #ifndef _ANSIDECL_H - -#define _ANSIDECL_H 1 - +#define _ANSIDECL_H 1 /* Every source file includes this file, so they will all get the switch for lint. */ /* LINTLIBRARY */ +/* Using MACRO(x,y) in cpp #if conditionals does not work with some + older preprocessors. Thus we can't define something like this: -#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) -/* All known AIX compilers implement these things (but don't always - define __STDC__). The RISC/OS MIPS compiler defines these things - in SVR4 mode, but does not define __STDC__. */ +#define HAVE_GCC_VERSION(MAJOR, MINOR) \ + (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR))) -#define PTR void * -#define PTRCONST void *CONST -#define LONG_DOUBLE long double +and then test "#if HAVE_GCC_VERSION(2,7)". -#ifndef IN_GCC -#define AND , -#define NOARGS void -#define VOLATILE volatile -#define SIGNED signed -#endif /* ! IN_GCC */ +So instead we use the macro below and test it against specific values. */ -#define PARAMS(paramlist) paramlist -#define ANSI_PROTOTYPES 1 +/* This macro simplifies testing whether we are using gcc, and if it + is of a particular minimum version. (Both major & minor numbers are + significant.) This macro will evaluate to 0 if we are not using + gcc at all. */ +#ifndef GCC_VERSION +#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +#endif /* GCC_VERSION */ + +#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) || (defined(__alpha) && defined(__cplusplus)) +/* All known AIX compilers implement these things (but don't always + define __STDC__). The RISC/OS MIPS compiler defines these things + in SVR4 mode, but does not define __STDC__. */ +/* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other + C++ compilers, does not define __STDC__, though it acts as if this + was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */ + +#define ANSI_PROTOTYPES 1 +#define PTR void * +#define PTRCONST void *const +#define LONG_DOUBLE long double + +/* PARAMS is often defined elsewhere (e.g. by libintl.h), so wrap it in + a #ifndef. */ +#ifndef PARAMS +#define PARAMS(ARGS) ARGS +#endif -#define VPARAMS(ARGS) ARGS -#define VA_START(va_list,var) va_start(va_list,var) +#define VPARAMS(ARGS) ARGS +#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR) + +/* variadic function helper macros */ +/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's + use without inhibiting further decls and without declaring an + actual variable. */ +#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP, VAR); { struct Qdmy +#define VA_CLOSE(AP) } va_end(AP); } +#define VA_FIXEDARG(AP, T, N) struct Qdmy + +#undef const +#undef volatile +#undef signed + +/* inline requires special treatment; it's in C99, and GCC >=2.7 supports + it too, but it's not in C89. */ +#undef inline +#if __STDC_VERSION__ > 199901L +/* it's a keyword */ +#else +# if GCC_VERSION >= 2007 +# define inline __inline__ /* __inline__ prevents -pedantic warnings */ +# else +# define inline /* nothing */ +# endif +#endif /* These are obsolete. Do not use. */ #ifndef IN_GCC -#define CONST const -#define DOTS , ... +#define CONST const +#define VOLATILE volatile +#define SIGNED signed + #define PROTO(type, name, arglist) type name arglist #define EXFUN(name, proto) name proto #define DEFUN(name, arglist, args) name(args) #define DEFUN_VOID(name) name(void) +#define AND , +#define DOTS , ... +#define NOARGS void #endif /* ! IN_GCC */ #else /* Not ANSI C. */ -#define PTR char * -#define PTRCONST PTR -#define LONG_DOUBLE double - -#ifndef IN_GCC -#define AND ; -#define NOARGS -#define VOLATILE -#define SIGNED -#endif /* !IN_GCC */ - -#ifndef const /* some systems define it in header files for non-ansi mode */ -#define const -#endif - -#define PARAMS(paramlist) () - -#define VPARAMS(ARGS) (va_alist) va_dcl -#define VA_START(va_list,var) va_start(va_list) +#undef ANSI_PROTOTYPES +#define PTR char * +#define PTRCONST PTR +#define LONG_DOUBLE double + +#define PARAMS(args) () +#define VPARAMS(args) (va_alist) va_dcl +#define VA_START(va_list, var) va_start(va_list) + +#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP); { struct Qdmy +#define VA_CLOSE(AP) } va_end(AP); } +#define VA_FIXEDARG(AP, TYPE, NAME) TYPE NAME = va_arg(AP, TYPE) + +/* some systems define these in header files for non-ansi mode */ +#undef const +#undef volatile +#undef signed +#undef inline +#define const +#define volatile +#define signed +#define inline -/* These are obsolete. Do not use. */ #ifndef IN_GCC #define CONST -#define DOTS +#define VOLATILE +#define SIGNED + #define PROTO(type, name, arglist) type name () #define EXFUN(name, proto) name() #define DEFUN(name, arglist, args) name arglist args; #define DEFUN_VOID(name) name() +#define AND ; +#define DOTS +#define NOARGS #endif /* ! IN_GCC */ #endif /* ANSI C. */ +/* Define macros for some gcc attributes. This permits us to use the + macros freely, and know that they will come into play for the + version of gcc in which they are supported. */ + +#if (GCC_VERSION < 2007) +# define __attribute__(x) +#endif + +/* Attribute __malloc__ on functions was valid as of gcc 2.96. */ +#ifndef ATTRIBUTE_MALLOC +# if (GCC_VERSION >= 2096) +# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define ATTRIBUTE_MALLOC +# endif /* GNUC >= 2.96 */ +#endif /* ATTRIBUTE_MALLOC */ + +/* Attributes on labels were valid as of gcc 2.93. */ +#ifndef ATTRIBUTE_UNUSED_LABEL +# if (!defined (__cplusplus) && GCC_VERSION >= 2093) +# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED +# else +# define ATTRIBUTE_UNUSED_LABEL +# endif /* !__cplusplus && GNUC >= 2.93 */ +#endif /* ATTRIBUTE_UNUSED_LABEL */ + +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#endif /* ATTRIBUTE_UNUSED */ + +/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the + identifier name. */ +#if ! defined(__cplusplus) || (GCC_VERSION >= 3004) +# define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED +#else /* !__cplusplus || GNUC >= 3.4 */ +# define ARG_UNUSED(NAME) NAME +#endif /* !__cplusplus || GNUC >= 3.4 */ + +#ifndef ATTRIBUTE_NORETURN +#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +#endif /* ATTRIBUTE_NORETURN */ + +/* Attribute `nonnull' was valid as of gcc 3.3. */ +#ifndef ATTRIBUTE_NONNULL +# if (GCC_VERSION >= 3003) +# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m))) +# else +# define ATTRIBUTE_NONNULL(m) +# endif /* GNUC >= 3.3 */ +#endif /* ATTRIBUTE_NONNULL */ + +/* Attribute `pure' was valid as of gcc 3.0. */ +#ifndef ATTRIBUTE_PURE +# if (GCC_VERSION >= 3000) +# define ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define ATTRIBUTE_PURE +# endif /* GNUC >= 3.0 */ +#endif /* ATTRIBUTE_PURE */ + +/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL. + This was the case for the `printf' format attribute by itself + before GCC 3.3, but as of 3.3 we need to add the `nonnull' + attribute to retain this behavior. */ +#ifndef ATTRIBUTE_PRINTF +#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m) +#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) +#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) +#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) +#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) +#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) +#endif /* ATTRIBUTE_PRINTF */ + +/* Use ATTRIBUTE_FPTR_PRINTF when the format attribute is to be set on + a function pointer. Format attributes were allowed on function + pointers as of gcc 3.1. */ +#ifndef ATTRIBUTE_FPTR_PRINTF +# if (GCC_VERSION >= 3001) +# define ATTRIBUTE_FPTR_PRINTF(m, n) ATTRIBUTE_PRINTF(m, n) +# else +# define ATTRIBUTE_FPTR_PRINTF(m, n) +# endif /* GNUC >= 3.1 */ +# define ATTRIBUTE_FPTR_PRINTF_1 ATTRIBUTE_FPTR_PRINTF(1, 2) +# define ATTRIBUTE_FPTR_PRINTF_2 ATTRIBUTE_FPTR_PRINTF(2, 3) +# define ATTRIBUTE_FPTR_PRINTF_3 ATTRIBUTE_FPTR_PRINTF(3, 4) +# define ATTRIBUTE_FPTR_PRINTF_4 ATTRIBUTE_FPTR_PRINTF(4, 5) +# define ATTRIBUTE_FPTR_PRINTF_5 ATTRIBUTE_FPTR_PRINTF(5, 6) +#endif /* ATTRIBUTE_FPTR_PRINTF */ + +/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A + NULL format specifier was allowed as of gcc 3.3. */ +#ifndef ATTRIBUTE_NULL_PRINTF +# if (GCC_VERSION >= 3003) +# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) +# else +# define ATTRIBUTE_NULL_PRINTF(m, n) +# endif /* GNUC >= 3.3 */ +# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2) +# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3) +# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4) +# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5) +# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6) +#endif /* ATTRIBUTE_NULL_PRINTF */ + +/* Attribute `sentinel' was valid as of gcc 3.5. */ +#ifndef ATTRIBUTE_SENTINEL +# if (GCC_VERSION >= 3005) || defined(__OpenBSD__) +# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__)) +# else +# define ATTRIBUTE_SENTINEL +# endif /* GNUC >= 3.5 */ +#endif /* ATTRIBUTE_SENTINEL */ + + +#ifndef ATTRIBUTE_ALIGNED_ALIGNOF +# if (GCC_VERSION >= 3000) +# define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m)))) +# else +# define ATTRIBUTE_ALIGNED_ALIGNOF(m) +# endif /* GNUC >= 3.0 */ +#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */ + +/* We use __extension__ in some places to suppress -pedantic warnings + about GCC extensions. This feature didn't work properly before + gcc 2.8. */ +#if GCC_VERSION < 2008 +#define __extension__ +#endif + #endif /* ansidecl.h */ diff --git a/gnu/lib/libiberty/include/demangle.h b/gnu/lib/libiberty/include/demangle.h index bff266931c8..af294672736 100644 --- a/gnu/lib/libiberty/include/demangle.h +++ b/gnu/lib/libiberty/include/demangle.h @@ -1,6 +1,6 @@ /* Defs for interface to demanglers. - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002 - Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, + 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,14 +14,14 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ #if !defined (DEMANGLE_H) #define DEMANGLE_H -#include "ansidecl.h" +#include "libiberty.h" #ifdef __cplusplus extern "C" { @@ -35,6 +35,8 @@ extern "C" { #define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */ #define DMGL_VERBOSE (1 << 3) /* Include implementation details. */ #define DMGL_TYPES (1 << 4) /* Also try to demangle type encodings. */ +#define DMGL_RET_POSTFIX (1 << 5) /* Print function return types (when + present) after function signature */ #define DMGL_AUTO (1 << 8) #define DMGL_GNU (1 << 9) @@ -110,31 +112,31 @@ extern const struct demangler_engine } libiberty_demanglers[]; extern char * -cplus_demangle PARAMS ((const char *mangled, int options)); +cplus_demangle (const char *mangled, int options); extern int -cplus_demangle_opname PARAMS ((const char *opname, char *result, int options)); +cplus_demangle_opname (const char *opname, char *result, int options); extern const char * -cplus_mangle_opname PARAMS ((const char *opname, int options)); +cplus_mangle_opname (const char *opname, int options); /* Note: This sets global state. FIXME if you care about multi-threading. */ extern void -set_cplus_marker_for_demangling PARAMS ((int ch)); +set_cplus_marker_for_demangling (int ch); extern enum demangling_styles -cplus_demangle_set_style PARAMS ((enum demangling_styles style)); +cplus_demangle_set_style (enum demangling_styles style); extern enum demangling_styles -cplus_demangle_name_to_style PARAMS ((const char *name)); +cplus_demangle_name_to_style (const char *name); /* V3 ABI demangling entry points, defined in cp-demangle.c. */ extern char* -cplus_demangle_v3 PARAMS ((const char* mangled, int options)); +cplus_demangle_v3 (const char* mangled, int options); extern char* -java_demangle_v3 PARAMS ((const char* mangled)); +java_demangle_v3 (const char* mangled); enum gnu_v3_ctor_kinds { @@ -148,7 +150,7 @@ enum gnu_v3_ctor_kinds { gnu_v3_ctor_kinds' value indicating what kind of constructor it is. */ extern enum gnu_v3_ctor_kinds - is_gnu_v3_mangled_ctor PARAMS ((const char *name)); + is_gnu_v3_mangled_ctor (const char *name); enum gnu_v3_dtor_kinds { @@ -162,7 +164,370 @@ enum gnu_v3_dtor_kinds { gnu_v3_dtor_kinds' value, indicating what kind of destructor it is. */ extern enum gnu_v3_dtor_kinds - is_gnu_v3_mangled_dtor PARAMS ((const char *name)); + is_gnu_v3_mangled_dtor (const char *name); + +/* The V3 demangler works in two passes. The first pass builds a tree + representation of the mangled name, and the second pass turns the + tree representation into a demangled string. Here we define an + interface to permit a caller to build their own tree + representation, which they can pass to the demangler to get a + demangled string. This can be used to canonicalize user input into + something which the demangler might output. It could also be used + by other demanglers in the future. */ + +/* These are the component types which may be found in the tree. Many + component types have one or two subtrees, referred to as left and + right (a component type with only one subtree puts it in the left + subtree). */ + +enum demangle_component_type +{ + /* A name, with a length and a pointer to a string. */ + DEMANGLE_COMPONENT_NAME, + /* A qualified name. The left subtree is a class or namespace or + some such thing, and the right subtree is a name qualified by + that class. */ + DEMANGLE_COMPONENT_QUAL_NAME, + /* A local name. The left subtree describes a function, and the + right subtree is a name which is local to that function. */ + DEMANGLE_COMPONENT_LOCAL_NAME, + /* A typed name. The left subtree is a name, and the right subtree + describes that name as a function. */ + DEMANGLE_COMPONENT_TYPED_NAME, + /* A template. The left subtree is a template name, and the right + subtree is a template argument list. */ + DEMANGLE_COMPONENT_TEMPLATE, + /* A template parameter. This holds a number, which is the template + parameter index. */ + DEMANGLE_COMPONENT_TEMPLATE_PARAM, + /* A constructor. This holds a name and the kind of + constructor. */ + DEMANGLE_COMPONENT_CTOR, + /* A destructor. This holds a name and the kind of destructor. */ + DEMANGLE_COMPONENT_DTOR, + /* A vtable. This has one subtree, the type for which this is a + vtable. */ + DEMANGLE_COMPONENT_VTABLE, + /* A VTT structure. This has one subtree, the type for which this + is a VTT. */ + DEMANGLE_COMPONENT_VTT, + /* A construction vtable. The left subtree is the type for which + this is a vtable, and the right subtree is the derived type for + which this vtable is built. */ + DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, + /* A typeinfo structure. This has one subtree, the type for which + this is the tpeinfo structure. */ + DEMANGLE_COMPONENT_TYPEINFO, + /* A typeinfo name. This has one subtree, the type for which this + is the typeinfo name. */ + DEMANGLE_COMPONENT_TYPEINFO_NAME, + /* A typeinfo function. This has one subtree, the type for which + this is the tpyeinfo function. */ + DEMANGLE_COMPONENT_TYPEINFO_FN, + /* A thunk. This has one subtree, the name for which this is a + thunk. */ + DEMANGLE_COMPONENT_THUNK, + /* A virtual thunk. This has one subtree, the name for which this + is a virtual thunk. */ + DEMANGLE_COMPONENT_VIRTUAL_THUNK, + /* A covariant thunk. This has one subtree, the name for which this + is a covariant thunk. */ + DEMANGLE_COMPONENT_COVARIANT_THUNK, + /* A Java class. This has one subtree, the type. */ + DEMANGLE_COMPONENT_JAVA_CLASS, + /* A guard variable. This has one subtree, the name for which this + is a guard variable. */ + DEMANGLE_COMPONENT_GUARD, + /* A reference temporary. This has one subtree, the name for which + this is a temporary. */ + DEMANGLE_COMPONENT_REFTEMP, + /* A hidden alias. This has one subtree, the encoding for which it + is providing alternative linkage. */ + DEMANGLE_COMPONENT_HIDDEN_ALIAS, + /* A standard substitution. This holds the name of the + substitution. */ + DEMANGLE_COMPONENT_SUB_STD, + /* The restrict qualifier. The one subtree is the type which is + being qualified. */ + DEMANGLE_COMPONENT_RESTRICT, + /* The volatile qualifier. The one subtree is the type which is + being qualified. */ + DEMANGLE_COMPONENT_VOLATILE, + /* The const qualifier. The one subtree is the type which is being + qualified. */ + DEMANGLE_COMPONENT_CONST, + /* The restrict qualifier modifying a member function. The one + subtree is the type which is being qualified. */ + DEMANGLE_COMPONENT_RESTRICT_THIS, + /* The volatile qualifier modifying a member function. The one + subtree is the type which is being qualified. */ + DEMANGLE_COMPONENT_VOLATILE_THIS, + /* The const qualifier modifying a member function. The one subtree + is the type which is being qualified. */ + DEMANGLE_COMPONENT_CONST_THIS, + /* A vendor qualifier. The left subtree is the type which is being + qualified, and the right subtree is the name of the + qualifier. */ + DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL, + /* A pointer. The one subtree is the type which is being pointed + to. */ + DEMANGLE_COMPONENT_POINTER, + /* A reference. The one subtree is the type which is being + referenced. */ + DEMANGLE_COMPONENT_REFERENCE, + /* A complex type. The one subtree is the base type. */ + DEMANGLE_COMPONENT_COMPLEX, + /* An imaginary type. The one subtree is the base type. */ + DEMANGLE_COMPONENT_IMAGINARY, + /* A builtin type. This holds the builtin type information. */ + DEMANGLE_COMPONENT_BUILTIN_TYPE, + /* A vendor's builtin type. This holds the name of the type. */ + DEMANGLE_COMPONENT_VENDOR_TYPE, + /* A function type. The left subtree is the return type. The right + subtree is a list of ARGLIST nodes. Either or both may be + NULL. */ + DEMANGLE_COMPONENT_FUNCTION_TYPE, + /* An array type. The left subtree is the dimension, which may be + NULL, or a string (represented as DEMANGLE_COMPONENT_NAME), or an + expression. The right subtree is the element type. */ + DEMANGLE_COMPONENT_ARRAY_TYPE, + /* A pointer to member type. The left subtree is the class type, + and the right subtree is the member type. CV-qualifiers appear + on the latter. */ + DEMANGLE_COMPONENT_PTRMEM_TYPE, + /* An argument list. The left subtree is the current argument, and + the right subtree is either NULL or another ARGLIST node. */ + DEMANGLE_COMPONENT_ARGLIST, + /* A template argument list. The left subtree is the current + template argument, and the right subtree is either NULL or + another TEMPLATE_ARGLIST node. */ + DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, + /* An operator. This holds information about a standard + operator. */ + DEMANGLE_COMPONENT_OPERATOR, + /* An extended operator. This holds the number of arguments, and + the name of the extended operator. */ + DEMANGLE_COMPONENT_EXTENDED_OPERATOR, + /* A typecast, represented as a unary operator. The one subtree is + the type to which the argument should be cast. */ + DEMANGLE_COMPONENT_CAST, + /* A unary expression. The left subtree is the operator, and the + right subtree is the single argument. */ + DEMANGLE_COMPONENT_UNARY, + /* A binary expression. The left subtree is the operator, and the + right subtree is a BINARY_ARGS. */ + DEMANGLE_COMPONENT_BINARY, + /* Arguments to a binary expression. The left subtree is the first + argument, and the right subtree is the second argument. */ + DEMANGLE_COMPONENT_BINARY_ARGS, + /* A trinary expression. The left subtree is the operator, and the + right subtree is a TRINARY_ARG1. */ + DEMANGLE_COMPONENT_TRINARY, + /* Arguments to a trinary expression. The left subtree is the first + argument, and the right subtree is a TRINARY_ARG2. */ + DEMANGLE_COMPONENT_TRINARY_ARG1, + /* More arguments to a trinary expression. The left subtree is the + second argument, and the right subtree is the third argument. */ + DEMANGLE_COMPONENT_TRINARY_ARG2, + /* A literal. The left subtree is the type, and the right subtree + is the value, represented as a DEMANGLE_COMPONENT_NAME. */ + DEMANGLE_COMPONENT_LITERAL, + /* A negative literal. Like LITERAL, but the value is negated. + This is a minor hack: the NAME used for LITERAL points directly + to the mangled string, but since negative numbers are mangled + using 'n' instead of '-', we want a way to indicate a negative + number which involves neither modifying the mangled string nor + allocating a new copy of the literal in memory. */ + DEMANGLE_COMPONENT_LITERAL_NEG +}; + +/* Types which are only used internally. */ + +struct demangle_operator_info; +struct demangle_builtin_type_info; + +/* A node in the tree representation is an instance of a struct + demangle_component. Note that the field names of the struct are + not well protected against macros defined by the file including + this one. We can fix this if it ever becomes a problem. */ + +struct demangle_component +{ + /* The type of this component. */ + enum demangle_component_type type; + + union + { + /* For DEMANGLE_COMPONENT_NAME. */ + struct + { + /* A pointer to the name (which need not NULL terminated) and + its length. */ + const char *s; + int len; + } s_name; + + /* For DEMANGLE_COMPONENT_OPERATOR. */ + struct + { + /* Operator. */ + const struct demangle_operator_info *op; + } s_operator; + + /* For DEMANGLE_COMPONENT_EXTENDED_OPERATOR. */ + struct + { + /* Number of arguments. */ + int args; + /* Name. */ + struct demangle_component *name; + } s_extended_operator; + + /* For DEMANGLE_COMPONENT_CTOR. */ + struct + { + /* Kind of constructor. */ + enum gnu_v3_ctor_kinds kind; + /* Name. */ + struct demangle_component *name; + } s_ctor; + + /* For DEMANGLE_COMPONENT_DTOR. */ + struct + { + /* Kind of destructor. */ + enum gnu_v3_dtor_kinds kind; + /* Name. */ + struct demangle_component *name; + } s_dtor; + + /* For DEMANGLE_COMPONENT_BUILTIN_TYPE. */ + struct + { + /* Builtin type. */ + const struct demangle_builtin_type_info *type; + } s_builtin; + + /* For DEMANGLE_COMPONENT_SUB_STD. */ + struct + { + /* Standard substitution string. */ + const char* string; + /* Length of string. */ + int len; + } s_string; + + /* For DEMANGLE_COMPONENT_TEMPLATE_PARAM. */ + struct + { + /* Template parameter index. */ + long number; + } s_number; + + /* For other types. */ + struct + { + /* Left (or only) subtree. */ + struct demangle_component *left; + /* Right subtree. */ + struct demangle_component *right; + } s_binary; + + } u; +}; + +/* People building mangled trees are expected to allocate instances of + struct demangle_component themselves. They can then call one of + the following functions to fill them in. */ + +/* Fill in most component types with a left subtree and a right + subtree. Returns non-zero on success, zero on failure, such as an + unrecognized or inappropriate component type. */ + +extern int +cplus_demangle_fill_component (struct demangle_component *fill, + enum demangle_component_type, + struct demangle_component *left, + struct demangle_component *right); + +/* Fill in a DEMANGLE_COMPONENT_NAME. Returns non-zero on success, + zero for bad arguments. */ + +extern int +cplus_demangle_fill_name (struct demangle_component *fill, + const char *, int); + +/* Fill in a DEMANGLE_COMPONENT_BUILTIN_TYPE, using the name of the + builtin type (e.g., "int", etc.). Returns non-zero on success, + zero if the type is not recognized. */ + +extern int +cplus_demangle_fill_builtin_type (struct demangle_component *fill, + const char *type_name); + +/* Fill in a DEMANGLE_COMPONENT_OPERATOR, using the name of the + operator and the number of arguments which it takes (the latter is + used to disambiguate operators which can be both binary and unary, + such as '-'). Returns non-zero on success, zero if the operator is + not recognized. */ + +extern int +cplus_demangle_fill_operator (struct demangle_component *fill, + const char *opname, int args); + +/* Fill in a DEMANGLE_COMPONENT_EXTENDED_OPERATOR, providing the + number of arguments and the name. Returns non-zero on success, + zero for bad arguments. */ + +extern int +cplus_demangle_fill_extended_operator (struct demangle_component *fill, + int numargs, + struct demangle_component *nm); + +/* Fill in a DEMANGLE_COMPONENT_CTOR. Returns non-zero on success, + zero for bad arguments. */ + +extern int +cplus_demangle_fill_ctor (struct demangle_component *fill, + enum gnu_v3_ctor_kinds kind, + struct demangle_component *name); + +/* Fill in a DEMANGLE_COMPONENT_DTOR. Returns non-zero on success, + zero for bad arguments. */ + +extern int +cplus_demangle_fill_dtor (struct demangle_component *fill, + enum gnu_v3_dtor_kinds kind, + struct demangle_component *name); + +/* This function translates a mangled name into a struct + demangle_component tree. The first argument is the mangled name. + The second argument is DMGL_* options. This returns a pointer to a + tree on success, or NULL on failure. On success, the third + argument is set to a block of memory allocated by malloc. This + block should be passed to free when the tree is no longer + needed. */ + +extern struct demangle_component * +cplus_demangle_v3_components (const char *mangled, int options, void **mem); + +/* This function takes a struct demangle_component tree and returns + the corresponding demangled string. The first argument is DMGL_* + options. The second is the tree to demangle. The third is a guess + at the length of the demangled string, used to initially allocate + the return buffer. The fourth is a pointer to a size_t. On + success, this function returns a buffer allocated by malloc(), and + sets the size_t pointed to by the fourth argument to the size of + the allocated buffer (not the length of the returned string). On + failure, this function returns NULL, and sets the size_t pointed to + by the fourth argument to 0 for an invalid tree, or to 1 for a + memory allocation error. */ + +extern char * +cplus_demangle_print (int options, + const struct demangle_component *tree, + int estimated_length, + size_t *p_allocated_size); #ifdef __cplusplus } diff --git a/gnu/lib/libiberty/include/dyn-string.h b/gnu/lib/libiberty/include/dyn-string.h index 2a771c7a5d1..ae766e51ebd 100644 --- a/gnu/lib/libiberty/include/dyn-string.h +++ b/gnu/lib/libiberty/include/dyn-string.h @@ -1,5 +1,5 @@ /* An abstract string datatype. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GCC. @@ -16,8 +16,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ typedef struct dyn_string @@ -69,24 +69,21 @@ typedef struct dyn_string #endif /* IN_LIBGCC2 || IN_GLIBCPP_V3 */ -extern int dyn_string_init PARAMS ((struct dyn_string *, int)); -extern dyn_string_t dyn_string_new PARAMS ((int)); -extern void dyn_string_delete PARAMS ((dyn_string_t)); -extern char *dyn_string_release PARAMS ((dyn_string_t)); -extern dyn_string_t dyn_string_resize PARAMS ((dyn_string_t, int)); -extern void dyn_string_clear PARAMS ((dyn_string_t)); -extern int dyn_string_copy PARAMS ((dyn_string_t, dyn_string_t)); -extern int dyn_string_copy_cstr PARAMS ((dyn_string_t, const char *)); -extern int dyn_string_prepend PARAMS ((dyn_string_t, dyn_string_t)); -extern int dyn_string_prepend_cstr PARAMS ((dyn_string_t, const char *)); -extern int dyn_string_insert PARAMS ((dyn_string_t, int, - dyn_string_t)); -extern int dyn_string_insert_cstr PARAMS ((dyn_string_t, int, - const char *)); -extern int dyn_string_insert_char PARAMS ((dyn_string_t, int, int)); -extern int dyn_string_append PARAMS ((dyn_string_t, dyn_string_t)); -extern int dyn_string_append_cstr PARAMS ((dyn_string_t, const char *)); -extern int dyn_string_append_char PARAMS ((dyn_string_t, int)); -extern int dyn_string_substring PARAMS ((dyn_string_t, - dyn_string_t, int, int)); -extern int dyn_string_eq PARAMS ((dyn_string_t, dyn_string_t)); +extern int dyn_string_init (struct dyn_string *, int); +extern dyn_string_t dyn_string_new (int); +extern void dyn_string_delete (dyn_string_t); +extern char *dyn_string_release (dyn_string_t); +extern dyn_string_t dyn_string_resize (dyn_string_t, int); +extern void dyn_string_clear (dyn_string_t); +extern int dyn_string_copy (dyn_string_t, dyn_string_t); +extern int dyn_string_copy_cstr (dyn_string_t, const char *); +extern int dyn_string_prepend (dyn_string_t, dyn_string_t); +extern int dyn_string_prepend_cstr (dyn_string_t, const char *); +extern int dyn_string_insert (dyn_string_t, int, dyn_string_t); +extern int dyn_string_insert_cstr (dyn_string_t, int, const char *); +extern int dyn_string_insert_char (dyn_string_t, int, int); +extern int dyn_string_append (dyn_string_t, dyn_string_t); +extern int dyn_string_append_cstr (dyn_string_t, const char *); +extern int dyn_string_append_char (dyn_string_t, int); +extern int dyn_string_substring (dyn_string_t, dyn_string_t, int, int); +extern int dyn_string_eq (dyn_string_t, dyn_string_t); diff --git a/gnu/lib/libiberty/include/floatformat.h b/gnu/lib/libiberty/include/floatformat.h index a8244ada5c7..f1bd7f601f5 100644 --- a/gnu/lib/libiberty/include/floatformat.h +++ b/gnu/lib/libiberty/include/floatformat.h @@ -1,5 +1,6 @@ /* IEEE floating point support declarations, for GDB, the GNU Debugger. - Copyright 1991, 1994, 1995, 1997, 2000, 2003 Free Software Foundation, Inc. + Copyright 1991, 1994, 1995, 1997, 2000, 2003, 2005 + Free Software Foundation, Inc. This file is part of GDB. @@ -15,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #if !defined (FLOATFORMAT_H) #define FLOATFORMAT_H 1 @@ -28,25 +29,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ (i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field contains with the *_start and *_len fields. */ -/* What is the order of the bytes. */ +/* What is the order of the bytes? */ enum floatformat_byteorders { - /* Standard little endian byte order. EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */ - floatformat_little, /* Standard big endian byte order. EX: 1.2345678e10 => 42 06 fe e0 c5 80 00 00 */ - floatformat_big, /* Little endian byte order but big endian word order. EX: 1.2345678e10 => e0 fe 06 42 00 00 80 c5 */ + floatformat_littlebyte_bigword, - floatformat_littlebyte_bigword - + /* VAX byte order. Little endian byte order with 16-bit words. The + following example is an illustration of the byte order only; VAX + doesn't have a fully IEEE compliant floating-point format. + EX: 1.2345678e10 => 80 c5 00 00 06 42 e0 fe */ + floatformat_vax }; enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no }; @@ -82,7 +84,7 @@ struct floatformat const char *name; /* Validator method. */ - int (*is_valid) PARAMS ((const struct floatformat *fmt, const char *from)); + int (*is_valid) (const struct floatformat *fmt, const void *from); }; /* floatformats for IEEE single and double, big and little endian. */ @@ -96,6 +98,12 @@ extern const struct floatformat floatformat_ieee_double_little; extern const struct floatformat floatformat_ieee_double_littlebyte_bigword; +/* floatformats for VAX. */ + +extern const struct floatformat floatformat_vax_f; +extern const struct floatformat floatformat_vax_d; +extern const struct floatformat floatformat_vax_g; + /* floatformats for various extendeds. */ extern const struct floatformat floatformat_i387_ext; @@ -116,18 +124,17 @@ extern const struct floatformat floatformat_ia64_quad_little; Store the double in *TO. */ extern void -floatformat_to_double PARAMS ((const struct floatformat *, const char *, double *)); +floatformat_to_double (const struct floatformat *, const void *, double *); /* The converse: convert the double *FROM to FMT and store where TO points. */ extern void -floatformat_from_double PARAMS ((const struct floatformat *, - const double *, char *)); +floatformat_from_double (const struct floatformat *, const double *, void *); /* Return non-zero iff the data at FROM is a valid number in format FMT. */ extern int -floatformat_is_valid PARAMS ((const struct floatformat *fmt, const char *from)); +floatformat_is_valid (const struct floatformat *fmt, const void *from); #endif /* defined (FLOATFORMAT_H) */ diff --git a/gnu/lib/libiberty/include/hashtab.h b/gnu/lib/libiberty/include/hashtab.h index 07a8cd6aec8..225bcd91323 100644 --- a/gnu/lib/libiberty/include/hashtab.h +++ b/gnu/lib/libiberty/include/hashtab.h @@ -1,5 +1,5 @@ /* An expandable hash tables datatype. - Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Vladimir Makarov (vmakarov@cygnus.com). This program is free software; you can redistribute it and/or modify @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This package implements basic hash table functionality. It is possible to search for an entry, create an entry and destroy an entry. @@ -81,6 +81,15 @@ typedef void (*htab_free) PARAMS ((PTR)); typedef PTR (*htab_alloc_with_arg) PARAMS ((void *, size_t, size_t)); typedef void (*htab_free_with_arg) PARAMS ((void *, void *)); +/* This macro defines reserved value for empty table entry. */ + +#define HTAB_EMPTY_ENTRY ((PTR) 0) + +/* This macro defines reserved value for table entry which contained + a deleted element. */ + +#define HTAB_DELETED_ENTRY ((PTR) 1) + /* Hash tables are of the following type. The structure (implementation) of this type is not needed for using the hash tables. All work with hash table should be executed only through @@ -101,13 +110,13 @@ struct htab GTY(()) /* Table itself. */ PTR * GTY ((use_param (""), length ("%h.size"))) entries; - /* Current size (in entries) of the hash table */ + /* Current size (in entries) of the hash table. */ size_t size; - /* Current number of elements including also deleted elements */ + /* Current number of elements including also deleted elements. */ size_t n_elements; - /* Current number of deleted elements in the table */ + /* Current number of deleted elements in the table. */ size_t n_deleted; /* The following member is used for debugging. Its value is number @@ -126,6 +135,10 @@ struct htab GTY(()) PTR GTY((skip (""))) alloc_arg; htab_alloc_with_arg alloc_with_arg_f; htab_free_with_arg free_with_arg_f; + + /* Current size (in entries) of the hash table, as an index into the + table of primes. */ + unsigned int size_prime_index; }; typedef struct htab *htab_t; @@ -135,44 +148,42 @@ enum insert_option {NO_INSERT, INSERT}; /* The prototypes of the package functions. */ -extern htab_t htab_create_alloc PARAMS ((size_t, htab_hash, - htab_eq, htab_del, - htab_alloc, htab_free)); +extern htab_t htab_create_alloc (size_t, htab_hash, + htab_eq, htab_del, + htab_alloc, htab_free); -extern htab_t htab_create_alloc_ex PARAMS ((size_t, htab_hash, - htab_eq, htab_del, - PTR, htab_alloc_with_arg, - htab_free_with_arg)); +extern htab_t htab_create_alloc_ex (size_t, htab_hash, + htab_eq, htab_del, + void *, htab_alloc_with_arg, + htab_free_with_arg); /* Backward-compatibility functions. */ -extern htab_t htab_create PARAMS ((size_t, htab_hash, htab_eq, htab_del)); -extern htab_t htab_try_create PARAMS ((size_t, htab_hash, htab_eq, htab_del)); - -extern void htab_set_functions_ex PARAMS ((htab_t, htab_hash, - htab_eq, htab_del, - PTR, htab_alloc_with_arg, - htab_free_with_arg)); - -extern void htab_delete PARAMS ((htab_t)); -extern void htab_empty PARAMS ((htab_t)); - -extern PTR htab_find PARAMS ((htab_t, const void *)); -extern PTR *htab_find_slot PARAMS ((htab_t, const void *, - enum insert_option)); -extern PTR htab_find_with_hash PARAMS ((htab_t, const void *, - hashval_t)); -extern PTR *htab_find_slot_with_hash PARAMS ((htab_t, const void *, - hashval_t, - enum insert_option)); -extern void htab_clear_slot PARAMS ((htab_t, void **)); -extern void htab_remove_elt PARAMS ((htab_t, void *)); - -extern void htab_traverse PARAMS ((htab_t, htab_trav, void *)); -extern void htab_traverse_noresize PARAMS ((htab_t, htab_trav, void *)); - -extern size_t htab_size PARAMS ((htab_t)); -extern size_t htab_elements PARAMS ((htab_t)); -extern double htab_collisions PARAMS ((htab_t)); +extern htab_t htab_create (size_t, htab_hash, htab_eq, htab_del); +extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del); + +extern void htab_set_functions_ex (htab_t, htab_hash, + htab_eq, htab_del, + void *, htab_alloc_with_arg, + htab_free_with_arg); + +extern void htab_delete (htab_t); +extern void htab_empty (htab_t); + +extern void * htab_find (htab_t, const void *); +extern void ** htab_find_slot (htab_t, const void *, enum insert_option); +extern void * htab_find_with_hash (htab_t, const void *, hashval_t); +extern void ** htab_find_slot_with_hash (htab_t, const void *, + hashval_t, enum insert_option); +extern void htab_clear_slot (htab_t, void **); +extern void htab_remove_elt (htab_t, void *); +extern void htab_remove_elt_with_hash (htab_t, void *, hashval_t); + +extern void htab_traverse (htab_t, htab_trav, void *); +extern void htab_traverse_noresize (htab_t, htab_trav, void *); + +extern size_t htab_size (htab_t); +extern size_t htab_elements (htab_t); +extern double htab_collisions (htab_t); /* A hash function for pointers. */ extern htab_hash htab_hash_pointer; @@ -181,7 +192,12 @@ extern htab_hash htab_hash_pointer; extern htab_eq htab_eq_pointer; /* A hash function for null-terminated strings. */ -extern hashval_t htab_hash_string PARAMS ((const PTR)); +extern hashval_t htab_hash_string (const void *); + +/* An iterative hash function for arbitrary data. */ +extern hashval_t iterative_hash (const void *, size_t, hashval_t); +/* Shorthand for hashing something with an intrinsic size. */ +#define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT) /* XXX Old hash table functions, kept for compatibility */ @@ -210,10 +226,10 @@ typedef struct int collisions; /* Pointer to function for evaluation of hash value (any unsigned value). This function has one parameter of type hash_table_entry_t. */ - unsigned (*hash_function) PARAMS ((hash_table_entry_t)); + unsigned (*hash_function) (hash_table_entry_t); /* Pointer to function for test on equality of hash table elements (two parameter of type hash_table_entry_t. */ - int (*eq_function) PARAMS ((hash_table_entry_t, hash_table_entry_t)); + int (*eq_function) (hash_table_entry_t, hash_table_entry_t); /* Table itself */ hash_table_entry_t *entries; } *hash_table_t; @@ -222,26 +238,26 @@ typedef struct /* The prototypes of the package functions. */ extern hash_table_t create_hash_table - PARAMS ((size_t, unsigned (*) (hash_table_entry_t), - int (*) (hash_table_entry_t, hash_table_entry_t))); + (size_t, unsigned (*) (hash_table_entry_t), + int (*) (hash_table_entry_t, hash_table_entry_t)); -extern void delete_hash_table PARAMS ((hash_table_t)); +extern void delete_hash_table (hash_table_t); -extern void empty_hash_table PARAMS ((hash_table_t)); +extern void empty_hash_table (hash_table_t); extern hash_table_entry_t *find_hash_table_entry - PARAMS ((hash_table_t, hash_table_entry_t, int)); + (hash_table_t, hash_table_entry_t, int); -extern void remove_element_from_hash_table_entry PARAMS ((hash_table_t, - hash_table_entry_t)); +extern void remove_element_from_hash_table_entry (hash_table_t, + hash_table_entry_t); -extern size_t hash_table_size PARAMS ((hash_table_t)); +extern size_t hash_table_size (hash_table_t); -extern size_t hash_table_elements_number PARAMS ((hash_table_t)); +extern size_t hash_table_elements_number (hash_table_t); -extern int hash_table_collisions PARAMS ((hash_table_t)); +extern int hash_table_collisions (hash_table_t); -extern int all_hash_table_collisions PARAMS ((void)); +extern int all_hash_table_collisions (void); #ifdef __cplusplus } diff --git a/gnu/lib/libiberty/include/libiberty.h b/gnu/lib/libiberty/include/libiberty.h index 676ceaba4a9..1e07013bb33 100644 --- a/gnu/lib/libiberty/include/libiberty.h +++ b/gnu/lib/libiberty/include/libiberty.h @@ -1,6 +1,6 @@ /* Function declarations for libiberty. - Copyright 2001, 2002 Free Software Foundation, Inc. + Copyright 2001, 2002, 2005 Free Software Foundation, Inc. Note - certain prototypes declared in this header file are for functions whoes implementation copyright does not belong to the @@ -21,8 +21,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. Written by Cygnus Support, 1994. @@ -41,27 +41,50 @@ extern "C" { #include "ansidecl.h" -#ifdef ANSI_PROTOTYPES /* Get a definition for size_t. */ #include <stddef.h> /* Get a definition for va_list. */ #include <stdarg.h> -#endif + +#include <stdio.h> + +/* If the OS supports it, ensure that the supplied stream is setup to + avoid any multi-threaded locking. Otherwise leave the FILE pointer + unchanged. If the stream is NULL do nothing. */ + +extern void unlock_stream (FILE *); + +/* If the OS supports it, ensure that the standard I/O streams, stdin, + stdout and stderr are setup to avoid any multi-threaded locking. + Otherwise do nothing. */ + +extern void unlock_std_streams (void); + +/* Open and return a FILE pointer. If the OS supports it, ensure that + the stream is setup to avoid any multi-threaded locking. Otherwise + return the FILE pointer unchanged. */ + +extern FILE *fopen_unlocked (const char *, const char *); +extern FILE *fdopen_unlocked (int, const char *); +extern FILE *freopen_unlocked (const char *, const char *, FILE *); /* Build an argument vector from a string. Allocates memory using malloc. Use freeargv to free the vector. */ -extern char **buildargv PARAMS ((const char *)) ATTRIBUTE_MALLOC; +extern char **buildargv (const char *) ATTRIBUTE_MALLOC; /* Free a vector returned by buildargv. */ -extern void freeargv PARAMS ((char **)); +extern void freeargv (char **); /* Duplicate an argument vector. Allocates memory using malloc. Use freeargv to free the vector. */ -extern char **dupargv PARAMS ((char **)) ATTRIBUTE_MALLOC; +extern char **dupargv (char **) ATTRIBUTE_MALLOC; + +/* Expand "@file" arguments in argv. */ +extern void expandargv PARAMS ((int *, char ***)); /* Return the last component of a path name. Note that we can't use a prototype here because the parameter is declared inconsistently @@ -74,26 +97,29 @@ extern char **dupargv PARAMS ((char **)) ATTRIBUTE_MALLOC; to find the declaration so provide a fully prototyped one. If it is 1, we found it so don't provide any declaration at all. */ #if !HAVE_DECL_BASENAME -#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (HAVE_DECL_BASENAME) -extern char *basename PARAMS ((const char *)); +#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME) +extern char *basename (const char *); #else -extern char *basename (); +/* Do not allow basename to be used if there is no prototype seen. We + either need to use the above prototype or have one from + autoconf which would result in HAVE_DECL_BASENAME being set. */ +#define basename basename_cannot_be_used_without_a_prototype #endif #endif /* A well-defined basename () that is always compiled in. */ -extern const char *lbasename PARAMS ((const char *)); +extern const char *lbasename (const char *); /* A well-defined realpath () that is always compiled in. */ -extern char *lrealpath PARAMS ((const char *)); +extern char *lrealpath (const char *); /* Concatenate an arbitrary number of strings. You must pass NULL as the last argument of this function, to terminate the list of strings. Allocates memory using xmalloc. */ -extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC; +extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL; /* Concatenate an arbitrary number of strings. You must pass NULL as the last argument of this function, to terminate the list of @@ -102,27 +128,27 @@ extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC; pointer to be freed after the new string is created, similar to the way xrealloc works. */ -extern char *reconcat PARAMS ((char *, const char *, ...)) ATTRIBUTE_MALLOC; +extern char *reconcat (char *, const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_SENTINEL; /* Determine the length of concatenating an arbitrary number of strings. You must pass NULL as the last argument of this function, to terminate the list of strings. */ -extern unsigned long concat_length PARAMS ((const char *, ...)); +extern unsigned long concat_length (const char *, ...) ATTRIBUTE_SENTINEL; /* Concatenate an arbitrary number of strings into a SUPPLIED area of memory. You must pass NULL as the last argument of this function, to terminate the list of strings. The supplied memory is assumed to be large enough. */ -extern char *concat_copy PARAMS ((char *, const char *, ...)); +extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_SENTINEL; /* Concatenate an arbitrary number of strings into a GLOBAL area of memory. You must pass NULL as the last argument of this function, to terminate the list of strings. The supplied memory is assumed to be large enough. */ -extern char *concat_copy2 PARAMS ((const char *, ...)); +extern char *concat_copy2 (const char *, ...) ATTRIBUTE_SENTINEL; /* This is the global area used by concat_copy2. */ @@ -133,133 +159,188 @@ extern char *libiberty_concat_ptr; strings. Allocates memory using alloca. The arguments are evaluated twice! */ #define ACONCAT(ACONCAT_PARAMS) \ - (libiberty_concat_ptr = alloca (concat_length ACONCAT_PARAMS + 1), \ + (libiberty_concat_ptr = (char *) alloca (concat_length ACONCAT_PARAMS + 1), \ concat_copy2 ACONCAT_PARAMS) /* Check whether two file descriptors refer to the same file. */ -extern int fdmatch PARAMS ((int fd1, int fd2)); +extern int fdmatch (int fd1, int fd2); + +/* Return the position of the first bit set in the argument. */ +/* Prototypes vary from system to system, so we only provide a + prototype on systems where we know that we need it. */ +#if defined (HAVE_DECL_FFS) && !HAVE_DECL_FFS +extern int ffs(int); +#endif /* Get the working directory. The result is cached, so don't call chdir() between calls to getpwd(). */ -extern char * getpwd PARAMS ((void)); +extern char * getpwd (void); + +/* Get the current time. */ +/* Prototypes vary from system to system, so we only provide a + prototype on systems where we know that we need it. */ +#ifdef __MINGW32__ +/* Forward declaration to avoid #include <sys/time.h>. */ +struct timeval; +extern int gettimeofday (struct timeval *, void *); +#endif /* Get the amount of time the process has run, in microseconds. */ -extern long get_run_time PARAMS ((void)); +extern long get_run_time (void); /* Generate a relocated path to some installation directory. Allocates return value using malloc. */ -extern char *make_relative_prefix PARAMS ((const char *, const char *, - const char *)); +extern char *make_relative_prefix (const char *, const char *, + const char *) ATTRIBUTE_MALLOC; /* Choose a temporary directory to use for scratch files. */ -extern char *choose_temp_base PARAMS ((void)) ATTRIBUTE_MALLOC; +extern char *choose_temp_base (void) ATTRIBUTE_MALLOC; /* Return a temporary file name or NULL if unable to create one. */ -extern char *make_temp_file PARAMS ((const char *)) ATTRIBUTE_MALLOC; +extern char *make_temp_file (const char *) ATTRIBUTE_MALLOC; + +/* Remove a link to a file unless it is special. */ + +extern int unlink_if_ordinary (const char *); /* Allocate memory filled with spaces. Allocates using malloc. */ -extern const char *spaces PARAMS ((int count)); +extern const char *spaces (int count); /* Return the maximum error number for which strerror will return a string. */ -extern int errno_max PARAMS ((void)); +extern int errno_max (void); /* Return the name of an errno value (e.g., strerrno (EINVAL) returns "EINVAL"). */ -extern const char *strerrno PARAMS ((int)); +extern const char *strerrno (int); /* Given the name of an errno value, return the value. */ -extern int strtoerrno PARAMS ((const char *)); +extern int strtoerrno (const char *); /* ANSI's strerror(), but more robust. */ -extern char *xstrerror PARAMS ((int)); +extern char *xstrerror (int); /* Return the maximum signal number for which strsignal will return a string. */ -extern int signo_max PARAMS ((void)); +extern int signo_max (void); /* Return a signal message string for a signal number (e.g., strsignal (SIGHUP) returns something like "Hangup"). */ /* This is commented out as it can conflict with one in system headers. We still document its existence though. */ -/*extern const char *strsignal PARAMS ((int));*/ +/*extern const char *strsignal (int);*/ /* Return the name of a signal number (e.g., strsigno (SIGHUP) returns "SIGHUP"). */ -extern const char *strsigno PARAMS ((int)); +extern const char *strsigno (int); /* Given the name of a signal, return its number. */ -extern int strtosigno PARAMS ((const char *)); +extern int strtosigno (const char *); /* Register a function to be run by xexit. Returns 0 on success. */ -extern int xatexit PARAMS ((void (*fn) (void))); +extern int xatexit (void (*fn) (void)); /* Exit, calling all the functions registered with xatexit. */ -extern void xexit PARAMS ((int status)) ATTRIBUTE_NORETURN; +extern void xexit (int status) ATTRIBUTE_NORETURN; /* Set the program name used by xmalloc. */ -extern void xmalloc_set_program_name PARAMS ((const char *)); +extern void xmalloc_set_program_name (const char *); /* Report an allocation failure. */ -extern void xmalloc_failed PARAMS ((size_t)) ATTRIBUTE_NORETURN; +extern void xmalloc_failed (size_t) ATTRIBUTE_NORETURN; /* Allocate memory without fail. If malloc fails, this will print a message to stderr (using the name set by xmalloc_set_program_name, if any) and then call xexit. */ -extern PTR xmalloc PARAMS ((size_t)) ATTRIBUTE_MALLOC; +extern void *xmalloc (size_t) ATTRIBUTE_MALLOC; /* Reallocate memory without fail. This works like xmalloc. Note, realloc type functions are not suitable for attribute malloc since they may return the same address across multiple calls. */ -extern PTR xrealloc PARAMS ((PTR, size_t)); +extern void *xrealloc (void *, size_t); /* Allocate memory without fail and set it to zero. This works like xmalloc. */ -extern PTR xcalloc PARAMS ((size_t, size_t)) ATTRIBUTE_MALLOC; +extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC; /* Copy a string into a memory buffer without fail. */ -extern char *xstrdup PARAMS ((const char *)) ATTRIBUTE_MALLOC; +extern char *xstrdup (const char *) ATTRIBUTE_MALLOC; + +/* Copy at most N characters from string into a buffer without fail. */ + +extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC; /* Copy an existing memory buffer to a new memory buffer without fail. */ -extern PTR xmemdup PARAMS ((const PTR, size_t, size_t)) ATTRIBUTE_MALLOC; +extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC; /* Physical memory routines. Return values are in BYTES. */ -extern double physmem_total PARAMS ((void)); -extern double physmem_available PARAMS ((void)); +extern double physmem_total (void); +extern double physmem_available (void); + + +/* These macros provide a K&R/C89/C++-friendly way of allocating structures + with nice encapsulation. The XDELETE*() macros are technically + superfluous, but provided here for symmetry. Using them consistently + makes it easier to update client code to use different allocators such + as new/delete and new[]/delete[]. */ + +/* Scalar allocators. */ + +#define XNEW(T) ((T *) xmalloc (sizeof (T))) +#define XCNEW(T) ((T *) xcalloc (1, sizeof (T))) +#define XDELETE(P) free ((void*) (P)) + +/* Array allocators. */ + +#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N))) +#define XCNEWVEC(T, N) ((T *) xcalloc ((N), sizeof (T))) +#define XRESIZEVEC(T, P, N) ((T *) xrealloc ((void *) (P), sizeof (T) * (N))) +#define XDELETEVEC(P) free ((void*) (P)) + +/* Allocators for variable-sized structures and raw buffers. */ + +#define XNEWVAR(T, S) ((T *) xmalloc ((S))) +#define XCNEWVAR(T, S) ((T *) xcalloc (1, (S))) +#define XRESIZEVAR(T, P, S) ((T *) xrealloc ((P), (S))) + +/* Type-safe obstack allocator. */ + +#define XOBNEW(O, T) ((T *) obstack_alloc ((O), sizeof (T))) +#define XOBFINISH(O, T) ((T) obstack_finish ((O))) /* hex character manipulation routines */ #define _hex_array_size 256 #define _hex_bad 99 -extern const char _hex_value[_hex_array_size]; -extern void hex_init PARAMS ((void)); +extern const unsigned char _hex_value[_hex_array_size]; +extern void hex_init (void); #define hex_p(c) (hex_value (c) != _hex_bad) /* If you change this, note well: Some code relies on side effects in the argument being performed exactly once. */ -#define hex_value(c) (_hex_value[(unsigned char) (c)]) +#define hex_value(c) ((unsigned int) _hex_value[(unsigned char) (c)]) /* Definitions used by the pexecute routine. */ @@ -271,26 +352,40 @@ extern void hex_init PARAMS ((void)); /* Execute a program. */ -extern int pexecute PARAMS ((const char *, char * const *, const char *, - const char *, char **, char **, int)); +extern int pexecute (const char *, char * const *, const char *, + const char *, char **, char **, int); /* Wait for pexecute to finish. */ -extern int pwait PARAMS ((int, int *, int)); +extern int pwait (int, int *, int); #if !HAVE_DECL_ASPRINTF /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ -extern int asprintf PARAMS ((char **, const char *, ...)) ATTRIBUTE_PRINTF_2; +extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2; #endif #if !HAVE_DECL_VASPRINTF /* Like vsprintf but provides a pointer to malloc'd storage, which must be freed by the caller. */ -extern int vasprintf PARAMS ((char **, const char *, va_list)) - ATTRIBUTE_PRINTF(2,0); +extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0); +#endif + +#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF +/* Like sprintf but prints at most N characters. */ +extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3; +#endif + +#if defined(HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF +/* Like vsprintf but prints at most N characters. */ +extern int vsnprintf (char *, size_t, const char *, va_list) ATTRIBUTE_PRINTF(3,0); +#endif + +#if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP +/* Compare version strings. */ +extern int strverscmp (const char *, const char *); #endif #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) @@ -301,7 +396,7 @@ extern int vasprintf PARAMS ((char **, const char *, va_list)) USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is also set/unset as it is often used to indicate whether code needs to call alloca(0). */ -extern PTR C_alloca PARAMS ((size_t)) ATTRIBUTE_MALLOC; +extern void *C_alloca (size_t) ATTRIBUTE_MALLOC; #undef alloca #if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA # define alloca(x) __builtin_alloca(x) @@ -309,7 +404,7 @@ extern PTR C_alloca PARAMS ((size_t)) ATTRIBUTE_MALLOC; # define ASTRDUP(X) \ (__extension__ ({ const char *const libiberty_optr = (X); \ const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \ - char *const libiberty_nptr = alloca (libiberty_len); \ + char *const libiberty_nptr = (char *const) alloca (libiberty_len); \ (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); })) #else # define alloca(x) C_alloca(x) @@ -323,7 +418,7 @@ extern unsigned long libiberty_len; # define ASTRDUP(X) \ (libiberty_optr = (X), \ libiberty_len = strlen (libiberty_optr) + 1, \ - libiberty_nptr = alloca (libiberty_len), \ + libiberty_nptr = (char *) alloca (libiberty_len), \ (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len)) #endif diff --git a/gnu/lib/libiberty/include/obstack.h b/gnu/lib/libiberty/include/obstack.h index 5496ff24071..88c2a264adc 100644 --- a/gnu/lib/libiberty/include/obstack.h +++ b/gnu/lib/libiberty/include/obstack.h @@ -1,6 +1,6 @@ /* obstack.h - object stack macros Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, - 1999, 2000 + 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Summary: @@ -145,11 +145,7 @@ extern "C" { #if defined _LIBC || defined HAVE_STRING_H # include <string.h> -# if defined __STDC__ && __STDC__ -# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) -# else -# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N)) -# endif +# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) #else # ifdef memcpy # define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N)) @@ -174,18 +170,12 @@ struct obstack /* control current object in current chunk */ char *chunk_limit; /* address of char after current chunk */ PTR_INT_TYPE temp; /* Temporary for some macros. */ int alignment_mask; /* Mask of alignment for each object. */ -#if defined __STDC__ && __STDC__ /* These prototypes vary based on `use_extra_arg', and we use casts to the prototypeless function type in all assignments, but having prototypes here quiets -Wstrict-prototypes. */ struct _obstack_chunk *(*chunkfun) (void *, long); void (*freefun) (void *, struct _obstack_chunk *); void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ -#else - struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */ - void (*freefun) (); /* User's function to free a chunk. */ - char *extra_arg; /* first arg for chunk alloc/dealloc funcs */ -#endif unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ unsigned maybe_empty_object:1;/* There is a possibility that the current chunk contains a zero-length object. This @@ -198,7 +188,6 @@ struct obstack /* control current object in current chunk */ /* Declare the external functions we use; they are in obstack.c. */ -#if defined __STDC__ && __STDC__ extern void _obstack_newchunk (struct obstack *, int); extern void _obstack_free (struct obstack *, void *); extern int _obstack_begin (struct obstack *, int, int, @@ -207,16 +196,7 @@ extern int _obstack_begin_1 (struct obstack *, int, int, void *(*) (void *, long), void (*) (void *, void *), void *); extern int _obstack_memory_used (struct obstack *); -#else -extern void _obstack_newchunk (); -extern void _obstack_free (); -extern int _obstack_begin (); -extern int _obstack_begin_1 (); -extern int _obstack_memory_used (); -#endif -#if defined __STDC__ && __STDC__ - /* Do the function-declarations after the structs but before defining the macros. */ @@ -255,19 +235,10 @@ int obstack_alignment_mask (struct obstack *obstack); int obstack_chunk_size (struct obstack *obstack); int obstack_memory_used (struct obstack *obstack); -#endif /* __STDC__ */ - -/* Non-ANSI C cannot really support alternative functions for these macros, - so we do not declare them. */ - /* Error handler called when `obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function. The default action is to print a message and abort. */ -#if defined __STDC__ && __STDC__ extern void (*obstack_alloc_failed_handler) (void); -#else -extern void (*obstack_alloc_failed_handler) (); -#endif /* Exit value used when `print_and_abort' is used. */ extern int obstack_exit_failure; @@ -292,8 +263,6 @@ extern int obstack_exit_failure; /* To prevent prototype warnings provide complete argument list in standard C version. */ -#if defined __STDC__ && __STDC__ - # define obstack_init(h) \ _obstack_begin ((h), 0, 0, \ (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) @@ -317,32 +286,6 @@ extern int obstack_exit_failure; # define obstack_freefun(h, newfreefun) \ ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) -#else - -# define obstack_init(h) \ - _obstack_begin ((h), 0, 0, \ - (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) - -# define obstack_begin(h, size) \ - _obstack_begin ((h), (size), 0, \ - (void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free) - -# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ - _obstack_begin ((h), (size), (alignment), \ - (void *(*) ()) (chunkfun), (void (*) ()) (freefun)) - -# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ - _obstack_begin_1 ((h), (size), (alignment), \ - (void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg)) - -# define obstack_chunkfun(h, newchunkfun) \ - ((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun)) - -# define obstack_freefun(h, newfreefun) \ - ((h) -> freefun = (void (*)()) (newfreefun)) - -#endif - #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) #define obstack_blank_fast(h,n) ((h)->next_free += (n)) @@ -494,9 +437,9 @@ __extension__ \ # define obstack_free(OBSTACK, OBJ) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ - void *__obj = (OBJ); \ + void *__obj = (void *) (OBJ); \ if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ - __o->next_free = __o->object_base = __obj; \ + __o->next_free = __o->object_base = (char *) __obj; \ else (obstack_free) (__o, __obj); }) #else /* not __GNUC__ or not __STDC__ */ @@ -586,21 +529,12 @@ __extension__ \ (h)->object_base = (h)->next_free, \ __INT_TO_PTR ((h)->temp)) -# if defined __STDC__ && __STDC__ -# define obstack_free(h,obj) \ +# define obstack_free(h,obj) \ ( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ ? (int) ((h)->next_free = (h)->object_base \ = (h)->temp + (char *) (h)->chunk) \ : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) -# else -# define obstack_free(h,obj) \ -( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ - (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ - ? (int) ((h)->next_free = (h)->object_base \ - = (h)->temp + (char *) (h)->chunk) \ - : (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0))) -# endif #endif /* not __GNUC__ or not __STDC__ */ diff --git a/gnu/lib/libiberty/include/partition.h b/gnu/lib/libiberty/include/partition.h index 5d3623f716e..d8b554f8f9a 100644 --- a/gnu/lib/libiberty/include/partition.h +++ b/gnu/lib/libiberty/include/partition.h @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ /* This package implements a partition of consecutive integers. The elements are partitioned into classes. Each class is represented @@ -64,13 +64,10 @@ typedef struct partition_def struct partition_elem elements[1]; } *partition; -extern partition partition_new PARAMS((int)); -extern void partition_delete PARAMS((partition)); -extern int partition_union PARAMS((partition, - int, - int)); -extern void partition_print PARAMS((partition, - FILE*)); +extern partition partition_new (int); +extern void partition_delete (partition); +extern int partition_union (partition, int, int); +extern void partition_print (partition, FILE*); /* Returns the canonical element corresponding to the class containing ELEMENT__ in PARTITION__. */ diff --git a/gnu/lib/libiberty/include/splay-tree.h b/gnu/lib/libiberty/include/splay-tree.h index 86707fc1d2f..78d8f71c09f 100644 --- a/gnu/lib/libiberty/include/splay-tree.h +++ b/gnu/lib/libiberty/include/splay-tree.h @@ -16,8 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ /* For an easily readable description of splay-trees, see: @@ -52,50 +52,50 @@ typedef struct splay_tree_node_s *splay_tree_node; /* The type of a function which compares two splay-tree keys. The function should return values as for qsort. */ -typedef int (*splay_tree_compare_fn) PARAMS((splay_tree_key, splay_tree_key)); +typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key); /* The type of a function used to deallocate any resources associated with the key. */ -typedef void (*splay_tree_delete_key_fn) PARAMS((splay_tree_key)); +typedef void (*splay_tree_delete_key_fn) (splay_tree_key); /* The type of a function used to deallocate any resources associated with the value. */ -typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value)); +typedef void (*splay_tree_delete_value_fn) (splay_tree_value); /* The type of a function used to iterate over the tree. */ -typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*)); +typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*); /* The type of a function used to allocate memory for tree root and node structures. The first argument is the number of bytes needed; the second is a data pointer the splay tree functions pass through to the allocator. This function must never return zero. */ -typedef PTR (*splay_tree_allocate_fn) PARAMS((int, void *)); +typedef void *(*splay_tree_allocate_fn) (int, void *); /* The type of a function used to free memory allocated using the corresponding splay_tree_allocate_fn. The first argument is the memory to be freed; the latter is a data pointer the splay tree functions pass through to the freer. */ -typedef void (*splay_tree_deallocate_fn) PARAMS((void *, void *)); +typedef void (*splay_tree_deallocate_fn) (void *, void *); /* The nodes in the splay tree. */ struct splay_tree_node_s GTY(()) { /* The key. */ - splay_tree_key GTY ((use_param1 (""))) key; + splay_tree_key GTY ((use_param1)) key; /* The value. */ - splay_tree_value GTY ((use_param2 (""))) value; + splay_tree_value GTY ((use_param2)) value; /* The left and right children, respectively. */ - splay_tree_node GTY ((use_params (""))) left; - splay_tree_node GTY ((use_params (""))) right; + splay_tree_node GTY ((use_params)) left; + splay_tree_node GTY ((use_params)) right; }; /* The splay tree itself. */ struct splay_tree_s GTY(()) { /* The root of the tree. */ - splay_tree_node GTY ((use_params (""))) root; + splay_tree_node GTY ((use_params)) root; /* The comparision function. */ splay_tree_compare_fn comp; @@ -109,48 +109,33 @@ struct splay_tree_s GTY(()) /* Allocate/free functions, and a data pointer to pass to them. */ splay_tree_allocate_fn allocate; splay_tree_deallocate_fn deallocate; - PTR GTY((skip (""))) allocate_data; + void * GTY((skip)) allocate_data; }; typedef struct splay_tree_s *splay_tree; -extern splay_tree splay_tree_new PARAMS((splay_tree_compare_fn, - splay_tree_delete_key_fn, - splay_tree_delete_value_fn)); -extern splay_tree splay_tree_new_with_allocator - PARAMS((splay_tree_compare_fn, - splay_tree_delete_key_fn, +extern splay_tree splay_tree_new (splay_tree_compare_fn, + splay_tree_delete_key_fn, + splay_tree_delete_value_fn); +extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn, + splay_tree_delete_key_fn, splay_tree_delete_value_fn, - splay_tree_allocate_fn, - splay_tree_deallocate_fn, - void *)); -extern void splay_tree_delete PARAMS((splay_tree)); -extern splay_tree_node splay_tree_insert - PARAMS((splay_tree, - splay_tree_key, - splay_tree_value)); -extern void splay_tree_remove PARAMS((splay_tree, - splay_tree_key)); -extern splay_tree_node splay_tree_lookup - PARAMS((splay_tree, - splay_tree_key)); -extern splay_tree_node splay_tree_predecessor - PARAMS((splay_tree, - splay_tree_key)); -extern splay_tree_node splay_tree_successor - PARAMS((splay_tree, - splay_tree_key)); -extern splay_tree_node splay_tree_max - PARAMS((splay_tree)); -extern splay_tree_node splay_tree_min - PARAMS((splay_tree)); -extern int splay_tree_foreach PARAMS((splay_tree, - splay_tree_foreach_fn, - void*)); -extern int splay_tree_compare_ints PARAMS((splay_tree_key, - splay_tree_key)); -extern int splay_tree_compare_pointers PARAMS((splay_tree_key, - splay_tree_key)); + splay_tree_allocate_fn, + splay_tree_deallocate_fn, + void *); +extern void splay_tree_delete (splay_tree); +extern splay_tree_node splay_tree_insert (splay_tree, + splay_tree_key, + splay_tree_value); +extern void splay_tree_remove (splay_tree, splay_tree_key); +extern splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key); +extern splay_tree_node splay_tree_predecessor (splay_tree, splay_tree_key); +extern splay_tree_node splay_tree_successor (splay_tree, splay_tree_key); +extern splay_tree_node splay_tree_max (splay_tree); +extern splay_tree_node splay_tree_min (splay_tree); +extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*); +extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key); +extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key); #ifdef __cplusplus } diff --git a/gnu/lib/libiberty/include/symcat.h b/gnu/lib/libiberty/include/symcat.h index 61ce1e9b341..03a12921042 100644 --- a/gnu/lib/libiberty/include/symcat.h +++ b/gnu/lib/libiberty/include/symcat.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SYM_CAT_H #define SYM_CAT_H diff --git a/gnu/lib/libiberty/install-sh b/gnu/lib/libiberty/install-sh index e9de23842dc..4d4a9519eaf 100644 --- a/gnu/lib/libiberty/install-sh +++ b/gnu/lib/libiberty/install-sh @@ -1,19 +1,38 @@ #!/bin/sh -# # install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). + +scriptversion=2005-05-14.22 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. # -# Copyright 1991 by the Massachusetts Institute of Technology +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it @@ -23,13 +42,11 @@ # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. - # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" - # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" @@ -41,211 +58,266 @@ stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" -transformbasename="" -transform_arg="" -instcmd="$mvprog" chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" +chowncmd= +chgrpcmd= +stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 shift + shift + continue;; - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi -fi && +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done -exit 0 +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/gnu/lib/libiberty/move-if-change b/gnu/lib/libiberty/move-if-change index ee1b348beeb..ff74a556d2d 100644 --- a/gnu/lib/libiberty/move-if-change +++ b/gnu/lib/libiberty/move-if-change @@ -1,32 +1,22 @@ #!/bin/sh +# Like mv $1 $2, but if the files are the same, just delete $1. +# Status is zero if successful, nonzero otherwise. -# Copyright (C) 1996 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +usage="$0: usage: $0 SOURCE DEST" -if -test -r $2 -then -if -cmp $1 $2 > /dev/null -then -echo $2 is unchanged -rm -f $1 -else -mv -f $1 $2 -fi +case $# in +2) ;; +*) echo "$usage" >&2; exit 1;; +esac + +for arg in "$1" "$2"; do + case $arg in + -*) echo "$usage" >&2; exit 1;; + esac +done + +if test -r "$2" && cmp -s "$1" "$2"; then + rm -f "$1" else -mv -f $1 $2 + mv -f "$1" "$2" fi diff --git a/gnu/lib/libiberty/shlib_version b/gnu/lib/libiberty/shlib_version index d0f0988b418..00604e64e7d 100644 --- a/gnu/lib/libiberty/shlib_version +++ b/gnu/lib/libiberty/shlib_version @@ -1,2 +1,2 @@ major=8 -minor=0 +minor=1 diff --git a/gnu/lib/libiberty/src/ChangeLog b/gnu/lib/libiberty/src/ChangeLog index 607bb148cc8..fb328da633c 100644 --- a/gnu/lib/libiberty/src/ChangeLog +++ b/gnu/lib/libiberty/src/ChangeLog @@ -1,14 +1,1683 @@ -2004-09-30 Release Manager +2006-03-29 Jim Blandy <jimb@codesourcery.com> + + * pex-common.c (pex_input_file, pex_input_pipe): New functions. + (pex_init_common): Initialize obj->input_file. + (pex_run): Close any file opened by pex_input_file. + * pexecute.txh (pex_input_file, pex_input_pipe): New docs. + * pex-common.h (struct pex_obj): New field input_file. + (struct pex_funcs): New function ptr fdopenw. + * pex-unix.c (pex_unix_fdopenw): New function. + (funcs): List it as our fdopenw function. + * pex-win32.c (pex_win32_fdopenw): New function. + (funcs): List it as our fdopenw function. + * pex-djgpp.c (funcs): Leave fdopenw null. + * pex-msdos (funcs): Same. + * functions.texi: Regenerated. + +2006-04-10 Jim Blandy <jimb@codesourcery.com> + + * pex-common.c (temp_file): New function, containing guts of + pex-style temporary file name generation. + (pex_run): Use it. + +2006-04-06 Carlos O'Donell <carlos@codesourcery.com> + + * Makefile.in: Add install-html, install-html-am, and + install-html-recursive targets. Define mkdir_p and + NORMAL_INSTALL. + * configure.ac: AC_SUBST datarootdir, docdir, htmldir. + * configure: Regenerate. + * testsuite/Makefile.in: Add install-html and html targets. + +2006-03-31 Mark Mitchell <mark@codesourcery.com> + + * pex-win32.c (<errno.h>): Include. + (fix_argv): Remove. + (argv_to_cmdline): New function. + (std_suffixes): New variable. + (no_suffixes): Likewise. + (find_executable): New function. + (win32_spawn): Likewise. + (spawn_script): Use win32_spawn instead of _spawnv[p]. + (pex_win32_exec_child): Replace MSVCRT calls with Win32 API calls. + (pex_win32_wait): Likewise. + +2006-03-24 Jim Blandy <jimb@codesourcery.com> + + * pex-common.c (pex_run): Simplify output name handling. + +2006-03-12 Jim Blandy <jimb@red-bean.com> + + * pex-common.h (struct pex_obj): Doc fixes. + +2006-03-11 Jim Blandy <jimb@red-bean.com> + + * functions.texi: Regenerate. + +2006-02-21 Ben Elliston <bje@au.ibm.com> + + * pexecute.c (pwait): Syntax fix for previous change. + +2006-02-17 Uttam Pawar <uttamp@us.ibm.com> + + * pexecute.c (pwait): Free vector pointer. + * partition.c (partition_print): Free class_elements pointer. + +2006-02-11 Roger Sayle <roger@eyesopen.com> + R. Scott Bailey <scott.bailey@eds.com> + Bill Northcott <w.northcott@unsw.edu.au> + + PR bootstrap/16787 + * floatformat.c: Include <float.h> where available. + (NAN): Use value of DBL_QNAN if defined, and NAN isn't. + +2006-01-29 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * configure.ac: Add -Wc++-compat to ac_libibety_warn_cflags where + supported. + * configure: Regenerated. + +2006-01-20 Carlos O'Donell <carlos@codesourcery.com> + + * testsuite/Makefile.in: Add test-expandargv test. + * testsuite/test-expandargv.c: New test. + * argv.c (expandargv): Check for errors with ferror, + rather than just by looking at return value from fread. + +2005-12-17 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * floatformat.c (floatformat_i387_ext_is_valid): Use explicit cast + to convert from "from". + (floatformat_to_double): Likewise. + (floatformat_from_double): Use explicit cast to convert from "to". + +2005-12-10 Terry Laurenzo <tlaurenzo@gmail.com> + + PR java/9861 + * cp-demangle.c (d_bare_function_type): Recognize new 'J' qualifer + and include return type when found. + (d_print_comp)[DEMANGLE_COMPONENT_FUNCTION_TYPE]: Add + conditional logic to change printing order of return type.when + the DMGL_RET_POSTFIX option is present. + (java_demangle_v3): Add DMGL_RET_POSTFIX option to d_demangle + call. + * testsuite/test-demangle.c (main): Recognize option --ret-postfix + * testsuite/demangle-expected: Test cases to verify extended encoding. + Updated comment to document --ret-postfix option. + +2005-11-06 Richard Guenther <rguenther@suse.de> + + * splay-tree.c (rotate_left): New function. + (rotate_right): Likewise. + (splay_tree_splay_helper): Remove. + (splay_tree_splay): Re-implement. + +2005-10-31 Mark Kettenis <kettenis@gnu.org> + + * floatformat.c (floatformat_vax_aingle, floatformat_vax_double): + New variables. + +2005-10-07 Mark Mitchell <mark@codesourcery.com> + + * at-file.texi: Fix typo. + +2005-10-03 Mark Mitchell <mark@codesourcery.com> + + * at-file.texi: New file. + +2005-09-27 Mark Mitchell <mark@codesourcery.com> + + * argv.c (expandargv): Do not use xmalloc_failed. + +2005-09-26 Mark Mitchell <mark@codesourcery.com> + + * argv.c (safe-ctype.h): Include it. + (ISBLANK): Remove. + (stdio.h): Include. + (buildargv): Use ISSPACE instead of ISBLANK. + (expandargv): New function. + * Makefile.in: Regenerated. + +2005-09-14 Christopher Faylor <cgf@timesys.com> + + * pex-win32.c: Include "windows.h". + (backslashify): New function. + (fix_argv): Use backslashify to convert path to windows format. + Allocate one more place in new argv for potential executable from '#!' + parsing. + (tack_on_executable): New function. Conditional on USE_MINGW_MSYS + (openkey): Ditto. + (mingw_rootify): Ditto. + (msys_rootify): Ditto. + (spawn_script): New function. + (pex_win32_exec_child): Save translated argv in newargv. Pass to + spawn_script if spawnv* fails. + (main): New function. Conditional on MAIN. Useful for testing. + +2005-08-17 Mark Kettenis <kettenis@gnu.org> + + * floatformat.c (floatformat_always_valid): Change type of last + argument to `void *'. + (floatformat_i387_ext_is_valid): Likewise. + (floatformat_to_double): Change type of second argument to `const + void *'. + (floatformat_from_double): Change type of last argument to `void + *'. + (floatformat_is_valid): Change type of last argument to `const + void *'. + (ieee_test): Remove redundant casts. + +2005-08-17 Kelley Cook <kcook@gcc.gnu.org> + + * strverscmp.c: Update FSF address. + * testsuite/Makefile.in: Likewise. + * testsuite/test-demangle.c: Likewise. + * testsuite/test-pexecute.c: Likewise. + +2005-07-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * getopt.c: Include ansidecl.h before system headers. + +2005-07-22 Ben Elliston <bje@gnu.org> - * GCC 3.3.5 Released. + * getopt.c: Include "ansidecl.h". + (_getopt_initialize): Mark argc and argv parameters as unused. -2004-05-31 Release Manager +2005-07-22 Ben Elliston <bje@gnu.org> + + * regex.c (regcomp): Change type of `i' from unsigned to int. + +2005-07-22 Ben Elliston <bje@gnu.org> + + Recover patch lost in the sourceware repository: + 2005-07-09 Ben Elliston <bje@au.ibm.com> + * memcpy.c: Remove ANSI_PROTOTYPES conditional code. + * memmove.c: Likewise. + * objalloc.c: Likewise. + +2005-07-22 Ben Elliston <bje@gnu.org> + + * configure.ac: Check for a getopt(3) declaration. + * configure, config.in: Regenerate. + +2005-07-15 Ben Elliston <bje@au.ibm.com> + + * regex.c (TRANSLATE): Cast rhs of ternary expression to char. + +2005-07-12 Ben Elliston <bje@au.ibm.com> + + * floatformat.c (floatformat_to_double): Add a comment about a + potential source of warnings when compiling this file. + +2005-07-12 Ben Elliston <bje@au.ibm.com> + + * pexecute.c (pexecute): Cast string litrals to char *. + * regex.c (re_comp): Cast a call to gettext() to char *. + +2005-07-07 Kelley Cook <kcook@gcc.gnu.org> + + * config.table: Delete file. Move former contents into ... + * configure.ac: ... here and escape any brackets for m4. + * Makefile.in (config.status): Remove dependency on config.table. + * configure: Regenerate. + +2005-07-07 Kelley Cook <kcook@gcc.gnu.org> + + * config.in: Regenerate for 6/20 change. + +2005-07-03 Steve Ellcey <sje@cup.hp.com> + + PR other/13906 + * md5.c (md5_process_bytes): Check alignment. + +2005-07-01 Ian Lance Taylor <ian@airs.com> + + PR other/22268 + * cp-demangle.c (d_expr_primary): Don't run off the end of the + string while looking for the end of a literal value. + * testsuite/demangle-expected: Add test case. + +2005-06-30 Daniel Berlin <dberlin@dberlin.org> + + * hashtab.c (EMPTY_ENTRY): Moved and renamed. + (DELETED_ENTRY): Ditto. + +2005-06-20 Geoffrey Keating <geoffk@apple.com> + + * strverscmp.c: New. + * Makefile.in (CFILES): Add strverscmp.c. + (CONFIGURED_OFILES): Add strverscmp.o. + (strverscmp.o): New rule. + (stamp-functions): Add $(srcdir) to files in source directory. + * configure.ac (funcs): Add strverscmp. + (AC_CHECK_FUNCS): Add strverscmp. + * configure: Regenerate. + * functions.texi: Regenerate. + +2005-05-28 Eli Zaretskii <eliz@gnu.org> + + * configure.ac: Add snprintf and vsnprintf to AC_CHEK_DECLS. + * config.in, configure: Regenerate. + +2005-05-25 Richard Henderson <rth@redhat.com> + + * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_HIDDEN_ALIAS. + (d_make_comp, d_print_comp): Likewise. + (d_special_name): Generate one. + * testsuite/demangle-expected: Add a hidden alias test. + +2005-05-24 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * configure.ac: Check declarations for calloc(), getenv(), + malloc(), realloc() and sbrk(). + * config.in: Regenerate. + * configure: Likewise. + + * alloca.c (C_alloca): Change "new" to "new_storage". Use XNEWVEC + instead of xmalloc. + * choose-temp.c (choose_temp_base): Use XNEWVEC instea od xmalloc. + * concat.c (liiberty_concat_ptr): Surround definition with an + extern "C" block, if __cplusplus. + (concat): Use XNEWVEC instead of xmalloc. + (reconcat): Likewise. + * cp-demangle.c (struct d_print_template): Rename member + "template" to "template_decl". Adjust use throughout the file. + (d_print_resize): Properly cast return value of realloc(). + (cplus_demangle_print): Same for malloc(). + (d_demangle): Likewise. + * cp-demint.c (cplus_demangle_fill_builtin_type): Rename parameter + "typename" to "type_name". + * cplus-dem.c (grow_vect): Use XRESIZEVEC instead of xrealloc(). + (work_stuff_copy_to_from): Use XNEWVEC insteand of xmalloc(). + (demangle_template_value_parm): Likewise. + (demangle_template): Likewise. + (recursively_demangle): Likewise. + (do_hpacc_template_literal): Likewise. + (do_arg): Likewise. + (remember_type): Likewise. + (remember_Ktype): Likewise. + (register_Btype): Likewise. + (string_need): Use XRESIZEVEC instead of xrealloc(). + * dyn-string.c (dyn_string_init): Use XNEWVEC. + (dyn_string_new): Use XNEW. + (dyn_string_resize): Use XRESIZEVEC. + * fnmatch.c (fnmatch): Rename local variable "not" to "negate". + * getopt.c (getenv): Declare only if !__cplusplus and !getenv. + Otherwise include <stdlib.h>. + (exchange): Cast return value of malloc(). + * hashtab.c (htab_size): Define as both macro and non-inline + function. + (htab_elements): Likewise. + * getpwd.c (getpwd): Use XNEWVEC. + (htab_create_alloc_ex): Use C90 prototype-style. + * lrealpath.c (lrealpath): Appropriately cast return value of + malloc(). + * make-relative-prefix.c (save_string): Likewise. + * make-temp-file.c (try_dir): Rename from "try". Adjust use in + the file. + (choose_tmpdir): Use XNEWVEC. + * mkstemps.c (mkstemps): Rename parameter "template" to "pattern". + * pex-common.c (pex_init_common): Use XNEW. + (pex_add_remove): Use XRESIZEVEC. + (pex_run): Likewise. + (pex_get_status_and_time): Likewise. + * pex-djgpp.c (pex_djgpp_exec_child): Likewise. + * pex-msdos.c (pex_init): Use XNEW. + (pex_msdos_exec_child): Likewise. + (pex_msdos_exec_child): Use XRESIZEVEC. + * pex-unix.c (pex_wait): Use XNEW. + * pex-win32.c (fix_argv): Use XNEWVEC. + * pexecute.c (pwait): Likewise. + * setenv.c (setenv): Properly cast return value of malloc(). + * sigsetmask.c (sigsetmask): Rename local variables "old" and + "new" to "old_sig" and "new_sig". + * sort.c (main): Use XNEWVEC. + * spaces.c (spaces): Cast return value of malloc(). + * strndup.c (strndup): Likewise. + * ternary.c (ternary_insert): Use XNEW. + * xmalloc.c (malloc, realloc, calloc, sbrk): Surround declaration + with an extern "C" block if __cplusplus. + * xstrdup.c (xstrdup): Cast return value of memcpy(). + * xstrerror.c (strerror): Enclose declaration in an extern "C" + block if __cplusplus. + * xstrndup.c (xstrndup): Use XNEW. Cast return value of memcpy(). + +2005-05-16 Andreas Jaeger <aj@suse.de> + + * getpwd.c: Remove unneeded prototype getcwd and move getwd so + that it's only declared if needed. + + * getopt1.c: Change order of includes so that __GNU_LIBRARY__ is + defined. + +2005-05-15 Andreas Jaeger <aj@suse.de> + + * functions.texi: Regenerated. - * GCC 3.3.4 Released. +2005-05-15 Eli Zaretskii <eliz@gnu.org> -2004-02-14 Release Manager + * pexecute.txh: Enclose multi-word data types in @deftypefn in + braces. Minor wording fixes. Use --- for em-dash. Use + @enumerate in enumerated lists. - * GCC 3.3.3 Released. + * fopen_unlocked.c: Enclose multi-word data types in @deftypefn in + braces. + +2005-05-11 Eli Zaretskii <eliz@gnu.org> + + * pex-djgpp.c: Include string.h, fcntl.h, unistd.h, and + sys/stat.h. + (pex_init): Fix last argument to pex_init_common. + (pex_djgpp_exec_child): Remove leading underscore from _open, + _dup, _dup2, _close, and _spawnv/_spawnvp. Replace `program', + which is undeclared, with `executable', which was unused. Remove + unused variable `e'. Fix casting of last arg to spawnv/spawnvp. + (pex_djgpp_wait): Declare arguments with ATTRIBUTE_UNUSED. + +2005-05-11 Paul Brook <paul@codesourcery.com> + + * Makefile.in: Regenerate dependencies. + +2005-05-10 Nick Clifton <nickc@redhat.com> + + * Update the address and phone number of the FSF organization in + the GPL notices in the following files: + COPYING.LIB, Makefile.in, _doprnt.c, argv.c, asprintf.c, + choose-temp.c, clock.c, concat.c, copying-lib.texi, cp-demangle.c, + cp-demangle.h, cp-demint.c, cplus-dem.c, dyn-string.c, fdmatch.c, + fibheap.c, floatformat.c, fnmatch.c, fopen_unlocked.c, + gather-docs, getopt.c, getopt1.c, getruntime.c, hashtab.c, hex.c, + lbasename.c, lrealpath.c, maint-tool, make-relative-prefix.c, + make-temp-file.c, md5.c, mempcpy.c, mkstemps.c, objalloc.c, + obstack.c, partition.c, pex-common.c, pex-common.h, pex-djgpp.c, + pex-msdos.c, pex-one.c, pex-unix.c, pex-win32.c, pexecute.c, + physmem.c, putenv.c, regex.c, safe-ctype.c, setenv.c, snprintf.c, + sort.c, spaces.c, splay-tree.c, stpcpy.c, stpncpy.c, strndup.c, + strtod.c, ternary.c, unlink-if-ordinary.c, vasprintf.c, + vsnprintf.c, vsprintf.c, xexit.c, xmalloc.c, xstrndup.c + +2005-05-06 Kelley Cook <kcook@gcc.gnu.org> + + * aclocal.m4 (AC_DEFINE_NOAUTOHEADER): Remove. + * configure.ac: Replace any AC_DEFINE_NOAUTOHEADER with AC_DEFINE. + * configure: Regenerate. + +2005-05-06 Kelley Cook <kcook@gcc.gnu.org> + + * configure.ac: Use AC_C_BIGENDIAN instead of AC_C_BIGENDIAN_CROSS. + Use AC_CHECK_SIZEOF instead of AC_COMPILE_CHECK_SIZEOF. + * aclocal.m4: Don't include accross.m4. + * configure, config.in: Regenerate. + +2005-04-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * fopen_unlocked.c (unlock_std_streams): New. + + * functions.texi: Regenerate. + +2005-04-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * fopen_unlocked.c (unlock_stream): New. + Consolidate unlocking code into a helper function. + + * functions.texi: Regenerate. + +2005-04-13 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * asprintf.c: Include config.h. + * basename.c: Likewise. + * fdmatch.c: Likewise. + * hex.c: Likewise. + * lbasename.c: Likewise. + * spaces.c: Likewise. + * xatexit.c:Likewise. + * configure.ac: Do check declarations for basename, ffs, asprintf + and vasprintf for real. + * configure: Regenerate. + +2005-04-13 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * argv.c (dupargv): Allocate space of argv[argc], not + sizeof(char *) of that amount. Cast result to char *. + +2005-04-12 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * regex.c (wcs_re_match_2_internal, byte_re_match_2_internal): + Replace not with negate. + +2005-04-12 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * configure.ac: Check declarations for basename, ffs, asprintf, + vasprintf. + * configure: Regenerate. + * config.in: Likewise. + +2005-04-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Makefile.in (CFILES): Add fopen_unlocked.c. + (REQUIRED_OFILES): Add ./fopen_unlocked.o. + Regenerate dependencies. + + * configure.ac: Check for stdio_ext.h and __fsetlocking. + + * fopen_unlocked.c: New file. + + * functions.texi, configure, config.in: Regenerate. + +2005-04-04 Ian Lance Taylor <ian@airs.com> + + * testsuite/test-pexecute.c (TEST_PEX_RUN): Move variable + declaration before statement. + +2005-04-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * bcmp.c: Fix warnings and implement using memcmp. + * bcopy.c: Fix warnings. + * bzero.c: Fix warnings and implement using memset. + + * configure.ac (ac_libiberty_warn_cflags): Add -Wwrite-strings + -Wstrict-prototypes. + * configure, config.in: Regenerate. + + * bsearch.c, index.c, rindex.c, strstr.c, strtol.c, waitpid.c: Fix + warnings and reconcile interfaces with relevant standards. + +2005-04-02 Ian Lance Taylor <ian@airs.com> + + * cp-demangle.c: Update copyright. + +2005-03-31 Joseph S. Myers <joseph@codesourcery.com> + + * gettimeofday.c: Add "Supplemental" to @deftypefn. + * functions.texi: Regenerate. + +2005-03-28 Ian Lance Taylor <ian@airs.com> + + * pex-common.c: New file. + * pex-one.c: New file. + * pexecute.c: New file. + * pex-common.h: Include <stdio.h>. + (struct pex_obj): Define. + (struct pex_funcs): Define. + (pex_init_common): Declare. + * pex-unix.c: Rewrite. + * pex-win32.c: Rewrite. + * pex-djgpp.c: Rewrite. + * pex-msdos.c: Rewrite. + * testsuite/text-pexecute.c: New file. + * pexecute.txh: Rewrite. + * configure.ac: Check for wait3 and wait4. Set CHECK to + really-check rather than check-cplus-dem. + * functions.texi: Rebuild. + * Makefile.in: Rebuild dependencies. + (CFILES): Add pexecute.c, pex-common.c, pex-one.c. + (REQUIRED_OFILES): Add pexecute.o, pex-common.o, pex-one.o. + * testsuite/Makefile.in (really-check): New target. + (check-pexecute, test-pexecute): New targets. + * configure: Rebuild. + +2005-03-28 Mark Kettenis <kettenis@gnu.org> + + * unlink-if-ordinary.c: Include <sys/types.h>. + +2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net> + + Convert libiberty to use ISO C prototype style 7/n. + * regex.c (PARAMS): Remove definition. + (PREFIX): Unconditionaly define using ISO C ## operator. + (init_syntax_once, extract_number, extract_number_and_incr, + print_fastmap, print_partial_compiled_pattern, + print_compiled_pattern, print_double_string, printchar, + convert_mbs_to_wcs, re_set_syntax, regex_grow_registers, + regex_compile, store_op1, store_op2, insert_op1, insert_op2, + at_begline_loc_p, at_endline_p, group_in_compile_stack, + insert_space, wcs_compile_range, byte_compile_range, + truncate_wchar, re_compile_fastmap, re_compile_fastmap, + re_set_registers, re_search, re_search_2, re_search_3, re_match, + re_match_2, count_mbs_length, wcs_re_match_2_internal, + byte_re_match_2_internal, group_match_null_string_p, + alt_match_null_string_p, common_op_match_null_string_p, + bcmp_translate, re_compile_pattern, re_comp, re_exec, regcomp, + regexec, regerror, regfree): Use ISO C prototype style. + * partition.c: (elem_compare): Likewise. + * cp-demangle.c (print_usage): Likewise. + +2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net> + + Convert libiberty to use ISO C prototype style 5/n. + * random.c (srandom, initstate, setstate, random): Use ISO C + prototypes. + * putenv.c (putenv): Likewise. + * physmem.c (physmem_available, physmem_total, main): Likewise. + * pex-win32.c (fix_argv, pexecute, pwait): Likewise. + * pex-unix.c (pexecute, pwait): Likewise. + * pex-msdos.c (pexecute, pwait): Likewise. + * pex-djgpp.c (pexecute, pwait): Likewise. + * partition.c (partition_new, partition_delete, partition_union) + (elem_compare, partition_print): Likewise. + * obstack.c (_obstack_begin, _obstack_begin_1, _obstack_newchunk, + _obstack_allocated_p, _obstack_free, obstack_free, + _obstack_memory_used, print_and_abort, obstack_next_free, + obstack_object_size, obstack_base): Likewise. Remove codes + predicated on !defined(__STDC__). + * objalloc.c (objalloc_create, _objalloc_alloc, objalloc_free, + objalloc_free_block): Use ISO C prototypes. + * mkstemps.c (mkstemps): Likewise. + * memset.c (memset): Likewise. + * mempcpy.c (mempcpy): Likewise. + * rename.c (rename): Likewise. + * rindex.c (rindex): Likewise. + * setenv.c (setenv, unsetenv): Likewise. + * sigsetmask.c (sigsetmask): Likewise. + * snprintf.c (snprintf): Likewise. + * sort.c (sort_pointers, xmalloc): Likewise. + * spaces.c (spaces): Likewise. + * splay-tree.c (splay_tree_delete_helper, + splay_tree_splay_helper, splay_tree_splay, + splay_tree_foreach_helper, splay_tree_xmalloc_allocate, + splay_tree_new, splay_tree_xmalloc_allocate, + splay_tree_new_with_allocator, splay_tree_delete, + splay_tree_insert, splay_tree_remove, splay_tree_lookup, + splay_tree_max, splay_tree_min, splay_tree_predecessor, + splay_tree_successor, splay_tree_foreach, + splay_tree_compare_ints, splay_tree_compare_pointers): Likewise. + * stpcpy.c (stpcpy): Likewise. + * stpncpy.c (stpncpy): Likewise. + * strcasecmp.c (strcasecmp): Likewise. + * strchr.c (strchr): Likewise. + * strdup.c (strdup): Likewise. + +2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net> + + Convert libiberty to use ISO C prototype style 6/n. + * strerror.c (init_error_tables, errno_max, strerror, strerrno, + strtoerrno, main): Use ISO C prototype style. + * strncasecmp.c (strncasecmp): Likewise. + * strncmp.c (strncmp): Likewise. + * strndup.c (strndup): Likewise. + * strrchr.c (strrchr): Likewise. + * strsignal.c (init_signal_tables, signo_max, strsignal, + strsigno, strtosigno, psignal, main): Likewise. + * strstr.c (strstr): Likewise. + * strtod.c (strtod, atof): Likewise. + * strtol.c (strtol): Likewise. + * strtoul.c (strtoul): Likewise. + * ternary.c (ternary_insert, ternary_cleanup, ternary_search, + ternary_recursivesearch): Likewise. + * tmpnam.c (tmpnam): Likewise. + * unlink-if-ordinary.c (unlink_if_ordinary): Likewise. + * vasprintf.c (int_vasprintf, vasprintf, checkit, main): Likewise. + * vfork.c (vfork): Likewise. + * vfprintf.c (vfprintf): Likewise. + * vprintf.c (vprintf): Likewise. + * vsnprintf.c (vsnprintf, checkit, main): Likewise. + * vsprintf.c (vsprintf): Likewise. + * waitpid.c (waitpid): Likewise. + * xatexit.c (xatexit, xatexit_cleanup): Likewise. + * xexit.c (xexit): Likewise. + * xmalloc.c (xmalloc_set_program_name, xmalloc_failed, xmalloc, + xcalloc, xrealloc): Likewise. + * xmemdup.c (xmemdup): Likewise. + * xstrdup.c (xstrdup): Likewise. + * xstrerror.c (xstrerror): Likewise. + * xstrndup.c (xstrndup): Likewise. + +2005-03-27 Andreas Jaeger <aj@suse.de> + + * configure.ac (ac_c_preproc_warn_flag): Remove -Wtraditional + flags. + * configure: Regenerated. + +2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * getopt1.c (getopt_long_only): Fix thinko. + +2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net> + + Convert libiberty to use ISO C prototype style 4/n. + * hashtab.c (higher_prime_index, hash_pointer, eq_pointer, + htab_size, htab_elements, htab_mod_1, htab_mod, htab_mod_m2, + htab_create_alloc, htab_set_functions_ex, htab_create, + htab_try_create, htab_delete, htab_empty, + find_empty_slot_for_expand, htab_expand, htab_find_with_hash, + htab_find, htab_find_slot_with_hash, htab_find_slot, + htab_remove_elt, htab_remove_elt_with_hash, htab_clear_slot, + htab_traverse_noresize, htab_traverse, htab_collisions, + htab_hash_string, iterative_hash): Use ISO C prototype. + * hex.c (hex_init): Likewise. + * index.c (index): Likewise. + * insque.c (insque, remque): Likewise. + * lbasename.c (lbasename): Likewise. + * lrealpath.c (lrealpath): Likewise. + * make-relative-prefix.c (save_string, split_directories, + free_split_directories, make_relative_prefix): Likewise. + * make-temp-file.c (try, choose_tmpdir, make_temp_file): Likewise. + * md5.c (md5_init_ctx, md5_read_ctx, md5_finish_ctx, md5_stream, + md5_buffer, md5_process_bytes, md5_process_block): Likewise. + * memchr.c (memchr): Likewise. + * memcpy.c (memcpy): Likewise. + * memmove.c (memmove): Likewise. + * gettimeofday.c (gettimeofday): Likewise. + * getruntime.c (get_run_time): Likewise. + * getpwd.c (getpwd, getpwd): Likewise. + * getpagesize.c (getpagesize): Likewise. + * getopt1.c (getopt_long, getopt_long_only, main): Likewise. + * getopt.c (my_index, exchange, _getopt_initialize, + _getopt_internal, getopt, main): Likewise. + * getcwd.c (getcwd): Likewise. + * fnmatch.c (fnmatch): Likewise. + * floatformat.c (floatformat_always_valid, + floatformat_i387_ext_is_valid, get_field, floatformat_to_double, + put_field, floatformat_from_double, floatformat_is_valid, + ieee_test, main): Likewise. + * fibheap.c (fibheap_new, fibnode_new, fibheap_compare, + fibheap_comp_data, fibheap_insert, fibheap_min, fibheap_min_key, + fibheap_union, fibheap_extract_min, fibheap_replace_key_data, + fibheap_replace_key, fibheap_replace_data, fibheap_delete_node, + fibheap_delete, fibheap_empty, fibheap_extr_min_node, + fibheap_ins_root, fibheap_rem_root, fibheap_consolidate, + fibheap_link, fibheap_cut, fibheap_cascading_cut, + fibnode_insert_after, fibnode_remove): Likewise. + * ffs.c (ffs): Likewise. + * fdmatch.c (fdmatch): Likewise. + * dyn-string.c (dyn_string_init, dyn_string_new, + dyn_string_delete, dyn_string_release, dyn_string_resize, + dyn_string_clear, dyn_string_copy, dyn_string_copy_cstr, + dyn_string_prepend, dyn_string_prepend_cstr, dyn_string_insert, + dyn_string_insert_cstr, dyn_string_insert_char, + dyn_string_append, dyn_string_append_cstr, + dyn_string_append_char, dyn_string_substring, dyn_string_eq): + Likewise. + +2005-03-27 Gabriel Dos Reis <gdr@integrable-solutions.net> + + Convert libiberty to use ISO C prototype style 3/n. + * cplus-dem.c (set_cplus_marker_for_demangling, consume_count, + consume_count_with_underscores, code_for_qualifier, + qualifier_string, demangle_qualifier, cplus_demangle_opname, + cplus_mangle_opname, cplus_demangle_set_style, + cplus_demangle_name_to_style, cplus_demangle, grow_vect, + ada_demangle, internal_cplus_demangle, squangle_mop_up, + work_stuff_copy_to_from, delete_non_B_K_work_stuff, + delete_work_stuff, mop_up, demangle_signature, + demangle_method_args, demangle_template_template_parm, + demangle_expression, demangle_integral_value, + demangle_real_value, demangle_template_value_parm, + demangle_template, arm_pt, demangle_arm_hp_template, + demangle_class_name, demangle_class, iterate_demangle_function, + demangle_prefix, gnu_special, recursively_demangle, arm_special, + demangle_qualified, get_count, do_type, demangle_fund_type, + do_hpacc_template_const_value, do_hpacc_template_literal, + snarf_numeric_literal, do_arg, remember_type, remember_Ktype, + register_Btype, remember_Btype, forget_B_and_K_types, + forget_types, demangle_args, demangle_nested_args, + demangle_function_name, string_need, string_delete, string_init, + string_clear, string_empty, string_append, string_appends, + string_appendn, string_prepend, string_prepends, string_prependn, + string_append_template_idx): Use ISO C prootype style. + * cp-demint.c (cplus_demangle_fill_component, + cplus_demangle_fill_builtin_type, cplus_demangle_fill_operator, + cplus_demangle_v3_components): Likewise. + +2005-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net> + + Convert libiberty to use ISO C prototype style 2/n. + * cp-demangle.h: Remove uses of PARAMS. + * cp-demangle.c: Likewise. + (d_dump, cplus_demangle_fill_name, + cplus_demangle_fill_extended_operator, cplus_demangle_fill_ctor, + cplus_demangle_fill_dtor, d_make_empty, d_make_comp, d_make_name, + d_make_builtin_type, d_make_operator, d_make_extended_operator, + d_make_ctor, d_make_dtor, d_make_template_param, d_make_sub, + cplus_demangle_mangled_name, has_return_type, + is_ctor_dtor_or_conversion, d_encoding, d_name, d_nested_name, + d_prefix, d_unqualified_name, d_source_name, d_number, + d_identifier, d_operator_name, d_special_name, d_call_offset, + d_ctor_dtor_name, cplus_demangle_type, d_cv_qualifiers, + d_function_type, d_bare_function_type, d_class_enum_type, + d_array_type, d_pointer_to_member_type, d_template_param, + d_template_args, d_template_arg, d_expression, d_expr_primary, + d_local_name, d_discriminator, d_add_substitution, + d_substitution, d_print_resize, d_print_append_char, + d_print_append_buffer, d_print_error, cplus_demangle_print, + d_print_comp, d_print_java_identifier, d_print_mod_list, + d_print_mod, d_print_function_type, d_print_array_type, + d_print_expr_op, d_print_cast, cplus_demangle_init_info, + d_demangle, __cxa_demangle, cplus_demangle_v3, java_demangle_v3, + is_ctor_or_dtor, is_gnu_v3_mangled_ctor, is_gnu_v3_mangled_dtor, + print_usage, main): + +2005-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net> + + Convert libiberty to ISO C prototype style 1/n. + * _doprnt.c: Remove conditional #include <varargs.h> on + ANSI_PROTOTYPES as the latter is always assumed. + (_doprnt, checkit, main): Use ISO C prototype. + * alloca.c (find_stack_direction, C_alloca): Use ISO C prototype. + * argv.c: Remove conditional #includes on ANSI_PROTOTYPES. + (dupargv, freeargv, buildargv, main): Use ISO C prototype. + * atexit.c (atexit): Likewise + * asprintf.c: Remove conditional include on ANSI_PROTOTYPES. + (asprintf): Use ISO C prototype. + * basename.c (basename): Likewise + * bcmp.c (bcmp): Likewise. + * bcopy.c (bcopy): Likewise. + * bzero.c (bzero): Likewise. + * bsearch.c (bsearch): Likewise. Improve const-correctness. + * choose-temp.c (choose_temp_base): Likewise. + * calloc.c: Remove conditional #include on ANSI_PROTOTYPES. + (calloc): Use ISO C prototype. + * clock.c (clock): Likewise. + * concat.c: Remove conditional #include on ANSI_PROTOTYPES. + (vconcat_length, vconcat_copy, concat_length, concat_copy, + concat_copy2, concat, reconcat, main): Use ISO C prototype. + * copysign.c (copysign): Likewise. + +2005-03-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * Makefile.in (CFILES): Add strndup.c and xstrndup.c. + (REQUIRED_OFILES): Add xstrndup.o. + (CONFIGURED_OFILES): Add strndup.o. + Regenerate dependencies. + + * configure.ac (funcs, AC_CHECK_FUNCS): Add strndup. + + * strndup.c, xstrndup.c: New. + + * config.in, configure, functions.texi: Regenerate. + +2005-03-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * xmemdup.c, xstrdup.c: Expose the tail call. + +2005-03-09 Mark Mitchell <mark@codesourcery.com> + + * configure.ac (funcs): Add gettimeofday. + * configure: Regenerated. + * gettimeofday.c: New file. + * Makefile.in (CFILES): Add gettimeofday. + (CONFIGURED_OFILES): Add gettimeofday.o. + (./gettimeofday.o): New rule. + +2005-03-09 Ian Lance Taylor <ian@airs.com> + + * pex-os2.c: Remove. + * configure.ac: Remove *-*-os2-emx* case when setting pexecute. + * Makefile.in (CFILES): Remove pex-os2.c. + (CONFIGURED_OFILES): Remove pex-os2.o. + (pex-os2.o): Remove target. + * configure: Rebuild. + +2005-03-07 Ian Lance Taylor <ian@airs.com> + + * mpw-config.in: Remove. + * mpw-make.sed: Remove. + * mpw.c: Remove. + * Makefile.in (CFILES): Remove pex-mpw.c. + (CONFIGURED_OFILES): Remove pex-mpw.o. + (mpw.o, pex-mpw.o): Remove targets. + * maint-tool (undoc): Remove reference to mpw.c. + +2005-03-06 DJ Delorie <dj@redhat.com> + + * configure.ac (target_header_dir): vfork is a stub under djgpp. + * configure: Regenerated. + +2005-03-01 Jan Beulich <jbeulich@novell.com> + + * Makefile.in (CFILES): Add unlink-if-ordinary.c + (REQUIRED_OFILES): Add unlink-if-ordinary.o. + Add dependencies and rule for unlink-if-ordinary.o. + * unlink-if-ordinary.c: New. + +2005-03-01 Ben Elliston <bje@au.ibm.com> + + * hashtab.c (htab_find_slot_with_hash): Make function + documentation clearer. + +2005-02-13 Jason Merrill <jason@redhat.com> + + * cp-demangle.c (__cxa_demangle): Change resolution of ambiguous + arguments. + +2005-01-11 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> + + * hex.c (hex_value): Group 'unsigned int' together to get correct + markup. + * functions.texi: Regenerated. + +2004-12-27 H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.in: Undo to 2004-12-17. + * aclocal.m4: Likewise. + * config.table: Likewise. + * configure.ac: Likewise. + * maint-tool: Likewise. + * configure: Likewise. + +2004-12-19 H.J. Lu <hongjiu.lu@intel.com> + + PR bootstrap/19072 + * Makefile.in (enable_shared): New substitute. + (LTTARGETLIB): New. + (PREFIXTARGETLIB): New. + (LTTESTLIB): New. + (PREFIXTESTLIB): New. + (CCLD): New. + (LINK): New. + ($(TARGETLIB)): Use $(LINK) to create libraries and create + targets by hand. + ($(TESTLIB)): Likewise. + (mostlyclean): Don't remove .libs. Remove the libtool object + directory. + + * config.table (enable_shared): Removed. + + * configure.ac (enable_static): Set to yes. + (AC_PROG_LIBTOOL): Removed. + (AM_DISABLE_SHARED): Uncommented. + (AM_PROG_LIBTOOL): Likewise. + (LIBOBJS): Add `./' to avoid VPATH. + (LTLIBOBJS): Likewise. + (enable_shared): Substitute. + * configure: Regenerated. + +2004-12-18 H.J. Lu <hongjiu.lu@intel.com> + + * Makefile.in (top_builddir): Set to `.'. + (OUTPUT_OPTION): Removed. + (LIBTOOL): New. + (LTLIBOBJS): New. + (EXTRA_LTOFILES): New. + (FLAGS_TO_PASS): Add EXTRA_LTOFILES. + (all): Remove stamp-picdir. + (LTCOMPILE): New. + (.c.lo): New rule. + (REQUIRED_LTOFILES): New. + (CONFIGURED_LTOFILES): New. + ($(TARGETLIB)): Check .libs for PIC object files. Depend on + $(REQUIRED_LTOFILES) $(EXTRA_LTOFILES) $(LTLIBOBJS). + (stamp-picdir): Completely removed. + (maint-missing): Pass $(REQUIRED_LTOFILES) + $(CONFIGURED_LTOFILES) instead of (REQUIRED_OFILES) + $(CONFIGURED_OFILES) + (maint-buildall): Depend on $(REQUIRED_LTOFILES) + $(CONFIGURED_LTOFILES). + (mostlyclean): Also remove *.lo .libs. + Run "make maint-deps". + + * aclocal.m4: Include ../libtool.m4. + + * config.table: Don't check --enable-shared. + + * configure.ac (AC_PROG_LIBTOOL): Add. + (AC_PROG_CC_C_O): Removed. + (OUTPUT_OPTION): Removed. + (NO_MINUS_C_MINUS_O): Removed. + (ltpexecute): New substitute. + (LIBOBJS): Cleanup. + * configure: Regenerated. + + * maint-tool: Updated for .lo/libtool. + +2004-12-11 Ben Elliston <bje@au.ibm.com> + + * configure.ac: Invoke AC_CHECK_SIZEOF for sizeof (int). + * configure: Regenerate. + * config.in: Likewise. + +2004-12-07 DJ Delorie <dj@redhat.com> + + * splay-tree.c (splay_tree_delete_helper): Redesign the logic so + that recursion (and thus large stack space) is not needed. + +2004-11-29 Matt Kraai <kraai@alumni.cmu.edu> + + * pex-unix.c: Fix the spelling of longjmp. + +2004-11-23 Ian Lance Taylor <ian@wasabisystems.com> + + PR other/18623 + * cp-demangle.c (d_call_offset): Remove useless local variables + offset and virtual_offset. + * cplus-dem.c (ada_demangle): Remove useless local variable + at_start_name. + (demangle_template): Remove useless local variable start. + +2004-11-19 Roger Sayle <roger@eyesopen.com> + + * objalloc.c, strsignal.c, xstrerror.c: Include "config.h" before + "ansidecl.h" to avoid redeclaration errors with native compilers. + * regex.c: Protect config.h from multiple inclusion. + +2004-11-12 Mike Stump <mrs@apple.com> + + * Makefile.in (libiberty.html): Fix html generation. + +2004-09-08 Adam Nemet <anemet@lnxw.com> + + * vasprintf.c: Accept __va_copy in addition to va_copy. + +2004-09-03 Paolo Bonzini <bonzini@gnu.org> + + * configure: Regenerate. + +2004-09-02 Paolo Bonzini <bonzini@gnu.org> + + * configure.ac: Do not enable multilibs for build-side libiberty. + +2004-06-29 Danny Smith <dannysmith@users.sourceforge.net> + + * lrealpath.c (lrealpath): Add _WIN32 support. + +2004-06-28 Zack Weinberg <zack@codesourcery.com> + + * cp-demangle.h: Declare cplus_demangle_operators, + cplus_demangle_builtin_types, cplus_demangle_mangled_name, and + cplus_demangle_type as static if IN_GLIBCPP_V3. + +2004-06-28 Ian Lance Taylor <ian@wasabisystems.com> + + PR other/16240 + * cp-demangle.c (d_expr_primary): Check for a failure return from + cplus_demangle_type. + * testsuite/demangle-expected: Add test case. + +2004-05-31 Danny Smith <dannysmith@users.sourceforge.net> + + * pex-win32.c (fix_argv): Expand comment. + +2004-05-25 Daniel Jacobowitz <drow@false.org> + + * Makefile.in: Add .NOEXPORT. + +2004-04-29 Douglas B Rupp <rupp@gnat.com> + + * mkstemps.c (mkstemps) [VMS]: Remove special open option. Update + copyright. + +2004-04-26 Maciej W. Rozycki <macro@ds2.pg.gda.pl> + + * configure.ac (UNSIGNED_64BIT_TYPE): Unquote the definition. + * configure: Regenerate. + +2004-04-22 Richard Henderson <rth@redhat.com> + + * hashtab.c: Include limits.h, stdint.h, ansidecl.h. + (CHAR_BIT): Provide default. + (struct prime_ent, prime_tab): New. + (higher_prime_index): Rename from higher_prime_number, return index. + (htab_mod_1): New. + (htab_mod, htab_mod_m2): Use it. + (htab_create_alloc, htab_create_alloc_ex): Store prime index. + (htab_expand): Likewise. + * configure.ac: Check for stdint.h. + (UNSIGNED_64BIT_TYPE): New define and checks to fill it in. + * config.in, configure: Rebuild. + +2004-04-13 Ian Lance Taylor <ian@wasabisystems.com> + + * strerror.c: Include config.h, and redefine sys_nerr and + sys_errlist, before including ansidecl.h and libiberty.h. + +2004-04-13 Jeff Law <law@redhat.com> + + * hashtab.c (htab_remove_elt_with_hash): New function. + (htab_remove_elt): Implement in terms of htab_remove_elt_with_hash. + +2004-03-31 Richard Henderson <rth@redhat.com> + + * hashtab.c (htab_size): Move to top of file; mark inline. + (htab_elements): Likewise. + (htab_mod, htab_mod_m2): New. + (htab_delete): Refactor htab->size and htab->entries. + (htab_empty): Likewise. + (find_empty_slot_for_expand): Use htab_size, htab_mod, htab_mod_m2. + (htab_find_with_hash, htab_find_slot_with_hash): Likewise. + (htab_clear_slot): Use htab_size, htab_elements. + (htab_traverse_noresize, htab_traverse): Likewise. + +2004-03-17 Ian Lance Taylor <ian@wasabisystems.com> + + * pex-unix.c (pexecute): Use vfork instead of fork, with + appropriate changes to make this safe. + * pex-common.h (STDERR_FILE_NO): Define. + + * Makefile.in: Clean up REQUIRED_OFILES and CONFIGURED_OFILES for + an 80 column screen. Run maint-deps. + +2004-03-09 Kelley Cook <kcook@gcc.gnu.org> + + * configure.ac: Bump version to 2.59. Apply suggested autoupdates. + * acconfig.h: Delete redundant file. + * config.in: Regenerate. + * configure: Regenerate. + +2004-03-09 Hans-Peter Nilsson <hp@axis.com> + + * configure: Regenerate for config/accross.m4 correction. + +2004-03-07 Andreas Jaeger <aj@suse.de> + + * testsuite/test-demangle.c: Include <string.h> and <stdlib.h> for + prototypes. + (main): Initialize style. + +2004-02-24 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.h (enum d_builtin_type_print): Add D_PRINT_UNSIGNED, + D_PRINT_UNSIGNED_LONG, D_PRINT_LONG_LONG, + D_PRINT_UNSIGNED_LONG_LONG, D_PRINT_FLOAT. + * cp-demangle.c (cplus_demangle_builtin_types): Change char and + short types to D_PRINT_DEFAULT. Change other integer types to use + new D_PRINT_* values where appropriate. Change float types to + D_PRINT_FLOAT. + (d_print_comp) [LITERAL, LITERAL_NEG]: Handle new D_PRINT_* + values. + * testsuite/demangle-expected: Adjust two test cases. + + * cp-demangle.c (d_print_function_type): Print a space before the + parenthesis around the function type in more cases. + * testsuite/demangle-expected: Adjust one test case. + + * cp-demangle.c (d_print_comp) [UNARY]: Don't emit extra + parentheses around a cast. + * testsuite/demangle-expected: Adjust two test cases to match new + output. + + * cp-demangle.c (__cxa_demangle): Pass DMGL_PARAMS to d_demangle. + + * cp-demangle.c (d_print_comp) [RESTRICT, VOLATILE, CONST]: Don't + push more than one of the same CV-qualifier on the top of the + stack. + (d_print_comp) [ARRAY_TYPE]: If the array itself is CV-qualified, + move the CV-qualifiers to apply to the element type instead. + (d_print_array_type): When checking the modifiers, keep looking + past ones which have been printed already. + * testsuite/demangle-expected: Add three test cases. + +2004-02-23 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (__cxa_demangle): Adjust last patch to handle + empty string correctly. + + * cp-demangle.c (__cxa_demangle): It is not an error if status is + not NULL. It is an error if the mangled name is the same as a + built-in type name. + (main): If IN_GLIBCPP_V3 is defined, test __cxa_demangle rather + than cplus_demangle_v3. + + * dyn-string.c: Remove test of IN_LIBGCC2 and IN_GLIBCPP_V3 and + the associated #define of RETURN_ON_ALLOCATION_FAILURE. + +2004-02-16 Matt Kraai <kraai@alumni.cmu.edu> + + * regex.c: Include <ansidecl.h>. + (regcomp): Cast i to int. + (regerror): Add ATTRIBUTE_UNUSED to parameter preg. + +2004-01-25 Ian Lance Taylor <ian@wasabisystems.com> + + * configure.ac: Add m4_pattern_allow(LIBOBJS). + * configure: Regenerate. + +2004-01-22 DJ Delorie <dj@redhat.com> + + * Makefile.in: Convert to ./ throughout. Rebuild dependencies + with explicit build rules. + (VPATH): Remove. + (.c.o): Poison. + * configure.ac (pexecute, LIBOBJS): Add ./ . + * maint-tool: Build dependencies with explicit rules. + +2004-01-15 Kazu Hirata <kazu@cs.umass.edu> + + * strdup.c (strdup): Constify the argument. + +2004-01-14 Loren J. Rittle <ljrittle@acm.org> + + * Makefile.in (distclean): Remove config.cache. + +2004-01-13 Daniel Jacobowitz <drow@mvista.com> + + * cp-demangle.c (d_make_comp): DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE + takes two parameters. + * cp-demint.c (cplus_demangle_fill_component): Likewise. + +2004-01-12 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c: Include "cp-demangle.h". If IN_GLIBCPP_V3 is + defined, rename some functions which are to become static via + #define. + (CP_STATIC_IF_GLIBCPP_V3): Define. + (struct d_operator_info): Move definition to cp-demangle.h, and + rename to demangle_operator_info. Change all uses. + (enum d_builtin_type_print): Move definition to cp-demangle.h. + (struct d_builtin_type_info): Move definition to cp-demangle.h, + and rename to demangle_builtin_type_info. Change all uses. + (enum d_comp_type): Move definition to include/demangle.h, and + rename to demangle_component_type, and change all enums to start + with DEMANGLE_COMPONENT_ instead of D_. Change all uses. + (struct d_comp): Move definition to include/demangle.h, and rename + to demangle_component. Change all uses. + (struct d_info): Move definition to cp-demangle.h. + (cplus_demangle_fill_name): New function. + (cplus_demangle_fill_extended_operator): New function. + (cplus_demangle_fill_ctor): New function. + (cplus_demangle_fill_dtor): New function. + (d_make_empty): Remove type parameter. Change all callers. + (d_make_name): Use cplus_demangle_fill_name. + (d_make_extended_operator): Use + cplus_demangle_fill_extended_operator. + (d_make_ctor): Use cplus_demangle_fill_ctor. + (d_make_dtor): Use cplus_demangle_fill_dtor. + (cplus_demangle_mangled_name): Rename from d_mangled_name. Make + non-static by default. Change all callers. + (cplus_demangle_operators): Rename from d_operators. Change all + uses. Make non-static by default. Add sentinel at end of array. + (d_operator_name): Adjust initialization of high for new sentinel + in cplus_demangle_operators. + (cplus_demangle_builtin_types): Rename from d_builtin_types. + Change all uses. Make non-static by default. Change initializer + to use D_BUILTIN_TYPE_COUNT instead of magic number 26. + (cplus_demangle_type): Rename from d_type. Make non-static by + default. Change all callers. + (cplus_demangle_init_info): Rename from d_init_info. Make + non-static by default. Change all callers. + * cp-demangle.h: New file. + * cp-demint.c: New file. + * Makefile.in: Rebuild dependencies. + (CFILES): Add cp-demint.c. + (REQUIRED_OFILES): Add cp-demint.o. + +2004-01-09 Kelley Cook <kcook@gcc.gnu.org> + + * configure.in: Rename file to ... + * configure.ac: ... this. + * Makefile.in: Update a comment for above change. + * README: Likewise. + * config.in: Regenerate. + +2004-01-02 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (d_encoding): When DMGL_PARAMS is not set, strip + CV-qualifiers from D_COMP_LOCAL_NAME right subtree. + * cplus-dem.c (demangle_arm_hp_template): Set DMGL_PARAMS when + demangling template parameters. + * testsuite/test-demangle.c (fail): New static function. + (main): Support new options in input file: --no-params, + --is-v3-ctor, and --is-v3-dtor. + * testsuite/demangle-expected: Add --no-params to most tests, and + add the correct result when parameters are not demangled. Add + some simple tests for V3 constructor/destructor recognition. + +2003-12-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * cp-demangle.c (is_ctor_or_dtor): Fix error in last change. + +2003-12-22 Daniel Jacobowitz <drow@mvista.com> + + PR debug/13272 + * Makefile.in (lbasename.o): Depend on filenames.h. + * lbasename.c: Include "filenames.h" instead of defining + its macros locally. + +2003-12-22 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (CP_DYNAMIC_ARRAYS): Define if compiler supports + dynamic arrays. + (struct d_operator_info): Add len field. + (struct d_builtin_type_info): Add len and java_len fields. + (struct d_standard_sub_info): Add simple_len, full_len, and + set_last_name_len fields. + (struct d_comp): Add len field to s_string. + (struct d_info): Add send, did_subs, and expansion fields. + (d_append_string_constant): Define. + (d_append_string): Remove. Change all users to use + d_append_string_constant or d_append_buffer instead. + (d_make_sub): Add len parameter. Change all callers. + (d_name): Increase expansion when substituting std::. + (d_unqualified_name): Increase expansion for an operator. + (d_number): Don't use multiplication for negative numbers. + (d_identifier): Make sure there are enough characters in the + string for the specified length. Adjust expansion for an + anonymous namespace. + (d_operators): Initialize len field. + (d_special_name, d_ctor_dtor_name): Increase expansion. + (d_builtin_types): Initialize len and java_len fields. + (d_type): Increase expansion for a builtin type. + (d_cv_qualifiers): Increase expansion for each qualifier. + (d_bare_function_type): Decrease expansion when removing single + void parameter. + (d_template_param): Increment did_subs. + (d_expression): Increase expansion for an operator. + (d_expr_primary): Decrease expansion for a type we will print + specially. + (standard_subs): Initialize new fields. + (d_substitution): Increment did_subs when doing a normal + substitution. Increase expansion for a special substitution. + (d_print): Add estimate parameter. Change all callers. + (d_print_comp) [D_COMP_NAME]: Handle C++ case inline. + (d_print_comp) [D_COMP_BINARY]: Use length to avoid strcmp call. + (d_print_java_identifier): Rename from d_print_identifier. Handle + only Java case. Change caller. + (d_init_info): Change return type to void. Change all callers. + Initialize send, did_subs, and expansion fields. Do not + initialize comps and subs fields. + (d_demangle): Ifdef CP_DYNAMIC_ARRAYS, allocate comps and subs + arrays on stack. Make an estimate of the length of the demangled + name. Ifdef CP_DEMANGLE_DEBUG, print estimation failures. + (is_ctor_or_dtor): Ifdef CP_DYNAMIC_ARRAYS, allocate comps and + subs arrays on stack. + +2003-12-20 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (d_identifier): In Java mode, skip an optional '$' + after the identifier. + * testsuite/demangle-expected: Add test case. + +2003-12-19 Ian Lance Taylor <ian@wasabisystems.com> + + Fix for PR c++/13447: + * cp-demangle.c (enum d_comp_type): Add D_COMP_LOCAL_NAME. + (d_dump, d_make_comp): Handle D_COMP_LOCAL_NAME. + (is_ctor_dtor_or_conversion): Handle D_COMP_LOCAL_NAME like + D_COMP_QUAL_NAME. + (is_ctor_or_dtor): Likewise. + (d_local_name): Use D_COMP_LOCAL_NAME rather than + D_COMP_QUAL_NAME. + (d_print_comp) [D_COMP_LOCAL_NAME]: New. + (d_prinT_comp) [D_COMP_TYPED_NAME]: If the left tree is + D_COMP_LOCAL_NAME, pull any qualifiers off its right subtree. + (d_print_mod_list): Handle D_COMP_LOCAL_NAME. + * testsuite/demangle-expected: Add two test cases. + + * cp-demangle.c (d_print_function_type): Clear the global modifier + list when printing the modifiers, not just when printing the + function parameters. + * testsuite/demangle-expected: Add two test cases. + +2003-12-15 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (d_print_function_type): Print the function + parameters with no modifiers. + * testsuite/demangle-expected: Add test case. + + * cp-demangle.c (d_demangle): If DMGL_PARAMS is not set, don't + expect that we've read the entire string. + (is_ctor_or_dtor): Don't expect that we've read the entire + string--reverse patch of 2003-11-29. + +2003-12-15 Brendan Kehoe <brendan@zen.org> + + * libiberty/Makefile.in (floatformat.o): Add dependency on + config.h to accompany change of 2003-12-03. + +2003-12-15 Ian Lance Taylor <ian@wasabisystems.com> + + Fix handling of constructor/destructor of standard substitution: + * cp-demangle.c (struct d_standard_sub_info): Define. + (d_substitution): Add prefix argument. Change all callers. + Rework handling of standard substitutions to print full name when + qualifying a constructor/destructor, or when DMGL_VERBOSE is set. + * testsuite/demangle-expected: Add test case. + + Fix handling of negative literal constants: + * cp-demangle.c (enum d_comp_type): Add D_COMP_LITERAL_NEG. + (d_dump, d_make_comp): Handle D_COMP_LITERAL_NEG. + (d_expr_primary): Use D_COMP_LITERAL_NEG for a negative number. + (d_print_comp): Handle D_COMP_LITERAL_NEG. + * testsuite/demangle-expected: Add test case. + +2003-12-04 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (IS_UPPER, IS_LOWER): Define. + (d_last_char): Define new macro. + (d_make_name): Reject an empty name. + (d_prefix, d_unqualified_name, d_type): Use new IS_* macros. + (d_substitution, d_print_identifier): Likewise. + (d_print_comp) [D_COMP_OPERATOR]: Likewise. + (d_print_comp) [D_COMP_TEMPLATE]: Use new d_last_char macro. + (d_print_mod) Use new d_last_char macro. + (d_print_cast): Use new d_last_char macro. + (is_ctor_or_dtor): Don't leak memory. + + Fix handling of member function modifiers: + * cp-demangle.c (enum d_comp_type): Add D_COMP_RESTRICT_THIS, + D_COMP_VOLATILE_THIS, and D_COMP_CONST_THIS. + (d_dump): Dump new d_comp_type values. + (d_make_comp): Accept new d_comp_type values. + (has_return_type): Only accept _THIS variants of qualifiers. + (d_encoding): Without DMGL_PARAMS, only remove _THIS variants of + qualifiers. + (d_cv_qualifiers): Add member_fn parameter. Change all callers. + (d_print_comp) [D_COMP_TYPED_NAME]: Rather than removing + qualifiers and printing them at the end, add _THIS qualifiers to + the modifier list. + (d_print_comp) [D_COMP_*_THIS]: New cases. + (d_print_comp) [D_COMP_PTRMEM_TYPE]: Remove special handling of + qualifiers. + (d_print_mod_list): Add suffix parameter. Change all callers. + Keep walking the list even if the current modifier has been + printed. + (d_print_mod): Handle new _THIS qualifiers. + (d_print_function_type): Handle new _THIS qualifiers when deciding + whether to print a parenthesis. Put a space before the + parenthesis in some cases. Call d_print_mod_list again at the + end, passing suffix as 1. + (is_ctor_or_dtor): Look for new _THIS qualifiers. + * testsuite/demangle-expected: Add test case. + + Fix for PR gcc/13304: + * cp-demangle.c (d_print_comp) [D_COMP_TEMPLATE]: If the character + before the '<' is itself a '<', insert a space. + (d_print_cast): Likewise. + * testsuite/demangle-expected: Add test case. + + Fix for PR gcc/13244: + * cp-demangle.c (d_print_comp) [D_COMP_BINARY]: Wrap an expression + which uses the '>' operator in an extra layer of parens. + * testsuite/demangle-expected: Add test case. + +2003-12-03 Ian Lance Taylor <ian@wasabisystems.com> + + * floatformat.c: Include "config.h" and <string.h> if available. + (INFINITY, NAN): Define if not defined by <math.h>. + (floatformat_to_double): Handle NaN, infinity, and denormalized + numbers. + (floatformat_from_double): Likewise. + (ieee_test): In debugging code, use little endian rather than big + endian. Correct tests to handle NaN and to check correct sign of + zero. Omit m68k extended test. + (main): Add more debugging cases. + +2003-11-29 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (d_demangle): Only return success if we consumed + the entire demangled string. + (is_ctor_or_dtor): Likewise. + + * testsuite/demangle-expected: Revert one part of 2003-06-26 patch + to restore expected result of EDG test case to original expected + result. + +2003-11-26 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (struct d_print_mod): Add templates field. + (d_make_builtin_type): Check for NULL type. + (d_make_extended_operator): Check for NULL name. + (d_make_ctor, d_make_dtor): Likewise. + (d_mangled_name): Add top_level parameter. Change all callers. + (d_encoding): If DMGL_PARAMS is not set, strip off initial + CV-qualifiers. + (d_type): Check some return values we rely on. + (d_bare_function_type, d_array_type): Likewise. + (d_pointer_to_member_type, d_template_args): Likewise. + (d_add_substitution): Fail if argument is NULL. + (d_print_resize): Check whether buf is NULL. + (d_print_comp): Save current templates list with each modifier. + Don't pass the modifier list down when printing a template. + (d_print_cast): Don't pass the modifier list down when printing a + template. + (d_print_mod_list): Temporarily set templates list while printing + a modifier. + (d_print_mod): Check that buf is not NULL before using it. + (d_print_function_type): Print parens if there is no modifier. + (d_init_info): Permit as many substitutions as there are + characters in the mangled name. + * testsuite/demangle-expected: Add two new test cases. + +2003-11-25 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (java_demangle_v3): Pass DMGL_PARAMS to + d_demangle. + +2003-11-22 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (d_encoding): Add top_level parameter. Change all + callers. + (print_usage): Display new -p option. + (long_options): Add --no-params. + (main): Accept and handle -p. + +2003-11-21 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (has_return_type): Skip qualifiers when checking + whether we have a template. + * testsuite/demangle-expected: Add four new tests. + +2003-11-20 Ian Lance Taylor <ian@wasabisystems.com> + + * testsuite/demangle-expected: Minor changes to match output of + new demangler: adjust whitespace in four tests, and change order + of qualifiers in one test. + + * cp-demangle.c: Complete rewrite. + +2003-11-19 Mark Mitchell <mark@codesourcery.com> + + * cp-demangle.c (demangle_type): Correct thinko in substitution + processing. + +2003-11-18 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (demangle_operator_name): Remove space before + "sizeof". + (demangle_type_ptr): Put qualifiers in the right place. Handle + qualifiers in pointer to member specially. + (demangle_type): Handle qualifiers for pointer or reference + specially. Handle function type. + (demangle_local_name): Save and restore caret around demangling of + initial encoding. + + * testsuite/test-demangle.c (main): Don't pass DMGL_VERBOSE to + cplus_demangle. + + * testsuite/Makefile.in (test-demangle): Depend upon libiberty.a. + +2003-10-31 Andreas Jaeger <aj@suse.de> + + * floatformat.c (floatformat_always_valid): Add unused attribute. + +2003-10-30 Josef Zlomek <zlomekj@suse.cz> + + Jan Hubicka <jh@suse.cz> + * vasprintf.c (int_vasprintf): Pass va_list by value. + Use va_copy for copying va_list. + (vasprintf): Pass va_list by value. + +2003-10-30 Josef Zlomek <zlomekj@suse.cz> + + * hashtab.c (htab_find_slot_with_hash): Decrease n_deleted + instead of increasing n_elements when inserting to deleted slot. + +2003-10-20 J. Brobecker <brobecker@gnat.com> + + * cplus-dem.c (demangle_template): Register a new Btype only + when needed. + * testsuite/demangle-expected: Add a new test. + +2003-10-16 H.J. Lu <hongjiu.lu@intel.com> + + * testsuite/demangle-expected: Update the expected output of + _GLOBAL__I__Z2fnv. + +2003-10-02 Daniel Jacobowitz <drow@mvista.com> + + * strerror.c: Revert last change. Declare static sys_nerr + and sys_errlist using different names. + +2003-10-01 Daniel Jacobowitz <drow@mvista.com> + + * strerror.c: Don't provide or reference sys_errlist if + strerror is available. + +2003-10-01 H.J. Lu <hongjiu.lu@intel.com> + + * configure.in: Check if $MAKEINFO is missing. + * configure: Regenerated. + +2003-09-24 Daniel Jacobowitz <drow@mvista.com> + + * configure.in: Use AC_PROG_CPP_WERROR. + * configure: Regenerated. + +2003-09-22 Andrew Cagney <cagney@redhat.com> + + * floatformat.c (floatformat_i387_ext_is_valid): New function. + (floatformat_always_valid): New function. + (floatformat_i387_ext): Initialize new "is_valid" field to + "floatformat_i387_ext_is_valid". + (floatformat_ieee_single_little): Initialize "is_valid" field to + floatformat_always_valid. + (floatformat_ieee_double_big): Ditto. + (floatformat_ieee_double_little): Ditto. + (floatformat_ieee_double_little): Ditto. + (floatformat_ieee_double_littlebyte_bigword): Ditto. + (floatformat_i960_ext): Ditto. + (floatformat_m88110_ext): Ditto. + (floatformat_m88110_harris_ext): Ditto. + (floatformat_arm_ext_big): Ditto. + (floatformat_arm_ext_littlebyte_bigword): Ditto. + (floatformat_ia64_spill_big): Ditto. + (floatformat_ia64_spill_little): Ditto. + (floatformat_ia64_quad_big): Ditto. + (floatformat_ia64_quad_little): Ditto. + (floatformat_ia64_quad_little): Ditto. + (floatformat_is_valid): Call "is_valid". + +2003-09-15 Andrew Cagney <cagney@redhat.com> + + * floatformat.c (get_field): Make "data" constant. + (floatformat_is_valid, floatformat_to_double): Make "from" + constant, fix casts. + (floatformat_from_double): Make "from" constant. + +2003-09-15 Daniel Jacobowitz <drow@mvista.com> + + * floatformat.c (floatformat_is_valid): New function. + (get_field, put_field): Correct comments. + +2003-09-06 Josef Zlomek <zlomekj@suse.cz> + + * fibheap.c (fibheap_replace_key_data): Change type of OKEY to + FIBHEAPKEY_T. + +2003-09-02 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR bootstrap/12100 + * aclocal.m4 (AC_LANG_FUNC_LINK_TRY): Define. + * configure: Rebuilt. + +2003-08-27 Daniel Jacobowitz <drow@mvista.com> + + * aclocal.m4: Include acx.m4 and no-executables.m4. + (libiberty_AC_FUNC_STRNCMP): Use AC_LIBOBJ. + (LIB_AC_PROG_CC): Remove. + * configure.in: Update AC_PREREQ to 2.57. Use GCC_NO_EXECUTABLES. + Use AC_PROG_CC and set ac_libiberty_warn_cflags instead of using + LIB_AC_PROG_CC. Use AC_LIBOBJ. Call AC_ISC_POSIX later, only if + performing link tests. + * configure: Regenerated. + +2003-08-12 Nathanael Nerode <neroden@gcc.gnu.org> + + * cp-demangle.c: Clarify what package(s) this is part of. + +2003-07-05 Danny Smith <dannysmith@users.sourceforge.net> + + * pex-win32.c (pexecute): Mark parameters this_pname and + temp_base as unused. Remove unused variables retries, + sleep_interval. Initialize org_stdin, org_stdout. + (pwait): Mark parameter flags as unused. + +2003-07-02 Danny Smith <dannysmith@users.sourceforge.net> + + * pex-win32.c (fix_argv): Ensure that the executable pathname + uses Win32 backslashes. + (pexecute): Cast away constness when assigning *errmsg_arg. + +2003-06-26 H.J. Lu <hongjiu.lu@intel.com> + + * testsuite/demangle-expected: Add more GNU V3 testcases. + +2003-06-22 Zack Weinberg <zack@codesourcery.com> + + * safe-ctype.c: Use HOST_CHARSET_ASCII and HOST_CHARSET_EBCDIC, + not HC_ASCII and HC_EBCDIC. + Add documentation in form expected by gather-docs. + * hex.c: Use HOST_CHARSET, not hand-coded check of character set. + * Makefile.in, functions.texi: Regenerate. + +2003-06-21 Zack Weinberg <zack@codesourcery.com> + + * safe-ctype.c: Separate out EOF==-1 check. Use HOST_CHARSET + for charset determination. + +2003-06-19 Dara Hazeghi <dhazeghi@yahoo.com> + + * configure.in: Add check for malloc.h needed by + m68k for function free(). + * configure: Regenerated. + * config.in: Add HAVE_MALLOC_H. + * hashtab.c: include malloc.h were available for + free(). + +2003-06-09 Albert Chin-A-Young <china@thewrittenword.com> + + PR bootstrap/10974 + * physmem.c: Update comment. + * configure.in: Modify test for _system_configuration for older + AIX systems. + + * config.in, configure: Regenerated. + +2003-06-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR other/10810 + * test-demangle.c (getline): Fix fence-post error. + +2003-06-03 Nick Clifton <nickc@redhat.com> + + * asprintf.c: Change comment to note that -1 is returned upon + error. + * vasprintf.c: Likewise. + (vasprintf): Return -1 upon error. + * functions.texi: Document changes to asprintf and vasprintf. + +2003-05-19 Kelley Cook <kelleycook@wideopenwest.com> + + * config.table: Accept i[345867]86 variant. + +2003-05-15 Jim Blandy <jimb@redhat.com> + + * hex.c (_hex_value): Make this unsigned. + (hex_value): Update documentation for new return type. hex_value + now expands to an unsigned int expression, to avoid unexpected + sign extension when we store it in a bfd_vma, which is larger than + int on some platforms. + * functions.texi: Regenerated. + +2003-05-07 Josef Zlomek <zlomekj@suse.cz> + + * splay-tree.c (splay_tree_predecessor): Fix comment. + (splay_tree_successor): Fix comment. + +2003-05-07 Jason Merrill <jason@redhat.com> + + * hashtab.c (iterative_hash): New fn. + * configure.in: Add AC_C_BIGENDIAN_CROSS. + * aclocal.m4: Include accross.m4. + * configure, config.in: Regenerate. + +2003-05-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * configure.in (AC_CHECK_FUNCS): Don't make multiple calls. + * configure: Regenerate. + +2003-05-03 Carlo Wood <carlo@alinoe.com> + + * cp-demangle.c: Fix typo in "char_traints" string-literal. 2003-04-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> @@ -56,7 +1725,7 @@ ANSI_PROTOTYPES. * vsprintf.c: Include "ansidecl.h" earlier, rely on ANSI_PROTOTYPES and possibly include <stdarg.h>. - + * Makefile.in: Regenerate dependencies. 2003-04-15 DJ Delorie <dj@redhat.com> @@ -154,7 +1823,7 @@ 2003-02-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Richard Earnshaw <rearnsha@arm.com> Geoffrey Keating <geoffk@apple.com> - + * configure.in: Check for sys/sysctl.h and sysctl. * physmem.c: Add support for *bsd and darwin. * Makefile.in: Generate depedency for physmem.o. @@ -183,7 +1852,7 @@ * physmem.c (physmem_total, physmem_available): De-ANSI-fy. * configure.in (AC_CHECK_FUNCS): Add pstat_getstatic and pstat_getdynamic. - + 2003-02-20 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * Makefile.in (CFILES): Add physmem.c. @@ -1927,7 +3596,7 @@ Thu Mar 16 01:33:58 2000 Jeffrey A Law (law@cygnus.com) (REQUIRED_OFILES): Add partition.o. (partition.o): New rule. * partition.c: New file. - + 2000-03-09 Zack Weinberg <zack@wolery.cumb.org> * hashtab.c (htab_create): Set del_f. @@ -4911,7 +6580,7 @@ Thu Feb 11 22:20:47 1993 Fred Fish (fnf@cygnus.com) * cplus-dem.c (string_prepends): Used now, remove #if 0. * cplus-dem.c (demangle_signature): Call demangle_qualified with prepending. - * cplus_dem.c (gnu_special): Recognize static data members that + * cplus-dem.c (gnu_special): Recognize static data members that use qualified names. * cplus-dem.c (demangle_qualified): Accumulate qualifiers in a temporary buffer and the prepend or append them to the result, diff --git a/gnu/lib/libiberty/src/Makefile.in b/gnu/lib/libiberty/src/Makefile.in index d73ab2fef77..95a82784b0b 100644 --- a/gnu/lib/libiberty/src/Makefile.in +++ b/gnu/lib/libiberty/src/Makefile.in @@ -1,6 +1,6 @@ # # Makefile -# Copyright (C) 1990, 91-99, 2000, 2001, 2002, 2003 +# Copyright (C) 1990, 91-99, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation # # This file is part of the libiberty library. @@ -16,8 +16,8 @@ # # You should have received a copy of the GNU Library General Public # License along with libiberty; see the file COPYING.LIB. If not, -# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. +# write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +# Boston, MA 02110-1301, USA. # # This file was written by K. Richard Pixley <rich@cygnus.com>. @@ -28,7 +28,6 @@ libiberty_topdir = @libiberty_topdir@ srcdir = @srcdir@ -VPATH = @srcdir@ prefix = @prefix@ @@ -70,8 +69,8 @@ PICFLAG = MAKEOVERRIDES = -TARGETLIB = libiberty.a -TESTLIB = testlib.a +TARGETLIB = ./libiberty.a +TESTLIB = ./testlib.a LIBOBJS = @LIBOBJS@ @@ -118,22 +117,24 @@ installcheck: installcheck-subdir INCDIR=$(srcdir)/$(MULTISRCTOP)../include COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@ + +# Just to make sure we don't use a built-in rule with VPATH .c.o: - if [ x"$(PICFLAG)" != x ]; then \ - $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \ - else true; fi - $(COMPILE.c) $< $(OUTPUT_OPTION) + false # NOTE: If you add new files to the library, add them to this list # (alphabetical), and add them to REQUIRED_OFILES, or -# CONFIGURED_OFILES and funcs in configure.in. +# CONFIGURED_OFILES and funcs in configure.ac. Also run "make maint-deps" +# to build the new rules. CFILES = alloca.c argv.c asprintf.c atexit.c \ basename.c bcmp.c bcopy.c bsearch.c bzero.c \ calloc.c choose-temp.c clock.c concat.c cp-demangle.c \ - cplus-dem.c \ + cp-demint.c cplus-dem.c \ dyn-string.c \ fdmatch.c ffs.c fibheap.c floatformat.c fnmatch.c \ + fopen_unlocked.c \ getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \ + gettimeofday.c \ hashtab.c hex.c \ index.c insque.c \ lbasename.c \ @@ -142,61 +143,68 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \ make-temp-file.c md5.c memchr.c memcmp.c memcpy.c memmove.c \ mempcpy.c memset.c mkstemps.c \ objalloc.c obstack.c \ - partition.c \ - pex-djgpp.c pex-mpw.c pex-msdos.c pex-os2.c \ + partition.c pexecute.c \ + pex-common.c pex-djgpp.c pex-msdos.c pex-one.c \ pex-unix.c pex-win32.c \ physmem.c putenv.c \ random.c regex.c rename.c rindex.c \ safe-ctype.c setenv.c sigsetmask.c snprintf.c sort.c spaces.c \ splay-tree.c stpcpy.c stpncpy.c strcasecmp.c strchr.c strdup.c \ strerror.c strncasecmp.c strncmp.c strrchr.c strsignal.c \ - strstr.c strtod.c strtol.c strtoul.c \ + strstr.c strtod.c strtol.c strtoul.c strndup.c strverscmp.c \ ternary.c tmpnam.c \ + unlink-if-ordinary.c \ vasprintf.c vfork.c vfprintf.c vprintf.c vsnprintf.c vsprintf.c \ waitpid.c \ - xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c + xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c \ + xstrndup.c # These are always included in the library. The first four are listed # first and by compile time to optimize parallel builds. -REQUIRED_OFILES = regex.o cplus-dem.o cp-demangle.o md5.o \ - alloca.o argv.o \ - choose-temp.o concat.o \ - dyn-string.o \ - fdmatch.o fibheap.o floatformat.o fnmatch.o \ - getopt.o getopt1.o getpwd.o getruntime.o \ - hashtab.o hex.o \ - lbasename.o \ - lrealpath.o \ - make-relative-prefix.o \ - make-temp-file.o \ - objalloc.o obstack.o \ - partition.o physmem.o @pexecute@ \ - safe-ctype.o sort.o spaces.o splay-tree.o strerror.o \ - strsignal.o \ - ternary.o \ - xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o +REQUIRED_OFILES = ./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o \ + ./alloca.o ./argv.o \ + ./choose-temp.o ./concat.o ./cp-demint.o \ + ./dyn-string.o \ + ./fdmatch.o ./fibheap.o ./floatformat.o ./fnmatch.o \ + ./fopen_unlocked.o \ + ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o \ + ./hashtab.o ./hex.o \ + ./lbasename.o ./lrealpath.o \ + ./make-relative-prefix.o ./make-temp-file.o \ + ./objalloc.o ./obstack.o \ + ./partition.o ./pexecute.o ./physmem.o \ + ./pex-common.o ./pex-one.o @pexecute@ \ + ./safe-ctype.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o \ + ./strsignal.o \ + ./ternary.o \ + ./unlink-if-ordinary.o \ + ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o \ + ./xstrerror.o ./xstrndup.o # These are all the objects that configure may add to the library via # $funcs or EXTRA_OFILES. This list exists here only for "make # maint-missing" and "make check". -CONFIGURED_OFILES = asprintf.o atexit.o \ - basename.o bcmp.o bcopy.o bsearch.o bzero.o \ - calloc.o clock.o copysign.o \ - _doprnt.o \ - ffs.o \ - getcwd.o getpagesize.o \ - index.o insque.o \ - memchr.o memcmp.o memcpy.o memmove.o mempcpy.o memset.o mkstemps.o \ - pex-djgpp.o pex-mpw.o pex-msdos.o pex-os2.o \ - pex-unix.o pex-win32.o \ - putenv.o \ - random.o rename.o rindex.o \ - setenv.o sigsetmask.o snprintf.o stpcpy.o stpncpy.o strcasecmp.o \ - strchr.o strdup.o strncasecmp.o strncmp.o strrchr.o strstr.o \ - strtod.o strtol.o strtoul.o \ - tmpnam.o \ - vasprintf.o vfork.o vfprintf.o vprintf.o vsnprintf.o vsprintf.o \ - waitpid.o +CONFIGURED_OFILES = ./asprintf.o ./atexit.o \ + ./basename.o ./bcmp.o ./bcopy.o ./bsearch.o ./bzero.o \ + ./calloc.o ./clock.o ./copysign.o \ + ./_doprnt.o \ + ./ffs.o \ + ./getcwd.o ./getpagesize.o ./gettimeofday.o \ + ./index.o ./insque.o \ + ./memchr.o ./memcmp.o ./memcpy.o ./memmove.o ./mempcpy.o \ + ./memset.o ./mkstemps.o \ + ./pex-djgpp.o ./pex-msdos.o \ + ./pex-unix.o ./pex-win32.o \ + ./putenv.o \ + ./random.o ./rename.o ./rindex.o \ + ./setenv.o ./sigsetmask.o ./snprintf.o ./stpcpy.o ./stpncpy.o \ + ./strcasecmp.o ./strchr.o ./strdup.o ./strncasecmp.o \ + ./strncmp.o ./strndup.o ./strrchr.o ./strstr.o \ + ./strtod.o ./strtol.o ./strtoul.o ./strverscmp.o \ + ./tmpnam.o \ + ./vasprintf.o ./vfork.o ./vfprintf.o ./vprintf.o ./vsnprintf.o \ + ./vsprintf.o \ + ./waitpid.o # These files are installed if the library has been configured to do so. INSTALLED_HEADERS = \ @@ -237,7 +245,62 @@ info: libiberty.info info-subdir install-info: install-info-subdir clean-info: clean-info-subdir dvi: libiberty.dvi dvi-subdir -html: libiberty.html + +# html, install-html targets +HTMLS = libiberty.html + +html: $(HTMLS) + +.PHONY: install-html install-html-am install-html-recursive + +NORMAL_INSTALL = : +mkdir_p = mkdir -p -- + +html__strip_dir = `echo $$p | sed -e 's|^.*/||'`; + +install-html: install-html-recursive install-html-am + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkdir_p) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkdir_p) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkdir_p) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done + +install-html-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" TEXISRC = \ $(srcdir)/libiberty.texi \ @@ -257,12 +320,12 @@ libiberty.dvi : $(srcdir)/libiberty.texi $(TEXISRC) texi2dvi $(srcdir)/libiberty.texi libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC) - $(MAKEINFO) --html -I$(srcdir) $(srcdir)/libiberty.texi + $(MAKEINFO) --no-split --html -I$(srcdir) -o $@ $< @MAINT@$(srcdir)/functions.texi : stamp-functions @MAINT@ @true -@MAINT@stamp-functions : $(CFILES) $(TEXIFILES) $(srcdir)/gather-docs Makefile +@MAINT@stamp-functions : $(CFILES:%=$(srcdir)/%) $(TEXIFILES:%=$(srcdir)/%) $(srcdir)/gather-docs Makefile @MAINT@@HAVE_PERL@ $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES) @MAINT@ echo stamp > stamp-functions @@ -376,7 +439,7 @@ clean: clean-subdir distclean: distclean-subdir $(MAKE) SUBDIRS="" clean @$(MULTICLEAN) multi-clean DO=distclean - -rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out + -rm -f *~ Makefile config.cache config.status xhost-mkfrag TAGS multilib.out -rm -f config.log -rmdir testsuite 2>/dev/null maintainer-clean realclean: maintainer-clean-subdir @@ -390,10 +453,10 @@ Makefile: $(srcdir)/Makefile.in config.status # Depending on Makefile makes sure that config.status has been re-run # if needed. This prevents problems with parallel builds. config.h: stamp-h ; @true -stamp-h: config.in config.status Makefile - CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status +stamp-h: $(srcdir)/config.in config.status Makefile + CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status -config.status: $(srcdir)/configure $(srcdir)/config.table +config.status: $(srcdir)/configure $(SHELL) ./config.status --recheck # Depending on config.h makes sure that config.status has been re-run @@ -412,111 +475,699 @@ maintainer-clean-subdir: config.h $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS): stamp-picdir $(CONFIGURED_OFILES): stamp-picdir +# Don't export variables to the environment, in order to not confuse +# configure. +.NOEXPORT: + # The dependencies in the remainder of this file are automatically # generated by "make maint-deps". Manual edits will be lost. -_doprnt.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h -alloca.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -argv.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -asprintf.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -atexit.o: config.h -basename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ +./_doprnt.o: $(srcdir)/_doprnt.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/safe-ctype.h -bsearch.o: config.h $(INCDIR)/ansidecl.h -calloc.o: $(INCDIR)/ansidecl.h -choose-temp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -clock.o: config.h -concat.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -copysign.o: $(INCDIR)/ansidecl.h -cp-demangle.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \ - $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h -cplus-dem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/_doprnt.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/_doprnt.c $(OUTPUT_OPTION) + +./alloca.o: $(srcdir)/alloca.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/alloca.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/alloca.c $(OUTPUT_OPTION) + +./argv.o: $(srcdir)/argv.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/argv.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/argv.c $(OUTPUT_OPTION) + +./asprintf.o: $(srcdir)/asprintf.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/asprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/asprintf.c $(OUTPUT_OPTION) + +./atexit.o: $(srcdir)/atexit.c config.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/atexit.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/atexit.c $(OUTPUT_OPTION) + +./basename.o: $(srcdir)/basename.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h -dyn-string.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/dyn-string.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/basename.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/basename.c $(OUTPUT_OPTION) + +./bcmp.o: $(srcdir)/bcmp.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/bcmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/bcmp.c $(OUTPUT_OPTION) + +./bcopy.o: $(srcdir)/bcopy.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/bcopy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/bcopy.c $(OUTPUT_OPTION) + +./bsearch.o: $(srcdir)/bsearch.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/bsearch.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/bsearch.c $(OUTPUT_OPTION) + +./bzero.o: $(srcdir)/bzero.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/bzero.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/bzero.c $(OUTPUT_OPTION) + +./calloc.o: $(srcdir)/calloc.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/calloc.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/calloc.c $(OUTPUT_OPTION) + +./choose-temp.o: $(srcdir)/choose-temp.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h -fdmatch.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -fibheap.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/fibheap.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/choose-temp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/choose-temp.c $(OUTPUT_OPTION) + +./clock.o: $(srcdir)/clock.c config.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/clock.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/clock.c $(OUTPUT_OPTION) + +./concat.o: $(srcdir)/concat.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h -floatformat.o: $(INCDIR)/ansidecl.h $(INCDIR)/floatformat.h -fnmatch.o: config.h $(INCDIR)/fnmatch.h $(INCDIR)/safe-ctype.h -getcwd.o: config.h -getopt.o: config.h $(INCDIR)/getopt.h -getopt1.o: config.h $(INCDIR)/getopt.h -getpagesize.o: config.h -getpwd.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -getruntime.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -hashtab.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/hashtab.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/concat.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/concat.c $(OUTPUT_OPTION) + +./copysign.o: $(srcdir)/copysign.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/copysign.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/copysign.c $(OUTPUT_OPTION) + +./cp-demangle.o: $(srcdir)/cp-demangle.c config.h $(INCDIR)/ansidecl.h \ + $(srcdir)/cp-demangle.h $(INCDIR)/demangle.h \ + $(INCDIR)/dyn-string.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/cp-demangle.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/cp-demangle.c $(OUTPUT_OPTION) + +./cp-demint.o: $(srcdir)/cp-demint.c config.h $(INCDIR)/ansidecl.h \ + $(srcdir)/cp-demangle.h $(INCDIR)/demangle.h \ $(INCDIR)/libiberty.h -hex.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -lbasename.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/cp-demint.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/cp-demint.c $(OUTPUT_OPTION) + +./cplus-dem.o: $(srcdir)/cplus-dem.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \ $(INCDIR)/safe-ctype.h -lrealpath.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -make-relative-prefix.o: config.h $(INCDIR)/ansidecl.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/cplus-dem.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/cplus-dem.c $(OUTPUT_OPTION) + +./dyn-string.o: $(srcdir)/dyn-string.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/dyn-string.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/dyn-string.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/dyn-string.c $(OUTPUT_OPTION) + +./fdmatch.o: $(srcdir)/fdmatch.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/libiberty.h -make-temp-file.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -md5.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h -memchr.o: $(INCDIR)/ansidecl.h -memcmp.o: $(INCDIR)/ansidecl.h -memcpy.o: $(INCDIR)/ansidecl.h -memmove.o: $(INCDIR)/ansidecl.h -mempcpy.o: $(INCDIR)/ansidecl.h -memset.o: $(INCDIR)/ansidecl.h -mkstemps.o: config.h $(INCDIR)/ansidecl.h -objalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/objalloc.h -obstack.o: config.h $(INCDIR)/obstack.h -partition.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(INCDIR)/partition.h -pex-djgpp.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -pex-mpw.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -pex-msdos.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h $(INCDIR)/safe-ctype.h -pex-os2.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -pex-unix.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -pex-win32.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(srcdir)/pex-common.h -physmem.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -putenv.o: config.h $(INCDIR)/ansidecl.h -random.o: $(INCDIR)/ansidecl.h -regex.o: config.h $(INCDIR)/xregex.h $(INCDIR)/xregex2.h -rename.o: config.h $(INCDIR)/ansidecl.h -safe-ctype.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h -setenv.o: config.h $(INCDIR)/ansidecl.h -sigsetmask.o: $(INCDIR)/ansidecl.h -snprintf.o: $(INCDIR)/ansidecl.h -sort.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/fdmatch.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/fdmatch.c $(OUTPUT_OPTION) + +./ffs.o: $(srcdir)/ffs.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/ffs.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/ffs.c $(OUTPUT_OPTION) + +./fibheap.o: $(srcdir)/fibheap.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/fibheap.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/fibheap.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION) + +./floatformat.o: $(srcdir)/floatformat.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/floatformat.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/floatformat.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/floatformat.c $(OUTPUT_OPTION) + +./fnmatch.o: $(srcdir)/fnmatch.c config.h $(INCDIR)/fnmatch.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/fnmatch.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/fnmatch.c $(OUTPUT_OPTION) + +./fopen_unlocked.o: $(srcdir)/fopen_unlocked.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/fopen_unlocked.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/fopen_unlocked.c $(OUTPUT_OPTION) + +./getcwd.o: $(srcdir)/getcwd.c config.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getcwd.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getcwd.c $(OUTPUT_OPTION) + +./getopt.o: $(srcdir)/getopt.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/getopt.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getopt.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getopt.c $(OUTPUT_OPTION) + +./getopt1.o: $(srcdir)/getopt1.c config.h $(INCDIR)/getopt.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getopt1.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getopt1.c $(OUTPUT_OPTION) + +./getpagesize.o: $(srcdir)/getpagesize.c config.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getpagesize.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getpagesize.c $(OUTPUT_OPTION) + +./getpwd.o: $(srcdir)/getpwd.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getpwd.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getpwd.c $(OUTPUT_OPTION) + +./getruntime.o: $(srcdir)/getruntime.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/getruntime.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/getruntime.c $(OUTPUT_OPTION) + +./gettimeofday.o: $(srcdir)/gettimeofday.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/gettimeofday.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/gettimeofday.c $(OUTPUT_OPTION) + +./hashtab.o: $(srcdir)/hashtab.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/hashtab.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/hashtab.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/hashtab.c $(OUTPUT_OPTION) + +./hex.o: $(srcdir)/hex.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/hex.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/hex.c $(OUTPUT_OPTION) + +./index.o: $(srcdir)/index.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/index.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/index.c $(OUTPUT_OPTION) + +./insque.o: $(srcdir)/insque.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/insque.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/insque.c $(OUTPUT_OPTION) + +./lbasename.o: $(srcdir)/lbasename.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/filenames.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/lbasename.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/lbasename.c $(OUTPUT_OPTION) + +./lrealpath.o: $(srcdir)/lrealpath.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/lrealpath.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/lrealpath.c $(OUTPUT_OPTION) + +./make-relative-prefix.o: $(srcdir)/make-relative-prefix.c config.h \ + $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/make-relative-prefix.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/make-relative-prefix.c $(OUTPUT_OPTION) + +./make-temp-file.o: $(srcdir)/make-temp-file.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/make-temp-file.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/make-temp-file.c $(OUTPUT_OPTION) + +./md5.o: $(srcdir)/md5.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/md5.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/md5.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/md5.c $(OUTPUT_OPTION) + +./memchr.o: $(srcdir)/memchr.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memchr.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memchr.c $(OUTPUT_OPTION) + +./memcmp.o: $(srcdir)/memcmp.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memcmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memcmp.c $(OUTPUT_OPTION) + +./memcpy.o: $(srcdir)/memcpy.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memcpy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memcpy.c $(OUTPUT_OPTION) + +./memmove.o: $(srcdir)/memmove.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memmove.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memmove.c $(OUTPUT_OPTION) + +./mempcpy.o: $(srcdir)/mempcpy.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/mempcpy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/mempcpy.c $(OUTPUT_OPTION) + +./memset.o: $(srcdir)/memset.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/memset.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/memset.c $(OUTPUT_OPTION) + +./mkstemps.o: $(srcdir)/mkstemps.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/mkstemps.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/mkstemps.c $(OUTPUT_OPTION) + +./msdos.o: $(srcdir)/msdos.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/msdos.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/msdos.c $(OUTPUT_OPTION) + +./objalloc.o: $(srcdir)/objalloc.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/objalloc.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/objalloc.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/objalloc.c $(OUTPUT_OPTION) + +./obstack.o: $(srcdir)/obstack.c config.h $(INCDIR)/obstack.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/obstack.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/obstack.c $(OUTPUT_OPTION) + +./partition.o: $(srcdir)/partition.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(INCDIR)/partition.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/partition.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/partition.c $(OUTPUT_OPTION) + +./pex-common.o: $(srcdir)/pex-common.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-common.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-common.c $(OUTPUT_OPTION) + +./pex-djgpp.o: $(srcdir)/pex-djgpp.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-djgpp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-djgpp.c $(OUTPUT_OPTION) + +./pex-msdos.o: $(srcdir)/pex-msdos.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-msdos.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-msdos.c $(OUTPUT_OPTION) + +./pex-one.o: $(srcdir)/pex-one.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-one.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-one.c $(OUTPUT_OPTION) + +./pex-unix.o: $(srcdir)/pex-unix.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-unix.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-unix.c $(OUTPUT_OPTION) + +./pex-win32.o: $(srcdir)/pex-win32.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(srcdir)/pex-common.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pex-win32.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pex-win32.c $(OUTPUT_OPTION) + +./pexecute.o: $(srcdir)/pexecute.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/pexecute.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/pexecute.c $(OUTPUT_OPTION) + +./physmem.o: $(srcdir)/physmem.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/physmem.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/physmem.c $(OUTPUT_OPTION) + +./putenv.o: $(srcdir)/putenv.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/putenv.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/putenv.c $(OUTPUT_OPTION) + +./random.o: $(srcdir)/random.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/random.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/random.c $(OUTPUT_OPTION) + +./regex.o: $(srcdir)/regex.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/xregex.h \ + $(INCDIR)/xregex2.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/regex.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/regex.c $(OUTPUT_OPTION) + +./rename.o: $(srcdir)/rename.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/rename.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/rename.c $(OUTPUT_OPTION) + +./rindex.o: $(srcdir)/rindex.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/rindex.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/rindex.c $(OUTPUT_OPTION) + +./safe-ctype.o: $(srcdir)/safe-ctype.c $(INCDIR)/ansidecl.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/safe-ctype.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/safe-ctype.c $(OUTPUT_OPTION) + +./setenv.o: $(srcdir)/setenv.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/setenv.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/setenv.c $(OUTPUT_OPTION) + +./sigsetmask.o: $(srcdir)/sigsetmask.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/sigsetmask.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/sigsetmask.c $(OUTPUT_OPTION) + +./snprintf.o: $(srcdir)/snprintf.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/snprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/snprintf.c $(OUTPUT_OPTION) + +./sort.o: $(srcdir)/sort.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ $(INCDIR)/sort.h -spaces.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -splay-tree.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(INCDIR)/splay-tree.h -stpcpy.o: $(INCDIR)/ansidecl.h -stpncpy.o: $(INCDIR)/ansidecl.h -strcasecmp.o: $(INCDIR)/ansidecl.h -strchr.o: $(INCDIR)/ansidecl.h -strdup.o: $(INCDIR)/ansidecl.h -strerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -strncasecmp.o: $(INCDIR)/ansidecl.h -strncmp.o: $(INCDIR)/ansidecl.h -strrchr.o: $(INCDIR)/ansidecl.h -strsignal.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -strtod.o: $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h -strtol.o: config.h $(INCDIR)/safe-ctype.h -strtoul.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h -ternary.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ - $(INCDIR)/ternary.h -vasprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -vfork.o: $(INCDIR)/ansidecl.h -vfprintf.o: $(INCDIR)/ansidecl.h -vprintf.o: $(INCDIR)/ansidecl.h -vsnprintf.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -vsprintf.o: $(INCDIR)/ansidecl.h -waitpid.o: config.h -xatexit.o: $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xexit.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xmalloc.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xmemdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xstrdup.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h -xstrerror.o: config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/sort.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/sort.c $(OUTPUT_OPTION) + +./spaces.o: $(srcdir)/spaces.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/spaces.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/spaces.c $(OUTPUT_OPTION) + +./splay-tree.o: $(srcdir)/splay-tree.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/splay-tree.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/splay-tree.c $(OUTPUT_OPTION) + +./stpcpy.o: $(srcdir)/stpcpy.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/stpcpy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/stpcpy.c $(OUTPUT_OPTION) + +./stpncpy.o: $(srcdir)/stpncpy.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/stpncpy.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/stpncpy.c $(OUTPUT_OPTION) + +./strcasecmp.o: $(srcdir)/strcasecmp.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strcasecmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strcasecmp.c $(OUTPUT_OPTION) + +./strchr.o: $(srcdir)/strchr.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strchr.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strchr.c $(OUTPUT_OPTION) + +./strdup.o: $(srcdir)/strdup.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strdup.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strdup.c $(OUTPUT_OPTION) + +./strerror.o: $(srcdir)/strerror.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strerror.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strerror.c $(OUTPUT_OPTION) + +./strncasecmp.o: $(srcdir)/strncasecmp.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strncasecmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strncasecmp.c $(OUTPUT_OPTION) + +./strncmp.o: $(srcdir)/strncmp.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strncmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strncmp.c $(OUTPUT_OPTION) + +./strndup.o: $(srcdir)/strndup.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strndup.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strndup.c $(OUTPUT_OPTION) + +./strrchr.o: $(srcdir)/strrchr.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strrchr.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strrchr.c $(OUTPUT_OPTION) + +./strsignal.o: $(srcdir)/strsignal.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strsignal.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strsignal.c $(OUTPUT_OPTION) + +./strstr.o: $(srcdir)/strstr.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strstr.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strstr.c $(OUTPUT_OPTION) + +./strtod.o: $(srcdir)/strtod.c $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strtod.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strtod.c $(OUTPUT_OPTION) + +./strtol.o: $(srcdir)/strtol.c config.h $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strtol.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strtol.c $(OUTPUT_OPTION) + +./strtoul.o: $(srcdir)/strtoul.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strtoul.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strtoul.c $(OUTPUT_OPTION) + +./strverscmp.o: $(srcdir)/strverscmp.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \ + $(INCDIR)/safe-ctype.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/strverscmp.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/strverscmp.c $(OUTPUT_OPTION) + +./ternary.o: $(srcdir)/ternary.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h $(INCDIR)/ternary.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/ternary.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/ternary.c $(OUTPUT_OPTION) + +./tmpnam.o: $(srcdir)/tmpnam.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/tmpnam.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/tmpnam.c $(OUTPUT_OPTION) + +./unlink-if-ordinary.o: $(srcdir)/unlink-if-ordinary.c config.h \ + $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/unlink-if-ordinary.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/unlink-if-ordinary.c $(OUTPUT_OPTION) + +./vasprintf.o: $(srcdir)/vasprintf.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vasprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vasprintf.c $(OUTPUT_OPTION) + +./vfork.o: $(srcdir)/vfork.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vfork.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vfork.c $(OUTPUT_OPTION) + +./vfprintf.o: $(srcdir)/vfprintf.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vfprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vfprintf.c $(OUTPUT_OPTION) + +./vprintf.o: $(srcdir)/vprintf.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vprintf.c $(OUTPUT_OPTION) + +./vsnprintf.o: $(srcdir)/vsnprintf.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vsnprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vsnprintf.c $(OUTPUT_OPTION) + +./vsprintf.o: $(srcdir)/vsprintf.c $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/vsprintf.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/vsprintf.c $(OUTPUT_OPTION) + +./waitpid.o: $(srcdir)/waitpid.c config.h $(INCDIR)/ansidecl.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/waitpid.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/waitpid.c $(OUTPUT_OPTION) + +./xatexit.o: $(srcdir)/xatexit.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xatexit.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xatexit.c $(OUTPUT_OPTION) + +./xexit.o: $(srcdir)/xexit.c config.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xexit.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xexit.c $(OUTPUT_OPTION) + +./xmalloc.o: $(srcdir)/xmalloc.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xmalloc.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xmalloc.c $(OUTPUT_OPTION) + +./xmemdup.o: $(srcdir)/xmemdup.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xmemdup.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xmemdup.c $(OUTPUT_OPTION) + +./xstrdup.o: $(srcdir)/xstrdup.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrdup.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xstrdup.c $(OUTPUT_OPTION) + +./xstrerror.o: $(srcdir)/xstrerror.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrerror.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xstrerror.c $(OUTPUT_OPTION) + +./xstrndup.o: $(srcdir)/xstrndup.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/xstrndup.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/xstrndup.c $(OUTPUT_OPTION) + diff --git a/gnu/lib/libiberty/src/acconfig.h b/gnu/lib/libiberty/src/acconfig.h deleted file mode 100644 index f7c599df7ac..00000000000 --- a/gnu/lib/libiberty/src/acconfig.h +++ /dev/null @@ -1,11 +0,0 @@ -/* Define if you have the sys_errlist variable. */ -#undef HAVE_SYS_ERRLIST - -/* Define if you have the sys_nerr variable. */ -#undef HAVE_SYS_NERR - -/* Define if you have the sys_siglist variable. */ -#undef HAVE_SYS_SIGLIST - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR diff --git a/gnu/lib/libiberty/src/argv.c b/gnu/lib/libiberty/src/argv.c index 31d8ef55e26..11ca549a8ea 100644 --- a/gnu/lib/libiberty/src/argv.c +++ b/gnu/lib/libiberty/src/argv.c @@ -15,39 +15,26 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ /* Create and destroy argument vectors. An argument vector is simply an array of string pointers, terminated by a NULL pointer. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" - -#define ISBLANK(ch) ((ch) == ' ' || (ch) == '\t') +#include "safe-ctype.h" /* Routines imported from standard C runtime libraries. */ -#ifdef ANSI_PROTOTYPES - #include <stddef.h> #include <string.h> #include <stdlib.h> - -#else /* !ANSI_PROTOTYPES */ - -#if !defined _WIN32 || defined __GNUC__ -extern char *memcpy (); /* Copy memory region */ -extern int strlen (); /* Count length of string */ -extern char *malloc (); /* Standard memory allocater */ -extern char *realloc (); /* Standard memory reallocator */ -extern void free (); /* Free malloc'd memory */ -extern char *strdup (); /* Duplicate a string */ -#endif - -#endif /* ANSI_PROTOTYPES */ - +#include <stdio.h> #ifndef NULL #define NULL 0 @@ -75,8 +62,7 @@ argument vector. */ char ** -dupargv (argv) - char **argv; +dupargv (char **argv) { int argc; char **copy; @@ -94,7 +80,7 @@ dupargv (argv) for (argc = 0; argv[argc] != NULL; argc++) { int len = strlen (argv[argc]); - copy[argc] = malloc (sizeof (char *) * (len + 1)); + copy[argc] = (char *) malloc (len + 1); if (copy[argc] == NULL) { freeargv (copy); @@ -119,8 +105,7 @@ itself. */ -void freeargv (vector) -char **vector; +void freeargv (char **vector) { register char **scan; @@ -174,8 +159,7 @@ returned, as appropriate. */ -char **buildargv (input) - const char *input; +char **buildargv (const char *input) { char *arg; char *copybuf; @@ -228,7 +212,7 @@ char **buildargv (input) arg = copybuf; while (*input != EOS) { - if (ISBLANK (*input) && !squote && !dquote && !bsquote) + if (ISSPACE (*input) && !squote && !dquote && !bsquote) { break; } @@ -294,7 +278,7 @@ char **buildargv (input) argc++; argv[argc] = NULL; - while (ISBLANK (*input)) + while (ISSPACE (*input)) { input++; } @@ -304,6 +288,126 @@ char **buildargv (input) return (argv); } +/* + +@deftypefn Extension void expandargv (int *@var{argcp}, char ***@var{argvp}) + +The @var{argcp} and @code{argvp} arguments are pointers to the usual +@code{argc} and @code{argv} arguments to @code{main}. This function +looks for arguments that begin with the character @samp{@@}. Any such +arguments are interpreted as ``response files''. The contents of the +response file are interpreted as additional command line options. In +particular, the file is separated into whitespace-separated strings; +each such string is taken as a command-line option. The new options +are inserted in place of the option naming the response file, and +@code{*argcp} and @code{*argvp} will be updated. If the value of +@code{*argvp} is modified by this function, then the new value has +been dynamically allocated and can be deallocated by the caller with +@code{freeargv}. However, most callers will simply call +@code{expandargv} near the beginning of @code{main} and allow the +operating system to free the memory when the program exits. + +@end deftypefn + +*/ + +void +expandargv (argcp, argvp) + int *argcp; + char ***argvp; +{ + /* The argument we are currently processing. */ + int i = 0; + /* Non-zero if ***argvp has been dynamically allocated. */ + int argv_dynamic = 0; + /* Loop over the arguments, handling response files. We always skip + ARGVP[0], as that is the name of the program being run. */ + while (++i < *argcp) + { + /* The name of the response file. */ + const char *filename; + /* The response file. */ + FILE *f; + /* An upper bound on the number of characters in the response + file. */ + long pos; + /* The number of characters in the response file, when actually + read. */ + size_t len; + /* A dynamically allocated buffer used to hold options read from a + response file. */ + char *buffer; + /* Dynamically allocated storage for the options read from the + response file. */ + char **file_argv; + /* The number of options read from the response file, if any. */ + size_t file_argc; + /* We are only interested in options of the form "@file". */ + filename = (*argvp)[i]; + if (filename[0] != '@') + continue; + /* Read the contents of the file. */ + f = fopen (++filename, "r"); + if (!f) + continue; + if (fseek (f, 0L, SEEK_END) == -1) + goto error; + pos = ftell (f); + if (pos == -1) + goto error; + if (fseek (f, 0L, SEEK_SET) == -1) + goto error; + buffer = (char *) xmalloc (pos * sizeof (char) + 1); + len = fread (buffer, sizeof (char), pos, f); + if (len != (size_t) pos + /* On Windows, fread may return a value smaller than POS, + due to CR/LF->CR translation when reading text files. + That does not in-and-of itself indicate failure. */ + && ferror (f)) + goto error; + /* Add a NUL terminator. */ + buffer[len] = '\0'; + /* Parse the string. */ + file_argv = buildargv (buffer); + /* If *ARGVP is not already dynamically allocated, copy it. */ + if (!argv_dynamic) + { + *argvp = dupargv (*argvp); + if (!*argvp) + { + fputs ("\nout of memory\n", stderr); + xexit (1); + } + } + /* Count the number of arguments. */ + file_argc = 0; + while (file_argv[file_argc] && *file_argv[file_argc]) + ++file_argc; + /* Now, insert FILE_ARGV into ARGV. The "+1" below handles the + NULL terminator at the end of ARGV. */ + *argvp = ((char **) + xrealloc (*argvp, + (*argcp + file_argc + 1) * sizeof (char *))); + memmove (*argvp + i + file_argc, *argvp + i + 1, + (*argcp - i) * sizeof (char *)); + memcpy (*argvp + i, file_argv, file_argc * sizeof (char *)); + /* The original option has been replaced by all the new + options. */ + *argcp += file_argc - 1; + /* Free up memory allocated to process the response file. We do + not use freeargv because the individual options in FILE_ARGV + are now in the main ARGV. */ + free (file_argv); + free (buffer); + /* Rescan all of the arguments just read to support response + files that include other response files. */ + --i; + error: + /* We're all done with the file now. */ + fclose (f); + } +} + #ifdef MAIN /* Simple little test driver. */ @@ -325,7 +429,8 @@ static const char *const tests[] = NULL }; -int main () +int +main (void) { char **argv; const char *const *test; diff --git a/gnu/lib/libiberty/src/basename.c b/gnu/lib/libiberty/src/basename.c index 69a982d7dca..0f2c069f0cc 100644 --- a/gnu/lib/libiberty/src/basename.c +++ b/gnu/lib/libiberty/src/basename.c @@ -12,6 +12,9 @@ Behavior is undefined if the pathname ends in a directory separator. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" #include "safe-ctype.h" @@ -37,8 +40,7 @@ Behavior is undefined if the pathname ends in a directory separator. #endif /* DIR_SEPARATOR_2 */ char * -basename (name) - const char *name; +basename (const char *name) { const char *base; diff --git a/gnu/lib/libiberty/src/calloc.c b/gnu/lib/libiberty/src/calloc.c index 50736823077..f4bd27b1cd2 100644 --- a/gnu/lib/libiberty/src/calloc.c +++ b/gnu/lib/libiberty/src/calloc.c @@ -13,19 +13,14 @@ Uses @code{malloc} to allocate storage for @var{nelem} objects of */ #include "ansidecl.h" -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif /* For systems with larger pointers than ints, this must be declared. */ -PTR malloc PARAMS ((size_t)); -void bzero PARAMS ((PTR, size_t)); +PTR malloc (size_t); +void bzero (PTR, size_t); PTR -calloc (nelem, elsize) - size_t nelem, elsize; +calloc (size_t nelem, size_t elsize) { register PTR ptr; diff --git a/gnu/lib/libiberty/src/choose-temp.c b/gnu/lib/libiberty/src/choose-temp.c index cb48d35897d..0cba9905d5b 100644 --- a/gnu/lib/libiberty/src/choose-temp.c +++ b/gnu/lib/libiberty/src/choose-temp.c @@ -14,8 +14,8 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -30,7 +30,7 @@ Boston, MA 02111-1307, USA. */ #endif #include "libiberty.h" -extern char *choose_tmpdir PARAMS ((void)); +extern char *choose_tmpdir (void); /* Name of temporary file. mktemp requires 6 trailing X's. */ @@ -53,16 +53,15 @@ not recommended. */ -#if defined(__MSDOS__) && !defined(__GO32__) char * -choose_temp_base () +choose_temp_base (void) { const char *base = choose_tmpdir (); char *temp_filename; int len; len = strlen (base); - temp_filename = xmalloc (len + TEMP_FILE_LEN + 1); + temp_filename = XNEWVEC (char, len + TEMP_FILE_LEN + 1); strcpy (temp_filename, base); strcpy (temp_filename + len, TEMP_FILE); @@ -71,4 +70,3 @@ choose_temp_base () abort (); return temp_filename; } -#endif diff --git a/gnu/lib/libiberty/src/config.in b/gnu/lib/libiberty/src/config.in index 1cc6d6132e5..436a58d7e79 100644 --- a/gnu/lib/libiberty/src/config.in +++ b/gnu/lib/libiberty/src/config.in @@ -1,326 +1,444 @@ -/* config.in. Generated automatically from configure.in by autoheader. */ +/* config.in. Generated from configure.ac by autoheader. */ -/* Define to empty if the keyword does not work. */ -#undef const +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +#undef CRAY_STACKSEG_END -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP +/* Define to 1 if you have the <alloca.h> header file. */ +#undef HAVE_ALLOCA_H -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H +/* Define to 1 if you have the `asprintf' function. */ +#undef HAVE_ASPRINTF -/* Define if you have <vfork.h>. */ -#undef HAVE_VFORK_H +/* Define to 1 if you have the `atexit' function. */ +#undef HAVE_ATEXIT -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline +/* Define to 1 if you have the `basename' function. */ +#undef HAVE_BASENAME -/* Define if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O +/* Define to 1 if you have the `bcmp' function. */ +#undef HAVE_BCMP -/* Define to `int' if <sys/types.h> doesn't define. */ -#undef pid_t +/* Define to 1 if you have the `bcopy' function. */ +#undef HAVE_BCOPY -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE +/* Define to 1 if you have the `bsearch' function. */ +#undef HAVE_BSEARCH -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS +/* Define to 1 if you have the `bzero' function. */ +#undef HAVE_BZERO -/* Define if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME +/* Define to 1 if you have the `calloc' function. */ +#undef HAVE_CALLOC -/* Define vfork as fork if vfork does not work. */ -#undef vfork +/* Define to 1 if you have the `canonicalize_file_name' function. */ +#undef HAVE_CANONICALIZE_FILE_NAME -/* Define to `unsigned long' if <sys/types.h> doesn't define. */ -#undef uintptr_t +/* Define to 1 if you have the `clock' function. */ +#undef HAVE_CLOCK -/* Define if you have the _doprnt function. */ -#undef HAVE__DOPRNT +/* Define to 1 if you have the declaration of `asprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_ASPRINTF -/* Define if you have the asprintf function. */ -#undef HAVE_ASPRINTF +/* Define to 1 if you have the declaration of `basename', and to 0 if you + don't. */ +#undef HAVE_DECL_BASENAME -/* Define if you have the atexit function. */ -#undef HAVE_ATEXIT +/* Define to 1 if you have the declaration of `calloc', and to 0 if you don't. + */ +#undef HAVE_DECL_CALLOC -/* Define if you have the basename function. */ -#undef HAVE_BASENAME +/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */ +#undef HAVE_DECL_FFS -/* Define if you have the bcmp function. */ -#undef HAVE_BCMP +/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. + */ +#undef HAVE_DECL_GETENV -/* Define if you have the bcopy function. */ -#undef HAVE_BCOPY +/* Define to 1 if you have the declaration of `getopt', and to 0 if you don't. + */ +#undef HAVE_DECL_GETOPT -/* Define if you have the bsearch function. */ -#undef HAVE_BSEARCH +/* Define to 1 if you have the declaration of `malloc', and to 0 if you don't. + */ +#undef HAVE_DECL_MALLOC -/* Define if you have the bzero function. */ -#undef HAVE_BZERO +/* Define to 1 if you have the declaration of `realloc', and to 0 if you + don't. */ +#undef HAVE_DECL_REALLOC -/* Define if you have the calloc function. */ -#undef HAVE_CALLOC +/* Define to 1 if you have the declaration of `sbrk', and to 0 if you don't. + */ +#undef HAVE_DECL_SBRK -/* Define if you have the canonicalize_file_name function. */ -#undef HAVE_CANONICALIZE_FILE_NAME +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_SNPRINTF -/* Define if you have the clock function. */ -#undef HAVE_CLOCK +/* Define to 1 if you have the declaration of `strverscmp', and to 0 if you + don't. */ +#undef HAVE_DECL_STRVERSCMP + +/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_VASPRINTF + +/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_VSNPRINTF -/* Define if you have the ffs function. */ +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `ffs' function. */ #undef HAVE_FFS -/* Define if you have the getcwd function. */ +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD -/* Define if you have the getpagesize function. */ +/* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE -/* Define if you have the getrusage function. */ +/* Define to 1 if you have the `getrusage' function. */ #undef HAVE_GETRUSAGE -/* Define if you have the getsysinfo function. */ +/* Define to 1 if you have the `getsysinfo' function. */ #undef HAVE_GETSYSINFO -/* Define if you have the gettimeofday function. */ +/* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY -/* Define if you have the index function. */ +/* Define to 1 if you have the `index' function. */ #undef HAVE_INDEX -/* Define if you have the insque function. */ +/* Define to 1 if you have the `insque' function. */ #undef HAVE_INSQUE -/* Define if you have the memchr function. */ +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <limits.h> header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the <machine/hal_sysinfo.h> header file. */ +#undef HAVE_MACHINE_HAL_SYSINFO_H + +/* Define to 1 if you have the <malloc.h> header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the `memchr' function. */ #undef HAVE_MEMCHR -/* Define if you have the memcmp function. */ +/* Define to 1 if you have the `memcmp' function. */ #undef HAVE_MEMCMP -/* Define if you have the memcpy function. */ +/* Define to 1 if you have the `memcpy' function. */ #undef HAVE_MEMCPY -/* Define if you have the memmove function. */ +/* Define to 1 if you have the `memmove' function. */ #undef HAVE_MEMMOVE -/* Define if you have the mempcpy function. */ +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mempcpy' function. */ #undef HAVE_MEMPCPY -/* Define if you have the memset function. */ +/* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET -/* Define if you have the mkstemps function. */ +/* Define to 1 if you have the `mkstemps' function. */ #undef HAVE_MKSTEMPS -/* Define if you have the on_exit function. */ +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `on_exit' function. */ #undef HAVE_ON_EXIT -/* Define if you have the psignal function. */ +/* Define to 1 if you have the `psignal' function. */ #undef HAVE_PSIGNAL -/* Define if you have the pstat_getdynamic function. */ +/* Define to 1 if you have the `pstat_getdynamic' function. */ #undef HAVE_PSTAT_GETDYNAMIC -/* Define if you have the pstat_getstatic function. */ +/* Define to 1 if you have the `pstat_getstatic' function. */ #undef HAVE_PSTAT_GETSTATIC -/* Define if you have the putenv function. */ +/* Define to 1 if you have the `putenv' function. */ #undef HAVE_PUTENV -/* Define if you have the random function. */ +/* Define to 1 if you have the `random' function. */ #undef HAVE_RANDOM -/* Define if you have the realpath function. */ +/* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH -/* Define if you have the rename function. */ +/* Define to 1 if you have the `rename' function. */ #undef HAVE_RENAME -/* Define if you have the rindex function. */ +/* Define to 1 if you have the `rindex' function. */ #undef HAVE_RINDEX -/* Define if you have the sbrk function. */ +/* Define to 1 if you have the `sbrk' function. */ #undef HAVE_SBRK -/* Define if you have the setenv function. */ +/* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV -/* Define if you have the sigsetmask function. */ +/* Define to 1 if you have the `sigsetmask' function. */ #undef HAVE_SIGSETMASK -/* Define if you have the snprintf function. */ +/* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF -/* Define if you have the stpcpy function. */ +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdio_ext.h> header file. */ +#undef HAVE_STDIO_EXT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `stpcpy' function. */ #undef HAVE_STPCPY -/* Define if you have the stpncpy function. */ +/* Define to 1 if you have the `stpncpy' function. */ #undef HAVE_STPNCPY -/* Define if you have the strcasecmp function. */ +/* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP -/* Define if you have the strchr function. */ +/* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR -/* Define if you have the strdup function. */ +/* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP -/* Define if you have the strerror function. */ +/* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR -/* Define if you have the strncasecmp function. */ +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP -/* Define if you have the strrchr function. */ +/* Define to 1 if you have the `strndup' function. */ +#undef HAVE_STRNDUP + +/* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR -/* Define if you have the strsignal function. */ +/* Define to 1 if you have the `strsignal' function. */ #undef HAVE_STRSIGNAL -/* Define if you have the strstr function. */ +/* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR -/* Define if you have the strtod function. */ +/* Define to 1 if you have the `strtod' function. */ #undef HAVE_STRTOD -/* Define if you have the strtol function. */ +/* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL -/* Define if you have the strtoul function. */ +/* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL -/* Define if you have the sysconf function. */ +/* Define to 1 if you have the `strverscmp' function. */ +#undef HAVE_STRVERSCMP + +/* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF -/* Define if you have the sysctl function. */ +/* Define to 1 if you have the `sysctl' function. */ #undef HAVE_SYSCTL -/* Define if you have the sysmp function. */ +/* Define to 1 if you have the `sysmp' function. */ #undef HAVE_SYSMP -/* Define if you have the table function. */ -#undef HAVE_TABLE +/* Define if you have the sys_errlist variable. */ +#undef HAVE_SYS_ERRLIST -/* Define if you have the times function. */ -#undef HAVE_TIMES +/* Define to 1 if you have the <sys/file.h> header file. */ +#undef HAVE_SYS_FILE_H -/* Define if you have the tmpnam function. */ -#undef HAVE_TMPNAM +/* Define to 1 if you have the <sys/mman.h> header file. */ +#undef HAVE_SYS_MMAN_H -/* Define if you have the vasprintf function. */ -#undef HAVE_VASPRINTF +/* Define if you have the sys_nerr variable. */ +#undef HAVE_SYS_NERR -/* Define if you have the vfprintf function. */ -#undef HAVE_VFPRINTF +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H -/* Define if you have the vprintf function. */ -#undef HAVE_VPRINTF +/* Define to 1 if you have the <sys/pstat.h> header file. */ +#undef HAVE_SYS_PSTAT_H -/* Define if you have the vsnprintf function. */ -#undef HAVE_VSNPRINTF +/* Define to 1 if you have the <sys/resource.h> header file. */ +#undef HAVE_SYS_RESOURCE_H -/* Define if you have the vsprintf function. */ -#undef HAVE_VSPRINTF +/* Define if you have the sys_siglist variable. */ +#undef HAVE_SYS_SIGLIST -/* Define if you have the waitpid function. */ -#undef HAVE_WAITPID +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H -/* Define if you have the <alloca.h> header file. */ -#undef HAVE_ALLOCA_H +/* Define to 1 if you have the <sys/sysctl.h> header file. */ +#undef HAVE_SYS_SYSCTL_H -/* Define if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H +/* Define to 1 if you have the <sys/sysinfo.h> header file. */ +#undef HAVE_SYS_SYSINFO_H -/* Define if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H +/* Define to 1 if you have the <sys/sysmp.h> header file. */ +#undef HAVE_SYS_SYSMP_H -/* Define if you have the <machine/hal_sysinfo.h> header file. */ -#undef HAVE_MACHINE_HAL_SYSINFO_H +/* Define to 1 if you have the <sys/systemcfg.h> header file. */ +#undef HAVE_SYS_SYSTEMCFG_H -/* Define if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H +/* Define to 1 if you have the <sys/table.h> header file. */ +#undef HAVE_SYS_TABLE_H -/* Define if you have the <string.h> header file. */ -#undef HAVE_STRING_H +/* Define to 1 if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H -/* Define if you have the <strings.h> header file. */ -#undef HAVE_STRINGS_H +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H -/* Define if you have the <sys/file.h> header file. */ -#undef HAVE_SYS_FILE_H +/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H -/* Define if you have the <sys/mman.h> header file. */ -#undef HAVE_SYS_MMAN_H +/* Define to 1 if you have the `table' function. */ +#undef HAVE_TABLE -/* Define if you have the <sys/param.h> header file. */ -#undef HAVE_SYS_PARAM_H +/* Define to 1 if you have the `times' function. */ +#undef HAVE_TIMES -/* Define if you have the <sys/pstat.h> header file. */ -#undef HAVE_SYS_PSTAT_H +/* Define to 1 if you have the <time.h> header file. */ +#undef HAVE_TIME_H -/* Define if you have the <sys/resource.h> header file. */ -#undef HAVE_SYS_RESOURCE_H +/* Define to 1 if you have the `tmpnam' function. */ +#undef HAVE_TMPNAM -/* Define if you have the <sys/stat.h> header file. */ -#undef HAVE_SYS_STAT_H +/* Define if you have the \`uintptr_t' type. */ +#undef HAVE_UINTPTR_T -/* Define if you have the <sys/sysctl.h> header file. */ -#undef HAVE_SYS_SYSCTL_H +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H -/* Define if you have the <sys/sysinfo.h> header file. */ -#undef HAVE_SYS_SYSINFO_H +/* Define to 1 if you have the `vasprintf' function. */ +#undef HAVE_VASPRINTF -/* Define if you have the <sys/sysmp.h> header file. */ -#undef HAVE_SYS_SYSMP_H +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK -/* Define if you have the <sys/systemcfg.h> header file. */ -#undef HAVE_SYS_SYSTEMCFG_H +/* Define to 1 if you have the <vfork.h> header file. */ +#undef HAVE_VFORK_H -/* Define if you have the <sys/table.h> header file. */ -#undef HAVE_SYS_TABLE_H +/* Define to 1 if you have the `vfprintf' function. */ +#undef HAVE_VFPRINTF -/* Define if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF -/* Define if you have the <time.h> header file. */ -#undef HAVE_TIME_H +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF -/* Define if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H +/* Define to 1 if you have the `vsprintf' function. */ +#undef HAVE_VSPRINTF -/* Define if errno must be declared even when <errno.h> is included. */ -#undef NEED_DECLARATION_ERRNO +/* Define to 1 if you have the `wait3' function. */ +#undef HAVE_WAIT3 -/* Define if you have the `uintptr_t' type. */ -#undef HAVE_UINTPTR_T +/* Define to 1 if you have the `wait4' function. */ +#undef HAVE_WAIT4 -/* Define if you have the sys_errlist variable. */ -#undef HAVE_SYS_ERRLIST +/* Define to 1 if you have the `waitpid' function. */ +#undef HAVE_WAITPID -/* Define if you have the sys_nerr variable. */ -#undef HAVE_SYS_NERR +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK -/* Define if you have the sys_siglist variable. */ -#undef HAVE_SYS_SIGLIST +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if you have the `_doprnt' function. */ +#undef HAVE__DOPRNT /* Define if you have the _system_configuration variable. */ #undef HAVE__SYSTEM_CONFIGURATION -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP - systems. This function is required for alloca.c support on those - systems. */ -#undef CRAY_STACKSEG_END - -/* Define if you know the direction of stack growth for your system; - otherwise it will be automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION +/* Define to 1 if you have the `__fsetlocking' function. */ +#undef HAVE___FSETLOCKING /* Define if canonicalize_file_name is not declared in system header files. */ #undef NEED_DECLARATION_CANONICALIZE_FILE_NAME +/* Define if errno must be declared even when <errno.h> is included. */ +#undef NEED_DECLARATION_ERRNO + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* Define if you know the direction of stack growth for your system; otherwise + it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows + toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Define to an unsigned 64-bit type available in the compiler. */ +#undef UNSIGNED_64BIT_TYPE + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `int' if <sys/types.h> does not define. */ +#undef pid_t + +/* Define to `unsigned long' if <sys/types.h> does not define. */ +#undef uintptr_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork diff --git a/gnu/lib/libiberty/src/config.table b/gnu/lib/libiberty/src/config.table deleted file mode 100644 index df48ce99525..00000000000 --- a/gnu/lib/libiberty/src/config.table +++ /dev/null @@ -1,68 +0,0 @@ -# Don't build the shared library for build. -if [ -n "${with_build_subdir}" ]; then - enable_shared=no -fi - -frag= -case "${host}" in - rs6000-ibm-aix3.1 | rs6000-ibm-aix) - frag=mh-aix ;; - *-*-cxux7*) frag=mh-cxux7 ;; - *-*-freebsd2.1.*) frag=mh-fbsd21 ;; - *-*-freebsd2.2.[012]) frag=mh-fbsd21 ;; - i370-*-opened*) frag=mh-openedition ;; - i[345]86-*-windows*) frag=mh-windows ;; -esac - -if [ -n "${frag}" ]; then - frags=${libiberty_topdir}/libiberty/config/$frag -else - frags= -fi - -# If they didn't specify --enable-shared, don't generate shared libs. -case "${enable_shared}" in - yes) shared=yes ;; - no) shared=no ;; - "") shared=no ;; - *) shared=yes ;; -esac -if [ "${shared}" = "yes" ]; then - frag= - case "${host}" in - *-*-cygwin*) ;; - alpha*-*-linux*) frag=mh-elfalphapic ;; - arm*-*-*) frag=mh-armpic ;; - hppa*-*-*) frag=mh-papic ;; - i[3456]86-*-* | x86_64-*-*) - frag=mh-x86pic ;; - powerpc*-*-aix*) ;; - powerpc*-*-*) frag=mh-ppcpic ;; - sparc*-*-*) frag=mh-sparcpic ;; - s390*-*-*) frag=mh-s390pic ;; - *) frag=mh-${host_cpu}pic ;; - esac - if [ -n "${frag}" ]; then - frags="${frags} ${libiberty_topdir}/config/${frag}" - fi -fi - -echo "# Warning: this fragment is automatically generated" > temp-frag - -for frag in ${frags}; do - if [ -f ${frag} ]; then - echo "Appending ${frag} to xhost-mkfrag" - echo "# Following fragment copied from ${frag}" >> temp-frag - cat ${frag} >> temp-frag - fi -done - -# record if we want to build shared libs. -if [ "${shared}" = "yes" ]; then - echo enable_shared = yes >> temp-frag -else - echo enable_shared = no >> temp-frag -fi - -frag=xhost-mkfrag -${CONFIG_SHELL-/bin/sh} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag diff --git a/gnu/lib/libiberty/src/configure b/gnu/lib/libiberty/src/configure index f1ba0c85832..ed7423a006e 100644 --- a/gnu/lib/libiberty/src/configure +++ b/gnu/lib/libiberty/src/configure @@ -1,40 +1,325 @@ #! /bin/sh - # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# Generated by GNU Autoconf 2.59. # +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH -# Defaults: -ac_help= + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --with-target-subdir=SUBDIR Configuring in a subdirectory for target" -ac_help="$ac_help - --with-build-subdir=SUBDIR Configuring in a subdirectory for build" -ac_help="$ac_help - --with-cross-host=HOST Configuring with a cross compiler" -ac_help="$ac_help - --with-newlib Configuring with newlib" -ac_help="$ac_help - --enable-maintainer-mode - enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer" -ac_help="$ac_help - --enable-install-libiberty Install headers for end users" +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="xmalloc.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libiberty_topdir MAINT NOTMAINT MAKEINFO BUILD_INFO PERL HAVE_PERL build build_cpu build_vendor build_os host host_cpu host_vendor host_os AR ac_ct_AR RANLIB ac_ct_RANLIB CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP ac_libiberty_warn_cflags NO_MINUS_C_MINUS_O OUTPUT_OPTION INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA EGREP LIBOBJS CHECK target_header_dir pexecute INSTALL_DEST datarootdir docdir htmldir LTLIBOBJS' +ac_subst_files='host_makefile_frag' # Initialize some variables set by options. +ac_init_help= +ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -43,10 +328,15 @@ program_transform_name=s,x,x, silent= site= srcdir= -target=NONE verbose= x_includes=NONE x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' @@ -60,17 +350,9 @@ oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - ac_prev= for ac_option do - # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" @@ -78,59 +360,59 @@ do continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) - datadir="$ac_optarg" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "enable_${ac_feature}='$ac_optarg'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -139,95 +421,47 @@ do -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; -host | --host | --hos | --ho) - ac_prev=host ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -236,19 +470,19 @@ EOF -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) + | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -262,26 +496,26 @@ EOF -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; + program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; + program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -298,7 +532,7 @@ EOF | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -308,7 +542,7 @@ EOF ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -319,58 +553,57 @@ EOF | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -381,99 +614,110 @@ EOF ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; + x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac done -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=xmalloc.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. @@ -483,13 +727,474 @@ else fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode + enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-install-libiberty Install headers for end users + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-target-subdir=SUBDIR Configuring in a subdirectory for target + --with-build-subdir=SUBDIR Configuring in a subdirectory for build + --with-cross-host=HOST Configuring with a cross compiler + --with-newlib Configuring with newlib + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then @@ -500,39 +1205,104 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi else - echo "creating cache $cache_file" - > $cache_file + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + @@ -542,30 +1312,30 @@ fi # exported. We don't use libtool yet, but some day we might, so... ORIGINAL_LD_FOR_MULTILIBS=$LD + # Check whether --with-target-subdir or --without-target-subdir was given. if test "${with_target_subdir+set}" = set; then withval="$with_target_subdir" - : -fi + +fi; # Check whether --with-build-subdir or --without-build-subdir was given. if test "${with_build_subdir+set}" = set; then withval="$with_build_subdir" - : -fi + +fi; # Check whether --with-cross-host or --without-cross-host was given. if test "${with_cross_host+set}" = set; then withval="$with_cross_host" - : -fi + +fi; # Check whether --with-newlib or --without-newlib was given. if test "${with_newlib+set}" = set; then withval="$with_newlib" - : -fi +fi; if test "${srcdir}" = "."; then if test -n "${with_build_subdir}"; then @@ -594,29 +1364,35 @@ for ac_dir in $libiberty_topdir $srcdir/$libiberty_topdir; do ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break fi done if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" 1>&2; exit 1; } + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $libiberty_topdir $srcdir/$libiberty_topdir" >&2;} + { (exit 1); exit 1; }; } fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. -echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:610: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" maintainer_mode=$enableval else maintainer_mode=no -fi - +fi; -echo "$ac_t""$maintainer_mode" 1>&6 +echo "$as_me:$LINENO: result: $maintainer_mode" >&5 +echo "${ECHO_T}$maintainer_mode" >&6 if test "$maintainer_mode" = "yes"; then MAINT='' @@ -630,31 +1406,37 @@ fi # rely on it - libiberty is built before texinfo. # Extract the first word of "makeinfo", so it can be a program name with args. set dummy makeinfo; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:635: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_MAKEINFO+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MAKEINFO"; then ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_MAKEINFO="makeinfo" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MAKEINFO="makeinfo" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -MAKEINFO="$ac_cv_prog_MAKEINFO" +MAKEINFO=$ac_cv_prog_MAKEINFO if test -n "$MAKEINFO"; then - echo "$ac_t""$MAKEINFO" 1>&6 + echo "$as_me:$LINENO: result: $MAKEINFO" >&5 +echo "${ECHO_T}$MAKEINFO" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi if test "x$MAKEINFO" = "x"; then @@ -662,12 +1444,25 @@ if test "x$MAKEINFO" = "x"; then BUILD_INFO= else BUILD_INFO=info - case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in - x*\ [1-3].* ) - MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true" + case "$MAKEINFO" in + */missing\ makeinfo*) BUILD_INFO= - echo "configure: warning: -*** Makeinfo is too old. Info documentation will not be built." 1>&2 + { echo "$as_me:$LINENO: WARNING: +*** Makeinfo is missing. Info documentation will not be built." >&5 +echo "$as_me: WARNING: +*** Makeinfo is missing. Info documentation will not be built." >&2;} + ;; + *) + case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in + x*\ [1-3].* ) + MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true" + BUILD_INFO= + { echo "$as_me:$LINENO: WARNING: +*** Makeinfo is too old. Info documentation will not be built." >&5 +echo "$as_me: WARNING: +*** Makeinfo is too old. Info documentation will not be built." >&2;} + ;; + esac ;; esac fi @@ -676,31 +1471,37 @@ fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:681: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_PERL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PERL"; then ac_cv_prog_PERL="$PERL" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_PERL="perl" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PERL="perl" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -PERL="$ac_cv_prog_PERL" +PERL=$ac_cv_prog_PERL if test -n "$PERL"; then - echo "$ac_t""$PERL" 1>&6 + echo "$as_me:$LINENO: result: $PERL" >&5 +echo "${ECHO_T}$PERL" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi if test x"$PERL" = x""; then @@ -710,330 +1511,1554 @@ else fi - # Make sure we can run config.sub. -if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : -else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } -fi +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:721: checking host system type" >&5 - -host_alias=$host -case "$host_alias" in -NONE) - case $nonopt in - NONE) - if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) host_alias=$nonopt ;; - esac ;; -esac +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } -host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` -host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$host" 1>&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } -echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:744: checking build system type" >&5 +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -build_alias=$build -case "$build_alias" in -NONE) - case $nonopt in - NONE) build_alias=$host_alias ;; - *) build_alias=$nonopt ;; - esac ;; -esac -build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` -build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$ac_t""$build" 1>&6 -if test $host != $build; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi -# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:770: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -AR="$ac_cv_prog_AR" +AR=$ac_cv_prog_AR if test -n "$AR"; then - echo "$ac_t""$AR" 1>&6 + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi -# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:802: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -RANLIB="$ac_cv_prog_RANLIB" +RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - +fi if test -z "$ac_cv_prog_RANLIB"; then -if test -n "$ac_tool_prefix"; then + ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:834: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + RANLIB=$ac_ct_RANLIB else - RANLIB=":" -fi + RANLIB="$ac_cv_prog_RANLIB" fi -# Extract the first word of "gcc", so it can be a program name with args. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:871: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:901: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift - if test $# -gt 0; then + if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:950: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 else - ac_cv_prog_gcc=no + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# FIXME: Cleanup? +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + gcc_no_link=no +else + gcc_no_link=yes +fi + +if test x$gcc_no_link = xyes; then + # Setting cross_compile will disable run tests; it will + # also disable AC_CHECK_FILE but that's generally + # correct if we can't link. + cross_compiling=yes + EXEEXT= +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 -if test $ac_cv_prog_gcc = yes; then - GCC=yes - ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic' - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:975: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +fi +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done else - ac_cv_prog_cc_g=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest* +rm -f conftest.$ac_cv_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then CFLAGS="-g -O2" else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include <stdlib.h> +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= fi else - GCC= - ac_libiberty_warn_cflags= - test "${CFLAGS+set}" = set || CFLAGS="-g" + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_c_preproc_warn_flag=yes + +# Warn C++ incompatibilities if supported. + +echo "$as_me:$LINENO: checking whether ${CC} accepts -Wc++-compat" >&5 +echo $ECHO_N "checking whether ${CC} accepts -Wc++-compat... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_w_cxx_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + save_CFLAGS="$CFLAGS" + CFLAGS="-Wc++-compat" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_w_cxx_compat=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_w_cxx_compat=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_w_cxx_compat" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_w_cxx_compat" >&6 + + +if test x$GCC = xyes; then + ac_libiberty_warn_cflags='-W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes' +fi +if test $ac_cv_prog_cc_w_cxx_compat = yes ; then + ac_libiberty_warn_cflags="${ac_libiberty_warn_cflags} -Wc++-compat" +fi if test "x$CC" != xcc; then - echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6 -echo "configure:1007: checking whether $CC and cc understand -c and -o together" >&5 + echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 +echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6 else - echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6 -echo "configure:1010: checking whether cc understands -c and -o together" >&5 + echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5 +echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6 fi -set dummy $CC; ac_cc="`echo $2 | - sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" -if eval "test \"`echo '$''{'ac_cv_prog_cc_${ac_cc}_c_o'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +set dummy $CC; ac_cc=`echo $2 | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo 'foo(){}' > conftest.c + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF # Make sure it works both with $CC and with simple cc. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. -ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5' -if { (eval echo configure:1022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && - test -f conftest.o && { (eval echo configure:1023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; +ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&5' +if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. - if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:1028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then - ac_try='cc -c conftest.c -o conftest.o 1>&5' - if { (eval echo configure:1030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } && - test -f conftest.o && { (eval echo configure:1031: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; + if { ac_try='cc -c conftest.$ac_ext >&5' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&5' + if { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest.$ac_objext && { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then - # cc works too. - : + # cc works too. + : else - # cc exists but doesn't like -o. - eval ac_cv_prog_cc_${ac_cc}_c_o=no + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi @@ -1044,12 +3069,15 @@ rm -f conftest* fi if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else - echo "$ac_t""no" 1>&6 - cat >> confdefs.h <<\EOF + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +cat >>confdefs.h <<\_ACEOF #define NO_MINUS_C_MINUS_O 1 -EOF +_ACEOF fi @@ -1062,145 +3090,418 @@ fi -echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1067: checking for POSIXized ISC" >&5 -if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 -then - echo "$ac_t""yes" 1>&6 - ISC=yes # If later tests want to check for ISC. - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - if test "$GCC" = yes; then - CC="$CC -posix" - else - CC="$CC -Xp" - fi +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$ac_t""no" 1>&6 - ISC= -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1088: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1093 "configure" -#include "confdefs.h" +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif -int main() { - -/* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; -/* SunOS 4.1.1 cc rejects this. */ -char const *const *ccp; -char **p; -/* NEC SVR4.0.2 mips cc rejects this. */ -struct point {int x, y;}; -static struct point const zero = {0,0}; -/* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in an arm - of an if-expression whose if-part is not a constant expression */ -const char *g = "string"; -ccp = &g + (g ? g-g : 0); -/* HPUX 7.0 cc rejects these. */ -++ccp; -p = (char**) ccp; -ccp = (char const *const *) p; -{ /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; -} -{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; -} -{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; -} -{ /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:1142: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_const=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF fi -echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:1163: checking for inline" >&5 -if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat > conftest.$ac_ext <<EOF -#line 1170 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif -int main() { -} $ac_kw foo() { -; return 0; } -EOF -if { (eval echo configure:1177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done fi +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 -echo "$ac_t""$ac_cv_c_inline" 1>&6 -case "$ac_cv_c_inline" in + +case $ac_cv_c_inline in inline | yes) ;; - no) cat >> confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >> confdefs.h <<EOF -#define inline $ac_cv_c_inline -EOF + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; esac + ac_config_headers="$ac_config_headers config.h:config.in" @@ -1211,343 +3512,517 @@ esac # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1220: checking for a BSD compatible install" >&5 +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done - ;; - esac - done - IFS="$ac_save_IFS" + done + ;; +esac +done + fi if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" + INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. - INSTALL="$ac_install_sh" + INSTALL=$ac_install_sh fi fi -echo "$ac_t""$INSTALL" 1>&6 +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -. ${srcdir}/config.table +# Don't build the shared library for build. +if [ -n "${with_build_subdir}" ]; then + enable_shared=no +fi + +frag= +case "${host}" in + rs6000-ibm-aix3.1 | rs6000-ibm-aix) + frag=mh-aix ;; + *-*-cxux7*) frag=mh-cxux7 ;; + *-*-freebsd2.1.*) frag=mh-fbsd21 ;; + *-*-freebsd2.2.[012]) frag=mh-fbsd21 ;; + i370-*-opened*) frag=mh-openedition ;; + i[34567]86-*-windows*) frag=mh-windows ;; +esac + +if [ -n "${frag}" ]; then + frags=${libiberty_topdir}/libiberty/config/$frag +else + frags= +fi + +# If they didn't specify --enable-shared, don't generate shared libs. +case "${enable_shared}" in + yes) shared=yes ;; + no) shared=no ;; + "") shared=no ;; + *) shared=yes ;; +esac +if [ "${shared}" = "yes" ]; then + frag= + case "${host}" in + *-*-cygwin*) ;; + alpha*-*-linux*) frag=mh-elfalphapic ;; + arm*-*-*) frag=mh-armpic ;; + hppa*-*-*) frag=mh-papic ;; + i[34567]86-*-* | x86_64-*-*) + frag=mh-x86pic ;; + powerpc*-*-aix*) ;; + powerpc*-*-*) frag=mh-ppcpic ;; + sparc*-*-*) frag=mh-sparcpic ;; + s390*-*-*) frag=mh-s390pic ;; + *) frag=mh-${host_cpu}pic ;; + esac + if [ -n "${frag}" ]; then + frags="${frags} ${libiberty_topdir}/config/${frag}" + fi +fi + +echo "# Warning: this fragment is automatically generated" > temp-frag + +for frag in ${frags}; do + if [ -f ${frag} ]; then + echo "Appending ${frag} to xhost-mkfrag" + echo "# Following fragment copied from ${frag}" >> temp-frag + cat ${frag} >> temp-frag + fi +done + +# record if we want to build shared libs. +if [ "${shared}" = "yes" ]; then + echo enable_shared = yes >> temp-frag +else + echo enable_shared = no >> temp-frag +fi + +frag=xhost-mkfrag +${CONFIG_SHELL-/bin/sh} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag + host_makefile_frag=${frag} # It's OK to check for header files. Although the compiler may not be # able to link anything, it had better be able to at least compile # something. -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1281: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 1296 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 1313 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1319: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 1330 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1336: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : + + + + + + + + + + + + + + + + + + + + + + + + + +for ac_header in sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h stdint.h stdio_ext.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" + ac_cpp_err=yes fi - CPP="$ac_cv_prog_CPP" +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -for ac_hdr in sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1364: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1369 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1374: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + eval "$as_ac_Header=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi done -echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1401: checking for sys/wait.h that is POSIX.1 compatible" >&5 -if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1406 "configure" -#include "confdefs.h" +echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <sys/types.h> #include <sys/wait.h> #ifndef WEXITSTATUS -#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED -#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif -int main() { -int s; -wait (&s); -s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; -; return 0; } -EOF -if { (eval echo configure:1422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +int +main () +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_sys_wait_h=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_sys_wait_h=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_sys_wait_h=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 if test $ac_cv_header_sys_wait_h = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 -EOF +_ACEOF fi -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1443: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1448 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <sys/types.h> #include <sys/time.h> #include <time.h> -int main() { -struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:1457: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_time=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_time=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_time=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_header_time" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 -EOF +_ACEOF fi -echo $ac_n "checking whether errno must be declared""... $ac_c" 1>&6 -echo "configure:1479: checking whether errno must be declared" >&5 -if eval "test \"`echo '$''{'libiberty_cv_declare_errno'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking whether errno must be declared" >&5 +echo $ECHO_N "checking whether errno must be declared... $ECHO_C" >&6 +if test "${libiberty_cv_declare_errno+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1484 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <errno.h> -int main() { +int +main () +{ int x = errno; -; return 0; } -EOF -if { (eval echo configure:1491: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then libiberty_cv_declare_errno=no else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - libiberty_cv_declare_errno=yes + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +libiberty_cv_declare_errno=yes fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$libiberty_cv_declare_errno" 1>&6 +echo "$as_me:$LINENO: result: $libiberty_cv_declare_errno" >&5 +echo "${ECHO_T}$libiberty_cv_declare_errno" >&6 if test $libiberty_cv_declare_errno = yes -then cat >> confdefs.h <<\EOF +then +cat >>confdefs.h <<\_ACEOF #define NEED_DECLARATION_ERRNO 1 -EOF +_ACEOF fi -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1513: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# Determine the size of an int for struct fibnode. +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1518 "configure" -#include "confdefs.h" + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_header_stdc=yes else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 1543 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <string.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1556,16 +4031,19 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 1561 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <stdlib.h> -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1574,115 +4052,855 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <<EOF -#line 1582 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include <ctype.h> -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif -EOF -if { (eval echo configure:1593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no fi -rm -fr conftest* +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF fi -echo $ac_n "checking for uintptr_t""... $ac_c" 1>&6 -echo "configure:1617: checking for uintptr_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_uintptr_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi else - cat > conftest.$ac_ext <<EOF -#line 1622 "configure" -#include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +echo "$as_me:$LINENO: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6 +if test "${ac_cv_type_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((int *) 0) + return 0; +if (sizeof (int)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_int=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6 + +echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_int" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_int=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (int)); } +unsigned long ulongval () { return (long) (sizeof (int)); } +#include <stdio.h> #include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])uintptr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (int))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_int=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_int=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + + +echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 +if test "${ac_cv_type_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((uintptr_t *) 0) + return 0; +if (sizeof (uintptr_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_uintptr_t=yes else - rm -rf conftest* - ac_cv_type_uintptr_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_uintptr_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$ac_cv_type_uintptr_t" 1>&6 -if test $ac_cv_type_uintptr_t = no; then - cat >> confdefs.h <<\EOF +echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 +if test $ac_cv_type_uintptr_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF #define uintptr_t unsigned long -EOF +_ACEOF + +fi + + +# Look for a 64-bit type. +echo "$as_me:$LINENO: checking for a 64-bit type" >&5 +echo $ECHO_N "checking for a 64-bit type... $ECHO_C" >&6 +if test "${liberty_cv_uint64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif +int +main () +{ +extern uint64_t foo; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + liberty_cv_uint64=uint64_t +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif +int +main () +{ +extern char foo[sizeof(long) * CHAR_BIT >= 64 ? 1 : -1]; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + liberty_cv_uint64="unsigned long" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif +int +main () +{ +extern char foo[sizeof(long long) * CHAR_BIT >= 64 ? 1 : -1]; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + liberty_cv_uint64="unsigned long long" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +liberty_cv_uint64=none +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +echo "$as_me:$LINENO: result: $liberty_cv_uint64" >&5 +echo "${ECHO_T}$liberty_cv_uint64" >&6 +if test "$liberty_cv_uint64" != none; then + +cat >>confdefs.h <<_ACEOF +#define UNSIGNED_64BIT_TYPE $liberty_cv_uint64 +_ACEOF fi # Given the above check, we always have uintptr_t or a fallback # definition. So define HAVE_UINTPTR_T in case any imported code # relies on it. -cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_UINTPTR_T 1 -EOF +_ACEOF -echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1658: checking for pid_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 1663 "configure" -#include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else - rm -rf conftest* - ac_cv_type_pid_t=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_type_pid_t=no fi -echo "$ac_t""$ac_cv_type_pid_t" 1>&6 -if test $ac_cv_type_pid_t = no; then - cat >> confdefs.h <<\EOF +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF #define pid_t int -EOF +_ACEOF fi @@ -1702,6 +4920,7 @@ funcs="$funcs clock" funcs="$funcs ffs" funcs="$funcs getcwd" funcs="$funcs getpagesize" +funcs="$funcs gettimeofday" funcs="$funcs index" funcs="$funcs insque" funcs="$funcs memchr" @@ -1724,11 +4943,13 @@ funcs="$funcs strcasecmp" funcs="$funcs strchr" funcs="$funcs strdup" funcs="$funcs strncasecmp" +funcs="$funcs strndup" funcs="$funcs strrchr" funcs="$funcs strstr" funcs="$funcs strtod" funcs="$funcs strtol" funcs="$funcs strtoul" +funcs="$funcs strverscmp" funcs="$funcs tmpnam" funcs="$funcs vasprintf" funcs="$funcs vfprintf" @@ -1739,525 +4960,628 @@ funcs="$funcs waitpid" # Also in the old function.def file: alloca, vfork, getopt. -vars="sys_errlist sys_nerr sys_siglist _system_configuration" +vars="sys_errlist sys_nerr sys_siglist" checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp" -checkfuncs="$checkfuncs getsysinfo table sysctl" +checkfuncs="$checkfuncs getsysinfo table sysctl wait3 wait4 __fsetlocking" # These are neither executed nor required, but they help keep # autoheader happy without adding a bunch of text to acconfig.h. if test "x" = "y"; then - for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1755: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1760 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); -int main() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif -; return 0; } -EOF -if { (eval echo configure:1783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - for ac_func in getcwd getpagesize index insque mkstemps memchr memcmp memcpy -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1810: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1815 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); -int main() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif -; return 0; } -EOF -if { (eval echo configure:1838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - for ac_func in memmove mempcpy memset putenv random rename rindex sigsetmask -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1865: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1870 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); -int main() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif -; return 0; } -EOF -if { (eval echo configure:1893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - for ac_func in strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1920: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1925 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); -int main() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif -; return 0; } -EOF -if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - for ac_func in strtod strtol strtoul tmpnam vasprintf vfprintf vprintf -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1975: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1980 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); -int main() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif -; return 0; } -EOF -if { (eval echo configure:2003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - for ac_func in vsprintf waitpid getrusage on_exit psignal strerror strsignal -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2030: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2035 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); -int main() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif -; return 0; } -EOF -if { (eval echo configure:2058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - for ac_func in sysconf times sbrk gettimeofday ffs snprintf vsnprintf -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2085: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2090 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); -int main() { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif -; return 0; } -EOF -if { (eval echo configure:2113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +for ac_func in asprintf atexit basename bcmp bcopy bsearch bzero calloc clock \ + getcwd getpagesize gettimeofday index insque mkstemps memchr memcmp memcpy \ + memmove mempcpy memset putenv random rename rindex sigsetmask \ + strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strndup strrchr strstr \ + strtod strtol strtoul strverscmp tmpnam vasprintf vfprintf vprintf \ + vsprintf waitpid getrusage on_exit psignal strerror strsignal \ + sysconf times sbrk gettimeofday ffs snprintf vsnprintf \ + pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl wait3 wait4 \ + realpath canonicalize_file_name __fsetlocking do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2140: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2145 "configure" -#include "confdefs.h" +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. Under hpux, + including <limits.h> includes <sys/time.h> and causes problems + checking for functions defined therein. */ +#if defined (__STDC__) && !defined (_HPUX_SOURCE) +# include <limits.h> +#else +# include <assert.h> +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done - for ac_func in realpath canonicalize_file_name -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2195: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2200 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); + echo "$as_me:$LINENO: checking whether basename is declared" >&5 +echo $ECHO_N "checking whether basename is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_basename+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef basename + char *p = (char *) basename; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_basename=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_basename=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_basename" >&5 +echo "${ECHO_T}$ac_cv_have_decl_basename" >&6 +if test $ac_cv_have_decl_basename = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether ffs is declared" >&5 +echo $ECHO_N "checking whether ffs is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_ffs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef ffs + char *p = (char *) ffs; +#endif -int main() { + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_ffs=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_ffs=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_ffs" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ffs" >&6 +if test $ac_cv_have_decl_ffs = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether asprintf is declared" >&5 +echo $ECHO_N "checking whether asprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_asprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef asprintf + char *p = (char *) asprintf; +#endif -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_asprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_asprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_asprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_asprintf" >&6 +if test $ac_cv_have_decl_asprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ASPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ASPRINTF 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether vasprintf is declared" >&5 +echo $ECHO_N "checking whether vasprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_vasprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef vasprintf + char *p = (char *) vasprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_vasprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_vasprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_vasprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_vasprintf" >&6 +if test $ac_cv_have_decl_vasprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VASPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VASPRINTF 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether snprintf is declared" >&5 +echo $ECHO_N "checking whether snprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_snprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef snprintf + char *p = (char *) snprintf; #endif -; return 0; } -EOF -if { (eval echo configure:2223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_snprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_snprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_snprintf" >&6 +if test $ac_cv_have_decl_snprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5 +echo $ECHO_N "checking whether vsnprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_vsnprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef vsnprintf + char *p = (char *) vsnprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_vsnprintf=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_vsnprintf=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_vsnprintf" >&6 +if test $ac_cv_have_decl_vsnprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 1 +_ACEOF + -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - else - echo "$ac_t""no" 1>&6 + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 0 +_ACEOF + + fi -done - cat >> confdefs.h <<\EOF + + +cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_ERRLIST 1 -EOF +_ACEOF - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_NERR 1 -EOF +_ACEOF - cat >> confdefs.h <<\EOF -#define HAVE_SYS_SIGLIST 1 -EOF - cat >> confdefs.h <<\EOF -#define HAVE__SYSTEM_CONFIGURATION 1 -EOF +cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_SIGLIST 1 +_ACEOF fi @@ -2279,7 +5603,54 @@ if test -n "${with_target_subdir}"; then # newlib provide and which ones we will be expected to provide. if test "x${with_newlib}" = "xyes"; then - LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o" + case $LIBOBJS in + "asprintf.$ac_objext" | \ + *" asprintf.$ac_objext" | \ + "asprintf.$ac_objext "* | \ + *" asprintf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS asprintf.$ac_objext" ;; +esac + + case $LIBOBJS in + "basename.$ac_objext" | \ + *" basename.$ac_objext" | \ + "basename.$ac_objext "* | \ + *" basename.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS basename.$ac_objext" ;; +esac + + case $LIBOBJS in + "insque.$ac_objext" | \ + *" insque.$ac_objext" | \ + "insque.$ac_objext "* | \ + *" insque.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS insque.$ac_objext" ;; +esac + + case $LIBOBJS in + "random.$ac_objext" | \ + *" random.$ac_objext" | \ + "random.$ac_objext "* | \ + *" random.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS random.$ac_objext" ;; +esac + + case $LIBOBJS in + "strdup.$ac_objext" | \ + *" strdup.$ac_objext" | \ + "strdup.$ac_objext "* | \ + *" strdup.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strdup.$ac_objext" ;; +esac + + case $LIBOBJS in + "vasprintf.$ac_objext" | \ + *" vasprintf.$ac_objext" | \ + "vasprintf.$ac_objext "* | \ + *" vasprintf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS vasprintf.$ac_objext" ;; +esac + for f in $funcs; do case "$f" in @@ -2287,9 +5658,9 @@ if test -n "${with_target_subdir}"; then ;; *) n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF + cat >>confdefs.h <<_ACEOF #define $n 1 -EOF +_ACEOF ;; esac @@ -2299,9 +5670,9 @@ EOF # dont have to check them here. # Of the functions in $checkfuncs, newlib only has strerror. - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\_ACEOF #define HAVE_STRERROR 1 -EOF +_ACEOF setobjs=yes @@ -2315,17 +5686,16 @@ if test "${enable_install_libiberty+set}" = set; then enable_install_libiberty=$enableval else enable_install_libiberty=no -fi - +fi; # Option parsed, now set things appropriately. case x"$enable_install_libiberty" in xyes|x) target_header_dir=libiberty ;; - xno) + xno) target_header_dir= ;; - *) + *) # This could be sanity-checked in various ways... target_header_dir="${enable_install_libiberty}" ;; @@ -2335,7 +5705,7 @@ fi else # Not a target library, so we set things up to run the test suite. - CHECK=check-cplus-dem + CHECK=really-check fi @@ -2344,13 +5714,13 @@ fi case "${host}" in *-*-cygwin* | *-*-mingw*) - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_ERRLIST 1 -EOF +_ACEOF - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_NERR 1 -EOF +_ACEOF ;; esac @@ -2362,8 +5732,86 @@ if test -z "${setobjs}"; then # Handle VxWorks configuration specially, since on VxWorks the # libraries are actually on the target board, not in the file # system. - LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o" - LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o" + case $LIBOBJS in + "basename.$ac_objext" | \ + *" basename.$ac_objext" | \ + "basename.$ac_objext "* | \ + *" basename.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS basename.$ac_objext" ;; +esac + + case $LIBOBJS in + "getpagesize.$ac_objext" | \ + *" getpagesize.$ac_objext" | \ + "getpagesize.$ac_objext "* | \ + *" getpagesize.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS getpagesize.$ac_objext" ;; +esac + + case $LIBOBJS in + "insque.$ac_objext" | \ + *" insque.$ac_objext" | \ + "insque.$ac_objext "* | \ + *" insque.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS insque.$ac_objext" ;; +esac + + case $LIBOBJS in + "random.$ac_objext" | \ + *" random.$ac_objext" | \ + "random.$ac_objext "* | \ + *" random.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS random.$ac_objext" ;; +esac + + case $LIBOBJS in + "strcasecmp.$ac_objext" | \ + *" strcasecmp.$ac_objext" | \ + "strcasecmp.$ac_objext "* | \ + *" strcasecmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strcasecmp.$ac_objext" ;; +esac + + case $LIBOBJS in + "strncasecmp.$ac_objext" | \ + *" strncasecmp.$ac_objext" | \ + "strncasecmp.$ac_objext "* | \ + *" strncasecmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strncasecmp.$ac_objext" ;; +esac + + case $LIBOBJS in + "strdup.$ac_objext" | \ + *" strdup.$ac_objext" | \ + "strdup.$ac_objext "* | \ + *" strdup.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strdup.$ac_objext" ;; +esac + + case $LIBOBJS in + "vfork.$ac_objext" | \ + *" vfork.$ac_objext" | \ + "vfork.$ac_objext "* | \ + *" vfork.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS vfork.$ac_objext" ;; +esac + + case $LIBOBJS in + "waitpid.$ac_objext" | \ + *" waitpid.$ac_objext" | \ + "waitpid.$ac_objext "* | \ + *" waitpid.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS waitpid.$ac_objext" ;; +esac + + case $LIBOBJS in + "vasprintf.$ac_objext" | \ + *" vasprintf.$ac_objext" | \ + "vasprintf.$ac_objext "* | \ + *" vasprintf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS vasprintf.$ac_objext" ;; +esac + for f in $funcs; do case "$f" in basename | getpagesize | insque | random | strcasecmp) @@ -2372,9 +5820,9 @@ if test -z "${setobjs}"; then ;; *) n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF + cat >>confdefs.h <<_ACEOF #define $n 1 -EOF +_ACEOF ;; esac @@ -2384,9 +5832,9 @@ EOF # don't have to check them here. # Of the functions in $checkfuncs, VxWorks only has strerror. - cat >> confdefs.h <<\EOF + cat >>confdefs.h <<\_ACEOF #define HAVE_STRERROR 1 -EOF +_ACEOF setobjs=yes @@ -2412,11 +5860,18 @@ if test -z "${setobjs}"; then # missing. # DJ - only if we're *building* cygwin, not just building *with* cygwin - + if test -n "${with_target_subdir}" then funcs="`echo $funcs | sed -e 's/random//'`" - LIBOBJS="$LIBOBJS random.o" + case $LIBOBJS in + "random.$ac_objext" | \ + *" random.$ac_objext" | \ + "random.$ac_objext "* | \ + *" random.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS random.$ac_objext" ;; +esac + vars="`echo $vars | sed -e 's/sys_siglist//'`" checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`" fi @@ -2429,20 +5884,25 @@ if test -z "${setobjs}"; then libiberty_cv_var_sys_errlist=yes ;; + *-*-msdosdjgpp*) + # vfork and fork are stubs. + ac_cv_func_vfork_works=no + ;; + *-*-uwin*) - # Under some versions of uwin, vfork is notoriously buggy and the test + # Under some versions of uwin, vfork is notoriously buggy and the test # can hang configure; on other versions, vfork exists just as a stub. # FIXME: This should be removed once vfork in uwin's runtime is fixed. ac_cv_func_vfork_works=no # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are - # macros (actually, these are imported from a DLL, but the end effect + # macros (actually, these are imported from a DLL, but the end effect # is the same), so the test below won't find them. libiberty_cv_var_sys_nerr=yes libiberty_cv_var_sys_errlist=yes ;; *-*-*vms*) - # Under VMS, vfork works very different than on Unix. The standard test + # Under VMS, vfork works very different than on Unix. The standard test # won't work, and it isn't easily adaptable. It makes more sense to # just force it. ac_cv_func_vfork_works=yes @@ -2452,205 +5912,399 @@ if test -z "${setobjs}"; then # We haven't set the list of objects yet. Use the standard autoconf # tests. This will only work if the compiler works. - echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2457: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross + echo "$as_me:$LINENO: checking for library containing strerror" >&5 +echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 +if test "${ac_cv_search_strerror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_strerror=no +if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -cat > conftest.$ac_ext << EOF - -#line 2468 "configure" -#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_strerror" = no; then + for ac_lib in cposix; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -main(){return(0);} -EOF -if { (eval echo configure:2473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strerror (); +int +main () +{ +strerror (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_strerror="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6 +if test "$ac_cv_search_strerror" != no; then + test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2499: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - for ac_func in $funcs + +for ac_func in $funcs do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2506: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2511 "configure" -#include "confdefs.h" +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. Under hpux, + including <limits.h> includes <sys/time.h> and causes problems + checking for functions defined therein. */ +#if defined (__STDC__) && !defined (_HPUX_SOURCE) +# include <limits.h> +#else +# include <assert.h> +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case $LIBOBJS in + "$ac_func.$ac_objext" | \ + *" $ac_func.$ac_objext" | \ + "$ac_func.$ac_objext "* | \ + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; +esac -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" fi done - echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2561: checking whether alloca needs Cray hooks" >&5 -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + echo "$as_me:$LINENO: checking whether alloca needs Cray hooks" >&5 +echo $ECHO_N "checking whether alloca needs Cray hooks... $ECHO_C" >&6 +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 2566 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if defined(CRAY) && ! defined(CRAY2) webecray #else wenotbecray #endif -EOF +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* + $EGREP "webecray" >/dev/null 2>&1; then ac_cv_os_cray=yes else - rm -rf conftest* ac_cv_os_cray=no fi rm -f conftest* fi - -echo "$ac_t""$ac_cv_os_cray" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2591: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2596 "configure" -#include "confdefs.h" + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. Under hpux, + including <limits.h> includes <sys/time.h> and causes problems + checking for functions defined therein. */ +#if defined (__STDC__) && !defined (_HPUX_SOURCE) +# include <limits.h> +#else +# include <assert.h> +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<EOF +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func -EOF +_ACEOF break -else - echo "$ac_t""no" 1>&6 fi done fi -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2645: checking stack direction for C alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else - cat > conftest.$ac_ext <<EOF -#line 2653 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ find_stack_direction () { static char *addr = 0; @@ -2667,142 +6321,298 @@ main () { exit (find_stack_direction() < 0); } -EOF -if { (eval echo configure:2672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_stack_direction=-1 fi -rm -fr conftest* +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi +echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 -cat >> confdefs.h <<EOF +cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction -EOF +_ACEOF + - ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2694: checking for vfork.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + +for ac_header in unistd.h vfork.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi else - cat > conftest.$ac_ext <<EOF -#line 2699 "configure" -#include "confdefs.h" -#include <vfork.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" + ac_cpp_err=yes fi -rm -f conftest* +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_VFORK_H 1 -EOF +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF -else - echo "$ac_t""no" 1>&6 fi +done -echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2729: checking for working vfork" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2735: checking for vfork" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2740 "configure" -#include "confdefs.h" + + +for ac_func in fork vfork +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char vfork(); below. */ -#include <assert.h> + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. Under hpux, + including <limits.h> includes <sys/time.h> and causes problems + checking for functions defined therein. */ +#if defined (__STDC__) && !defined (_HPUX_SOURCE) +# include <limits.h> +#else +# include <assert.h> +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vfork(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_vfork) || defined (__stub___vfork) +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -vfork(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_vfork=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_vfork=no" -fi -rm -f conftest* +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + fi +done -if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : +if test "x$ac_cv_func_fork" = xyes; then + echo "$as_me:$LINENO: checking for working fork" >&5 +echo $ECHO_N "checking for working fork... $ECHO_C" >&6 +if test "${ac_cv_func_fork_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - echo "$ac_t""no" 1>&6 + if test "$cross_compiling" = yes; then + ac_cv_func_fork_works=cross +else + cat >conftest.$ac_ext <<_ACEOF +/* By Ruediger Kuhlmann. */ + #include <sys/types.h> + #if HAVE_UNISTD_H + # include <unistd.h> + #endif + /* Some systems only have a dummy stub for fork() */ + int main () + { + if (fork() < 0) + exit (1); + exit (0); + } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_fork_works=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_fork_works=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 +echo "${ECHO_T}$ac_cv_func_fork_works" >&6 + +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi - ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + echo "$as_me:$LINENO: checking for working vfork" >&5 +echo $ECHO_N "checking for working vfork... $ECHO_C" >&6 +if test "${ac_cv_func_vfork_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 2785 "configure" -#include "confdefs.h" + if test "$cross_compiling" = yes; then + ac_cv_func_vfork_works=cross +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ #include <stdio.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> +#include <sys/wait.h> +#if HAVE_UNISTD_H +# include <unistd.h> #endif -#ifdef HAVE_VFORK_H -#include <vfork.h> +#if HAVE_VFORK_H +# include <vfork.h> #endif /* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. - The compiler is told about this with #include <vfork.h>, - but some compilers (e.g. gcc -O) don't grok <vfork.h>. - Test for this by using a static variable whose address - is put into a register that is clobbered by the vfork. */ -static + argument registers are propagated back to the parent. The compiler + is told about this with #include <vfork.h>, but some compilers + (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void #ifdef __cplusplus sparc_address_test (int arg) -#else +# else sparc_address_test (arg) int arg; #endif { @@ -2820,25 +6630,27 @@ sparc_address_test (arg) int arg; } } } -main() { + +int +main () +{ pid_t parent = getpid (); pid_t child; - sparc_address_test (); + sparc_address_test (0); child = vfork (); if (child == 0) { - /* Here is another test for sparc vfork register problems. - This test uses lots of local variables, at least - as many local variables as main has allocated so far - including compiler temporaries. 4 locals are enough for - gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. - A buggy compiler should reuse the register of parent - for one of the local variables, since it will think that - parent can't possibly be used any more in this routine. - Assigning to the local variable will thus munge parent - in the parent process. */ + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); @@ -2848,11 +6660,10 @@ main() { || p != p5 || p != p6 || p != p7) _exit(1); - /* On some systems (e.g. IRIX 3.3), - vfork doesn't separate parent from child file descriptors. - If the child closes a descriptor before it execs or exits, - this munges the parent's descriptor as well. - Test for this by closing stdout in the child. */ + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; @@ -2875,251 +6686,1448 @@ main() { ); } } -EOF -if { (eval echo configure:2880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_vfork_works=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_vfork_works=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_vfork_works=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -rm -fr conftest* fi +echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 +echo "${ECHO_T}$ac_cv_func_vfork_works" >&6 +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi -echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 -if test $ac_cv_func_vfork_works = no; then - cat >> confdefs.h <<\EOF +if test "x$ac_cv_func_vfork_works" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WORKING_VFORK 1 +_ACEOF + +else + +cat >>confdefs.h <<\_ACEOF #define vfork fork -EOF +_ACEOF + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_WORKING_FORK 1 +_ACEOF fi if test $ac_cv_func_vfork_works = no; then - LIBOBJS="$LIBOBJS vfork.o" + case $LIBOBJS in + "vfork.$ac_objext" | \ + *" vfork.$ac_objext" | \ + "vfork.$ac_objext "* | \ + *" vfork.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS vfork.$ac_objext" ;; +esac + fi # We only need _doprnt if we might use it to implement v*printf. if test $ac_cv_func_vprintf != yes \ || test $ac_cv_func_vfprintf != yes \ || test $ac_cv_func_vsprintf != yes; then - for ac_func in _doprnt + +for ac_func in _doprnt do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2912: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2917 "configure" -#include "confdefs.h" +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. Under hpux, + including <limits.h> includes <sys/time.h> and causes problems + checking for functions defined therein. */ +#if defined (__STDC__) && !defined (_HPUX_SOURCE) +# include <limits.h> +#else +# include <assert.h> +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + case $LIBOBJS in + "$ac_func.$ac_objext" | \ + *" $ac_func.$ac_objext" | \ + "$ac_func.$ac_objext "* | \ + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; +esac -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" fi done else - for ac_func in _doprnt + +for ac_func in _doprnt do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2970: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2975 "configure" -#include "confdefs.h" +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. Under hpux, + including <limits.h> includes <sys/time.h> and causes problems + checking for functions defined therein. */ +#if defined (__STDC__) && !defined (_HPUX_SOURCE) +# include <limits.h> +#else +# include <assert.h> +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:2998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done fi for v in $vars; do - echo $ac_n "checking for $v""... $ac_c" 1>&6 -echo "configure:3026: checking for $v" >&5 - if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3031 "configure" -#include "confdefs.h" + echo "$as_me:$LINENO: checking for $v" >&5 +echo $ECHO_N "checking for $v... $ECHO_C" >&6 + if eval "test \"\${libiberty_cv_var_$v+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int *p; -int main() { +int +main () +{ extern int $v []; p = $v; -; return 0; } -EOF -if { (eval echo configure:3038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then eval "libiberty_cv_var_$v=yes" else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "libiberty_cv_var_$v=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "libiberty_cv_var_$v=no" fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF + cat >>confdefs.h <<_ACEOF #define $n 1 -EOF +_ACEOF else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi done - for ac_func in $checkfuncs -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3064: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + + # special check for _system_configuration because AIX <4.3.2 do not + # contain the `physmem' member. + echo "$as_me:$LINENO: checking for external symbol _system_configuration" >&5 +echo $ECHO_N "checking for external symbol _system_configuration... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/systemcfg.h> +int +main () +{ +double x = _system_configuration.physmem; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE__SYSTEM_CONFIGURATION 1 +_ACEOF + else - cat > conftest.$ac_ext <<EOF -#line 3069 "configure" -#include "confdefs.h" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + + +for ac_func in $checkfuncs +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. Under hpux, + including <limits.h> includes <sys/time.h> and causes problems + checking for functions defined therein. */ +#if defined (__STDC__) && !defined (_HPUX_SOURCE) +# include <limits.h> +#else +# include <assert.h> +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + echo "$as_me:$LINENO: checking whether basename is declared" >&5 +echo $ECHO_N "checking whether basename is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_basename+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef basename + char *p = (char *) basename; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_basename=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_basename=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_basename" >&5 +echo "${ECHO_T}$ac_cv_have_decl_basename" >&6 +if test $ac_cv_have_decl_basename = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether ffs is declared" >&5 +echo $ECHO_N "checking whether ffs is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_ffs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef ffs + char *p = (char *) ffs; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_ffs=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_ffs=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_ffs" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ffs" >&6 +if test $ac_cv_have_decl_ffs = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether asprintf is declared" >&5 +echo $ECHO_N "checking whether asprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_asprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef asprintf + char *p = (char *) asprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_asprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_asprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_asprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_asprintf" >&6 +if test $ac_cv_have_decl_asprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ASPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ASPRINTF 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether vasprintf is declared" >&5 +echo $ECHO_N "checking whether vasprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_vasprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef vasprintf + char *p = (char *) vasprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_vasprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_vasprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_vasprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_vasprintf" >&6 +if test $ac_cv_have_decl_vasprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VASPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VASPRINTF 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether snprintf is declared" >&5 +echo $ECHO_N "checking whether snprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_snprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef snprintf + char *p = (char *) snprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_snprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_snprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_snprintf" >&6 +if test $ac_cv_have_decl_snprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5 +echo $ECHO_N "checking whether vsnprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_vsnprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef vsnprintf + char *p = (char *) vsnprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_vsnprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_vsnprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_vsnprintf" >&6 +if test $ac_cv_have_decl_vsnprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 0 +_ACEOF + + +fi + + + echo "$as_me:$LINENO: checking whether calloc is declared" >&5 +echo $ECHO_N "checking whether calloc is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_calloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef calloc + char *p = (char *) calloc; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_calloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_calloc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_calloc" >&5 +echo "${ECHO_T}$ac_cv_have_decl_calloc" >&6 +if test $ac_cv_have_decl_calloc = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_CALLOC 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_CALLOC 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether getenv is declared" >&5 +echo $ECHO_N "checking whether getenv is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getenv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getenv + char *p = (char *) getenv; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_getenv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_getenv=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getenv" >&6 +if test $ac_cv_have_decl_getenv = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether getopt is declared" >&5 +echo $ECHO_N "checking whether getopt is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef getopt + char *p = (char *) getopt; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_getopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_getopt=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getopt" >&6 +if test $ac_cv_have_decl_getopt = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETOPT 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETOPT 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether malloc is declared" >&5 +echo $ECHO_N "checking whether malloc is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef malloc + char *p = (char *) malloc; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_malloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_malloc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_malloc" >&5 +echo "${ECHO_T}$ac_cv_have_decl_malloc" >&6 +if test $ac_cv_have_decl_malloc = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MALLOC 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MALLOC 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether realloc is declared" >&5 +echo $ECHO_N "checking whether realloc is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_realloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef realloc + char *p = (char *) realloc; #endif -; return 0; } -EOF -if { (eval echo configure:3092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_realloc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_realloc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_realloc" >&5 +echo "${ECHO_T}$ac_cv_have_decl_realloc" >&6 +if test $ac_cv_have_decl_realloc = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_REALLOC 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_REALLOC 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether sbrk is declared" >&5 +echo $ECHO_N "checking whether sbrk is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_sbrk+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef sbrk + char *p = (char *) sbrk; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_sbrk=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_sbrk=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_sbrk" >&5 +echo "${ECHO_T}$ac_cv_have_decl_sbrk" >&6 +if test $ac_cv_have_decl_sbrk = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SBRK 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SBRK 0 +_ACEOF + + +fi + + + echo "$as_me:$LINENO: checking whether strverscmp is declared" >&5 +echo $ECHO_N "checking whether strverscmp is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_strverscmp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef strverscmp + char *p = (char *) strverscmp; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_strverscmp=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_strverscmp=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strverscmp" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strverscmp" >&6 +if test $ac_cv_have_decl_strverscmp = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRVERSCMP 1 +_ACEOF + -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - else - echo "$ac_t""no" 1>&6 + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRVERSCMP 0 +_ACEOF + + fi -done - echo $ac_n "checking whether canonicalize_file_name must be declared""... $ac_c" 1>&6 -echo "configure:3117: checking whether canonicalize_file_name must be declared" >&5 -if eval "test \"`echo '$''{'libiberty_cv_decl_needed_canonicalize_file_name'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + + echo "$as_me:$LINENO: checking whether canonicalize_file_name must be declared" >&5 +echo $ECHO_N "checking whether canonicalize_file_name must be declared... $ECHO_C" >&6 +if test "${libiberty_cv_decl_needed_canonicalize_file_name+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat > conftest.$ac_ext <<EOF -#line 3122 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "confdefs.h" #include <stdio.h> @@ -3136,27 +8144,53 @@ else #ifdef HAVE_UNISTD_H #include <unistd.h> #endif -int main() { +int +main () +{ char *(*pfn) = (char *(*)) canonicalize_file_name -; return 0; } -EOF -if { (eval echo configure:3144: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then libiberty_cv_decl_needed_canonicalize_file_name=no else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - libiberty_cv_decl_needed_canonicalize_file_name=yes + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +libiberty_cv_decl_needed_canonicalize_file_name=yes fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$ac_t""$libiberty_cv_decl_needed_canonicalize_file_name" 1>&6 +echo "$as_me:$LINENO: result: $libiberty_cv_decl_needed_canonicalize_file_name" >&5 +echo "${ECHO_T}$libiberty_cv_decl_needed_canonicalize_file_name" >&6 if test $libiberty_cv_decl_needed_canonicalize_file_name = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define NEED_DECLARATION_CANONICALIZE_FILE_NAME 1 -EOF +_ACEOF fi @@ -3164,120 +8198,192 @@ fi # Figure out which version of pexecute to use. case "${host}" in - *-*-mingw* | *-*-winnt*) pexecute=pex-win32.o ;; - *-*-msdosdjgpp*) pexecute=pex-djgpp.o ;; - *-*-msdos*) pexecute=pex-msdos.o ;; - *-*-os2-emx*) pexecute=pex-os2.o ;; - *) pexecute=pex-unix.o ;; + *-*-mingw* | *-*-winnt*) pexecute=./pex-win32.o ;; + *-*-msdosdjgpp*) pexecute=./pex-djgpp.o ;; + *-*-msdos*) pexecute=./pex-msdos.o ;; + *) pexecute=./pex-unix.o ;; esac -for ac_hdr in unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3180: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3185 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +if test x$gcc_no_link = xyes; then + if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then + ac_cv_func_mmap_fixed_mapped=no + fi fi -rm -f conftest* +if test "x${ac_cv_func_mmap_fixed_mapped}" != xno; then + + +for ac_header in stdlib.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" else - echo "$ac_t""no" 1>&6 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi done + for ac_func in getpagesize do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3219: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3224 "configure" -#include "confdefs.h" +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test x$gcc_no_link = xyes; then + { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5 +echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;} + { (exit 1); exit 1; }; } +fi +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. Under hpux, + including <limits.h> includes <sys/time.h> and causes problems + checking for functions defined therein. */ +#if defined (__STDC__) && !defined (_HPUX_SOURCE) +# include <limits.h> +#else +# include <assert.h> +#endif /* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - + builtin and then its argument prototype would still apply. */ +char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -$ac_func(); +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} #endif -; return 0; } -EOF -if { (eval echo configure:3247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 fi done -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:3272: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working mmap" >&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_mmap_fixed_mapped=no else - cat > conftest.$ac_ext <<EOF -#line 3280 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +/* malloc might have been renamed as rpl_malloc. */ +#undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: @@ -3291,34 +8397,34 @@ else back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the filesystem buffer cache + VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get - propogated back to all the places they're supposed to be. + propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ -#include <sys/types.h> + #include <fcntl.h> #include <sys/mman.h> -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include <unistd.h> -# endif +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE /* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H +# if !HAVE_SYS_PARAM_H # define HAVE_SYS_PARAM_H 1 # endif # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H +# if HAVE_SYS_PARAM_H # include <sys/param.h> # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE @@ -3345,111 +8451,113 @@ else #endif /* no HAVE_GETPAGESIZE */ -#ifdef __cplusplus -extern "C" { void *malloc(unsigned); } -#else -char *malloc(); -#endif - -int -main() -{ - char *data, *data2, *data3; - int i, pagesize; - int fd; - - pagesize = getpagesize(); - - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); - - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); - - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); -} - -EOF -if { (eval echo configure:3420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +int +main () +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + exit (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + exit (1); + if (write (fd, data, pagesize) != pagesize) + exit (1); + close (fd); + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + exit (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + exit (1); + data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit (1); + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + exit (1); + if (read (fd, data3, pagesize) != pagesize) + exit (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit (1); + close (fd); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_mmap_fixed_mapped=no fi -rm -fr conftest* +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi - -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 if test $ac_cv_func_mmap_fixed_mapped = yes; then - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP 1 -EOF +_ACEOF fi +rm -f conftest.mmap +fi -echo $ac_n "checking for working strncmp""... $ac_c" 1>&6 -echo "configure:3444: checking for working strncmp" >&5 -if eval "test \"`echo '$''{'ac_cv_func_strncmp_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for working strncmp" >&5 +echo $ECHO_N "checking for working strncmp... $ECHO_C" >&6 +if test "${ac_cv_func_strncmp_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_strncmp_works=no else - cat > conftest.$ac_ext <<EOF -#line 3452 "configure" -#include "confdefs.h" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ /* Test by Jim Wilson and Kaveh Ghazi. Check whether strncmp reads past the end of its string parameters. */ @@ -3489,7 +8597,7 @@ main () dev_zero = open ("/dev/zero", O_RDONLY); if (dev_zero < 0) exit (1); - + p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, dev_zero, 0); if (p == (char *)-1) @@ -3511,25 +8619,42 @@ main () exit (0); } -EOF -if { (eval echo configure:3516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_cv_func_strncmp_works=yes else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_strncmp_works=no + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_strncmp_works=no fi -rm -fr conftest* +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - rm -f core core.* *.core fi - -echo "$ac_t""$ac_cv_func_strncmp_works" 1>&6 +echo "$as_me:$LINENO: result: $ac_cv_func_strncmp_works" >&5 +echo "${ECHO_T}$ac_cv_func_strncmp_works" >&6 if test $ac_cv_func_strncmp_works = no ; then - LIBOBJS="$LIBOBJS strncmp.o" + case $LIBOBJS in + "strncmp.$ac_objext" | \ + *" strncmp.$ac_objext" | \ + "strncmp.$ac_objext "* | \ + *" strncmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strncmp.$ac_objext" ;; +esac + fi @@ -3542,408 +8667,1317 @@ else fi + +L="" +for l in x $LIBOBJS; do + case $l in + x) ;; + *) L="$L ./$l" ;; + esac +done +LIBOBJS="$L" + + + + + # We need multilib support, but only if configuring for the target. -trap '' 1 2 15 -cat > confcache <<\EOF + ac_config_files="$ac_config_files Makefile testsuite/Makefile" + + ac_config_commands="$ac_config_commands default" + +cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - DEFS=-DHAVE_CONFIG_H -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. # Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# # Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. +# configure, is in config.log if it exists. -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi done -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi -trap 'rm -fr `echo "Makefile testsuite/Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@libiberty_topdir@%$libiberty_topdir%g -s%@MAINT@%$MAINT%g -s%@NOTMAINT@%$NOTMAINT%g -s%@MAKEINFO@%$MAKEINFO%g -s%@BUILD_INFO@%$BUILD_INFO%g -s%@PERL@%$PERL%g -s%@HAVE_PERL@%$HAVE_PERL%g -s%@host@%$host%g -s%@host_alias@%$host_alias%g -s%@host_cpu@%$host_cpu%g -s%@host_vendor@%$host_vendor%g -s%@host_os@%$host_os%g -s%@build@%$build%g -s%@build_alias@%$build_alias%g -s%@build_cpu@%$build_cpu%g -s%@build_vendor@%$build_vendor%g -s%@build_os@%$build_os%g -s%@AR@%$AR%g -s%@RANLIB@%$RANLIB%g -s%@CC@%$CC%g -s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g -s%@NO_MINUS_C_MINUS_O@%$NO_MINUS_C_MINUS_O%g -s%@OUTPUT_OPTION@%$OUTPUT_OPTION%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -/@host_makefile_frag@/r $host_makefile_frag -s%@host_makefile_frag@%%g -s%@CPP@%$CPP%g -s%@CHECK@%$CHECK%g -s%@target_header_dir@%$target_header_dir%g -s%@LIBOBJS@%$LIBOBJS%g -s%@pexecute@%$pexecute%g -s%@INSTALL_DEST@%$INSTALL_DEST%g +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` + as_ln_s='ln -s' fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" fi -EOF -cat >> $CONFIG_STATUS <<EOF +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi -CONFIG_FILES=\${CONFIG_FILES-"Makefile testsuite/Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +srcdir=${srcdir} +host=${host} +target=${target} +with_target_subdir=${with_target_subdir} +with_multisubdir=${with_multisubdir} +ac_configure_args="--enable-multilib ${ac_configure_args}" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" +libiberty_topdir=${libiberty_topdir} + + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "testsuite/Makefile" ) CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; + "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; esac +done - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@libiberty_topdir@,$libiberty_topdir,;t t +s,@MAINT@,$MAINT,;t t +s,@NOTMAINT@,$NOTMAINT,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@BUILD_INFO@,$BUILD_INFO,;t t +s,@PERL@,$PERL,;t t +s,@HAVE_PERL@,$HAVE_PERL,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@ac_libiberty_warn_cflags@,$ac_libiberty_warn_cflags,;t t +s,@NO_MINUS_C_MINUS_O@,$NO_MINUS_C_MINUS_O,;t t +s,@OUTPUT_OPTION@,$OUTPUT_OPTION,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@EGREP@,$EGREP,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@CHECK@,$CHECK,;t t +s,@target_header_dir@,$target_header_dir,;t t +s,@pexecute@,$pexecute,;t t +s,@INSTALL_DEST@,$INSTALL_DEST,;t t +s,@datarootdir@,$datarootdir,;t t +s,@docdir@,$docdir,;t t +s,@htmldir@,$htmldir,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +/@host_makefile_frag@/r $host_makefile_frag +s,@host_makefile_frag@,,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat fi +fi # test -n "$CONFIG_FILES" - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' - -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <<EOF - CONFIG_HEADERS="config.h:config.in" -EOF -cat >> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; esac - echo creating $ac_file - - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in - -EOF - -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail -while : +while grep . conftest.undefs >/dev/null do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals -done -rm -f conftest.vals - -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file fi - rm -f $ac_file - mv conftest.h $ac_file + else + cat $tmp/config.h + rm -f $tmp/config.h fi -fi; done +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF -EOF -cat >> $CONFIG_STATUS <<EOF -srcdir=${srcdir} -host=${host} -target=${target} -with_target_subdir=${with_target_subdir} -with_build_subdir=${with_build_subdir} -with_multisubdir=${with_multisubdir} -ac_configure_args="--enable-multilib ${ac_configure_args}" -CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" -libiberty_topdir=${libiberty_topdir} +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac -EOF -cat >> $CONFIG_STATUS <<\EOF -test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + default ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h if test -n "$CONFIG_FILES"; then - if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then + if test -n "${with_target_subdir}"; then # FIXME: We shouldn't need to set ac_file ac_file=Makefile LD="${ORIGINAL_LD_FOR_MULTILIBS}" . ${libiberty_topdir}/config-ml.in fi -fi -exit 0 -EOF +fi ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi diff --git a/gnu/lib/libiberty/src/configure.in b/gnu/lib/libiberty/src/configure.in deleted file mode 100644 index e142cf501c8..00000000000 --- a/gnu/lib/libiberty/src/configure.in +++ /dev/null @@ -1,481 +0,0 @@ -dnl Process this file with autoconf to produce a configure script - -AC_PREREQ(2.13) -AC_INIT(xmalloc.c) - -# This works around the fact that libtool configuration may change LD -# for this particular configuration, but some shells, instead of -# keeping the changes in LD private, export them just because LD is -# exported. We don't use libtool yet, but some day we might, so... -ORIGINAL_LD_FOR_MULTILIBS=$LD - -dnl We use these options to decide which functions to include. -AC_ARG_WITH(target-subdir, -[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target]) -AC_ARG_WITH(build-subdir, -[ --with-build-subdir=SUBDIR Configuring in a subdirectory for build]) -AC_ARG_WITH(cross-host, -[ --with-cross-host=HOST Configuring with a cross compiler]) -AC_ARG_WITH(newlib, -[ --with-newlib Configuring with newlib]) - -if test "${srcdir}" = "."; then - if test -n "${with_build_subdir}"; then - libiberty_topdir="${srcdir}/../.." - with_target_subdir= - elif test -z "${with_target_subdir}"; then - libiberty_topdir="${srcdir}/.." - else - if test "${with_target_subdir}" != "."; then - libiberty_topdir="${srcdir}/${with_multisrctop}../.." - else - libiberty_topdir="${srcdir}/${with_multisrctop}.." - fi - fi -else - libiberty_topdir="${srcdir}/.." -fi -AC_SUBST(libiberty_topdir) -AC_CONFIG_AUX_DIR($libiberty_topdir) - -dnl Very limited version of automake's enable-maintainer-mode - -AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode is disabled by default - AC_ARG_ENABLE(maintainer-mode, -[ --enable-maintainer-mode - enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer], - maintainer_mode=$enableval, - maintainer_mode=no) - -AC_MSG_RESULT($maintainer_mode) - -if test "$maintainer_mode" = "yes"; then - MAINT='' - NOTMAINT='#' -else - MAINT='#' - NOTMAINT='' -fi -AC_SUBST(MAINT)dnl -AC_SUBST(NOTMAINT)dnl - -# Do we have a single-tree copy of texinfo? Even if we do, we can't -# rely on it - libiberty is built before texinfo. -AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, ) -if test "x$MAKEINFO" = "x"; then - MAKEINFO="@echo makeinfo missing; true" - BUILD_INFO= -else - BUILD_INFO=info - case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in - x*\ [[1-3]].* ) - MAKEINFO="@echo $MAKEINFO is too old, 4.0 or newer required; true" - BUILD_INFO= - AC_MSG_WARN([ -*** Makeinfo is too old. Info documentation will not be built.]) - ;; - esac -fi -AC_SUBST(MAKEINFO) -AC_SUBST(BUILD_INFO) - -AC_CHECK_PROG(PERL, perl, perl, ) -if test x"$PERL" = x""; then - HAVE_PERL='#' -else - HAVE_PERL='' -fi -AC_SUBST(HAVE_PERL) - -AC_CANONICAL_HOST - -dnl When we start using automake: -dnl AM_INIT_AUTOMAKE(libiberty, 1.0) - -dnl These must be called before AM_PROG_LIBTOOL, because it may want -dnl to call AC_CHECK_PROG. -AC_CHECK_TOOL(AR, ar) -AC_CHECK_TOOL(RANLIB, ranlib, :) - -LIB_AC_PROG_CC - -AC_PROG_CC_C_O -# autoconf is lame and doesn't give us any substitution variable for this. -if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then - NO_MINUS_C_MINUS_O=yes -else - OUTPUT_OPTION='-o $@' -fi -AC_SUBST(NO_MINUS_C_MINUS_O) -AC_SUBST(OUTPUT_OPTION) - -AC_ISC_POSIX -AC_C_CONST -AC_C_INLINE - -dnl When we start using libtool: -dnl Default to a non shared library. This may be overridden by the -dnl configure option --enable-shared. -dnl AM_DISABLE_SHARED - -dnl When we start using libtool: -dnl AM_PROG_LIBTOOL - -dnl When we start using automake: -dnl AM_CONFIG_HEADER(config.h:config.in) -AC_CONFIG_HEADER(config.h:config.in) - -dnl When we start using automake: -dnl AM_MAINTAINER_MODE -dnl AC_EXEEXT - -dnl When we start using automake: -dnl AM_PROG_INSTALL -AC_PROG_INSTALL - -. ${srcdir}/config.table -host_makefile_frag=${frag} -AC_SUBST_FILE(host_makefile_frag) - -# It's OK to check for header files. Although the compiler may not be -# able to link anything, it had better be able to at least compile -# something. -AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h) -AC_HEADER_SYS_WAIT -AC_HEADER_TIME - -libiberty_AC_DECLARE_ERRNO - -AC_CHECK_TYPE(uintptr_t, unsigned long) -# Given the above check, we always have uintptr_t or a fallback -# definition. So define HAVE_UINTPTR_T in case any imported code -# relies on it. -AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if you have the \`uintptr_t' type.]) - -AC_TYPE_PID_T - -# This is the list of functions which libiberty will provide if they -# are not available on the host. - -funcs="asprintf" -funcs="$funcs atexit" -funcs="$funcs basename" -funcs="$funcs bcmp" -funcs="$funcs bcopy" -funcs="$funcs bsearch" -funcs="$funcs bzero" -funcs="$funcs calloc" -funcs="$funcs clock" -funcs="$funcs ffs" -funcs="$funcs getcwd" -funcs="$funcs getpagesize" -funcs="$funcs index" -funcs="$funcs insque" -funcs="$funcs memchr" -funcs="$funcs memcmp" -funcs="$funcs memcpy" -funcs="$funcs memmove" -funcs="$funcs mempcpy" -funcs="$funcs memset" -funcs="$funcs mkstemps" -funcs="$funcs putenv" -funcs="$funcs random" -funcs="$funcs rename" -funcs="$funcs rindex" -funcs="$funcs setenv" -funcs="$funcs snprintf" -funcs="$funcs sigsetmask" -funcs="$funcs stpcpy" -funcs="$funcs stpncpy" -funcs="$funcs strcasecmp" -funcs="$funcs strchr" -funcs="$funcs strdup" -funcs="$funcs strncasecmp" -funcs="$funcs strrchr" -funcs="$funcs strstr" -funcs="$funcs strtod" -funcs="$funcs strtol" -funcs="$funcs strtoul" -funcs="$funcs tmpnam" -funcs="$funcs vasprintf" -funcs="$funcs vfprintf" -funcs="$funcs vprintf" -funcs="$funcs vsnprintf" -funcs="$funcs vsprintf" -funcs="$funcs waitpid" - -# Also in the old function.def file: alloca, vfork, getopt. - -vars="sys_errlist sys_nerr sys_siglist _system_configuration" - -checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday" -checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp" -checkfuncs="$checkfuncs getsysinfo table sysctl" - -# These are neither executed nor required, but they help keep -# autoheader happy without adding a bunch of text to acconfig.h. -if test "x" = "y"; then - AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bsearch bzero calloc clock) - AC_CHECK_FUNCS(getcwd getpagesize index insque mkstemps memchr memcmp memcpy) - AC_CHECK_FUNCS(memmove mempcpy memset putenv random rename rindex sigsetmask) - AC_CHECK_FUNCS(strcasecmp setenv stpcpy stpncpy strchr strdup strncasecmp strrchr strstr) - AC_CHECK_FUNCS(strtod strtol strtoul tmpnam vasprintf vfprintf vprintf) - AC_CHECK_FUNCS(vsprintf waitpid getrusage on_exit psignal strerror strsignal) - AC_CHECK_FUNCS(sysconf times sbrk gettimeofday ffs snprintf vsnprintf) - AC_CHECK_FUNCS(pstat_getstatic pstat_getdynamic sysmp getsysinfo table sysctl) - AC_CHECK_FUNCS(realpath canonicalize_file_name) - AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.]) - AC_DEFINE(HAVE_SYS_NERR, 1, [Define if you have the sys_nerr variable.]) - AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.]) - AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, [Define if you have the _system_configuration variable.]) -fi - -# For each of these functions, if the host does not provide the -# function we want to put FN.o in LIBOBJS, and if the host does -# provide the function, we want to define HAVE_FN in config.h. - -setobjs= -CHECK= -target_header_dir= -if test -n "${with_target_subdir}"; then - - # We are being configured as a target library. AC_REPLACE_FUNCS - # may not work correctly, because the compiler may not be able to - # link executables. Note that we may still be being configured - # native. - - # If we are being configured for newlib, we know which functions - # newlib provide and which ones we will be expected to provide. - - if test "x${with_newlib}" = "xyes"; then - LIBOBJS="asprintf.o basename.o insque.o random.o strdup.o vasprintf.o" - - for f in $funcs; do - case "$f" in - asprintf | basename | insque | random | strdup | vasprintf) - ;; - *) - n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - AC_DEFINE_UNQUOTED($n) - ;; - esac - done - - # newlib doesnt provide any of the variables in $vars, so we - # dont have to check them here. - - # Of the functions in $checkfuncs, newlib only has strerror. - AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR) - - setobjs=yes - - fi - - # We may wish to install the target headers somewhere. - AC_ARG_ENABLE(install-libiberty, - [ --enable-install-libiberty Install headers for end users], - enable_install_libiberty=$enableval, - enable_install_libiberty=no)dnl - - # Option parsed, now set things appropriately. - case x"$enable_install_libiberty" in - xyes|x) - target_header_dir=libiberty - ;; - xno) - target_header_dir= - ;; - *) - # This could be sanity-checked in various ways... - target_header_dir="${enable_install_libiberty}" - ;; - esac - - -else - - # Not a target library, so we set things up to run the test suite. - CHECK=check-cplus-dem - -fi - -AC_SUBST(CHECK) -AC_SUBST(target_header_dir) - -case "${host}" in - *-*-cygwin* | *-*-mingw*) - AC_DEFINE_NOAUTOHEADER(HAVE_SYS_ERRLIST) - AC_DEFINE_NOAUTOHEADER(HAVE_SYS_NERR) - ;; -esac - -if test -z "${setobjs}"; then - case "${host}" in - - *-*-vxworks*) - # Handle VxWorks configuration specially, since on VxWorks the - # libraries are actually on the target board, not in the file - # system. - LIBOBJS="basename.o getpagesize.o insque.o random.o strcasecmp.o" - LIBOBJS="$LIBOBJS strncasecmp.o strdup.o vfork.o waitpid.o vasprintf.o" - for f in $funcs; do - case "$f" in - basename | getpagesize | insque | random | strcasecmp) - ;; - strncasecmp | strdup | vfork | waitpid | vasprintf) - ;; - *) - n=HAVE_`echo $f | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - AC_DEFINE_UNQUOTED($n) - ;; - esac - done - - # VxWorks doesn't provide any of the variables in $vars, so we - # don't have to check them here. - - # Of the functions in $checkfuncs, VxWorks only has strerror. - AC_DEFINE_NOAUTOHEADER(HAVE_STRERROR) - - setobjs=yes - ;; - - esac -fi - -if test -z "${setobjs}"; then - - case "${host}" in - - *-*-cygwin*) - # The Cygwin library actually uses a couple of files from - # libiberty when it is built. If we are building a native - # Cygwin, and we run the tests, we will appear to have these - # files. However, when we go on to build winsup, we will wind up - # with a library which does not have the files, since they should - # have come from libiberty. - - # We handle this by removing the functions the winsup library - # provides from our shell variables, so that they appear to be - # missing. - - # DJ - only if we're *building* cygwin, not just building *with* cygwin - - if test -n "${with_target_subdir}" - then - funcs="`echo $funcs | sed -e 's/random//'`" - LIBOBJS="$LIBOBJS random.o" - vars="`echo $vars | sed -e 's/sys_siglist//'`" - checkfuncs="`echo $checkfuncs | sed -e 's/strsignal//' -e 's/psignal//'`" - fi - ;; - - *-*-mingw32*) - # Under mingw32, sys_nerr and sys_errlist exist, but they are - # macros, so the test below won't find them. - libiberty_cv_var_sys_nerr=yes - libiberty_cv_var_sys_errlist=yes - ;; - - *-*-uwin*) - # Under some versions of uwin, vfork is notoriously buggy and the test - # can hang configure; on other versions, vfork exists just as a stub. - # FIXME: This should be removed once vfork in uwin's runtime is fixed. - ac_cv_func_vfork_works=no - # Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are - # macros (actually, these are imported from a DLL, but the end effect - # is the same), so the test below won't find them. - libiberty_cv_var_sys_nerr=yes - libiberty_cv_var_sys_errlist=yes - ;; - - *-*-*vms*) - # Under VMS, vfork works very different than on Unix. The standard test - # won't work, and it isn't easily adaptable. It makes more sense to - # just force it. - ac_cv_func_vfork_works=yes - ;; - - esac - - # We haven't set the list of objects yet. Use the standard autoconf - # tests. This will only work if the compiler works. - AC_PROG_CC_WORKS - AC_REPLACE_FUNCS($funcs) - libiberty_AC_FUNC_C_ALLOCA - AC_FUNC_VFORK - if test $ac_cv_func_vfork_works = no; then - LIBOBJS="$LIBOBJS vfork.o" - fi - # We only need _doprnt if we might use it to implement v*printf. - if test $ac_cv_func_vprintf != yes \ - || test $ac_cv_func_vfprintf != yes \ - || test $ac_cv_func_vsprintf != yes; then - AC_REPLACE_FUNCS(_doprnt) - else - AC_CHECK_FUNCS(_doprnt) - fi - - for v in $vars; do - AC_MSG_CHECKING([for $v]) - AC_CACHE_VAL(libiberty_cv_var_$v, - [AC_TRY_LINK([int *p;], [extern int $v []; p = $v;], - [eval "libiberty_cv_var_$v=yes"], - [eval "libiberty_cv_var_$v=no"])]) - if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then - AC_MSG_RESULT(yes) - n=HAVE_`echo $v | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - AC_DEFINE_UNQUOTED($n) - else - AC_MSG_RESULT(no) - fi - done - AC_CHECK_FUNCS($checkfuncs) - libiberty_NEED_DECLARATION(canonicalize_file_name) -fi - -# Figure out which version of pexecute to use. -case "${host}" in - *-*-mingw* | *-*-winnt*) pexecute=pex-win32.o ;; - *-*-msdosdjgpp*) pexecute=pex-djgpp.o ;; - *-*-msdos*) pexecute=pex-msdos.o ;; - *-*-os2-emx*) pexecute=pex-os2.o ;; - *) pexecute=pex-unix.o ;; -esac -AC_SUBST(pexecute) - -libiberty_AC_FUNC_STRNCMP - -# Install a library built with a cross compiler in $(tooldir) rather -# than $(libdir). -if test -z "${with_cross_host}"; then - INSTALL_DEST=libdir -else - INSTALL_DEST=tooldir -fi -AC_SUBST(INSTALL_DEST) - -# We need multilib support, but only if configuring for the target. -AC_OUTPUT(Makefile testsuite/Makefile, -[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h -if test -n "$CONFIG_FILES"; then - if test -n "${with_build_subdir}" || test -n "${with_target_subdir}"; then - # FIXME: We shouldn't need to set ac_file - ac_file=Makefile - LD="${ORIGINAL_LD_FOR_MULTILIBS}" - . ${libiberty_topdir}/config-ml.in - fi -fi], -srcdir=${srcdir} -host=${host} -target=${target} -with_target_subdir=${with_target_subdir} -with_build_subdir=${with_build_subdir} -with_multisubdir=${with_multisubdir} -ac_configure_args="--enable-multilib ${ac_configure_args}" -CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} -ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}" -libiberty_topdir=${libiberty_topdir} -) diff --git a/gnu/lib/libiberty/src/copysign.c b/gnu/lib/libiberty/src/copysign.c index d288be239eb..6793f22e8cc 100644 --- a/gnu/lib/libiberty/src/copysign.c +++ b/gnu/lib/libiberty/src/copysign.c @@ -132,8 +132,7 @@ typedef union #if defined(__IEEE_BIG_ENDIAN) || defined(__IEEE_LITTLE_ENDIAN) double -copysign (x, y) - double x, y; +copysign (double x, double y) { __ieee_double_shape_type a,b; b.value = y; @@ -145,8 +144,7 @@ copysign (x, y) #else double -copysign (x, y) - double x, y; +copysign (double x, double y) { if ((x < 0 && y > 0) || (x > 0 && y < 0)) return -x; diff --git a/gnu/lib/libiberty/src/cp-demangle.c b/gnu/lib/libiberty/src/cp-demangle.c index 5dcce5560ee..b5bfd953769 100644 --- a/gnu/lib/libiberty/src/cp-demangle.c +++ b/gnu/lib/libiberty/src/cp-demangle.c @@ -1,10 +1,10 @@ -/* Demangler for IA64 / g++ V3 ABI. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. - Written by Alex Samuel <samuel@codesourcery.com>. +/* Demangler for g++ V3 ABI. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + Written by Ian Lance Taylor <ian@wasabisystems.com>. - This file is part of GNU CC. + This file is part of the libiberty library, which is part of GCC. - This program is free software; you can redistribute it and/or modify + This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. @@ -25,3786 +25,3982 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -/* This file implements demangling of C++ names mangled according to - the IA64 / g++ V3 ABI. Use the cp_demangle function to - demangle a mangled name, or compile with the preprocessor macro - STANDALONE_DEMANGLER defined to create a demangling filter - executable (functionally similar to c++filt, but includes this - demangler only). */ +/* This code implements a demangler for the g++ V3 ABI. The ABI is + described on this web page: + http://www.codesourcery.com/cxx-abi/abi.html#mangling + + This code was written while looking at the demangler written by + Alex Samuel <samuel@codesourcery.com>. + + This code first pulls the mangled name apart into a list of + components, and then walks the list generating the demangled + name. + + This file will normally define the following functions, q.v.: + char *cplus_demangle_v3(const char *mangled, int options) + char *java_demangle_v3(const char *mangled) + enum gnu_v3_ctor_kinds is_gnu_v3_mangled_ctor (const char *name) + enum gnu_v3_dtor_kinds is_gnu_v3_mangled_dtor (const char *name) + + Also, the interface to the component list is public, and defined in + demangle.h. The interface consists of these types, which are + defined in demangle.h: + enum demangle_component_type + struct demangle_component + and these functions defined in this file: + cplus_demangle_fill_name + cplus_demangle_fill_extended_operator + cplus_demangle_fill_ctor + cplus_demangle_fill_dtor + cplus_demangle_print + and other functions defined in the file cp-demint.c. + + This file also defines some other functions and variables which are + only to be used by the file cp-demint.c. + + Preprocessor macros you can define while compiling this file: + + IN_LIBGCC2 + If defined, this file defines the following function, q.v.: + char *__cxa_demangle (const char *mangled, char *buf, size_t *len, + int *status) + instead of cplus_demangle_v3() and java_demangle_v3(). + + IN_GLIBCPP_V3 + If defined, this file defines only __cxa_demangle(), and no other + publically visible functions or variables. + + STANDALONE_DEMANGLER + If defined, this file defines a main() function which demangles + any arguments, or, if none, demangles stdin. + + CP_DEMANGLE_DEBUG + If defined, turns on debugging mode, which prints information on + stdout about the mangled string. This is not generally useful. +*/ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include <sys/types.h> +#include <stdio.h> #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif - -#include <stdio.h> - #ifdef HAVE_STRING_H #include <string.h> #endif -#include <ctype.h> - #include "ansidecl.h" #include "libiberty.h" -#include "dyn-string.h" #include "demangle.h" +#include "cp-demangle.h" -/* If CP_DEMANGLE_DEBUG is defined, a trace of the grammar evaluation, - and other debugging output, will be generated. */ -#ifdef CP_DEMANGLE_DEBUG -#define DEMANGLE_TRACE(PRODUCTION, DM) \ - fprintf (stderr, " -> %-24s at position %3d\n", \ - (PRODUCTION), current_position (DM)); -#else -#define DEMANGLE_TRACE(PRODUCTION, DM) -#endif +/* If IN_GLIBCPP_V3 is defined, some functions are made static. We + also rename them via #define to avoid compiler errors when the + static definition conflicts with the extern declaration in a header + file. */ +#ifdef IN_GLIBCPP_V3 -/* Don't include <ctype.h>, to prevent additional unresolved symbols - from being dragged into the C++ runtime library. */ -#define IS_DIGIT(CHAR) ((CHAR) >= '0' && (CHAR) <= '9') -#define IS_ALPHA(CHAR) \ - (((CHAR) >= 'a' && (CHAR) <= 'z') \ - || ((CHAR) >= 'A' && (CHAR) <= 'Z')) +#define CP_STATIC_IF_GLIBCPP_V3 static -/* The prefix prepended by GCC to an identifier represnting the - anonymous namespace. */ -#define ANONYMOUS_NAMESPACE_PREFIX "_GLOBAL_" +#define cplus_demangle_fill_name d_fill_name +static int d_fill_name (struct demangle_component *, const char *, int); -/* Character(s) to use for namespace separation in demangled output */ -#define NAMESPACE_SEPARATOR (dm->style == DMGL_JAVA ? "." : "::") +#define cplus_demangle_fill_extended_operator d_fill_extended_operator +static int +d_fill_extended_operator (struct demangle_component *, int, + struct demangle_component *); -/* If flag_verbose is zero, some simplifications will be made to the - output to make it easier to read and supress details that are - generally not of interest to the average C++ programmer. - Otherwise, the demangled representation will attempt to convey as - much information as the mangled form. */ -static int flag_verbose; +#define cplus_demangle_fill_ctor d_fill_ctor +static int +d_fill_ctor (struct demangle_component *, enum gnu_v3_ctor_kinds, + struct demangle_component *); -/* If flag_strict is non-zero, demangle strictly according to the - specification -- don't demangle special g++ manglings. */ -static int flag_strict; +#define cplus_demangle_fill_dtor d_fill_dtor +static int +d_fill_dtor (struct demangle_component *, enum gnu_v3_dtor_kinds, + struct demangle_component *); -/* String_list_t is an extended form of dyn_string_t which provides a - link field and a caret position for additions to the string. A - string_list_t may safely be cast to and used as a dyn_string_t. */ +#define cplus_demangle_mangled_name d_mangled_name +static struct demangle_component *d_mangled_name (struct d_info *, int); -struct string_list_def -{ - /* The dyn_string; must be first. */ - struct dyn_string string; +#define cplus_demangle_type d_type +static struct demangle_component *d_type (struct d_info *); - /* The position at which additional text is added to this string - (using the result_add* macros). This value is an offset from the - end of the string, not the beginning (and should be - non-positive). */ - int caret_position; +#define cplus_demangle_print d_print +static char *d_print (int, const struct demangle_component *, int, size_t *); - /* The next string in the list. */ - struct string_list_def *next; -}; +#define cplus_demangle_init_info d_init_info +static void d_init_info (const char *, int, size_t, struct d_info *); + +#else /* ! defined(IN_GLIBCPP_V3) */ +#define CP_STATIC_IF_GLIBCPP_V3 +#endif /* ! defined(IN_GLIBCPP_V3) */ + +/* See if the compiler supports dynamic arrays. */ + +#ifdef __GNUC__ +#define CP_DYNAMIC_ARRAYS +#else +#ifdef __STDC__ +#ifdef __STDC_VERSION__ +#if __STDC_VERSION__ >= 199901L +#define CP_DYNAMIC_ARRAYS +#endif /* __STDC__VERSION >= 199901L */ +#endif /* defined (__STDC_VERSION__) */ +#endif /* defined (__STDC__) */ +#endif /* ! defined (__GNUC__) */ + +/* We avoid pulling in the ctype tables, to prevent pulling in + additional unresolved symbols when this code is used in a library. + FIXME: Is this really a valid reason? This comes from the original + V3 demangler code. + + As of this writing this file has the following undefined references + when compiled with -DIN_GLIBCPP_V3: malloc, realloc, free, memcpy, + strcpy, strcat, strlen. */ + +#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') +#define IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z') +#define IS_LOWER(c) ((c) >= 'a' && (c) <= 'z') -typedef struct string_list_def *string_list_t; +/* The prefix prepended by GCC to an identifier represnting the + anonymous namespace. */ +#define ANONYMOUS_NAMESPACE_PREFIX "_GLOBAL_" +#define ANONYMOUS_NAMESPACE_PREFIX_LEN \ + (sizeof (ANONYMOUS_NAMESPACE_PREFIX) - 1) -/* Data structure representing a potential substitution. */ +/* Information we keep for the standard substitutions. */ -struct substitution_def +struct d_standard_sub_info { - /* The demangled text of the substitution. */ - dyn_string_t text; + /* The code for this substitution. */ + char code; + /* The simple string it expands to. */ + const char *simple_expansion; + /* The length of the simple expansion. */ + int simple_len; + /* The results of a full, verbose, expansion. This is used when + qualifying a constructor/destructor, or when in verbose mode. */ + const char *full_expansion; + /* The length of the full expansion. */ + int full_len; + /* What to set the last_name field of d_info to; NULL if we should + not set it. This is only relevant when qualifying a + constructor/destructor. */ + const char *set_last_name; + /* The length of set_last_name. */ + int set_last_name_len; +}; + +/* Accessors for subtrees of struct demangle_component. */ - /* Whether this substitution represents a template item. */ - int template_p : 1; +#define d_left(dc) ((dc)->u.s_binary.left) +#define d_right(dc) ((dc)->u.s_binary.right) + +/* A list of templates. This is used while printing. */ + +struct d_print_template +{ + /* Next template on the list. */ + struct d_print_template *next; + /* This template. */ + const struct demangle_component *template_decl; }; -/* Data structure representing a template argument list. */ +/* A list of type modifiers. This is used while printing. */ -struct template_arg_list_def +struct d_print_mod { - /* The next (lower) template argument list in the stack of currently - active template arguments. */ - struct template_arg_list_def *next; + /* Next modifier on the list. These are in the reverse of the order + in which they appeared in the mangled string. */ + struct d_print_mod *next; + /* The modifier. */ + const struct demangle_component *mod; + /* Whether this modifier was printed. */ + int printed; + /* The list of templates which applies to this modifier. */ + struct d_print_template *templates; +}; - /* The first element in the list of template arguments in - left-to-right order. */ - string_list_t first_argument; +/* We use this structure to hold information during printing. */ - /* The last element in the arguments lists. */ - string_list_t last_argument; +struct d_print_info +{ + /* The options passed to the demangler. */ + int options; + /* Buffer holding the result. */ + char *buf; + /* Current length of data in buffer. */ + size_t len; + /* Allocated size of buffer. */ + size_t alc; + /* The current list of templates, if any. */ + struct d_print_template *templates; + /* The current list of modifiers (e.g., pointer, reference, etc.), + if any. */ + struct d_print_mod *modifiers; + /* Set to 1 if we had a memory allocation failure. */ + int allocation_failure; }; -typedef struct template_arg_list_def *template_arg_list_t; +#define d_print_saw_error(dpi) ((dpi)->buf == NULL) -/* Data structure to maintain the state of the current demangling. */ +#define d_append_char(dpi, c) \ + do \ + { \ + if ((dpi)->buf != NULL && (dpi)->len < (dpi)->alc) \ + (dpi)->buf[(dpi)->len++] = (c); \ + else \ + d_print_append_char ((dpi), (c)); \ + } \ + while (0) -struct demangling_def -{ - /* The full mangled name being mangled. */ - const char *name; +#define d_append_buffer(dpi, s, l) \ + do \ + { \ + if ((dpi)->buf != NULL && (dpi)->len + (l) <= (dpi)->alc) \ + { \ + memcpy ((dpi)->buf + (dpi)->len, (s), (l)); \ + (dpi)->len += l; \ + } \ + else \ + d_print_append_buffer ((dpi), (s), (l)); \ + } \ + while (0) - /* Pointer into name at the current position. */ - const char *next; +#define d_append_string_constant(dpi, s) \ + d_append_buffer (dpi, (s), sizeof (s) - 1) - /* Stack for strings containing demangled result generated so far. - Text is emitted to the topmost (first) string. */ - string_list_t result; +#define d_last_char(dpi) \ + ((dpi)->buf == NULL || (dpi)->len == 0 ? '\0' : (dpi)->buf[(dpi)->len - 1]) - /* The number of presently available substitutions. */ - int num_substitutions; +#ifdef CP_DEMANGLE_DEBUG +static void d_dump (struct demangle_component *, int); +#endif - /* The allocated size of the substitutions array. */ - int substitutions_allocated; +static struct demangle_component * +d_make_empty (struct d_info *); - /* An array of available substitutions. The number of elements in - the array is given by num_substitions, and the allocated array - size in substitutions_size. +static struct demangle_component * +d_make_comp (struct d_info *, enum demangle_component_type, + struct demangle_component *, + struct demangle_component *); - The most recent substition is at the end, so +static struct demangle_component * +d_make_name (struct d_info *, const char *, int); - - `S_' corresponds to substititutions[num_substitutions - 1] - - `S0_' corresponds to substititutions[num_substitutions - 2] +static struct demangle_component * +d_make_builtin_type (struct d_info *, + const struct demangle_builtin_type_info *); - etc. */ - struct substitution_def *substitutions; +static struct demangle_component * +d_make_operator (struct d_info *, + const struct demangle_operator_info *); - /* The stack of template argument lists. */ - template_arg_list_t template_arg_lists; +static struct demangle_component * +d_make_extended_operator (struct d_info *, int, + struct demangle_component *); - /* The most recently demangled source-name. */ - dyn_string_t last_source_name; - - /* Language style to use for demangled output. */ - int style; +static struct demangle_component * +d_make_ctor (struct d_info *, enum gnu_v3_ctor_kinds, + struct demangle_component *); - /* Set to non-zero iff this name is a constructor. The actual value - indicates what sort of constructor this is; see demangle.h. */ - enum gnu_v3_ctor_kinds is_constructor; +static struct demangle_component * +d_make_dtor (struct d_info *, enum gnu_v3_dtor_kinds, + struct demangle_component *); - /* Set to non-zero iff this name is a destructor. The actual value - indicates what sort of destructor this is; see demangle.h. */ - enum gnu_v3_dtor_kinds is_destructor; +static struct demangle_component * +d_make_template_param (struct d_info *, long); -}; +static struct demangle_component * +d_make_sub (struct d_info *, const char *, int); -typedef struct demangling_def *demangling_t; - -/* This type is the standard return code from most functions. Values - other than STATUS_OK contain descriptive messages. */ -typedef const char *status_t; - -/* Special values that can be used as a status_t. */ -#define STATUS_OK NULL -#define STATUS_ERROR "Error." -#define STATUS_UNIMPLEMENTED "Unimplemented." -#define STATUS_INTERNAL_ERROR "Internal error." - -/* This status code indicates a failure in malloc or realloc. */ -static const char *const status_allocation_failed = "Allocation failed."; -#define STATUS_ALLOCATION_FAILED status_allocation_failed - -/* Non-zero if STATUS indicates that no error has occurred. */ -#define STATUS_NO_ERROR(STATUS) ((STATUS) == STATUS_OK) - -/* Evaluate EXPR, which must produce a status_t. If the status code - indicates an error, return from the current function with that - status code. */ -#define RETURN_IF_ERROR(EXPR) \ - do \ - { \ - status_t s = EXPR; \ - if (!STATUS_NO_ERROR (s)) \ - return s; \ - } \ - while (0) +static int +has_return_type (struct demangle_component *); -static status_t int_to_dyn_string - PARAMS ((int, dyn_string_t)); -static string_list_t string_list_new - PARAMS ((int)); -static void string_list_delete - PARAMS ((string_list_t)); -static status_t result_add_separated_char - PARAMS ((demangling_t, int)); -static status_t result_push - PARAMS ((demangling_t)); -static string_list_t result_pop - PARAMS ((demangling_t)); -static int substitution_start - PARAMS ((demangling_t)); -static status_t substitution_add - PARAMS ((demangling_t, int, int)); -static dyn_string_t substitution_get - PARAMS ((demangling_t, int, int *)); -#ifdef CP_DEMANGLE_DEBUG -static void substitutions_print - PARAMS ((demangling_t, FILE *)); -#endif -static template_arg_list_t template_arg_list_new - PARAMS ((void)); -static void template_arg_list_delete - PARAMS ((template_arg_list_t)); -static void template_arg_list_add_arg - PARAMS ((template_arg_list_t, string_list_t)); -static string_list_t template_arg_list_get_arg - PARAMS ((template_arg_list_t, int)); -static void push_template_arg_list - PARAMS ((demangling_t, template_arg_list_t)); -static void pop_to_template_arg_list - PARAMS ((demangling_t, template_arg_list_t)); -#ifdef CP_DEMANGLE_DEBUG -static void template_arg_list_print - PARAMS ((template_arg_list_t, FILE *)); -#endif -static template_arg_list_t current_template_arg_list - PARAMS ((demangling_t)); -static demangling_t demangling_new - PARAMS ((const char *, int)); -static void demangling_delete - PARAMS ((demangling_t)); - -/* The last character of DS. Warning: DS is evaluated twice. */ -#define dyn_string_last_char(DS) \ - (dyn_string_buf (DS)[dyn_string_length (DS) - 1]) - -/* Append a space character (` ') to DS if it does not already end - with one. Evaluates to 1 on success, or 0 on allocation failure. */ -#define dyn_string_append_space(DS) \ - ((dyn_string_length (DS) > 0 \ - && dyn_string_last_char (DS) != ' ') \ - ? dyn_string_append_char ((DS), ' ') \ - : 1) - -/* Returns the index of the current position in the mangled name. */ -#define current_position(DM) ((DM)->next - (DM)->name) - -/* Returns the character at the current position of the mangled name. */ -#define peek_char(DM) (*((DM)->next)) - -/* Returns the character one past the current position of the mangled - name. */ -#define peek_char_next(DM) \ - (peek_char (DM) == '\0' ? '\0' : (*((DM)->next + 1))) - -/* Returns the character at the current position, and advances the - current position to the next character. */ -#define next_char(DM) (*((DM)->next)++) - -/* Returns non-zero if the current position is the end of the mangled - name, i.e. one past the last character. */ -#define end_of_name_p(DM) (peek_char (DM) == '\0') - -/* Advances the current position by one character. */ -#define advance_char(DM) (++(DM)->next) - -/* Returns the string containing the current demangled result. */ -#define result_string(DM) (&(DM)->result->string) - -/* Returns the position at which new text is inserted into the - demangled result. */ -#define result_caret_pos(DM) \ - (result_length (DM) + \ - ((string_list_t) result_string (DM))->caret_position) - -/* Adds a dyn_string_t to the demangled result. */ -#define result_add_string(DM, STRING) \ - (dyn_string_insert (&(DM)->result->string, \ - result_caret_pos (DM), (STRING)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Adds NUL-terminated string CSTR to the demangled result. */ -#define result_add(DM, CSTR) \ - (dyn_string_insert_cstr (&(DM)->result->string, \ - result_caret_pos (DM), (CSTR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Adds character CHAR to the demangled result. */ -#define result_add_char(DM, CHAR) \ - (dyn_string_insert_char (&(DM)->result->string, \ - result_caret_pos (DM), (CHAR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Inserts a dyn_string_t to the demangled result at position POS. */ -#define result_insert_string(DM, POS, STRING) \ - (dyn_string_insert (&(DM)->result->string, (POS), (STRING)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Inserts NUL-terminated string CSTR to the demangled result at - position POS. */ -#define result_insert(DM, POS, CSTR) \ - (dyn_string_insert_cstr (&(DM)->result->string, (POS), (CSTR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Inserts character CHAR to the demangled result at position POS. */ -#define result_insert_char(DM, POS, CHAR) \ - (dyn_string_insert_char (&(DM)->result->string, (POS), (CHAR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* The length of the current demangled result. */ -#define result_length(DM) \ - dyn_string_length (&(DM)->result->string) - -/* Appends a (less-than, greater-than) character to the result in DM - to (open, close) a template argument or parameter list. Appends a - space first if necessary to prevent spurious elision of angle - brackets with the previous character. */ -#define result_open_template_list(DM) result_add_separated_char(DM, '<') -#define result_close_template_list(DM) result_add_separated_char(DM, '>') - -/* Appends a base 10 representation of VALUE to DS. STATUS_OK on - success. On failure, deletes DS and returns an error code. */ - -static status_t -int_to_dyn_string (value, ds) - int value; - dyn_string_t ds; -{ - int i; - int mask = 1; +static int +is_ctor_dtor_or_conversion (struct demangle_component *); - /* Handle zero up front. */ - if (value == 0) - { - if (!dyn_string_append_char (ds, '0')) - return STATUS_ALLOCATION_FAILED; - return STATUS_OK; - } +static struct demangle_component *d_encoding (struct d_info *, int); - /* For negative numbers, emit a minus sign. */ - if (value < 0) - { - if (!dyn_string_append_char (ds, '-')) - return STATUS_ALLOCATION_FAILED; - value = -value; - } - - /* Find the power of 10 of the first digit. */ - i = value; - while (i > 9) - { - mask *= 10; - i /= 10; - } +static struct demangle_component *d_name (struct d_info *); - /* Write the digits. */ - while (mask > 0) - { - int digit = value / mask; +static struct demangle_component *d_nested_name (struct d_info *); - if (!dyn_string_append_char (ds, '0' + digit)) - return STATUS_ALLOCATION_FAILED; +static struct demangle_component *d_prefix (struct d_info *); - value -= digit * mask; - mask /= 10; - } +static struct demangle_component *d_unqualified_name (struct d_info *); - return STATUS_OK; -} +static struct demangle_component *d_source_name (struct d_info *); -/* Creates a new string list node. The contents of the string are - empty, but the initial buffer allocation is LENGTH. The string - list node should be deleted with string_list_delete. Returns NULL - if allocation fails. */ +static long d_number (struct d_info *); -static string_list_t -string_list_new (length) - int length; -{ - string_list_t s = (string_list_t) malloc (sizeof (struct string_list_def)); - s->caret_position = 0; - if (s == NULL) - return NULL; - if (!dyn_string_init ((dyn_string_t) s, length)) - return NULL; - return s; -} +static struct demangle_component *d_identifier (struct d_info *, int); -/* Deletes the entire string list starting at NODE. */ +static struct demangle_component *d_operator_name (struct d_info *); -static void -string_list_delete (node) - string_list_t node; -{ - while (node != NULL) - { - string_list_t next = node->next; - dyn_string_delete ((dyn_string_t) node); - node = next; - } -} +static struct demangle_component *d_special_name (struct d_info *); -/* Appends CHARACTER to the demangled result. If the current trailing - character of the result is CHARACTER, a space is inserted first. */ +static int d_call_offset (struct d_info *, int); -static status_t -result_add_separated_char (dm, character) - demangling_t dm; - int character; -{ - char *result = dyn_string_buf (result_string (dm)); - int caret_pos = result_caret_pos (dm); +static struct demangle_component *d_ctor_dtor_name (struct d_info *); - /* Add a space if the last character is already the character we - want to add. */ - if (caret_pos > 0 && result[caret_pos - 1] == character) - RETURN_IF_ERROR (result_add_char (dm, ' ')); - /* Add the character. */ - RETURN_IF_ERROR (result_add_char (dm, character)); +static struct demangle_component ** +d_cv_qualifiers (struct d_info *, struct demangle_component **, int); - return STATUS_OK; -} +static struct demangle_component * +d_function_type (struct d_info *); -/* Allocates and pushes a new string onto the demangled results stack - for DM. Subsequent demangling with DM will emit to the new string. - Returns STATUS_OK on success, STATUS_ALLOCATION_FAILED on - allocation failure. */ +static struct demangle_component * +d_bare_function_type (struct d_info *, int); -static status_t -result_push (dm) - demangling_t dm; -{ - string_list_t new_string = string_list_new (0); - if (new_string == NULL) - /* Allocation failed. */ - return STATUS_ALLOCATION_FAILED; - - /* Link the new string to the front of the list of result strings. */ - new_string->next = (string_list_t) dm->result; - dm->result = new_string; - return STATUS_OK; -} +static struct demangle_component * +d_class_enum_type (struct d_info *); -/* Removes and returns the topmost element on the demangled results - stack for DM. The caller assumes ownership for the returned - string. */ +static struct demangle_component *d_array_type (struct d_info *); -static string_list_t -result_pop (dm) - demangling_t dm; -{ - string_list_t top = dm->result; - dm->result = top->next; - return top; -} +static struct demangle_component * +d_pointer_to_member_type (struct d_info *); -/* Returns the current value of the caret for the result string. The - value is an offet from the end of the result string. */ +static struct demangle_component * +d_template_param (struct d_info *); -static int -result_get_caret (dm) - demangling_t dm; -{ - return ((string_list_t) result_string (dm))->caret_position; -} +static struct demangle_component *d_template_args (struct d_info *); -/* Sets the value of the caret for the result string, counted as an - offet from the end of the result string. */ +static struct demangle_component * +d_template_arg (struct d_info *); -static void -result_set_caret (dm, position) - demangling_t dm; - int position; -{ - ((string_list_t) result_string (dm))->caret_position = position; -} +static struct demangle_component *d_expression (struct d_info *); -/* Shifts the position of the next addition to the result by - POSITION_OFFSET. A negative value shifts the caret to the left. */ +static struct demangle_component *d_expr_primary (struct d_info *); -static void -result_shift_caret (dm, position_offset) - demangling_t dm; - int position_offset; -{ - ((string_list_t) result_string (dm))->caret_position += position_offset; -} +static struct demangle_component *d_local_name (struct d_info *); -/* Returns non-zero if the character that comes right before the place - where text will be added to the result is a space. In this case, - the caller should supress adding another space. */ +static int d_discriminator (struct d_info *); static int -result_previous_char_is_space (dm) - demangling_t dm; -{ - char *result = dyn_string_buf (result_string (dm)); - int pos = result_caret_pos (dm); - return pos > 0 && result[pos - 1] == ' '; -} +d_add_substitution (struct d_info *, struct demangle_component *); -/* Returns the start position of a fragment of the demangled result - that will be a substitution candidate. Should be called at the - start of productions that can add substitutions. */ +static struct demangle_component *d_substitution (struct d_info *, int); -static int -substitution_start (dm) - demangling_t dm; -{ - return result_caret_pos (dm); -} +static void d_print_resize (struct d_print_info *, size_t); -/* Adds the suffix of the current demangled result of DM starting at - START_POSITION as a potential substitution. If TEMPLATE_P is - non-zero, this potential substitution is a template-id. */ +static void d_print_append_char (struct d_print_info *, int); -static status_t -substitution_add (dm, start_position, template_p) - demangling_t dm; - int start_position; - int template_p; -{ - dyn_string_t result = result_string (dm); - dyn_string_t substitution = dyn_string_new (0); - int i; +static void +d_print_append_buffer (struct d_print_info *, const char *, size_t); - if (substitution == NULL) - return STATUS_ALLOCATION_FAILED; +static void d_print_error (struct d_print_info *); - /* Extract the substring of the current demangling result that - represents the subsitution candidate. */ - if (!dyn_string_substring (substitution, - result, start_position, result_caret_pos (dm))) - { - dyn_string_delete (substitution); - return STATUS_ALLOCATION_FAILED; - } +static void +d_print_comp (struct d_print_info *, const struct demangle_component *); - /* If there's no room for the new entry, grow the array. */ - if (dm->substitutions_allocated == dm->num_substitutions) - { - size_t new_array_size; - if (dm->substitutions_allocated > 0) - dm->substitutions_allocated *= 2; - else - dm->substitutions_allocated = 2; - new_array_size = - sizeof (struct substitution_def) * dm->substitutions_allocated; - - dm->substitutions = (struct substitution_def *) - realloc (dm->substitutions, new_array_size); - if (dm->substitutions == NULL) - /* Realloc failed. */ - { - dyn_string_delete (substitution); - return STATUS_ALLOCATION_FAILED; - } - } +static void +d_print_java_identifier (struct d_print_info *, const char *, int); - /* Add the substitution to the array. */ - i = dm->num_substitutions++; - dm->substitutions[i].text = substitution; - dm->substitutions[i].template_p = template_p; +static void +d_print_mod_list (struct d_print_info *, struct d_print_mod *, int); -#ifdef CP_DEMANGLE_DEBUG - substitutions_print (dm, stderr); -#endif +static void +d_print_mod (struct d_print_info *, const struct demangle_component *); - return STATUS_OK; -} +static void +d_print_function_type (struct d_print_info *, + const struct demangle_component *, + struct d_print_mod *); -/* Returns the Nth-most-recent substitution. Sets *TEMPLATE_P to - non-zero if the substitution is a template-id, zero otherwise. - N is numbered from zero. DM retains ownership of the returned - string. If N is negative, or equal to or greater than the current - number of substitution candidates, returns NULL. */ - -static dyn_string_t -substitution_get (dm, n, template_p) - demangling_t dm; - int n; - int *template_p; -{ - struct substitution_def *sub; +static void +d_print_array_type (struct d_print_info *, + const struct demangle_component *, + struct d_print_mod *); - /* Make sure N is in the valid range. */ - if (n < 0 || n >= dm->num_substitutions) - return NULL; +static void +d_print_expr_op (struct d_print_info *, const struct demangle_component *); - sub = &(dm->substitutions[n]); - *template_p = sub->template_p; - return sub->text; -} +static void +d_print_cast (struct d_print_info *, const struct demangle_component *); + +static char *d_demangle (const char *, int, size_t *); #ifdef CP_DEMANGLE_DEBUG -/* Debugging routine to print the current substitutions to FP. */ static void -substitutions_print (dm, fp) - demangling_t dm; - FILE *fp; +d_dump (struct demangle_component *dc, int indent) { - int seq_id; - int num = dm->num_substitutions; + int i; - fprintf (fp, "SUBSTITUTIONS:\n"); - for (seq_id = -1; seq_id < num - 1; ++seq_id) - { - int template_p; - dyn_string_t text = substitution_get (dm, seq_id + 1, &template_p); + if (dc == NULL) + return; - if (seq_id == -1) - fprintf (fp, " S_ "); - else - fprintf (fp, " S%d_", seq_id); - fprintf (fp, " %c: %s\n", template_p ? '*' : ' ', dyn_string_buf (text)); + for (i = 0; i < indent; ++i) + putchar (' '); + + switch (dc->type) + { + case DEMANGLE_COMPONENT_NAME: + printf ("name '%.*s'\n", dc->u.s_name.len, dc->u.s_name.s); + return; + case DEMANGLE_COMPONENT_TEMPLATE_PARAM: + printf ("template parameter %ld\n", dc->u.s_number.number); + return; + case DEMANGLE_COMPONENT_CTOR: + printf ("constructor %d\n", (int) dc->u.s_ctor.kind); + d_dump (dc->u.s_ctor.name, indent + 2); + return; + case DEMANGLE_COMPONENT_DTOR: + printf ("destructor %d\n", (int) dc->u.s_dtor.kind); + d_dump (dc->u.s_dtor.name, indent + 2); + return; + case DEMANGLE_COMPONENT_SUB_STD: + printf ("standard substitution %s\n", dc->u.s_string.string); + return; + case DEMANGLE_COMPONENT_BUILTIN_TYPE: + printf ("builtin type %s\n", dc->u.s_builtin.type->name); + return; + case DEMANGLE_COMPONENT_OPERATOR: + printf ("operator %s\n", dc->u.s_operator.op->name); + return; + case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: + printf ("extended operator with %d args\n", + dc->u.s_extended_operator.args); + d_dump (dc->u.s_extended_operator.name, indent + 2); + return; + + case DEMANGLE_COMPONENT_QUAL_NAME: + printf ("qualified name\n"); + break; + case DEMANGLE_COMPONENT_LOCAL_NAME: + printf ("local name\n"); + break; + case DEMANGLE_COMPONENT_TYPED_NAME: + printf ("typed name\n"); + break; + case DEMANGLE_COMPONENT_TEMPLATE: + printf ("template\n"); + break; + case DEMANGLE_COMPONENT_VTABLE: + printf ("vtable\n"); + break; + case DEMANGLE_COMPONENT_VTT: + printf ("VTT\n"); + break; + case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE: + printf ("construction vtable\n"); + break; + case DEMANGLE_COMPONENT_TYPEINFO: + printf ("typeinfo\n"); + break; + case DEMANGLE_COMPONENT_TYPEINFO_NAME: + printf ("typeinfo name\n"); + break; + case DEMANGLE_COMPONENT_TYPEINFO_FN: + printf ("typeinfo function\n"); + break; + case DEMANGLE_COMPONENT_THUNK: + printf ("thunk\n"); + break; + case DEMANGLE_COMPONENT_VIRTUAL_THUNK: + printf ("virtual thunk\n"); + break; + case DEMANGLE_COMPONENT_COVARIANT_THUNK: + printf ("covariant thunk\n"); + break; + case DEMANGLE_COMPONENT_JAVA_CLASS: + printf ("java class\n"); + break; + case DEMANGLE_COMPONENT_GUARD: + printf ("guard\n"); + break; + case DEMANGLE_COMPONENT_REFTEMP: + printf ("reference temporary\n"); + break; + case DEMANGLE_COMPONENT_HIDDEN_ALIAS: + printf ("hidden alias\n"); + break; + case DEMANGLE_COMPONENT_RESTRICT: + printf ("restrict\n"); + break; + case DEMANGLE_COMPONENT_VOLATILE: + printf ("volatile\n"); + break; + case DEMANGLE_COMPONENT_CONST: + printf ("const\n"); + break; + case DEMANGLE_COMPONENT_RESTRICT_THIS: + printf ("restrict this\n"); + break; + case DEMANGLE_COMPONENT_VOLATILE_THIS: + printf ("volatile this\n"); + break; + case DEMANGLE_COMPONENT_CONST_THIS: + printf ("const this\n"); + break; + case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: + printf ("vendor type qualifier\n"); + break; + case DEMANGLE_COMPONENT_POINTER: + printf ("pointer\n"); + break; + case DEMANGLE_COMPONENT_REFERENCE: + printf ("reference\n"); + break; + case DEMANGLE_COMPONENT_COMPLEX: + printf ("complex\n"); + break; + case DEMANGLE_COMPONENT_IMAGINARY: + printf ("imaginary\n"); + break; + case DEMANGLE_COMPONENT_VENDOR_TYPE: + printf ("vendor type\n"); + break; + case DEMANGLE_COMPONENT_FUNCTION_TYPE: + printf ("function type\n"); + break; + case DEMANGLE_COMPONENT_ARRAY_TYPE: + printf ("array type\n"); + break; + case DEMANGLE_COMPONENT_PTRMEM_TYPE: + printf ("pointer to member type\n"); + break; + case DEMANGLE_COMPONENT_ARGLIST: + printf ("argument list\n"); + break; + case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST: + printf ("template argument list\n"); + break; + case DEMANGLE_COMPONENT_CAST: + printf ("cast\n"); + break; + case DEMANGLE_COMPONENT_UNARY: + printf ("unary operator\n"); + break; + case DEMANGLE_COMPONENT_BINARY: + printf ("binary operator\n"); + break; + case DEMANGLE_COMPONENT_BINARY_ARGS: + printf ("binary operator arguments\n"); + break; + case DEMANGLE_COMPONENT_TRINARY: + printf ("trinary operator\n"); + break; + case DEMANGLE_COMPONENT_TRINARY_ARG1: + printf ("trinary operator arguments 1\n"); + break; + case DEMANGLE_COMPONENT_TRINARY_ARG2: + printf ("trinary operator arguments 1\n"); + break; + case DEMANGLE_COMPONENT_LITERAL: + printf ("literal\n"); + break; + case DEMANGLE_COMPONENT_LITERAL_NEG: + printf ("negative literal\n"); + break; } + + d_dump (d_left (dc), indent + 2); + d_dump (d_right (dc), indent + 2); } #endif /* CP_DEMANGLE_DEBUG */ -/* Creates a new template argument list. Returns NULL if allocation - fails. */ +/* Fill in a DEMANGLE_COMPONENT_NAME. */ -static template_arg_list_t -template_arg_list_new () +CP_STATIC_IF_GLIBCPP_V3 +int +cplus_demangle_fill_name (struct demangle_component *p, const char *s, int len) { - template_arg_list_t new_list = - (template_arg_list_t) malloc (sizeof (struct template_arg_list_def)); - if (new_list == NULL) - return NULL; - /* Initialize the new list to have no arguments. */ - new_list->first_argument = NULL; - new_list->last_argument = NULL; - /* Return the new list. */ - return new_list; + if (p == NULL || s == NULL || len == 0) + return 0; + p->type = DEMANGLE_COMPONENT_NAME; + p->u.s_name.s = s; + p->u.s_name.len = len; + return 1; } -/* Deletes a template argument list and the template arguments it - contains. */ +/* Fill in a DEMANGLE_COMPONENT_EXTENDED_OPERATOR. */ -static void -template_arg_list_delete (list) - template_arg_list_t list; +CP_STATIC_IF_GLIBCPP_V3 +int +cplus_demangle_fill_extended_operator (struct demangle_component *p, int args, + struct demangle_component *name) { - /* If there are any arguments on LIST, delete them. */ - if (list->first_argument != NULL) - string_list_delete (list->first_argument); - /* Delete LIST. */ - free (list); + if (p == NULL || args < 0 || name == NULL) + return 0; + p->type = DEMANGLE_COMPONENT_EXTENDED_OPERATOR; + p->u.s_extended_operator.args = args; + p->u.s_extended_operator.name = name; + return 1; } -/* Adds ARG to the template argument list ARG_LIST. */ +/* Fill in a DEMANGLE_COMPONENT_CTOR. */ -static void -template_arg_list_add_arg (arg_list, arg) - template_arg_list_t arg_list; - string_list_t arg; +CP_STATIC_IF_GLIBCPP_V3 +int +cplus_demangle_fill_ctor (struct demangle_component *p, + enum gnu_v3_ctor_kinds kind, + struct demangle_component *name) { - if (arg_list->first_argument == NULL) - /* If there were no arguments before, ARG is the first one. */ - arg_list->first_argument = arg; - else - /* Make ARG the last argument on the list. */ - arg_list->last_argument->next = arg; - /* Make ARG the last on the list. */ - arg_list->last_argument = arg; - arg->next = NULL; + if (p == NULL + || name == NULL + || (kind < gnu_v3_complete_object_ctor + && kind > gnu_v3_complete_object_allocating_ctor)) + return 0; + p->type = DEMANGLE_COMPONENT_CTOR; + p->u.s_ctor.kind = kind; + p->u.s_ctor.name = name; + return 1; } -/* Returns the template arugment at position INDEX in template - argument list ARG_LIST. */ +/* Fill in a DEMANGLE_COMPONENT_DTOR. */ -static string_list_t -template_arg_list_get_arg (arg_list, index) - template_arg_list_t arg_list; - int index; +CP_STATIC_IF_GLIBCPP_V3 +int +cplus_demangle_fill_dtor (struct demangle_component *p, + enum gnu_v3_dtor_kinds kind, + struct demangle_component *name) { - string_list_t arg = arg_list->first_argument; - /* Scan down the list of arguments to find the one at position - INDEX. */ - while (index--) + if (p == NULL + || name == NULL + || (kind < gnu_v3_deleting_dtor + && kind > gnu_v3_base_object_dtor)) + return 0; + p->type = DEMANGLE_COMPONENT_DTOR; + p->u.s_dtor.kind = kind; + p->u.s_dtor.name = name; + return 1; +} + +/* Add a new component. */ + +static struct demangle_component * +d_make_empty (struct d_info *di) +{ + struct demangle_component *p; + + if (di->next_comp >= di->num_comps) + return NULL; + p = &di->comps[di->next_comp]; + ++di->next_comp; + return p; +} + +/* Add a new generic component. */ + +static struct demangle_component * +d_make_comp (struct d_info *di, enum demangle_component_type type, + struct demangle_component *left, + struct demangle_component *right) +{ + struct demangle_component *p; + + /* We check for errors here. A typical error would be a NULL return + from a subroutine. We catch those here, and return NULL + upward. */ + switch (type) { - arg = arg->next; - if (arg == NULL) - /* Ran out of arguments before INDEX hit zero. That's an - error. */ + /* These types require two parameters. */ + case DEMANGLE_COMPONENT_QUAL_NAME: + case DEMANGLE_COMPONENT_LOCAL_NAME: + case DEMANGLE_COMPONENT_TYPED_NAME: + case DEMANGLE_COMPONENT_TEMPLATE: + case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE: + case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: + case DEMANGLE_COMPONENT_PTRMEM_TYPE: + case DEMANGLE_COMPONENT_UNARY: + case DEMANGLE_COMPONENT_BINARY: + case DEMANGLE_COMPONENT_BINARY_ARGS: + case DEMANGLE_COMPONENT_TRINARY: + case DEMANGLE_COMPONENT_TRINARY_ARG1: + case DEMANGLE_COMPONENT_TRINARY_ARG2: + case DEMANGLE_COMPONENT_LITERAL: + case DEMANGLE_COMPONENT_LITERAL_NEG: + if (left == NULL || right == NULL) return NULL; + break; + + /* These types only require one parameter. */ + case DEMANGLE_COMPONENT_VTABLE: + case DEMANGLE_COMPONENT_VTT: + case DEMANGLE_COMPONENT_TYPEINFO: + case DEMANGLE_COMPONENT_TYPEINFO_NAME: + case DEMANGLE_COMPONENT_TYPEINFO_FN: + case DEMANGLE_COMPONENT_THUNK: + case DEMANGLE_COMPONENT_VIRTUAL_THUNK: + case DEMANGLE_COMPONENT_COVARIANT_THUNK: + case DEMANGLE_COMPONENT_JAVA_CLASS: + case DEMANGLE_COMPONENT_GUARD: + case DEMANGLE_COMPONENT_REFTEMP: + case DEMANGLE_COMPONENT_HIDDEN_ALIAS: + case DEMANGLE_COMPONENT_POINTER: + case DEMANGLE_COMPONENT_REFERENCE: + case DEMANGLE_COMPONENT_COMPLEX: + case DEMANGLE_COMPONENT_IMAGINARY: + case DEMANGLE_COMPONENT_VENDOR_TYPE: + case DEMANGLE_COMPONENT_ARGLIST: + case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST: + case DEMANGLE_COMPONENT_CAST: + if (left == NULL) + return NULL; + break; + + /* This needs a right parameter, but the left parameter can be + empty. */ + case DEMANGLE_COMPONENT_ARRAY_TYPE: + if (right == NULL) + return NULL; + break; + + /* These are allowed to have no parameters--in some cases they + will be filled in later. */ + case DEMANGLE_COMPONENT_FUNCTION_TYPE: + case DEMANGLE_COMPONENT_RESTRICT: + case DEMANGLE_COMPONENT_VOLATILE: + case DEMANGLE_COMPONENT_CONST: + case DEMANGLE_COMPONENT_RESTRICT_THIS: + case DEMANGLE_COMPONENT_VOLATILE_THIS: + case DEMANGLE_COMPONENT_CONST_THIS: + break; + + /* Other types should not be seen here. */ + default: + return NULL; + } + + p = d_make_empty (di); + if (p != NULL) + { + p->type = type; + p->u.s_binary.left = left; + p->u.s_binary.right = right; } - /* Return the argument at position INDEX. */ - return arg; + return p; } -/* Pushes ARG_LIST onto the top of the template argument list stack. */ +/* Add a new name component. */ -static void -push_template_arg_list (dm, arg_list) - demangling_t dm; - template_arg_list_t arg_list; +static struct demangle_component * +d_make_name (struct d_info *di, const char *s, int len) { - arg_list->next = dm->template_arg_lists; - dm->template_arg_lists = arg_list; -#ifdef CP_DEMANGLE_DEBUG - fprintf (stderr, " ** pushing template arg list\n"); - template_arg_list_print (arg_list, stderr); -#endif + struct demangle_component *p; + + p = d_make_empty (di); + if (! cplus_demangle_fill_name (p, s, len)) + return NULL; + return p; } -/* Pops and deletes elements on the template argument list stack until - arg_list is the topmost element. If arg_list is NULL, all elements - are popped and deleted. */ +/* Add a new builtin type component. */ -static void -pop_to_template_arg_list (dm, arg_list) - demangling_t dm; - template_arg_list_t arg_list; +static struct demangle_component * +d_make_builtin_type (struct d_info *di, + const struct demangle_builtin_type_info *type) { - while (dm->template_arg_lists != arg_list) + struct demangle_component *p; + + if (type == NULL) + return NULL; + p = d_make_empty (di); + if (p != NULL) { - template_arg_list_t top = dm->template_arg_lists; - /* Disconnect the topmost element from the list. */ - dm->template_arg_lists = top->next; - /* Delete the popped element. */ - template_arg_list_delete (top); -#ifdef CP_DEMANGLE_DEBUG - fprintf (stderr, " ** removing template arg list\n"); -#endif + p->type = DEMANGLE_COMPONENT_BUILTIN_TYPE; + p->u.s_builtin.type = type; } + return p; } -#ifdef CP_DEMANGLE_DEBUG - -/* Prints the contents of ARG_LIST to FP. */ +/* Add a new operator component. */ -static void -template_arg_list_print (arg_list, fp) - template_arg_list_t arg_list; - FILE *fp; +static struct demangle_component * +d_make_operator (struct d_info *di, const struct demangle_operator_info *op) { - string_list_t arg; - int index = -1; + struct demangle_component *p; - fprintf (fp, "TEMPLATE ARGUMENT LIST:\n"); - for (arg = arg_list->first_argument; arg != NULL; arg = arg->next) + p = d_make_empty (di); + if (p != NULL) { - if (index == -1) - fprintf (fp, " T_ : "); - else - fprintf (fp, " T%d_ : ", index); - ++index; - fprintf (fp, "%s\n", dyn_string_buf ((dyn_string_t) arg)); + p->type = DEMANGLE_COMPONENT_OPERATOR; + p->u.s_operator.op = op; } + return p; } -#endif /* CP_DEMANGLE_DEBUG */ - -/* Returns the topmost element on the stack of template argument - lists. If there is no list of template arguments, returns NULL. */ +/* Add a new extended operator component. */ -static template_arg_list_t -current_template_arg_list (dm) - demangling_t dm; +static struct demangle_component * +d_make_extended_operator (struct d_info *di, int args, + struct demangle_component *name) { - return dm->template_arg_lists; + struct demangle_component *p; + + p = d_make_empty (di); + if (! cplus_demangle_fill_extended_operator (p, args, name)) + return NULL; + return p; } -/* Allocates a demangling_t object for demangling mangled NAME. A new - result must be pushed before the returned object can be used. - Returns NULL if allocation fails. */ +/* Add a new constructor component. */ -static demangling_t -demangling_new (name, style) - const char *name; - int style; +static struct demangle_component * +d_make_ctor (struct d_info *di, enum gnu_v3_ctor_kinds kind, + struct demangle_component *name) { - demangling_t dm; - dm = (demangling_t) malloc (sizeof (struct demangling_def)); - if (dm == NULL) - return NULL; + struct demangle_component *p; - dm->name = name; - dm->next = name; - dm->result = NULL; - dm->num_substitutions = 0; - dm->substitutions_allocated = 10; - dm->template_arg_lists = NULL; - dm->last_source_name = dyn_string_new (0); - if (dm->last_source_name == NULL) + p = d_make_empty (di); + if (! cplus_demangle_fill_ctor (p, kind, name)) return NULL; - dm->substitutions = (struct substitution_def *) - malloc (dm->substitutions_allocated * sizeof (struct substitution_def)); - if (dm->substitutions == NULL) - { - dyn_string_delete (dm->last_source_name); - return NULL; - } - dm->style = style; - dm->is_constructor = (enum gnu_v3_ctor_kinds) 0; - dm->is_destructor = (enum gnu_v3_dtor_kinds) 0; + return p; +} + +/* Add a new destructor component. */ + +static struct demangle_component * +d_make_dtor (struct d_info *di, enum gnu_v3_dtor_kinds kind, + struct demangle_component *name) +{ + struct demangle_component *p; - return dm; + p = d_make_empty (di); + if (! cplus_demangle_fill_dtor (p, kind, name)) + return NULL; + return p; } -/* Deallocates a demangling_t object and all memory associated with - it. */ +/* Add a new template parameter. */ -static void -demangling_delete (dm) - demangling_t dm; +static struct demangle_component * +d_make_template_param (struct d_info *di, long i) { - int i; - template_arg_list_t arg_list = dm->template_arg_lists; + struct demangle_component *p; - /* Delete the stack of template argument lists. */ - while (arg_list != NULL) + p = d_make_empty (di); + if (p != NULL) { - template_arg_list_t next = arg_list->next; - template_arg_list_delete (arg_list); - arg_list = next; + p->type = DEMANGLE_COMPONENT_TEMPLATE_PARAM; + p->u.s_number.number = i; } - /* Delete the list of substitutions. */ - for (i = dm->num_substitutions; --i >= 0; ) - dyn_string_delete (dm->substitutions[i].text); - free (dm->substitutions); - /* Delete the demangled result. */ - string_list_delete (dm->result); - /* Delete the stored identifier name. */ - dyn_string_delete (dm->last_source_name); - /* Delete the context object itself. */ - free (dm); + return p; } -/* These functions demangle an alternative of the corresponding - production in the mangling spec. The first argument of each is a - demangling context structure for the current demangling - operation. Most emit demangled text directly to the topmost result - string on the result string stack in the demangling context - structure. */ - -static status_t demangle_char - PARAMS ((demangling_t, int)); -static status_t demangle_mangled_name - PARAMS ((demangling_t)); -static status_t demangle_encoding - PARAMS ((demangling_t)); -static status_t demangle_name - PARAMS ((demangling_t, int *)); -static status_t demangle_nested_name - PARAMS ((demangling_t, int *)); -static status_t demangle_prefix - PARAMS ((demangling_t, int *)); -static status_t demangle_unqualified_name - PARAMS ((demangling_t, int *)); -static status_t demangle_source_name - PARAMS ((demangling_t)); -static status_t demangle_number - PARAMS ((demangling_t, int *, int, int)); -static status_t demangle_number_literally - PARAMS ((demangling_t, dyn_string_t, int, int)); -static status_t demangle_identifier - PARAMS ((demangling_t, int, dyn_string_t)); -static status_t demangle_operator_name - PARAMS ((demangling_t, int, int *, int *)); -static status_t demangle_nv_offset - PARAMS ((demangling_t)); -static status_t demangle_v_offset - PARAMS ((demangling_t)); -static status_t demangle_call_offset - PARAMS ((demangling_t)); -static status_t demangle_special_name - PARAMS ((demangling_t)); -static status_t demangle_ctor_dtor_name - PARAMS ((demangling_t)); -static status_t demangle_type_ptr - PARAMS ((demangling_t, int *, int)); -static status_t demangle_type - PARAMS ((demangling_t)); -static status_t demangle_CV_qualifiers - PARAMS ((demangling_t, dyn_string_t)); -static status_t demangle_builtin_type - PARAMS ((demangling_t)); -static status_t demangle_function_type - PARAMS ((demangling_t, int *)); -static status_t demangle_bare_function_type - PARAMS ((demangling_t, int *)); -static status_t demangle_class_enum_type - PARAMS ((demangling_t, int *)); -static status_t demangle_array_type - PARAMS ((demangling_t, int *)); -static status_t demangle_template_param - PARAMS ((demangling_t)); -static status_t demangle_template_args - PARAMS ((demangling_t)); -static status_t demangle_literal - PARAMS ((demangling_t)); -static status_t demangle_template_arg - PARAMS ((demangling_t)); -static status_t demangle_expression - PARAMS ((demangling_t)); -static status_t demangle_scope_expression - PARAMS ((demangling_t)); -static status_t demangle_expr_primary - PARAMS ((demangling_t)); -static status_t demangle_substitution - PARAMS ((demangling_t, int *)); -static status_t demangle_local_name - PARAMS ((demangling_t)); -static status_t demangle_discriminator - PARAMS ((demangling_t, int)); -static status_t cp_demangle - PARAMS ((const char *, dyn_string_t, int)); -static status_t cp_demangle_type - PARAMS ((const char*, dyn_string_t)); - -/* When passed to demangle_bare_function_type, indicates that the - function's return type is not encoded before its parameter types. */ -#define BFT_NO_RETURN_TYPE NULL - -/* Check that the next character is C. If so, consume it. If not, - return an error. */ - -static status_t -demangle_char (dm, c) - demangling_t dm; - int c; +/* Add a new standard substitution component. */ + +static struct demangle_component * +d_make_sub (struct d_info *di, const char *name, int len) { - static char *error_message = NULL; + struct demangle_component *p; - if (peek_char (dm) == c) + p = d_make_empty (di); + if (p != NULL) { - advance_char (dm); - return STATUS_OK; - } - else - { - if (error_message == NULL) - error_message = (char *) strdup ("Expected ?"); - error_message[9] = c; - return error_message; + p->type = DEMANGLE_COMPONENT_SUB_STD; + p->u.s_string.string = name; + p->u.s_string.len = len; } + return p; } -/* Demangles and emits a <mangled-name>. +/* <mangled-name> ::= _Z <encoding> - <mangled-name> ::= _Z <encoding> */ + TOP_LEVEL is non-zero when called at the top level. */ -static status_t -demangle_mangled_name (dm) - demangling_t dm; +CP_STATIC_IF_GLIBCPP_V3 +struct demangle_component * +cplus_demangle_mangled_name (struct d_info *di, int top_level) { - DEMANGLE_TRACE ("mangled-name", dm); - RETURN_IF_ERROR (demangle_char (dm, '_')); - RETURN_IF_ERROR (demangle_char (dm, 'Z')); - RETURN_IF_ERROR (demangle_encoding (dm)); - return STATUS_OK; + if (d_next_char (di) != '_') + return NULL; + if (d_next_char (di) != 'Z') + return NULL; + return d_encoding (di, top_level); } -/* Demangles and emits an <encoding>. +/* Return whether a function should have a return type. The argument + is the function name, which may be qualified in various ways. The + rules are that template functions have return types with some + exceptions, function types which are not part of a function name + mangling have return types with some exceptions, and non-template + function names do not have return types. The exceptions are that + constructors, destructors, and conversion operators do not have + return types. */ - <encoding> ::= <function name> <bare-function-type> - ::= <data name> - ::= <special-name> */ +static int +has_return_type (struct demangle_component *dc) +{ + if (dc == NULL) + return 0; + switch (dc->type) + { + default: + return 0; + case DEMANGLE_COMPONENT_TEMPLATE: + return ! is_ctor_dtor_or_conversion (d_left (dc)); + case DEMANGLE_COMPONENT_RESTRICT_THIS: + case DEMANGLE_COMPONENT_VOLATILE_THIS: + case DEMANGLE_COMPONENT_CONST_THIS: + return has_return_type (d_left (dc)); + } +} + +/* Return whether a name is a constructor, a destructor, or a + conversion operator. */ -static status_t -demangle_encoding (dm) - demangling_t dm; +static int +is_ctor_dtor_or_conversion (struct demangle_component *dc) { - int encode_return_type; - int start_position; - template_arg_list_t old_arg_list = current_template_arg_list (dm); - char peek = peek_char (dm); + if (dc == NULL) + return 0; + switch (dc->type) + { + default: + return 0; + case DEMANGLE_COMPONENT_QUAL_NAME: + case DEMANGLE_COMPONENT_LOCAL_NAME: + return is_ctor_dtor_or_conversion (d_right (dc)); + case DEMANGLE_COMPONENT_CTOR: + case DEMANGLE_COMPONENT_DTOR: + case DEMANGLE_COMPONENT_CAST: + return 1; + } +} + +/* <encoding> ::= <(function) name> <bare-function-type> + ::= <(data) name> + ::= <special-name> - DEMANGLE_TRACE ("encoding", dm); - - /* Remember where the name starts. If it turns out to be a template - function, we'll have to insert the return type here. */ - start_position = result_caret_pos (dm); + TOP_LEVEL is non-zero when called at the top level, in which case + if DMGL_PARAMS is not set we do not demangle the function + parameters. We only set this at the top level, because otherwise + we would not correctly demangle names in local scopes. */ + +static struct demangle_component * +d_encoding (struct d_info *di, int top_level) +{ + char peek = d_peek_char (di); if (peek == 'G' || peek == 'T') - RETURN_IF_ERROR (demangle_special_name (dm)); + return d_special_name (di); else { - /* Now demangle the name. */ - RETURN_IF_ERROR (demangle_name (dm, &encode_return_type)); + struct demangle_component *dc; + + dc = d_name (di); - /* If there's anything left, the name was a function name, with - maybe its return type, and its parameter types, following. */ - if (!end_of_name_p (dm) - && peek_char (dm) != 'E') + if (dc != NULL && top_level && (di->options & DMGL_PARAMS) == 0) { - if (encode_return_type) - /* Template functions have their return type encoded. The - return type should be inserted at start_position. */ - RETURN_IF_ERROR - (demangle_bare_function_type (dm, &start_position)); - else - /* Non-template functions don't have their return type - encoded. */ - RETURN_IF_ERROR - (demangle_bare_function_type (dm, BFT_NO_RETURN_TYPE)); - } - } + /* Strip off any initial CV-qualifiers, as they really apply + to the `this' parameter, and they were not output by the + v2 demangler without DMGL_PARAMS. */ + while (dc->type == DEMANGLE_COMPONENT_RESTRICT_THIS + || dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS + || dc->type == DEMANGLE_COMPONENT_CONST_THIS) + dc = d_left (dc); + + /* If the top level is a DEMANGLE_COMPONENT_LOCAL_NAME, then + there may be CV-qualifiers on its right argument which + really apply here; this happens when parsing a class + which is local to a function. */ + if (dc->type == DEMANGLE_COMPONENT_LOCAL_NAME) + { + struct demangle_component *dcr; + + dcr = d_right (dc); + while (dcr->type == DEMANGLE_COMPONENT_RESTRICT_THIS + || dcr->type == DEMANGLE_COMPONENT_VOLATILE_THIS + || dcr->type == DEMANGLE_COMPONENT_CONST_THIS) + dcr = d_left (dcr); + dc->u.s_binary.right = dcr; + } - /* Pop off template argument lists that were built during the - mangling of this name, to restore the old template context. */ - pop_to_template_arg_list (dm, old_arg_list); + return dc; + } - return STATUS_OK; + peek = d_peek_char (di); + if (peek == '\0' || peek == 'E') + return dc; + return d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME, dc, + d_bare_function_type (di, has_return_type (dc))); + } } -/* Demangles and emits a <name>. +/* <name> ::= <nested-name> + ::= <unscoped-name> + ::= <unscoped-template-name> <template-args> + ::= <local-name> - <name> ::= <unscoped-name> - ::= <unscoped-template-name> <template-args> - ::= <nested-name> - ::= <local-name> + <unscoped-name> ::= <unqualified-name> + ::= St <unqualified-name> - <unscoped-name> ::= <unqualified-name> - ::= St <unqualified-name> # ::std:: - - <unscoped-template-name> - ::= <unscoped-name> - ::= <substitution> */ + <unscoped-template-name> ::= <unscoped-name> + ::= <substitution> +*/ -static status_t -demangle_name (dm, encode_return_type) - demangling_t dm; - int *encode_return_type; +static struct demangle_component * +d_name (struct d_info *di) { - int start = substitution_start (dm); - char peek = peek_char (dm); - int is_std_substitution = 0; - - /* Generally, the return type is encoded if the function is a - template-id, and suppressed otherwise. There are a few cases, - though, in which the return type is not encoded even for a - templated function. In these cases, this flag is set. */ - int suppress_return_type = 0; - - DEMANGLE_TRACE ("name", dm); + char peek = d_peek_char (di); + struct demangle_component *dc; switch (peek) { case 'N': - /* This is a <nested-name>. */ - RETURN_IF_ERROR (demangle_nested_name (dm, encode_return_type)); - break; + return d_nested_name (di); case 'Z': - RETURN_IF_ERROR (demangle_local_name (dm)); - *encode_return_type = 0; - break; + return d_local_name (di); case 'S': - /* The `St' substitution allows a name nested in std:: to appear - without being enclosed in a nested name. */ - if (peek_char_next (dm) == 't') - { - (void) next_char (dm); - (void) next_char (dm); - RETURN_IF_ERROR (result_add (dm, "std::")); - RETURN_IF_ERROR - (demangle_unqualified_name (dm, &suppress_return_type)); - is_std_substitution = 1; - } - else - RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type)); - /* Check if a template argument list immediately follows. - If so, then we just demangled an <unqualified-template-name>. */ - if (peek_char (dm) == 'I') - { - /* A template name of the form std::<unqualified-name> is a - substitution candidate. */ - if (is_std_substitution) - RETURN_IF_ERROR (substitution_add (dm, start, 0)); - /* Demangle the <template-args> here. */ - RETURN_IF_ERROR (demangle_template_args (dm)); - *encode_return_type = !suppress_return_type; - } - else - *encode_return_type = 0; + { + int subst; - break; + if (d_peek_next_char (di) != 't') + { + dc = d_substitution (di, 0); + subst = 1; + } + else + { + d_advance (di, 2); + dc = d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME, + d_make_name (di, "std", 3), + d_unqualified_name (di)); + di->expansion += 3; + subst = 0; + } - default: - /* This is an <unscoped-name> or <unscoped-template-name>. */ - RETURN_IF_ERROR (demangle_unqualified_name (dm, &suppress_return_type)); + if (d_peek_char (di) != 'I') + { + /* The grammar does not permit this case to occur if we + called d_substitution() above (i.e., subst == 1). We + don't bother to check. */ + } + else + { + /* This is <template-args>, which means that we just saw + <unscoped-template-name>, which is a substitution + candidate if we didn't just get it from a + substitution. */ + if (! subst) + { + if (! d_add_substitution (di, dc)) + return NULL; + } + dc = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, dc, + d_template_args (di)); + } - /* If the <unqualified-name> is followed by template args, this - is an <unscoped-template-name>. */ - if (peek_char (dm) == 'I') - { - /* Add a substitution for the unqualified template name. */ - RETURN_IF_ERROR (substitution_add (dm, start, 0)); + return dc; + } - RETURN_IF_ERROR (demangle_template_args (dm)); - *encode_return_type = !suppress_return_type; + default: + dc = d_unqualified_name (di); + if (d_peek_char (di) == 'I') + { + /* This is <template-args>, which means that we just saw + <unscoped-template-name>, which is a substitution + candidate. */ + if (! d_add_substitution (di, dc)) + return NULL; + dc = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, dc, + d_template_args (di)); } - else - *encode_return_type = 0; - - break; + return dc; } - - return STATUS_OK; } -/* Demangles and emits a <nested-name>. - - <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqulified-name> E */ +/* <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E + ::= N [<CV-qualifiers>] <template-prefix> <template-args> E +*/ -static status_t -demangle_nested_name (dm, encode_return_type) - demangling_t dm; - int *encode_return_type; +static struct demangle_component * +d_nested_name (struct d_info *di) { - char peek; + struct demangle_component *ret; + struct demangle_component **pret; - DEMANGLE_TRACE ("nested-name", dm); + if (d_next_char (di) != 'N') + return NULL; - RETURN_IF_ERROR (demangle_char (dm, 'N')); + pret = d_cv_qualifiers (di, &ret, 1); + if (pret == NULL) + return NULL; - peek = peek_char (dm); - if (peek == 'r' || peek == 'V' || peek == 'K') - { - dyn_string_t cv_qualifiers; - status_t status; - - /* Snarf up CV qualifiers. */ - cv_qualifiers = dyn_string_new (24); - if (cv_qualifiers == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_CV_qualifiers (dm, cv_qualifiers); - - /* Emit them, preceded by a space. */ - status = result_add_char (dm, ' '); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, cv_qualifiers); - /* The CV qualifiers that occur in a <nested-name> will be - qualifiers for member functions. These are placed at the end - of the function. Therefore, shift the caret to the left by - the length of the qualifiers, so other text is inserted - before them and they stay at the end. */ - result_shift_caret (dm, -dyn_string_length (cv_qualifiers) - 1); - /* Clean up. */ - dyn_string_delete (cv_qualifiers); - RETURN_IF_ERROR (status); - } + *pret = d_prefix (di); + if (*pret == NULL) + return NULL; - RETURN_IF_ERROR (demangle_prefix (dm, encode_return_type)); - /* No need to demangle the final <unqualified-name>; demangle_prefix - will handle it. */ - RETURN_IF_ERROR (demangle_char (dm, 'E')); + if (d_next_char (di) != 'E') + return NULL; - return STATUS_OK; + return ret; } -/* Demangles and emits a <prefix>. +/* <prefix> ::= <prefix> <unqualified-name> + ::= <template-prefix> <template-args> + ::= <template-param> + ::= + ::= <substitution> - <prefix> ::= <prefix> <unqualified-name> - ::= <template-prefix> <template-args> - ::= # empty - ::= <substitution> - - <template-prefix> ::= <prefix> - ::= <substitution> */ + <template-prefix> ::= <prefix> <(template) unqualified-name> + ::= <template-param> + ::= <substitution> +*/ -static status_t -demangle_prefix (dm, encode_return_type) - demangling_t dm; - int *encode_return_type; +static struct demangle_component * +d_prefix (struct d_info *di) { - int start = substitution_start (dm); - int nested = 0; - - /* ENCODE_RETURN_TYPE is updated as we decend the nesting chain. - After <template-args>, it is set to non-zero; after everything - else it is set to zero. */ - - /* Generally, the return type is encoded if the function is a - template-id, and suppressed otherwise. There are a few cases, - though, in which the return type is not encoded even for a - templated function. In these cases, this flag is set. */ - int suppress_return_type = 0; - - DEMANGLE_TRACE ("prefix", dm); + struct demangle_component *ret = NULL; while (1) { char peek; + enum demangle_component_type comb_type; + struct demangle_component *dc; - if (end_of_name_p (dm)) - return "Unexpected end of name in <compound-name>."; - - peek = peek_char (dm); - - /* We'll initialize suppress_return_type to false, and set it to true - if we end up demangling a constructor name. However, make - sure we're not actually about to demangle template arguments - -- if so, this is the <template-args> following a - <template-prefix>, so we'll want the previous flag value - around. */ - if (peek != 'I') - suppress_return_type = 0; - - if (IS_DIGIT ((unsigned char) peek) - || (peek >= 'a' && peek <= 'z') - || peek == 'C' || peek == 'D' - || peek == 'S') - { - /* We have another level of scope qualification. */ - if (nested) - RETURN_IF_ERROR (result_add (dm, NAMESPACE_SEPARATOR)); - else - nested = 1; + peek = d_peek_char (di); + if (peek == '\0') + return NULL; - if (peek == 'S') - /* The substitution determines whether this is a - template-id. */ - RETURN_IF_ERROR (demangle_substitution (dm, encode_return_type)); - else - { - /* It's just a name. */ - RETURN_IF_ERROR - (demangle_unqualified_name (dm, &suppress_return_type)); - *encode_return_type = 0; - } - } - else if (peek == 'Z') - RETURN_IF_ERROR (demangle_local_name (dm)); + /* The older code accepts a <local-name> here, but I don't see + that in the grammar. The older code does not accept a + <template-param> here. */ + + comb_type = DEMANGLE_COMPONENT_QUAL_NAME; + if (IS_DIGIT (peek) + || IS_LOWER (peek) + || peek == 'C' + || peek == 'D') + dc = d_unqualified_name (di); + else if (peek == 'S') + dc = d_substitution (di, 1); else if (peek == 'I') { - RETURN_IF_ERROR (demangle_template_args (dm)); - - /* Now we want to indicate to the caller that we've - demangled template arguments, thus the prefix was a - <template-prefix>. That's so that the caller knows to - demangle the function's return type, if this turns out to - be a function name. But, if it's a member template - constructor or a templated conversion operator, report it - as untemplated. Those never get encoded return types. */ - *encode_return_type = !suppress_return_type; + if (ret == NULL) + return NULL; + comb_type = DEMANGLE_COMPONENT_TEMPLATE; + dc = d_template_args (di); } + else if (peek == 'T') + dc = d_template_param (di); else if (peek == 'E') - /* All done. */ - return STATUS_OK; + return ret; + else + return NULL; + + if (ret == NULL) + ret = dc; else - return "Unexpected character in <compound-name>."; + ret = d_make_comp (di, comb_type, ret, dc); - if (peek != 'S' - && peek_char (dm) != 'E') - /* Add a new substitution for the prefix thus far. */ - RETURN_IF_ERROR (substitution_add (dm, start, *encode_return_type)); + if (peek != 'S' && d_peek_char (di) != 'E') + { + if (! d_add_substitution (di, ret)) + return NULL; + } } } -/* Demangles and emits an <unqualified-name>. If this - <unqualified-name> is for a special function type that should never - have its return type encoded (particularly, a constructor or - conversion operator), *SUPPRESS_RETURN_TYPE is set to 1; otherwise, - it is set to zero. - - <unqualified-name> ::= <operator-name> - ::= <special-name> - ::= <source-name> */ +/* <unqualified-name> ::= <operator-name> + ::= <ctor-dtor-name> + ::= <source-name> +*/ -static status_t -demangle_unqualified_name (dm, suppress_return_type) - demangling_t dm; - int *suppress_return_type; +static struct demangle_component * +d_unqualified_name (struct d_info *di) { - char peek = peek_char (dm); - - DEMANGLE_TRACE ("unqualified-name", dm); - - /* By default, don't force suppression of the return type (though - non-template functions still don't get a return type encoded). */ - *suppress_return_type = 0; + char peek; - if (IS_DIGIT ((unsigned char) peek)) - RETURN_IF_ERROR (demangle_source_name (dm)); - else if (peek >= 'a' && peek <= 'z') + peek = d_peek_char (di); + if (IS_DIGIT (peek)) + return d_source_name (di); + else if (IS_LOWER (peek)) { - int num_args; + struct demangle_component *ret; - /* Conversion operators never have a return type encoded. */ - if (peek == 'c' && peek_char_next (dm) == 'v') - *suppress_return_type = 1; - - RETURN_IF_ERROR (demangle_operator_name (dm, 0, &num_args, NULL)); + ret = d_operator_name (di); + if (ret != NULL && ret->type == DEMANGLE_COMPONENT_OPERATOR) + di->expansion += sizeof "operator" + ret->u.s_operator.op->len - 2; + return ret; } else if (peek == 'C' || peek == 'D') - { - /* Constructors never have a return type encoded. */ - if (peek == 'C') - *suppress_return_type = 1; - - RETURN_IF_ERROR (demangle_ctor_dtor_name (dm)); - } + return d_ctor_dtor_name (di); else - return "Unexpected character in <unqualified-name>."; - - return STATUS_OK; + return NULL; } -/* Demangles and emits <source-name>. - - <source-name> ::= <length number> <identifier> */ +/* <source-name> ::= <(positive length) number> <identifier> */ -static status_t -demangle_source_name (dm) - demangling_t dm; +static struct demangle_component * +d_source_name (struct d_info *di) { - int length; + long len; + struct demangle_component *ret; - DEMANGLE_TRACE ("source-name", dm); - - /* Decode the length of the identifier. */ - RETURN_IF_ERROR (demangle_number (dm, &length, 10, 0)); - if (length == 0) - return "Zero length in <source-name>."; - - /* Now the identifier itself. It's placed into last_source_name, - where it can be used to build a constructor or destructor name. */ - RETURN_IF_ERROR (demangle_identifier (dm, length, - dm->last_source_name)); - - /* Emit it. */ - RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name)); - - return STATUS_OK; + len = d_number (di); + if (len <= 0) + return NULL; + ret = d_identifier (di, len); + di->last_name = ret; + return ret; } -/* Demangles a number, either a <number> or a <positive-number> at the - current position, consuming all consecutive digit characters. Sets - *VALUE to the resulting numberand returns STATUS_OK. The number is - interpreted as BASE, which must be either 10 or 36. If IS_SIGNED - is non-zero, negative numbers -- prefixed with `n' -- are accepted. +/* number ::= [n] <(non-negative decimal integer)> */ - <number> ::= [n] <positive-number> - - <positive-number> ::= <decimal integer> */ - -static status_t -demangle_number (dm, value, base, is_signed) - demangling_t dm; - int *value; - int base; - int is_signed; +static long +d_number (struct d_info *di) { - dyn_string_t number = dyn_string_new (10); - - DEMANGLE_TRACE ("number", dm); - - if (number == NULL) - return STATUS_ALLOCATION_FAILED; + int negative; + char peek; + long ret; - demangle_number_literally (dm, number, base, is_signed); - *value = strtol (dyn_string_buf (number), NULL, base); - dyn_string_delete (number); + negative = 0; + peek = d_peek_char (di); + if (peek == 'n') + { + negative = 1; + d_advance (di, 1); + peek = d_peek_char (di); + } - return STATUS_OK; + ret = 0; + while (1) + { + if (! IS_DIGIT (peek)) + { + if (negative) + ret = - ret; + return ret; + } + ret = ret * 10 + peek - '0'; + d_advance (di, 1); + peek = d_peek_char (di); + } } -/* Demangles a number at the current position. The digits (and minus - sign, if present) that make up the number are appended to STR. - Only base-BASE digits are accepted; BASE must be either 10 or 36. - If IS_SIGNED, negative numbers -- prefixed with `n' -- are - accepted. Does not consume a trailing underscore or other - terminating character. */ - -static status_t -demangle_number_literally (dm, str, base, is_signed) - demangling_t dm; - dyn_string_t str; - int base; - int is_signed; +/* identifier ::= <(unqualified source code identifier)> */ + +static struct demangle_component * +d_identifier (struct d_info *di, int len) { - DEMANGLE_TRACE ("number*", dm); + const char *name; - if (base != 10 && base != 36) - return STATUS_INTERNAL_ERROR; + name = d_str (di); - /* An `n' denotes a negative number. */ - if (is_signed && peek_char (dm) == 'n') - { - /* Skip past the n. */ - advance_char (dm); - /* The normal way to write a negative number is with a minus - sign. */ - if (!dyn_string_append_char (str, '-')) - return STATUS_ALLOCATION_FAILED; - } + if (di->send - name < len) + return NULL; - /* Loop until we hit a non-digit. */ - while (1) + d_advance (di, len); + + /* A Java mangled name may have a trailing '$' if it is a C++ + keyword. This '$' is not included in the length count. We just + ignore the '$'. */ + if ((di->options & DMGL_JAVA) != 0 + && d_peek_char (di) == '$') + d_advance (di, 1); + + /* Look for something which looks like a gcc encoding of an + anonymous namespace, and replace it with a more user friendly + name. */ + if (len >= (int) ANONYMOUS_NAMESPACE_PREFIX_LEN + 2 + && memcmp (name, ANONYMOUS_NAMESPACE_PREFIX, + ANONYMOUS_NAMESPACE_PREFIX_LEN) == 0) { - char peek = peek_char (dm); - if (IS_DIGIT ((unsigned char) peek) - || (base == 36 && peek >= 'A' && peek <= 'Z')) + const char *s; + + s = name + ANONYMOUS_NAMESPACE_PREFIX_LEN; + if ((*s == '.' || *s == '_' || *s == '$') + && s[1] == 'N') { - /* Accumulate digits. */ - if (!dyn_string_append_char (str, next_char (dm))) - return STATUS_ALLOCATION_FAILED; + di->expansion -= len - sizeof "(anonymous namespace)"; + return d_make_name (di, "(anonymous namespace)", + sizeof "(anonymous namespace)" - 1); } - else - /* Not a digit? All done. */ - break; } - return STATUS_OK; + return d_make_name (di, name, len); } -/* Demangles an identifier at the current position of LENGTH - characters and places it in IDENTIFIER. */ +/* operator_name ::= many different two character encodings. + ::= cv <type> + ::= v <digit> <source-name> +*/ -static status_t -demangle_identifier (dm, length, identifier) - demangling_t dm; - int length; - dyn_string_t identifier; -{ - DEMANGLE_TRACE ("identifier", dm); +#define NL(s) s, (sizeof s) - 1 - dyn_string_clear (identifier); - if (!dyn_string_resize (identifier, length)) - return STATUS_ALLOCATION_FAILED; +CP_STATIC_IF_GLIBCPP_V3 +const struct demangle_operator_info cplus_demangle_operators[] = +{ + { "aN", NL ("&="), 2 }, + { "aS", NL ("="), 2 }, + { "aa", NL ("&&"), 2 }, + { "ad", NL ("&"), 1 }, + { "an", NL ("&"), 2 }, + { "cl", NL ("()"), 0 }, + { "cm", NL (","), 2 }, + { "co", NL ("~"), 1 }, + { "dV", NL ("/="), 2 }, + { "da", NL ("delete[]"), 1 }, + { "de", NL ("*"), 1 }, + { "dl", NL ("delete"), 1 }, + { "dv", NL ("/"), 2 }, + { "eO", NL ("^="), 2 }, + { "eo", NL ("^"), 2 }, + { "eq", NL ("=="), 2 }, + { "ge", NL (">="), 2 }, + { "gt", NL (">"), 2 }, + { "ix", NL ("[]"), 2 }, + { "lS", NL ("<<="), 2 }, + { "le", NL ("<="), 2 }, + { "ls", NL ("<<"), 2 }, + { "lt", NL ("<"), 2 }, + { "mI", NL ("-="), 2 }, + { "mL", NL ("*="), 2 }, + { "mi", NL ("-"), 2 }, + { "ml", NL ("*"), 2 }, + { "mm", NL ("--"), 1 }, + { "na", NL ("new[]"), 1 }, + { "ne", NL ("!="), 2 }, + { "ng", NL ("-"), 1 }, + { "nt", NL ("!"), 1 }, + { "nw", NL ("new"), 1 }, + { "oR", NL ("|="), 2 }, + { "oo", NL ("||"), 2 }, + { "or", NL ("|"), 2 }, + { "pL", NL ("+="), 2 }, + { "pl", NL ("+"), 2 }, + { "pm", NL ("->*"), 2 }, + { "pp", NL ("++"), 1 }, + { "ps", NL ("+"), 1 }, + { "pt", NL ("->"), 2 }, + { "qu", NL ("?"), 3 }, + { "rM", NL ("%="), 2 }, + { "rS", NL (">>="), 2 }, + { "rm", NL ("%"), 2 }, + { "rs", NL (">>"), 2 }, + { "st", NL ("sizeof "), 1 }, + { "sz", NL ("sizeof "), 1 }, + { NULL, NULL, 0, 0 } +}; - while (length-- > 0) +static struct demangle_component * +d_operator_name (struct d_info *di) +{ + char c1; + char c2; + + c1 = d_next_char (di); + c2 = d_next_char (di); + if (c1 == 'v' && IS_DIGIT (c2)) + return d_make_extended_operator (di, c2 - '0', d_source_name (di)); + else if (c1 == 'c' && c2 == 'v') + return d_make_comp (di, DEMANGLE_COMPONENT_CAST, + cplus_demangle_type (di), NULL); + else { - int ch; - if (end_of_name_p (dm)) - return "Unexpected end of name in <identifier>."; - ch = next_char (dm); - - /* Handle extended Unicode characters. We encode them as __U{hex}_, - where {hex} omits leading 0's. For instance, '$' is encoded as - "__U24_". */ - if (ch == '_' - && peek_char (dm) == '_' - && peek_char_next (dm) == 'U') + /* LOW is the inclusive lower bound. */ + int low = 0; + /* HIGH is the exclusive upper bound. We subtract one to ignore + the sentinel at the end of the array. */ + int high = ((sizeof (cplus_demangle_operators) + / sizeof (cplus_demangle_operators[0])) + - 1); + + while (1) { - char buf[10]; - int pos = 0; - advance_char (dm); advance_char (dm); length -= 2; - while (length-- > 0) - { - ch = next_char (dm); - if (!isxdigit (ch)) - break; - buf[pos++] = ch; - } - if (ch != '_' || length < 0) - return STATUS_ERROR; - if (pos == 0) - { - /* __U_ just means __U. */ - if (!dyn_string_append_cstr (identifier, "__U")) - return STATUS_ALLOCATION_FAILED; - continue; - } - else - { - buf[pos] = '\0'; - ch = strtol (buf, 0, 16); - } - } + int i; + const struct demangle_operator_info *p; - if (!dyn_string_append_char (identifier, ch)) - return STATUS_ALLOCATION_FAILED; - } + i = low + (high - low) / 2; + p = cplus_demangle_operators + i; - /* GCC encodes anonymous namespaces using a `_GLOBAL_[_.$]N.' - followed by the source file name and some random characters. - Unless we're in strict mode, decipher these names appropriately. */ - if (!flag_strict) - { - char *name = dyn_string_buf (identifier); - int prefix_length = strlen (ANONYMOUS_NAMESPACE_PREFIX); - - /* Compare the first, fixed part. */ - if (strncmp (name, ANONYMOUS_NAMESPACE_PREFIX, prefix_length) == 0) - { - name += prefix_length; - /* The next character might be a period, an underscore, or - dollar sign, depending on the target architecture's - assembler's capabilities. After that comes an `N'. */ - if ((*name == '.' || *name == '_' || *name == '$') - && *(name + 1) == 'N') - /* This looks like the anonymous namespace identifier. - Replace it with something comprehensible. */ - dyn_string_copy_cstr (identifier, "(anonymous namespace)"); + if (c1 == p->code[0] && c2 == p->code[1]) + return d_make_operator (di, p); + + if (c1 < p->code[0] || (c1 == p->code[0] && c2 < p->code[1])) + high = i; + else + low = i + 1; + if (low == high) + return NULL; } } - - return STATUS_OK; } -/* Demangles and emits an <operator-name>. If SHORT_NAME is non-zero, - the short form is emitted; otherwise the full source form - (`operator +' etc.) is emitted. *NUM_ARGS is set to the number of - operands that the operator takes. If TYPE_ARG is non-NULL, - *TYPE_ARG is set to 1 if the first argument is a type and 0 - otherwise. - - <operator-name> - ::= nw # new - ::= na # new[] - ::= dl # delete - ::= da # delete[] - ::= ps # + (unary) - ::= ng # - (unary) - ::= ad # & (unary) - ::= de # * (unary) - ::= co # ~ - ::= pl # + - ::= mi # - - ::= ml # * - ::= dv # / - ::= rm # % - ::= an # & - ::= or # | - ::= eo # ^ - ::= aS # = - ::= pL # += - ::= mI # -= - ::= mL # *= - ::= dV # /= - ::= rM # %= - ::= aN # &= - ::= oR # |= - ::= eO # ^= - ::= ls # << - ::= rs # >> - ::= lS # <<= - ::= rS # >>= - ::= eq # == - ::= ne # != - ::= lt # < - ::= gt # > - ::= le # <= - ::= ge # >= - ::= nt # ! - ::= aa # && - ::= oo # || - ::= pp # ++ - ::= mm # -- - ::= cm # , - ::= pm # ->* - ::= pt # -> - ::= cl # () - ::= ix # [] - ::= qu # ? - ::= st # sizeof (a type) - ::= sz # sizeof (an expression) - ::= cv <type> # cast - ::= v [0-9] <source-name> # vendor extended operator */ - -static status_t -demangle_operator_name (dm, short_name, num_args, type_arg) - demangling_t dm; - int short_name; - int *num_args; - int *type_arg; +/* <special-name> ::= TV <type> + ::= TT <type> + ::= TI <type> + ::= TS <type> + ::= GV <(object) name> + ::= T <call-offset> <(base) encoding> + ::= Tc <call-offset> <call-offset> <(base) encoding> + Also g++ extensions: + ::= TC <type> <(offset) number> _ <(base) type> + ::= TF <type> + ::= TJ <type> + ::= GR <name> + ::= GA <encoding> +*/ + +static struct demangle_component * +d_special_name (struct d_info *di) { - struct operator_code - { - /* The mangled code for this operator. */ - const char *const code; - /* The source name of this operator. */ - const char *const name; - /* The number of arguments this operator takes. */ - const int num_args; - }; - - static const struct operator_code operators[] = - { - { "aN", "&=" , 2 }, - { "aS", "=" , 2 }, - { "aa", "&&" , 2 }, - { "ad", "&" , 1 }, - { "an", "&" , 2 }, - { "cl", "()" , 0 }, - { "cm", "," , 2 }, - { "co", "~" , 1 }, - { "dV", "/=" , 2 }, - { "da", " delete[]", 1 }, - { "de", "*" , 1 }, - { "dl", " delete" , 1 }, - { "dv", "/" , 2 }, - { "eO", "^=" , 2 }, - { "eo", "^" , 2 }, - { "eq", "==" , 2 }, - { "ge", ">=" , 2 }, - { "gt", ">" , 2 }, - { "ix", "[]" , 2 }, - { "lS", "<<=" , 2 }, - { "le", "<=" , 2 }, - { "ls", "<<" , 2 }, - { "lt", "<" , 2 }, - { "mI", "-=" , 2 }, - { "mL", "*=" , 2 }, - { "mi", "-" , 2 }, - { "ml", "*" , 2 }, - { "mm", "--" , 1 }, - { "na", " new[]" , 1 }, - { "ne", "!=" , 2 }, - { "ng", "-" , 1 }, - { "nt", "!" , 1 }, - { "nw", " new" , 1 }, - { "oR", "|=" , 2 }, - { "oo", "||" , 2 }, - { "or", "|" , 2 }, - { "pL", "+=" , 2 }, - { "pl", "+" , 2 }, - { "pm", "->*" , 2 }, - { "pp", "++" , 1 }, - { "ps", "+" , 1 }, - { "pt", "->" , 2 }, - { "qu", "?" , 3 }, - { "rM", "%=" , 2 }, - { "rS", ">>=" , 2 }, - { "rm", "%" , 2 }, - { "rs", ">>" , 2 }, - { "sz", " sizeof" , 1 } - }; - - const int num_operators = - sizeof (operators) / sizeof (struct operator_code); - - int c0 = next_char (dm); - int c1 = next_char (dm); - const struct operator_code* p1 = operators; - const struct operator_code* p2 = operators + num_operators; - - DEMANGLE_TRACE ("operator-name", dm); - - /* Assume the first argument is not a type. */ - if (type_arg) - *type_arg = 0; - - /* Is this a vendor-extended operator? */ - if (c0 == 'v' && IS_DIGIT (c1)) - { - RETURN_IF_ERROR (result_add (dm, "operator ")); - RETURN_IF_ERROR (demangle_source_name (dm)); - *num_args = 0; - return STATUS_OK; - } + char c; - /* Is this a conversion operator? */ - if (c0 == 'c' && c1 == 'v') + di->expansion += 20; + c = d_next_char (di); + if (c == 'T') { - RETURN_IF_ERROR (result_add (dm, "operator ")); - /* Demangle the converted-to type. */ - RETURN_IF_ERROR (demangle_type (dm)); - *num_args = 0; - return STATUS_OK; - } + switch (d_next_char (di)) + { + case 'V': + di->expansion -= 5; + return d_make_comp (di, DEMANGLE_COMPONENT_VTABLE, + cplus_demangle_type (di), NULL); + case 'T': + di->expansion -= 10; + return d_make_comp (di, DEMANGLE_COMPONENT_VTT, + cplus_demangle_type (di), NULL); + case 'I': + return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO, + cplus_demangle_type (di), NULL); + case 'S': + return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO_NAME, + cplus_demangle_type (di), NULL); - /* Is it the sizeof variant that takes a type? */ - if (c0 == 's' && c1 == 't') - { - RETURN_IF_ERROR (result_add (dm, " sizeof")); - *num_args = 1; - if (type_arg) - *type_arg = 1; - return STATUS_OK; - } + case 'h': + if (! d_call_offset (di, 'h')) + return NULL; + return d_make_comp (di, DEMANGLE_COMPONENT_THUNK, + d_encoding (di, 0), NULL); - /* Perform a binary search for the operator code. */ - while (1) - { - const struct operator_code* p = p1 + (p2 - p1) / 2; - char match0 = p->code[0]; - char match1 = p->code[1]; + case 'v': + if (! d_call_offset (di, 'v')) + return NULL; + return d_make_comp (di, DEMANGLE_COMPONENT_VIRTUAL_THUNK, + d_encoding (di, 0), NULL); - if (c0 == match0 && c1 == match1) - /* Found it. */ - { - if (!short_name) - RETURN_IF_ERROR (result_add (dm, "operator")); - RETURN_IF_ERROR (result_add (dm, p->name)); - *num_args = p->num_args; + case 'c': + if (! d_call_offset (di, '\0')) + return NULL; + if (! d_call_offset (di, '\0')) + return NULL; + return d_make_comp (di, DEMANGLE_COMPONENT_COVARIANT_THUNK, + d_encoding (di, 0), NULL); + + case 'C': + { + struct demangle_component *derived_type; + long offset; + struct demangle_component *base_type; + + derived_type = cplus_demangle_type (di); + offset = d_number (di); + if (offset < 0) + return NULL; + if (d_next_char (di) != '_') + return NULL; + base_type = cplus_demangle_type (di); + /* We don't display the offset. FIXME: We should display + it in verbose mode. */ + di->expansion += 5; + return d_make_comp (di, DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, + base_type, derived_type); + } + + case 'F': + return d_make_comp (di, DEMANGLE_COMPONENT_TYPEINFO_FN, + cplus_demangle_type (di), NULL); + case 'J': + return d_make_comp (di, DEMANGLE_COMPONENT_JAVA_CLASS, + cplus_demangle_type (di), NULL); - return STATUS_OK; + default: + return NULL; } + } + else if (c == 'G') + { + switch (d_next_char (di)) + { + case 'V': + return d_make_comp (di, DEMANGLE_COMPONENT_GUARD, d_name (di), NULL); - if (p == p1) - /* Couldn't find it. */ - return "Unknown code in <operator-name>."; + case 'R': + return d_make_comp (di, DEMANGLE_COMPONENT_REFTEMP, d_name (di), + NULL); - /* Try again. */ - if (c0 < match0 || (c0 == match0 && c1 < match1)) - p2 = p; - else - p1 = p; + case 'A': + return d_make_comp (di, DEMANGLE_COMPONENT_HIDDEN_ALIAS, + d_encoding (di, 0), NULL); + + default: + return NULL; + } } + else + return NULL; } -/* Demangles and omits an <nv-offset>. +/* <call-offset> ::= h <nv-offset> _ + ::= v <v-offset> _ - <nv-offset> ::= <offset number> # non-virtual base override */ + <nv-offset> ::= <(offset) number> -static status_t -demangle_nv_offset (dm) - demangling_t dm; -{ - dyn_string_t number; - status_t status = STATUS_OK; + <v-offset> ::= <(offset) number> _ <(virtual offset) number> - DEMANGLE_TRACE ("h-offset", dm); + The C parameter, if not '\0', is a character we just read which is + the start of the <call-offset>. - /* Demangle the offset. */ - number = dyn_string_new (4); - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_number_literally (dm, number, 10, 1); + We don't display the offset information anywhere. FIXME: We should + display it in verbose mode. */ - /* Don't display the offset unless in verbose mode. */ - if (flag_verbose) +static int +d_call_offset (struct d_info *di, int c) +{ + if (c == '\0') + c = d_next_char (di); + + if (c == 'h') + d_number (di); + else if (c == 'v') { - status = result_add (dm, " [nv:"); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, number); - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, ']'); + d_number (di); + if (d_next_char (di) != '_') + return 0; + d_number (di); } + else + return 0; - /* Clean up. */ - dyn_string_delete (number); - RETURN_IF_ERROR (status); - return STATUS_OK; -} + if (d_next_char (di) != '_') + return 0; -/* Demangles and emits a <v-offset>. + return 1; +} - <v-offset> ::= <offset number> _ <virtual offset number> - # virtual base override, with vcall offset */ +/* <ctor-dtor-name> ::= C1 + ::= C2 + ::= C3 + ::= D0 + ::= D1 + ::= D2 +*/ -static status_t -demangle_v_offset (dm) - demangling_t dm; +static struct demangle_component * +d_ctor_dtor_name (struct d_info *di) { - dyn_string_t number; - status_t status = STATUS_OK; - - DEMANGLE_TRACE ("v-offset", dm); - - /* Demangle the offset. */ - number = dyn_string_new (4); - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_number_literally (dm, number, 10, 1); - - /* Don't display the offset unless in verbose mode. */ - if (flag_verbose) + if (di->last_name != NULL) { - status = result_add (dm, " [v:"); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, number); - if (STATUS_NO_ERROR (status)) - result_add_char (dm, ','); + if (di->last_name->type == DEMANGLE_COMPONENT_NAME) + di->expansion += di->last_name->u.s_name.len; + else if (di->last_name->type == DEMANGLE_COMPONENT_SUB_STD) + di->expansion += di->last_name->u.s_string.len; } - dyn_string_delete (number); - RETURN_IF_ERROR (status); + switch (d_next_char (di)) + { + case 'C': + { + enum gnu_v3_ctor_kinds kind; - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); + switch (d_next_char (di)) + { + case '1': + kind = gnu_v3_complete_object_ctor; + break; + case '2': + kind = gnu_v3_base_object_ctor; + break; + case '3': + kind = gnu_v3_complete_object_allocating_ctor; + break; + default: + return NULL; + } + return d_make_ctor (di, kind, di->last_name); + } - /* Demangle the vcall offset. */ - number = dyn_string_new (4); - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_number_literally (dm, number, 10, 1); + case 'D': + { + enum gnu_v3_dtor_kinds kind; - /* Don't display the vcall offset unless in verbose mode. */ - if (flag_verbose) - { - status = result_add_string (dm, number); - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, ']'); - } - dyn_string_delete (number); - RETURN_IF_ERROR (status); + switch (d_next_char (di)) + { + case '0': + kind = gnu_v3_deleting_dtor; + break; + case '1': + kind = gnu_v3_complete_object_dtor; + break; + case '2': + kind = gnu_v3_base_object_dtor; + break; + default: + return NULL; + } + return d_make_dtor (di, kind, di->last_name); + } - return STATUS_OK; + default: + return NULL; + } } -/* Demangles and emits a <call-offset>. +/* <type> ::= <builtin-type> + ::= <function-type> + ::= <class-enum-type> + ::= <array-type> + ::= <pointer-to-member-type> + ::= <template-param> + ::= <template-template-param> <template-args> + ::= <substitution> + ::= <CV-qualifiers> <type> + ::= P <type> + ::= R <type> + ::= C <type> + ::= G <type> + ::= U <source-name> <type> + + <builtin-type> ::= various one letter codes + ::= u <source-name> +*/ - <call-offset> ::= h <nv-offset> _ - ::= v <v-offset> _ */ +CP_STATIC_IF_GLIBCPP_V3 +const struct demangle_builtin_type_info +cplus_demangle_builtin_types[D_BUILTIN_TYPE_COUNT] = +{ + /* a */ { NL ("signed char"), NL ("signed char"), D_PRINT_DEFAULT }, + /* b */ { NL ("bool"), NL ("boolean"), D_PRINT_BOOL }, + /* c */ { NL ("char"), NL ("byte"), D_PRINT_DEFAULT }, + /* d */ { NL ("double"), NL ("double"), D_PRINT_FLOAT }, + /* e */ { NL ("long double"), NL ("long double"), D_PRINT_FLOAT }, + /* f */ { NL ("float"), NL ("float"), D_PRINT_FLOAT }, + /* g */ { NL ("__float128"), NL ("__float128"), D_PRINT_FLOAT }, + /* h */ { NL ("unsigned char"), NL ("unsigned char"), D_PRINT_DEFAULT }, + /* i */ { NL ("int"), NL ("int"), D_PRINT_INT }, + /* j */ { NL ("unsigned int"), NL ("unsigned"), D_PRINT_UNSIGNED }, + /* k */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT }, + /* l */ { NL ("long"), NL ("long"), D_PRINT_LONG }, + /* m */ { NL ("unsigned long"), NL ("unsigned long"), D_PRINT_UNSIGNED_LONG }, + /* n */ { NL ("__int128"), NL ("__int128"), D_PRINT_DEFAULT }, + /* o */ { NL ("unsigned __int128"), NL ("unsigned __int128"), + D_PRINT_DEFAULT }, + /* p */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT }, + /* q */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT }, + /* r */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT }, + /* s */ { NL ("short"), NL ("short"), D_PRINT_DEFAULT }, + /* t */ { NL ("unsigned short"), NL ("unsigned short"), D_PRINT_DEFAULT }, + /* u */ { NULL, 0, NULL, 0, D_PRINT_DEFAULT }, + /* v */ { NL ("void"), NL ("void"), D_PRINT_VOID }, + /* w */ { NL ("wchar_t"), NL ("char"), D_PRINT_DEFAULT }, + /* x */ { NL ("long long"), NL ("long"), D_PRINT_LONG_LONG }, + /* y */ { NL ("unsigned long long"), NL ("unsigned long long"), + D_PRINT_UNSIGNED_LONG_LONG }, + /* z */ { NL ("..."), NL ("..."), D_PRINT_DEFAULT }, +}; -static status_t -demangle_call_offset (dm) - demangling_t dm; +CP_STATIC_IF_GLIBCPP_V3 +struct demangle_component * +cplus_demangle_type (struct d_info *di) { - DEMANGLE_TRACE ("call-offset", dm); + char peek; + struct demangle_component *ret; + int can_subst; + + /* The ABI specifies that when CV-qualifiers are used, the base type + is substitutable, and the fully qualified type is substitutable, + but the base type with a strict subset of the CV-qualifiers is + not substitutable. The natural recursive implementation of the + CV-qualifiers would cause subsets to be substitutable, so instead + we pull them all off now. + + FIXME: The ABI says that order-insensitive vendor qualifiers + should be handled in the same way, but we have no way to tell + which vendor qualifiers are order-insensitive and which are + order-sensitive. So we just assume that they are all + order-sensitive. g++ 3.4 supports only one vendor qualifier, + __vector, and it treats it as order-sensitive when mangling + names. */ + + peek = d_peek_char (di); + if (peek == 'r' || peek == 'V' || peek == 'K') + { + struct demangle_component **pret; - switch (peek_char (dm)) + pret = d_cv_qualifiers (di, &ret, 0); + if (pret == NULL) + return NULL; + *pret = cplus_demangle_type (di); + if (! d_add_substitution (di, ret)) + return NULL; + return ret; + } + + can_subst = 1; + + switch (peek) { - case 'h': - advance_char (dm); - /* Demangle the offset. */ - RETURN_IF_ERROR (demangle_nv_offset (dm)); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': + case 'h': case 'i': case 'j': case 'l': case 'm': case 'n': + case 'o': case 's': case 't': + case 'v': case 'w': case 'x': case 'y': case 'z': + ret = d_make_builtin_type (di, + &cplus_demangle_builtin_types[peek - 'a']); + di->expansion += ret->u.s_builtin.type->len; + can_subst = 0; + d_advance (di, 1); break; - case 'v': - advance_char (dm); - /* Demangle the offset. */ - RETURN_IF_ERROR (demangle_v_offset (dm)); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); + case 'u': + d_advance (di, 1); + ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE, + d_source_name (di), NULL); break; - default: - return "Unrecognized <call-offset>."; - } + case 'F': + ret = d_function_type (di); + break; - return STATUS_OK; -} + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case 'N': + case 'Z': + ret = d_class_enum_type (di); + break; -/* Demangles and emits a <special-name>. + case 'A': + ret = d_array_type (di); + break; - <special-name> ::= GV <object name> # Guard variable - ::= TV <type> # virtual table - ::= TT <type> # VTT - ::= TI <type> # typeinfo structure - ::= TS <type> # typeinfo name + case 'M': + ret = d_pointer_to_member_type (di); + break; - Other relevant productions include thunks: + case 'T': + ret = d_template_param (di); + if (d_peek_char (di) == 'I') + { + /* This is <template-template-param> <template-args>. The + <template-template-param> part is a substitution + candidate. */ + if (! d_add_substitution (di, ret)) + return NULL; + ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret, + d_template_args (di)); + } + break; - <special-name> ::= T <call-offset> <base encoding> - # base is the nominal target function of thunk + case 'S': + /* If this is a special substitution, then it is the start of + <class-enum-type>. */ + { + char peek_next; - <special-name> ::= Tc <call-offset> <call-offset> <base encoding> - # base is the nominal target function of thunk - # first call-offset is 'this' adjustment - # second call-offset is result adjustment + peek_next = d_peek_next_char (di); + if (IS_DIGIT (peek_next) + || peek_next == '_' + || IS_UPPER (peek_next)) + { + ret = d_substitution (di, 0); + /* The substituted name may have been a template name and + may be followed by tepmlate args. */ + if (d_peek_char (di) == 'I') + ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret, + d_template_args (di)); + else + can_subst = 0; + } + else + { + ret = d_class_enum_type (di); + /* If the substitution was a complete type, then it is not + a new substitution candidate. However, if the + substitution was followed by template arguments, then + the whole thing is a substitution candidate. */ + if (ret != NULL && ret->type == DEMANGLE_COMPONENT_SUB_STD) + can_subst = 0; + } + } + break; - where + case 'P': + d_advance (di, 1); + ret = d_make_comp (di, DEMANGLE_COMPONENT_POINTER, + cplus_demangle_type (di), NULL); + break; - <call-offset> ::= h <nv-offset> _ - ::= v <v-offset> _ + case 'R': + d_advance (di, 1); + ret = d_make_comp (di, DEMANGLE_COMPONENT_REFERENCE, + cplus_demangle_type (di), NULL); + break; - Also demangles the special g++ manglings, + case 'C': + d_advance (di, 1); + ret = d_make_comp (di, DEMANGLE_COMPONENT_COMPLEX, + cplus_demangle_type (di), NULL); + break; - <special-name> ::= TC <type> <offset number> _ <base type> - # construction vtable - ::= TF <type> # typeinfo function (old ABI only) - ::= TJ <type> # java Class structure */ + case 'G': + d_advance (di, 1); + ret = d_make_comp (di, DEMANGLE_COMPONENT_IMAGINARY, + cplus_demangle_type (di), NULL); + break; -static status_t -demangle_special_name (dm) - demangling_t dm; -{ - dyn_string_t number; - int unused; - char peek = peek_char (dm); + case 'U': + d_advance (di, 1); + ret = d_source_name (di); + ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL, + cplus_demangle_type (di), ret); + break; - DEMANGLE_TRACE ("special-name", dm); + default: + return NULL; + } - if (peek == 'G') + if (can_subst) { - /* Consume the G. */ - advance_char (dm); - switch (peek_char (dm)) - { - case 'V': - /* A guard variable name. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "guard variable for ")); - RETURN_IF_ERROR (demangle_name (dm, &unused)); - break; - - case 'R': - /* A reference temporary. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "reference temporary for ")); - RETURN_IF_ERROR (demangle_name (dm, &unused)); - break; - - default: - return "Unrecognized <special-name>."; - } + if (! d_add_substitution (di, ret)) + return NULL; } - else if (peek == 'T') - { - status_t status = STATUS_OK; - /* Other C++ implementation miscellania. Consume the T. */ - advance_char (dm); + return ret; +} - switch (peek_char (dm)) - { - case 'V': - /* Virtual table. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "vtable for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; +/* <CV-qualifiers> ::= [r] [V] [K] */ - case 'T': - /* VTT structure. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "VTT for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; +static struct demangle_component ** +d_cv_qualifiers (struct d_info *di, + struct demangle_component **pret, int member_fn) +{ + char peek; - case 'I': - /* Typeinfo structure. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "typeinfo for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; + peek = d_peek_char (di); + while (peek == 'r' || peek == 'V' || peek == 'K') + { + enum demangle_component_type t; - case 'F': - /* Typeinfo function. Used only in old ABI with new mangling. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "typeinfo fn for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; + d_advance (di, 1); + if (peek == 'r') + { + t = (member_fn + ? DEMANGLE_COMPONENT_RESTRICT_THIS + : DEMANGLE_COMPONENT_RESTRICT); + di->expansion += sizeof "restrict"; + } + else if (peek == 'V') + { + t = (member_fn + ? DEMANGLE_COMPONENT_VOLATILE_THIS + : DEMANGLE_COMPONENT_VOLATILE); + di->expansion += sizeof "volatile"; + } + else + { + t = (member_fn + ? DEMANGLE_COMPONENT_CONST_THIS + : DEMANGLE_COMPONENT_CONST); + di->expansion += sizeof "const"; + } - case 'S': - /* Character string containing type name, used in typeinfo. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "typeinfo name for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; + *pret = d_make_comp (di, t, NULL, NULL); + if (*pret == NULL) + return NULL; + pret = &d_left (*pret); - case 'J': - /* The java Class variable corresponding to a C++ class. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "java Class for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; + peek = d_peek_char (di); + } - case 'h': - /* Non-virtual thunk. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "non-virtual thunk")); - RETURN_IF_ERROR (demangle_nv_offset (dm)); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - /* Demangle and emit the target name and function type. */ - RETURN_IF_ERROR (result_add (dm, " to ")); - RETURN_IF_ERROR (demangle_encoding (dm)); - break; + return pret; +} - case 'v': - /* Virtual thunk. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "virtual thunk")); - RETURN_IF_ERROR (demangle_v_offset (dm)); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - /* Demangle and emit the target function. */ - RETURN_IF_ERROR (result_add (dm, " to ")); - RETURN_IF_ERROR (demangle_encoding (dm)); - break; +/* <function-type> ::= F [Y] <bare-function-type> E */ - case 'c': - /* Covariant return thunk. */ - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "covariant return thunk")); - RETURN_IF_ERROR (demangle_call_offset (dm)); - RETURN_IF_ERROR (demangle_call_offset (dm)); - /* Demangle and emit the target function. */ - RETURN_IF_ERROR (result_add (dm, " to ")); - RETURN_IF_ERROR (demangle_encoding (dm)); - break; +static struct demangle_component * +d_function_type (struct d_info *di) +{ + struct demangle_component *ret; - case 'C': - /* TC is a special g++ mangling for a construction vtable. */ - if (!flag_strict) - { - dyn_string_t derived_type; + if (d_next_char (di) != 'F') + return NULL; + if (d_peek_char (di) == 'Y') + { + /* Function has C linkage. We don't print this information. + FIXME: We should print it in verbose mode. */ + d_advance (di, 1); + } + ret = d_bare_function_type (di, 1); + if (d_next_char (di) != 'E') + return NULL; + return ret; +} - advance_char (dm); - RETURN_IF_ERROR (result_add (dm, "construction vtable for ")); +/* <bare-function-type> ::= [J]<type>+ */ - /* Demangle the derived type off to the side. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_type (dm)); - derived_type = (dyn_string_t) result_pop (dm); +static struct demangle_component * +d_bare_function_type (struct d_info *di, int has_return_type) +{ + struct demangle_component *return_type; + struct demangle_component *tl; + struct demangle_component **ptl; + char peek; - /* Demangle the offset. */ - number = dyn_string_new (4); - if (number == NULL) - { - dyn_string_delete (derived_type); - return STATUS_ALLOCATION_FAILED; - } - demangle_number_literally (dm, number, 10, 1); - /* Demangle the underscore separator. */ - status = demangle_char (dm, '_'); - - /* Demangle the base type. */ - if (STATUS_NO_ERROR (status)) - status = demangle_type (dm); - - /* Emit the derived type. */ - if (STATUS_NO_ERROR (status)) - status = result_add (dm, "-in-"); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, derived_type); - dyn_string_delete (derived_type); - - /* Don't display the offset unless in verbose mode. */ - if (flag_verbose) - { - status = result_add_char (dm, ' '); - if (STATUS_NO_ERROR (status)) - result_add_string (dm, number); - } - dyn_string_delete (number); - RETURN_IF_ERROR (status); - break; - } - /* If flag_strict, fall through. */ + /* Detect special qualifier indicating that the first argument + is the return type. */ + peek = d_peek_char (di); + if (peek == 'J') + { + d_advance (di, 1); + has_return_type = 1; + } - default: - return "Unrecognized <special-name>."; + return_type = NULL; + tl = NULL; + ptl = &tl; + while (1) + { + struct demangle_component *type; + + peek = d_peek_char (di); + if (peek == '\0' || peek == 'E') + break; + type = cplus_demangle_type (di); + if (type == NULL) + return NULL; + if (has_return_type) + { + return_type = type; + has_return_type = 0; + } + else + { + *ptl = d_make_comp (di, DEMANGLE_COMPONENT_ARGLIST, type, NULL); + if (*ptl == NULL) + return NULL; + ptl = &d_right (*ptl); } } - else - return STATUS_ERROR; - return STATUS_OK; + /* There should be at least one parameter type besides the optional + return type. A function which takes no arguments will have a + single parameter type void. */ + if (tl == NULL) + return NULL; + + /* If we have a single parameter type void, omit it. */ + if (d_right (tl) == NULL + && d_left (tl)->type == DEMANGLE_COMPONENT_BUILTIN_TYPE + && d_left (tl)->u.s_builtin.type->print == D_PRINT_VOID) + { + di->expansion -= d_left (tl)->u.s_builtin.type->len; + tl = NULL; + } + + return d_make_comp (di, DEMANGLE_COMPONENT_FUNCTION_TYPE, return_type, tl); } -/* Demangles and emits a <ctor-dtor-name>. - - <ctor-dtor-name> - ::= C1 # complete object (in-charge) ctor - ::= C2 # base object (not-in-charge) ctor - ::= C3 # complete object (in-charge) allocating ctor - ::= D0 # deleting (in-charge) dtor - ::= D1 # complete object (in-charge) dtor - ::= D2 # base object (not-in-charge) dtor */ - -static status_t -demangle_ctor_dtor_name (dm) - demangling_t dm; +/* <class-enum-type> ::= <name> */ + +static struct demangle_component * +d_class_enum_type (struct d_info *di) { - static const char *const ctor_flavors[] = - { - "in-charge", - "not-in-charge", - "allocating" - }; - static const char *const dtor_flavors[] = - { - "in-charge deleting", - "in-charge", - "not-in-charge" - }; + return d_name (di); +} - int flavor; - char peek = peek_char (dm); +/* <array-type> ::= A <(positive dimension) number> _ <(element) type> + ::= A [<(dimension) expression>] _ <(element) type> +*/ - DEMANGLE_TRACE ("ctor-dtor-name", dm); - - if (peek == 'C') +static struct demangle_component * +d_array_type (struct d_info *di) +{ + char peek; + struct demangle_component *dim; + + if (d_next_char (di) != 'A') + return NULL; + + peek = d_peek_char (di); + if (peek == '_') + dim = NULL; + else if (IS_DIGIT (peek)) { - /* A constructor name. Consume the C. */ - advance_char (dm); - flavor = next_char (dm); - if (flavor < '1' || flavor > '3') - return "Unrecognized constructor."; - RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name)); - switch (flavor) - { - case '1': dm->is_constructor = gnu_v3_complete_object_ctor; - break; - case '2': dm->is_constructor = gnu_v3_base_object_ctor; - break; - case '3': dm->is_constructor = gnu_v3_complete_object_allocating_ctor; - break; - } - /* Print the flavor of the constructor if in verbose mode. */ - if (flag_verbose) + const char *s; + + s = d_str (di); + do { - RETURN_IF_ERROR (result_add (dm, "[")); - RETURN_IF_ERROR (result_add (dm, ctor_flavors[flavor - '1'])); - RETURN_IF_ERROR (result_add_char (dm, ']')); + d_advance (di, 1); + peek = d_peek_char (di); } + while (IS_DIGIT (peek)); + dim = d_make_name (di, s, d_str (di) - s); + if (dim == NULL) + return NULL; } - else if (peek == 'D') + else { - /* A destructor name. Consume the D. */ - advance_char (dm); - flavor = next_char (dm); - if (flavor < '0' || flavor > '2') - return "Unrecognized destructor."; - RETURN_IF_ERROR (result_add_char (dm, '~')); - RETURN_IF_ERROR (result_add_string (dm, dm->last_source_name)); - switch (flavor) - { - case '0': dm->is_destructor = gnu_v3_deleting_dtor; - break; - case '1': dm->is_destructor = gnu_v3_complete_object_dtor; - break; - case '2': dm->is_destructor = gnu_v3_base_object_dtor; - break; - } - /* Print the flavor of the destructor if in verbose mode. */ - if (flag_verbose) - { - RETURN_IF_ERROR (result_add (dm, " [")); - RETURN_IF_ERROR (result_add (dm, dtor_flavors[flavor - '0'])); - RETURN_IF_ERROR (result_add_char (dm, ']')); - } + dim = d_expression (di); + if (dim == NULL) + return NULL; } - else - return STATUS_ERROR; - return STATUS_OK; + if (d_next_char (di) != '_') + return NULL; + + return d_make_comp (di, DEMANGLE_COMPONENT_ARRAY_TYPE, dim, + cplus_demangle_type (di)); } -/* Handle pointer, reference, and pointer-to-member cases for - demangle_type. All consecutive `P's, `R's, and 'M's are joined to - build a pointer/reference type. We snarf all these, plus the - following <type>, all at once since we need to know whether we have - a pointer to data or pointer to function to construct the right - output syntax. C++'s pointer syntax is hairy. - - This function adds substitution candidates for every nested - pointer/reference type it processes, including the outermost, final - type, assuming the substitution starts at SUBSTITUTION_START in the - demangling result. For example, if this function demangles - `PP3Foo', it will add a substitution for `Foo', `Foo*', and - `Foo**', in that order. - - *INSERT_POS is a quantity used internally, when this function calls - itself recursively, to figure out where to insert pointer - punctuation on the way up. On entry to this function, INSERT_POS - should point to a temporary value, but that value need not be - initialized. - - <type> ::= P <type> - ::= R <type> - ::= <pointer-to-member-type> - - <pointer-to-member-type> ::= M </class/ type> </member/ type> */ - -static status_t -demangle_type_ptr (dm, insert_pos, substitution_start) - demangling_t dm; - int *insert_pos; - int substitution_start; +/* <pointer-to-member-type> ::= M <(class) type> <(member) type> */ + +static struct demangle_component * +d_pointer_to_member_type (struct d_info *di) { - status_t status; - int is_substitution_candidate = 1; + struct demangle_component *cl; + struct demangle_component *mem; + struct demangle_component **pmem; - DEMANGLE_TRACE ("type*", dm); + if (d_next_char (di) != 'M') + return NULL; - /* Scan forward, collecting pointers and references into symbols, - until we hit something else. Then emit the type. */ - switch (peek_char (dm)) + cl = cplus_demangle_type (di); + + /* The ABI specifies that any type can be a substitution source, and + that M is followed by two types, and that when a CV-qualified + type is seen both the base type and the CV-qualified types are + substitution sources. The ABI also specifies that for a pointer + to a CV-qualified member function, the qualifiers are attached to + the second type. Given the grammar, a plain reading of the ABI + suggests that both the CV-qualified member function and the + non-qualified member function are substitution sources. However, + g++ does not work that way. g++ treats only the CV-qualified + member function as a substitution source. FIXME. So to work + with g++, we need to pull off the CV-qualifiers here, in order to + avoid calling add_substitution() in cplus_demangle_type(). */ + + pmem = d_cv_qualifiers (di, &mem, 1); + if (pmem == NULL) + return NULL; + *pmem = cplus_demangle_type (di); + + return d_make_comp (di, DEMANGLE_COMPONENT_PTRMEM_TYPE, cl, mem); +} + +/* <template-param> ::= T_ + ::= T <(parameter-2 non-negative) number> _ +*/ + +static struct demangle_component * +d_template_param (struct d_info *di) +{ + long param; + + if (d_next_char (di) != 'T') + return NULL; + + if (d_peek_char (di) == '_') + param = 0; + else { - case 'P': - /* A pointer. Snarf the `P'. */ - advance_char (dm); - /* Demangle the underlying type. */ - RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos, - substitution_start)); - /* Insert an asterisk where we're told to; it doesn't - necessarily go at the end. If we're doing Java style output, - there is no pointer symbol. */ - if (dm->style != DMGL_JAVA) - RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '*')); - /* The next (outermost) pointer or reference character should go - after this one. */ - ++(*insert_pos); - break; + param = d_number (di); + if (param < 0) + return NULL; + param += 1; + } - case 'R': - /* A reference. Snarf the `R'. */ - advance_char (dm); - /* Demangle the underlying type. */ - RETURN_IF_ERROR (demangle_type_ptr (dm, insert_pos, - substitution_start)); - /* Insert an ampersand where we're told to; it doesn't - necessarily go at the end. */ - RETURN_IF_ERROR (result_insert_char (dm, *insert_pos, '&')); - /* The next (outermost) pointer or reference character should go - after this one. */ - ++(*insert_pos); - break; + if (d_next_char (di) != '_') + return NULL; - case 'M': + ++di->did_subs; + + return d_make_template_param (di, param); +} + +/* <template-args> ::= I <template-arg>+ E */ + +static struct demangle_component * +d_template_args (struct d_info *di) +{ + struct demangle_component *hold_last_name; + struct demangle_component *al; + struct demangle_component **pal; + + /* Preserve the last name we saw--don't let the template arguments + clobber it, as that would give us the wrong name for a subsequent + constructor or destructor. */ + hold_last_name = di->last_name; + + if (d_next_char (di) != 'I') + return NULL; + + al = NULL; + pal = &al; + while (1) { - /* A pointer-to-member. */ - dyn_string_t class_type; - - /* Eat the 'M'. */ - advance_char (dm); - - /* Capture the type of which this is a pointer-to-member. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_type (dm)); - class_type = (dyn_string_t) result_pop (dm); - - if (peek_char (dm) == 'F') - /* A pointer-to-member function. We want output along the - lines of `void (C::*) (int, int)'. Demangle the function - type, which would in this case give `void () (int, int)' - and set *insert_pos to the spot between the first - parentheses. */ - status = demangle_type_ptr (dm, insert_pos, substitution_start); - else if (peek_char (dm) == 'A') - /* A pointer-to-member array variable. We want output that - looks like `int (Klass::*) [10]'. Demangle the array type - as `int () [10]', and set *insert_pos to the spot between - the parentheses. */ - status = demangle_array_type (dm, insert_pos); - else - { - /* A pointer-to-member variable. Demangle the type of the - pointed-to member. */ - status = demangle_type (dm); - /* Make it pretty. */ - if (STATUS_NO_ERROR (status) - && !result_previous_char_is_space (dm)) - status = result_add_char (dm, ' '); - /* The pointer-to-member notation (e.g. `C::*') follows the - member's type. */ - *insert_pos = result_caret_pos (dm); - } + struct demangle_component *a; - /* Build the pointer-to-member notation. */ - if (STATUS_NO_ERROR (status)) - status = result_insert (dm, *insert_pos, "::*"); - if (STATUS_NO_ERROR (status)) - status = result_insert_string (dm, *insert_pos, class_type); - /* There may be additional levels of (pointer or reference) - indirection in this type. If so, the `*' and `&' should be - added after the pointer-to-member notation (e.g. `C::*&' for - a reference to a pointer-to-member of class C). */ - *insert_pos += dyn_string_length (class_type) + 3; - - /* Clean up. */ - dyn_string_delete (class_type); - - RETURN_IF_ERROR (status); + a = d_template_arg (di); + if (a == NULL) + return NULL; + + *pal = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, a, NULL); + if (*pal == NULL) + return NULL; + pal = &d_right (*pal); + + if (d_peek_char (di) == 'E') + { + d_advance (di, 1); + break; + } } - break; - case 'F': - /* Ooh, tricky, a pointer-to-function. When we demangle the - function type, the return type should go at the very - beginning. */ - *insert_pos = result_caret_pos (dm); - /* The parentheses indicate this is a function pointer or - reference type. */ - RETURN_IF_ERROR (result_add (dm, "()")); - /* Now demangle the function type. The return type will be - inserted before the `()', and the argument list will go after - it. */ - RETURN_IF_ERROR (demangle_function_type (dm, insert_pos)); - /* We should now have something along the lines of - `void () (int, int)'. The pointer or reference characters - have to inside the first set of parentheses. *insert_pos has - already been updated to point past the end of the return - type. Move it one character over so it points inside the - `()'. */ - ++(*insert_pos); - break; + di->last_name = hold_last_name; - case 'A': - /* An array pointer or reference. demangle_array_type will figure - out where the asterisks and ampersands go. */ - RETURN_IF_ERROR (demangle_array_type (dm, insert_pos)); - break; + return al; +} + +/* <template-arg> ::= <type> + ::= X <expression> E + ::= <expr-primary> +*/ + +static struct demangle_component * +d_template_arg (struct d_info *di) +{ + struct demangle_component *ret; + + switch (d_peek_char (di)) + { + case 'X': + d_advance (di, 1); + ret = d_expression (di); + if (d_next_char (di) != 'E') + return NULL; + return ret; + + case 'L': + return d_expr_primary (di); default: - /* No more pointer or reference tokens; this is therefore a - pointer to data. Finish up by demangling the underlying - type. */ - RETURN_IF_ERROR (demangle_type (dm)); - /* The pointer or reference characters follow the underlying - type, as in `int*&'. */ - *insert_pos = result_caret_pos (dm); - /* Because of the production <type> ::= <substitution>, - demangle_type will already have added the underlying type as - a substitution candidate. Don't do it again. */ - is_substitution_candidate = 0; - break; + return cplus_demangle_type (di); } - - if (is_substitution_candidate) - RETURN_IF_ERROR (substitution_add (dm, substitution_start, 0)); - - return STATUS_OK; } -/* Demangles and emits a <type>. - - <type> ::= <builtin-type> - ::= <function-type> - ::= <class-enum-type> - ::= <array-type> - ::= <pointer-to-member-type> - ::= <template-param> - ::= <template-template-param> <template-args> - ::= <CV-qualifiers> <type> - ::= P <type> # pointer-to - ::= R <type> # reference-to - ::= C <type> # complex pair (C 2000) - ::= G <type> # imaginary (C 2000) - ::= U <source-name> <type> # vendor extended type qualifier - ::= <substitution> */ - -static status_t -demangle_type (dm) - demangling_t dm; +/* <expression> ::= <(unary) operator-name> <expression> + ::= <(binary) operator-name> <expression> <expression> + ::= <(trinary) operator-name> <expression> <expression> <expression> + ::= st <type> + ::= <template-param> + ::= sr <type> <unqualified-name> + ::= sr <type> <unqualified-name> <template-args> + ::= <expr-primary> +*/ + +static struct demangle_component * +d_expression (struct d_info *di) { - int start = substitution_start (dm); - char peek = peek_char (dm); - char peek_next; - int encode_return_type = 0; - template_arg_list_t old_arg_list = current_template_arg_list (dm); - int insert_pos; - - /* A <type> can be a <substitution>; therefore, this <type> is a - substitution candidate unless a special condition holds (see - below). */ - int is_substitution_candidate = 1; - - DEMANGLE_TRACE ("type", dm); - - /* A <class-enum-type> can start with a digit (a <source-name>), an - N (a <nested-name>), or a Z (a <local-name>). */ - if (IS_DIGIT ((unsigned char) peek) || peek == 'N' || peek == 'Z') - RETURN_IF_ERROR (demangle_class_enum_type (dm, &encode_return_type)); - /* Lower-case letters begin <builtin-type>s, except for `r', which - denotes restrict. */ - else if (peek >= 'a' && peek <= 'z' && peek != 'r') + char peek; + + peek = d_peek_char (di); + if (peek == 'L') + return d_expr_primary (di); + else if (peek == 'T') + return d_template_param (di); + else if (peek == 's' && d_peek_next_char (di) == 'r') { - RETURN_IF_ERROR (demangle_builtin_type (dm)); - /* Built-in types are not substitution candidates. */ - is_substitution_candidate = 0; + struct demangle_component *type; + struct demangle_component *name; + + d_advance (di, 2); + type = cplus_demangle_type (di); + name = d_unqualified_name (di); + if (d_peek_char (di) != 'I') + return d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME, type, name); + else + return d_make_comp (di, DEMANGLE_COMPONENT_QUAL_NAME, type, + d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name, + d_template_args (di))); } else - switch (peek) - { - case 'r': - case 'V': - case 'K': - /* CV-qualifiers (including restrict). We have to demangle - them off to the side, since C++ syntax puts them in a funny - place for qualified pointer and reference types. */ - { - status_t status; - dyn_string_t cv_qualifiers = dyn_string_new (24); - int old_caret_position = result_get_caret (dm); - - if (cv_qualifiers == NULL) - return STATUS_ALLOCATION_FAILED; - - /* Decode all adjacent CV qualifiers. */ - demangle_CV_qualifiers (dm, cv_qualifiers); - /* Emit them, and shift the caret left so that the - underlying type will be emitted before the qualifiers. */ - status = result_add_string (dm, cv_qualifiers); - result_shift_caret (dm, -dyn_string_length (cv_qualifiers)); - /* Clean up. */ - dyn_string_delete (cv_qualifiers); - RETURN_IF_ERROR (status); - /* Also prepend a blank, if needed. */ - RETURN_IF_ERROR (result_add_char (dm, ' ')); - result_shift_caret (dm, -1); - - /* Demangle the underlying type. It will be emitted before - the CV qualifiers, since we moved the caret. */ - RETURN_IF_ERROR (demangle_type (dm)); - - /* Put the caret back where it was previously. */ - result_set_caret (dm, old_caret_position); - } - break; - - case 'F': - return "Non-pointer or -reference function type."; + { + struct demangle_component *op; + int args; - case 'A': - RETURN_IF_ERROR (demangle_array_type (dm, NULL)); - break; + op = d_operator_name (di); + if (op == NULL) + return NULL; - case 'T': - /* It's either a <template-param> or a - <template-template-param>. In either case, demangle the - `T' token first. */ - RETURN_IF_ERROR (demangle_template_param (dm)); + if (op->type == DEMANGLE_COMPONENT_OPERATOR) + di->expansion += op->u.s_operator.op->len - 2; - /* Check for a template argument list; if one is found, it's a - <template-template-param> ::= <template-param> - ::= <substitution> */ - if (peek_char (dm) == 'I') - { - /* Add a substitution candidate. The template parameter - `T' token is a substitution candidate by itself, - without the template argument list. */ - RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type)); - - /* Now demangle the template argument list. */ - RETURN_IF_ERROR (demangle_template_args (dm)); - /* The entire type, including the template template - parameter and its argument list, will be added as a - substitution candidate below. */ - } + if (op->type == DEMANGLE_COMPONENT_OPERATOR + && strcmp (op->u.s_operator.op->code, "st") == 0) + return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op, + cplus_demangle_type (di)); - break; + switch (op->type) + { + default: + return NULL; + case DEMANGLE_COMPONENT_OPERATOR: + args = op->u.s_operator.op->args; + break; + case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: + args = op->u.s_extended_operator.args; + break; + case DEMANGLE_COMPONENT_CAST: + args = 1; + break; + } - case 'S': - /* First check if this is a special substitution. If it is, - this is a <class-enum-type>. Special substitutions have a - letter following the `S'; other substitutions have a digit - or underscore. */ - peek_next = peek_char_next (dm); - if (IS_DIGIT (peek_next) || peek_next == '_') + switch (args) + { + case 1: + return d_make_comp (di, DEMANGLE_COMPONENT_UNARY, op, + d_expression (di)); + case 2: { - RETURN_IF_ERROR (demangle_substitution (dm, &encode_return_type)); - - /* The substituted name may have been a template name. - Check if template arguments follow, and if so, demangle - them. */ - if (peek_char (dm) == 'I') - RETURN_IF_ERROR (demangle_template_args (dm)); - else - /* A substitution token is not itself a substitution - candidate. (However, if the substituted template is - instantiated, the resulting type is.) */ - is_substitution_candidate = 0; + struct demangle_component *left; + + left = d_expression (di); + return d_make_comp (di, DEMANGLE_COMPONENT_BINARY, op, + d_make_comp (di, + DEMANGLE_COMPONENT_BINARY_ARGS, + left, + d_expression (di))); } - else + case 3: { - /* Now some trickiness. We have a special substitution - here. Often, the special substitution provides the - name of a template that's subsequently instantiated, - for instance `SaIcE' => std::allocator<char>. In these - cases we need to add a substitution candidate for the - entire <class-enum-type> and thus don't want to clear - the is_substitution_candidate flag. - - However, it's possible that what we have here is a - substitution token representing an entire type, such as - `Ss' => std::string. In this case, we mustn't add a - new substitution candidate for this substitution token. - To detect this case, remember where the start of the - substitution token is. */ - const char *next = dm->next; - /* Now demangle the <class-enum-type>. */ - RETURN_IF_ERROR - (demangle_class_enum_type (dm, &encode_return_type)); - /* If all that was just demangled is the two-character - special substitution token, supress the addition of a - new candidate for it. */ - if (dm->next == next + 2) - is_substitution_candidate = 0; + struct demangle_component *first; + struct demangle_component *second; + + first = d_expression (di); + second = d_expression (di); + return d_make_comp (di, DEMANGLE_COMPONENT_TRINARY, op, + d_make_comp (di, + DEMANGLE_COMPONENT_TRINARY_ARG1, + first, + d_make_comp (di, + DEMANGLE_COMPONENT_TRINARY_ARG2, + second, + d_expression (di)))); } + default: + return NULL; + } + } +} - break; - - case 'P': - case 'R': - case 'M': - RETURN_IF_ERROR (demangle_type_ptr (dm, &insert_pos, start)); - /* demangle_type_ptr adds all applicable substitution - candidates. */ - is_substitution_candidate = 0; - break; - - case 'C': - /* A C99 complex type. */ - RETURN_IF_ERROR (result_add (dm, "complex ")); - advance_char (dm); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'G': - /* A C99 imaginary type. */ - RETURN_IF_ERROR (result_add (dm, "imaginary ")); - advance_char (dm); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'U': - /* Vendor-extended type qualifier. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_source_name (dm)); - RETURN_IF_ERROR (result_add_char (dm, ' ')); - RETURN_IF_ERROR (demangle_type (dm)); - break; +/* <expr-primary> ::= L <type> <(value) number> E + ::= L <type> <(value) float> E + ::= L <mangled-name> E +*/ - default: - return "Unexpected character in <type>."; - } +static struct demangle_component * +d_expr_primary (struct d_info *di) +{ + struct demangle_component *ret; - if (is_substitution_candidate) - /* Add a new substitution for the type. If this type was a - <template-param>, pass its index since from the point of - substitutions; a <template-param> token is a substitution - candidate distinct from the type that is substituted for it. */ - RETURN_IF_ERROR (substitution_add (dm, start, encode_return_type)); + if (d_next_char (di) != 'L') + return NULL; + if (d_peek_char (di) == '_') + ret = cplus_demangle_mangled_name (di, 0); + else + { + struct demangle_component *type; + enum demangle_component_type t; + const char *s; - /* Pop off template argument lists added during mangling of this - type. */ - pop_to_template_arg_list (dm, old_arg_list); + type = cplus_demangle_type (di); + if (type == NULL) + return NULL; - return STATUS_OK; + /* If we have a type we know how to print, we aren't going to + print the type name itself. */ + if (type->type == DEMANGLE_COMPONENT_BUILTIN_TYPE + && type->u.s_builtin.type->print != D_PRINT_DEFAULT) + di->expansion -= type->u.s_builtin.type->len; + + /* Rather than try to interpret the literal value, we just + collect it as a string. Note that it's possible to have a + floating point literal here. The ABI specifies that the + format of such literals is machine independent. That's fine, + but what's not fine is that versions of g++ up to 3.2 with + -fabi-version=1 used upper case letters in the hex constant, + and dumped out gcc's internal representation. That makes it + hard to tell where the constant ends, and hard to dump the + constant in any readable form anyhow. We don't attempt to + handle these cases. */ + + t = DEMANGLE_COMPONENT_LITERAL; + if (d_peek_char (di) == 'n') + { + t = DEMANGLE_COMPONENT_LITERAL_NEG; + d_advance (di, 1); + } + s = d_str (di); + while (d_peek_char (di) != 'E') + { + if (d_peek_char (di) == '\0') + return NULL; + d_advance (di, 1); + } + ret = d_make_comp (di, t, type, d_make_name (di, s, d_str (di) - s)); + } + if (d_next_char (di) != 'E') + return NULL; + return ret; } -/* C++ source names of builtin types, indexed by the mangled code - letter's position in the alphabet ('a' -> 0, 'b' -> 1, etc). */ -static const char *const builtin_type_names[26] = -{ - "signed char", /* a */ - "bool", /* b */ - "char", /* c */ - "double", /* d */ - "long double", /* e */ - "float", /* f */ - "__float128", /* g */ - "unsigned char", /* h */ - "int", /* i */ - "unsigned", /* j */ - NULL, /* k */ - "long", /* l */ - "unsigned long", /* m */ - "__int128", /* n */ - "unsigned __int128", /* o */ - NULL, /* p */ - NULL, /* q */ - NULL, /* r */ - "short", /* s */ - "unsigned short", /* t */ - NULL, /* u */ - "void", /* v */ - "wchar_t", /* w */ - "long long", /* x */ - "unsigned long long", /* y */ - "..." /* z */ -}; +/* <local-name> ::= Z <(function) encoding> E <(entity) name> [<discriminator>] + ::= Z <(function) encoding> E s [<discriminator>] +*/ -/* Java source names of builtin types. Types that arn't valid in Java - are also included here - we don't fail if someone attempts to demangle a - C++ symbol in Java style. */ -static const char *const java_builtin_type_names[26] = +static struct demangle_component * +d_local_name (struct d_info *di) { - "signed char", /* a */ - "boolean", /* C++ "bool" */ /* b */ - "byte", /* C++ "char" */ /* c */ - "double", /* d */ - "long double", /* e */ - "float", /* f */ - "__float128", /* g */ - "unsigned char", /* h */ - "int", /* i */ - "unsigned", /* j */ - NULL, /* k */ - "long", /* l */ - "unsigned long", /* m */ - "__int128", /* n */ - "unsigned __int128", /* o */ - NULL, /* p */ - NULL, /* q */ - NULL, /* r */ - "short", /* s */ - "unsigned short", /* t */ - NULL, /* u */ - "void", /* v */ - "char", /* C++ "wchar_t" */ /* w */ - "long", /* C++ "long long" */ /* x */ - "unsigned long long", /* y */ - "..." /* z */ -}; + struct demangle_component *function; -/* Demangles and emits a <builtin-type>. - - <builtin-type> ::= v # void - ::= w # wchar_t - ::= b # bool - ::= c # char - ::= a # signed char - ::= h # unsigned char - ::= s # short - ::= t # unsigned short - ::= i # int - ::= j # unsigned int - ::= l # long - ::= m # unsigned long - ::= x # long long, __int64 - ::= y # unsigned long long, __int64 - ::= n # __int128 - ::= o # unsigned __int128 - ::= f # float - ::= d # double - ::= e # long double, __float80 - ::= g # __float128 - ::= z # ellipsis - ::= u <source-name> # vendor extended type */ - -static status_t -demangle_builtin_type (dm) - demangling_t dm; -{ + if (d_next_char (di) != 'Z') + return NULL; - char code = peek_char (dm); + function = d_encoding (di, 0); - DEMANGLE_TRACE ("builtin-type", dm); + if (d_next_char (di) != 'E') + return NULL; - if (code == 'u') + if (d_peek_char (di) == 's') { - advance_char (dm); - RETURN_IF_ERROR (demangle_source_name (dm)); - return STATUS_OK; + d_advance (di, 1); + if (! d_discriminator (di)) + return NULL; + return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function, + d_make_name (di, "string literal", + sizeof "string literal" - 1)); } - else if (code >= 'a' && code <= 'z') + else { - const char *type_name; - /* Java uses different names for some built-in types. */ - if (dm->style == DMGL_JAVA) - type_name = java_builtin_type_names[code - 'a']; - else - type_name = builtin_type_names[code - 'a']; - if (type_name == NULL) - return "Unrecognized <builtin-type> code."; + struct demangle_component *name; - RETURN_IF_ERROR (result_add (dm, type_name)); - advance_char (dm); - return STATUS_OK; + name = d_name (di); + if (! d_discriminator (di)) + return NULL; + return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function, name); } - else - return "Non-alphabetic <builtin-type> code."; } -/* Demangles all consecutive CV-qualifiers (const, volatile, and - restrict) at the current position. The qualifiers are appended to - QUALIFIERS. Returns STATUS_OK. */ - -static status_t -demangle_CV_qualifiers (dm, qualifiers) - demangling_t dm; - dyn_string_t qualifiers; -{ - DEMANGLE_TRACE ("CV-qualifiers", dm); +/* <discriminator> ::= _ <(non-negative) number> - while (1) - { - switch (peek_char (dm)) - { - case 'r': - if (!dyn_string_append_space (qualifiers)) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_append_cstr (qualifiers, "restrict")) - return STATUS_ALLOCATION_FAILED; - break; - - case 'V': - if (!dyn_string_append_space (qualifiers)) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_append_cstr (qualifiers, "volatile")) - return STATUS_ALLOCATION_FAILED; - break; - - case 'K': - if (!dyn_string_append_space (qualifiers)) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_append_cstr (qualifiers, "const")) - return STATUS_ALLOCATION_FAILED; - break; + We demangle the discriminator, but we don't print it out. FIXME: + We should print it out in verbose mode. */ - default: - return STATUS_OK; - } +static int +d_discriminator (struct d_info *di) +{ + long discrim; - advance_char (dm); - } + if (d_peek_char (di) != '_') + return 1; + d_advance (di, 1); + discrim = d_number (di); + if (discrim < 0) + return 0; + return 1; } -/* Demangles and emits a <function-type>. *FUNCTION_NAME_POS is the - position in the result string of the start of the function - identifier, at which the function's return type will be inserted; - *FUNCTION_NAME_POS is updated to position past the end of the - function's return type. - - <function-type> ::= F [Y] <bare-function-type> E */ +/* Add a new substitution. */ -static status_t -demangle_function_type (dm, function_name_pos) - demangling_t dm; - int *function_name_pos; +static int +d_add_substitution (struct d_info *di, struct demangle_component *dc) { - DEMANGLE_TRACE ("function-type", dm); - RETURN_IF_ERROR (demangle_char (dm, 'F')); - if (peek_char (dm) == 'Y') - { - /* Indicate this function has C linkage if in verbose mode. */ - if (flag_verbose) - RETURN_IF_ERROR (result_add (dm, " [extern \"C\"] ")); - advance_char (dm); - } - RETURN_IF_ERROR (demangle_bare_function_type (dm, function_name_pos)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - return STATUS_OK; + if (dc == NULL) + return 0; + if (di->next_sub >= di->num_subs) + return 0; + di->subs[di->next_sub] = dc; + ++di->next_sub; + return 1; } -/* Demangles and emits a <bare-function-type>. RETURN_TYPE_POS is the - position in the result string at which the function return type - should be inserted. If RETURN_TYPE_POS is BFT_NO_RETURN_TYPE, the - function's return type is assumed not to be encoded. +/* <substitution> ::= S <seq-id> _ + ::= S_ + ::= St + ::= Sa + ::= Sb + ::= Ss + ::= Si + ::= So + ::= Sd + + If PREFIX is non-zero, then this type is being used as a prefix in + a qualified name. In this case, for the standard substitutions, we + need to check whether we are being used as a prefix for a + constructor or destructor, and return a full template name. + Otherwise we will get something like std::iostream::~iostream() + which does not correspond particularly well to any function which + actually appears in the source. +*/ - <bare-function-type> ::= <signature type>+ */ +static const struct d_standard_sub_info standard_subs[] = +{ + { 't', NL ("std"), + NL ("std"), + NULL, 0 }, + { 'a', NL ("std::allocator"), + NL ("std::allocator"), + NL ("allocator") }, + { 'b', NL ("std::basic_string"), + NL ("std::basic_string"), + NL ("basic_string") }, + { 's', NL ("std::string"), + NL ("std::basic_string<char, std::char_traits<char>, std::allocator<char> >"), + NL ("basic_string") }, + { 'i', NL ("std::istream"), + NL ("std::basic_istream<char, std::char_traits<char> >"), + NL ("basic_istream") }, + { 'o', NL ("std::ostream"), + NL ("std::basic_ostream<char, std::char_traits<char> >"), + NL ("basic_ostream") }, + { 'd', NL ("std::iostream"), + NL ("std::basic_iostream<char, std::char_traits<char> >"), + NL ("basic_iostream") } +}; -static status_t -demangle_bare_function_type (dm, return_type_pos) - demangling_t dm; - int *return_type_pos; +static struct demangle_component * +d_substitution (struct d_info *di, int prefix) { - /* Sequence is the index of the current function parameter, counting - from zero. The value -1 denotes the return type. */ - int sequence = - (return_type_pos == BFT_NO_RETURN_TYPE ? 0 : -1); + char c; - DEMANGLE_TRACE ("bare-function-type", dm); + if (d_next_char (di) != 'S') + return NULL; - RETURN_IF_ERROR (result_add_char (dm, '(')); - while (!end_of_name_p (dm) && peek_char (dm) != 'E') + c = d_next_char (di); + if (c == '_' || IS_DIGIT (c) || IS_UPPER (c)) { - if (sequence == -1) - /* We're decoding the function's return type. */ + int id; + + id = 0; + if (c != '_') { - dyn_string_t return_type; - status_t status = STATUS_OK; - - /* Decode the return type off to the side. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_type (dm)); - return_type = (dyn_string_t) result_pop (dm); - - /* Add a space to the end of the type. Insert the return - type where we've been asked to. */ - if (!dyn_string_append_space (return_type)) - status = STATUS_ALLOCATION_FAILED; - if (STATUS_NO_ERROR (status)) + do { - if (!dyn_string_insert (result_string (dm), *return_type_pos, - return_type)) - status = STATUS_ALLOCATION_FAILED; + if (IS_DIGIT (c)) + id = id * 36 + c - '0'; + else if (IS_UPPER (c)) + id = id * 36 + c - 'A' + 10; else - *return_type_pos += dyn_string_length (return_type); + return NULL; + c = d_next_char (di); } + while (c != '_'); + + ++id; + } - dyn_string_delete (return_type); - RETURN_IF_ERROR (status); + if (id >= di->next_sub) + return NULL; + + ++di->did_subs; + + return di->subs[id]; + } + else + { + int verbose; + const struct d_standard_sub_info *p; + const struct d_standard_sub_info *pend; + + verbose = (di->options & DMGL_VERBOSE) != 0; + if (! verbose && prefix) + { + char peek; + + peek = d_peek_char (di); + if (peek == 'C' || peek == 'D') + verbose = 1; } - else + + pend = (&standard_subs[0] + + sizeof standard_subs / sizeof standard_subs[0]); + for (p = &standard_subs[0]; p < pend; ++p) { - /* Skip `void' parameter types. One should only occur as - the only type in a parameter list; in that case, we want - to print `foo ()' instead of `foo (void)'. */ - if (peek_char (dm) == 'v') - /* Consume the v. */ - advance_char (dm); - else + if (c == p->code) { - /* Separate parameter types by commas. */ - if (sequence > 0) - RETURN_IF_ERROR (result_add (dm, ", ")); - /* Demangle the type. */ - RETURN_IF_ERROR (demangle_type (dm)); + const char *s; + int len; + + if (p->set_last_name != NULL) + di->last_name = d_make_sub (di, p->set_last_name, + p->set_last_name_len); + if (verbose) + { + s = p->full_expansion; + len = p->full_len; + } + else + { + s = p->simple_expansion; + len = p->simple_len; + } + di->expansion += len; + return d_make_sub (di, s, len); } } - ++sequence; + return NULL; } - RETURN_IF_ERROR (result_add_char (dm, ')')); +} - /* We should have demangled at least one parameter type (which would - be void, for a function that takes no parameters), plus the - return type, if we were supposed to demangle that. */ - if (sequence == -1) - return "Missing function return type."; - else if (sequence == 0) - return "Missing function parameter."; +/* Resize the print buffer. */ - return STATUS_OK; -} +static void +d_print_resize (struct d_print_info *dpi, size_t add) +{ + size_t need; + + if (dpi->buf == NULL) + return; + need = dpi->len + add; + while (need > dpi->alc) + { + size_t newalc; + char *newbuf; -/* Demangles and emits a <class-enum-type>. *ENCODE_RETURN_TYPE is set to - non-zero if the type is a template-id, zero otherwise. + newalc = dpi->alc * 2; + newbuf = (char *) realloc (dpi->buf, newalc); + if (newbuf == NULL) + { + free (dpi->buf); + dpi->buf = NULL; + dpi->allocation_failure = 1; + return; + } + dpi->buf = newbuf; + dpi->alc = newalc; + } +} - <class-enum-type> ::= <name> */ +/* Append a character to the print buffer. */ -static status_t -demangle_class_enum_type (dm, encode_return_type) - demangling_t dm; - int *encode_return_type; +static void +d_print_append_char (struct d_print_info *dpi, int c) { - DEMANGLE_TRACE ("class-enum-type", dm); + if (dpi->buf != NULL) + { + if (dpi->len >= dpi->alc) + { + d_print_resize (dpi, 1); + if (dpi->buf == NULL) + return; + } - RETURN_IF_ERROR (demangle_name (dm, encode_return_type)); - return STATUS_OK; + dpi->buf[dpi->len] = c; + ++dpi->len; + } } -/* Demangles and emits an <array-type>. +/* Append a buffer to the print buffer. */ - If PTR_INSERT_POS is not NULL, the array type is formatted as a - pointer or reference to an array, except that asterisk and - ampersand punctuation is omitted (since it's not know at this - point). *PTR_INSERT_POS is set to the position in the demangled - name at which this punctuation should be inserted. For example, - `A10_i' is demangled to `int () [10]' and *PTR_INSERT_POS points - between the parentheses. +static void +d_print_append_buffer (struct d_print_info *dpi, const char *s, size_t l) +{ + if (dpi->buf != NULL) + { + if (dpi->len + l > dpi->alc) + { + d_print_resize (dpi, l); + if (dpi->buf == NULL) + return; + } - If PTR_INSERT_POS is NULL, the array type is assumed not to be - pointer- or reference-qualified. Then, for example, `A10_i' is - demangled simply as `int[10]'. + memcpy (dpi->buf + dpi->len, s, l); + dpi->len += l; + } +} - <array-type> ::= A [<dimension number>] _ <element type> - ::= A <dimension expression> _ <element type> */ +/* Indicate that an error occurred during printing. */ -static status_t -demangle_array_type (dm, ptr_insert_pos) - demangling_t dm; - int *ptr_insert_pos; +static void +d_print_error (struct d_print_info *dpi) { - status_t status = STATUS_OK; - dyn_string_t array_size = NULL; - char peek; + free (dpi->buf); + dpi->buf = NULL; +} + +/* Turn components into a human readable string. OPTIONS is the + options bits passed to the demangler. DC is the tree to print. + ESTIMATE is a guess at the length of the result. This returns a + string allocated by malloc, or NULL on error. On success, this + sets *PALC to the size of the allocated buffer. On failure, this + sets *PALC to 0 for a bad parse, or to 1 for a memory allocation + failure. */ - DEMANGLE_TRACE ("array-type", dm); +CP_STATIC_IF_GLIBCPP_V3 +char * +cplus_demangle_print (int options, const struct demangle_component *dc, + int estimate, size_t *palc) +{ + struct d_print_info dpi; - RETURN_IF_ERROR (demangle_char (dm, 'A')); + dpi.options = options; - /* Demangle the array size into array_size. */ - peek = peek_char (dm); - if (peek == '_') - /* Array bound is omitted. This is a C99-style VLA. */ - ; - else if (IS_DIGIT (peek_char (dm))) + dpi.alc = estimate + 1; + dpi.buf = (char *) malloc (dpi.alc); + if (dpi.buf == NULL) { - /* It looks like a constant array bound. */ - array_size = dyn_string_new (10); - if (array_size == NULL) - return STATUS_ALLOCATION_FAILED; - status = demangle_number_literally (dm, array_size, 10, 0); + *palc = 1; + return NULL; } + + dpi.len = 0; + dpi.templates = NULL; + dpi.modifiers = NULL; + + dpi.allocation_failure = 0; + + d_print_comp (&dpi, dc); + + d_append_char (&dpi, '\0'); + + if (dpi.buf != NULL) + *palc = dpi.alc; else - { - /* Anything is must be an expression for a nont-constant array - bound. This happens if the array type occurs in a template - and the array bound references a template parameter. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_expression (dm)); - array_size = (dyn_string_t) result_pop (dm); - } - /* array_size may have been allocated by now, so we can't use - RETURN_IF_ERROR until it's been deallocated. */ + *palc = dpi.allocation_failure; + + return dpi.buf; +} - /* Demangle the base type of the array. */ - if (STATUS_NO_ERROR (status)) - status = demangle_char (dm, '_'); - if (STATUS_NO_ERROR (status)) - status = demangle_type (dm); +/* Subroutine to handle components. */ - if (ptr_insert_pos != NULL) +static void +d_print_comp (struct d_print_info *dpi, + const struct demangle_component *dc) +{ + if (dc == NULL) { - /* This array is actually part of an pointer- or - reference-to-array type. Format appropriately, except we - don't know which and how much punctuation to use. */ - if (STATUS_NO_ERROR (status)) - status = result_add (dm, " () "); - /* Let the caller know where to insert the punctuation. */ - *ptr_insert_pos = result_caret_pos (dm) - 2; + d_print_error (dpi); + return; } + if (d_print_saw_error (dpi)) + return; - /* Emit the array dimension syntax. */ - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, '['); - if (STATUS_NO_ERROR (status) && array_size != NULL) - status = result_add_string (dm, array_size); - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, ']'); - if (array_size != NULL) - dyn_string_delete (array_size); - - RETURN_IF_ERROR (status); - - return STATUS_OK; -} + switch (dc->type) + { + case DEMANGLE_COMPONENT_NAME: + if ((dpi->options & DMGL_JAVA) == 0) + d_append_buffer (dpi, dc->u.s_name.s, dc->u.s_name.len); + else + d_print_java_identifier (dpi, dc->u.s_name.s, dc->u.s_name.len); + return; + + case DEMANGLE_COMPONENT_QUAL_NAME: + case DEMANGLE_COMPONENT_LOCAL_NAME: + d_print_comp (dpi, d_left (dc)); + if ((dpi->options & DMGL_JAVA) == 0) + d_append_string_constant (dpi, "::"); + else + d_append_char (dpi, '.'); + d_print_comp (dpi, d_right (dc)); + return; -/* Demangles and emits a <template-param>. + case DEMANGLE_COMPONENT_TYPED_NAME: + { + struct d_print_mod *hold_modifiers; + struct demangle_component *typed_name; + struct d_print_mod adpm[4]; + unsigned int i; + struct d_print_template dpt; + + /* Pass the name down to the type so that it can be printed in + the right place for the type. We also have to pass down + any CV-qualifiers, which apply to the this parameter. */ + hold_modifiers = dpi->modifiers; + i = 0; + typed_name = d_left (dc); + while (typed_name != NULL) + { + if (i >= sizeof adpm / sizeof adpm[0]) + { + d_print_error (dpi); + return; + } + + adpm[i].next = dpi->modifiers; + dpi->modifiers = &adpm[i]; + adpm[i].mod = typed_name; + adpm[i].printed = 0; + adpm[i].templates = dpi->templates; + ++i; + + if (typed_name->type != DEMANGLE_COMPONENT_RESTRICT_THIS + && typed_name->type != DEMANGLE_COMPONENT_VOLATILE_THIS + && typed_name->type != DEMANGLE_COMPONENT_CONST_THIS) + break; - <template-param> ::= T_ # first template parameter - ::= T <parameter-2 number> _ */ + typed_name = d_left (typed_name); + } -static status_t -demangle_template_param (dm) - demangling_t dm; -{ - int parm_number; - template_arg_list_t current_arg_list = current_template_arg_list (dm); - string_list_t arg; + /* If typed_name is a template, then it applies to the + function type as well. */ + if (typed_name->type == DEMANGLE_COMPONENT_TEMPLATE) + { + dpt.next = dpi->templates; + dpi->templates = &dpt; + dpt.template_decl = typed_name; + } - DEMANGLE_TRACE ("template-param", dm); + /* If typed_name is a DEMANGLE_COMPONENT_LOCAL_NAME, then + there may be CV-qualifiers on its right argument which + really apply here; this happens when parsing a class which + is local to a function. */ + if (typed_name->type == DEMANGLE_COMPONENT_LOCAL_NAME) + { + struct demangle_component *local_name; + + local_name = d_right (typed_name); + while (local_name->type == DEMANGLE_COMPONENT_RESTRICT_THIS + || local_name->type == DEMANGLE_COMPONENT_VOLATILE_THIS + || local_name->type == DEMANGLE_COMPONENT_CONST_THIS) + { + if (i >= sizeof adpm / sizeof adpm[0]) + { + d_print_error (dpi); + return; + } + + adpm[i] = adpm[i - 1]; + adpm[i].next = &adpm[i - 1]; + dpi->modifiers = &adpm[i]; + + adpm[i - 1].mod = local_name; + adpm[i - 1].printed = 0; + adpm[i - 1].templates = dpi->templates; + ++i; + + local_name = d_left (local_name); + } + } - /* Make sure there is a template argmust list in which to look up - this parameter reference. */ - if (current_arg_list == NULL) - return "Template parameter outside of template."; + d_print_comp (dpi, d_right (dc)); - RETURN_IF_ERROR (demangle_char (dm, 'T')); - if (peek_char (dm) == '_') - parm_number = 0; - else - { - RETURN_IF_ERROR (demangle_number (dm, &parm_number, 10, 0)); - ++parm_number; - } - RETURN_IF_ERROR (demangle_char (dm, '_')); + if (typed_name->type == DEMANGLE_COMPONENT_TEMPLATE) + dpi->templates = dpt.next; + + /* If the modifiers didn't get printed by the type, print them + now. */ + while (i > 0) + { + --i; + if (! adpm[i].printed) + { + d_append_char (dpi, ' '); + d_print_mod (dpi, adpm[i].mod); + } + } - arg = template_arg_list_get_arg (current_arg_list, parm_number); - if (arg == NULL) - /* parm_number exceeded the number of arguments in the current - template argument list. */ - return "Template parameter number out of bounds."; - RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg)); + dpi->modifiers = hold_modifiers; - return STATUS_OK; -} + return; + } -/* Demangles and emits a <template-args>. + case DEMANGLE_COMPONENT_TEMPLATE: + { + struct d_print_mod *hold_dpm; - <template-args> ::= I <template-arg>+ E */ + /* Don't push modifiers into a template definition. Doing so + could give the wrong definition for a template argument. + Instead, treat the template essentially as a name. */ -static status_t -demangle_template_args (dm) - demangling_t dm; -{ - int first = 1; - dyn_string_t old_last_source_name; - template_arg_list_t arg_list = template_arg_list_new (); + hold_dpm = dpi->modifiers; + dpi->modifiers = NULL; - if (arg_list == NULL) - return STATUS_ALLOCATION_FAILED; + d_print_comp (dpi, d_left (dc)); + if (d_last_char (dpi) == '<') + d_append_char (dpi, ' '); + d_append_char (dpi, '<'); + d_print_comp (dpi, d_right (dc)); + /* Avoid generating two consecutive '>' characters, to avoid + the C++ syntactic ambiguity. */ + if (d_last_char (dpi) == '>') + d_append_char (dpi, ' '); + d_append_char (dpi, '>'); - /* Preserve the most recently demangled source name. */ - old_last_source_name = dm->last_source_name; - dm->last_source_name = dyn_string_new (0); + dpi->modifiers = hold_dpm; - DEMANGLE_TRACE ("template-args", dm); + return; + } - if (dm->last_source_name == NULL) - return STATUS_ALLOCATION_FAILED; + case DEMANGLE_COMPONENT_TEMPLATE_PARAM: + { + long i; + struct demangle_component *a; + struct d_print_template *hold_dpt; - RETURN_IF_ERROR (demangle_char (dm, 'I')); - RETURN_IF_ERROR (result_open_template_list (dm)); - do - { - string_list_t arg; + if (dpi->templates == NULL) + { + d_print_error (dpi); + return; + } + i = dc->u.s_number.number; + for (a = d_right (dpi->templates->template_decl); + a != NULL; + a = d_right (a)) + { + if (a->type != DEMANGLE_COMPONENT_TEMPLATE_ARGLIST) + { + d_print_error (dpi); + return; + } + if (i <= 0) + break; + --i; + } + if (i != 0 || a == NULL) + { + d_print_error (dpi); + return; + } + + /* While processing this parameter, we need to pop the list of + templates. This is because the template parameter may + itself be a reference to a parameter of an outer + template. */ + + hold_dpt = dpi->templates; + dpi->templates = hold_dpt->next; + + d_print_comp (dpi, d_left (a)); + + dpi->templates = hold_dpt; - if (first) - first = 0; + return; + } + + case DEMANGLE_COMPONENT_CTOR: + d_print_comp (dpi, dc->u.s_ctor.name); + return; + + case DEMANGLE_COMPONENT_DTOR: + d_append_char (dpi, '~'); + d_print_comp (dpi, dc->u.s_dtor.name); + return; + + case DEMANGLE_COMPONENT_VTABLE: + d_append_string_constant (dpi, "vtable for "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_VTT: + d_append_string_constant (dpi, "VTT for "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE: + d_append_string_constant (dpi, "construction vtable for "); + d_print_comp (dpi, d_left (dc)); + d_append_string_constant (dpi, "-in-"); + d_print_comp (dpi, d_right (dc)); + return; + + case DEMANGLE_COMPONENT_TYPEINFO: + d_append_string_constant (dpi, "typeinfo for "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_TYPEINFO_NAME: + d_append_string_constant (dpi, "typeinfo name for "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_TYPEINFO_FN: + d_append_string_constant (dpi, "typeinfo fn for "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_THUNK: + d_append_string_constant (dpi, "non-virtual thunk to "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_VIRTUAL_THUNK: + d_append_string_constant (dpi, "virtual thunk to "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_COVARIANT_THUNK: + d_append_string_constant (dpi, "covariant return thunk to "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_JAVA_CLASS: + d_append_string_constant (dpi, "java Class for "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_GUARD: + d_append_string_constant (dpi, "guard variable for "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_REFTEMP: + d_append_string_constant (dpi, "reference temporary for "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_HIDDEN_ALIAS: + d_append_string_constant (dpi, "hidden alias for "); + d_print_comp (dpi, d_left (dc)); + return; + + case DEMANGLE_COMPONENT_SUB_STD: + d_append_buffer (dpi, dc->u.s_string.string, dc->u.s_string.len); + return; + + case DEMANGLE_COMPONENT_RESTRICT: + case DEMANGLE_COMPONENT_VOLATILE: + case DEMANGLE_COMPONENT_CONST: + { + struct d_print_mod *pdpm; + + /* When printing arrays, it's possible to have cases where the + same CV-qualifier gets pushed on the stack multiple times. + We only need to print it once. */ + + for (pdpm = dpi->modifiers; pdpm != NULL; pdpm = pdpm->next) + { + if (! pdpm->printed) + { + if (pdpm->mod->type != DEMANGLE_COMPONENT_RESTRICT + && pdpm->mod->type != DEMANGLE_COMPONENT_VOLATILE + && pdpm->mod->type != DEMANGLE_COMPONENT_CONST) + break; + if (pdpm->mod->type == dc->type) + { + d_print_comp (dpi, d_left (dc)); + return; + } + } + } + } + /* Fall through. */ + case DEMANGLE_COMPONENT_RESTRICT_THIS: + case DEMANGLE_COMPONENT_VOLATILE_THIS: + case DEMANGLE_COMPONENT_CONST_THIS: + case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: + case DEMANGLE_COMPONENT_POINTER: + case DEMANGLE_COMPONENT_REFERENCE: + case DEMANGLE_COMPONENT_COMPLEX: + case DEMANGLE_COMPONENT_IMAGINARY: + { + /* We keep a list of modifiers on the stack. */ + struct d_print_mod dpm; + + dpm.next = dpi->modifiers; + dpi->modifiers = &dpm; + dpm.mod = dc; + dpm.printed = 0; + dpm.templates = dpi->templates; + + d_print_comp (dpi, d_left (dc)); + + /* If the modifier didn't get printed by the type, print it + now. */ + if (! dpm.printed) + d_print_mod (dpi, dc); + + dpi->modifiers = dpm.next; + + return; + } + + case DEMANGLE_COMPONENT_BUILTIN_TYPE: + if ((dpi->options & DMGL_JAVA) == 0) + d_append_buffer (dpi, dc->u.s_builtin.type->name, + dc->u.s_builtin.type->len); else - RETURN_IF_ERROR (result_add (dm, ", ")); + d_append_buffer (dpi, dc->u.s_builtin.type->java_name, + dc->u.s_builtin.type->java_len); + return; - /* Capture the template arg. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_template_arg (dm)); - arg = result_pop (dm); + case DEMANGLE_COMPONENT_VENDOR_TYPE: + d_print_comp (dpi, d_left (dc)); + return; - /* Emit it in the demangled name. */ - RETURN_IF_ERROR (result_add_string (dm, (dyn_string_t) arg)); + case DEMANGLE_COMPONENT_FUNCTION_TYPE: + { + if ((dpi->options & DMGL_RET_POSTFIX) != 0) + d_print_function_type (dpi, dc, dpi->modifiers); - /* Save it for use in expanding <template-param>s. */ - template_arg_list_add_arg (arg_list, arg); - } - while (peek_char (dm) != 'E'); - /* Append the '>'. */ - RETURN_IF_ERROR (result_close_template_list (dm)); + /* Print return type if present */ + if (d_left (dc) != NULL) + { + struct d_print_mod dpm; - /* Consume the 'E'. */ - advance_char (dm); + /* We must pass this type down as a modifier in order to + print it in the right location. */ + dpm.next = dpi->modifiers; + dpi->modifiers = &dpm; + dpm.mod = dc; + dpm.printed = 0; + dpm.templates = dpi->templates; - /* Restore the most recent demangled source name. */ - dyn_string_delete (dm->last_source_name); - dm->last_source_name = old_last_source_name; + d_print_comp (dpi, d_left (dc)); - /* Push the list onto the top of the stack of template argument - lists, so that arguments from it are used from now on when - expanding <template-param>s. */ - push_template_arg_list (dm, arg_list); + dpi->modifiers = dpm.next; - return STATUS_OK; -} + if (dpm.printed) + return; -/* This function, which does not correspond to a production in the - mangling spec, handles the `literal' production for both - <template-arg> and <expr-primary>. It does not expect or consume - the initial `L' or final `E'. The demangling is given by: + /* In standard prefix notation, there is a space between the + return type and the function signature. */ + if ((dpi->options & DMGL_RET_POSTFIX) == 0) + d_append_char (dpi, ' '); + } - <literal> ::= <type> </value/ number> + if ((dpi->options & DMGL_RET_POSTFIX) == 0) + d_print_function_type (dpi, dc, dpi->modifiers); - and the emitted output is `(type)number'. */ + return; + } -static status_t -demangle_literal (dm) - demangling_t dm; -{ - char peek = peek_char (dm); - dyn_string_t value_string; - status_t status; + case DEMANGLE_COMPONENT_ARRAY_TYPE: + { + struct d_print_mod *hold_modifiers; + struct d_print_mod adpm[4]; + unsigned int i; + struct d_print_mod *pdpm; + + /* We must pass this type down as a modifier in order to print + multi-dimensional arrays correctly. If the array itself is + CV-qualified, we act as though the element type were + CV-qualified. We do this by copying the modifiers down + rather than fiddling pointers, so that we don't wind up + with a d_print_mod higher on the stack pointing into our + stack frame after we return. */ + + hold_modifiers = dpi->modifiers; + + adpm[0].next = hold_modifiers; + dpi->modifiers = &adpm[0]; + adpm[0].mod = dc; + adpm[0].printed = 0; + adpm[0].templates = dpi->templates; + + i = 1; + pdpm = hold_modifiers; + while (pdpm != NULL + && (pdpm->mod->type == DEMANGLE_COMPONENT_RESTRICT + || pdpm->mod->type == DEMANGLE_COMPONENT_VOLATILE + || pdpm->mod->type == DEMANGLE_COMPONENT_CONST)) + { + if (! pdpm->printed) + { + if (i >= sizeof adpm / sizeof adpm[0]) + { + d_print_error (dpi); + return; + } + + adpm[i] = *pdpm; + adpm[i].next = dpi->modifiers; + dpi->modifiers = &adpm[i]; + pdpm->printed = 1; + ++i; + } + + pdpm = pdpm->next; + } - DEMANGLE_TRACE ("literal", dm); + d_print_comp (dpi, d_right (dc)); - if (!flag_verbose && peek >= 'a' && peek <= 'z') - { - /* If not in verbose mode and this is a builtin type, see if we - can produce simpler numerical output. In particular, for - integer types shorter than `long', just write the number - without type information; for bools, write `true' or `false'. - Other refinements could be made here too. */ - - /* This constant string is used to map from <builtin-type> codes - (26 letters of the alphabet) to codes that determine how the - value will be displayed. The codes are: - b: display as bool - i: display as int - l: display as long - A space means the value will be represented using cast - notation. */ - static const char *const code_map = "ibi iii ll ii i "; - - char code = code_map[peek - 'a']; - /* FIXME: Implement demangling of floats and doubles. */ - if (code == 'u') - return STATUS_UNIMPLEMENTED; - if (code == 'b') - { - /* It's a boolean. */ - char value; - - /* Consume the b. */ - advance_char (dm); - /* Look at the next character. It should be 0 or 1, - corresponding to false or true, respectively. */ - value = peek_char (dm); - if (value == '0') - RETURN_IF_ERROR (result_add (dm, "false")); - else if (value == '1') - RETURN_IF_ERROR (result_add (dm, "true")); - else - return "Unrecognized bool constant."; - /* Consume the 0 or 1. */ - advance_char (dm); - return STATUS_OK; - } - else if (code == 'i' || code == 'l') - { - /* It's an integer or long. */ - - /* Consume the type character. */ - advance_char (dm); - - /* Demangle the number and write it out. */ - value_string = dyn_string_new (0); - status = demangle_number_literally (dm, value_string, 10, 1); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, value_string); - /* For long integers, append an l. */ - if (code == 'l' && STATUS_NO_ERROR (status)) - status = result_add_char (dm, code); - dyn_string_delete (value_string); - - RETURN_IF_ERROR (status); - return STATUS_OK; - } - /* ...else code == ' ', so fall through to represent this - literal's type explicitly using cast syntax. */ - } + dpi->modifiers = hold_modifiers; - RETURN_IF_ERROR (result_add_char (dm, '(')); - RETURN_IF_ERROR (demangle_type (dm)); - RETURN_IF_ERROR (result_add_char (dm, ')')); + if (adpm[0].printed) + return; - value_string = dyn_string_new (0); - if (value_string == NULL) - return STATUS_ALLOCATION_FAILED; + while (i > 1) + { + --i; + d_print_mod (dpi, adpm[i].mod); + } - status = demangle_number_literally (dm, value_string, 10, 1); - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, value_string); - dyn_string_delete (value_string); - RETURN_IF_ERROR (status); + d_print_array_type (dpi, dc, dpi->modifiers); - return STATUS_OK; -} + return; + } -/* Demangles and emits a <template-arg>. + case DEMANGLE_COMPONENT_PTRMEM_TYPE: + { + struct d_print_mod dpm; - <template-arg> ::= <type> # type - ::= L <type> <value number> E # literal - ::= LZ <encoding> E # external name - ::= X <expression> E # expression */ + dpm.next = dpi->modifiers; + dpi->modifiers = &dpm; + dpm.mod = dc; + dpm.printed = 0; + dpm.templates = dpi->templates; -static status_t -demangle_template_arg (dm) - demangling_t dm; -{ - DEMANGLE_TRACE ("template-arg", dm); + d_print_comp (dpi, d_right (dc)); - switch (peek_char (dm)) - { - case 'L': - advance_char (dm); + /* If the modifier didn't get printed by the type, print it + now. */ + if (! dpm.printed) + { + d_append_char (dpi, ' '); + d_print_comp (dpi, d_left (dc)); + d_append_string_constant (dpi, "::*"); + } + + dpi->modifiers = dpm.next; - if (peek_char (dm) == 'Z') + return; + } + + case DEMANGLE_COMPONENT_ARGLIST: + case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST: + d_print_comp (dpi, d_left (dc)); + if (d_right (dc) != NULL) { - /* External name. */ - advance_char (dm); - /* FIXME: Standard is contradictory here. */ - RETURN_IF_ERROR (demangle_encoding (dm)); + d_append_string_constant (dpi, ", "); + d_print_comp (dpi, d_right (dc)); } + return; + + case DEMANGLE_COMPONENT_OPERATOR: + { + char c; + + d_append_string_constant (dpi, "operator"); + c = dc->u.s_operator.op->name[0]; + if (IS_LOWER (c)) + d_append_char (dpi, ' '); + d_append_buffer (dpi, dc->u.s_operator.op->name, + dc->u.s_operator.op->len); + return; + } + + case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: + d_append_string_constant (dpi, "operator "); + d_print_comp (dpi, dc->u.s_extended_operator.name); + return; + + case DEMANGLE_COMPONENT_CAST: + d_append_string_constant (dpi, "operator "); + d_print_cast (dpi, dc); + return; + + case DEMANGLE_COMPONENT_UNARY: + if (d_left (dc)->type != DEMANGLE_COMPONENT_CAST) + d_print_expr_op (dpi, d_left (dc)); else - RETURN_IF_ERROR (demangle_literal (dm)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - break; + { + d_append_char (dpi, '('); + d_print_cast (dpi, d_left (dc)); + d_append_char (dpi, ')'); + } + d_append_char (dpi, '('); + d_print_comp (dpi, d_right (dc)); + d_append_char (dpi, ')'); + return; - case 'X': - /* Expression. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_expression (dm)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - break; + case DEMANGLE_COMPONENT_BINARY: + if (d_right (dc)->type != DEMANGLE_COMPONENT_BINARY_ARGS) + { + d_print_error (dpi); + return; + } + + /* We wrap an expression which uses the greater-than operator in + an extra layer of parens so that it does not get confused + with the '>' which ends the template parameters. */ + if (d_left (dc)->type == DEMANGLE_COMPONENT_OPERATOR + && d_left (dc)->u.s_operator.op->len == 1 + && d_left (dc)->u.s_operator.op->name[0] == '>') + d_append_char (dpi, '('); + + d_append_char (dpi, '('); + d_print_comp (dpi, d_left (d_right (dc))); + d_append_string_constant (dpi, ") "); + d_print_expr_op (dpi, d_left (dc)); + d_append_string_constant (dpi, " ("); + d_print_comp (dpi, d_right (d_right (dc))); + d_append_char (dpi, ')'); + + if (d_left (dc)->type == DEMANGLE_COMPONENT_OPERATOR + && d_left (dc)->u.s_operator.op->len == 1 + && d_left (dc)->u.s_operator.op->name[0] == '>') + d_append_char (dpi, ')'); + + return; + + case DEMANGLE_COMPONENT_BINARY_ARGS: + /* We should only see this as part of DEMANGLE_COMPONENT_BINARY. */ + d_print_error (dpi); + return; + + case DEMANGLE_COMPONENT_TRINARY: + if (d_right (dc)->type != DEMANGLE_COMPONENT_TRINARY_ARG1 + || d_right (d_right (dc))->type != DEMANGLE_COMPONENT_TRINARY_ARG2) + { + d_print_error (dpi); + return; + } + d_append_char (dpi, '('); + d_print_comp (dpi, d_left (d_right (dc))); + d_append_string_constant (dpi, ") "); + d_print_expr_op (dpi, d_left (dc)); + d_append_string_constant (dpi, " ("); + d_print_comp (dpi, d_left (d_right (d_right (dc)))); + d_append_string_constant (dpi, ") : ("); + d_print_comp (dpi, d_right (d_right (d_right (dc)))); + d_append_char (dpi, ')'); + return; + + case DEMANGLE_COMPONENT_TRINARY_ARG1: + case DEMANGLE_COMPONENT_TRINARY_ARG2: + /* We should only see these are part of DEMANGLE_COMPONENT_TRINARY. */ + d_print_error (dpi); + return; + + case DEMANGLE_COMPONENT_LITERAL: + case DEMANGLE_COMPONENT_LITERAL_NEG: + { + enum d_builtin_type_print tp; + + /* For some builtin types, produce simpler output. */ + tp = D_PRINT_DEFAULT; + if (d_left (dc)->type == DEMANGLE_COMPONENT_BUILTIN_TYPE) + { + tp = d_left (dc)->u.s_builtin.type->print; + switch (tp) + { + case D_PRINT_INT: + case D_PRINT_UNSIGNED: + case D_PRINT_LONG: + case D_PRINT_UNSIGNED_LONG: + case D_PRINT_LONG_LONG: + case D_PRINT_UNSIGNED_LONG_LONG: + if (d_right (dc)->type == DEMANGLE_COMPONENT_NAME) + { + if (dc->type == DEMANGLE_COMPONENT_LITERAL_NEG) + d_append_char (dpi, '-'); + d_print_comp (dpi, d_right (dc)); + switch (tp) + { + default: + break; + case D_PRINT_UNSIGNED: + d_append_char (dpi, 'u'); + break; + case D_PRINT_LONG: + d_append_char (dpi, 'l'); + break; + case D_PRINT_UNSIGNED_LONG: + d_append_string_constant (dpi, "ul"); + break; + case D_PRINT_LONG_LONG: + d_append_string_constant (dpi, "ll"); + break; + case D_PRINT_UNSIGNED_LONG_LONG: + d_append_string_constant (dpi, "ull"); + break; + } + return; + } + break; + + case D_PRINT_BOOL: + if (d_right (dc)->type == DEMANGLE_COMPONENT_NAME + && d_right (dc)->u.s_name.len == 1 + && dc->type == DEMANGLE_COMPONENT_LITERAL) + { + switch (d_right (dc)->u.s_name.s[0]) + { + case '0': + d_append_string_constant (dpi, "false"); + return; + case '1': + d_append_string_constant (dpi, "true"); + return; + default: + break; + } + } + break; + + default: + break; + } + } + + d_append_char (dpi, '('); + d_print_comp (dpi, d_left (dc)); + d_append_char (dpi, ')'); + if (dc->type == DEMANGLE_COMPONENT_LITERAL_NEG) + d_append_char (dpi, '-'); + if (tp == D_PRINT_FLOAT) + d_append_char (dpi, '['); + d_print_comp (dpi, d_right (dc)); + if (tp == D_PRINT_FLOAT) + d_append_char (dpi, ']'); + } + return; default: - RETURN_IF_ERROR (demangle_type (dm)); - break; + d_print_error (dpi); + return; } - - return STATUS_OK; } -/* Demangles and emits an <expression>. +/* Print a Java dentifier. For Java we try to handle encoded extended + Unicode characters. The C++ ABI doesn't mention Unicode encoding, + so we don't it for C++. Characters are encoded as + __U<hex-char>+_. */ - <expression> ::= <unary operator-name> <expression> - ::= <binary operator-name> <expression> <expression> - ::= <expr-primary> - ::= <scope-expression> */ - -static status_t -demangle_expression (dm) - demangling_t dm; +static void +d_print_java_identifier (struct d_print_info *dpi, const char *name, int len) { - char peek = peek_char (dm); + const char *p; + const char *end; - DEMANGLE_TRACE ("expression", dm); - - if (peek == 'L' || peek == 'T') - RETURN_IF_ERROR (demangle_expr_primary (dm)); - else if (peek == 's' && peek_char_next (dm) == 'r') - RETURN_IF_ERROR (demangle_scope_expression (dm)); - else - /* An operator expression. */ + end = name + len; + for (p = name; p < end; ++p) { - int num_args; - int type_arg; - status_t status = STATUS_OK; - dyn_string_t operator_name; - - /* We have an operator name. Since we want to output binary - operations in infix notation, capture the operator name - first. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_operator_name (dm, 1, &num_args, - &type_arg)); - operator_name = (dyn_string_t) result_pop (dm); - - /* If it's binary, do an operand first. */ - if (num_args > 1) + if (end - p > 3 + && p[0] == '_' + && p[1] == '_' + && p[2] == 'U') { - status = result_add_char (dm, '('); - if (STATUS_NO_ERROR (status)) - status = demangle_expression (dm); - if (STATUS_NO_ERROR (status)) - status = result_add_char (dm, ')'); - } + unsigned long c; + const char *q; - /* Emit the operator. */ - if (STATUS_NO_ERROR (status)) - status = result_add_string (dm, operator_name); - dyn_string_delete (operator_name); - RETURN_IF_ERROR (status); - - /* Emit its second (if binary) or only (if unary) operand. */ - RETURN_IF_ERROR (result_add_char (dm, '(')); - if (type_arg) - RETURN_IF_ERROR (demangle_type (dm)); - else - RETURN_IF_ERROR (demangle_expression (dm)); - RETURN_IF_ERROR (result_add_char (dm, ')')); + c = 0; + for (q = p + 3; q < end; ++q) + { + int dig; + + if (IS_DIGIT (*q)) + dig = *q - '0'; + else if (*q >= 'A' && *q <= 'F') + dig = *q - 'A' + 10; + else if (*q >= 'a' && *q <= 'f') + dig = *q - 'a' + 10; + else + break; - /* The ternary operator takes a third operand. */ - if (num_args == 3) - { - RETURN_IF_ERROR (result_add (dm, ":(")); - RETURN_IF_ERROR (demangle_expression (dm)); - RETURN_IF_ERROR (result_add_char (dm, ')')); + c = c * 16 + dig; + } + /* If the Unicode character is larger than 256, we don't try + to deal with it here. FIXME. */ + if (q < end && *q == '_' && c < 256) + { + d_append_char (dpi, c); + p = q; + continue; + } } - } - return STATUS_OK; + d_append_char (dpi, *p); + } } -/* Demangles and emits a <scope-expression>. - - <scope-expression> ::= sr <qualifying type> <source-name> - ::= sr <qualifying type> <encoding> */ +/* Print a list of modifiers. SUFFIX is 1 if we are printing + qualifiers on this after printing a function. */ -static status_t -demangle_scope_expression (dm) - demangling_t dm; +static void +d_print_mod_list (struct d_print_info *dpi, + struct d_print_mod *mods, int suffix) { - RETURN_IF_ERROR (demangle_char (dm, 's')); - RETURN_IF_ERROR (demangle_char (dm, 'r')); - RETURN_IF_ERROR (demangle_type (dm)); - RETURN_IF_ERROR (result_add (dm, "::")); - RETURN_IF_ERROR (demangle_encoding (dm)); - return STATUS_OK; -} + struct d_print_template *hold_dpt; -/* Demangles and emits an <expr-primary>. + if (mods == NULL || d_print_saw_error (dpi)) + return; - <expr-primary> ::= <template-param> - ::= L <type> <value number> E # literal - ::= L <mangled-name> E # external name */ + if (mods->printed + || (! suffix + && (mods->mod->type == DEMANGLE_COMPONENT_RESTRICT_THIS + || mods->mod->type == DEMANGLE_COMPONENT_VOLATILE_THIS + || mods->mod->type == DEMANGLE_COMPONENT_CONST_THIS))) + { + d_print_mod_list (dpi, mods->next, suffix); + return; + } -static status_t -demangle_expr_primary (dm) - demangling_t dm; -{ - char peek = peek_char (dm); + mods->printed = 1; - DEMANGLE_TRACE ("expr-primary", dm); + hold_dpt = dpi->templates; + dpi->templates = mods->templates; - if (peek == 'T') - RETURN_IF_ERROR (demangle_template_param (dm)); - else if (peek == 'L') + if (mods->mod->type == DEMANGLE_COMPONENT_FUNCTION_TYPE) { - /* Consume the `L'. */ - advance_char (dm); - peek = peek_char (dm); + d_print_function_type (dpi, mods->mod, mods->next); + dpi->templates = hold_dpt; + return; + } + else if (mods->mod->type == DEMANGLE_COMPONENT_ARRAY_TYPE) + { + d_print_array_type (dpi, mods->mod, mods->next); + dpi->templates = hold_dpt; + return; + } + else if (mods->mod->type == DEMANGLE_COMPONENT_LOCAL_NAME) + { + struct d_print_mod *hold_modifiers; + struct demangle_component *dc; + + /* When this is on the modifier stack, we have pulled any + qualifiers off the right argument already. Otherwise, we + print it as usual, but don't let the left argument see any + modifiers. */ - if (peek == '_') - RETURN_IF_ERROR (demangle_mangled_name (dm)); + hold_modifiers = dpi->modifiers; + dpi->modifiers = NULL; + d_print_comp (dpi, d_left (mods->mod)); + dpi->modifiers = hold_modifiers; + + if ((dpi->options & DMGL_JAVA) == 0) + d_append_string_constant (dpi, "::"); else - RETURN_IF_ERROR (demangle_literal (dm)); + d_append_char (dpi, '.'); + + dc = d_right (mods->mod); + while (dc->type == DEMANGLE_COMPONENT_RESTRICT_THIS + || dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS + || dc->type == DEMANGLE_COMPONENT_CONST_THIS) + dc = d_left (dc); + + d_print_comp (dpi, dc); - RETURN_IF_ERROR (demangle_char (dm, 'E')); + dpi->templates = hold_dpt; + return; } - else - return STATUS_ERROR; - return STATUS_OK; + d_print_mod (dpi, mods->mod); + + dpi->templates = hold_dpt; + + d_print_mod_list (dpi, mods->next, suffix); } -/* Demangles and emits a <substitution>. Sets *TEMPLATE_P to non-zero - if the substitution is the name of a template, zero otherwise. - - <substitution> ::= S <seq-id> _ - ::= S_ - - ::= St # ::std:: - ::= Sa # ::std::allocator - ::= Sb # ::std::basic_string - ::= Ss # ::std::basic_string<char, - ::std::char_traits<char>, - ::std::allocator<char> > - ::= Si # ::std::basic_istream<char, - std::char_traits<char> > - ::= So # ::std::basic_ostream<char, - std::char_traits<char> > - ::= Sd # ::std::basic_iostream<char, - std::char_traits<char> > -*/ +/* Print a modifier. */ -static status_t -demangle_substitution (dm, template_p) - demangling_t dm; - int *template_p; +static void +d_print_mod (struct d_print_info *dpi, + const struct demangle_component *mod) { - int seq_id; - int peek; - dyn_string_t text; - - DEMANGLE_TRACE ("substitution", dm); + switch (mod->type) + { + case DEMANGLE_COMPONENT_RESTRICT: + case DEMANGLE_COMPONENT_RESTRICT_THIS: + d_append_string_constant (dpi, " restrict"); + return; + case DEMANGLE_COMPONENT_VOLATILE: + case DEMANGLE_COMPONENT_VOLATILE_THIS: + d_append_string_constant (dpi, " volatile"); + return; + case DEMANGLE_COMPONENT_CONST: + case DEMANGLE_COMPONENT_CONST_THIS: + d_append_string_constant (dpi, " const"); + return; + case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: + d_append_char (dpi, ' '); + d_print_comp (dpi, d_right (mod)); + return; + case DEMANGLE_COMPONENT_POINTER: + /* There is no pointer symbol in Java. */ + if ((dpi->options & DMGL_JAVA) == 0) + d_append_char (dpi, '*'); + return; + case DEMANGLE_COMPONENT_REFERENCE: + d_append_char (dpi, '&'); + return; + case DEMANGLE_COMPONENT_COMPLEX: + d_append_string_constant (dpi, "complex "); + return; + case DEMANGLE_COMPONENT_IMAGINARY: + d_append_string_constant (dpi, "imaginary "); + return; + case DEMANGLE_COMPONENT_PTRMEM_TYPE: + if (d_last_char (dpi) != '(') + d_append_char (dpi, ' '); + d_print_comp (dpi, d_left (mod)); + d_append_string_constant (dpi, "::*"); + return; + case DEMANGLE_COMPONENT_TYPED_NAME: + d_print_comp (dpi, d_left (mod)); + return; + default: + /* Otherwise, we have something that won't go back on the + modifier stack, so we can just print it. */ + d_print_comp (dpi, mod); + return; + } +} - RETURN_IF_ERROR (demangle_char (dm, 'S')); +/* Print a function type, except for the return type. */ - /* Scan the substitution sequence index. A missing number denotes - the first index. */ - peek = peek_char (dm); - if (peek == '_') - seq_id = -1; - /* If the following character is 0-9 or a capital letter, interpret - the sequence up to the next underscore as a base-36 substitution - index. */ - else if (IS_DIGIT ((unsigned char) peek) - || (peek >= 'A' && peek <= 'Z')) - RETURN_IF_ERROR (demangle_number (dm, &seq_id, 36, 0)); - else +static void +d_print_function_type (struct d_print_info *dpi, + const struct demangle_component *dc, + struct d_print_mod *mods) +{ + int need_paren; + int saw_mod; + int need_space; + struct d_print_mod *p; + struct d_print_mod *hold_modifiers; + + need_paren = 0; + saw_mod = 0; + need_space = 0; + for (p = mods; p != NULL; p = p->next) { - const char *new_last_source_name = NULL; + if (p->printed) + break; - switch (peek) + saw_mod = 1; + switch (p->mod->type) { - case 't': - RETURN_IF_ERROR (result_add (dm, "std")); + case DEMANGLE_COMPONENT_POINTER: + case DEMANGLE_COMPONENT_REFERENCE: + need_paren = 1; break; - - case 'a': - RETURN_IF_ERROR (result_add (dm, "std::allocator")); - new_last_source_name = "allocator"; - *template_p = 1; + case DEMANGLE_COMPONENT_RESTRICT: + case DEMANGLE_COMPONENT_VOLATILE: + case DEMANGLE_COMPONENT_CONST: + case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: + case DEMANGLE_COMPONENT_COMPLEX: + case DEMANGLE_COMPONENT_IMAGINARY: + case DEMANGLE_COMPONENT_PTRMEM_TYPE: + need_space = 1; + need_paren = 1; break; - - case 'b': - RETURN_IF_ERROR (result_add (dm, "std::basic_string")); - new_last_source_name = "basic_string"; - *template_p = 1; + case DEMANGLE_COMPONENT_RESTRICT_THIS: + case DEMANGLE_COMPONENT_VOLATILE_THIS: + case DEMANGLE_COMPONENT_CONST_THIS: break; - - case 's': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_add (dm, "std::string")); - new_last_source_name = "string"; - } - else - { - RETURN_IF_ERROR (result_add (dm, "std::basic_string<char, std::char_traits<char>, std::allocator<char> >")); - new_last_source_name = "basic_string"; - } - *template_p = 0; + default: break; + } + if (need_paren) + break; + } - case 'i': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_add (dm, "std::istream")); - new_last_source_name = "istream"; - } - else - { - RETURN_IF_ERROR (result_add (dm, "std::basic_istream<char, std::char_traits<char> >")); - new_last_source_name = "basic_istream"; - } - *template_p = 0; - break; + if (d_left (dc) != NULL && ! saw_mod) + need_paren = 1; - case 'o': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_add (dm, "std::ostream")); - new_last_source_name = "ostream"; - } - else - { - RETURN_IF_ERROR (result_add (dm, "std::basic_ostream<char, std::char_traits<char> >")); - new_last_source_name = "basic_ostream"; - } - *template_p = 0; - break; + if (need_paren) + { + if (! need_space) + { + if (d_last_char (dpi) != '(' + && d_last_char (dpi) != '*') + need_space = 1; + } + if (need_space && d_last_char (dpi) != ' ') + d_append_char (dpi, ' '); + d_append_char (dpi, '('); + } - case 'd': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_add (dm, "std::iostream")); - new_last_source_name = "iostream"; - } - else - { - RETURN_IF_ERROR (result_add (dm, "std::basic_iostream<char, std::char_traits<char> >")); - new_last_source_name = "basic_iostream"; - } - *template_p = 0; - break; + hold_modifiers = dpi->modifiers; + dpi->modifiers = NULL; - default: - return "Unrecognized <substitution>."; - } - - /* Consume the character we just processed. */ - advance_char (dm); + d_print_mod_list (dpi, mods, 0); + + if (need_paren) + d_append_char (dpi, ')'); - if (new_last_source_name != NULL) + d_append_char (dpi, '('); + + if (d_right (dc) != NULL) + d_print_comp (dpi, d_right (dc)); + + d_append_char (dpi, ')'); + + d_print_mod_list (dpi, mods, 1); + + dpi->modifiers = hold_modifiers; +} + +/* Print an array type, except for the element type. */ + +static void +d_print_array_type (struct d_print_info *dpi, + const struct demangle_component *dc, + struct d_print_mod *mods) +{ + int need_space; + + need_space = 1; + if (mods != NULL) + { + int need_paren; + struct d_print_mod *p; + + need_paren = 0; + for (p = mods; p != NULL; p = p->next) { - if (!dyn_string_copy_cstr (dm->last_source_name, - new_last_source_name)) - return STATUS_ALLOCATION_FAILED; + if (! p->printed) + { + if (p->mod->type == DEMANGLE_COMPONENT_ARRAY_TYPE) + { + need_space = 0; + break; + } + else + { + need_paren = 1; + need_space = 1; + break; + } + } } - return STATUS_OK; + if (need_paren) + d_append_string_constant (dpi, " ("); + + d_print_mod_list (dpi, mods, 0); + + if (need_paren) + d_append_char (dpi, ')'); } - /* Look up the substitution text. Since `S_' is the most recent - substitution, `S0_' is the second-most-recent, etc., shift the - numbering by one. */ - text = substitution_get (dm, seq_id + 1, template_p); - if (text == NULL) - return "Substitution number out of range."; + if (need_space) + d_append_char (dpi, ' '); - /* Emit the substitution text. */ - RETURN_IF_ERROR (result_add_string (dm, text)); + d_append_char (dpi, '['); - RETURN_IF_ERROR (demangle_char (dm, '_')); - return STATUS_OK; -} + if (d_left (dc) != NULL) + d_print_comp (dpi, d_left (dc)); -/* Demangles and emits a <local-name>. + d_append_char (dpi, ']'); +} - <local-name> := Z <function encoding> E <entity name> [<discriminator>] - := Z <function encoding> E s [<discriminator>] */ +/* Print an operator in an expression. */ -static status_t -demangle_local_name (dm) - demangling_t dm; +static void +d_print_expr_op (struct d_print_info *dpi, + const struct demangle_component *dc) { - DEMANGLE_TRACE ("local-name", dm); + if (dc->type == DEMANGLE_COMPONENT_OPERATOR) + d_append_buffer (dpi, dc->u.s_operator.op->name, + dc->u.s_operator.op->len); + else + d_print_comp (dpi, dc); +} - RETURN_IF_ERROR (demangle_char (dm, 'Z')); - RETURN_IF_ERROR (demangle_encoding (dm)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - RETURN_IF_ERROR (result_add (dm, "::")); +/* Print a cast. */ - if (peek_char (dm) == 's') - { - /* Local character string literal. */ - RETURN_IF_ERROR (result_add (dm, "string literal")); - /* Consume the s. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_discriminator (dm, 0)); - } +static void +d_print_cast (struct d_print_info *dpi, + const struct demangle_component *dc) +{ + if (d_left (dc)->type != DEMANGLE_COMPONENT_TEMPLATE) + d_print_comp (dpi, d_left (dc)); else { - int unused; - /* Local name for some other entity. Demangle its name. */ - RETURN_IF_ERROR (demangle_name (dm, &unused)); - RETURN_IF_ERROR (demangle_discriminator (dm, 1)); - } - - return STATUS_OK; - } - - /* Optimonally demangles and emits a <discriminator>. If there is no - <discriminator> at the current position in the mangled string, the - descriminator is assumed to be zero. Emit the discriminator number - in parentheses, unless SUPPRESS_FIRST is non-zero and the - discriminator is zero. - - <discriminator> ::= _ <number> */ - -static status_t -demangle_discriminator (dm, suppress_first) - demangling_t dm; - int suppress_first; -{ - /* Output for <discriminator>s to the demangled name is completely - suppressed if not in verbose mode. */ + struct d_print_mod *hold_dpm; + struct d_print_template dpt; - if (peek_char (dm) == '_') - { - /* Consume the underscore. */ - advance_char (dm); - if (flag_verbose) - RETURN_IF_ERROR (result_add (dm, " [#")); - /* Check if there's a number following the underscore. */ - if (IS_DIGIT ((unsigned char) peek_char (dm))) - { - int discriminator; - /* Demangle the number. */ - RETURN_IF_ERROR (demangle_number (dm, &discriminator, 10, 0)); - if (flag_verbose) - /* Write the discriminator. The mangled number is two - less than the discriminator ordinal, counting from - zero. */ - RETURN_IF_ERROR (int_to_dyn_string (discriminator + 1, - (dyn_string_t) dm->result)); - } - else - return STATUS_ERROR; - if (flag_verbose) - RETURN_IF_ERROR (result_add_char (dm, ']')); - } - else if (!suppress_first) - { - if (flag_verbose) - RETURN_IF_ERROR (result_add (dm, " [#0]")); + /* It appears that for a templated cast operator, we need to put + the template parameters in scope for the operator name, but + not for the parameters. The effect is that we need to handle + the template printing here. */ + + hold_dpm = dpi->modifiers; + dpi->modifiers = NULL; + + dpt.next = dpi->templates; + dpi->templates = &dpt; + dpt.template_decl = d_left (dc); + + d_print_comp (dpi, d_left (d_left (dc))); + + dpi->templates = dpt.next; + + if (d_last_char (dpi) == '<') + d_append_char (dpi, ' '); + d_append_char (dpi, '<'); + d_print_comp (dpi, d_right (d_left (dc))); + /* Avoid generating two consecutive '>' characters, to avoid + the C++ syntactic ambiguity. */ + if (d_last_char (dpi) == '>') + d_append_char (dpi, ' '); + d_append_char (dpi, '>'); + + dpi->modifiers = hold_dpm; } +} + +/* Initialize the information structure we use to pass around + information. */ + +CP_STATIC_IF_GLIBCPP_V3 +void +cplus_demangle_init_info (const char *mangled, int options, size_t len, + struct d_info *di) +{ + di->s = mangled; + di->send = mangled + len; + di->options = options; + + di->n = mangled; + + /* We can not need more components than twice the number of chars in + the mangled string. Most components correspond directly to + chars, but the ARGLIST types are exceptions. */ + di->num_comps = 2 * len; + di->next_comp = 0; - return STATUS_OK; + /* Similarly, we can not need more substitutions than there are + chars in the mangled string. */ + di->num_subs = len; + di->next_sub = 0; + di->did_subs = 0; + + di->last_name = NULL; + + di->expansion = 0; } -/* Demangle NAME into RESULT, which must be an initialized - dyn_string_t. On success, returns STATUS_OK. On failure, returns - an error message, and the contents of RESULT are unchanged. */ +/* Entry point for the demangler. If MANGLED is a g++ v3 ABI mangled + name, return a buffer allocated with malloc holding the demangled + name. OPTIONS is the usual libiberty demangler options. On + success, this sets *PALC to the allocated size of the returned + buffer. On failure, this sets *PALC to 0 for a bad name, or 1 for + a memory allocation failure. On failure, this returns NULL. */ -static status_t -cp_demangle (name, result, style) - const char *name; - dyn_string_t result; - int style; +static char * +d_demangle (const char* mangled, int options, size_t *palc) { - status_t status; - int length = strlen (name); + size_t len; + int type; + struct d_info di; + struct demangle_component *dc; + int estimate; + char *ret; - if (length > 2 && name[0] == '_' && name[1] == 'Z') - { - demangling_t dm = demangling_new (name, style); - if (dm == NULL) - return STATUS_ALLOCATION_FAILED; + *palc = 0; - status = result_push (dm); - if (status != STATUS_OK) - { - demangling_delete (dm); - return status; - } + len = strlen (mangled); + + if (mangled[0] == '_' && mangled[1] == 'Z') + type = 0; + else if (strncmp (mangled, "_GLOBAL_", 8) == 0 + && (mangled[8] == '.' || mangled[8] == '_' || mangled[8] == '$') + && (mangled[9] == 'D' || mangled[9] == 'I') + && mangled[10] == '_') + { + char *r; - status = demangle_mangled_name (dm); - if (STATUS_NO_ERROR (status)) + r = (char *) malloc (40 + len - 11); + if (r == NULL) + *palc = 1; + else { - dyn_string_t demangled = (dyn_string_t) result_pop (dm); - if (!dyn_string_copy (result, demangled)) - return STATUS_ALLOCATION_FAILED; - dyn_string_delete (demangled); + if (mangled[9] == 'I') + strcpy (r, "global constructors keyed to "); + else + strcpy (r, "global destructors keyed to "); + strcat (r, mangled + 11); } - - demangling_delete (dm); + return r; } else { - /* It's evidently not a mangled C++ name. It could be the name - of something with C linkage, though, so just copy NAME into - RESULT. */ - if (!dyn_string_copy_cstr (result, name)) - return STATUS_ALLOCATION_FAILED; - status = STATUS_OK; + if ((options & DMGL_TYPES) == 0) + return NULL; + type = 1; } - return status; -} + cplus_demangle_init_info (mangled, options, len, &di); -/* Demangle TYPE_NAME into RESULT, which must be an initialized - dyn_string_t. On success, returns STATUS_OK. On failiure, returns - an error message, and the contents of RESULT are unchanged. */ + { +#ifdef CP_DYNAMIC_ARRAYS + __extension__ struct demangle_component comps[di.num_comps]; + __extension__ struct demangle_component *subs[di.num_subs]; -static status_t -cp_demangle_type (type_name, result) - const char* type_name; - dyn_string_t result; -{ - status_t status; - demangling_t dm = demangling_new (type_name, DMGL_GNU_V3); - - if (dm == NULL) - return STATUS_ALLOCATION_FAILED; - - /* Demangle the type name. The demangled name is stored in dm. */ - status = result_push (dm); - if (status != STATUS_OK) - { - demangling_delete (dm); - return status; - } + di.comps = &comps[0]; + di.subs = &subs[0]; +#else + di.comps = ((struct demangle_component *) + malloc (di.num_comps * sizeof (struct demangle_component))); + di.subs = ((struct demangle_component **) + malloc (di.num_subs * sizeof (struct demangle_component *))); + if (di.comps == NULL || di.subs == NULL) + { + if (di.comps != NULL) + free (di.comps); + if (di.subs != NULL) + free (di.subs); + *palc = 1; + return NULL; + } +#endif - status = demangle_type (dm); + if (! type) + dc = cplus_demangle_mangled_name (&di, 1); + else + dc = cplus_demangle_type (&di); - if (STATUS_NO_ERROR (status)) - { - /* The demangling succeeded. Pop the result out of dm and copy - it into RESULT. */ - dyn_string_t demangled = (dyn_string_t) result_pop (dm); - if (!dyn_string_copy (result, demangled)) - return STATUS_ALLOCATION_FAILED; - dyn_string_delete (demangled); - } + /* If DMGL_PARAMS is set, then if we didn't consume the entire + mangled string, then we didn't successfully demangle it. If + DMGL_PARAMS is not set, we didn't look at the trailing + parameters. */ + if (((options & DMGL_PARAMS) != 0) && d_peek_char (&di) != '\0') + dc = NULL; + +#ifdef CP_DEMANGLE_DEBUG + if (dc == NULL) + printf ("failed demangling\n"); + else + d_dump (dc, 0); +#endif + + /* We try to guess the length of the demangled string, to minimize + calls to realloc during demangling. */ + estimate = len + di.expansion + 10 * di.did_subs; + estimate += estimate / 8; - /* Clean up. */ - demangling_delete (dm); + ret = NULL; + if (dc != NULL) + ret = cplus_demangle_print (options, dc, estimate, palc); - return status; +#ifndef CP_DYNAMIC_ARRAYS + free (di.comps); + free (di.subs); +#endif + +#ifdef CP_DEMANGLE_DEBUG + if (ret != NULL) + { + int rlen; + + rlen = strlen (ret); + if (rlen > 2 * estimate) + printf ("*** Length %d much greater than estimate %d\n", + rlen, estimate); + else if (rlen > estimate) + printf ("*** Length %d greater than estimate %d\n", + rlen, estimate); + else if (rlen < estimate / 2) + printf ("*** Length %d much less than estimate %d\n", + rlen, estimate); + } +#endif + } + + return ret; } #if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3) -extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *)); -/* ia64 ABI-mandated entry point in the C++ runtime library for performing - demangling. MANGLED_NAME is a NUL-terminated character string - containing the name to be demangled. +extern char *__cxa_demangle (const char *, char *, size_t *, int *); + +/* ia64 ABI-mandated entry point in the C++ runtime library for + performing demangling. MANGLED_NAME is a NUL-terminated character + string containing the name to be demangled. OUTPUT_BUFFER is a region of memory, allocated with malloc, of *LENGTH bytes, into which the demangled name is stored. If OUTPUT_BUFFER is not long enough, it is expanded using realloc. OUTPUT_BUFFER may instead be NULL; in that case, the demangled name - is placed in a region of memory allocated with malloc. + is placed in a region of memory allocated with malloc. - If LENGTH is non-NULL, the length of the buffer conaining the - demangled name, is placed in *LENGTH. + If LENGTH is non-NULL, the length of the buffer containing the + demangled name, is placed in *LENGTH. The return value is a pointer to the start of the NUL-terminated demangled name, or NULL if the demangling fails. The caller is - responsible for deallocating this memory using free. + responsible for deallocating this memory using free. *STATUS is set to one of the following values: 0: The demangling operation succeeded. - -1: A memory allocation failiure occurred. + -1: A memory allocation failure occurred. -2: MANGLED_NAME is not a valid name under the C++ ABI mangling rules. -3: One of the arguments is invalid. - The demagling is performed using the C++ ABI mangling rules, with + The demangling is performed using the C++ ABI mangling rules, with GNU extensions. */ char * -__cxa_demangle (mangled_name, output_buffer, length, status) - const char *mangled_name; - char *output_buffer; - size_t *length; - int *status; +__cxa_demangle (const char *mangled_name, char *output_buffer, + size_t *length, int *status) { - struct dyn_string demangled_name; - status_t result; - - if (status == NULL) - return NULL; + char *demangled; + size_t alc; - if (mangled_name == NULL) { - *status = -3; - return NULL; - } + if (mangled_name == NULL) + { + if (status != NULL) + *status = -3; + return NULL; + } - /* Did the caller provide a buffer for the demangled name? */ - if (output_buffer == NULL) { - /* No; dyn_string will malloc a buffer for us. */ - if (!dyn_string_init (&demangled_name, 0)) - { - *status = -1; - return NULL; - } - } - else { - /* Yes. Check that the length was provided. */ - if (length == NULL) { - *status = -3; + if (output_buffer != NULL && length == NULL) + { + if (status != NULL) + *status = -3; return NULL; } - /* Install the buffer into a dyn_string. */ - demangled_name.allocated = *length; - demangled_name.length = 0; - demangled_name.s = output_buffer; - } - if (mangled_name[0] == '_' && mangled_name[1] == 'Z') - /* MANGLED_NAME apprears to be a function or variable name. - Demangle it accordingly. */ - result = cp_demangle (mangled_name, &demangled_name, 0); - else - /* Try to demangled MANGLED_NAME as the name of a type. */ - result = cp_demangle_type (mangled_name, &demangled_name); + demangled = d_demangle (mangled_name, DMGL_PARAMS | DMGL_TYPES, &alc); - if (result == STATUS_OK) - /* The demangling succeeded. */ + if (demangled == NULL) { - /* If LENGTH isn't NULL, store the allocated buffer length - there; the buffer may have been realloced by dyn_string - functions. */ - if (length != NULL) - *length = demangled_name.allocated; - /* The operation was a success. */ - *status = 0; - return dyn_string_buf (&demangled_name); + if (status != NULL) + { + if (alc == 1) + *status = -1; + else + *status = -2; + } + return NULL; } - else if (result == STATUS_ALLOCATION_FAILED) - /* A call to malloc or realloc failed during the demangling - operation. */ + + if (output_buffer == NULL) { - *status = -1; - return NULL; + if (length != NULL) + *length = alc; } else - /* The demangling failed for another reason, most probably because - MANGLED_NAME isn't a valid mangled name. */ { - /* If the buffer containing the demangled name wasn't provided - by the caller, free it. */ - if (output_buffer == NULL) - free (dyn_string_buf (&demangled_name)); - *status = -2; - return NULL; + if (strlen (demangled) < *length) + { + strcpy (output_buffer, demangled); + free (demangled); + demangled = output_buffer; + } + else + { + free (output_buffer); + *length = alc; + } } + + if (status != NULL) + *status = 0; + + return demangled; } #else /* ! (IN_LIBGCC2 || IN_GLIBCPP_V3) */ -/* Variant entry point for integration with the existing cplus-dem - demangler. Attempts to demangle MANGLED. If the demangling - succeeds, returns a buffer, allocated with malloc, containing the - demangled name. The caller must deallocate the buffer using free. - If the demangling failes, returns NULL. */ +/* Entry point for libiberty demangler. If MANGLED is a g++ v3 ABI + mangled name, return a buffer allocated with malloc holding the + demangled name. Otherwise, return NULL. */ char * -cplus_demangle_v3 (mangled, options) - const char* mangled; - int options; +cplus_demangle_v3 (const char* mangled, int options) { - dyn_string_t demangled; - status_t status; - int type = !!(options & DMGL_TYPES); + size_t alc; - if (mangled[0] == '_' && mangled[1] == 'Z') - /* It is not a type. */ - type = 0; - else - { - /* It is a type. Stop if we don't want to demangle types. */ - if (!type) - return NULL; - } - - flag_verbose = !!(options & DMGL_VERBOSE); - - /* Create a dyn_string to hold the demangled name. */ - demangled = dyn_string_new (0); - /* Attempt the demangling. */ - if (!type) - /* Appears to be a function or variable name. */ - status = cp_demangle (mangled, demangled, 0); - else - /* Try to demangle it as the name of a type. */ - status = cp_demangle_type (mangled, demangled); - - if (STATUS_NO_ERROR (status)) - /* Demangling succeeded. */ - { - /* Grab the demangled result from the dyn_string. It was - allocated with malloc, so we can return it directly. */ - char *return_value = dyn_string_release (demangled); - /* Hand back the demangled name. */ - return return_value; - } - else if (status == STATUS_ALLOCATION_FAILED) - { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); - } - else - /* Demangling failed. */ - { - dyn_string_delete (demangled); - return NULL; - } + return d_demangle (mangled, options, &alc); } /* Demangle a Java symbol. Java uses a subset of the V3 ABI C++ mangling @@ -3815,198 +4011,179 @@ cplus_demangle_v3 (mangled, options) of JArray<TYPE> with TYPE[]. */ char * -java_demangle_v3 (mangled) - const char* mangled; +java_demangle_v3 (const char* mangled) { - dyn_string_t demangled; - char *next; - char *end; - int len; - status_t status; - int nesting = 0; - char *cplus_demangled; - char *return_value; - - /* Create a dyn_string to hold the demangled name. */ - demangled = dyn_string_new (0); - - /* Attempt the demangling. */ - status = cp_demangle ((char *) mangled, demangled, DMGL_JAVA); - - if (STATUS_NO_ERROR (status)) - /* Demangling succeeded. */ - { - /* Grab the demangled result from the dyn_string. */ - cplus_demangled = dyn_string_release (demangled); - } - else if (status == STATUS_ALLOCATION_FAILED) - { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); - } - else - /* Demangling failed. */ - { - dyn_string_delete (demangled); - return NULL; - } - - len = strlen (cplus_demangled); - next = cplus_demangled; - end = next + len; - demangled = NULL; - - /* Replace occurances of JArray<TYPE> with TYPE[]. */ - while (next < end) + size_t alc; + char *demangled; + int nesting; + char *from; + char *to; + + demangled = d_demangle (mangled, DMGL_JAVA | DMGL_PARAMS | DMGL_RET_POSTFIX, + &alc); + + if (demangled == NULL) + return NULL; + + nesting = 0; + from = demangled; + to = from; + while (*from != '\0') { - char *open_str = strstr (next, "JArray<"); - char *close_str = NULL; - if (nesting > 0) - close_str = strchr (next, '>'); - - if (open_str != NULL && (close_str == NULL || close_str > open_str)) - { + if (strncmp (from, "JArray<", 7) == 0) + { + from += 7; ++nesting; - - if (!demangled) - demangled = dyn_string_new(len); - - /* Copy prepending symbols, if any. */ - if (open_str > next) - { - open_str[0] = 0; - dyn_string_append_cstr (demangled, next); - } - next = open_str + 7; } - else if (close_str != NULL) - { + else if (nesting > 0 && *from == '>') + { + while (to > demangled && to[-1] == ' ') + --to; + *to++ = '['; + *to++ = ']'; --nesting; - - /* Copy prepending type symbol, if any. Squash any spurious - whitespace. */ - if (close_str > next && next[0] != ' ') - { - close_str[0] = 0; - dyn_string_append_cstr (demangled, next); - } - dyn_string_append_cstr (demangled, "[]"); - next = close_str + 1; + ++from; } else - { - /* There are no more arrays. Copy the rest of the symbol, or - simply return the original symbol if no changes were made. */ - if (next == cplus_demangled) - return cplus_demangled; - - dyn_string_append_cstr (demangled, next); - next = end; - } + *to++ = *from++; } - free (cplus_demangled); - - if (demangled) - return_value = dyn_string_release (demangled); - else - return_value = NULL; + *to = '\0'; - return return_value; + return demangled; } #endif /* IN_LIBGCC2 || IN_GLIBCPP_V3 */ - #ifndef IN_GLIBCPP_V3 -/* Demangle NAME in the G++ V3 ABI demangling style, and return either - zero, indicating that some error occurred, or a demangling_t - holding the results. */ -static demangling_t -demangle_v3_with_details (name) - const char *name; + +/* Demangle a string in order to find out whether it is a constructor + or destructor. Return non-zero on success. Set *CTOR_KIND and + *DTOR_KIND appropriately. */ + +static int +is_ctor_or_dtor (const char *mangled, + enum gnu_v3_ctor_kinds *ctor_kind, + enum gnu_v3_dtor_kinds *dtor_kind) { - demangling_t dm; - status_t status; + struct d_info di; + struct demangle_component *dc; + int ret; - if (strncmp (name, "_Z", 2)) - return 0; + *ctor_kind = (enum gnu_v3_ctor_kinds) 0; + *dtor_kind = (enum gnu_v3_dtor_kinds) 0; - dm = demangling_new (name, DMGL_GNU_V3); - if (dm == NULL) - { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); - } + cplus_demangle_init_info (mangled, DMGL_GNU_V3, strlen (mangled), &di); - status = result_push (dm); - if (! STATUS_NO_ERROR (status)) - { - demangling_delete (dm); - fprintf (stderr, "%s\n", status); - abort (); - } + { +#ifdef CP_DYNAMIC_ARRAYS + __extension__ struct demangle_component comps[di.num_comps]; + __extension__ struct demangle_component *subs[di.num_subs]; - status = demangle_mangled_name (dm); - if (STATUS_NO_ERROR (status)) - return dm; + di.comps = &comps[0]; + di.subs = &subs[0]; +#else + di.comps = ((struct demangle_component *) + malloc (di.num_comps * sizeof (struct demangle_component))); + di.subs = ((struct demangle_component **) + malloc (di.num_subs * sizeof (struct demangle_component *))); + if (di.comps == NULL || di.subs == NULL) + { + if (di.comps != NULL) + free (di.comps); + if (di.subs != NULL) + free (di.subs); + return 0; + } +#endif - demangling_delete (dm); - return 0; + dc = cplus_demangle_mangled_name (&di, 1); + + /* Note that because we did not pass DMGL_PARAMS, we don't expect + to demangle the entire string. */ + + ret = 0; + while (dc != NULL) + { + switch (dc->type) + { + default: + dc = NULL; + break; + case DEMANGLE_COMPONENT_TYPED_NAME: + case DEMANGLE_COMPONENT_TEMPLATE: + case DEMANGLE_COMPONENT_RESTRICT_THIS: + case DEMANGLE_COMPONENT_VOLATILE_THIS: + case DEMANGLE_COMPONENT_CONST_THIS: + dc = d_left (dc); + break; + case DEMANGLE_COMPONENT_QUAL_NAME: + case DEMANGLE_COMPONENT_LOCAL_NAME: + dc = d_right (dc); + break; + case DEMANGLE_COMPONENT_CTOR: + *ctor_kind = dc->u.s_ctor.kind; + ret = 1; + dc = NULL; + break; + case DEMANGLE_COMPONENT_DTOR: + *dtor_kind = dc->u.s_dtor.kind; + ret = 1; + dc = NULL; + break; + } + } + +#ifndef CP_DYNAMIC_ARRAYS + free (di.subs); + free (di.comps); +#endif + } + + return ret; } +/* Return whether NAME is the mangled form of a g++ V3 ABI constructor + name. A non-zero return indicates the type of constructor. */ -/* Return non-zero iff NAME is the mangled form of a constructor name - in the G++ V3 ABI demangling style. Specifically, return: - - '1' if NAME is a complete object constructor, - - '2' if NAME is a base object constructor, or - - '3' if NAME is a complete object allocating constructor. */ enum gnu_v3_ctor_kinds -is_gnu_v3_mangled_ctor (name) - const char *name; +is_gnu_v3_mangled_ctor (const char *name) { - demangling_t dm = demangle_v3_with_details (name); + enum gnu_v3_ctor_kinds ctor_kind; + enum gnu_v3_dtor_kinds dtor_kind; - if (dm) - { - enum gnu_v3_ctor_kinds result = dm->is_constructor; - demangling_delete (dm); - return result; - } - else + if (! is_ctor_or_dtor (name, &ctor_kind, &dtor_kind)) return (enum gnu_v3_ctor_kinds) 0; + return ctor_kind; } -/* Return non-zero iff NAME is the mangled form of a destructor name - in the G++ V3 ABI demangling style. Specifically, return: - - '0' if NAME is a deleting destructor, - - '1' if NAME is a complete object destructor, or - - '2' if NAME is a base object destructor. */ +/* Return whether NAME is the mangled form of a g++ V3 ABI destructor + name. A non-zero return indicates the type of destructor. */ + enum gnu_v3_dtor_kinds -is_gnu_v3_mangled_dtor (name) - const char *name; +is_gnu_v3_mangled_dtor (const char *name) { - demangling_t dm = demangle_v3_with_details (name); + enum gnu_v3_ctor_kinds ctor_kind; + enum gnu_v3_dtor_kinds dtor_kind; - if (dm) - { - enum gnu_v3_dtor_kinds result = dm->is_destructor; - demangling_delete (dm); - return result; - } - else + if (! is_ctor_or_dtor (name, &ctor_kind, &dtor_kind)) return (enum gnu_v3_dtor_kinds) 0; + return dtor_kind; } -#endif /* IN_GLIBCPP_V3 */ +#endif /* IN_GLIBCPP_V3 */ #ifdef STANDALONE_DEMANGLER #include "getopt.h" +#include "dyn-string.h" + +static void print_usage (FILE* fp, int exit_value); -static void print_usage - PARAMS ((FILE* fp, int exit_value)); +#define IS_ALPHA(CHAR) \ + (((CHAR) >= 'a' && (CHAR) <= 'z') \ + || ((CHAR) >= 'A' && (CHAR) <= 'Z')) /* Non-zero if CHAR is a character than can occur in a mangled name. */ #define is_mangled_char(CHAR) \ @@ -4019,14 +4196,12 @@ const char* program_name; /* Prints usage summary to FP and then exits with EXIT_VALUE. */ static void -print_usage (fp, exit_value) - FILE* fp; - int exit_value; +print_usage (FILE* fp, int exit_value) { fprintf (fp, "Usage: %s [options] [names ...]\n", program_name); fprintf (fp, "Options:\n"); fprintf (fp, " -h,--help Display this message.\n"); - fprintf (fp, " -s,--strict Demangle standard names only.\n"); + fprintf (fp, " -p,--no-params Don't display function parameters\n"); fprintf (fp, " -v,--verbose Produce verbose demanglings.\n"); fprintf (fp, "If names are provided, they are demangled. Otherwise filters standard input.\n"); @@ -4036,10 +4211,10 @@ print_usage (fp, exit_value) /* Option specification for getopt_long. */ static const struct option long_options[] = { - { "help", no_argument, NULL, 'h' }, - { "strict", no_argument, NULL, 's' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, no_argument, NULL, 0 }, + { "help", no_argument, NULL, 'h' }, + { "no-params", no_argument, NULL, 'p' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, no_argument, NULL, 0 }, }; /* Main entry for a demangling filter executable. It will demangle @@ -4048,13 +4223,11 @@ static const struct option long_options[] = with their demangled equivalents. */ int -main (argc, argv) - int argc; - char *argv[]; +main (int argc, char *argv[]) { - status_t status; int i; int opt_char; + int options = DMGL_PARAMS | DMGL_ANSI | DMGL_TYPES; /* Use the program name of this program, as invoked. */ program_name = argv[0]; @@ -4062,7 +4235,7 @@ main (argc, argv) /* Parse options. */ do { - opt_char = getopt_long (argc, argv, "hsv", long_options, NULL); + opt_char = getopt_long (argc, argv, "hpv", long_options, NULL); switch (opt_char) { case '?': /* Unrecognized option. */ @@ -4073,12 +4246,12 @@ main (argc, argv) print_usage (stdout, 0); break; - case 's': - flag_strict = 1; + case 'p': + options &= ~ DMGL_PARAMS; break; case 'v': - flag_verbose = 1; + options |= DMGL_VERBOSE; break; } } @@ -4088,41 +4261,12 @@ main (argc, argv) /* No command line arguments were provided. Filter stdin. */ { dyn_string_t mangled = dyn_string_new (3); - dyn_string_t demangled = dyn_string_new (0); - status_t status; + char *s; /* Read all of input. */ while (!feof (stdin)) { - char c = getchar (); - - /* The first character of a mangled name is an underscore. */ - if (feof (stdin)) - break; - if (c != '_') - { - /* It's not a mangled name. Print the character and go - on. */ - putchar (c); - continue; - } - c = getchar (); - - /* The second character of a mangled name is a capital `Z'. */ - if (feof (stdin)) - break; - if (c != 'Z') - { - /* It's not a mangled name. Print the previous - underscore, the `Z', and go on. */ - putchar ('_'); - putchar (c); - continue; - } - - /* Start keeping track of the candidate mangled name. */ - dyn_string_append_char (mangled, '_'); - dyn_string_append_char (mangled, 'Z'); + char c; /* Pile characters into mangled until we hit one that can't occur in a mangled name. */ @@ -4135,62 +4279,70 @@ main (argc, argv) c = getchar (); } - /* Attempt to demangle the name. */ - status = cp_demangle (dyn_string_buf (mangled), demangled, 0); - - /* If the demangling succeeded, great! Print out the - demangled version. */ - if (STATUS_NO_ERROR (status)) - fputs (dyn_string_buf (demangled), stdout); - /* Abort on allocation failures. */ - else if (status == STATUS_ALLOCATION_FAILED) + if (dyn_string_length (mangled) > 0) { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); +#ifdef IN_GLIBCPP_V3 + s = __cxa_demangle (dyn_string_buf (mangled), NULL, NULL, NULL); +#else + s = cplus_demangle_v3 (dyn_string_buf (mangled), options); +#endif + + if (s != NULL) + { + fputs (s, stdout); + free (s); + } + else + { + /* It might not have been a mangled name. Print the + original text. */ + fputs (dyn_string_buf (mangled), stdout); + } + + dyn_string_clear (mangled); } - /* Otherwise, it might not have been a mangled name. Just - print out the original text. */ - else - fputs (dyn_string_buf (mangled), stdout); /* If we haven't hit EOF yet, we've read one character that can't occur in a mangled name, so print it out. */ if (!feof (stdin)) putchar (c); - - /* Clear the candidate mangled name, to start afresh next - time we hit a `_Z'. */ - dyn_string_clear (mangled); } dyn_string_delete (mangled); - dyn_string_delete (demangled); } else /* Demangle command line arguments. */ { - dyn_string_t result = dyn_string_new (0); - /* Loop over command line arguments. */ for (i = optind; i < argc; ++i) { + char *s; +#ifdef IN_GLIBCPP_V3 + int status; +#endif + /* Attempt to demangle. */ - status = cp_demangle (argv[i], result, 0); +#ifdef IN_GLIBCPP_V3 + s = __cxa_demangle (argv[i], NULL, NULL, &status); +#else + s = cplus_demangle_v3 (argv[i], options); +#endif /* If it worked, print the demangled name. */ - if (STATUS_NO_ERROR (status)) - printf ("%s\n", dyn_string_buf (result)); - /* Abort on allocaiton failures. */ - else if (status == STATUS_ALLOCATION_FAILED) + if (s != NULL) { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); + printf ("%s\n", s); + free (s); + } + else + { +#ifdef IN_GLIBCPP_V3 + fprintf (stderr, "Failed: %s (status %d)\n", argv[i], status); +#else + fprintf (stderr, "Failed: %s\n", argv[i]); +#endif } - /* If not, print the error message to stderr instead. */ - else - fprintf (stderr, "%s\n", status); } - dyn_string_delete (result); } return 0; diff --git a/gnu/lib/libiberty/src/cplus-dem.c b/gnu/lib/libiberty/src/cplus-dem.c index 027f5696d32..5c9ed348120 100644 --- a/gnu/lib/libiberty/src/cplus-dem.c +++ b/gnu/lib/libiberty/src/cplus-dem.c @@ -1,6 +1,6 @@ /* Demangler for GNU C++ Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.uucp) Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling Modified by Satish Pai (pai@apollo.hp.com) for HP demangling @@ -27,8 +27,8 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ /* This file exports two functions; cplus_mangle_opname and cplus_demangle. @@ -62,7 +62,7 @@ char * realloc (); #include "libiberty.h" -static char *ada_demangle PARAMS ((const char *, int)); +static char *ada_demangle (const char *, int); #define min(X,Y) (((X) < (Y)) ? (X) : (Y)) @@ -70,7 +70,7 @@ static char *ada_demangle PARAMS ((const char *, int)); that will be output when using the `%d' format with `printf'. */ #define INTBUF_SIZE 32 -extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN; +extern void fancy_abort (void) ATTRIBUTE_NORETURN; /* In order to allow a single demangler executable to demangle strings using various common values of CPLUS_MARKER, as well as any specific @@ -99,8 +99,7 @@ static char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' }; static char char_str[2] = { '\000', '\000' }; void -set_cplus_marker_for_demangling (ch) - int ch; +set_cplus_marker_for_demangling (int ch) { cplus_markers[0] = ch; } @@ -327,163 +326,127 @@ const struct demangler_engine libiberty_demanglers[] = /* Prototypes for local functions */ -static void -delete_work_stuff PARAMS ((struct work_stuff *)); +static void delete_work_stuff (struct work_stuff *); -static void -delete_non_B_K_work_stuff PARAMS ((struct work_stuff *)); +static void delete_non_B_K_work_stuff (struct work_stuff *); -static char * -mop_up PARAMS ((struct work_stuff *, string *, int)); +static char *mop_up (struct work_stuff *, string *, int); -static void -squangle_mop_up PARAMS ((struct work_stuff *)); +static void squangle_mop_up (struct work_stuff *); -static void -work_stuff_copy_to_from PARAMS ((struct work_stuff *, struct work_stuff *)); +static void work_stuff_copy_to_from (struct work_stuff *, struct work_stuff *); #if 0 static int -demangle_method_args PARAMS ((struct work_stuff *, const char **, string *)); +demangle_method_args (struct work_stuff *, const char **, string *); #endif static char * -internal_cplus_demangle PARAMS ((struct work_stuff *, const char *)); +internal_cplus_demangle (struct work_stuff *, const char *); static int -demangle_template_template_parm PARAMS ((struct work_stuff *work, - const char **, string *)); +demangle_template_template_parm (struct work_stuff *work, + const char **, string *); static int -demangle_template PARAMS ((struct work_stuff *work, const char **, string *, - string *, int, int)); +demangle_template (struct work_stuff *work, const char **, string *, + string *, int, int); static int -arm_pt PARAMS ((struct work_stuff *, const char *, int, const char **, - const char **)); +arm_pt (struct work_stuff *, const char *, int, const char **, + const char **); static int -demangle_class_name PARAMS ((struct work_stuff *, const char **, string *)); +demangle_class_name (struct work_stuff *, const char **, string *); static int -demangle_qualified PARAMS ((struct work_stuff *, const char **, string *, - int, int)); +demangle_qualified (struct work_stuff *, const char **, string *, + int, int); -static int -demangle_class PARAMS ((struct work_stuff *, const char **, string *)); +static int demangle_class (struct work_stuff *, const char **, string *); -static int -demangle_fund_type PARAMS ((struct work_stuff *, const char **, string *)); +static int demangle_fund_type (struct work_stuff *, const char **, string *); -static int -demangle_signature PARAMS ((struct work_stuff *, const char **, string *)); +static int demangle_signature (struct work_stuff *, const char **, string *); -static int -demangle_prefix PARAMS ((struct work_stuff *, const char **, string *)); +static int demangle_prefix (struct work_stuff *, const char **, string *); -static int -gnu_special PARAMS ((struct work_stuff *, const char **, string *)); +static int gnu_special (struct work_stuff *, const char **, string *); -static int -arm_special PARAMS ((const char **, string *)); +static int arm_special (const char **, string *); -static void -string_need PARAMS ((string *, int)); +static void string_need (string *, int); -static void -string_delete PARAMS ((string *)); +static void string_delete (string *); static void -string_init PARAMS ((string *)); +string_init (string *); -static void -string_clear PARAMS ((string *)); +static void string_clear (string *); #if 0 -static int -string_empty PARAMS ((string *)); +static int string_empty (string *); #endif -static void -string_append PARAMS ((string *, const char *)); +static void string_append (string *, const char *); -static void -string_appends PARAMS ((string *, string *)); +static void string_appends (string *, string *); -static void -string_appendn PARAMS ((string *, const char *, int)); +static void string_appendn (string *, const char *, int); -static void -string_prepend PARAMS ((string *, const char *)); +static void string_prepend (string *, const char *); -static void -string_prependn PARAMS ((string *, const char *, int)); +static void string_prependn (string *, const char *, int); -static void -string_append_template_idx PARAMS ((string *, int)); +static void string_append_template_idx (string *, int); -static int -get_count PARAMS ((const char **, int *)); +static int get_count (const char **, int *); -static int -consume_count PARAMS ((const char **)); +static int consume_count (const char **); -static int -consume_count_with_underscores PARAMS ((const char**)); +static int consume_count_with_underscores (const char**); -static int -demangle_args PARAMS ((struct work_stuff *, const char **, string *)); +static int demangle_args (struct work_stuff *, const char **, string *); -static int -demangle_nested_args PARAMS ((struct work_stuff*, const char**, string*)); +static int demangle_nested_args (struct work_stuff*, const char**, string*); -static int -do_type PARAMS ((struct work_stuff *, const char **, string *)); +static int do_type (struct work_stuff *, const char **, string *); -static int -do_arg PARAMS ((struct work_stuff *, const char **, string *)); +static int do_arg (struct work_stuff *, const char **, string *); static void -demangle_function_name PARAMS ((struct work_stuff *, const char **, string *, - const char *)); +demangle_function_name (struct work_stuff *, const char **, string *, + const char *); static int -iterate_demangle_function PARAMS ((struct work_stuff *, - const char **, string *, const char *)); +iterate_demangle_function (struct work_stuff *, + const char **, string *, const char *); -static void -remember_type PARAMS ((struct work_stuff *, const char *, int)); +static void remember_type (struct work_stuff *, const char *, int); -static void -remember_Btype PARAMS ((struct work_stuff *, const char *, int, int)); +static void remember_Btype (struct work_stuff *, const char *, int, int); -static int -register_Btype PARAMS ((struct work_stuff *)); +static int register_Btype (struct work_stuff *); -static void -remember_Ktype PARAMS ((struct work_stuff *, const char *, int)); +static void remember_Ktype (struct work_stuff *, const char *, int); -static void -forget_types PARAMS ((struct work_stuff *)); +static void forget_types (struct work_stuff *); -static void -forget_B_and_K_types PARAMS ((struct work_stuff *)); +static void forget_B_and_K_types (struct work_stuff *); -static void -string_prepends PARAMS ((string *, string *)); +static void string_prepends (string *, string *); static int -demangle_template_value_parm PARAMS ((struct work_stuff*, const char**, - string*, type_kind_t)); +demangle_template_value_parm (struct work_stuff*, const char**, + string*, type_kind_t); static int -do_hpacc_template_const_value PARAMS ((struct work_stuff *, const char **, string *)); +do_hpacc_template_const_value (struct work_stuff *, const char **, string *); static int -do_hpacc_template_literal PARAMS ((struct work_stuff *, const char **, string *)); +do_hpacc_template_literal (struct work_stuff *, const char **, string *); -static int -snarf_numeric_literal PARAMS ((const char **, string *)); +static int snarf_numeric_literal (const char **, string *); /* There is a TYPE_QUAL value for each type qualifier. They can be combined by bitwise-or to form the complete set of qualifiers for a @@ -494,36 +457,28 @@ snarf_numeric_literal PARAMS ((const char **, string *)); #define TYPE_QUAL_VOLATILE 0x2 #define TYPE_QUAL_RESTRICT 0x4 -static int -code_for_qualifier PARAMS ((int)); +static int code_for_qualifier (int); -static const char* -qualifier_string PARAMS ((int)); +static const char* qualifier_string (int); -static const char* -demangle_qualifier PARAMS ((int)); +static const char* demangle_qualifier (int); -static int -demangle_expression PARAMS ((struct work_stuff *, const char **, string *, - type_kind_t)); +static int demangle_expression (struct work_stuff *, const char **, string *, + type_kind_t); static int -demangle_integral_value PARAMS ((struct work_stuff *, const char **, - string *)); +demangle_integral_value (struct work_stuff *, const char **, string *); static int -demangle_real_value PARAMS ((struct work_stuff *, const char **, string *)); +demangle_real_value (struct work_stuff *, const char **, string *); static void -demangle_arm_hp_template PARAMS ((struct work_stuff *, const char **, int, - string *)); +demangle_arm_hp_template (struct work_stuff *, const char **, int, string *); static void -recursively_demangle PARAMS ((struct work_stuff *, const char **, string *, - int)); +recursively_demangle (struct work_stuff *, const char **, string *, int); -static void -grow_vect PARAMS ((char **, size_t *, size_t, int)); +static void grow_vect (char **, size_t *, size_t, int); /* Translate count to integer, consuming tokens in the process. Conversion terminates on the first non-digit character. @@ -534,8 +489,7 @@ grow_vect PARAMS ((char **, size_t *, size_t, int)); Overflow consumes the rest of the digits, and returns -1. */ static int -consume_count (type) - const char **type; +consume_count (const char **type) { int count = 0; @@ -574,8 +528,7 @@ consume_count (type) failure, since 0 can be a valid value. */ static int -consume_count_with_underscores (mangled) - const char **mangled; +consume_count_with_underscores (const char **mangled) { int idx; @@ -608,8 +561,7 @@ consume_count_with_underscores (mangled) corresponding to this qualifier. */ static int -code_for_qualifier (c) - int c; +code_for_qualifier (int c) { switch (c) { @@ -634,8 +586,7 @@ code_for_qualifier (c) TYPE_QUALS. */ static const char* -qualifier_string (type_quals) - int type_quals; +qualifier_string (int type_quals) { switch (type_quals) { @@ -676,17 +627,13 @@ qualifier_string (type_quals) called with a valid qualifier code. */ static const char* -demangle_qualifier (c) - int c; +demangle_qualifier (int c) { return qualifier_string (code_for_qualifier (c)); } int -cplus_demangle_opname (opname, result, options) - const char *opname; - char *result; - int options; +cplus_demangle_opname (const char *opname, char *result, int options) { int len, len1, ret; string type; @@ -819,9 +766,7 @@ cplus_demangle_opname (opname, result, options) if OPTIONS & DMGL_ANSI == 0, return the old GNU name. */ const char * -cplus_mangle_opname (opname, options) - const char *opname; - int options; +cplus_mangle_opname (const char *opname, int options) { size_t i; int len; @@ -841,8 +786,7 @@ cplus_mangle_opname (opname, options) allow for any demangler initialization that maybe necessary. */ enum demangling_styles -cplus_demangle_set_style (style) - enum demangling_styles style; +cplus_demangle_set_style (enum demangling_styles style) { const struct demangler_engine *demangler = libiberty_demanglers; @@ -859,8 +803,7 @@ cplus_demangle_set_style (style) /* Do string name to style translation */ enum demangling_styles -cplus_demangle_name_to_style (name) - const char *name; +cplus_demangle_name_to_style (const char *name) { const struct demangler_engine *demangler = libiberty_demanglers; @@ -900,9 +843,7 @@ cplus_demangle_name_to_style (name) MANGLED. */ char * -cplus_demangle (mangled, options) - const char *mangled; - int options; +cplus_demangle (const char *mangled, int options) { char *ret; struct work_stuff work[1]; @@ -944,18 +885,14 @@ cplus_demangle (mangled, options) updating *OLD_VECT and *SIZE as necessary. */ static void -grow_vect (old_vect, size, min_size, element_size) - char **old_vect; - size_t *size; - size_t min_size; - int element_size; +grow_vect (char **old_vect, size_t *size, size_t min_size, int element_size) { if (*size < min_size) { *size *= 2; if (*size < min_size) *size = min_size; - *old_vect = (void *) xrealloc (*old_vect, *size * element_size); + *old_vect = XRESIZEVAR (char, *old_vect, *size * element_size); } } @@ -968,15 +905,12 @@ grow_vect (old_vect, size, min_size, element_size) The resulting string is valid until the next call of ada_demangle. */ static char * -ada_demangle (mangled, option) - const char *mangled; - int option ATTRIBUTE_UNUSED; +ada_demangle (const char *mangled, int option ATTRIBUTE_UNUSED) { int i, j; int len0; const char* p; char *demangled = NULL; - int at_start_name; int changed; size_t demangled_size = 0; @@ -1029,15 +963,12 @@ ada_demangle (mangled, option) i += 1, j += 1) demangled[j] = mangled[i]; - at_start_name = 1; while (i < len0) { - at_start_name = 0; - if (i < len0 - 2 && mangled[i] == '_' && mangled[i + 1] == '_') { demangled[j] = '.'; - changed = at_start_name = 1; + changed = 1; i += 2; j += 1; } else @@ -1063,7 +994,7 @@ ada_demangle (mangled, option) sizeof (char)); if (mangled[0] == '<') - strlcpy (demangled, mangled, demangled_size); + strlcpy (demangled, mangled, demangled_size); else snprintf (demangled, demangled_size, "<%s>", mangled); @@ -1077,9 +1008,7 @@ ada_demangle (mangled, option) calls go directly to this routine to avoid resetting that info. */ static char * -internal_cplus_demangle (work, mangled) - struct work_stuff *work; - const char *mangled; +internal_cplus_demangle (struct work_stuff *work, const char *mangled) { string decl; @@ -1144,8 +1073,7 @@ internal_cplus_demangle (work, mangled) /* Clear out and squangling related storage */ static void -squangle_mop_up (work) - struct work_stuff *work; +squangle_mop_up (struct work_stuff *work) { /* clean up the B and K type mangling types. */ forget_B_and_K_types (work); @@ -1163,9 +1091,7 @@ squangle_mop_up (work) /* Copy the work state and storage. */ static void -work_stuff_copy_to_from (to, from) - struct work_stuff *to; - struct work_stuff *from; +work_stuff_copy_to_from (struct work_stuff *to, struct work_stuff *from) { int i; @@ -1176,56 +1102,52 @@ work_stuff_copy_to_from (to, from) /* Deep-copy dynamic storage. */ if (from->typevec_size) - to->typevec - = (char **) xmalloc (from->typevec_size * sizeof (to->typevec[0])); + to->typevec = XNEWVEC (char *, from->typevec_size); for (i = 0; i < from->ntypes; i++) { int len = strlen (from->typevec[i]) + 1; - to->typevec[i] = xmalloc (len); + to->typevec[i] = XNEWVEC (char, len); memcpy (to->typevec[i], from->typevec[i], len); } if (from->ksize) - to->ktypevec - = (char **) xmalloc (from->ksize * sizeof (to->ktypevec[0])); + to->ktypevec = XNEWVEC (char *, from->ksize); for (i = 0; i < from->numk; i++) { int len = strlen (from->ktypevec[i]) + 1; - to->ktypevec[i] = xmalloc (len); + to->ktypevec[i] = XNEWVEC (char, len); memcpy (to->ktypevec[i], from->ktypevec[i], len); } if (from->bsize) - to->btypevec - = (char **) xmalloc (from->bsize * sizeof (to->btypevec[0])); + to->btypevec = XNEWVEC (char *, from->bsize); for (i = 0; i < from->numb; i++) { int len = strlen (from->btypevec[i]) + 1; - to->btypevec[i] = xmalloc (len); + to->btypevec[i] = XNEWVEC (char , len); memcpy (to->btypevec[i], from->btypevec[i], len); } if (from->ntmpl_args) - to->tmpl_argvec - = (char **) xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0])); + to->tmpl_argvec = XNEWVEC (char *, from->ntmpl_args); for (i = 0; i < from->ntmpl_args; i++) { int len = strlen (from->tmpl_argvec[i]) + 1; - to->tmpl_argvec[i] = xmalloc (len); + to->tmpl_argvec[i] = XNEWVEC (char, len); memcpy (to->tmpl_argvec[i], from->tmpl_argvec[i], len); } if (from->previous_argument) { - to->previous_argument = (string*) xmalloc (sizeof (string)); + to->previous_argument = XNEW (string); string_init (to->previous_argument); string_appends (to->previous_argument, from->previous_argument); } @@ -1235,8 +1157,7 @@ work_stuff_copy_to_from (to, from) /* Delete dynamic stuff in work_stuff that is not to be re-used. */ static void -delete_non_B_K_work_stuff (work) - struct work_stuff *work; +delete_non_B_K_work_stuff (struct work_stuff *work) { /* Discard the remembered types, if any. */ @@ -1269,8 +1190,7 @@ delete_non_B_K_work_stuff (work) /* Delete all dynamic storage in work_stuff. */ static void -delete_work_stuff (work) - struct work_stuff *work; +delete_work_stuff (struct work_stuff *work) { delete_non_B_K_work_stuff (work); squangle_mop_up (work); @@ -1280,10 +1200,7 @@ delete_work_stuff (work) /* Clear out any mangled storage */ static char * -mop_up (work, declp, success) - struct work_stuff *work; - string *declp; - int success; +mop_up (struct work_stuff *work, string *declp, int success) { char *demangled = NULL; @@ -1335,10 +1252,8 @@ DESCRIPTION argument list. */ static int -demangle_signature (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; +demangle_signature (struct work_stuff *work, + const char **mangled, string *declp) { int success = 1; int func_done = 0; @@ -1628,10 +1543,8 @@ demangle_signature (work, mangled, declp) #if 0 static int -demangle_method_args (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; +demangle_method_args (struct work_stuff *work, const char **mangled, + string *declp) { int success = 0; @@ -1651,10 +1564,8 @@ demangle_method_args (work, mangled, declp) #endif static int -demangle_template_template_parm (work, mangled, tname) - struct work_stuff *work; - const char **mangled; - string *tname; +demangle_template_template_parm (struct work_stuff *work, + const char **mangled, string *tname) { int i; int r; @@ -1715,11 +1626,8 @@ demangle_template_template_parm (work, mangled, tname) } static int -demangle_expression (work, mangled, s, tk) - struct work_stuff *work; - const char** mangled; - string* s; - type_kind_t tk; +demangle_expression (struct work_stuff *work, const char **mangled, + string *s, type_kind_t tk) { int need_operator = 0; int success; @@ -1775,10 +1683,8 @@ demangle_expression (work, mangled, s, tk) } static int -demangle_integral_value (work, mangled, s) - struct work_stuff *work; - const char** mangled; - string* s; +demangle_integral_value (struct work_stuff *work, + const char **mangled, string *s) { int success; @@ -1873,10 +1779,8 @@ demangle_integral_value (work, mangled, s) /* Demangle the real value in MANGLED. */ static int -demangle_real_value (work, mangled, s) - struct work_stuff *work; - const char **mangled; - string* s; +demangle_real_value (struct work_stuff *work, + const char **mangled, string *s) { if (**mangled == 'E') return demangle_expression (work, mangled, s, tk_real); @@ -1916,11 +1820,8 @@ demangle_real_value (work, mangled, s) } static int -demangle_template_value_parm (work, mangled, s, tk) - struct work_stuff *work; - const char **mangled; - string* s; - type_kind_t tk; +demangle_template_value_parm (struct work_stuff *work, const char **mangled, + string *s, type_kind_t tk) { int success = 1; @@ -1990,7 +1891,7 @@ demangle_template_value_parm (work, mangled, s, tk) string_appendn (s, "0", 1); else { - char *p = xmalloc (symbol_len + 1), *q; + char *p = XNEWVEC (char, symbol_len + 1), *q; strncpy (p, *mangled, symbol_len); p [symbol_len] = '\0'; /* We use cplus_demangle here, rather than @@ -2028,29 +1929,20 @@ demangle_template_value_parm (work, mangled, s, tk) types. */ static int -demangle_template (work, mangled, tname, trawname, is_type, remember) - struct work_stuff *work; - const char **mangled; - string *tname; - string *trawname; - int is_type; - int remember; +demangle_template (struct work_stuff *work, const char **mangled, + string *tname, string *trawname, + int is_type, int remember) { int i; int r; int need_comma = 0; int success = 0; - const char *start; int is_java_array = 0; string temp; - int bindex = 0; (*mangled)++; if (is_type) { - if (remember) - bindex = register_Btype (work); - start = *mangled; /* get template name */ if (**mangled == 'z') { @@ -2105,7 +1997,7 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) if (!is_type) { /* Create an array for saving the template argument values. */ - work->tmpl_argvec = (char**) xmalloc (r * sizeof (char *)); + work->tmpl_argvec = XNEWVEC (char *, r); work->ntmpl_args = r; for (i = 0; i < r; i++) work->tmpl_argvec[i] = 0; @@ -2130,7 +2022,7 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) { /* Save the template argument. */ int len = temp.p - temp.b; - work->tmpl_argvec[i] = xmalloc (len + 1); + work->tmpl_argvec[i] = XNEWVEC (char, len + 1); memcpy (work->tmpl_argvec[i], temp.b, len); work->tmpl_argvec[i][len] = '\0'; } @@ -2158,7 +2050,7 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) { /* Save the template argument. */ int len = r2; - work->tmpl_argvec[i] = xmalloc (len + 1); + work->tmpl_argvec[i] = XNEWVEC (char, len + 1); memcpy (work->tmpl_argvec[i], *mangled, len); work->tmpl_argvec[i][len] = '\0'; } @@ -2204,7 +2096,7 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) if (!is_type) { int len = s->p - s->b; - work->tmpl_argvec[i] = xmalloc (len + 1); + work->tmpl_argvec[i] = XNEWVEC (char, len + 1); memcpy (work->tmpl_argvec[i], s->b, len); work->tmpl_argvec[i][len] = '\0'; @@ -2226,7 +2118,10 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) } if (is_type && remember) - remember_Btype (work, tname->b, LEN_STRING (tname), bindex); + { + const int bindex = register_Btype (work); + remember_Btype (work, tname->b, LEN_STRING (tname), bindex); + } /* if (work -> static_type) @@ -2245,11 +2140,8 @@ demangle_template (work, mangled, tname, trawname, is_type, remember) } static int -arm_pt (work, mangled, n, anchor, args) - struct work_stuff *work; - const char *mangled; - int n; - const char **anchor, **args; +arm_pt (struct work_stuff *work, const char *mangled, + int n, const char **anchor, const char **args) { /* Check if ARM template with "__pt__" in it ("parameterized type") */ /* Allow HP also here, because HP's cfront compiler follows ARM to some extent */ @@ -2302,11 +2194,8 @@ arm_pt (work, mangled, n, anchor, args) } static void -demangle_arm_hp_template (work, mangled, n, declp) - struct work_stuff *work; - const char **mangled; - int n; - string *declp; +demangle_arm_hp_template (struct work_stuff *work, const char **mangled, + int n, string *declp) { const char *p; const char *args; @@ -2318,6 +2207,7 @@ demangle_arm_hp_template (work, mangled, n, declp) if (HP_DEMANGLING && ((*mangled)[n] == 'X')) { char *start_spec_args = NULL; + int hold_options; /* First check for and omit template specialization pseudo-arguments, such as in "Spec<#1,#1.*>" */ @@ -2330,6 +2220,12 @@ demangle_arm_hp_template (work, mangled, n, declp) string_init (&arg); if (work->temp_start == -1) /* non-recursive call */ work->temp_start = declp->p - declp->b; + + /* We want to unconditionally demangle parameter types in + template parameters. */ + hold_options = work->options; + work->options |= DMGL_PARAMS; + string_append (declp, "<"); while (1) { @@ -2376,17 +2272,25 @@ demangle_arm_hp_template (work, mangled, n, declp) string_delete (&arg); if (**mangled == '_') (*mangled)++; + work->options = hold_options; return; } /* ARM template? (Also handles HP cfront extensions) */ else if (arm_pt (work, *mangled, n, &p, &args)) { + int hold_options; string type_str; string_init (&arg); string_appendn (declp, *mangled, p - *mangled); if (work->temp_start == -1) /* non-recursive call */ work->temp_start = declp->p - declp->b; + + /* We want to unconditionally demangle parameter types in + template parameters. */ + hold_options = work->options; + work->options |= DMGL_PARAMS; + string_append (declp, "<"); /* should do error checking here */ while (args < e) { @@ -2430,7 +2334,10 @@ demangle_arm_hp_template (work, mangled, n, declp) /* Fail if we didn't make any progress: prevent infinite loop. */ if (args == old_args) - return; + { + work->options = hold_options; + return; + } } } string_appends (declp, &arg); @@ -2441,6 +2348,7 @@ demangle_arm_hp_template (work, mangled, n, declp) if (args >= e) --declp->p; /* remove extra comma */ string_append (declp, ">"); + work->options = hold_options; } else if (n>10 && strncmp (*mangled, "_GLOBAL_", 8) == 0 && (*mangled)[9] == 'N' @@ -2464,10 +2372,8 @@ demangle_arm_hp_template (work, mangled, n, declp) already been dealt with */ static int -demangle_class_name (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; +demangle_class_name (struct work_stuff *work, const char **mangled, + string *declp) { int n; int success = 0; @@ -2520,10 +2426,7 @@ DESCRIPTION */ static int -demangle_class (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; +demangle_class (struct work_stuff *work, const char **mangled, string *declp) { int success = 0; int btype; @@ -2575,11 +2478,8 @@ demangle_class (work, mangled, declp) demangle_signature. */ static int -iterate_demangle_function (work, mangled, declp, scan) - struct work_stuff *work; - const char **mangled; - string *declp; - const char *scan; +iterate_demangle_function (struct work_stuff *work, const char **mangled, + string *declp, const char *scan) { const char *mangle_init = *mangled; int success = 0; @@ -2678,10 +2578,8 @@ DESCRIPTION */ static int -demangle_prefix (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; +demangle_prefix (struct work_stuff *work, const char **mangled, + string *declp) { int success = 1; const char *scan; @@ -2889,10 +2787,7 @@ DESCRIPTION */ static int -gnu_special (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; +gnu_special (struct work_stuff *work, const char **mangled, string *declp) { int n; int success = 1; @@ -3049,8 +2944,7 @@ gnu_special (work, mangled, declp) if (method) { char buf[50]; - snprintf (buf, sizeof buf, - "virtual function thunk (delta:%d) for ", -delta); + snprintf (buf, sizeof buf, "virtual function thunk (delta:%d) for ", -delta); string_append (declp, buf); string_append (declp, method); free (method); @@ -3094,16 +2988,13 @@ gnu_special (work, mangled, declp) } static void -recursively_demangle(work, mangled, result, namelength) - struct work_stuff *work; - const char **mangled; - string *result; - int namelength; +recursively_demangle(struct work_stuff *work, const char **mangled, + string *result, int namelength) { char * recurse = (char *)NULL; char * recurse_dem = (char *)NULL; - recurse = (char *) xmalloc (namelength + 1); + recurse = XNEWVEC (char, namelength + 1); memcpy (recurse, *mangled, namelength); recurse[namelength] = '\000'; @@ -3146,9 +3037,7 @@ DESCRIPTION */ static int -arm_special (mangled, declp) - const char **mangled; - string *declp; +arm_special (const char **mangled, string *declp) { int n; int success = 1; @@ -3231,12 +3120,8 @@ BUGS */ static int -demangle_qualified (work, mangled, result, isfuncname, append) - struct work_stuff *work; - const char **mangled; - string *result; - int isfuncname; - int append; +demangle_qualified (struct work_stuff *work, const char **mangled, + string *result, int isfuncname, int append) { int qualifiers = 0; int success = 1; @@ -3458,9 +3343,7 @@ DESCRIPTION */ static int -get_count (type, count) - const char **type; - int *count; +get_count (const char **type, int *count) { const char *p; int n; @@ -3496,10 +3379,7 @@ get_count (type, count) value returned is really a type_kind_t. */ static int -do_type (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; +do_type (struct work_stuff *work, const char **mangled, string *result) { int n; int done; @@ -3808,10 +3688,8 @@ do_type (work, mangled, result) The value returned is really a type_kind_t. */ static int -demangle_fund_type (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; +demangle_fund_type (struct work_stuff *work, + const char **mangled, string *result) { int done = 0; int success = 1; @@ -4010,10 +3888,8 @@ demangle_fund_type (work, mangled, result) **mangled points to 'S' or 'U' */ static int -do_hpacc_template_const_value (work, mangled, result) - struct work_stuff *work ATTRIBUTE_UNUSED; - const char **mangled; - string *result; +do_hpacc_template_const_value (struct work_stuff *work ATTRIBUTE_UNUSED, + const char **mangled, string *result) { int unsigned_const; @@ -4067,10 +3943,8 @@ do_hpacc_template_const_value (work, mangled, result) **mangled is pointing to the 'A' */ static int -do_hpacc_template_literal (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; +do_hpacc_template_literal (struct work_stuff *work, const char **mangled, + string *result) { int literal_len = 0; char * recurse; @@ -4091,7 +3965,7 @@ do_hpacc_template_literal (work, mangled, result) string_append (result, "&"); /* Now recursively demangle the literal name */ - recurse = (char *) xmalloc (literal_len + 1); + recurse = XNEWVEC (char, literal_len + 1); memcpy (recurse, *mangled, literal_len); recurse[literal_len] = '\000'; @@ -4113,9 +3987,7 @@ do_hpacc_template_literal (work, mangled, result) } static int -snarf_numeric_literal (args, arg) - const char ** args; - string * arg; +snarf_numeric_literal (const char **args, string *arg) { if (**args == '-') { @@ -4144,10 +4016,7 @@ snarf_numeric_literal (args, arg) and free'd should anything go wrong. */ static int -do_arg (work, mangled, result) - struct work_stuff *work; - const char **mangled; - string *result; +do_arg (struct work_stuff *work, const char **mangled, string *result) { /* Remember where we started so that we can record the type, for non-squangling type remembering. */ @@ -4198,7 +4067,7 @@ do_arg (work, mangled, result) if (work->previous_argument) string_delete (work->previous_argument); else - work->previous_argument = (string*) xmalloc (sizeof (string)); + work->previous_argument = XNEW (string); if (!do_type (work, mangled, work->previous_argument)) return 0; @@ -4210,10 +4079,7 @@ do_arg (work, mangled, result) } static void -remember_type (work, start, len) - struct work_stuff *work; - const char *start; - int len; +remember_type (struct work_stuff *work, const char *start, int len) { char *tem; @@ -4225,18 +4091,16 @@ remember_type (work, start, len) if (work -> typevec_size == 0) { work -> typevec_size = 3; - work -> typevec - = (char **) xmalloc (sizeof (char *) * work -> typevec_size); + work -> typevec = XNEWVEC (char *, work->typevec_size); } else { work -> typevec_size *= 2; work -> typevec - = (char **) xrealloc ((char *)work -> typevec, - sizeof (char *) * work -> typevec_size); + = XRESIZEVEC (char *, work->typevec, work->typevec_size); } } - tem = xmalloc (len + 1); + tem = XNEWVEC (char, len + 1); memcpy (tem, start, len); tem[len] = '\0'; work -> typevec[work -> ntypes++] = tem; @@ -4245,10 +4109,7 @@ remember_type (work, start, len) /* Remember a K type class qualifier. */ static void -remember_Ktype (work, start, len) - struct work_stuff *work; - const char *start; - int len; +remember_Ktype (struct work_stuff *work, const char *start, int len) { char *tem; @@ -4257,18 +4118,16 @@ remember_Ktype (work, start, len) if (work -> ksize == 0) { work -> ksize = 5; - work -> ktypevec - = (char **) xmalloc (sizeof (char *) * work -> ksize); + work -> ktypevec = XNEWVEC (char *, work->ksize); } else { work -> ksize *= 2; work -> ktypevec - = (char **) xrealloc ((char *)work -> ktypevec, - sizeof (char *) * work -> ksize); + = XRESIZEVEC (char *, work->ktypevec, work->ksize); } } - tem = xmalloc (len + 1); + tem = XNEWVEC (char, len + 1); memcpy (tem, start, len); tem[len] = '\0'; work -> ktypevec[work -> numk++] = tem; @@ -4279,8 +4138,7 @@ remember_Ktype (work, start, len) registers map<temp<char> > as B0, and temp<char> as B1 */ static int -register_Btype (work) - struct work_stuff *work; +register_Btype (struct work_stuff *work) { int ret; @@ -4289,15 +4147,13 @@ register_Btype (work) if (work -> bsize == 0) { work -> bsize = 5; - work -> btypevec - = (char **) xmalloc (sizeof (char *) * work -> bsize); + work -> btypevec = XNEWVEC (char *, work->bsize); } else { work -> bsize *= 2; work -> btypevec - = (char **) xrealloc ((char *)work -> btypevec, - sizeof (char *) * work -> bsize); + = XRESIZEVEC (char *, work->btypevec, work->bsize); } } ret = work -> numb++; @@ -4308,14 +4164,12 @@ register_Btype (work) /* Store a value into a previously registered B code type. */ static void -remember_Btype (work, start, len, index) - struct work_stuff *work; - const char *start; - int len, index; +remember_Btype (struct work_stuff *work, const char *start, + int len, int index) { char *tem; - tem = xmalloc (len + 1); + tem = XNEWVEC (char, len + 1); memcpy (tem, start, len); tem[len] = '\0'; work -> btypevec[index] = tem; @@ -4323,8 +4177,7 @@ remember_Btype (work, start, len, index) /* Lose all the info related to B and K type codes. */ static void -forget_B_and_K_types (work) - struct work_stuff *work; +forget_B_and_K_types (struct work_stuff *work) { int i; @@ -4351,8 +4204,7 @@ forget_B_and_K_types (work) /* Forget the remembered types, but not the type vector itself. */ static void -forget_types (work) - struct work_stuff *work; +forget_types (struct work_stuff *work) { int i; @@ -4410,10 +4262,8 @@ forget_types (work) */ static int -demangle_args (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; +demangle_args (struct work_stuff *work, const char **mangled, + string *declp) { string arg; int need_comma = 0; @@ -4535,10 +4385,8 @@ demangle_args (work, mangled, declp) and method pointers or references, not top-level declarations. */ static int -demangle_nested_args (work, mangled, declp) - struct work_stuff *work; - const char **mangled; - string *declp; +demangle_nested_args (struct work_stuff *work, const char **mangled, + string *declp) { string* saved_previous_argument; int result; @@ -4574,11 +4422,8 @@ demangle_nested_args (work, mangled, declp) } static void -demangle_function_name (work, mangled, declp, scan) - struct work_stuff *work; - const char **mangled; - string *declp; - const char *scan; +demangle_function_name (struct work_stuff *work, const char **mangled, + string *declp, const char *scan) { size_t i; string type; @@ -4735,9 +4580,7 @@ demangle_function_name (work, mangled, declp, scan) /* a mini string-handling package */ static void -string_need (s, n) - string *s; - int n; +string_need (string *s, int n) { int tem; @@ -4747,7 +4590,7 @@ string_need (s, n) { n = 32; } - s->p = s->b = xmalloc (n); + s->p = s->b = XNEWVEC (char, n); s->e = s->b + n; } else if (s->e - s->p < n) @@ -4755,15 +4598,14 @@ string_need (s, n) tem = s->p - s->b; n += tem; n *= 2; - s->b = xrealloc (s->b, n); + s->b = XRESIZEVEC (char, s->b, n); s->p = s->b + tem; s->e = s->b + n; } } static void -string_delete (s) - string *s; +string_delete (string *s) { if (s->b != NULL) { @@ -4773,15 +4615,13 @@ string_delete (s) } static void -string_init (s) - string *s; +string_init (string *s) { s->b = s->p = s->e = NULL; } static void -string_clear (s) - string *s; +string_clear (string *s) { s->p = s->b; } @@ -4789,8 +4629,7 @@ string_clear (s) #if 0 static int -string_empty (s) - string *s; +string_empty (string *s) { return (s->b == s->p); } @@ -4798,9 +4637,7 @@ string_empty (s) #endif static void -string_append (p, s) - string *p; - const char *s; +string_append (string *p, const char *s) { int n; if (s == NULL || *s == '\0') @@ -4812,8 +4649,7 @@ string_append (p, s) } static void -string_appends (p, s) - string *p, *s; +string_appends (string *p, string *s) { int n; @@ -4827,10 +4663,7 @@ string_appends (p, s) } static void -string_appendn (p, s, n) - string *p; - const char *s; - int n; +string_appendn (string *p, const char *s, int n) { if (n != 0) { @@ -4841,9 +4674,7 @@ string_appendn (p, s, n) } static void -string_prepend (p, s) - string *p; - const char *s; +string_prepend (string *p, const char *s) { if (s != NULL && *s != '\0') { @@ -4852,8 +4683,7 @@ string_prepend (p, s) } static void -string_prepends (p, s) - string *p, *s; +string_prepends (string *p, string *s) { if (s->b != s->p) { @@ -4862,10 +4692,7 @@ string_prepends (p, s) } static void -string_prependn (p, s, n) - string *p; - const char *s; - int n; +string_prependn (string *p, const char *s, int n) { char *q; @@ -4882,9 +4709,7 @@ string_prependn (p, s, n) } static void -string_append_template_idx (s, idx) - string *s; - int idx; +string_append_template_idx (string *s, int idx) { char buf[INTBUF_SIZE + 1 /* 'T' */]; snprintf(buf, sizeof buf, "T%d", idx); diff --git a/gnu/lib/libiberty/src/dyn-string.c b/gnu/lib/libiberty/src/dyn-string.c index be182e2c630..bf6a9c6a464 100644 --- a/gnu/lib/libiberty/src/dyn-string.c +++ b/gnu/lib/libiberty/src/dyn-string.c @@ -1,5 +1,5 @@ /* An abstract string datatype. - Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GNU CC. @@ -25,8 +25,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -65,9 +65,7 @@ Boston, MA 02111-1307, USA. */ fails, returns 0. Otherwise returns 1. */ int -dyn_string_init (ds_struct_ptr, space) - struct dyn_string *ds_struct_ptr; - int space; +dyn_string_init (struct dyn_string *ds_struct_ptr, int space) { /* We need at least one byte in which to store the terminating NUL. */ if (space == 0) @@ -78,7 +76,7 @@ dyn_string_init (ds_struct_ptr, space) if (ds_struct_ptr->s == NULL) return 0; #else - ds_struct_ptr->s = (char *) xmalloc (space); + ds_struct_ptr->s = XNEWVEC (char, space); #endif ds_struct_ptr->allocated = space; ds_struct_ptr->length = 0; @@ -94,8 +92,7 @@ dyn_string_init (ds_struct_ptr, space) returns the newly allocated string. */ dyn_string_t -dyn_string_new (space) - int space; +dyn_string_new (int space) { dyn_string_t result; #ifdef RETURN_ON_ALLOCATION_FAILURE @@ -108,7 +105,7 @@ dyn_string_new (space) return NULL; } #else - result = (dyn_string_t) xmalloc (sizeof (struct dyn_string)); + result = XNEW (struct dyn_string); dyn_string_init (result, space); #endif return result; @@ -117,8 +114,7 @@ dyn_string_new (space) /* Free the memory used by DS. */ void -dyn_string_delete (ds) - dyn_string_t ds; +dyn_string_delete (dyn_string_t ds) { free (ds->s); free (ds); @@ -129,8 +125,7 @@ dyn_string_delete (ds) DS is then set to the empty string. Deletes DS itself. */ char* -dyn_string_release (ds) - dyn_string_t ds; +dyn_string_release (dyn_string_t ds) { /* Store the old buffer. */ char* result = ds->s; @@ -150,9 +145,7 @@ dyn_string_release (ds) operation fails, deletes DS and returns NULL. */ dyn_string_t -dyn_string_resize (ds, space) - dyn_string_t ds; - int space; +dyn_string_resize (dyn_string_t ds, int space) { int new_allocated = ds->allocated; @@ -175,7 +168,7 @@ dyn_string_resize (ds, space) return NULL; } #else - ds->s = (char *) xrealloc (ds->s, ds->allocated); + ds->s = XRESIZEVEC (char, ds->s, ds->allocated); #endif } @@ -185,8 +178,7 @@ dyn_string_resize (ds, space) /* Sets the contents of DS to the empty string. */ void -dyn_string_clear (ds) - dyn_string_t ds; +dyn_string_clear (dyn_string_t ds) { /* A dyn_string always has room for at least the NUL terminator. */ ds->s[0] = '\0'; @@ -198,9 +190,7 @@ dyn_string_clear (ds) RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */ int -dyn_string_copy (dest, src) - dyn_string_t dest; - dyn_string_t src; +dyn_string_copy (dyn_string_t dest, dyn_string_t src) { if (dest == src) abort (); @@ -220,9 +210,7 @@ dyn_string_copy (dest, src) and returns 0. */ int -dyn_string_copy_cstr (dest, src) - dyn_string_t dest; - const char *src; +dyn_string_copy_cstr (dyn_string_t dest, const char *src) { int length = strlen (src); /* Make room in DEST. */ @@ -241,9 +229,7 @@ dyn_string_copy_cstr (dest, src) returns 0. */ int -dyn_string_prepend (dest, src) - dyn_string_t dest; - dyn_string_t src; +dyn_string_prepend (dyn_string_t dest, dyn_string_t src) { return dyn_string_insert (dest, 0, src); } @@ -253,9 +239,7 @@ dyn_string_prepend (dest, src) if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */ int -dyn_string_prepend_cstr (dest, src) - dyn_string_t dest; - const char *src; +dyn_string_prepend_cstr (dyn_string_t dest, const char *src) { return dyn_string_insert_cstr (dest, 0, src); } @@ -266,10 +250,7 @@ dyn_string_prepend_cstr (dest, src) and returns 0. */ int -dyn_string_insert (dest, pos, src) - dyn_string_t dest; - int pos; - dyn_string_t src; +dyn_string_insert (dyn_string_t dest, int pos, dyn_string_t src) { int i; @@ -294,10 +275,7 @@ dyn_string_insert (dest, pos, src) and returns 0. */ int -dyn_string_insert_cstr (dest, pos, src) - dyn_string_t dest; - int pos; - const char *src; +dyn_string_insert_cstr (dyn_string_t dest, int pos, const char *src) { int i; int length = strlen (src); @@ -319,10 +297,7 @@ dyn_string_insert_cstr (dest, pos, src) RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */ int -dyn_string_insert_char (dest, pos, c) - dyn_string_t dest; - int pos; - int c; +dyn_string_insert_char (dyn_string_t dest, int pos, int c) { int i; @@ -343,9 +318,7 @@ dyn_string_insert_char (dest, pos, c) returns 0. */ int -dyn_string_append (dest, s) - dyn_string_t dest; - dyn_string_t s; +dyn_string_append (dyn_string_t dest, dyn_string_t s) { if (dyn_string_resize (dest, dest->length + s->length) == 0) return 0; @@ -359,9 +332,7 @@ dyn_string_append (dest, s) deletes DEST and returns 0. */ int -dyn_string_append_cstr (dest, s) - dyn_string_t dest; - const char *s; +dyn_string_append_cstr (dyn_string_t dest, const char *s) { int len = strlen (s); @@ -378,9 +349,7 @@ dyn_string_append_cstr (dest, s) if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */ int -dyn_string_append_char (dest, c) - dyn_string_t dest; - int c; +dyn_string_append_char (dyn_string_t dest, int c) { /* Make room for the extra character. */ if (dyn_string_resize (dest, dest->length + 1) == NULL) @@ -401,11 +370,8 @@ dyn_string_append_char (dest, c) deletes DEST and returns 0. */ int -dyn_string_substring (dest, src, start, end) - dyn_string_t dest; - dyn_string_t src; - int start; - int end; +dyn_string_substring (dyn_string_t dest, dyn_string_t src, + int start, int end) { int i; int length = end - start; @@ -430,9 +396,7 @@ dyn_string_substring (dest, src, start, end) /* Returns non-zero if DS1 and DS2 have the same contents. */ int -dyn_string_eq (ds1, ds2) - dyn_string_t ds1; - dyn_string_t ds2; +dyn_string_eq (dyn_string_t ds1, dyn_string_t ds2) { /* If DS1 and DS2 have different lengths, they must not be the same. */ if (ds1->length != ds2->length) diff --git a/gnu/lib/libiberty/src/floatformat.c b/gnu/lib/libiberty/src/floatformat.c index a0f65354e48..bd31efac7c1 100644 --- a/gnu/lib/libiberty/src/floatformat.c +++ b/gnu/lib/libiberty/src/floatformat.c @@ -1,5 +1,6 @@ /* IEEE floating point support routines, for GDB, the GNU Debugger. - Copyright (C) 1991, 1994, 1999, 2000, 2003 Free Software Foundation, Inc. + Copyright 1991, 1994, 1999, 2000, 2003, 2005, 2006 + Free Software Foundation, Inc. This file is part of GDB. @@ -15,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This is needed to pick up the NAN macro on some systems. */ #define _GNU_SOURCE @@ -30,6 +31,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <string.h> #endif +/* On some platforms, <float.h> provides DBL_QNAN. */ +#ifdef STDC_HEADERS +#include <float.h> +#endif + #include "ansidecl.h" #include "libiberty.h" #include "floatformat.h" @@ -43,21 +49,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #endif #ifndef NAN +#ifdef DBL_QNAN +#define NAN DBL_QNAN +#else #define NAN (0.0 / 0.0) #endif +#endif -static unsigned long get_field PARAMS ((const unsigned char *, - enum floatformat_byteorders, - unsigned int, - unsigned int, - unsigned int)); -static int floatformat_always_valid PARAMS ((const struct floatformat *fmt, - const char *from)); +static unsigned long get_field (const unsigned char *, + enum floatformat_byteorders, + unsigned int, + unsigned int, + unsigned int); +static int floatformat_always_valid (const struct floatformat *fmt, + const void *from); static int -floatformat_always_valid (fmt, from) - const struct floatformat *fmt ATTRIBUTE_UNUSED; - const char *from ATTRIBUTE_UNUSED; +floatformat_always_valid (const struct floatformat *fmt ATTRIBUTE_UNUSED, + const void *from ATTRIBUTE_UNUSED) { return 1; } @@ -108,12 +117,35 @@ const struct floatformat floatformat_ieee_double_littlebyte_bigword = floatformat_always_valid }; -static int floatformat_i387_ext_is_valid PARAMS ((const struct floatformat *fmt, const char *from)); +/* floatformat for VAX. Not quite IEEE, but close enough. */ + +const struct floatformat floatformat_vax_f = +{ + floatformat_vax, 32, 0, 1, 8, 129, 0, 9, 23, + floatformat_intbit_no, + "floatformat_vax_f", + floatformat_always_valid +}; +const struct floatformat floatformat_vax_d = +{ + floatformat_vax, 64, 0, 1, 8, 129, 0, 9, 55, + floatformat_intbit_no, + "floatformat_vax_d", + floatformat_always_valid +}; +const struct floatformat floatformat_vax_g = +{ + floatformat_vax, 64, 0, 1, 11, 1025, 0, 12, 52, + floatformat_intbit_no, + "floatformat_vax_g", + floatformat_always_valid +}; + +static int floatformat_i387_ext_is_valid (const struct floatformat *fmt, + const void *from); static int -floatformat_i387_ext_is_valid (fmt, from) - const struct floatformat *fmt; - const char *from; +floatformat_i387_ext_is_valid (const struct floatformat *fmt, const void *from) { /* In the i387 double-extended format, if the exponent is all ones, then the integer bit must be set. If the exponent is neither 0 @@ -121,12 +153,12 @@ floatformat_i387_ext_is_valid (fmt, from) zero can it be zero, and then it must be zero. */ unsigned long exponent, int_bit; const unsigned char *ufrom = (const unsigned char *) from; - + exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len); int_bit = get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->man_start, 1); - + if ((exponent == 0) != (int_bit == 0)) return 0; else @@ -220,12 +252,8 @@ const struct floatformat floatformat_ia64_quad_little = /* Extract a field which starts at START and is LEN bits long. DATA and TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ static unsigned long -get_field (data, order, total_len, start, len) - const unsigned char *data; - enum floatformat_byteorders order; - unsigned int total_len; - unsigned int start; - unsigned int len; +get_field (const unsigned char *data, enum floatformat_byteorders order, + unsigned int total_len, unsigned int start, unsigned int len) { unsigned long result; unsigned int cur_byte; @@ -273,12 +301,10 @@ get_field (data, order, total_len, start, len) Store the double in *TO. */ void -floatformat_to_double (fmt, from, to) - const struct floatformat *fmt; - const char *from; - double *to; +floatformat_to_double (const struct floatformat *fmt, + const void *from, double *to) { - const unsigned char *ufrom = (const unsigned char *)from; + const unsigned char *ufrom = (const unsigned char *) from; double dto; long exponent; unsigned long mant; @@ -315,6 +341,13 @@ floatformat_to_double (fmt, from, to) mant_bits_left -= mant_bits; } + /* On certain systems (such as GNU/Linux), the use of the + INFINITY macro below may generate a warning that can not be + silenced due to a bug in GCC (PR preprocessor/11931). The + preprocessor fails to recognise the __extension__ keyword in + conjunction with the GNU/C99 extension for hexadecimal + floating point constants and will issue a warning when + compiling with -pedantic. */ if (nan) dto = NAN; else @@ -381,22 +414,18 @@ floatformat_to_double (fmt, from, to) *to = dto; } -static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders, - unsigned int, - unsigned int, - unsigned int, - unsigned long)); +static void put_field (unsigned char *, enum floatformat_byteorders, + unsigned int, + unsigned int, + unsigned int, + unsigned long); /* Set a field which starts at START and is LEN bits long. DATA and TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ static void -put_field (data, order, total_len, start, len, stuff_to_put) - unsigned char *data; - enum floatformat_byteorders order; - unsigned int total_len; - unsigned int start; - unsigned int len; - unsigned long stuff_to_put; +put_field (unsigned char *data, enum floatformat_byteorders order, + unsigned int total_len, unsigned int start, unsigned int len, + unsigned long stuff_to_put) { unsigned int cur_byte; int cur_bitshift; @@ -443,17 +472,15 @@ put_field (data, order, total_len, start, len, stuff_to_put) restrictions. */ void -floatformat_from_double (fmt, from, to) - const struct floatformat *fmt; - const double *from; - char *to; +floatformat_from_double (const struct floatformat *fmt, + const double *from, void *to) { double dfrom; int exponent; double mant; unsigned int mant_bits, mant_off; int mant_bits_left; - unsigned char *uto = (unsigned char *)to; + unsigned char *uto = (unsigned char *) to; dfrom = *from; memset (uto, 0, fmt->totalsize / FLOATFORMAT_CHAR_BIT); @@ -541,9 +568,7 @@ floatformat_from_double (fmt, from, to) /* Return non-zero iff the data at FROM is a valid number in format FMT. */ int -floatformat_is_valid (fmt, from) - const struct floatformat *fmt; - const char *from; +floatformat_is_valid (const struct floatformat *fmt, const void *from) { return fmt->is_valid (fmt, from); } @@ -556,20 +581,17 @@ floatformat_is_valid (fmt, from) /* This is to be run on a host which uses IEEE floating point. */ void -ieee_test (n) - double n; +ieee_test (double n) { double result; - floatformat_to_double (&floatformat_ieee_double_little, (char *) &n, - &result); + floatformat_to_double (&floatformat_ieee_double_little, &n, &result); if ((n != result && (! isnan (n) || ! isnan (result))) || (n < 0 && result >= 0) || (n >= 0 && result < 0)) printf ("Differ(to): %.20g -> %.20g\n", n, result); - floatformat_from_double (&floatformat_ieee_double_little, &n, - (char *) &result); + floatformat_from_double (&floatformat_ieee_double_little, &n, &result); if ((n != result && (! isnan (n) || ! isnan (result))) || (n < 0 && result >= 0) || (n >= 0 && result < 0)) @@ -597,7 +619,7 @@ ieee_test (n) } int -main () +main (void) { ieee_test (0.0); ieee_test (0.5); diff --git a/gnu/lib/libiberty/src/fnmatch.c b/gnu/lib/libiberty/src/fnmatch.c index eb898ee14d8..fc897be2c6f 100644 --- a/gnu/lib/libiberty/src/fnmatch.c +++ b/gnu/lib/libiberty/src/fnmatch.c @@ -15,8 +15,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +Foundation, 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #if defined (CONFIG_BROKETS) @@ -65,10 +65,7 @@ extern int errno; /* Match STRING against the filename pattern PATTERN, returning zero if it matches, nonzero if not. */ int -fnmatch (pattern, string, flags) - const char *pattern; - const char *string; - int flags; +fnmatch (const char *pattern, const char *string, int flags) { register const char *p = pattern, *n = string; register unsigned char c; @@ -127,7 +124,7 @@ fnmatch (pattern, string, flags) case '[': { /* Nonzero if the sense of the character class is inverted. */ - register int not; + register int negate; if (*n == '\0') return FNM_NOMATCH; @@ -136,8 +133,8 @@ fnmatch (pattern, string, flags) (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; - not = (*p == '!' || *p == '^'); - if (not) + negate = (*p == '!' || *p == '^'); + if (negate) ++p; c = *p++; @@ -180,7 +177,7 @@ fnmatch (pattern, string, flags) if (c == ']') break; } - if (!not) + if (!negate) return FNM_NOMATCH; break; @@ -197,7 +194,7 @@ fnmatch (pattern, string, flags) /* XXX 1003.2d11 is unclear if this is right. */ ++p; } - if (not) + if (negate) return FNM_NOMATCH; } break; diff --git a/gnu/lib/libiberty/src/functions.texi b/gnu/lib/libiberty/src/functions.texi index 4261d864676..fa92d702d79 100644 --- a/gnu/lib/libiberty/src/functions.texi +++ b/gnu/lib/libiberty/src/functions.texi @@ -3,6 +3,28 @@ @c Edit the *.c files, configure with --enable-maintainer-mode, @c and let gather-docs build you a new copy. +@c safe-ctype.c:25 +@defvr Extension HOST_CHARSET +This macro indicates the basic character set and encoding used by the +host: more precisely, the encoding used for character constants in +preprocessor @samp{#if} statements (the C "execution character set"). +It is defined by @file{safe-ctype.h}, and will be an integer constant +with one of the following values: + +@ftable @code +@item HOST_CHARSET_UNKNOWN +The host character set is unknown - that is, not one of the next two +possibilities. + +@item HOST_CHARSET_ASCII +The host character set is ASCII. + +@item HOST_CHARSET_EBCDIC +The host character set is some variant of EBCDIC. (Only one of the +nineteen EBCDIC varying characters is tested; exercise caution.) +@end ftable +@end defvr + @c alloca.c:26 @deftypefn Replacement void* alloca (size_t @var{size}) @@ -21,7 +43,7 @@ the possibility of a GCC built-in function. @end deftypefn -@c asprintf.c:33 +@c asprintf.c:32 @deftypefn Extension int asprintf (char **@var{resptr}, const char *@var{format}, ...) Like @code{sprintf}, but instead of passing a pointer to a buffer, you @@ -29,7 +51,7 @@ pass a pointer to a pointer. This function will compute the size of the buffer needed, allocate memory with @code{malloc}, and store a pointer to the allocated memory in @code{*@var{resptr}}. The value returned is the same as @code{sprintf} would return. If memory could -not be allocated, zero is returned and @code{NULL} is stored in +not be allocated, minus one is returned and @code{NULL} is stored in @code{*@var{resptr}}. @end deftypefn @@ -82,7 +104,7 @@ is respectively less than, matching, or greater than the array member. @end deftypefn -@c argv.c:139 +@c argv.c:124 @deftypefn Extension char** buildargv (char *@var{sp}) Given a pointer to a string, parse the string extracting fields @@ -136,7 +158,7 @@ not recommended. @end deftypefn -@c make-temp-file.c:88 +@c make-temp-file.c:87 @deftypefn Replacement char* choose_tmpdir () Returns a pointer to a directory path suitable for creating temporary @@ -163,7 +185,7 @@ pointer encountered. Pointers to empty strings are ignored. @end deftypefn -@c argv.c:65 +@c argv.c:52 @deftypefn Extension char** dupargv (char **@var{vector}) Duplicate an argument vector. Simply scans through @var{vector}, @@ -174,7 +196,7 @@ argument vector. @end deftypefn -@c strerror.c:566 +@c strerror.c:567 @deftypefn Extension int errno_max (void) Returns the maximum @code{errno} value for which a corresponding @@ -192,6 +214,26 @@ symbolic name or message. @end deftypefn +@c argv.c:293 +@deftypefn Extension void expandargv (int *@var{argcp}, char ***@var{argvp}) + +The @var{argcp} and @code{argvp} arguments are pointers to the usual +@code{argc} and @code{argv} arguments to @code{main}. This function +looks for arguments that begin with the character @samp{@@}. Any such +arguments are interpreted as ``response files''. The contents of the +response file are interpreted as additional command line options. In +particular, the file is separated into whitespace-separated strings; +each such string is taken as a command-line option. The new options +are inserted in place of the option naming the response file, and +@code{*argcp} and @code{*argvp} will be updated. If the value of +@code{*argvp} is modified by this function, then the new value has +been dynamically allocated and can be deallocated by the caller with +@code{freeargv}. However, most callers will simply call +@code{expandargv} near the beginning of @code{main} and allow the +operating system to free the memory when the program exits. + +@end deftypefn + @c fdmatch.c:23 @deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2}) @@ -207,6 +249,16 @@ and inode numbers. @end deftypefn +@c fopen_unlocked.c:48 +@deftypefn Extension {FILE *} fdopen_unlocked (int @var{fildes}, const char * @var{mode}) + +Opens and returns a @code{FILE} pointer via @code{fdopen}. If the +operating system supports it, ensure that the stream is setup to avoid +any multi-threaded locking. Otherwise return the @code{FILE} pointer +unchanged. + +@end deftypefn + @c ffs.c:3 @deftypefn Supplemental int ffs (int @var{valu}) @@ -266,7 +318,17 @@ Ignores case when performing the comparison. @end deftypefn -@c argv.c:111 +@c fopen_unlocked.c:39 +@deftypefn Extension {FILE *} fopen_unlocked (const char *@var{path}, const char * @var{mode}) + +Opens and returns a @code{FILE} pointer via @code{fopen}. If the +operating system supports it, ensure that the stream is setup to avoid +any multi-threaded locking. Otherwise return the @code{FILE} pointer +unchanged. + +@end deftypefn + +@c argv.c:97 @deftypefn Extension void freeargv (char **@var{vector}) Free an argument vector that was built using @code{buildargv}. Simply @@ -276,6 +338,16 @@ itself. @end deftypefn +@c fopen_unlocked.c:57 +@deftypefn Extension {FILE *} freopen_unlocked (const char * @var{path}, const char * @var{mode}, FILE * @var{stream}) + +Opens and returns a @code{FILE} pointer via @code{freopen}. If the +operating system supports it, ensure that the stream is setup to avoid +any multi-threaded locking. Otherwise return the @code{FILE} pointer +unchanged. + +@end deftypefn + @c getruntime.c:82 @deftypefn Replacement long get_run_time (void) @@ -317,7 +389,15 @@ between calls to @code{getpwd}. @end deftypefn -@c hex.c:25 +@c gettimeofday.c:12 +@deftypefn Supplemental int gettimeofday (struct timeval *@var{tp}, void *@var{tz}) + +Writes the current time to @var{tp}. This implementation requires +that @var{tz} be NULL. Returns 0 on success, -1 on failure. + +@end deftypefn + +@c hex.c:33 @deftypefn Extension void hex_init (void) Initializes the array mapping the current character set to @@ -327,7 +407,7 @@ default ASCII-based table will normally be used on ASCII systems. @end deftypefn -@c hex.c:34 +@c hex.c:42 @deftypefn Extension int hex_p (int @var{c}) Evaluates to non-zero if the given character is a valid hex character, @@ -336,14 +416,20 @@ or zero if it is not. Note that the value you pass will be cast to @end deftypefn -@c hex.c:42 -@deftypefn Extension int hex_value (int @var{c}) +@c hex.c:50 +@deftypefn Extension {unsigned int} hex_value (int @var{c}) Returns the numeric equivalent of the given character when interpreted as a hexidecimal digit. The result is undefined if you pass an invalid hex digit. Note that the value you pass will be cast to @code{unsigned char} within the macro. +The @code{hex_value} macro returns @code{unsigned int}, rather than +signed @code{int}, to make it easier to use in parsing addresses from +hex dump files: a signed @code{int} would be sign-extended when +converted to a wider unsigned type --- like @code{bfd_vma}, on some +systems. + @end deftypefn @c index.c:5 @@ -376,6 +462,78 @@ struct qelem @{ @end deftypefn +@c safe-ctype.c:46 +@deffn Extension ISALPHA (@var{c}) +@deffnx Extension ISALNUM (@var{c}) +@deffnx Extension ISBLANK (@var{c}) +@deffnx Extension ISCNTRL (@var{c}) +@deffnx Extension ISDIGIT (@var{c}) +@deffnx Extension ISGRAPH (@var{c}) +@deffnx Extension ISLOWER (@var{c}) +@deffnx Extension ISPRINT (@var{c}) +@deffnx Extension ISPUNCT (@var{c}) +@deffnx Extension ISSPACE (@var{c}) +@deffnx Extension ISUPPER (@var{c}) +@deffnx Extension ISXDIGIT (@var{c}) + +These twelve macros are defined by @file{safe-ctype.h}. Each has the +same meaning as the corresponding macro (with name in lowercase) +defined by the standard header @file{ctype.h}. For example, +@code{ISALPHA} returns true for alphabetic characters and false for +others. However, there are two differences between these macros and +those provided by @file{ctype.h}: + +@itemize @bullet +@item These macros are guaranteed to have well-defined behavior for all +values representable by @code{signed char} and @code{unsigned char}, and +for @code{EOF}. + +@item These macros ignore the current locale; they are true for these +fixed sets of characters: +@multitable {@code{XDIGIT}} {yada yada yada yada yada yada yada yada} +@item @code{ALPHA} @tab @kbd{A-Za-z} +@item @code{ALNUM} @tab @kbd{A-Za-z0-9} +@item @code{BLANK} @tab @kbd{space tab} +@item @code{CNTRL} @tab @code{!PRINT} +@item @code{DIGIT} @tab @kbd{0-9} +@item @code{GRAPH} @tab @code{ALNUM || PUNCT} +@item @code{LOWER} @tab @kbd{a-z} +@item @code{PRINT} @tab @code{GRAPH ||} @kbd{space} +@item @code{PUNCT} @tab @kbd{`~!@@#$%^&*()_-=+[@{]@}\|;:'",<.>/?} +@item @code{SPACE} @tab @kbd{space tab \n \r \f \v} +@item @code{UPPER} @tab @kbd{A-Z} +@item @code{XDIGIT} @tab @kbd{0-9A-Fa-f} +@end multitable + +Note that, if the host character set is ASCII or a superset thereof, +all these macros will return false for all values of @code{char} outside +the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return +false for characters with numeric values from 128 to 255. +@end itemize +@end deffn + +@c safe-ctype.c:95 +@deffn Extension ISIDNUM (@var{c}) +@deffnx Extension ISIDST (@var{c}) +@deffnx Extension IS_VSPACE (@var{c}) +@deffnx Extension IS_NVSPACE (@var{c}) +@deffnx Extension IS_SPACE_OR_NUL (@var{c}) +@deffnx Extension IS_ISOBASIC (@var{c}) +These six macros are defined by @file{safe-ctype.h} and provide +additional character classes which are useful when doing lexical +analysis of C or similar languages. They are true for the following +sets of characters: + +@multitable {@code{SPACE_OR_NUL}} {yada yada yada yada yada yada yada yada} +@item @code{IDNUM} @tab @kbd{A-Za-z0-9_} +@item @code{IDST} @tab @kbd{A-Za-z_} +@item @code{VSPACE} @tab @kbd{\r \n} +@item @code{NVSPACE} @tab @kbd{space tab \f \v \0} +@item @code{SPACE_OR_NUL} @tab @code{VSPACE || NVSPACE} +@item @code{ISOBASIC} @tab @code{VSPACE || NVSPACE || PRINT} +@end multitable +@end deffn + @c lbasename.c:23 @deftypefn Replacement {const char*} lbasename (const char *@var{name}) @@ -427,7 +585,7 @@ relative prefix can be found, return @code{NULL}. @end deftypefn -@c make-temp-file.c:138 +@c make-temp-file.c:137 @deftypefn Replacement char* make_temp_file (const char *@var{suffix}) Return a temporary file name (as a string) or @code{NULL} if unable to @@ -493,63 +651,289 @@ Sets the first @var{count} bytes of @var{s} to the constant byte @end deftypefn @c mkstemps.c:54 -@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len}) +@deftypefn Replacement int mkstemps (char *@var{pattern}, int @var{suffix_len}) -Generate a unique temporary file name from @var{template}. -@var{template} has the form: +Generate a unique temporary file name from @var{pattern}. +@var{pattern} has the form: @example @var{path}/ccXXXXXX@var{suffix} @end example @var{suffix_len} tells us how long @var{suffix} is (it can be zero -length). The last six characters of @var{template} before @var{suffix} +length). The last six characters of @var{pattern} before @var{suffix} must be @samp{XXXXXX}; they are replaced with a string that makes the filename unique. Returns a file descriptor open on the file for reading and writing. @end deftypefn -@c pexecute.txh:1 -@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags) +@c pexecute.txh:231 +@deftypefn Extension void pex_free (struct pex_obj @var{obj}) + +Clean up and free all data associated with @var{obj}. + +@end deftypefn + +@c pexecute.txh:206 +@deftypefn Extension int pex_get_status (struct pex_obj *@var{obj}, int @var{count}, int *@var{vector}) + +Returns the exit status of all programs run using @var{obj}. +@var{count} is the number of results expected. The results will be +placed into @var{vector}. The results are in the order of the calls +to @code{pex_run}. Returns 0 on error, 1 on success. + +@end deftypefn + +@c pexecute.txh:215 +@deftypefn Extension int pex_get_times (struct pex_obj *@var{obj}, int @var{count}, struct pex_time *@var{vector}) + +Returns the process execution times of all programs run using +@var{obj}. @var{count} is the number of results expected. The +results will be placed into @var{vector}. The results are in the +order of the calls to @code{pex_run}. Returns 0 on error, 1 on +success. + +@code{struct pex_time} has the following fields of the type +@code{unsigned long}: @code{user_seconds}, +@code{user_microseconds}, @code{system_seconds}, +@code{system_microseconds}. On systems which do not support reporting +process times, all the fields will be set to @code{0}. + +@end deftypefn + +@c pexecute.txh:2 +@deftypefn Extension {struct pex_obj *} pex_init (int @var{flags}, const char *@var{pname}, const char *@var{tempbase}) + +Prepare to execute one or more programs, with standard output of each +program fed to standard input of the next. This is a system +independent interface to execute a pipeline. + +@var{flags} is a bitwise combination of the following: + +@table @code + +@vindex PEX_RECORD_TIMES +@item PEX_RECORD_TIMES +Record subprocess times if possible. + +@vindex PEX_USE_PIPES +@item PEX_USE_PIPES +Use pipes for communication between processes, if possible. + +@vindex PEX_SAVE_TEMPS +@item PEX_SAVE_TEMPS +Don't delete temporary files used for communication between +processes. + +@end table + +@var{pname} is the name of program to be executed, used in error +messages. @var{tempbase} is a base name to use for any required +temporary files; it may be @code{NULL} to use a randomly chosen name. + +@end deftypefn + +@c pexecute.txh:133 +@deftypefn Extension {FILE *} pex_input_file (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{in_name}) + +Return a stream for a temporary file to pass to the first program in +the pipeline as input. + +The name of the input file is chosen according to the same rules +@code{pex_run} uses to choose output file names, based on +@var{in_name}, @var{obj} and the @code{PEX_SUFFIX} bit in @var{flags}. + +Don't call @code{fclose} on the returned stream; the first call to +@code{pex_run} closes it automatically. + +If @var{flags} includes @code{PEX_BINARY_OUTPUT}, open the stream in +binary mode; otherwise, open it in the default mode. Including +@code{PEX_BINARY_OUTPUT} in @var{flags} has no effect on Unix. +@end deftypefn + +@c pexecute.txh:150 +@deftypefn Extension {FILE *} pex_input_pipe (struct pex_obj *@var{obj}, int @var{binary}) -Executes a program. +Return a stream @var{fp} for a pipe connected to the standard input of +the first program in the pipeline; @var{fp} is opened for writing. +You must have passed @code{PEX_USE_PIPES} to the @code{pex_init} call +that returned @var{obj}. -@var{program} and @var{argv} are the arguments to -@code{execv}/@code{execvp}. +You must close @var{fp} using @code{fclose} yourself when you have +finished writing data to the pipeline. -@var{this_pname} is name of the calling program (i.e., @code{argv[0]}). +The file descriptor underlying @var{fp} is marked not to be inherited +by child processes. -@var{temp_base} is the path name, sans suffix, of a temporary file to -use if needed. This is currently only needed for MS-DOS ports that -don't use @code{go32} (do any still exist?). Ports that don't need it -can pass @code{NULL}. +On systems that do not support pipes, this function returns +@code{NULL}, and sets @code{errno} to @code{EINVAL}. If you would +like to write code that is portable to all systems the @code{pex} +functions support, consider using @code{pex_input_file} instead. -(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} -should be searched (??? It's not clear that GCC passes this flag -correctly). (@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the -first process in chain. (@code{@var{flags} & PEXECUTE_FIRST}) is -nonzero for the last process in chain. The first/last flags could be -simplified to only mark the last of a chain of processes but that -requires the caller to always mark the last one (and not give up -early if some error occurs). It's more robust to require the caller -to mark both ends of the chain. +There are two opportunities for deadlock using +@code{pex_input_pipe}: -The result is the pid on systems like Unix where we -@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we -use @code{spawn}. It is up to the caller to wait for the child. +@itemize @bullet +@item +Most systems' pipes can buffer only a fixed amount of data; a process +that writes to a full pipe blocks. Thus, if you write to @file{fp} +before starting the first process, you run the risk of blocking when +there is no child process yet to read the data and allow you to +continue. @code{pex_input_pipe} makes no promises about the +size of the pipe's buffer, so if you need to write any data at all +before starting the first process in the pipeline, consider using +@code{pex_input_file} instead. -The result is the @code{WEXITSTATUS} on systems like MS-DOS where we -@code{spawn} and wait for the child here. +@item +Using @code{pex_input_pipe} and @code{pex_read_output} together +may also cause deadlock. If the output pipe fills up, so that each +program in the pipeline is waiting for the next to read more data, and +you fill the input pipe by writing more data to @var{fp}, then there +is no way to make progress: the only process that could read data from +the output pipe is you, but you are blocked on the input pipe. -Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the -text of the error message with an optional argument (if not needed, -@var{errmsg_arg} is set to @code{NULL}), and @minus{}1 is returned. -@code{errno} is available to the caller to use. +@end itemize @end deftypefn -@c strsignal.c:547 +@c pexecute.txh:237 +@deftypefn Extension {const char *} pex_one (int @var{flags}, const char *@var{executable}, char * const *@var{argv}, const char *@var{pname}, const char *@var{outname}, const char *@var{errname}, int *@var{status}, int *@var{err}) + +An interface to permit the easy execution of a +single program. The return value and most of the parameters are as +for a call to @code{pex_run}. @var{flags} is restricted to a +combination of @code{PEX_SEARCH}, @code{PEX_STDERR_TO_STDOUT}, and +@code{PEX_BINARY_OUTPUT}. @var{outname} is interpreted as if +@code{PEX_LAST} were set. On a successful return, @code{*@var{status}} will +be set to the exit status of the program. + +@end deftypefn + +@c pexecute.txh:194 +@deftypefn Extension {FILE *} pex_read_output (struct pex_obj *@var{obj}, int @var{binary}) + +Returns a @code{FILE} pointer which may be used to read the standard +output of the last program in the pipeline. When this is used, +@code{PEX_LAST} should not be used in a call to @code{pex_run}. After +this is called, @code{pex_run} may no longer be called with the same +@var{obj}. @var{binary} should be non-zero if the file should be +opened in binary mode. Don't call @code{fclose} on the returned file; +it will be closed by @code{pex_free}. + +@end deftypefn + +@c pexecute.txh:33 +@deftypefn Extension {const char *} pex_run (struct pex_obj *@var{obj}, int @var{flags}, const char *@var{executable}, char * const *@var{argv}, const char *@var{outname}, const char *@var{errname}, int *@var{err}) + +Execute one program in a pipeline. On success this returns +@code{NULL}. On failure it returns an error message, a statically +allocated string. + +@var{obj} is returned by a previous call to @code{pex_init}. + +@var{flags} is a bitwise combination of the following: + +@table @code + +@vindex PEX_LAST +@item PEX_LAST +This must be set on the last program in the pipeline. In particular, +it should be set when executing a single program. The standard output +of the program will be sent to @var{outname}, or, if @var{outname} is +@code{NULL}, to the standard output of the calling program. Do @emph{not} +set this bit if you want to call @code{pex_read_output} +(described below). After a call to @code{pex_run} with this bit set, +@var{pex_run} may no longer be called with the same @var{obj}. + +@vindex PEX_SEARCH +@item PEX_SEARCH +Search for the program using the user's executable search path. + +@vindex PEX_SUFFIX +@item PEX_SUFFIX +@var{outname} is a suffix. See the description of @var{outname}, +below. + +@vindex PEX_STDERR_TO_STDOUT +@item PEX_STDERR_TO_STDOUT +Send the program's standard error to standard output, if possible. + +@vindex PEX_BINARY_INPUT +@vindex PEX_BINARY_OUTPUT +@item PEX_BINARY_INPUT +@itemx PEX_BINARY_OUTPUT +The standard input (output) of the program should be read (written) in +binary mode rather than text mode. These flags are ignored on systems +which do not distinguish binary mode and text mode, such as Unix. For +proper behavior these flags should match appropriately---a call to +@code{pex_run} using @code{PEX_BINARY_OUTPUT} should be followed by a +call using @code{PEX_BINARY_INPUT}. +@end table + +@var{executable} is the program to execute. @var{argv} is the set of +arguments to pass to the program; normally @code{@var{argv}[0]} will +be a copy of @var{executable}. + +@var{outname} is used to set the name of the file to use for standard +output. There are two cases in which no output file will be used: + +@enumerate +@item +if @code{PEX_LAST} is not set in @var{flags}, and @code{PEX_USE_PIPES} +was set in the call to @code{pex_init}, and the system supports pipes + +@item +if @code{PEX_LAST} is set in @var{flags}, and @var{outname} is +@code{NULL} +@end enumerate + +@noindent +Otherwise the code will use a file to hold standard +output. If @code{PEX_LAST} is not set, this file is considered to be +a temporary file, and it will be removed when no longer needed, unless +@code{PEX_SAVE_TEMPS} was set in the call to @code{pex_init}. + +There are two cases to consider when setting the name of the file to +hold standard output. + +@enumerate +@item +@code{PEX_SUFFIX} is set in @var{flags}. In this case +@var{outname} may not be @code{NULL}. If the @var{tempbase} parameter +to @code{pex_init} was not @code{NULL}, then the output file name is +the concatenation of @var{tempbase} and @var{outname}. If +@var{tempbase} was @code{NULL}, then the output file name is a random +file name ending in @var{outname}. + +@item +@code{PEX_SUFFIX} was not set in @var{flags}. In this +case, if @var{outname} is not @code{NULL}, it is used as the output +file name. If @var{outname} is @code{NULL}, and @var{tempbase} was +not NULL, the output file name is randomly chosen using +@var{tempbase}. Otherwise the output file name is chosen completely +at random. +@end enumerate + +@var{errname} is the file name to use for standard error output. If +it is @code{NULL}, standard error is the same as the caller's. +Otherwise, standard error is written to the named file. + +On an error return, the code sets @code{*@var{err}} to an @code{errno} +value, or to 0 if there is no relevant @code{errno}. + +@end deftypefn + +@c pexecute.txh:249 +@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags) + +This is the old interface to execute one or more programs. It is +still supported for compatibility purposes, but is no longer +documented. + +@end deftypefn + +@c strsignal.c:539 @deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) Print @var{message} to the standard error, followed by a colon, @@ -568,23 +952,10 @@ name is unset/removed. @end deftypefn -@c pexecute.txh:39 +@c pexecute.txh:257 @deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags}) -Waits for a program started by @code{pexecute} to finish. - -@var{pid} is the process id of the task to wait for. @var{status} is -the `status' argument to wait. @var{flags} is currently unused -(allows future enhancement without breaking upward compatibility). -Pass 0 for now. - -The result is the pid of the child reaped, or -1 for failure -(@code{errno} says why). - -On systems that don't support waiting for a particular child, -@var{pid} is ignored. On systems like MS-DOS that don't really -multitask @code{pwait} is just a mechanism to provide a consistent -interface for the caller. +Another part of the old execution interface. @end deftypefn @@ -603,7 +974,7 @@ control over the state of the random number generator. @end deftypefn -@c concat.c:177 +@c concat.c:173 @deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @dots{}, @code{NULL}) Same as @code{concat}, except that if @var{optr} is not @code{NULL} it @@ -646,7 +1017,7 @@ environment. This implementation is not safe for multithreaded code. @end deftypefn -@c strsignal.c:353 +@c strsignal.c:348 @deftypefn Extension int signo_max (void) Returns the maximum signal value for which a corresponding symbolic @@ -757,7 +1128,7 @@ valid until the next call to @code{strerrno}. @end deftypefn -@c strerror.c:602 +@c strerror.c:603 @deftypefn Supplemental char* strerror (int @var{errnoval}) Maps an @code{errno} number to an error message string, the contents @@ -793,6 +1164,15 @@ Compares the first @var{n} bytes of two strings, returning a value as @end deftypefn +@c strndup.c:23 +@deftypefn Extension char* strndup (const char *@var{s}, size_t @var{n}) + +Returns a pointer to a copy of @var{s} with at most @var{n} characters +in memory obtained from @code{malloc}, or @code{NULL} if insufficient +memory was available. The result is always NUL terminated. + +@end deftypefn + @c strrchr.c:6 @deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c}) @@ -802,7 +1182,7 @@ null character, the results are undefined. @end deftypefn -@c strsignal.c:388 +@c strsignal.c:383 @deftypefn Supplemental {const char *} strsignal (int @var{signo}) Maps an signal number to an signal message string, the contents of @@ -823,7 +1203,7 @@ call to @code{strsignal}. @end deftypefn -@c strsignal.c:452 +@c strsignal.c:446 @deftypefn Extension {const char*} strsigno (int @var{signo}) Given an signal number, returns a pointer to a string containing the @@ -865,7 +1245,7 @@ the location referenced by @var{endptr}. @end deftypefn -@c strerror.c:730 +@c strerror.c:729 @deftypefn Extension int strtoerrno (const char *@var{name}) Given the symbolic name of a error number (e.g., @code{EACCES}), map it @@ -889,7 +1269,7 @@ that the converted value is unsigned. @end deftypefn -@c strsignal.c:507 +@c strsignal.c:500 @deftypefn Extension int strtosigno (const char *@var{name}) Given the symbolic name of a signal, map it to a signal number. If no @@ -897,6 +1277,53 @@ translation is found, returns 0. @end deftypefn +@c strverscmp.c:25 +@deftypefun int strverscmp (const char *@var{s1}, const char *@var{s2}) +The @code{strverscmp} function compares the string @var{s1} against +@var{s2}, considering them as holding indices/version numbers. Return +value follows the same conventions as found in the @code{strverscmp} +function. In fact, if @var{s1} and @var{s2} contain no digits, +@code{strverscmp} behaves like @code{strcmp}. + +Basically, we compare strings normally (character by character), until +we find a digit in each string - then we enter a special comparison +mode, where each sequence of digits is taken as a whole. If we reach the +end of these two parts without noticing a difference, we return to the +standard comparison mode. There are two types of numeric parts: +"integral" and "fractional" (those begin with a '0'). The types +of the numeric parts affect the way we sort them: + +@itemize @bullet +@item +integral/integral: we compare values as you would expect. + +@item +fractional/integral: the fractional part is less than the integral one. +Again, no surprise. + +@item +fractional/fractional: the things become a bit more complex. +If the common prefix contains only leading zeroes, the longest part is less +than the other one; else the comparison behaves normally. +@end itemize + +@smallexample +strverscmp ("no digit", "no digit") + @result{} 0 // @r{same behavior as strcmp.} +strverscmp ("item#99", "item#100") + @result{} <0 // @r{same prefix, but 99 < 100.} +strverscmp ("alpha1", "alpha001") + @result{} >0 // @r{fractional part inferior to integral one.} +strverscmp ("part1_f012", "part1_f01") + @result{} >0 // @r{two fractional parts.} +strverscmp ("foo.009", "foo.0") + @result{} <0 // @r{idem, but with leading zeroes only.} +@end smallexample + +This function is especially useful when dealing with filename sorting, +because filenames frequently hold indices/version numbers. +@end deftypefun + @c tmpnam.c:3 @deftypefn Supplemental char* tmpnam (char *@var{s}) @@ -908,7 +1335,35 @@ not be used in new projects. Use @code{mkstemp} instead. @end deftypefn -@c vasprintf.c:48 +@c unlink-if-ordinary.c:27 +@deftypefn Supplemental int unlink_if_ordinary (const char*) + +Unlinks the named file, unless it is special (e.g. a device file). +Returns 0 when the file was unlinked, a negative value (and errno set) when +there was an error deleting the file, and a positive value if no attempt +was made to unlink the file because it is special. + +@end deftypefn + +@c fopen_unlocked.c:31 +@deftypefn Extension void unlock_std_streams (void) + +If the OS supports it, ensure that the standard I/O streams, +@code{stdin}, @code{stdout} and @code{stderr} are setup to avoid any +multi-threaded locking. Otherwise do nothing. + +@end deftypefn + +@c fopen_unlocked.c:23 +@deftypefn Extension void unlock_stream (FILE * @var{stream}) + +If the OS supports it, ensure that the supplied stream is setup to +avoid any multi-threaded locking. Otherwise leave the @code{FILE} +pointer unchanged. If the @var{stream} is @code{NULL} do nothing. + +@end deftypefn + +@c vasprintf.c:47 @deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args}) Like @code{vsprintf}, but instead of passing a pointer to a buffer, @@ -916,7 +1371,7 @@ you pass a pointer to a pointer. This function will compute the size of the buffer needed, allocate memory with @code{malloc}, and store a pointer to the allocated memory in @code{*@var{resptr}}. The value returned is the same as @code{vsprintf} would return. If memory could -not be allocated, zero is returned and @code{NULL} is stored in +not be allocated, minus one is returned and @code{NULL} is stored in @code{*@var{resptr}}. @end deftypefn @@ -1053,4 +1508,13 @@ will never return a @code{NULL} pointer. @end deftypefn +@c xstrndup.c:23 +@deftypefn Replacement char* xstrndup (const char *@var{s}, size_t @var{n}) + +Returns a pointer to a copy of @var{s} with at most @var{n} characters +without fail, using @code{xmalloc} to obtain memory. The result is +always NUL terminated. + +@end deftypefn + diff --git a/gnu/lib/libiberty/src/getcwd.c b/gnu/lib/libiberty/src/getcwd.c index a19d26796d5..28f26eb179f 100644 --- a/gnu/lib/libiberty/src/getcwd.c +++ b/gnu/lib/libiberty/src/getcwd.c @@ -38,9 +38,7 @@ extern int errno; #endif char * -getcwd (buf, len) - char *buf; - size_t len; +getcwd (char *buf, size_t len) { char ourbuf[MAXPATHLEN]; char *result; diff --git a/gnu/lib/libiberty/src/getruntime.c b/gnu/lib/libiberty/src/getruntime.c index 3f7dc0d117a..82f3d2e4185 100644 --- a/gnu/lib/libiberty/src/getruntime.c +++ b/gnu/lib/libiberty/src/getruntime.c @@ -14,8 +14,8 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ #include "config.h" @@ -90,7 +90,7 @@ process started. */ long -get_run_time () +get_run_time (void) { #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H) struct rusage rusage; diff --git a/gnu/lib/libiberty/src/hashtab.c b/gnu/lib/libiberty/src/hashtab.c index 32067afb5b8..a5671a0a768 100644 --- a/gnu/lib/libiberty/src/hashtab.c +++ b/gnu/lib/libiberty/src/hashtab.c @@ -1,5 +1,6 @@ /* An expandable hash tables datatype. - Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. Contributed by Vladimir Makarov (vmakarov@cygnus.com). This file is part of the libiberty library. @@ -15,8 +16,8 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ /* This package implements basic hash table functionality. It is possible to search for an entry, create an entry and destroy an entry. @@ -40,30 +41,37 @@ Boston, MA 02111-1307, USA. */ #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif - #ifdef HAVE_STRING_H #include <string.h> #endif +#ifdef HAVE_MALLOC_H +#include <malloc.h> +#endif +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif #include <stdio.h> #include "libiberty.h" +#include "ansidecl.h" #include "hashtab.h" -/* This macro defines reserved value for empty table entry. */ - -#define EMPTY_ENTRY ((PTR) 0) - -/* This macro defines reserved value for table entry which contained - a deleted element. */ - -#define DELETED_ENTRY ((PTR) 1) +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif -static unsigned long higher_prime_number PARAMS ((unsigned long)); -static hashval_t hash_pointer PARAMS ((const void *)); -static int eq_pointer PARAMS ((const void *, const void *)); -static int htab_expand PARAMS ((htab_t)); -static PTR *find_empty_slot_for_expand PARAMS ((htab_t, hashval_t)); +static unsigned int higher_prime_index (unsigned long); +static hashval_t htab_mod_1 (hashval_t, hashval_t, hashval_t, int); +static hashval_t htab_mod (hashval_t, htab_t); +static hashval_t htab_mod_m2 (hashval_t, htab_t); +static hashval_t hash_pointer (const void *); +static int eq_pointer (const void *, const void *); +static int htab_expand (htab_t); +static PTR *find_empty_slot_for_expand (htab_t, hashval_t); /* At some point, we could make these be NULL, and modify the hash-table routines to handle NULL specially; that would avoid @@ -71,76 +79,122 @@ static PTR *find_empty_slot_for_expand PARAMS ((htab_t, hashval_t)); htab_hash htab_hash_pointer = hash_pointer; htab_eq htab_eq_pointer = eq_pointer; -/* The following function returns a nearest prime number which is - greater than N, and near a power of two. */ - -static unsigned long -higher_prime_number (n) - unsigned long n; -{ - /* These are primes that are near, but slightly smaller than, a - power of two. */ - static const unsigned long primes[] = { - (unsigned long) 7, - (unsigned long) 13, - (unsigned long) 31, - (unsigned long) 61, - (unsigned long) 127, - (unsigned long) 251, - (unsigned long) 509, - (unsigned long) 1021, - (unsigned long) 2039, - (unsigned long) 4093, - (unsigned long) 8191, - (unsigned long) 16381, - (unsigned long) 32749, - (unsigned long) 65521, - (unsigned long) 131071, - (unsigned long) 262139, - (unsigned long) 524287, - (unsigned long) 1048573, - (unsigned long) 2097143, - (unsigned long) 4194301, - (unsigned long) 8388593, - (unsigned long) 16777213, - (unsigned long) 33554393, - (unsigned long) 67108859, - (unsigned long) 134217689, - (unsigned long) 268435399, - (unsigned long) 536870909, - (unsigned long) 1073741789, - (unsigned long) 2147483647, - /* 4294967291L */ - ((unsigned long) 2147483647) + ((unsigned long) 2147483644), - }; - - const unsigned long *low = &primes[0]; - const unsigned long *high = &primes[sizeof(primes) / sizeof(primes[0])]; +/* Table of primes and multiplicative inverses. + + Note that these are not minimally reduced inverses. Unlike when generating + code to divide by a constant, we want to be able to use the same algorithm + all the time. All of these inverses (are implied to) have bit 32 set. + + For the record, here's the function that computed the table; it's a + vastly simplified version of the function of the same name from gcc. */ + +#if 0 +unsigned int +ceil_log2 (unsigned int x) +{ + int i; + for (i = 31; i >= 0 ; --i) + if (x > (1u << i)) + return i+1; + abort (); +} + +unsigned int +choose_multiplier (unsigned int d, unsigned int *mlp, unsigned char *shiftp) +{ + unsigned long long mhigh; + double nx; + int lgup, post_shift; + int pow, pow2; + int n = 32, precision = 32; + + lgup = ceil_log2 (d); + pow = n + lgup; + pow2 = n + lgup - precision; + + nx = ldexp (1.0, pow) + ldexp (1.0, pow2); + mhigh = nx / d; + + *shiftp = lgup - 1; + *mlp = mhigh; + return mhigh >> 32; +} +#endif + +struct prime_ent +{ + hashval_t prime; + hashval_t inv; + hashval_t inv_m2; /* inverse of prime-2 */ + hashval_t shift; +}; + +static struct prime_ent const prime_tab[] = { + { 7, 0x24924925, 0x9999999b, 2 }, + { 13, 0x3b13b13c, 0x745d1747, 3 }, + { 31, 0x08421085, 0x1a7b9612, 4 }, + { 61, 0x0c9714fc, 0x15b1e5f8, 5 }, + { 127, 0x02040811, 0x0624dd30, 6 }, + { 251, 0x05197f7e, 0x073260a5, 7 }, + { 509, 0x01824366, 0x02864fc8, 8 }, + { 1021, 0x00c0906d, 0x014191f7, 9 }, + { 2039, 0x0121456f, 0x0161e69e, 10 }, + { 4093, 0x00300902, 0x00501908, 11 }, + { 8191, 0x00080041, 0x00180241, 12 }, + { 16381, 0x000c0091, 0x00140191, 13 }, + { 32749, 0x002605a5, 0x002a06e6, 14 }, + { 65521, 0x000f00e2, 0x00110122, 15 }, + { 131071, 0x00008001, 0x00018003, 16 }, + { 262139, 0x00014002, 0x0001c004, 17 }, + { 524287, 0x00002001, 0x00006001, 18 }, + { 1048573, 0x00003001, 0x00005001, 19 }, + { 2097143, 0x00004801, 0x00005801, 20 }, + { 4194301, 0x00000c01, 0x00001401, 21 }, + { 8388593, 0x00001e01, 0x00002201, 22 }, + { 16777213, 0x00000301, 0x00000501, 23 }, + { 33554393, 0x00001381, 0x00001481, 24 }, + { 67108859, 0x00000141, 0x000001c1, 25 }, + { 134217689, 0x000004e1, 0x00000521, 26 }, + { 268435399, 0x00000391, 0x000003b1, 27 }, + { 536870909, 0x00000019, 0x00000029, 28 }, + { 1073741789, 0x0000008d, 0x00000095, 29 }, + { 2147483647, 0x00000003, 0x00000007, 30 }, + /* Avoid "decimal constant so large it is unsigned" for 4294967291. */ + { 0xfffffffb, 0x00000006, 0x00000008, 31 } +}; + +/* The following function returns an index into the above table of the + nearest prime number which is greater than N, and near a power of two. */ + +static unsigned int +higher_prime_index (unsigned long n) +{ + unsigned int low = 0; + unsigned int high = sizeof(prime_tab) / sizeof(prime_tab[0]); while (low != high) { - const unsigned long *mid = low + (high - low) / 2; - if (n > *mid) + unsigned int mid = low + (high - low) / 2; + if (n > prime_tab[mid].prime) low = mid + 1; else high = mid; } /* If we've run out of primes, abort. */ - if (n > *low) + if (n > prime_tab[low].prime) { fprintf (stderr, "Cannot find prime bigger than %lu\n", n); abort (); } - return *low; + return low; } /* Returns a hash code for P. */ static hashval_t -hash_pointer (p) - const PTR p; +hash_pointer (const PTR p) { return (hashval_t) ((long)p >> 3); } @@ -148,30 +202,98 @@ hash_pointer (p) /* Returns non-zero if P1 and P2 are equal. */ static int -eq_pointer (p1, p2) - const PTR p1; - const PTR p2; +eq_pointer (const PTR p1, const PTR p2) { return p1 == p2; } + +/* The parens around the function names in the next two definitions + are essential in order to prevent macro expansions of the name. + The bodies, however, are expanded as expected, so they are not + recursive definitions. */ + +/* Return the current size of given hash table. */ + +#define htab_size(htab) ((htab)->size) + +size_t +(htab_size) (htab_t htab) +{ + return htab_size (htab); +} + +/* Return the current number of elements in given hash table. */ + +#define htab_elements(htab) ((htab)->n_elements - (htab)->n_deleted) + +size_t +(htab_elements) (htab_t htab) +{ + return htab_elements (htab); +} + +/* Return X % Y. */ + +static inline hashval_t +htab_mod_1 (hashval_t x, hashval_t y, hashval_t inv, int shift) +{ + /* The multiplicative inverses computed above are for 32-bit types, and + requires that we be able to compute a highpart multiply. */ +#ifdef UNSIGNED_64BIT_TYPE + __extension__ typedef UNSIGNED_64BIT_TYPE ull; + if (sizeof (hashval_t) * CHAR_BIT <= 32) + { + hashval_t t1, t2, t3, t4, q, r; + + t1 = ((ull)x * inv) >> 32; + t2 = x - t1; + t3 = t2 >> 1; + t4 = t1 + t3; + q = t4 >> shift; + r = x - (q * y); + + return r; + } +#endif + + /* Otherwise just use the native division routines. */ + return x % y; +} + +/* Compute the primary hash for HASH given HTAB's current size. */ + +static inline hashval_t +htab_mod (hashval_t hash, htab_t htab) +{ + const struct prime_ent *p = &prime_tab[htab->size_prime_index]; + return htab_mod_1 (hash, p->prime, p->inv, p->shift); +} + +/* Compute the secondary hash for HASH given HTAB's current size. */ + +static inline hashval_t +htab_mod_m2 (hashval_t hash, htab_t htab) +{ + const struct prime_ent *p = &prime_tab[htab->size_prime_index]; + return 1 + htab_mod_1 (hash, p->prime - 2, p->inv_m2, p->shift); +} + /* This function creates table with length slightly longer than given source length. Created hash table is initiated as empty (all the - hash table entries are EMPTY_ENTRY). The function returns the + hash table entries are HTAB_EMPTY_ENTRY). The function returns the created hash table, or NULL if memory allocation fails. */ htab_t -htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f) - size_t size; - htab_hash hash_f; - htab_eq eq_f; - htab_del del_f; - htab_alloc alloc_f; - htab_free free_f; +htab_create_alloc (size_t size, htab_hash hash_f, htab_eq eq_f, + htab_del del_f, htab_alloc alloc_f, htab_free free_f) { htab_t result; + unsigned int size_prime_index; + + size_prime_index = higher_prime_index (size); + size = prime_tab[size_prime_index].prime; - size = higher_prime_number (size); result = (htab_t) (*alloc_f) (1, sizeof (struct htab)); if (result == NULL) return NULL; @@ -183,6 +305,7 @@ htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f) return NULL; } result->size = size; + result->size_prime_index = size_prime_index; result->hash_f = hash_f; result->eq_f = eq_f; result->del_f = del_f; @@ -195,19 +318,17 @@ htab_create_alloc (size, hash_f, eq_f, del_f, alloc_f, free_f) an extra argument. */ htab_t -htab_create_alloc_ex (size, hash_f, eq_f, del_f, alloc_arg, alloc_f, - free_f) - size_t size; - htab_hash hash_f; - htab_eq eq_f; - htab_del del_f; - PTR alloc_arg; - htab_alloc_with_arg alloc_f; - htab_free_with_arg free_f; +htab_create_alloc_ex (size_t size, htab_hash hash_f, htab_eq eq_f, + htab_del del_f, void *alloc_arg, + htab_alloc_with_arg alloc_f, + htab_free_with_arg free_f) { htab_t result; + unsigned int size_prime_index; + + size_prime_index = higher_prime_index (size); + size = prime_tab[size_prime_index].prime; - size = higher_prime_number (size); result = (htab_t) (*alloc_f) (alloc_arg, 1, sizeof (struct htab)); if (result == NULL) return NULL; @@ -219,6 +340,7 @@ htab_create_alloc_ex (size, hash_f, eq_f, del_f, alloc_arg, alloc_f, return NULL; } result->size = size; + result->size_prime_index = size_prime_index; result->hash_f = hash_f; result->eq_f = eq_f; result->del_f = del_f; @@ -231,14 +353,9 @@ htab_create_alloc_ex (size, hash_f, eq_f, del_f, alloc_arg, alloc_f, /* Update the function pointers and allocation parameter in the htab_t. */ void -htab_set_functions_ex (htab, hash_f, eq_f, del_f, alloc_arg, alloc_f, free_f) - htab_t htab; - htab_hash hash_f; - htab_eq eq_f; - htab_del del_f; - PTR alloc_arg; - htab_alloc_with_arg alloc_f; - htab_free_with_arg free_f; +htab_set_functions_ex (htab_t htab, htab_hash hash_f, htab_eq eq_f, + htab_del del_f, PTR alloc_arg, + htab_alloc_with_arg alloc_f, htab_free_with_arg free_f) { htab->hash_f = hash_f; htab->eq_f = eq_f; @@ -252,21 +369,13 @@ htab_set_functions_ex (htab, hash_f, eq_f, del_f, alloc_arg, alloc_f, free_f) #undef htab_create htab_t -htab_create (size, hash_f, eq_f, del_f) - size_t size; - htab_hash hash_f; - htab_eq eq_f; - htab_del del_f; +htab_create (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f) { return htab_create_alloc (size, hash_f, eq_f, del_f, xcalloc, free); } htab_t -htab_try_create (size, hash_f, eq_f, del_f) - size_t size; - htab_hash hash_f; - htab_eq eq_f; - htab_del del_f; +htab_try_create (size_t size, htab_hash hash_f, htab_eq eq_f, htab_del del_f) { return htab_create_alloc (size, hash_f, eq_f, del_f, calloc, free); } @@ -275,25 +384,25 @@ htab_try_create (size, hash_f, eq_f, del_f) Naturally the hash table must already exist. */ void -htab_delete (htab) - htab_t htab; +htab_delete (htab_t htab) { + size_t size = htab_size (htab); + PTR *entries = htab->entries; int i; if (htab->del_f) - for (i = htab->size - 1; i >= 0; i--) - if (htab->entries[i] != EMPTY_ENTRY - && htab->entries[i] != DELETED_ENTRY) - (*htab->del_f) (htab->entries[i]); + for (i = size - 1; i >= 0; i--) + if (entries[i] != HTAB_EMPTY_ENTRY && entries[i] != HTAB_DELETED_ENTRY) + (*htab->del_f) (entries[i]); if (htab->free_f != NULL) { - (*htab->free_f) (htab->entries); + (*htab->free_f) (entries); (*htab->free_f) (htab); } else if (htab->free_with_arg_f != NULL) { - (*htab->free_with_arg_f) (htab->alloc_arg, htab->entries); + (*htab->free_with_arg_f) (htab->alloc_arg, entries); (*htab->free_with_arg_f) (htab->alloc_arg, htab); } } @@ -301,18 +410,18 @@ htab_delete (htab) /* This function clears all entries in the given hash table. */ void -htab_empty (htab) - htab_t htab; +htab_empty (htab_t htab) { + size_t size = htab_size (htab); + PTR *entries = htab->entries; int i; if (htab->del_f) - for (i = htab->size - 1; i >= 0; i--) - if (htab->entries[i] != EMPTY_ENTRY - && htab->entries[i] != DELETED_ENTRY) - (*htab->del_f) (htab->entries[i]); + for (i = size - 1; i >= 0; i--) + if (entries[i] != HTAB_EMPTY_ENTRY && entries[i] != HTAB_DELETED_ENTRY) + (*htab->del_f) (entries[i]); - memset (htab->entries, 0, htab->size * sizeof (PTR)); + memset (entries, 0, size * sizeof (PTR)); } /* Similar to htab_find_slot, but without several unwanted side effects: @@ -323,21 +432,19 @@ htab_empty (htab) HASH is the hash value for the element to be inserted. */ static PTR * -find_empty_slot_for_expand (htab, hash) - htab_t htab; - hashval_t hash; +find_empty_slot_for_expand (htab_t htab, hashval_t hash) { - size_t size = htab->size; - unsigned int index = hash % size; + hashval_t index = htab_mod (hash, htab); + size_t size = htab_size (htab); PTR *slot = htab->entries + index; hashval_t hash2; - if (*slot == EMPTY_ENTRY) + if (*slot == HTAB_EMPTY_ENTRY) return slot; - else if (*slot == DELETED_ENTRY) + else if (*slot == HTAB_DELETED_ENTRY) abort (); - hash2 = 1 + hash % (size - 2); + hash2 = htab_mod_m2 (hash, htab); for (;;) { index += hash2; @@ -345,9 +452,9 @@ find_empty_slot_for_expand (htab, hash) index -= size; slot = htab->entries + index; - if (*slot == EMPTY_ENTRY) + if (*slot == HTAB_EMPTY_ENTRY) return slot; - else if (*slot == DELETED_ENTRY) + else if (*slot == HTAB_DELETED_ENTRY) abort (); } } @@ -361,26 +468,33 @@ find_empty_slot_for_expand (htab, hash) expanded. If all goes well, it will return a non-zero value. */ static int -htab_expand (htab) - htab_t htab; +htab_expand (htab_t htab) { PTR *oentries; PTR *olimit; PTR *p; PTR *nentries; - size_t nsize; + size_t nsize, osize, elts; + unsigned int oindex, nindex; oentries = htab->entries; - olimit = oentries + htab->size; + oindex = htab->size_prime_index; + osize = htab->size; + olimit = oentries + osize; + elts = htab_elements (htab); /* Resize only when table after removal of unused elements is either too full or too empty. */ - if ((htab->n_elements - htab->n_deleted) * 2 > htab->size - || ((htab->n_elements - htab->n_deleted) * 8 < htab->size - && htab->size > 32)) - nsize = higher_prime_number ((htab->n_elements - htab->n_deleted) * 2); + if (elts * 2 > osize || (elts * 8 < osize && osize > 32)) + { + nindex = higher_prime_index (elts * 2); + nsize = prime_tab[nindex].prime; + } else - nsize = htab->size; + { + nindex = oindex; + nsize = osize; + } if (htab->alloc_with_arg_f != NULL) nentries = (PTR *) (*htab->alloc_with_arg_f) (htab->alloc_arg, nsize, @@ -391,7 +505,7 @@ htab_expand (htab) return 0; htab->entries = nentries; htab->size = nsize; - + htab->size_prime_index = nindex; htab->n_elements -= htab->n_deleted; htab->n_deleted = 0; @@ -400,7 +514,7 @@ htab_expand (htab) { PTR x = *p; - if (x != EMPTY_ENTRY && x != DELETED_ENTRY) + if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY) { PTR *q = find_empty_slot_for_expand (htab, (*htab->hash_f) (x)); @@ -422,27 +536,22 @@ htab_expand (htab) element. It cannot be used to insert or delete an element. */ PTR -htab_find_with_hash (htab, element, hash) - htab_t htab; - const PTR element; - hashval_t hash; +htab_find_with_hash (htab_t htab, const PTR element, hashval_t hash) { - unsigned int index; - hashval_t hash2; + hashval_t index, hash2; size_t size; PTR entry; htab->searches++; - size = htab->size; - index = hash % size; + size = htab_size (htab); + index = htab_mod (hash, htab); entry = htab->entries[index]; - if (entry == EMPTY_ENTRY - || (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element))) + if (entry == HTAB_EMPTY_ENTRY + || (entry != HTAB_DELETED_ENTRY && (*htab->eq_f) (entry, element))) return entry; - hash2 = 1 + hash % (size - 2); - + hash2 = htab_mod_m2 (hash, htab); for (;;) { htab->collisions++; @@ -451,8 +560,8 @@ htab_find_with_hash (htab, element, hash) index -= size; entry = htab->entries[index]; - if (entry == EMPTY_ENTRY - || (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element))) + if (entry == HTAB_EMPTY_ENTRY + || (entry != HTAB_DELETED_ENTRY && (*htab->eq_f) (entry, element))) return entry; } } @@ -461,53 +570,50 @@ htab_find_with_hash (htab, element, hash) element. */ PTR -htab_find (htab, element) - htab_t htab; - const PTR element; +htab_find (htab_t htab, const PTR element) { return htab_find_with_hash (htab, element, (*htab->hash_f) (element)); } /* This function searches for a hash table slot containing an entry equal to the given element. To delete an entry, call this with - INSERT = 0, then call htab_clear_slot on the slot returned (possibly - after doing some checks). To insert an entry, call this with - INSERT = 1, then write the value you want into the returned slot. - When inserting an entry, NULL may be returned if memory allocation - fails. */ + insert=NO_INSERT, then call htab_clear_slot on the slot returned + (possibly after doing some checks). To insert an entry, call this + with insert=INSERT, then write the value you want into the returned + slot. When inserting an entry, NULL may be returned if memory + allocation fails. */ PTR * -htab_find_slot_with_hash (htab, element, hash, insert) - htab_t htab; - const PTR element; - hashval_t hash; - enum insert_option insert; +htab_find_slot_with_hash (htab_t htab, const PTR element, + hashval_t hash, enum insert_option insert) { PTR *first_deleted_slot; - unsigned int index; - hashval_t hash2; + hashval_t index, hash2; size_t size; PTR entry; - if (insert == INSERT && htab->size * 3 <= htab->n_elements * 4 - && htab_expand (htab) == 0) - return NULL; + size = htab_size (htab); + if (insert == INSERT && size * 3 <= htab->n_elements * 4) + { + if (htab_expand (htab) == 0) + return NULL; + size = htab_size (htab); + } - size = htab->size; - index = hash % size; + index = htab_mod (hash, htab); htab->searches++; first_deleted_slot = NULL; entry = htab->entries[index]; - if (entry == EMPTY_ENTRY) + if (entry == HTAB_EMPTY_ENTRY) goto empty_entry; - else if (entry == DELETED_ENTRY) + else if (entry == HTAB_DELETED_ENTRY) first_deleted_slot = &htab->entries[index]; else if ((*htab->eq_f) (entry, element)) return &htab->entries[index]; - hash2 = 1 + hash % (size - 2); + hash2 = htab_mod_m2 (hash, htab); for (;;) { htab->collisions++; @@ -516,9 +622,9 @@ htab_find_slot_with_hash (htab, element, hash, insert) index -= size; entry = htab->entries[index]; - if (entry == EMPTY_ENTRY) + if (entry == HTAB_EMPTY_ENTRY) goto empty_entry; - else if (entry == DELETED_ENTRY) + else if (entry == HTAB_DELETED_ENTRY) { if (!first_deleted_slot) first_deleted_slot = &htab->entries[index]; @@ -531,14 +637,14 @@ htab_find_slot_with_hash (htab, element, hash, insert) if (insert == NO_INSERT) return NULL; - htab->n_elements++; - if (first_deleted_slot) { - *first_deleted_slot = EMPTY_ENTRY; + htab->n_deleted--; + *first_deleted_slot = HTAB_EMPTY_ENTRY; return first_deleted_slot; } + htab->n_elements++; return &htab->entries[index]; } @@ -546,34 +652,40 @@ htab_find_slot_with_hash (htab, element, hash, insert) element. */ PTR * -htab_find_slot (htab, element, insert) - htab_t htab; - const PTR element; - enum insert_option insert; +htab_find_slot (htab_t htab, const PTR element, enum insert_option insert) { return htab_find_slot_with_hash (htab, element, (*htab->hash_f) (element), insert); } /* This function deletes an element with the given value from hash + table (the hash is computed from the element). If there is no matching + element in the hash table, this function does nothing. */ + +void +htab_remove_elt (htab_t htab, PTR element) +{ + htab_remove_elt_with_hash (htab, element, (*htab->hash_f) (element)); +} + + +/* This function deletes an element with the given value from hash table. If there is no matching element in the hash table, this function does nothing. */ void -htab_remove_elt (htab, element) - htab_t htab; - PTR element; +htab_remove_elt_with_hash (htab_t htab, PTR element, hashval_t hash) { PTR *slot; - slot = htab_find_slot (htab, element, NO_INSERT); - if (*slot == EMPTY_ENTRY) + slot = htab_find_slot_with_hash (htab, element, hash, NO_INSERT); + if (*slot == HTAB_EMPTY_ENTRY) return; if (htab->del_f) (*htab->del_f) (*slot); - *slot = DELETED_ENTRY; + *slot = HTAB_DELETED_ENTRY; htab->n_deleted++; } @@ -582,18 +694,16 @@ htab_remove_elt (htab, element) again. */ void -htab_clear_slot (htab, slot) - htab_t htab; - PTR *slot; +htab_clear_slot (htab_t htab, PTR *slot) { - if (slot < htab->entries || slot >= htab->entries + htab->size - || *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY) + if (slot < htab->entries || slot >= htab->entries + htab_size (htab) + || *slot == HTAB_EMPTY_ENTRY || *slot == HTAB_DELETED_ENTRY) abort (); if (htab->del_f) (*htab->del_f) (*slot); - *slot = DELETED_ENTRY; + *slot = HTAB_DELETED_ENTRY; htab->n_deleted++; } @@ -603,22 +713,19 @@ htab_clear_slot (htab, slot) argument. */ void -htab_traverse_noresize (htab, callback, info) - htab_t htab; - htab_trav callback; - PTR info; +htab_traverse_noresize (htab_t htab, htab_trav callback, PTR info) { PTR *slot; PTR *limit; - + slot = htab->entries; - limit = slot + htab->size; + limit = slot + htab_size (htab); do { PTR x = *slot; - if (x != EMPTY_ENTRY && x != DELETED_ENTRY) + if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY) if (!(*callback) (slot, info)) break; } @@ -629,41 +736,19 @@ htab_traverse_noresize (htab, callback, info) too empty to improve effectivity of subsequent calls. */ void -htab_traverse (htab, callback, info) - htab_t htab; - htab_trav callback; - PTR info; +htab_traverse (htab_t htab, htab_trav callback, PTR info) { - if ((htab->n_elements - htab->n_deleted) * 8 < htab->size) + if (htab_elements (htab) * 8 < htab_size (htab)) htab_expand (htab); htab_traverse_noresize (htab, callback, info); } -/* Return the current size of given hash table. */ - -size_t -htab_size (htab) - htab_t htab; -{ - return htab->size; -} - -/* Return the current number of elements in given hash table. */ - -size_t -htab_elements (htab) - htab_t htab; -{ - return htab->n_elements - htab->n_deleted; -} - /* Return the fraction of fixed collisions during all work with given hash table. */ double -htab_collisions (htab) - htab_t htab; +htab_collisions (htab_t htab) { if (htab->searches == 0) return 0.0; @@ -697,8 +782,7 @@ htab_collisions (htab) function they just started using for Perl's hashes. */ hashval_t -htab_hash_string (p) - const PTR p; +htab_hash_string (const PTR p) { const unsigned char *str = (const unsigned char *) p; hashval_t r = 0; @@ -709,3 +793,142 @@ htab_hash_string (p) return r; } + +/* DERIVED FROM: +-------------------------------------------------------------------- +lookup2.c, by Bob Jenkins, December 1996, Public Domain. +hash(), hash2(), hash3, and mix() are externally useful functions. +Routines to test the hash are included if SELF_TEST is defined. +You can use this free for any purpose. It has no warranty. +-------------------------------------------------------------------- +*/ + +/* +-------------------------------------------------------------------- +mix -- mix 3 32-bit values reversibly. +For every delta with one or two bit set, and the deltas of all three + high bits or all three low bits, whether the original value of a,b,c + is almost all zero or is uniformly distributed, +* If mix() is run forward or backward, at least 32 bits in a,b,c + have at least 1/4 probability of changing. +* If mix() is run forward, every bit of c will change between 1/3 and + 2/3 of the time. (Well, 22/100 and 78/100 for some 2-bit deltas.) +mix() was built out of 36 single-cycle latency instructions in a + structure that could supported 2x parallelism, like so: + a -= b; + a -= c; x = (c>>13); + b -= c; a ^= x; + b -= a; x = (a<<8); + c -= a; b ^= x; + c -= b; x = (b>>13); + ... + Unfortunately, superscalar Pentiums and Sparcs can't take advantage + of that parallelism. They've also turned some of those single-cycle + latency instructions into multi-cycle latency instructions. Still, + this is the fastest good hash I could find. There were about 2^^68 + to choose from. I only looked at a billion or so. +-------------------------------------------------------------------- +*/ +/* same, but slower, works on systems that might have 8 byte hashval_t's */ +#define mix(a,b,c) \ +{ \ + a -= b; a -= c; a ^= (c>>13); \ + b -= c; b -= a; b ^= (a<< 8); \ + c -= a; c -= b; c ^= ((b&0xffffffff)>>13); \ + a -= b; a -= c; a ^= ((c&0xffffffff)>>12); \ + b -= c; b -= a; b = (b ^ (a<<16)) & 0xffffffff; \ + c -= a; c -= b; c = (c ^ (b>> 5)) & 0xffffffff; \ + a -= b; a -= c; a = (a ^ (c>> 3)) & 0xffffffff; \ + b -= c; b -= a; b = (b ^ (a<<10)) & 0xffffffff; \ + c -= a; c -= b; c = (c ^ (b>>15)) & 0xffffffff; \ +} + +/* +-------------------------------------------------------------------- +hash() -- hash a variable-length key into a 32-bit value + k : the key (the unaligned variable-length array of bytes) + len : the length of the key, counting by bytes + level : can be any 4-byte value +Returns a 32-bit value. Every bit of the key affects every bit of +the return value. Every 1-bit and 2-bit delta achieves avalanche. +About 36+6len instructions. + +The best hash table sizes are powers of 2. There is no need to do +mod a prime (mod is sooo slow!). If you need less than 32 bits, +use a bitmask. For example, if you need only 10 bits, do + h = (h & hashmask(10)); +In which case, the hash table should have hashsize(10) elements. + +If you are hashing n strings (ub1 **)k, do it like this: + for (i=0, h=0; i<n; ++i) h = hash( k[i], len[i], h); + +By Bob Jenkins, 1996. bob_jenkins@burtleburtle.net. You may use this +code any way you wish, private, educational, or commercial. It's free. + +See http://burtleburtle.net/bob/hash/evahash.html +Use for hash table lookup, or anything where one collision in 2^32 is +acceptable. Do NOT use for cryptographic purposes. +-------------------------------------------------------------------- +*/ + +hashval_t +iterative_hash (const PTR k_in /* the key */, + register size_t length /* the length of the key */, + register hashval_t initval /* the previous hash, or + an arbitrary value */) +{ + register const unsigned char *k = (const unsigned char *)k_in; + register hashval_t a,b,c,len; + + /* Set up the internal state */ + len = length; + a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */ + c = initval; /* the previous hash value */ + + /*---------------------------------------- handle most of the key */ +#ifndef WORDS_BIGENDIAN + /* On a little-endian machine, if the data is 4-byte aligned we can hash + by word for better speed. This gives nondeterministic results on + big-endian machines. */ + if (sizeof (hashval_t) == 4 && (((size_t)k)&3) == 0) + while (len >= 12) /* aligned */ + { + a += *(hashval_t *)(k+0); + b += *(hashval_t *)(k+4); + c += *(hashval_t *)(k+8); + mix(a,b,c); + k += 12; len -= 12; + } + else /* unaligned */ +#endif + while (len >= 12) + { + a += (k[0] +((hashval_t)k[1]<<8) +((hashval_t)k[2]<<16) +((hashval_t)k[3]<<24)); + b += (k[4] +((hashval_t)k[5]<<8) +((hashval_t)k[6]<<16) +((hashval_t)k[7]<<24)); + c += (k[8] +((hashval_t)k[9]<<8) +((hashval_t)k[10]<<16)+((hashval_t)k[11]<<24)); + mix(a,b,c); + k += 12; len -= 12; + } + + /*------------------------------------- handle the last 11 bytes */ + c += length; + switch(len) /* all the case statements fall through */ + { + case 11: c+=((hashval_t)k[10]<<24); + case 10: c+=((hashval_t)k[9]<<16); + case 9 : c+=((hashval_t)k[8]<<8); + /* the first byte of c is reserved for the length */ + case 8 : b+=((hashval_t)k[7]<<24); + case 7 : b+=((hashval_t)k[6]<<16); + case 6 : b+=((hashval_t)k[5]<<8); + case 5 : b+=k[4]; + case 4 : a+=((hashval_t)k[3]<<24); + case 3 : a+=((hashval_t)k[2]<<16); + case 2 : a+=((hashval_t)k[1]<<8); + case 1 : a+=k[0]; + /* case 0: nothing left to add */ + } + mix(a,b,c); + /*-------------------------------------------- report the result */ + return c; +} diff --git a/gnu/lib/libiberty/src/maint-tool b/gnu/lib/libiberty/src/maint-tool index 6b9bf7f2cdb..5584d9b5594 100644 --- a/gnu/lib/libiberty/src/maint-tool +++ b/gnu/lib/libiberty/src/maint-tool @@ -17,8 +17,8 @@ # # You should have received a copy of the GNU Library General Public # License along with libiberty; see the file COPYING.LIB. If not, -# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. +# write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +# Boston, MA 02110-1301, USA. # # Originally written by DJ Delorie <dj@redhat.com> @@ -145,7 +145,6 @@ sub undoc { next unless /^\# *define/; s/\# *define *//; } - next if $filename =~ /mpw\.c/; s/ VPARAMS//; s/ *\177.*//; @@ -213,6 +212,12 @@ sub locals_first { sub deps { + $crule = "\tif [ x\"\$(PICFLAG)\" != x ]; then \\\n"; + $crule .= "\t \$(COMPILE.c) \$(PICFLAG) \$< -o pic/\$@; \\\n"; + $crule .= "\telse true; fi\n"; + $crule .= "\t\$(COMPILE.c) \$< \$(OUTPUT_OPTION)\n"; + $crule .= "\n"; + $incdir = shift @ARGV; opendir(INC, $incdir); @@ -260,10 +265,10 @@ sub deps { @deps = sort { &locals_first($a,$b) } keys %scanned; $obj = $f; $obj =~ s/\.c$/.o/; - $obj = "$obj:"; + $obj = "./$obj:"; if ($#deps >= 0) { - print OUT $obj; - $len = length($obj); + print OUT "$obj \$(srcdir)/$f"; + $len = length("$obj $f"); for $dt (@deps) { $d = $mine{$dt}; if ($len + length($d) > 70) { @@ -275,7 +280,12 @@ sub deps { } } print OUT "\n"; + } else { + print OUT "$obj \$(srcdir)/$f\n"; } + $c = $crule; + $c =~ s@\$\<@\$\(srcdir\)\/$f@g; + print OUT $c; } } closedir(S); diff --git a/gnu/lib/libiberty/src/memchr.c b/gnu/lib/libiberty/src/memchr.c index 3948125963d..451f817d320 100644 --- a/gnu/lib/libiberty/src/memchr.c +++ b/gnu/lib/libiberty/src/memchr.c @@ -15,17 +15,10 @@ returned. */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif PTR -memchr (src_void, c, length) - register const PTR src_void; - int c; - size_t length; +memchr (register const PTR src_void, int c, size_t length) { const unsigned char *src = (const unsigned char *)src_void; diff --git a/gnu/lib/libiberty/src/memcmp.c b/gnu/lib/libiberty/src/memcmp.c index 92f2b6e6425..39edfca98a6 100644 --- a/gnu/lib/libiberty/src/memcmp.c +++ b/gnu/lib/libiberty/src/memcmp.c @@ -16,17 +16,10 @@ as if comparing unsigned char arrays. */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif int -memcmp (str1, str2, count) - const PTR str1; - const PTR str2; - size_t count; +memcmp (const PTR str1, const PTR str2, size_t count) { register const unsigned char *s1 = (const unsigned char*)str1; register const unsigned char *s2 = (const unsigned char*)str2; diff --git a/gnu/lib/libiberty/src/memcpy.c b/gnu/lib/libiberty/src/memcpy.c index 5eece7a0a00..9b5b24295df 100644 --- a/gnu/lib/libiberty/src/memcpy.c +++ b/gnu/lib/libiberty/src/memcpy.c @@ -13,19 +13,12 @@ Copies @var{length} bytes from memory region @var{in} to region */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif -void bcopy PARAMS((const void*, void*, size_t)); +void bcopy (const void*, void*, size_t); PTR -memcpy (out, in, length) - PTR out; - const PTR in; - size_t length; +memcpy (PTR out, const PTR in, size_t length) { bcopy(in, out, length); return out; diff --git a/gnu/lib/libiberty/src/memmove.c b/gnu/lib/libiberty/src/memmove.c index 00ac053401b..06a24fc2688 100644 --- a/gnu/lib/libiberty/src/memmove.c +++ b/gnu/lib/libiberty/src/memmove.c @@ -13,19 +13,12 @@ Copies @var{count} bytes from memory area @var{from} to memory area */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif -void bcopy PARAMS ((const void*, void*, size_t)); +void bcopy (const void*, void*, size_t); PTR -memmove (s1, s2, n) - PTR s1; - const PTR s2; - size_t n; +memmove (PTR s1, const PTR s2, size_t n) { bcopy (s2, s1, n); return s1; diff --git a/gnu/lib/libiberty/src/memset.c b/gnu/lib/libiberty/src/memset.c index 5119f858ad0..1951ad6bd61 100644 --- a/gnu/lib/libiberty/src/memset.c +++ b/gnu/lib/libiberty/src/memset.c @@ -13,17 +13,10 @@ Sets the first @var{count} bytes of @var{s} to the constant byte */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif PTR -memset (dest, val, len) - PTR dest; - register int val; - register size_t len; +memset (PTR dest, register int val, register size_t len) { register unsigned char *ptr = (unsigned char*)dest; while (len-- > 0) diff --git a/gnu/lib/libiberty/src/mkstemps.c b/gnu/lib/libiberty/src/mkstemps.c index 1f6600a15b9..89b37d9f480 100644 --- a/gnu/lib/libiberty/src/mkstemps.c +++ b/gnu/lib/libiberty/src/mkstemps.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1996, 1998, 2004 Free Software Foundation, Inc. This file is derived from mkstemp.c from the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -13,8 +13,8 @@ You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -51,17 +51,17 @@ typedef unsigned long gcc_uint64_t; /* -@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len}) +@deftypefn Replacement int mkstemps (char *@var{pattern}, int @var{suffix_len}) -Generate a unique temporary file name from @var{template}. -@var{template} has the form: +Generate a unique temporary file name from @var{pattern}. +@var{pattern} has the form: @example @var{path}/ccXXXXXX@var{suffix} @end example @var{suffix_len} tells us how long @var{suffix} is (it can be zero -length). The last six characters of @var{template} before @var{suffix} +length). The last six characters of @var{pattern} before @var{suffix} must be @samp{XXXXXX}; they are replaced with a string that makes the filename unique. Returns a file descriptor open on the file for reading and writing. @@ -71,9 +71,7 @@ reading and writing. */ int -mkstemps (template, suffix_len) - char *template; - int suffix_len; +mkstemps (char *pattern, int suffix_len) { static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; @@ -85,15 +83,15 @@ mkstemps (template, suffix_len) size_t len; int count; - len = strlen (template); + len = strlen (pattern); if ((int) len < 6 + suffix_len - || strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6)) + || strncmp (&pattern[len - 6 - suffix_len], "XXXXXX", 6)) { return -1; } - XXXXXX = &template[len - 6 - suffix_len]; + XXXXXX = &pattern[len - 6 - suffix_len]; #ifdef HAVE_GETTIMEOFDAY /* Get some more or less random data. */ @@ -121,11 +119,7 @@ mkstemps (template, suffix_len) v /= 62; XXXXXX[5] = letters[v % 62]; -#ifdef VMS - fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd"); -#else - fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600); -#endif + fd = open (pattern, O_RDWR|O_CREAT|O_EXCL, 0600); if (fd >= 0) /* The file does not exist. */ return fd; @@ -137,6 +131,6 @@ mkstemps (template, suffix_len) } /* We return the null string if we can't find a unique file name. */ - template[0] = '\0'; + pattern[0] = '\0'; return -1; } diff --git a/gnu/lib/libiberty/src/mpw-config.in b/gnu/lib/libiberty/src/mpw-config.in deleted file mode 100644 index 2a21802148d..00000000000 --- a/gnu/lib/libiberty/src/mpw-config.in +++ /dev/null @@ -1,7 +0,0 @@ -# MPW configuration fragment for libiberty. - -Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new - -MoveIfChange "{o}"config.new "{o}"config.h - - diff --git a/gnu/lib/libiberty/src/mpw-make.sed b/gnu/lib/libiberty/src/mpw-make.sed deleted file mode 100644 index 6f2a5e77b2b..00000000000 --- a/gnu/lib/libiberty/src/mpw-make.sed +++ /dev/null @@ -1,51 +0,0 @@ -# Sed commands to finish translating libiberty's Unix makefile to MPW syntax. - -# Comment out a useless thing. -/^\.always\./s/^/#/ - -# Replace the auto-generated list with the list of what we know we need. -s/`cat needed-list`/"{o}"alloca.c.o "{o}"bcopy.c.o "{o}"getpagesize.c.o "{o}"insque.c.o "{o}"mpw.c.o "{o}"strcasecmp.c.o "{o}"strdup.c.o "{o}"strncasecmp.c.o/ - -# Paste in some desirable definitions. -# The default rule here completely replaces the tricky stuff in the Unix -# Makefile.in. -/^###$/a\ -\ -HDEFINES = -d NEED_sys_siglist -d NEED_sys_errlist -d NEED_basename -d NEED_strcasecmp -d NEED_strncasecmp\ -INCLUDES = -i : -i {INCDIR}: -i {INCDIR}:mpw: -i ::extra-include: -i "{s}"\ -\ -.c.o \\Option-f .c\ - {CC} @DASH_C_FLAG@ {DepDir}{Default}.c {LIBCFLAGS} {INCLUDES} {HDEFINES} @SEGMENT_FLAG({Default})@ -o {TargDir}{Default}.c.o\ - -# Remove dependency on needed-list, which we don't use. -/DO_ALSO =/s/needed-list// - -/INCDIR=/s/"{srcdir}"{MULTISRCTOP}::/"{topsrcdir}"/ - -# Whack out the COMPILE.c trickiness. -/^COMPILE.c /,/^$/d - -# Remove the multido trickiness from the "all" target. -/^all \\Option-f/,/^$/c\ -all \\Option-f {TARGETLIB}\ - - -# Remove the RULE1/RULE2 crud. -/if \[/,/fi/d -/^RULE1 =/,/RULE2 =/d -/RULE2/s/RULE2/TARGETLIB/ - -# Don't want fdmatch ever. -s/ "{o}"fdmatch.c.o// - -# Fix paths to generated files. -/config.h/s/"{s}"config.h/"{o}"config.h/ - -# Whack out config rebuild rules. -/^"{o}"config.h \\Option-f/,/^$/d - - - - - - diff --git a/gnu/lib/libiberty/src/mpw.c b/gnu/lib/libiberty/src/mpw.c deleted file mode 100644 index ca3ae412d25..00000000000 --- a/gnu/lib/libiberty/src/mpw.c +++ /dev/null @@ -1,1010 +0,0 @@ -/* MPW-Unix compatibility library. - Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* This should only be compiled and linked under MPW. */ - -#include "mpw.h" - -#include <stdlib.h> - -#ifndef USE_MW_HEADERS -#include <sys/time.h> -#include <sys/resource.h> -#endif - -#include <Types.h> -#include <Files.h> - -#include <Timer.h> - -/* Initialize to 0 at first, then set to errno_max() later. */ - -int sys_nerr = 0; - -/* Debug flag for pathname hacking. Set this to one and rebuild. */ - -int DebugPI = -1; - -void -mpwify_filename(char *unixname, char *macname) -{ - int i, j; - - /* (should truncate 255 chars from end of name, not beginning) */ - if (strlen (unixname) > 255) - { - fprintf (stderr, "Pathname \"%s\" is too long for Macs, truncating\n", - unixname); - } - j = 0; - /* If you're going to end up with one or more colons in the middle of a - path after an all-Unix relative path is translated, you must add a - colon on the front, so that the first component is not thought to be - a disk name. */ - if (unixname[0] != '/' && ! strchr (unixname, ':') && strchr (unixname, '/')) - { - macname[j++] = ':'; - } - for (i = 0; unixname[i] != '\0' && i < 255; ++i) - { - if (i == 0 && unixname[i] == '/') - { - if (strncmp (unixname, "/tmp/", 5) == 0) - { - /* A temporary name, make a more Mac-flavored tmpname. */ - /* A better choice would be {Boot}Trash:foo, but - that would require being able to identify the - boot disk's and trashcan's name. Another option - would be to have an env var, so user can point it - at a ramdisk. */ - macname[j++] = ':'; - macname[j++] = 't'; - macname[j++] = 'm'; - macname[j++] = 'p'; - macname[j++] = '_'; - i += 4; - } - else - { - /* Don't copy the leading slash. */ - } - } - else if (unixname[i] == ':' && unixname[i+1] == '/') - { - macname[j++] = ':'; - i += 1; - } - else if (unixname[i] == '.' && unixname[i+1] == '/') - { - macname[j++] = ':'; - i += 1; - } - else if (unixname[i] == '.' && unixname[i+1] == '.' && unixname[i+2] == '/') - { - macname[j++] = ':'; - macname[j++] = ':'; - i += 2; - } - else if (unixname[i] == '/') - { - macname[j++] = ':'; - } - else - { - macname[j++] = unixname[i]; - } - } - macname[j] = '\0'; - /* Allow for getting the debug flag from an env var; quite useful. */ - if (DebugPI < 0) - DebugPI = (*(getenv ("DEBUG_PATHNAMES")) == '1' ? 1 : 0); - if (DebugPI) - { - fprintf (stderr, "# Made \"%s\"\n", unixname); - fprintf (stderr, "# into \"%s\"\n", macname); - } -} - -/* MPW-flavored basename finder. */ - -char * -mpw_basename (name) - char *name; -{ - char *base = name; - - while (*name) - { - if (*name++ == ':') - { - base = name; - } - } - return base; -} - -/* Mixed MPW/Unix basename finder. This can be led astray by - filenames with slashes in them and come up with a basename that - either corresponds to no file or (worse) to some other file, so - should only be tried if other methods of finding a file via a - basename have failed. */ - -char * -mpw_mixed_basename (name) - char *name; -{ - char *base = name; - - while (*name) - { - if (*name == '/' || *name == ':') - { - base = name + 1; - } - ++name; - } - return base; -} - -/* This function is fopen() modified to create files that are type TEXT - or 'BIN ', and always of type 'MPS '. */ - -FILE * -mpw_fopen (char *name, char *mode) -{ -#undef fopen - int errnum; - FILE *fp; - char tmpname[256]; - - mpwify_filename (name, tmpname); - PROGRESS (1); - fp = fopen (tmpname, mode); - errnum = errno; - - /* If writing, need to set type and creator usefully. */ - if (strchr (mode, 'w')) - { - char *pname = (char *) malloc (strlen (tmpname) + 2); - OSErr e; - struct FInfo fi; - - pname[0] = strlen (tmpname); - strcpy (pname+1, tmpname); - - e = GetFInfo ((ConstStr255Param) pname, 0, &fi); - /* should do spiffier error handling */ - if (e != 0) - fprintf(stderr, "GetFInfo returns %d\n", e); - if (strchr (mode, 'b')) - { - fi.fdType = (OSType) 'BIN '; - } - else - { - fi.fdType = (OSType) 'TEXT'; - } - fi.fdCreator = (OSType) 'MPS '; - e = SetFInfo ((ConstStr255Param) pname, 0, &fi); - if (e != 0) - fprintf(stderr, "SetFInfo returns %d\n", e); - free (pname); - } - if (fp == NULL) - errno = errnum; - return fp; -} - -/* This is a version of fseek() modified to fill the file with zeros - if seeking past the end of it. */ - -#define ZEROBLKSIZE 4096 - -char zeros[ZEROBLKSIZE]; - -int -mpw_fseek (FILE *fp, int offset, int whence) -{ -#undef fseek - int cursize, numleft; - - PROGRESS (1); - if (whence == SEEK_SET) - { - fseek (fp, 0, SEEK_END); - cursize = ftell (fp); - if (offset > cursize) - { - numleft = offset - cursize; - while (numleft > ZEROBLKSIZE) - { - /* This might fail, should check for that. */ - PROGRESS (1); - fwrite (zeros, 1, ZEROBLKSIZE, fp); - numleft -= ZEROBLKSIZE; - } - PROGRESS (1); - fwrite (zeros, 1, numleft, fp); - fflush (fp); - } - } - return fseek (fp, offset, whence); -} - -int -mpw_fread (char *ptr, int size, int nitems, FILE *stream) -{ -#undef fread - int rslt; - - PROGRESS (1); - rslt = fread (ptr, size, nitems, stream); - PROGRESS (1); - return rslt; -} - -int -mpw_fwrite (char *ptr, int size, int nitems, FILE *stream) -{ -#undef fwrite - int rslt; - - PROGRESS (1); - rslt = fwrite (ptr, size, nitems, stream); - PROGRESS (1); - return rslt; -} - -int -link () -{ - fprintf (stderr, "link not available!\n"); - mpw_abort (); -} - -int -fork () -{ - fprintf (stderr, "fork not available!\n"); - mpw_abort (); -} - -int -vfork () -{ - fprintf (stderr, "vfork not available!\n"); - mpw_abort (); - return (-1); -} - -int -pipe (int *fd) -{ - fprintf (stderr, "pipe not available!\n"); - mpw_abort (); - return (-1); -} - -#ifndef USE_MW_HEADERS -int -execvp (char *file, char **argv) -{ - fprintf (stderr, "execvp not available!\n"); - mpw_abort (); - return (-1); -} - -int -execv (char *path, char **argv) -{ - fprintf (stderr, "execv not available!\n"); - mpw_abort (); - return (-1); -} -#endif - -int -kill (int pid, int sig) -{ - fprintf (stderr, "kill not available!\n"); - mpw_abort (); - return (-1); -} - -int -wait (int *status) -{ - *status = 0; - return 0; -} - -#ifndef USE_MW_HEADERS -int -sleep (int seconds) -{ - unsigned long start_time, now; - - time (&start_time); - - while (1) - { - PROGRESS (1); - time (&now); - if (now > start_time + seconds) - return 0; - } -} -#endif - -void -putenv (char *str) -{ - /* The GCC driver calls this to do things for collect2, but we - don't care about collect2. */ -} - -int -chmod (char *path, int mode) -{ - /* Pretend it was all OK. */ - return 0; -} - -#ifndef USE_MW_HEADERS -int -getuid () -{ - /* One value is as good as another... */ - return 0; -} - -int -getgid () -{ - /* One value is as good as another... */ - return 0; -} -#endif - -/* Instead of coredumping, which is not a normal Mac facility, we - drop into Macsbug. If we then "g" from Macsbug, the program will - exit cleanly. */ - -void -mpw_abort () -{ - /* Make sure no output still buffered up, then zap into MacsBug. */ - fflush(stdout); - fflush(stderr); - printf("## Abort! ##\n"); -#ifdef MPW_SADE - SysError(8005); -#else - Debugger(); -#endif - /* "g" in MacsBug will then cause a regular error exit. */ - exit (1); -} - -/* Imitation getrusage based on the ANSI clock() function. */ - -int -getrusage (int who, struct rusage *rusage) -{ - int clk = clock (); - -#if 0 - rusage->ru_utime.tv_sec = clk / CLOCKS_PER_SEC; - rusage->ru_utime.tv_usec = ((clk * 1000) / CLOCKS_PER_SEC) * 1000; - rusage->ru_stime.tv_sec = 0; - rusage->ru_stime.tv_usec = 0; -#endif -} - -int -sbrk () -{ - return 0; -} - -#ifndef USE_MW_HEADERS -int -isatty (int fd) -{ - return 0; -} - -/* This is inherited from Timothy Murray's Posix library. */ - -#include "utime.h" - -int -utime (char *filename, struct utimbuf *times) -{ - CInfoPBRec cipbr; - HFileInfo *fpb = (HFileInfo *) &cipbr; - DirInfo *dpb = (DirInfo *) &cipbr; - unsigned char pname[256]; - short err; - - strcpy ((char *) pname, filename); - c2pstr (pname); - - dpb->ioDrDirID = 0L; - fpb->ioNamePtr = pname; - fpb->ioVRefNum = 0; - fpb->ioFDirIndex = 0; - fpb->ioFVersNum = 0; - err = PBGetCatInfo (&cipbr, 0); - if (err != noErr) { - errno = ENOENT; - return -1; - } - dpb->ioDrDirID = 0L; - fpb->ioFlMdDat = times->modtime; - fpb->ioFlCrDat = times->actime; - err = PBSetCatInfo (&cipbr, 0); - if (err != noErr) { - errno = EACCES; - return -1; - } - return 0; -} - -int -mkdir (char *path, int mode) -{ - errno = ENOSYS; - return -1; -} - -int -rmdir () -{ - errno = ENOSYS; - return -1; -} -#endif - -chown () -{ - errno = ENOSYS; - return -1; -} - -char *myenviron[] = {NULL}; - -char **environ = myenviron; - -#ifndef USE_MW_HEADERS - -/* Minimal 'stat' emulation: tells directories from files and - gives length and mtime. - - Derived from code written by Guido van Rossum, CWI, Amsterdam - and placed by him in the public domain. */ - -extern int __uid, __gid; - -int __uid = 0; -int __gid = 0; - -/* Bits in ioFlAttrib: */ -#define LOCKBIT (1<<0) /* File locked */ -#define DIRBIT (1<<4) /* It's a directory */ - -/* Macified "stat" in which filename is given relative to a directory, - specified by long DirID. */ - -static int -_stat (char *name, long dirid, struct stat *buf) -{ - CInfoPBRec cipbr; - HFileInfo *fpb = (HFileInfo*) &cipbr; - DirInfo *dpb = (DirInfo*) &cipbr; - Str255 pname; - short err; - - /* Make a temp copy of the name and pascalize. */ - strcpy ((char *) pname, name); - c2pstr (pname); - - cipbr.dirInfo.ioDrDirID = dirid; - cipbr.hFileInfo.ioNamePtr = pname; - cipbr.hFileInfo.ioVRefNum = 0; - cipbr.hFileInfo.ioFDirIndex = 0; - cipbr.hFileInfo.ioFVersNum = 0; - err = PBGetCatInfo (&cipbr, 0); - if (err != noErr) - { - errno = ENOENT; - return -1; - } - /* Mac files are readable if they can be accessed at all. */ - buf->st_mode = 0444; - /* Mark unlocked files as writeable. */ - if (!(fpb->ioFlAttrib & LOCKBIT)) - buf->st_mode |= 0222; - if (fpb->ioFlAttrib & DIRBIT) - { - /* Mark directories as "executable". */ - buf->st_mode |= 0111 | S_IFDIR; - buf->st_size = dpb->ioDrNmFls; - buf->st_rsize = 0; - } - else - { - buf->st_mode |= S_IFREG; - /* Mark apps as "executable". */ - if (fpb->ioFlFndrInfo.fdType == 'APPL') - buf->st_mode |= 0111; - /* Fill in the sizes of data and resource forks. */ - buf->st_size = fpb->ioFlLgLen; - buf->st_rsize = fpb->ioFlRLgLen; - } - /* Fill in various times. */ - buf->st_atime = fpb->ioFlCrDat; - buf->st_mtime = fpb->ioFlMdDat; - buf->st_ctime = fpb->ioFlCrDat; - /* Set up an imitation inode number. */ - buf->st_ino = (unsigned short) fpb->ioDirID; - /* Set up an imitation device. */ - GetVRefNum (buf->st_ino, &buf->st_dev); - buf->st_uid = __uid; - buf->st_gid = __gid; -/* buf->st_FlFndrInfo = fpb->ioFlFndrInfo; */ - return 0; -} - -/* stat() sets up an empty dirid. */ - -int -stat (char *path, struct stat *buf) -{ - long rslt, errnum; - char tmpname[256]; - - mpwify_filename (path, tmpname); - if (DebugPI) - fprintf (stderr, "# stat (%s, %x)", tmpname, buf); - PROGRESS (1); - rslt = _stat (tmpname, 0L, buf); - errnum = errno; - if (DebugPI) - { - fprintf (stderr, " -> %d", rslt); - if (rslt != 0) - fprintf (stderr, " (errno is %d)", errnum); - fprintf (stderr, "\n"); - fflush (stderr); - } - if (rslt != 0) - errno = errnum; - return rslt; -} - -int -fstat (int fd, struct stat *buf) -{ - FCBPBRec fcb; - FILE *fp; - Str255 pathname; - long dirid = 0L, temp; - long rslt, errnum; - short err; - - if (DebugPI < 0) - DebugPI = (*(getenv ("DEBUG_PATHNAMES")) == '1' ? 1 : 0); - if (DebugPI) - fprintf (stderr, "# fstat (%d, %x)", fd, buf); - PROGRESS (1); - pathname[0] = 0; -#ifdef FIOFNAME - /* Use an MPW-specific ioctl to get the pathname associated with - the file descriptor. */ - ioctl (fd, FIOFNAME, (long *) pathname); -#else - you lose -#endif - if (DebugPI) - fprintf (stderr, " (name is %s)", pathname); - dirid = 0L /* fcb.ioFCBParID */ ; - rslt = _stat ((char *) pathname, dirid, buf); - errnum = errno; - if (DebugPI) - { - fprintf (stderr, " -> %d", rslt); - if (rslt != 0) - fprintf (stderr, " (errno is %d)", errnum); - fprintf (stderr, "\n"); - fflush (stderr); - } - if (rslt != 0) - errno = errnum; - return rslt; -} - -#endif /* n USE_MW_HEADERS */ - -chdir () -{ - errno = ENOSYS; - return (-1); -} - -char * -getcwd (char *buf, int size) -{ - if (buf == NULL) - buf = (char *) malloc (size); - strcpy(buf, ":"); - return buf; -} - -/* This should probably be more elaborate for MPW. */ - -char * -getpwd () -{ - return ":"; -} - -int -mpw_open (char *filename, int arg2, int arg3) -{ -#undef open - int fd, errnum = 0; - char tmpname[256]; - - mpwify_filename (filename, tmpname); - fd = open (tmpname, arg2); - errnum = errno; - - if (DebugPI) - { - fprintf (stderr, "# open (%s, %d, %d)", tmpname, arg2, arg3); - fprintf (stderr, " -> %d", fd); - if (fd == -1) - fprintf (stderr, " (errno is %d)", errnum); - fprintf (stderr, "\n"); - } - if (fd == -1) - errno = errnum; - return fd; -} - -int -mpw_access (char *filename, unsigned int cmd) -{ -#undef access - - int rslt, errnum = 0; - struct stat st; - char tmpname[256]; - - mpwify_filename (filename, tmpname); - if (cmd & R_OK || cmd & X_OK) - { - rslt = stat (tmpname, &st); - errnum = errno; - if (rslt >= 0) - { - if ((((st.st_mode & 004) == 0) && (cmd & R_OK)) - || (((st.st_mode & 002) == 0) && (cmd & W_OK)) - || (((st.st_mode & 001) == 0) && (cmd & X_OK))) - { - rslt = -1; - errnum = EACCES; - } - } - } - if (DebugPI) - { - fprintf (stderr, "# mpw_access (%s, %d)", tmpname, cmd); - fprintf (stderr, " -> %d", rslt); - if (rslt != 0) - fprintf (stderr, " (errno is %d)", errnum); - fprintf (stderr, "\n"); - } - if (rslt != 0) - errno = errnum; - return rslt; -} - -/* The MPW library creat() has no mode argument. */ - -int -mpw_creat (char *path, /* mode_t */ int mode) -{ -#undef creat - -#ifdef USE_MW_HEADERS - return creat (path, mode); -#else - return creat (path); -#endif -} - -/* This is a hack to get control in an MPW tool before it crashes the - machine. */ - -mpw_special_init (name) - char *name; -{ - if (strstr (name, "DEBUG")) - DebugStr("\pat beginning of program"); -} - -static int current_umask; - -int -umask(int mask) -{ - int oldmask = current_umask; - - current_umask = mask; - return oldmask; -} - -/* Cursor-spinning stuff that includes metering of spin rate and delays. */ - -/* Nonzero when cursor spinning has been set up properly. */ - -int cursor_inited; - -/* Nonzero if spin should be measured and excessive delays reported. */ - -int measure_spin; - -/* Nonzero if spin histogram and rate data should be written out. */ - -int dump_spin_data; - -long warning_threshold = 400000; - -long bucket_size = 1024; - -long bucket_power = 10; - -long numbuckets = 300; - -int *delay_counts; - -int overflow_count; - -char *current_progress; - -static UnsignedWide last_microseconds; - -static char *last_spin_file = ""; - -static int last_spin_line; - -void -warn_if_spin_delay (char *file, int line) -{ - long diff, ix; - UnsignedWide now; - - Microseconds(&now); - - diff = now.lo - last_microseconds.lo; - - if (diff > warning_threshold) - fprintf (stderr, "# %s: %ld.%06ld sec delay getting from %s:%d to %s:%d\n", - (current_progress ? current_progress : ""), - diff / 1000000, diff % 1000000, - last_spin_file, last_spin_line, file, line); - if (dump_spin_data) - { - if (diff >= 0) - { - ix = diff >> bucket_power; - if (ix >= 0 && ix < numbuckets && delay_counts != NULL) - ++delay_counts[ix]; - else - ++overflow_count; - } - else - fprintf (stderr, "raw diff is %ld (?)\n", diff); - } -} - -void -record_for_spin_delay (char *file, int line) -{ - Microseconds (&last_microseconds); - last_spin_file = file; - last_spin_line = line; -} - -void -mpw_start_progress (char *str, int n, char *file, int line) -{ - int i; - char *measure, *threshold; - - if (!cursor_inited) - { - InitCursorCtl (nil); - cursor_inited = 1; - record_for_spin_delay (file, line); - measure = getenv ("MEASURE_SPIN"); - if (measure != NULL && measure[0] != '\0') - { - measure_spin = 1; - if (strcmp (measure, "all") == 0) - dump_spin_data = 1; - } - threshold = getenv ("SPIN_WARN_THRESHOLD"); - if (threshold != NULL && threshold[0] != '\0') - warning_threshold = atol (threshold); - if (dump_spin_data) - { - if (delay_counts == NULL) - delay_counts = (int *) malloc (numbuckets * sizeof (int)); - for (i = 0; i < numbuckets; ++i) - delay_counts[i] = 0; - overflow_count = 0; - } - } - current_progress = str; - - sys_nerr = errno_max (); - - mpw_special_init (str); -} - -void -mpw_progress (int n) -{ - SpinCursor (32); -} - -void -mpw_progress_measured (int n, char *file, int line) -{ - if (measure_spin) - warn_if_spin_delay (file, line); - SpinCursor (32); - if (measure_spin) - record_for_spin_delay (file, line); -} - -void -mpw_end_progress (char *str, char *file, int line) -{ - long i, delay, count = 0, sum = 0, avgdelay, spinrate; - long curpower = 0, curgroup = 0; - - /* Warn if it's been a while since the last spin. */ - if (measure_spin) - warn_if_spin_delay (file, line); - - /* Dump all the nonzero delay counts and an approximation of the delay. */ - if (dump_spin_data && delay_counts != NULL) - { - for (i = 0; i < numbuckets; ++i) - { - delay = (i + 1) * bucket_size; - sum += delay_counts[i] * (i + 1); - count += delay_counts[i]; - if (delay <= (1 << curpower)) - { - curgroup += delay_counts[i]; - } - else - { - if (curgroup > 0) - fprintf (stderr, - "# %s: %d delays between %ld.%06ld and %ld.%06ld sec\n", - (str ? str : ""), - curgroup, - (1 << curpower) / 1000000, - (1 << curpower) % 1000000, - (1 << (curpower + 1)) / 1000000, - (1 << (curpower + 1)) % 1000000); - ++curpower; - curgroup = 0; - } - } - if (count > 0) - { - avgdelay = (sum * bucket_size) / count; - spinrate = 1000000 / avgdelay; - fprintf (stderr, "# %s: Average spin rate is %d times/sec\n", - (str ? str : ""), spinrate); - } - } -} - -#ifdef PROGRESS_TEST - -/* Test program. */ - -main () -{ - int i, j; - double x = 1.0, y = 2.4; - long start = Microseconds (), tm; FIXME - - START_PROGRESS ("hi", 0); - - for (i = 0; i < 1000; ++i) - { - PROGRESS (1); - - for (j = 0; j < (i * 100); ++j) - { - x += (x * y) / j; - } - } - - END_PROGRESS ("hi"); - - tm = Microseconds () - start; - - printf ("Total time is %d.%d secs\n", tm / 1000000, tm % 1000000); -} - -#endif - -#ifdef USE_MW_HEADERS -/* Empty definitions for Metrowerks' SIOUX console library. */ - -#ifndef __CONSOLE__ -#include <console.h> -#endif - -short -InstallConsole(short fd) -{ -#pragma unused (fd) - return 0; -} - -void -RemoveConsole(void) -{ -} - -long -WriteCharsToConsole(char *buf, long n) -{ -#pragma unused (buf, n) - return 0; -} - -long ReadCharsFromConsole(char *buf, long n) -{ -#pragma unused (buf, n) - return 0; -} - -extern char * -__ttyname(long fd) -{ - static char *__devicename = "null device"; - - if (fd >= 0 && fd <= 2) - return (__devicename); - return NULL; -} - -#endif diff --git a/gnu/lib/libiberty/src/objalloc.c b/gnu/lib/libiberty/src/objalloc.c index 50995691e33..3ddac2ce4cb 100644 --- a/gnu/lib/libiberty/src/objalloc.c +++ b/gnu/lib/libiberty/src/objalloc.c @@ -14,11 +14,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +Foundation, 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ -#include "ansidecl.h" #include "config.h" +#include "ansidecl.h" #include "objalloc.h" @@ -30,17 +30,15 @@ Boston, MA 02111-1307, USA. */ #include <unixlib.h> #else -#ifdef ANSI_PROTOTYPES /* Get a definition for size_t. */ #include <stddef.h> -#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #else /* For systems with larger pointers than ints, this must be declared. */ -extern PTR malloc PARAMS ((size_t)); -extern void free PARAMS ((PTR)); +extern PTR malloc (size_t); +extern void free (PTR); #endif #endif @@ -85,7 +83,7 @@ struct objalloc_chunk /* Create an objalloc structure. */ struct objalloc * -objalloc_create () +objalloc_create (void) { struct objalloc *ret; struct objalloc_chunk *chunk; @@ -114,9 +112,7 @@ objalloc_create () /* Allocate space from an objalloc structure. */ PTR -_objalloc_alloc (o, len) - struct objalloc *o; - unsigned long len; +_objalloc_alloc (struct objalloc *o, unsigned long len) { /* We avoid confusion from zero sized objects by always allocating at least 1 byte. */ @@ -171,8 +167,7 @@ _objalloc_alloc (o, len) /* Free an entire objalloc structure. */ void -objalloc_free (o) - struct objalloc *o; +objalloc_free (struct objalloc *o) { struct objalloc_chunk *l; @@ -193,9 +188,7 @@ objalloc_free (o) recently allocated blocks. */ void -objalloc_free_block (o, block) - struct objalloc *o; - PTR block; +objalloc_free_block (struct objalloc *o, PTR block) { struct objalloc_chunk *p, *small; char *b = (char *) block; diff --git a/gnu/lib/libiberty/src/partition.c b/gnu/lib/libiberty/src/partition.c index 07154722079..5f0745c9142 100644 --- a/gnu/lib/libiberty/src/partition.c +++ b/gnu/lib/libiberty/src/partition.c @@ -16,8 +16,8 @@ You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -34,14 +34,13 @@ #include "libiberty.h" #include "partition.h" -static int elem_compare PARAMS ((const void *, const void *)); +static int elem_compare (const void *, const void *); /* Creates a partition of NUM_ELEMENTS elements. Initially each element is in a class by itself. */ partition -partition_new (num_elements) - int num_elements; +partition_new (int num_elements) { int e; @@ -62,8 +61,7 @@ partition_new (num_elements) /* Freeds a partition. */ void -partition_delete (part) - partition part; +partition_delete (partition part) { free (part); } @@ -74,10 +72,7 @@ partition_delete (part) resulting union class. */ int -partition_union (part, elem1, elem2) - partition part; - int elem1; - int elem2; +partition_union (partition part, int elem1, int elem2) { struct partition_elem *elements = part->elements; struct partition_elem *e1; @@ -126,9 +121,7 @@ partition_union (part, elem1, elem2) pointer to each. Used to qsort such an array. */ static int -elem_compare (elem1, elem2) - const void *elem1; - const void *elem2; +elem_compare (const void *elem1, const void *elem2) { int e1 = * (const int *) elem1; int e2 = * (const int *) elem2; @@ -144,9 +137,7 @@ elem_compare (elem1, elem2) class are sorted. */ void -partition_print (part, fp) - partition part; - FILE *fp; +partition_print (partition part, FILE *fp) { char *done; int num_elements = part->num_elements; @@ -186,6 +177,7 @@ partition_print (part, fp) } fputc (']', fp); + free (class_elements); free (done); } diff --git a/gnu/lib/libiberty/src/pex-common.c b/gnu/lib/libiberty/src/pex-common.c deleted file mode 100644 index ebe8c437590..00000000000 --- a/gnu/lib/libiberty/src/pex-common.c +++ /dev/null @@ -1,575 +0,0 @@ -/* Common code for executing a program in a sub-process. - Copyright (C) 2005 Free Software Foundation, Inc. - Written by Ian Lance Taylor <ian@airs.com>. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, -Boston, MA 02110-1301, USA. */ - -#include "config.h" -#include "libiberty.h" -#include "pex-common.h" - -#include <stdio.h> -#include <errno.h> -#ifdef NEED_DECLARATION_ERRNO -extern int errno; -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -extern int mkstemps (char *, int); - -/* This file contains subroutines for the program execution routines - (pex_init, pex_run, etc.). This file is compiled on all - systems. */ - -static void pex_add_remove (struct pex_obj *, const char *, int); -static int pex_get_status_and_time (struct pex_obj *, int, const char **, - int *); - -/* Initialize a pex_obj structure. */ - -struct pex_obj * -pex_init_common (int flags, const char *pname, const char *tempbase, - const struct pex_funcs *funcs) -{ - struct pex_obj *obj; - - obj = XNEW (struct pex_obj); - obj->flags = flags; - obj->pname = pname; - obj->tempbase = tempbase; - obj->next_input = STDIN_FILE_NO; - obj->next_input_name = NULL; - obj->next_input_name_allocated = 0; - obj->count = 0; - obj->children = NULL; - obj->status = NULL; - obj->time = NULL; - obj->number_waited = 0; - obj->input_file = NULL; - obj->read_output = NULL; - obj->remove_count = 0; - obj->remove = NULL; - obj->funcs = funcs; - obj->sysdep = NULL; - return obj; -} - -/* Add a file to be removed when we are done. */ - -static void -pex_add_remove (struct pex_obj *obj, const char *name, int allocated) -{ - char *add; - - ++obj->remove_count; - obj->remove = XRESIZEVEC (char *, obj->remove, obj->remove_count); - if (allocated) - add = (char *) name; - else - add = xstrdup (name); - obj->remove[obj->remove_count - 1] = add; -} - -/* Generate a temporary file name based on OBJ, FLAGS, and NAME. - Return NULL if we were unable to reserve a temporary filename. - - If non-NULL, the result is either allocated with malloc, or the - same pointer as NAME. */ -static char * -temp_file (struct pex_obj *obj, int flags, char *name) -{ - if (name == NULL) - { - if (obj->tempbase == NULL) - { - name = make_temp_file (NULL); - } - else - { - int len = strlen (obj->tempbase); - int out; - - if (len >= 6 - && strcmp (obj->tempbase + len - 6, "XXXXXX") == 0) - name = xstrdup (obj->tempbase); - else - name = concat (obj->tempbase, "XXXXXX", NULL); - - out = mkstemps (name, 0); - if (out < 0) - { - free (name); - return NULL; - } - - /* This isn't obj->funcs->close because we got the - descriptor from mkstemps, not from a function in - obj->funcs. Calling close here is just like what - make_temp_file does. */ - close (out); - } - } - else if ((flags & PEX_SUFFIX) != 0) - { - if (obj->tempbase == NULL) - name = make_temp_file (name); - else - name = concat (obj->tempbase, name, NULL); - } - - return name; -} - -/* Run a program. */ - -const char * -pex_run (struct pex_obj *obj, int flags, const char *executable, - char * const * argv, const char *orig_outname, const char *errname, - int *err) -{ - const char *errmsg; - int in, out, errdes; - char *outname; - int outname_allocated; - int p[2]; - long pid; - - in = -1; - out = -1; - errdes = -1; - outname = (char *) orig_outname; - outname_allocated = 0; - - /* If the user called pex_input_file, close the file now. */ - if (obj->input_file) - { - if (fclose (obj->input_file) == EOF) - { - errmsg = "closing pipeline input file"; - goto error_exit; - } - obj->input_file = NULL; - } - - /* Set IN. */ - - if (obj->next_input_name != NULL) - { - /* We have to make sure that the previous process has completed - before we try to read the file. */ - if (!pex_get_status_and_time (obj, 0, &errmsg, err)) - goto error_exit; - - in = obj->funcs->open_read (obj, obj->next_input_name, - (flags & PEX_BINARY_INPUT) != 0); - if (in < 0) - { - *err = errno; - errmsg = "open temporary file"; - goto error_exit; - } - if (obj->next_input_name_allocated) - { - free (obj->next_input_name); - obj->next_input_name_allocated = 0; - } - obj->next_input_name = NULL; - } - else - { - in = obj->next_input; - if (in < 0) - { - *err = 0; - errmsg = "pipeline already complete"; - goto error_exit; - } - } - - /* Set OUT and OBJ->NEXT_INPUT/OBJ->NEXT_INPUT_NAME. */ - - if ((flags & PEX_LAST) != 0) - { - if (outname == NULL) - out = STDOUT_FILE_NO; - else if ((flags & PEX_SUFFIX) != 0) - { - outname = concat (obj->tempbase, outname, NULL); - outname_allocated = 1; - } - obj->next_input = -1; - } - else if ((obj->flags & PEX_USE_PIPES) == 0) - { - outname = temp_file (obj, flags, outname); - if (! outname) - { - *err = 0; - errmsg = "could not create temporary file"; - goto error_exit; - } - - if (outname != orig_outname) - outname_allocated = 1; - - if ((obj->flags & PEX_SAVE_TEMPS) == 0) - { - pex_add_remove (obj, outname, outname_allocated); - outname_allocated = 0; - } - - /* Hand off ownership of outname to the next stage. */ - obj->next_input_name = outname; - obj->next_input_name_allocated = outname_allocated; - outname_allocated = 0; - } - else - { - if (obj->funcs->pipe (obj, p, (flags & PEX_BINARY_OUTPUT) != 0) < 0) - { - *err = errno; - errmsg = "pipe"; - goto error_exit; - } - - out = p[WRITE_PORT]; - obj->next_input = p[READ_PORT]; - } - - if (out < 0) - { - out = obj->funcs->open_write (obj, outname, - (flags & PEX_BINARY_OUTPUT) != 0); - if (out < 0) - { - *err = errno; - errmsg = "open temporary output file"; - goto error_exit; - } - } - - if (outname_allocated) - { - free (outname); - outname_allocated = 0; - } - - /* Set ERRDES. */ - - if (errname == NULL) - errdes = STDERR_FILE_NO; - else - { - /* We assume that stderr is in text mode--it certainly shouldn't - be controlled by PEX_BINARY_OUTPUT. If necessary, we can add - a PEX_BINARY_STDERR flag. */ - errdes = obj->funcs->open_write (obj, errname, 0); - if (errdes < 0) - { - *err = errno; - errmsg = "open error file"; - goto error_exit; - } - } - - /* Run the program. */ - - pid = obj->funcs->exec_child (obj, flags, executable, argv, in, out, errdes, - &errmsg, err); - if (pid < 0) - goto error_exit; - - ++obj->count; - obj->children = XRESIZEVEC (long, obj->children, obj->count); - obj->children[obj->count - 1] = pid; - - return NULL; - - error_exit: - if (in >= 0 && in != STDIN_FILE_NO) - obj->funcs->close (obj, in); - if (out >= 0 && out != STDOUT_FILE_NO) - obj->funcs->close (obj, out); - if (errdes >= 0 && errdes != STDERR_FILE_NO) - obj->funcs->close (obj, errdes); - if (outname_allocated) - free (outname); - return errmsg; -} - -/* Return a FILE pointer for a temporary file to fill with input for - the pipeline. */ -FILE * -pex_input_file (struct pex_obj *obj, int flags, const char *in_name) -{ - char *name = (char *) in_name; - FILE *f; - - /* This must be called before the first pipeline stage is run, and - there must not have been any other input selected. */ - if (obj->count != 0 - || (obj->next_input >= 0 && obj->next_input != STDIN_FILE_NO) - || obj->next_input_name) - { - errno = EINVAL; - return NULL; - } - - name = temp_file (obj, flags, name); - if (! name) - return NULL; - - f = fopen (name, (flags & PEX_BINARY_OUTPUT) ? "wb" : "w"); - if (! f) - { - free (name); - return NULL; - } - - obj->input_file = f; - obj->next_input_name = name; - obj->next_input_name_allocated = (name != in_name); - - return f; -} - -/* Return a stream for a pipe connected to the standard input of the - first stage of the pipeline. */ -FILE * -pex_input_pipe (struct pex_obj *obj, int binary) -{ - int p[2]; - FILE *f; - - /* You must call pex_input_pipe before the first pex_run or pex_one. */ - if (obj->count > 0) - goto usage_error; - - /* You must be using pipes. Implementations that don't support - pipes clear this flag before calling pex_init_common. */ - if (! (obj->flags & PEX_USE_PIPES)) - goto usage_error; - - /* If we have somehow already selected other input, that's a - mistake. */ - if ((obj->next_input >= 0 && obj->next_input != STDIN_FILE_NO) - || obj->next_input_name) - goto usage_error; - - if (obj->funcs->pipe (obj, p, binary != 0) < 0) - return NULL; - - f = obj->funcs->fdopenw (obj, p[WRITE_PORT], binary != 0); - if (! f) - { - int saved_errno = errno; - obj->funcs->close (obj, p[READ_PORT]); - obj->funcs->close (obj, p[WRITE_PORT]); - errno = saved_errno; - return NULL; - } - - obj->next_input = p[READ_PORT]; - - return f; - - usage_error: - errno = EINVAL; - return NULL; -} - -/* Return a FILE pointer for the output of the last program - executed. */ - -FILE * -pex_read_output (struct pex_obj *obj, int binary) -{ - if (obj->next_input_name != NULL) - { - const char *errmsg; - int err; - - /* We have to make sure that the process has completed before we - try to read the file. */ - if (!pex_get_status_and_time (obj, 0, &errmsg, &err)) - { - errno = err; - return NULL; - } - - obj->read_output = fopen (obj->next_input_name, binary ? "rb" : "r"); - - if (obj->next_input_name_allocated) - { - free (obj->next_input_name); - obj->next_input_name_allocated = 0; - } - obj->next_input_name = NULL; - } - else - { - int o; - - o = obj->next_input; - if (o < 0 || o == STDIN_FILE_NO) - return NULL; - obj->read_output = obj->funcs->fdopenr (obj, o, binary); - obj->next_input = -1; - } - - return obj->read_output; -} - -/* Get the exit status and, if requested, the resource time for all - the child processes. Return 0 on failure, 1 on success. */ - -static int -pex_get_status_and_time (struct pex_obj *obj, int done, const char **errmsg, - int *err) -{ - int ret; - int i; - - if (obj->number_waited == obj->count) - return 1; - - obj->status = XRESIZEVEC (int, obj->status, obj->count); - if ((obj->flags & PEX_RECORD_TIMES) != 0) - obj->time = XRESIZEVEC (struct pex_time, obj->time, obj->count); - - ret = 1; - for (i = obj->number_waited; i < obj->count; ++i) - { - if (obj->funcs->wait (obj, obj->children[i], &obj->status[i], - obj->time == NULL ? NULL : &obj->time[i], - done, errmsg, err) < 0) - ret = 0; - } - obj->number_waited = i; - - return ret; -} - -/* Get exit status of executed programs. */ - -int -pex_get_status (struct pex_obj *obj, int count, int *vector) -{ - if (obj->status == NULL) - { - const char *errmsg; - int err; - - if (!pex_get_status_and_time (obj, 0, &errmsg, &err)) - return 0; - } - - if (count > obj->count) - { - memset (vector + obj->count, 0, (count - obj->count) * sizeof (int)); - count = obj->count; - } - - memcpy (vector, obj->status, count * sizeof (int)); - - return 1; -} - -/* Get process times of executed programs. */ - -int -pex_get_times (struct pex_obj *obj, int count, struct pex_time *vector) -{ - if (obj->status == NULL) - { - const char *errmsg; - int err; - - if (!pex_get_status_and_time (obj, 0, &errmsg, &err)) - return 0; - } - - if (obj->time == NULL) - return 0; - - if (count > obj->count) - { - memset (vector + obj->count, 0, - (count - obj->count) * sizeof (struct pex_time)); - count = obj->count; - } - - memcpy (vector, obj->time, count * sizeof (struct pex_time)); - - return 1; -} - -/* Free a pex_obj structure. */ - -void -pex_free (struct pex_obj *obj) -{ - if (obj->next_input >= 0 && obj->next_input != STDIN_FILE_NO) - obj->funcs->close (obj, obj->next_input); - - /* If the caller forgot to wait for the children, we do it here, to - avoid zombies. */ - if (obj->status == NULL) - { - const char *errmsg; - int err; - - obj->flags &= ~ PEX_RECORD_TIMES; - pex_get_status_and_time (obj, 1, &errmsg, &err); - } - - if (obj->next_input_name_allocated) - free (obj->next_input_name); - if (obj->children != NULL) - free (obj->children); - if (obj->status != NULL) - free (obj->status); - if (obj->time != NULL) - free (obj->time); - if (obj->read_output != NULL) - fclose (obj->read_output); - - if (obj->remove_count > 0) - { - int i; - - for (i = 0; i < obj->remove_count; ++i) - { - remove (obj->remove[i]); - free (obj->remove[i]); - } - free (obj->remove); - } - - if (obj->funcs->cleanup != NULL) - obj->funcs->cleanup (obj); - - free (obj); -} diff --git a/gnu/lib/libiberty/src/pex-common.h b/gnu/lib/libiberty/src/pex-common.h deleted file mode 100644 index da2f71e1247..00000000000 --- a/gnu/lib/libiberty/src/pex-common.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Utilities to execute a program in a subprocess (possibly linked by pipes - with other subprocesses), and wait for it. Shared logic. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 - Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifndef PEX_COMMON_H -#define PEX_COMMON_H - -#include "config.h" -#include "libiberty.h" - -#define install_error_msg "installation problem, cannot exec `%s'" - -/* stdin file number. */ -#define STDIN_FILE_NO 0 - -/* stdout file number. */ -#define STDOUT_FILE_NO 1 - -/* value of `pipe': port index for reading. */ -#define READ_PORT 0 - -/* value of `pipe': port index for writing. */ -#define WRITE_PORT 1 - -#endif diff --git a/gnu/lib/libiberty/src/pex-djgpp.c b/gnu/lib/libiberty/src/pex-djgpp.c deleted file mode 100644 index 968e7841215..00000000000 --- a/gnu/lib/libiberty/src/pex-djgpp.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Utilities to execute a program in a subprocess (possibly linked by pipes - with other subprocesses), and wait for it. DJGPP specialization. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 - Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "pex-common.h" - -#include <stdio.h> -#include <errno.h> -#ifdef NEED_DECLARATION_ERRNO -extern int errno; -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#include <process.h> - -/* Use ECHILD if available, otherwise use EINVAL. */ -#ifdef ECHILD -#define PWAIT_ERROR ECHILD -#else -#define PWAIT_ERROR EINVAL -#endif - -/* MSDOS doesn't multitask, but for the sake of a consistent interface - the code behaves like it does. pexecute runs the program, tucks the - exit code away, and returns a "pid". pwait must be called to fetch the - exit code. */ - -/* For communicating information from pexecute to pwait. */ -static int last_pid = 0; -static int last_status = 0; -static int last_reaped = 0; - -int -pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) - const char *program; - char * const *argv; - const char *this_pname; - const char *temp_base; - char **errmsg_fmt, **errmsg_arg; - int flags; -{ - int rc; - - last_pid++; - if (last_pid < 0) - last_pid = 1; - - if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) - abort (); - - /* ??? What are the possible return values from spawnv? */ - rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv); - - if (rc == -1) - { - *errmsg_fmt = install_error_msg; - *errmsg_arg = (char *)program; - return -1; - } - - /* Tuck the status away for pwait, and return a "pid". */ - last_status = rc << 8; - return last_pid; -} - -int -pwait (pid, status, flags) - int pid; - int *status; - int flags; -{ - /* On MSDOS each pexecute must be followed by its associated pwait. */ - if (pid != last_pid - /* Called twice for the same child? */ - || pid == last_reaped) - { - errno = PWAIT_ERROR; - return -1; - } - /* ??? Here's an opportunity to canonicalize the values in STATUS. - Needed? */ - *status = (last_status >> 8); - last_reaped = last_pid; - return last_pid; -} diff --git a/gnu/lib/libiberty/src/pex-mpw.c b/gnu/lib/libiberty/src/pex-mpw.c deleted file mode 100644 index 9a8879c9b27..00000000000 --- a/gnu/lib/libiberty/src/pex-mpw.c +++ /dev/null @@ -1,161 +0,0 @@ -/* Utilities to execute a program in a subprocess (possibly linked by pipes - with other subprocesses), and wait for it. MPW specialization. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 - Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "pex-common.h" - -#include <stdio.h> -#ifdef HAVE_STRING_H -#include <string.h> -#endif - -/* MPW pexecute doesn't actually run anything; instead, it writes out - script commands that, when run, will do the actual executing. - - For example, in GCC's case, GCC will write out several script commands: - - cpp ... - cc1 ... - as ... - ld ... - - and then exit. None of the above programs will have run yet. The task - that called GCC will then execute the script and cause cpp,etc. to run. - The caller must invoke pfinish before calling exit. This adds - the finishing touches to the generated script. */ - -static int first_time = 1; - -extern void mpwify_filename PARAMS ((const char *, char *)); - -int -pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) - const char *program; - char * const *argv; - const char *this_pname; - const char *temp_base; - char **errmsg_fmt, **errmsg_arg; - int flags; -{ - char tmpprogram[255]; - char *cp, *tmpname; - int i; - - mpwify_filename (program, tmpprogram); - if (first_time) - { - printf ("Set Failed 0\n"); - first_time = 0; - } - - fputs ("If {Failed} == 0\n", stdout); - /* If being verbose, output a copy of the command. It should be - accurate enough and escaped enough to be "clickable". */ - if (flags & PEXECUTE_VERBOSE) - { - fputs ("\tEcho ", stdout); - fputc ('\'', stdout); - fputs (tmpprogram, stdout); - fputc ('\'', stdout); - fputc (' ', stdout); - for (i=1; argv[i]; i++) - { - fputc ('\'', stdout); - /* See if we have an argument that needs fixing. */ - if (strchr(argv[i], '/')) - { - tmpname = (char *) xmalloc (256); - mpwify_filename (argv[i], tmpname); - argv[i] = tmpname; - } - for (cp = argv[i]; *cp; cp++) - { - /* Write an Option-d escape char in front of special chars. */ - if (strchr("'+", *cp)) - fputc ('\266', stdout); - fputc (*cp, stdout); - } - fputc ('\'', stdout); - fputc (' ', stdout); - } - fputs ("\n", stdout); - } - fputs ("\t", stdout); - fputs (tmpprogram, stdout); - fputc (' ', stdout); - - for (i=1; argv[i]; i++) - { - /* See if we have an argument that needs fixing. */ - if (strchr(argv[i], '/')) - { - tmpname = (char *) xmalloc (256); - mpwify_filename (argv[i], tmpname); - argv[i] = tmpname; - } - if (strchr (argv[i], ' ')) - fputc ('\'', stdout); - for (cp = argv[i]; *cp; cp++) - { - /* Write an Option-d escape char in front of special chars. */ - if (strchr("'+", *cp)) - fputc ('\266', stdout); - fputc (*cp, stdout); - } - if (strchr (argv[i], ' ')) - fputc ('\'', stdout); - fputc (' ', stdout); - } - - fputs ("\n", stdout); - - /* Output commands that arrange to clean up and exit if a failure occurs. - We have to be careful to collect the status from the program that was - run, rather than some other script command. Also, we don't exit - immediately, since necessary cleanups are at the end of the script. */ - fputs ("\tSet TmpStatus {Status}\n", stdout); - fputs ("\tIf {TmpStatus} != 0\n", stdout); - fputs ("\t\tSet Failed {TmpStatus}\n", stdout); - fputs ("\tEnd\n", stdout); - fputs ("End\n", stdout); - - /* We're just composing a script, can't fail here. */ - return 0; -} - -int -pwait (pid, status, flags) - int pid; - int *status; - int flags; -{ - *status = 0; - return 0; -} - -/* Write out commands that will exit with the correct error code - if something in the script failed. */ - -void -pfinish () -{ - printf ("\tExit \"{Failed}\"\n"); -} - diff --git a/gnu/lib/libiberty/src/pex-msdos.c b/gnu/lib/libiberty/src/pex-msdos.c deleted file mode 100644 index d61c129b97f..00000000000 --- a/gnu/lib/libiberty/src/pex-msdos.c +++ /dev/null @@ -1,147 +0,0 @@ -/* Utilities to execute a program in a subprocess (possibly linked by pipes - with other subprocesses), and wait for it. Generic MSDOS specialization. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 - Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "pex-common.h" - -#include <stdio.h> -#include <errno.h> -#ifdef NEED_DECLARATION_ERRNO -extern int errno; -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#include "safe-ctype.h" -#include <process.h> - -/* MSDOS doesn't multitask, but for the sake of a consistent interface - the code behaves like it does. pexecute runs the program, tucks the - exit code away, and returns a "pid". pwait must be called to fetch the - exit code. */ - -/* For communicating information from pexecute to pwait. */ -static int last_pid = 0; -static int last_status = 0; -static int last_reaped = 0; - -int -pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) - const char *program; - char * const *argv; - const char *this_pname; - const char *temp_base; - char **errmsg_fmt, **errmsg_arg; - int flags; -{ - int rc; - char *scmd, *rf; - FILE *argfile; - int i, el = flags & PEXECUTE_SEARCH ? 4 : 0; - - last_pid++; - if (last_pid < 0) - last_pid = 1; - - if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) - abort (); - - if (temp_base == 0) - temp_base = choose_temp_base (); - scmd = (char *) xmalloc (strlen (program) + strlen (temp_base) + 6 + el); - rf = scmd + strlen(program) + 2 + el; - sprintf (scmd, "%s%s @%s.gp", program, - (flags & PEXECUTE_SEARCH ? ".exe" : ""), temp_base); - argfile = fopen (rf, "w"); - if (argfile == 0) - { - int errno_save = errno; - free (scmd); - errno = errno_save; - *errmsg_fmt = "cannot open `%s.gp'"; - *errmsg_arg = temp_base; - return -1; - } - - for (i=1; argv[i]; i++) - { - char *cp; - for (cp = argv[i]; *cp; cp++) - { - if (*cp == '"' || *cp == '\'' || *cp == '\\' || ISSPACE (*cp)) - fputc ('\\', argfile); - fputc (*cp, argfile); - } - fputc ('\n', argfile); - } - fclose (argfile); - - rc = system (scmd); - - { - int errno_save = errno; - remove (rf); - free (scmd); - errno = errno_save; - } - - if (rc == -1) - { - *errmsg_fmt = install_error_msg; - *errmsg_arg = (char *)program; - return -1; - } - - /* Tuck the status away for pwait, and return a "pid". */ - last_status = rc << 8; - return last_pid; -} - -/* Use ECHILD if available, otherwise use EINVAL. */ -#ifdef ECHILD -#define PWAIT_ERROR ECHILD -#else -#define PWAIT_ERROR EINVAL -#endif - -int -pwait (pid, status, flags) - int pid; - int *status; - int flags; -{ - /* On MSDOS each pexecute must be followed by its associated pwait. */ - if (pid != last_pid - /* Called twice for the same child? */ - || pid == last_reaped) - { - errno = PWAIT_ERROR; - return -1; - } - /* ??? Here's an opportunity to canonicalize the values in STATUS. - Needed? */ - *status = last_status; - last_reaped = last_pid; - return last_pid; -} diff --git a/gnu/lib/libiberty/src/pex-one.c b/gnu/lib/libiberty/src/pex-one.c deleted file mode 100644 index 696b8bcc62a..00000000000 --- a/gnu/lib/libiberty/src/pex-one.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Execute a program and wait for a result. - Copyright (C) 2005 Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, -Boston, MA 02110-1301, USA. */ - -#include "config.h" -#include "libiberty.h" - -const char * -pex_one (int flags, const char *executable, char * const *argv, - const char *pname, const char *outname, const char *errname, - int *status, int *err) -{ - struct pex_obj *obj; - const char *errmsg; - - obj = pex_init (0, pname, NULL); - errmsg = pex_run (obj, flags, executable, argv, outname, errname, err); - if (errmsg == NULL) - { - if (!pex_get_status (obj, 1, status)) - { - *err = 0; - errmsg = "pex_get_status failed"; - } - } - pex_free (obj); - return errmsg; -} diff --git a/gnu/lib/libiberty/src/pex-os2.c b/gnu/lib/libiberty/src/pex-os2.c deleted file mode 100644 index d9eacf1f8f3..00000000000 --- a/gnu/lib/libiberty/src/pex-os2.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Utilities to execute a program in a subprocess (possibly linked by pipes - with other subprocesses), and wait for it. OS/2 specialization. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 - Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "pex-common.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif - -/* ??? Does OS2 have process.h? */ -extern int spawnv (); -extern int spawnvp (); - -int -pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) - const char *program; - char * const *argv; - const char *this_pname; - const char *temp_base; - char **errmsg_fmt, **errmsg_arg; - int flags; -{ - int pid; - - if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) - abort (); - /* ??? Presumably 1 == _P_NOWAIT. */ - pid = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv); - if (pid == -1) - { - *errmsg_fmt = install_error_msg; - *errmsg_arg = program; - return -1; - } - return pid; -} - -int -pwait (pid, status, flags) - int pid; - int *status; - int flags; -{ - /* ??? Here's an opportunity to canonicalize the values in STATUS. - Needed? */ - int pid = wait (status); - return pid; -} diff --git a/gnu/lib/libiberty/src/pex-unix.c b/gnu/lib/libiberty/src/pex-unix.c deleted file mode 100644 index 14fe71ed09c..00000000000 --- a/gnu/lib/libiberty/src/pex-unix.c +++ /dev/null @@ -1,166 +0,0 @@ -/* Utilities to execute a program in a subprocess (possibly linked by pipes - with other subprocesses), and wait for it. Generic Unix version - (also used for UWIN and VMS). - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 - Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "pex-common.h" - -#include <stdio.h> -#include <errno.h> -#ifdef NEED_DECLARATION_ERRNO -extern int errno; -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif - -#ifndef HAVE_WAITPID -#define waitpid(pid, status, flags) wait(status) -#endif - -extern int execv (); -extern int execvp (); - -int -pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) - const char *program; - char * const *argv; - const char *this_pname; - const char *temp_base ATTRIBUTE_UNUSED; - char **errmsg_fmt, **errmsg_arg; - int flags; -{ - int (*func)() = (flags & PEXECUTE_SEARCH ? execvp : execv); - int pid; - int pdes[2]; - int input_desc, output_desc; - int retries, sleep_interval; - /* Pipe waiting from last process, to be used as input for the next one. - Value is STDIN_FILE_NO if no pipe is waiting - (i.e. the next command is the first of a group). */ - static int last_pipe_input; - - /* If this is the first process, initialize. */ - if (flags & PEXECUTE_FIRST) - last_pipe_input = STDIN_FILE_NO; - - input_desc = last_pipe_input; - - /* If this isn't the last process, make a pipe for its output, - and record it as waiting to be the input to the next process. */ - if (! (flags & PEXECUTE_LAST)) - { - if (pipe (pdes) < 0) - { - *errmsg_fmt = "pipe"; - *errmsg_arg = NULL; - return -1; - } - output_desc = pdes[WRITE_PORT]; - last_pipe_input = pdes[READ_PORT]; - } - else - { - /* Last process. */ - output_desc = STDOUT_FILE_NO; - last_pipe_input = STDIN_FILE_NO; - } - - /* Fork a subprocess; wait and retry if it fails. */ - sleep_interval = 1; - pid = -1; - for (retries = 0; retries < 4; retries++) - { - pid = fork (); - if (pid >= 0) - break; - sleep (sleep_interval); - sleep_interval *= 2; - } - - switch (pid) - { - case -1: - *errmsg_fmt = "fork"; - *errmsg_arg = NULL; - return -1; - - case 0: /* child */ - /* Move the input and output pipes into place, if necessary. */ - if (input_desc != STDIN_FILE_NO) - { - close (STDIN_FILE_NO); - dup (input_desc); - close (input_desc); - } - if (output_desc != STDOUT_FILE_NO) - { - close (STDOUT_FILE_NO); - dup (output_desc); - close (output_desc); - } - - /* Close the parent's descs that aren't wanted here. */ - if (last_pipe_input != STDIN_FILE_NO) - close (last_pipe_input); - - /* Exec the program. */ - (*func) (program, argv); - - fprintf (stderr, "%s: ", this_pname); - fprintf (stderr, install_error_msg, program); - fprintf (stderr, ": %s\n", xstrerror (errno)); - exit (-1); - /* NOTREACHED */ - return 0; - - default: - /* In the parent, after forking. - Close the descriptors that we made for this child. */ - if (input_desc != STDIN_FILE_NO) - close (input_desc); - if (output_desc != STDOUT_FILE_NO) - close (output_desc); - - /* Return child's process number. */ - return pid; - } -} - -int -pwait (pid, status, flags) - int pid; - int *status; - int flags ATTRIBUTE_UNUSED; -{ - /* ??? Here's an opportunity to canonicalize the values in STATUS. - Needed? */ - pid = waitpid (pid, status, 0); - return pid; -} diff --git a/gnu/lib/libiberty/src/pex-win32.c b/gnu/lib/libiberty/src/pex-win32.c deleted file mode 100644 index bd097a4bb05..00000000000 --- a/gnu/lib/libiberty/src/pex-win32.c +++ /dev/null @@ -1,243 +0,0 @@ -/* Utilities to execute a program in a subprocess (possibly linked by pipes - with other subprocesses), and wait for it. Generic Win32 specialization. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 - Free Software Foundation, Inc. - -This file is part of the libiberty library. -Libiberty is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -Libiberty is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with libiberty; see the file COPYING.LIB. If not, -write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#include "pex-common.h" - -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif - -#include <process.h> -#include <io.h> -#include <fcntl.h> -#include <signal.h> - -/* mingw32 headers may not define the following. */ - -#ifndef _P_WAIT -# define _P_WAIT 0 -# define _P_NOWAIT 1 -# define _P_OVERLAY 2 -# define _P_NOWAITO 3 -# define _P_DETACH 4 - -# define WAIT_CHILD 0 -# define WAIT_GRANDCHILD 1 -#endif - -/* This is a kludge to get around the Microsoft C spawn functions' propensity - to remove the outermost set of double quotes from all arguments. */ - -static const char * const * -fix_argv (argvec) - char **argvec; -{ - int i; - - for (i = 1; argvec[i] != 0; i++) - { - int len, j; - char *temp, *newtemp; - - temp = argvec[i]; - len = strlen (temp); - for (j = 0; j < len; j++) - { - if (temp[j] == '"') - { - newtemp = xmalloc (len + 2); - strncpy (newtemp, temp, j); - newtemp [j] = '\\'; - strncpy (&newtemp [j+1], &temp [j], len-j); - newtemp [len+1] = 0; - temp = newtemp; - len++; - j++; - } - } - - argvec[i] = temp; - } - - for (i = 0; argvec[i] != 0; i++) - { - if (strpbrk (argvec[i], " \t")) - { - int len, trailing_backslash; - char *temp; - - len = strlen (argvec[i]); - trailing_backslash = 0; - - /* There is an added complication when an arg with embedded white - space ends in a backslash (such as in the case of -iprefix arg - passed to cpp). The resulting quoted strings gets misinterpreted - by the command interpreter -- it thinks that the ending quote - is escaped by the trailing backslash and things get confused. - We handle this case by escaping the trailing backslash, provided - it was not escaped in the first place. */ - if (len > 1 - && argvec[i][len-1] == '\\' - && argvec[i][len-2] != '\\') - { - trailing_backslash = 1; - ++len; /* to escape the final backslash. */ - } - - len += 2; /* and for the enclosing quotes. */ - - temp = xmalloc (len + 1); - temp[0] = '"'; - strcpy (temp + 1, argvec[i]); - if (trailing_backslash) - temp[len-2] = '\\'; - temp[len-1] = '"'; - temp[len] = '\0'; - - argvec[i] = temp; - } - } - - return (const char * const *) argvec; -} - -/* Win32 supports pipes */ -int -pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) - const char *program; - char * const *argv; - const char *this_pname; - const char *temp_base; - char **errmsg_fmt, **errmsg_arg; - int flags; -{ - int pid; - int pdes[2], org_stdin, org_stdout; - int input_desc, output_desc; - int retries, sleep_interval; - - /* Pipe waiting from last process, to be used as input for the next one. - Value is STDIN_FILE_NO if no pipe is waiting - (i.e. the next command is the first of a group). */ - static int last_pipe_input; - - /* If this is the first process, initialize. */ - if (flags & PEXECUTE_FIRST) - last_pipe_input = STDIN_FILE_NO; - - input_desc = last_pipe_input; - - /* If this isn't the last process, make a pipe for its output, - and record it as waiting to be the input to the next process. */ - if (! (flags & PEXECUTE_LAST)) - { - if (_pipe (pdes, 256, O_BINARY) < 0) - { - *errmsg_fmt = "pipe"; - *errmsg_arg = NULL; - return -1; - } - output_desc = pdes[WRITE_PORT]; - last_pipe_input = pdes[READ_PORT]; - } - else - { - /* Last process. */ - output_desc = STDOUT_FILE_NO; - last_pipe_input = STDIN_FILE_NO; - } - - if (input_desc != STDIN_FILE_NO) - { - org_stdin = dup (STDIN_FILE_NO); - dup2 (input_desc, STDIN_FILE_NO); - close (input_desc); - } - - if (output_desc != STDOUT_FILE_NO) - { - org_stdout = dup (STDOUT_FILE_NO); - dup2 (output_desc, STDOUT_FILE_NO); - close (output_desc); - } - - pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv) - (_P_NOWAIT, program, fix_argv(argv)); - - if (input_desc != STDIN_FILE_NO) - { - dup2 (org_stdin, STDIN_FILE_NO); - close (org_stdin); - } - - if (output_desc != STDOUT_FILE_NO) - { - dup2 (org_stdout, STDOUT_FILE_NO); - close (org_stdout); - } - - if (pid == -1) - { - *errmsg_fmt = install_error_msg; - *errmsg_arg = program; - return -1; - } - - return pid; -} - -/* MS CRTDLL doesn't return enough information in status to decide if the - child exited due to a signal or not, rather it simply returns an - integer with the exit code of the child; eg., if the child exited with - an abort() call and didn't have a handler for SIGABRT, it simply returns - with status = 3. We fix the status code to conform to the usual WIF* - macros. Note that WIFSIGNALED will never be true under CRTDLL. */ - -int -pwait (pid, status, flags) - int pid; - int *status; - int flags; -{ - int termstat; - - pid = _cwait (&termstat, pid, WAIT_CHILD); - - /* ??? Here's an opportunity to canonicalize the values in STATUS. - Needed? */ - - /* cwait returns the child process exit code in termstat. - A value of 3 indicates that the child caught a signal, but not - which one. Since only SIGABRT, SIGFPE and SIGINT do anything, we - report SIGABRT. */ - if (termstat == 3) - *status = SIGABRT; - else - *status = (((termstat) & 0xff) << 8); - - return pid; -} diff --git a/gnu/lib/libiberty/src/physmem.c b/gnu/lib/libiberty/src/physmem.c index 9185c1224e8..09fbf3f8c83 100644 --- a/gnu/lib/libiberty/src/physmem.c +++ b/gnu/lib/libiberty/src/physmem.c @@ -1,5 +1,5 @@ /* Calculate the size of physical memory. - Copyright 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Paul Eggert. */ @@ -80,7 +80,7 @@ typedef WINBOOL (WINAPI *PFN_MS_EX) (lMEMORYSTATUSEX*); /* Return the total amount of physical memory. */ double -physmem_total () +physmem_total (void) { #if defined _SC_PHYS_PAGES && defined _SC_PAGESIZE { /* This works on linux-gnu, solaris2 and cygwin. */ @@ -145,7 +145,7 @@ physmem_total () #endif #if HAVE__SYSTEM_CONFIGURATION - /* This works on AIX. */ + /* This works on AIX 4.3.3+. */ return _system_configuration.physmem; #endif @@ -184,7 +184,7 @@ physmem_total () /* Return the amount of physical memory available. */ double -physmem_available () +physmem_available (void) { #if defined _SC_AVPHYS_PAGES && defined _SC_PAGESIZE { /* This works on linux-gnu, solaris2 and cygwin. */ @@ -290,7 +290,7 @@ physmem_available () # include <stdlib.h> int -main () +main (void) { printf ("%12.f %12.f\n", physmem_total (), physmem_available ()); exit (0); diff --git a/gnu/lib/libiberty/src/rename.c b/gnu/lib/libiberty/src/rename.c index 399980ab7d7..ad342ffca65 100644 --- a/gnu/lib/libiberty/src/rename.c +++ b/gnu/lib/libiberty/src/rename.c @@ -22,9 +22,7 @@ exists, it is removed. #endif int -rename (zfrom, zto) - const char *zfrom; - const char *zto; +rename (const char *zfrom, const char *zto) { if (link (zfrom, zto) < 0) { diff --git a/gnu/lib/libiberty/src/setenv.c b/gnu/lib/libiberty/src/setenv.c index 8394fafe4e1..355af5a9dd6 100644 --- a/gnu/lib/libiberty/src/setenv.c +++ b/gnu/lib/libiberty/src/setenv.c @@ -13,8 +13,8 @@ You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ /* @@ -80,10 +80,7 @@ static char **last_environ; int -setenv (name, value, replace) - const char *name; - const char *value; - int replace; +setenv (const char *name, const char *value, int replace) { register char **ep = 0; register size_t size; @@ -118,7 +115,7 @@ setenv (name, value, replace) return -1; } - new_environ[size] = malloc (namelen + 1 + vallen); + new_environ[size] = (char *) malloc (namelen + 1 + vallen); if (new_environ[size] == NULL) { free ((char *) new_environ); @@ -145,13 +142,13 @@ setenv (name, value, replace) if (len + 1 < namelen + 1 + vallen) { /* The existing string is too short; malloc a new one. */ - char *new = malloc (namelen + 1 + vallen); - if (new == NULL) + char *new_string = (char *) malloc (namelen + 1 + vallen); + if (new_string == NULL) { UNLOCK; return -1; } - *ep = new; + *ep = new_string; } memcpy (*ep, name, namelen); (*ep)[namelen] = '='; @@ -164,8 +161,7 @@ setenv (name, value, replace) } void -unsetenv (name) - const char *name; +unsetenv (const char *name) { const size_t len = strlen (name); char **ep; diff --git a/gnu/lib/libiberty/src/sigsetmask.c b/gnu/lib/libiberty/src/sigsetmask.c index 4de3e4b1eb8..3b708b16adb 100644 --- a/gnu/lib/libiberty/src/sigsetmask.c +++ b/gnu/lib/libiberty/src/sigsetmask.c @@ -21,21 +21,20 @@ be the value @code{1}). #include <sys/types.h> #include <signal.h> -extern void abort PARAMS ((void)) ATTRIBUTE_NORETURN; +extern void abort (void) ATTRIBUTE_NORETURN; #ifdef SIG_SETMASK int -sigsetmask (set) - int set; +sigsetmask (int set) { - sigset_t new; - sigset_t old; + sigset_t new_sig; + sigset_t old_sig; - sigemptyset (&new); + sigemptyset (&new_sig); if (set != 0) { abort(); /* FIXME, we don't know how to translate old mask to new */ } - sigprocmask(SIG_SETMASK, &new, &old); + sigprocmask(SIG_SETMASK, &new_sig, &old_sig); return 1; /* FIXME, we always return 1 as old value. */ } #endif diff --git a/gnu/lib/libiberty/src/splay-tree.c b/gnu/lib/libiberty/src/splay-tree.c index 6f90fde05fb..060f900ae0a 100644 --- a/gnu/lib/libiberty/src/splay-tree.c +++ b/gnu/lib/libiberty/src/splay-tree.c @@ -16,8 +16,8 @@ General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ /* For an easily readable description of splay-trees, see: @@ -37,166 +37,164 @@ Boston, MA 02111-1307, USA. */ #include "libiberty.h" #include "splay-tree.h" -static void splay_tree_delete_helper PARAMS((splay_tree, - splay_tree_node)); -static void splay_tree_splay PARAMS((splay_tree, - splay_tree_key)); -static splay_tree_node splay_tree_splay_helper - PARAMS((splay_tree, - splay_tree_key, - splay_tree_node*, - splay_tree_node*, - splay_tree_node*)); -static int splay_tree_foreach_helper PARAMS((splay_tree, - splay_tree_node, - splay_tree_foreach_fn, - void*)); +static void splay_tree_delete_helper (splay_tree, splay_tree_node); +static inline void rotate_left (splay_tree_node *, + splay_tree_node, splay_tree_node); +static inline void rotate_right (splay_tree_node *, + splay_tree_node, splay_tree_node); +static void splay_tree_splay (splay_tree, splay_tree_key); +static int splay_tree_foreach_helper (splay_tree, splay_tree_node, + splay_tree_foreach_fn, void*); /* Deallocate NODE (a member of SP), and all its sub-trees. */ static void -splay_tree_delete_helper (sp, node) - splay_tree sp; - splay_tree_node node; +splay_tree_delete_helper (splay_tree sp, splay_tree_node node) { + splay_tree_node pending = 0; + splay_tree_node active = 0; + if (!node) return; - splay_tree_delete_helper (sp, node->left); - splay_tree_delete_helper (sp, node->right); - - if (sp->delete_key) - (*sp->delete_key)(node->key); - if (sp->delete_value) - (*sp->delete_value)(node->value); - - (*sp->deallocate) ((char*) node, sp->allocate_data); -} - -/* Help splay SP around KEY. PARENT and GRANDPARENT are the parent - and grandparent, respectively, of NODE. */ +#define KDEL(x) if (sp->delete_key) (*sp->delete_key)(x); +#define VDEL(x) if (sp->delete_value) (*sp->delete_value)(x); -static splay_tree_node -splay_tree_splay_helper (sp, key, node, parent, grandparent) - splay_tree sp; - splay_tree_key key; - splay_tree_node *node; - splay_tree_node *parent; - splay_tree_node *grandparent; -{ - splay_tree_node *next; - splay_tree_node n; - int comparison; - - n = *node; + KDEL (node->key); + VDEL (node->value); - if (!n) - return *parent; + /* We use the "key" field to hold the "next" pointer. */ + node->key = (splay_tree_key)pending; + pending = (splay_tree_node)node; - comparison = (*sp->comp) (key, n->key); - - if (comparison == 0) - /* We've found the target. */ - next = 0; - else if (comparison < 0) - /* The target is to the left. */ - next = &n->left; - else - /* The target is to the right. */ - next = &n->right; + /* Now, keep processing the pending list until there aren't any + more. This is a little more complicated than just recursing, but + it doesn't toast the stack for large trees. */ - if (next) + while (pending) { - /* Continue down the tree. */ - n = splay_tree_splay_helper (sp, key, next, node, parent); + active = pending; + pending = 0; + while (active) + { + splay_tree_node temp; - /* The recursive call will change the place to which NODE - points. */ - if (*node != n) - return n; - } + /* active points to a node which has its key and value + deallocated, we just need to process left and right. */ - if (!parent) - /* NODE is the root. We are done. */ - return n; + if (active->left) + { + KDEL (active->left->key); + VDEL (active->left->value); + active->left->key = (splay_tree_key)pending; + pending = (splay_tree_node)(active->left); + } + if (active->right) + { + KDEL (active->right->key); + VDEL (active->right->value); + active->right->key = (splay_tree_key)pending; + pending = (splay_tree_node)(active->right); + } - /* First, handle the case where there is no grandparent (i.e., - *PARENT is the root of the tree.) */ - if (!grandparent) - { - if (n == (*parent)->left) - { - *node = n->right; - n->right = *parent; - } - else - { - *node = n->left; - n->left = *parent; + temp = active; + active = (splay_tree_node)(temp->key); + (*sp->deallocate) ((char*) temp, sp->allocate_data); } - *parent = n; - return n; } +#undef KDEL +#undef VDEL +} - /* Next handle the cases where both N and *PARENT are left children, - or where both are right children. */ - if (n == (*parent)->left && *parent == (*grandparent)->left) - { - splay_tree_node p = *parent; - - (*grandparent)->left = p->right; - p->right = *grandparent; - p->left = n->right; - n->right = p; - *grandparent = n; - return n; - } - else if (n == (*parent)->right && *parent == (*grandparent)->right) - { - splay_tree_node p = *parent; - - (*grandparent)->right = p->left; - p->left = *grandparent; - p->right = n->left; - n->left = p; - *grandparent = n; - return n; - } +/* Rotate the edge joining the left child N with its parent P. PP is the + grandparents pointer to P. */ - /* Finally, deal with the case where N is a left child, but *PARENT - is a right child, or vice versa. */ - if (n == (*parent)->left) - { - (*parent)->left = n->right; - n->right = *parent; - (*grandparent)->right = n->left; - n->left = *grandparent; - *grandparent = n; - return n; - } - else - { - (*parent)->right = n->left; - n->left = *parent; - (*grandparent)->left = n->right; - n->right = *grandparent; - *grandparent = n; - return n; - } +static inline void +rotate_left (splay_tree_node *pp, splay_tree_node p, splay_tree_node n) +{ + splay_tree_node tmp; + tmp = n->right; + n->right = p; + p->left = tmp; + *pp = n; +} + +/* Rotate the edge joining the right child N with its parent P. PP is the + grandparents pointer to P. */ + +static inline void +rotate_right (splay_tree_node *pp, splay_tree_node p, splay_tree_node n) +{ + splay_tree_node tmp; + tmp = n->left; + n->left = p; + p->right = tmp; + *pp = n; } -/* Splay SP around KEY. */ +/* Bottom up splay of key. */ static void -splay_tree_splay (sp, key) - splay_tree sp; - splay_tree_key key; +splay_tree_splay (splay_tree sp, splay_tree_key key) { if (sp->root == 0) return; - splay_tree_splay_helper (sp, key, &sp->root, - /*grandparent=*/0, /*parent=*/0); + do { + int cmp1, cmp2; + splay_tree_node n, c; + + n = sp->root; + cmp1 = (*sp->comp) (key, n->key); + + /* Found. */ + if (cmp1 == 0) + return; + + /* Left or right? If no child, then we're done. */ + if (cmp1 < 0) + c = n->left; + else + c = n->right; + if (!c) + return; + + /* Next one left or right? If found or no child, we're done + after one rotation. */ + cmp2 = (*sp->comp) (key, c->key); + if (cmp2 == 0 + || (cmp2 < 0 && !c->left) + || (cmp2 > 0 && !c->right)) + { + if (cmp1 < 0) + rotate_left (&sp->root, n, c); + else + rotate_right (&sp->root, n, c); + return; + } + + /* Now we have the four cases of double-rotation. */ + if (cmp1 < 0 && cmp2 < 0) + { + rotate_left (&n->left, c, c->left); + rotate_left (&sp->root, n, n->left); + } + else if (cmp1 > 0 && cmp2 > 0) + { + rotate_right (&n->right, c, c->right); + rotate_right (&sp->root, n, n->right); + } + else if (cmp1 < 0 && cmp2 > 0) + { + rotate_right (&n->left, c, c->right); + rotate_left (&sp->root, n, n->left); + } + else if (cmp1 > 0 && cmp2 < 0) + { + rotate_left (&n->right, c, c->left); + rotate_right (&sp->root, n, n->right); + } + } while (1); } /* Call FN, passing it the DATA, for every node below NODE, all of @@ -205,11 +203,8 @@ splay_tree_splay (sp, key) value is returned. Otherwise, this function returns 0. */ static int -splay_tree_foreach_helper (sp, node, fn, data) - splay_tree sp; - splay_tree_node node; - splay_tree_foreach_fn fn; - void* data; +splay_tree_foreach_helper (splay_tree sp, splay_tree_node node, + splay_tree_foreach_fn fn, void *data) { int val; @@ -230,17 +225,13 @@ splay_tree_foreach_helper (sp, node, fn, data) /* An allocator and deallocator based on xmalloc. */ static void * -splay_tree_xmalloc_allocate (size, data) - int size; - void *data ATTRIBUTE_UNUSED; +splay_tree_xmalloc_allocate (int size, void *data ATTRIBUTE_UNUSED) { return (void *) xmalloc (size); } static void -splay_tree_xmalloc_deallocate (object, data) - void *object; - void *data ATTRIBUTE_UNUSED; +splay_tree_xmalloc_deallocate (void *object, void *data ATTRIBUTE_UNUSED) { free (object); } @@ -252,10 +243,9 @@ splay_tree_xmalloc_deallocate (object, data) nodes added. */ splay_tree -splay_tree_new (compare_fn, delete_key_fn, delete_value_fn) - splay_tree_compare_fn compare_fn; - splay_tree_delete_key_fn delete_key_fn; - splay_tree_delete_value_fn delete_value_fn; +splay_tree_new (splay_tree_compare_fn compare_fn, + splay_tree_delete_key_fn delete_key_fn, + splay_tree_delete_value_fn delete_value_fn) { return (splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn, @@ -268,14 +258,12 @@ splay_tree_new (compare_fn, delete_key_fn, delete_value_fn) values. */ splay_tree -splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn, - allocate_fn, deallocate_fn, allocate_data) - splay_tree_compare_fn compare_fn; - splay_tree_delete_key_fn delete_key_fn; - splay_tree_delete_value_fn delete_value_fn; - splay_tree_allocate_fn allocate_fn; - splay_tree_deallocate_fn deallocate_fn; - void *allocate_data; +splay_tree_new_with_allocator (splay_tree_compare_fn compare_fn, + splay_tree_delete_key_fn delete_key_fn, + splay_tree_delete_value_fn delete_value_fn, + splay_tree_allocate_fn allocate_fn, + splay_tree_deallocate_fn deallocate_fn, + void *allocate_data) { splay_tree sp = (splay_tree) (*allocate_fn) (sizeof (struct splay_tree_s), allocate_data); @@ -293,8 +281,7 @@ splay_tree_new_with_allocator (compare_fn, delete_key_fn, delete_value_fn, /* Deallocate SP. */ void -splay_tree_delete (sp) - splay_tree sp; +splay_tree_delete (splay_tree sp) { splay_tree_delete_helper (sp, sp->root); (*sp->deallocate) ((char*) sp, sp->allocate_data); @@ -305,10 +292,7 @@ splay_tree_delete (sp) with the new value. Returns the new node. */ splay_tree_node -splay_tree_insert (sp, key, value) - splay_tree sp; - splay_tree_key key; - splay_tree_value value; +splay_tree_insert (splay_tree sp, splay_tree_key key, splay_tree_value value) { int comparison = 0; @@ -360,9 +344,7 @@ splay_tree_insert (sp, key, value) /* Remove KEY from SP. It is not an error if it did not exist. */ void -splay_tree_remove (sp, key) - splay_tree sp; - splay_tree_key key; +splay_tree_remove (splay_tree sp, splay_tree_key key) { splay_tree_splay (sp, key); @@ -402,9 +384,7 @@ splay_tree_remove (sp, key) otherwise. */ splay_tree_node -splay_tree_lookup (sp, key) - splay_tree sp; - splay_tree_key key; +splay_tree_lookup (splay_tree sp, splay_tree_key key) { splay_tree_splay (sp, key); @@ -417,8 +397,7 @@ splay_tree_lookup (sp, key) /* Return the node in SP with the greatest key. */ splay_tree_node -splay_tree_max (sp) - splay_tree sp; +splay_tree_max (splay_tree sp) { splay_tree_node n = sp->root; @@ -434,8 +413,7 @@ splay_tree_max (sp) /* Return the node in SP with the smallest key. */ splay_tree_node -splay_tree_min (sp) - splay_tree sp; +splay_tree_min (splay_tree sp) { splay_tree_node n = sp->root; @@ -452,9 +430,7 @@ splay_tree_min (sp) predecessor. KEY need not be present in the tree. */ splay_tree_node -splay_tree_predecessor (sp, key) - splay_tree sp; - splay_tree_key key; +splay_tree_predecessor (splay_tree sp, splay_tree_key key) { int comparison; splay_tree_node node; @@ -472,7 +448,7 @@ splay_tree_predecessor (sp, key) if (comparison < 0) return sp->root; - /* Otherwise, find the leftmost element of the right subtree. */ + /* Otherwise, find the rightmost element of the left subtree. */ node = sp->root->left; if (node) while (node->right) @@ -485,9 +461,7 @@ splay_tree_predecessor (sp, key) successor. KEY need not be present in the tree. */ splay_tree_node -splay_tree_successor (sp, key) - splay_tree sp; - splay_tree_key key; +splay_tree_successor (splay_tree sp, splay_tree_key key) { int comparison; splay_tree_node node; @@ -505,7 +479,7 @@ splay_tree_successor (sp, key) if (comparison > 0) return sp->root; - /* Otherwise, find the rightmost element of the left subtree. */ + /* Otherwise, find the leftmost element of the right subtree. */ node = sp->root->right; if (node) while (node->left) @@ -520,10 +494,7 @@ splay_tree_successor (sp, key) Otherwise, this function returns 0. */ int -splay_tree_foreach (sp, fn, data) - splay_tree sp; - splay_tree_foreach_fn fn; - void *data; +splay_tree_foreach (splay_tree sp, splay_tree_foreach_fn fn, void *data) { return splay_tree_foreach_helper (sp, sp->root, fn, data); } @@ -531,9 +502,7 @@ splay_tree_foreach (sp, fn, data) /* Splay-tree comparison function, treating the keys as ints. */ int -splay_tree_compare_ints (k1, k2) - splay_tree_key k1; - splay_tree_key k2; +splay_tree_compare_ints (splay_tree_key k1, splay_tree_key k2) { if ((int) k1 < (int) k2) return -1; @@ -546,9 +515,7 @@ splay_tree_compare_ints (k1, k2) /* Splay-tree comparison function, treating the keys as pointers. */ int -splay_tree_compare_pointers (k1, k2) - splay_tree_key k1; - splay_tree_key k2; +splay_tree_compare_pointers (splay_tree_key k1, splay_tree_key k2) { if ((char*) k1 < (char*) k2) return -1; diff --git a/gnu/lib/libiberty/src/strcasecmp.c b/gnu/lib/libiberty/src/strcasecmp.c index d2608dc0b87..131d81c2ce7 100644 --- a/gnu/lib/libiberty/src/strcasecmp.c +++ b/gnu/lib/libiberty/src/strcasecmp.c @@ -25,11 +25,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; #endif /* LIBC_SCCS and not lint */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif /* * This array is designed for mapping upper and lower case letter @@ -73,8 +69,7 @@ static const unsigned char charmap[] = { }; int -strcasecmp(s1, s2) - const char *s1, *s2; +strcasecmp(const char *s1, const char *s2) { register unsigned char u1, u2; diff --git a/gnu/lib/libiberty/src/strdup.c b/gnu/lib/libiberty/src/strdup.c index 071a4a401af..78c2093b61a 100644 --- a/gnu/lib/libiberty/src/strdup.c +++ b/gnu/lib/libiberty/src/strdup.c @@ -10,19 +10,14 @@ Returns a pointer to a copy of @var{s} in memory obtained from */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif -extern size_t strlen PARAMS ((const char*)); -extern PTR malloc PARAMS ((size_t)); -extern PTR memcpy PARAMS ((PTR, const PTR, size_t)); +extern size_t strlen (const char*); +extern PTR malloc (size_t); +extern PTR memcpy (PTR, const PTR, size_t); char * -strdup(s) - char *s; +strdup(const char *s) { size_t len = strlen (s) + 1; char *result = (char*) malloc (len); diff --git a/gnu/lib/libiberty/src/strerror.c b/gnu/lib/libiberty/src/strerror.c index a1d165efac9..0efadc3d65e 100644 --- a/gnu/lib/libiberty/src/strerror.c +++ b/gnu/lib/libiberty/src/strerror.c @@ -2,9 +2,6 @@ Written by Fred Fish. fnf@cygnus.com This file is in the public domain. --Per Bothner. */ -#include "ansidecl.h" -#include "libiberty.h" - #include "config.h" #ifdef HAVE_SYS_ERRLIST @@ -17,6 +14,9 @@ #define sys_errlist sys_errlist__ #endif +#include "ansidecl.h" +#include "libiberty.h" + #include <stdio.h> #include <errno.h> @@ -43,7 +43,7 @@ extern PTR memset (); # define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif -static void init_error_tables PARAMS ((void)); +static void init_error_tables (void); /* Translation table for errno values. See intro(2) in most UNIX systems Programmers Reference Manuals. @@ -462,6 +462,8 @@ static int num_error_names = 0; #ifndef HAVE_SYS_ERRLIST +#define sys_nerr sys_nerr__ +#define sys_errlist sys_errlist__ static int sys_nerr; static const char **sys_errlist; @@ -472,7 +474,6 @@ extern char *sys_errlist[]; #endif - /* NAME @@ -502,7 +503,7 @@ BUGS */ static void -init_error_tables () +init_error_tables (void) { const struct error_info *eip; int nbytes; @@ -583,7 +584,7 @@ symbolic name or message. */ int -errno_max () +errno_max (void) { int maxsize; @@ -622,8 +623,7 @@ next call to @code{strerror}. */ char * -strerror (errnoval) - int errnoval; +strerror (int errnoval) { const char *msg; static char buf[32]; @@ -650,7 +650,7 @@ strerror (errnoval) else if ((sys_errlist == NULL) || (sys_errlist[errnoval] == NULL)) { /* In range, but no sys_errlist or no entry at this index. */ - snprintf (buf, sizeof buf, "Error %d", errnoval); + sprintf (buf, "Error %d", errnoval); msg = buf; } else @@ -689,8 +689,7 @@ valid until the next call to @code{strerrno}. */ const char * -strerrno (errnoval) - int errnoval; +strerrno (int errnoval) { const char *name; static char buf[32]; @@ -713,7 +712,7 @@ strerrno (errnoval) else if ((error_names == NULL) || (error_names[errnoval] == NULL)) { /* In range, but no error_names or no entry at this index. */ - snprintf (buf, sizeof buf, "Error %d", errnoval); + sprintf (buf, "Error %d", errnoval); name = (const char *) buf; } else @@ -737,8 +736,7 @@ to an errno value. If no translation is found, returns 0. */ int -strtoerrno (name) - const char *name; +strtoerrno (const char *name) { int errnoval = 0; @@ -778,7 +776,7 @@ strtoerrno (name) #include <stdio.h> int -main () +main (void) { int errn; int errnmax; diff --git a/gnu/lib/libiberty/src/strncasecmp.c b/gnu/lib/libiberty/src/strncasecmp.c index 10feee82198..47700dde518 100644 --- a/gnu/lib/libiberty/src/strncasecmp.c +++ b/gnu/lib/libiberty/src/strncasecmp.c @@ -25,11 +25,7 @@ static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87"; #endif /* LIBC_SCCS and not lint */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif /* * This array is designed for mapping upper and lower case letter @@ -72,9 +68,7 @@ static const unsigned char charmap[] = { }; int -strncasecmp(s1, s2, n) - const char *s1, *s2; - register size_t n; +strncasecmp(const char *s1, const char *s2, register size_t n) { register unsigned char u1, u2; diff --git a/gnu/lib/libiberty/src/strncmp.c b/gnu/lib/libiberty/src/strncmp.c index ad87e1fde8b..916c2f07a8a 100644 --- a/gnu/lib/libiberty/src/strncmp.c +++ b/gnu/lib/libiberty/src/strncmp.c @@ -13,16 +13,10 @@ Compares the first @var{n} bytes of two strings, returning a value as */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif int -strncmp(s1, s2, n) - const char *s1, *s2; - register size_t n; +strncmp(const char *s1, const char *s2, register size_t n) { register unsigned char u1, u2; diff --git a/gnu/lib/libiberty/src/strsignal.c b/gnu/lib/libiberty/src/strsignal.c index fcb20d59aa5..c3a16ab9bdc 100644 --- a/gnu/lib/libiberty/src/strsignal.c +++ b/gnu/lib/libiberty/src/strsignal.c @@ -2,11 +2,10 @@ Written by Fred Fish. fnf@cygnus.com This file is in the public domain. */ +#include "config.h" #include "ansidecl.h" #include "libiberty.h" -#include "config.h" - /* We need to declare sys_siglist, because even if the system provides it we can't assume that it is declared in <signal.h> (for example, SunOS provides sys_siglist, but it does not declare it in any @@ -42,18 +41,14 @@ extern PTR memset (); #undef sys_nsig #ifndef NULL -# ifdef ANSI_PROTOTYPES -# define NULL (void *) 0 -# else -# define NULL 0 -# endif +# define NULL (void *) 0 #endif #ifndef MAX # define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif -static void init_signal_tables PARAMS ((void)); +static void init_signal_tables (void); /* Translation table for signal values. @@ -289,7 +284,7 @@ BUGS */ static void -init_signal_tables () +init_signal_tables (void) { const struct signal_info *eip; int nbytes; @@ -370,7 +365,7 @@ symbolic name or message. */ int -signo_max () +signo_max (void) { int maxsize; @@ -410,8 +405,7 @@ call to @code{strsignal}. #ifndef HAVE_STRSIGNAL const char * -strsignal (signo) - int signo; +strsignal (int signo) { const char *msg; static char buf[32]; @@ -433,7 +427,7 @@ strsignal (signo) else if ((sys_siglist == NULL) || (sys_siglist[signo] == NULL)) { /* In range, but no sys_siglist or no entry at this index. */ - snprintf (buf, sizeof buf, "Signal %d", signo); + sprintf (buf, "Signal %d", signo); msg = (const char *) buf; } else @@ -470,8 +464,7 @@ valid until the next call to @code{strsigno}. */ const char * -strsigno (signo) - int signo; +strsigno (int signo) { const char *name; static char buf[32]; @@ -489,7 +482,7 @@ strsigno (signo) else if ((signal_names == NULL) || (signal_names[signo] == NULL)) { /* In range, but no signal_names or no entry at this index. */ - snprintf (buf, sizeof buf, "Signal %d", signo); + sprintf (buf, "Signal %d", signo); name = (const char *) buf; } else @@ -514,8 +507,7 @@ translation is found, returns 0. */ int -strtosigno (name) - const char *name; +strtosigno (const char *name) { int signo = 0; @@ -557,9 +549,7 @@ followed by a newline. #ifndef HAVE_PSIGNAL void -psignal (signo, message) - unsigned signo; - char *message; +psignal (unsigned signo, char *message) { if (signal_names == NULL) { @@ -586,7 +576,7 @@ psignal (signo, message) #include <stdio.h> int -main () +main (void) { int signo; int maxsigno; diff --git a/gnu/lib/libiberty/src/strstr.c b/gnu/lib/libiberty/src/strstr.c index a059c7f5dcb..60902ea40ee 100644 --- a/gnu/lib/libiberty/src/strstr.c +++ b/gnu/lib/libiberty/src/strstr.c @@ -20,24 +20,22 @@ length, the function returns @var{string}. /* FIXME: The above description is ANSI compiliant. This routine has not been validated to comply with it. -fnf */ +#include <stddef.h> + +extern char *strchr (const char *, int); +extern int strncmp (const void *, const void *, size_t); +extern size_t strlen (const char *); + char * -strstr (s1, s2) - char *s1, *s2; +strstr (const char *s1, const char *s2) { - register char *p = s1; - extern char *strchr (); - extern int strncmp (); -#if __GNUC__ >= 2 - extern __SIZE_TYPE__ strlen (const char *); -#endif - register int len = strlen (s2); + const char *p = s1; + const size_t len = strlen (s2); for (; (p = strchr (p, *s2)) != 0; p++) { if (strncmp (p, s2, len) == 0) - { - return (p); - } + return (char *)p; } return (0); } diff --git a/gnu/lib/libiberty/src/strtod.c b/gnu/lib/libiberty/src/strtod.c index 97fc9339344..adbc33b0da0 100644 --- a/gnu/lib/libiberty/src/strtod.c +++ b/gnu/lib/libiberty/src/strtod.c @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, if you link this library with files compiled with a GNU compiler to produce an executable, this does not cause @@ -40,16 +40,14 @@ the location referenced by @var{endptr}. #include "ansidecl.h" #include "safe-ctype.h" -extern double atof (); +extern double atof (const char *); /* Disclaimer: this is currently just used by CHILL in GDB and therefore has not been tested well. It may have been tested for nothing except that it compiles. */ double -strtod (str, ptr) - char *str; - char **ptr; +strtod (char *str, char **ptr) { char *p; diff --git a/gnu/lib/libiberty/src/strtol.c b/gnu/lib/libiberty/src/strtol.c index d9f54cc8f7a..acc7882192b 100644 --- a/gnu/lib/libiberty/src/strtol.c +++ b/gnu/lib/libiberty/src/strtol.c @@ -85,10 +85,7 @@ extern int errno; * alphabets and digits are each contiguous. */ long -strtol(nptr, endptr, base) - const char *nptr; - char **endptr; - register int base; +strtol(const char *nptr, char **endptr, register int base) { register const char *s = nptr; register unsigned long acc; @@ -147,7 +144,7 @@ strtol(nptr, endptr, base) break; if (c >= base) break; - if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; diff --git a/gnu/lib/libiberty/src/strtoul.c b/gnu/lib/libiberty/src/strtoul.c index 66420f268b2..ba80063531e 100644 --- a/gnu/lib/libiberty/src/strtoul.c +++ b/gnu/lib/libiberty/src/strtoul.c @@ -58,10 +58,7 @@ extern int errno; * alphabets and digits are each contiguous. */ unsigned long -strtoul(nptr, endptr, base) - const char *nptr; - char **endptr; - register int base; +strtoul(const char *nptr, char **endptr, register int base) { register const char *s = nptr; register unsigned long acc; diff --git a/gnu/lib/libiberty/src/testsuite/Makefile.in b/gnu/lib/libiberty/src/testsuite/Makefile.in index 9d4ddd0ef1e..515dcd56b7e 100644 --- a/gnu/lib/libiberty/src/testsuite/Makefile.in +++ b/gnu/lib/libiberty/src/testsuite/Makefile.in @@ -1,6 +1,6 @@ # # Makefile -# Copyright (C) 1999 +# Copyright (C) 1999, 2002 # Free Software Foundation # # This file is part of the libiberty library. @@ -45,31 +45,25 @@ all: check: @CHECK@ # Run some tests of the demangler. -check-cplus-dem: test-filter $(srcdir)/demangle-expected - $(SHELL) $(srcdir)/regress-demangle $(srcdir)/demangle-expected +check-cplus-dem: test-demangle $(srcdir)/demangle-expected + ./test-demangle < $(srcdir)/demangle-expected -# Note that we just hard-code prepends_underscore to 0. This doesn't -# matter since any particular test can override the default if need -# be. TEST_COMPILE = $(CC) @DEFS@ $(LIBCFLAGS) -I.. -I$(INCDIR) $(HDEFINES) -test-filter: $(srcdir)/../cplus-dem.c - echo 'int prepends_underscore = 0;' > test-us.c - $(TEST_COMPILE) -o test-filter -DMAIN -DVERSION='"none"' @DEFS@ \ - $(srcdir)/../cplus-dem.c test-us.c -L.. -liberty - +test-demangle: $(srcdir)/test-demangle.c + $(TEST_COMPILE) -o test-demangle \ + $(srcdir)/test-demangle.c ../libiberty.a # Standard (either GNU or Cygnus) rules we don't use. info install-info clean-info dvi install etags tags installcheck: # The standard clean rules. mostlyclean: - rm -f test-us.c test-filter + rm -f test-demangle clean: mostlyclean distclean: clean rm -f Makefile maintainer-clean realclean: distclean - Makefile: $(srcdir)/Makefile.in ../config.status CONFIG_FILES=testsuite/Makefile CONFIG_HEADERS= \ cd .. && $(SHELL) ./config.status diff --git a/gnu/lib/libiberty/src/vasprintf.c b/gnu/lib/libiberty/src/vasprintf.c index aa20e5bff00..b6cb94e7a22 100644 --- a/gnu/lib/libiberty/src/vasprintf.c +++ b/gnu/lib/libiberty/src/vasprintf.c @@ -1,6 +1,6 @@ /* Like vsprintf but provides a pointer to malloc'd storage, which must be freed by the caller. - Copyright (C) 1994 Free Software Foundation, Inc. + Copyright (C) 1994, 2003 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -15,17 +15,16 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stdarg.h> -#else -#include <varargs.h> +#if !defined (va_copy) && defined (__va_copy) +# define va_copy(d,s) __va_copy((d),(s)) #endif #include <stdio.h> #ifdef HAVE_STRING_H @@ -52,20 +51,17 @@ you pass a pointer to a pointer. This function will compute the size of the buffer needed, allocate memory with @code{malloc}, and store a pointer to the allocated memory in @code{*@var{resptr}}. The value returned is the same as @code{vsprintf} would return. If memory could -not be allocated, zero is returned and @code{NULL} is stored in +not be allocated, minus one is returned and @code{NULL} is stored in @code{*@var{resptr}}. @end deftypefn */ -static int int_vasprintf PARAMS ((char **, const char *, va_list *)); +static int int_vasprintf (char **, const char *, va_list); static int -int_vasprintf (result, format, args) - char **result; - const char *format; - va_list *args; +int_vasprintf (char **result, const char *format, va_list args) { const char *p = format; /* Add one to make sure that it is never zero, which might cause malloc @@ -73,7 +69,11 @@ int_vasprintf (result, format, args) int total_width = strlen (format) + 1; va_list ap; - memcpy ((PTR) &ap, (PTR) args, sizeof (va_list)); +#ifdef va_copy + va_copy (ap, args); +#else + memcpy ((PTR) &ap, (PTR) &args, sizeof (va_list)); +#endif while (*p != '\0') { @@ -135,32 +135,33 @@ int_vasprintf (result, format, args) p++; } } +#ifdef va_copy + va_end (ap); +#endif #ifdef TEST global_total_width = total_width; #endif *result = (char *) malloc (total_width); if (*result != NULL) - return vsprintf (*result, format, *args); + return vsprintf (*result, format, args); else - return 0; + return -1; } int -vasprintf (result, format, args) - char **result; - const char *format; +vasprintf (char **result, const char *format, #if defined (_BSD_VA_LIST_) && defined (__FreeBSD__) - _BSD_VA_LIST_ args; + _BSD_VA_LIST_ args) #else - va_list args; + va_list args) #endif { - return int_vasprintf (result, format, &args); + return int_vasprintf (result, format, args); } #ifdef TEST static void ATTRIBUTE_PRINTF_1 -checkit VPARAMS ((const char *format, ...)) +checkit (const char *format, ...) { char *result; VA_OPEN (args, format); @@ -177,10 +178,10 @@ checkit VPARAMS ((const char *format, ...)) free (result); } -extern int main PARAMS ((void)); +extern int main (void); int -main () +main (void) { checkit ("%d", 0x12345678); checkit ("%200d", 5); diff --git a/gnu/lib/libiberty/src/vfork.c b/gnu/lib/libiberty/src/vfork.c index 4aa5c21d427..eb4ff622b44 100644 --- a/gnu/lib/libiberty/src/vfork.c +++ b/gnu/lib/libiberty/src/vfork.c @@ -13,10 +13,10 @@ Emulates @code{vfork} by calling @code{fork} and returning its value. #include "ansidecl.h" -extern int fork PARAMS ((void)); +extern int fork (void); int -vfork () +vfork (void) { return (fork ()); } diff --git a/gnu/lib/libiberty/src/vfprintf.c b/gnu/lib/libiberty/src/vfprintf.c index 18f09d47d32..9bd3ed555d0 100644 --- a/gnu/lib/libiberty/src/vfprintf.c +++ b/gnu/lib/libiberty/src/vfprintf.c @@ -4,19 +4,12 @@ */ #include "ansidecl.h" -#ifdef ANSI_PROTOTYPES #include <stdarg.h> -#else -#include <varargs.h> -#endif #include <stdio.h> #undef vfprintf int -vfprintf (stream, format, ap) - FILE * stream; - const char * format; - va_list ap; +vfprintf (FILE *stream, const char *format, va_list ap) { return _doprnt (format, ap, stream); } diff --git a/gnu/lib/libiberty/src/vprintf.c b/gnu/lib/libiberty/src/vprintf.c index 9487896ea5e..c2553167bab 100644 --- a/gnu/lib/libiberty/src/vprintf.c +++ b/gnu/lib/libiberty/src/vprintf.c @@ -16,17 +16,11 @@ nonstandard but common function @code{_doprnt}. */ #include <ansidecl.h> -#ifdef ANSI_PROTOTYPES #include <stdarg.h> -#else -#include <varargs.h> -#endif #include <stdio.h> #undef vprintf int -vprintf (format, ap) - const char *format; - va_list ap; +vprintf (const char *format, va_list ap) { return vfprintf (stdout, format, ap); } diff --git a/gnu/lib/libiberty/src/waitpid.c b/gnu/lib/libiberty/src/waitpid.c index 6e31f25e305..fd519d7696e 100644 --- a/gnu/lib/libiberty/src/waitpid.c +++ b/gnu/lib/libiberty/src/waitpid.c @@ -13,6 +13,7 @@ does the return value. The third argument is unused in @libib{}. #ifdef HAVE_CONFIG_H #include "config.h" #endif +#include "ansidecl.h" /* On some systems (such as WindISS), you must include <sys/types.h> to get the definition of "pid_t" before you include <sys/wait.h>. */ @@ -23,9 +24,7 @@ does the return value. The third argument is unused in @libib{}. #endif pid_t -waitpid (pid, stat_loc, options) - pid_t pid; - int *stat_loc, options; +waitpid (pid_t pid, int *stat_loc, int options ATTRIBUTE_UNUSED) { for (;;) { diff --git a/gnu/lib/libiberty/src/xatexit.c b/gnu/lib/libiberty/src/xatexit.c index 075599c61f9..6fdad9ed806 100644 --- a/gnu/lib/libiberty/src/xatexit.c +++ b/gnu/lib/libiberty/src/xatexit.c @@ -22,36 +22,35 @@ failure. If you use @code{xatexit} to register functions, you must use /* Adapted from newlib/libc/stdlib/{,at}exit.[ch]. If you use xatexit, you must call xexit instead of exit. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" #include <stdio.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#endif #if VMS #include <stdlib.h> #include <unixlib.h> #else /* For systems with larger pointers than ints, this must be declared. */ -PTR malloc PARAMS ((size_t)); +PTR malloc (size_t); #endif -static void xatexit_cleanup PARAMS ((void)); +static void xatexit_cleanup (void); /* Pointer to function run by xexit. */ -extern void (*_xexit_cleanup) PARAMS ((void)); +extern void (*_xexit_cleanup) (void); #define XATEXIT_SIZE 32 struct xatexit { struct xatexit *next; /* next in list */ int ind; /* next index in this table */ - void (*fns[XATEXIT_SIZE]) PARAMS ((void)); /* the table itself */ + void (*fns[XATEXIT_SIZE]) (void); /* the table itself */ }; /* Allocate one struct statically to guarantee that we can register @@ -65,8 +64,7 @@ static struct xatexit *xatexit_head = &xatexit_first; Return 0 if successful, -1 if not. */ int -xatexit (fn) - void (*fn) PARAMS ((void)); +xatexit (void (*fn) (void)) { register struct xatexit *p; @@ -90,7 +88,7 @@ xatexit (fn) /* Call any cleanup functions. */ static void -xatexit_cleanup () +xatexit_cleanup (void) { register struct xatexit *p; register int n; diff --git a/gnu/lib/libiberty/src/xexit.c b/gnu/lib/libiberty/src/xexit.c index a65690f09c3..421e5e23841 100644 --- a/gnu/lib/libiberty/src/xexit.c +++ b/gnu/lib/libiberty/src/xexit.c @@ -14,8 +14,8 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If not, write -to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ /* @@ -41,11 +41,10 @@ Termination is handled via the system's normal @code{exit} call. /* This variable is set by xatexit if it is called. This way, xmalloc doesn't drag xatexit into the link. */ -void (*_xexit_cleanup) PARAMS ((void)); +void (*_xexit_cleanup) (void); void -xexit (code) - int code; +xexit (int code) { if (_xexit_cleanup != NULL) (*_xexit_cleanup) (); diff --git a/gnu/lib/libiberty/src/xmalloc.c b/gnu/lib/libiberty/src/xmalloc.c index c3fe1a84f4d..3e97aab563f 100644 --- a/gnu/lib/libiberty/src/xmalloc.c +++ b/gnu/lib/libiberty/src/xmalloc.c @@ -14,8 +14,8 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with libiberty; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ /* @@ -68,23 +68,30 @@ function will be called to print an error message and terminate execution. #include <stdio.h> -#ifdef ANSI_PROTOTYPES #include <stddef.h> -#else -#define size_t unsigned long -#define ptrdiff_t long -#endif #if VMS #include <stdlib.h> #include <unixlib.h> #else /* For systems with larger pointers than ints, these must be declared. */ -PTR malloc PARAMS ((size_t)); -PTR realloc PARAMS ((PTR, size_t)); -PTR calloc PARAMS ((size_t, size_t)); -PTR sbrk PARAMS ((ptrdiff_t)); -#endif +# if HAVE_STDLIB_H && HAVE_UNISTD_H && HAVE_DECL_MALLOC \ + && HAVE_DECL_REALLOC && HAVE_DECL_CALLOC && HAVE_DECL_SBRK +# include <stdlib.h> +# include <unistd.h> +# else +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ +void *malloc (size_t); +void *realloc (void *, size_t); +void *calloc (size_t, size_t); +void *sbrk (ptrdiff_t); +# ifdef __cplusplus +} +# endif /* __cplusplus */ +# endif /* HAVE_STDLIB_H ... */ +#endif /* VMS */ /* The program name if set. */ static const char *name = ""; @@ -96,8 +103,7 @@ static char *first_break = NULL; #endif /* HAVE_SBRK */ void -xmalloc_set_program_name (s) - const char *s; +xmalloc_set_program_name (const char *s) { name = s; #ifdef HAVE_SBRK @@ -108,8 +114,7 @@ xmalloc_set_program_name (s) } void -xmalloc_failed (size) - size_t size; +xmalloc_failed (size_t size) { #ifdef HAVE_SBRK extern char **environ; @@ -133,8 +138,7 @@ xmalloc_failed (size) } PTR -xmalloc (size) - size_t size; +xmalloc (size_t size) { PTR newmem; @@ -148,8 +152,7 @@ xmalloc (size) } PTR -xcalloc (nelem, elsize) - size_t nelem, elsize; +xcalloc (size_t nelem, size_t elsize) { PTR newmem; @@ -164,9 +167,7 @@ xcalloc (nelem, elsize) } PTR -xrealloc (oldmem, size) - PTR oldmem; - size_t size; +xrealloc (PTR oldmem, size_t size) { PTR newmem; diff --git a/gnu/lib/libiberty/src/xmemdup.c b/gnu/lib/libiberty/src/xmemdup.c index 9e9d66b715d..d4831163a20 100644 --- a/gnu/lib/libiberty/src/xmemdup.c +++ b/gnu/lib/libiberty/src/xmemdup.c @@ -24,15 +24,15 @@ allocated, the remaining memory is zeroed. #include <sys/types.h> /* For size_t. */ #ifdef HAVE_STRING_H #include <string.h> +#else +# ifdef HAVE_STRINGS_H +# include <strings.h> +# endif #endif PTR -xmemdup (input, copy_size, alloc_size) - const PTR input; - size_t copy_size; - size_t alloc_size; +xmemdup (const PTR input, size_t copy_size, size_t alloc_size) { PTR output = xcalloc (1, alloc_size); - memcpy (output, input, copy_size); - return output; + return (PTR) memcpy (output, input, copy_size); } diff --git a/gnu/lib/libiberty/src/xstrerror.c b/gnu/lib/libiberty/src/xstrerror.c index 25a83e7ee31..2ea2200e9fc 100644 --- a/gnu/lib/libiberty/src/xstrerror.c +++ b/gnu/lib/libiberty/src/xstrerror.c @@ -15,19 +15,32 @@ will never return a @code{NULL} pointer. #include <stdio.h> -#include "libiberty.h" #include "config.h" +#include "libiberty.h" #ifdef VMS -#include <errno.h> -#if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES) -extern char *strerror PARAMS ((int,...)); -#define DONT_DECLARE_STRERROR -#endif -#endif /* VMS */ +# include <errno.h> +# if !defined (__STRICT_ANSI__) && !defined (__HIDE_FORBIDDEN_NAMES) +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ +extern char *strerror (int,...); +# define DONT_DECLARE_STRERROR +# ifdef __cplusplus +} +# endif /* __cplusplus */ +# endif +#endif /* VMS */ + #ifndef DONT_DECLARE_STRERROR -extern char *strerror PARAMS ((int)); +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ +extern char *strerror (int); +# ifdef __cplusplus +} +# endif /* __cplusplus */ #endif /* If strerror returns NULL, we'll format the number into a static buffer. */ @@ -38,15 +51,14 @@ static char xstrerror_buf[sizeof ERRSTR_FMT + 20]; /* Like strerror, but result is never a null pointer. */ char * -xstrerror (errnum) - int errnum; +xstrerror (int errnum) { char *errstr; #ifdef VMS - char *(*vmslib_strerror) PARAMS ((int,...)); + char *(*vmslib_strerror) (int,...); /* Override any possibly-conflicting declaration from system header. */ - vmslib_strerror = (char *(*) PARAMS ((int,...))) strerror; + vmslib_strerror = (char *(*) (int,...)) strerror; /* Second argument matters iff first is EVMSERR, but it's simpler to pass it unconditionally. `vaxc$errno' is declared in <errno.h> and maintained by the run-time library in parallel to `errno'. @@ -60,7 +72,7 @@ xstrerror (errnum) /* If `errnum' is out of range, result might be NULL. We'll fix that. */ if (!errstr) { - snprintf (xstrerror_buf, sizeof xstrerror_buf, ERRSTR_FMT, errnum); + sprintf (xstrerror_buf, ERRSTR_FMT, errnum); errstr = xstrerror_buf; } return errstr; |