about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2006-02-28 07:11:04 +0000
committerRoland McGrath <roland@gnu.org>2006-02-28 07:11:04 +0000
commite0a3ed4ff95ec2e422c1211b35ddf7bf6fbc0a5a (patch)
tree9ee2ada7a666b14f1e47aa183012ddf59de3fb73
parent0f284e58375992e42d7e9b3f1ea14963cfa4462b (diff)
downloadglibc-e0a3ed4ff95ec2e422c1211b35ddf7bf6fbc0a5a.tar.gz
glibc-e0a3ed4ff95ec2e422c1211b35ddf7bf6fbc0a5a.tar.xz
glibc-e0a3ed4ff95ec2e422c1211b35ddf7bf6fbc0a5a.zip
* Makefile (subdir-target-args): New variable.
	($(all-subdirs-targets)): Use it in place of -C option.
	* Rules: Use $(..) instead of ../ if it's already defined.
	* Makeconfig (subdir-srcdirs): New variable.
	* csu/Makefile (all-Banner-files): Use it.

	* configure.in (--enable-add-ons): Set to "yes" by default.
	Handle absolute add-on directory names when looking for configure
	fragments.  Also look for sysdeps/*/preconfigure fragments in add-ons.
	Require add-on configure to set $libc_add_on_canonical, use
	that in $add_ons_sfx.  Substitute add_on_subdirs with computed list
	of subdir names each add-on configure set in libc_add_on_subdirs.
	* configure: Regenerated.
	* Makefile (%/preconfigure: %/preconfigure.in): New pattern rule.
	* config.make.in (add-on-subdirs): New substituted variable.
	* Makeconfig (all-subdirs): Include $(add-on-subdirs).
	Remove $(add-ons), $(sysdep-subdirs).
	Don't filter out $(sysdep-inhibit-subdirs).
	($(common-objpfx)sysd-dirs): Target removed.  Don't include it.
	($(common-objpfx)sysd-sorted): Rewritten to feed Depend and Subdirs
	files together to gen-sorted.awk, and $(subdirs) via -v.
	(subdirs): Remove magic reordering for mach and hurd.
	* scripts/gen-sorted.awk: Use subdirs from command line.
	Process Subdirs and Depend files directly.
	Let Subdirs files use "first dir" and "inhibit dir".
	Always move elf to the end of the list.
	* hurd/Depend: New file.
	* sysdeps/mach/Subdirs: Use "first mach".

	* Makefile (dist-separate): Remove linuxthreads.
	(dist-separate-linuxthreads): Variable removed.
	(glibc-%.tar rule): Use $(sysdeps-add-ons).

	* Makerules ($(common-objpfx)Versions.v.i): Use $(subdirs),
	not $(all-subdirs).
	(sysdep-makefiles): Use $(sysdirs).
	(sysdirs): Remove export.
	($(+sysdir_pfx)sysd-rules): Handle absolute directory names in
	$(config-sysdirs).
	(+sysdir_pfx): Variable removed.
	(sysd-rules): Use $(common-objpfx) in place of it.
	(sysdirs): Variable moved to ...
	* Makeconfig (sysdirs): ... here.
	Handle absolute directory names in $(config-sysdirs).
	(full_config_sysdirs): Variable removed.
	* csu/Makefile: Use $(sysdirs) in vpath directive.
	* math/Makefile (ulps-file): Use $(sysdirs).
	* sysdeps/gnu/Makefile (errlist-c): Likewise.
	($(objpfx)errlist-compat.c): Likewise.
	* Makeconfig (all-Subdirs-files): Likewise.
	($(common-objpfx)config.status): Likewise.

	* configure.in (sysnames): Handle absolute add-on directory names.
	(sysdeps_add_ons): New variable, AC_SUBST it.
	Compute which add-ons contributed sysdeps directories.
	* configure: Regenerated.
	* config.make.in (sysdeps-add-ons): New substituted variable.
	* Makerules (+sysdep_dirs, +sysdep-includes): Variables moved ...
	* Makeconfig: ... to here.
	(+sysdep_dirs): Append $(sysdeps-add-ons) here.
	(+includes): Remove $(objpfx) include, already in $(+sysdep_dirs).
	Remove $(includes).
	(sysdep-makeconfigs): Use $(+sysdep_dirs).
	($(common-objpfx)shlib-versions.v.i): Likewise.

	* Makeconfig: Remove hair to set Makeconfig-add-on.

	* sysdeps/unix/Makefile (sysdirs): Remove export.
	(asm_CPP): Variable removed.
	($(common-objpfx)sysd-syscalls): Pass them directly for the script.

	* sysdeps/posix/Makefile: New file.
	* Makerules (L_tmpnam, TMP_MAX, L_ctermid, L_cuserid): Set non-posix
	values here with ?=.

	* stdlib/gen-mpn-copy: File removed.
	* stdlib/Makefile (distribute): Remove it.
	* configure.in: Don't grok --with-gmp.
	* configure: Regenerated.

	* configure.in (libc_cv_idn): Don't check it; libidn/configure does it.
	* configure: Regenerated.

	* bare: Directory removed, saved in ports repository.
-rw-r--r--ChangeLog87
-rw-r--r--Makeconfig121
-rw-r--r--Makefile14
-rw-r--r--Makerules56
-rw-r--r--Rules4
-rw-r--r--config.make.in2
-rwxr-xr-xconfigure232
-rw-r--r--configure.in207
-rw-r--r--csu/Makefile7
-rw-r--r--hurd/Depend9
-rw-r--r--libidn/Makefile6
-rw-r--r--libidn/configure3
-rw-r--r--libidn/configure.in3
-rw-r--r--math/Makefile2
-rw-r--r--nptl/ChangeLog30
-rw-r--r--nptl/Makeconfig6
-rw-r--r--nptl/Makefile2
-rw-r--r--nptl/configure9
-rw-r--r--nptl/sysdeps/pthread/Makefile4
-rw-r--r--nptl/sysdeps/pthread/Subdirs1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/alpha/clone.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/clone.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/vfork.S19
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/clone2.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S12
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S12
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/s390-32/clone.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/s390-64/clone.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/clone.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/sh4/lowlevellock.h2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sleep.c12
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/clone.S11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S16
-rwxr-xr-xscripts/gen-sorted.awk113
-rw-r--r--stdlib/Makefile3
-rw-r--r--stdlib/gen-mpn-copy35
-rw-r--r--sysdeps/gnu/Makefile11
-rw-r--r--sysdeps/mach/Subdirs10
-rw-r--r--sysdeps/unix/Makefile7
41 files changed, 795 insertions, 361 deletions
diff --git a/ChangeLog b/ChangeLog
index dfdfbb7586..0bf0b80578 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,88 @@
+2006-02-27  Roland McGrath  <roland@redhat.com>
+
+	* Makefile (subdir-target-args): New variable.
+	($(all-subdirs-targets)): Use it in place of -C option.
+	* Rules: Use $(..) instead of ../ if it's already defined.
+	* Makeconfig (subdir-srcdirs): New variable.
+	* csu/Makefile (all-Banner-files): Use it.
+
+	* configure.in (--enable-add-ons): Set to "yes" by default.
+	Handle absolute add-on directory names when looking for configure
+	fragments.  Also look for sysdeps/*/preconfigure fragments in add-ons.
+	Require add-on configure to set $libc_add_on_canonical, use
+	that in $add_ons_sfx.  Substitute add_on_subdirs with computed list
+	of subdir names each add-on configure set in libc_add_on_subdirs.
+	* configure: Regenerated.
+	* Makefile (%/preconfigure: %/preconfigure.in): New pattern rule.
+	* config.make.in (add-on-subdirs): New substituted variable.
+	* Makeconfig (all-subdirs): Include $(add-on-subdirs).
+	Remove $(add-ons), $(sysdep-subdirs).
+	Don't filter out $(sysdep-inhibit-subdirs).
+	($(common-objpfx)sysd-dirs): Target removed.  Don't include it.
+	($(common-objpfx)sysd-sorted): Rewritten to feed Depend and Subdirs
+	files together to gen-sorted.awk, and $(subdirs) via -v.
+	(subdirs): Remove magic reordering for mach and hurd.
+	* scripts/gen-sorted.awk: Use subdirs from command line.
+	Process Subdirs and Depend files directly.
+	Let Subdirs files use "first dir" and "inhibit dir".
+	Always move elf to the end of the list.
+	* hurd/Depend: New file.
+	* sysdeps/mach/Subdirs: Use "first mach".
+
+	* Makefile (dist-separate): Remove linuxthreads.
+	(dist-separate-linuxthreads): Variable removed.
+	(glibc-%.tar rule): Use $(sysdeps-add-ons).
+
+	* Makerules ($(common-objpfx)Versions.v.i): Use $(subdirs),
+	not $(all-subdirs).
+	(sysdep-makefiles): Use $(sysdirs).
+	(sysdirs): Remove export.
+	($(+sysdir_pfx)sysd-rules): Handle absolute directory names in
+	$(config-sysdirs).
+	(+sysdir_pfx): Variable removed.
+	(sysd-rules): Use $(common-objpfx) in place of it.
+	(sysdirs): Variable moved to ...
+	* Makeconfig (sysdirs): ... here.
+	Handle absolute directory names in $(config-sysdirs).
+	(full_config_sysdirs): Variable removed.
+	* csu/Makefile: Use $(sysdirs) in vpath directive.
+	* math/Makefile (ulps-file): Use $(sysdirs).
+	* sysdeps/gnu/Makefile (errlist-c): Likewise.
+	($(objpfx)errlist-compat.c): Likewise.
+	* Makeconfig (all-Subdirs-files): Likewise.
+	($(common-objpfx)config.status): Likewise.
+
+	* configure.in (sysnames): Handle absolute add-on directory names.
+	(sysdeps_add_ons): New variable, AC_SUBST it.
+	Compute which add-ons contributed sysdeps directories.
+	* configure: Regenerated.
+	* config.make.in (sysdeps-add-ons): New substituted variable.
+	* Makerules (+sysdep_dirs, +sysdep-includes): Variables moved ...
+	* Makeconfig: ... to here.
+	(+sysdep_dirs): Append $(sysdeps-add-ons) here.
+	(+includes): Remove $(objpfx) include, already in $(+sysdep_dirs).
+	Remove $(includes).
+	(sysdep-makeconfigs): Use $(+sysdep_dirs).
+	($(common-objpfx)shlib-versions.v.i): Likewise.
+
+	* Makeconfig: Remove hair to set Makeconfig-add-on.
+
+	* sysdeps/unix/Makefile (sysdirs): Remove export.
+	(asm_CPP): Variable removed.
+	($(common-objpfx)sysd-syscalls): Pass them directly for the script.
+
+	* sysdeps/posix/Makefile: New file.
+	* Makerules (L_tmpnam, TMP_MAX, L_ctermid, L_cuserid): Set non-posix
+	values here with ?=.
+
+	* stdlib/gen-mpn-copy: File removed.
+	* stdlib/Makefile (distribute): Remove it.
+	* configure.in: Don't grok --with-gmp.
+	* configure: Regenerated.
+
+	* configure.in (libc_cv_idn): Don't check it; libidn/configure does it.
+	* configure: Regenerated.
+
 2006-02-27  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/linkat.c (linkat): Allow flags to be set
