summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-03-04 05:53:28 +0000
committerUlrich Drepper <drepper@redhat.com>1997-03-04 05:53:28 +0000
commit377a515b4ce100dc119db09a7bc1d7628136993a (patch)
tree92bcdcc43bde79c11ac56b74f05ad4a4dcf3dd96
parentd1a2b102df91d6e478d1fa25d8a3e38f0b98e374 (diff)
downloadglibc-377a515b4ce100dc119db09a7bc1d7628136993a.tar.gz
glibc-377a515b4ce100dc119db09a7bc1d7628136993a.tar.xz
glibc-377a515b4ce100dc119db09a7bc1d7628136993a.zip
1997-03-04 04:31  Ulrich Drepper  <drepper@cygnus.com>

	* Makerules: Add rules to handle versioning.
	* config.h.in (DO_VERSIONING): New macro.
	* config.make.in (versioning): New variable.
	* configure.in: Add checks for .symver directive in gas and
	--version-script option to ld.  Define DO_VERSIONING and
	versioning if appropriate.

	* math/Makefile (routines): Add s_signbit, s_fpclassify, s_fmax,
	s_fmin, and s_fdim.
	* math/math.h: Define ISO C 9X constants, macros and functions.
	* math/mathcalls.h: Likewise.
	* sysdeps/libm-ieee754/s_fdim.c: New file.
	* sysdeps/libm-ieee754/s_fdimf.c: New file.
	* sysdeps/libm-ieee754/s_fdiml.c: New file.
	* sysdeps/libm-ieee754/s_fmax.c: New file.
	* sysdeps/libm-ieee754/s_fmaxf.c: New file.
	* sysdeps/libm-ieee754/s_fmaxl.c: New file.
	* sysdeps/libm-ieee754/s_fmin.c: New file.
	* sysdeps/libm-ieee754/s_fminf.c: New file.
	* sysdeps/libm-ieee754/s_fminl.c: New file.
	* sysdeps/libm-ieee754/s_fpclassify.c: New file.
	* sysdeps/libm-ieee754/s_fpclassifyf.c: New file.
	* sysdeps/libm-ieee754/s_fpclassifyl.c: New file.
	* sysdeps/libm-ieee754/s_signbit.c: New file.
	* sysdeps/libm-ieee754/s_signbitf.c: New file.
	* sysdeps/libm-ieee754/s_signbitl.c: New file.

	* stdio-common/printf_fphex.c: Correct printing of decimal point
	character.
	Simplify conversion of mantissa to string.
	* stdio-common/vfscanf.c: Handle %A format.
	Optimize termination of floating-point scanning.
	* stdio-common/tstscanf.c (main): Add new test to scanf to test
	scanning float values with given width.
	* stdlib/strtod.c: Add handling of floating-point numbers in
	hexadecimal notation.

	* stdlib/stdlib.h: Use __USE_ISOC9X feature macro for new long long
	functions.
	Pretty print #if directives.
	* string/string.h: Pretty print #if directives.

	* sysdeps/ieee754/dbl2mpn.c: Update copyright.
	* sysdeps/ieee754/ldbl2mpn.c: Likewise.
	* sysdeps/ieee754/mpn2dbl.c: Likewise.
	* sysdeps/ieee754/mpn2flt.c: Likewise.
	* sysdeps/ieee754/mpn2ldbl.c: Likewise.

	* sysdeps/unix/sysv/linux/poll.c: Implement poll function by
	falling back to select-based implementation if syscall isn't
	available.
	* sysdeps/unix/sysv/linux/syscalls.list: Add s_poll.

	* time/leapseconds: Update from tzdata1997b.
	* time/zic.c: Update from tzcode1997b.

1997-03-01 15:08  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* time/Makefile $(tzfiles:%=$(objpfx)z.%): Remove unneeded
	depedencies between installed $(tzlinks) and $(tzbases) files.

1997-03-01 14:27  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* math/math.h: Make compatible with traditional preprocessor;
	requires carefull placement of whitespace in macro arguments.
	Use __CONCAT instead of ##.
	Declare long double functions only if __STDC__ or __GNUC__.
	* math/mathcall.h: Avoid whitespace before argument of macro call
	that is used as function name.

	* sysdeps/m68k/fpu/__math.h: Use __CONCAT instead of ##.
	(__m81_u, __m81_inline): Depend on __LIBC_M81_MATH_INLINES instead
	of __NO_M81_MATH_INLINES.
	[!__LIBC_M81_MATH_INLINES]: Don't define internal functions
	starting with __ieee754.
	[!__NO_MATH_INLINES && __OPTIMIZE__]: Define user visible
	functions as inlines.
	(__m81_defun): Put __attribute__ between return type and function
	name.
	* math/math.h: Include <__math.h> also if __LIBC_M81_MATH_INLINES
	is defined.
	* sysdeps/m68k/fpu/e_acos.c: Define __LIBC_M81_MATH_INLINES
	instead of __NO_M81_MATH_INLINES.
	* sysdeps/m68k/fpu/e_fmod.c: Likewise.
	* sysdeps/m68k/fpu/k_cos.c: Likewise.
	* sysdeps/m68k/fpu/k_sin.c: Likewise.
	* sysdeps/m68k/fpu/k_tan.c: Likewise.
	* sysdeps/m68k/fpu/s_atan.c: Likewise. De-ANSI-declify.
	* sysdeps/m68k/fpu/s_frexp.c: Likewise.
	* sysdeps/m68k/fpu/s_ilogb.c: Likewise.
	* sysdeps/m68k/fpu/s_isinf.c: Likewise.
	* sysdeps/m68k/fpu/s_modf.c: Likewise.
	* sysdeps/m68k/fpu/s_scalbn.c: Likewise.

1997-02-27 21:51  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makefile (tests): Cope with $PATH not including the current
	directory.

1997-02-27 18:04  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/Makefile ($(common-objpfx)mk-local_lim): Use
	$(common-objdir-compile).
	($(common-objpfx)make-ioctls): Likewise.
	(mk-local_lim-CFLAGS): Set this instead of local_lim-CFLAGS.
	($(common-objpfx)sys/param.h): Use $(make-target-directory).
	($(addprefix $(common-objpfx),$(sys/param.h-includes))):
	Likewise.
	($(common-objpfx)sys/syscall.h): Likewise.
	($(common-objpfx)local_lim.h): Let make deal with command
	failure.
	($(common-objpfx)param.h.dep): Use temporary file and update
	target atomically.
	($(common-objpfx)errnos): Avoid the Useless Use of cat Award.
	(include $(common-objpfx)param.h.dep): Ignore error.

	* sysdeps/posix/Makefile ($(common-objpfx)mk-stdiolim): Use
	$(common-objdir-compile).
	(mk-stdiolim-CFLAGS): Renamed from cded-objdir-includes, use
	$(shell pwd) instead of $$cwd.

	* sysdeps/generic/Makefile ($(common-objpfx)det_endian): Use
	$(common-objdir-compile).
	($(objpfx)make_siglist): Use $(native-compile).
	(make_siglist-CFLAGS): New variable.

	* Makerules (ALL_BUILD_CFLAGS): Renamed from BUILD_CFLAGS, leaving
	the old name for the user to pass additional flags to the host
	compiler.  Fix reference to config header.
	(native-compile, common-objdir-compile): Rewritten to make more
	generally usable.
	* sysdeps/unix/sysv/sysv4/solaris2/Makefile: Set ALL_BUILD_CFLAGS
	instead of BUILD_CFLAGS.

	* sysvips/sys/ipc.h: Warn if needed feature select macro are not
	defined.

1997-02-27 17:11  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sunrpc/Makefile ($(objpfx)rpc-proto.d, $(objpfx)rpc-proto.c):
	New rules to generate dependencies for the RPC service objects.

1997-02-27 16:26  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* argp/argp-parse.c (parser_finalize): Always set *END_INDEX if
	supplied.

1997-02-28 03:27  Ulrich Drepper  <drepper@cygnus.com>

	* stdlib/strtod.c (STRTOF): Make sure return value is large enough
	so that clearing second word is necessary.

	* sysdeps/unix/sysv/linux/netinet/in_systm.h: Don't use kernel
	header since it is wrong for 64 bit systems.
	Patch by a sun <asun@zoology.washington.edu>.

1997-02-27 10:34:11  Richard Henderson  <rth@tamu.edu>

	* sysdeps/unix/sysv/linux/alpha/brk.S: Support both the Linux/i386
	and OSF/1 style brk syscalls.  We may want to change Linux/Alpha
	for the benefit of running foreign binaries.

1997-03-01 20:21  Miles Bader  <miles@gnu.ai.mit.edu>
1997-02-25 19:42  Miles Bader  <miles@gnu.ai.mit.edu>
-rw-r--r--ChangeLog168
-rw-r--r--Makefile6
-rw-r--r--Makerules22
-rw-r--r--NEWS7
-rw-r--r--argp/argp-parse.c4
-rw-r--r--config.h.in3
-rw-r--r--config.make.in2
-rwxr-xr-xconfigure104
-rw-r--r--configure.in48
-rw-r--r--math/Makefile3
-rw-r--r--math/math.h116
-rw-r--r--math/mathcalls.h111
-rw-r--r--stdio-common/printf_fphex.c67
-rw-r--r--stdio-common/tstscanf.c12
-rw-r--r--stdio-common/vfscanf.c48
-rw-r--r--stdlib/stdlib.h26
-rw-r--r--stdlib/strtod.c163
-rw-r--r--string/string.h10
-rw-r--r--sunrpc/Makefile21
-rw-r--r--sysdeps/generic/Makefile10
-rw-r--r--sysdeps/ieee754/dbl2mpn.c28
-rw-r--r--sysdeps/ieee754/ldbl2mpn.c28
-rw-r--r--sysdeps/ieee754/mpn2dbl.c34
-rw-r--r--sysdeps/ieee754/mpn2flt.c32
-rw-r--r--sysdeps/ieee754/mpn2ldbl.c34
-rw-r--r--sysdeps/libm-ieee754/s_fdim.c36
-rw-r--r--sysdeps/libm-ieee754/s_fdimf.c36
-rw-r--r--sysdeps/libm-ieee754/s_fdiml.c36
-rw-r--r--sysdeps/libm-ieee754/s_fmax.c29
-rw-r--r--sysdeps/libm-ieee754/s_fmaxf.c29
-rw-r--r--sysdeps/libm-ieee754/s_fmaxl.c29
-rw-r--r--sysdeps/libm-ieee754/s_fmin.c29
-rw-r--r--sysdeps/libm-ieee754/s_fminf.c29
-rw-r--r--sysdeps/libm-ieee754/s_fminl.c29
-rw-r--r--sysdeps/libm-ieee754/s_fpclassify.c43
-rw-r--r--sysdeps/libm-ieee754/s_fpclassifyf.c42
-rw-r--r--sysdeps/libm-ieee754/s_fpclassifyl.c43
-rw-r--r--sysdeps/libm-ieee754/s_signbit.c32
-rw-r--r--sysdeps/libm-ieee754/s_signbitf.c32
-rw-r--r--sysdeps/libm-ieee754/s_signbitl.c32
-rw-r--r--sysdeps/m68k/fpu/__math.h336
-rw-r--r--sysdeps/m68k/fpu/e_acos.c30
-rw-r--r--sysdeps/m68k/fpu/e_fmod.c30
-rw-r--r--sysdeps/m68k/fpu/k_cos.c30
-rw-r--r--sysdeps/m68k/fpu/k_sin.c30
-rw-r--r--sysdeps/m68k/fpu/k_tan.c30
-rw-r--r--sysdeps/m68k/fpu/s_atan.c42
-rw-r--r--sysdeps/m68k/fpu/s_frexp.c44
-rw-r--r--sysdeps/m68k/fpu/s_ilogb.c42
-rw-r--r--sysdeps/m68k/fpu/s_isinf.c42
-rw-r--r--sysdeps/m68k/fpu/s_modf.c44
-rw-r--r--sysdeps/m68k/fpu/s_scalbn.c43
-rw-r--r--sysdeps/posix/Makefile11
-rw-r--r--sysdeps/unix/Makefile29
-rw-r--r--sysdeps/unix/sysv/linux/alpha/brk.S17
-rw-r--r--sysdeps/unix/sysv/linux/netinet/in_systm.h42
-rw-r--r--sysdeps/unix/sysv/linux/poll.c52
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/Makefile2
-rw-r--r--sysvipc/sys/ipc.h6
-rw-r--r--time/Makefile8
-rw-r--r--time/leapseconds3
-rw-r--r--time/zic.c16
63 files changed, 1935 insertions, 608 deletions
diff --git a/ChangeLog b/ChangeLog
index 9494721328..43178f3726 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,168 @@
-Sat Mar  1 20:21:31 1997  Miles Bader  <miles@gnu.ai.mit.edu>
+1997-03-04 04:31  Ulrich Drepper  <drepper@cygnus.com>
+
+	* Makerules: Add rules to handle versioning.
+	* config.h.in (DO_VERSIONING): New macro.
+	* config.make.in (versioning): New variable.
+	* configure.in: Add checks for .symver directive in gas and
+	--version-script option to ld.  Define DO_VERSIONING and
+	versioning if appropriate.
+
+	* math/Makefile (routines): Add s_signbit, s_fpclassify, s_fmax,
+	s_fmin, and s_fdim.
+	* math/math.h: Define ISO C 9X constants, macros and functions.
+	* math/mathcalls.h: Likewise.
+	* sysdeps/libm-ieee754/s_fdim.c: New file.
+	* sysdeps/libm-ieee754/s_fdimf.c: New file.
+	* sysdeps/libm-ieee754/s_fdiml.c: New file.
+	* sysdeps/libm-ieee754/s_fmax.c: New file.
+	* sysdeps/libm-ieee754/s_fmaxf.c: New file.
+	* sysdeps/libm-ieee754/s_fmaxl.c: New file.
+	* sysdeps/libm-ieee754/s_fmin.c: New file.
+	* sysdeps/libm-ieee754/s_fminf.c: New file.
+	* sysdeps/libm-ieee754/s_fminl.c: New file.
+	* sysdeps/libm-ieee754/s_fpclassify.c: New file.
+	* sysdeps/libm-ieee754/s_fpclassifyf.c: New file.
+	* sysdeps/libm-ieee754/s_fpclassifyl.c: New file.
+	* sysdeps/libm-ieee754/s_signbit.c: New file.
+	* sysdeps/libm-ieee754/s_signbitf.c: New file.
+	* sysdeps/libm-ieee754/s_signbitl.c: New file.
+
+	* stdio-common/printf_fphex.c: Correct printing of decimal point
+	character.
+	Simplify conversion of mantissa to string.
+	* stdio-common/vfscanf.c: Handle %A format.
+	Optimize termination of floating-point scanning.
+	* stdio-common/tstscanf.c (main): Add new test to scanf to test
+	scanning float values with given width.
+	* stdlib/strtod.c: Add handling of floating-point numbers in
+	hexadecimal notation.
+
+	* stdlib/stdlib.h: Use __USE_ISOC9X feature macro for new long long
+	functions.
+	Pretty print #if directives.
+	* string/string.h: Pretty print #if directives.
+
+	* sysdeps/ieee754/dbl2mpn.c: Update copyright.
+	* sysdeps/ieee754/ldbl2mpn.c: Likewise.
+	* sysdeps/ieee754/mpn2dbl.c: Likewise.
+	* sysdeps/ieee754/mpn2flt.c: Likewise.
+	* sysdeps/ieee754/mpn2ldbl.c: Likewise.
+
+	* sysdeps/unix/sysv/linux/poll.c: Implement poll function by
+	falling back to select-based implementation if syscall isn't
+	available.
+	* sysdeps/unix/sysv/linux/syscalls.list: Add s_poll.
+
+	* time/leapseconds: Update from tzdata1997b.
+	* time/zic.c: Update from tzcode1997b.
+
+1997-03-01 15:08  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* time/Makefile $(tzfiles:%=$(objpfx)z.%): Remove unneeded
+	depedencies between installed $(tzlinks) and $(tzbases) files.
+
+1997-03-01 14:27  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* math/math.h: Make compatible with traditional preprocessor;
+	requires carefull placement of whitespace in macro arguments.
+	Use __CONCAT instead of ##.
+	Declare long double functions only if __STDC__ or __GNUC__.
+	* math/mathcall.h: Avoid whitespace before argument of macro call
+	that is used as function name.
+
+	* sysdeps/m68k/fpu/__math.h: Use __CONCAT instead of ##.
+	(__m81_u, __m81_inline): Depend on __LIBC_M81_MATH_INLINES instead
+	of __NO_M81_MATH_INLINES.
+	[!__LIBC_M81_MATH_INLINES]: Don't define internal functions
+	starting with __ieee754.
+	[!__NO_MATH_INLINES && __OPTIMIZE__]: Define user visible
+	functions as inlines.
+	(__m81_defun): Put __attribute__ between return type and function
+	name.
+	* math/math.h: Include <__math.h> also if __LIBC_M81_MATH_INLINES
+	is defined.
+	* sysdeps/m68k/fpu/e_acos.c: Define __LIBC_M81_MATH_INLINES
+	instead of __NO_M81_MATH_INLINES.
+	* sysdeps/m68k/fpu/e_fmod.c: Likewise.
+	* sysdeps/m68k/fpu/k_cos.c: Likewise.
+	* sysdeps/m68k/fpu/k_sin.c: Likewise.
+	* sysdeps/m68k/fpu/k_tan.c: Likewise.
+	* sysdeps/m68k/fpu/s_atan.c: Likewise. De-ANSI-declify.
+	* sysdeps/m68k/fpu/s_frexp.c: Likewise.
+	* sysdeps/m68k/fpu/s_ilogb.c: Likewise.
+	* sysdeps/m68k/fpu/s_isinf.c: Likewise.
+	* sysdeps/m68k/fpu/s_modf.c: Likewise.
+	* sysdeps/m68k/fpu/s_scalbn.c: Likewise.
+
+1997-02-27 21:51  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* Makefile (tests): Cope with $PATH not including the current
+	directory.
+
+1997-02-27 18:04  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sysdeps/unix/Makefile ($(common-objpfx)mk-local_lim): Use
+	$(common-objdir-compile).
+	($(common-objpfx)make-ioctls): Likewise.
+	(mk-local_lim-CFLAGS): Set this instead of local_lim-CFLAGS.
+	($(common-objpfx)sys/param.h): Use $(make-target-directory).
+	($(addprefix $(common-objpfx),$(sys/param.h-includes))):
+	Likewise.
+	($(common-objpfx)sys/syscall.h): Likewise.
+	($(common-objpfx)local_lim.h): Let make deal with command
+	failure.
+	($(common-objpfx)param.h.dep): Use temporary file and update
+	target atomically.
+	($(common-objpfx)errnos): Avoid the Useless Use of cat Award.
+	(include $(common-objpfx)param.h.dep): Ignore error.
+
+	* sysdeps/posix/Makefile ($(common-objpfx)mk-stdiolim): Use
+	$(common-objdir-compile).
+	(mk-stdiolim-CFLAGS): Renamed from cded-objdir-includes, use
+	$(shell pwd) instead of $$cwd.
+
+	* sysdeps/generic/Makefile ($(common-objpfx)det_endian): Use
+	$(common-objdir-compile).
+	($(objpfx)make_siglist): Use $(native-compile).
+	(make_siglist-CFLAGS): New variable.
+
+	* Makerules (ALL_BUILD_CFLAGS): Renamed from BUILD_CFLAGS, leaving
+	the old name for the user to pass additional flags to the host
+	compiler.  Fix reference to config header.
+	(native-compile, common-objdir-compile): Rewritten to make more
+	generally usable.
+	* sysdeps/unix/sysv/sysv4/solaris2/Makefile: Set ALL_BUILD_CFLAGS
+	instead of BUILD_CFLAGS.
+
+	* sysvips/sys/ipc.h: Warn if needed feature select macro are not
+	defined.
+
+1997-02-27 17:11  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* sunrpc/Makefile ($(objpfx)rpc-proto.d, $(objpfx)rpc-proto.c):
+	New rules to generate dependencies for the RPC service objects.
+
+1997-02-27 16:26  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+	* argp/argp-parse.c (parser_finalize): Always set *END_INDEX if
+	supplied.
+
+1997-02-28 03:27  Ulrich Drepper  <drepper@cygnus.com>
+
+	* stdlib/strtod.c (STRTOF): Make sure return value is large enough
+	so that clearing second word is necessary.
+
+	* sysdeps/unix/sysv/linux/netinet/in_systm.h: Don't use kernel
+	header since it is wrong for 64 bit systems.
+	Patch by a sun <asun@zoology.washington.edu>.
+
+1997-02-27 10:34:11  Richard Henderson  <rth@tamu.edu>
+
+	* sysdeps/unix/sysv/linux/alpha/brk.S: Support both the Linux/i386
+	and OSF/1 style brk syscalls.  We may want to change Linux/Alpha
+	for the benefit of running foreign binaries.
+
+1997-03-01 20:21  Miles Bader  <miles@gnu.ai.mit.edu>
 
 	* login/utmp_file.c (pututline_file): Correctly decide whether
 	LAST_ENTRY matches DATA.
