about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog34
-rw-r--r--FAQ195
-rw-r--r--Makeconfig15
-rw-r--r--Makefile3
-rw-r--r--aclocal.m411
-rw-r--r--bits/byteswap.h6
-rwxr-xr-xconfigure229
-rw-r--r--configure.in2
-rw-r--r--inet/gethstbyad_r.c9
-rw-r--r--inet/gethstbynm_r.c6
-rw-r--r--math/libm-test.c23
-rw-r--r--nss/getXXbyYY_r.c10
-rw-r--r--resolv/Makefile4
-rw-r--r--resolv/res_hconf.c232
-rw-r--r--resolv/res_hconf.h30
-rw-r--r--sysdeps/generic/bits/byteswap.h6
-rwxr-xr-xsysdeps/generic/configure2
-rwxr-xr-xsysdeps/unix/common/configure6
-rwxr-xr-xsysdeps/unix/configure2
19 files changed, 447 insertions, 378 deletions
diff --git a/ChangeLog b/ChangeLog
index feea31d2d0..8ea86268c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+1998-11-20  Ulrich Drepper  <drepper@cygnus.com>
+
+	* aclocal.m4 (LIBC_PROG_BINUTILS): Also add AR and RANLIB using the
+	same method.
+	* configure.in: Don't define AR and RANLIB here.
+
+	* inet/gethstbyad_r.c: Define NEED__RES_HCONV and POSTPROCESS for
+	host name res_hconf code.
+	* inet/gethstbynm_r.c: Likewise.
+	* nss/getXXbyYY_r.c: Include resolv/res_hconf.h if NEED__RES_HCONF
+	is defined.  Call res_hconf_init if necessary.  If POSTPROCESS is
+	defined execute the code.
+	* resolv/Makefile (routines): Add res_hconf.
+	(headers): Add res_hconf.h.
+	* resolv/res_hconf.c: Pretty print.
+	* resolv/res_hconf.h: Likewise.
+
+1998-11-20  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/generic/bits/byteswap.h: Fix typos in non-GCC
+	definitions.  Reported by Scott Bambrough <scottb@corelcomputer.com>.
+
+1998-11-20 1998  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* math/libm-test.c: Raise some epsilons a bit.
+
+1998-11-20  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
+
+	* Makeconfig ($(common-objpfx)sysd-sorted): Fix portability problems.
+
+1998-11-20  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makefile (distribute): Add scripts/gen-sorted.awk.
+
 1998-11-19  Ulrich Drepper  <drepper@cygnus.com>
 
 	* posix/regex.c (regex_compile): Handle extra long class names
diff --git a/FAQ b/FAQ
index 73385871e8..6491b389ad 100644
--- a/FAQ
+++ b/FAQ
@@ -22,9 +22,9 @@ please let me know.
 1.2.	What compiler do I need to build GNU libc?
 1.3.	When I try to compile glibc I get only error messages.
 	What's wrong?
-1.4.	Do I need a special linker or archiver?
+1.4.	Do I need a special linker or assembler?
 1.5.	Which compiler should I use for powerpc?
-1.6.	Do I need some more things to compile GNU C Library?
+1.6.	Do I need some more things to compile the GNU C Library?
 1.7.	What version of the Linux kernel headers should be used?
 1.8.	The compiler hangs while building iconvdata modules.  What's
 	wrong?
@@ -58,38 +58,41 @@ please let me know.
 	functions `stat', `lstat', `fstat', and `mknod' and while
 	linking on my Linux system I get error messages.  How is
 	this supposed to work?
-2.8.	How can I compile gcc 2.7.2.1 from the gcc source code using
+2.8.	When I run an executable on one system which I compiled on
+	another, I get dynamic linker errors.  Both systems have the same
+	version of glibc installed.  What's wrong?
+2.9.	How can I compile gcc 2.7.2.1 from the gcc source code using
 	glibc 2.x?
-2.9.	The `gencat' utility cannot process the catalog sources which
+2.10.	The `gencat' utility cannot process the catalog sources which
 	were used on my Linux libc5 based system.  Why?
-2.10.	Programs using libc have their messages translated, but other
+2.11.	Programs using libc have their messages translated, but other
 	behavior is not localized (e.g. collating order); why?
-2.11.	I have set up /etc/nis.conf, and the Linux libc 5 with NYS
+2.12.	I have set up /etc/nis.conf, and the Linux libc 5 with NYS
 	works great.  But the glibc NIS+ doesn't seem to work.
-2.12.	I have killed ypbind to stop using NIS, but glibc
+2.13.	I have killed ypbind to stop using NIS, but glibc
 	continues using NIS.
-2.13.	Under Linux/Alpha, I always get "do_ypcall: clnt_call:
+2.14.	Under Linux/Alpha, I always get "do_ypcall: clnt_call:
 	RPC: Unable to receive; errno = Connection refused" when using NIS.
-2.14.	After installing glibc name resolving doesn't work properly.
-2.15.	How do I create the databases for NSS?
-2.16.	I have /usr/include/net and /usr/include/scsi as symlinks
+2.15.	After installing glibc name resolving doesn't work properly.
+2.16.	How do I create the databases for NSS?
+2.17.	I have /usr/include/net and /usr/include/scsi as symlinks
 	into my Linux source tree.  Is that wrong?
-2.17.	Programs like `logname', `top', `uptime' `users', `w' and
+2.18.	Programs like `logname', `top', `uptime' `users', `w' and
 	`who', show incorrect information about the (number of)
 	users on my system.  Why?
-2.18.	After upgrading to glibc 2.1 with symbol versioning I get
+2.19.	After upgrading to glibc 2.1 with symbol versioning I get
 	errors about undefined symbols.  What went wrong?
-2.19.	When I start the program XXX after upgrading the library
+2.20.	When I start the program XXX after upgrading the library
 	I get
 	  XXX: Symbol `_sys_errlist' has different size in shared
 	  object, consider re-linking
 	Why?  What should I do?
-2.20.	What do I need for C++ development?
-2.21.	Even statically linked programs need some shared libraries
+2.21.	What do I need for C++ development?
+2.22.	Even statically linked programs need some shared libraries
 	which is not acceptable for me.  What can I do?
-2.22.	I just upgraded my Linux system to glibc and now I get
+2.23.	I just upgraded my Linux system to glibc and now I get
 	errors whenever I try to link any program.
-2.23.	When I use nscd the machine freezes.
+2.24.	When I use nscd the machine freezes.
 
 3. Source and binary incompatibilities, and what to do about them
 
@@ -188,6 +191,9 @@ may not have all the features GNU libc requires.  The current releases of
 egcs (1.0.3 and 1.1) and GNU CC (2.8.1) should work with the GNU C library
 (for powerpc see question question 1.5).
 
+{ZW} You may have problems if you try to mix code compiled with
+EGCS and with GCC 2.8.1. See question 2.8 for details.
+
 
 1.3.	When I try to compile glibc I get only error messages.
 	What's wrong?
@@ -195,32 +201,27 @@ egcs (1.0.3 and 1.1) and GNU CC (2.8.1) should work with the GNU C library
 {UD} You definitely need GNU make to translate GNU libc.  No other make
 program has the needed functionality.
 
-We recommend version GNU make version 3.75.  Versions 3.76 and 3.76.1 have
-bugs which appear when building big projects like GNU libc.  Versions before
-3.74 have bugs and/or are missing features.
-
-
-1.4.	Do I need a special linker or archiver?
+We recommend version GNU make version 3.75 or 3.77.  Versions before 3.75
+have bugs and/or are missing features.  Version 3.76 has bugs which
+appear when building big projects like GNU libc. 3.76.1 appears to work but
+some people have reported problems.
 
-{UD} You may be able to use your system linker, but GNU libc works best with
-GNU binutils.
 
-On systems where the native linker does not support weak symbols you will
-not get a fully ISO C compliant C library.  Generally speaking you should
-use the GNU binutils if they provide at least the same functionality as your
-system's tools.
+1.4.	Do I need a special linker or assembler?
 
-Always get the newest release of GNU binutils available.  Older releases are
-known to have bugs that prevent a successful compilation.
+{ZW} If you want a shared library, you need a linker and assembler that
+understand all the features of ELF, including weak and versioned symbols.
+The static library can be compiled with less featureful tools, but lacks key
+features such as NSS.
 
-{AJ} Please don't use binutils 2.7.  That release contains some bugs which
-might make it necessary that you've got to recompile all your glibc2
-binaries when upgrading the GNU C library.
+For Linux or Hurd, you want binutils 2.8.1.0.23, 2.9.1, or 2.9.1.0.15 or
+higher.  These are the only versions we've tested and found reliable.  Other
+versions after 2.8.1.0.23 may work but we don't recommend them, especially
+not when C++ is involved.  Earlier versions do not work at all.
 
-{ZW} As of release 2.1 a linker supporting symbol versions is required.  For
-Linux, get binutils-2.8.1.0.23 or later.  Other systems may have native
-linker support, but it's moot right now, because glibc has not been ported
-to them.
+Other operating systems may come with system tools that have all the
+necessary features, but this is moot because glibc hasn't been ported to
+them.
 
 
 1.5.	Which compiler should I use for powerpc?