@@ -6,6 +91,8 @@
 
 2006-02-26  Roland McGrath  <roland@redhat.com>
 
+	* bare: Directory removed, saved in ports repository.
+
 	* sysdeps/unix/common/Makefile: File removed.
 	* sysdeps/unix/common/glue-ctype.c: File removed.
 	* sysdeps/unix/common/configure.in: File removed.
diff --git a/Makeconfig b/Makeconfig
index 64ab926666..a0638f8343 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -99,7 +99,20 @@ binfmt-subdir = aout
 endif
 
 # Complete path to sysdep dirs.
-export full_config_sysdirs := $(addprefix $(..),$(config-sysdirs))
+# `configure' writes a definition of `config-sysdirs' in `config.make'.
+sysdirs := $(foreach D,$(config-sysdirs),$(firstword $(filter /%,$D) $(..)$D))
+
+# Add-ons that contribute sysdeps trees get added to the include list
+# after sysdeps/generic.  This makes #include <sysdeps/...> work right
+# to find specific add-on files without assuming the add-on directory name.
+# It also means that headers can go into an add-on's base directory
+# instead of the add-on needing a sysdeps/generic of its own.
++sysdep_dirs := $(sysdirs) $(foreach add-on,$(sysdeps-add-ons),\
+				     $(firstword $(filter /%,$(add-on)) \
+						 $(..)$(add-on)))
+ifdef objdir
++sysdep_dirs := $(objdir) $(+sysdep_dirs)
+endif
 
 # Run config.status to update config.make and config.h.  We don't show the
 # dependence of config.h to Make, because it is only touched when it
@@ -113,16 +126,16 @@ $(common-objpfx)config.make: $(common-objpfx)config.status \
 # Find all the add-on and sysdeps configure fragments, to make sure we
 # re-run configure when any of them changes.
 $(common-objpfx)config.status: $(..)version.h $(..)configure \
-			       $(foreach dir,$(full_config_sysdirs),\
-					 $(wildcard \
-					   $(dir)/Implies) \
+			       $(foreach dir,$(sysdirs),\
+					 $(wildcard $(dir)/Implies) \
 					 $(patsubst %.in,%,\
 						    $(firstword $(wildcard \
  $(addprefix $(dir)/,configure configure.in))))) \
 			       $(patsubst %.in,%,\
-					  $(foreach dir,$(add-ons),\
+					  $(foreach add-on,$(add-ons),\
 						    $(firstword $(wildcard \
- $(addprefix $(..)$(dir)/,configure configure.in)))))
+ $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\
+	     configure configure.in)))))
 	@cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
 	 echo The GNU C library has not been configured. >&2; \
 	 echo Run \`configure\' to configure it before building. >&2; \
@@ -632,11 +645,10 @@ endif	# $(+cflags) == ""
 # include files (including ones given in angle brackets) in the parent
 # library source directory, in the include directory, and in the
 # current directory.
-# `+sysdep-includes' will be defined by Makerules.
-+includes = -I$(..)include \
-	    $(patsubst %/,-I%,$(objpfx)) $(+sysdep-includes) \
-	    $(patsubst %/,-I%,$(..)) $(libio-include) $(includes) -I. \
-	    $(sysincludes)
++sysdep-includes = $(addprefix -I,$(+sysdep_dirs))
++includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \
+	    $(+sysdep-includes) \
+	    $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
 
 # Since libio has several internal header files, we use a -I instead
 # of many little headers in the include directory.
@@ -753,12 +765,10 @@ endif
 
 move-if-change = $(SHELL) $(..)scripts/move-if-change
 
--include $(common-objpfx)sysd-dirs
-
-ifeq ($(sysd-dirs-done),t)
 -include $(common-objpfx)sysd-sorted
 subdirs = $(sorted-subdirs)
-endif
+subdir-srcdirs = $(foreach dir,$(subdirs),\
+			   $(firstword $($(dir)-srcdir) $(..)$(dir)))
 
 ifeq (yes, $(build-shared))
 
@@ -789,9 +799,8 @@ ifndef avoid-generated
 # This lets add-ons give more-specific matches that override defaults
 # in the top-level file.
 $(common-objpfx)shlib-versions.v.i: \