@@ -9,7 +173,7 @@ Sat Mar  1 20:21:31 1997  Miles Bader  <miles@gnu.ai.mit.edu>
 
 	* login/logout.c (logout): Change type of entry to be DEAD_PROCESS.
 
-Tue Feb 25 19:42:50 1997  Miles Bader  <miles@gnu.ai.mit.edu>
+1997-02-25 19:42  Miles Bader  <miles@gnu.ai.mit.edu>
 
 	* sysdeps/mach/hurd/fcntlbits.h (O_NORW): New macro.
 
diff --git a/Makefile b/Makefile
index 02e87d0ce7..353281b84e 100644
--- a/Makefile
+++ b/Makefile
@@ -131,6 +131,9 @@ ifeq (yes,$(build-shared))
 lib: $(common-objpfx)libc.so
 endif
 
+# We have a versioning file for libc.so.
+#libc-map = libc.map
+
 all-Subdirs-files = $(wildcard $(addsuffix /Subdirs, $(config-sysdirs)))
 $(objpfx)sysd-dirs: $(+sysdir_pfx)config.make $(all-Subdirs-files)
 	(echo define sysdep-subdirs;				\
@@ -279,7 +282,8 @@ parent_echo-distinfo:
 
 # Run a test on the header files we use.
 tests: $(objpfx)isomac
-	$(objpfx)isomac $(CC) '$(+sysdep-includes)' >$(common-objpfx)isomac.out
+	$(objpfx)./isomac $(CC) '$(+sysdep-includes)' \
+			  >$(common-objpfx)isomac.out
 
 $(objpfx)isomac: isomac.c
 	$(native-compile)
diff --git a/Makerules b/Makerules
index b4b7610b62..3636011e43 100644
--- a/Makerules
+++ b/Makerules
@@ -338,6 +338,12 @@ else
 no-whole-archive =
 endif
 
+ifeq ($(versioning),yes)
+load-map-file = $($(@F:%.so=%)-map:%=-Wl,--version-script=%)
+else
+load-map-file =
+endif
+
 interp-obj = $(common-objpfx)interp.so
 $(interp-obj): $(common-objpfx)%.so: $(..)%.c
 	$(compile-command.c)
@@ -349,7 +355,7 @@ $(patsubst %,$(objpfx)%.so,$(extra-libs)): $(interp-obj)
 
 define build-shlib
 $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS)  \
-	  -B$(csu-objpfx) \
+	  -B$(csu-objpfx) $(load-map-file) \
 	  -Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
 	  $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
 	  -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
@@ -809,19 +815,23 @@ install: install-no-libc.a-nosubdir
 
 # Command to compile $< in $(objdir) using the native libraries.
 define native-compile
-cwd=`pwd`; cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) \
-	   $(addprefix $$cwd/,$^) -o $(@F)
+$(make-target-directory)
+$(patsubst %/,cd %;,$(objpfx)) \
+$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
+	    $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
 endef
 
 # Command to compile $< in $(common-objdir) using the native libraries.
 # We must cd to $(objdir) anyway so that $(..)config.h is valid.
 define common-objdir-compile
-cd $(objpfx).; \
-$(BUILD_CC) $(BUILD_CFLAGS) $(<:$(common-objpfx)%=$(..)%) -o $(..)$(@F)
+$(patsubst %/,cd %;,$(objpfx)) \
+$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
+	    $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(..)$(@F)
 endef
 
 # We always want to use configuration definitions.
-BUILD_CFLAGS = -include $(common-objpfx)config.h
+# Note that this is only used for commands running in $(objpfx).
+ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h
 
 # Support the GNU standard name for this target.
 .PHONY: check