@@ -237,7 +238,7 @@ variables.  There is a temporary patch at:
 Later versions of egcs may fix this problem.
 
 
-1.6.	Do I need some more things to compile GNU C Library?
+1.6.	Do I need some more things to compile the GNU C Library?
 
 {UD} Yes, there are some more :-).
 
@@ -247,15 +248,15 @@ Later versions of egcs may fix this problem.
   site.  (We distribute compiled message catalogs, but they may not be
   updated in patches.)
 
-* Some files depend on special tools.  E.g., files ending in .gperf
-  need a `gperf' program.  The GNU version (part of libg++) is known
-  to work while some vendor versions do not.
+* Some files are built with special tools.  E.g., files ending in .gperf
+  need a `gperf' program.  The GNU version (now available in a separate
+  package, formerly only as part of libg++) is known to work while some
+  vendor versions do not.
 
   You should not need these tools unless you change the source files.
 
-* Some scripts need perl5 - but at the moment those scripts are not
-  vital for building and installing GNU libc (some data files will not
-  be created).
+* Perl 5 is needed if you wish to test an installation of GNU libc
+  as the primary C library.
 
 * When compiling for Linux, the header files of the Linux kernel must
   be available to the compiler as <linux/*.h> and <asm/*.h>.
@@ -298,7 +299,7 @@ recompile libc if you ever upgrade to kernel 2.1 or 2.2.  To tell libc which
 headers to use, give configure the --with-headers switch
 (e.g. --with-headers=/usr/src/linux-2.1.107/include).
 
-Note that you must configure the 2.1 kernel if you do this; otherwise libc
+Note that you must configure the 2.1 kernel if you do this, otherwise libc
 will be unable to find <linux/version.h>.  Just copy .config from your 2.0
 kernel sources to the 2.1 tree, do `make oldconfig', and say no to all the
 new options.
@@ -307,8 +308,9 @@ new options.
 1.8.	The compiler hangs while building iconvdata modules.  What's
 	wrong?
 
-{ZW} This is a problem of older GCC.  Initialization of large static arrays
-is very slow.  The compiler will eventually finish; give it time.
+{ZW} This is a problem with old versions of GCC.  Initialization of large
+static arrays is very slow.  The compiler will eventually finish; give it
+time.
 
 The problem is fixed in egcs 1.1 but not in earlier releases.
 
@@ -675,7 +677,36 @@ not a symlink to libc.so.6.  It should look something like this:
 GROUP ( libc.so.6 libc_nonshared.a )
 
 
-2.8.	How can I compile gcc 2.7.2.1 from the gcc source code using
+2.8.	When I run an executable on one system which I compiled on
+	another, I get dynamic linker errors.  Both systems have the same
+	version of glibc installed.  What's wrong?
+
+{ZW} Glibc on one of these systems was compiled with gcc 2.7 or 2.8, the
+other with egcs (any version).  Egcs has functions in its internal
+`libgcc.a' to support exception handling with C++.  They are linked into
+any program or dynamic library compiled with egcs, whether it needs them or
+not.  Dynamic libraries then turn around and export those functions again
+unless special steps are taken to prevent them.
+
+When you link your program, it resolves its references to the exception
+functions to the ones exported accidentally by libc.so.  That works fine as
+long as libc has those functions.  On the other system, libc doesn't have
+those functions because it was compiled by gcc 2.8, and you get undefined
+symbol errors.  The symbols in question are named things like
+`__register_frame_info'.
+
+For glibc 2.0, the workaround is to not compile libc with egcs.  We've also
+incorporated a patch which should prevent the EH functions sneaking into
+libc.  It doesn't matter what compiler you use to compile your program.
+
+For glibc 2.1, we've chosen to do it the other way around: libc.so
+explicitly provides the EH functions.  This is to prevent other shared
+libraries from doing it.  You must therefore compile glibc 2.1 with EGCS
+unless you don't care about ever importing binaries from other systems.
+Again, it doesn't matter what compiler you use for your programs.
+
+
+2.9.	How can I compile gcc 2.7.2.1 from the gcc source code using
 	glibc 2.x?
 
 {AJ} There's only correct support for glibc 2.0.x in gcc 2.7.2.3 or later.
@@ -683,7 +714,7 @@ But you should get at least gcc 2.8.1 or egcs 1.0.2 (or later versions)
 instead.
 
 
-2.9.	The `gencat' utility cannot process the catalog sources which
+2.10.	The `gencat' utility cannot process the catalog sources which
 	were used on my Linux libc5 based system.  Why?
 
 {UD} The `gencat' utility provided with glibc complies to the XPG standard.
@@ -718,7 +749,7 @@ files to the XPG4 form:
 -----------------------------------------------------------------------
 
 
-2.10.	Programs using libc have their messages translated, but other
+2.11.	Programs using libc have their messages translated, but other
 	behavior is not localized (e.g. collating order); why?
 
 {ZW} Translated messages are automatically installed, but the locale
@@ -731,7 +762,7 @@ set up the French Canadian locale, simply issue the command
 Please see localedata/README in the source tree for further details.
 
 
-2.11.	I have set up /etc/nis.conf, and the Linux libc 5 with NYS
+2.12.	I have set up /etc/nis.conf, and the Linux libc 5 with NYS
 	works great.  But the glibc NIS+ doesn't seem to work.
 
 {TK} The glibc NIS+ implementation uses a /var/nis/NIS_COLD_START file for
@@ -744,7 +775,7 @@ package; available at
     http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html
 
 
-2.12.	I have killed ypbind to stop using NIS, but glibc
+2.13.	I have killed ypbind to stop using NIS, but glibc
 	continues using NIS.
 
 {TK} For faster NIS lookups, glibc uses the /var/yp/binding/ files from
@@ -755,7 +786,7 @@ Until ypbind 3.4 is released, you can find a patch at
     ftp://ftp.kernel.org/pub/linux/utils/net/NIS/ypbind-3.3-glibc4.diff.gz
 
 
-2.13.	Under Linux/Alpha, I always get "do_ypcall: clnt_call:
+2.14.	Under Linux/Alpha, I always get "do_ypcall: clnt_call:
 	RPC: Unable to receive; errno = Connection refused" when using NIS.
 
 {TK} You need a ypbind version which is 64bit clean.  Some versions are not
@@ -764,14 +795,14 @@ you need the patch from ftp.kernel.org (See the previous question).  I don't
 know about other versions.
 
 
-2.14.	After installing glibc name resolving doesn't work properly.
+2.15.	After installing glibc name resolving doesn't work properly.
 
 {AJ} You probably should read the manual section describing nsswitch.conf
 (just type `info libc "NSS Configuration File"').  The NSS configuration
 file is usually the culprit.
 
 
-2.15.	How do I create the databases for NSS?
+2.16.	How do I create the databases for NSS?
 
 {AJ} If you have an entry "db" in /etc/nsswitch.conf you should also create
 the database files.  The glibc sources contain a Makefile which does the
@@ -782,7 +813,7 @@ database.  Currently passwd, group, ethers, protocol, rpc, services shadow
 and netgroup are implemented.
 
 
-2.16.	I have /usr/include/net and /usr/include/scsi as symlinks
+2.17.	I have /usr/include/net and /usr/include/scsi as symlinks
 	into my Linux source tree.  Is that wrong?
 
 {PB} This was necessary for libc5, but is not correct when using glibc.
@@ -793,14 +824,14 @@ in place before you install glibc.  However, /usr/include/asm and
 /usr/include/linux should remain as they were.
 
 
-2.17.	Programs like `logname', `top', `uptime' `users', `w' and
+2.18.	Programs like `logname', `top', `uptime' `users', `w' and
 	`who', show incorrect information about the (number of)
 	users on my system.  Why?
 
 {MK} See question 3.2.
 
 
-2.18.	After upgrading to glibc 2.1 with symbol versioning I get
+2.19.	After upgrading to glibc 2.1 with symbol versioning I get
 	errors about undefined symbols.  What went wrong?
 
 {AJ} The problem is caused either by wrong program code or tools.  In the
@@ -814,7 +845,7 @@ price you might have to pay once for quite a number of advantages with
 symbol versioning.
 
 
-2.19.	When I start the program XXX after upgrading the library
+2.20.	When I start the program XXX after upgrading the library
 	I get
 	  XXX: Symbol `_sys_errlist' has different size in shared
 	  object, consider re-linking
@@ -836,26 +867,26 @@ be possible that a symbol changed size when that should not have happened.
 So in case of doubt report such a warning message as a problem.
 
 
-2.20.	What do I need for C++ development?
+2.21.	What do I need for C++ development?
+
+{HJ,AJ} You need either egcs 1.1 which comes directly with libstdc++ or
+gcc-2.8.1 together with libstdc++ 2.8.1.1.  egcs 1.1 has the better C++
+support and works directly with glibc 2.1.  If you use gcc-2.8.1 with
+libstdc++ 2.8.1.1, you need to modify libstdc++ a bit.  A patch is available
+as:
+	ftp://alpha.gnu.org/gnu/libstdc++-2.8.1.1-glibc2.1-diff.gz
 
-{HJ,AJ} You need either egcs 1.1 which comes directly with libstdc++ or 
-gcc-2.8.1 together with libstdc++ 2.8.1.1.  egcs 1.1 has the better C++ 
-support and works directly with glibc 2.1.  If you use gcc-2.8.1 with 
-libstdc++ 2.8.1.1, you need to modify libstdc++ a bit.  A patch is available 
-as: 
-	ftp://alpha.gnu.org/gnu/libstdc++-2.8.1.1-glibc2.1-diff.gz 
- 
-Please note that libg++ 2.7.2 (and the Linux Versions 2.7.2.x) doesn't work 
-very well with the GNU C library due to vtable thunks.  If you're upgrading 
-from glibc 2.0.x to 2.1 you have to recompile libstdc++ since the library 
-compiled for 2.0 is not compatible due to the new Large File Support (LFS) 
-in version 2.1. 
+Please note that libg++ 2.7.2 (and the Linux Versions 2.7.2.x) doesn't work
+very well with the GNU C library due to vtable thunks.  If you're upgrading
+from glibc 2.0.x to 2.1 you have to recompile libstdc++ since the library
+compiled for 2.0 is not compatible due to the new Large File Support (LFS)
+in version 2.1.
 
 {UD} But since in the case of a shared libstdc++ the version numbers should
 be different existing programs will continue to work.
 
 
-2.21.	Even statically linked programs need some shared libraries
+2.22.	Even statically linked programs need some shared libraries
 	which is not acceptable for me.  What can I do?
 
 {AJ} NSS (for details just type `info libc "Name Service Switch"') won't
@@ -882,7 +913,7 @@ option is using NSS.  There is no switch anymore.  Therefore it is
 the behaviour of the programs on the system inconsistent.
 
 
-2.22.	I just upgraded my Linux system to glibc and now I get
+2.23.	I just upgraded my Linux system to glibc and now I get
 	errors whenever I try to link any program.
 
 {ZW} This happens when you have installed glibc as the primary C library but
@@ -901,15 +932,13 @@ detect these situations.  If the script reports problems, something is
 really screwed up.
 
 
-2.23.	When I use nscd the machine freezes.
+2.24.	When I use nscd the machine freezes.
 
-{UD} It is well known that you cannot use nscd with Linux 2.0.*.  There
-is functionality missing in the kernel and work-arounds are not suitable.
-Beside this some parts of the kernel are too buggy when it comes to using
-threads.
+{UD} You cannot use nscd with Linux 2.0.*.  There is functionality missing
+in the kernel and work-arounds are not suitable.  Besides, some parts of the
+kernel are too buggy when it comes to using threads.
 
-So you have the possibilities to run Linux 2.0.* or update to a higher
-version and start using nscd.
+If you need nscd, you have to use a 2.1 kernel.
 
 Note that I have at this point no information about any other platform.
 
diff --git a/Makeconfig b/Makeconfig
index 99389276f9..20fa1b01ef 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -789,14 +789,13 @@ $(common-objpfx)sysd-dirs: $(common-objpfx)config.make $(all-Subdirs-files)
 all-Depend-files = $(wildcard $(..)*/Depend)
 $(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk $(all-Depend-files) \
 			     $(common-objpfx)sysd-dirs $(..)Makeconfig
-	(if test "$(all-Depend-files)"; then				\
-	   for f in $(all-Depend-files); do				\
-	     dir=$${f%%/*};						\
-	     while read on; do						\
-	       echo "depend $$dir $$on";				\
-	     done < $$f;						\
-	   done;							\
-	 fi;								\
+	(files="$(all-Depend-files)";					\
+	 for f in $$files; do						\
+	   dir=`echo $$f | sed 's/^$(..)\(.*\)\/[^/]*$$/\1/'`;		\
+	   while read on; do						\
+	     echo "depend $$dir $$on";					\
+	   done < $$f;							\
+	 done;								\
 	 for f in $(all-subdirs); do					\
 	   echo $$f;							\
 	 done								\
diff --git a/Makefile b/Makefile
index c439a29d06..e7fb520e3b 100644
--- a/Makefile
+++ b/Makefile
@@ -253,7 +253,8 @@ distribute  :=	README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS	\
 		$(addprefix scripts/,					\
 			    rellns-sh config.sub config.guess		\
 			    mkinstalldirs move-if-change install-sh	\
-			    test-installation.pl gen-FAQ.pl versions.awk)
+			    test-installation.pl gen-FAQ.pl versions.awk\
+			    gen-sorted.awk)
 
 distribute := $(strip $(distribute))
 generated := $(generated) stubs.h
diff --git a/aclocal.m4 b/aclocal.m4
index 4da7ef89b4..8a1819d6f9 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -116,6 +116,17 @@ if test -n "$path_binutils"; then
 fi
 AS=`$CC -print-prog-name=as`
 LD=`$CC -print-prog-name=ld`
+AR=`$CC -print-prog-name=ar`
+AC_SUBST(AR)
+
+# ranlib has to be treated a bit differently since it might not exist at all.
+RANLIB=`$CC -print-prog-name=ranlib`
+if test $RANLIB = ranlib; then
+# This extra check has to happen since gcc simply echos the parameter in
+# case it cannot find the value in its own directories.
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+fi
+AC_SUBST(RANLIB)
 
 # Determine whether we are using GNU binutils.
 AC_CACHE_CHECK(whether $AS is GNU as, libc_cv_prog_as_gnu,
diff --git a/bits/byteswap.h b/bits/byteswap.h
index 73189cfe5c..6b5115658b 100644
--- a/bits/byteswap.h
+++ b/bits/byteswap.h
@@ -29,9 +29,9 @@
         ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); }))
 #else
 static __inline unsigned short int
-__bswap16 (unsigned short int x)
+__bswap_16 (unsigned short int __bsx)
 {
-  return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
+  return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
 }
 #endif
 
@@ -44,7 +44,7 @@ __bswap16 (unsigned short int x)
 	 (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24)); }))
 #else
 static __inline unsigned int
-__bswap32 (unsigned int x)
+__bswap_32 (unsigned int __bsx)
 {
   return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >>  8) |
 	  (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24));
diff --git a/configure b/configure
index 2281a6a7eb..c5c29d5cd2 100755
--- a/configure
+++ b/configure
@@ -1655,80 +1655,18 @@ if test -n "$path_binutils"; then
 fi
 AS=`$CC -print-prog-name=as`
 LD=`$CC -print-prog-name=ld`
-
-# Determine whether we are using GNU binutils.
-echo $ac_n "checking whether $AS is GNU as""... $ac_c" 1>&6
-echo "configure:1662: checking whether $AS is GNU as" >&5
-if eval "test \"`echo '$''{'libc_cv_prog_as_gnu'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  # Most GNU programs take a -v and spit out some text including
-# the word 'GNU'.  Some try to read stdin, so give them /dev/null.
-if $AS -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
-  libc_cv_prog_as_gnu=yes
-else
-  libc_cv_prog_as_gnu=no
-fi
-rm -fr contest*
-fi
-
-echo "$ac_t""$libc_cv_prog_as_gnu" 1>&6
-rm -f a.out
-gnu_as=$libc_cv_prog_as_gnu
-
-echo $ac_n "checking whether $LD is GNU ld""... $ac_c" 1>&6
-echo "configure:1681: checking whether $LD is GNU ld" >&5
-if eval "test \"`echo '$''{'libc_cv_prog_ld_gnu'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  # Most GNU programs take a -v and spit out some text including
-# the word 'GNU'.  Some try to read stdin, so give them /dev/null.
-if $LD -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
-  libc_cv_prog_ld_gnu=yes
-else
-  libc_cv_prog_ld_gnu=no
-fi
-rm -fr contest*
-fi
-
-echo "$ac_t""$libc_cv_prog_ld_gnu" 1>&6
-gnu_ld=$libc_cv_prog_ld_gnu
-
-# 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:1701: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&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="${IFS}:"
-  for ac_dir in $PATH; 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"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
-  echo "$ac_t""$AR" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
+AR=`$CC -print-prog-name=ar`
 
 
+# ranlib has to be treated a bit differently since it might not exist at all.
+RANLIB=`$CC -print-prog-name=ranlib`
+if test $RANLIB = ranlib; then
+# This extra check has to happen since gcc simply echos the parameter in
+# case it cannot find the value in its own directories.
 # 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:1732: checking for $ac_word" >&5
+echo "configure:1670: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1759,7 +1697,7 @@ if test -n "$ac_tool_prefix"; then
   # 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:1763: checking for $ac_word" >&5
+echo "configure:1701: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1790,10 +1728,51 @@ else
 fi
 fi
 
+fi
+
+
+# Determine whether we are using GNU binutils.
+echo $ac_n "checking whether $AS is GNU as""... $ac_c" 1>&6
+echo "configure:1737: checking whether $AS is GNU as" >&5
+if eval "test \"`echo '$''{'libc_cv_prog_as_gnu'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # Most GNU programs take a -v and spit out some text including
+# the word 'GNU'.  Some try to read stdin, so give them /dev/null.
+if $AS -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
+  libc_cv_prog_as_gnu=yes
+else
+  libc_cv_prog_as_gnu=no
+fi
+rm -fr contest*
+fi
+
+echo "$ac_t""$libc_cv_prog_as_gnu" 1>&6
+rm -f a.out
+gnu_as=$libc_cv_prog_as_gnu
+
+echo $ac_n "checking whether $LD is GNU ld""... $ac_c" 1>&6
+echo "configure:1756: checking whether $LD is GNU ld" >&5
+if eval "test \"`echo '$''{'libc_cv_prog_ld_gnu'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # Most GNU programs take a -v and spit out some text including
+# the word 'GNU'.  Some try to read stdin, so give them /dev/null.
+if $LD -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
+  libc_cv_prog_ld_gnu=yes
+else
+  libc_cv_prog_ld_gnu=no
+fi
+rm -fr contest*
+fi
+
+echo "$ac_t""$libc_cv_prog_ld_gnu" 1>&6
+gnu_ld=$libc_cv_prog_ld_gnu
+
 # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args.
 set dummy ${ac_tool_prefix}mig; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1797: checking for $ac_word" >&5
+echo "configure:1776: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_MIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1833,7 +1812,7 @@ fi
 
 # check if ranlib is necessary
 echo $ac_n "checking whether ranlib is necessary""... $ac_c" 1>&6
-echo "configure:1837: checking whether ranlib is necessary" >&5
+echo "configure:1816: checking whether ranlib is necessary" >&5
 if eval "test \"`echo '$''{'libc_cv_ranlib_necessary'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1867,7 +1846,7 @@ fi
 # - two terminals occur directly after each other
 # - the path contains an element with a dot in it
 echo $ac_n "checking LD_LIBRARY_PATH variable""... $ac_c" 1>&6
-echo "configure:1871: checking LD_LIBRARY_PATH variable" >&5
+echo "configure:1850: checking LD_LIBRARY_PATH variable" >&5
 case ${LD_LIBRARY_PATH} in
   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
     ld_library_path_setting="contains current directory"
@@ -1887,7 +1866,7 @@ fi
 # Extract the first word of "bash", so it can be a program name with args.
 set dummy bash; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1891: checking for $ac_word" >&5
+echo "configure:1870: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1929,7 +1908,7 @@ if test "$BASH" = no; then
   # Extract the first word of "ksh", so it can be a program name with args.
 set dummy ksh; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1933: checking for $ac_word" >&5
+echo "configure:1912: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_KSH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1975,7 +1954,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1979: checking for $ac_word" >&5
+echo "configure:1958: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2006,7 +1985,7 @@ done
 # 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:2010: checking for $ac_word" >&5
+echo "configure:1989: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2040,7 +2019,7 @@ install_info_path=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
 # Extract the first word of "install-info", so it can be a program name with args.
 set dummy install-info; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2044: checking for $ac_word" >&5
+echo "configure:2023: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_INSTALL_INFO'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2072,7 +2051,7 @@ fi
 
 if test "$INSTALL_INFO" != "no"; then
 echo $ac_n "checking for old Debian install-info""... $ac_c" 1>&6
-echo "configure:2076: checking for old Debian install-info" >&5
+echo "configure:2055: checking for old Debian install-info" >&5
 if eval "test \"`echo '$''{'libc_cv_old_debian_install_info'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2105,7 +2084,7 @@ fi
 
 
 echo $ac_n "checking for signed size_t type""... $ac_c" 1>&6
-echo "configure:2109: checking for signed size_t type" >&5
+echo "configure:2088: checking for signed size_t type" >&5
 if eval "test \"`echo '$''{'libc_cv_signed_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2129,12 +2108,12 @@ EOF
 fi
 
 echo $ac_n "checking for libc-friendly stddef.h""... $ac_c" 1>&6
-echo "configure:2133: checking for libc-friendly stddef.h" >&5
+echo "configure:2112: checking for libc-friendly stddef.h" >&5
 if eval "test \"`echo '$''{'libc_cv_friendly_stddef'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2138 "configure"
+#line 2117 "configure"
 #include "confdefs.h"
 #define __need_size_t
 #define __need_wchar_t
@@ -2149,7 +2128,7 @@ size_t size; wchar_t wchar;
 if (&size == NULL || &wchar == NULL) abort ();
 ; return 0; }
 EOF
-if { (eval echo configure:2153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_friendly_stddef=yes
 else
@@ -2168,7 +2147,7 @@ override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
 fi
 
 echo $ac_n "checking whether we need to use -P to assemble .S files""... $ac_c" 1>&6
-echo "configure:2172: checking whether we need to use -P to assemble .S files" >&5
+echo "configure:2151: checking whether we need to use -P to assemble .S files" >&5
 if eval "test \"`echo '$''{'libc_cv_need_minus_P'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2191,7 +2170,7 @@ asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
 fi
 
 echo $ac_n "checking for assembler global-symbol directive""... $ac_c" 1>&6
-echo "configure:2195: checking for assembler global-symbol directive" >&5
+echo "configure:2174: checking for assembler global-symbol directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_global_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2221,7 +2200,7 @@ EOF
 fi
 
 echo $ac_n "checking for .set assembler directive""... $ac_c" 1>&6
-echo "configure:2225: checking for .set assembler directive" >&5
+echo "configure:2204: checking for .set assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_set_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2255,7 +2234,7 @@ EOF
 fi
 
 echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
-echo "configure:2259: checking for .symver assembler directive" >&5
+echo "configure:2238: checking for .symver assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_symver_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2274,7 +2253,7 @@ fi
 
 echo "$ac_t""$libc_cv_asm_symver_directive" 1>&6
 echo $ac_n "checking for ld --version-script""... $ac_c" 1>&6
-echo "configure:2278: checking for ld --version-script" >&5
+echo "configure:2257: checking for ld --version-script" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_version_script_option'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2297,7 +2276,7 @@ EOF
     if { ac_try='${CC-cc} $CFLAGS -shared -o conftest.so conftest.o
 					-nostartfiles -nostdlib
 					-Wl,--version-script,conftest.map
-		       1>&5'; { (eval echo configure:2301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+		       1>&5'; { (eval echo configure:2280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
     then
       libc_cv_ld_version_script_option=yes
     else
@@ -2335,7 +2314,7 @@ if test $VERSIONING = no; then
 fi
 if test $elf = yes; then
   echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:2339: checking for .previous assembler directive" >&5
+echo "configure:2318: checking for .previous assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2343,7 +2322,7 @@ else
 .section foo_section
 .previous
 EOF
-  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2326: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     libc_cv_asm_previous_directive=yes
   else
     libc_cv_asm_previous_directive=no
@@ -2359,7 +2338,7 @@ EOF
 
   else
     echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:2363: checking for .popsection assembler directive" >&5
+echo "configure:2342: checking for .popsection assembler directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2367,7 +2346,7 @@ else
 .pushsection foo_section
 .popsection
 EOF
-    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:2350: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
       libc_cv_asm_popsection_directive=yes
     else
       libc_cv_asm_popsection_directive=no
@@ -2387,12 +2366,12 @@ fi
 
 if test $elf != yes; then
   echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:2391: checking for .init and .fini sections" >&5
+echo "configure:2370: checking for .init and .fini sections" >&5
 if eval "test \"`echo '$''{'libc_cv_have_initfini'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2396 "configure"
+#line 2375 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2401,7 +2380,7 @@ asm (".section .init");
 				    asm (".text");
 ; return 0; }
 EOF
-if { (eval echo configure:2405: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2384: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -2429,19 +2408,19 @@ if test $elf = yes; then
 else
   if test $ac_cv_prog_cc_works = yes; then
     echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:2433: checking for _ prefix on C symbol names" >&5
+echo "configure:2412: checking for _ prefix on C symbol names" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2438 "configure"
+#line 2417 "configure"
 #include "confdefs.h"
 asm ("_glibc_foobar:");
 int main() {
 glibc_foobar ();
 ; return 0; }
 EOF
-if { (eval echo configure:2445: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   libc_cv_asm_underscores=yes
 else
@@ -2456,17 +2435,17 @@ fi
 echo "$ac_t""$libc_cv_asm_underscores" 1>&6
   else
     echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:2460: checking for _ prefix on C symbol names" >&5
+echo "configure:2439: checking for _ prefix on C symbol names" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_underscores'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2465 "configure"
+#line 2444 "configure"
 #include "confdefs.h"
 void underscore_test(void) {
 return; }
 EOF
-if { (eval echo configure:2470: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   if grep _underscore_test conftest* >/dev/null; then
     rm -f conftest*
     libc_cv_asm_underscores=yes
@@ -2498,7 +2477,7 @@ if test $elf = yes; then
 fi
 
 echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:2502: checking for assembler .weak directive" >&5
+echo "configure:2481: checking for assembler .weak directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weak_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2521,7 +2500,7 @@ echo "$ac_t""$libc_cv_asm_weak_directive" 1>&6
 
 if test $libc_cv_asm_weak_directive = no; then
   echo $ac_n "checking for assembler .weakext directive""... $ac_c" 1>&6
-echo "configure:2525: checking for assembler .weakext directive" >&5
+echo "configure:2504: checking for assembler .weakext directive" >&5
 if eval "test \"`echo '$''{'libc_cv_asm_weakext_directive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2559,7 +2538,7 @@ EOF
 fi
 
 echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:2563: checking for ld --no-whole-archive" >&5
+echo "configure:2542: checking for ld --no-whole-archive" >&5
 if eval "test \"`echo '$''{'libc_cv_ld_no_whole_archive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2570,7 +2549,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -Wl,--no-whole-archive
-			    -o conftest conftest.c 1>&5'; { (eval echo configure:2574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c 1>&5'; { (eval echo configure:2553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_ld_no_whole_archive=yes
 else
   libc_cv_ld_no_whole_archive=no
@@ -2584,7 +2563,7 @@ if test $libc_cv_ld_no_whole_archive = yes; then
 fi
 
 echo $ac_n "checking for gcc -fexceptions""... $ac_c" 1>&6
-echo "configure:2588: checking for gcc -fexceptions" >&5
+echo "configure:2567: checking for gcc -fexceptions" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_exceptions'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2595,7 +2574,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -fexceptions
-			    -o conftest conftest.c 1>&5'; { (eval echo configure:2599: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c 1>&5'; { (eval echo configure:2578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_exceptions=yes
 else
   libc_cv_gcc_exceptions=no
@@ -2610,14 +2589,14 @@ fi
 
 if test "$base_machine" = alpha ; then
 echo $ac_n "checking for function ..ng prefix""... $ac_c" 1>&6
-echo "configure:2614: checking for function ..ng prefix" >&5
+echo "configure:2593: checking for function ..ng prefix" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_alpha_ng_prefix'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<\EOF
 foo () { }
 EOF
-if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:2621: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo..ng" > /dev/null'; { (eval echo configure:2600: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
 then
   libc_cv_gcc_alpha_ng_prefix=yes
 else
@@ -2644,19 +2623,19 @@ if test "$host_cpu" = powerpc ; then
 # Check for a bug present in at least versions 2.8.x of GCC
 # and versions 1.0.x of EGCS.
 echo $ac_n "checking whether clobbering cr0 causes problems""... $ac_c" 1>&6
-echo "configure:2648: checking whether clobbering cr0 causes problems" >&5
+echo "configure:2627: checking whether clobbering cr0 causes problems" >&5
 if eval "test \"`echo '$''{'libc_cv_c_asmcr0_bug'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2653 "configure"
+#line 2632 "configure"
 #include "confdefs.h"
 int tester(int x) { asm ("" : : : "cc"); return x & 123; }
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2639: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_c_asmcr0_bug='no'
 else
@@ -2678,12 +2657,12 @@ fi
 fi
 
 echo $ac_n "checking for DWARF2 unwind info support""... $ac_c" 1>&6
-echo "configure:2682: checking for DWARF2 unwind info support" >&5
+echo "configure:2661: checking for DWARF2 unwind info support" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_dwarf2_unwind_info'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
-#line 2687 "configure"
+#line 2666 "configure"
 static char __EH_FRAME_BEGIN__;
 _start ()
 {
@@ -2710,7 +2689,7 @@ __bzero () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame_info
 			    -nostdlib -nostartfiles
-			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2693: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_dwarf2_unwind_info=static
 else
   libc_cv_gcc_dwarf2_unwind_info=no
@@ -2718,7 +2697,7 @@ fi
 if test $libc_cv_gcc_dwarf2_unwind_info = no; then
   if { ac_try='${CC-cc} $CFLAGS -DCHECK__register_frame
 			      -nostdlib -nostartfiles
-			      -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2722: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			      -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     libc_cv_gcc_dwarf2_unwind_info=yes
   else
     libc_cv_gcc_dwarf2_unwind_info=no
@@ -2748,12 +2727,12 @@ EOF
 esac
 
 echo $ac_n "checking for __builtin_expect""... $ac_c" 1>&6
-echo "configure:2752: checking for __builtin_expect" >&5
+echo "configure:2731: checking for __builtin_expect" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_builtin_expect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.c <<EOF
-#line 2757 "configure"
+#line 2736 "configure"
 int foo (int a)
 {
   a = __builtin_expect (a, 10);
@@ -2761,7 +2740,7 @@ int foo (int a)
 }
 EOF
 if { ac_try='${CC-cc} $CFLAGS -nostdlib -nostartfiles
-			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2765: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c -lgcc >&5'; { (eval echo configure:2744: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_builtin_expect=yes
 else
   libc_cv_gcc_builtin_expect=no
@@ -2822,7 +2801,7 @@ if test "$uname" = "sysdeps/generic"; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:2826: checking OS release for uname" >&5
+echo "configure:2805: checking OS release for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_release'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2844,7 +2823,7 @@ echo "$ac_t""$libc_cv_uname_release" 1>&6
   uname_release="$libc_cv_uname_release"
 
   echo $ac_n "checking OS version for uname""... $ac_c" 1>&6
-echo "configure:2848: checking OS version for uname" >&5
+echo "configure:2827: checking OS version for uname" >&5
 if eval "test \"`echo '$''{'libc_cv_uname_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2866,7 +2845,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:2870: checking stdio selection" >&5
+echo "configure:2849: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
@@ -2880,7 +2859,7 @@ echo "$ac_t""$stdio" 1>&6
 # Test for old glibc 2.0.x headers so that they can be removed properly
 # Search only in includedir.
 echo $ac_n "checking for old glibc 2.0.x headers""... $ac_c" 1>&6
-echo "configure:2884: checking for old glibc 2.0.x headers" >&5
+echo "configure:2863: checking for old glibc 2.0.x headers" >&5
 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
 then
   old_glibc_headers=yes
@@ -2934,7 +2913,7 @@ if test $shared = default; then
 fi
 
 echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6
-echo "configure:2938: checking whether -fPIC is default" >&5
+echo "configure:2917: checking whether -fPIC is default" >&5
 if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
diff --git a/configure.in b/configure.in
index a8dd26a1f4..5e37a1732e 100644
--- a/configure.in
+++ b/configure.in
@@ -472,8 +472,6 @@ fi
 AC_SUBST(cross_compiling)
 AC_PROG_CPP
 LIBC_PROG_BINUTILS
-AC_CHECK_TOOL(AR, ar)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
 AC_CHECK_TOOL(MIG, mig)
 
 # if using special system headers, find out the compiler's sekrit
diff --git a/inet/gethstbyad_r.c b/inet/gethstbyad_r.c
index 33b6c7c71f..175253d9ab 100644
--- a/inet/gethstbyad_r.c
+++ b/inet/gethstbyad_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -27,5 +27,12 @@
 #define ADD_VARIABLES	addr, len, type
 #define NEED_H_ERRNO	1
 #define NEED__RES	1
+#define NEED__RES_HCONF	1
+#define POSTPROCESS \
+  if (status == NSS_STATUS_SUCCESS)					      \
+    {									      \
+      _res_hconf_reorder_addrs (resbuf);				      \
+      _res_hconf_trim_domains (resbuf);					      \
+    }
 
 #include "../nss/getXXbyYY_r.c"
diff --git a/inet/gethstbynm_r.c b/inet/gethstbynm_r.c
index dbc063cc97..c9262a7bb0 100644
--- a/inet/gethstbynm_r.c
+++ b/inet/gethstbynm_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -32,6 +32,10 @@
 #define ADD_VARIABLES	name
 #define NEED_H_ERRNO	1
 #define NEED__RES	1
+#define NEED__RES_HCONF	1
+#define POSTPROCESS \
+  if (status == NSS_STATUS_SUCCESS)					      \
+    _res_hconf_reorder_addrs (resbuf);
 
 #define HANDLE_DIGITS_DOTS	1
 #define HAVE_LOOKUP_BUFFER	1
diff --git a/math/libm-test.c b/math/libm-test.c
index 2cd90757a4..86616a4404 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -1020,7 +1020,7 @@ atan2_test (void)
   check_eps ("atan2 (0.7,1) == 0.61072...", FUNC(atan2) (0.7,1),
 	     0.6107259643892086165L, CHOOSE(3e-17L, 0, 0));
   check_eps ("atan2 (0.4,0.0003) == 1.57004...", FUNC(atan2) (0.4, 0.0003),
-	     1.5700463269355215718L, CHOOSE(2e-19L, 0, 0));
+	     1.5700463269355215718L, CHOOSE(2e-19L, 0, 1.2e-7));
 
 }
 
@@ -1601,7 +1601,8 @@ log_test (void)
   check_eps ("log (e) == 1", FUNC(log) (M_El), 1, CHOOSE (1e-18L, 0, 9e-8L));
   check_eps ("log (1/e) == -1", FUNC(log) (1.0 / M_El), -1,
 	     CHOOSE (2e-18L, 0, 0));
-  check ("log (2) == M_LN2", FUNC(log) (2), M_LN2l);
+  check_eps ("log (2) == M_LN2", FUNC(log) (2), M_LN2l,
+	     CHOOSE (6e-20L, 0, 0));
   check_eps ("log (10) == M_LN10", FUNC(log) (10), M_LN10l,
 	     CHOOSE (1e-18L, 0, 0));
   check_eps ("log (0.7) == -0.3566749439...", FUNC(log) (0.7),
@@ -2743,11 +2744,11 @@ cexp_test (void)
   check_eps ("real(cexp(0.7 + i 1.2)) == 0.72969...", __real__ result,
 	     0.7296989091503236012L, CHOOSE(6e-17L, 2e-16, 2e-7));
   check_eps ("imag(cexp(0.7 + i 1.2)) == 1.87689...", __imag__ result,
-	     1.8768962328348102821L, CHOOSE(2e-16L, 0, 3e-7));
+	     1.8768962328348102821L, CHOOSE(2e-16L, 2.5e-16, 3e-7));
 
   result = FUNC(cexp) (BUILD_COMPLEX (-2, -3));
   check_eps ("real(cexp(-2 - i 3)) == -0.13398...", __real__ result,
-	     -0.1339809149295426134L, CHOOSE(6e-20L, 0, 2e-8));
+	     -0.1339809149295426134L, CHOOSE(6.8e-20L, 0, 2e-8));
   check_eps ("imag(cexp(-2 - i 3)) == -0.01909...", __imag__ result,
 	     -0.0190985162611351964L, CHOOSE(4e-20L, 0, 2e-9));
 }
@@ -3745,13 +3746,13 @@ cacosh_test (void)
   check_eps ("real(cacosh(0.7 + i 1.2)) == 1.09276...", __real__ result,
 	     1.0927647857577371459L, CHOOSE(4e-17L, 3e-16, 2e-7));
   check_eps ("imag(cacosh(0.7 + i 1.2)) == 1.13518...", __imag__ result,
-	 1.1351827477151551089L, CHOOSE(2e-17L, 0, 0));
+	 1.1351827477151551089L, CHOOSE(2e-17L, 0, 1.2e-7));
 
   result = FUNC(cacosh) (BUILD_COMPLEX (-2, -3));
   check_eps ("real(cacosh(-2 - i 3)) == -1.98338...", __real__ result,
 	     -1.9833870299165354323L, CHOOSE (2e-18L, 3e-16, 9e-7));
   check_eps ("imag(cacosh(-2 - i 3)) == 2.14144...", __imag__ result,
-	     2.1414491111159960199L, CHOOSE (3e-19, 5e-16, 1e-6));
+	     2.1414491111159960199L, CHOOSE (4.5e-19, 5e-16, 1e-6));
 }
 
 
@@ -4041,7 +4042,7 @@ casinh_test (void)
   check_eps ("real(casinh(-2 - i 3)) == -1.96863...", __real__ result,
 	     -1.9686379257930962917L, CHOOSE(7e-19L, 2e-15, 3e-6));
   check_eps ("imag(casinh(-2 - i 3)) == -0.96465...", __imag__ result,
-	     -0.9646585044076027920L, CHOOSE(4e-19L, 2e-15, 4e-7));
+	     -0.9646585044076027920L, CHOOSE(4e-19L, 2e-15, 4.5e-7));
 }
 
 
@@ -4333,7 +4334,7 @@ catanh_test (void)
 
   result = FUNC(catanh) (BUILD_COMPLEX (0.7, 1.2));
   check_eps ("real(catanh(0.7 + i 1.2)) == 0.26007...", __real__ result,
-	     0.2600749516525135959L, CHOOSE (2e-18, 6e-17, 0));
+	     0.2600749516525135959L, CHOOSE (2e-18, 6e-17, 3e-8));
   check_eps ("imag(catanh(0.7 + i 1.2)) == 0.97024...", __imag__ result,
 	     0.9702403077950989849L, CHOOSE (3e-17, 2e-16, 4e-7));
 
@@ -4806,7 +4807,7 @@ clog_test (void)
   check_eps ("real(clog(0.7 + i 1.2)) == 0.32876...", __real__ result,
 	     0.3287600014583970919L, CHOOSE(5e-17L, 6e-17, 3e-8));
   check_eps ("imag(clog(0.7 + i 1.2)) == 1.04272...", __imag__ result,
-	     1.0427218783685369524L, CHOOSE(2e-17L, 0, 0));
+	     1.0427218783685369524L, CHOOSE(2e-17L, 2.5e-16, 1.2e-7));
 
   result = FUNC(clog) (BUILD_COMPLEX (-2, -3));
   check_eps ("real(clog(-2 - i 3)) == 1.28247...", __real__ result,
@@ -4988,7 +4989,7 @@ clog10_test (void)
   check_eps ("real(clog10(0.7 + i 1.2)) == 0.14277...", __real__ result,
 	     0.1427786545038868803L, CHOOSE(2e-17L, 6e-17, 2e-8));
   check_eps ("imag(clog10(0.7 + i 1.2)) == 0.45284...", __imag__ result,
-	     0.4528483579352493248L, CHOOSE(6e-18, 6e-17, 3e-8));
+	     0.4528483579352493248L, CHOOSE(6e-18, 6e-17, 6e-8));
 
   result = FUNC(clog10) (BUILD_COMPLEX (-2, -3));
   check_eps ("real(clog10(-2 - i 3)) == 0.55697...", __real__ result,
@@ -5181,7 +5182,7 @@ cpow_test (void)
 
   result = FUNC (cpow) (BUILD_COMPLEX (2, 0), BUILD_COMPLEX (10, 0));
   check_eps ("real(cpow (2 + i0), (10 + i0)) == 1024", __real__ result, 1024,
-	     CHOOSE (2e-16L, 0, 0));
+	     CHOOSE (6e-16L, 0, 0));
   check ("imag(cpow (2 + i0), (10 + i0)) == 0", __imag__ result, 0);
 
   result = FUNC (cpow) (BUILD_COMPLEX (M_El, 0), BUILD_COMPLEX (0, 2 * M_PIl));
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 3befede20f..7e567a1325 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -22,6 +22,9 @@
 #ifdef USE_NSCD
 # include <nscd/nscd_proto.h>
 #endif
+#ifdef NEED__RES_HCONF
+# include <resolv/res_hconf.h>
+#endif
 
 /*******************************************************************\
 |* Here we assume several symbols to be defined:		   *|
@@ -153,6 +156,10 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
 	      return -1;
 	    }
 #endif /* need _res */
+#ifdef NEED__RES_HCONF
+	  if (!_res_hconf.initialized)
+	    _res_hconf_init ();
+#endif /* need _res_hconf */
 	}
     }
   else
@@ -186,6 +193,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
 done:
 #endif
   *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
+#ifdef POSTPROCESS
+  POSTPROCESS;
+#endif
   return status == NSS_STATUS_SUCCESS ? 0 : -1;
 }
 