-	$(wildcard $(patsubst %, $(..)%/shlib-versions,$(add-ons) \
-						       $(config-sysdirs) \
-						       $(subdirs))) \
+	$(wildcard $(+sysdep_dirs:=/shlib-versions) \
+		   $(subdir-srcdirs:=/shlib-versions)) \
 	$(..)shlib-versions
 
 soversions-default-setname = $(patsubst %, %,\
@@ -891,81 +900,39 @@ endif
 
 # These are the subdirectories containing the library source.  The order
 # is more or less arbitrary.  The sorting step will take care of the
-# dependencies.  Only the $(binfmt-subdir) should always be kept at the
-# end of the list.
+# dependencies.
 all-subdirs = csu assert ctype locale intl catgets math setjmp signal	    \
-	      stdlib stdio-common libio malloc string wcsmbs time dirent \
+	      stdlib stdio-common libio malloc string wcsmbs time dirent    \
 	      grp pwd posix io termios resource misc socket sysvipc gmon    \
 	      gnulib iconv iconvdata wctype manual shadow po argp	    \
-	      crypt $(add-ons) nss localedata timezone rt conform debug	    \
-	      $(sysdep-subdirs) $(dlfcn) $(binfmt-subdir)
-all-subdirs := $(filter-out $(sysdep-inhibit-subdirs),$(all-subdirs))
-
-# The mach and hurd subdirectories have many generated header files which
-# much of the rest of the library depends on, so it is best to build them
-# first (and mach before hurd, at that).  The before-compile additions in
-# sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
-# not to exist when making in other directories, but it will be slower that
-# way with more somewhat expensive `make' invocations.
-subdirs	:= $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
-	   $(filter-out mach hurd,$(subdirs))
+	      crypt nss localedata timezone rt conform debug		    \
+	      $(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
 
 ifndef avoid-generated
-all-Subdirs-files = $(wildcard $(config-sysdirs:%=$(..)%/Subdirs))
-$(common-objpfx)sysd-dirs: $(common-objpfx)config.make $(all-Subdirs-files)
-	$(AWK) 'BEGIN { subdirs = ""; inhibit = "" };			\
-		/^#/ { next };						\
-		/^[^-]/ { subdirs = subdirs " " $$0 };			\
-		/^-/ { inhibit = inhibit " " substr($$0, 2) };		\
-		END { printf "sysdep-subdirs =%s\n", subdirs;		\
-		      printf "sysdep-inhibit-subdirs =%s\n", inhibit;	\
-		      print "sysd-dirs-done = t" }'			\
-	       $(patsubst $<,/dev/null,$^) > $@-tmp
-	mv -f $@-tmp $@
-
-all-Depend-files = $(wildcard $(..)*/Depend)
-$(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk $(all-Depend-files) \
-			     $(common-objpfx)sysd-dirs $(..)Makeconfig
-	{ { dirs='$(patsubst $(..)%/Depend,%,$(filter %/Depend,$^))';	  \
-	    for d in $$dirs; do						  \
-	      while read on; do						  \
-		echo "depend $$d $$on";					  \
-	      done < $(..)$$d/Depend;					  \
-	    done;							  \
-	    for f in $(all-subdirs); do					  \
-	      echo $$f;							  \
-	    done;							  \
-	  } | $(AWK) -f $< &&						  \
-	  echo sysd-sorted-done = t;					  \
-	} > $@-tmp
+all-Depend-files := $(wildcard $(foreach dir,$(all-subdirs),\
+					 $(firstword $($(dir)-srcdir) \
+						     $(..)$(dir))/Depend))
+$(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \
+			     $(common-objpfx)config.make $(..)Makeconfig \
+			     $(wildcard $(sysdirs:=/Subdirs)) \
+			     $(all-Depend-files)
+	$(AWK) -f $< \
+	       -v subdirs='$(all-subdirs)' \
+	       -v srcpfx='$(..)' \
+	       $(filter %/Subdirs %/Depend,$^) > $@-tmp
 	mv -f $@-tmp $@
 $(all-Depend-files): ;
 endif
 
 # Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
-sysdep-makeconfigs := $(wildcard $(patsubst %,$(..)%/Makeconfig,\
-					    $(config-sysdirs) $(add-ons)))
-
+sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig))
 ifneq (,$(sysdep-makeconfigs))
-Makeconfig-doing-sysdep := $(sysdep-makeconfigs)
-# Before each one, include ourselves again to do the bit below that
-# will set `Makeconfig-add-on' in an add-on's Makeconfig fragment.
-include $(foreach M,$(sysdep-makeconfigs),$(..)Makeconfig $M)
+include $(sysdep-makeconfigs)
 endif
 
 
 endif # Makeconfig not yet included
 
-# The whole body above didn't run when we are included as a subroutine
-# of ourselves in the sysdep-makeconfigs include line.  This bit runs.
-ifneq (,$(Makeconfig-doing-sysdep))
-sysdep-Makeconfig := $(firstword $(Makeconfig-doing-sysdep))
-Makeconfig-doing-sysdep := $(filter-out $(sysdep-Makeconfig),\
-					$(Makeconfig-doing-sysdep))
-Makeconfig-add-on := $(filter $(add-ons),$(patsubst $(..)%/Makeconfig,%,\
-						    $(sysdep-Makeconfig)))
-endif
-
 # Local Variables:
 # mode: makefile
 # End:
diff --git a/Makefile b/Makefile
index 8a7fbf307f..8db0ff51f4 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,7 @@ endef
 
 configure: configure.in aclocal.m4; $(autoconf-it)
 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
+%/preconfigure: %/preconfigure.in aclocal.m4; $(autoconf-it)
 
 endif # $(AUTOCONF) = no
 
@@ -202,7 +203,13 @@ all-subdirs-targets := $(foreach dir,$(subdirs),\
 # The action for each of those is to cd into the directory and make the
 # target there.
 $(all-subdirs-targets):
-	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
+	$(MAKE) $(PARALLELMFLAGS) $(subdir-target-args) $(@F)
+
+define subdir-target-args
+subdir=$(@D)$(if $($(@D)-srcdir),\
+-C $($(@D)-srcdir) ..=`pwd`/,\
+-C $(@D) ..=../)
+endef
 
 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
 
@@ -353,17 +360,16 @@ files-for-dist := README FAQ INSTALL NOTES configure
 tag-of-stem = glibc-$(subst .,_,$*)
 
 # Add-ons in the main repository but distributed in their own tar files.
-dist-separate = libidn linuxthreads
+dist-separate = libidn
 
 # Directories in each add-on.
 dist-separate-libidn = libidn
-dist-separate-linuxthreads = linuxthreads linuxthreads_db
 
 glibc-%.tar $(dist-separate:%=glibc-%-%.tar): $(files-for-dist) \
 					      $(foreach D,$(dist-separate),\
 							$D/configure)
 	@rm -fr glibc-$*
-	$(MAKE) -q `find sysdeps $(addsuffix /sysdeps,$(add-ons)) \
+	$(MAKE) -q `find sysdeps $(addsuffix /sysdeps,$(sysdeps-add-ons)) \
 			 -name configure`
 	cvs $(CVSOPTS) -Q export -d glibc-$* -r $(tag-of-stem) libc
 # Touch all the configure scripts going into the tarball since cvs export
diff --git a/Makerules b/Makerules
index a96a03eee4..13d9248479 100644
--- a/Makerules
+++ b/Makerules
@@ -56,22 +56,6 @@ ifndef +included-Makeconfig
 include $(..)Makeconfig
 endif
 
-# `configure' writes a definition of `config-sysdirs' in `config.make'.
-sysdirs = $(strip $(full_config_sysdirs))
-
-+sysdir_pfx = $(common-objpfx)
-
-export sysdirs := $(sysdirs)
-
-+sysdep_dirs := $(full_config_sysdirs)
-ifdef objdir
-+sysdep_dirs := $(objdir) $(+sysdep_dirs)
-endif
-
-# Add -I switches to get the right sysdep directories.
-# `+includes' in Makeconfig references $(+sysdep-includes).
-+sysdep-includes := $(addprefix -I,$(+sysdep_dirs))
-
 # This variable is used in ``include $(o-iterator)'' after defining
 # $(o-iterator-doit) to produce some desired rule using $o for the object
 # suffix, and setting $(object-suffixes-left) to $(object-suffixes); a copy
@@ -94,7 +78,7 @@ vpath %.x $(subst $(empty) ,:,$(strip $(common-objpfx) $(objpfx) \
 # being included individually by a subdir makefile (hurd/Makefile needs this).
 in-Makerules := yes
 
-sysdep-makefiles := $(wildcard $(full_config_sysdirs:=/Makefile))
+sysdep-makefiles := $(wildcard $(sysdirs:=/Makefile))
 ifneq (,$(sysdep-makefiles))
 include $(sysdep-makefiles)
 endif
@@ -229,20 +213,22 @@ endef
 close-check-inhibit-asm = ;; esac ;
 endif
 
--include $(+sysdir_pfx)sysd-rules
+-include $(common-objpfx)sysd-rules
 ifneq ($(sysd-rules-sysdirs),$(config-sysdirs))
 # The value of $(+sysdep_dirs) the sysd-rules was computed for
 # differs from the one we are using now.  So force a rebuild of sysd-rules.
 sysd-rules-force = FORCE
 FORCE:
 endif
-$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
-			  $(wildcard $(foreach dir,$(sysdirs),\
-					       $(dir)/Makefile))\
-			  $(sysd-rules-force)
+$(common-objpfx)sysd-rules: $(common-objpfx)config.make $(..)Makerules \
+			    $(sysdep-makefiles) $(sysd-rules-force)
 	-@rm -f $@T
 	(echo 'sysd-rules-sysdirs := $(config-sysdirs)';		      \
-	 for dir in $(config-sysdirs:%='$$(..)%'); do			      \
+	 for dir in $(config-sysdirs); do				      \
+	   case "$$dir" in						      \
+	   /*) ;;							      \
+	   *) dir="\$$(..)$$dir" ;;					      \
+	   esac;							      \
 	   for o in $(all-object-suffixes); do \
 	     $(open-check-inhibit-asm) \
 	     echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \
@@ -340,7 +326,7 @@ postclean-generated += sysd-versions Versions.all abi-versions.h \
 		       Versions.def.v.i Versions.def.v Versions.v.i Versions.v
 
 ifndef avoid-generated
-ifneq ($(sysd-versions-subdirs),$(all-subdirs) $(config-sysdirs))
+ifneq ($(sysd-versions-subdirs),$(sorted-subdirs) $(config-sysdirs))
 sysd-versions-force = FORCE
 FORCE:
 endif
@@ -358,14 +344,14 @@ $(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
 	} | LC_ALL=C $(AWK) -f $< > $@T
 	mv -f $@T $@
 # See %.v/%.v.i implicit rules in Makeconfig.
-$(common-objpfx)Versions.v.i: $(wildcard $(all-subdirs:%=$(..)%/Versions)) \
+$(common-objpfx)Versions.v.i: $(wildcard $(subdirs:%=$(..)%/Versions)) \
 			      $(wildcard $(sysdirs:%=%/Versions)) \
 			      $(common-objpfx)abi-versions.h \
 			      $(sysd-versions-force)
 $(common-objpfx)sysd-versions: $(common-objpfx)Versions.all \
 			       $(common-objpfx)Versions.v \
 			       $(..)scripts/versions.awk
-	( echo 'sysd-versions-subdirs = $(all-subdirs) $(config-sysdirs)' ; \
+	( echo 'sysd-versions-subdirs = $(subdirs) $(config-sysdirs)' ; \
 	  cat $(word 2,$^) \
 	  | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
 			    -v move_if_change='$(move-if-change)' \
@@ -1301,18 +1287,12 @@ endif
 
 endif
 
-# There's no good place to put this - here will do.
-ifeq ($(filter %posix, $(sysdirs)),)
-L_tmpnam  = 1
-TMP_MAX   = 0
-L_ctermid = 1
-L_cuserid = 1
-else
-L_tmpnam  = 20
-TMP_MAX   = 238328
-L_ctermid = 9
-L_cuserid = 9
-endif
+# These will have been set by sysdeps/posix/Makefile.
+L_tmpnam  ?= 1
+TMP_MAX   ?= 0
+L_ctermid ?= 1
+L_cuserid ?= 1
+
 stdio_lim = $(common-objpfx)bits/stdio_lim.h
 
 $(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
diff --git a/Rules b/Rules
index 74b80e85ed..5ace24cee0 100644
--- a/Rules
+++ b/Rules
@@ -27,7 +27,7 @@ endif
 
 all: # Don't let the default goal come from Makeconfig.
 
-include ../Makeconfig
+include $(firstword $(..) ../)Makeconfig
 
 ifndef	subdir
 Each subdirectory makefile must define the `subdir' variable.
@@ -65,7 +65,7 @@ endif
 # See below.  This must be set before Makerules processes it.
 before-compile += $(common-objpfx)bits/stdio_lim.h
 
-include ../Makerules
+include $(..)Makerules
 
 .PHONY: subdir_lib
 subdir_lib: lib-noranlib
diff --git a/config.make.in b/config.make.in
index 871c5d60de..292dea667b 100644
--- a/config.make.in
+++ b/config.make.in
@@ -88,6 +88,8 @@ build-omitfp = @omitfp@
 build-bounded = @bounded@
 build-static-nss = @static_nss@
 add-ons = @add_ons@
+add-on-subdirs = @add_on_subdirs@
+sysdeps-add-ons = @sysdeps_add_ons@
 cross-compiling = @cross_compiling@
 force-install = @force_install@
 
diff --git a/configure b/configure
index 57fc703459..e1f8ec36be 100755
--- a/configure
+++ b/configure
@@ -313,7 +313,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine submachine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -891,7 +891,6 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-gmp=DIRECTORY    find GMP source code in DIRECTORY (not needed)
   --with-gd=DIR           find libgd include dir and library with prefix DIR
   --with-gd-include=DIR   find libgd include files in DIR
   --with-gd-lib=DIR       find libgd library files in DIR
@@ -1406,22 +1405,6 @@ fi
 # This will get text that should go into config.make.
 config_vars=
 
-# Check for a --with-gmp argument and set gmp-srcdir in config.make.
-
-# Check whether --with-gmp or --without-gmp was given.
-if test "${with_gmp+set}" = set; then
-  withval="$with_gmp"
-
-case "$with_gmp" in
-yes) { { echo "$as_me:$LINENO: error: --with-gmp requires an argument; use --with-gmp=DIRECTORY" >&5
-echo "$as_me: error: --with-gmp requires an argument; use --with-gmp=DIRECTORY" >&2;}
-   { (exit 1); exit 1; }; } ;;
-''|no) ;;
-*) config_vars="$config_vars
-gmp-srcdir = $withval" ;;
-esac
-
-fi;
 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
 
 # Check whether --with-gd or --without-gd was given.
@@ -1618,15 +1601,9 @@ fi
 # Check whether --enable-add-ons or --disable-add-ons was given.
 if test "${enable_add_ons+set}" = set; then
   enableval="$enable_add_ons"
-  case "$enableval" in
-    yes) add_ons=`cd $srcdir && echo */configure | sed -e 's!/configure!!g'`
-	 add_ons_automatic=yes
-	 test "$add_ons" = "*" && add_ons= ;;
-    *) add_ons=`echo "$enableval" | sed 's/,/ /g'`
-       add_ons_automatic=no ;;
-   esac
+
 else
-  add_ons= add_ons_automatic=no
+  enable_add_ons=yes
 fi;
 
 
@@ -1844,7 +1821,7 @@ echo "$as_me: error: --with-cpu requires an argument" >&2;}
 fi;
 
 
-# An add-on can set this when it the tuple to disable the sanity check below.
+# An add-on can set this when it wants to disable the sanity check below.
 libc_config_ok=no
 
 
@@ -1852,6 +1829,18 @@ libc_config_ok=no
 subdirs="$subdirs "
 
 
+case "$enable_add_ons" in
+''|no) add_ons= ;;
+yes|'*')
+ add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
+	  sed 's@/[^/]*$@@' | sort | uniq`
+	 add_ons_automatic=yes
+	 ;;
+*) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
+       add_ons_automatic=no ;;
+esac
+
+configured_add_ons=
 add_ons_sfx=
 add_ons_pfx=
 if test x"$add_ons" != x; then
@@ -1885,13 +1874,6 @@ echo "$as_me: error:
    { (exit 1); exit 1; }; }
     ;;
     esac
-
-    # Test whether such a subdir really exists.
-    test -d $srcdir/$f || {
-      { { echo "$as_me:$LINENO: error: add-on directory \"$f\" does not exist" >&5
-echo "$as_me: error: add-on directory \"$f\" does not exist" >&2;}
-   { (exit 1); exit 1; }; }
-    }
   done
 
   # Now source each add-on's configure fragment.
@@ -1901,19 +1883,81 @@ echo "$as_me: error: add-on directory \"$f\" does not exist" >&2;}
   # whether it goes into the list to be actually used in the build.
   use_add_ons=
   for libc_add_on in $add_ons; do
-    libc_add_on_frag=$srcdir/$libc_add_on/configure
-    if test -r $libc_add_on_frag; then
-      echo "$as_me:$LINENO: result: running configure fragment for add-on $libc_add_on" >&5
-echo "${ECHO_T}running configure fragment for add-on $libc_add_on" >&6
-      . $libc_add_on_frag
-    else
-      { echo "$as_me:$LINENO: WARNING: add-on fragment $libc_add_on_frag missing" >&5
-echo "$as_me: WARNING: add-on fragment $libc_add_on_frag missing" >&2;}
+    # Test whether such a directory really exists.
+    # It can be absolute, or relative to $srcdir, or relative to the build dir.
+    case "$libc_add_on" in
+    /*)
+      libc_add_on_srcdir=$libc_add_on
+      ;;
+    *)
+      test -d "$srcdir/$libc_add_on" || {
+        if test -d "$libc_add_on"; then
+	  libc_add_on="`pwd`/$libc_add_on"
+	else
+	  { { echo "$as_me:$LINENO: error: add-on directory \"$libc_add_on\" does not exist" >&5
+echo "$as_me: error: add-on directory \"$libc_add_on\" does not exist" >&2;}
+   { (exit 1); exit 1; }; }
+	fi
+      }
+      libc_add_on_srcdir=$srcdir/$libc_add_on
+      ;;
+    esac
+
+    libc_add_on_frag=$libc_add_on_srcdir/configure
+    libc_add_on_canonical=
+    if test -r "$libc_add_on_frag"; then
+      { echo "$as_me:$LINENO: running configure fragment for add-on $libc_add_on" >&5
+echo "$as_me: running configure fragment for add-on $libc_add_on" >&6;}
+      libc_add_on_canonical=unknown
+      libc_add_on_subdirs=
+      . "$libc_add_on_frag"
+      test -z "$libc_add_on" || {
+        configured_add_ons="$configured_add_ons $libc_add_on"
+	if test "x$libc_add_on_canonical" = xunknown; then
+	  { { echo "$as_me:$LINENO: error: fragment must set \$libc_add_on_canonical" >&5
+echo "$as_me: error: fragment must set \$libc_add_on_canonical" >&2;}
+   { (exit 1); exit 1; }; }
+	fi
+	for d in $libc_add_on_subdirs; do
+	  case "$libc_add_on" in
+	  /*) subdir_srcdir="$libc_add_on" ;;
+	  *) subdir_srcdir="\$(..)$libc_add_on" ;;
+	  esac
+	  case "$d" in
+	  .)
+	    d="${libc_add_on_canonical:-$libc_add_on}"
+	    ;;
+	  /*)
+	    subdir_srcdir="$d"
+	    ;;
+	  *)
+	    subdir_srcdir="$subdir_srcdir/$d"
+	    ;;
+	  esac
+	  d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
+	  add_on_subdirs="$add_on_subdirs $d"
+	  test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
+$d-srcdir = $subdir_srcdir"
+	done
+      }
     fi
     if test -n "$libc_add_on"; then
+      if frags=`ls -d $libc_add_on_srcdir/sysdeps/*/preconfigure 2> /dev/null`
+      then
+	echo "$as_me:$LINENO: checking add-on $libc_add_on for preconfigure fragments" >&5
+echo $ECHO_N "checking add-on $libc_add_on for preconfigure fragments... $ECHO_C" >&6
+	for frag in $frags; do
+	  name=`echo "$frag" | sed 's@/[^/]*$@@;s@^.*/@@'`
+	  echo $ECHO_N "$name $ECHO_C" >&6
+	  . "$frag"
+	done
+	echo "$as_me:$LINENO: result: " >&5
+echo "${ECHO_T}" >&6
+      fi
       use_add_ons="$use_add_ons $libc_add_on"
       add_ons_pfx="$add_ons_pfx $libc_add_on/"
-      add_ons_sfx="$add_ons_sfx /$libc_add_on"
+      test -z "$libc_add_on_canonical" ||
+      add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
     fi
   done
   # Use echo to strip excess whitespace.
@@ -1922,6 +1966,7 @@ fi
 
 
 
+
 ###
 ### I put this here to prevent those annoying emails from people who cannot
 ### read and try to compile glibc on unsupported platforms.  --drepper
@@ -2065,8 +2110,8 @@ done
 
 
 # Find what sysdep directories exist.
+sysnames_add_ons=
 sysnames=
-IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 for b in $base ''; do
   for m0 in $mach ''; do
     for v in /$vendor ''; do
@@ -2076,17 +2121,27 @@ for b in $base ''; do
 	for m in $mach ''; do
 	  for d in $add_ons_pfx ''; do
 	    for a in $add_ons_sfx ''; do
-	      if test "$m0$m0sub$b$v$o$m$msub"; then
+	      if test -n "$m0$m0sub$b$v$o$m$msub"; then
+	        try_srcdir="${srcdir}/"
+	        case "$d" in
+		/*) try_srcdir= ;;
+		esac
 		try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
 		test -n "$enable_debug_configure" &&
 		echo "$0 DEBUG: try $try" >&2
-		if test -d $srcdir/$try; then
+		if test -d "$try_srcdir$try"; then
 		  sysnames="$sysnames $try"
 		  { test -n "$o" || test -n "$b"; } && os_used=t
 		  { test -n "$m" || test -n "$m0"; } && machine_used=t
 		  case x${m0:-$m} in
 		  x*/$submachine) submachine_used=t ;;
 		  esac
+		  if test -n "$d"; then
+		    case "$sysnames_add_ons" in
+		    *" $d "*) ;;
+		    *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
+		    esac
+		  fi
 		fi
 	      fi
 	    done
@@ -2096,19 +2151,6 @@ for b in $base ''; do
     done
   done
 done
-for d in $add_ons_pfx ''; do
-  for a in $add_ons_sfx ''; do
-    if test -n "$d" && test "$d" != "$a"; then
-      try="${d}sysdeps/generic${a}"
-      test -n "$enable_debug_configure" &&
-      echo "$0 DEBUG: try $try" >&2
-      if test -d $srcdir/$try; then
-	sysnames="$sysnames $try"
-      fi
-    fi
-  done
-done
-IFS="$ac_save_ifs"
 
 if test -z "$os_used" && test "$os" != none; then
   { { echo "$as_me:$LINENO: error: Operating system $os is not supported." >&5
@@ -2195,6 +2237,10 @@ while test $# -gt 0; do
 	then
 	  implied="$implied $try"
 	  found=yes
+	  case "$sysnames_add_ons" in
+	  *" $d "*) ;;
+	  *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
+	  esac
 	fi
       done
       if test $found = no; then
@@ -2234,6 +2280,65 @@ sysnames="$names $default_sysnames"
 echo "$as_me:$LINENO: result: $default_sysnames" >&5
 echo "${ECHO_T}$default_sysnames" >&6
 
+# Collect the list of add-ons that supply partial sysdeps trees.
+sysdeps_add_ons=
+for add_on in $add_ons; do
+  case "$add_on" in
+  /*) xsrcdir= ;;
+  *) xsrcdir="$srcdir/" ;;
+  esac
+
+  test -d "$xsrcdir$add_on/sysdeps" || {
+    case "$configured_add_ons " in
+    *" $add_on "*) ;;
+    *|'')
+      { { echo "$as_me:$LINENO: error: add-on $add_on has no configure fragment or sysdeps tree" >&5
+echo "$as_me: error: add-on $add_on has no configure fragment or sysdeps tree" >&2;}
+   { (exit 1); exit 1; }; }
+      ;;
+    esac
+    continue
+  }
+
+  sysdeps_add_ons="$sysdeps_add_ons $add_on"
+  case "$sysnames_add_ons" in
+  *" $add_on/ "*) ;;
+  *|'')
+    { echo "$as_me:$LINENO: WARNING: add-on $add_on contributed no sysdeps directories" >&5
+echo "$as_me: WARNING: add-on $add_on contributed no sysdeps directories" >&2;}
+    continue ;;
+  esac
+
+  found=no
+  for d in $sysnames; do
+    case "$d" in
+    $add_on/sysdeps/*) ;;
+    *) continue ;;
+    esac
+    (cd "$xsrcdir$d" && for f in *[!~]; do
+       case "$f" in
+       sys|bits)
+	 for ff in $f/*.h; do
+	   test -d "$ff" || { test -e "$ff" && exit 88; }
+	 done
+	 ;;
+       *)
+         test -d "$f" || { test -e "$f" && exit 88; }
+	 ;;
+       esac
+     done)
+    if test $? -eq 88; then
+      found=yes
+      break
+    fi
+  done
+  if test $found = no; then
+    { echo "$as_me:$LINENO: WARNING: add-on $add_on contributed no useful sysdeps directories" >&5
+echo "$as_me: WARNING: add-on $add_on contributed no useful sysdeps directories" >&2;}
+  fi
+done
+
+
 
 ### Locate tools.
 
@@ -7565,13 +7670,6 @@ if test $shared = default; then
   shared=$elf
 fi
 
-if test x"$libc_cv_idn" = xyes; then
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBIDN 1
-_ACEOF
-
-fi
-
 echo "$as_me:$LINENO: checking whether -fPIC is default" >&5
 echo $ECHO_N "checking whether -fPIC is default... $ECHO_C" >&6
 if test "${pic_default+set}" = set; then
@@ -8259,9 +8357,11 @@ s,@host_vendor@,$host_vendor,;t t
 s,@host_os@,$host_os,;t t
 s,@subdirs@,$subdirs,;t t
 s,@add_ons@,$add_ons,;t t
+s,@add_on_subdirs@,$add_on_subdirs,;t t
 s,@base_machine@,$base_machine,;t t
 s,@submachine@,$submachine,;t t
 s,@sysnames@,$sysnames,;t t
+s,@sysdeps_add_ons@,$sysdeps_add_ons,;t t
 s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
 s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
 s,@INSTALL_DATA@,$INSTALL_DATA,;t t
diff --git a/configure.in b/configure.in
index 6d91fcacea..c6b0e2c945 100644
--- a/configure.in
+++ b/configure.in
@@ -13,18 +13,6 @@ fi
 # This will get text that should go into config.make.
 config_vars=
 
-# Check for a --with-gmp argument and set gmp-srcdir in config.make.
-AC_ARG_WITH([gmp],
-            AC_HELP_STRING([--with-gmp=DIRECTORY],
-                           [find GMP source code in DIRECTORY (not needed)]),
-	    [
-case "$with_gmp" in
-yes) AC_MSG_ERROR([--with-gmp requires an argument; use --with-gmp=DIRECTORY]) ;;
-''|no) ;;
-*) config_vars="$config_vars
-gmp-srcdir = $withval" ;;
-esac
-])
 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
 AC_ARG_WITH([gd],
             AC_HELP_STRING([--with-gd=DIR],
@@ -186,15 +174,9 @@ fi
 dnl Generic infrastructure for drop-in additions to libc.
 AC_ARG_ENABLE([add-ons],
               AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
-                             [configure and build add-ons in DIR1,DIR2,...  search for add-ons if no parameter given]),
-  [case "$enableval" in
-    yes) add_ons=`cd $srcdir && echo */configure | sed -e 's!/configure!!g'`
-	 add_ons_automatic=yes
-	 test "$add_ons" = "*" && add_ons= ;;
-    *) add_ons=`echo "$enableval" | sed 's/,/ /g'`
-       add_ons_automatic=no ;;
-   esac],
-  [add_ons= add_ons_automatic=no])
+                             [configure and build add-ons in DIR1,DIR2,...
+                              search for add-ons if no parameter given]),
+			     , [enable_add_ons=yes])
 
 dnl Let the user avoid using TLS.  Don't know why but...
 AC_ARG_WITH([tls],
@@ -344,7 +326,7 @@ AC_ARG_WITH([cpu],
 ])
 
 
-# An add-on can set this when it the tuple to disable the sanity check below.
+# An add-on can set this when it wants to disable the sanity check below.
 libc_config_ok=no
 
 dnl Having this here, though empty, makes sure that if add-ons' fragments
@@ -352,6 +334,18 @@ dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
 dnl our AC_OUTPUT will actually use it.
 AC_CONFIG_SUBDIRS()
 
+case "$enable_add_ons" in
+''|no) add_ons= ;;
+yes|'*')
+ add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
+	  sed 's@/[[^/]]*$@@' | sort | uniq`
+	 add_ons_automatic=yes
+	 ;;
+*) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
+       add_ons_automatic=no ;;
+esac
+
+configured_add_ons=
 add_ons_sfx=
 add_ons_pfx=
 if test x"$add_ons" != x; then
@@ -373,11 +367,6 @@ if test x"$add_ons" != x; then
 *** \`localedata' add-on.])
     ;;
     esac
-
-    # Test whether such a subdir really exists.
-    test -d $srcdir/$f || {
-      AC_MSG_ERROR(add-on directory \"$f\" does not exist)
-    }
   done
 
   # Now source each add-on's configure fragment.
@@ -387,23 +376,81 @@ if test x"$add_ons" != x; then
   # whether it goes into the list to be actually used in the build.
   use_add_ons=
   for libc_add_on in $add_ons; do
-    libc_add_on_frag=$srcdir/$libc_add_on/configure
-    if test -r $libc_add_on_frag; then
-      AC_MSG_RESULT(running configure fragment for add-on $libc_add_on)
-      . $libc_add_on_frag
-    else
-      AC_MSG_WARN(add-on fragment $libc_add_on_frag missing)
+    # Test whether such a directory really exists.
+    # It can be absolute, or relative to $srcdir, or relative to the build dir.
+    case "$libc_add_on" in
+    /*)
+      libc_add_on_srcdir=$libc_add_on
+      ;;
+    *)
+      test -d "$srcdir/$libc_add_on" || {
+        if test -d "$libc_add_on"; then
+	  libc_add_on="`pwd`/$libc_add_on"
+	else
+	  AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
+	fi
+      }
+      libc_add_on_srcdir=$srcdir/$libc_add_on
+      ;;
+    esac
+
+    libc_add_on_frag=$libc_add_on_srcdir/configure
+    libc_add_on_canonical=
+    if test -r "$libc_add_on_frag"; then
+      AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
+      libc_add_on_canonical=unknown
+      libc_add_on_subdirs=
+      . "$libc_add_on_frag"
+      test -z "$libc_add_on" || {
+        configured_add_ons="$configured_add_ons $libc_add_on"
+	if test "x$libc_add_on_canonical" = xunknown; then
+	  AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
+	fi
+	for d in $libc_add_on_subdirs; do
+	  case "$libc_add_on" in
+	  /*) subdir_srcdir="$libc_add_on" ;;
+	  *) subdir_srcdir="\$(..)$libc_add_on" ;;
+	  esac
+	  case "$d" in
+	  .)
+	    d="${libc_add_on_canonical:-$libc_add_on}"
+	    ;;
+	  /*)
+	    subdir_srcdir="$d"
+	    ;;
+	  *)
+	    subdir_srcdir="$subdir_srcdir/$d"
+	    ;;
+	  esac
+	  d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
+	  add_on_subdirs="$add_on_subdirs $d"
+	  test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
+$d-srcdir = $subdir_srcdir"
+	done
+      }
     fi
     if test -n "$libc_add_on"; then
+      if frags=`ls -d $libc_add_on_srcdir/sysdeps/*/preconfigure 2> /dev/null`
+      then
+	AC_MSG_CHECKING(add-on $libc_add_on for preconfigure fragments)
+	for frag in $frags; do
+	  name=`echo "$frag" | sed 's@/[[^/]]*$@@;s@^.*/@@'`
+	  echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
+	  . "$frag"
+	done
+	AC_MSG_RESULT()
+      fi
       use_add_ons="$use_add_ons $libc_add_on"
       add_ons_pfx="$add_ons_pfx $libc_add_on/"
-      add_ons_sfx="$add_ons_sfx /$libc_add_on"
+      test -z "$libc_add_on_canonical" ||
+      add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
     fi
   done
   # Use echo to strip excess whitespace.
   add_ons="`echo $use_add_ons`"
 fi
 AC_SUBST(add_ons)
+AC_SUBST(add_on_subdirs)
 
 
 ###
@@ -552,8 +599,8 @@ dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
 changequote([,])dnl
 
 # Find what sysdep directories exist.
+sysnames_add_ons=
 sysnames=
-IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
 for b in $base ''; do
   for m0 in $mach ''; do
     for v in /$vendor ''; do
@@ -563,17 +610,27 @@ for b in $base ''; do
 	for m in $mach ''; do
 	  for d in $add_ons_pfx ''; do
 	    for a in $add_ons_sfx ''; do
-	      if test "$m0$m0sub$b$v$o$m$msub"; then
+	      if test -n "$m0$m0sub$b$v$o$m$msub"; then
+	        try_srcdir="${srcdir}/"
+	        case "$d" in
+		/*) try_srcdir= ;;
+		esac
 		try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
 		test -n "$enable_debug_configure" &&
 		echo "$0 [DEBUG]: try $try" >&2
-		if test -d $srcdir/$try; then
+		if test -d "$try_srcdir$try"; then
 		  sysnames="$sysnames $try"
 		  { test -n "$o" || test -n "$b"; } && os_used=t
 		  { test -n "$m" || test -n "$m0"; } && machine_used=t
 		  case x${m0:-$m} in
 		  x*/$submachine) submachine_used=t ;;
 		  esac
+		  if test -n "$d"; then
+		    case "$sysnames_add_ons" in
+		    *" $d "*) ;;
+		    *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
+		    esac
+		  fi
 		fi
 	      fi
 	    done