diff --git a/NEWS b/NEWS
index 6e1ba7edd5..860f8ffa14 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,13 @@ Version 2.1
 
 * Miles Bader provided the `argp' function family to support hierachical
   command line argument parsing, layered on top of getopt.
+
+* strtod accepts new hexadecimal floating-point format from ISO C 9X
+
+* printf has two new specifiers %a and %A to print hexadecimal flaoting-point
+  numbers
+
+* scanf recognizes the %A format for scanning floating point numbers
 
 Version 2.0.2
 
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index 11c36be705..47a16fac4f 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -612,6 +612,10 @@ parser_finalize (struct parser *parser,
 
 	if (err == EBADKEY)
 	  err = 0;		/* Some parser didn't understand.  */
+
+	/* Tell the user that all arguments are parsed.  */
+	if (end_index)
+	  *end_index = parser->state.next;
       }
     else if (end_index)
       /* Return any remaining arguments to the user.  */
diff --git a/config.h.in b/config.h.in
index e928eacecf..2b9ca028af 100644
--- a/config.h.in
+++ b/config.h.in
@@ -43,6 +43,9 @@
    directive.  */
 #undef	HAVE_ASM_POPSECTION_DIRECTIVE
 
+/* Define if versioning of the library is wanted.  */
+#undef	DO_VERSIONING
+
 /*
  */
 
diff --git a/config.make.in b/config.make.in
index 58f2f474f8..0a7d0379fd 100644
--- a/config.make.in
+++ b/config.make.in
@@ -26,6 +26,8 @@ defines = @DEFINES@
 elf = @elf@
 have-initfini = @libc_cv_have_initfini@
 
+versioning = @VERSIONING@
+
 have-no-whole-archive = @libc_cv_ld_no_whole_archive@
 have-no-exceptions = @libc_cv_gcc_no_exceptions@
 have-bash2 = @libc_cv_have_bash2@
diff --git a/configure b/configure
index a757ce72a7..414403d84e 100755
--- a/configure
+++ b/configure
@@ -1598,9 +1598,74 @@ EOF
 
 fi
 
+echo $ac_n "checking for .symver assembler directive""... $ac_c" 1>&6
+echo "configure:1603: 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
+  cat > conftest.s <<EOF
+.text
+_sym: ret
+.symver _sym,sym@VERS
+EOF
+if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&5 2>&5; then
+  libc_cv_asm_symver_directive=yes
+else
+  libc_cv_asm_symver_directive=no
+fi
+rm -f conftest*
+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:1622: 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
+  if test $libc_cv_asm_symver_directive = yes; then
+  cat > conftest.s <<EOF
+.text
+_sym: ret
+.symver _sym,sym@VERS
+EOF
+  cat > conftest.map <<EOF
+VERS {
+	global: sym;
+};
+EOF
+  if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&5 2>&5; then
+    if { ac_try='${CC-cc} $CFLAGS --shared -o conftest.so conftest.o
+					-Wl,--version-script,conftest.map'; { (eval echo configure:1639: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; };
+    then
+      libc_cv_ld_version_script_option=yes
+    else
+      libc_cv_ld_version_script_option=no
+    fi
+  else
+    libc_cv_ld_version_script_option=no
+  fi
+else
+  libc_cv_ld_version_script_option=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$libc_cv_ld_version_script_option" 1>&6
+if test $libc_cv_asm_symver_directive = yes &&
+   test $libc_cv_ld_version_script_option = yes; then
+  VERSIONING=yes
+  cat >> confdefs.h <<\EOF
+#define DO_VERSIONING 1
+EOF
+
+else
+  VERSIONING=no
+fi
+
+
 if test $elf = yes; then
   echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6
-echo "configure:1604: checking for .previous assembler directive" >&5
+echo "configure:1669: 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
@@ -1608,7 +1673,7 @@ else
 .section foo_section
 .previous
 EOF
-  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+  if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1677: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
     libc_cv_asm_previous_directive=yes
   else
     libc_cv_asm_previous_directive=no
@@ -1624,7 +1689,7 @@ EOF
 
   else
     echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6
-echo "configure:1628: checking for .popsection assembler directive" >&5
+echo "configure:1693: 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
@@ -1632,7 +1697,7 @@ else
 .pushsection foo_section
 .popsection
 EOF
-    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1636: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:1701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
       libc_cv_asm_popsection_directive=yes
     else
       libc_cv_asm_popsection_directive=no
@@ -1652,12 +1717,12 @@ fi
 
 if test $elf != yes; then
   echo $ac_n "checking for .init and .fini sections""... $ac_c" 1>&6
-echo "configure:1656: checking for .init and .fini sections" >&5
+echo "configure:1721: 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 1661 "configure"
+#line 1726 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1666,7 +1731,7 @@ asm (".section .init");
 				    asm (".text");
 ; return 0; }
 EOF
-if { (eval echo configure:1670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   libc_cv_have_initfini=yes
 else
@@ -1691,19 +1756,19 @@ if test $elf = yes; then
   libc_cv_asm_underscores=no
 else
   echo $ac_n "checking for _ prefix on C symbol names""... $ac_c" 1>&6
-echo "configure:1695: checking for _ prefix on C symbol names" >&5
+echo "configure:1760: 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 1700 "configure"
+#line 1765 "configure"
 #include "confdefs.h"
 asm ("_glibc_foobar:");
 int main() {
 glibc_foobar ();
 ; return 0; }
 EOF
-if { (eval echo configure:1707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   libc_cv_asm_underscores=yes
 else
@@ -1730,7 +1795,7 @@ if test $elf = yes; then
   libc_cv_asm_weakext_directive=no
 else
   echo $ac_n "checking for assembler .weak directive""... $ac_c" 1>&6
-echo "configure:1734: checking for assembler .weak directive" >&5
+echo "configure:1799: 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
@@ -1753,7 +1818,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:1757: checking for assembler .weakext directive" >&5
+echo "configure:1822: 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
@@ -1790,7 +1855,7 @@ EOF
 fi
 
 echo $ac_n "checking for ld --no-whole-archive""... $ac_c" 1>&6
-echo "configure:1794: checking for ld --no-whole-archive" >&5
+echo "configure:1859: 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
@@ -1801,7 +1866,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -Wl,--no-whole-archive
-			    -o conftest conftest.c'; { (eval echo configure:1805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:1870: \"$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
@@ -1812,7 +1877,7 @@ fi
 echo "$ac_t""$libc_cv_ld_no_whole_archive" 1>&6
 
 echo $ac_n "checking for gcc -fno-exceptions""... $ac_c" 1>&6
-echo "configure:1816: checking for gcc -fno-exceptions" >&5
+echo "configure:1881: checking for gcc -fno-exceptions" >&5
 if eval "test \"`echo '$''{'libc_cv_gcc_no_exceptions'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1823,7 +1888,7 @@ __throw () {}
 EOF
 if { ac_try='${CC-cc} $CFLAGS
 			    -nostdlib -nostartfiles -fno-exceptions
-			    -o conftest conftest.c'; { (eval echo configure:1827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+			    -o conftest conftest.c'; { (eval echo configure:1892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
   libc_cv_gcc_no_exceptions=yes
 else
   libc_cv_gcc_no_exceptions=no
@@ -1875,7 +1940,7 @@ if test "$uname" = generic; then
   fi
 
   echo $ac_n "checking OS release for uname""... $ac_c" 1>&6
-echo "configure:1879: checking OS release for uname" >&5
+echo "configure:1944: 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
@@ -1897,7 +1962,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:1901: checking OS version for uname" >&5
+echo "configure:1966: 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
@@ -1919,7 +1984,7 @@ else
 fi
 
 echo $ac_n "checking stdio selection""... $ac_c" 1>&6
-echo "configure:1923: checking stdio selection" >&5
+echo "configure:1988: checking stdio selection" >&5
 
 case $stdio in
 libio) cat >> confdefs.h <<\EOF
@@ -2138,6 +2203,7 @@ s%@BASH@%$BASH%g
 s%@libc_cv_have_bash2@%$libc_cv_have_bash2%g
 s%@KSH@%$KSH%g
 s%@libc_cv_have_ksh@%$libc_cv_have_ksh%g
+s%@VERSIONING@%$VERSIONING%g
 s%@libc_cv_have_initfini@%$libc_cv_have_initfini%g
 s%@libc_cv_ld_no_whole_archive@%$libc_cv_ld_no_whole_archive%g
 s%@libc_cv_gcc_no_exceptions@%$libc_cv_gcc_no_exceptions%g
diff --git a/configure.in b/configure.in
index 8b797c792e..11421eff9f 100644
--- a/configure.in
+++ b/configure.in
@@ -489,6 +489,54 @@ if test $libc_cv_asm_set_directive = yes; then
   AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
 fi
 
+AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
+[cat > conftest.s <<EOF
+.text
+_sym: ret
+.symver _sym,sym@VERS
+EOF
+if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
+  libc_cv_asm_symver_directive=yes
+else
+  libc_cv_asm_symver_directive=no
+fi
+rm -f conftest*])
+AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
+if test $libc_cv_asm_symver_directive = yes; then
+  cat > conftest.s <<EOF
+.text
+_sym: ret
+.symver _sym,sym@VERS
+EOF
+  cat > conftest.map <<EOF
+VERS {
+	global: sym;
+};
+EOF
+  if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
+    if AC_TRY_COMMAND([${CC-cc} $CFLAGS --shared -o conftest.so conftest.o
+					-Wl,--version-script,conftest.map]);
+    then
+      libc_cv_ld_version_script_option=yes
+    else
+      libc_cv_ld_version_script_option=no
+    fi
+  else
+    libc_cv_ld_version_script_option=no
+  fi
+else
+  libc_cv_ld_version_script_option=no
+fi
+rm -f conftest*])
+if test $libc_cv_asm_symver_directive = yes &&
+   test $libc_cv_ld_version_script_option = yes; then
+  VERSIONING=yes
+  AC_DEFINE(DO_VERSIONING)
+else
+  VERSIONING=no
+fi
+AC_SUBST(VERSIONING)
+
 if test $elf = yes; then
   AC_CACHE_CHECK(for .previous assembler directive,
 		 libc_cv_asm_previous_directive, [dnl
diff --git a/math/Makefile b/math/Makefile
index 550e9d6c50..b8964baa88 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -45,7 +45,8 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod	\
 	     s_sin s_tan s_tanh w_acos w_acosh w_asin			\
 	     w_atan2 w_atanh w_cabs w_cosh w_drem w_exp w_fmod w_gamma	\
 	     w_gamma_r w_hypot w_j0 w_j1 w_jn w_lgamma w_lgamma_r	\
-	     w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt
+	     w_log w_log10 w_pow w_remainder w_scalb w_sinh w_sqrt	\
+	     s_signbit s_fpclassify s_fmax s_fmin s_fdim
 libm-routines = $(libm-support) $(libm-calls) \
 		$(patsubst %_rf,%f_r,$(libm-calls:=f))	\
 		$(long-m-$(long-double-fcts))
diff --git a/math/math.h b/math/math.h
index dce06e798b..e08d210be8 100644
--- a/math/math.h
+++ b/math/math.h
@@ -44,20 +44,20 @@ __BEGIN_DECLS
    and can declare the float versions `namef' and `__namef'.  */
 
 #define __MATHCALL(function,suffix, args)	\
-  __MATHDECL (_Mdouble_, function,suffix, args)
+  __MATHDECL (_Mdouble_,function,suffix, args)
 #define __MATHDECL(type, function,suffix, args) \
   __MATHDECL_1(type, function,suffix, args); \
-  __MATHDECL_1(type, __##function,suffix, args)
+  __MATHDECL_1(type, __CONCAT(__,function),suffix, args)
 #define __MATHDECL_1(type, function,suffix, args) \
   extern type __MATH_PRECNAME(function,suffix) args
 
 #define _Mdouble_ 		double
-#define __MATH_PRECNAME(name,r)	name##r
+#define __MATH_PRECNAME(name,r)	__CONCAT(name,r)
 #include <mathcalls.h>
 #undef	_Mdouble_
 #undef	__MATH_PRECNAME
 
-#ifdef __USE_MISC
+#if defined __USE_MISC || defined __USE_ISOC9X
 
 
 /* Include the file of declarations again, this time using `float'
@@ -67,11 +67,16 @@ __BEGIN_DECLS
 #define _Mfloat_		float
 #endif
 #define _Mdouble_ 		_Mfloat_
+#ifdef __STDC__
 #define __MATH_PRECNAME(name,r)	name##f##r
+#else
+#define __MATH_PRECNAME(name,r) name/**/f/**/r
+#endif
 #include <mathcalls.h>
 #undef	_Mdouble_
 #undef	__MATH_PRECNAME
 
+#if __STDC__ - 0 || __GNUC__ - 0
 /* Include the file of declarations again, this time using `long double'
    instead of `double' and appending l to each function name.  */
 
@@ -79,14 +84,104 @@ __BEGIN_DECLS
 #define _Mlong_double_		long double
 #endif
 #define _Mdouble_ 		_Mlong_double_
+#ifdef __STDC__
 #define __MATH_PRECNAME(name,r)	name##l##r
+#else
+#define __MATH_PRECNAME(name,r) name/**/l/**/r
+#endif
 #include <mathcalls.h>
 #undef	_Mdouble_
 #undef	__MATH_PRECNAME
 
-#endif	/* Use misc.  */
+#endif /* __STDC__ || __GNUC__ */
+
+#endif	/* Use misc or ISO C 9X.  */
+
+
+/* ISO C 9X defines some generic macros which work on any data type.  */
+#if __USE_ISOC9X
+
+/* All floating-point numbers can be put in one of these categories.  */
+enum
+  {
+    FP_NAN,
+#define FP_NAN FP_NAN
+    FP_INFINITE,
+#define FP_INFINITE FP_INFINITE
+    FP_ZERO,
+#define FP_ZERO FP_ZERO
+    FP_SUBNORMAL,
+#define FP_SUBNORMAL FP_SUBNORMAL
+    FP_NORMAL
+#define FP_NORMAL FP_NORMAL
+  };
+
+/* Return number of classification appropriate for X.  */
+#define fpclassify(x) \
+     (sizeof (x) == sizeof (float) ?					      \
+        __finitef (x)							      \
+      : sizeof (x) == sizeof (double) ?					      \
+        __finite (x) : __finitel (x))
+
+/* Return nonzero value if sign of X is negative.  */
+#define signbit(x) \
+     (sizeof (x) == sizeof (float) ?					      \
+        __signbitf (x)							      \
+      : sizeof (x) == sizeof (double) ?					      \
+        __signbit (x) : __signbitl (x))
+
+/* Return nonzero value if X is not +-Inf or NaN.  */
+#define isfinite(x) (fpclassify (x) >= FP_ZERO)
+
+/* Return nonzero value if X is neither zero, subnormal, Inf, nor NaN.  */
+#define isnormal(x) (fpclassify (x) == FP_NORMAL)
+
+/* Return nonzero value if X is a NaN.  We could use `fpclassify' but
+   we already have this functions `__isnan' and it is faster.  */
+#define isnan(x) \
+     (sizeof (x) == sizeof (float) ?					      \
+        __isnanf (x)							      \
+      : sizeof (x) == sizeof (double) ?					      \
+        __isnan (x) : __isnanl (x))
 
 
+/* Conversion functions.  */
+
+/* Round X to nearest integral value according to current rounding
+   direction.  */
+extern long int rinttol __P ((double __x));
+extern long long int rinttoll __P ((double __x));
+
+/* Round X to nearest integral value, rounding halfway cases away from
+   zero.  */
+extern long int roundtol __P ((double __x));
+extern long long int roundtoll __P ((double __x));
+
+
+/* Comparison macros.  */
+
+/* Return nonzero value if X is greater than Y.  */
+#define isgreater(x, y) (!isunordered ((x), (y)) && (x) > (y))
+
+/* Return nonzero value if X is greater than or equal to Y.  */
+#define isgreaterequal(x, y) (!isunordered ((x), (y)) && (x) >= (y))
+
+/* Return nonzero value if X is less than Y.  */
+#define isless(x, y) (!isunordered ((x), (y)) && (x) < (y))
+
+/* Return nonzero value if X is less than or equal to Y.  */
+#define islessequal(x, y) (!isunordered ((x), (y)) && (x) <= (y))
+
+/* Return nonzero value if either X is less than Y or Y is less than X.  */
+#define islessgreater(x, y) \
+     (!isunordered ((x), (y)) && ((x) < (y) || (y) < (x)))
+
+/* Return nonzero value if arguments are unordered.  */
+#define isunordered(x, y) \
+     (fpclassify (x) == FP_NAN || fpclassify (y) == FP_NAN)
+
+#endif /* Use ISO C 9X.  */
+
 #ifdef	__USE_MISC
 /* Support for various different standard error handling behaviors.  */
 
@@ -140,6 +235,14 @@ extern int matherr __P ((struct exception *));
 #define HUGE		FLT_MAX
 #include <float.h>		/* Defines FLT_MAX.  */
 
+#else	/* !SVID */
+
+#ifdef __USE_XOPEN
+/* X/Open wants another strange constant.  */
+#define MAXFLOAT	FLT_MAX
+#include <float.h>
+#endif
+
 #endif	/* SVID */
 
 
@@ -173,7 +276,8 @@ extern int matherr __P ((struct exception *));
 
 
 /* Get machine-dependent inline versions (if there are any).  */
-#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+#if (!defined __NO_MATH_INLINES && defined __OPTIMIZE__) \
+    || defined __LIBC_M81_MATH_INLINES
 #include <__math.h>
 #endif
 
diff --git a/math/mathcalls.h b/math/mathcalls.h
index ca2fe0c32a..fd8ed86e81 100644
--- a/math/mathcalls.h
+++ b/math/mathcalls.h
@@ -73,7 +73,7 @@ __MATHCALL (sinh,, (_Mdouble_ __x));
 /* Hyperbolic tangent of X.  */
 __MATHCALL (tanh,, (_Mdouble_ __x));
 
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
 /* Hyperbolic arc cosine of X.  */
 __MATHCALL (acosh,, (_Mdouble_ __x));
 /* Hyperbolic arc sine of X.  */
@@ -99,7 +99,10 @@ __MATHCALL (log,, (_Mdouble_ __x));
 /* Base-ten logarithm of X.  */
 __MATHCALL (log10,, (_Mdouble_ __x));
 
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+/* Break VALUE into integral and fractional parts.  */
+__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
 /* Return exp(X) - 1.  */
 __MATHCALL (expm1,, (_Mdouble_ __x));
 
@@ -110,8 +113,13 @@ __MATHCALL (log1p,, (_Mdouble_ __x));
 __MATHCALL (logb,, (_Mdouble_ __x));
 #endif
 
-/* Break VALUE into integral and fractional parts.  */
-__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
+#ifdef __USE_ISOC9X
+/* Compute base-2 exponential of X.  */
+__MATHCALL (exp2,, (_Mdouble_ __x));
+
+/* Compute base-2 logarithm of X.  */
+__MATHCALL (log2,, (_Mdouble_ __x));
+#endif
 
 
 /* Power functions.  */
@@ -122,7 +130,12 @@ __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 /* Return the square root of X.  */
 __MATHCALL (sqrt,, (_Mdouble_ __x));
 
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
+/* Return `sqrt(X*X + Y*Y)'.  */
+__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 /* Return the cube root of X.  */
 __MATHCALL (cbrt,, (_Mdouble_ __x));
 #endif
@@ -144,13 +157,12 @@ __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
 
 
 #ifdef __USE_MISC
-
 /* Return 0 if VALUE is finite or NaN, +1 if it
    is +Infinity, -1 if it is -Infinity.  */
-__MATHDECL (int, isinf,, (_Mdouble_ __value));
+__MATHDECL (int,isinf,, (_Mdouble_ __value));
 
 /* Return nonzero if VALUE is finite and not NaN.  */
-__MATHDECL (int, finite,, (_Mdouble_ __value));
+__MATHDECL (int,finite,, (_Mdouble_ __value));
 
 /* Deal with an infinite or NaN result.
    If ERROR is ERANGE, result is +Inf;
@@ -160,9 +172,6 @@ __MATHDECL (int, finite,, (_Mdouble_ __value));
    and may return an infinity or NaN, or may do something else.  */
 __MATHCALL (infnan,, (int __error));
 
-/* Return X with its signed changed to Y's.  */
-__MATHCALL (copysign,, (_Mdouble_ __x, _Mdouble_ __y));
-
 /* Return X times (2 to the Nth power).  */
 __MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
 
@@ -182,36 +191,45 @@ __MATHCALL (cabs,, (struct __MATH_PRECNAME(__cabs_complex,)));
 __MATHCALL (significand,, (_Mdouble_ __x));
 #endif /* Use misc.  */
 
+#if defined __USE_MISC || defined __USE_ISOC9X
+/* Return X with its signed changed to Y's.  */
+__MATHCALL (copysign,, (_Mdouble_ __x, _Mdouble_ __y));
+#endif
+
+#ifdef __USE_ISOC9X
+/* Return representation of NaN for double type.  */
+__MATHCALL (nan,, (__const char *__tagb));
+#endif
 
-#if defined(__USE_MISC) || defined(__USE_XOPEN)
 
+#if defined __USE_MISC || defined __USE_XOPEN
 /* Return nonzero if VALUE is not a number.  */
-__MATHDECL (int, isnan,, (_Mdouble_ __value));
+__MATHDECL (int,isnan,, (_Mdouble_ __value));
 
 /* Return the binary exponent of X, which must be nonzero.  */
-__MATHDECL (int, ilogb,, (_Mdouble_ __x));
+__MATHDECL (int,ilogb,, (_Mdouble_ __x));
 
-/* Return `sqrt(X*X + Y*Y)'.  */
-__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
+/* Bessel functions.  */
+__MATHCALL (j0,, (_Mdouble_));
+__MATHCALL (j1,, (_Mdouble_));
+__MATHCALL (jn,, (int, _Mdouble_));
+__MATHCALL (y0,, (_Mdouble_));
+__MATHCALL (y1,, (_Mdouble_));
+__MATHCALL (yn,, (int, _Mdouble_));
+#endif
 
 
+#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC9X
 /* Error, gamma, and Bessel functions.  */
 __MATHCALL (erf,, (_Mdouble_));
 __MATHCALL (erfc,, (_Mdouble_));
 __MATHCALL (gamma,, (_Mdouble_));
-__MATHCALL (j0,, (_Mdouble_));
-__MATHCALL (j1,, (_Mdouble_));
-__MATHCALL (jn,, (int, _Mdouble_));
 __MATHCALL (lgamma,, (_Mdouble_));
-__MATHCALL (y0,, (_Mdouble_));
-__MATHCALL (y1,, (_Mdouble_));
-__MATHCALL (yn,, (int, _Mdouble_));
 
 /* This variable is used by `gamma' and `lgamma'.  */
 extern int signgam;
 
 #ifdef __USE_MISC
-
 /* Reentrant versions of gamma and lgamma.  Those functions use the global
    variable `signgam'.  The reentrant versions instead take a pointer and
    store the value through it.  */
@@ -219,16 +237,14 @@ __MATHCALL (gamma,_r, (_Mdouble_, int *));
 __MATHCALL (lgamma,_r, (_Mdouble_, int *));
 #endif
 
+#endif /* Use misc or X/Open.  */
 
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
 
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC9X
 /* Return the integer nearest X in the direction of the
    prevailing rounding mode.  */
 __MATHCALL (rint,, (_Mdouble_ __x));
 
-/* Return X times (2 to the Nth power).  */
-__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
-
 /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
 __MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y));
 
@@ -236,4 +252,43 @@ __MATHCALL (nextafter,, (_Mdouble_ __x, _Mdouble_ __y));
 __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
 #endif
 
-#endif /* Use misc.  */
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+/* Return X times (2 to the Nth power).  */
+__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
+#endif
+
+#ifdef __USE_ISOC9X
+/* Round X to integral valuein floating-point format using current
+   rounding direction, but do not raise inexact exception.  */
+__MATHCALL (nearbyint,, (_Mdouble_ __x));
+
+/* Round X to nearest integral value, rounding halfway cases away from
+   zero.  */
+__MATHCALL (round,, (_Mdouble_ __x));
+
+/* Round X to the integral value in floating-point format nearest but
+   not larger in magnitude.  */
+__MATHCALL (trunc,, (_Mdouble_ __x));
+
+/* Compute remainder of X and Y and put in *QUO a value with sign of x/y
+   and magnitude congruent `mod 2^n' to the magnitude of the integral
+   quotient x/y, with n >= 3.  */
+__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo));
+
+
+/* Return positive difference between X and Y.  */
+__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
+
+/* Return minimum numeric value from X and Y.  */
+__MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y));
+
+/* Return maximum numeric value from X and Y.  */
+__MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y));
+
+
+/* Classify given number.  */
+__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value));
+
+/* Test for negative number.  */
+__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value));
+#endif /* Use ISO C 9X.  */
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
index d442b56099..ac939ec4b4 100644
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -217,29 +217,19 @@ __printf_fphex (FILE *fp,
 	 52 bits are representable without rest using hexadecimal
 	 digits we use only the implicit digits for the number before
 	 the decimal point.  */
-      if (sizeof (unsigned long int) > 6)
-	{
-	  unsigned long int num;
+      unsigned long long int num;
 
-	  num = (((unsigned long int) fpnum.dbl.ieee.mantissa0) << 32
-		 | fpnum.dbl.ieee.mantissa1);
+      num = (((unsigned long long int) fpnum.dbl.ieee.mantissa0) << 32
+	     | fpnum.dbl.ieee.mantissa1);
 
-	  zero_mantissa = num == 0;
+      zero_mantissa = num == 0;
 
-	  numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
-			       info->spec == 'A');
-	}
+      if (sizeof (unsigned long int) > 6)
+	numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
+			     info->spec == 'A');
       else