diff --git a/resolv/Makefile b/resolv/Makefile
index fe5a0f16c1..71a66fe0f0 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -23,9 +23,9 @@ subdir	:= resolv
 
 headers	:= resolv.h netdb.h arpa/nameser.h sys/bitypes.h
 distribute := ../conf/portability.h mapv4v6addr.h mapv4v6hostent.h \
-	      Banner
+	      Banner res_hconf.h
 
-routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init
+routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init res_hconf
 
 tests = tst-aton
 
diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c
index 642cada678..c7aee65e59 100644
--- a/resolv/res_hconf.c
+++ b/resolv/res_hconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    Contributed by David Mosberger (davidm@azstarnet.com).
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -32,6 +32,7 @@ to the original implementation:
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <net/if.h>
 
 #include "res_hconf.h"
 
@@ -46,19 +47,21 @@ to the original implementation:
 #define ENV_MULTI	"RESOLV_MULTI"
 #define ENV_REORDER	"RESOLV_REORDER"
 
-static const char * arg_service_list (const char *, int, const char *,
-				      unsigned);
-static const char * arg_trimdomain_list (const char *, int, const char *,
-					 unsigned);
-static const char * arg_spoof (const char *, int, const char *, unsigned);
-static const char * arg_bool (const char *, int, const char *, unsigned);
-
-static struct cmd {
-  const char *	name;
-  const char *	(*parse_args)(const char * filename, int line_num,
-			      const char * args, unsigned arg);
-  unsigned	arg;;
-} cmd[] = {
+static const char *arg_service_list (const char *, int, const char *,
+				     unsigned int);
+static const char *arg_trimdomain_list (const char *, int, const char *,
+					unsigned int);
+static const char *arg_spoof (const char *, int, const char *, unsigned int);
+static const char *arg_bool (const char *, int, const char *, unsigned int);
+
+static struct cmd
+{
+  const char *name;
+  const char *(*parse_args) (const char * filename, int line_num,
+			     const char * args, unsigned int arg);
+  unsigned int arg;
+} cmd[] =
+{
   {"order",		arg_service_list,	0},
   {"trim",		arg_trimdomain_list,	0},
   {"spoof",		arg_spoof,		0},
@@ -68,10 +71,12 @@ static struct cmd {
   {"reorder",		arg_bool,		HCONF_FLAG_REORDER}
 };
 
+/* Structure containing the state.  */
+struct hconf _res_hconf;
 
 /* Skip white space.  */
 static const char *
-skip_ws (const char * str)
+skip_ws (const char *str)
 {
   while (isspace (*str)) ++str;
   return str;
@@ -80,29 +85,32 @@ skip_ws (const char * str)
 
 /* Skip until whitespace, comma, end of line, or comment character.  */
 static const char *
-skip_string (const char * str)
+skip_string (const char *str)
 {
-  while (*str && !isspace (*str) && *str != '#' && *str != ',') ++str;
+  while (*str && !isspace (*str) && *str != '#' && *str != ',')
+    ++str;
   return str;
 }
 
 
 static const char *
-arg_service_list (const char * fname, int line_num, const char * args,
-		  unsigned arg)
+arg_service_list (const char *fname, int line_num, const char *args,
+		  unsigned int arg)
 {
   enum Name_Service service;
-  const char * start;
+  const char *start;
   size_t len;
   int i;
-  static struct {
-    const char *	name;
-    enum Name_Service	service;
-  } svcs[] = {
-    {"bind",	SERVICE_BIND},
-    {"hosts",	SERVICE_HOSTS},
-    {"nis",	SERVICE_NIS},
-  };
+  static struct
+  {
+    const char * name;
+    enum Name_Service service;
+  } svcs[] =
+    {
+      {"bind",	SERVICE_BIND},
+      {"hosts",	SERVICE_HOSTS},
+      {"nis",	SERVICE_NIS},
+    };
 
   do
     {
@@ -113,7 +121,7 @@ arg_service_list (const char * fname, int line_num, const char * args,
       service = SERVICE_NONE;
       for (i = 0; i < sizeof (svcs) / sizeof (svcs[0]); ++i)
 	{
-	  if (strncasecmp (start, svcs[i].name, len) == 0
+	  if (__strncasecmp (start, svcs[i].name, len) == 0
 	      && len == strlen (svcs[i].name))
 	  {
 	    service = svcs[i].service;
@@ -137,7 +145,9 @@ arg_service_list (const char * fname, int line_num, const char * args,
       args = skip_ws (args);
       switch (*args)
 	{
-	case ',': case ';': case ':':
+	case ',':
+	case ';':
+	case ':':
 	  args = skip_ws (++args);
 	  if (!*args || *args == '#')
 	    {
@@ -156,8 +166,8 @@ arg_service_list (const char * fname, int line_num, const char * args,
 
 
 static const char *
-arg_trimdomain_list (const char * fname, int line_num, const char * args,
-		     unsigned flag)
+arg_trimdomain_list (const char *fname, int line_num, const char *args,
+		     unsigned int flag)
 {
   const char * start;
   size_t len;
@@ -176,7 +186,7 @@ arg_trimdomain_list (const char * fname, int line_num, const char * args,
 	  return 0;
 	}
       _res_hconf.trimdomain[_res_hconf.num_trimdomains++] =
-	  strndup (start, len);
+	__strndup (start, len);
       args = skip_ws (args);
       switch (*args)
 	{
@@ -199,21 +209,21 @@ arg_trimdomain_list (const char * fname, int line_num, const char * args,
 
 
 static const char *
-arg_spoof (const char * fname, int line_num, const char * args, unsigned flag)
+arg_spoof (const char *fname, int line_num, const char *args, unsigned flag)
 {
-  const char * start = args;
+  const char *start = args;
   size_t len;
 
   args = skip_string (args);
   len = args - start;
 
-  if (len == 3 && strncasecmp (start, "off", len) == 0)
+  if (len == 3 && __strncasecmp (start, "off", len) == 0)
     _res_hconf.flags &= ~(HCONF_FLAG_SPOOF | HCONF_FLAG_SPOOFALERT);
   else
     {
       _res_hconf.flags |= (HCONF_FLAG_SPOOF | HCONF_FLAG_SPOOFALERT);
-      if ((len == 6 && strncasecmp (start, "nowarn", len) == 0)
-	  || !(len == 4 && strncasecmp (start, "warn", len) == 0))
+      if ((len == 6 && __strncasecmp (start, "nowarn", len) == 0)
+	  || !(len == 4 && __strncasecmp (start, "warn", len) == 0))
 	_res_hconf.flags &= ~HCONF_FLAG_SPOOFALERT;
     }
   return args;
@@ -221,14 +231,14 @@ arg_spoof (const char * fname, int line_num, const char * args, unsigned flag)
 
 
 static const char *
-arg_bool (const char * fname, int line_num, const char * args, unsigned flag)
+arg_bool (const char *fname, int line_num, const char *args, unsigned flag)
 {
-  if (strncasecmp (args, "on", 2) == 0)
+  if (__strncasecmp (args, "on", 2) == 0)
     {
       args += 2;
       _res_hconf.flags |= flag;
     }
-  else if (strncasecmp (args, "off", 3) == 0)
+  else if (__strncasecmp (args, "off", 3) == 0)
     {
       args += 3;
       _res_hconf.flags &= ~flag;
@@ -244,10 +254,10 @@ arg_bool (const char * fname, int line_num, const char * args, unsigned flag)
 
 
 static void
-parse_line (const char * fname, int line_num, const char * str)
+parse_line (const char *fname, int line_num, const char *str)
 {
-  const char * start;
-  struct cmd * c = 0;
+  const char *start;
+  struct cmd *c = 0;
   size_t len;
   int i;
 
@@ -268,7 +278,7 @@ parse_line (const char * fname, int line_num, const char * str)
 	  break;
 	}
     }
-  if (!c)
+  if (c == NULL)
     {
       fprintf (stderr, "%s: line %d: bad command `%s'\n",
 	       fname, line_num, start);
@@ -300,15 +310,18 @@ parse_line (const char * fname, int line_num, const char * str)
 void
 _res_hconf_init (void)
 {
-  const char * hconf_name;
+  const char *hconf_name;
   int line_num = 0;
-  char buf[256], * end, * envval;
-  FILE * fp;
+  char buf[256], *end, *envval;
+  FILE *fp;
 
-  memset (&_res_hconf, 0, sizeof (_res_hconf));
+  if (_res_hconf.initialized)
+    return;
+
+  memset (&_res_hconf, '\0', sizeof (_res_hconf));
 
   hconf_name = getenv (ENV_HOSTCONF);
-  if (!hconf_name)
+  if (hconf_name == NULL)
     hconf_name = _PATH_HOSTCONF;
 
   fp = fopen (hconf_name, "r");
@@ -317,7 +330,7 @@ _res_hconf_init (void)
     _res_hconf.service[_res_hconf.num_services++] = SERVICE_BIND;
   else
     {
-      while (fgets (buf, sizeof (buf), fp))
+      while (fgets_unlocked (buf, sizeof (buf), fp))
 	{
 	  ++line_num;
 	  end = strchr (buf, '\n');
@@ -357,6 +370,8 @@ _res_hconf_init (void)
       _res_hconf.num_trimdomains = 0;
       arg_trimdomain_list (ENV_TRIM_OVERR, 1, envval, 0);
     }
+
+  _res_hconf.initialized = 1;
 }
 
 
@@ -365,19 +380,22 @@ _res_hconf_init (void)
    Otherwise, nothing is changed.  */
 
 void
-_res_hconf_reorder_addrs (struct hostent * hp)
+_res_hconf_reorder_addrs (struct hostent *hp)
 {
-#if defined (SIOCGIFCONF) && defined (SIOCGIFNETMASK)
+#if defined SIOCGIFCONF && defined SIOCGIFNETMASK
   static int num_ifs = -1;	/* number of interfaces */
-  static struct netaddr {
+  static struct netaddr
+  {
     int addrtype;
-    union {
-      struct {
+    union
+    {
+      struct
+      {
 	u_int32_t	addr;
 	u_int32_t	mask;
       } ipv4
     } u;
-  } * ifaddrs;
+  } *ifaddrs;
 
   if (hp->h_addrtype != AF_INET)
     return;	/* can't deal with anything but IPv4 for now... */
@@ -385,7 +403,7 @@ _res_hconf_reorder_addrs (struct hostent * hp)
   if (num_ifs <= 0)
     {
       struct ifconf ifs;
-      struct ifreq * ifr;
+      struct ifreq *ifr;
       size_t size, num;
       int sd;
 
@@ -393,7 +411,7 @@ _res_hconf_reorder_addrs (struct hostent * hp)
 
       num_ifs = 0;
 
-      sd = socket (AF_INET, SOCK_DGRAM, 0);
+      sd = __socket (AF_INET, SOCK_DGRAM, 0);
       if (sd < 0)
 	return;
 
@@ -404,18 +422,20 @@ _res_hconf_reorder_addrs (struct hostent * hp)
 	 interfaces, not memory */
       size = 0;
       ifs.ifc_buf = 0;
-      do {
-	size += 4 * sizeof (struct ifreq);
-	ifs.ifc_buf = realloc (ifs.ifs_buf, size);
-	if (!ifs.ifc_buf)
-	  {
-	    close (sd);
-	    return;
-	  }
-	ifs.ifc_len = size;
-	if (ioctl (sd, SIOCGIFCONF, &ifs) < 0)
-	  goto cleanup;
-      } while (size - ifs.ifc_len < sizeof (struct ifreq));
+      do
+	{
+	  size += 4 * sizeof (struct ifreq);
+	  ifs.ifc_buf = realloc (ifs.ifs_buf, size);
+	  if (ifs.ifc_buf == NULL)
+	    {
+	      close (sd);
+	      return;
+	    }
+	  ifs.ifc_len = size;
+	  if (__ioctl (sd, SIOCGIFCONF, &ifs) < 0)
+	    goto cleanup;
+	}
+      while (size - ifs.ifc_len < sizeof (struct ifreq));
 
       num = ifs.ifc_len / sizeof (struct ifreq);
 
@@ -424,21 +444,22 @@ _res_hconf_reorder_addrs (struct hostent * hp)
 	goto cleanup;
 
       ifr = ifs.ifc_req;
-      for (i = 0; i < num; ++i) {
-	if (ifr->ifr_addr.sa_family != AF_INET)
-	  continue;
-	ifaddrs[num_ifs].addrtype = AF_INET;
+      for (i = 0; i < num; ++i)
+	{
+	  if (ifr->ifr_addr.sa_family != AF_INET)
+	    continue;
+	  ifaddrs[num_ifs].addrtype = AF_INET;
 
-	memcpy (&ifaddrs[num_ifs].u.ipv4.addr,
-		&((struct sockaddr_in *)ifr->ifr_addr)->sin_addr, 4);
+	  memcpy (&ifaddrs[num_ifs].u.ipv4.addr,
+		  &((struct sockaddr_in *)ifr->ifr_addr)->sin_addr, 4);
 
-	if (ioctl (sd, SIOCGIFNETMASK, if) < 0)
-	  continue;
-	memcpy (&ifaddrs[num_ifs].u.ipv4.mask,
-		((struct sockaddr_in *)ifr->ifr_mask)->sin_addr, 4);
+	  if (__ioctl (sd, SIOCGIFNETMASK, if) < 0)
+	    continue;
+	  memcpy (&ifaddrs[num_ifs].u.ipv4.mask,
+		  ((struct sockaddr_in *)ifr->ifr_mask)->sin_addr, 4);
 
-	++num_ifs;	/* now we're committed to this entry */
-      }
+	  ++num_ifs;	/* now we're committed to this entry */
+	}
       /* just keep enough memory to hold all the interfaces we want: */
       ifaddrs = realloc (ifaddrs, num_ifs * sizeof (ifaddrs[0]));
 
@@ -462,9 +483,9 @@ _res_hconf_reorder_addrs (struct hostent * hp)
 
 	  if (((h_addr->s_addr ^ if_addr) & if_netmask) == 0)
 	    {
-	      void * tmp;
+	      void *tmp;
 
-	      tmp		 = hp->h_addr_list[i];
+	      tmp = hp->h_addr_list[i];
 	      hp->h_addr_list[i] = hp->h_addr_list[0];
 	      hp->h_addr_list[0] = tmp;
 	      return;
@@ -481,20 +502,20 @@ _res_hconf_reorder_addrs (struct hostent * hp)
    same domainname could be trimmed multiple times.  I believe this
    was unintentional.  */
 void
-_res_hconf_trim_domain (char * hostname)
+_res_hconf_trim_domain (char *hostname)
 {
   size_t hostname_len, trim_len;
   int i;
 
-  hostname_len = strlen(hostname);
+  hostname_len = strlen (hostname);
 
   for (i = 0; i < _res_hconf.num_trimdomains; ++i)
     {
-      const char * trim = _res_hconf.trimdomain[i];
+      const char *trim = _res_hconf.trimdomain[i];
 
-      trim_len = strlen(trim);
+      trim_len = strlen (trim);
       if (hostname_len > trim_len
-	  && strcasecmp(&hostname[hostname_len - trim_len], trim) == 0)
+	  && __strcasecmp (&hostname[hostname_len - trim_len], trim) == 0)
 	{
 	  hostname[hostname_len - trim_len] = '\0';
 	  break;
@@ -506,7 +527,7 @@ _res_hconf_trim_domain (char * hostname)
 /* Trim all hostnames/aliases in HP according to the trimdomain list.
    Notice that HP is modified inplace!  */
 void
-_res_hconf_trim_domains (struct hostent * hp)
+_res_hconf_trim_domains (struct hostent *hp)
 {
   int i;
 
@@ -517,32 +538,3 @@ _res_hconf_trim_domains (struct hostent * hp)
   for (i = 0; hp->h_aliases[i]; ++i)
     _res_hconf_trim_domain (hp->h_aliases[i]);
 }
-
-
-#if 0
-
-struct hostent *
-_hconf_gethostent (void)
-{
-}
-
-
-struct hostent *
-_hconf_gethostbyname (const char * name)
-{
-
-}
-
-
-struct hostent *
-_hconf_gethostbyaddr (const char * addr, int len, int type)
-{
-}
-
-
-struct hostent *
-_hconf_gethtbyname (const char * name)
-{
-}
-
-#endif
diff --git a/resolv/res_hconf.h b/resolv/res_hconf.h
index c2aeefbcd5..80c0828d4e 100644
--- a/resolv/res_hconf.h
+++ b/resolv/res_hconf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
    Contributed by David Mosberger (davidm@azstarnet.com).
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,28 +23,32 @@
 
 #define TRIMDOMAINS_MAX	4
 
-enum Name_Service {
+enum Name_Service
+{
   SERVICE_NONE = 0,
   SERVICE_BIND, SERVICE_HOSTS, SERVICE_NIS,
   SERVICE_MAX
 };
 
-struct hconf {
-  int			num_services;
-  enum Name_Service	service[SERVICE_MAX];
-  int			num_trimdomains;
-  const char *		trimdomain[TRIMDOMAINS_MAX];
-  unsigned		flags;
+struct hconf
+{
+  int initialized;
+  int num_services;
+  enum Name_Service service[SERVICE_MAX];
+  int num_trimdomains;
+  const char *trimdomain[TRIMDOMAINS_MAX];
+  unsigned int flags;
 #  define HCONF_FLAG_INITED	(1 << 0) /* initialized? */
 #  define HCONF_FLAG_SPOOF	(1 << 1) /* refuse spoofed addresses */
 #  define HCONF_FLAG_SPOOFALERT	(1 << 2) /* syslog warning of spoofed */
 #  define HCONF_FLAG_REORDER	(1 << 3) /* list best address first */
 #  define HCONF_FLAG_MULTI	(1 << 4) /* see comments for gethtbyname() */
-} _res_hconf;
+};
+extern struct hconf _res_hconf;
 
-extern void	_res_hconf_init (void);
-extern void	_res_hconf_trim_domain (char * domain);
-extern void	_res_hconf_trim_domains (struct hostent * hp);
-extern void	_res_hconf_reorder_addrs (struct hostent * hp);
+extern void _res_hconf_init (void);
+extern void _res_hconf_trim_domain (char *domain);
+extern void _res_hconf_trim_domains (struct hostent *hp);
+extern void _res_hconf_reorder_addrs (struct hostent *hp);
 
 #endif /* _RES_HCONF_H_ */
diff --git a/sysdeps/generic/bits/byteswap.h b/sysdeps/generic/bits/byteswap.h
index 73189cfe5c..6b5115658b 100644
--- a/sysdeps/generic/bits/byteswap.h
+++ b/sysdeps/generic/bits/byteswap.h
@@ -29,9 +29,9 @@
         ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); }))
 #else
 static __inline unsigned short int
-__bswap16 (unsigned short int x)
+__bswap_16 (unsigned short int __bsx)
 {
-  return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
+  return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
 }
 #endif
 
@@ -44,7 +44,7 @@ __bswap16 (unsigned short int x)
 	 (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24)); }))
 #else
 static __inline unsigned int
-__bswap32 (unsigned int x)
+__bswap_32 (unsigned int __bsx)
 {
   return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >>  8) |
 	  (((__bsx) & 0x0000ff00) <<  8) | (((__bsx) & 0x000000ff) << 24));
diff --git a/sysdeps/generic/configure b/sysdeps/generic/configure
index 574808f5e8..ddfa2cff80 100755
--- a/sysdeps/generic/configure
+++ b/sysdeps/generic/configure
@@ -32,7 +32,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:36: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:36: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
diff --git a/sysdeps/unix/common/configure b/sysdeps/unix/common/configure
index acd4ef23fe..9e26b276f2 100755
--- a/sysdeps/unix/common/configure
+++ b/sysdeps/unix/common/configure
@@ -15,7 +15,7 @@ int main() {
 extern char *sys_siglist[]; puts(*sys_siglist);
 ; return 0; }
 EOF
-if { (eval echo configure:19: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   	    ac_cv_check_symbol_sys_siglist=yes
 else
@@ -48,7 +48,7 @@ int main() {
 extern char *_sys_siglist[]; puts(*_sys_siglist);
 ; return 0; }
 EOF
-if { (eval echo configure:52: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:52: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   	    ac_cv_check_symbol__sys_siglist=yes
 else
@@ -85,7 +85,7 @@ int main() {
 $ctype[13];
 ; return 0; }
 EOF
-if { (eval echo configure:89: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:89: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   libc_cv_ctype_glue="$ctype"; break
 else
diff --git a/sysdeps/unix/configure b/sysdeps/unix/configure
index b7eff0368d..6398735140 100755
--- a/sysdeps/unix/configure
+++ b/sysdeps/unix/configure
@@ -33,7 +33,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:37: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:37: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else