@@ -583,19 +640,6 @@ for b in $base ''; do
     done
   done
 done
-for d in $add_ons_pfx ''; do
-  for a in $add_ons_sfx ''; do
-    if test -n "$d" && test "$d" != "$a"; then
-      try="${d}sysdeps/generic${a}"
-      test -n "$enable_debug_configure" &&
-      echo "$0 DEBUG: try $try" >&2
-      if test -d $srcdir/$try; then
-	sysnames="$sysnames $try"
-      fi
-    fi
-  done
-done
-IFS="$ac_save_ifs"
 
 if test -z "$os_used" && test "$os" != none; then
   AC_MSG_ERROR(Operating system $os is not supported.)
@@ -676,6 +720,10 @@ while test $# -gt 0; do
 	then
 	  implied="$implied $try"
 	  found=yes
+	  case "$sysnames_add_ons" in
+	  *" $d "*) ;;
+	  *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
+	  esac
 	fi
       done
       if test $found = no; then
@@ -715,6 +763,61 @@ AC_SUBST(sysnames)
 # The other names were emitted during the scan.
 AC_MSG_RESULT($default_sysnames)
 
+# Collect the list of add-ons that supply partial sysdeps trees.
+sysdeps_add_ons=
+for add_on in $add_ons; do
+  case "$add_on" in
+  /*) xsrcdir= ;;
+  *) xsrcdir="$srcdir/" ;;
+  esac
+
+  test -d "$xsrcdir$add_on/sysdeps" || {
+    case "$configured_add_ons " in
+    *" $add_on "*) ;;
+    *|'')
+      AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
+      ;;
+    esac
+    continue
+  }
+
+  sysdeps_add_ons="$sysdeps_add_ons $add_on"
+  case "$sysnames_add_ons" in
+  *" $add_on/ "*) ;;
+  *|'')
+    AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
+    continue ;;
+  esac
+
+  found=no
+  for d in $sysnames; do
+    case "$d" in
+    $add_on/sysdeps/*) ;;
+    *) continue ;;
+    esac
+    (cd "$xsrcdir$d" && for f in *[[!~]]; do
+       case "$f" in
+       sys|bits)
+	 for ff in $f/*.h; do
+	   test -d "$ff" || { test -e "$ff" && exit 88; }
+	 done
+	 ;;
+       *)
+         test -d "$f" || { test -e "$f" && exit 88; }
+	 ;;
+       esac
+     done)
+    if test $? -eq 88; then
+      found=yes
+      break
+    fi
+  done
+  if test $found = no; then
+    AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
+  fi
+done
+AC_SUBST(sysdeps_add_ons)
+
 
 ### Locate tools.
 
@@ -2026,10 +2129,6 @@ if test $shared = default; then
   shared=$elf
 fi
 
-if test x"$libc_cv_idn" = xyes; then
-  AC_DEFINE(HAVE_LIBIDN)
-fi
-
 AC_CACHE_CHECK([whether -fPIC is default], pic_default,
 [pic_default=yes
 cat > conftest.c <<EOF
diff --git a/csu/Makefile b/csu/Makefile
index 550dc2983c..54af0d6662 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -1,5 +1,5 @@
 # Makefile for csu code for GNU C library.
-# Copyright (C) 1995-2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1995-2004, 2005, 2006 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
@@ -95,7 +95,7 @@ $(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h
 
 CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions $(fno-unit-at-a-time)
 
-vpath initfini.c $(full_config_sysdirs)
+vpath initfini.c $(sysdirs)
 
 $(objpfx)initfini.s: initfini.c $(before-compile)
 	$(compile.c) -S $(CFLAGS-initfini.s) -finhibit-size-directive \
@@ -200,8 +200,7 @@ $(objpfx)abi-tag.h: $(..)abi-tags
 	if test -r $@.new; then mv -f $@.new $@; \
 	else echo >&2 'This configuration not matched in $<'; exit 1; fi
 
-all-Banner-files = $(wildcard $(addsuffix /Banner, \
-					$(addprefix $(..), $(subdirs))))
+all-Banner-files = $(wildcard $(addsuffix /Banner,$(subdir-srcdirs)))
 $(objpfx)version-info.h: $(common-objpfx)config.make $(all-Banner-files)
 	$(make-target-directory)
 	(case $(config-os) in \
diff --git a/hurd/Depend b/hurd/Depend
new file mode 100644
index 0000000000..b108b245b8
--- /dev/null
+++ b/hurd/Depend
@@ -0,0 +1,9 @@
+# This file says that the mach subdirectory should appear before this one.
+# The mach and hurd subdirectories have many generated header files which
+# much of the rest of the library depends on, so it is best to build them
+# first (and mach before hurd, at that).  The before-compile additions in
+# sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
+# not to exist when making in other directories, but it will be slower that
+# way with more somewhat expensive `make' invocations.
+
+mach
diff --git a/libidn/Makefile b/libidn/Makefile
index 3d2ef5ef9b..3a4d1b3422 100644
--- a/libidn/Makefile
+++ b/libidn/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006 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
@@ -31,10 +31,10 @@ libcidn-routines := punycode toutf8 nfkc stringprep rfc3454 profiles idna \
 		    iconvme
 
 
-include ../Makeconfig
+include $(..)Makeconfig
 
 libcidn-inhibit-o = $(filter-out .os,$(object-suffixes))
 
-include ../Rules
+include $(..)Rules
 
 $(objpfx)libcidn.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
diff --git a/libidn/configure b/libidn/configure
index 52ddb3fc26..365e747df2 100644
--- a/libidn/configure
+++ b/libidn/configure
@@ -1,5 +1,8 @@
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
 
+libc_add_on_canonical=
+libc_add_on_subdirs=.
+
 # Get this defined in config.h for main source code to test.
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_LIBIDN 1
diff --git a/libidn/configure.in b/libidn/configure.in
index bafa3555ef..38b9ad7fac 100644
--- a/libidn/configure.in
+++ b/libidn/configure.in
@@ -1,5 +1,8 @@
 dnl glibc configure fragment for libidn add-on
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 
+libc_add_on_canonical=
+libc_add_on_subdirs=.
+
 # Get this defined in config.h for main source code to test.
 AC_DEFINE([HAVE_LIBIDN])
diff --git a/math/Makefile b/math/Makefile
index b45283d8fc..1ab1b13b07 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -108,7 +108,7 @@ generated += $(libm-tests-generated) libm-test.stmp
 # This is needed for dependencies
 before-compile += $(objpfx)libm-test.c
 
-ulps-file = $(firstword $(wildcard $(config-sysdirs:%=$(..)%/libm-test-ulps)))
+ulps-file = $(firstword $(wildcard $(sysdirs:%=%/libm-test-ulps)))
 
 $(addprefix $(objpfx), $(libm-tests-generated)): $(objpfx)libm-test.stmp
 
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 8881c8d487..b4c320890f 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,33 @@
+2006-02-27  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/pthread/Subdirs: List nptl here too.
+	* configure (libc_add_on_canonical): New variable.
+
+	* sysdeps/unix/sysv/linux/sh/sh4/lowlevellock.h: Use #include_next.
+
+	* sysdeps/unix/sysv/linux/sleep.c: Use #include_next after #include of
+	self to get main source tree's file.
+	* sysdeps/unix/sysv/linux/alpha/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/vfork.S: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/clone2.S: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/vfork.S: Likewise.
+
+	* Makefile: Use $(sysdirs) in vpath directive.
+
+	* sysdeps/pthread/Makefile (CFLAGS-libc-start.c): Variable removed.
+	(CPPFLAGS-timer_routines.c): Likewise.
+
+	* Makeconfig (includes): Variable removed.
+
 2006-02-26  Roland McGrath  <roland@redhat.com>
 
 	* sysdeps/generic/pt-raise.c: Moved to ...
diff --git a/nptl/Makeconfig b/nptl/Makeconfig
index 681d76f61f..54e2f65b01 100644
--- a/nptl/Makeconfig
+++ b/nptl/Makeconfig
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2002,2003,2005,2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -28,7 +28,3 @@ static-thread-library = $(common-objpfx)nptl/libpthread.a
 bounded-thread-library = $(common-objpfx)nptl/libpthread_b.a
 
 rpath-dirs += nptl
-
-ifneq ($(subdir),nptl)
-includes += -I$(..)nptl
-endif
diff --git a/nptl/Makefile b/nptl/Makefile
index e484c6ab61..fff33eaf54 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -528,7 +528,7 @@ $(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
 endif
 
 ifeq ($(build-shared),yes)
-vpath pt-initfini.c $(full_config_sysdirs)
+vpath pt-initfini.c $(sysdirs)
 
 $(objpfx)pt-initfini.s: pt-initfini.c
 	$(compile.c) -S $(CFLAGS-pt-initfini.s) -finhibit-size-directive \
diff --git a/nptl/configure b/nptl/configure
index 3ad635f48d..1ce3caec6e 100644
--- a/nptl/configure
+++ b/nptl/configure
@@ -1,6 +1,5 @@
-# This is only to keep the GNU C library configure mechanism happy.
 # This is a shell script fragment sourced by the main configure script.
-# We have nothing we need to add here.
-#
-# Perhaps some day we will need a real configuration script for different
-# kernel versions or so.
+# We're obliged to give here the canonical name that will be used to
+# as a subdirectory to search for in other add-ons' sysdeps trees.
+
+libc_add_on_canonical=nptl
diff --git a/nptl/sysdeps/pthread/Makefile b/nptl/sysdeps/pthread/Makefile
index 207e10fad2..72550d74a7 100644
--- a/nptl/sysdeps/pthread/Makefile
+++ b/nptl/sysdeps/pthread/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002,2003,2004,2006 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -18,7 +18,6 @@
 # 02111-1307 USA.
 
 ifeq ($(subdir),csu)
-CFLAGS-libc-start.c += -I../nptl
 routines += unwind-resume
 shared-only-routines += unwind-resume
 CFLAGS-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables
@@ -31,7 +30,6 @@ endif
 ifeq ($(subdir),rt)
 librt-sysdep_routines += timer_routines librt-cancellation rt-unwind-resume
 librt-shared-only-routines += rt-unwind-resume
-CPPFLAGS-timer_routines.c = -I../nptl
 CFLAGS-librt-cancellation.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-rt-unwind-resume.c += -fexceptions -fasynchronous-unwind-tables
 
diff --git a/nptl/sysdeps/pthread/Subdirs b/nptl/sysdeps/pthread/Subdirs
index 4d1f4d876b..36266c1e69 100644
--- a/nptl/sysdeps/pthread/Subdirs
+++ b/nptl/sysdeps/pthread/Subdirs
@@ -1 +1,2 @@
+nptl
 nptl_db
diff --git a/nptl/sysdeps/unix/sysv/linux/alpha/clone.S b/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
index eea1cbeed1..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/alpha/clone.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/alpha/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/clone.S b/nptl/sysdeps/unix/sysv/linux/i386/clone.S
index 95c17f18e4..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/clone.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/i386/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/vfork.S b/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
index 52336102c7..37f0842051 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/vfork.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2002,2004,2006 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
@@ -16,10 +16,17 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <tcb-offsets.h>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <vfork.S>
+#else
+
+# include <tcb-offsets.h>
 
 /* Save the PID value.  */