-	{
-	  unsigned long long int num;
-
-	  num = (((unsigned long long int) fpnum.dbl.ieee.mantissa0) << 32
-		 | fpnum.dbl.ieee.mantissa1);
-
-	  zero_mantissa = num == 0;
-
-	  numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
-	}
+	numstr = _itoa (num, numbuf + sizeof numbuf, 16,
+			info->spec == 'A');
 
       /* Fill with zeroes.  */
       while (numstr > numbuf + (sizeof numbuf - 13))	/* 52 ÷ 4 = 13 */
@@ -249,7 +239,8 @@ __printf_fphex (FILE *fp,
 
       exponent = fpnum.dbl.ieee.exponent;
 
-      if (exponent != 0 && exponent < IEEE754_DOUBLE_BIAS)
+      if ((exponent != 0 && exponent < IEEE754_DOUBLE_BIAS)
+	  || (exponent == 0 && !zero_mantissa))
 	{
 	  expnegative = 1;
 	  exponent = abs (exponent - IEEE754_DOUBLE_BIAS);
@@ -265,31 +256,20 @@ __printf_fphex (FILE *fp,
     {
       /* The "strange" 80 bit format on ix86 and m68k has an explicit
 	 leading digit in the 64 bit mantissa.  */
-      assert (sizeof (long double) == 12);
+      unsigned long long int num;
 
-      if (sizeof (unsigned long int) > 6)
-	{
-	  unsigned long int num;
+      assert (sizeof (long double) == 12);
 
-	  num = (((unsigned long int) fpnum.dbl.ieee.mantissa0) << 32
-		 | fpnum.dbl.ieee.mantissa1);
+      num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32
+	     | fpnum.ldbl.ieee.mantissa1);
 
-	  zero_mantissa = num == 0;
+      zero_mantissa = num == 0;
 
-	  numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
-			       info->spec == 'A');
-	}
+      if (sizeof (unsigned long int) > 6)
+	numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
+			     info->spec == 'A');
       else
-	{
-	  unsigned long long int num;
-
-	  num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32
-		 | fpnum.ldbl.ieee.mantissa1);
-
-	  zero_mantissa = num == 0;
-
-	  numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
-	}
+	numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
 
       /* We use a full nibble for the leading digit.  */
       leading = *numstr++;