-#define SAVE_PID \
+# define SAVE_PID \
 	movl	%gs:PID, %edx; 						      \
 	movl	%edx, %eax;						      \
 	negl	%eax;							      \
@@ -28,11 +35,11 @@
 1:	movl	%eax, %gs:PID
 
 /* Restore the old PID value in the parent.  */
-#define RESTORE_PID \
+# define RESTORE_PID \
 	testl	%eax, %eax;						      \
 	je	1f;							      \
 	movl	%edx, %gs:PID;						      \
 1:
 
-
-#include <sysdeps/unix/sysv/linux/i386/vfork.S>
+# include_next <vfork.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S b/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S
index 8664056f27..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/ia64/clone2.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
index e19579e842..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S
@@ -1,3 +1,9 @@
-#define RESET_PID
-#include <tcb-offsets.h>
-#include <sysdeps/unix/sysv/linux/powerpc/powerpc32/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
index f87adf4737..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
@@ -1,3 +1,9 @@
-#define RESET_PID
-#include <tcb-offsets.h>
-#include <sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-32/clone.S b/nptl/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
index 682f94dae8..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-32/clone.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/s390/s390-32/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/clone.S b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
index 87ee2e1846..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/clone.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/s390/s390-64/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/clone.S b/nptl/sysdeps/unix/sysv/linux/sh/clone.S
index 62a11972d8..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/clone.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/sh/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/sh4/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/sh/sh4/lowlevellock.h
index 8cdcac5560..90be7bd8d0 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/sh4/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/sh4/lowlevellock.h
@@ -1,4 +1,4 @@
 /*  4 instruction cycles not accessing cache and TLB are needed after
     trapa instruction to avoid an SH-4 silicon bug.  */
 #define NEED_SYSCALL_INST_PAD
-#include <sysdeps/unix/sysv/linux/sh/lowlevellock.h>
+#include_next <lowlevellock.h>
diff --git a/nptl/sysdeps/unix/sysv/linux/sleep.c b/nptl/sysdeps/unix/sysv/linux/sleep.c
index c56b49b39f..2dce3210ca 100644
--- a/nptl/sysdeps/unix/sysv/linux/sleep.c
+++ b/nptl/sysdeps/unix/sysv/linux/sleep.c
@@ -1,2 +1,10 @@
-#include <nptl/pthreadP.h>
-#include <sysdeps/unix/sysv/linux/sleep.c>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <sleep.c>
+#else
+/* This defines the CANCELLATION_P macro, which sleep.c checks for.  */
+# include <pthreadP.h>
+# include_next <sleep.c>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
index da6197c00d..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/sparc/sparc32/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
index 410f32017a..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/sparc/sparc64/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S b/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
index dfa6adb3e2..675a997e97 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/clone.S
@@ -1,2 +1,9 @@
-#define RESET_PID
-#include <sysdeps/unix/sysv/linux/x86_64/clone.S>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <clone.S>
+#else
+# define RESET_PID
+# include_next <clone.S>
+#endif
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S b/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
index f68d40439e..9a9912ca85 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/vfork.S
@@ -16,9 +16,16 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <tcb-offsets.h>
+/* We want an #include_next, but we are the main source file.
+   So, #include ourselves and in that incarnation we can use #include_next.  */
+#ifndef INCLUDED_SELF
+# define INCLUDED_SELF
+# include <vfork.S>
+#else
 