@@ -301,7 +281,8 @@ __printf_fphex (FILE *fp,
       /* We have 3 bits from the mantissa in the leading nibble.  */
       exponent = fpnum.ldbl.ieee.exponent - 3;
 
-      if (exponent != 0 && exponent < IEEE854_LONG_DOUBLE_BIAS)
+      if ((exponent != 0 && exponent < IEEE854_LONG_DOUBLE_BIAS)
+	  || (exponent == 0 && !zero_mantissa))
 	{
 	  expnegative = 1;
 	  exponent = abs (exponent - IEEE854_LONG_DOUBLE_BIAS);
@@ -414,10 +395,10 @@ __printf_fphex (FILE *fp,
   outchar (info->spec == 'A' ? 'X' : 'x');
   outchar (leading);
 
-  if (!zero_mantissa || precision != 0 || info->alt)
+  if (!zero_mantissa || precision > 0 || info->alt)
     outchar (decimal);
 
-  if (!zero_mantissa || precision != 0)
+  if (!zero_mantissa || precision > 0)
     {
       PRINT (numstr, MIN (numend - numstr, precision));
       if (precision > numend - numstr)
diff --git a/stdio-common/tstscanf.c b/stdio-common/tstscanf.c
index 85be441b5b..277d4e1cbf 100644
--- a/stdio-common/tstscanf.c
+++ b/stdio-common/tstscanf.c
@@ -150,5 +150,17 @@ main (int argc, char **argv)
       return 1;
   }
 
+  fputs ("Test 4:\n", out);
+  {
+    double a = 0, b = 0;
+    int res, n;
+
+    res = sscanf ("1234567", "%3lg%3lg%n", &a, &b, &n);
+    printf ("res = %d, a = %g, b = %g, n = %d\n", res, a, b, n);
+
+    if (res != 2 || a != 123 || b != 456 || n != 6)
+      return 1;
+  }
+
   exit(EXIT_SUCCESS);
 }
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 8653088751..106c62b8e0 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -177,10 +177,12 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
   char got_dot, got_e, negative;
   /* If a [...] is a [^...].  */
   char not_in;
+#define exp_char not_in
   /* Base for integral numbers.  */
   int base;
   /* Signedness for integral numbers.  */
   int number_signed;
+#define is_hexa number_signed
   /* Decimal point character.  */
   wchar_t decimal;
   /* The thousands character of the current locale.  */
@@ -889,6 +891,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 	case 'f':
 	case 'g':
 	case 'G':
+	case 'A':
 	  c = inchar ();
 	  if (c == EOF)
 	    input_error ();
@@ -906,17 +909,39 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 	  else
 	    negative = 0;
 
+	  if (c == '0' && tolower (c == inchar ()) == 'x')
+	    {
+	      /* It is a number in hexadecimal format.  */
+	      ADDW ('0');
+	      ADDW ('x');
+
+	      is_hexa = 1;
+	      exp_char = 'p';
+
+	      /* Grouping is not allowed.  */
+	      flags &= ~GROUP;
+	      c = inchar ();
+	    }
+	  else
+	    {
+	      /* It not a hexadecimal prefix.  */
+	      is_hexa = 0;
+	      exp_char = 'e';
+	    }
+
 	  got_dot = got_e = 0;
 	  do
 	    {
 	      if (isdigit (c))
 		ADDW (c);
-	      else if (got_e && wp[wpsize - 1] == 'e'
+	      else if (!got_e && is_hexa && isxdigit (c))
+		ADDW (c);
+	      else if (got_e && wp[wpsize - 1] == exp_char
 		       && (c == '-' || c == '+'))
 		ADDW (c);
-	      else if (wpsize > 0 && !got_e && tolower (c) == 'e')
+	      else if (wpsize > 0 && !got_e && tolower (c) == exp_char)
 		{
-		  ADDW ('e');
+		  ADDW (exp_char);
 		  got_e = got_dot = 1;
 		}
 	      else if (c == decimal && !got_dot)
@@ -927,16 +952,21 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
 	      else if ((flags & GROUP) && c == thousands && !got_dot)
 		ADDW (c);
 	      else
-		break;
+		{
+		  /* The last read character is not part of the number
+		     anymore.  */
+		  ungetc (c, s);
+		  break;
+		}
 	      if (width > 0)
 		--width;
 	    }
-	  while (inchar () != EOF && width != 0);
-
-	  /* The last read character is not part of the number anymore.  */
-	  ungetc (c, s);
+	  while (width != 0 && inchar () != EOF);
 
-	  if (wpsize == 0)
+	  /* Have we read any character?  If we try to read a number
+	     in hexadecimal notation and we have read only the `0x'
+	     prefix this is an error.  */
+	  if (wpsize == 0 || (is_hexa && wpsize == 2))
 	    conv_error ();
 
 	  /* Convert the number.  */
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index aaabbc8edc..6fad54eaf6 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -17,7 +17,7 @@
    Boston, MA 02111-1307, USA.  */
 
 /*
- *	ISO S Standard: 4.10 GENERAL UTILITIES	<stdlib.h>
+ *	ISO C Standard: 4.10 GENERAL UTILITIES	<stdlib.h>
  */
 
 #ifndef	_STDLIB_H
@@ -47,7 +47,7 @@ typedef struct
     long int rem;		/* Remainder.  */
   } ldiv_t;
 
-#ifdef __USE_GNU
+#ifdef __USE_ISOC9X
 /* Returned by `lldiv'.  */
 typedef struct
   {
@@ -160,7 +160,7 @@ extern unsigned long long int __strtoull_internal __P ((__const char *
 							int __group));
 #endif /* GCC */
 
-#if defined (__OPTIMIZE__) && __GNUC__ >= 2
+#if defined __OPTIMIZE__ && __GNUC__ >= 2
 /* Define inline functions which call the internal entry points.  */
 
 extern __inline double strtod (__const char *__restrict __nptr,
@@ -211,14 +211,14 @@ extern __inline int atoi (__const char *__nptr)
 extern __inline long int atol (__const char *__nptr)
 { return strtol (__nptr, (char **) NULL, 10); }
 
-#ifdef __USE_MISC
+#if defined __USE_ISOC9X && (defined __GNUC__ || defined __USE_MISC)
 extern __inline long long int atoll (__const char *__nptr)
 { return strtoll (__nptr, (char **) NULL, 10); }
 #endif
 #endif /* Optimizing GCC >=2.  */
 
 
-#if defined(__USE_SVID) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
 /* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant
    digit first.  Returns a pointer to static storage overwritten by the
    next call.  */
@@ -302,7 +302,7 @@ extern int rand_r __P ((unsigned int *__seed));
 #endif
 
 
-#if defined(__USE_SVID) || defined(__USE_XOPEN)
+#if defined __USE_SVID || defined __USE_XOPEN
 /* System V style 48-bit random number generator functions.  */
 
 /* Return non-negative, double-precision floating-point value in [0.0,1.0).  */
@@ -377,11 +377,11 @@ extern void free __P ((__ptr_t __ptr));
 extern void cfree __P ((__ptr_t __ptr));
 #endif /* Use misc.  */
 
-#if defined(__USE_GNU) || defined(__USE_BSD) || defined(__USE_MISC)
+#if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
 #include <alloca.h>
 #endif /* Use GNU, BSD, or misc.  */
 
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 /* Allocate SIZE bytes on a page boundary.  The storage cannot be freed.  */
 extern __ptr_t valloc __P ((size_t __size));
 #endif
@@ -416,7 +416,7 @@ extern char *getenv __P ((__const char *__name));
    programs is running with SUID or SGID enabled.  */
 extern char *__secure_getenv __P ((__const char *__name));
 
-#if defined(__USE_SVID) || defined(__USE_XOPEN)
+#if defined __USE_SVID || defined __USE_XOPEN
 /* The SVID says this is in <stdio.h>, but this seems a better place.	*/
 /* Put STRING, which is of the form "NAME=VALUE", in the environment.
    If there is no `=', remove NAME from the environment.  */
@@ -441,7 +441,7 @@ extern int clearenv __P ((void));
 #endif
 
 
-#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 /* Generate a unique temporary file name from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the file name unique.
@@ -468,7 +468,7 @@ extern int system __P ((__const char *__command));
 extern char *canonicalize_file_name __P ((__const char *__name));
 #endif
 
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 /* Return the canonical absolute name of file NAME.  The last file name
    component need not exist, and may be a symlink to a nonexistent file.
    If RESOLVED is null, the result is malloc'd; otherwise, if the canonical
@@ -522,7 +522,7 @@ extern lldiv_t lldiv __P ((long long int __numer, long long int __denom))
 #endif
 
 
-#if defined(__USE_SVID) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
 /* Convert floating point numbers to strings.  The returned values are
    valid only until another call to the same function.  */
 
@@ -578,7 +578,7 @@ extern int mbtowc __P ((wchar_t *__restrict __pwc,
    by WCHAR in S, returning its length.  */
 extern int wctomb __P ((char *__s, wchar_t __wchar));
 
-#if defined (__OPTIMIZE__) && __GNUC__ >= 2
+#if defined __OPTIMIZE__ && __GNUC__ >= 2
 extern __inline int mblen (__const char *__s, size_t __n)
 { return mbtowc ((wchar_t *) NULL, __s, __n); }
 #endif /* Optimizing GCC >=2.  */
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index ed24c08f2b..316adec5ff 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -40,6 +40,8 @@
 # define CHAR_TYPE wint_t
 # define L_(Ch) L##Ch
 # define ISSPACE(Ch) iswspace (Ch)
+# define ISDIGIT(Ch) iswdigit (Ch)
+# define ISXDIGIT(Ch) iswxdigit (Ch)
 # define TOLOWER(Ch) towlower (Ch)
 # define STRNCASECMP(S1, S2, N) __wcsncasecmp ((S1), (S2), (N))
 #else
@@ -47,6 +49,8 @@
 # define CHAR_TYPE char
 # define L_(Ch) Ch
 # define ISSPACE(Ch) isspace (Ch)
+# define ISDIGIT(Ch) isdigit (Ch)
+# define ISXDIGIT(Ch) isxdigit (Ch)
 # define TOLOWER(Ch) tolower (Ch)
 # define STRNCASECMP(S1, S2, N) __strncasecmp ((S1), (S2), (N))
 #endif
@@ -125,6 +129,7 @@ static const mp_limb_t _tens_in_limb[MAX_DIG_PER_LIMB + 1] =
 #define SWAP(x, y)		({ typeof(x) _tmp = x; x = y; y = _tmp; })
 
 #define NDIG			(MAX_10_EXP - MIN_10_EXP + 2 * MANT_DIG)
+#define HEXNDIG			((MAX_EXP - MIN_EXP + 7) / 8 + 2 * MANT_DIG)
 #define	RETURN_LIMB_SIZE		howmany (MANT_DIG, BITS_PER_MP_LIMB)
 
 #define RETURN(val,end)							      \
@@ -239,7 +244,7 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
   /* Number of digits for actual limb.  */
   int cnt = 0;
   mp_limb_t low = 0;
-  mp_limb_t base;
+  mp_limb_t start;
 
   *nsize = 0;
   assert (digcnt > 0);
@@ -262,9 +267,10 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
 	  low = 0;
 	}
 
-      /* There might be thousands separators or radix characters in the string.
-	 But these all can be ignored because we know the format of the number
-	 is correct and we have an exact number of characters to read.  */
+      /* There might be thousands separators or radix characters in
+	 the string.  But these all can be ignored because we know the
+	 format of the number is correct and we have an exact number
+	 of characters to read.  */
       while (*str < L_('0') || *str > L_('9'))
 	++str;
       low = low * 10 + *str++ - L_('0');
@@ -275,11 +281,11 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
   if (*exponent > 0 && cnt + *exponent <= MAX_DIG_PER_LIMB)
     {
       low *= _tens_in_limb[*exponent];
-      base = _tens_in_limb[cnt + *exponent];
+      start = _tens_in_limb[cnt + *exponent];
       *exponent = 0;
     }
   else
-    base = _tens_in_limb[cnt];
+    start = _tens_in_limb[cnt];
 
   if (*nsize == 0)
     {
@@ -289,11 +295,12 @@ str_to_mpn (const STRING_TYPE *str, int digcnt, mp_limb_t *n, mp_size_t *nsize,
   else
     {
       mp_limb_t cy;
-      cy = __mpn_mul_1 (n, n, *nsize, base);
+      cy = __mpn_mul_1 (n, n, *nsize, start);
       cy += __mpn_add_1 (n, n, *nsize, low);
       if (cy != 0)
 	n[(*nsize)++] = cy;
     }
+
   return str;
 }
 
@@ -346,6 +353,9 @@ INTERNAL (STRTOF) (nptr, endptr, group)
   MPN_VAR (num);		/* MP representation of the number.  */
   int exponent;			/* Exponent of the number.  */
 
+  /* Numbers starting `0X' or `0x' have to be processed with base 16.  */
+  int base = 10;
+
   /* When we have to compute fractional digits we form a fraction with a
      second multi-precision number (and we sometimes need a second for
      temporary results).  */
@@ -485,6 +495,18 @@ INTERNAL (STRTOF) (nptr, endptr, group)
       RETURN (0.0, nptr);
     }
 
+  /* First look whether we are faced with a hexadecimal number.  */
+  if (c == L_('0') && TOLOWER (cp[1]) == L_('x'))
+    {
+      /* Okay, it is a hexa-decimal number.  Remember this and skip
+	 the characters.  BTW: hexadecimal numbers must not be
+	 grouped.  */
+      base = 16;
+      cp += 2;
+      c = *cp;
+      grouping = NULL;
+    }
+
   /* Record the start of the digits, in case we will check their grouping.  */
   start_of_digits = startp = cp;
 
@@ -494,25 +516,29 @@ INTERNAL (STRTOF) (nptr, endptr, group)
 
   /* If no other digit but a '0' is found the result is 0.0.
      Return current read pointer.  */
-  if ((c < L_('0') || c > L_('9')) && (wint_t) c != decimal
-      && TOLOWER (c) != L_('e'))
+  if ((c < L_('0') || c > L_('9')) &&
+      (base == 16 && (c < TOLOWER (L_('a')) || c > TOLOWER (L_('f')))) &&
+      (wint_t) c != decimal &&
+      (base == 16 && (cp == start_of_digits || TOLOWER (c) != L_('p'))) &&
+      (base != 16 && TOLOWER (c) != L_('e')))
     {
       tp = correctly_grouped_prefix (start_of_digits, cp, thousands, grouping);
       /* If TP is at the start of the digits, there was no correctly
 	 grouped prefix of the string; so no number found.  */
-      RETURN (0.0, tp == start_of_digits ? nptr : tp);
+      RETURN (0.0, tp == start_of_digits ? (base == 16 ? cp - 1 : nptr) : tp);
     }
 
   /* Remember first significant digit and read following characters until the
      decimal point, exponent character or any non-FP number character.  */
   startp = cp;
   dig_no = 0;
-  while (dig_no < NDIG ||
+  while (dig_no < (base == 16 ? HEXNDIG : NDIG) ||
 	 /* If parsing grouping info, keep going past useful digits
 	    so we can check all the grouping separators.  */
 	 grouping)
     {
-      if (c >= L_('0') && c <= L_('9'))
+      if ((c >= L_('0') && c <= L_('9'))
+	  || (base == 16 && TOLOWER (c) >= L_('a') && TOLOWER (c) <= L_('f')))
 	++dig_no;
       else if (thousands == L'\0' || (wint_t) c != thousands)
 	/* Not a digit or separator: end of the integer part.  */
@@ -552,7 +578,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
 	}
     }
 
-  if (dig_no >= NDIG)
+  if (dig_no >= (base == 16 ? HEXNDIG : NDIG))
     /* Too many digits to be representable.  Assigning this to EXPONENT
        allows us to read the full number but return HUGE_VAL after parsing.  */
     exponent = MAX_10_EXP;
@@ -567,7 +593,8 @@ INTERNAL (STRTOF) (nptr, endptr, group)
   if ((wint_t) c == decimal)
     {
       c = *++cp;
-      while (c >= L_('0') && c <= L_('9'))
+      while (c >= L_('0') && c <= L_('9') ||
+	     (base == 16 && TOLOWER (c) >= L_('a') && TOLOWER (c) <= L_('f')))
 	{
 	  if (c != L_('0') && lead_zero == -1)
 	    lead_zero = dig_no - int_no;
@@ -580,7 +607,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
   expp = cp;
 
   /* Read exponent.  */
-  if (TOLOWER (c) == L_('e'))
+  if (TOLOWER (c) == (base == 16 ? L_('p') : L_('e')))
     {
       int exp_negative = 0;
 
@@ -598,9 +625,14 @@ INTERNAL (STRTOF) (nptr, endptr, group)
 	  int exp_limit;
 
 	  /* Get the exponent limit. */
-	  exp_limit = exp_negative ?
-		-MIN_10_EXP + MANT_DIG - int_no :
-		MAX_10_EXP - int_no + lead_zero;
+	  if (base == 16)
+	    exp_limit = (exp_negative ?
+			 -MIN_EXP + MANT_DIG - 4 * int_no :
+			 MAX_EXP - 4 * int_no + lead_zero);
+	  else
+	    exp_limit = (exp_negative ?
+			 -MIN_10_EXP + MANT_DIG - int_no :
+			 MAX_10_EXP - int_no + lead_zero);
 
 	  do
 	    {
@@ -610,11 +642,11 @@ INTERNAL (STRTOF) (nptr, endptr, group)
 		/* The exponent is too large/small to represent a valid
 		   number.  */
 		{
-	 	  FLOAT retval;
+	 	  FLOAT result;
 
 		  /* Overflow or underflow.  */
 		  __set_errno (ERANGE);
-		  retval = (exp_negative ? 0.0 :
+		  result = (exp_negative ? 0.0 :
 			    negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL);
 
 		  /* Accept all following digits as part of the exponent.  */
@@ -622,7 +654,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
 		    ++cp;
 		  while (*cp >= L_('0') && *cp <= L_('9'));
 
-		  RETURN (retval, cp);
+		  RETURN (result, cp);
 		  /* NOTREACHED */
 		}
 
@@ -664,17 +696,89 @@ INTERNAL (STRTOF) (nptr, endptr, group)
       while ((wint_t) *startp != decimal)
 	++startp;
       startp += lead_zero + 1;
-      exponent -= lead_zero;
+      exponent -= base == 16 ? 4 * lead_zero : lead_zero;
       dig_no -= lead_zero;
     }
 
+  /* If the BASE is 16 we can use a simpler algorithm.  */
+  if (base == 16)
+    {
+      static const int nbits[16] = { 0, 1, 2, 2, 3, 3, 3, 3,
+				     4, 4, 4, 4, 4, 4, 4, 4 };
+      int idx = (MANT_DIG - 1) / BITS_PER_MP_LIMB;
+      int pos = (MANT_DIG - 1) % BITS_PER_MP_LIMB;
+      mp_limb_t val;
+
+      while (!ISXDIGIT (*startp))
+	++startp;
+      if (ISDIGIT (*startp))
+	val = *startp++ - L_('0');
+      else
+	val = 10 + TOLOWER (*startp++) - L_('a');
+      bits = nbits[val];
+
+      if (pos + 1 >= 4)
+	{
+	  /* We don't have to care for wrapping.  This is the normal
+	     case so we add this optimization.  */
+	  retval[idx] = val << (pos - bits + 1);
+	  pos -= bits;
+	}
+      else
+	{
+	  if (pos + 1 >= bits)
+	    {
+	      retval[idx] = val << (pos - bits + 1);
+	      pos -= bits;
+	    }
+	  else
+	    {
+	      retval[idx--] = val >> (bits - pos - 1);
+	      retval[idx] = val << (BITS_PER_MP_LIMB - (bits - pos - 1));
+	      pos = BITS_PER_MP_LIMB - 1 - (bits - pos - 1);
+	    }
+	}
+
+      while (--dig_no > 0 && idx >= 0)
+	{
+	  while (!ISXDIGIT (*startp))
+	    ++startp;
+	  if (ISDIGIT (*startp))
+	    val = *startp++ - L_('0');
+	  else
+	    val = 10 + TOLOWER (*startp++) - L_('a');
+
+	  if (pos + 1 >= 4)
+	    {
+	      retval[idx] |= val << (pos - 4 + 1);
+	      pos -= 4;
+	    }
+	  else
+	    {
+	      retval[idx--] |= val >> (4 - pos - 1);
+	      val <<= BITS_PER_MP_LIMB - (4 - pos - 1);
+	      if (idx < 0)
+		return round_and_return (retval, exponent, negative, val,
+					 BITS_PER_MP_LIMB - 1, dig_no > 0);
+
+	      retval[idx] = val;
+	      pos = BITS_PER_MP_LIMB - 1 - (4 - pos - 1);
+	    }
+	}
+
+      /* We ran out of digits.  */
+      MPN_ZERO (retval, idx);
+
+      return round_and_return (retval, exponent, negative, 0, 0, 0);
+    }
+
   /* Now we have the number of digits in total and the integer digits as well
      as the exponent and its sign.  We can decide whether the read digits are
      really integer digits or belong to the fractional part; i.e. we normalize
      123e-2 to 1.23.  */
   {
-    register int incr = exponent < 0 ? MAX (-int_no, exponent)
-				     : MIN (dig_no - int_no, exponent);
+    register int incr = (exponent < 0 ? MAX (-int_no, exponent)
+			 : MIN (dig_no - int_no, exponent));
     int_no += incr;
     exponent -= incr;
   }
@@ -711,9 +815,10 @@ INTERNAL (STRTOF) (nptr, endptr, group)
 		  mp_limb_t cy;
 		  exponent ^= expbit;
 
-		  /* FIXME: not the whole multiplication has to be done.
-		     If we have the needed number of bits we only need the
-		     information whether more non-zero bits follow.  */
+		  /* FIXME: not the whole multiplication has to be
+		     done.  If we have the needed number of bits we
+		     only need the information whether more non-zero
+		     bits follow.  */
 		  if (numsize >= ttab->arraysize - _FPIO_CONST_OFFSET)
 		    cy = __mpn_mul (pdest, psrc, numsize,
 				    &ttab->array[_FPIO_CONST_OFFSET],
@@ -848,7 +953,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
     assert (dig_no > int_no && exponent <= 0);
 
 
-    /* For the fractional part we need not process too much digits.  One
+    /* For the fractional part we need not process too many digits.  One
        decimal digits gives us log_2(10) ~ 3.32 bits.  If we now compute
                         ceil(BITS / 3) =: N
        digits we should have enough bits for the result.  The remaining
@@ -1126,7 +1231,9 @@ INTERNAL (STRTOF) (nptr, endptr, group)
 		      for (i = RETURN_LIMB_SIZE; i > empty; --i)
 			retval[i] = retval[i - empty];
 #endif
+#if RETURN_LIMB_SIZE > 1
 		      retval[1] = 0;
+#endif
 		      for (i = numsize; i > 0; --i)
 			num[i + empty] = num[i - 1];
 		      MPN_ZERO (num, empty + 1);
diff --git a/string/string.h b/string/string.h
index 462992dbf3..9602886910 100644
--- a/string/string.h
+++ b/string/string.h
@@ -46,7 +46,7 @@ extern __ptr_t memmove __P ((__ptr_t __dest, __const __ptr_t __src,
    or NULL if C was not found in the first N bytes of SRC.  */
 extern __ptr_t __memccpy __P ((__ptr_t __dest, __const __ptr_t __src,
 			       int __c, size_t __n));
-#if defined (__USE_SVID) || defined (__USE_BSD) || defined (__USE_XOPEN)
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN
 extern __ptr_t memccpy __P ((__ptr_t __dest, __const __ptr_t __src,
 			     int __c, size_t __n));
 #endif /* SVID.  */
@@ -102,7 +102,7 @@ extern size_t __strxfrm_l __P ((char *__dest, __const char *__src, size_t __n,
 				__locale_t __l));
 #endif
 
-#if defined(__USE_SVID) || defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 /* Duplicate S, returning an identical malloc'd string.  */
 extern char *__strdup __P ((__const char *__s));
 extern char *strdup __P ((__const char *__s));
@@ -112,11 +112,11 @@ extern char *strdup __P ((__const char *__s));
    resultant string is terminated even if no null terminator
    appears before STRING[N].  */
 extern char *__strndup __P ((__const char *__string, size_t __n));
-#if defined(__USE_GNU)
+#if defined __USE_GNU
 extern char *strndup __P ((__const char *__string, size_t __n));
 #endif
 
-#if defined (__USE_GNU) && defined (__GNUC__)
+#if defined __USE_GNU && defined __GNUC__
 /* Duplicate S, returning an identical alloca'd string.  */
 #define strdupa(s)							      \
   (__extension__							      \
@@ -202,7 +202,7 @@ extern char *__strerror_r __P ((int __errnum, char *__buf, size_t __buflen));
 extern char *strerror_r __P ((int __errnum, char *__buf, size_t __buflen));
 #endif
 
-#if defined(__USE_BSD) || defined(__USE_XOPEN_EXTENDED)
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
 /* Copy N bytes of SRC to DEST (like memmove, but args reversed).  */
 extern void bcopy __P ((__const __ptr_t __src, __ptr_t __dest, size_t __n));
 
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index 2b232acbe3..2cc64cc10b 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -55,7 +55,8 @@ headers = $(addprefix rpc/,auth.h auth_unix.h clnt.h netdb.h pmap_clnt.h \
 	  $(rpcsvc:%=rpcsvc/%)
 install-others = $(inst_sysconfdir)/rpc
 generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) \
-	    $(rpcsvc:%.x=rpcsvc/%.stmp) $(rpcsvc:%.x=x%.stmp)
+	    $(rpcsvc:%.x=rpcsvc/%.stmp) $(rpcsvc:%.x=x%.stmp) \
+	    rpc-proto.c
 
 routines := auth_none auth_unix authuxprot bindrsvprt \
 	    clnt_gen clnt_perr clnt_raw clnt_simp clnt_tcp \
@@ -142,4 +143,20 @@ $(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen
 # The generated source files depend on the corresponding generated headers.
 # Gratuitous dependency on generated .c file here just gets it mentioned to
 # avoid being an intermediate file and getting removed.
-$(rpcsvc:%.x=$(objpfx)x%.o): $(objpfx)x%.o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h
+$(rpcsvc:%.x=$(objpfx)x%.o): $(objpfx)x%.o: $(objpfx)x%.c $(objpfx)rpcsvc/%.h \
+					    $(objpfx)rpc-proto.d
+
+ifndef no_deps
+-include $(objpfx)rpc-proto.d
+endif
+
+$(objpfx)rpc-proto.d: $(objpfx)%.d: $(objpfx)%.c
+	$(+make-deps)
+# Special file to generate dependencies for the RPC service objects.
+# Collect all include directives from the source files.
+$(objpfx)rpc-proto.c: $(rpcsvc:%=rpcsvc/%)
+	{ echo '#include <rpc/types.h>'; \
+	  echo '#include <rpc/xdr.h>'; \
+	  echo '#include <rpc/rpc.h>'; \
+	  sed -n '/^%#include/s/%//p' $^; } > $@T
+	mv -f $@T $@
diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile
index f4d001b7f4..5513ca998c 100644
--- a/sysdeps/generic/Makefile
+++ b/sysdeps/generic/Makefile
@@ -24,7 +24,7 @@ $(common-objpfx)bytesex.h: $(common-objpfx)det_endian
 	mv $@-tmp $@
 
 $(common-objpfx)det_endian: $(sysdep_dir)/generic/det_endian.c
-	$(native-compile)
+	$(common-objdir-compile)
 
 before-compile := $(before-compile) $(common-objpfx)bytesex.h
 common-generated := $(common-generated) bytesex.h det_endian
@@ -40,12 +40,10 @@ $(objpfx)siglist.c: $(objpfx)make_siglist
 	$(dir $<)$(notdir $<) > $@-tmp
 	mv $@-tmp $@
 
+make_siglist-CFLAGS = -DSIGNUM_H=\"$(shell pwd)/$(firstword $(wildcard \
+				   $(+sysdep_dirs:%=%/signum.h)))\"
 $(objpfx)make_siglist: $(sysdep_dir)/generic/make_siglist.c
-	$(make-target-directory)
-	signum_h=`cd $(dir $(firstword $(wildcard \
-			   $(+sysdep_dirs:%=%/signum.h)))); pwd`/signum.h; \
-	$(native-compile) \
-	-DSIGNUM_H=\"$${signum_h}\"
+	$(native-compile)
 
 generated := $(generated) make_siglist siglist.c
 endif
diff --git a/sysdeps/ieee754/dbl2mpn.c b/sysdeps/ieee754/dbl2mpn.c
index bbac525a07..749fb41737 100644
--- a/sysdeps/ieee754/dbl2mpn.c
+++ b/sysdeps/ieee754/dbl2mpn.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library 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.
+   The GNU C Library 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.
 
-The GNU C Library 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.
+   The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
diff --git a/sysdeps/ieee754/ldbl2mpn.c b/sysdeps/ieee754/ldbl2mpn.c
index b72af2ef47..e55bb8e029 100644
--- a/sysdeps/ieee754/ldbl2mpn.c
+++ b/sysdeps/ieee754/ldbl2mpn.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library 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.
+   The GNU C Library 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.
 
-The GNU C Library 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.
+   The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
diff --git a/sysdeps/ieee754/mpn2dbl.c b/sysdeps/ieee754/mpn2dbl.c
index e05d849b61..8219d18bb2 100644
--- a/sysdeps/ieee754/mpn2dbl.c
+++ b/sysdeps/ieee754/mpn2dbl.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library 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.
-
-The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
diff --git a/sysdeps/ieee754/mpn2flt.c b/sysdeps/ieee754/mpn2flt.c
index e9bbc490ad..37448d11d8 100644
--- a/sysdeps/ieee754/mpn2flt.c
+++ b/sysdeps/ieee754/mpn2flt.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library 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.
+   The GNU C Library 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.
 
-The GNU C Library 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.
+   The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
@@ -23,13 +23,13 @@ Cambridge, MA 02139, USA.  */
 
 /* Convert a multi-precision integer of the needed number of bits (24 for
    float) and an integral power of two to a `float' in IEEE754 single-
-   precision format.  */ 
+   precision format.  */
 
 float
 __mpn_construct_float (mp_srcptr frac_ptr, int expt, int sign)
 {
   union ieee754_float u;
-  
+
   u.ieee.negative = sign;
   u.ieee.exponent = expt + IEEE754_FLOAT_BIAS;
 #if BITS_PER_MP_LIMB > FLT_MANT_DIG
diff --git a/sysdeps/ieee754/mpn2ldbl.c b/sysdeps/ieee754/mpn2ldbl.c
index 03774a33c3..27a3e33266 100644
--- a/sysdeps/ieee754/mpn2ldbl.c
+++ b/sysdeps/ieee754/mpn2ldbl.c
@@ -1,20 +1,20 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library 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.
-
-The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
 
 #include "gmp.h"
 #include "gmp-impl.h"
diff --git a/sysdeps/libm-ieee754/s_fdim.c b/sysdeps/libm-ieee754/s_fdim.c
new file mode 100644
index 0000000000..cdd7886068
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fdim.c
@@ -0,0 +1,36 @@
+/* Return positive difference between arguments.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+double
+__fdim (double x, double y)
+{
+  int clsx = fpclassify (x);
+  int clsy = fpclassify (y);
+
+  if (clsx == FP_NAN || clsy == FP_NAN
+      || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+    /* Raise invalid flag.  */
+    return x - y;
+
+  return x < y ? 0 : x - y;
+}
+weak_alias (__fdim, fdim)
diff --git a/sysdeps/libm-ieee754/s_fdimf.c b/sysdeps/libm-ieee754/s_fdimf.c
new file mode 100644
index 0000000000..a8d8192c0f
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fdimf.c
@@ -0,0 +1,36 @@
+/* Return positive difference between arguments.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+float
+__fdimf (float x, float y)
+{
+  int clsx = fpclassify (x);
+  int clsy = fpclassify (y);
+
+  if (clsx == FP_NAN || clsy == FP_NAN
+      || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+    /* Raise invalid flag.  */
+    return x - y;
+
+  return x < y ? 0 : x - y;
+}
+weak_alias (__fdimf, fdimf)
diff --git a/sysdeps/libm-ieee754/s_fdiml.c b/sysdeps/libm-ieee754/s_fdiml.c
new file mode 100644
index 0000000000..c97a668f10
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fdiml.c
@@ -0,0 +1,36 @@
+/* Return positive difference between arguments.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+long double
+__fdiml (long double x, long double y)
+{
+  int clsx = fpclassify (x);
+  int clsy = fpclassify (y);
+
+  if (clsx == FP_NAN || clsy == FP_NAN
+      || (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
+    /* Raise invalid flag.  */
+    return x - y;
+
+  return x < y ? 0 : x - y;
+}
+weak_alias (__fdiml, fdiml)
diff --git a/sysdeps/libm-ieee754/s_fmax.c b/sysdeps/libm-ieee754/s_fmax.c
new file mode 100644
index 0000000000..651def8aac
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fmax.c
@@ -0,0 +1,29 @@
+/* Return maximum numeric value of X and Y.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+
+double
+__fmax (double x, double y)
+{
+  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmax, fmax)
diff --git a/sysdeps/libm-ieee754/s_fmaxf.c b/sysdeps/libm-ieee754/s_fmaxf.c
new file mode 100644
index 0000000000..e56193fe7b
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fmaxf.c
@@ -0,0 +1,29 @@
+/* Return maximum numeric value of X and Y.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+
+float
+__fmaxf (float x, float y)
+{
+  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxf, fmaxf)
diff --git a/sysdeps/libm-ieee754/s_fmaxl.c b/sysdeps/libm-ieee754/s_fmaxl.c
new file mode 100644
index 0000000000..6e1c7152ed
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fmaxl.c
@@ -0,0 +1,29 @@
+/* Return maximum numeric value of X and Y.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+
+long double
+__fmaxl (long double x, long double y)
+{
+  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxl, fmaxl)
diff --git a/sysdeps/libm-ieee754/s_fmin.c b/sysdeps/libm-ieee754/s_fmin.c
new file mode 100644
index 0000000000..2a49a2e069
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fmin.c
@@ -0,0 +1,29 @@
+/* Return minimum numeric value of X and Y.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+
+double
+__fmin (double x, double y)
+{
+  return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmin, fmin)
diff --git a/sysdeps/libm-ieee754/s_fminf.c b/sysdeps/libm-ieee754/s_fminf.c
new file mode 100644
index 0000000000..72c656e1ac
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fminf.c
@@ -0,0 +1,29 @@
+/* Return minimum numeric value of X and Y.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+
+float
+__fminf (float x, float y)
+{
+  return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminf, fminf)
diff --git a/sysdeps/libm-ieee754/s_fminl.c b/sysdeps/libm-ieee754/s_fminl.c
new file mode 100644
index 0000000000..0f06194b77
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fminl.c
@@ -0,0 +1,29 @@
+/* Return minimum numeric value of X and Y.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+
+long double
+__fminl (long double x, long double y)
+{
+  return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminl, fminl)
diff --git a/sysdeps/libm-ieee754/s_fpclassify.c b/sysdeps/libm-ieee754/s_fpclassify.c
new file mode 100644
index 0000000000..dd4e742260
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fpclassify.c
@@ -0,0 +1,43 @@
+/* Return classification value corresponding to argument.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+int
+__fpclassify (double x)
+{
+  u_int32_t hx, lx;
+  int retval = FP_NORMAL;
+
+  GET_WORDS (hx, lx, x);
+  lx |= hx & 0xfffff;
+  hx &= 0x7ff00000;
+  if ((hx | lx) == 0)
+    retval = FP_ZERO;
+  else if (hx == 0)
+    retval = FP_SUBNORMAL;
+  else if (hx == 0x7ff00000)
+    retval = lx != 0 ? FP_NAN : FP_INFINITE;
+
+  return retval;
+}
diff --git a/sysdeps/libm-ieee754/s_fpclassifyf.c b/sysdeps/libm-ieee754/s_fpclassifyf.c
new file mode 100644
index 0000000000..15bcfef4a6
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fpclassifyf.c
@@ -0,0 +1,42 @@
+/* Return classification value corresponding to argument.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+int
+__fpclassifyf (float x)
+{
+  u_int32_t wx;
+  int retval = FP_NORMAL;
+
+  GET_FLOAT_WORD (wx, x);
+  wx &= 0x7fffffff;
+  if (wx == 0)
+    retval = FP_ZERO;
+  else if (wx < 0x1000000)
+    retval = FP_SUBNORMAL;
+  else if (wx == 0x7f000000)
+    retval = wx > 0x7f000000 ? FP_NAN : FP_INFINITE;
+
+  return retval;
+}
diff --git a/sysdeps/libm-ieee754/s_fpclassifyl.c b/sysdeps/libm-ieee754/s_fpclassifyl.c
new file mode 100644
index 0000000000..ef37e6f0cc
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_fpclassifyl.c
@@ -0,0 +1,43 @@
+/* Return classification value corresponding to argument.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+int
+__fpclassifyl (long double x)
+{
+  u_int32_t ex, hx, lx;
+  int retval = FP_NORMAL;
+
+  GET_LDOUBLE_WORDS (ex, hx, lx, x);
+  hx |= lx;
+  ex &= 0x7fff;
+  if ((ex | hx) == 0)
+    retval = FP_ZERO;
+  else if (ex == 0)
+    retval = FP_SUBNORMAL;
+  else if (ex == 0x7fff)
+    retval = hx != 0 ? FP_NAN : FP_INFINITE;
+
+  return retval;
+}
diff --git a/sysdeps/libm-ieee754/s_signbit.c b/sysdeps/libm-ieee754/s_signbit.c
new file mode 100644
index 0000000000..ee340035fb
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_signbit.c
@@ -0,0 +1,32 @@
+/* Return nonzero value if number is negative.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+int
+__signbit (double x)
+{
+  int32_t hx;
+
+  GET_HIGH_WORD (hx, x);
+  return hx & 0x80000000;
+}
diff --git a/sysdeps/libm-ieee754/s_signbitf.c b/sysdeps/libm-ieee754/s_signbitf.c
new file mode 100644
index 0000000000..85418ea73f
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_signbitf.c
@@ -0,0 +1,32 @@
+/* Return nonzero value if number is negative.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+int
+__signbitf (float x)
+{
+  int32_t hx;
+
+  GET_FLOAT_WORD (hx, x);
+  return hx & 0x80000000;
+}
diff --git a/sysdeps/libm-ieee754/s_signbitl.c b/sysdeps/libm-ieee754/s_signbitl.c
new file mode 100644
index 0000000000..b12fdefff4
--- /dev/null
+++ b/sysdeps/libm-ieee754/s_signbitl.c
@@ -0,0 +1,32 @@
+/* Return nonzero value if number is negative.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+int
+__signbitl (long double x)
+{
+  int32_t e;
+
+  GET_LDOUBLE_EXP (e, x);
+  return e & 0x8000;
+}
diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/__math.h
index 0e3e2a3d8c..1a29a56d92 100644
--- a/sysdeps/m68k/fpu/__math.h
+++ b/sysdeps/m68k/fpu/__math.h
@@ -1,26 +1,27 @@
-/* Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Definitions of inline math functions implemented by the m68881/2.
+   Copyright (C) 1991, 92, 93, 94, 96, 97 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library 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.
+   The GNU C Library 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.
 
-The GNU C Library 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.
+   The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
 #ifdef	__GNUC__
 
 #include <sys/cdefs.h>
 
-#ifdef	__NO_M81_MATH_INLINES
+#ifdef	__LIBC_M81_MATH_INLINES
 /* This is used when defining the functions themselves.  Define them with
    __ names, and with `static inline' instead of `extern inline' so the
    bodies will always be used, never an external function call.  */
@@ -34,36 +35,35 @@ Cambridge, MA 02139, USA.  */
 
 /* Define a const math function.  */
 #define __m81_defun(rettype, func, args)				      \
-  __m81_inline rettype							      \
-  __m81_u(func) args __attribute__((__const__));			      \
-  __m81_inline rettype							      \
+  __m81_inline rettype __attribute__((__const__))			      \
   __m81_u(func) args
 
 /* Define the three variants of a math function that has a direct
    implementation in the m68k fpu.  FUNC is the name for C (which will be
    suffixed with f and l for the float and long double version, resp).  OP
    is the name of the fpu operation (without leading f).  */
-#define	__inline_mathop(func, op)					      \
-  __m81_defun (double, func, (double __mathop_x))			      \
-  {									      \
-    double __result;							      \
-    __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
-    return __result;							      \
-  }									      \
-  __m81_defun (float, func##f, (float __mathop_x))			      \
-  {									      \
-    float __result;							      \
-    __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
-    return __result;							      \
-  }									      \
-  __m81_defun (long double, func##l, (long double __mathop_x))		      \
+
+#ifdef __USE_MISC
+#define	__inline_mathop(func, op)			\
+  __inline_mathop1(double, func, op)			\
+  __inline_mathop1(float, __CONCAT(func,f), op)		\
+  __inline_mathop1(long double, __CONCAT(func,l), op)
+#else
+#define	__inline_mathop(func, op)			\
+  __inline_mathop1(double, func, op)
+#endif
+
+#define __inline_mathop1(float_type,func, op)				      \
+  __m81_defun (float_type, func, (float_type __mathop_x))		      \
   {									      \
-    long double __result;						      \
+    float_type __result;						      \
     __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
     return __result;							      \
   }
 
+#ifdef __LIBC_M81_MATH_INLINES
 /* ieee style elementary functions */
+/* These are internal to the implementation of libm.  */
 __inline_mathop(__ieee754_acos, acos)
 __inline_mathop(__ieee754_asin, asin)
 __inline_mathop(__ieee754_cosh, cosh)
@@ -73,6 +73,7 @@ __inline_mathop(__ieee754_log10, log10)
 __inline_mathop(__ieee754_log, logn)
 __inline_mathop(__ieee754_sqrt, sqrt)
 __inline_mathop(__ieee754_atanh, atanh)
+#endif
 
 __inline_mathop(__atan, atan)
 __inline_mathop(__cos, cos)
@@ -88,31 +89,56 @@ __inline_mathop(__log1p, lognp1)
 __inline_mathop(__logb, log2)
 __inline_mathop(__significand, getman)
 
+#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+
+__inline_mathop(atan, atan)
+__inline_mathop(cos, cos)
+__inline_mathop(sin, sin)
+__inline_mathop(tan, tan)
+__inline_mathop(tanh, tanh)
+__inline_mathop(fabs, abs)
+__inline_mathop(sqrt, sqrt)
+
+#if defined(__USE_MISC) || defined(__USE_XOPEN_EXTENDED)
+__inline_mathop(rint, int)
+__inline_mathop(expm1, etoxm1)
+__inline_mathop(log1p, lognp1)
+__inline_mathop(logb, log2)
+#endif
+
+#ifdef __USE_MISC
+__inline_mathop(significand, getman)
+#endif
+
+#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
+
 /* This macro contains the definition for the rest of the inline
    functions, using __FLOAT_TYPE as the domain type and __S as the suffix
    for the function names.  */
 
-#define __inline_functions(__float_type, __s)				     \
-__m81_defun (__float_type,						     \
-	     __ieee754_remainder##__s, (__float_type __x, __float_type __y)) \
+#ifdef __LIBC_M81_MATH_INLINES
+/* Internally used functions.  */
+#define __internal_inline_functions(float_type, s)			     \
+__m81_defun (float_type, __CONCAT(__ieee754_remainder,s),		     \
+	     (float_type __x, float_type __y))				     \
 {									     \
-  __float_type __result;						     \
+  float_type __result;							     \
   __asm("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));	     \
   return __result;							     \
 }									     \
 									     \
-__m81_defun (__float_type,						     \
-	     __ieee754_fmod##__s, (__float_type __x, __float_type __y))	     \
+__m81_defun (float_type, __CONCAT(__ieee754_fmod,s),			     \
+	     (float_type __x, float_type __y))				     \
 {									     \
-  __float_type __result;						     \
+  float_type __result;							     \
   __asm("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));	     \
   return __result;							     \
 }									     \
 									     \
-__m81_defun (__float_type,						     \
-	     __ieee754_atan2##__s, (__float_type __y, __float_type __x))     \
+__m81_defun (float_type, __CONCAT(__ieee754_atan2,s),			     \
+	     (float_type __y, float_type __x))				     \
 {									     \
-  __float_type __pi, __pi_2;						     \
+  float_type __pi, __pi_2;						     \
 									     \
   __asm ("fmovecr%.x %#0, %0" : "=f" (__pi));				     \
   __asm ("fscale%.w %#-1, %0" : "=f" (__pi_2) : "0" (__pi));		     \
@@ -121,16 +147,16 @@ __m81_defun (__float_type,						     \
       if (__y > 0)							     \
 	{								     \
 	  if (__x > __y)						     \
-	    return __m81_u(__atan##__s) (__y / __x);			     \
+	    return __m81_u(__CONCAT(__atan,s)) (__y / __x);		     \
 	  else								     \
-	    return __pi_2 - __m81_u(__atan##__s) (__x / __y);		     \
+	    return __pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y);	     \
 	}								     \
       else								     \
 	{								     \
 	  if (__x > -__y)						     \
-	    return __m81_u(__atan##__s) (__y / __x);			     \
+	    return __m81_u(__CONCAT(__atan,s)) (__y / __x);		     \
 	  else								     \
-	    return -__pi_2 - __m81_u(__atan##__s) (__x / __y);		     \
+	    return -__pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y);	     \
 	}								     \
     }									     \
   else									     \
@@ -138,58 +164,24 @@ __m81_defun (__float_type,						     \
       if (__y > 0)							     \
 	{								     \
 	  if (-__x < __y)						     \
-	    return __pi + __m81_u(__atan##__s) (__y / __x);		     \
+	    return __pi + __m81_u(__CONCAT(__atan,s)) (__y / __x);	     \
 	  else								     \
-	    return __pi_2 - __m81_u(__atan##__s) (__x / __y);		     \
+	    return __pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y);	     \
 	}								     \
       else								     \
 	{								     \
 	  if (-__x > -__y)						     \
-	    return -__pi + __m81_u(__atan##__s) (__y / __x);		     \
+	    return -__pi + __m81_u(__CONCAT(__atan,s)) (__y / __x);	     \
 	  else								     \
-	    return -__pi_2 - __m81_u(__atan##__s) (__x / __y);		     \
+	    return -__pi_2 - __m81_u(__CONCAT(__atan,s)) (__x / __y);	     \
 	}								     \
     }									     \
 }									     \
 									     \
-__m81_inline __float_type						     \
-__m81_u(__frexp##__s)(__float_type __value, int *__expptr)		     \
-{									     \
-  __float_type __mantissa, __exponent;					     \
-  int __iexponent;							     \
-  if (__value == 0.0)							     \
-    {									     \
-      *__expptr = 0;							     \
-      return __value;							     \
-    }									     \
-  __asm("fgetexp%.x %1, %0" : "=f" (__exponent) : "f" (__value));	     \
-  __iexponent = (int) __exponent + 1;					     \
-  *__expptr = __iexponent;						     \
-  __asm("fscale%.l %2, %0" : "=f" (__mantissa)				     \
-	: "0" (__value), "dmi" (-__iexponent));				     \
-  return __mantissa;							     \
-}									     \
-									     \
-__m81_defun (__float_type, __floor##__s, (__float_type __x))		     \
-{									     \
-  __float_type __result;						     \
-  unsigned long int __ctrl_reg;						     \
-  __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg));		     \
-  /* Set rounding towards negative infinity.  */			     \
-  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */ 		     \
-		      : "dmi" ((__ctrl_reg & ~0x10) | 0x20));		     \
-  /* Convert X to an integer, using -Inf rounding.  */			     \
-  __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x));	     \
-  /* Restore the previous rounding mode.  */				     \
-  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		     \
-		      : "dmi" (__ctrl_reg));				     \
-  return __result;							     \
-}									     \
-									     \
-__m81_defun (__float_type,						     \
-	     __ieee754_pow##__s, (__float_type __x, __float_type __y))	     \
+__m81_defun (float_type, __CONCAT(__ieee754_pow,s),			     \
+	     (float_type __x, float_type __y))				     \
 {									     \
-  __float_type __result;						     \
+  float_type __result;							     \
   if (__x == 0.0)							     \
     {									     \
       if (__y <= 0.0)							     \
@@ -209,12 +201,12 @@ __m81_defun (__float_type,						     \
     __asm("ftwotox%.x %1, %0" : "=f" (__result) : "f" (__y));		     \
   else if (__x < 0.0)							     \
     {									     \
-      __float_type __temp = __m81_u (__rint##__s) (__y);		     \
+      float_type __temp = __m81_u (__CONCAT(__rint,s)) (__y);		     \
       if (__y == __temp)						     \
 	{								     \
 	  int __i = (int) __y;						     \
-	  __result = (__m81_u(__ieee754_exp##__s)			     \
-		      (__y * __m81_u(__ieee754_log##__s) (-__x)));	     \
+	  __result = (__m81_u(__CONCAT(__ieee754_exp,s))		     \
+		      (__y * __m81_u(__CONCAT(__ieee754_log,s)) (-__x)));    \
 	  if (__i & 1)							     \
 	    __result = -__result;					     \
 	}								     \
@@ -222,14 +214,66 @@ __m81_defun (__float_type,						     \
 	__result = 0.0 / 0.0;						     \
     }									     \
   else									     \
-    __result = (__m81_u(__ieee754_exp##__s)				     \
-		(__y * __m81_u(__ieee754_log##__s) (__x)));		     \
+    __result = (__m81_u(__CONCAT(__ieee754_exp,s))			     \
+		(__y * __m81_u(__CONCAT(__ieee754_log,s)) (__x)));	     \
   return __result;							     \
 }									     \
 									     \
-__m81_defun (__float_type, __ceil##__s, (__float_type __x))		     \
+__m81_defun (float_type, __CONCAT(__ieee754_scalb,s),			     \
+	     (float_type __x, float_type __n))				     \
 {									     \
-  __float_type __result;						     \
+  float_type __result;							     \
+  __asm ("fscale%.x %1, %0" : "=f" (__result) : "f" (__n), "0" (__x));	     \
+  return __result;							     \
+}
+
+__internal_inline_functions (double,)
+__internal_inline_functions (float,f)
+__internal_inline_functions (long double,l)
+#undef __internal_inline_functions
+
+#endif /* __LIBC_M81_MATH_INLINES */
+
+/* The rest of the functions are available to the user.  */
+
+#define __inline_functions(float_type, s)				     \
+__m81_inline float_type							     \
+__m81_u(__CONCAT(__frexp,s))(float_type __value, int *__expptr)		     \
+{									     \
+  float_type __mantissa, __exponent;					     \
+  int __iexponent;							     \
+  if (__value == 0.0)							     \
+    {									     \
+      *__expptr = 0;							     \
+      return __value;							     \
+    }									     \
+  __asm("fgetexp%.x %1, %0" : "=f" (__exponent) : "f" (__value));	     \
+  __iexponent = (int) __exponent + 1;					     \
+  *__expptr = __iexponent;						     \
+  __asm("fscale%.l %2, %0" : "=f" (__mantissa)				     \
+	: "0" (__value), "dmi" (-__iexponent));				     \
+  return __mantissa;							     \
+}									     \
+									     \
+__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x))		     \
+{									     \
+  float_type __result;							     \
+  unsigned long int __ctrl_reg;						     \
+  __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg));		     \
+  /* Set rounding towards negative infinity.  */			     \
+  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		     \
+		      : "dmi" ((__ctrl_reg & ~0x10) | 0x20));		     \
+  /* Convert X to an integer, using -Inf rounding.  */			     \
+  __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x));	     \
+  /* Restore the previous rounding mode.  */				     \
+  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */		     \
+		      : "dmi" (__ctrl_reg));				     \
+  return __result;							     \
+}									     \
+									     \
+__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x))		     \
+{									     \
+  float_type __result;							     \
   unsigned long int __ctrl_reg;						     \
   __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg));		     \
   /* Set rounding towards positive infinity.  */			     \
@@ -243,16 +287,16 @@ __m81_defun (__float_type, __ceil##__s, (__float_type __x))		     \
   return __result;							     \
 }									     \
 									     \
-__m81_inline __float_type						     \
-__m81_u(__modf##__s)(__float_type __value, __float_type *__iptr)	     \
+__m81_inline float_type							     \
+__m81_u(__CONCAT(__modf,s))(float_type __value, float_type *__iptr)	     \
 {									     \
-  __float_type __modf_int;						     \
+  float_type __modf_int;						     \
   __asm ("fintrz%.x %1, %0" : "=f" (__modf_int) : "f" (__value));	     \
   *__iptr = __modf_int;							     \
   return __value - __modf_int;						     \
 }									     \
 									     \
-__m81_defun (int, __isinf##__s, (__float_type __value))			     \
+__m81_defun (int, __CONCAT(__isinf,s), (float_type __value))		     \
 {									     \
   /* There is no branch-condition for infinity,				     \
      so we must extract and examine the condition codes manually.  */	     \
@@ -262,7 +306,7 @@ __m81_defun (int, __isinf##__s, (__float_type __value))			     \
   return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0;	     \
 }									     \
 									     \
-__m81_defun (int, __isnan##__s, (__float_type __value))			     \
+__m81_defun (int, __CONCAT(__isnan,s), (float_type __value))		     \
 {									     \
   char __result;							     \
   __asm("ftst%.x %1\n"							     \
@@ -270,7 +314,7 @@ __m81_defun (int, __isnan##__s, (__float_type __value))			     \
   return __result;							     \
 }									     \
 									     \
-__m81_defun (int, __finite##__s, (__float_type __value))		     \
+__m81_defun (int, __CONCAT(__finite,s), (float_type __value))		     \
 {									     \
   /* There is no branch-condition for infinity, so we must extract and	     \
      examine the condition codes manually.  */				     \
@@ -280,34 +324,94 @@ __m81_defun (int, __finite##__s, (__float_type __value))		     \
   return (__fpsr & (3 << 24)) == 0;					     \
 }									     \
 									     \
-__m81_defun (int, __ilogb##__s, (__float_type __x))			     \
+__m81_defun (int, __CONCAT(__ilogb,s), (float_type __x))		     \
 {									     \
-  __float_type __result;						     \
+  float_type __result;							     \
   if (__x == 0.0)							     \
     return 0x80000001;							     \
   __asm("fgetexp%.x %1, %0" : "=f" (__result) : "f" (__x));		     \
   return (int) __result;						     \
 }									     \
 									     \
-__m81_defun (__float_type,						     \
-	     __ieee754_scalb##__s, (__float_type __x, __float_type __n))     \
+__m81_defun (float_type, __CONCAT(__scalbn,s), (float_type __x, int __n))    \
 {									     \
-  __float_type __result;						     \
-  __asm ("fscale%.x %1, %0" : "=f" (__result) : "f" (__n), "0" (__x));	     \
-  return __result;							     \
-}									     \
-									     \
-__m81_defun (__float_type, __scalbn##__s, (__float_type __x, int __n))	     \
-{									     \
-  __float_type __result;						     \
+  float_type __result;							     \
   __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x));     \
   return __result;							     \
 }
 
 /* This defines the three variants of the inline functions.  */
-__inline_functions (double, )
-__inline_functions (float, f)
-__inline_functions (long double, l)
+__inline_functions (double,)
+__inline_functions (float,f)
+__inline_functions (long double,l)
 #undef __inline_functions
 
+#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+
+/* Define inline versions of the user visible functions.  */
+
+#define __inline_forward_c(rettype, name, args1, args2)	\
+extern __inline rettype __attribute__((__const__))	\
+name args1						\
+{							\
+  return __CONCAT(__,name) args2;			\
+}
+
+#define __inline_forward(rettype, name, args1, args2)	\
+extern __inline rettype name args1			\
+{							\
+  return __CONCAT(__,name) args2;			\
+}
+
+__inline_forward(double,frexp, (double __value, int *__expptr),
+		 (__value, __expptr))
+__inline_forward_c(double,floor, (double __x), (__x))
+__inline_forward_c(double,ceil, (double __x), (__x))
+__inline_forward(double,modf, (double __value, double *__iptr),
+		 (__value, __iptr))
+#ifdef __USE_MISC
+__inline_forward_c(int,isinf, (double __value), (__value))
+__inline_forward_c(int,finite, (double __value), (__value))
+__inline_forward_c(double,scalbn, (double __x, int __n), (__x, __n))
+#endif
+#if defined __USE_MISC || defined __USE_XOPEN
+__inline_forward_c(int,isnan, (double __value), (__value))
+__inline_forward_c(int,ilogb, (double __value), (__value))
+#endif
+
+#ifdef __USE_MISC
+
+__inline_forward(float,frexpf, (float __value, int *__expptr),
+		 (__value, __expptr))
+__inline_forward_c(float,floorf, (float __x), (__x))
+__inline_forward_c(float,ceilf, (float __x), (__x))
+__inline_forward(float,modff, (float __value, float *__iptr),
+		 (__value, __iptr))
+__inline_forward_c(int,isinff, (float __value), (__value))
+__inline_forward_c(int,finitef, (float __value), (__value))
+__inline_forward_c(float,scalbnf, (float __x, int __n), (__x, __n))
+__inline_forward_c(int,isnanf, (float __value), (__value))
+__inline_forward_c(int,ilogbf, (float __value), (__value))
+
+__inline_forward(long double,frexpl, (long double __value, int *__expptr),
+		 (__value, __expptr))
+__inline_forward_c(long double,floorl, (long double __x), (__x))
+__inline_forward_c(long double,ceill, (long double __x), (__x))
+__inline_forward(long double,modfl,
+		 (long double __value, long double *__iptr),
+		 (__value, __iptr))
+__inline_forward_c(int,isinfl, (long double __value), (__value))
+__inline_forward_c(int,finitel, (long double __value), (__value))
+__inline_forward_c(long double,scalbnl, (long double __x, int __n),
+		   (__x, __n))
+__inline_forward_c(int,isnanl, (long double __value), (__value))
+__inline_forward_c(int,ilogbl, (long double __value), (__value))
+
+#endif /* __USE_MISC */
+
+#undef __inline_forward
+#undef __inline_forward_c
+
+#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
+
 #endif	/* GCC.  */
diff --git a/sysdeps/m68k/fpu/e_acos.c b/sysdeps/m68k/fpu/e_acos.c
index 61c374d917..7ea9fb014b 100644
--- a/sysdeps/m68k/fpu/e_acos.c
+++ b/sysdeps/m68k/fpu/e_acos.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library 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.
+   The GNU C Library 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.
 
-The GNU C Library 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.
+   The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 #include "math_private.h"
 
diff --git a/sysdeps/m68k/fpu/e_fmod.c b/sysdeps/m68k/fpu/e_fmod.c
index bf2f7ed1bb..1daa453618 100644
--- a/sysdeps/m68k/fpu/e_fmod.c
+++ b/sysdeps/m68k/fpu/e_fmod.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library 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.
+   The GNU C Library 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.
 
-The GNU C Library 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.
+   The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 #include "math_private.h"
 
diff --git a/sysdeps/m68k/fpu/k_cos.c b/sysdeps/m68k/fpu/k_cos.c
index 6bb9090568..516d45904e 100644
--- a/sysdeps/m68k/fpu/k_cos.c
+++ b/sysdeps/m68k/fpu/k_cos.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library 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.
+   The GNU C Library 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.
 
-The GNU C Library 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.
+   The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 #include "math_private.h"
 
diff --git a/sysdeps/m68k/fpu/k_sin.c b/sysdeps/m68k/fpu/k_sin.c
index f10c7f9801..348bc8fd9d 100644
--- a/sysdeps/m68k/fpu/k_sin.c
+++ b/sysdeps/m68k/fpu/k_sin.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library 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.
+   The GNU C Library 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.
 
-The GNU C Library 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.
+   The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 #include "math_private.h"
 
diff --git a/sysdeps/m68k/fpu/k_tan.c b/sysdeps/m68k/fpu/k_tan.c
index 9c222cd6e1..c38327e571 100644
--- a/sysdeps/m68k/fpu/k_tan.c
+++ b/sysdeps/m68k/fpu/k_tan.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library 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.
+   The GNU C Library 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.
 
-The GNU C Library 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.
+   The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
-#define __NO_M81_MATH_INLINES
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 #include "math_private.h"
 
diff --git a/sysdeps/m68k/fpu/s_atan.c b/sysdeps/m68k/fpu/s_atan.c
index 99b3024326..f3d6960dc1 100644
--- a/sysdeps/m68k/fpu/s_atan.c
+++ b/sysdeps/m68k/fpu/s_atan.c
@@ -1,23 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library 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.
-
-The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 
 #ifndef FUNC
@@ -30,7 +29,8 @@ Cambridge, MA 02139, USA.  */
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 float_type
-DEFUN(__CONCATX(__,FUNC), (x), float_type x)
+__CONCATX(__,FUNC) (x)
+     float_type x;
 {
   return __m81_u(__CONCATX(__,FUNC))(x);
 }
diff --git a/sysdeps/m68k/fpu/s_frexp.c b/sysdeps/m68k/fpu/s_frexp.c
index 8b38086e27..84a9a0b45d 100644
--- a/sysdeps/m68k/fpu/s_frexp.c
+++ b/sysdeps/m68k/fpu/s_frexp.c
@@ -1,23 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library 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.
-
-The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 
 #ifndef FUNC
@@ -30,9 +29,12 @@ Cambridge, MA 02139, USA.  */
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 float_type
-DEFUN(__CONCATX(__,FUNC), (value, expptr), float_type value AND int *expptr)
+__CONCATX(__,FUNC) (value, expptr)
+     float_type value;
+     int *expptr;
 {
   return __m81_u(__CONCATX(__,FUNC))(value, expptr);
 }
+
 #define weak_aliasx(a,b) weak_alias(a,b)
 weak_aliasx (__CONCATX(__,FUNC), FUNC)
diff --git a/sysdeps/m68k/fpu/s_ilogb.c b/sysdeps/m68k/fpu/s_ilogb.c
index 39c871481d..a081a884d4 100644
--- a/sysdeps/m68k/fpu/s_ilogb.c
+++ b/sysdeps/m68k/fpu/s_ilogb.c
@@ -1,23 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library 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.
-
-The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 
 #ifndef FUNC
@@ -30,7 +29,8 @@ Cambridge, MA 02139, USA.  */
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 int
-DEFUN(__CONCATX(__,FUNC), (x), float_type x)
+__CONCATX(__,FUNC) (x)
+     float_type x;
 {
   return __m81_u(__CONCATX(__,FUNC))(x);
 }
diff --git a/sysdeps/m68k/fpu/s_isinf.c b/sysdeps/m68k/fpu/s_isinf.c
index 7d4b1c44a5..fa0d1d56db 100644
--- a/sysdeps/m68k/fpu/s_isinf.c
+++ b/sysdeps/m68k/fpu/s_isinf.c
@@ -1,23 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library 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.
-
-The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 
 #ifndef FUNC
@@ -30,7 +29,8 @@ Cambridge, MA 02139, USA.  */
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 int
-DEFUN(__CONCATX(__,FUNC), (x), float_type x)
+__CONCATX(__,FUNC) (x)
+     float_type x;
 {
   return __m81_u(__CONCATX(__,FUNC))(x);
 }
diff --git a/sysdeps/m68k/fpu/s_modf.c b/sysdeps/m68k/fpu/s_modf.c
index 426d847ebd..6428afc3be 100644
--- a/sysdeps/m68k/fpu/s_modf.c
+++ b/sysdeps/m68k/fpu/s_modf.c
@@ -1,23 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library 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.
-
-The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 
 #ifndef FUNC
@@ -30,9 +29,12 @@ Cambridge, MA 02139, USA.  */
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 float_type
-DEFUN(__CONCATX(__,FUNC), (x, iptr), float_type x AND float_type *iptr)
+__CONCATX(__,FUNC) (x, iptr)
+     float_type x;
+     float_type *iptr;
 {
   return __m81_u(__CONCATX(__,FUNC))(x, iptr);
 }
+
 #define weak_aliasx(a,b) weak_alias(a,b)
 weak_aliasx(__CONCATX(__,FUNC), FUNC)
diff --git a/sysdeps/m68k/fpu/s_scalbn.c b/sysdeps/m68k/fpu/s_scalbn.c
index 6d2b74a3d0..1d43a75de0 100644
--- a/sysdeps/m68k/fpu/s_scalbn.c
+++ b/sysdeps/m68k/fpu/s_scalbn.c
@@ -1,23 +1,22 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library 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.
-
-The GNU C Library 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 the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define __NO_M81_MATH_INLINES
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#define __LIBC_M81_MATH_INLINES
 #include <math.h>
 
 #ifndef FUNC
@@ -30,7 +29,9 @@ Cambridge, MA 02139, USA.  */
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 float_type
-DEFUN(__CONCATX(__,FUNC), (x, exp), float_type x AND int exp)
+__CONCATX(__,FUNC) (x, exp)
+     float_type x;
+     int exp;
 {
   return __m81_u(__CONCATX(__,FUNC))(x, exp);
 }
diff --git a/sysdeps/posix/Makefile b/sysdeps/posix/Makefile
index a0122c7c05..9770dbb358 100644
--- a/sysdeps/posix/Makefile
+++ b/sysdeps/posix/Makefile
@@ -21,15 +21,12 @@ $(common-objpfx)stdio_lim.h: $(common-objpfx)mk-stdiolim
 	mv $@-t $@
 
 # Turn into a version that works when cd'd into $(objdir).
-cded-objdir-includes = $(patsubst -I$$cwd//%,-I/%,\
-				  $(patsubst -I%,-I$$cwd/%,$(+includes)))
-# $(BUILD_CFLAGS) needs to come last because it contains unwanted -Is.
+mk-stdiolim-CFLAGS = $(patsubst -I$(shell pwd)//%,-I/%,\
+				$(patsubst -I%,-I$(shell pwd)/%,$(+includes)))
+# $(ALL_BUILD_CFLAGS) needs to come last because it contains unwanted -Is.
 $(common-objpfx)mk-stdiolim: $(sysdep_dir)/posix/mk-stdiolim.c \
 			     $(..)posix/posix1_lim.h local_lim.h
-	cwd=`pwd`; cd $(objpfx).; \
-	$(BUILD_CC) $(cded-objdir-includes) $(BUILD_CFLAGS) \
-	  $$cwd/$< -o $(patsubst $(common-objpfx)%,$(..)%,$@)
-
+	$(common-objdir-compile)
 
 common-generated := $(common-generated) stdio_lim.h mk-stdiolim
 before-compile := $(before-compile) $(common-objpfx)stdio_lim.h
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index 3cef7e735b..c9c5ed8fdc 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -23,20 +23,20 @@ ifeq (,$(filter-out $(sysdep_dir)/stub/ $(common-objpfx),\
 	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/local_lim.h))))))
 
 ifneq (,$(wildcard $(sysincludedir)/sys/param.h))
-local_lim-CFLAGS := $(local_lim-CFLAGS) -DHAVE_SYS_PARAM_H
+mk-local_lim-CFLAGS += -DHAVE_SYS_PARAM_H
 endif
 ifneq (,$(wildcard $(sysincludedir)/sys/limits.h))
-local_lim-CFLAGS := $(local_lim-CFLAGS) -DHAVE_SYS_LIMITS_H
+mk-local_lim-CFLAGS += -DHAVE_SYS_LIMITS_H
 endif
 ifneq (,$(wildcard $(sysincludedir)/limits.h))
-local_lim-CFLAGS := $(local_lim-CFLAGS) -DHAVE_LIMITS_H
+mk-local_lim-CFLAGS += -DHAVE_LIMITS_H
 endif
 
 $(common-objpfx)local_lim.h: $(common-objpfx)mk-local_lim
-	if $(dir $<)$(notdir $<) > $@-t; then mv $@-t $@; else XXX; fi
+	$(dir $<)$(notdir $<) > $@-t
+	mv -f $@-t $@
 $(common-objpfx)mk-local_lim: $(sysdep_dir)/unix/mk-local_lim.c
-	cwd=`pwd`; cd $(@D); \
-	$(BUILD_CC) $(BUILD_CFLAGS) $(local_lim-CFLAGS) $$cwd/$< -o $(@F)
+	$(common-objdir-compile)
 
 before-compile := $(before-compile) $(common-objpfx)local_lim.h
 common-generated := $(common-generated) local_lim.h mk-local_lim
@@ -50,7 +50,7 @@ ifeq (,$(filter-out $(sysdep_dir)/stub/ $(common-objpfx),\
 before-compile := $(before-compile) $(common-objpfx)sys/param.h
 
 $(common-objpfx)sys/param.h: $(sysincludedir)/sys/param.h
-	-mkdir $(@D:%/=%)
+	$(make-target-directory)
 	(echo '#ifndef _GNU_SYS_PARAM_H';	\
 	 echo '#define _GNU_SYS_PARAM_H 1';	\
 	 echo '#include <endian.h>';		\
@@ -73,16 +73,17 @@ $(common-objpfx)param.h.c: $(sysincludedir)/sys/param.h
 $(common-objpfx)param.h.dep: $(common-objpfx)param.h.c \
 			     $(sysdep_dir)/unix/Makefile
 	$(+mkdep) -I$(sysincludedir) $<		\
-	| sed > $@				\
+	| sed > $@-t				\
 	      -e 's@^.*:@@'			\
 	      -e 's@$<@@g'			\
 	      -e 's@$(sysincludedir)/*@@g'	\
 	      -e 's@\\$$@@'			\
 	      -e 's@^@sys/param.h-includes := $$(sys/param.h-includes) @'
+	mv $@-t $@
 
 # Get the generated definition of sys/param.h-includes.
 ifndef no_deps
-include $(common-objpfx)param.h.dep
+-include $(common-objpfx)param.h.dep
 endif
 
 # Don't preempt our own headers.
@@ -100,7 +101,7 @@ ifdef sys/param.h-includes
 # Copy the system files to $(common-objdir).
 $(addprefix $(common-objpfx),$(sys/param.h-includes)): $(common-objpfx)%: \
 						       $(sysincludedir)/%
-	-mkdir $(@D:%/=%)
+	$(make-target-directory)
 # Some of these files sometimes contain conflicting declarations for htons,
 # ntohs, etc.  They also often contain definitions of *_ENDIAN and
 # BYTE_ORDER, which we define ourselves in <endian.h>.
@@ -146,7 +147,8 @@ $(common-objpfx)make-errnos.c: $(sysdep_dir)/unix/errnos-tmpl.c \
 
 $(common-objpfx)errnos: $(wildcard $(sysincludedir)/errno.h	\
 				   $(sysincludedir)/sys/errno.h)
-	cat $^ | sed -n 's/^#define[ 	]*\(E[A-Z0-9][A-Z0-9]*\)[ 	].*$$/\1/p' > $@-tmp
+	sed -n 's/^#define[ 	]*\(E[A-Z0-9][A-Z0-9]*\)[ 	].*$$/\1/p' \
+	    $^ > $@-tmp
 	mv $@-tmp $@
 
 common-generated := $(common-generated) \
@@ -169,8 +171,7 @@ make-ioctls-CFLAGS := $(subst /,_,$(subst .,_,\
 				   $(ioctl-includes))))
 
 $(common-objpfx)make-ioctls: $(common-objpfx)make-ioctls.c
-	cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) $(make-ioctls-CFLAGS) \
-			$(<:$(common-objpfx)%=%) -o $(@F)
+	$(common-objdir-compile)
 
 $(common-objpfx)make-ioctls.c: $(sysdep_dir)/unix/ioctls-tmpl.c \
 			       $(sysdep_dir)/unix/ioctls.awk \
@@ -247,7 +248,7 @@ ifdef syscall.h
 
 # Transmogrify any of several formats of the file into the one we want.
 $(common-objpfx)sys/syscall.h: $(syscall.h)
-	-mkdir $(common-objpfx)sys
+	$(make-target-directory)
 	tr '[A-Z]' '[a-z]' < $< | \
 	sed -e 's/[ 	]sys_/ /' \
 	    -e 's/^#define[ 	]*\([a-z0-9_]*\)[ 	]*/#define SYS_\1 /' \
diff --git a/sysdeps/unix/sysv/linux/alpha/brk.S b/sysdeps/unix/sysv/linux/alpha/brk.S
index 3d9f6dca5f..f44686b9a4 100644
--- a/sysdeps/unix/sysv/linux/alpha/brk.S
+++ b/sysdeps/unix/sysv/linux/alpha/brk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe <brendan@zen.org>, 1993.
 
@@ -50,20 +50,23 @@ LEAF(__brk, 0)
 	ldiq	v0, __NR_brk
 	call_pal PAL_callsys
 
+	/* Be prepared for an OSF-style brk.  */
+	bne	a3, $err1
+	beq	v0, $ok
+
 	/* Correctly handle the brk(0) query case.  */
 	cmoveq	a0, v0, a0
-
-	subq	a0, v0, t0
-	bne	t0, error
+	xor	a0, v0, t0
+	bne	t0, $err0
 
 	/* Update __curbrk and return cleanly.  */
-	stq	a0, __curbrk
 	mov	zero, v0
+$ok:	stq	a0, __curbrk
 	ret
 
 	/* What a horrible way to die.  */
-error:	ldi	v0, ENOMEM
-	jmp	zero, __syscall_error
+$err0:	ldi	v0, ENOMEM
+$err1:	jmp	zero, __syscall_error
 
 	END(__brk)
 
diff --git a/sysdeps/unix/sysv/linux/netinet/in_systm.h b/sysdeps/unix/sysv/linux/netinet/in_systm.h
index f481c5511a..902fe6ea0e 100644
--- a/sysdeps/unix/sysv/linux/netinet/in_systm.h
+++ b/sysdeps/unix/sysv/linux/netinet/in_systm.h
@@ -1 +1,41 @@
-#include <linux/in_systm.h>
+/* System specific type definitions for networking code.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#ifndef _NETINET_IN_SYSTM_H
+#define _NETINET_IN_SYSTM_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+/*
+ * Network order versions of various data types. Unfortunately, BSD
+ * assumes specific sizes for shorts (16 bit) and longs (32 bit) which
+ * don't hold in general. As a consequence, the network order versions
+ * may not reflect the actual size of the native data types.
+ */
+
+typedef u_int16_t n_short;      /* short as received from the net */
+typedef u_int32_t n_long;       /* long as received from the net  */
+typedef u_int32_t n_time;       /* ms since 00:00 GMT, byte rev   */
+
+__END_DECLS
+
+#endif /* netinet/in_systm.h */
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index 198819970a..337b85005f 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -1 +1,53 @@
+/* Poll system call, with emulation if it is not available.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 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.  */
+
+#include <errno.h>
+#include <sys/poll.h>
+
+extern int __syscall_poll __P ((struct pollfd *fds, unsigned int nfds,
+				int timeout));
+extern int __emulate_poll __P ((struct pollfd *fds, unsigned long int nfds,
+				int timeout));
+
+/* The real implementation.  */
+int
+poll (fds, nfds, timeout)
+     struct pollfd *fds;
+     unsigned long int nfds;
+     int timeout;
+{
+  static int must_emulate = 0;
+
+  if (!must_emulate)
+    {
+      int retval = __syscall_poll (fds, nfds, timeout);
+
+      if (retval >= 0 || errno != ENOSYS)
+	return retval;
+
+      must_emulate = 1;
+    }
+
+  return __emulate_poll (fds, nfds, timeout);
+}
+
+
+/* Get the emulation code.  */
+#define poll(fds, nfds, timeout) __emulate_poll (fds, nfds, timeout)
 #include <sysdeps/unix/bsd/poll.c>
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 20ac94ae26..867e3bce3e 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -30,6 +30,7 @@ nanosleep	-	nanosleep	2	__libc_nanosleep	__nanosleep nanosleep
 pause		-	pause		0	__libc_pause	pause
 personality	init-first personality	1	__personality	personality
 pipe		-	pipe		1	__pipe		pipe
+s_poll		EXTRA	poll		3	__syscall_poll
 query_module	EXTRA	query_module	5	query_module
 s_getdents	EXTRA	getdents	3	__getdents
 s_getpriority	getpriority getpriority	2	__syscall_getpriority
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/Makefile b/sysdeps/unix/sysv/sysv4/solaris2/Makefile
index 3f86c46cc8..3ad90f748a 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/Makefile
+++ b/sysdeps/unix/sysv/sysv4/solaris2/Makefile
@@ -3,4 +3,4 @@
 # along the way (e.g., glue-ctype) will fail because it'll try to link
 # with the libc.a being *constructed* in $(objdir).  As a work-around,
 # we add this to each native-compile.
-BUILD_CFLAGS := $(BUILD_CFLAGS) -L/lib
+ALL_BUILD_CFLAGS += -L/lib
diff --git a/sysvipc/sys/ipc.h b/sysvipc/sys/ipc.h
index ea8f3f2132..4386d676d4 100644
--- a/sysvipc/sys/ipc.h
+++ b/sysvipc/sys/ipc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -25,6 +25,10 @@
 /* Get system dependent definition of `struct ipc_perm' and more.  */
 #include <sys/ipc_buf.h>
 
+#if !defined __USE_SVID && !defined __USE_XOPEN && __GNUC__ >= 2
+# warning "Files using this header must be compiled with _SVID_SOURCE or _XOPEN_SOURCE"
+#endif
+
 __BEGIN_DECLS
 
 /* Generates key for System V style IPC.  */
diff --git a/time/Makefile b/time/Makefile
index 0798e0838e..044f15486d 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -106,11 +106,11 @@ $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
 	 echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))'		    ;\
 	 echo 'ifdef $*-zones'						    ;\
 	 if test x$(findstring $*, $(tzlinks)) != x; then		     \
-	   echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)) \';\
-	   echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)) \';\
+	   echo '$$(addprefix $$(inst_zonedir)/right/,$$($*-zones)): \';\
+	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones)))' ;\
+	   echo '$$(addprefix $$(inst_zonedir)/posix/,$$($*-zones)): \';\
+	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones)))' ;\
 	   echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \'	    ;\
-	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/right/,$$($$t-zones))) \' ;\
-	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/posix/,$$($$t-zones))) \' ;\
 	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\
 	 fi								    ;\
 	 echo '$$(addprefix $$(inst_datadir)/zone%/right/,$$($*-zones)): \' ;\
diff --git a/time/leapseconds b/time/leapseconds
index c48e495344..6ff99ada37 100644
--- a/time/leapseconds
+++ b/time/leapseconds
@@ -1,4 +1,4 @@
-# @(#)leapseconds	7.8
+# @(#)leapseconds	7.9
 
 # Allowance for leapseconds added to each timezone file.
 
@@ -40,3 +40,4 @@ Leap	1992	Jun	30	23:59:60	+	S
 Leap	1993	Jun	30	23:59:60	+	S
 Leap	1994	Jun	30	23:59:60	+	S
 Leap	1995	Dec	31	23:59:60	+	S
+Leap	1997	Jun	30	23:59:60	+	S
diff --git a/time/zic.c b/time/zic.c
index 2e07d79196..c4c9a3ae25 100644
--- a/time/zic.c
+++ b/time/zic.c
@@ -1,6 +1,6 @@
 #ifndef lint
 #ifndef NOID
-static char	elsieid[] = "@(#)zic.c	7.81";
+static char	elsieid[] = "@(#)zic.c	7.82";
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
@@ -2126,17 +2126,17 @@ char * const	argname;
 		if (!itsdir(name)) {
 			/*
 			** It doesn't seem to exist, so we try to create it.
-			** Double check the return. Someone may be one
-			** step ahead of us.
+			** Creation may fail because of the directory being
+			** created by some other multiprocessor, so we get
+			** to do extra checking.
 			*/
 			if (mkdir(name, 0755) != 0) {
-			  	int save_error = errno;
-				if (errno == EEXIST && !itsdir(name)) {
-					const char *e = strerror(save_error);
+				const char *e = strerror(errno);
 
+				if (errno != EEXIST || !itsdir(name)) {
 					(void) fprintf(stderr,
-				      _("%s: Can't create directory %s: %s\n"),
-						       progname, name, e);
+_("%s: Can't create directory %s: %s\n"),
+						progname, name, e);
 					ifree(name);
 					return -1;
 				}