-#define SAVE_PID \
+# include <tcb-offsets.h>
+
+# define SAVE_PID \
 	movl	%fs:PID, %esi;						      \
 	movl	$0x80000000, %ecx;					      \
 	movl	%esi, %edx;						      \
@@ -26,10 +33,11 @@
 	cmove	%ecx, %edx;						      \
 	movl	%edx, %fs:PID
 
-#define RESTORE_PID \
+# define RESTORE_PID \
 	testq	%rax, %rax;						      \
 	je	1f;							      \
 	movl	%esi, %fs:PID;						      \
 1:
 
-#include <sysdeps/unix/sysv/linux/x86_64/vfork.S>
+# include_next <vfork.S>
+#endif
diff --git a/scripts/gen-sorted.awk b/scripts/gen-sorted.awk
index a943df6d2f..0092fe61d1 100755
--- a/scripts/gen-sorted.awk
+++ b/scripts/gen-sorted.awk
@@ -5,23 +5,101 @@
 # Written by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
 BEGIN {
-  cnt = 0
+  cnt = split(subdirs, all) + 1
   dnt = 0
 }
+
+# Let input files have comments.
+{ sub(/[ 	]*#.*$/, "") }
+NF == 0 { next }
+
 {
-  if ($1 ~ /depend/) {
-    from[dnt] = $2
-    to[dnt] = $3
-    ++dnt
-  } else {
-    all[cnt++] = $1
+  subdir = type = FILENAME;
+  sub(/^.*\//, "", type);
+  sub(/\/[^/]+$/, "", subdir);
+  sub(/^.*\//, "", subdir);
+  thisdir = "";
+}
+
+type == "Depend" && NF == 1 {
+  from[dnt] = subdir;
+  to[dnt] = $1;
+  ++dnt;
+  next
+}
+
+type == "Subdirs" && NF == 1 { thisdir = $1 }
+
+type == "Subdirs" && NF == 2 && $1 == "first" {
+  thisdir = $2;
+  # Make the first dir in the list depend on this one.
+  from[dnt] = all[1];
+  to[dnt] = thisdir;
+  ++dnt;
+}
+
+type == "Subdirs" && NF == 2 && $1 == "inhibit" {
+  inhibit[$2] = subdir;
+  next
+}
+
+type == "Subdirs" && thisdir {
+  all[cnt++] = thisdir;
+
+  if (FILENAME ~ (srcpfx ? /^\.\.\/sysdeps\// : /^sysdeps\//) \
+      || system("test -d " srcpfx thisdir) == 0) {
+    # This Subdirs file is in the main source tree,
+    # or this subdirectory exists in the main source tree.
+    this_srcdir = srcpfx thisdir
+  }
+  else {
+    # The Subdirs file comes from an add-on that should have the subdirectory.
+    dir = FILENAME;
+    do
+      sub(/\/[^/]+$/, "", dir);
+    while (dir !~ /\/sysdeps$/);
+    sub(/\/sysdeps$/, "", dir);
+    if (system("test -d " dir "/" thisdir) == 0)
+      dir = dir "/" thisdir;
+    else {
+      sub(/\/[^/]+$/, "", dir);
+      if (system("test -d " dir "/" thisdir) == 0)
+        dir = dir "/" thisdir;
+      else {
+	print FILENAME ":" FNR ":", "cannot find", thisdir > "/dev/stderr";
+	exit 2
+      }
+    }
+    file = dir "/Depend";
+    if (srcpfx)
+      sub(/^\.\.\//, "", dir);
+    if (dir !~ /^\/.*$/)
+      dir = "$(..)" dir;
+    print thisdir "-srcdir", ":=", dir;
+  }
+  file = this_srcdir "/Depend";
+  if (system("test -f " file) == 0) {
+    ARGV[ARGC++] = file;
+    # Emit a dependency on the implicitly-read file.
+    if (srcpfx)
+      sub(/^\.\.\//, "", file);
+    if (file !~ /^\/.*$/)
+      file = "$(..)" file;
+    print "$(common-objpfx)sysd-sorted:", "$(wildcard", file ")";
   }
+  next
 }
+
+{
+  print FILENAME ":" FNR ":", "what type of file is this?" > "/dev/stderr";
+  exit 2
+}
+
 END {
   do {
     moved = 0
     for (i = 0; i < dnt; ++i) {
-      for (j = 0; j < cnt; ++j) {
+      for (j = 1; j < cnt; ++j) {
 	if (all[j] == from[i]) {
 	  for (k = j + 1; k < cnt; ++k) {
 	    if (all[k] == to[i]) {
@@ -42,11 +120,20 @@ END {
 	break
       }
     }
-  } while (moved)
+  } while (moved);
 
-  printf "sorted-subdirs = "
-  for (i = 0; i < cnt; ++i) {
-    printf "%s ", all[i];
+  # Make sure we list "elf" last.
+  saw_elf = 0;
+  printf "sorted-subdirs :=";
+  for (i = 1; i < cnt; ++i) {
+    if (all[i] in inhibit)
+      continue;
+    if (all[i] == "elf")
+      saw_elf = 1;
+    else
+      printf " %s", all[i];
   }
-  printf "\n"
+  printf "%s\n", saw_elf ? " elf" : "";
+
+  print "sysd-sorted-done := t"
 }
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 2690d5dd47..c857eac744 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -83,8 +83,7 @@ routines := $(strip $(routines) $(mpn-routines))	\
 	    dbl2mpn ldbl2mpn				\
 	    mpn2flt mpn2dbl mpn2ldbl
 aux += fpioconst mp_clz_tab
-distribute := $(distribute) $(mpn-headers) gen-mpn-copy fpioconst.h \
-	      tst-putenvmod.c
+distribute := $(distribute) $(mpn-headers) fpioconst.h tst-putenvmod.c
 
 tests-extras += tst-putenvmod
 extra-objs += tst-putenvmod.os
diff --git a/stdlib/gen-mpn-copy b/stdlib/gen-mpn-copy
deleted file mode 100644
index 01656ae54d..0000000000
--- a/stdlib/gen-mpn-copy
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-translations='
-sparc64		sparc/sparc64
-sparc32/v8	sparc/sparc8
-sparc32		sparc
-x86/pentium	i386/i586
-x86		i386
-m68k/mc68000	m68k/m68000
-m68k/mc68020	m68k/m68020
-m88k/mc88100	m88k/m88100
-m88k/mc88110	m88k/m88110
-mips3		mips/mips3
-mips2		mips
-hppa/hppa1_1	hppa/hppa1.1
-alpha/ev5	alpha/alphaev5
-power		rs6000
-am29000		a29k
-'
-
-set $translations
-while [ $# -ge 2 ]; do
-  gmp=$1 glibc=$2
-  shift; shift
-  echo 'mpn-found-1 := $(filter $(gmp-srcdir)/mpn/'$gmp'/%,$(mpn-found))
-mpn-copy-1 := $(patsubst $(gmp-srcdir)/mpn/'$gmp'/%,$(sysdep_dir)/'$glibc\
-'/%,$(mpn-found-1))
-mpn-found := $(filter-out $(mpn-found-1),$(mpn-found))
-mpn-copy-sysdep := $(mpn-copy-sysdep) $(mpn-copy-1)
-$(mpn-copy-1): $(sysdep_dir)/'$glibc'/%: \
-	       $(ignore gmp2glibc.sed) $(gmp-srcdir)/mpn/'$gmp'/%
-	$(gmp2glibc)'
-done
-
-exit 0
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index 2b3194f04a..5b9a0a56ed 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1996,1997,1998,1999,2001,2002,2003,2004, 2005
+# Copyright (C) 1996,1997,1998,1999,2001,2002,2003,2004,2005,2006
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -32,8 +32,7 @@ endif
 
 ifeq ($(subdir),stdio-common)
 
-errlist-c = $(firstword $(wildcard $(addsuffix /errlist.c, \
-						   $(full_config_sysdirs) .)))
+errlist-c = $(firstword $(wildcard $(addsuffix /errlist.c,$(sysdirs) .)))
 
 ifeq ($(versioning),yes)
 $(objpfx)errlist-compat.c: $(errlist-c) $(..)sysdeps/gnu/errlist-compat.awk \
@@ -47,8 +46,7 @@ endif
 	  $(CC) -S $(CPPFLAGS) $(CFLAGS) -DNOT_IN_libc -DEMIT_ERR_MAX $< -o - \
 	  | sed -n 's/^.*@@@[^0-9]*\([0-9]*\)[^0-9]*@@@.*$$/\1/p'` \
 	       -f $(..)sysdeps/gnu/errlist-compat.awk \
-	       $(wildcard $(patsubst %,$(..)%/Versions,\
-		 $(config-sysdirs) $(add-ons))) > $@T
+	       $(wildcard $(sysdirs:=/Versions)) > $@T
 # Make it unwritable so noone will edit it by mistake.
 	-chmod a-w $@T
 	mv -f $@T $@
@@ -59,7 +57,8 @@ $(objpfx)errlist-compat.h: $(objpfx)errlist-compat.c
 generated += errlist-compat.c errlist-compat.h
 
 # This will force the generation above to happy if need be.
-$(foreach o,.d $(object-suffixes),$(objpfx)errlist$o):$(objpfx)errlist-compat.h
+$(foreach o,$(object-suffixes) $(object-suffixes:=.d),\
+	  $(objpfx)errlist$o): $(objpfx)errlist-compat.h
 endif
 
 ifeq ($(subdir),login)
diff --git a/sysdeps/mach/Subdirs b/sysdeps/mach/Subdirs
index fc6ac35d83..24fa4a3c98 100644
--- a/sysdeps/mach/Subdirs
+++ b/sysdeps/mach/Subdirs
@@ -1 +1,9 @@
-mach
+# This file says that the mach subdirectory should appear before all others.
+# The mach and hurd subdirectories have many generated header files which
+# much of the rest of the library depends on, so it is best to build them
+# first (and mach before hurd, at that).  The before-compile additions in
+# sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
+# not to exist when making in other directories, but it will be slower that
+# way with more somewhat expensive `make' invocations.
+
+first mach
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index c9aa360cde..4ab06ba33e 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -305,9 +305,6 @@ generated += stub-syscalls.c
 endif
 endif
 
-export sysdirs
-export asm_CPP := $(COMPILE.S) -E -x assembler-with-cpp
-
 # This is the end of the pipeline for compiling the syscall stubs.
 # The stdin in assembler with cpp using sysdep.h macros.
 # Be sure to disable debugging info since it would all just say "<stdin>".
@@ -318,7 +315,9 @@ $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
 			       $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
 	for dir in $(+sysdep_dirs); do \
 	  test -f $$dir/syscalls.list && \
-	  { $(SHELL) $(dir $<)$(notdir $<) $$dir || exit 1; }; \
+	  { sysdirs='$(sysdirs)' \
+	    asm_CPP='$(COMPILE.S) -E -x assembler-with-cpp' \
+	    $(SHELL) $(dir $<)$(notdir $<) $$dir || exit 1; }; \
 	  test $$dir = $(..)sysdeps/unix && break; \
 	done > $@T
 	mv -f $@T $@